# Rel\_calib\_stack to response

**URL:** <https://discourse.obspy.org/t/rel-calib-stack-to-response/1654>\
**Category:** Uncategorized\
**Created:** [March 7, 2023, 12:58pm UTC](https://discourse.obspy.org/t/rel-calib-stack-to-response/1654 "2023-03-07T12:58:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fred\_Massin](https://discourse.obspy.org/user_avatar/discourse.obspy.org/fred_massin/32/250_2.png) [@Fred\_Massin](https://discourse.obspy.org/u/Fred_Massin)\
**Post date:** [March 7, 2023, 12:58pm UTC](https://discourse.obspy.org/t/rel-calib-stack-to-response/1654/1 "2023-03-07T12:58:04Z")

</div>

Hello

Can someone help to get from the output of [rel\_calib\_stack](https://docs.obspy.org/packages/autogen/obspy.signal.calibration.rel_calib_stack.html#obspy.signal.calibration.rel_calib_stack) to a `obspy.core.inventory.response.Response` that I can attach to a `obspy.core.inventory.channel` ?

Cheers

Fred

---

<div class="post-metadata">

**Author:** ![megies](https://discourse.obspy.org/user_avatar/discourse.obspy.org/megies/32/9_2.png) [@megies](https://discourse.obspy.org/u/megies)\
**Post date:** [March 9, 2023, 10:22am UTC](https://discourse.obspy.org/t/rel-calib-stack-to-response/1654/2 "2023-03-09T10:22:59Z")

</div>

You basically want to make a `Response` with one stage and that being a `ResponseListResponseStage` that has the list of freq-amp-phase pairs.  
Then you could probably then go one of two ways with that stage’s gain and the instrument sensitivity. You could be lazy and set it to 1 and use the values you got on these individual value pairs, or probably better you could use an actual proper value from your flat response part (assuming there is one) and then divide all original values for “amplitude” by that value for the individual pairs, so that all the value pairs have the amplitude relative to that overall sensitivity.

> **[obspy.core.inventory.response.ResponseListResponseStage — ObsPy...](https://docs.obspy.org/master/packages/autogen/obspy.core.inventory.response.ResponseListResponseStage.html)**

---

<div class="post-metadata">

**Author:** ![Isabel](https://discourse.obspy.org/user_avatar/discourse.obspy.org/isabel/32/915_2.png) [@Isabel](https://discourse.obspy.org/u/Isabel)\
**Post date:** [June 20, 2023, 4:09pm UTC](https://discourse.obspy.org/t/rel-calib-stack-to-response/1654/3 "2023-06-20T16:09:39Z")

</div>

> [@megies](#):
>
> You could be lazy and set it to 1 and use the values you got on these individual value pairs, or probably better you could use an actual proper value from your flat response part (assuming there is one) and then divide all original values for “amplitude” by that value for the individual pairs, so that all the value pairs have the amplitude relative to that overall sensitivity.

No matter how I define the instrument\_sensitivity when creating the Response, I will always get an error when trying to plot the response.

I have tried:  
_response = Response(resource\_id=None, instrument\_sensitivity=None, instrument\_polynomial=None, response\_stages=responseLS)_  
the same with: _instrument\_sensitivity=-170.0_ and _instrument\_sensitivity=InstrumentSensitivity(amp\_array, freq\_array,“PA”, “V”)_ where amp\_array and feq\_array are the same as in the defined response stage.  
To plot, I use: _response.plot(min\_freq=1, sampling\_rate=256e3)_  
Error message: _line 1544, in \_call\_eval\_resp\_for\_frequencies_

- gain\_blkt.gain = self.instrument\_sensitivity.value\*

---

<div class="post-metadata">

**Author:** ![megies](https://discourse.obspy.org/user_avatar/discourse.obspy.org/megies/32/9_2.png) [@megies](https://discourse.obspy.org/u/megies)\
**Post date:** [June 21, 2023, 8:02am UTC](https://discourse.obspy.org/t/rel-calib-stack-to-response/1654/4 "2023-06-21T08:02:02Z")

</div>

> [@Isabel](#):
>
> _instrument\_sensitivity=InstrumentSensitivity(amp\_array, freq\_array,“PA”, “V”)_ where amp\_array and feq\_array are the same as in the defined response stage.

Instrument sensitivity isn’t with arrays of values, it’s defined at one certain frequency. Also please keep it to your original ticket and not mix into this one which was resolved, thanks!  
Like I said in the other ticket, you’ll need phase values as well at these frequencies you listed.
