nu-radio / NuRadioReco

reconstruction framework for radio detectors of high-energy neutrinos
GNU General Public License v3.0
5 stars 3 forks source link

Use Fourier shift theorem to improve timing precision in EfieldToVoltage converter #236

Closed cg-laser closed 3 years ago

cg-laser commented 4 years ago

Each electric field has a different trace start time. To convert them to voltage traces that all have the same time synchronization (start time), the efields need to be shifted in time. So far we upsample the traces to ~10GHz to achieve a 0.1ns time resolution. However, by exploiting the Fourier shift theorem, we can achieve a much better time resolution without the expensive upsampling. The module should be improved accordingly.

christophwelling commented 4 years ago

@cg-laser Are you already working on this? I'm going to need this feature, so if you are not already on it, I can take care of it.

cg-laser commented 4 years ago

no, I do not. If you can implement this improvement, that would be awesome.

The best way to improve the module might be by leaving the old code and just adding the remaining time delay due to the binning via the Fourier shift theorem. This ensures that the time delay via the shift theorem is small and we don't run into wrapping issues as the FFT assumes a cyclic function. But we can remove the upsampling code.

cg-laser commented 4 years ago

this is a code snippet of how to apply the shift correctly (ff is the array of frequencies from np.fft.rfftfreq())

dT = travel_time[iA][iS] - travel_time.min()
phase = -1j * 2 * np.pi * ff * dT
voltage_spectrum *= np.exp(phase)
christophwelling commented 4 years ago

It would be useful to be able to use this in other situations as well. So I would like to put the feature either into the base_trace class or as a utility function. Other than that, I think it's a good idea to only use it for fine-tuning and do most of the timing as before

cg-laser commented 4 years ago

you mean a class function like def shift(Delta_t) that sounds like a good idea

christophwelling commented 4 years ago

Yes, something like that.