IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12188


Ignore:
Timestamp:
Mar 2, 2007, 12:42:55 PM (19 years ago)
Author:
jhoblitt
Message:

add camQueueChipID and use it where appropriate

Location:
trunk/ippTools
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/scripts/camtest.sh

    r12131 r12188  
    88camtool -pendingimfile || exit 1
    99
    10 camtool -addprocessedexp -cam_id 1 -uri file://camp -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -sigma_ra 1 -sigma_dec 2 -nastro 42 -path_base file:///foo -zp_mean 1 -zp_stdev 2 || exit 1
    11 camtool -addprocessedexp -cam_id 2 -uri file://camp -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -sigma_ra 1 -sigma_dec 2 -nastro 42 -path_base file:///foo -zp_mean 1 -zp_stdev 2 || exit 1
     10camtool -addprocessedexp -cam_id 1 -uri file:///cam -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -sigma_ra 1 -sigma_dec 2 -nastro 42 -path_base file:///foo -zp_mean 1 -zp_stdev 2 || exit 1
     11camtool -addprocessedexp -cam_id 2 -uri file:///cam -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -sigma_ra 1 -sigma_dec 2 -nastro 42 -path_base file:///foo -zp_mean 1 -zp_stdev 2 || exit 1
  • trunk/ippTools/share/Makefile.am

    r12184 r12188  
    11dist_pkgdata_DATA = \
     2        camtool_queue_chip_id.sql \
    23        chiptool_completely_processed_exp.sql \
     4        chiptool_find_rawexp.sql \
    35        chiptool_find_unprocessed_imfile.pl \
    46        chiptool_pendingimfile.sql \
    57        chiptool_processedimfile.sql \
     8        chiptool_queuerawexp.sql \
     9        chiptool_queuerawimfile.sql \
     10        regtool_find_unprocessed_exp.sql \
     11        regtool_find_unprocessed_imfile.sql \
     12        regtool_pendingexp.sql \
    613        regtool_pendingimfile.sql \
    7         regtool_find_unprocessed_exp.sql \
    814        regtool_processedexp.sql \
    9         regtool_find_unprocessed_imfile.sql \
    10         regtool_processedimfile.sql \
    11         regtool_pendingexp.sql \
    12         chiptool_queuerawexp.sql \
    13         chiptool_queuerawimfile.sql
    14         chiptool_find_rawexp.sql
     15        regtool_processedimfile.sql
  • trunk/ippTools/src/Makefile.am

    r12177 r12188  
    5151        pxio.c \
    5252        pxtag.c \
    53         chipqueuerawexp.c
     53        chipqueuerawexp.c \
     54        camqueue.c
    5455
    5556# for pxtools.h
  • trunk/ippTools/src/camtool.c

    r12176 r12188  
    293293    }
    294294
    295     psString recipe = psMetadataLookupStr(&status, config->args, "-recip");
    296     if (!status) {
    297         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -recip");
    298         return false;
    299     }
    300     if (!recipe) {
    301         psError(PS_ERR_UNKNOWN, true, "-recip is required");
    302         return false;
    303     }
    304 
    305295    psF64 bg = psMetadataLookupF64(&status, config->args, "-bg");
    306296    if (!status) {
     
    428418        pendingRow->chip_id,
    429419        pendingRow->label,
     420        pendingRow->recipe,
     421        pendingRow->expgroup,
     422        pendingRow->dvodb,
    430423        uri,
    431         recipe,
    432424        bg,
    433425        bg_stdev,
     
    439431        zp_mean,
    440432        zp_stdev,
    441         code,
    442         pendingRow->expgroup,
    443         pendingRow->dvodb
     433        code
    444434    );
    445435
  • trunk/ippTools/src/camtool.h

    r12025 r12188  
    3737pxConfig *camtoolConfig(pxConfig *config, int argc, char **argv);
    3838
     39bool camQueueChipID(pxConfig *config,
     40                    psS64 chip_id,
     41                    psString label,
     42                    psString recipe,
     43                    psString expgroup,
     44                    psString dvodb);
     45
    3946#endif // CAMTOOL_H
  • trunk/ippTools/src/camtoolConfig.c

    r12131 r12188  
    7878    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-uri", 0,
    7979            "define URI (required)", NULL);
    80     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-recip",  0,
    81             "define recipe (required)", NULL);
    8280    psMetadataAddF64(addprocessedexpArgs, PS_LIST_TAIL, "-bg", 0,
    8381            "define exposue background (required)", NAN);
  • trunk/ippTools/src/chiptool.c

    r12184 r12188  
    2929#include "pxdata.h"
    3030#include "chiptool.h"
     31#include "camtool.h"
    3132
    3233static bool queuerawexpMode(pxConfig *config);
     
    4142static chipProcessedImfileRow *chipPendingToProcessedImfile(pxConfig *config, chipPendingImfileRow *imfile);
    4243static chipProcessedExpRow *chipPendingToProcessedExp(pxConfig *config, chipPendingExpRow *pendingExp);
    43 static camPendingExpRow *chipPendingTocamPendingExp(pxConfig *config, chipPendingExpRow *pendingExp);
    4444static bool chipProcessedCompleteExp(pxConfig *config);
    4545
     
    748748    for (long i = 0; i < psArrayLength(output); i++) {
    749749        psMetadata *row = output->data[i];
     750
    750751        // convert metadata into a chipPendingExp object
    751         chipPendingExpRow *object = chipPendingExpObjectFromMetadata(row);
    752         // do both *Exp type conversion first so we don't insert one and then
    753         // have to rollback the change as the 2nd failed
     752        chipPendingExpRow *pendingExp = chipPendingExpObjectFromMetadata(row);
     753        if (!pendingExp) {
     754            psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into chipPendingExp");
     755            psFree(output);
     756            return false;
     757        }
     758
    754759        // convert chipPendingExp object into a chipProcesseExp object
    755         chipProcessedExpRow *processedExp = chipPendingToProcessedExp(config, object);
     760        chipProcessedExpRow *processedExp = chipPendingToProcessedExp(config, pendingExp);
    756761        if (!processedExp) {
    757762            psError(PS_ERR_UNKNOWN, false, "failed to convert chipPendingExp to chipProcessedExp");
    758             psFree(object);
    759             psFree(output);
    760             return false;
    761         }
    762         // convert chipPendingExp object into a camPendingExp object
    763         camPendingExpRow *pendingExp = chipPendingTocamPendingExp(config, object);
    764         if (!processedExp) {
    765             psError(PS_ERR_UNKNOWN, false, "failed to convert chipPendingExp to camPendingExp");
     763            psFree(pendingExp);
     764            psFree(output);
     765            return false;
     766        }
     767
     768        // delete the chipPendingExp object from the database
     769        if (!chipPendingExpDeleteObject(config->dbh, pendingExp)) {
     770            // there must be atleast 1 Imfile to get this far
     771            psError(PS_ERR_UNKNOWN, false, "database error");
    766772            psFree(processedExp);
    767             psFree(object);
    768             psFree(output);
    769             return false;
    770         }
     773            psFree(pendingExp);
     774            psFree(output);
     775            return false;
     776        }
     777        psFree(pendingExp);
     778
    771779        // insert chipProccessedExp object into the database
    772780        if (!chipProcessedExpInsertObject(config->dbh, processedExp)) {
    773781            psError(PS_ERR_UNKNOWN, false, "database error");
    774782            psFree(processedExp);
    775             psFree(pendingExp);
    776             psFree(object);
    777             psFree(output);
    778             return false;
    779         }
     783            psFree(output);
     784            return false;
     785        }
     786
     787        // camQueueChipID() can only be run after the chipProcessedExp entry
     788        // has been inserted.
     789        // queue the chip_id in the camPendingExp table
     790        if (!camQueueChipID(config,
     791                    processedExp->chip_id,
     792                    processedExp->label,
     793                    processedExp->recipe,
     794                    processedExp->expgroup,
     795                    processedExp->dvodb
     796        )) {
     797            // rollback
     798            if (!psDBRollback(config->dbh)) {
     799                psError(PS_ERR_UNKNOWN, false, "database error");
     800            }
     801            psError(PS_ERR_UNKNOWN, false, "failed to queue camPendingExp");
     802            psFree(processedExp);
     803            psFree(output);
     804            return false;
     805        }
     806
    780807        psFree(processedExp);
    781         // insert camPendingExp object into the database
    782         if (!camPendingExpInsertObject(config->dbh, pendingExp)) {
    783             psError(PS_ERR_UNKNOWN, false, "database error");
    784             psFree(pendingExp);
    785             psFree(object);
    786             psFree(output);
    787             return false;
    788         }
    789         psFree(pendingExp);
    790         // delete the chipPendingExp object from the database
    791         if (!chipPendingExpDeleteObject(config->dbh, object)) {
    792             // there must be atleast 1 Imfile to get this far
    793             psError(PS_ERR_UNKNOWN, false, "database error");
    794             psFree(object);
    795             psFree(output);
    796             return false;
    797         }
    798         psFree(object);
    799808    }
    800809
     
    875884        pendingExp->guide_id,
    876885        pendingExp->label,
     886        pendingExp->recipe,
    877887        pendingExp->expgroup,
    878888        pendingExp->dvodb
    879889    );
    880890}
    881 
    882 
    883 static camPendingExpRow *chipPendingTocamPendingExp(pxConfig *config, chipPendingExpRow *pendingExp)
    884 {
    885     PS_ASSERT_PTR_NON_NULL(pendingExp, NULL);
    886 
    887     return camPendingExpRowAlloc(
    888         0,                      // cam version, assigned by db
    889         pendingExp->chip_id,
    890         pendingExp->label,
    891         pendingExp->expgroup,
    892         pendingExp->dvodb
    893     );
    894 }
Note: See TracChangeset for help on using the changeset viewer.