Feature #944

Implement load(), eval() and eval_gradients() functions GModelSpatialDiffuseCube

Added by Mayer Michael over 10 years ago. Updated over 10 years ago.

Status:ClosedStart date:09/05/2013
Priority:HighDue date:
Assigned To:Mayer Michael% Done:

100%

Category:-Estimated time:4.00 hours
Target version:00-08-00
Duration:

Description

Currently it is not possible to load a spatial cube into memory and work with it. For Fermi analyses the workaround, using the srcmaps (produced by the ScienceTools) is applied. In order to provide e.g. a background cube describing the acceptance of the CTA (or H.E.S.S.) FoV the GModelSpatialDiffuseCube should support the above-mentioned functions.

test_cube.fits (64.7 KB) Mayer Michael, 09/08/2013 11:46 AM


Recurrence

No recurrence.

History

#1 Updated by Mayer Michael over 10 years ago

I would propose to add a protected member std::vector<double> m_energies to GModelSpatialDiffuseCube since GSkymap can contain the different maps but does not store the energy value of each map.
The load(std::string filename) function should load the Skymaps from the primary HDU of the file (implemented in GSkymap) and look for the second HDU named “ENERGIES” and store the energy values. This would allow to use files like e.g. the Fermi Galactic diffuse model.

#2 Updated by Mayer Michael over 10 years ago

I realised that a better method than using a vector of doubles describing the energies, we could use a GNodeArray, which allows to interpolate the cube content in energy. Does that sound like a better approach?

#3 Updated by Mayer Michael over 10 years ago

Alternatively, one could use GEBounds to find the correct energy bin.

#4 Updated by Mayer Michael over 10 years ago

  • Status changed from New to Pull request
  • % Done changed from 0 to 100
  • Estimated time changed from 5.00 to 4.00

#5 Updated by Knödlseder Jürgen over 10 years ago

I was about to pull in your change, but a test failed because there is no test FITS file (before, this was probably ignored). Do you have a small test map cube (small to not overload the gammalib tarball)?

#6 Updated by Mayer Michael over 10 years ago

Here is a small (66kb) fits cube. One could probably further reduce the file size by using floats instead of double precision. Then we also would have to adapt the reader I think. The content of the cube is just a gaussian, where the width is changing with energy. The Gaussian is centered on the Crab.

#7 Updated by Mayer Michael over 10 years ago

I left two 'to do’ points in the load() function, since I think we need to create new exceptions, if e.g. the dimension of the loaded fits-image is less than 3.

#8 Updated by Knödlseder Jürgen over 10 years ago

  • Status changed from Pull request to Closed

Checked in integration, pulled into devel after minor corrections.

#9 Updated by Knödlseder Jürgen over 10 years ago

Michael Mayer wrote:

I left two 'to do’ points in the load() function, since I think we need to create new exceptions, if e.g. the dimension of the loaded fits-image is less than 3.

That’s okay. In fact, the plan is to remove all the various exceptions and just work with a bunch of standard exceptions in the future.

Also available in: Atom PDF