IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 3, 2010, 8:41:49 AM (16 years ago)
Author:
eugene
Message:

updates from trunk

Location:
branches/tap_branches
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/tap_branches

  • branches/tap_branches/ippTools/src

    • Property svn:ignore
      •  

        old new  
        1616difftool
        1717disttool
         18dqstatstool
        1819faketool
        1920flatcorr
  • branches/tap_branches/ippTools/src/flatcorr.c

    r25835 r27838  
    115115    if (!psListLength(where->list)) {
    116116        psFree(where);
    117         psError(PXTOOLS_ERR_DATA, false, "search parameters are required");
    118         return false;
    119     }
    120 
    121     // require the camera to be defined: this analysis does not make sense 
     117        psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required");
     118        return false;
     119    }
     120
     121    // require the camera to be defined: this analysis does not make sense
    122122    // across multiple cameras
    123123    PXOPT_LOOKUP_STR(camera, config->args, "-inst", true, false);
     
    133133    PXOPT_LOOKUP_STR(tess_id, config->args, "-set_tess_id", false, false);
    134134    PXOPT_LOOKUP_STR(region, config->args, "-set_region", false, false);
     135    PXOPT_LOOKUP_BOOL(make_correction, config->args, "-make_correction", false);
    135136    PXOPT_LOOKUP_STR(note, config->args, "-set_note", false, false);
    136137
     
    141142    psString query = pxDataGet("chiptool_find_rawexp.sql");
    142143    if (!query) {
    143         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     144        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
    144145        psFree(where);
    145146        return false;
     
    172173
    173174    if (pretend) {
    174         for (long i = 0; i < psArrayLength(output); i++) {
    175             // negative simple so the default is true
    176             if (!ippdbPrintMetadataRaw(stdout, output->data[i], !simple)) {
    177                 psError(PS_ERR_UNKNOWN, false, "failed to print array");
    178                 psFree(output);
    179                 return false;
    180             }
    181         }
     175        for (long i = 0; i < psArrayLength(output); i++) {
     176            // negative simple so the default is true
     177            if (!ippdbPrintMetadataRaw(stdout, output->data[i], !simple)) {
     178                psError(PS_ERR_UNKNOWN, false, "failed to print array");
     179                psFree(output);
     180                return false;
     181            }
     182        }
    182183        psFree(output);
    183184        return true;
     
    194195    // create a new flatcorrRun
    195196    if (!flatcorrRunInsert(
    196             config->dbh,
     197            config->dbh,
    197198            0,      // corr_id
    198             det_type,
     199            det_type,
    199200            dvodb,
    200             camera,
    201             telescope,
    202             NULL,
     201            camera,
     202            telescope,
     203            NULL,
    203204            filter,
    204205            "reg",  // state
     206            make_correction,
    205207            workdir,
    206208            label,
    207209            reduction,
    208             region,
    209             NULL,
    210             0
     210            region,
     211            NULL,
     212            0
    211213        )) {
    212214        if (!psDBRollback(config->dbh)) {
     
    294296    PXOPT_LOOKUP_STR(tess_id, config->args, "-set_tess_id", false, false);
    295297    PXOPT_LOOKUP_STR(region, config->args, "-set_region", false, false);
     298    PXOPT_LOOKUP_BOOL(make_correction, config->args, "-make_correction", false);
    296299    // XXX probably should make the region in -set_region match ra_min, ra_max, etc
    297300
     
    307310    // create a new flatcorrRun
    308311    flatcorrRunRow *row = flatcorrRunRowAlloc(
    309         0,      // corr_id
    310         det_type,
    311         dvodb,
    312         camera,
    313         telescope,
    314         NULL,
    315         filter,
    316         "reg",  // state
    317         workdir,
    318         label,
    319         reduction,
    320         region,
    321         NULL, // hostname
    322         0 // fault
     312        0,      // corr_id
     313        det_type,
     314        dvodb,
     315        camera,
     316        telescope,
     317        NULL,
     318        filter,
     319        "reg",  // state
     320        make_correction,
     321        workdir,
     322        label,
     323        reduction,
     324        region,
     325        NULL, // hostname
     326        0 // fault
    323327        );
    324328
     
    331335        return false;
    332336    }
    333    
     337
    334338    // figure out the ID of the flatcorrRun we just created
    335339    psS64 corr_id = psDBLastInsertID(config->dbh);
     
    373377    psString query = pxDataGet("flatcorr_dropchip.sql");
    374378    if (!query) {
    375         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    376         return false;
     379        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     380        return false;
    377381    }
    378382
     
    416420    psString query = pxDataGet("flatcorr_dropcamera.sql");
    417421    if (!query) {
    418         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    419         return false;
     422        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     423        return false;
    420424    }
    421425
     
    444448    psString query = pxDataGet("flatcorr_chiprundone.sql");
    445449    if (!query) {
    446         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    447         return false;
     450        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     451        return false;
    448452    }
    449453
     
    457461    // treat limit == 0 as "no limit"
    458462    if (limit) {
    459         psString limitString = psDBGenerateLimitSQL(limit);
    460         psStringAppend(&query, " %s", limitString);
    461         psFree(limitString);
     463        psString limitString = psDBGenerateLimitSQL(limit);
     464        psStringAppend(&query, " %s", limitString);
     465        psFree(limitString);
    462466    }
    463467
     
    520524        // queue the exp
    521525        if (!pxcamQueueByChipID(
    522                 config,
    523                 row->chip_id,
    524                 row->workdir,
    525                 row->label,
    526                 row->data_group,
    527                 row->dist_group,
    528                 row->reduction,
    529                 row->expgroup,
    530                 row->dvodb,
    531                 row->tess_id,
    532                 "camera",
     526                config,
     527                row->chip_id,
     528                row->workdir,
     529                row->label,
     530                row->data_group,
     531                row->dist_group,
     532                row->reduction,
     533                row->expgroup,
     534                row->dvodb,
     535                row->tess_id,
     536                "camera",
     537                row->magicked,
    533538                NULL // note does not propragate
    534539                )) {
     
    543548        }
    544549
    545         // figure out the ID of the flatcorrRun we just created
    546         psS64 cam_id = psDBLastInsertID(config->dbh);
    547 
    548         // add the camRun entry to the flatcorrCamLink table (include is TRUE)
     550        // figure out the ID of the flatcorrRun we just created
     551        psS64 cam_id = psDBLastInsertID(config->dbh);
     552
     553        // add the camRun entry to the flatcorrCamLink table (include is TRUE)
    549554        if (!flatcorrCamLinkInsert(config->dbh, corr_id, row->chip_id, cam_id, 1)) {
    550555            if (!psDBRollback(config->dbh)) {
     
    554559            return false;
    555560        }
    556        
     561
    557562        psFree(row);
    558563    }
     
    582587    psString query = pxDataGet("flatcorr_camerarundone.sql");
    583588    if (!query) {
    584         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    585         return false;
     589        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     590        return false;
    586591    }
    587592
     
    595600    // treat limit == 0 as "no limit"
    596601    if (limit) {
    597         psString limitString = psDBGenerateLimitSQL(limit);
    598         psStringAppend(&query, " %s", limitString);
    599         psFree(limitString);
     602        psString limitString = psDBGenerateLimitSQL(limit);
     603        psStringAppend(&query, " %s", limitString);
     604        psFree(limitString);
    600605    }
    601606
     
    658663        // queue the exp : force image_only to be false (flatcorr is meaningless with just image info)
    659664        if (!pxaddQueueByCamID(
    660                 config,
    661                 row->cam_id,
    662                 row->workdir,
    663                 row->reduction,
    664                 row->label,
     665                config,
     666                row->cam_id,
     667                row->workdir,
     668                row->reduction,
     669                row->label,
    665670                row->data_group,
    666                 row->dvodb,
     671                row->dvodb,
    667672                NULL,       // note is not propagated
    668                 0)) {
     673                0)) {
    669674            if (!psDBRollback(config->dbh)) {
    670675                psError(PS_ERR_UNKNOWN, false, "database error");
     
    677682        }
    678683
    679         // figure out the ID of the flatcorrRun we just created
    680         psS64 add_id = psDBLastInsertID(config->dbh);
    681 
    682         // add the addRun entry to the flatcorrAddstarLink table (include is TRUE)
     684        // figure out the ID of the flatcorrRun we just created
     685        psS64 add_id = psDBLastInsertID(config->dbh);
     686
     687        // add the addRun entry to the flatcorrAddstarLink table (include is TRUE)
    683688        if (!flatcorrAddstarLinkInsert(config->dbh, corr_id, row->cam_id, add_id, 1)) {
    684689            if (!psDBRollback(config->dbh)) {
     
    714719    psString query = pxDataGet("flatcorr_pendingprocess.sql");
    715720    if (!query) {
    716         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    717         return false;
     721        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     722        return false;
    718723    }
    719724
     
    727732    // treat limit == 0 as "no limit"
    728733    if (limit) {
    729         psString limitString = psDBGenerateLimitSQL(limit);
    730         psStringAppend(&query, " %s", limitString);
    731         psFree(limitString);
     734        psString limitString = psDBGenerateLimitSQL(limit);
     735        psStringAppend(&query, " %s", limitString);
     736        psFree(limitString);
    732737    }
    733738
     
    750755
    751756    if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) {
    752         psError(PS_ERR_UNKNOWN, false, "failed to print array");
    753         psFree(output);
    754         return false;
     757        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     758        psFree(output);
     759        return false;
    755760    }
    756761
     
    809814    // treat limit == 0 as "no limit"
    810815    if (limit) {
    811         psString limitString = psDBGenerateLimitSQL(limit);
    812         psStringAppend(&query, " %s", limitString);
    813         psFree(limitString);
     816        psString limitString = psDBGenerateLimitSQL(limit);
     817        psStringAppend(&query, " %s", limitString);
     818        psFree(limitString);
    814819    }
    815820
     
    832837
    833838    if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) {
    834         psError(PS_ERR_UNKNOWN, false, "failed to print array");
    835         psFree(output);
    836         return false;
     839        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     840        psFree(output);
     841        return false;
    837842    }
    838843
     
    849854    PXOPT_LOOKUP_BOOL(simple,  config->args, "-simple",  false);
    850855    PXOPT_LOOKUP_BOOL(limit,   config->args, "-limit",   false);
    851    
     856
    852857    psMetadata *where = psMetadataAlloc();
    853858    PXOPT_COPY_S64(config->args, where, "-chip_id", "chipProcessedImfile.chip_id", "==");
     
    855860    psString query = pxDataGet("flatcorr_inputimfile.sql");
    856861    if (!query) {
    857         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     862        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
    858863        return false;
    859864    }
     
    868873    // treat limit == 0 as "no limit"
    869874    if (limit) {
    870         psString limitString = psDBGenerateLimitSQL(limit);
    871         psStringAppend(&query, " %s", limitString);
    872         psFree(limitString);
     875        psString limitString = psDBGenerateLimitSQL(limit);
     876        psStringAppend(&query, " %s", limitString);
     877        psFree(limitString);
    873878    }
    874879
     
    891896
    892897    if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) {
    893         psError(PS_ERR_UNKNOWN, false, "failed to print array");
    894         psFree(output);
    895         return false;
     898        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     899        psFree(output);
     900        return false;
    896901    }
    897902
     
    905910
    906911    // check that state is a valid string value
    907     if (!strcmp(state, "reg") && 
    908         !strcmp(state, "new") &&
    909         !strcmp(state, "full"))
     912    if (!strcmp(state, "reg") &&
     913        !strcmp(state, "new") &&
     914        !strcmp(state, "full"))
    910915    {
    911916        psError(PS_ERR_UNKNOWN, false, "invalid state: %s", state);
Note: See TracChangeset for help on using the changeset viewer.