IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 21, 2010, 2:45:13 PM (16 years ago)
Author:
eugene
Message:

merge changes from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100823/ippToPsps/src/ippToPspsBatchDetection.c

    r29124 r29515  
    1111#include "ippToPspsConfig.h"
    1212#include "ippToPspsDetEnums.h"
    13 #include "fitsio.h"
    14 
    15 // Gets uncalibrated instrumental flux from magnitude
    16 static __inline bool ippToPsps_getFlux(const float exposureTime, const float magnitude, float* flux, const float magnitudeErr, float* fluxErr) {
    17 
    18     *flux = powf(10.0, -0.4*magnitude) / exposureTime;
    19     if (!isfinite(*flux) || *flux < 0.000001) return false;
    20     if (fluxErr) *fluxErr = fabsf((magnitudeErr * *flux)/1.085736);
    21     //  if (fluxErr)    printf("Mag = %03.03f, Flux = %03.03f, Mag err = %03.03f, Flux Err = %03.03f\n", magnitude, *flux, magnitudeErr, *fluxErr);
    22          
    23     return true;
    24 }
    2513
    2614/**
     
    3523int ippToPsps_batchDetection(IppToPsps *this) {
    3624
    37     if (this->numOfInputFiles < 1) return PS_EXIT_DATA_ERROR;
    38 
    3925    int status = 0;
    4026    fitsfile *fitsIn;         
    41     int nKeys;
    4227
    4328    if (fits_open_file(&fitsIn, this->inputFiles[0], READONLY, &status)) {
     
    4833
    4934    // get primary header and pull stuff out for later
     35    int nKeys;
    5036    fits_get_hdrspace(fitsIn, &nKeys, NULL, &status);
    5137
     
    6551
    6652    // FrameMeta values
    67     fits_write_col(this->fitsOut, TLONG, FRAMEMETA_FRAMEID, 1, 1, 1, &this->expId, &status);
     53    fits_write_col(this->fitsOut, TLONG, FRAMEMETA_FRAMEID, 1, 1, 1, &this->id, &status);
    6854    fits_write_col(this->fitsOut, TSTRING, FRAMEMETA_FRAMENAME, 1, 1, 1, &this->expName, &status);
    6955
    70     int8_t surveyID = -1;
    71     if (!ippToPspsConfig_getSurveyId(this->config, this->surveyType, &surveyID)) {return PS_EXIT_DATA_ERROR;}
    72     fits_write_col(this->fitsOut, TBYTE, FRAMEMETA_SURVEYID, 1, 1, 1, &surveyID, &status);
     56    fits_write_col(this->fitsOut, TBYTE, FRAMEMETA_SURVEYID, 1, 1, 1, &this->surveyID, &status);
    7357
    7458    int8_t filterID = -1;
     
    9781
    9882    // stuff for detections table
    99     time_t now;
    100     struct tm *ts;
    101     char timeStr[12];
    102     now = time(NULL);
    103     ts = gmtime(&now); // TODO should be UTC
    104     strftime(timeStr, sizeof(timeStr), "%Y-%m-%d", ts);
    105 
    10683    uint32_t s,d, invalidDvoRows, smfJumps, unmatched, totalDetections = 0;
    10784
     
    128105
    129106        filterIDs[s] = filterID;
    130         surveyIDs[s] = surveyID;
    131         strcpy(assocDate[s], timeStr);
     107        surveyIDs[s] = this->surveyID;
     108        strcpy(assocDate[s], this->todaysDate);
    132109    }
    133110
     
    192169
    193170            // create unique int from 'frameID' (aka exposure ID) and ccd number
    194             pspsImageId = (this->expId*100) + image->ccdnum;
     171            pspsImageId = (this->id*100) + image->ccdnum;
    195172
    196173            // now get DVO detections
     
    206183            imageFlags = (uint64_t)image->flags;
    207184            fits_write_col(this->fitsOut, TLONGLONG, IMAGEMETA_IMAGEID, 1, 1, 1, &pspsImageId, &status);
    208             fits_write_col(this->fitsOut, TLONG, IMAGEMETA_FRAMEID, 1, 1, 1, &this->expId, &status);
     185            fits_write_col(this->fitsOut, TLONG, IMAGEMETA_FRAMEID, 1, 1, 1, &this->id, &status);
    209186            fits_write_col(this->fitsOut, TSHORT, IMAGEMETA_CCDID, 1, 1, 1, &image->ccdnum, &status);
    210187            fits_write_col(this->fitsOut, TLONG, IMAGEMETA_PHOTOCALID, 1, 1, 1, &image->photcode, &status);
Note: See TracChangeset for help on using the changeset viewer.