IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8349


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

stub out -tonormalize

Location:
trunk/ippTools/src
Files:
2 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}
  • trunk/ippTools/src/dettoolConfig.c

    r8331 r8349  
    171171    psMetadataAddStr(addstacArgs, PS_LIST_TAIL, "-recip",  0,
    172172        "define recipe (required)", NULL);
     173    psMetadataAddBool(addstacArgs, PS_LIST_TAIL, "-pleasenormalize",  0,
     174        "dude, make me normal", false);
     175
     176    // -tonormalize
     177    psMetadata *tonormalizeArgs = psMetadataAlloc();
     178    psMetadataAddBool(tonormalizeArgs, PS_LIST_TAIL, "-simple",  0,
     179        "use the simple output format", false);
    173180   
    174181    // -stacked
     
    357364    PXTOOL_MODE("-processed",       DETTOOL_MODE_PROCESSED,     procArgs);
    358365    PXTOOL_MODE("-addstacked",      DETTOOL_MODE_ADDSTACKED,    addstacArgs);
     366    PXTOOL_MODE("-tonormalize",     DETTOOL_MODE_TONORMALIZE,   tonormalizeArgs);
    359367    PXTOOL_MODE("-stacked",         DETTOOL_MODE_STACKED,       stacArgs);
    360368    PXTOOL_MODE("-stackedframe",    DETTOOL_MODE_STACKEDFRAME,  stacframeArgs);
     
    383391        printf("\nPan-STARRS Detrend Tool\n");
    384392        printf("Usage: %s <mode> [<options>]\n\n", argv[0]);
    385         printf(" <mode> : [-pending|-definebyexp|-definebyquery|-runs|-selectrun|-select|-raw|-addprocessed|-tostack|-processed|-addstacked|-stacked|-stackedframe|-addnormalized|-normalized|-normalizedframe|-addresidimfile|-residimfile|-addresidexp|-residexp|-declaremasterframe|-masterframe|-master|-rerun]\n\n");
     393        printf(" <mode> : [-pending|-definebyexp|-definebyquery|-runs|-selectrun|-select|-raw|-addprocessed|-tostack|-processed|-addstacked|-tonormalize|-stacked|-stackedframe|-addnormalized|-normalized|-normalizedframe|-addresidimfile|-residimfile|-addresidexp|-residexp|-declaremasterframe|-masterframe|-master|-rerun]\n\n");
    386394        fprintf (stdout, "-pending ");
    387395        psArgumentHelp(pendingArgs);
     
    431439        psFree(addstacArgs);
    432440
     441        fprintf (stdout, "-tonormalize ");
     442        psArgumentHelp(tonormalizeArgs);
     443        psFree(tonormalizeArgs);
     444
    433445        fprintf (stdout, "-stacked ");
    434446        psArgumentHelp(stacArgs);
     
    498510    psFree(procArgs);
    499511    psFree(addstacArgs);
     512    psFree(tonormalizeArgs);
    500513    psFree(stacArgs);
    501514    psFree(stacframeArgs);
Note: See TracChangeset for help on using the changeset viewer.