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) {
616 double resolution = 0.05 * circle->
radius();
617 if (resolution < 0.0002) {
620 else if (resolution > 0.1) {
625 int nbins = int(2.5 * circle->
radius() / resolution);
632 resolution, resolution,
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) {
690 double dx = dist * std::sin(pa);
691 double dy = dist * std::cos(pa);
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) {
735 map_fine(ipix) = 1.0;
Mathematical function definitions.
Sky direction class interface definition.
Sky map class definition.
Circular sky region class interface definition.
Sky region map class interface definition.
Rectangular sky region class interface definition.
Abstract sky region base class interface definition.
void rotate_deg(const double &phi, const double &theta)
Rotate sky direction by zenith and azimuth angle.
double dist_deg(const GSkyDir &dir) const
Compute angular distance between sky directions in degrees.
double dist(const GSkyDir &dir) const
Compute angular distance between sky directions in radians.
double posang(const GSkyDir &dir, const std::string &coordsys="CEL") const
Compute position angle between sky directions in radians.
double solidangle(const int &index) const
Returns solid angle of pixel.
void clear(void)
Clear instance.
GSkyDir inx2dir(const int &index) const
Returns sky direction of pixel.
int dir2inx(const GSkyDir &dir) const
Returns pixel index for a given sky direction.
const int & npix(void) const
Returns number of pixels.
void load(const GFilename &filename)
Load skymap from FITS file.
bool contains(const GSkyDir &dir) const
Checks if sky direction falls in map.
std::string print(const GChatter &chatter=NORMAL) const
Print sky map.
Interface for the circular sky region class.
double dec(void) const
Return circular region centre Declination.
double ra(void) const
Return circular region centre Right Ascension.
const double & radius(void) const
Return circular region radius (in degrees)
const GSkyDir & centre(void) const
Return circular region centre.
Interface for a sky region map.
GSkyMap m_map
The region map.
void set_nonzero_indices(void)
Create an array of non-zero pixel indices.
void read(const std::string &line)
Create region from a string in DS9 format.
bool contains(const GSkyDir &dir) const
Check if a given direction is contained in this region.
void copy_members(const GSkyRegionMap ®ion)
Copy class members.
void map(const GSkyMap &map)
Set sky map.
GSkyRegionMap(void)
Void constructor.
GSkyRegionMap * clone(void) const
Clone sky region map.
bool overlaps(const GSkyRegion ®) const
Checks if a given region is overlapping with this region.
void init_members(void)
Initialise class members.
const std::vector< int > & nonzero_indices(void) const
Get non-zero index vector.
virtual ~GSkyRegionMap(void)
Destructor.
std::string write(void) const
Write string describing region in DS9 region format.
void compute_solid_angle(void)
Compute solid angle.
void load(const GFilename &filename)
Load region map from FITS file.
void set_region_rectangle(const GSkyRegionRectangle *rect)
Set region map from region rectangle.
const GSkyMap & map(void) const
Return sky map.
std::string print(const GChatter &chatter=NORMAL) const
Print region description.
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.
void free_members(void)
Delete class members.
void clear(void)
Clear instance.
GSkyRegionMap & operator=(const GSkyRegionMap ®ion)
Assignment operator.
Interface for the rectangular sky region class.
double dec(void) const
Return rectangular region centre Declination.
double ra(void) const
Return rectangular region centre Right Ascension.
bool contains(const GSkyDir &dir) const
Checks if sky direction lies within region.
const GSkyDir & centre(void) const
Return rectangular region centre.
GSkyDir corner(const int &index) const
Return sky direction of one corner of the rectangle.
Abstract interface for the sky region class.
const std::string & type(void) const
Return region type.
void init_members(void)
Initialise class members.
void free_members(void)
Delete class members.
virtual bool contains(const GSkyDir &dir) const =0
std::string m_type
Type of the region (circle, rectangle,...)
double m_solid
Solid angle subtended by the region (sr)