how to get PZ from stationXML inventory

Dear All,

I am trying to get PZ information from stationXML.
It is quite easy to read the station XML files with read_inventory, and to remove the response using the remove_response, but I would like to get the PZ coeffecient from the stationXML because I want to plot the sensor response.

In fact I would like to do something like getPAZ method in the Parser class in xseed, but fro the stationXML format.

Is there any existing solution ? I try Inventory.Response method, but It does not give me explicitly the PZ values :

Channel Response
    From None (None) to None (None)
    Overall Sensitivity: 1.25435e+11 defined at 1.000 Hz
    5 stages:
        Stage 1: PolesZerosResponseStage from M/S to V, gain: 1168.20
        Stage 2: CoefficientsTypeResponseStage from V to COUNTS, gain: 107374000.00
        Stage 3: FIRResponseStage from COUNTS to COUNTS, gain: 1.00
        Stage 4: FIRResponseStage from COUNTS to COUNTS, gain: 1.00
        Stage 5: FIRResponseStage from COUNTS to COUNTS, gain: 1.00

There is also the method "get_evalresp_response" but does not exactly give me the PZ values...only the frequency simulation of the equivalent filter....

Thanks in advance,

Best regards
Mickael.

Hi Mickael,

its fairly easy to assemble the PAZ dictionary from full inventory objects. You just have to extract the information from the correct response stages.

response = inv[0][0][0].response

Overall sensitivity:

response.instrument_sensitivity.value

PAZ are usually the first stage.

poles = response.response_stages[0].poles
zeros = response.response_stages[0].zeros
norm_fact = response.response_stages[0].normalization_factor
stage_gain = response.response_stages[0].stage_gain

I guess this is all that’s needed.

Hope it helps!

Lion

Hi Mickael,

both things you mentioned are already implemented in the master branch
of ObsPy (but not in latest stable release 0.9.2).

http://docs.obspy.org/master/packages/autogen/obspy.station.inventory.Inventory.plot_response.html

http://docs.obspy.org/master/packages/autogen/obspy.station.response.Response.get_paz.html

If switching to the developer version of ObsPy is not an option,
extracting the poles and zeros information should be pretty simple to
do, just have a look at this code:

https://github.com/obspy/obspy/blob/3b1e65ef27c4477ce7165e4e18a2a4f99bc3eb3a/obspy/station/response.py#L1280-L1335

best,
Tobias

Thanks Lion,

That's gives me good a solution.

Regards.

Mickaël LANGLAIS

Hi Tobias,

Thanks for this extra information.

When does the master branch will be released into stable ?

I try to take advantage of the response.py, but my python skills does not give me enough experience to include this file successfully. Any tips ?

Thanks in advance,

Mickaël LANGLAIS

Hi Mickael,

When does the master branch will be released into stable ?

no fixed date there, whenever we find time to tie up some loose ends..

I try to take advantage of the response.py, but my python skills does
not give me enough experience to include this file successfully. Any tips ?

I did not want to suggest that you should include that file.. just that
you can take some inspiration from the code pieces I highlighted in that
link..

best,
Tobias