IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8015


Ignore:
Timestamp:
Jul 31, 2006, 2:18:49 PM (20 years ago)
Author:
jhoblitt
Message:

revise -update to accept a -detrend flag to mark the data as either science or detrend

Location:
trunk/ippTools/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/regtool.c

    r8013 r8015  
    7373    PS_ASSERT_PTR_NON_NULL(config, false);
    7474
     75    bool status = false;
     76    bool detrend = psMetadataLookupBool(&status, config->args, "-detrend");
     77    if (!status) {
     78        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -detrend");
     79        return false;
     80    }
     81
    7582    psArray *new = newFrameSearchPending(config);
    7683    if (!new) {
     
    8087
    8188    // insert 'new' rawScience & detrendframes
    82     if (new->n > 0) {
     89    if (psArrayLength(new) > 0) {
    8390        for (long i = 0; i < new->n; i++) {
    8491            newFrame *newFrame = new->data[i];
    85             if (strcmp(newFrame->exposure->exp_type, "object") == 0) {
     92            if (detrend) {
     93                // it's a detrend frame
     94                rawDetrendFrame *frame = newToRawDetrendFrame(newFrame);
     95                if (!frame) {
     96                }
     97                if (!rawDetrendFrameInsert(config, frame)) {
     98                    // error
     99                }
     100            } else {
    86101                // it's a science frame
    87                 rawScienceFrame *rawScienceFrame = newToRawScienceFrame(newFrame);
    88                 if (!rawScienceFrameInsert(config, rawScienceFrame)) {
     102                rawScienceFrame *frame = newToRawDetrendFrame(newFrame);
     103                if (!frame) {
     104                }
     105                if (!rawScienceFrameInsert(config, frame)) {
    89106                    // error
    90107                }
    91             } else {
    92                 // it's a detrend frame
    93                 rawDetrendFrame *rawDetrendFrame = newToRawDetrendFrame(newFrame);
    94                 if (!rawDetrendFrameInsert(config, rawDetrendFrame)) {
    95                     // error
    96                 }
    97108            }
    98            
    99             /*
    100             // lookup camera name in p0CameraConfig
    101             psMetadata *where = psMetadataAlloc();
    102             //bool status = false;
    103             psMetadataAddStr(where, PS_LIST_TAIL, "camera", 0, NULL,
    104                 newFrame->exposure->camera);
    105             psArray *configs = p0CameraConfigSelectRowObjects(config->dbh, where, MAX_ROWS);
    106             psFree(where);
    107             // if there is no match then we default to sending into into p2
    108             if (!configs) {
    109                 // convert newFrame->exposure to p2PendingExp
    110                 p2PendingExpRow *p2PendingExp = newToP2PendingExp(
    111                     newFrame->exposure
    112                 );
    113                 p2PendingExpInsertObject(config->dbh, p2PendingExp);
    114                 psFree(p2PendingExp);
    115                 continue;
    116             }
    117 
    118             // only use the first match
    119             int pX = ((p0CameraConfigRow *)configs->data[0])->phase;
    120             switch (pX) {
    121                 case 1:
    122                     // convert newFrame->exposure to p1PendingExp
    123                 {
    124                     p1PendingExpRow *p1PendingExp = newToP1PendingExp(
    125                         newFrame->exposure
    126                     );
    127                     p1PendingExpInsertObject(config->dbh, p1PendingExp);
    128                     psFree(p1PendingExp);
    129                 }
    130                     break;
    131                 case 2:
    132                     // convert newFrame->exposure to p2PendingExp
    133                 {
    134                     p2PendingExpRow *p2PendingExp = newToP2PendingExp(
    135                         newFrame->exposure
    136                     );
    137                     p2PendingExpInsertObject(config->dbh, p2PendingExp);
    138                     psFree(p2PendingExp);
    139                 }
    140                     break;
    141                 default:
    142                     // XXX add argv[0] to pxConfig
    143                     psAbort("foo", "invalid phase (this should not happen)");
    144             }
    145 
    146             psFree(configs);
    147             */
    148109        }
    149         psFree(new);
    150     }
     110    }
     111    psFree(new);
    151112
    152113    return true;
  • trunk/ippTools/src/regtoolConfig.c

    r7821 r8015  
    3939    psMetadataAddStr(updateArgs, PS_LIST_TAIL, "-exp_id",  0,
    4040        "define class", NULL);
     41    psMetadataAddBool(updateArgs, PS_LIST_TAIL, "-detrend",  0,
     42        "declare this as detrend data", false);
    4143    psMetadataAddStr(updateArgs, PS_LIST_TAIL, "-filter",  0,
    4244        "define filter of interest", NULL);
Note: See TracChangeset for help on using the changeset viewer.