IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 14, 2006, 7:31:12 PM (20 years ago)
Author:
jhoblitt
Message:

stub out -tonormalize

File:
1 edited

Legend:

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

    r8344 r8349  
    16541654static bool tonormalizeMode(pxConfig *config)
    16551655{
     1656    PS_ASSERT_PTR_NON_NULL(config, false);
     1657
     1658    // select detRun.iteration
     1659    // select detProcessedImfile.det_id
     1660    // select detProcessedImfile.class_id
     1661    // by:
     1662    // find the current iteration bassed on det_id
     1663    // find all exp_ids in the current det_id/iteration from detInputExp
     1664    // find all rawImfiles in the current exp_ids
     1665    // compare to detProcessedImfiles by det_id/exp_id
     1666    // found how many imfile there are in each class_id
     1667    // and:
     1668    // det_id is not in detStackedImfile;
     1669    // iteration is not in detStackedImfile;
     1670    // class_id is not in detStackedImfile;
     1671
     1672    psString query = psStringCopy(
     1673        " SELECT"
     1674        "    detRun.position,"
     1675        "    detRun.iteration,"
     1676        " FROM detRun"
     1677        " LEFT JOIN detInputExp"
     1678        "    ON detRun.position = detInputExp.det_id"
     1679        "    AND detRun.iteration = detInputExp.iteration"
     1680        " LEFT JOIN detStackedImfile"
     1681        "    ON detInputExp.det_id = detStackedImfile.det_id"
     1682        "    AND detInputExp.iteration = detStackedImfile.iteration"
     1683        " LEFT JOIN rawImfile"
     1684        "    ON detInputExp.exp_id = rawImfile.exp_id"
     1685        " WHERE"
     1686        "    detStackedImfile.det_id IS NOT NULL"
     1687        "    AND detStackedImfile.iteration IS NOT NULL"
     1688        "    AND detStackedImfile.class_id IS NOT NULL"
     1689        " GROUP BY"
     1690        "    detStackedImfile.class_id,"
     1691        "    rawImfile.class_id"
     1692        " HAVING"
     1693        "    COUNT(detStackedImfile.class_id) = COUNT(rawImfile.class_id)"
     1694        );
     1695
     1696    // XXX does it make sens to accept any search params?
     1697#if 0
     1698    if (config->where) {
     1699        psString whereClaus = psDBGenerateWhereConditionSQL(config->where);
     1700        psStringAppend(&query, " AND %s", whereClaus);
     1701        psFree(whereClaus);
     1702    }
     1703#endif
     1704
     1705    if (!p_psDBRunQuery(config->dbh, query)) {
     1706        psError(PS_ERR_UNKNOWN, false, "database error");
     1707        psFree(query);
     1708        return false;
     1709    }
     1710    psFree(query);
     1711
     1712    psArray *output = p_psDBFetchResult(config->dbh);
     1713    if (!output) {
     1714        // XXX check psError here
     1715        psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
     1716        return false;
     1717    }
     1718
     1719    bool simple = false;
     1720    {
     1721        bool status = false;
     1722        simple = psMetadataLookupBool(&status, config->args, "-simple");
     1723        if (!status) {
     1724            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
     1725            return false;
     1726        }
     1727    }
     1728
     1729    // negative simple so the default is true
     1730    if (!ippdbPrintMetadatas(stdout, output, "rawDetrendImfile", !simple)) {
     1731        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     1732        psFree(output);
     1733        return false;
     1734    }
     1735
     1736    psFree(output);
     1737
    16561738    return true;
    16571739}
Note: See TracChangeset for help on using the changeset viewer.