Obspy plot vs matplotlib issue


I have normalized a dataset and saved it into a new file (basically, the data for each receiver should be less than 1). However, when I use file.plot() the amplitude that is being shown is nonsense:

this is while when I use the meta data to plot them using matplotlib, the results look logical:

I assume that I am missing something. Maybe, file.plot considers the instrument effect? I would appreciate it if anybody could help me with the issue.

I don’t think we have enough information about what you were doing and what you wanted to do to help right now. No plotting function itself will take instrument response into account by itself, you have to do an instrument correction to go from digital counts to physical units if that is what you want and then do the plotting afterwards.

Thank you for your response. To clarify, I have added the pieces of code that I have written:

Please take a look at the amplitude of the transformed data. Now, I want to plot the same figure, using matplotlib:

As is observable, the amplitude is between (-1,1), while it is much smaller when I used the plot function (As I said, I intentionally normalized the raw field data and saved them as " transformed").

Obspy multiplies the data with trace.stats.calib before plotting if the calib header is present. This might be the reason for the confusing behavior.

One solution would be to set the calib header to 1.

1 Like