IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8333


Ignore:
Timestamp:
Aug 14, 2006, 3:33:39 PM (20 years ago)
Author:
jhoblitt
Message:

implement -tostack

File:
1 edited

Legend:

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

    r8330 r8333  
    985985static bool tostackMode(pxConfig *config)
    986986{
     987    PS_ASSERT_PTR_NON_NULL(config, false);
     988
     989    /*
     990which returns a list of stacks that are ready to be performed.  This
     991list includes the detrend id, iteration, class id and detrend types
     992(note that class id is unique per detrend id).  In terms of the
     993database, the command returns the list where the detrend id, iteration
     994and class id triplet do not have an entry in detStackedImfile; the
     995results are masked by entries in detResidExpAnalysis
     996*/
     997
     998//select detProcessedImfile.det_id, detRun.iteration, detProcessedImfile.class_id from detProcessedImfile LEFT JOIN detRun ON detProcessedImfile.det_id = detRun.position LEFT JOIN rawImfile ON detprocessedImfile.exp_id
     999
     1000    // select detRun.iteration
     1001    // select detProcessedImfile.det_id
     1002    // select detProcessedImfile.class_id
     1003    // by:
     1004    // find the current iteration bassed on det_id
     1005    // find all exp_ids in the current det_id/iteration from detInputExp
     1006    // find all rawImfiles in the current exp_ids
     1007    // compare to detProcessedImfiles by det_id/exp_id
     1008    // found how many imfile there are in each class_id
     1009    // and:
     1010    // det_id is not in detStackedImfile;
     1011    // iteration is not in detStackedImfile;
     1012    // class_id is not in detStackedImfile;
     1013
     1014    psString query = psStringCopy(
     1015        " SELECT"
     1016        "    detProcessedImfile.det_id,"
     1017        "    detRun.iteration,"
     1018        "    detProcessedImfile.class_id"
     1019        " FROM detRun LEFT JOIN detInputExp"
     1020        "    ON detRun.position = detInputExp.det_id"
     1021        "    AND detRun.iteration = detInputExp.iteration"
     1022        " LEFT JOIN rawImfile"
     1023        "    ON detInputExp.exp_id = rawImfile.exp_id"
     1024        " LEFT JOIN detProcessedImfile"
     1025        "    ON detInputExp.det_id = detProcessedImfile.det_id"
     1026        "    AND detInputExp.exp_id = detProcessedImfile.exp_id"
     1027        " LEFT JOIN detStackedImfile"
     1028        "    ON detInputExp.det_id = detStackedImfile.det_id"
     1029        "    AND detInputExp.iteration = detStackedImfile.iteration"
     1030        "    AND detProcessedImfile.class_id = detStackedImfile.class_id"
     1031        " WHERE detStackedImfile.det_id IS NULL"
     1032        "    AND detStackedImfile.iteration IS NULL"
     1033        "    AND detStackedImfile.class_id IS NULL"
     1034        " HAVING COUNT(detProcessedImfile.class_id) = COUNT(rawImfile.class_id)"
     1035        );
     1036
     1037    // XXX search criterian are disabled
     1038#if 0
     1039    if (config->where) {
     1040        psString whereClaus = psDBGenerateWhereConditionSQL(config->where);
     1041        psStringAppend(&query, " AND %s", whereClaus);
     1042        psFree(whereClaus);
     1043    }
     1044#endif
     1045
     1046    if (!p_psDBRunQuery(config->dbh, query)) {
     1047        psError(PS_ERR_UNKNOWN, false, "database error");
     1048        psFree(query);
     1049        return false;
     1050    }
     1051    psFree(query);
     1052
     1053    psArray *output = p_psDBFetchResult(config->dbh);
     1054    if (!output) {
     1055        // XXX check psError here
     1056        psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
     1057        return false;
     1058    }
     1059
     1060    bool simple = false;
     1061    {
     1062        bool status = false;
     1063        simple = psMetadataLookupBool(&status, config->args, "-simple");
     1064        if (!status) {
     1065            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
     1066            return false;
     1067        }
     1068    }
     1069
     1070    // negative simple so the default is true
     1071    if (!ippdbPrintMetadatas(stdout, output, "rawDetrendImfile", !simple)) {
     1072        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     1073        psFree(output);
     1074        return false;
     1075    }
     1076
     1077    psFree(output);
     1078
    9871079    return true;
    9881080}
Note: See TracChangeset for help on using the changeset viewer.