| 1 | #include "lcproc.h"
 | 
|---|
| 2 | 
 | 
|---|
| 3 | #include "sopnamsp.h"
 | 
|---|
| 4 | 
 | 
|---|
| 5 | LightCurveProc::LightCurveProc(string outppf, int dtblks, int dtblkti)
 | 
|---|
| 6 |   : dts(dtblks) , dtti(dtblkti), _outname(outppf)
 | 
|---|
| 7 | {
 | 
|---|
| 8 |   // Defining column names for the dts : One row / star 
 | 
|---|
| 9 |   dts.AddFloatColumn("NumEt");
 | 
|---|
| 10 |   dts.AddFloatColumn("FluxRef");
 | 
|---|
| 11 |   dts.AddFloatColumn("XPos");
 | 
|---|
| 12 |   dts.AddFloatColumn("YPos");
 | 
|---|
| 13 |   dts.AddFloatColumn("nmes");
 | 
|---|
| 14 |   dts.AddFloatColumn("MeanFlux");
 | 
|---|
| 15 |   dts.AddFloatColumn("SigFlux");
 | 
|---|
| 16 | 
 | 
|---|
| 17 | 
 | 
|---|
| 18 |   // Defining column names for the dtti : One row / exposure ( = TimeInfo_ 
 | 
|---|
| 19 |   dtti.AddFloatColumn("TStart");
 | 
|---|
| 20 |   dtti.AddFloatColumn("Expose");
 | 
|---|
| 21 |   dtti.AddFloatColumn("Fond");
 | 
|---|
| 22 |   dtti.AddFloatColumn("SigFond");
 | 
|---|
| 23 |   dtti.AddFloatColumn("SigX");
 | 
|---|
| 24 |   dtti.AddFloatColumn("SigY");
 | 
|---|
| 25 |   dtti.AddFloatColumn("Absorption");
 | 
|---|
| 26 |   dtti.AddIntegerColumn("FgBad");
 | 
|---|
| 27 | }
 | 
|---|
| 28 | 
 | 
|---|
| 29 | LightCurveProc::~LightCurveProc()
 | 
|---|
| 30 | {
 | 
|---|
| 31 |   cout << " LightCurveProc::~LightCurveProc() Writing DT-Stars, DT-TimeInfo to file \n" 
 | 
|---|
| 32 |        << _outname << endl; 
 | 
|---|
| 33 |   POutPersist po(_outname); 
 | 
|---|
| 34 |   po << PPFNameTag("stardt") << dts;
 | 
|---|
| 35 |   po << PPFNameTag("timdt") << dtti;
 | 
|---|
| 36 | }  
 | 
|---|
| 37 | 
 | 
|---|
| 38 | void LightCurveProc::ProcessLC(int numet, int nmes, STARINFO *sti, TIMEINFO *tminf, MESUREU *mesu)
 | 
|---|
| 39 | {
 | 
|---|
| 40 |   double xnt[20];
 | 
|---|
| 41 |   xnt[0] = sti->NumEt;
 | 
|---|
| 42 |   xnt[1] = sti->FluxRef;
 | 
|---|
| 43 |   xnt[2] = sti->XPos;
 | 
|---|
| 44 |   xnt[3] = sti->YPos;
 | 
|---|
| 45 | 
 | 
|---|
| 46 |   xnt[4] = (double)nmes;
 | 
|---|
| 47 | 
 | 
|---|
| 48 |   // We have to check that  fgbad has been filled
 | 
|---|
| 49 |   if ((int)fgbad.size() < nmes) 
 | 
|---|
| 50 |     for(int kb=fgbad.size(); kb<nmes; kb++) fgbad.push_back(0);
 | 
|---|
| 51 | 
 | 
|---|
| 52 |   xnt[5] = 0.; 
 | 
|---|
| 53 |   for(int jt=0; jt<nmes; jt++) { /* mesure jt=0 is the reference image */
 | 
|---|
| 54 |     if (fgbad[jt] != 0)  continue;
 | 
|---|
| 55 |     xnt[5] += mesu[jt].Flux; 
 | 
|---|
| 56 |   }                   
 | 
|---|
| 57 |   xnt[5] /= nmes;  // mean flux of the star number numet
 | 
|---|
| 58 | 
 | 
|---|
| 59 |   xnt[6] = 0.; 
 | 
|---|
| 60 |   for(int jt=1; jt<nmes; jt++) {
 | 
|---|
| 61 |     if (fgbad[jt] != 0)  continue;
 | 
|---|
| 62 |     xnt[6] += (mesu[jt].Flux - xnt[5])*(mesu[jt].Flux - xnt[5]); 
 | 
|---|
| 63 |   }
 | 
|---|
| 64 |   xnt[6] = sqrt(xnt[6]/nmes); // flux dispersion of the star number numet
 | 
|---|
| 65 | 
 | 
|---|
| 66 |   dts.AddRow(xnt);
 | 
|---|
| 67 | }
 | 
|---|
| 68 | 
 | 
|---|
| 69 | void LightCurveProc::TimeInfo(int nmes, TIMEINFO *tminf)
 | 
|---|
| 70 | {
 | 
|---|
| 71 |   double xnt[20]; 
 | 
|---|
| 72 |   fgbad.clear();
 | 
|---|
| 73 |   for(int jt=0; jt<nmes; jt++){
 | 
|---|
| 74 |     fgbad.push_back(0);
 | 
|---|
| 75 |     if (jt == 0) fgbad[jt] = 1;  // flag mes #0 (ref) as bad 
 | 
|---|
| 76 |     if((jt==260)||(jt==647)) fgbad[jt] = 2;  // in-proper mesures
 | 
|---|
| 77 |     xnt[0] = tminf[jt].TStart/86400.;
 | 
|---|
| 78 |     xnt[1] = tminf[jt].Expose;
 | 
|---|
| 79 |     xnt[2] = tminf[jt].Fond;
 | 
|---|
| 80 |     xnt[3] = tminf[jt].SigFond;
 | 
|---|
| 81 |     xnt[4] = (double)tminf[jt].SigX;
 | 
|---|
| 82 |     xnt[5] = tminf[jt].SigY;
 | 
|---|
| 83 |     xnt[6] = tminf[jt].Absorption;
 | 
|---|
| 84 |     xnt[7] = fgbad[jt];
 | 
|---|
| 85 |     dtti.AddRow(xnt);
 | 
|---|
| 86 |   }
 | 
|---|
| 87 | }
 | 
|---|
| 88 | 
 | 
|---|