Luiza  v03-01
Public Member Functions | List of all members
gloria::GloriaSkyCatalog Class Reference

Class for storing catalogs of sky objects (eg. stars) More...

#include <GloriaSkyCatalog.h>

Inheritance diagram for gloria::GloriaSkyCatalog:
gloria::GloriaFitsTable gloria::GloriaFitsHeader

Public Member Functions

 GloriaSkyCatalog ()
 Default constructor. More...
 
void AddObject (double ra, double dec)
 Add new object to the list.
 
void AddObject ()
 Add new object to the list.
 
int GetObjectNumber ()
 Returns number of objects in the list.
 
double GetObjectRA (int iObject)
 Get object RA position.
 
double GetObjectDEC (int iObject)
 Get object DEC position.
 
vector< double > & GetRAVector ()
 Returns vector of object positions in RA.
 
vector< double > & GetDECVector ()
 Returns vector of object positions in DEC.
 
void SetObjectRA (int iObject, double ra)
 Set object RA position.
 
void SetObjectDEC (int iObject, double dec)
 Set object DEC position.
 
bool CheckCatalog ()
 Check catalog table structure.
 
GloriaFitsTableGetTable ()
 Returns the table itself.
 
int MatchObject (double ra, double dec, double cut)
 Match object in catalog by its position on the sky. More...
 
vector< long > MatchAllObjects (double ra, double dec, double distMax, double distMin=0.)
 Find all matching object in catalog at given position on the sky. More...
 
long * MatchObjectArray (int nObject, double *RaArr, double *DecArr, double cut)
 Match list of objects by their position on the sky. More...
 
vector< long > MatchObjectVector (vector< double > *RaVec, vector< double > *DecVec, double cut)
 Match list of objects by their position on the sky. More...
 
vector< long > MatchObjectTable (GloriaFitsTable *table, double cut, vector< string > RaDecNames, vector< string > CopyNames, vector< string > NewNames)
 Match objects in the table with the catalog, and copy catalog data. More...
 
vector< long > MatchObjectTable (GloriaFitsTable *table, double cut)
 Match objects in the table with the catalog (using default column names)
 
vector< long > MatchObjectTable (GloriaFitsTable *table, double cut, vector< string > RaDecNames)
 Match objects in the table with the catalog.
 
- Public Member Functions inherited from gloria::GloriaFitsTable
 GloriaFitsTable ()
 Default constructor. More...
 
 GloriaFitsTable (string FitsFileName)
 Constructor based on reading fits file.
 
 GloriaFitsTable (const GloriaFitsTable &sourceFitsTable)
 Copy constructor.
 
virtual ~GloriaFitsTable ()
 Destructor.
 
GloriaFitsTableoperator= (const GloriaFitsTable &tab)
 Assignment operator.
 
void ReadFitsFile (string FitsFileName)
 Read fits table from file. More...
 
void ReadTextFile (string TextFileName)
 Read table from text file. More...
 
void WriteFitsFile (string FitsFileName, bool binary_tbl=true)
 Write table to fits file. More...
 
void WriteTextFile (string TextFileName, int colWidth=10, char ColumnSeparator= ' ')
 Write table to text file. More...
 
void WriteTextStream (std::ostream &outF, int colWidth=10, char ColumnSeparator= ' ')
 Write table to output text stream. More...
 
int GetColumnNumber ()
 Returns number of defined columns.
 
int GetRowNumber ()
 Returns number of filled rows.
 
string GetColumnName (int iCol)
 Returns name of column.
 
int GetColumnId (string name)
 Returns column Id.
 
TableColumnType GetColumnType (int iCol)
 Returns type of column.
 
TableColumnType GetColumnType (string name)
 Returns type for given column name.
 
bool ColumnExists (string name)
 Check if given column exists.
 
GloriaTableColumnGetColumn (int iCol)
 Returns base class pointer for given column index.
 
GloriaTableColumnGetColumn (string name)
 Returns base class pointer for named column stored in the table.
 
template<class T >
GloriaTableColumnOf< T > * GetColumnOf (int iCol)
 Returns pointer to the column of given type, for given column index.
 
template<class T >
GloriaTableColumnOf< T > * GetColumnOf (string name)
 Returns pointer to the column of given type, for given column name.
 
template<class T >
vector< T > & GetVectorOf (int iCol)
 Returns data vector of given type, from given column index.
 
template<class T >
vector< T > & GetVectorOf (string name)
 Returns data vector of given type, from given column name.
 
template<class T >
T & GetValueOf (int iCol, int iRow)
 Returns value of given type, from given column index and row.
 
template<class T >
T & GetValueOf (string name, int iRow)
 Returns value of given type, from given column name and row.
 
void AddColumn (string Name, TableColumnType Type, string Unit="", string Comment="")
 Add column of given type to the table. More...
 
template<class T >
void AddColumn (string Name, T empty, string Unit="", string Comment="")
 Add column to the table. Type recognized by type of empty cell given. More...
 
void InsertColumn (GloriaTableColumn *source)
 Insert column in the table. More...
 
void InsertColumn (string NewName, GloriaTableColumn *source)
 Insert column in the table. More...
 
void AddRow ()
 Add new row in the table. More...
 
template<class T >
void AddRow (T val)
 Add new row and set value to the first column. More...
 
template<class T0 , class T1 >
void AddRow (T0 val0, T1 val1)
 Add new row and set value to the first two columns. More...
 
template<class T0 , class T1 , class T2 >
void AddRow (T0 val0, T1 val1, T2 val2)
 Add new row and set value to the first three columns. More...
 
template<class T0 , class T1 , class T2 , class T3 >
void AddRow (T0 val0, T1 val1, T2 val2, T3 val3)
 Add new row and set value to the first four columns. More...
 
template<class T0 , class T1 , class T2 , class T3 , class T4 >
void AddRow (T0 val0, T1 val1, T2 val2, T3 val3, T4 val4)
 Add new row and set value to the first five columns. More...
 
template<class T >
void SetValue (string Name, int iRow, T val)
 Set value of given cell.
 
template<class T >
void SetValue (int iCol, int iRow, T val)
 Set value of given cell.
 
template<class T >
void SetLast (int iCol, T val)
 Set value of last cell in given column.
 
template<class T >
void SetLast (string Name, T val)
 Set value of last cell in given column.
 
template<class T >
void GetValue (string Name, int iRow, T *val)
 Get value of given cell.
 
template<class T >
void GetValue (int iCol, int iRow, T *val)
 Get value of given cell.
 
void CopyTableRow (GloriaFitsTable *source, int isource, int itarget=-1)
 Copy row elements from other table (assuming types match!) More...
 
GloriaFitsTableEmptyClone ()
 Copy table structure and header information. Data is not copied.
 
void AdjustColumns ()
 Checks sizes of columns and adjust to the longest one if needed.
 
bool CheckTable ()
 Checks consistency of table structure.
 
long * CreateSortIndex (int iCol, bool reverse=false)
 Create an index array for accessing table rows in order of increasing column values.
 
long * CreateSortIndex (string name, bool reverse=false)
 Create an index array for accessing table rows in order of increasing column values.
 
void SortTable (int iCol, bool reverse=false)
 Sort table rows in order of increasing values of selected column.
 
void SortTable (string name, bool reverse=false)
 Sort table rows in order of increasing values of selected column.
 
bool IsSorted ()
 Check if table is sorted.
 
bool IsSortedBy (string name)
 Check if table is sorted by given column.
 
string SortName ()
 Return name of the column used for table sorting.
 
int SortColumn ()
 Return name of the column used for table sorting.
 
void DeleteRow (int iRow)
 Delete given row.
 
GloriaTableColumnRemoveColumn (int iCol)
 Return column pointer and remove it from the table structure.
 
GloriaTableColumnRemoveColumn (string name)
 Return column pointer and remove it from the table structure.
 
void DeleteColumn (int iCol)
 Delete given column.
 
void DeleteColumn (string name)
 Delete given column.
 
void ClearTable ()
 Clear the table (delete all rows, keep column definitions)
 
void EmptyTable ()
 Delete all columns in the table and clear table header.
 
void Print (std::ostream &os, int colWidth=10)
 Print table content to the stream.
 
- Public Member Functions inherited from gloria::GloriaFitsHeader
 GloriaFitsHeader ()
 Constructor.
 
virtual ~GloriaFitsHeader ()
 Destructor.
 
void ReadFitsHeader (fitsfile *fp)
 Read fits header from file. More...
 
void WriteFitsHeader (fitsfile *fp)
 Write header to fits file. More...
 
int GetKeywordNumber ()
 Number of records defined in the header.
 
HeaderRecordGetRecordAt (const int ikey)
 Access header record by record index.
 
std::string & GetKeywordAt (const int ikey)
 Access header keyword by record index.
 
std::string & GetValueAt (const int ikey)
 Access header value (string) by record index.
 
std::string & GetCommentAt (const int ikey)
 Access header comment by record index.
 
bool IsKeywordSet (const char *keyword)
 Check if given keyword is set in the header.
 
HeaderRecordGetKeywordRecord (const char *keyword)
 Access header record by record index.
 
std::string & GetKeywordValue (const char *keyword)
 Access header value (string) by keyword.
 
long GetKeywordValueInt (const char *keyword)
 Access header value (long int) by keyword.
 
double GetKeywordValueDouble (const char *keyword)
 Access header value (double) by keyword.
 
void AddKeyword (const char *keyword, std::string value, std::string comment)
 Add new keyword to the fits header.
 
void AddKeywordDouble (const char *keyword, double value, std::string comment)
 Add new keyword to the fits header, as double.
 
void AddKeywordInt (const char *keyword, int value, std::string comment)
 Add new keyword to the fits header, as int.
 
void AddKeyword (HeaderRecord record)
 Add new keyword record to the fits header.
 
void SetKeyword (const char *keyword, std::string value, std::string comment)
 Set new value for the existing keyword. Add it if not present.
 
void SetKeywordDouble (const char *keyword, double value, std::string comment)
 Set new value for the existing keyword as double. Add it if not present.
 
void SetKeywordInt (const char *keyword, int value, std::string comment)
 Set new value for the existing keyword as int. Add it if not present.
 
void AddComment (std::string comment)
 Add comment to the header.
 
void AddHistory (std::string history)
 Add history to the header.
 
void RemoveKeyword (const char *keyword)
 Remove given keyword from header. More...
 
void RemoveKeywords (const char *keyword)
 Remove given keyword from header. More...
 
void CopyHeader (GloriaFitsHeader *source)
 Copy full header from given data object (table or image);.
 
void PrintHeader (std::ostream &os, int maxRec=100)
 Print FITS header to output stream. Use maxRec=0 to print all records.
 
bool OK ()
 Method returning true if processing was successful.
 
bool Error ()
 Method returning true if there was an error in data processing.
 
std::string ErrorMessage ()
 Returns error message string.
 
void ClearError ()
 Method returning true if there was an error in data processing.
 
std::string InputFileName ()
 
void SetInputFileName (string name)
 
std::string OutputFileName ()
 

Additional Inherited Members

- Protected Attributes inherited from gloria::GloriaFitsTable
int _nRow
 Table size.
 
vector< GloriaTableColumn * > _columns
 Column vector.
 
multimap< string, int > _nameMap
 Column name map. Name is not always unique!
 
int _nSorted
 Number of sorted rows.
 
string _sortName
 Name of column used for sorting.
 
int _sortColumn
 ID of column used for sorting.
 

Detailed Description

Class for storing catalogs of sky objects (eg. stars)

This class defines GloriaFitsTable with predefined columns for storing position of objects on the sky ("RA" and "DEC"). It is expected that RA and DEC values are given in degrees according to J2000. User can add additional columns if needed. This makes sure that catalogs will be exchangeable between processors and allows implementing general matching algorithms.

Author
A.F.Zarnecki, University of Warsaw, zarne.nosp@m.cki@.nosp@m.fuw.e.nosp@m.du.p.nosp@m.l

Constructor & Destructor Documentation

gloria::GloriaSkyCatalog::GloriaSkyCatalog ( )

Default constructor.

Default constructor cretes empty table

References gloria::GloriaFitsTable::AddColumn().

Member Function Documentation

vector< long > gloria::GloriaSkyCatalog::MatchAllObjects ( double  ra,
double  dec,
double  distMax,
double  distMin = 0. 
)

Find all matching object in catalog at given position on the sky.

This method finds matching objects in the catalog for given values of RA and DEC (in degrees). Vector of index to the matching raws is returned (empty vector no match found). distMax and distMin parameters determine the maximal and minimal matching radius (in degrees). The method can be used to search for neighbouring objects (eg. reference stars) for given star (in that case one should set distMin > 0 to avoid matching object to itself). Returned objects are sorted by the distance (from the smallest to the largest one) to the given position.

References gloria::GloriaFitsTable::_columns, and gloria::GloriaFitsTable::_nRow.

int gloria::GloriaSkyCatalog::MatchObject ( double  ra,
double  dec,
double  cut 
)

Match object in catalog by its position on the sky.

This method finds matching objects in the catalog for given values of RA and DEC (in degrees). Index of the matching raw is returned or -1 if no match found. cut parameter is used as the matching tolerance (maximum distance of the matched object in degrees). If cut==0, closes object is returned (without any constraints).

References gloria::GloriaFitsTable::_columns, and gloria::GloriaFitsTable::_nRow.

long * gloria::GloriaSkyCatalog::MatchObjectArray ( int  nObject,
double *  RaArr,
double *  DecArr,
double  cut 
)

Match list of objects by their position on the sky.

This method can be used to find matching objects for all entries in the object table. Pointers to RA and DEC value arrays need to be given. Pointer to array of matched sky objects (indexes in the catalog table) is returned. Procedure is faster if the catalog is prevuiously sorted in DEC (with SortTable("DEC") ).

References MatchObjectVector().

vector< long > gloria::GloriaSkyCatalog::MatchObjectTable ( GloriaFitsTable table,
double  cut,
vector< string >  RaDecNames,
vector< string >  CopyNames,
vector< string >  NewNames 
)

Match objects in the table with the catalog, and copy catalog data.

This method can be used to find matching objects for all entries in the object table. Pointers to the object table has to be given, as well as names of columns with RA and DEC values. Vector of matched sky objects (indexes in the catalog table) is returned. In addition, columns listed in CopyNames vector are copied from the catalog to the table being matched (can be used eg. to store catalog magnitudo, position, or star ID). If NewNames vector is specified (not empty) column names are changed accordingly. Procedure is faster if the catalog is prevuiously sorted in DEC (with SortTable("DEC") ).

References gloria::GloriaFitsTable::_columns, gloria::GloriaFitsTable::_nRow, gloria::GloriaFitsTable::AdjustColumns(), gloria::GloriaFitsTable::ColumnExists(), gloria::GloriaTableColumn::CopyCellValue(), gloria::GloriaFitsTable::CreateSortIndex(), gloria::GloriaTableColumn::EmptyClone(), gloria::GloriaFitsTable::GetColumn(), gloria::GloriaFitsTable::GetRowNumber(), gloria::GloriaFitsTable::GetVectorOf(), gloria::GloriaFitsTable::InsertColumn(), and gloria::GloriaFitsTable::IsSortedBy().

Referenced by MatchObjectTable(), MatchObjectVector(), luiza::MatchSkyCatalog::processData(), luiza::SelectNewObjects::processData(), and luiza::CalibrateFrameObjects::processData().

vector< long > gloria::GloriaSkyCatalog::MatchObjectVector ( vector< double > *  RaVec,
vector< double > *  DecVec,
double  cut 
)

Match list of objects by their position on the sky.

This method can be used to find matching objects for all entries in the object table. Pointers to RA and DEC value vectors need to be given. Vector of matched sky objects (indexes in the catalog table) is returned. Procedure is faster if the catalog is prevuiously sorted in DEC (with SortTable("DEC") ).

References gloria::GloriaTableColumnOf< T >::Data(), gloria::GloriaFitsTable::InsertColumn(), and MatchObjectTable().

Referenced by MatchObjectArray().


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