IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28698


Ignore:
Timestamp:
Jul 22, 2010, 3:17:49 PM (16 years ago)
Author:
rhenders
Message:

Broken large start script into perl classes

Location:
trunk/ippToPsps
Files:
7 added
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/src/ippToPspsBatchDetection.c

    r28589 r28698  
    1414
    1515// Gets uncalibrated instrumental flux from magnitude
    16 static __inline bool ippToPsps_getFlux(const float zeroPoint, const float exposureTime, const float magnitude, float* flux) {
     16static __inline bool ippToPsps_getFlux(const float exposureTime, const float magnitude, float* flux, const float magnitudeErr, float* fluxErr) {
    1717
    1818    *flux = powf(10.0, -0.4*magnitude) / exposureTime;
     19    if (fluxErr) *fluxErr = (magnitudeErr * *flux)/1.085736;
     20//if (fluxErr)    printf("Mag = %03.03f, Flux = %03.03f, Mag err = %03.03f, Flux Err = %03.03f\n", magnitude, *flux, magnitudeErr, *fluxErr);
    1921    return (!isfinite(*flux) || *flux < 0.000001) ? false : true;
    2022}
     
    4648    fits_get_hdrspace(fitsIn, &nKeys, NULL, &status);
    4749
    48     float zptObs, zeroPoint, exposureTime;
     50    float zptObs, exposureTime;
    4951    char filterType[20];
    5052    double obsTime;
     
    5254    double expTime;
    5355    status=0; fits_read_key(fitsIn, TFLOAT, "ZPT_OBS", &zptObs, NULL, &status);
    54     status=0; fits_read_key(fitsIn, TFLOAT, "ZPT_REF", &zeroPoint, NULL, &status);
    5556    status=0; fits_read_key(fitsIn, TFLOAT, "EXPREQ", &exposureTime, NULL, &status);
    5657    status=0; fits_read_key(fitsIn, TSTRING, "FILTERID", filterType, NULL, &status);
     
    138139    long removeList[MAXDETECT];
    139140    long thisObjId;
    140     bool firstTimeIn = true;
     141    bool firstTimeIn = true, peakFluxOk, instFluxOk;
    141142    int ippIDetNum, instMagNum, instMagErrNum, peakMagNum;
    142143
    143144    // loop round all 60 chips
    144     for (int x=0; x<8; x++) {
    145         for (int y=0; y<8; y++) {
     145    for (int x=3; x<4; x++) {
     146        for (int y=3; y<4; y++) {
    146147
    147148            // dodge the corners
     
    293294                    obsTimes[s] = obsTime;
    294295
    295                     ippToPsps_getFlux(zeroPoint, exposureTime, instMagErr[s], &instFluxErr[s]);
     296//                    ippToPsps_getFlux(exposureTime, instMagErr[s], &instFluxErr[s]);
     297
     298                    // calculate flux and flux errors from magnitudes
     299                    peakFluxOk = ippToPsps_getFlux(exposureTime, peakMag[s], &peakFlux[s], 0.0, NULL);
     300                    instFluxOk = ippToPsps_getFlux(exposureTime, instMag[s], &instFlux[s], instMagErr[s], &instFluxErr[s]);
    296301
    297302                    // check for invalid flux values (if not already labelled as a duplicate)
    298                     if ((!ippToPsps_getFlux(zeroPoint, exposureTime, peakMag[s], &peakFlux[s]) ||
    299                                 !ippToPsps_getFlux(zeroPoint, exposureTime, instMag[s], &instFlux[s])) && !isDuplicate) {
     303                    if ( (!peakFluxOk || !instFluxOk) && !isDuplicate) {
    300304                        removeList[numOfDuplicates+numInvalidFlux] = s+1;
    301305                        numInvalidFlux++;
Note: See TracChangeset for help on using the changeset viewer.