[3493] | 1 | /*
|
---|
| 2 | --- SOPHYA software - FitsIOServer module ---
|
---|
| 3 | C. Magneville, 2001
|
---|
| 4 | (C) UPS+LAL IN2P3/CNRS (C) DAPNIA-SPP/CEA
|
---|
| 5 | */
|
---|
[1661] | 6 | /* Interface Fits pour bolometre cmv 29/09/2001 */
|
---|
| 7 | #ifndef FBOLOREAD_H_SEEN
|
---|
| 8 | #define FBOLOREAD_H_SEEN
|
---|
| 9 |
|
---|
| 10 | #include "machdefs.h"
|
---|
[2322] | 11 | #include <iostream>
|
---|
[1661] | 12 | #include <string.h>
|
---|
| 13 | #include <string>
|
---|
| 14 |
|
---|
| 15 | #include "anydataobj.h"
|
---|
| 16 | #include "tvector.h"
|
---|
| 17 | #include "fabtcolread.h"
|
---|
| 18 |
|
---|
| 19 | #include <vector>
|
---|
| 20 |
|
---|
| 21 | namespace SOPHYA {
|
---|
| 22 |
|
---|
| 23 | //! Class for defining a bolometer by connecting columns out FITS files
|
---|
| 24 | class FitsBoloRead : public AnyDataObj {
|
---|
| 25 | public:
|
---|
| 26 | enum {ColSNum=0, ColBolo=1, ColFlag=2, ColAlpha=3, ColDelta=4};
|
---|
| 27 |
|
---|
[4029] | 28 | FitsBoloRead(void);
|
---|
[1661] | 29 | virtual ~FitsBoloRead();
|
---|
| 30 |
|
---|
| 31 | //! Define the Alpha column connection (see addcol).
|
---|
| 32 | inline int SetAlpha(const char *label,const char* fname="",int ihdu=0)
|
---|
| 33 | {return addcol(ColAlpha,label,fname,ihdu);}
|
---|
| 34 | //! Define the Delta column connection (see addcol).
|
---|
| 35 | inline int SetDelta(const char *label,const char* fname="",int ihdu=0)
|
---|
| 36 | {return addcol(ColDelta,label,fname,ihdu);}
|
---|
| 37 | //! Define the Bolo column connection (see addcol).
|
---|
| 38 | inline int SetBolo(const char *label,const char* fname="",int ihdu=0)
|
---|
| 39 | {return addcol(ColBolo,label,fname,ihdu);}
|
---|
| 40 | //! Define the Flag column connection (see addcol).
|
---|
| 41 | inline int SetFlag(const char *label,const char* fname="",int ihdu=0)
|
---|
| 42 | {return addcol(ColFlag,label,fname,ihdu);}
|
---|
| 43 | //! Define the Sample Number column connection (see addcol).
|
---|
| 44 | inline int SetSNum(const char *label,const char* fname="",int ihdu=0)
|
---|
| 45 | {return addcol(ColSNum,label,fname,ihdu);}
|
---|
| 46 | //! Add a new column connection (see addcol).
|
---|
| 47 | inline int AddCol(const char *label,const char* fname,int ihdu=0)
|
---|
| 48 | {return addcol(-1,label,fname,ihdu);}
|
---|
| 49 |
|
---|
| 50 | //! return Alpha value for row "n" into double
|
---|
[4029] | 51 | inline double GetAlpha(LONGLONG n)
|
---|
| 52 | {return GetCol(ColAlpha,n);}
|
---|
[1661] | 53 | //! return Delta value for row "n" into double
|
---|
[4029] | 54 | inline double GetDelta(LONGLONG n)
|
---|
| 55 | {return GetCol(ColDelta,n);}
|
---|
[1661] | 56 | //! return Bolo value for row "n" into double
|
---|
[4029] | 57 | inline double GetBolo(LONGLONG n)
|
---|
| 58 | {return GetCol(ColBolo,n);}
|
---|
[1661] | 59 | //! return Flag value for row "n" into double
|
---|
[4029] | 60 | inline double GetFlag(LONGLONG n)
|
---|
| 61 | {if(!IsFlag()) return 0.; return GetCol(ColFlag,n);}
|
---|
[1661] | 62 | //! return SNum value for row "n" into double
|
---|
[4029] | 63 | inline double GetSNum(LONGLONG n) {return GetCol(ColSNum,n);}
|
---|
[1661] | 64 | //! return column "col" value for row "n" into double
|
---|
[4029] | 65 | inline double GetCol(int col,LONGLONG n) {
|
---|
[1661] | 66 | if(col<0 || col>=(int)mFABT.size())
|
---|
| 67 | throw ParmError("FitsBoloRead::GetCol: bad column number\n");
|
---|
| 68 | if(mFABT[col]==NULL)
|
---|
| 69 | throw NullPtrError("FitsBoloRead::GetCol: column not connected\n");
|
---|
[4029] | 70 | return mFABT[col]->Read(n);
|
---|
[1661] | 71 | }
|
---|
| 72 |
|
---|
| 73 | //! return Alpha values for rows [n1,n2] into TVector
|
---|
[3128] | 74 | inline LONGLONG GetAlpha(LONGLONG n1,LONGLONG n2,TVector<double>& data)
|
---|
[1661] | 75 | {return GetCol(ColAlpha,n1,n2,data);}
|
---|
[3128] | 76 | inline LONGLONG GetAlpha(LONGLONG n1,LONGLONG n2,TVector<float>& data)
|
---|
[1661] | 77 | {return GetCol(ColAlpha,n1,n2,data);}
|
---|
[3128] | 78 | inline LONGLONG GetAlpha(LONGLONG n1,LONGLONG n2,TVector<int_4>& data)
|
---|
[1661] | 79 | {return GetCol(ColAlpha,n1,n2,data);}
|
---|
| 80 |
|
---|
| 81 | //! return Delta values for rows [n1,n2] into TVector
|
---|
[3128] | 82 | inline LONGLONG GetDelta(LONGLONG n1,LONGLONG n2,TVector<double>& data)
|
---|
[1661] | 83 | {return GetCol(ColDelta,n1,n2,data);}
|
---|
[3128] | 84 | inline LONGLONG GetDelta(LONGLONG n1,LONGLONG n2,TVector<float>& data)
|
---|
[1661] | 85 | {return GetCol(ColDelta,n1,n2,data);}
|
---|
[3128] | 86 | inline LONGLONG GetDelta(LONGLONG n1,LONGLONG n2,TVector<int_4>& data)
|
---|
[1661] | 87 | {return GetCol(ColDelta,n1,n2,data);}
|
---|
| 88 |
|
---|
| 89 | //! return Bolo values for rows [n1,n2] into TVector
|
---|
[3128] | 90 | inline LONGLONG GetBolo(LONGLONG n1,LONGLONG n2,TVector<double>& data)
|
---|
[1661] | 91 | {return GetCol(ColBolo,n1,n2,data);}
|
---|
[3128] | 92 | inline LONGLONG GetBolo(LONGLONG n1,LONGLONG n2,TVector<float>& data)
|
---|
[1661] | 93 | {return GetCol(ColBolo,n1,n2,data);}
|
---|
[3128] | 94 | inline LONGLONG GetBolo(LONGLONG n1,LONGLONG n2,TVector<int_4>& data)
|
---|
[1661] | 95 | {return GetCol(ColBolo,n1,n2,data);}
|
---|
| 96 |
|
---|
| 97 | //! return Flag values for rows [n1,n2] into TVector
|
---|
[3128] | 98 | inline LONGLONG GetFlag(LONGLONG n1,LONGLONG n2,TVector<double>& data)
|
---|
[1661] | 99 | {if(!IsFlag()) return 0; return GetCol(ColFlag,n1,n2,data);}
|
---|
[3128] | 100 | inline LONGLONG GetFlag(LONGLONG n1,LONGLONG n2,TVector<float>& data)
|
---|
[1661] | 101 | {if(!IsFlag()) return 0; return GetCol(ColFlag,n1,n2,data);}
|
---|
[3128] | 102 | inline LONGLONG GetFlag(LONGLONG n1,LONGLONG n2,TVector<int_4>& data)
|
---|
[1661] | 103 | {if(!IsFlag()) return 0; return GetCol(ColFlag,n1,n2,data);}
|
---|
| 104 |
|
---|
| 105 | //! return Sample Number values for rows [n1,n2] into TVector
|
---|
[3128] | 106 | inline LONGLONG GetSNum(LONGLONG n1,LONGLONG n2,TVector<double>& data)
|
---|
[1661] | 107 | {return GetCol(ColSNum,n1,n2,data);}
|
---|
[3128] | 108 | inline LONGLONG GetSNum(LONGLONG n1,LONGLONG n2,TVector<float>& data)
|
---|
[1661] | 109 | {return GetCol(ColSNum,n1,n2,data);}
|
---|
[3128] | 110 | inline LONGLONG GetSNum(LONGLONG n1,LONGLONG n2,TVector<int_4>& data)
|
---|
[1661] | 111 | {return GetCol(ColSNum,n1,n2,data);}
|
---|
| 112 |
|
---|
| 113 | //! return column "col" values for rows [n1,n2] into TVector
|
---|
[3128] | 114 | inline LONGLONG GetCol(int col,LONGLONG n1,LONGLONG n2,TVector<double>& data) {
|
---|
[1661] | 115 | if(col<0 || col>=(int)mFABT.size()) return 0; if(mFABT[col]==NULL) return 0;
|
---|
| 116 | return mFABT[col]->Read(n1,n2,data);
|
---|
| 117 | }
|
---|
[3128] | 118 | inline LONGLONG GetCol(int col,LONGLONG n1,LONGLONG n2,TVector<float>& data) {
|
---|
[1661] | 119 | if(col<0 || col>=(int)mFABT.size()) return 0; if(mFABT[col]==NULL) return 0;
|
---|
| 120 | return mFABT[col]->Read(n1,n2,data);
|
---|
| 121 | }
|
---|
[3128] | 122 | inline LONGLONG GetCol(int col,LONGLONG n1,LONGLONG n2,TVector<int_4>& data) {
|
---|
[1661] | 123 | if(col<0 || col>=(int)mFABT.size()) return 0; if(mFABT[col]==NULL) return 0;
|
---|
| 124 | return mFABT[col]->Read(n1,n2,data);
|
---|
| 125 | }
|
---|
| 126 |
|
---|
| 127 | //! return the value of the first sampleNum
|
---|
[4029] | 128 | inline double ReadFirstSNum(void) {return GetSNum(0);}
|
---|
[1661] | 129 | //! return the value of the last sampleNum
|
---|
[4029] | 130 | inline double ReadLastSNum(void) {return GetSNum(NBline-1);}
|
---|
[1661] | 131 |
|
---|
| 132 | //! Is Alpha connected ?
|
---|
| 133 | inline bool IsAlpha(void) {return IsCol(ColAlpha);}
|
---|
| 134 | //! Is Delta connected ?
|
---|
| 135 | inline bool IsDelta(void) {return IsCol(ColDelta);}
|
---|
| 136 | //! Is Bolo connected ?
|
---|
| 137 | inline bool IsBolo(void) {return IsCol(ColBolo);}
|
---|
| 138 | //! Is Flag connected ?
|
---|
| 139 | inline bool IsFlag(void) {return IsCol(ColFlag);}
|
---|
| 140 | //! Is SNum connected ?
|
---|
| 141 | inline bool IsSNum(void) {return IsCol(ColSNum);}
|
---|
| 142 | //! Is column col connected ?
|
---|
| 143 | inline bool IsCol(int col) {if(mFABT[col]) return true; return false;}
|
---|
| 144 |
|
---|
| 145 | //! Set debug level
|
---|
| 146 | inline void SetDebug(int lp=0) {DbgLevel = (unsigned short) lp;}
|
---|
| 147 | //! Set the number of rows for that class choosing column "col"
|
---|
| 148 | void SetNbLine(int col=-1);
|
---|
| 149 | //! Get the number of rows to be read
|
---|
[3128] | 150 | inline LONGLONG GetNbLine(void) const {return NBline;}
|
---|
[1661] | 151 | //! Get the number of columns in the FITS HDU to be read
|
---|
| 152 | inline int GetNbCol(void) const {return mFABT.size();}
|
---|
[4029] | 153 | //! Print to os
|
---|
[1661] | 154 | virtual void Print(ostream& os,int lp=1) const;
|
---|
| 155 | //! Print to stdout
|
---|
| 156 | inline void Print(int lp=1) const {Print(cout,lp);}
|
---|
| 157 |
|
---|
| 158 | //! Get the FitsABTColRead pointer for the Alpha
|
---|
| 159 | inline FitsABTColRead* GetAlphaReader(void) {return GetColReader(ColAlpha);}
|
---|
| 160 | //! Get the FitsABTColRead pointer for the Delta
|
---|
| 161 | inline FitsABTColRead* GetDeltaReader(void) {return GetColReader(ColDelta);}
|
---|
| 162 | //! Get the FitsABTColRead pointer for the Bolo
|
---|
| 163 | inline FitsABTColRead* GetBoloReader(void) {return GetColReader(ColBolo);}
|
---|
| 164 | //! Get the FitsABTColRead pointer for the Flag
|
---|
| 165 | inline FitsABTColRead* GetFlagReader(void) {return GetColReader(ColFlag);}
|
---|
| 166 | //! Get the FitsABTColRead pointer for the SNum
|
---|
| 167 | inline FitsABTColRead* GetSNumReader(void) {return GetColReader(ColSNum);}
|
---|
| 168 | //! Get the FitsABTColRead pointer for the column "col"
|
---|
| 169 | inline FitsABTColRead* GetColReader(int col)
|
---|
| 170 | {if(col<0 || col>=(int)mFABT.size()) return NULL; return mFABT[col];}
|
---|
| 171 |
|
---|
| 172 | protected:
|
---|
| 173 | //! Protected method. Do not use directly but read the doc.
|
---|
| 174 | int addcol(int col,const char *label,const char* fname,int ihdu);
|
---|
| 175 | void Gess_If_Not_Define(int col);
|
---|
| 176 |
|
---|
[3128] | 177 | LONGLONG NBline;
|
---|
[1661] | 178 | unsigned short DbgLevel;
|
---|
| 179 | long BuffLen, BuffSens;
|
---|
| 180 |
|
---|
| 181 | vector<string> mFName;
|
---|
| 182 | vector<string> mLabel;
|
---|
| 183 | vector<int> mHDU;
|
---|
| 184 | vector<FitsABTColRead *> mFABT;
|
---|
| 185 | };
|
---|
| 186 |
|
---|
| 187 | } // namespace SOPHYA
|
---|
| 188 | #endif /* FBOLOREAD_H_SEEN */
|
---|