#include #include #include #include #include #include #include #include #include using std::string; using std::vector; using namespace Column; Col::Col(int num) { /** * Col::Col(int num) * A specialised constructor that defines one of the default * columns, as defined in the Column namespace */ if((num>=0)&&(num<22)){ this->width = defaultWidth[num]; this->precision = defaultPrec[num]; this->name = defaultName[num]; this->units = defaultUnits[num]; } else{ std::stringstream errmsg; errmsg << "Incorrect value for Col(num) --> num="<width = 1; this->precision = 0; this->name = " "; this->units = " "; } } vector getFullColSet(vector &objectList, FitsHeader &head) { /** * getFullColSet(objectlist, head) * A function that returns a vector of Col objects containing * information on the columns necessary for output to the results file: * Obj#,NAME,X,Y,Z,RA,DEC,VEL,w_RA,w_DEC,w_VEL,F_tot,F_int,F_peak, * X1,X2,Y1,Y2,Z1,Z2,Npix,Flag * Each object in the provided objectList is checked to see if * it requires any column to be widened, or for that column to * have its precision increased. * Both Ftot and Fint are provided -- it is up to the calling function to * determine which to use. */ vector newset; // set up the default columns newset.push_back( Col(NUM) ); newset.push_back( Col(NAME) ); newset.push_back( Col(X) ); newset.push_back( Col(Y) ); newset.push_back( Col(Z) ); newset.push_back( Col(RA) ); newset.push_back( Col(DEC) ); newset.push_back( Col(VEL) ); newset.push_back( Col(WRA) ); newset.push_back( Col(WDEC) ); newset.push_back( Col(WVEL) ); newset.push_back( Col(FINT) ); newset.push_back( Col(FTOT) ); newset.push_back( Col(FPEAK) ); newset.push_back( Col(X1) ); newset.push_back( Col(X2) ); newset.push_back( Col(Y1) ); newset.push_back( Col(Y2) ); newset.push_back( Col(Z1) ); newset.push_back( Col(Z2) ); newset.push_back( Col(NPIX) ); newset.push_back( Col(FLAG) ); // Now test each object against each new column for( int obj = 0; obj < objectList.size(); obj++){ string tempstr; int tempwidth; float val,minval; // Obj# tempwidth = int( log10(objectList[obj].getID()) + 1) + newset[NUM].getPrecision() + 1; for(int i=newset[NUM].getWidth();i0.)&&(val < minval)) newset[Z].upPrec(); } if(head.isWCS()){ // RA -- assign correct title. Check width but should be ok by definition tempstr = head.getWCS()->lngtyp; newset[RA].setName(tempstr); tempwidth = objectList[obj].getRAs().size() + 1; for(int i=newset[RA].getWidth();ilattyp; newset[DEC].setName(tempstr); tempwidth = objectList[obj].getDecs().size() + 1; for(int i=newset[DEC].getWidth();irestfrq == 0) // using frequency, not velocity newset[VEL].setName("FREQ"); newset[VEL].setUnits("[" + head.getSpectralUnits() + "]"); tempwidth = newset[VEL].getUnits().size() + 1; for(int i=newset[VEL].getWidth();irestfrq == 0) // using frequency, not velocity newset[WVEL].setName("w_FREQ"); newset[WVEL].setUnits("[" + head.getSpectralUnits() + "]"); tempwidth = newset[WVEL].getUnits().size() + 1; for(int i=newset[WVEL].getWidth();i getLogColSet(vector &objectList, FitsHeader &head) { /** * getLogColSet(objectlist) * A function that returns a vector of Col objects containing * information on the columns necessary for logfile output: * Obj#,X,Y,Z,F_tot,F_peak,X1,X2,Y1,Y2,Z1,Z2,Npix * Each object in the provided objectList is checked to see if * it requires any column to be widened, or for that column to * have its precision increased. */ vector newset,tempset; // set up the default columns: // get from FullColSet, and select only the ones we want. tempset = getFullColSet(objectList,head); newset.push_back( tempset[0] ); newset.push_back( tempset[2] ); newset.push_back( tempset[3] ); newset.push_back( tempset[4] ); newset.push_back( tempset[12] ); newset.push_back( tempset[13] ); newset.push_back( tempset[14] ); newset.push_back( tempset[15] ); newset.push_back( tempset[16] ); newset.push_back( tempset[17] ); newset.push_back( tempset[18] ); newset.push_back( tempset[19] ); newset.push_back( tempset[20] ); return newset; }