IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20397 for trunk/ippTools/src


Ignore:
Timestamp:
Oct 25, 2008, 9:12:41 AM (18 years ago)
Author:
eugene
Message:

adding include fields to flatcorrChipLink and flatcorrCamLink

Location:
trunk/ippTools/src
Files:
3 edited

Legend:

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

    r20377 r20397  
    3939static bool addchipMode(pxConfig *config);
    4040static bool addcameraMode(pxConfig *config);
     41static bool dropchipMode(pxConfig *config);
     42static bool dropcameraMode(pxConfig *config);
    4143static bool pendingprocessMode(pxConfig *config);
    4244static bool addprocessMode(pxConfig *config);
     
    6971        MODECASE(FLATCORR_MODE_ADDCHIP,        addchipMode);
    7072        MODECASE(FLATCORR_MODE_ADDCAMERA,      addcameraMode);
     73        MODECASE(FLATCORR_MODE_DROPCHIP,       dropchipMode);
     74        MODECASE(FLATCORR_MODE_DROPCAMERA,     dropcameraMode);
    7175        MODECASE(FLATCORR_MODE_PENDINGPROCESS, pendingprocessMode);
    7276        MODECASE(FLATCORR_MODE_ADDPROCESS,     addprocessMode);
     
    236240        }
    237241
    238         // add a flatcorrChipLink to the flatcorr Run we just created
    239         if (!flatcorrChipLinkInsert(config->dbh, corr_id, chip_id)) {
     242        // add a flatcorrChipLink to the flatcorr Run we just created (initial state has include = TRUE)
     243        if (!flatcorrChipLinkInsert(config->dbh, corr_id, chip_id, 1)) {
    240244            if (!psDBRollback(config->dbh)) {
    241245                psError(PS_ERR_UNKNOWN, false, "database error");
     
    337341    PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", true, false);
    338342
    339     if (!flatcorrChipLinkInsert(config->dbh, corr_id, chip_id)) {
    340         psError(PS_ERR_UNKNOWN, false, "database error");
     343    // add a flatcorrChipLink (initial state has include = TRUE)
     344    if (!flatcorrChipLinkInsert(config->dbh, corr_id, chip_id, 1)) {
     345        psError(PS_ERR_UNKNOWN, false, "database error");
     346        return false;
     347    }
     348
     349    return true;
     350}
     351
     352static bool dropchipMode(pxConfig *config)
     353{
     354    PS_ASSERT_PTR_NON_NULL(config, false);
     355
     356    // required
     357    PXOPT_LOOKUP_S64(corr_id, config->args, "-corr_id", true, false);
     358    PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", true, false);
     359
     360    // UPDATE flatcorrChipLink set include = 0 where corr_id = %lld AND chip_id = %lld
     361    psString query = pxDataGet("flatcorr_dropchip.sql");
     362    if (!query) {
     363        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     364        return false;
     365    }
     366
     367    if (!p_psDBRunQuery(config->dbh, query, (long long) corr_id, (long long) chip_id)) {
     368        psError(PS_ERR_UNKNOWN, false, "database error");
     369        psFree(query);
    341370        return false;
    342371    }
     
    448477        psS64 cam_id = psDBLastInsertID(config->dbh);
    449478
    450         // add the camRun entry to the flatcorrCamLink table:
    451         if (!flatcorrCamLinkInsert(config->dbh, corr_id, row->chip_id, cam_id)) {
     479        // add the camRun entry to the flatcorrCamLink table (include is TRUE)
     480        if (!flatcorrCamLinkInsert(config->dbh, corr_id, row->chip_id, cam_id, 1)) {
    452481            if (!psDBRollback(config->dbh)) {
    453482                psError(PS_ERR_UNKNOWN, false, "database error");
     
    467496
    468497    return false;
     498}
     499
     500static bool dropcameraMode(pxConfig *config)
     501{
     502    PS_ASSERT_PTR_NON_NULL(config, false);
     503
     504    // required
     505    PXOPT_LOOKUP_S64(corr_id, config->args, "-corr_id", true, false);
     506    PXOPT_LOOKUP_S64(cam_id, config->args, "-cam_id", true, false);
     507
     508    // UPDATE flatcorrCamLink set include = 0 where corr_id = %lld AND cam_id = %lld
     509    psString query = pxDataGet("flatcorr_dropcamera.sql");
     510    if (!query) {
     511        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     512        return false;
     513    }
     514
     515    if (!p_psDBRunQuery(config->dbh, query, (long long) corr_id, (long long) cam_id)) {
     516        psError(PS_ERR_UNKNOWN, false, "database error");
     517        psFree(query);
     518        return false;
     519    }
     520
     521    return true;
    469522}
    470523
  • trunk/ippTools/src/flatcorr.h

    r19325 r20397  
    2929    FLATCORR_MODE_ADDCHIP,
    3030    FLATCORR_MODE_ADDCAMERA,
     31    FLATCORR_MODE_DROPCHIP,
     32    FLATCORR_MODE_DROPCAMERA,
    3133    FLATCORR_MODE_PENDINGPROCESS,
    3234    FLATCORR_MODE_ADDPROCESS,
  • trunk/ippTools/src/flatcorrConfig.c

    r20377 r20397  
    8181    psMetadataAddS64(addchipArgs, PS_LIST_TAIL, "-chip_id", 0,            "define Chip ID (required)", 0);
    8282
     83    // -dropchip
     84    psMetadata *dropchipArgs = psMetadataAlloc();
     85    psMetadataAddS64(dropchipArgs, PS_LIST_TAIL, "-corr_id", 0,            "define Flat Correction ID (required)", 0);
     86    psMetadataAddS64(dropchipArgs, PS_LIST_TAIL, "-chip_id", 0,            "define Chip ID (required)", 0);
     87
    8388    // -addcamera
    8489    psMetadata *addcameraArgs = psMetadataAlloc();
     
    8691    psMetadataAddBool(addcameraArgs, PS_LIST_TAIL, "-simple",  0, "use the simple output format", false);
    8792    psMetadataAddBool(addcameraArgs, PS_LIST_TAIL, "-pretend", 0, "use the simple output format", false);
     93
     94    // -dropcamera
     95    psMetadata *dropcameraArgs = psMetadataAlloc();
     96    psMetadataAddS64(dropcameraArgs, PS_LIST_TAIL, "-corr_id", 0,      "define Flat Correction ID (required)", 0);
     97    psMetadataAddS64(dropcameraArgs, PS_LIST_TAIL, "-cam_id", 0,       "define Camera ID (required)", 0);
    8898
    8999    // -pendingprocess
     
    124134    PXOPT_ADD_MODE("-addchip",        "add a chip to a flat correction run",               FLATCORR_MODE_ADDCHIP,        addchipArgs);
    125135    PXOPT_ADD_MODE("-addcamera",      "migrate completed chips to camera stage analysis",  FLATCORR_MODE_ADDCAMERA,      addcameraArgs);
     136    PXOPT_ADD_MODE("-dropchip",       "drop a chip from a flat correction run",            FLATCORR_MODE_DROPCHIP,       dropchipArgs);
     137    PXOPT_ADD_MODE("-dropcamera",     "drop an exposure (camera stage analysis)",          FLATCORR_MODE_DROPCAMERA,     dropcameraArgs);
    126138    PXOPT_ADD_MODE("-pendingprocess", "show flat correction runs needing to be processed", FLATCORR_MODE_PENDINGPROCESS, pendingprocessArgs);
    127139    PXOPT_ADD_MODE("-addprocess",     "report completed flat correction analysis",         FLATCORR_MODE_ADDPROCESS,     addprocessArgs);
Note: See TracChangeset for help on using the changeset viewer.