39 #define G_NAXIS "GLATEventCube::naxis(int)"
40 #define G_DIFFNAME "GLATEventCube::diffname(int&)"
41 #define G_DIFFRSP "GLATEventCube::diffrsp(int&)"
42 #define G_READ_SRCMAP "GLATEventCube::read_srcmap(GFitsImage&)"
43 #define G_SET_DIRECTIONS "GLATEventCube::set_directions()"
44 #define G_SET_ENERGIES "GLATEventCube::set_energies()"
45 #define G_SET_TIMES "GLATEventCube::set_times()"
46 #define G_SET_BIN "GLATEventCube::set_bin(int&)"
51 #define G_MISSING_WCS_KLUDGE
281 #if defined(G_RANGE_CHECK)
282 if (axis < 0 || axis >=
dim()) {
315 GFits fits(filename);
337 const bool& clobber)
const
346 fits.
saveto(filename, clobber);
384 for (
int i = 1; i < fits.
size(); ++i) {
394 #if defined(G_MISSING_WCS_KLUDGE)
395 std::string keys[] = {
"CTYPE1",
"CTYPE2",
"CTYPE3",
396 "CRPIX1",
"CRPIX2",
"CRPIX3",
397 "CRVAL1",
"CRVAL2",
"CRVAL3",
398 "CDELT1",
"CDELT2",
"CDELT3",
399 "CUNIT1",
"CUNIT2",
"CUNIT3",
401 for (
int i = 0; i < 16; ++i) {
402 if (!hdu_srcmap.
has_card(keys[i])) {
403 const_cast<GFitsImage&
>(hdu_srcmap).card(hdu_cntmap.
card(keys[i]));
437 for (
int i = 0; i <
m_srcmap.size(); ++i) {
460 if (
size() > 0 && pixels != NULL) {
461 for (
int i = 0; i <
size(); ++i) {
467 return int(number+0.5);
502 result.append(
"=== GLATEventCube ===");
524 result.append(
"not defined");
533 result.append(
"not defined");
538 if (reduced_chatter >
SILENT) {
548 for (
int i = 0; i <
m_srcmap.size(); ++i) {
551 result.append(
" x ");
553 result.append(
" x ");
580 #if defined(G_RANGE_CHECK)
581 if (index < 0 || index >=
ndiffrsp()) {
606 #if defined(G_RANGE_CHECK)
607 if (index < 0 || index >=
ndiffrsp()) {
642 for (
int ix = 0; ix <
nx(); ++ix) {
645 if (distance < radius) {
652 for (
int ix = 0; ix <
nx(); ++ix) {
655 if (distance < radius) {
662 for (
int iy = 0; iy <
ny(); ++iy) {
665 if (distance < radius) {
672 for (
int iy = 0; iy <
ny(); ++iy) {
675 if (distance < radius) {
736 for (
int i = 0; i < cube.
m_srcmap.size(); ++i) {
752 for (
int i = 0; i <
m_srcmap.size(); ++i) {
809 std::string msg =
"Specified source map projection in HDU \""+
810 hdu.
extname()+
"\" is incompatible with map projection "
811 "of the event cube. Please specify a compatible "
822 hdu.
extname()+
"\" is not compatible with number of "
825 "Please specify a source map of compatible size.";
832 " in source map in HDU \""+hdu.
extname()+
"\" is not "
833 "compatible with number of energy bin boundaries ("+
835 "Please specify a source map of compatible size.";
897 hdu_local->
card(
"MJDREFI", 51910,
898 "Integer part of MJD reference");
899 hdu_local->
card(
"MJDREFF", 0.00074287037037037,
900 "Fractional part of MJD reference");
929 std::string msg =
"LAT event cube contains no sky pixels. Please "
930 "provide a valid LAT event cube.";
943 for (
int iy = 0; iy <
ny(); ++iy) {
944 for (
int ix = 0; ix <
nx(); ++ix) {
970 std::string msg =
"LAT event cube contains no energy bins. Please "
971 "provide a valid LAT event cube.";
985 for (
int i = 0; i <
ebins(); ++i) {
1015 std::string msg =
"No Good Time Intervals have been found in event "
1016 "cube. Every LAT event cube needs a definition "
1017 "of the Good Time Intervals.";
1052 #if defined(G_RANGE_CHECK)
1053 if (index < 0 || index >=
size()) {
1061 ") is incompatible with size of energies ("+
1064 "). Please provide an correctly initialised event "
1072 ") is incompatible with size of sky directions ("+
1075 "). Please provide an correctly initialised event "
GTime m_time
Event cube mean time.
GFitsHDU * at(const int &extno)
Get pointer to HDU.
virtual int naxis(const int &axis) const
Return number of bins in axis.
const GGti & gti(void) const
Return Good Time Intervals.
double dist_deg(const GSkyDir &dir) const
Compute angular distance between sky directions in degrees.
GSkyMap * diffrsp(const int &index) const
Return diffuse response map.
Abstract FITS image base class.
void init_members(void)
Initialise class members.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
bool has_card(const int &cardno) const
Check existence of header card.
const int & ny(void) const
Returns number of pixels in y coordinate.
const GSkyProjection * projection(void) const
Returns pointer to sky projection.
virtual void set_times(void)
Set mean event time and ontime of event cube.
virtual ~GLATEventCube(void)
Destructor.
int m_index
Actual skymap index.
int ndiffrsp(void) const
Return number of diffuse model components.
void free_members(void)
Delete class members.
void init_members(void)
Initialise class members.
Fermi/LAT instrument direction class.
double maxrad(const GSkyDir &dir) const
Computes the maximum radius (in degrees) around a given source direction that fits spatially into the...
void free_members(void)
Delete class members.
virtual void load(const GFilename &filename)
Load LAT event cube from FITS file.
void read_gti(const GFitsTable &hdu)
Read GTIs from HDU.
virtual GEventCube & operator=(const GEventCube &cube)
Assignment operator.
const GTime & tstop(void) const
Return stop time.
int nx(void) const
Return number of bins in X direction.
void clear(void)
Clear node array.
virtual HDUType exttype(void) const =0
void clear(void)
Clear time.
GEbounds m_ebounds
Energy boundaries covered by events.
std::vector< GEnergy > m_ewidth
Array of energy bin widths.
void read(const GFitsTable &table)
Read energy boundaries from FITS table.
virtual void read(const GFits &file)
Read LAT event cube from FITS file.
const std::string extname_gti
const GFitsHeader & header(void) const
Return extension header.
GLATInstDir * m_dir
Pointer to bin direction.
GEnergy * m_ewidth
Pointer to energy width of bin.
std::string strip_whitespace(const std::string &arg)
Strip leading and trailing whitespace from string.
void read(const GFitsHDU &hdu)
Read skymap from FITS HDU.
void write(GFits &file, const std::string &extname=gammalib::extname_ebounds, const std::string &unit="keV") const
Write energy boundaries into FITS object.
int size(void) const
Return number of Good Time Intervals.
virtual int size(void) const
Return number of bins in event cube.
Abstract FITS image base class definition.
virtual void clear(void)
Clear instance.
GEnergy * m_energy
Pointer to bin energy.
std::vector< double > m_solidangle
Array of solid angles (sr)
int m_ipix
Actual spatial index.
void read_srcmap(const GFitsImage &hdu)
Read LAT source map from HDU.
void set_bin(const int &index)
Set event bin.
Fermi/LAT event bin class.
void saveto(const GFilename &filename, const bool &clobber=false)
Saves to specified FITS file.
int m_ieng
Actual energy index.
GNodeArray m_enodes
Energy nodes.
void init_members(void)
Initialise class members.
GSkyDir pix2dir(const GSkyPixel &pixel) const
Returns sky direction of pixel.
GLATEventCube(void)
Void constructor.
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save LAT event cube into FITS file.
const int & nmaps(void) const
Returns number of maps.
GLATEventBin m_bin
Actual energy bin.
int npix(void) const
Return number of pixels in event cube sky map.
double * m_solidangle
Pointer to solid angle of pixel (sr)
int ebins(void) const
Return number of energy bins in event cube.
GFitsHDU * write(GFits &file, const std::string &extname="") const
Write sky map into FITS file.
void free_members(void)
Delete class members.
virtual GLATEventCube & operator=(const GLATEventCube &cube)
Assignment operator.
const std::string extname_ebounds
bool contains(const GSkyDir &dir) const
Checks if sky direction falls in map.
virtual void set_energies(void)
Set log mean energies and energy widths of event cube.
Abstract interface for FITS table.
GGti m_gti
Good time intervals covered by events.
virtual void write(GFits &file) const
Write LAT event cube into FITS file.
Fermi/LAT event cube class definition.
void copy_members(const GLATEventCube &cube)
Copy class members.
double m_ontime
Event cube ontime (sec)
void clear(void)
Clear instance.
Fermi/LAT event cube class.
const GTime & tstop(void) const
Returns latest stop time in Good Time Intervals.
void read_ebds(const GFitsTable &hdu)
Read energy boundaries from HDU.
const std::string & extname(void) const
Return extension name.
const GTime & tstart(void) const
Returns earliest start time in Good Time Intervals.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print event cube information.
std::vector< GSkyMap * > m_srcmap
Pointers to source maps.
std::vector< GEnergy > m_energies
Array of log mean energies.
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
virtual void clear(void)
Clear event bin.
double * m_ontime
Pointer to ontime of bin (seconds)
double * m_counts
Pointer to number of counts.
GFitsImage * image(const int &extno)
Get pointer to image HDU.
void set_directions(void)
Set sky directions and solid angles of events cube.
const GEnergy & emin(void) const
Return minimum energy.
void read(const GFitsTable &table)
Read Good Time Intervals and time reference from FITS table.
int size(void) const
Return number of HDUs in FITS file.
GChatter reduce(const GChatter &chatter)
Reduce chattiness by one level.
std::vector< GLATInstDir > m_dirs
Array of event directions.
std::string string(const std::string &keyname) const
Return card value as string.
virtual GFitsTable * clone(void) const =0
Clones object.
Exception handler interface definition.
const int & nx(void) const
Returns number of pixels in x coordinate.
const GEbounds & ebounds(void) const
Return energy boundaries.
virtual GLATEventBin * operator[](const int &index)
Event bin access operator.
const GSkyMap & map(void) const
Return event cube sky map.
virtual int number(void) const
Return number of events in cube.
virtual GLATEventCube * clone(void) const
Clone instance.
virtual int dim(void) const
Return dimension of event cube.
GLATEventCube * m_cube
Event cube back pointer.
void read_cntmap(const GFitsImage &hdu)
Read Fermi/LAT counts map from HDU.
double solidangle(const int &index) const
Returns solid angle of pixel.
GTime * m_time
Pointer to bin time.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
void append(const double &node)
Append one node to array.
const GTime & tstart(void) const
Return start time.
const int & npix(void) const
Returns number of pixels.
GFitsHeaderCard & card(const int &cardno)
Return header card.
void write(GFits &fits, const std::string &extname=gammalib::extname_gti) const
Write Good Time Intervals and time reference into FITS object.
Abstract event bin container class.
void close(void)
Close FITS file.
const GEnergy & emax(void) const
Return maximum energy.
int ny(void) const
Return number of bins in Y direction.
const double & ontime(void) const
Returns ontime.
const double * pixels(void) const
Returns pointer to pixel data.
std::vector< std::string > m_srcmap_names
Source map names.
Filename class interface definition.
GSkyMap m_map
Counts map stored as sky map.
GVector log10(const GVector &vector)
Computes base10 logarithm of vector elements.
GEnergy elogmean(const GEnergy &a, const GEnergy &b)
Computes log mean energy.
std::string diffname(const int &index) const
Return name of diffuse model.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
FITS table abstract base class interface definition.