Join GitHub today
Take observation time from GTI table #1908
The observation time will now be calculated using the GTI table pointed to in the HDU index file.
Maybe we could add a warning that taking the obs time from the Obs index file is deprecated and will raise an error in the future?
I checked the data sets we have in gammapy-extra for differences between the live-times (computed from the GTI table and taken from the obs index file). Only the data sets
show a deviation of about 0.1-0.5%. For the rest of the data sets there is basically no difference.
We just discussed this PR in the call. Conclusion: rather than changing the
I will make this change here in this PR.
I introduced a
@cdeil From my side this would be ready to merge.
@dcfidalgo - Thanks!
Some suggestions inline.
I was expecting that you would read the EVENTS header and create the GTI from there.
Here you create it from the OBS_INDEX file.
OK, fine to leave as-is. But I'd suggest to move the method to make the GTI object on the ObservationTable class. This will also simplify the test.
Later we will probably have code to make the GTI table or an ObservationInfo object that also contains pointing info from the EVENTS header, that's needed if we no longer rely on index files.
I specifically don't like the name
_create_missing_gti because it doesn't mention from which info this gti is created and wanted to suggest a better / longer name - but @dcfidalgo if you agree to move this to a method on the
ObservationTable class, the point is resolved.
The caching, i.e. where we have
lazyproperty and where
property is pretty arbitrary by now.
Possibly the solution will be to introduce an
ObservationInfo object that contains all time and pointing-related info, and that would be cached. Basically an Observation would consists of three parts: events, irfs, info.
Given that here all the remaining lazy properties (except possibly GTI) just access
obs_info, which is just a row from a table, i.e. very fast, doesn't access the disk, you could either remove all
lazyproperty completely in this file, or only keep them for the
gti properties. Or just leave as-is for now, as something to be figured out in a follow-up PR.
@cdeil Thanks for the comments!
I moved the method to the
I left a small test in the
For now i simply removed all lazy properties, maybe we can discuss a possible optimization in a follow-up PR.