You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue superseeds #249 and #338, closed by #342.
This is meant to start the discussion on how DataIO will look like longer term. None of this is critical, it's only refactoring, and therefore it's low priotirity
I'll start with my thoughts. I propose:
UnbinnedData and BinnedData should both derive from DataIO. DataIO should contain all common functions and properties (currently UnbinnedData derived from DataIO, and BinnedData from UnbinnedData)
Both UnbinnedData and BinnedData should have the methods open(), write() and plot(). For BinnedData, these will mostly call histpy methods, instead of duplicating the IO code (tagging @jdbuhler since he had thoughts about this)
Methods like get_raw_spectrum and get_raw_lightcurve should return another BinnedData object (with a reduced number of axes). They'll now how to open(), write() and plot() themselves already. Similarly for other axes --e.g. psichi, phi.
BinnedData should have a classmethod from_unbinned() which takes an UnbinnedData object and bins it.
UnbinnedData should have a method called to_binned() which internally calls BinnedData.from_unbinned(). This is a convenience method, but doesn't duplicate code.
config file should become optional, only if the user finds them convenient. There should be a way to use DataIO programatically without config files.
(Done in Interfaces refactoring #369 )~We should create an e.g. EventSelection class. This will take an event (or event list), and output True of False (or an array that works as a mask) depending on whether an event passed a cut or not. Derived classes from EventSelection can implement different types of cuts --e.g. energy, time, if it's in the SAA, if it's a GTI, number of hits, hit location, etc. Multiple event EventSelection objects can be concatenated. The UnbinnedData object should be able to take these as an input to filter out events. This mechanism should replace specific methods like select_data_energy, select_data_time, filter_good_data, cut_SAA_events, etc.
The binning information should come from a histpy Axes, which can in turn from from a response.
This issue superseeds #249 and #338, closed by #342.
This is meant to start the discussion on how DataIO will look like longer term. None of this is critical, it's only refactoring, and therefore it's low priotirity
I'll start with my thoughts. I propose:
UnbinnedDataandBinnedDatashould both derive fromDataIO.DataIOshould contain all common functions and properties (currentlyUnbinnedDataderived fromDataIO, andBinnedDatafromUnbinnedData)UnbinnedDataandBinnedDatashould have the methodsopen(),write()andplot(). ForBinnedData, these will mostly call histpy methods, instead of duplicating the IO code (tagging @jdbuhler since he had thoughts about this)get_raw_spectrumandget_raw_lightcurveshould return anotherBinnedDataobject (with a reduced number of axes). They'll now how toopen(),write()andplot()themselves already. Similarly for other axes --e.g. psichi, phi.BinnedDatashould have a classmethodfrom_unbinned()which takes anUnbinnedDataobject and bins it.UnbinnedDatashould have a method calledto_binned()which internally callsBinnedData.from_unbinned(). This is a convenience method, but doesn't duplicate code.configfile should become optional, only if the user finds them convenient. There should be a way to useDataIOprogramatically without config files.EventSelectionclass. This will take an event (or event list), and outputTrueofFalse(or an array that works as a mask) depending on whether an event passed a cut or not. Derived classes fromEventSelectioncan implement different types of cuts --e.g. energy, time, if it's in the SAA, if it's a GTI, number of hits, hit location, etc. Multiple eventEventSelectionobjects can be concatenated. TheUnbinnedDataobject should be able to take these as an input to filter out events. This mechanism should replace specific methods likeselect_data_energy,select_data_time,filter_good_data,cut_SAA_events, etc.Axes, which can in turn from from a response.