GammaLib
2.1.0.dev
|
Interface for a sky region map. More...
#include <GSkyRegionMap.hpp>
Public Member Functions | |
GSkyRegionMap (void) | |
Void constructor. More... | |
GSkyRegionMap (const GFilename &filename) | |
FITS filename constructor. More... | |
GSkyRegionMap (const GSkyMap &map) | |
Sky map constructor. More... | |
GSkyRegionMap (const GSkyRegion *region) | |
Region conversion constructor. More... | |
GSkyRegionMap (const GSkyRegionMap ®ion) | |
Copy constructor. More... | |
virtual | ~GSkyRegionMap (void) |
Destructor. More... | |
GSkyRegionMap & | operator= (const GSkyRegionMap ®ion) |
Assignment operator. More... | |
void | clear (void) |
Clear instance. More... | |
GSkyRegionMap * | clone (void) const |
Clone sky region map. More... | |
std::string | classname (void) const |
Return class name. More... | |
void | read (const std::string &line) |
Create region from a string in DS9 format. More... | |
std::string | write (void) const |
Write string describing region in DS9 region format. More... | |
bool | contains (const GSkyDir &dir) const |
Check if a given direction is contained in this region. More... | |
bool | contains (const GSkyRegion ®) const |
Checks if a given region is fully contained within this region. More... | |
bool | overlaps (const GSkyRegion ®) const |
Checks if a given region is overlapping with this region. More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print region description. More... | |
void | load (const GFilename &filename) |
Load region map from FITS file. More... | |
void | map (const GSkyMap &map) |
Set sky map. More... | |
const GSkyMap & | map (void) const |
Return sky map. More... | |
const std::vector< int > & | nonzero_indices (void) const |
Get non-zero index vector. More... | |
Public Member Functions inherited from GSkyRegion | |
GSkyRegion (void) | |
Void constructor. More... | |
GSkyRegion (const GSkyRegion ®ion) | |
Copy constructor. More... | |
virtual | ~GSkyRegion (void) |
Destructor. More... | |
virtual GSkyRegion & | operator= (const GSkyRegion ®ion) |
Assignment operator. More... | |
const std::string & | type (void) const |
Return region type. More... | |
const std::string & | name (void) const |
Return region name. More... | |
const double & | solidangle (void) const |
Return solid angle of region. More... | |
void | type (const std::string &type) |
Set region type. More... | |
void | name (const std::string &name) |
Set region name. More... | |
void | solidangle (const double &solidangle) |
Set solid angle of 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 GSkyRegionMap ®ion) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | compute_solid_angle (void) |
Compute solid angle. More... | |
void | set_nonzero_indices (void) |
Create an array of non-zero pixel indices. More... | |
void | set_region_circle (const GSkyRegionCircle *circle) |
Set region map from region circle. More... | |
void | set_region_rectangle (const GSkyRegionRectangle *rect) |
Set region map from region rectangle. More... | |
Protected Member Functions inherited from GSkyRegion | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GSkyRegion ®ion) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Attributes | |
GSkyMap | m_map |
The region map. More... | |
std::vector< int > | m_nonzero_indices |
Vector of non-zero pixel indices. More... | |
Protected Attributes inherited from GSkyRegion | |
std::string | m_type |
Type of the region (circle, rectangle,...) More... | |
std::string | m_name |
Name of the region. More... | |
double | m_solid |
Solid angle subtended by the region (sr) More... | |
Interface for a sky region map.
This class provides an implementation for a sky region defined by a sky map. The map is provided as a FITS file. Pixels with non-zero values are within the region, pixels with zero values outside the region.
Definition at line 52 of file GSkyRegionMap.hpp.
GSkyRegionMap::GSkyRegionMap | ( | void | ) |
Void constructor.
Definition at line 61 of file GSkyRegionMap.cpp.
References init_members().
Referenced by clone().
|
explicit |
FITS filename constructor.
[in] | filename | FITS file. |
Constructs region from a FITS file.
Definition at line 78 of file GSkyRegionMap.cpp.
References init_members(), and load().
|
explicit |
Sky map constructor.
[in] | map | Sky map. |
Definition at line 96 of file GSkyRegionMap.cpp.
References init_members(), and map().
|
explicit |
Region conversion constructor.
[in] | region | Pointer to sky region. |
Constructs a sky region map from any region type.
Definition at line 116 of file GSkyRegionMap.cpp.
References copy_members(), init_members(), map(), set_region_circle(), and set_region_rectangle().
GSkyRegionMap::GSkyRegionMap | ( | const GSkyRegionMap & | region | ) |
Copy constructor.
[in] | region | Sky region map. |
Definition at line 153 of file GSkyRegionMap.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GSkyRegion.
Definition at line 105 of file GSkyRegionMap.hpp.
|
virtual |
Clear instance.
Implements GSkyRegion.
Definition at line 221 of file GSkyRegionMap.cpp.
References free_members(), GSkyRegion::free_members(), init_members(), and GSkyRegion::init_members().
|
virtual |
Clone sky region map.
Implements GSkyRegion.
Definition at line 241 of file GSkyRegionMap.cpp.
References GSkyRegionMap().
|
protected |
Compute solid angle.
Definition at line 565 of file GSkyRegionMap.cpp.
References m_map, m_nonzero_indices, GSkyRegion::m_solid, and GSkyMap::solidangle().
Referenced by copy_members(), load(), and map().
|
virtual |
Check if a given direction is contained in this region.
[in] | dir | Sky direction. |
Checks if sky direction is contained in the region map.
Implements GSkyRegion.
Definition at line 369 of file GSkyRegionMap.cpp.
References GSkyMap::contains(), GSkyMap::dir2inx(), and m_map.
Referenced by contains().
|
virtual |
Checks if a given region is fully contained within this region.
[in] | reg | Sky region. |
GException::feature_not_implemented | Specified sky region type not supported by method. |
Implements GSkyRegion.
Definition at line 400 of file GSkyRegionMap.cpp.
References GSkyRegionCircle::centre(), gammalib::centre(), contains(), G_CONTAINS, GSkyMap::inx2dir(), map(), nonzero_indices(), GSkyRegionCircle::radius(), GSkyDir::rotate_deg(), and GSkyRegion::type().
|
protected |
Copy class members.
[in] | map | Sky region map. |
Definition at line 538 of file GSkyRegionMap.cpp.
References compute_solid_angle(), m_map, and m_nonzero_indices.
Referenced by GSkyRegionMap(), and operator=().
|
protected |
Delete class members.
Definition at line 555 of file GSkyRegionMap.cpp.
Referenced by clear(), load(), operator=(), and ~GSkyRegionMap().
|
protected |
Initialise class members.
Definition at line 519 of file GSkyRegionMap.cpp.
References GSkyMap::clear(), m_map, m_nonzero_indices, and GSkyRegion::m_type.
Referenced by clear(), GSkyRegionMap(), load(), and operator=().
void GSkyRegionMap::load | ( | const GFilename & | filename | ) |
Load region map from FITS file.
[in] | filename | FITS file name. |
Definition at line 276 of file GSkyRegionMap.cpp.
References compute_solid_angle(), free_members(), init_members(), GSkyMap::load(), m_map, and set_nonzero_indices().
Referenced by GSkyRegionMap().
void GSkyRegionMap::map | ( | const GSkyMap & | map | ) |
Set sky map.
[in] | map | Sky map |
Sets the sky map of a region map.
Definition at line 255 of file GSkyRegionMap.cpp.
References compute_solid_angle(), m_map, map(), and set_nonzero_indices().
Referenced by GCTAOnOffObservation::compute_alpha(), GCTAOnOffObservation::compute_arf(), GCTAOnOffObservation::compute_arf_cut(), GCTAOnOffObservation::compute_bgd(), GCTAOnOffObservation::compute_rmf(), contains(), GSkyRegionCircle::contains(), and GSkyRegionRectangle::contains().
|
inline |
Return sky map.
Definition at line 117 of file GSkyRegionMap.hpp.
References m_map.
Referenced by GSkyRegionMap(), map(), set_region_circle(), and set_region_rectangle().
|
inline |
Get non-zero index vector.
Definition at line 129 of file GSkyRegionMap.hpp.
References m_nonzero_indices.
Referenced by GCTAOnOffObservation::compute_alpha(), GCTAOnOffObservation::compute_arf(), GCTAOnOffObservation::compute_arf_cut(), GCTAOnOffObservation::compute_bgd(), GCTAOnOffObservation::compute_rmf(), contains(), GSkyRegionCircle::contains(), and GSkyRegionRectangle::contains().
GSkyRegionMap & GSkyRegionMap::operator= | ( | const GSkyRegionMap & | region | ) |
Assignment operator.
[in] | region | Sky region map. |
Definition at line 191 of file GSkyRegionMap.cpp.
References copy_members(), free_members(), and init_members().
|
virtual |
Checks if a given region is overlapping with this region.
[in] | reg | Sky region. |
Implements GSkyRegion.
Definition at line 491 of file GSkyRegionMap.cpp.
References GSkyRegion::contains(), GSkyMap::inx2dir(), m_map, and m_nonzero_indices.
Referenced by GSkyRegionCircle::overlaps(), and GSkyRegionRectangle::overlaps().
Print region description.
[in] | chatter | Chattiness. |
Implements GSkyRegion.
Definition at line 340 of file GSkyRegionMap.cpp.
References m_map, GSkyMap::print(), and SILENT.
|
virtual |
Create region from a string in DS9 format.
[in] | line | String describing region in DS9 region format. |
Empty implementation of a virtual function because map is not supported as DS9 region.
Implements GSkyRegion.
Definition at line 308 of file GSkyRegionMap.cpp.
|
protected |
Create an array of non-zero pixel indices.
Definition at line 583 of file GSkyRegionMap.cpp.
References m_map, m_nonzero_indices, and GSkyMap::npix().
|
protected |
Set region map from region circle.
[in] | circle | Region circle |
Sets a region map from a region circle. The method allocates a sky map with a default resolution of 1/20 of the circle radius. In any case, the sky map resolution is comprised within [0.0002, 0.1] degrees. The default size of the sky map is 2.5 times the circle radius, and in any case, at least 10 sky map pixels will be allocated. The sky map will be in celestial coordinates and TAN projection.
Definition at line 612 of file GSkyRegionMap.cpp.
References GSkyRegionCircle::centre(), GSkyRegionCircle::dec(), GSkyDir::dist_deg(), GSkyMap::inx2dir(), map(), GSkyMap::npix(), GSkyRegionCircle::ra(), GSkyRegionCircle::radius(), and gammalib::resolution().
Referenced by GSkyRegionMap().
|
protected |
Set region map from region rectangle.
[in] | rect | Region rectangle |
Sets a region map from a region rectangle.
A skymap is allocated with a resolution goal of 0.01 degrees (same for both axes). The particular resolution of either axes depends on the width over height of the RoI of the rotated rectangle. The map extent is chosen dynamically to match the RoI of the rotated rectangle. Three sparse pixels are added at either side of the map. The sky map is created in celestial coordinates and TAN projection.
Definition at line 671 of file GSkyRegionMap.cpp.
References GSkyRegionRectangle::centre(), GSkyRegionRectangle::contains(), GSkyRegionRectangle::corner(), cos(), GSkyRegionRectangle::dec(), GSkyDir::dist(), map(), GSkyDir::posang(), GSkyRegionRectangle::ra(), gammalib::rad2deg, and sin().
Referenced by GSkyRegionMap().
|
virtual |
Write string describing region in DS9 region format.
Returns an empty string.
Implements GSkyRegion.
Definition at line 324 of file GSkyRegionMap.cpp.
|
protected |
The region map.
Definition at line 94 of file GSkyRegionMap.hpp.
Referenced by compute_solid_angle(), contains(), copy_members(), init_members(), load(), map(), overlaps(), print(), and set_nonzero_indices().
|
protected |
Vector of non-zero pixel indices.
Definition at line 95 of file GSkyRegionMap.hpp.
Referenced by compute_solid_angle(), copy_members(), init_members(), nonzero_indices(), overlaps(), and set_nonzero_indices().