Adding New Data Types to OSPEX

Kim Tolbert, 02-Mar-2023

Back to Main OSPEX page

Adding a new data type to OSPEX involves providing data-specific readers and modifying a few OSPEX routines to make the new data type 'known' to OSPEX. Once the data (and DRM if needed) have been set into OSPEX, you can proceed to use OSPEX for analysis in the same way for every data type.

If you don't need or aren't ready for your data to be a 'known' data type in OSPEX, there are two mechanisms for analysing 'unknown' data types in OSPEX - the ANY Input method and the User Data method.


For each case below, see examples in the existing OSPEX data types and data-specific routines.

Adding spectrum data type called xxx

  1. Your input file must be identifiable as containing xxx data. If it's a FITS file, the header must have the one of the keywords ‘instrume’, ‘telecop’, or ‘mission’ set to xxx. If it's some other type of file, the name of the file must identify it as xxx data.
  2. Create a spex_xxx_specfile__define.pro that inherits spex_data_strategy and has a read_data method (similar to spex_messenger_specfile__define.pro). The read_data method is called by spex_data_strategy::process and must return all of the arguments expected by that call. (Look in spex_data_strategy__define.pro in the process method for the arguments that read_data is called with and expects returned, and look in spex_data_strategy_info__define.pro for an explanation of those variables.)
  3. Modify spex_data__define.pro to set the strategy to 'spex_xxx_specfile' when the input file is of type xxx (look in the set method - if input is FITS, the header will contain a keyword identifying it as xxx, otherwise you may need to add a new branch examining the file name to determine the data type.).
  4. Modify spex_datatypes.pro to add xxx to the structure of allowed data types (look in the header for the meaning of each field).
  5. If the DRM (or SRM) for xxx is computed, or read from a single file (i.e. not time-dependent), spex_xxx_specfile::read_data can return the DRM matrix in the resp_info argument as a structure with the fields edges_in (2xn photon energy edges) and drm (the 1- or 2-d DRM matrix). The DRM count energy edges will assumed to be the same as the input data energy edges.
  6. If there is a separate DRM for each input xxx file, then you must create a routine called spex_xxx_fits2drm and modify the spex_drm::read_drm method to add an xxx branch to call the new fits2drm routine (or if the file is not a FITS file, modify spex_drm::read_drm to determine the data type, and call the new fits2drm routine). In the hessi example (spex_hessi_specfile__define.pro), the input spectrum FITS file contains the name of the corresponding DRM FITS file, and the read_data method returns that DRM file name in the resp_info argument. In the fermi gbm example (spex_fermi_gbm_specfile__define.pro) the DRM file name is not known when reading the spectrum input file, so the read_data returns resp_info='' (a null string) - the user will have to set the drm file explicitly.

Adding imagecube data type called xxx

(similar to above for spectrum input)

  1. Your input file must be identifiable as containing xxx data. If it's a FITS file, the header must have the one of the keywords ‘instrume’, ‘telescop’, or ‘mission’ set to xxx. If it's some other type of file, the name of the file must identify it as xxx data.
  2. Create a spex_xxx_image__define.pro that inherits spex_image and has read_data and compute_spectra methods (similar to spex_hessi_image__define.pro). The read_data method is called by spex_data_strategy::process and must return all of the arguments expected by that call.
  3. The inherited spex_image class will provide all the general tools to define ROIs. The compute_spectra method in your spex_xxx_image__define will compute the spectrum in each ROI defined for each image.
  4. Modify spex_data__define.pro to set the strategy to 'spex_xxx_image' when the input file is of type xxx (look in the set method - if input is FITS, the header will contain a keyword identifying it as xxx, otherwise you may need to add a new branch examining the file name to determine the data type.).
  5. Modify spex_datatypes.pro to add xxx to the structure of allowed data types (look in the header for the meaning of each field).

Making your data files searchable through the OSPEX GUI

This is not required, but makes it much easier for the user to acquire your data for use in OSPEX analysis. If you don't add this feature, users must know where to find your data files, and manually download them to the local computer.

  1. Your data files should be organized on a server in year/month/day directories or similar and be retrievable using https.
  2. Create an xxx__define.pro with a search method that inherits synop_spex (similar to messenger__define.pro). This will identify the server containing the xxx data, and include any other methods specific to xxx data (e.g. parse_time), but will use the synop_spex class to do most of the generic work to find and copy the files.
  3. Make sure the web field of the data types structure is set to 1 (in spex_datatypes.pro).
  4. Modify spex_xtime_data_info.txt to add information about xxx.
  5. The spex__xtime.pro routine that provides a widget to find and copy remote data files in OSPEX will automatically be populated with any data types whose web field of the datatypes structure is set to 1.

 


Kim Tolbert
Last Modified:04 March 2023