IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 28, 2008, 11:17:03 AM (18 years ago)
Author:
jhoblitt
Message:

add camtool -updaterun

File:
1 edited

Legend:

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

    r17142 r17171  
    2828#include "pxtools.h"
    2929#include "pxwarp.h"
     30#include "pxcam.h"
    3031#include "camtool.h"
    3132
    3233static bool queueMode(pxConfig *config);
     34static bool updaterunMode(pxConfig *config);
    3335static bool pendingexpMode(pxConfig *config);
    3436static bool pendingimfileMode(pxConfig *config);
     
    6062    switch (config->mode) {
    6163        MODECASE(CAMTOOL_MODE_QUEUE,                queueMode);
     64        MODECASE(CAMTOOL_MODE_UPDATERUN,            updaterunMode);
    6265        MODECASE(CAMTOOL_MODE_PENDINGEXP,           pendingexpMode);
    6366        MODECASE(CAMTOOL_MODE_PENDINGIMFILE,        pendingimfileMode);
     
    156159    PXOPT_COPY_F32(config->args, where, "-solang_max", "solang", "<");
    157160
    158     if (where->list->n < 1) {
     161    if (!psListLength(where->list)) {
    159162        psFree(where);
    160         where = NULL;
     163        psError(PXTOOLS_ERR_DATA, false, "search parameters are required");
     164        return false;
    161165    }
    162166
     
    256260    return true;
    257261}
     262
     263
     264static bool updaterunMode(pxConfig *config)
     265{
     266    PS_ASSERT_PTR_NON_NULL(config, false);
     267
     268    PXOPT_LOOKUP_STR(cam_id, config->args, "-cam_id", false, false);
     269    PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);
     270    PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);
     271
     272    psMetadata *where = psMetadataAlloc();
     273    // convert cam_id into a psS64
     274    if (cam_id) {
     275        if (!psMetadataAddS64(where, PS_LIST_TAIL, "cam_id", 0, "==", (psS64)atoll(cam_id))) {
     276            psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
     277            psFree(where);
     278            return false;
     279        }
     280    }
     281
     282    // convert chip_id into a psS64
     283    if (chip_id) {
     284        if (!psMetadataAddS64(where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(chip_id))) {
     285            psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
     286            psFree(where);
     287            return false;
     288        }
     289    }
     290
     291    // convert exp_id into a psS64
     292    if (exp_id) {
     293        if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) {
     294            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     295            psFree(where);
     296            return false;
     297        }
     298    }
     299
     300    PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");
     301    PXOPT_COPY_STR(config->args, where, "-inst", "camera", "==");
     302    PXOPT_COPY_STR(config->args, where, "-telescope", "telescope", "==");
     303    PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "dateobs", ">=");
     304    PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "dateobs", "<=");
     305    PXOPT_COPY_STR(config->args, where, "-exp_tag", "exp_tag", "==");
     306    PXOPT_COPY_STR(config->args, where, "-exp_type", "exp_type", "==");
     307    PXOPT_COPY_STR(config->args, where, "-filelevel", "filelevel", "==");
     308    PXOPT_COPY_STR(config->args, where, "-reduction", "reduction", "==");
     309    PXOPT_COPY_STR(config->args, where, "-filter", "filter", "==");
     310
     311    PXOPT_COPY_F64(config->args, where, "-airmass_min", "airmass", ">=");
     312    PXOPT_COPY_F64(config->args, where, "-airmass_max", "airmass", "<");
     313    PXOPT_COPY_F64(config->args, where, "-ra_min", "ra", ">=");
     314    PXOPT_COPY_F64(config->args, where, "-ra_max", "ra", "<");
     315    PXOPT_COPY_F64(config->args, where, "-decl_min", "decl", ">=");
     316    PXOPT_COPY_F64(config->args, where, "-decl_max", "decl", "<");
     317    PXOPT_COPY_F32(config->args, where, "-exp_time_min", "exp_time", ">=");
     318    PXOPT_COPY_F32(config->args, where, "-exp_time_max", "exp_time", "<");
     319    PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_min", "sat_pixel_frac", ">=");
     320    PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_max", "sat_pixel_frac", "<");
     321    PXOPT_COPY_F64(config->args, where, "-bg_min", "bt", ">=");
     322    PXOPT_COPY_F64(config->args, where, "-bg_max", "bt", "<");
     323    PXOPT_COPY_F64(config->args, where, "-bg_stdev_min", "bg_stdev", ">=");
     324    PXOPT_COPY_F64(config->args, where, "-bg_stdev_max", "bg_stdev", "<");
     325    PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_min", "bg_mean_stdev", ">=");
     326    PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_max", "bg_mean_stdev", "<");
     327    PXOPT_COPY_F64(config->args, where, "-alt_min", "alt", ">=");
     328    PXOPT_COPY_F64(config->args, where, "-alt_max", "alt", "<");
     329    PXOPT_COPY_F64(config->args, where, "-az_min", "az", ">=");
     330    PXOPT_COPY_F64(config->args, where, "-az_max", "az", "<");
     331    PXOPT_COPY_F32(config->args, where, "-ccd_temp_min", "ccd_temp", ">=");
     332    PXOPT_COPY_F32(config->args, where, "-ccd_temp_max", "ccd_temp", "<");
     333    PXOPT_COPY_F64(config->args, where, "-posang_min", "posang", ">=");
     334    PXOPT_COPY_F64(config->args, where, "-posang_max", "posang", "<");
     335    PXOPT_COPY_STR(config->args, where, "-object", "object", "==");
     336    PXOPT_COPY_F32(config->args, where, "-solang_min", "solang", ">=");
     337    PXOPT_COPY_F32(config->args, where, "-solang_max", "solang", "<");
     338
     339    if (!psListLength(where->list)) {
     340        psFree(where);
     341        psError(PXTOOLS_ERR_DATA, false, "search parameters are required");
     342        return false;
     343    }
     344
     345    PXOPT_LOOKUP_STR(state, config->args, "-state", false, false);
     346    PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);
     347
     348    if ((!state) && (!label)) {
     349        psError(PXTOOLS_ERR_DATA, false, "parameters are required");
     350        return false;
     351    }
     352
     353    if (state) {
     354        // set chipRun.state to state
     355        if (!pxcamRunSetStateByQuery(config, where, state)) {
     356            return false;
     357        }
     358    }
     359
     360    if (label) {
     361        // set chipRun.label to label
     362        if (!pxcamRunSetLabelByQuery(config, where, label)) {
     363            return false;
     364        }
     365    }
     366
     367    return true;
     368}
     369
    258370
    259371static bool pendingexpMode(pxConfig *config)
Note: See TracChangeset for help on using the changeset viewer.