IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9057


Ignore:
Timestamp:
Sep 28, 2006, 5:25:54 PM (20 years ago)
Author:
jhoblitt
Message:

require ippdb 0.0.38
the "big" exp_id -> exp_tag conversion

Location:
trunk/ippTools
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/Makefile.am

    r8697 r9057  
    22
    33CLEANFILES = *~ core core.*
     4
     5ACLOCAL_AMFLAGS = -I m4
  • trunk/ippTools/configure.ac

    r9046 r9057  
    1616PKG_CHECK_MODULES([PSLIB], [pslib >= 0.12.99])
    1717PKG_CHECK_MODULES([PSMODULES], [psmodules >= 0.12.0])
    18 PKG_CHECK_MODULES([IPPDB], [ippdb >= 0.0.37])
     18PKG_CHECK_MODULES([IPPDB], [ippdb >= 0.0.38])
    1919
    2020AC_PROG_PERL_MODULES(
  • trunk/ippTools/scripts/dettest.sh

    r8755 r9057  
    99
    1010for ID in `seq 0 3` ; do
    11     dettool -addprocessed -det_id 1 -exp_id 10 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 1
     11    dettool -addprocessedimfile -det_id 1 -exp_tag t10 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 1
    1212done;
    1313
    1414for ID in `seq 0 3` ; do
    15     dettool -addprocessed -det_id 1 -exp_id 11 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 1
     15    dettool -addprocessedimfile -det_id 1 -exp_tag t11 -class_id $ID -uri file://proc-$ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 || exit 1
    1616done;
    1717
     
    3434
    3535for ID in `seq 0 3` ; do
    36     dettool -addresidimfile -det_id 1 -exp_id 10 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 1
     36    dettool -addresidimfile -det_id 1 -exp_tag t10 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 1
    3737done;
    3838for ID in `seq 0 3` ; do
    39     dettool -addresidimfile -det_id 1 -exp_id 11 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 1
     39    dettool -addresidimfile -det_id 1 -exp_tag t11 -class_id $ID -recip myrecip -bg 1 -bg_stdev 1 -bg_mean_stdev 1 -uri file://resid-$ID || exit 1
    4040done;
    4141
    4242dettool -toresidexp || exit 1
    43 dettool -addresidexp -det_id 1 -exp_id 10 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri jpeg1 -b2_uri jpeg2  || exit 1
    44 dettool -addresidexp -det_id 1 -exp_id 11 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri jpeg1 -b2_uri jpeg2  -reject || exit 1
     43dettool -addresidexp -det_id 1 -exp_tag t10 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri jpeg1 -b2_uri jpeg2  || exit 1
     44dettool -addresidexp -det_id 1 -exp_tag t11 -recip myrecipe -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -b1_uri jpeg1 -b2_uri jpeg2  -reject || exit 1
    4545
    4646dettool -residdetrun || exit 1
    4747dettool -residexp || exit 1
    4848dettool -updateresidexp -det_id 1 -iteration 0 -recip yourrecipe || exit 1
    49 dettool -updateresidexp -det_id 1 -iteration 0 -exp_id 10 -reject || exit 1
    50 dettool -updateresidexp -det_id 1 -iteration 0 -exp_id 11 || exit 1
     49dettool -updateresidexp -det_id 1 -iteration 0 -exp_tag t10 -reject || exit 1
     50dettool -updateresidexp -det_id 1 -iteration 0 -exp_tag t11 || exit 1
    5151dettool -residexp || exit 1
    5252dettool -updatedetrun -det_id 1 -again || exit 1
  • trunk/ippTools/scripts/regtest.sh

    r8755 r9057  
    88echo -e "YES\nipp\n\n" | pxadmin -recreate || exit 1
    99
    10 $inject -newExp -exp_id 10 -inst gpc -telescope ps1 -exp_type object -imfiles 4 || exit 1
     10$inject -newExp -exp_tag t10 -exp_id 10 -inst gpc -telescope ps1 -exp_type object -imfiles 4 || exit 1
    1111
    1212for ID in `seq 0 3`; do
    13     $inject -newImfile -exp_id 10 -class OTA -class_id $ID -uri file://$ID || exit 1
     13    $inject -newImfile -exp_tag t10 -class OTA -class_id $ID -uri file://$ID || exit 1
    1414done;
    1515
    16 $inject -newExp -exp_id 11 -inst gpc -telescope ps1 -exp_type object -imfiles 4 || exit 1
     16$inject -newExp -exp_tag t11 -exp_id 11 -inst gpc -telescope ps1 -exp_type object -imfiles 4 || exit 1
    1717
    1818for ID in `seq 0 3`; do
    19     $inject -newImfile -exp_id 11 -class OTA -class_id $ID -uri file://$ID || exit 1
     19    $inject -newImfile -exp_tag t11 -class OTA -class_id $ID -uri file://$ID || exit 1
    2020done;
    2121
    2222for ID in `seq 0 3`; do
    23     $p0tool -updateimfile -exp_id 10 -exp_type object -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 || exit 1
     23    $p0tool -updateimfile -exp_tag t10 -exp_type object -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 || exit 1
    2424done;
    2525
    26 $p0tool -updateexp -exp_id 10 -filter r -airmass 10 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 10 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 45 -posang 10 $* || exit 1
     26$p0tool -updateexp -exp_tag t10 -filter r -airmass 10 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 10 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 45 -posang 10 $* || exit 1
    2727
    2828for ID in `seq 0 3`; do
    29     $p0tool -updateimfile -exp_id 11 -exp_type object -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 || exit 1
     29    $p0tool -updateimfile -exp_tag t11 -exp_type object -class OTA -class_id $ID -filter r -airmass 10 -ra 1 -decl 2 -exp_time 0 -bg 1 -bg_stdev 1 -bg_mean_stdev 10 -alt 10 -az 10 -ccd_temp 10 -posang 10 || exit 1
    3030done;
    3131
    32 $p0tool -updateexp -exp_id 11 -filter r -airmass 11 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 11 -bg_stdev 1 -bg_mean_stdev 11 -alt 11 -az 11 -ccd_temp 45 -posang 11 $* || exit 1
     32$p0tool -updateexp -exp_tag t11 -filter r -airmass 11 -ra 1 -decl 2 -exp_type bias -exp_time 0 -bg 11 -bg_stdev 1 -bg_mean_stdev 11 -alt 11 -az 11 -ccd_temp 45 -posang 11 $* || exit 1
  • trunk/ippTools/src/chiptool.c

    r8849 r9057  
    9292            for (long j = 0; j < pendingFrames->n; j++) {
    9393                p2PendingFrame *pendingFrame = pendingFrames->data[j];
    94                 if (strcmp(rawFrame->exposure->exp_id,
    95                            pendingFrame->exposure->exp_id) == 0) {
     94                if (strcmp(rawFrame->exposure->exp_tag,
     95                           pendingFrame->exposure->exp_tag) == 0) {
    9696                    psArrayRemove(rawFrames, rawFrame);
    9797                    // dec the counter as the array just got shorter
     
    111111                for (long j = 0; j < pendingFrames->n; j++) {
    112112                    p2DoneFrame *doneFrame = pendingFrames->data[j];
    113                     if (strcmp(rawFrame->exposure->exp_id,
    114                                doneFrame->exposure->exp_id) == 0) {
     113                    if (strcmp(rawFrame->exposure->exp_tag,
     114                               doneFrame->exposure->exp_tag) == 0) {
    115115                        psArrayRemove(rawFrames, rawFrame);
    116116                        // dec the counter as the array just got shorter
     
    178178    // select * from p2ProcessedImfiles
    179179    // where
    180     // exp_id & class_id are not in p2PendingImfile
     180    // exp_tag & class_id are not in p2PendingImfile
    181181
    182182    // add the completed imfile to
     
    193193        " FROM p2PendingImfile "
    194194        " LEFT JOIN p2ProcessedImfile"
    195         "   USING(exp_id, class_id)"
     195        "   USING(exp_tag, class_id)"
    196196        " WHERE"
    197         "  p2ProcessedImfile.exp_id IS NULL"
     197        "  p2ProcessedImfile.exp_tag IS NULL"
    198198        "  AND p2ProcessedImfile.class_id IS NULL"
    199199        );
     
    201201        psMetadata *where = psMetadataAlloc();
    202202        bool status = false;
    203         psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");        if (!status) {
    204             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     203        psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");        if (!status) {
     204            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    205205            psFree(query);
    206206            return false;
    207207        }
    208         if (exp_id) {
    209             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
    210                 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     208        if (exp_tag) {
     209            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
     210                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    211211                psFree(where);
    212212                psFree(query);
     
    339339
    340340    // select * from p2PendingExp
    341     // where exp_id is not in p2ProcessedExp
    342     // where exp_id is not in p2PendingImfile
     341    // where exp_tag is not in p2ProcessedExp
     342    // where exp_tag is not in p2PendingImfile
    343343    // where the number of entries in p2ProccessedImfile matches the .imfiles
    344344    // entry in rawScienceExp
     
    350350        " FROM p2PendingExp"
    351351        " JOIN rawScienceExp"
    352         "   ON p2PendingExp.exp_id = rawScienceExp.exp_id"
     352        "   ON p2PendingExp.exp_tag = rawScienceExp.exp_tag"
    353353        " LEFT JOIN p2ProcessedExp"
    354         "   ON p2PendingExp.exp_id = p2ProcessedExp.exp_id"
     354        "   ON p2PendingExp.exp_tag = p2ProcessedExp.exp_tag"
    355355        " LEFT JOIN p2PendingImfile"
    356         "   ON p2PendingExp.exp_id = p2PendingImfile.exp_id"
     356        "   ON p2PendingExp.exp_tag = p2PendingImfile.exp_tag"
    357357        " LEFT JOIN p2ProcessedImfile"
    358         "   ON p2PendingExp.exp_id = p2ProcessedImfile.exp_id"
     358        "   ON p2PendingExp.exp_tag = p2ProcessedImfile.exp_tag"
    359359        " WHERE"
    360         "  p2ProcessedExp.exp_id IS NULL"
    361         "  AND p2PendingImfile.exp_id IS NULL"
    362         "  AND p2ProcessedImfile.exp_id IS NOT NULL"
     360        "  p2ProcessedExp.exp_tag IS NULL"
     361        "  AND p2PendingImfile.exp_tag IS NULL"
     362        "  AND p2ProcessedImfile.exp_tag IS NOT NULL"
    363363        " GROUP BY"
    364         "   p2PendingExp.exp_id"
     364        "   p2PendingExp.exp_tag"
    365365        " HAVING rawScienceExp.imfiles = COUNT(p2ProcessedImfile.class_id)"
    366366        );
     
    514514
    515515    return p2ProcessedImfileRowAlloc(
    516         imfile->exp_id,
     516        imfile->exp_tag,
    517517        imfile->class_id,
    518518        uri,
     
    533533
    534534    return p2ProcessedExpRowAlloc(
    535         pendingExp->exp_id,
     535        pendingExp->exp_tag,
    536536        pendingExp->p1_version,
    537537        pendingExp->p2_version
     
    544544
    545545    return p3PendingExpRowAlloc(
    546         pendingExp->exp_id,
     546        pendingExp->exp_tag,
    547547        pendingExp->p1_version,
    548548        pendingExp->p2_version
  • trunk/ippTools/src/chiptoolConfig.c

    r8658 r9057  
    3232    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-filter",  0,
    3333            "define filter of interest", NULL);
    34     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
     34    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
    3535            "define exposure ID", NULL);
    3636    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-class",  0,
     
    4545    // -addprocessedimfile
    4646    psMetadata *addprocessedimfileArgs = psMetadataAlloc();
    47     psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
    48             "define exp_id (required)", NULL);
     47    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
     48            "define exp_tag (required)", NULL);
    4949    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-class_id",  0,
    5050            "define class ID", NULL);
     
    138138    config->where = psMetadataAlloc();
    139139
    140     addWhereStr(exp_id);
     140    addWhereStr(exp_tag);
    141141    // convert '-inst' to 'camera'
    142142    {
  • trunk/ippTools/src/dettool.c

    r9046 r9057  
    127127
    128128     psString query = psStringCopy("SELECT rawDetrendExp.* FROM rawDetrendExp"
    129         " LEFT JOIN detInputExp ON rawDetrendExp.exp_id = detInputExp.exp_id"
    130         " WHERE detInputExp.exp_id IS NULL");
     129        " LEFT JOIN detInputExp ON rawDetrendExp.exp_tag = detInputExp.exp_tag"
     130        " WHERE detInputExp.exp_tag IS NULL");
    131131
    132132    if (config->where) {
     
    190190    }
    191191
    192     // we have to support multipe exp_ids
    193     psMetadataItem *item = psMetadataLookup(config->args, "-exp_id");
     192    // we have to support multipe exp_tags
     193    psMetadataItem *item = psMetadataLookup(config->args, "-exp_tag");
    194194    if (!item) {
    195195        // this shouldn't actually happen when using psArgs
    196         psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
     196        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
    197197        return false;
    198198    }
    199199    psMetadata *where = psMetadataAlloc();
    200200
    201     // make sure that -exp_id was parsed correctly
     201    // make sure that -exp_tag was parsed correctly
    202202    // XXX this can be removed someday
    203203    if (item->type == PS_DATA_METADATA_MULTI) {
     
    205205        psMetadataItem *mItem = NULL;
    206206        while ((mItem = psListGetAndIncrement(iter))) {
    207             psString exp_id = mItem->data.V;
    208             // if exp_id is NULL then it means that -exp_id has not been
     207            psString exp_tag = mItem->data.V;
     208            // if exp_tag is NULL then it means that -exp_tag has not been
    209209            // specified
    210             if (!exp_id) {
     210            if (!exp_tag) {
    211211                psError(PS_ERR_UNKNOWN, true,
    212                         "at least one -exp_id is required");
     212                        "at least one -exp_tag is required");
    213213                psFree(where);
    214214                return false;
    215215            }
    216216
    217             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id",
    218                  PS_META_DUPLICATE_OK, "==", exp_id)) {
    219                 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     217            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag",
     218                 PS_META_DUPLICATE_OK, "==", exp_tag)) {
     219                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    220220                psFree(iter);
    221221                psFree(where);
     
    226226    } else {
    227227        psAbort(config->argv[0],
    228                 "-exp_id was not parsed correctly (this should not happen");
     228                "-exp_tag was not parsed correctly (this should not happen");
    229229    }
    230230
     
    234234    }
    235235
    236     // check that the specified exp_ids actually exist
     236    // check that the specified exp_tags actually exist
    237237    psArray *detrendExps = rawDetrendExpSelectRowObjects(config->dbh, where, 0);
    238238    psFree(where);
     
    242242    }
    243243
    244     // we should have one rawDetrendExp row per exp_id specified
     244    // we should have one rawDetrendExp row per exp_tag specified
    245245    if (psListLength(item->data.list) != psArrayLength(detrendExps)) {
    246246        psAbort(config->argv[0],
    247     "an -exp_id matched more then one rawDetrendExp (this should not happen");
     247    "an -exp_tag matched more then one rawDetrendExp (this should not happen");
    248248
    249249    }
     
    717717        det_id,
    718718        iteration,
    719         rawExp->exp_id,
     719        rawExp->exp_tag,
    720720        true            // use
    721721    );
     
    729729    // select rawDetrendExp.*
    730730    // by:
    731     // exp_id
     731    // exp_tag
    732732
    733733    psString query = psStringCopy(
     
    735735        " FROM detInputExp"
    736736        " JOIN rawDetrendExp"
    737         " USING(exp_id)"
     737        " USING(exp_tag)"
    738738        );
    739739
     
    789789    //
    790790    // det_id is in detInputExp
    791     // exp_id is in detInputExp
     791    // exp_tag is in detInputExp
    792792    // det_id is not in detProccessedImfile
    793     // exp_id is not in detProccessedImfile
     793    // exp_tag is not in detProccessedImfile
    794794    // class_is is not in detProccessedImfile
    795795    psString query = psStringCopy(
    796796            "SELECT detInputExp.det_id, detRun.det_type, rawImfile.*"
    797797            " FROM rawImfile"
    798             " LEFT JOIN detInputExp USING(exp_id) "
     798            " LEFT JOIN detInputExp USING(exp_tag) "
    799799            " LEFT JOIN detRun ON detInputExp.det_id = detRun.position"
    800800            " LEFT JOIN detProcessedImfile"
    801801                " ON detInputExp.det_id = detProcessedImfile.det_id"
    802                 " AND rawImfile.exp_id = detProcessedImfile.exp_id"
     802                " AND rawImfile.exp_tag = detProcessedImfile.exp_tag"
    803803                " AND rawImfile.class_id = detProcessedImfile.class_id"
    804804            " WHERE"
    805805            " detInputExp.det_id IS NOT NULL"
    806             " AND detInputExp.exp_id IS NOT NULL"
     806            " AND detInputExp.exp_tag IS NOT NULL"
    807807            " AND detProcessedImfile.det_id IS NULL"
    808             " AND detProcessedImfile.exp_id IS NULL"
     808            " AND detProcessedImfile.exp_tag IS NULL"
    809809            " AND detProcessedImfile.class_id IS NULL"
    810810        );
     
    861861    }
    862862
    863     // select exp_ids from detInputExp matching det_idp
     863    // select exp_tags from detInputExp matching det_idp
    864864    // where query should be pre-generated
    865865    psArray *detInputExp =
     
    870870    }
    871871
    872     // generate where query with just the exp_ids
    873     psMetadata *where_exp_ids = psMetadataAlloc();
     872    // generate where query with just the exp_tags
     873    psMetadata *where_exp_tags = psMetadataAlloc();
    874874    for (long i = 0; i < psArrayLength(detInputExp); i++) {
    875875        detInputExpRow *row = detInputExp->data[i];
    876         if (!psMetadataAddStr(where_exp_ids, PS_LIST_TAIL, "exp_id",
    877                 PS_META_DUPLICATE_OK, "==", row->exp_id)
     876        if (!psMetadataAddStr(where_exp_tags, PS_LIST_TAIL, "exp_tag",
     877                PS_META_DUPLICATE_OK, "==", row->exp_tag)
    878878        ) {
    879             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     879            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    880880            psFree(detInputExp);
    881             psFree(where_exp_ids);
     881            psFree(where_exp_tags);
    882882            return NULL;
    883883        }
     
    885885    psFree(detInputExp);
    886886
    887     // select rawImfiles with matching exp_ids
     887    // select rawImfiles with matching exp_tags
    888888    psArray *rawImfiles =
    889         rawImfileSelectRowObjects(config->dbh, where_exp_ids, 0);
    890     psFree(where_exp_ids);
     889        rawImfileSelectRowObjects(config->dbh, where_exp_tags, 0);
     890    psFree(where_exp_tags);
    891891    if (!rawImfiles) {
    892892        psError(PS_ERR_UNKNOWN, false, "no rawImfile rows found");
     
    901901    PS_ASSERT_PTR_NON_NULL(config, false);
    902902
    903     // det_id, exp_id, class_id, uri, recipe, -bg, -bg_stdev, & -bg_mean_stdev
     903    // det_id, exp_tag, class_id, uri, recipe, -bg, -bg_stdev, & -bg_mean_stdev
    904904    // are required
    905905    bool status = false;
     
    913913        return false;
    914914    }
    915     psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
    916     if (!status) {
    917         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
    918         return false;
    919     }
    920     if (!exp_id) {
    921         psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
     915    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
     916    if (!status) {
     917        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
     918        return false;
     919    }
     920    if (!exp_tag) {
     921        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
    922922        return false;
    923923    }
     
    988988    }
    989989
    990     // find the matching rawImfile by exp_id/class_id
     990    // find the matching rawImfile by exp_tag/class_id
    991991    psMetadata *where = psMetadataAlloc();
    992     if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
    993         psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     992    if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
     993        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    994994        psFree(where);
    995995        return false;
     
    10111011    detProcessedImfileRow *detRow = detProcessedImfileRowAlloc(
    10121012        (psS32)atol(det_id),
    1013         exp_id,
     1013        exp_tag,
    10141014        class_id,
    10151015        uri,
     
    10441044    // by:
    10451045    // find the current iteration bassed on det_id
    1046     // find all exp_ids in the current det_id/iteration from detInputExp
    1047     // find all rawImfiles in the current exp_ids
    1048     // compare to detProcessedImfiles by det_id/exp_id
     1046    // find all exp_tags in the current det_id/iteration from detInputExp
     1047    // find all rawImfiles in the current exp_tags
     1048    // compare to detProcessedImfiles by det_id/exp_tag
    10491049    // found how many imfile there are in each class_id
    10501050    // and:
     
    10651065        "    AND detRun.iteration = detInputExp.iteration"
    10661066        " JOIN rawDetrendExp"
    1067         "    ON detInputExp.exp_id = rawDetrendExp.exp_id"
     1067        "    ON detInputExp.exp_tag = rawDetrendExp.exp_tag"
    10681068        " JOIN detProcessedImfile"
    10691069        "    ON detInputExp.det_id = detProcessedImfile.det_id"
    1070         "    AND detInputExp.exp_id = detProcessedImfile.exp_id"
     1070        "    AND detInputExp.exp_tag = detProcessedImfile.exp_tag"
    10711071        " LEFT JOIN detStackedImfile"
    10721072        "    ON detInputExp.det_id = detStackedImfile.det_id"
     
    10741074        "    AND detProcessedImfile.class_id = detStackedImfile.class_id"
    10751075        " LEFT JOIN rawImfile"
    1076         "    ON detInputExp.exp_id = rawImfile.exp_id"
     1076        "    ON detInputExp.exp_tag = rawImfile.exp_tag"
    10771077        "    AND detProcessedImfile.class_id = rawImfile.class_id"
    10781078        " WHERE"
     
    11651165        // det_id is not in detStackedImfile
    11661166        // iteration is not in detStackedImfile
    1167         // detProcessedImfile.exp_id is not in detStackedImfile
     1167        // detProcessedImfile.exp_tag is not in detStackedImfile
    11681168        // detProcessedImfile.class_id is not in detStackedImfile
    11691169        // and detInputExp.include is 1
     
    11801180            "       ON detRun.position = detInputExp.det_id"
    11811181            "       AND detRun.iteration = detInputExp.iteration"
    1182             "       AND detProcessedImfile.exp_id = detInputExp.exp_id"
     1182            "       AND detProcessedImfile.exp_tag = detInputExp.exp_tag"
    11831183            "   LEFT JOIN detStackedImfile"
    11841184            "       ON detRun.position = detStackedImfile.det_id"
     
    12671267    // remove detStackedImfiles unless -unmask
    12681268    if (!psMetadataLookupBool(&status, config->args, "-unmask")) {
    1269         // detStackedImfiles doesn't have an exp_id so we have to generate the
     1269        // detStackedImfiles doesn't have an exp_tag so we have to generate the
    12701270        // where query ourselves
    12711271        bool status = false;
     
    12931293            if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==",
    12941294                    (psS32)atoi(det_id))) {
    1295                 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     1295                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    12961296                psFree(where);
    12971297                return false;
     
    15821582    if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==",
    15831583            (psS32)atoi(det_id))) {
    1584         psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     1584        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    15851585        psFree(where);
    15861586        return false;
     
    17941794    // by:
    17951795    // find the current iteration bassed on det_id
    1796     // find all exp_ids in the current det_id/iteration from detInputExp
     1796    // find all exp_tags in the current det_id/iteration from detInputExp
    17971797    // sort to detInputExp.imfiles to find the largest value per det_id/iter
    17981798    // compare imfiles to the number of detStackedImfiles by class_id
     
    18121812        "     AND detRun.iteration = detInputExp.iteration"
    18131813        " LEFT JOIN rawDetrendExp"
    1814         "     ON detInputExp.exp_id = rawDetrendExp.exp_id"
     1814        "     ON detInputExp.exp_tag = rawDetrendExp.exp_tag"
    18151815        " LEFT JOIN detStackedImfile"
    18161816        "     ON detInputExp.det_id = detStackedImfile.det_id"
     
    18191819        "   detStackedImfile.normalize = 1"
    18201820        " GROUP BY"
    1821         "     rawDetrendExp.exp_id"
     1821        "     rawDetrendExp.exp_tag"
    18221822        " HAVING MAX(rawDetrendExp.imfiles) = COUNT(detStackedImfile.class_id)"
    18231823        );
     
    21062106        psMetadata *where = psMetadataAlloc();
    21072107        for (long i = 0; i < psArrayLength(inputExps); i++) {
    2108             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id",
     2108            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag",
    21092109                    PS_META_DUPLICATE_OK, "==",
    2110                     ((detInputExpRow *)inputExps->data[i])->exp_id)) {
    2111                 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     2110                    ((detInputExpRow *)inputExps->data[i])->exp_tag)) {
     2111                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    21122112                psFree(inputExps);
    21132113                psFree(where);
     
    23122312        " JOIN detProcessedImfile"
    23132313        "   ON detRun.position = detProcessedImfile.det_id"
    2314         "   AND detInputExp.exp_id = detProcessedImfile.exp_id"
     2314        "   AND detInputExp.exp_tag = detProcessedImfile.exp_tag"
    23152315        " JOIN detNormalizedImfile"
    23162316        "   ON detRun.position = detNormalizedImfile.det_id"
     
    23202320        "   ON detRun.position = detResidImfile.det_id"
    23212321        "   AND detRun.iteration = detResidImfile.iteration"
    2322         "   AND detProcessedImfile.exp_id = detResidImfile.exp_id"
     2322        "   AND detProcessedImfile.exp_tag = detResidImfile.exp_tag"
    23232323        "   AND detProcessedImfile.class_id = detResidImfile.class_id"
    23242324        " WHERE"
    23252325        "   detResidImfile.det_id IS NULL"
    23262326        "   AND detResidImfile.iteration IS NULL"
    2327         "   AND detResidImfile.exp_id IS NULL"
     2327        "   AND detResidImfile.exp_tag IS NULL"
    23282328        "   AND detResidImfile.class_id IS NULL"
    23292329        " UNION"
     
    23392339        " JOIN detProcessedImfile"
    23402340        "   ON detRun.position = detProcessedImfile.det_id"
    2341         "   AND detInputExp.exp_id = detProcessedImfile.exp_id"
     2341        "   AND detInputExp.exp_tag = detProcessedImfile.exp_tag"
    23422342        " JOIN detStackedImfile"
    23432343        "   ON detRun.position = detStackedImfile.det_id"
     
    23472347        "   ON detRun.position = detResidImfile.det_id"
    23482348        "   AND detRun.iteration = detResidImfile.iteration"
    2349         "   AND detProcessedImfile.exp_id = detResidImfile.exp_id"
     2349        "   AND detProcessedImfile.exp_tag = detResidImfile.exp_tag"
    23502350        "   AND detStackedImfile.class_id = detResidImfile.class_id"
    23512351        " WHERE"
    23522352        "   detResidImfile.det_id IS NULL"
    23532353        "   AND detResidImfile.iteration IS NULL"
    2354         "   AND detResidImfile.exp_id IS NULL"
     2354        "   AND detResidImfile.exp_tag IS NULL"
    23552355        "   AND detResidImfile.class_id IS NULL"
    23562356        "   AND detStackedImfile.normalize = 0"
     
    25712571
    25722572    // make sure that there is a coresponding entry in detNormalizedImfile
    2573     // and the exp_id specified is valid
     2573    // and the exp_tag specified is valid
    25742574    // select * from detNormalizedImfile
    25752575    // by det_id, iteration, class_id
     
    25882588        "   ON detNormalizedImfile.det_id = detResidImfile.det_id"
    25892589        "   AND detNormalizedImfile.iteration= detResidImfile.iteration"
    2590         "   AND detInputExp.exp_id = detResidImfile.exp_id"
     2590        "   AND detInputExp.exp_tag = detResidImfile.exp_tag"
    25912591        "   AND detNormalizedImfile.class_id = detResidImfile.class_id"
    25922592        " WHERE"
    25932593        "  detResidImfile.det_id IS NULL"
    25942594        "  AND detResidImfile.iteration IS NULL"
    2595         "  AND detResidImfile.exp_id IS NULL"
     2595        "  AND detResidImfile.exp_tag IS NULL"
    25962596        "  AND detResidImfile.class_id IS NULL"
    2597         "  AND detInputExp.exp_id = '%s'"
     2597        "  AND detInputExp.exp_tag = '%s'"
    25982598        " UNION"
    25992599        " SELECT"
     
    26082608        "   ON detStackedImfile.det_id = detResidImfile.det_id"
    26092609        "   AND detStackedImfile.iteration= detResidImfile.iteration"
    2610         "   AND detInputExp.exp_id = detResidImfile.exp_id"
     2610        "   AND detInputExp.exp_tag = detResidImfile.exp_tag"
    26112611        "   AND detStackedImfile.class_id = detResidImfile.class_id"
    26122612        " WHERE"
    26132613        "   detResidImfile.det_id IS NULL"
    26142614        "   AND detResidImfile.iteration IS NULL"
    2615         "   AND detResidImfile.exp_id IS NULL"
     2615        "   AND detResidImfile.exp_tag IS NULL"
    26162616        "   AND detResidImfile.class_id IS NULL"
    2617         "   AND detInputExp.exp_id = '%s'"
     2617        "   AND detInputExp.exp_tag = '%s'"
    26182618        "   AND detStackedImfile.normalize = 0"
    26192619        " ) as detNormStackedImfile"
     
    26782678    }
    26792679
    2680     // exp_id is manadatory to cross check that this is a exp_id for this
     2680    // exp_tag is manadatory to cross check that this is a exp_tag for this
    26812681    // detRUn
    26822682    bool status = false;
    2683     psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
    2684     if (!status) {
    2685         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     2683    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
     2684    if (!status) {
     2685        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    26862686        psFree(query);
    26872687        return false;
    26882688    }
    2689     if (!exp_id) {
    2690         psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
     2689    if (!exp_tag) {
     2690        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
    26912691        psFree(query);
    26922692        return false;
    26932693    }
    26942694
    2695     if (!p_psDBRunQuery(config->dbh, query, exp_id, exp_id)) {
     2695    if (!p_psDBRunQuery(config->dbh, query, exp_tag, exp_tag)) {
    26962696        psError(PS_ERR_UNKNOWN, false, "database error");
    26972697        psFree(query);
     
    27572757
    27582758    bool status = false;
    2759     psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
    2760     if (!status) {
    2761         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
    2762         return false;
    2763     }
    2764     if (!exp_id) {
    2765         psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
     2759    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
     2760    if (!status) {
     2761        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
     2762        return false;
     2763    }
     2764    if (!exp_tag) {
     2765        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
    27662766        return false;
    27672767    }
     
    28272827            normalizedImfile->det_id,
    28282828            normalizedImfile->iteration,
    2829             exp_id,
     2829            exp_tag,
    28302830            normalizedImfile->class_id,
    28312831            uri,
     
    28452845    // select detResidImfile.*
    28462846    // by:
    2847     // where det_id, iteration, exp_id is not in detResidExp;
     2847    // where det_id, iteration, exp_tag is not in detResidExp;
    28482848
    28492849    psString query = psStringCopy(
     
    28522852        " FROM detResidImfile"
    28532853        " LEFT JOIN detResidExp"
    2854         "   USING(det_id, iteration, exp_id)"
     2854        "   USING(det_id, iteration, exp_tag)"
    28552855        " WHERE"
    28562856        "   detResidExp.det_id IS NULL"
    28572857        "   AND detResidExp.iteration IS NULL"
    2858         "   AnD detResidExp.exp_id IS NULL"
     2858        "   AnD detResidExp.exp_tag IS NULL"
    28592859        );
    28602860
     
    29172917    // select detRun.iteration
    29182918    // select detRun.det_type
    2919     // select detInputExp.exp_id
     2919    // select detInputExp.exp_tag
    29202920    // select detInputExp.include
    29212921    // by:
    29222922    // find the current iteration bassed on det_id
    2923     // find all exp_ids in the current det_id/iteration from detInputExp
     2923    // find all exp_tags in the current det_id/iteration from detInputExp
    29242924    // compare to detInputExp.imfiles to derResidImfile by class_id
    29252925    // and:
    2926     // detResidImfile.{det_id, iteration, exp_id} is not in detResidExp
     2926    // detResidImfile.{det_id, iteration, exp_tag} is not in detResidExp
    29272927
    29282928    psString query = psStringCopy(
     
    29312931        "   iteration,"
    29322932        "   det_type,"
    2933         "   exp_id,"
     2933        "   exp_tag,"
    29342934        "   include"
    29352935        " FROM"
     
    29382938        "       detRun.iteration,"
    29392939        "       detRun.det_type,"
    2940         "       detInputExp.exp_id,"
     2940        "       detInputExp.exp_tag,"
    29412941        "       detInputExp.include,"
    29422942        "       rawDetrendExp.imfiles"
     
    29462946        "       AND detRun.iteration = detInputExp.iteration"
    29472947        "   LEFT JOIN rawDetrendExp"
    2948         "       ON detInputExp.exp_id = rawDetrendExp.exp_id"
     2948        "       ON detInputExp.exp_tag = rawDetrendExp.exp_tag"
    29492949        "   LEFT JOIN detResidImfile"
    29502950        "       ON detRun.position = detResidImfile.det_id"
    29512951        "       AND detRun.iteration = detResidImfile.iteration"
    2952         "       AND detInputExp.exp_id = detResidImfile.exp_id"
     2952        "       AND detInputExp.exp_tag = detResidImfile.exp_tag"
    29532953        "   LEFT JOIN detResidExp"
    29542954        "       ON detRun.position = detResidExp.det_id"
    29552955        "       AND detRun.iteration = detResidExp.iteration"
    2956         "       AND detInputExp.exp_id = detResidExp.exp_id"
     2956        "       AND detInputExp.exp_tag = detResidExp.exp_tag"
    29572957        "   WHERE"
    29582958        "       detResidExp.det_id IS NULL"
    29592959        "       AND detResidExp.iteration IS NULL"
    2960         "       AND detResidExp.exp_id IS NULL"
     2960        "       AND detResidExp.exp_tag IS NULL"
    29612961        "   GROUP BY"
    2962         "       detInputExp.exp_id"
     2962        "       detInputExp.exp_tag"
    29632963        "   HAVING"
    29642964        "       rawDetrendExp.imfiles = COUNT(detResidImfile.class_id)"
     
    30263026    // select detRun.iteration
    30273027    // select detRun.det_type
    3028     // select detInputExp.exp_id
     3028    // select detInputExp.exp_tag
    30293029    // select detInputExp.include
    30303030    // by:
    30313031    // find the current iteration bassed on det_id
    3032     // find all exp_ids in the current det_id/iteration from detInputExp
     3032    // find all exp_tags in the current det_id/iteration from detInputExp
    30333033    // compare to detInputExp.imfiles to derResidImfile by class_id
    30343034    // and:
    3035     // detResidImfile.{det_id, iteration, exp_id} is not in detResidExp
     3035    // detResidImfile.{det_id, iteration, exp_tag} is not in detResidExp
    30363036
    30373037    psString query = psStringCopy(
     
    30393039        "   det_id,"
    30403040        "   iteration,"
    3041         "   exp_id,"
     3041        "   exp_tag,"
    30423042        "   include"
    30433043        " FROM"
     
    30463046        "       detRun.iteration,"
    30473047        "       detRun.det_type,"
    3048         "       detInputExp.exp_id,"
     3048        "       detInputExp.exp_tag,"
    30493049        "       detInputExp.include,"
    30503050        "       rawDetrendExp.imfiles"
     
    30543054        "       AND detRun.iteration = detInputExp.iteration"
    30553055        "   LEFT JOIN rawDetrendExp"
    3056         "       ON detInputExp.exp_id = rawDetrendExp.exp_id"
     3056        "       ON detInputExp.exp_tag = rawDetrendExp.exp_tag"
    30573057        "   LEFT JOIN detResidImfile"
    30583058        "       ON detRun.position = detResidImfile.det_id"
    30593059        "       AND detRun.iteration = detResidImfile.iteration"
    3060         "       AND detInputExp.exp_id = detResidImfile.exp_id"
     3060        "       AND detInputExp.exp_tag = detResidImfile.exp_tag"
    30613061        "   LEFT JOIN detResidExp"
    30623062        "       ON detRun.position = detResidExp.det_id"
    30633063        "       AND detRun.iteration = detResidExp.iteration"
    3064         "       AND detInputExp.exp_id = detResidExp.exp_id"
     3064        "       AND detInputExp.exp_tag = detResidExp.exp_tag"
    30653065        "   WHERE"
    30663066        "       detResidExp.det_id IS NULL"
    30673067        "       AND detResidExp.iteration IS NULL"
    3068         "       AND detResidExp.exp_id IS NULL"
     3068        "       AND detResidExp.exp_tag IS NULL"
    30693069        "   GROUP BY"
    3070         "       detInputExp.exp_id"
     3070        "       detInputExp.exp_tag"
    30713071        "   HAVING"
    30723072        "       rawDetrendExp.imfiles = COUNT(detResidImfile.class_id)"
     
    30753075
    30763076    {
    3077         // build a query to search by det_id, iteration, exp_id
     3077        // build a query to search by det_id, iteration, exp_tag
    30783078        psMetadata *where = psMetadataAlloc();
    30793079        bool status = false;
     
    31073107            return false;
    31083108        }
    3109         psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
    3110         if (!status) {
    3111             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     3109        psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
     3110        if (!status) {
     3111            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    31123112            psFree(where);
    31133113            psFree(query);
    31143114            return false;
    31153115        }
    3116         if (exp_id) {
    3117             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
    3118                 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     3116        if (exp_tag) {
     3117            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
     3118                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    31193119                psFree(where);
    31203120                psFree(query);
     
    32083208        return false;
    32093209    }
    3210     psString exp_id = psMetadataLookupStr(&status, row, "exp_id");
    3211     if (!status) {
    3212         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_id");
    3213         return false;
    3214     }
    3215     if (!exp_id) {
    3216         psError(PS_ERR_UNKNOWN, true, "exp_id is required");
     3210    psString exp_tag = psMetadataLookupStr(&status, row, "exp_tag");
     3211    if (!status) {
     3212        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_tag");
     3213        return false;
     3214    }
     3215    if (!exp_tag) {
     3216        psError(PS_ERR_UNKNOWN, true, "exp_tag is required");
    32173217        return false;
    32183218    }
     
    32833283            det_id,
    32843284            iteration,
    3285             exp_id,
     3285            exp_tag,
    32863286            recipe,
    32873287            bg,
     
    33433343    // by:
    33443344    // find the current iteration bassed on det_id
    3345     // find all exp_ids in the current det_id/iteration from detInputExp
    3346     // find all exp_ids in the current det_id/iteration from detResidExp
    3347     // compare the counts of exp_ids
     3345    // find all exp_tags in the current det_id/iteration from detInputExp
     3346    // find all exp_tags in the current det_id/iteration from detResidExp
     3347    // compare the counts of exp_tags
    33483348
    33493349    psString query = psStringCopy(
     
    33573357        "       detRun.iteration,"
    33583358        "       detRun.det_type,"
    3359         "       detInputExp.exp_id"
     3359        "       detInputExp.exp_tag"
    33603360        "   FROM detRun"
    33613361        "       LEFT JOIN detInputExp"
     
    33633363        "       AND detRun.iteration = detInputExp.iteration"
    33643364        "   LEFT JOIN rawDetrendExp"
    3365         "       ON detInputExp.exp_id = rawDetrendExp.exp_id"
     3365        "       ON detInputExp.exp_tag = rawDetrendExp.exp_tag"
    33663366        "   LEFT JOIN detResidExp"
    33673367        "       ON detRun.position = detResidExp.det_id"
    33683368        "       AND detRun.iteration = detResidExp.iteration"
    3369         "       AND detInputExp.exp_id = detResidExp.exp_id"
     3369        "       AND detInputExp.exp_tag = detResidExp.exp_tag"
    33703370        "   GROUP BY"
    33713371        "       detRun.position,"
    33723372        "       detRun.iteration"
    33733373        "   HAVING"
    3374         "       COUNT(detResidExp.exp_id) = COUNT(detInputExp.exp_id)"
     3374        "       COUNT(detResidExp.exp_tag) = COUNT(detInputExp.exp_tag)"
    33753375        " ) AS residdetrun"
    33763376        );
     
    34253425    PS_ASSERT_PTR_NON_NULL(config, false);
    34263426
    3427     // build a query to search by det_id, iteration, exp_id
     3427    // build a query to search by det_id, iteration, exp_tag
    34283428    psMetadata *where = psMetadataAlloc();
    34293429    bool status = false;
     
    34533453        return false;
    34543454    }
    3455     psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
    3456     if (!status) {
    3457         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     3455    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
     3456    if (!status) {
     3457        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    34583458        psFree(where);
    34593459        return false;
    34603460    }
    3461     if (exp_id) {
    3462         if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
    3463             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     3461    if (exp_tag) {
     3462        if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
     3463            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    34643464            psFree(where);
    34653465            return false;
     
    34683468
    34693469    // find the values we're going to set
    3470     // copy everything but det_id, iteration, & exp_id from the args and
     3470    // copy everything but det_id, iteration, & exp_tag from the args and
    34713471    // remove the '-' prefix
    34723472    psMetadata *set = psMetadataAlloc();
     
    36013601    // by:
    36023602    // find the current iteration bassed on det_id
    3603     // find all exp_ids in the current det_id/iteration from detInputExp
    3604     // find all exp_ids in the current det_id/iteration from detResidExp
    3605     // compare the counts of exp_ids
     3603    // find all exp_tags in the current det_id/iteration from detInputExp
     3604    // find all exp_tags in the current det_id/iteration from detResidExp
     3605    // compare the counts of exp_tags
    36063606
    36073607    psString query = psStringCopy(
     
    36133613        "       detRun.position AS det_id,"
    36143614        "       detRun.iteration,"
    3615         "       detInputExp.exp_id"
     3615        "       detInputExp.exp_tag"
    36163616        "   FROM detRun"
    36173617        "       LEFT JOIN detInputExp"
     
    36193619        "       AND detRun.iteration = detInputExp.iteration"
    36203620        "   LEFT JOIN rawDetrendExp"
    3621         "       ON detInputExp.exp_id = rawDetrendExp.exp_id"
     3621        "       ON detInputExp.exp_tag = rawDetrendExp.exp_tag"
    36223622        "   LEFT JOIN detResidExp"
    36233623        "       ON detRun.position = detResidExp.det_id"
    36243624        "       AND detRun.iteration = detResidExp.iteration"
    3625         "       AND detInputExp.exp_id = detResidExp.exp_id"
     3625        "       AND detInputExp.exp_tag = detResidExp.exp_tag"
    36263626        "   GROUP BY"
    36273627        "       detRun.position,"
    36283628        "       detRun.iteration"
    36293629        "   HAVING"
    3630         "       COUNT(detResidExp.exp_id) = COUNT(detInputExp.exp_id)"
     3630        "       COUNT(detResidExp.exp_tag) = COUNT(detInputExp.exp_tag)"
    36313631        " ) AS residdetrun"
    36323632        );
    36333633
    36343634    {
    3635         // build a query to search by det_id, iteration, exp_id
     3635        // build a query to search by det_id, iteration, exp_tag
    36363636        psMetadata *where = psMetadataAlloc();
    36373637        bool status = false;
     
    38393839    // select detRun.position
    38403840    // select detRun.iteration
    3841     // select detInputExp.exp_id
     3841    // select detInputExp.exp_tag
    38423842    // select detResidExp.accept
    38433843    // by:
    38443844    // find the current iteration bassed on det_id
    3845     // find all exp_ids in the current det_id/iteration from detInputExp
    3846     // find all exp_ids in the current det_id/iteration from detResidExp
    3847     // compare the counts of exp_ids
     3845    // find all exp_tags in the current det_id/iteration from detInputExp
     3846    // find all exp_tags in the current det_id/iteration from detResidExp
     3847    // compare the counts of exp_tags
    38483848
    38493849    psString query = psStringCopy(
     
    38513851        "   detRun.position AS det_id,"
    38523852        "   detRun.iteration,"
    3853         "   detInputExp.exp_id,"
     3853        "   detInputExp.exp_tag,"
    38543854        "   detResidExp.accept"
    38553855        " FROM detRun"
     
    38603860        "   ON detRun.position = detResidExp.det_id"
    38613861        "   AND detRun.iteration = detResidExp.iteration"
    3862         "   AND detInputExp.exp_id = detResidExp.exp_id"
     3862        "   AND detInputExp.exp_tag = detResidExp.exp_tag"
    38633863        " WHERE"
    3864         "   detInputExp.exp_id IS NOT NULL"
     3864        "   detInputExp.exp_tag IS NOT NULL"
    38653865        "   AND detResidExp.accept IS NOT NULL"
    38663866        " GROUP BY"
    38673867        "   detRun.position,"
    38683868        "   detRun.iteration,"
    3869         "   detInputExp.exp_id"
     3869        "   detInputExp.exp_tag"
    38703870        " HAVING"
    3871         "   COUNT(detResidExp.exp_id) = COUNT(detInputExp.exp_id)"
     3871        "   COUNT(detResidExp.exp_tag) = COUNT(detInputExp.exp_tag)"
    38723872        );
    38733873
     
    39103910    for (long i = 0; i < psArrayLength(output); i++) {
    39113911        psMetadata *row = output->data[i];
    3912         psString exp_id = psMetadataLookupStr(&status, row, "exp_id");
     3912        psString exp_tag = psMetadataLookupStr(&status, row, "exp_tag");
    39133913        if (!status) {
    39143914            // rollback
     
    39163916                psError(PS_ERR_UNKNOWN, false, "database error");
    39173917            }
    3918             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_id");
     3918            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_tag");
    39193919            psFree(output);
    39203920            return false;
     
    39363936                    (psS32)atol(det_id),
    39373937                    newIteration,
    3938                     exp_id,
     3938                    exp_tag,
    39393939                    accept
    39403940                )
     
    40984098    }
    40994099
    4100     // we have to support multipe exp_ids
    4101     psMetadataItem *item = psMetadataLookup(config->args, "-exp_id");
     4100    // we have to support multipe exp_tags
     4101    psMetadataItem *item = psMetadataLookup(config->args, "-exp_tag");
    41024102    if (!item) {
    41034103        // this shouldn't actually happen when using psArgs
    4104         psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
    4105         return false;
    4106     }
    4107 
    4108     psList *exp_id_list = item->data.list;
     4104        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
     4105        return false;
     4106    }
     4107
     4108    psList *exp_tag_list = item->data.list;
    41094109    psMetadata *where = psMetadataAlloc();
    4110     // make sure that -exp_id was parsed correctly
     4110    // make sure that -exp_tag was parsed correctly
    41114111    // XXX this can be removed someday
    41124112    if (item->type == PS_DATA_METADATA_MULTI) {
     
    41144114        psMetadataItem *mItem = NULL;
    41154115        while ((mItem = psListGetAndIncrement(iter))) {
    4116             psString exp_id = mItem->data.V;
    4117             // if exp_id is NULL then it means that -exp_id has not been
     4116            psString exp_tag = mItem->data.V;
     4117            // if exp_tag is NULL then it means that -exp_tag has not been
    41184118            // specified
    4119             if (!exp_id) {
     4119            if (!exp_tag) {
    41204120                psError(PS_ERR_UNKNOWN, true,
    4121                         "at least one -exp_id is required");
     4121                        "at least one -exp_tag is required");
    41224122                psFree(where);
    41234123                return false;
    41244124            }
    41254125
    4126             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id",
    4127                         PS_META_DUPLICATE_OK, "==", exp_id)) {
    4128                 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     4126            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag",
     4127                        PS_META_DUPLICATE_OK, "==", exp_tag)) {
     4128                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    41294129                psFree(iter);
    41304130                psFree(where);
     
    41354135    } else {
    41364136        psAbort(config->argv[0],
    4137                 "-exp_id was not parsed correctly (this should not happen");
    4138     }
    4139 
    4140     // check that the specified exp_ids actually exist in the iteration zero
     4137                "-exp_tag was not parsed correctly (this should not happen");
     4138    }
     4139
     4140    // check that the specified exp_tags actually exist in the iteration zero
    41414141    // detInputExp set
    41424142
     
    41624162    }
    41634163
    4164     // build a hash for the valid exp_ids
    4165     psHash *valid_exp_ids = psHashAlloc(psArrayLength(detrendExps));
     4164    // build a hash for the valid exp_tags
     4165    psHash *valid_exp_tags = psHashAlloc(psArrayLength(detrendExps));
    41664166    for (long i = 0; i < psArrayLength(detrendExps); i++) {
    4167         psHashAdd(valid_exp_ids,
    4168             ((detInputExpRow *)detrendExps->data[i])->exp_id,
     4167        psHashAdd(valid_exp_tags,
     4168            ((detInputExpRow *)detrendExps->data[i])->exp_tag,
    41694169            detrendExps->data[i]
    41704170        );
     
    41764176    if (!psDBTransaction(config->dbh)) {
    41774177        psError(PS_ERR_UNKNOWN, false, "database error");
    4178         psFree(valid_exp_ids);
     4178        psFree(valid_exp_tags);
    41794179        return false;
    41804180    }
     
    41874187            psError(PS_ERR_UNKNOWN, false, "database error");
    41884188        }
    4189         psFree(valid_exp_ids);
    4190         return false;
    4191     }
    4192 
    4193     // check exp_ids and build up an array of new detInputExp rows at the same
     4189        psFree(valid_exp_tags);
     4190        return false;
     4191    }
     4192
     4193    // check exp_tags and build up an array of new detInputExp rows at the same
    41944194    // time
    4195     psListIterator *iter = psListIteratorAlloc(exp_id_list, 0, false);
     4195    psListIterator *iter = psListIteratorAlloc(exp_tag_list, 0, false);
    41964196    psMetadataItem *mItem = NULL;
    4197     psArray *newInputExps = psArrayAlloc(psListLength(exp_id_list));
     4197    psArray *newInputExps = psArrayAlloc(psListLength(exp_tag_list));
    41984198    while ((mItem = psListGetAndIncrement(iter))) {
    4199         detInputExpRow *inputExp = psHashLookup(valid_exp_ids,
     4199        detInputExpRow *inputExp = psHashLookup(valid_exp_tags,
    42004200                (char *)mItem->data.V);
    42014201        if (!inputExp) {
     
    42044204                psError(PS_ERR_UNKNOWN, false, "database error");
    42054205            }
    4206             // invalid exp_id
    4207             psError(PS_ERR_UNKNOWN, false, "exp_id %s is invalid for det_id %s",
     4206            // invalid exp_tag
     4207            psError(PS_ERR_UNKNOWN, false, "exp_tag %s is invalid for det_id %s",
    42084208                    (char *)mItem->data.V, det_id);
    42094209            psFree(iter);
    4210             psFree(valid_exp_ids);
     4210            psFree(valid_exp_tags);
    42114211            return false;
    42124212        }
     
    42144214            (psS32)atol(det_id),
    42154215            newIteration,
    4216             inputExp->exp_id,
     4216            inputExp->exp_tag,
    42174217            true   // use
    42184218        );
     
    42214221    }
    42224222    psFree(iter);
    4223     psFree(valid_exp_ids);
     4223    psFree(valid_exp_tags);
    42244224
    42254225    for (long i = 0; i < psArrayLength(newInputExps); i++) {
  • trunk/ippTools/src/dettoolConfig.c

    r9046 r9057  
    2323    // -pending
    2424    psMetadata *pendingArgs = psMetadataAlloc();
    25     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_id",  0,
     25    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_tag",  0,
    2626            "search by exposure ID", NULL);
    2727    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_type",  0,
     
    4040    // -definebyexp
    4141    psMetadata *definebyexpArgs = psMetadataAlloc();
    42     psMetadataAddStr(definebyexpArgs, PS_LIST_TAIL, "-exp_id",
     42    psMetadataAddStr(definebyexpArgs, PS_LIST_TAIL, "-exp_tag",
    4343            PS_META_DUPLICATE_OK,
    4444            "include this exposure (multiple OK, required)", NULL);
     
    100100    psMetadataAddS32(inputArgs, PS_LIST_TAIL, "-iteration",  0,
    101101        "define iteration number", 0);
    102     psMetadataAddStr(inputArgs, PS_LIST_TAIL, "-exp_id",  0,
     102    psMetadataAddStr(inputArgs, PS_LIST_TAIL, "-exp_tag",  0,
    103103        "search for exp ID", NULL);
    104104    psMetadataAddBool(inputArgs, PS_LIST_TAIL, "-simple",  0,
     
    109109    psMetadataAddStr(rawArgs, PS_LIST_TAIL, "-det_id",  0,
    110110        "search for detrend ID", NULL);
    111     psMetadataAddStr(rawArgs, PS_LIST_TAIL, "-exp_id",  0,
     111    psMetadataAddStr(rawArgs, PS_LIST_TAIL, "-exp_tag",  0,
    112112        "search for exp ID", NULL);
    113113    psMetadataAddStr(rawArgs, PS_LIST_TAIL, "-class_id",  0,
     
    120120    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-det_id",  0,
    121121        "define detrend ID (required)", NULL);
    122     psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
     122    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
    123123        "define exp ID (required)", NULL);
    124124    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-class_id",  0,
     
    150150    psMetadataAddS32(procArgs, PS_LIST_TAIL, "-iteration",  0,
    151151        "searchfor iteration number", 0);
    152     psMetadataAddStr(procArgs, PS_LIST_TAIL, "-exp_id",  0,
     152    psMetadataAddStr(procArgs, PS_LIST_TAIL, "-exp_tag",  0,
    153153        "search for exp ID", NULL);
    154154    psMetadataAddStr(procArgs, PS_LIST_TAIL, "-class_id",  0,
     
    290290    psMetadataAddS32(addresidimfileArgs, PS_LIST_TAIL, "-iteration",  0,
    291291        "define iteration number", 0);
    292     psMetadataAddStr(addresidimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
     292    psMetadataAddStr(addresidimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
    293293        "define detrend ID (required)", NULL);
    294294    psMetadataAddStr(addresidimfileArgs, PS_LIST_TAIL, "-class_id",  0,
     
    315315    psMetadataAddS32(residimfileArgs, PS_LIST_TAIL, "-iteration",  0,
    316316        "search for iteration number", 0);
    317     psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
     317    psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
    318318        "define detrend ID (required)", NULL);
    319319    psMetadataAddStr(residimfileArgs, PS_LIST_TAIL, "-class_id",  0,
     
    330330    psMetadataAddS32(addresidexpArgs, PS_LIST_TAIL, "-iteration",  0,
    331331        "define iteration number", 0);
    332     psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-exp_id",  0,
     332    psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
    333333        "define detrend ID (required)", NULL);
    334334    psMetadataAddStr(addresidexpArgs, PS_LIST_TAIL, "-recip",  0,
     
    353353    psMetadataAddS32(residexpArgs, PS_LIST_TAIL, "-iteration",  0,
    354354        "search for iteration number", 0);
    355     psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-exp_id",  0,
     355    psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
    356356        "search for exp ID", NULL);
    357357    psMetadataAddStr(residexpArgs, PS_LIST_TAIL, "-recip",  0,
     
    373373    psMetadataAddS32(updateresidexpArgs, PS_LIST_TAIL, "-iteration",  0,
    374374        "define iteration number", 0);
    375     psMetadataAddStr(updateresidexpArgs, PS_LIST_TAIL, "-exp_id",  0,
     375    psMetadataAddStr(updateresidexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
    376376        "define exp ID", NULL);
    377377    psMetadataAddStr(updateresidexpArgs, PS_LIST_TAIL, "-recip",  0,
     
    448448    psMetadataAddStr(rerunArgs, PS_LIST_TAIL, "-det_id",  0,
    449449        "search for detrend master for detrend ID (required)", NULL);
    450     psMetadataAddStr(rerunArgs, PS_LIST_TAIL, "-exp_id",  PS_META_DUPLICATE_OK,
     450    psMetadataAddStr(rerunArgs, PS_LIST_TAIL, "-exp_tag",  PS_META_DUPLICATE_OK,
    451451        "include this exposure (multiple OK, required)", NULL);
    452452
     
    567567    }
    568568    addWhereStr(det_type);
    569     addWhereStr(exp_id);
     569    addWhereStr(exp_tag);
    570570    addWhereStr(class_id);
    571571    // convert '-inst' to 'camera'
  • trunk/ippTools/src/guidetool.c

    r8537 r9057  
    166166
    167167    return p1PendingExpRowAlloc(
    168         exp->exp_id,
     168        exp->exp_tag,
    169169        exp->camera,
    170170        exp->telescope,
  • trunk/ippTools/src/guidetoolConfig.c

    r8537 r9057  
    3131    // -pending search
    3232    psMetadata *pendingArgs = psMetadataAlloc();
    33     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_id",  0,
     33    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_tag",  0,
    3434        "define exposure ID", NULL);
    3535    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-inst",  0,
     
    5050    // -define inputs
    5151    psMetadata *defineArgs = psMetadataAlloc();
    52     psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-exp_id",  0,
     52    psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-exp_tag",  0,
    5353        "define class", NULL);
    5454    psMetadataAddStr(defineArgs, PS_LIST_TAIL, "-inst",  0,
     
    142142    bool status = false;
    143143
    144     addWhereStr(exp_id);
     144    addWhereStr(exp_tag);
    145145    // convert '-inst' to 'camera'
    146146    if ((str = psMetadataLookupStr(&status, config->args, "-inst"))) {
  • trunk/ippTools/src/p2insertPendingFrames.c

    r8279 r9057  
    2121        psMetadata *where = psMetadataAlloc();
    2222
    23         psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", PS_META_REPLACE, "==",
    24             rawFrame->exposure->exp_id);
     23        psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", PS_META_REPLACE, "==",
     24            rawFrame->exposure->exp_tag);
    2525        psArray *exposures = p2PendingExpSelectRowObjects(config->dbh,
    2626            where, MAX_ROWS);
     
    4040
    4141        p2PendingExpRow *pendingExposure = p2PendingExpRowAlloc(
    42             rawFrame->exposure->exp_id,
     42            rawFrame->exposure->exp_tag,
    4343            "my recipe",
    4444            0xff,
     
    5151            rawImfileRow *rawImage = rawFrame->images->data[j];
    5252            p2PendingImfileRow *pendingImage = p2PendingImfileRowAlloc(
    53                 rawImage->exp_id,
     53                rawImage->exp_tag,
    5454                rawImage->class_id,
    5555                rawImage->uri,
  • trunk/ippTools/src/p2pendingToDone.c

    r8279 r9057  
    1717
    1818        p2DoneExpRow *doneExposure = p2DoneExpRowAlloc(
    19             pendingFrame->exposure->exp_id,
     19            pendingFrame->exposure->exp_tag,
    2020            "my recipe",
    2121            pendingFrame->exposure->p1_version,
     
    3434
    3535            p2DoneImfileRow *doneImage = p2DoneImfileRowAlloc(
    36                 pendingImage->exp_id,
     36                pendingImage->exp_tag,
    3737                pendingImage->class_id,
    3838                pendingImage->uri,
     
    5959
    6060    p2DoneExpRow *doneExp = p2DoneExpRowAlloc(
    61         pendingExp->exp_id,
     61        pendingExp->exp_tag,
    6262        "my recipe",
    6363        pendingExp->p1_version,
  • trunk/ippTools/src/p2rawToPending.c

    r8121 r9057  
    1616
    1717        p2PendingExpRow *pendingExposure = p2PendingExpRowAlloc(
    18             rawFrame->exposure->exp_id,
     18            rawFrame->exposure->exp_tag,
    1919            rawFrame->exposure->camera,
    2020            rawFrame->exposure->telescope,
     
    3636            rawImfileRow *rawImage = rawFrame->images->data[j];
    3737            p2PendingImfileRow *pendingImage = p2PendingImfileRowAlloc(
    38                 rawImage->exp_id,
     38                rawImage->exp_tag,
    3939                rawImage->class_id,
    4040                rawImage->uri,
  • trunk/ippTools/src/p2searchDoneFrames.c

    r8121 r9057  
    2525        // 'where' to select each exposure
    2626        psMetadata *where = psMetadataAlloc ();
    27         psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", PS_META_REPLACE, "==",
    28             exposure->exp_id);
     27        psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", PS_META_REPLACE, "==",
     28            exposure->exp_tag);
    2929
    3030        psArray *images = p2DoneImfileSelectRowObjects(config->dbh, where,
  • trunk/ippTools/src/p2searchPendingFrames.c

    r8121 r9057  
    2525        p2PendingExpRow *exposure = exposures->data[i];
    2626
    27         psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", PS_META_REPLACE, "==", exposure->exp_id);
     27        psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", PS_META_REPLACE, "==", exposure->exp_tag);
    2828        psMetadataAddS32(where, PS_LIST_TAIL, "p2_version", PS_META_REPLACE, "==", exposure->p2_version);
    2929
     
    6161    PS_ASSERT_PTR_NON_NULL(config, NULL);
    6262
    63     // exp_id is optional
     63    // exp_tag is optional
    6464    bool status = false;
    65     psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
     65    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    6666    if (!status) {
    67         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     67        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    6868        return false;
    6969    }
    7070
    71     // search only based on exp_id -- either they specified it or not
     71    // search only based on exp_tag -- either they specified it or not
    7272    psMetadata *where = NULL;
    73     if (exp_id) {
     73    if (exp_tag) {
    7474        where = psMetadataAlloc();
    75         if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
    76             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     75        if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
     76            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    7777            psFree(where);
    7878            return false;
  • trunk/ippTools/src/p2updatePending.c

    r8062 r9057  
    2222
    2323        // find the next available version numbers
    24         psMetadataAddStr (where, PS_LIST_TAIL, "EXP_ID",     PS_META_REPLACE, "==", exposure->exp_id);
     24        psMetadataAddStr (where, PS_LIST_TAIL, "EXP_ID",     PS_META_REPLACE, "==", exposure->exp_tag);
    2525        psMetadataAddS32 (where, PS_LIST_TAIL, "P2_VERSION", PS_META_REPLACE, "==", exposure->p2_version);
    2626        psArray *images = p2PendingImfileSelectRowObjects (config->dbh, where, MAX_ROWS);
  • trunk/ippTools/src/pxframes.c

    r8661 r9057  
    8080
    8181// XXX fix the exposure search so that it doesn't dump the entire table
    82 #define PX_FRAME_SEARCH(frametype, exptype, imfiletype) \
     82#define PX_FRAME_SEARCH(frametype, exptype, imfiletype, key) \
    8383psArray *frametype##Search(pxConfig *config) \
    8484{ \
     
    9898\
    9999        psMetadata *where = psMetadataAlloc(); \
    100         psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", PS_META_REPLACE, "==", \
    101             exposure->exp_id); \
     100        psMetadataAddStr(where, PS_LIST_TAIL, #key, PS_META_REPLACE, "==", \
     101            exposure->key); \
    102102 \
    103103        psArray *images = imfiletype##SelectRowObjects(config->dbh, where, \
     
    105105        psFree(where); \
    106106        if (!images) { \
    107             psError(PS_ERR_UNKNOWN, false, "no " #imfiletype " rows found for exp_id %s", exposure->exp_id); \
     107            psError(PS_ERR_UNKNOWN, false, "no " #imfiletype " rows found for key %s", exposure->key); \
    108108 \
    109109            continue; \
     
    126126}
    127127
    128 PX_FRAME_SEARCH(pzPendingFrame, pzPendingExp, pzPendingImfile);
    129 PX_FRAME_SEARCH(newFrame, newExp, newImfile);
    130 PX_FRAME_SEARCH(rawDetrendFrame, rawDetrendExp, rawImfile);
    131 PX_FRAME_SEARCH(rawScienceFrame, rawScienceExp, rawImfile);
    132 PX_FRAME_SEARCH(p2PendingFrame, p2PendingExp, p2PendingImfile);
     128PX_FRAME_SEARCH(pzPendingFrame, pzPendingExp, pzPendingImfile, exp_id);
     129//PX_FRAME_SEARCH(newFrame, newExp, newImfile);
     130PX_FRAME_SEARCH(rawDetrendFrame, rawDetrendExp, rawImfile, exp_tag);
     131PX_FRAME_SEARCH(rawScienceFrame, rawScienceExp, rawImfile, exp_tag);
     132PX_FRAME_SEARCH(p2PendingFrame, p2PendingExp, p2PendingImfile, exp_tag);
    133133
    134134
     
    172172        newImfileRow *newImfile = newImages->data[i];
    173173        rawImfileRow *rawImfile = rawImfileRowAlloc(
    174             newImfile->exp_id,
     174            newImfile->exp_tag,
    175175            newImfile->class,
    176176            newImfile->class_id,
  • trunk/ippTools/src/pxinject.c

    r9028 r9057  
    5252    bool status = false;
    5353
     54    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
     55    if (!status) {
     56        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
     57        return false;
     58    }
     59    if (!exp_tag) {
     60        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
     61        return false;
     62    }
    5463    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
    5564    if (!status) {
     
    98107    }
    99108
    100     if (!newExpInsert(config->dbh, exp_id, camera, telescope, exp_type, imfiles)) {
     109    if (!newExpInsert(config->dbh, exp_tag, exp_id, camera, telescope, exp_type, imfiles)) {
    101110        psError(PS_ERR_UNKNOWN, false, "database error");
    102111        return false;
     
    110119    bool status = false;
    111120
    112     psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
     121    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    113122    if (!status) {
    114         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     123        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    115124        return false;
    116125    }
    117     if (!exp_id) {
    118         psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
     126    if (!exp_tag) {
     127        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
    119128        return false;
    120129    }
     
    147156    }
    148157
    149     if (!newImfileInsert(config->dbh, exp_id, class, class_id, uri)) {
     158    if (!newImfileInsert(config->dbh, exp_tag, class, class_id, uri)) {
    150159        psError(PS_ERR_UNKNOWN, false, "database error");
    151160        return false;
  • trunk/ippTools/src/pxinjectConfig.c

    r8459 r9057  
    2323    // -newExp
    2424    psMetadata *newExpArgs = psMetadataAlloc();
     25    psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-exp_tag",  0,
     26        "define the exp_tag (required)", NULL);
    2527    psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-exp_id",  0,
    2628        "define the exp_id (required)", NULL);
     
    3638    // -newImfile
    3739    psMetadata *newImfileArgs = psMetadataAlloc();
    38     psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-exp_id",  0,
    39         "define the exp_id (required)", NULL);
     40    psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
     41        "define the exp_tag (required)", NULL);
    4042    psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-class",  0,
    4143        "define the class (required)", NULL);
     
    116118    }
    117119    addWhereStr(det_type);
    118     addWhereStr(exp_id);
     120    addWhereStr(exp_tag);
    119121    addWhereStr(class_id);
    120122    // convert '-inst' to 'camera'
  • trunk/ippTools/src/pzgetimfiles.c

    r8849 r9057  
    152152    PS_ASSERT_PTR_NON_NULL(str, NULL);
    153153
     154    bool status = false;
     155    psString camera     = psMetadataLookupStr(&status, config->args, "-inst");
     156    psString telescope  = psMetadataLookupStr(&status, config->args, "-telescope");
     157
    154158    psList *doc = psStringSplit(str, "\n", false);
    155159
     
    192196        pzPendingImfileRow *row = pzPendingImfileRowAlloc(
    193197            exp_id,
     198            camera,
     199            telescope,
    194200            (psS32)atol(bytes),
    195201            md5sum,
  • trunk/ippTools/src/pzgetimfilesConfig.c

    r8849 r9057  
    2424    psMetadata *args = psMetadataAlloc();
    2525    psMetadataAddStr(args , PS_LIST_TAIL, "-uri", 0,
    26         "DataStore FileSet URI", "");
     26            "DataStore FileSet URI", "");
    2727    psMetadataAddStr(args , PS_LIST_TAIL, "-filesetid", 0,
    28         "FileSet ID", "");
     28            "FileSet ID", "");
     29    psMetadataAddStr(args, PS_LIST_TAIL, "-inst",  0,
     30            "search by camera", NULL);
     31    psMetadataAddStr(args, PS_LIST_TAIL, "-telescope",  0,
     32            "search by telescope", NULL);
     33
    2934
    3035    bool status = false;
  • trunk/ippTools/src/pztool.c

    r8849 r9057  
    253253            if (!newExpInsert(
    254254                    config->dbh,
     255                    // XXX exp_tag needs to be generated
     256                    "FIXME exp_tag",
    255257                    pendingExp->exp_id,
    256258                    pendingExp->camera,
  • trunk/ippTools/src/pztoolConfig.c

    r8536 r9057  
    2323    // -seen
    2424    psMetadata *seenArgs = psMetadataAlloc();
    25     psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-exp_id",  0,
     25    psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-exp_tag",  0,
    2626        "define exposure ID", NULL);
    2727    psMetadataAddStr(seenArgs, PS_LIST_TAIL, "-inst",  0,
     
    3434    // -pending
    3535    psMetadata *pendingArgs = psMetadataAlloc();
    36     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_id",  0,
     36    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_tag",  0,
    3737        "define exposure ID", NULL);
    3838    psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-inst",  0,
     
    4545    // -copydone
    4646    psMetadata *copydoneArgs = psMetadataAlloc();
    47     psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-exp_id",  0,
     47    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-exp_tag",  0,
    4848        "define exposure ID", NULL);
    4949    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-class",  0,
     
    120120    config->where = psMetadataAlloc();
    121121
    122     addWhereStr(exp_id);
     122    addWhereStr(exp_tag);
    123123    addWhereStr(class);
    124124    addWhereStr(class_id);
  • trunk/ippTools/src/regtool.c

    r9028 r9057  
    7272        "SELECT newExp.*"
    7373        "   FROM newExp"
    74         " LEFT JOIN newImfile USING(exp_id)"
    75         " LEFT JOIN rawScienceExp USING(exp_id)"
    76         " LEFT JOIN rawDetrendExp USING(exp_id)"
     74        " LEFT JOIN newImfile USING(exp_tag)"
     75        " LEFT JOIN rawScienceExp USING(exp_tag)"
     76        " LEFT JOIN rawDetrendExp USING(exp_tag)"
    7777        " WHERE"
    78         "   newExp.exp_id IS NOT NULL"
    79         "   AND newImfile.exp_id IS NULL"
    80         "   AND rawScienceExp.exp_id IS NULL"
     78        "   newExp.exp_tag IS NOT NULL"
     79        "   AND newImfile.exp_tag IS NULL"
     80        "   AND rawScienceExp.exp_tag IS NULL"
    8181        "   AND newExp.imfiles ="
    82         "   (SELECT COUNT(exp_id) FROM rawImfile"
    83         "       WHERE rawImfile.exp_id = newExp.exp_id)"
     82        "   (SELECT COUNT(exp_tag) FROM rawImfile"
     83        "       WHERE rawImfile.exp_tag = newExp.exp_tag)"
    8484        ;
    8585
     
    123123
    124124    // select newImfiles that:
    125     // exp_id is in newExp
    126     // don't have their exp_id in rawScienceExp
    127     // don't have their exp_id in rawDetrendExp
    128     // XXX having the same exp_id in newExp and raw*Exp is probably an error
     125    // exp_tag is in newExp
     126    // don't have their exp_tag in rawScienceExp
     127    // don't have their exp_tag in rawDetrendExp
     128    // XXX having the same exp_tag in newExp and raw*Exp is probably an error
    129129    // that should be checked for
    130130    char *query =
    131131        "SELECT newImfile.* FROM newImfile"
    132         " LEFT JOIN newExp USING(exp_id)"
    133         " LEFT JOIN rawScienceExp USING(exp_id)"
    134         " LEFT JOIN rawDetrendExp USING (exp_id)"
    135         " WHERE newExp.exp_id is NOT NULL"
    136         " AND rawScienceExp.exp_id IS NULL"
    137         " AND rawDetrendExp.exp_id IS NULL";
     132        " LEFT JOIN newExp USING(exp_tag)"
     133        " LEFT JOIN rawScienceExp USING(exp_tag)"
     134        " LEFT JOIN rawDetrendExp USING (exp_tag)"
     135        " WHERE newExp.exp_tag is NOT NULL"
     136        " AND rawScienceExp.exp_tag IS NULL"
     137        " AND rawDetrendExp.exp_tag IS NULL";
    138138
    139139    if (!p_psDBRunQuery(config->dbh, query)) {
     
    175175    PS_ASSERT_PTR_NON_NULL(config, false);
    176176
    177     // make sure that the exp_id(s) are ready to be updated based on:
    178     // exp_id is not in rawScienceExp
    179     // exp_id is not in rawDetrendExp
    180     // exp_id is not in newImfile
     177    // make sure that the exp_tag(s) are ready to be updated based on:
     178    // exp_tag is not in rawScienceExp
     179    // exp_tag is not in rawDetrendExp
     180    // exp_tag is not in newImfile
    181181    // that the correct count of imfiles is in rawImfile
    182182
     
    184184        "SELECT newExp.*"
    185185        "   FROM newExp"
    186         " LEFT JOIN newImfile USING(exp_id)"
    187         " LEFT JOIN rawScienceExp USING(exp_id)"
    188         " LEFT JOIN rawDetrendExp USING(exp_id)"
     186        " LEFT JOIN newImfile USING(exp_tag)"
     187        " LEFT JOIN rawScienceExp USING(exp_tag)"
     188        " LEFT JOIN rawDetrendExp USING(exp_tag)"
    189189        " WHERE"
    190         "   newExp.exp_id IS NOT NULL"
    191         "   AND newImfile.exp_id IS NULL"
    192         "   AND rawScienceExp.exp_id IS NULL"
     190        "   newExp.exp_tag IS NOT NULL"
     191        "   AND newImfile.exp_tag IS NULL"
     192        "   AND rawScienceExp.exp_tag IS NULL"
    193193        "   AND newExp.imfiles ="
    194         "   (SELECT COUNT(exp_id) FROM rawImfile"
    195         "       WHERE rawImfile.exp_id = newExp.exp_id)"
     194        "   (SELECT COUNT(exp_tag) FROM rawImfile"
     195        "       WHERE rawImfile.exp_tag = newExp.exp_tag)"
    196196        );
    197197
    198198    {       
    199199        bool status = false;
    200         psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
     200        psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    201201        if (!status) {
    202             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     202            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    203203            psFree(query);
    204204            return false;
    205205        }
    206         if (exp_id) {
    207             psStringAppend(&query, " AND newExp.exp_id = '%s'", exp_id);
     206        if (exp_tag) {
     207            psStringAppend(&query, " AND newExp.exp_tag = '%s'", exp_tag);
    208208        }
    209209    }
     
    359359        psArray *rawImfiles = NULL;
    360360        {
    361             // build a query to search by exp_id
     361            // build a query to search by exp_tag
    362362            psMetadata *where = psMetadataAlloc();
    363             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", newExp->exp_id)) {
     363            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", newExp->exp_tag)) {
    364364                // rollback
    365365                if (!psDBRollback(config->dbh)) {
    366366                    psError(PS_ERR_UNKNOWN, false, "database error");
    367367                }
    368                 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     368                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    369369                psFree(where);
    370370                psFree(newExp);
     
    381381                psError(PS_ERR_UNKNOWN, false, "database error");
    382382            }
    383             psError(PS_ERR_UNKNOWN, false, "found no rawImfiles associated with exp_id %s", newExp->exp_id);
     383            psError(PS_ERR_UNKNOWN, false, "found no rawImfiles associated with exp_tag %s", newExp->exp_tag);
    384384            psFree(newExp);
    385385            psFree(output);
     
    439439        "SELECT * FROM"
    440440            " (SELECT newImfile.* FROM newImfile"
    441                 " LEFT JOIN newExp USING(exp_id)"
    442                 " LEFT JOIN rawScienceExp USING(exp_id)"
    443                 " LEFT JOIN rawDetrendExp USING (exp_id)"
    444                 " WHERE newExp.exp_id IS NOT NULL"
    445                 " AND rawScienceExp.exp_id IS NULL"
    446                 " AND rawDetrendExp.exp_id IS NULL) AS foo"
    447         ); // WHERE class is generated from exp_id, class, & class_id
     441                " LEFT JOIN newExp USING(exp_tag)"
     442                " LEFT JOIN rawScienceExp USING(exp_tag)"
     443                " LEFT JOIN rawDetrendExp USING (exp_tag)"
     444                " WHERE newExp.exp_tag IS NOT NULL"
     445                " AND rawScienceExp.exp_tag IS NULL"
     446                " AND rawDetrendExp.exp_tag IS NULL) AS foo"
     447        ); // WHERE class is generated from exp_tag, class, & class_id
    448448
    449449    {
    450         // build a query to search by exp_id, class, class_id
     450        // build a query to search by exp_tag, class, class_id
    451451        psMetadata *where = psMetadataAlloc();
    452452        bool status = false;
    453         psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
     453        psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    454454        if (!status) {
    455             psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     455            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    456456            psFree(query);
    457457            return false;
    458458        }
    459         if (exp_id) {
    460             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
    461                 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     459        if (exp_tag) {
     460            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
     461                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    462462                psFree(where);
    463463                psFree(query);
     
    619619{
    620620    return p1PendingExpRowAlloc(
    621         newExp->exp_id,
     621        newExp->exp_tag,
    622622        newExp->camera,
    623623        newExp->telescope,
     
    642642
    643643    return p2PendingExpRowAlloc(
    644         exp->exp_id,
     644        exp->exp_tag,
    645645        "my recipe",
    646646        0xff, // XXX calc version number
     
    652652{
    653653    return p2PendingImfileRowAlloc(
    654         rawImfile->exp_id,
     654        rawImfile->exp_tag,
    655655        rawImfile->class_id,
    656656        rawImfile->uri,
     
    796796
    797797    return rawDetrendExpRowAlloc(
    798         exp->exp_id,
     798        exp->exp_tag,
    799799        exp->camera,
    800800        exp->telescope,
     
    941941
    942942    return rawImfileRowAlloc(
    943         imfile->exp_id,
     943        imfile->exp_tag,
    944944        imfile->class,
    945945        imfile->class_id,
  • trunk/ippTools/src/regtoolConfig.c

    r8711 r9057  
    2424    // -pendingexp
    2525    psMetadata *pendingexpArgs = psMetadataAlloc();
    26     psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_id",  0,
     26    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
    2727        "search by exposure ID", NULL);
    2828    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-inst",  0,
     
    3939    // -pendingimfile
    4040    psMetadata *pendingimfileArgs = psMetadataAlloc();
    41     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
     41    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
    4242        "search by exposure ID", NULL);
    4343    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-class",  0,
     
    5151    // -updateexp
    5252    psMetadata *updateexpArgs = psMetadataAlloc();
    53     psMetadataAddStr(updateexpArgs, PS_LIST_TAIL, "-exp_id",  0,
    54         "exp_id to operate on", NULL);
     53    psMetadataAddStr(updateexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
     54        "exp_tag to operate on", NULL);
    5555    psMetadataAddStr(updateexpArgs, PS_LIST_TAIL, "-exp_type",  0,
    5656        "define exposure type", NULL);
     
    9090    // -updateimfile
    9191    psMetadata *updateimfileArgs = psMetadataAlloc();
    92     psMetadataAddStr(updateimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
     92    psMetadataAddStr(updateimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
    9393        "search by exposure ID", NULL);
    9494    psMetadataAddStr(updateimfileArgs, PS_LIST_TAIL, "-class",  0,
     
    125125    // -rawimfile
    126126    psMetadata *rawimfileArgs = psMetadataAlloc();
    127     psMetadataAddStr(rawimfileArgs, PS_LIST_TAIL, "-exp_id",  0,
     127    psMetadataAddStr(rawimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
    128128        "search by exposure ID", NULL);
    129129    psMetadataAddStr(rawimfileArgs, PS_LIST_TAIL, "-class_id",  0,
     
    205205    config->where = psMetadataAlloc();
    206206
    207     addWhereStr(exp_id);
     207    addWhereStr(exp_tag);
    208208    // convert '-inst' to 'camera'
    209209    {
Note: See TracChangeset for help on using the changeset viewer.