nu-radio / NuRadioMC

A Monte Carlo simulation package for radio neutrino detectors
GNU General Public License v3.0
33 stars 35 forks source link

non-causal responses #693

Open cozzyd opened 3 months ago

cozzyd commented 3 months ago

Describe the issue The RNO-G phased array response as implemented is non-causal

image

While I haven't checked, I suspect the same is true for many other responses defined by S parameters, unless the S-parameters are derived from time-domain measurements or have been causality-corrected.

Expected behavior

A causal impulse response

Additional context

I think this is caused by 2 issues:

1) S-parameters as measured by network analyzers are usually non-causal (due to numerical errors, etc.). This is also true for the S-parameter files that come from Minicircuits, unfortunately.

2) Even if the s-parameters were causal, linearly interpolating the magnitude/phase would cause it to be non-causal. Causality is guaranteed only when the Kramers-Kronig relations are satisfied, and linear interpolation of the complex response does not preserve that.

I think the solution is either to get a time-domain measurement of the impulse response of the FLOWER, or, at the very least, force causality on resposnse from the S-Parameters. This can be done e.g. by doing complex rational fitting (see e.g. the example here in MATLAB https://www.mathworks.com/help/rf/ref/impulse.html#mw_1b673be6-9aa9-4e4b-bdc7-be829eb756f1 ), which ensures causality, though unfortunately nobody has implemented complex rational fitting (or an equivalent like MATLAB's invfreqs) as part of scipy.signal as far as I can tell. So either someone needs to implement something like it, or we can just use the fitted rational functions from someone doing it manually in MATLAB. Once you have a rational function, you don't need to interpolate either, since your response will be defined at every frequency.

Even if the non-causal part is small, it can have important effects for e.g. template matching or attempts at deconvolution. Plus, I find it extremely embarrassing to plot a non-causal impulse response.

philippwindischhofer commented 2 months ago

Interesting topic! @fschlueter and I also briefly talked about this in the past and I'm tagging him here in case he is interested in chiming in.

Perhaps this could be a starting point for some experiments?

https://scikit-rf.readthedocs.io/en/latest/api/generated/skrf.vectorFitting.VectorFitting.html