Support #2512
ctools time (MET reference, and MJDREFF)
Status: | Closed | Start date: | 06/13/2018 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assigned To: | Knödlseder Jürgen | % Done: | 100% | |
Category: | - | |||
Target version: | - | |||
Duration: |
Description
Hello,
I had a question about times in ctools.
When I define an observation in python with:
tmin = (Time('2000-01-01T12:00:00', format='fits', scale='utc’)).isot tmax = (tmin + TimeDelta(40, format='sec’)).isot
I would expect that the obs interval will be 0-40 sec.
However, the output of ctobssim gives:
2018-06-13T10:02:32: +============+ 2018-06-13T10:02:32: | Parameters | 2018-06-13T10:02:32: +============+ ……. 2018-06-13T10:02:32: tmin ......................: 2000-01-01T12:00:00.000 2018-06-13T10:02:32: tmax ......................: 2000-01-01T12:00:40.000 ……. 2018-06-13T10:02:32: +======================+ 2018-06-13T10:02:32: | Simulate observation | 2018-06-13T10:02:32: +======================+ ……. 2018-06-13T10:02:32: Time interval .............: 64.184 - 104.184 s …….
This offset of 64.184 seconds seems to correspond to the choice of
MJDREFF=7.428703703703703x10-4
used e.g. by FERMI.
If this is not a bug, then the documentation in e.g., http://cta.irap.omp.eu/ctools/users/tutorials/quickstart/simulating.html is a bit misleading, as the true reference time is 2000-01-01T11:58:55.816.
This becomes even more confusing if one uses a temporal model, as in http://gammalib.sourceforge.net/users/user_manual/modules/model.html#temporal-components .
The examples encourages the user to use
MJDREFI = '51544' MJDREFF = ‘0.5'
This choice is consistent with a reference time of 2000-01-01T12:00:00.
However, in order to really match the time reference used by ctobssim, one needs to set
MJDREFF = ‘0.50074287037037037'
(add 64.184 sec) or alternatively, to use
tmin = (Time('2000-01-01T12:00:00', format='fits', scale='utc’) - TimeDelta(64.184, format='sec')).isot tmax = (tmin + TimeDelta(40, format='sec’)).isot MJDREFF = ‘0.5'
Then one gets
2018-06-13T10:09:47: +============+ 2018-06-13T10:09:47: | Parameters | 2018-06-13T10:09:47: +============+ ……. 2018-06-13T10:09:47: tmin ......................: 2000-01-01T11:58:55.816 2018-06-13T10:09:47: tmax ......................: 2000-01-01T11:59:35.816 ……. 2018-06-13T10:09:47: +======================+ 2018-06-13T10:09:47: | Simulate observation | 2018-06-13T10:09:47: +======================+ ……. 2018-06-13T10:09:47: Time interval .............: 0 - 40 s
In this case, the base reference time defined in the temporal model (i.e., model_temporal_lightcurve.fits in the example) would indeed be zero seconds.
I’d appreciate some advice on wether this behaviour is a bug, or if I have made a mistake myself.
What is the true reference time in ctools?
What is the recommended way to define the time reference in a temporal model fits file?
As a side note, it would be very handy if an example model_temporal_lightcurve.fits file was included in the tutorialsop. Creating it from scratch for a first-time user was non trivial.
Thanks for the advice,
Iftach.
Recurrence
No recurrence.
History
#1 Updated by Knödlseder Jürgen almost 6 years ago
- Status changed from New to In Progress
- Assigned To set to Knödlseder Jürgen
- % Done changed from 0 to 10
The difference comes from the fact that the time string is in the UTC time system, while the seconds reported by ctobssim is in the TT time system. The difference between both systems is 64.18 sec at the specified time. You may check this using the xTime tool, specifying UTC as input and TT as output: https://heasarc.gsfc.nasa.gov/cgi-bin/Tools/xTime/xTime.pl?time_in_i=2000-01-01T12%3A00%3A00.000&time_in_c=&time_in_d=&time_in_j=&time_in_m=&time_in_sf=&time_in_wf=&time_in_sl=&time_in_sni=&time_in_snu=&time_in_s=&time_in_h=&time_in_sz=&time_in_ss=&time_in_sn=×ys_in=u×ys_out=t&apply_clock_offset=yes
The interpretation of the times in the light curve file depend on the keywords in the light curve file header. If TIMESYS='TT'
then you need to specify also times in the TT time system in the table. If you want times in UTC you need to specify TIMESYS='UTC'
.
Please let me know if this answers your questions. I recognize that these issues should be better explained on the documentation web pages.
#2 Updated by Sadeh Iftach almost 6 years ago
Thanks, Jürgen.
For completeness, here’s a self consistent configuration which works with the model_temporal_lightcurve.fits file.
- parameters:
deltaT = TimeDelta(40, format='sec') tmin = Time('2000-01-01T12:00:00', format='fits', scale='tt') tmax = tmin + deltaT tmin = str(tmin.utc) # == "2000-01-01T11:58:55.816(UTC)" tmax = str(tmax.utc) # == "2000-01-01T11:59:35.816(UTC)" MJDREFI = '51544' MJDREFF = '0.5' TIMESYS = 'TT' TIMEREF = 'LOCAL' TIMEUNIT = 's'
- output:
2018-06-13T13:39:17: +============+ 2018-06-13T13:39:17: | Parameters | 2018-06-13T13:39:17: +============+ ......... 2018-06-13T13:39:17: tmin ......................: 2000-01-01T11:58:55.816(UTC) 2018-06-13T13:39:17: tmax ......................: 2000-01-01T11:59:35.816(UTC) ......... 2018-06-13T13:39:17: +======================+ 2018-06-13T13:39:17: | Simulate observation | 2018-06-13T13:39:17: +======================+ ......... 2018-06-13T13:39:17: Time interval .............: 0 - 40 s
I’m still slightly confused about the input to ctobssim. If I try to explicitly do
tmin = Time('2000-01-01T12:00:00', format='fits', scale='tt') tmax = tmin + deltaT tmin = str(tmin.tt) tmax = str(tmax.tt) TIMESYS = 'UTC'
I get
2018-06-13T13:53:47: +============+ 2018-06-13T13:53:47: | Parameters | 2018-06-13T13:53:47: +============+ ......... 2018-06-13T13:53:47: tmin ......................: 2000-01-01T12:00:00.000(TT) 2018-06-13T13:53:47: tmax ......................: 2000-01-01T12:00:40.000(TT) ......... 2018-06-13T13:53:47: +======================+ 2018-06-13T13:53:47: | Simulate observation | 2018-06-13T13:53:47: +======================+ ......... 2018-06-13T13:53:47: Time interval .............: 64.184 - 104.184 s
and a consistent model_temporal_lightcurve.fits file.
However, the quoted reference is now
2018-06-13T13:53:47: Time interval .............: 64.184 - 104.184 s
Looking at the docs at http://cta.irap.omp.eu/ctools/users/tutorials/quickstart/simulating.html , it says that one can set the reference system of ctobssim by e.g. “MJD 58849.0 (TAI)”.
I would therefore have expected that 2000-01-01T11:58:55.816(UTC) and 2000-01-01T12:00:00.000(TT) would be equivalent (and would both indicate the [0 - 40 s] interval). However, the string input to ctobssim seems to always be interpreted as UTC
#3 Updated by Knödlseder Jürgen almost 6 years ago
Indeed, UTC and TT are different time scales, so “UTC in TT” does not really make sense, that’s why it is not supported.
#4 Updated by Sadeh Iftach almost 6 years ago
- Status changed from In Progress to Closed
- % Done changed from 10 to 100
Thanks again for the quick replay!