IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 30, 2010, 9:31:50 AM (16 years ago)
Author:
eugene
Message:

updates from trunk

Location:
branches/eam_branches/ipp-20100621/ippTools/src
Files:
2 edited

Legend:

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

    • Property svn:ignore
      •  

        old new  
        3939warptool
        4040staticskytool
        41 
         41bgtool
        4242diffphottool
  • branches/eam_branches/ipp-20100621/ippTools/src/stacktool.c

    r28376 r28794  
    7878        MODECASE(STACKTOOL_MODE_ADDSUMSKYFILE,         addsumskyfileMode);
    7979        MODECASE(STACKTOOL_MODE_SUMSKYFILE,            sumskyfileMode);
    80         MODECASE(STACKTOOL_MODE_SASSSKYFILE,            sassskyfileMode);
     80        MODECASE(STACKTOOL_MODE_SASSSKYFILE,            sassskyfileMode);
    8181        MODECASE(STACKTOOL_MODE_REVERTSUMSKYFILE,      revertsumskyfileMode);
    82         MODECASE(STACKTOOL_MODE_TOSUMMARY,             tosummaryMode);
    83         MODECASE(STACKTOOL_MODE_ADDSUMMARY,            addsummaryMode);
     82        MODECASE(STACKTOOL_MODE_TOSUMMARY,             tosummaryMode);
     83        MODECASE(STACKTOOL_MODE_ADDSUMMARY,            addsummaryMode);
    8484        MODECASE(STACKTOOL_MODE_PENDINGCLEANUPRUN,     pendingcleanuprunMode);
    8585        MODECASE(STACKTOOL_MODE_PENDINGCLEANUPSKYFILE, pendingcleanupskyfileMode);
     
    155155
    156156    printf("%" PRId64 " %s %s %s %s\n",psMetadataLookupS64(NULL,row,"sass_id"),
    157            psMetadataLookupStr(NULL,row,"data_group"),
    158            psMetadataLookupStr(NULL,row,"tess_id"),
    159            psMetadataLookupStr(NULL,row,"filter"),
    160            psMetadataLookupStr(NULL,row,"projection_cell"));
     157           psMetadataLookupStr(NULL,row,"data_group"),
     158           psMetadataLookupStr(NULL,row,"tess_id"),
     159           psMetadataLookupStr(NULL,row,"filter"),
     160           psMetadataLookupStr(NULL,row,"projection_cell"));
    161161
    162162    if (psMetadataLookupS64(NULL,row,"sass_id") == PS_MAX_S64) {
     
    170170    psMetadataAddStr(outrow,PS_LIST_TAIL,"filter",PS_META_REPLACE,"",psMetadataLookupStr(NULL,row,"filter"));
    171171    psMetadataAddStr(outrow,PS_LIST_TAIL,"projection_cell",PS_META_REPLACE,"",
    172                      psMetadataLookupStr(NULL,row,"projection_cell"));
     172                     psMetadataLookupStr(NULL,row,"projection_cell"));
    173173  }
    174174  printf("%" PRId64 " %s %s %s %s\n",psMetadataLookupS64(NULL,outrow,"sass_id"),
    175         psMetadataLookupStr(NULL,outrow,"data_group"),
    176         psMetadataLookupStr(NULL,outrow,"tess_id"),
    177         psMetadataLookupStr(NULL,outrow,"filter"),
    178         psMetadataLookupStr(NULL,outrow,"projection_cell"));
    179  
     175        psMetadataLookupStr(NULL,outrow,"data_group"),
     176        psMetadataLookupStr(NULL,outrow,"tess_id"),
     177        psMetadataLookupStr(NULL,outrow,"filter"),
     178        psMetadataLookupStr(NULL,outrow,"projection_cell"));
     179
    180180
    181181  psFree(output);
     
    184184  return(sassRow);
    185185}
    186      
    187      
    188  
    189                                              
     186
     187
     188
     189
    190190
    191191
     
    239239    PXOPT_COPY_F32(config->args,  where, "-select_zpt_obs_min",        "camProcessedExp.zpt_obs", ">=");
    240240    PXOPT_COPY_F32(config->args,  where, "-select_zpt_obs_max",        "camProcessedExp.zpt_obs", "<=");
     241    PXOPT_COPY_F32(config->args,  where, "-select_astrom",             "sqrt(POWER(camProcessedExp.sigma_ra, 2) + POWER(camProcessedExp.sigma_dec, 2))", "<=");
    241242
    242243    PXOPT_COPY_STR(config->args,  where, "-select_exp_type",           "rawExp.exp_type", "==");
     
    483484        psFree(run);
    484485
    485         //CZW Add an association entry here.
    486         // Define the requested association, and insert it if it doesn't already exist
    487         stackAssociationRow *association = pxStackAssociationDefine(config,stack_id);
    488         psS64 sass_id;
    489         if (!association->sass_id) {
    490           psTrace("stacktool.association",2,"No required Association found. Adding.");
    491 
    492           if (!stackAssociationInsertObject(config->dbh,association)) {
    493             if (!psDBRollback(config->dbh)) {
    494               psError(PS_ERR_UNKNOWN, false, "database error");
    495             }
    496             psError(PS_ERR_UNKNOWN, false, "database error");
    497             psFree(output);
    498             psFree(run);
    499             psFree(insert);
    500             psFree(list);
    501             psFree(association);
    502             if (!psDBRollback(config->dbh)) {
    503               psError(PS_ERR_UNKNOWN, false, "database error");
    504             }
    505             return(false);
    506           }
    507           sass_id = psDBLastInsertID(config->dbh);
    508           association->sass_id = sass_id;
    509         }
    510         // Insert the map entry for this row.
    511         stackAssociationMapRow *maprow = stackAssociationMapRowAlloc(sass_id,stack_id);
    512         if (!stackAssociationMapInsertObject(config->dbh,maprow)) {
    513           if (!psDBRollback(config->dbh)) {
    514             psError(PS_ERR_UNKNOWN, false, "database error");
    515           }
    516           psError(PS_ERR_UNKNOWN, false, "database error");
    517           psFree(output);
    518           psFree(run);
    519           psFree(insert);
    520           psFree(list);
    521           psFree(association);
    522           if (!psDBRollback(config->dbh)) {
    523             psError(PS_ERR_UNKNOWN, false, "database error");
    524           }
    525           return(false);
    526         }
    527        
    528        
     486        //CZW Add an association entry here.
     487        // Define the requested association, and insert it if it doesn't already exist
     488        stackAssociationRow *association = pxStackAssociationDefine(config,stack_id);
     489        psS64 sass_id;
     490        if (!association->sass_id) {
     491          psTrace("stacktool.association",2,"No required Association found. Adding.");
     492
     493          if (!stackAssociationInsertObject(config->dbh,association)) {
     494            if (!psDBRollback(config->dbh)) {
     495              psError(PS_ERR_UNKNOWN, false, "database error");
     496            }
     497            psError(PS_ERR_UNKNOWN, false, "database error");
     498            psFree(output);
     499            psFree(run);
     500            psFree(insert);
     501            psFree(list);
     502            psFree(association);
     503            if (!psDBRollback(config->dbh)) {
     504              psError(PS_ERR_UNKNOWN, false, "database error");
     505            }
     506            return(false);
     507          }
     508          sass_id = psDBLastInsertID(config->dbh);
     509          association->sass_id = sass_id;
     510        }
     511        // Insert the map entry for this row.
     512        stackAssociationMapRow *maprow = stackAssociationMapRowAlloc(sass_id,stack_id);
     513        if (!stackAssociationMapInsertObject(config->dbh,maprow)) {
     514          if (!psDBRollback(config->dbh)) {
     515            psError(PS_ERR_UNKNOWN, false, "database error");
     516          }
     517          psError(PS_ERR_UNKNOWN, false, "database error");
     518          psFree(output);
     519          psFree(run);
     520          psFree(insert);
     521          psFree(list);
     522          psFree(association);
     523          if (!psDBRollback(config->dbh)) {
     524            psError(PS_ERR_UNKNOWN, false, "database error");
     525          }
     526          return(false);
     527        }
     528
     529
    529530        // Create a suitable insertion query for this run
    530531        psString thisInsert = psStringCopy(insert);
     
    685686
    686687    //CZW Add an association entry here.
    687    
     688
    688689    // insert the stackInputSkyfile rows
    689690    psListIterator *iter = psListIteratorAlloc(warp_ids->data.list, 0, false);
     
    740741    PXOPT_COPY_STR(config->args, where, "-label",     "stackRun.label",     "==");
    741742    PXOPT_COPY_STR(config->args, where, "-state",     "stackRun.state",     "==");
    742     PXOPT_COPY_STR(config->args, where, "-sass_id",   "stackAssociationMap.sass_id",  "==");
     743    PXOPT_COPY_S64(config->args, where, "-sass_id",   "stackAssociationMap.sass_id",  "==");
    743744    if (!psListLength(where->list)) {
    744745        psFree(where);
     
    13481349static bool tosummaryMode(pxConfig *config) {
    13491350  PS_ASSERT_PTR_NON_NULL(config, NULL);
    1350  
     1351
    13511352  psMetadata *where = psMetadataAlloc();
    13521353  PXOPT_COPY_S64(config->args, where, "-stack_id",    "stackSumSkyfile.warp_id", "==");
     
    13571358  pxAddLabelSearchArgs (config, where, "-label",   "stackRun.label", "LIKE");
    13581359  pxAddLabelSearchArgs (config, where, "-data_group",   "stackRun.data_group", "LIKE");
    1359  
     1360
    13601361  PXOPT_LOOKUP_BOOL(all, config->args, "-all", false);
    13611362
    13621363  PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
    13631364  PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    1364  
     1365
    13651366  // find all rawImfiles matching the default query
    13661367  psString query = pxDataGet("stacktool_tosummary.sql");
     
    13801381    return false;
    13811382  }
    1382  
     1383
    13831384  psFree(where);
    13841385
     
    14081409      psError(PXTOOLS_ERR_PROG, false, "unknown error");
    14091410    }
    1410    
     1411
    14111412    return false;
    14121413  }
     
    14161417    return true;
    14171418  }
    1418  
     1419
    14191420  if (psArrayLength(output)) {
    14201421    // negative simple so the default is true
     
    14251426    }
    14261427  }
    1427  
     1428
    14281429  psFree(output);
    14291430  return(true);
     
    14471448  }
    14481449  psS64 numUpdated = psDBAffectedRows(config->dbh);
    1449  
     1450
    14501451  if (numUpdated != 1) {
    14511452    psError(PS_ERR_UNKNOWN, false, "should have affected 1 row");
     
    14531454    return false;
    14541455  }
    1455  
     1456
    14561457  psFree(query);
    14571458
    14581459  // Print anything here?
    1459  
     1460
    14601461  return(true);
    14611462}
     
    14711472    PXOPT_COPY_S64(config->args, where, "-stack_id", "stackRun.stack_id", "==");
    14721473    PXOPT_COPY_S64(config->args, where, "-sass_id", "stackAssociationMap.sass_id", "==");
    1473    
     1474
    14741475    pxAddLabelSearchArgs (config, where, "-label", "stackRun.label", "==");
    14751476
Note: See TracChangeset for help on using the changeset viewer.