nu-radio / NuRadioMC

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

Defining trigger time in NuRadioReco #524

Open fschlueter opened 1 year ago

fschlueter commented 1 year ago

Should it be defined absolut or relative (to station time). In what format do we want to store it (astropy, float tuple, ...). Do we need ns precision?

shallmann commented 1 year ago

To give a bit of more detail how the readout is done:

The different options are:

sjoerd-bouma commented 1 year ago

Some more comments:

fschlueter commented 1 year ago

Just to put the information here and to restart the discussion. For the (just merged) mattak reader we set the trigger time absolute and the traces start time is relative to that.

fschlueter commented 1 year ago

Some more comments:

from astropy.time import Time
import numpy as np
time_128 = np.float128(int(Time.now().unix)) + np.float128(1e-9)
print(time_128, type(time_128))
aptime = Time(time_128, format='unix')
print(aptime.value, type(aptime.value))

results in the output

1680768370.000000001 <class 'numpy.float128'>
1680768370.0 <class 'numpy.float64'>

If we do store our times as unix doubles, the precision is limited to 52 bits, which means ~ 400 ns. This will limit what we can do with multiple-station coincidences.

Good that you bring that up Sjoerd. So we already store the time(stamp) as a float to file. I think that is the right way to go because storing astropy objects carries the danger of compatibility problems (e.g. see https://github.com/nu-radio/NuRadioMC/issues/481 where this happened for the event header where we used to store astropy objects). I would suggest the following: Within NuRadioMC we use astropy where ns precision is required and to file we store two floats/integers (the second and the nanosecond).

fschlueter commented 1 year ago

Just to document it here. We decided in the call on May-the-force that we will store the time with two numbers (second and nanosecond) + format to disc but will convert it to Astropy.Time in memory. @sjoerd-bouma or me will propose an implementation

fschlueter commented 1 year ago

What we have not decided is wether we want to store the trigger time as an absolute time or a relative time. As far as I can see we have the station_time, event_time and trigger_time. We should define what is their "relationship" and properly document it.