IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 11, 2011, 2:49:34 PM (15 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-20101205/ippTools/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20101205/ippTools/src

  • branches/eam_branches/ipp-20101205/ippTools/src/chiptool.c

    r30102 r30579  
    838838    PXOPT_COPY_S16(config->args, where, "-fault", "chipProcessedImfile.fault", "==");
    839839
     840    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     841
    840842    if (!psListLength(where->list)
    841843        && !psMetadataLookupBool(NULL, config->args, "-all")) {
     
    874876    }
    875877    psFree(query);
     878
     879    if (!fault) {
     880        // If fault has not been supplied, don't revert update faults with the magic value
     881        // We don't do this for new runs because then they would never complete
     882        // quality should be used to drop bad components
     883        psStringAppend(&query_update, " AND (chipProcessedImfile.fault != %d)", PXTOOL_DO_NOT_REVERT_FAULT);
     884    }
    876885    if (!p_psDBRunQuery(config->dbh, query_update)) {
    877886        psError(PS_ERR_UNKNOWN, false, "database error");
     
    19191928    }
    19201929
     1930    // we do not update components with the magic fault value. They are non-updateable
     1931    psStringAppend(&query, " AND (chipProcessedImfile.fault != %d)", PXTOOL_DO_NOT_REVERT_FAULT);
     1932
    19211933    if (!p_psDBRunQueryF(config->dbh, query, setHook, chip_id)) {
    19221934        psError(PS_ERR_UNKNOWN, false, "database error");
  • branches/eam_branches/ipp-20101205/ippTools/src/difftool.c

    r30530 r30579  
    917917    PXOPT_COPY_S16(config->args, where, "-fault",     "fault", "==");
    918918
     919    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     920
    919921    if (!psListLength(where->list) && !psMetadataLookupBool(NULL, config->args, "-all")) {
    920922        psFree(where);
     
    950952        psLogMsg("difftool", PS_LOG_INFO, "Deleted %" PRIu64 " rows", psDBAffectedRows(config->dbh));
    951953
     954        if (!fault) {
     955            // If fault has not been supplied, don't revert update faults with the magic value
     956            // We don't do this for new runs because then they would never complete
     957            // quality should be used to drop bad components
     958            psStringAppend(&query_updated, " AND (diffSkyfile.fault != %d)", PXTOOL_DO_NOT_REVERT_FAULT);
     959        }
    952960        if (!p_psDBRunQuery(config->dbh, query_updated)) {
    953961            psError(PS_ERR_UNKNOWN, false, "database error");
     
    32013209        psStringAppend(&query, " AND (diffSkyfile.skycell_id = '%s')", skycell_id);
    32023210    }
     3211    // we do not update components with the magic fault value. They are non-updateable
     3212    // (But can be recovered with "difftool -revertwarped -fault 26" (PXTOOL_DO_NOT_REVERT_FAULT)
     3213    psStringAppend(&query, " AND (diffSkyfile.fault != %d)", PXTOOL_DO_NOT_REVERT_FAULT);
    32033214
    32043215    if (!p_psDBRunQueryF(config->dbh, query, setHook, diff_id)) {
  • branches/eam_branches/ipp-20101205/ippTools/src/disttool.c

    r30446 r30579  
    11851185    PXOPT_COPY_S64(config->args, where, "-stage_id", "stage_id", "==");
    11861186    PXOPT_COPY_STR(config->args, where, "-state", "state", "==");
    1187     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
     1187    pxAddLabelSearchArgs(config, where, "-label", "label", "==");
    11881188    PXOPT_COPY_S16(config->args, where, "-fault", "rcDSFileset.fault", "==");
    11891189
  • branches/eam_branches/ipp-20101205/ippTools/src/disttoolConfig.c

    r29067 r30579  
    197197    psMetadataAddS64(revertfilesetArgs, PS_LIST_TAIL, "-stage_id",0, "define stage_id", 0);
    198198    psMetadataAddStr(revertfilesetArgs, PS_LIST_TAIL, "-state",   0, "define state", NULL);
    199     psMetadataAddStr(revertfilesetArgs, PS_LIST_TAIL, "-label",   0, "define label", NULL);
     199    psMetadataAddStr(revertfilesetArgs, PS_LIST_TAIL, "-label",   PS_META_DUPLICATE_OK, "define label", NULL);
    200200    psMetadataAddS16(revertfilesetArgs, PS_LIST_TAIL, "-fault",   0, "define fault code", 0);
    201201    psMetadataAddBool(revertfilesetArgs, PS_LIST_TAIL, "-all",    0, "revert all faulted runs", NULL);
  • branches/eam_branches/ipp-20101205/ippTools/src/dqstatstool.c

    r28427 r30579  
    9292  }
    9393  else {
    94     psStringAppend(&query, " AND (invalid IS NULL OR invalid = 1) ");
     94    psStringAppend(&query, " AND (warp_id IS NOT NULL AND invalid IS NULL) ");
    9595  }
    9696
     
    402402
    403403    if (psMetadataLookupStr(&status,enginedef,"COLNAME")&&
    404         isfinite(psMetadataLookupF32(&status,enginedef,"MINIMUM"))&&
    405         isfinite(psMetadataLookupF32(&status,enginedef,"MAXIMUM"))) {
     404        (strcmp(psMetadataLookupStr(&status,enginedef,"RULETYPE"),"STRICT") == 0)&&
     405        (isfinite(psMetadataLookupF32(&status,enginedef,"MINIMUM"))&&
     406         isfinite(psMetadataLookupF32(&status,enginedef,"MAXIMUM")))) {
    406407      psArrayAdd(decisionRules,decisionRules->n,enginedef);
     408    }
     409    else if (psMetadataLookupStr(&status,enginedef,"COLNAME")&&
     410             (strcmp(psMetadataLookupStr(&status,enginedef,"RULETYPE"),"CDF") == 0)&&
     411             (isfinite(psMetadataLookupF32(&status,enginedef,"CDF00"))&&
     412              isfinite(psMetadataLookupF32(&status,enginedef,"CDF50"))&&
     413              isfinite(psMetadataLookupF32(&status,enginedef,"CDF100")))) {
     414      psArrayAdd(decisionRules,decisionRules->n, enginedef);
     415    }
     416    else if (strcmp(psMetadataLookupStr(&status,enginedef,"RULETYPE"),"UNUSED") == 0) {
    407417    }
    408418    else {
     
    637647    // Calculate if this exposure was "good" or not.
    638648    bool accept = true;
     649    psF32 quality = 1.0;
    639650    for (long j = 0; j < decisionRules->n; j++) {
    640651      psMetadata *rule = decisionRules->data[j];
     
    644655        psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find column name");
    645656        return(false);
    646       }     
    647       psF32 min_value  = psMetadataLookupF32(&status,rule,"MINIMUM");
    648       if (!status) {
    649         psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find min value for %s",colname);
    650         return(false);
    651       }     
    652       psF32 max_value  = psMetadataLookupF32(&status,rule,"MAXIMUM");
    653       if (!status) {
    654         psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find max value for %s",colname);
    655         return(false);
    656       }
    657       psString filter = psMetadataLookupStr(&status,rule,"FILTER");
    658       if (!status) {
    659         status = true;
    660       }
    661       if (filter) {
    662         psString imfilter = psMetadataLookupStr(&status,tableRow,"FILTER");
    663         if (strcmp(filter,imfilter) != 0) {
    664           continue;
    665         }
    666657      }
    667658      // Not happy with this being set to a F32. Can this ever be something else?
    668659      psF32 value      = psMetadataLookupF32(&status,tableRow,colname);
    669660      if (!status) {
    670         psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find column %s (%f %f %f) in compare with rule.",colname,min_value,max_value,value);
     661        psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find column %s (%f) in compare with rule.",
     662                colname,value);
    671663        psFree(colNames);
    672664        psFree(colTypes);
     
    677669        return(false);
    678670      }
    679       if ((value > max_value)||(value < min_value)) {
    680         accept = false;
    681       }     
     671      psString filter = psMetadataLookupStr(&status,rule,"FILTER");
     672      if (!status) {
     673        status = true;
     674      }
     675      if (filter) {
     676        psString imfilter = psMetadataLookupStr(&status,tableRow,"FILTER");
     677        if (strcmp(filter,imfilter) != 0) {
     678          continue;
     679        }
     680      }
     681     
     682      if (strcmp(psMetadataLookupStr(&status,rule,"RULETYPE"),"STRICT") == 0) {
     683        psF32 min_value  = psMetadataLookupF32(&status,rule,"MINIMUM");
     684        if (!status) {
     685          psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find min value for %s",colname);
     686          return(false);
     687        }     
     688        psF32 max_value  = psMetadataLookupF32(&status,rule,"MAXIMUM");
     689        if (!status) {
     690          psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find max value for %s",colname);
     691          return(false);
     692        }
     693
     694        if ((value > max_value)||(value < min_value)) {
     695          accept = false;
     696        }
     697      } // End STRICT min/max rule parsing
     698      else if (strcmp(psMetadataLookupStr(&status,rule,"RULETYPE"),"CDF") == 0) {
     699        // I'm just going to implement a quick linear interpolation over the points that exist.
     700        psF32 min_value,max_value = 99;
     701        psF32 min_cdf = 0.0,max_cdf = 1.0;
     702        psF32 cdf;
     703        psF32 try[22] = {0.00,0.05,0.10,0.15,0.20,0.25,0.30,0.35,0.40,0.45,0.50,
     704                         0.55,0.60,0.65,0.70,0.75,0.80,0.85,0.90,0.95,0.99,1.00};
     705        int i;
     706        int done = 0;
     707        status = true;
     708        min_value = psMetadataLookupF32(&status,rule,"CDF00");
     709        min_cdf   = 0.0;
     710        if (!isfinite(value)) {
     711          quality = 0.0;
     712          continue;
     713        }
     714        if (!status) {
     715          status = true;
     716          psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find CDF00 value for %s",colname);
     717        }
     718        if (value < min_value) {
     719          if (quality > min_cdf) {
     720            quality = 0.0;
     721            continue;
     722          }
     723        }
     724
     725        for (i = 1; i < 22; i++) {
     726          psString label = psStringCopy("");
     727          psStringAppend(&label,"CDF%02d",(int) (100 * try[i]));
     728         
     729          max_value = psMetadataLookupF32(&status,rule,label);
     730          max_cdf   = try[i];
     731          if (!status) {
     732            status = true;
     733            psError(PS_EXIT_CONFIG_ERROR, false, "Unable to find %s value for %s",label,colname);
     734          }
     735          if ((value < max_value)&&(value > min_value)) {
     736            cdf = ((value - min_value) * max_cdf + (max_value - value) * min_cdf) / (max_value - min_value);
     737            //      fprintf(stderr,"value: %f %f %f %f %f %f %d %d %f\n",value,quality,min_cdf,min_value,max_cdf,max_value, value < max_value, value > min_value,cdf);
     738            if (quality > cdf) {
     739              quality = cdf;
     740              done = 1;
     741              i = 25;
     742            }
     743          }
     744          min_value = max_value;
     745          min_cdf = max_cdf;
     746        }
     747        if (done) {
     748          continue;
     749        }
     750        // Reached end of array without finding the value;
     751        if (value > min_value) {
     752          if (quality > min_cdf) {
     753            quality = 1.0;
     754          }
     755        }
     756
     757
     758      } // End CDF rule parsing
    682759    }
    683760    bool success;
     
    695772      return(false);
    696773    }
     774    success = psMetadataAddF32(tableRow,PS_LIST_TAIL,"QUALITY",0,"",quality);
     775    if (!success) {
     776      psError(PS_ERR_UNKNOWN,false, "Error adding exposure quality to fits table row.");
     777      psFree(colNames);
     778      psFree(colTypes);
     779      psFree(contents);
     780      psFree(query);
     781      psFree(outTable);
     782      psFree(statsoutput);
     783      psFree(statIter);
     784      psFree(tableRow);
     785      return(false);
     786    }
    697787
    698788    // Add the row to the table array.
  • branches/eam_branches/ipp-20101205/ippTools/src/magicdstool.c

    r30446 r30579  
    11121112
    11131113    PXOPT_LOOKUP_STR(state, config->args, "-state", false, false);
     1114    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
    11141115
    11151116    psString queryFile = NULL;
     1117    bool stateIsUpdate = false;
    11161118    if (state) {
    11171119        if (! strcmp(state, "new") || !strcmp(state, "goto_restored")) {
     
    11191121        } else if (!strcmp(state, "update")) {
    11201122            queryFile = "magicdstool_revertupdated.sql";
     1123            stateIsUpdate = true;
    11211124        } else {
    11221125            psError(PXTOOLS_ERR_SYS, true, "%s is not a valid value for state", state);
     
    11411144    }
    11421145    psFree(where);
     1146
     1147    if (stateIsUpdate && !fault) {
     1148        // If fault has not been supplied, don't revert update faults with
     1149        // the magic "do not update" value
     1150        // We don't do this for new runs because then they would never complete
     1151        // quality should be used to drop bad components
     1152        psStringAppend(&query, " AND magicDSFile.fault != %d", PXTOOL_DO_NOT_REVERT_FAULT);
     1153    }
    11431154
    11441155    if (!p_psDBRunQuery(config->dbh, query)) {
     
    17441755    }
    17451756
     1757    // we do not update components with the magic fault value. They are non-updateable
     1758    // (But can be recovered with "magicdstool -revertdestreakedfile -fault 26" (PXTOOL_DO_NOT_REVERT_FAULT)
     1759    psStringAppend(&query, " AND (magicDSFile.fault != %d)", PXTOOL_DO_NOT_REVERT_FAULT);
     1760
    17461761    if (!p_psDBRunQueryF(config->dbh, query, setHook, magic_ds_id)) {
    17471762        psError(PS_ERR_UNKNOWN, false, "database error");
  • branches/eam_branches/ipp-20101205/ippTools/src/magictool.c

    r30446 r30579  
    627627    PXOPT_COPY_S64(config->args, where, "-magic_id", "magic_id", "==");
    628628    PXOPT_COPY_S16(config->args, where, "-fault", "fault", "==");
    629     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
     629    pxAddLabelSearchArgs (config, where, "-label", "magicRun.label", "==");
    630630
    631631    psString query = psStringCopy("UPDATE magicRun SET fault = 0 WHERE state = 'new' AND fault != 0");
  • branches/eam_branches/ipp-20101205/ippTools/src/magictoolConfig.c

    r30446 r30579  
    114114    psMetadataAddS64(reverttreeArgs, PS_LIST_TAIL, "-magic_id", 0, "search by magictool ID", 0);
    115115    psMetadataAddS16(reverttreeArgs, PS_LIST_TAIL, "-fault", 0, "search by fault code", 0);
    116     psMetadataAddStr(reverttreeArgs, PS_LIST_TAIL, "-label", 0, "search by label", NULL);
     116    psMetadataAddStr(reverttreeArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by label", NULL);
    117117
    118118    // -inputs
  • branches/eam_branches/ipp-20101205/ippTools/src/pstamptool.c

    r30446 r30579  
    571571    PXOPT_COPY_S32(config->args, where, "-fault",      "fault", "==");
    572572    PXOPT_COPY_STR(config->args, where, "-state",      "state", "==");
     573    PXOPT_COPY_STR(config->args, where, "-reqType",     "reqType", "==");
     574    PXOPT_COPY_STR(config->args, where, "-name",     "name", "LIKE");
    573575    PXOPT_COPY_TIME(config->args, where, "-timestamp_begin", "timestamp", ">=");
    574576    PXOPT_COPY_TIME(config->args, where, "-timestamp_end", "timestamp", "<=");
     
    586588        psStringAppend(&query, ", state = '%s'", state);
    587589        if (!strcmp(state, "goto_cleaned")) {
    588             psStringAppend(&stateCheck, " AND state != 'cleaned'");
     590            psStringAppend(&stateCheck, " AND (state != 'cleaned' AND state != 'goto_cleaned')");
    589591        }
    590592    }
  • branches/eam_branches/ipp-20101205/ippTools/src/pstamptoolConfig.c

    r30446 r30579  
    104104    psMetadataAddS16(updatereqArgs, PS_LIST_TAIL, "-fault", 0,        "search by fault code", 0);
    105105    psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-state", 0,        "search by state", NULL);
     106    psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-reqType", 0,      "search by reqType", NULL);
     107    psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-name", 0,      "search by reqType (LIKE comparsion)", NULL);
    106108    psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by pstampJob label (LIKE comparision)", NULL);
    107109    psMetadataAddTime(updatereqArgs, PS_LIST_TAIL, "-timestamp_begin", 0, "search by timestamp (>=)", NULL);
  • branches/eam_branches/ipp-20101205/ippTools/src/pxtools.h

    r28486 r30579  
    5151# define MAX_ROWS 10e9
    5252# define PXTOOL_MODE_NONE 0x0
     53// we do not revert or update components with this fault value
     54// This is the same value as PSTAMP_GONE
     55# define PXTOOL_DO_NOT_REVERT_FAULT 26
    5356
    5457bool pxIsValidState(const char *state);
  • branches/eam_branches/ipp-20101205/ippTools/src/warptool.c

    r29903 r30579  
    14851485    PXOPT_COPY_S16(config->args, where, "-fault",      "warpSkyfile.fault", "==");
    14861486
     1487    PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false);
     1488
    14871489    if (!psListLength(where->list)
    14881490        && !psMetadataLookupBool(NULL, config->args, "-all")) {
     
    15101512    }
    15111513    psFree(where);
     1514
     1515    if (!fault) {
     1516        // If fault has not been supplied, don't revert update faults with the magic value
     1517        // We don't do this for new runs because then they would never complete
     1518        // quality should be used to drop bad components
     1519        psStringAppend(&query_updated, " AND warpSkyfile.fault != %d", PXTOOL_DO_NOT_REVERT_FAULT);
     1520    }
    15121521
    15131522    if (!p_psDBRunQuery(config->dbh, query)) {
     
    20032012// shared code for the modes -tocleanedskyfile -tofullskyfile -topurgedskyfile
    20042013
    2005 static bool change_skyfile_data_state(pxConfig *config, psString data_state, psString run_state)
     2014static bool change_skyfile_data_state(pxConfig *config, psString data_state)
    20062015{
    20072016    PS_ASSERT_PTR_NON_NULL(config, false);
     
    20652074static bool tocleanedskyfileMode(pxConfig *config)
    20662075{
    2067     return change_skyfile_data_state(config, "cleaned", "goto_cleaned");
     2076    return change_skyfile_data_state(config, "cleaned");
    20682077}
    20692078static bool tofullskyfileMode(pxConfig *config)
    20702079{
    2071     return change_skyfile_data_state(config, "full", "update");
     2080    return change_skyfile_data_state(config, "full");
    20722081}
    20732082static bool topurgedskyfileMode(pxConfig *config)
    20742083{
    2075     return change_skyfile_data_state(config, "purged", "goto_purged");
     2084    return change_skyfile_data_state(config, "purged");
    20762085}
    20772086static bool toscrubbedskyfileMode(pxConfig *config)
    20782087{
    2079      return change_skyfile_data_state(config, "scrubbed", "goto_scrubbed");
     2088     return change_skyfile_data_state(config, "scrubbed");
    20802089}
    20812090
     
    21012110    else {
    21022111      if (strcmp(state,"error_cleaned") == 0) {
    2103         change_skyfile_data_state(config,"error_cleaned","goto_cleaned");
     2112        change_skyfile_data_state(config,"error_cleaned");
    21042113      }
    21052114      else if (strcmp(state, "error_scrubbed") == 0) {
    2106         change_skyfile_data_state(config,"error_scrubbed","goto_scrubbed");
     2115        change_skyfile_data_state(config,"error_scrubbed");
    21072116      }
    21082117      else if (strcmp(state, "error_purged") == 0) {
    2109         change_skyfile_data_state(config,"error_purged","goto_purged");
     2118        change_skyfile_data_state(config,"error_purged");
    21102119      }
    21112120      else {
     
    25262535        psStringAppend(&query, " AND (warpSkyfile.skycell_id = '%s')", skycell_id);
    25272536    }
     2537    // we do not update components with the magic fault value. They are non-updateable
     2538    // (But can be recovered with "warptool -revertwarped -fault 26" (PXTOOL_DO_NOT_REVERT_FAULT)
     2539    psStringAppend(&query, " AND (warpSkyfile.fault != %d)", PXTOOL_DO_NOT_REVERT_FAULT);
    25282540
    25292541    if (!p_psDBRunQueryF(config->dbh, query, setHook, warp_id)) {
Note: See TracChangeset for help on using the changeset viewer.