# pressure decay filtering

So, I've been dealing with a series of pressure decay curves from a pressure transducer. Each one has a waterhammer effect as a consequence of shutting down pumps. Here are examples of 3 curves:

I'm using the scipy's signal.irr to obtain the coefficients and signal.filtfilt for filtering. Here are my parameters:

#filter parameters
order = 1 (varied between 1 and 2)
wn_log_log = 0.045 (This value has been adjusted to fit most of the curves, mostly arbitrary)
rs = 0.05
rp=0.5
type = 'bessel' (between bessel and butterworth)


data points were sampled at 1 second.

I've had mixed results so far (in terms of the next calculation step).

Order 2 bessel wn= 0.065

Order 1 bessel wn= 0.045

Since I'm kind of unexperienced on signal processing I think my question will be how be able to intelligently choose a cut off frequency or adjust the filter parameters based on the nature of the signal which I assume is kind of similar.

But just a first pointer on an intelligent way of at least analyze this signal and have a better understanding of it (fourier analaysis, time domain-frequency domain methods, etc..) that would give me an idea of what would be a good cut-off frequency would be great.

Thanks

Update:

So my goal is to be able to calculate the pressure difference from the filtered pressure and the I'll calculate the first and second derivative. My goal is to get three zones using the second derivative change of sign. The filter will need to be able to get a filtered pressure signal to identify these three zones. Some "wigles" will be ok, as long as zone 1 and 2 are clearly defined (sometime using the same filter to different curves doesn't allow me to achieve that)

• What do you want to do with the output of the filter? I assume you're trying to deduce the pressure decay with the water hammer removed -- is that correct? – TimWescott Dec 2 at 21:25
• Hey Tim, yeah the idea is to eliminate as much as I can the water hammer and use the output pressure signal to calculate pressure differences and then with this pressure difference calculate the first and second derivative. – Juan Hurtado Dec 2 at 21:52
• What's still missing are some details about what you're going to do with the information, and when. How precise do you need to be? Are "wiggles" in your second derivative a bad thing, or acceptable as long as they're small enough? Are you doing this on-line (like to trip some safety) or off-line (i.e., after the fact to analyze performance)? – TimWescott Dec 2 at 23:10
• @TimWescott Hi Tim, I made an update to my post. – Juan Hurtado Dec 3 at 1:06
• It looks like the reverberation could be assigned a transfer function $z^n/(z^n + 0.4)$, where $n$ is the number of samples that spans one period of reverberation. Cascading your lowpass filter with one that has transfer function $(z^n + 0.4)/(1.4 z^n)$ should kill a lot of the reverberation (it won't be perfect), leaving your low-pass less to clean up. of course, any change in plumbing will need a new anti-reverb filter, unless you want to get fancy with adaptive processing. – TimWescott Dec 3 at 1:25