Action #4159

Implement saving and loading of response cache information

Added by Knödlseder Jürgen 20 days ago. Updated 18 days ago.

Status:ClosedStart date:11/17/2022
Priority:HighDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:2.1.0
Duration:

Description

In order to speed-up computations, it should be possible to save the response cache and the reload the cached values so that re-computation is not necessary. Corresponding loading and saving methods should be implemented in GResponseVectorCache.

The actual loading and saving should be implemented in the XML read/write methods of the relevant observation classes. For example for COMPTEL, implementation should be done in GCOMObservation::read and GCOMObservation::write. A possible logic would be to add a member

GFilename m_irfcachename;    //!< IRF response cache filename
to the class that by default is an empty string. If the filename is set, the GCOMObservation::write method should save the response cache in the specified filename, and write the corresponding filename in the XML file
<parameter name="IRFcache" file="irf_cache.fits"/>
The GCOMObservation::read method should then check for the existence of the parameter, and if present, load the cache from the FITS file.

The FITS file would be a table with two columns, the first specifying the IRF cache ID and the second the IRF values.


Recurrence

No recurrence.

History

#1 Updated by Knödlseder Jürgen 19 days ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 30

I implemented save(), load() and read() methods into the GResponseVectorCache to enable saving and loading of cache values using FITS files. Each cache entry is saved in a specific extension to take benefit from the compressed cache format. The cache identifier is used as the extension name.

Some code has been added to the unit test to verify that saving and loading works correctly.

#2 Updated by Knödlseder Jürgen 18 days ago

  • Status changed from In Progress to Pull request
  • % Done changed from 30 to 100

I implemented the automatic saving and loading of cached response information in the GCOMObservation and GCOMResponse classes. The automatic saving is enabled by setting the response cache name using GCOMObservation::rspname() to a non-empty string that specifies the name of the file into which the cached response values will be written. Once a file has been written it will never be overwritten again.

I also implemented a comscript comobsconv that convolves a model with the COMPTEL response and stores the convolved response files in a specified output folder. The script also returns an observation definition XML file that points to the convolved response files and that can be used for further analysis.

#3 Updated by Knödlseder Jürgen 18 days ago

  • Status changed from Pull request to Closed

Code merged into devel

Also available in: Atom PDF