GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GModelSpatialDiffuseCube Class Reference

Spatial map cube model. More...

#include <GModelSpatialDiffuseCube.hpp>

Inheritance diagram for GModelSpatialDiffuseCube:
GModelSpatialDiffuse GModelSpatial GBase

Public Member Functions

 GModelSpatialDiffuseCube (void)
 Void constructor. More...
 
 GModelSpatialDiffuseCube (const bool &dummy, const std::string &type)
 Model type constructor. More...
 
 GModelSpatialDiffuseCube (const GXmlElement &xml)
 XML constructor. More...
 
 GModelSpatialDiffuseCube (const GFilename &filename, const double &value=1.0)
 Filename constructor. More...
 
 GModelSpatialDiffuseCube (const GSkyMap &cube, const GEnergies &energies, const double &value=1.0)
 Sky map constructor. More...
 
 GModelSpatialDiffuseCube (const GModelSpatialDiffuseCube &model)
 Copy constructor. More...
 
virtual ~GModelSpatialDiffuseCube (void)
 Destructor. More...
 
virtual GModelSpatialDiffuseCubeoperator= (const GModelSpatialDiffuseCube &model)
 Assignment operator. More...
 
virtual void clear (void)
 Clear map cube model. More...
 
virtual GModelSpatialDiffuseCubeclone (void) const
 Clone map cube model. More...
 
virtual std::string classname (void) const
 Return class name. More...
 
virtual std::string type (void) const
 Return spatial model type. More...
 
virtual double eval (const GPhoton &photon, const bool &gradients=false) const
 Evaluate function. More...
 
virtual GSkyDir mc (const GEnergy &energy, const GTime &time, GRan &ran) const
 Returns MC sky direction. More...
 
virtual double mc_norm (const GSkyDir &dir, const double &radius) const
 Return normalization of diffuse cube for Monte Carlo simulations. More...
 
virtual bool contains (const GSkyDir &dir, const double &margin=0.0) const
 Signals whether model contains sky direction. More...
 
virtual GSkyRegionregion (void) const
 Return boundary sky region. More...
 
virtual void read (const GXmlElement &xml)
 Read model from XML element. More...
 
virtual void write (GXmlElement &xml) const
 Write model into XML element. More...
 
virtual std::string print (const GChatter &chatter=NORMAL) const
 Print map cube information. More...
 
int maps (void) const
 Return number of maps in cube. More...
 
int pixels (void) const
 Return number of pixels in cube. More...
 
double value (void) const
 Get model value. More...
 
void value (const double &value)
 Set model value. More...
 
const GFilenamefilename (void) const
 Get file name. More...
 
void filename (const GFilename &filename)
 Set file name. More...
 
const GSkyMapcube (void) const
 Get map cube. More...
 
void cube (const GSkyMap &cube)
 Set map cube. More...
 
GEnergies energies (void)
 Returns map cube energies. More...
 
void energies (const GEnergies &energies)
 Set energies for map cube. More...
 
const GModelSpectralNodesspectrum (void) const
 Get map cube spectrum. More...
 
void set_mc_cone (const GSkyDir &centre, const double &radius) const
 Set Monte Carlo simulation cone. More...
 
void load (const GFilename &filename)
 Load cube into the model class. More...
 
void save (const GFilename &filename, const bool &clobber=false) const
 Save cube into FITS file. More...
 
void read (const GFits &fits)
 Read diffuse cube from FITS file. More...
 
void write (GFits &fits) const
 Write diffuse cube into FITS file. More...
 
- Public Member Functions inherited from GModelSpatialDiffuse
 GModelSpatialDiffuse (void)
 Void constructor. More...
 
 GModelSpatialDiffuse (const GModelSpatialDiffuse &model)
 Copy constructor. More...
 
virtual ~GModelSpatialDiffuse (void)
 Destructor. More...
 
virtual GModelSpatialDiffuseoperator= (const GModelSpatialDiffuse &model)
 Assignment operator. More...
 
virtual GClassCode code (void) const
 Return class code. More...
 
- Public Member Functions inherited from GModelSpatial
 GModelSpatial (void)
 Void constructor. More...
 
 GModelSpatial (const GModelSpatial &model)
 Copy constructor. More...
 
virtual ~GModelSpatial (void)
 Destructor. More...
 
virtual GModelSpatialoperator= (const GModelSpatial &model)
 Assignment operator. More...
 
virtual GModelParoperator[] (const int &index)
 Returns model parameter. More...
 
virtual const GModelParoperator[] (const int &index) const
 Returns model parameter (const version) More...
 
virtual GModelParoperator[] (const std::string &name)
 Returns model parameter. More...
 
virtual const GModelParoperator[] (const std::string &name) const
 Returns model parameter (const version) More...
 
GModelParat (const int &index)
 Returns model parameter. More...
 
const GModelParat (const int &index) const
 Returns model parameter (const version) More...
 
bool has_par (const std::string &name) const
 Checks if parameter name exists. More...
 
bool has_free_pars (void) const
 Checks if the spatial model has free parameters. More...
 
int size (void) const
 Return number of parameters. More...
 
void autoscale (void)
 Autoscale parameters. More...
 
double flux (const GSkyRegion *reg, const GEnergy &srcEng=GEnergy(), const GTime &srcTime=GTime()) const
 Returns model flux integrated in circular sky region. More...
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor. More...
 

Protected Member Functions

void init_members (void)
 Initialise class members. More...
 
void copy_members (const GModelSpatialDiffuseCube &model)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void fetch_cube (void) const
 Fetch cube. More...
 
void load_cube (const GFilename &filename)
 Load map cube. More...
 
void set_energy_boundaries (void)
 Set energy boundaries. More...
 
void update_mc_cache (void)
 Update Monte Carlo cache. More...
 
double cube_intensity (const GPhoton &photon) const
 Compute cube intensity by log-log interpolation. More...
 
void set_region (void) const
 Set boundary sky region. More...
 
- Protected Member Functions inherited from GModelSpatialDiffuse
void init_members (void)
 Initialise class members. More...
 
void copy_members (const GModelSpatialDiffuse &model)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
- Protected Member Functions inherited from GModelSpatial
void init_members (void)
 Initialise class members. More...
 
void copy_members (const GModelSpatial &model)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Protected Attributes

std::string m_type
 Model type. More...
 
GModelPar m_value
 Value. More...
 
GFilename m_filename
 Name of map cube. More...
 
bool m_loaded
 Signals if map cube has been loaded. More...
 
GSkyMap m_cube
 Map cube. More...
 
GNodeArray m_logE
 Log10(energy) values of the maps. More...
 
GEbounds m_ebounds
 Energy bounds of the maps. More...
 
GSkyRegionCircle m_region
 Bounding circle. More...
 
GSkyDir m_mc_centre
 Centre of MC cone. More...
 
double m_mc_radius
 Radius of MC cone (degrees) More...
 
double m_mc_one_minus_cosrad
 1-cosine of radius More...
 
std::vector< double > m_mc_max
 Maximum values for MC. More...
 
GModelSpectralNodes m_mc_spectrum
 Map cube spectrum. More...
 
- Protected Attributes inherited from GModelSpatial
std::vector< GModelPar * > m_pars
 Parameter pointers. More...
 

Detailed Description

Spatial map cube model.

This class implements the spatial component of the factorised source model for a map cube. A map cube is a set of sky maps for different energies. It is assumed that the pixels of the sky map are given in the units ph/cm2/s/sr/MeV.

Definition at line 59 of file GModelSpatialDiffuseCube.hpp.

Constructor & Destructor Documentation

GModelSpatialDiffuseCube::GModelSpatialDiffuseCube ( void  )

Void constructor.

Constructs empty map cube model.

Definition at line 81 of file GModelSpatialDiffuseCube.cpp.

References init_members().

Referenced by clone().

GModelSpatialDiffuseCube::GModelSpatialDiffuseCube ( const bool &  dummy,
const std::string &  type 
)

Model type constructor.

Parameters
[in]dummyDummy flag.
[in]typeModel type.

Constructs empty map cube model by specifying a model type.

Definition at line 100 of file GModelSpatialDiffuseCube.cpp.

References init_members(), m_type, and type().

GModelSpatialDiffuseCube::GModelSpatialDiffuseCube ( const GXmlElement xml)
explicit

XML constructor.

Parameters
[in]xmlXML element.

Constructs map cube model by extracting information from an XML element. See the read() method for more information about the expected structure of the XML element.

Definition at line 124 of file GModelSpatialDiffuseCube.cpp.

References init_members(), and read().

GModelSpatialDiffuseCube::GModelSpatialDiffuseCube ( const GFilename filename,
const double &  value = 1.0 
)

Filename constructor.

Parameters
[in]filenameFile name.
[in]valueNormalization factor (defaults to 1).

Constructs map cube model by loading a map cube from filename and by assigning the normalization value.

Definition at line 147 of file GModelSpatialDiffuseCube.cpp.

References GModelSpatial::autoscale(), filename(), init_members(), m_filename, m_value, and GOptimizerPar::value().

GModelSpatialDiffuseCube::GModelSpatialDiffuseCube ( const GSkyMap cube,
const GEnergies energies,
const double &  value = 1.0 
)

Sky map constructor.

Parameters
[in]cubeSky map cube.
[in]energiesSky map energies.
[in]valueNormalization factor (defaults to 1).

Constructs map cube model by extracting a cube from a sky map. The constructor also assigns the energy values for all maps and sets the scaling value. The filename will remain blank.

Definition at line 179 of file GModelSpatialDiffuseCube.cpp.

References GModelSpatial::autoscale(), cube(), energies(), init_members(), m_value, and GOptimizerPar::value().

GModelSpatialDiffuseCube::GModelSpatialDiffuseCube ( const GModelSpatialDiffuseCube model)

Copy constructor.

Parameters
[in]modelMap cube model.

Definition at line 209 of file GModelSpatialDiffuseCube.cpp.

References copy_members(), and init_members().

GModelSpatialDiffuseCube::~GModelSpatialDiffuseCube ( void  )
virtual

Destructor.

Definition at line 226 of file GModelSpatialDiffuseCube.cpp.

References free_members().

Member Function Documentation

std::string GModelSpatialDiffuseCube::classname ( void  ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GModelSpatialDiffuseCube").

Implements GModelSpatialDiffuse.

Definition at line 153 of file GModelSpatialDiffuseCube.hpp.

void GModelSpatialDiffuseCube::clear ( void  )
virtual
GModelSpatialDiffuseCube * GModelSpatialDiffuseCube::clone ( void  ) const
virtual

Clone map cube model.

Returns
Pointer to deep copy of map cube model.

Implements GModelSpatialDiffuse.

Definition at line 303 of file GModelSpatialDiffuseCube.cpp.

References GModelSpatialDiffuseCube().

bool GModelSpatialDiffuseCube::contains ( const GSkyDir dir,
const double &  margin = 0.0 
) const
virtual

Signals whether model contains sky direction.

Parameters
[in]dirSky direction.
[in]marginMargin to be added to sky direction (degrees)
Returns
True if the model contains the sky direction.

Signals whether a sky direction falls within the bounding circle of the diffuse cube.

Todo:
To be implemented.

Implements GModelSpatialDiffuse.

Definition at line 517 of file GModelSpatialDiffuseCube.cpp.

void GModelSpatialDiffuseCube::copy_members ( const GModelSpatialDiffuseCube model)
protected

Copy class members.

Parameters
[in]modelSpatial map cube model.

Definition at line 1161 of file GModelSpatialDiffuseCube.cpp.

References m_cube, m_ebounds, m_filename, m_loaded, m_logE, m_mc_centre, m_mc_max, m_mc_one_minus_cosrad, m_mc_radius, m_mc_spectrum, GModelSpatial::m_pars, m_region, m_type, and m_value.

Referenced by GModelSpatialDiffuseCube(), and operator=().

const GSkyMap & GModelSpatialDiffuseCube::cube ( void  ) const
inline

Get map cube.

Returns
Map cube.

Returns the map cube.

Definition at line 267 of file GModelSpatialDiffuseCube.hpp.

References m_cube.

Referenced by cube(), GModelSpatialDiffuseCube(), and gammalib::resolution().

void GModelSpatialDiffuseCube::cube ( const GSkyMap cube)

Set map cube.

Parameters
[in]cubeSky map.

Set the map cube of the spatial map cube model.

Definition at line 659 of file GModelSpatialDiffuseCube.cpp.

References GFilename::clear(), cube(), m_cube, m_filename, m_loaded, and update_mc_cache().

double GModelSpatialDiffuseCube::cube_intensity ( const GPhoton photon) const
protected

Compute cube intensity by log-log interpolation.

Parameters
[in]photonIncident photon.
Returns
Cube intensity value.

Definition at line 1353 of file GModelSpatialDiffuseCube.cpp.

References GPhoton::dir(), GPhoton::energy(), exp(), fetch_cube(), GNodeArray::inx_left(), GNodeArray::inx_right(), log(), GEnergy::log10MeV(), m_cube, m_logE, GNodeArray::set_value(), GNodeArray::size(), GNodeArray::wgt_left(), and GNodeArray::wgt_right().

Referenced by eval().

GEnergies GModelSpatialDiffuseCube::energies ( void  )

Returns map cube energies.

Returns
Map cube energies.

Returns the energies for the map cube in a vector.

Definition at line 730 of file GModelSpatialDiffuseCube.cpp.

References GEnergies::append(), fetch_cube(), GEnergy::log10MeV(), m_logE, GEnergies::reserve(), and GNodeArray::size().

Referenced by GModelSpatialDiffuseCube(), load_cube(), read(), and write().

void GModelSpatialDiffuseCube::energies ( const GEnergies energies)

Set energies for map cube.

Parameters
[in]energiesSky map energies.
Exceptions
GException::invalid_argumentSpecified sky map energies incompatible with map cube.

Sets the energies for the map cube.

Definition at line 686 of file GModelSpatialDiffuseCube.cpp.

References GNodeArray::append(), GNodeArray::clear(), fetch_cube(), G_ENERGIES, m_cube, m_logE, GSkyMap::nmaps(), set_energy_boundaries(), GEnergies::size(), gammalib::str(), and update_mc_cache().

double GModelSpatialDiffuseCube::eval ( const GPhoton photon,
const bool &  gradients = false 
) const
virtual

Evaluate function.

Parameters
[in]photonIncident photon.
[in]gradientsCompute gradients?
Returns
Sky map intensity ( \(\mbox{ph cm}^{-2}\mbox{sr}^{-1}\mbox{s}^{-1}\))

Computes the spatial diffuse model as function of photon parameters.

If the gradients flag is true the method will also evaluate the partial derivatives of the model.

Implements GModelSpatialDiffuse.

Definition at line 322 of file GModelSpatialDiffuseCube.cpp.

References cube_intensity(), GOptimizerPar::factor_gradient(), GOptimizerPar::is_free(), m_value, GOptimizerPar::scale(), value(), and GOptimizerPar::value().

void GModelSpatialDiffuseCube::fetch_cube ( void  ) const
protected

Fetch cube.

Load diffuse cube if it is not yet loaded. The loading is thread save.

Definition at line 1204 of file GModelSpatialDiffuseCube.cpp.

References GFilename::is_empty(), load_cube(), m_filename, and m_loaded.

Referenced by cube_intensity(), energies(), mc(), set_mc_cone(), and write().

const GFilename & GModelSpatialDiffuseCube::filename ( void  ) const
inline

Get file name.

Returns
File name.

Returns the file name of the spatial map cube model.

Definition at line 238 of file GModelSpatialDiffuseCube.hpp.

References m_filename.

Referenced by filename(), GModelSpatialDiffuseCube(), and load_cube().

void GModelSpatialDiffuseCube::filename ( const GFilename filename)
inline

Set file name.

Parameters
[in]filenameFile name.

Set the file name of the spatial map cube model.

Definition at line 252 of file GModelSpatialDiffuseCube.hpp.

References filename(), and m_filename.

void GModelSpatialDiffuseCube::free_members ( void  )
protected

Delete class members.

Definition at line 1192 of file GModelSpatialDiffuseCube.cpp.

Referenced by clear(), operator=(), and ~GModelSpatialDiffuseCube().

void GModelSpatialDiffuseCube::load ( const GFilename filename)

Load cube into the model class.

Parameters
[in]filenamecube file.

Loads cube into the model class.

Definition at line 895 of file GModelSpatialDiffuseCube.cpp.

References load_cube(), and update_mc_cache().

void GModelSpatialDiffuseCube::load_cube ( const GFilename filename)
protected

Load map cube.

Parameters
[in]filenameMap cube file.
Exceptions
GException::invalid_valueNumber of maps in cube mismatches number of energy bins.

Load diffuse map cube.

Definition at line 1232 of file GModelSpatialDiffuseCube.cpp.

References GNodeArray::append(), GNodeArray::clear(), GSkyMap::clear(), energies(), filename(), G_LOAD_CUBE, GSkyMap::load(), m_cube, m_filename, m_loaded, m_logE, GSkyMap::nmaps(), set_energy_boundaries(), GEnergies::size(), and gammalib::str().

Referenced by fetch_cube(), and load().

int GModelSpatialDiffuseCube::maps ( void  ) const
inline

Return number of maps in cube.

Returns
Number of maps in cube.

Returns the number of maps in the cube.

Definition at line 181 of file GModelSpatialDiffuseCube.hpp.

References m_cube, and GSkyMap::nmaps().

Referenced by set_mc_cone().

GSkyDir GModelSpatialDiffuseCube::mc ( const GEnergy energy,
const GTime time,
GRan ran 
) const
virtual

Returns MC sky direction.

Parameters
[in]energyPhoton energy.
[in]timePhoton arrival time.
[in,out]ranRandom number generator.
Returns
Sky direction.
Exceptions
GException::invalid_valueNo map cube defined. No energy boundaries defined.
GException::invalid_return_valueSimulation cone not defined, does not overlap with map cube or map cube is empty for the specified energy.

Returns a random sky direction according to the intensity distribution of the model sky map and the specified energy. The method uses a rejection method to determine the sky direction. If no sky direction could be determined, the method throws an GException::invalid_return_value exception.

Implements GModelSpatialDiffuse.

Definition at line 377 of file GModelSpatialDiffuseCube.cpp.

References gammalib::acos(), exp(), fetch_cube(), G_MC, GNodeArray::inx_left(), GNodeArray::inx_right(), log(), GEnergy::log10MeV(), m_cube, m_ebounds, m_logE, m_mc_centre, m_mc_max, m_mc_one_minus_cosrad, max(), pixels(), GEnergy::print(), gammalib::rad2deg, GSkyDir::rotate_deg(), GNodeArray::set_value(), GEbounds::size(), GRan::uniform(), value(), GNodeArray::wgt_left(), and GNodeArray::wgt_right().

double GModelSpatialDiffuseCube::mc_norm ( const GSkyDir dir,
const double &  radius 
) const
inlinevirtual

Return normalization of diffuse cube for Monte Carlo simulations.

Parameters
[in]dirCentre of simulation cone.
[in]radiusRadius of simulation cone (degrees).
Returns
Normalization.

Returns the normalization of a diffuse cube. The normalization is given by the model value. The dir and radius parameters are not used.

Implements GModelSpatialDiffuse.

Definition at line 298 of file GModelSpatialDiffuseCube.hpp.

References value().

GModelSpatialDiffuseCube & GModelSpatialDiffuseCube::operator= ( const GModelSpatialDiffuseCube model)
virtual

Assignment operator.

Parameters
[in]modelMap cube model.
Returns
Map cube model.

Definition at line 248 of file GModelSpatialDiffuseCube.cpp.

References copy_members(), free_members(), init_members(), and GModelSpatialDiffuse::operator=().

int GModelSpatialDiffuseCube::pixels ( void  ) const
inline

Return number of pixels in cube.

Returns
Number of pixels in cube.

Returns the number of pixels in the cube.

Definition at line 195 of file GModelSpatialDiffuseCube.hpp.

References m_cube, and GSkyMap::npix().

Referenced by mc(), and set_mc_cone().

std::string GModelSpatialDiffuseCube::print ( const GChatter chatter = NORMAL) const
virtual
void GModelSpatialDiffuseCube::read ( const GXmlElement xml)
virtual

Read model from XML element.

Parameters
[in]xmlXML element.
Exceptions
GException::invalid_valueModel parameters not found in XML element.

Read the map cube information from an XML element. The XML element should have the format

<spatialModel type="DiffuseMapCube" file="test_file.fits">
  <parameter name="Normalization" ../>
</spatialModel>

Implements GModelSpatialDiffuse.

Definition at line 539 of file GModelSpatialDiffuseCube.cpp.

References GXmlElement::attribute(), G_READ, m_filename, m_value, GModelPar::read(), gammalib::xml_file_expand(), gammalib::xml_get_par(), and gammalib::xml_has_par().

Referenced by GModelSpatialDiffuseCube().

void GModelSpatialDiffuseCube::read ( const GFits fits)

Read diffuse cube from FITS file.

Parameters
[in]fitsFITS file.
Exceptions
GException::invalid_valueENERGIES extension incompatible with map cube.

Reads the diffuse cube sky map from the first extension in the fits file and the energy extension from the "ENERGIES" extension.

Definition at line 944 of file GModelSpatialDiffuseCube.cpp.

References GNodeArray::append(), GFits::at(), GNodeArray::clear(), GSkyMap::clear(), energies(), gammalib::extname_energies, GFitsHDU::exttype(), G_READ_FITS, GFitsHDU::has_card(), GFitsHDU::HT_IMAGE, GFitsHDU::integer(), m_cube, m_loaded, m_logE, GSkyMap::nmaps(), GEnergies::read(), GSkyMap::read(), set_energy_boundaries(), GEnergies::size(), GFits::size(), gammalib::str(), and GFits::table().

GSkyRegion * GModelSpatialDiffuseCube::region ( void  ) const
inlinevirtual

Return boundary sky region.

Returns
Boundary sky region.

Returns a sky region that fully encloses the point source.

Implements GModelSpatialDiffuse.

Definition at line 313 of file GModelSpatialDiffuseCube.hpp.

References m_region, and set_region().

void GModelSpatialDiffuseCube::save ( const GFilename filename,
const bool &  clobber = false 
) const

Save cube into FITS file.

Parameters
[in]filenameCube FITS file name.
[in]clobberOverwrite existing FITS file (default: false).

Saves spatial cube model into a FITS file.

Definition at line 916 of file GModelSpatialDiffuseCube.cpp.

References GFits::saveto(), and write().

void GModelSpatialDiffuseCube::set_energy_boundaries ( void  )
protected

Set energy boundaries.

Computes energy boundaries from the energy nodes. The boundaries will be computed as the centre in log10(energy) between the nodes. If only a single map exists, no boundaries will be computed.

Definition at line 1286 of file GModelSpatialDiffuseCube.cpp.

References GEbounds::append(), GEbounds::clear(), GEnergy::log10MeV(), m_ebounds, m_logE, and GNodeArray::size().

Referenced by energies(), load_cube(), and read().

void GModelSpatialDiffuseCube::set_mc_cone ( const GSkyDir centre,
const double &  radius 
) const

Set Monte Carlo simulation cone.

Parameters
[in]centreSimulation cone centre.
[in]radiusSimulation cone radius (degrees).

Sets the simulation cone centre and radius that defines the directions that will be simulated using the mc() method and pre-computes the maximum intensity and the spatially integrated flux of each map within the simulation cone region.

Definition at line 772 of file GModelSpatialDiffuseCube.cpp.

References GModelSpectralNodes::append(), gammalib::centre(), GModelSpectralNodes::clear(), cos(), gammalib::deg2rad, GSkyDir::dist_deg(), GModelSpectralNodes::energy(), fetch_cube(), GModelSpatial::flux(), GSkyMap::flux(), GModelSpectralNodes::intensity(), GEnergy::log10MeV(), m_cube, m_logE, m_mc_centre, m_mc_max, m_mc_one_minus_cosrad, m_mc_radius, m_mc_spectrum, maps(), GModelSpectralNodes::nodes(), GSkyMap::pix2dir(), pixels(), GModelSpectralNodes::reserve(), GNodeArray::size(), and value().

Referenced by GModelSky::mc(), and update_mc_cache().

void GModelSpatialDiffuseCube::set_region ( void  ) const
protected

Set boundary sky region.

Todo:
Implement determination of the cube boundary circle

Definition at line 1396 of file GModelSpatialDiffuseCube.cpp.

References GSkyRegionCircle::centre(), m_region, and GSkyRegionCircle::radius().

Referenced by region().

const GModelSpectralNodes & GModelSpatialDiffuseCube::spectrum ( void  ) const
inline

Get map cube spectrum.

Returns
Map cube spectrum.

Returns the map cube spectrum.

Definition at line 281 of file GModelSpatialDiffuseCube.hpp.

References m_mc_spectrum.

Referenced by GModelSky::mc().

std::string GModelSpatialDiffuseCube::type ( void  ) const
inlinevirtual

Return spatial model type.

Returns
Model type.

Returns the type of the spatial map cube model.

Implements GModelSpatialDiffuse.

Definition at line 167 of file GModelSpatialDiffuseCube.hpp.

References m_type.

Referenced by GModelSpatialDiffuseCube(), and write().

void GModelSpatialDiffuseCube::update_mc_cache ( void  )
protected

Update Monte Carlo cache.

Initialise the cache for Monte Carlo sampling of the map cube. The Monte Carlo cache consists of a linear array that maps a value between 0 and 1 into the skymap pixel for all maps in the cube.

Definition at line 1333 of file GModelSpatialDiffuseCube.cpp.

References gammalib::centre(), and set_mc_cone().

Referenced by cube(), energies(), and load().

double GModelSpatialDiffuseCube::value ( void  ) const
inline

Get model value.

Returns
Model value.

Returns the value of the spatial map cube model.

Definition at line 209 of file GModelSpatialDiffuseCube.hpp.

References m_value, and GOptimizerPar::value().

Referenced by eval(), mc(), mc_norm(), and set_mc_cone().

void GModelSpatialDiffuseCube::value ( const double &  value)
inline

Set model value.

Parameters
[in]valueModel value.

Set the value of the spatial map cube model.

Definition at line 223 of file GModelSpatialDiffuseCube.hpp.

References m_value, and GOptimizerPar::value().

void GModelSpatialDiffuseCube::write ( GXmlElement xml) const
virtual

Write model into XML element.

Parameters
[in]xmlXML element.
Exceptions
GException::model_invalid_spatialExisting XML element is not of type "MapCubeFunction"
GException::model_invalid_parnumInvalid number of model parameters found in XML element.
GException::model_invalid_parnamesInvalid model parameter names found in XML element.

Write the map cube information into an XML element. The XML element will have either the format

<spatialModel type="DiffuseMapCube" file="test_file.fits">
  <parameter name="Normalization" scale="1" value="1" min="0.1" max="10" free="0"/>
</spatialModel>

or alternatively

<spatialModel type="DiffuseMapCube" file="test_file.fits">
  <parameter name="Value" scale="1" value="1" min="0.1" max="10" free="0"/>
</spatialModel>

The latter format is the default for newly written XML elements.

Implements GModelSpatialDiffuse.

Definition at line 603 of file GModelSpatialDiffuseCube.cpp.

References GXmlNode::append(), GXmlElement::attribute(), GXmlNode::element(), GXmlNode::elements(), G_WRITE, m_filename, m_value, type(), GModelPar::write(), and gammalib::xml_file_reduce().

Referenced by save().

void GModelSpatialDiffuseCube::write ( GFits fits) const

Write diffuse cube into FITS file.

Parameters
[in]fitsFITS file.

Writes the diffuse cube sky map and the energy intervals into fits file.

Definition at line 1001 of file GModelSpatialDiffuseCube.cpp.

References GEnergies::append(), energies(), fetch_cube(), m_cube, m_logE, pow(), GNodeArray::size(), GEnergies::write(), and GSkyMap::write().

Member Data Documentation

GSkyMap GModelSpatialDiffuseCube::m_cube
protected
GEbounds GModelSpatialDiffuseCube::m_ebounds
protected

Energy bounds of the maps.

Definition at line 135 of file GModelSpatialDiffuseCube.hpp.

Referenced by copy_members(), init_members(), mc(), print(), and set_energy_boundaries().

GFilename GModelSpatialDiffuseCube::m_filename
protected
bool GModelSpatialDiffuseCube::m_loaded
protected

Signals if map cube has been loaded.

Definition at line 132 of file GModelSpatialDiffuseCube.hpp.

Referenced by copy_members(), cube(), fetch_cube(), init_members(), load_cube(), print(), and read().

GNodeArray GModelSpatialDiffuseCube::m_logE
protected

Log10(energy) values of the maps.

Definition at line 134 of file GModelSpatialDiffuseCube.hpp.

Referenced by copy_members(), cube_intensity(), energies(), init_members(), load_cube(), mc(), print(), read(), set_energy_boundaries(), set_mc_cone(), and write().

GSkyDir GModelSpatialDiffuseCube::m_mc_centre
mutableprotected

Centre of MC cone.

Definition at line 139 of file GModelSpatialDiffuseCube.hpp.

Referenced by copy_members(), init_members(), mc(), and set_mc_cone().

std::vector<double> GModelSpatialDiffuseCube::m_mc_max
mutableprotected

Maximum values for MC.

Definition at line 142 of file GModelSpatialDiffuseCube.hpp.

Referenced by copy_members(), init_members(), mc(), and set_mc_cone().

double GModelSpatialDiffuseCube::m_mc_one_minus_cosrad
mutableprotected

1-cosine of radius

Definition at line 141 of file GModelSpatialDiffuseCube.hpp.

Referenced by copy_members(), init_members(), mc(), and set_mc_cone().

double GModelSpatialDiffuseCube::m_mc_radius
mutableprotected

Radius of MC cone (degrees)

Definition at line 140 of file GModelSpatialDiffuseCube.hpp.

Referenced by copy_members(), init_members(), and set_mc_cone().

GModelSpectralNodes GModelSpatialDiffuseCube::m_mc_spectrum
mutableprotected

Map cube spectrum.

Definition at line 143 of file GModelSpatialDiffuseCube.hpp.

Referenced by copy_members(), init_members(), print(), set_mc_cone(), and spectrum().

GSkyRegionCircle GModelSpatialDiffuseCube::m_region
mutableprotected

Bounding circle.

Definition at line 136 of file GModelSpatialDiffuseCube.hpp.

Referenced by copy_members(), init_members(), region(), and set_region().

std::string GModelSpatialDiffuseCube::m_type
protected

Model type.

Definition at line 129 of file GModelSpatialDiffuseCube.hpp.

Referenced by copy_members(), GModelSpatialDiffuseCube(), init_members(), and type().

GModelPar GModelSpatialDiffuseCube::m_value
protected

The documentation for this class was generated from the following files: