midiLib.h

00001 /**********************************************************
00002 ***********************************************************
00003 *               European Southern Observatory
00004 *            VLTI MIDI Data Reduction Software
00005 *
00006 * Module name:  midiLib.h
00007 * Description:
00008 *
00009 *
00010 * History:
00011 * 03-Mar-03     (csabet) Created
00012 ***********************************************************
00013 **********************************************************/
00014 #ifndef _MIDI_LIB_H
00015 #define _MIDI_LIB_H
00016 
00017 /**********************************************************
00018 *   Include files
00019 **********************************************************/
00020 #include "iauExchange.h"
00021 
00022 /**********************************************************
00023 *   Constant definitions
00024 **********************************************************/
00025 
00026 /**********************************************************
00027 *   Enumeration definitions
00028 **********************************************************/
00029 /*  Mask Mode */
00030 enum MaskMode
00031 {
00032     COMPUTED,
00033     SELECTED,
00034     SPECIFIED
00035 };
00036 
00037 /*  Obs Technique */
00038 enum ObsTechnique
00039 {
00040     INTERF,
00041     PHOTOMA,
00042     PHOTOMB,
00043     UNKNOWN
00044 };
00045 
00046 /*  Processing Modes */
00047 enum ProcessingMode
00048 {
00049     UNDISPERSED,
00050     DISPERSED,
00051     DISPERSED_SLIT,
00052     DISPERSED_3PH
00053 };
00054 
00055 /**********************************************************
00056 *   Type definitions
00057 **********************************************************/
00058 typedef struct
00059 {
00060     enum MaskMode       maskMode;
00061     enum ProcessingMode processing;
00062     int  drsFrg;  // 0, 1, 2: Decativate, Activate
00063     int  drsKap;  // 0, 1, 2: Decativate, Read, Update
00064     int  drsAcq;  // 0, 1, 2: Decativate, Activate
00065     int  tecRon;  // 0, 1, 2: Decativate, Activate
00066     int  tecLin;  // 0, 1, 2: Decativate, Activate
00067     int  tecPix;  // 0, 1, 2: Decativate, Activate
00068     int  tecTrn;  // 0, 1, 2: Decativate, Activate
00069     int  tecWav;  // 0, 1, 2: Decativate, Create, Correlate
00070 } UserOptions;
00071 
00072 typedef struct
00073 {
00074     OiArray      *array;
00075     OiTarget     *targets;
00076     OiWavelength *wavelength;
00077     OiVis        *vis;
00078     OiVis2       *vis2;
00079 } IauExchange;
00080 
00081 typedef struct
00082 {
00083     char *inFitsList;
00084     char *inFitsClassified;
00085     char *inFitsBatch;
00086     char *inFileDir;
00087     char *inFitsName;
00088     char *maskFileDir;
00089     char *maskFileName;
00090     char *outFitsName;
00091     char *outWaterfallName;
00092     char *outWaterpowerName;
00093     char *outAveImageName;
00094     char *outChSpectrumName;
00095     char *calibDbName;
00096     char *waveCalibName;
00097     char *grismFoilName;
00098     char *prismFoilName;
00099     char *calibDbDir;
00100     char *trfNameWrite;
00101     char *trfNameRead;
00102     char *trfHistoryName;
00103     char *trrNameWrite;
00104     char *trrNameRead;
00105     char *trrHistoryName;
00106     char *wclNameWrite;
00107     char *wclNameRead;
00108     char *transferRatiosName;
00109     char *wclHistoryName;
00110     char *archFileName;
00111     char *pipeFileName;
00112 } MidiFiles;
00113 
00114 //  Fits file format
00115 typedef struct
00116 {
00117     int   chopped;
00118     int   hasData;
00119     int   isDisp;
00120     int   numOfFrames;      // Total number of frames in a batch. used in UNDISPERSED
00121     int   framesPerScan;
00122     int   numOfScans;       // numOfScans = numOfFrames / framesPerScan;
00123     int   numOfPinholes;    // 1 standard; 3 if triple pinhole; 2 if slit with sky definition
00124     int   numOfDetectorRegions; // In raw data from detector. Number of Detector regions
00125     int   numOfRegionsToProcess;// Number that get processed
00126     int   iXWidth;      // X dimension
00127     int   iYWidth;      // Y dimension
00128     int   subWindowSize;    // iXWidth * iYWidth;
00129     int   numOfTemplates;
00130     int   numOfFilesInTemplate;
00131     int   fileNumInTemplate;
00132     int   numOfExposures;
00133     int   fileNumInExposure;
00134     int   exposureNumInTemplate;
00135     int   fftsize;
00136     int   allSpectrumLength;
00137     float optFreqCal;
00138     int   numOfScansRejected;
00139     int   numOfScansProcessed;
00140     int   numOfChannelsProcessed;
00141     int   numOfChannelsRejected;
00142     int   numOfSkyScans;
00143     char  *beamCombiner;
00144     char  *tplName;
00145     char  *obsTech;
00146     char  *obsCatg;
00147     char  *obsType;
00148     char  *shutterId;
00149     char  *grismId;
00150     char  *targetName;
00151     char  *tplStart;
00152     char  *cameraId;
00153     char  *slitName;
00154     char  *filterName;
00155 } ImageFormat;
00156 
00157 //  Transfer Ratios
00158 typedef struct
00159 {
00160     int   exists;
00161     float *ka1;
00162     float *siga1;
00163     float *ka2;
00164     float *siga2;
00165     float *kb1;
00166     float *sigb1;
00167     float *kb2;
00168     float *sigb2;
00169 } TransferRatios;
00170 
00171 //  Kappa Coefficients
00172 typedef struct
00173 {
00174     float *k11;
00175     float *sig11;
00176     float *k21;
00177     float *sig21;
00178     float *k31;
00179     float *sig31;
00180     float *k22;
00181     float *sig22;
00182     float *k32;
00183     float *sig32;
00184     float *k42;
00185     float *sig42;
00186 } KappaCoefficients;
00187 
00188 //  Only for DISPERSED
00189 typedef struct
00190 {
00191     int   photomAExists;
00192     int   photomBExists;
00193     int   photomIExists;
00194     int   trfExists;
00195     int   calibVisExists;
00196     float *rawVis2;
00197     float *rawVis2Err;
00198     float *normVis2;
00199     float *normVis2Err;
00200     float *calibVis2;
00201     float *calibVis2Err;
00202     float **photomA;
00203     float **photomB;
00204     float **photomI;
00205     float **photomAErr;
00206     float **photomBErr;
00207     float **photomIErr;
00208     float *photomNet2;    // Net photometry estimate
00209     float *photomNet2Err; // Net photometry error 
00210     float *trf;
00211     float *trfErr;
00212     float photomATarg1;
00213     float photomATarg2;
00214     float photomATarg3;
00215     float photomBTarg1;
00216     float photomBTarg2;
00217     float photomBTarg3;
00218     float photomATotal1;
00219     float photomATotal2;
00220     float photomATotal3;
00221     float photomBTotal1;
00222     float photomBTotal2;
00223     float photomBTotal3;
00224     float uncalVisBinned1;
00225     float uncalVisBinned2;
00226     float uncalVisBinned3;
00227     float uncalVisBinned4;
00228     float uncalVisBinned5;
00229     float trfBinned1;
00230     float trfBinned2;
00231     float trfBinned3;
00232     float trfBinned4;
00233     float trfBinned5;
00234 } DispersedResult;
00235 
00236 typedef struct
00237 {
00238     int    exists;
00239     float  ***iDispFringe;    // Triple pointer: regionsToProcess, Wave (X), time (frame)
00240     double *iFringe;
00241     double *iFringe1;
00242     double *iFringe2;
00243     float  *allSpectrum;
00244     float  **image;       // Region, image
00245     float  *dcLevels;
00246     char   *tarType;
00247     int    numOfTargetChops;
00248     float  *time;       // Array of framelength, time of each in JD relative to timezero
00249     float  *localOPD;       // Array of framelength, net Piezo OPD
00250     float  *bigDL;      // Array of framelength, net Piezo OPD
00251     int    **rejectList;    // 2D array of numOfChannels and numOfFrames
00252     int    *badScanList;    // Array of numOfScans
00253 } CompressedData;
00254 
00255 typedef struct
00256 {
00257     float   optFreqLo;
00258     float   optFreqHi;
00259     char    *filterName;
00260 } FilterData;
00261 
00262 //  Only for UNDISPERSED
00263 typedef struct
00264 {
00265     float   vis;
00266     float   visErr;
00267     float   vis1;
00268     float   vis1Err;
00269     float   vis2;
00270     float   vis2Err;
00271     float   visSqrd;
00272     float   visSqrdErr;
00273     float   visSqrd1;
00274     float   visSqrd1Err;
00275     float   visSqrd2;
00276     float   visSqrd2Err;
00277 } RawVisibility;
00278 
00279 //  Only for UNDISPERSED
00280 typedef struct
00281 {
00282     int   exists;
00283     float *vis;
00284     float *visErr;
00285     float *visSqrd;
00286     float *visSqrdErr;
00287 } CalibratedVisibility;
00288 
00289 //  Only for UNDISPERSED
00290 typedef struct
00291 {
00292     int   exists;
00293     float *trf;
00294     float *trfErr;
00295 } TransferFunction;
00296 
00297 //  Only for UNDISPERSED
00298 typedef struct
00299 {
00300     float   *photomA;
00301     float   *photomAErr;
00302     float   *photomB;
00303     float   *photomBErr;
00304     float   ratioPhotomA0toA1;
00305     float   ratioPhotomB0toB1;
00306     float   *chop2ChopAErr;
00307     float   *chop2ChopBErr;
00308 } PhotometryResult;
00309 
00310 typedef struct
00311 {
00312     double  uCoord;
00313     double  vCoord;
00314     double  wCoord;
00315 } UVW;
00316 
00317 typedef struct
00318 {
00319     char  *calibName;
00320     float calibRA;
00321     float calibDEC;
00322     float calibDistance;
00323     float calibVis;
00324     float calibVisErr;
00325     float calibVisSqrd;
00326     float calibVisSqrdErr;
00327     float calibPblAverage;
00328     float calibParangAverage;
00329     float calibDiameter;
00330     float calibDiameterErr;
00331     double calibFlux;
00332     int   calibFlag;
00333 } CalibratorParam;
00334 
00335 typedef struct
00336 {
00337     double xCoord;  
00338     double yCoord;  
00339     double dxCoord; 
00340     double dyCoord; 
00341     double size;
00342 } MidiCoords;
00343 
00344 typedef struct
00345 {
00346     int    exists;
00347     float  **aveImage;
00348     float  **aveImageSky;
00349     double *coordX;
00350     double *coordY;
00351     double *sizeX;
00352     double *sizeY;
00353     float  *targetFlux;
00354     int    *targetPixelCount;
00355     char   *tarType;
00356 } ImageQuality;
00357 
00358 
00359 typedef struct
00360 {
00361     int    exists;
00362     float  *pattern;
00363     float  *aveImage;
00364     double median;
00365 } DetRonNoise;
00366 
00367 typedef struct
00368 {
00369     int   exists;
00370     int   size;
00371     float *mean;
00372     char  *grismId;
00373     int   *saturated;
00374     float **aveImage;
00375     float *integTime;
00376     float *deviation;
00377     float meanCoeffA0;
00378     float meanCoeffA1;
00379     float meanCoeffA2;
00380     float meanCoeffA3;
00381     float meanSigma;
00382     int   winx;
00383     int   windx;
00384     int   winy;
00385     int   windy;
00386 } DetLinearity;
00387 
00388 typedef struct
00389 {
00390     float *xCoord;
00391     float *yCoord;
00392     float *wavelength;
00393     char  *fileName;
00394     float **image;
00395 } NarrowBandInfo;
00396 
00397 typedef struct
00398 {
00399     float *actualWavelength;
00400     float *actualTransmission;
00401     char  *fileName;
00402     float **image;
00403 } FoilInfo;
00404 
00405 typedef struct
00406 {
00407     char  *fileName;
00408     float **image;
00409 } OpenInfo;
00410 
00411 typedef struct
00412 {
00413     char  *fileName;
00414     float **image;
00415 } DarkInfo;
00416 
00417 typedef struct
00418 {
00419     int            exists;
00420     int            numOfFiles;
00421     char           **filterName;
00422     char           **shutterId;
00423     char       *tarType;
00424     float      **calibratedWave;
00425     float      *variance;
00426     NarrowBandInfo *ArIII;
00427     NarrowBandInfo *NeII;
00428     NarrowBandInfo *SIV;
00429     FoilInfo       *foil;
00430     OpenInfo       *open;
00431     DarkInfo       *dark;
00432 } WaveCalibration;
00433 
00434 typedef struct
00435 {
00436     int     numOfBeams;
00437     char    *shutterId;
00438     char    *beamCombiner;
00439     MidiCoords  *centroid;
00440 } RefPixExposure;
00441 
00442 typedef struct
00443 {
00444     int        exists;
00445     int        numOfExposures;
00446     RefPixExposure *exposure;
00447 } ReferencePixel;
00448 
00449 typedef struct
00450 {
00451     int     exists;
00452     char    **beamCombiner;
00453     char    **shutterId;
00454     char    **cameraId;
00455     char    **grismId;
00456     char    **filterName;
00457     int     numOfFiles;
00458     MidiCoords  *target;
00459     float   *integTime;
00460     float   *integFlux;
00461     float   *meanFlux;
00462     float   *transmission;
00463 } DispersiveTrans;
00464 
00465 typedef struct
00466 {
00467     long    CorrInterf;
00468     long    CorrPhotomA;
00469     long    CorrPhotomB;
00470 } CorrectedFrames;
00471 
00472 /**********************************************************
00473 *   Global Variables
00474 **********************************************************/
00475 
00476 /**********************************************************
00477 *   Function Prototypes
00478 **********************************************************/
00479 float sqrtp (float x);
00480 float sqr(float x);
00481 void Trace (int n);
00482 
00483 /*********************************************************/
00484 #endif
00485 /*********************************************************/
00486 /*********************************************************/

Generated on 11 Feb 2011 for MIDI Pipeline Reference Manual by  doxygen 1.6.1