IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23590


Ignore:
Timestamp:
Mar 29, 2009, 1:50:46 PM (17 years ago)
Author:
eugene
Message:

cleanup and fix use of pxcamGet/SetSearchArgs

Location:
trunk/ippTools/src
Files:
3 edited

Legend:

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

    r23310 r23590  
    109109    psMetadata *where = psMetadataAlloc();
    110110    pxcamGetSearchArgs (config, where);
    111     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
     111    PXOPT_COPY_STR(config->args, where, "-label",     "chipRun.label",     "==");
     112    PXOPT_COPY_STR(config->args, where, "-reduction", "chipRun.reduction", "==");
    112113
    113114    if (!psListLength(where->list)
     
    223224
    224225    psMetadata *where = psMetadataAlloc();
    225     PXOPT_COPY_S64(config->args, where, "-cam_id", "cam_id", "==");
    226226    pxcamGetSearchArgs (config, where);
    227     PXOPT_COPY_STR(config->args, where, "-label", "camRun.label", "==");
    228     PXOPT_COPY_STR(config->args, where, "-state", "camRun.state", "==");
     227    PXOPT_COPY_S64(config->args, where, "-cam_id",    "camRun.cam_id", "==");
     228    PXOPT_COPY_STR(config->args, where, "-label",     "camRun.label", "==");
     229    PXOPT_COPY_STR(config->args, where, "-state",     "camRun.state", "==");
     230    PXOPT_COPY_STR(config->args, where, "-reduction", "camRun.reduction", "==");
    229231
    230232    if (!psListLength(where->list)
     
    271273
    272274    psMetadata *where = psMetadataAlloc();
    273     PXOPT_COPY_S64(config->args, where, "-cam_id", "cam_id", "==");
    274275    pxcamGetSearchArgs (config, where);
    275     PXOPT_COPY_STR(config->args, where, "-label", "label", "==");
     276    PXOPT_COPY_S64(config->args, where, "-cam_id",    "camRun.cam_id", "==");
     277    PXOPT_COPY_STR(config->args, where, "-label",     "camRun.label", "==");
     278    PXOPT_COPY_STR(config->args, where, "-reduction", "camRun.reduction", "==");
    276279
    277280    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     
    334337
    335338    psMetadata *where = psMetadataAlloc();
    336     PXOPT_COPY_S64(config->args, where, "-cam_id",   "cam_id",   "==");
    337     PXOPT_COPY_S64(config->args, where, "-chip_id",  "chip_id",  "==");
    338     PXOPT_COPY_STR(config->args, where, "-class",    "class",    "==");
    339     PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "==");
    340339    pxcamGetSearchArgs (config, where);
    341     PXOPT_COPY_STR(config->args, where, "-label", "camRun.label", "==");
     340    PXOPT_COPY_S64(config->args, where, "-cam_id",    "camRun.cam_id",                "==");
     341    PXOPT_COPY_STR(config->args, where, "-label",     "camRun.label",                 "==");
     342    PXOPT_COPY_STR(config->args, where, "-reduction", "camRun.reduction",             "==");
     343    PXOPT_COPY_S64(config->args, where, "-chip_id",   "chipRun.chip_id",              "==");
     344    PXOPT_COPY_STR(config->args, where, "-class_id",  "chipProcessedImfile.class_id", "==");
     345
     346    // XXX is this used? PXOPT_COPY_STR(config->args, where, "-class",    "class",         "==");
    342347
    343348    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     
    649654    // generate restrictions
    650655    psMetadata *where = psMetadataAlloc();
    651     PXOPT_COPY_S64(config->args, where, "-cam_id",   "cam_id",   "==");
    652656    pxcamGetSearchArgs (config, where);
    653     PXOPT_COPY_STR(config->args, where, "-label", "camRun.label", "==");
     657    PXOPT_COPY_S64(config->args, where, "-cam_id",    "camRun.cam_id",    "==");
     658    PXOPT_COPY_STR(config->args, where, "-label",     "camRun.label",     "==");
     659    PXOPT_COPY_STR(config->args, where, "-reduction", "camRun.reduction", "==");
    654660
    655661    psString query = pxDataGet("camtool_find_processedexp.sql");
     
    674680    }
    675681
     682    // order by cam_id so that the postage stamp parser can easliy find the 'latest' astrometry
     683    psStringAppend(&query, " ORDER BY cam_id");
     684
    676685    // treat limit == 0 as "no limit"
    677686    if (limit) {
     
    681690    }
    682691
    683     // order by cam_id so that the postage stamp parser can easliy find the 'latest' astrometry
    684     psStringAppend(&query, "\nORDER BY cam_id");
    685 
    686692    if (!p_psDBRunQuery(config->dbh, query)) {
    687693        psError(PS_ERR_UNKNOWN, false, "database error");
     
    720726
    721727    psMetadata *where = psMetadataAlloc();
    722     PXOPT_COPY_S64(config->args, where, "-cam_id", "camRun.cam_id", "==");
    723728    pxcamGetSearchArgs (config, where);
    724     PXOPT_COPY_STR(config->args, where, "-label", "camRun.label", "==");
    725     PXOPT_COPY_S16(config->args, where, "-code", "camProcessedExp.fault", "==");
     729    PXOPT_COPY_S64(config->args, where, "-cam_id",    "camRun.cam_id",         "==");
     730    PXOPT_COPY_STR(config->args, where, "-label",     "camRun.label",          "==");
     731    PXOPT_COPY_STR(config->args, where, "-reduction", "camRun.reduction",      "==");
     732    PXOPT_COPY_S16(config->args, where, "-code",      "camProcessedExp.fault", "==");
    726733
    727734    if (!psListLength(where->list) && !psMetadataLookupBool(NULL, config->args, "-all")) {
  • trunk/ippTools/src/camtoolConfig.c

    r23418 r23590  
    5252    psMetadata *definebyqueryArgs = psMetadataAlloc();
    5353    pxcamSetSearchArgs(definebyqueryArgs);
    54     psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-label", 0, "search for label", NULL);
     54    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-label",              0, "search by chipRun label", NULL);
     55    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-reduction",          0, "search by chipRun reduction class", NULL);
    5556
    5657    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_workdir",        0, "define workdir", NULL);
     
    6869    // XXX need to allow multiple exp_ids
    6970    psMetadata *updaterunArgs = psMetadataAlloc();
     71    pxcamSetSearchArgs(updaterunArgs);
    7072    psMetadataAddS64(updaterunArgs, PS_LIST_TAIL, "-cam_id",             0, "search by cam_id", 0);
    71     pxcamSetSearchArgs(updaterunArgs);
    72     psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-label", 0, "search for label", NULL);
    73     psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state", 0, "search for state", NULL);
     73    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-label",              0, "search by camRun label", NULL);
     74    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state",              0, "search by camRun state", NULL);
     75    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-reduction",          0, "search by camRun reduction class", NULL);
    7476    psMetadataAddBool(updaterunArgs, PS_LIST_TAIL, "-all",               0, "allow everything to be queued without search terms", false);
    75     psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_state",              0, "set state", NULL);
    76     psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_label",              0, "set label", NULL);
     77    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_state",          0, "set state", NULL);
     78    psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_label",          0, "set label", NULL);
    7779
    7880    // -pendingexp
    7981    psMetadata *pendingexpArgs = psMetadataAlloc();
    80     psMetadataAddS64(pendingexpArgs, PS_LIST_TAIL, "-cam_id",            0, "search by camtool ID", 0);
    8182    pxcamSetSearchArgs(pendingexpArgs);
    82     psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-label", 0, "search for label", NULL);
     83    psMetadataAddS64(pendingexpArgs, PS_LIST_TAIL, "-cam_id",            0, "search by cam_id", 0);
     84    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-label",             0, "search by camRun label", NULL);
     85    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-reduction",         0, "search by camRun reduction class", NULL);
    8386    psMetadataAddU64(pendingexpArgs, PS_LIST_TAIL, "-limit",             0, "limit result set to N items", 0);
    8487    psMetadataAddBool(pendingexpArgs, PS_LIST_TAIL, "-simple",           0, "use the simple output format", false);
     
    8689    // -pendingimfile
    8790    psMetadata *pendingimfileArgs = psMetadataAlloc();
    88     psMetadataAddS64(pendingimfileArgs, PS_LIST_TAIL, "-cam_id", 0,            "search by camtool ID", 0);
    8991    pxcamSetSearchArgs(pendingimfileArgs);
    90     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-label", 0, "search for label", NULL);
    91     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-class", 0,            "search by class", NULL);
     92    psMetadataAddS64(pendingimfileArgs, PS_LIST_TAIL, "-cam_id",   0,            "search by camtool ID", 0);
     93    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-label",    0,            "search by camRun label", NULL);
     94    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-reduction",0,            "search by camRun reduction class", NULL);
    9295    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-class_id", 0,            "search by class ID", NULL);
    93     psMetadataAddBool(pendingimfileArgs, PS_LIST_TAIL, "-simple", 0,            "use the simple output format", false);
     96    psMetadataAddBool(pendingimfileArgs, PS_LIST_TAIL, "-simple",  0,            "use the simple output format", false);
     97
     98    // XXX is this used? psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-class",    0,            "search by class", NULL);
    9499
    95100    // -addprocessedexp
     
    164169    // -processedexp
    165170    psMetadata *processedexpArgs = psMetadataAlloc();
    166     psMetadataAddS64(processedexpArgs, PS_LIST_TAIL, "-cam_id", 0,            "search by camtool ID", 0);
    167171    pxcamSetSearchArgs(processedexpArgs);
    168     psMetadataAddStr(processedexpArgs, PS_LIST_TAIL, "-label", 0, "search for label", NULL);
     172    psMetadataAddS64(processedexpArgs, PS_LIST_TAIL, "-cam_id",   0,            "search by cam_id", 0);
     173    psMetadataAddStr(processedexpArgs, PS_LIST_TAIL, "-label",    0,            "search by camRun label", NULL);
     174    psMetadataAddStr(processedexpArgs, PS_LIST_TAIL, "-reduction",0,            "search by camRun reduction class", NULL);
    169175
    170176    psMetadataAddU64(processedexpArgs, PS_LIST_TAIL, "-limit",  0,            "limit result set to N items", 0);
     
    177183    // XXX need to allow multiple exp_ids
    178184    psMetadata *revertprocessedexpArgs = psMetadataAlloc();
    179     psMetadataAddS64(revertprocessedexpArgs, PS_LIST_TAIL, "-cam_id",  0,            "search by cam_id", 0);
    180185    pxcamSetSearchArgs(revertprocessedexpArgs);
    181     psMetadataAddStr(revertprocessedexpArgs, PS_LIST_TAIL, "-label", 0, "search for label", NULL);
     186    psMetadataAddS64(revertprocessedexpArgs, PS_LIST_TAIL, "-cam_id",   0,            "search by cam_id", 0);
     187    psMetadataAddStr(revertprocessedexpArgs, PS_LIST_TAIL, "-label",    0,            "search by camRun label", NULL);
     188    psMetadataAddStr(revertprocessedexpArgs, PS_LIST_TAIL, "-reduction",0,            "search by camRun reduction class", NULL);
     189    psMetadataAddS16(revertprocessedexpArgs, PS_LIST_TAIL, "-code",     0,            "search by fault code", 0);
    182190
    183191    psMetadataAddBool(revertprocessedexpArgs, PS_LIST_TAIL, "-all",  0,            "allow everything to be queued without search terms", false);
    184     psMetadataAddS16(revertprocessedexpArgs, PS_LIST_TAIL, "-code",  0,            "search by fault code", 0);
    185192
    186193    // -updateprocessedexp
  • trunk/ippTools/src/pxcam.c

    r21402 r23590  
    4242    psMetadataAddStr(md,  PS_LIST_TAIL, "-comment",            0, "search by comment", NULL);
    4343    psMetadataAddStr(md,  PS_LIST_TAIL, "-filelevel",          0, "search by filelevel", NULL);
    44     psMetadataAddStr(md,  PS_LIST_TAIL, "-reduction",          0, "search by reduction class", NULL);
    4544    psMetadataAddStr(md,  PS_LIST_TAIL, "-filter",             0, "search for filter", NULL);
    4645    psMetadataAddF64(md,  PS_LIST_TAIL, "-airmass_min",        0, "define min airmass", NAN);
     
    7776bool pxcamGetSearchArgs (pxConfig *config, psMetadata *where) {
    7877
    79     PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "==");
    80     PXOPT_COPY_S64(config->args, where, "-exp_id", "rawExp.exp_id", "==");
    81     PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");
    82     PXOPT_COPY_STR(config->args, where, "-inst", "camera", "==");
    83     PXOPT_COPY_STR(config->args, where, "-telescope", "telescope", "==");
    84     PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "dateobs", ">=");
    85     PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "dateobs", "<=");
    86     PXOPT_COPY_STR(config->args, where, "-exp_tag", "exp_tag", "==");
    87     PXOPT_COPY_STR(config->args, where, "-exp_type", "exp_type", "==");
    88     PXOPT_COPY_STR(config->args, where, "-comment", "rawExp.comment", "LIKE");
    89     PXOPT_COPY_STR(config->args, where, "-filelevel", "filelevel", "==");
    90     PXOPT_COPY_STR(config->args, where, "-reduction", "reduction", "==");
    91     PXOPT_COPY_STR(config->args, where, "-filter", "filter", "==");
    92     PXOPT_COPY_F64(config->args, where, "-airmass_min", "airmass", ">=");
    93     PXOPT_COPY_F64(config->args, where, "-airmass_max", "airmass", "<");
    94     PXOPT_COPY_F64(config->args, where, "-ra_min", "ra", ">=");
    95     PXOPT_COPY_F64(config->args, where, "-ra_max", "ra", "<");
    96     PXOPT_COPY_F64(config->args, where, "-decl_min", "decl", ">=");
    97     PXOPT_COPY_F64(config->args, where, "-decl_max", "decl", "<");
    98     PXOPT_COPY_F32(config->args, where, "-exp_time_min", "exp_time", ">=");
    99     PXOPT_COPY_F32(config->args, where, "-exp_time_max", "exp_time", "<");
    100     PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_min", "sat_pixel_frac", ">=");
    101     PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_max", "sat_pixel_frac", "<");
    102     PXOPT_COPY_F64(config->args, where, "-bg_min", "bt", ">=");
    103     PXOPT_COPY_F64(config->args, where, "-bg_max", "bt", "<");
    104     PXOPT_COPY_F64(config->args, where, "-bg_stdev_min", "bg_stdev", ">=");
    105     PXOPT_COPY_F64(config->args, where, "-bg_stdev_max", "bg_stdev", "<");
    106     PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_min", "bg_mean_stdev", ">=");
    107     PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_max", "bg_mean_stdev", "<");
    108     PXOPT_COPY_F64(config->args, where, "-alt_min", "alt", ">=");
    109     PXOPT_COPY_F64(config->args, where, "-alt_max", "alt", "<");
    110     PXOPT_COPY_F64(config->args, where, "-az_min", "az", ">=");
    111     PXOPT_COPY_F64(config->args, where, "-az_max", "az", "<");
    112     PXOPT_COPY_F32(config->args, where, "-ccd_temp_min", "ccd_temp", ">=");
    113     PXOPT_COPY_F32(config->args, where, "-ccd_temp_max", "ccd_temp", "<");
    114     PXOPT_COPY_F64(config->args, where, "-posang_min", "posang", ">=");
    115     PXOPT_COPY_F64(config->args, where, "-posang_max", "posang", "<");
    116     PXOPT_COPY_STR(config->args, where, "-object", "object", "==");
    117     PXOPT_COPY_F32(config->args, where, "-solang_min", "solang", ">=");
    118     PXOPT_COPY_F32(config->args, where, "-solang_max", "solang", "<");
     78    PXOPT_COPY_S64(config->args,  where, "-chip_id",            "chipRun.chip_id",       "==");
     79    PXOPT_COPY_S64(config->args,  where, "-exp_id",             "rawExp.exp_id",         "==");
     80    PXOPT_COPY_STR(config->args,  where, "-exp_name",           "rawExp.exp_name",       "==");
     81    PXOPT_COPY_STR(config->args,  where, "-inst",               "rawExp.camera",         "==");
     82    PXOPT_COPY_STR(config->args,  where, "-telescope",          "rawExp.telescope",      "==");
     83    PXOPT_COPY_TIME(config->args, where, "-dateobs_begin",      "rawExp.dateobs",        ">=");
     84    PXOPT_COPY_TIME(config->args, where, "-dateobs_end",        "rawExp.dateobs",        "<=");
     85    PXOPT_COPY_STR(config->args,  where, "-exp_tag",            "rawExp.exp_tag",        "==");
     86    PXOPT_COPY_STR(config->args,  where, "-exp_type",           "rawExp.exp_type",       "==");
     87    PXOPT_COPY_STR(config->args,  where, "-comment",            "rawExp.comment",        "LIKE");
     88    PXOPT_COPY_STR(config->args,  where, "-filelevel",          "rawExp.filelevel",      "==");
     89    PXOPT_COPY_STR(config->args,  where, "-filter",             "rawExp.filter",         "==");
     90    PXOPT_COPY_F64(config->args,  where, "-airmass_min",        "rawExp.airmass",        ">=");
     91    PXOPT_COPY_F64(config->args,  where, "-airmass_max",        "rawExp.airmass",        "<");
     92    PXOPT_COPY_F64(config->args,  where, "-ra_min",             "rawExp.ra",             ">=");
     93    PXOPT_COPY_F64(config->args,  where, "-ra_max",             "rawExp.ra",             "<");
     94    PXOPT_COPY_F64(config->args,  where, "-decl_min",           "rawExp.decl",           ">=");
     95    PXOPT_COPY_F64(config->args,  where, "-decl_max",           "rawExp.decl",           "<");
     96    PXOPT_COPY_F32(config->args,  where, "-exp_time_min",       "rawExp.exp_time",       ">=");
     97    PXOPT_COPY_F32(config->args,  where, "-exp_time_max",       "rawExp.exp_time",       "<");
     98    PXOPT_COPY_F32(config->args,  where, "-sat_pixel_frac_min", "rawExp.sat_pixel_frac", ">=");
     99    PXOPT_COPY_F32(config->args,  where, "-sat_pixel_frac_max", "rawExp.sat_pixel_frac", "<");
     100    PXOPT_COPY_F64(config->args,  where, "-bg_min",             "rawExp.bg",             ">=");
     101    PXOPT_COPY_F64(config->args,  where, "-bg_max",             "rawExp.bg",             "<");
     102    PXOPT_COPY_F64(config->args,  where, "-bg_stdev_min",       "rawExp.bg_stdev",       ">=");
     103    PXOPT_COPY_F64(config->args,  where, "-bg_stdev_max",       "rawExp.bg_stdev",       "<");
     104    PXOPT_COPY_F64(config->args,  where, "-bg_mean_stdev_min",  "rawExp.bg_mean_stdev",  ">=");
     105    PXOPT_COPY_F64(config->args,  where, "-bg_mean_stdev_max",  "rawExp.bg_mean_stdev",  "<");
     106    PXOPT_COPY_F64(config->args,  where, "-alt_min",            "rawExp.alt",            ">=");
     107    PXOPT_COPY_F64(config->args,  where, "-alt_max",            "rawExp.alt",            "<");
     108    PXOPT_COPY_F64(config->args,  where, "-az_min",             "rawExp.az",             ">=");
     109    PXOPT_COPY_F64(config->args,  where, "-az_max",             "rawExp.az",             "<");
     110    PXOPT_COPY_F32(config->args,  where, "-ccd_temp_min",       "rawExp.ccd_temp",       ">=");
     111    PXOPT_COPY_F32(config->args,  where, "-ccd_temp_max",       "rawExp.ccd_temp",       "<");
     112    PXOPT_COPY_F64(config->args,  where, "-posang_min",         "rawExp.posang",         ">=");
     113    PXOPT_COPY_F64(config->args,  where, "-posang_max",         "rawExp.posang",         "<");
     114    PXOPT_COPY_STR(config->args,  where, "-object",             "rawExp.object",         "==");
     115    PXOPT_COPY_F32(config->args,  where, "-solang_min",         "rawExp.solang",         ">=");
     116    PXOPT_COPY_F32(config->args,  where, "-solang_max",         "rawExp.solang",         "<");
    119117
    120118    return true;
Note: See TracChangeset for help on using the changeset viewer.