41 #define G_CONTAINS "GSkyRegionMap::contains(GSkyRegion&)"
133 else if (circle != NULL) {
139 else if (rect != NULL) {
194 if (
this != ®ion) {
349 result.append(
"=== GSkyRegionMap ===");
350 result.append(
"\n(");
372 bool contain =
false;
381 contain = (
m_map(i,0) != 0.0);
406 if (reg.
type() ==
"Map") {
416 for (
int i = 0; i < regnzvec.size(); ++i) {
426 else if (reg.
type() ==
"Circle") {
434 double rad = inreg->
radius();
437 const int numtest = 360;
438 double rotangle = 360.0 / numtest;
440 for (
int i = 0; i < numtest; ++i) {
452 else if (reg.
type() ==
"Rectangle") {
466 for (
int i = 0; i < regnzvec.size(); ++i) {
477 "Method only implemented for cicular, rectangular and map regions.");
494 bool overlap =
false;
590 if (
m_map(i,0) != 0.0) {
617 if (resolution < 0.0002) {
620 else if (resolution > 0.1) {
636 for (
int i = 0; i <
map.
npix(); ++i) {
643 if (distance <= circle->radius()) {
674 const double resolution_goal = 0.01;
680 for (
int icorner = 0; icorner < 4; ++icorner) {
708 int nbins_x = int(map_width / resolution_goal + 0.5);
709 int nbins_y = int(map_height / resolution_goal + 0.5);
720 double resolution_x = map_width / nbins_x;
721 double resolution_y = map_height / nbins_y;
729 -resolution_x, resolution_y,
733 for (
int ipix = 0; ipix < map_fine.npix(); ++ipix) {
734 if (rect->
contains(map_fine.inx2dir(ipix))) {
735 map_fine(ipix) = 1.0;
void set_nonzero_indices(void)
Create an array of non-zero pixel indices.
GSkyRegionMap(void)
Void constructor.
double dist_deg(const GSkyDir &dir) const
Compute angular distance between sky directions in degrees.
double m_solid
Solid angle subtended by the region (sr)
Rectangular sky region class interface definition.
void copy_members(const GSkyRegionMap ®ion)
Copy class members.
Sky direction class interface definition.
double dec(void) const
Return rectangular region centre Declination.
const GSkyMap & map(void) const
Return sky map.
void free_members(void)
Delete class members.
GVector cos(const GVector &vector)
Computes cosine of vector elements.
void compute_solid_angle(void)
Compute solid angle.
void init_members(void)
Initialise class members.
const std::string & type(void) const
Return region type.
bool contains(const GSkyDir &dir) const
Check if a given direction is contained in this region.
Interface for the circular sky region class.
Interface for the rectangular sky region class.
Sky map class definition.
std::string m_type
Type of the region (circle, rectangle,...)
std::string centre(const std::string &s, const int &n, const char &c= ' ')
Centre string to achieve a length of n characters.
const double & radius(void) const
Return circular region radius (in degrees)
void map(const GSkyMap &map)
Set sky map.
GSkyRegionMap & operator=(const GSkyRegionMap ®ion)
Assignment operator.
std::string print(const GChatter &chatter=NORMAL) const
Print sky map.
void clear(void)
Clear instance.
const std::vector< int > & nonzero_indices(void) const
Get non-zero index vector.
Abstract interface for the sky region class.
GSkyRegionMap * clone(void) const
Clone sky region map.
GSkyDir inx2dir(const int &index) const
Returns sky direction of pixel.
virtual bool contains(const GSkyDir &dir) const =0
bool overlaps(const GSkyRegion ®) const
Checks if a given region is overlapping with this region.
virtual ~GSkyRegionMap(void)
Destructor.
void rotate_deg(const double &phi, const double &theta)
Rotate sky direction by zenith and azimuth angle.
bool contains(const GSkyDir &dir) const
Checks if sky direction lies within region.
void init_members(void)
Initialise class members.
bool contains(const GSkyDir &dir) const
Checks if sky direction falls in map.
double resolution(const GModelSpatial *model)
Determine resolution of spatial model.
Interface for a sky region map.
void clear(void)
Clear instance.
void free_members(void)
Delete class members.
double dec(void) const
Return circular region centre Declination.
void read(const std::string &line)
Create region from a string in DS9 format.
std::vector< int > m_nonzero_indices
Vector of non-zero pixel indices.
void set_region_circle(const GSkyRegionCircle *circle)
Set region map from region circle.
double posang(const GSkyDir &dir, const std::string &coordsys="CEL") const
Compute position angle between sky directions in radians.
const GSkyDir & centre(void) const
Return circular region centre.
double ra(void) const
Return rectangular region centre Right Ascension.
std::string write(void) const
Write string describing region in DS9 region format.
Sky region map class interface definition.
GSkyMap m_map
The region map.
void set_region_rectangle(const GSkyRegionRectangle *rect)
Set region map from region rectangle.
GVector sin(const GVector &vector)
Computes sine of vector elements.
std::string print(const GChatter &chatter=NORMAL) const
Print region description.
void load(const GFilename &filename)
Load region map from FITS file.
double dist(const GSkyDir &dir) const
Compute angular distance between sky directions in radians.
GSkyDir corner(const int &index) const
Return sky direction of one corner of the rectangle.
const GSkyDir & centre(void) const
Return rectangular region centre.
double solidangle(const int &index) const
Returns solid angle of pixel.
void load(const GFilename &filename)
Load skymap from FITS file.
const int & npix(void) const
Returns number of pixels.
int dir2inx(const GSkyDir &dir) const
Returns pixel index for a given sky direction.
Circular sky region class interface definition.
Abstract sky region base class interface definition.
Mathematical function definitions.
double ra(void) const
Return circular region centre Right Ascension.