IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18530


Ignore:
Timestamp:
Jul 14, 2008, 8:54:45 PM (18 years ago)
Author:
eugene
Message:

updates from HEAD

Location:
branches/eam_branch_20080706
Files:
4 added
11 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080706/ippTools/share/Makefile.am

    r18497 r18530  
    8080        magictool_find_unmagiced.sql \
    8181        magictool_inputskyfile.sql \
     82        magictool_totree.sql \
    8283        magictool_tomask.sql \
    8384        magictool_toprocess_inputs.sql \
    8485        magictool_toprocess_tree.sql \
    8586        magictool_toskyfilemask.sql \
     87        magictool_inputs.sql \
     88        magictool_addmask.sql \
     89        magictool_mask.sql \
    8690        pstamptool_addjob_otherjob.sql \
    8791        pstamptool_addjob_stampjob.sql \
  • branches/eam_branch_20080706/ippTools/share/magictool_toprocess_inputs.sql

    r15336 r18530  
    33    -- convert magic_id into a boolean value (1 or 0)
    44    -- note that the type stays a 64 bit int
    5     magicNodeResult.magic_id IS TRUE as done,
    6     diffSkyfile.uri
     5    magicNodeResult.magic_id IS TRUE as done
    76FROM magicTree
    87JOIN magicRun
  • branches/eam_branch_20080706/ippTools/share/magictool_toprocess_tree.sql

    r15272 r18530  
    33    -- convert magic_id into a boolean value (1 or 0)
    44    -- note that the type stays a 64 bit int
    5     magicNodeResult.magic_id IS TRUE as done,
    6     magicNodeResult.uri
     5    magicNodeResult.magic_id IS TRUE as done
    76FROM magicTree
    87JOIN magicRun
  • branches/eam_branch_20080706/ippTools/share/pxadmin_create_tables.sql

    r18029 r18530  
    719719CREATE TABLE diffInputSkyfile (diff_id BIGINT, template TINYINT, stack_id BIGINT, warp_id BIGINT, skycell_id VARCHAR(64), tess_id VARCHAR(64), kind VARCHAR(64), PRIMARY KEY(diff_id, template), KEY(stack_id), KEY(warp_id), KEY(skycell_id), KEY(tess_id), KEY(kind), FOREIGN KEY (diff_id)  REFERENCES  diffRun(diff_id), FOREIGN KEY (stack_id)  REFERENCES  stackSumSkyfile(stack_id), FOREIGN KEY (warp_id, skycell_id, tess_id)  REFERENCES  warpSkyfile(warp_id, skycell_id, tess_id)) ENGINE=innodb DEFAULT CHARSET=latin1;
    720720CREATE TABLE diffSkyfile (diff_id BIGINT, uri VARCHAR(255), path_base VARCHAR(255), bg DOUBLE, bg_stdev DOUBLE, stamps_num INT, stamps_rms FLOAT, sources INT, dtime_diff FLOAT, hostname VARCHAR(64), good_frac FLOAT, fault SMALLINT, PRIMARY KEY(diff_id), KEY(good_frac), KEY(fault), FOREIGN KEY (diff_id)  REFERENCES  diffRun(diff_id)) ENGINE=innodb DEFAULT CHARSET=latin1;
    721 CREATE TABLE magicRun (magic_id BIGINT AUTO_INCREMENT, state VARCHAR(64), workdir VARCHAR(255), workdir_state VARCHAR(255), label VARCHAR(64), dvodb VARCHAR(255), registered DATETIME, PRIMARY KEY(magic_id), KEY(magic_id), KEY(state), KEY(workdir_state), KEY(label)) ENGINE=innodb DEFAULT CHARSET=latin1;
    722 CREATE TABLE magicInputSkyfile (magic_id BIGINT, diff_id BIGINT, node VARCHAR(64), PRIMARY KEY(magic_id, diff_id), FOREIGN KEY (magic_id)  REFERENCES  magicRun(magic_id), FOREIGN KEY (diff_id)  REFERENCES  diffRun(diff_id)) ENGINE=innodb DEFAULT CHARSET=latin1;
    723 CREATE TABLE magicTree (magic_id BIGINT, node VARCHAR(64), dep VARCHAR(64), KEY(magic_id), KEY(node), KEY(dep), INDEX(magic_id, node), FOREIGN KEY (magic_id)  REFERENCES  magicRun(magic_id)) ENGINE=innodb DEFAULT CHARSET=latin1;
    724 CREATE TABLE magicNodeResult (magic_id BIGINT, node VARCHAR(64), uri VARCHAR(255), PRIMARY KEY(magic_id, node), FOREIGN KEY (magic_id)  REFERENCES  magicRun(magic_id), FOREIGN KEY (magic_id, node)  REFERENCES  magicTree(magic_id, node)) ENGINE=innodb DEFAULT CHARSET=latin1;
    725 CREATE TABLE magicMask (magic_id BIGINT, uri VARCHAR(255), PRIMARY KEY(magic_id), FOREIGN KEY (magic_id)  REFERENCES  magicRun(magic_id)) ENGINE=innodb DEFAULT CHARSET=latin1;
    726 CREATE TABLE magicSkyfileMask (magic_id BIGINT, diff_id BIGINT, uri VARCHAR(255), PRIMARY KEY(magic_id, diff_id), KEY(uri), FOREIGN KEY (magic_id)  REFERENCES  magicRun(magic_id), FOREIGN KEY (magic_id, diff_id)  REFERENCES  magicInputSkyfile(magic_id, diff_id), FOREIGN KEY (magic_id)  REFERENCES  magicMask(magic_id)) ENGINE=innodb DEFAULT CHARSET=latin1;
     721
     722CREATE TABLE magicRun (
     723        magic_id BIGINT AUTO_INCREMENT,
     724        state VARCHAR(64),
     725        workdir VARCHAR(255),
     726        workdir_state VARCHAR(255),
     727        label VARCHAR(64),
     728        dvodb VARCHAR(255),
     729        registered DATETIME,
     730        fault SMALLINT,
     731        PRIMARY KEY(magic_id),
     732        KEY(magic_id),
     733        KEY(state),
     734        KEY(workdir_state),
     735        KEY(label),
     736        KEY(fault)
     737) ENGINE=innodb DEFAULT CHARSET=latin1;
     738
     739CREATE TABLE magicInputSkyfile (
     740        magic_id BIGINT,
     741        diff_id BIGINT,
     742        node VARCHAR(64),
     743        PRIMARY KEY(magic_id, diff_id),
     744        FOREIGN KEY (magic_id)  REFERENCES  magicRun(magic_id),
     745        FOREIGN KEY (diff_id)  REFERENCES  diffRun(diff_id)
     746) ENGINE=innodb DEFAULT CHARSET=latin1;
     747
     748CREATE TABLE magicTree (
     749        magic_id BIGINT,
     750        node VARCHAR(64),
     751        dep VARCHAR(64),
     752        KEY(magic_id),
     753        KEY(node),
     754        KEY(dep),
     755        INDEX(magic_id, node),
     756        FOREIGN KEY (magic_id)  REFERENCES  magicRun(magic_id)
     757) ENGINE=innodb DEFAULT CHARSET=latin1;
     758
     759CREATE TABLE magicNodeResult (
     760        magic_id BIGINT,
     761        node VARCHAR(64),
     762        uri VARCHAR(255),
     763        fault SMALLINT,
     764        PRIMARY KEY(magic_id, node),
     765        FOREIGN KEY (magic_id)  REFERENCES  magicRun(magic_id),
     766        FOREIGN KEY (magic_id, node)  REFERENCES  magicTree(magic_id, node),
     767        KEY(fault)
     768) ENGINE=innodb DEFAULT CHARSET=latin1;
     769
     770CREATE TABLE magicMask (
     771        magic_id BIGINT,
     772        uri VARCHAR(255),
     773        streaks INT,
     774        fault SMALLINT,
     775        PRIMARY KEY(magic_id),
     776        FOREIGN KEY (magic_id)  REFERENCES  magicRun(magic_id),
     777        KEY(fault)
     778) ENGINE=innodb DEFAULT CHARSET=latin1;
     779
    727780CREATE TABLE calDB (cal_id BIGINT AUTO_INCREMENT, dvodb VARCHAR(64), state VARCHAR(64), PRIMARY KEY(cal_id), KEY(cal_id)) ENGINE=innodb DEFAULT CHARSET=latin1;
    728781CREATE TABLE calRun (cal_id BIGINT AUTO_INCREMENT, region VARCHAR(64), last_step VARCHAR(64), state VARCHAR(64), PRIMARY KEY(cal_id), KEY(cal_id), KEY(last_step), FOREIGN KEY (cal_id)  REFERENCES  calDB(cal_id)) ENGINE=innodb DEFAULT CHARSET=latin1;
  • branches/eam_branch_20080706/ippTools/share/stacktool_tosum.sql

    r16942 r18530  
    1 SELECT
     1SELECT DISTINCT
    22    stackRun.stack_id,
    33    stackRun.tess_id,
    44    stackRun.skycell_id,
    5     stackRun.workdir
     5    stackRun.workdir,
     6    rawExp.camera
    67FROM stackRun
     8JOIN stackInputSkyfile
     9    USING(stack_id)
     10JOIN warpSkyfile
     11    ON  stackInputSkyfile.warp_id = warpSkyfile.warp_id
     12    AND stackRun.skycell_id       = warpSkyfile.skycell_id
     13    AND stackRun.tess_id          = warpSkyfile.tess_id
     14JOIN warpRun
     15    ON warpRun.warp_id = warpSkyfile.warp_id
     16JOIN fakeRun
     17    USING(fake_id)
     18JOIN camRun
     19    USING(cam_id)
     20JOIN chipRun
     21    USING(chip_id)
     22JOIN rawExp
     23    USING(exp_id)
    724LEFT JOIN stackSumSkyfile
    825    USING(stack_id)
  • branches/eam_branch_20080706/ippTools/src/magictool.c

    r18496 r18530  
    3636static bool addinputskyfileMode(pxConfig *config);
    3737static bool inputskyfileMode(pxConfig *config);
     38static bool totreeMode(pxConfig *config);
    3839static bool inputtreeMode(pxConfig *config);
    3940static bool toprocessMode(pxConfig *config);
    4041static bool addresultMode(pxConfig *config);
     42static bool inputsMode(pxConfig *config);
    4143static bool tomaskMode(pxConfig *config);
    4244static bool addmaskMode(pxConfig *config);
    43 static bool toskyfilemaskMode(pxConfig *config);
    44 static bool addskyfilemaskMode(pxConfig *config);
     45static bool maskMode(pxConfig *config);
    4546
    4647static bool setmagicRunState(pxConfig *config, psS64 magic_id, const char *state);
     
    6566
    6667    switch (config->mode) {
    67         MODECASE(MAGICTOOL_MODE_DEFINEBYQUERY,          definebyqueryMode);
     68        MODECASE(MAGICTOOL_MODE_DEFINEBYQUERY,  definebyqueryMode);
    6869        MODECASE(MAGICTOOL_MODE_DEFINERUN,      definerunMode);
    6970        MODECASE(MAGICTOOL_MODE_UPDATERUN,      updaterunMode);
    7071        MODECASE(MAGICTOOL_MODE_ADDINPUTSKYFILE,addinputskyfileMode);
    7172        MODECASE(MAGICTOOL_MODE_INPUTSKYFILE,   inputskyfileMode);
     73        MODECASE(MAGICTOOL_MODE_TOTREE,         totreeMode);
    7274        MODECASE(MAGICTOOL_MODE_INPUTTREE,      inputtreeMode);
    7375        MODECASE(MAGICTOOL_MODE_TOPROCESS,      toprocessMode);
    7476        MODECASE(MAGICTOOL_MODE_ADDRESULT,      addresultMode);
     77        MODECASE(MAGICTOOL_MODE_INPUTS,         inputsMode);
    7578        MODECASE(MAGICTOOL_MODE_TOMASK,         tomaskMode);
    7679        MODECASE(MAGICTOOL_MODE_ADDMASK,        addmaskMode);
    77         MODECASE(MAGICTOOL_MODE_TOSKYFILEMASK,  toskyfilemaskMode);
    78         MODECASE(MAGICTOOL_MODE_ADDSKYFILEMASK, addskyfilemaskMode);
     80        MODECASE(MAGICTOOL_MODE_MASK,           maskMode);
    7981        default:
    8082            psAbort("invalid option (this should not happen)");
     
    212214            NULL,       // label
    213215            NULL,       // dvodb
    214             NULL        // registered
     216            NULL,       // registered
     217            0           // fault
    215218            );
    216219        if (!run) {
     
    263266    PS_ASSERT_PTR_NON_NULL(config, false);
    264267
    265     // required 
     268    // required
    266269    PXOPT_LOOKUP_STR(workdir, config->args, "-workdir", true, false);
    267270
     
    279282            label,
    280283            dvodb,
    281             registered
     284            registered,
     285            0
    282286    );
    283     psFree(registered);
     287
    284288    if (!run) {
    285289        psError(PS_ERR_UNKNOWN, false, "failed to alloc magicRun object");
    286         return true;
     290        return false;
    287291    }
    288292    if (!magicRunInsertObject(config->dbh, run)) {
    289293        psError(PS_ERR_UNKNOWN, false, "database error");
    290294        psFree(run);
    291         return true;
     295        return false;
    292296    }
    293297
     
    400404    }
    401405    if (!psArrayLength(output)) {
    402         psTrace("warptool", PS_LOG_INFO, "no rows found");
     406        psTrace("magictool", PS_LOG_INFO, "no rows found");
    403407        psFree(output);
    404408        return true;
     
    420424
    421425
    422 static bool inputtreeMode(pxConfig *config)
    423 {
    424     PS_ASSERT_PTR_NON_NULL(config, false);
    425 
    426     // required
    427     PXOPT_LOOKUP_STR(magic_id, config->args, "-magic_id", true, false);
    428     PXOPT_LOOKUP_STR(dep_file, config->args, "-dep_file", true, false);
    429 
    430     if (!parseAndInsertNodeDeps(config, (psS64)atoll(magic_id), dep_file)) {
    431         psError(PS_ERR_UNKNOWN, false, "failed to parse file");
    432         return false;
    433     }
    434 
    435     return true;
    436 }
    437 
    438 
    439 bool findBaseNodes(void *arg, pxNode *node)
    440 {
    441     bool status = false;
    442     psS64 done = psMetadataLookupS64(&status, node->data, "done");
    443     if (!status) {
    444         psAbort("failed to lookup value for done column");
    445     }
    446 
    447     if ((!pxNodeHasChildren(node)) && (!done)) {
    448         // if this node has no child and it's not 'done', then push it's data
    449         // onto the void *array
    450         psArrayAdd((psArray *)arg, 0, node->data);
    451         return false;
    452     }
    453    
    454     return true;
    455 }
    456 
    457 
    458 bool findReadyNodes(void *arg, pxNode *node)
    459 {
    460 
    461     if (pxNodeHasChildren(node)) {
    462         psListIterator *iter = psListIteratorAlloc(node->children, 0, false);
    463         psMetadata *work = psMetadataCopy(NULL, node->data);
    464         psMetadataRemoveKey(work, "dep");
    465         psMetadataRemoveKey(work, "done");
    466         psMetadataRemoveKey(work, "uri");
    467         pxNode *child = NULL;
    468         while ((child = psListGetAndIncrement(iter))) {
    469             psMetadata *data = child->data;
    470 
    471             bool status = false;
    472             psS32 done = psMetadataLookupS32(&status, data, "done");
    473             if (!status) {
    474                 psAbort("failed to lookup value for done column");
    475             }
    476 
    477             if (!done) {
    478                 // if a child isn't "done", give up on this node and continue
    479                 // to crawl the tree
    480                 psFree(iter);
    481                 psFree(work);
    482                 return true;
    483             }
    484 
    485             char *uri = psMetadataLookupStr(&status, data, "uri");
    486             if (!status) {
    487                 psAbort("failed to lookup value for uri column");
    488             }
    489 
    490             psMetadataAddStr(work, PS_LIST_TAIL, "uri", PS_META_DUPLICATE_OK, NULL, uri);
    491 
    492         }
    493         psFree(iter);
    494         // if all this nodes children are done, then push it's data onto the
    495         // void *array
    496         psArrayAdd((psArray *)arg, 0, work);
    497         psFree(work);
    498         return false;
    499     }
    500    
    501     return true;
    502 }
    503 
    504 
    505 static bool toprocessMode(pxConfig *config)
     426static bool totreeMode(pxConfig *config)
    506427{
    507428    PS_ASSERT_PTR_NON_NULL(config, false);
     
    510431    PXOPT_COPY_STR(config->args, where, "-magic_id", "magic_id", "==");
    511432
    512     psString whereClause = NULL;
    513     if (psListLength(where->list)) {
    514         whereClause = psDBGenerateWhereSQL(where, NULL);
    515     }
    516     psFree(where);
    517 
     433    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
    518434    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    519435
    520436    // look for "inputs" that need to processed
    521     psString query = pxDataGet("magictool_toprocess_inputs.sql");
     437    psString query = pxDataGet("magictool_totree.sql");
    522438    if (!query) {
    523439        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     
    525441    }
    526442
    527     if (whereClause) {
    528         psStringAppend(&query, " %s", whereClause);
     443XXX : add where test
     444
     445    // treat limit == 0 as "no limit"
     446    if (limit) {
     447        psString limitString = psDBGenerateLimitSQL(limit);
     448        psStringAppend(&query, " %s", limitString);
     449        psFree(limitString);
    529450    }
    530451
     
    552473    if (!psArrayLength(output)) {
    553474        psTrace("magictool", PS_LOG_INFO, "no rows found");
    554         // psFree(output);
    555         // return true;
    556     }
    557 
    558     // look for tree nodes that need to be processed
    559     query = pxDataGet("magictool_toprocess_tree.sql");
    560     if (!query) {
    561         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    562         return false;
    563     }
    564 
    565     if (whereClause) {
    566         psStringAppend(&query, " %s", whereClause);
    567     }
    568 
    569     if (!p_psDBRunQuery(config->dbh, query)) {
    570         psError(PS_ERR_UNKNOWN, false, "database error");
    571         psFree(query);
    572         return false;
    573     }
    574     psFree(query);
    575 
    576     psArray *magicTree = p_psDBFetchResult(config->dbh);
    577     if (!output) {
    578         psErrorCode err = psErrorCodeLast();
    579         switch (err) {
    580             case PS_ERR_DB_CLIENT:
    581                 psError(PXTOOLS_ERR_SYS, false, "database error");
    582             case PS_ERR_DB_SERVER:
    583                 psError(PXTOOLS_ERR_PROG, false, "database error");
    584             default:
    585                 psError(PXTOOLS_ERR_PROG, false, "unknown error");
    586         }
    587 
    588         return false;
    589     }
    590     if (!psArrayLength(magicTree)) {
    591         psTrace("magictool", PS_LOG_INFO, "no rows found");
    592         psFree(magicTree);
     475        psFree(output);
    593476        return true;
    594477    }
    595      
    596     psHash *forest = psHashAlloc(psArrayLength(magicTree));
    597 
    598     // convert the array of metadata into a pxTree structure
    599     for (long i = 0; i < psArrayLength(magicTree); i++) {
    600         bool status;
    601         psString node = psMetadataLookupStr(&status, magicTree->data[i], "node");
    602         if (!status) {
    603             psAbort("failed to lookup value for node column");
    604         }
    605 
    606         psString dep = psMetadataLookupStr(&status, magicTree->data[i], "dep");
    607         if (!status) {
    608             psAbort("failed to lookup value for dep column");
    609         }
    610 
    611         pxTreeBuilder(forest, node, dep, magicTree->data[i]);
    612 
    613     }
    614     psFree(magicTree);
    615 
    616     // find the root of the tree
    617     pxNode *root = psHashLookup(forest, "root");
    618     psFree(forest);
    619     // pxTreePrint(stdout, root);
    620 
    621     // crawl through the tree and looking for nodes with children that are all
    622     // "done"
    623     pxTreeCrawl(root, findReadyNodes, output);
    624     psFree(root);
    625478
    626479    if (psArrayLength(output)) {
    627480        // negative simple so the default is true
    628         if (!ippdbPrintMetadatas(stdout, output, "magicMe", !simple)) {
     481        if (!ippdbPrintMetadatas(stdout, output, "totree", !simple)) {
    629482            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    630483            psFree(output);
     
    634487
    635488    psFree(output);
    636     psFree(whereClause);
    637 
    638     return true;
    639 }
    640 
    641 
    642 static bool addresultMode(pxConfig *config)
     489
     490    return true;
     491}
     492
     493
     494static bool inputtreeMode(pxConfig *config)
    643495{
    644496    PS_ASSERT_PTR_NON_NULL(config, false);
     
    646498    // required
    647499    PXOPT_LOOKUP_STR(magic_id, config->args, "-magic_id", true, false);
    648     PXOPT_LOOKUP_STR(node, config->args, "-node", true, false);
    649     PXOPT_LOOKUP_STR(uri, config->args, "-uri", true, false);
    650 
    651     if (!magicNodeResultInsert(config->dbh,
    652                 (psS64)atoll(magic_id),
    653                 node,
    654                 uri
    655         )) {
    656         psError(PS_ERR_UNKNOWN, false, "database error");
    657         return false;
    658     }
    659 
    660     return true;
    661 }
    662 
    663 
    664 static bool tomaskMode(pxConfig *config)
    665 {
    666     PS_ASSERT_PTR_NON_NULL(config, false);
    667 
    668     PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     500    PXOPT_LOOKUP_STR(dep_file, config->args, "-dep_file", true, false);
     501
     502    if (!parseAndInsertNodeDeps(config, (psS64)atoll(magic_id), dep_file)) {
     503        psError(PS_ERR_UNKNOWN, false, "failed to parse file");
     504        return false;
     505    }
     506
     507    return true;
     508}
     509
     510
     511bool findBaseNodes(void *arg, pxNode *node)
     512{
     513    bool status = false;
     514    psS64 done = psMetadataLookupS64(&status, node->data, "done");
     515    if (!status) {
     516        psAbort("failed to lookup value for done column");
     517    }
     518
     519    if ((!pxNodeHasChildren(node)) && (!done)) {
     520        // if this node has no child and it's not 'done', then push it's data
     521        // onto the void *array
     522        psArrayAdd((psArray *)arg, 0, node->data);
     523        return false;
     524    }
     525
     526    return true;
     527}
     528
     529
     530bool findReadyNodes(void *arg, pxNode *node)
     531{
     532    if (psMetadataLookupBool(NULL, node->data, "done")) {
     533        // It's already done
     534        return true;
     535    }
     536
     537    if (pxNodeHasChildren(node)) {
     538        psListIterator *iter = psListIteratorAlloc(node->children, 0, false);
     539        psMetadata *work = psMetadataCopy(NULL, node->data);
     540        psMetadataRemoveKey(work, "dep");
     541        psMetadataRemoveKey(work, "done");
     542#if 0
     543        psMetadataRemoveKey(work, "uri");
     544#endif
     545        pxNode *child = NULL;
     546        while ((child = psListGetAndIncrement(iter))) {
     547            psMetadata *data = child->data;
     548
     549            bool status = false;
     550            psS32 done = psMetadataLookupS32(&status, data, "done");
     551            if (!status) {
     552                psAbort("failed to lookup value for done column");
     553            }
     554
     555            if (!done) {
     556                // if a child isn't "done", give up on this node and continue
     557                // to crawl the tree
     558                psFree(iter);
     559                psFree(work);
     560                return true;
     561            }
     562#if 0
     563            char *uri = psMetadataLookupStr(&status, data, "uri");
     564            if (!status) {
     565                psAbort("failed to lookup value for uri column");
     566            }
     567
     568            psMetadataAddStr(work, PS_LIST_TAIL, "uri", PS_META_DUPLICATE_OK, NULL, uri);
     569#endif
     570        }
     571        psFree(iter);
     572        // if all this nodes children are done, then push it's data onto the
     573        // void *array
     574        psArrayAdd((psArray *)arg, 0, work);
     575        psFree(work);
     576        return false;
     577    }
     578
     579    return true;
     580}
     581
     582
     583static bool toprocessMode(pxConfig *config)
     584{
     585    PS_ASSERT_PTR_NON_NULL(config, false);
     586
     587    psMetadata *where = psMetadataAlloc();
     588    PXOPT_COPY_STR(config->args, where, "-magic_id", "magic_id", "==");
     589
     590    psString whereClause = NULL;
     591    if (psListLength(where->list)) {
     592        whereClause = psDBGenerateWhereSQL(where, NULL);
     593    }
     594    psFree(where);
     595
    669596    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    670597
    671598    // look for "inputs" that need to processed
    672     psString query = pxDataGet("magictool_tomask.sql");
     599    psString query = pxDataGet("magictool_toprocess_inputs.sql");
    673600    if (!query) {
    674601        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     
    676603    }
    677604
    678     // treat limit == 0 as "no limit"
    679     if (limit) {
    680         psString limitString = psDBGenerateLimitSQL(limit);
    681         psStringAppend(&query, " %s", limitString);
    682         psFree(limitString);
     605    if (whereClause) {
     606        psStringAppend(&query, " %s", whereClause);
    683607    }
    684608
     
    706630    if (!psArrayLength(output)) {
    707631        psTrace("magictool", PS_LOG_INFO, "no rows found");
    708         psFree(output);
     632        // psFree(output);
     633        // return true;
     634    }
     635
     636    // look for tree nodes that need to be processed
     637    query = pxDataGet("magictool_toprocess_tree.sql");
     638    if (!query) {
     639        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     640        return false;
     641    }
     642
     643    if (whereClause) {
     644        psStringAppend(&query, " %s", whereClause);
     645    }
     646
     647    if (!p_psDBRunQuery(config->dbh, query)) {
     648        psError(PS_ERR_UNKNOWN, false, "database error");
     649        psFree(query);
     650        return false;
     651    }
     652    psFree(query);
     653
     654    psArray *magicTree = p_psDBFetchResult(config->dbh);
     655    if (!magicTree) {
     656        psErrorCode err = psErrorCodeLast();
     657        switch (err) {
     658            case PS_ERR_DB_CLIENT:
     659                psError(PXTOOLS_ERR_SYS, false, "database error");
     660            case PS_ERR_DB_SERVER:
     661                psError(PXTOOLS_ERR_PROG, false, "database error");
     662            default:
     663                psError(PXTOOLS_ERR_PROG, false, "unknown error");
     664        }
     665
     666        return false;
     667    }
     668    if (!psArrayLength(magicTree)) {
     669        psTrace("magictool", PS_LOG_INFO, "no rows found");
     670        psFree(magicTree);
    709671        return true;
    710672    }
     673
     674    psHash *forest = psHashAlloc(psArrayLength(magicTree));
     675
     676    // convert the array of metadata into a pxTree structure
     677    for (long i = 0; i < psArrayLength(magicTree); i++) {
     678        bool status;
     679        psString node = psMetadataLookupStr(&status, magicTree->data[i], "node");
     680        if (!status) {
     681            psAbort("failed to lookup value for node column");
     682        }
     683
     684        psString dep = psMetadataLookupStr(&status, magicTree->data[i], "dep");
     685        if (!status) {
     686            psAbort("failed to lookup value for dep column");
     687        }
     688
     689        pxTreeBuilder(forest, node, dep, magicTree->data[i]);
     690
     691    }
     692    psFree(magicTree);
     693
     694    // find the root of the tree
     695    pxNode *root = psHashLookup(forest, "root");
     696    psFree(forest);
     697    // pxTreePrint(stdout, root);
     698
     699    // crawl through the tree and looking for nodes with children that are all
     700    // "done"
     701    pxTreeCrawl(root, findReadyNodes, output);
     702    psFree(root);
    711703
    712704    if (psArrayLength(output)) {
    713705        // negative simple so the default is true
    714         if (!ippdbPrintMetadatas(stdout, output, "toprocess", !simple)) {
     706        if (!ippdbPrintMetadatas(stdout, output, "magicMe", !simple)) {
    715707            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    716708            psFree(output);
     
    720712
    721713    psFree(output);
    722 
    723     return true;
    724 }
    725 
    726 
    727 static bool addmaskMode(pxConfig *config)
     714    psFree(whereClause);
     715
     716    return true;
     717}
     718
     719
     720static bool addresultMode(pxConfig *config)
    728721{
    729722    PS_ASSERT_PTR_NON_NULL(config, false);
     
    731724    // required
    732725    PXOPT_LOOKUP_STR(magic_id, config->args, "-magic_id", true, false);
    733     PXOPT_LOOKUP_STR(uri, config->args, "-uri", true, false);
    734 
    735     if (!magicMaskInsert(config->dbh,
    736                 (psS64)atoll(magic_id),
    737                 uri
     726    PXOPT_LOOKUP_STR(node, config->args, "-node", true, false);
     727
     728    // optional
     729    PXOPT_LOOKUP_STR(uri, config->args, "-uri", false, false);
     730
     731    // default values
     732    PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     733
     734    if (!magicNodeResultInsert(config->dbh,
     735                               (psS64)atoll(magic_id),
     736                               node,
     737                               uri,
     738                               code
    738739        )) {
    739740        psError(PS_ERR_UNKNOWN, false, "database error");
     
    744745}
    745746
    746 
    747 static bool toskyfilemaskMode(pxConfig *config)
    748 {
    749     PS_ASSERT_PTR_NON_NULL(config, false);
    750 
    751     psMetadata *where = psMetadataAlloc();
    752     PXOPT_COPY_STR(config->args, where, "-magic_id", "magic_id", "==");
     747static bool inputsMode(pxConfig *config)
     748{
     749    PS_ASSERT_PTR_NON_NULL(config, false);
    753750
    754751    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
    755752    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    756753
    757     psString query = pxDataGet("magictool_toskyfilemask.sql");
     754    psString query = pxDataGet("magictool_inputs.sql");
    758755    if (!query) {
    759756        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     
    761758    }
    762759
    763     if (psListLength(where->list)) {
    764         psString whereClause = psDBGenerateWhereConditionSQL(where, "magicRun");
     760    if (config->where) {
     761        psString whereClause = psDBGenerateWhereConditionSQL(config->where, NULL);
    765762        psStringAppend(&query, " AND %s", whereClause);
    766763        psFree(whereClause);
    767764    }
    768     psFree(where);
    769765
    770766    // treat limit == 0 as "no limit"
     
    804800    if (psArrayLength(output)) {
    805801        // negative simple so the default is true
    806         if (!ippdbPrintMetadatas(stdout, output, "toskyfilemask", !simple)) {
     802        if (!ippdbPrintMetadatas(stdout, output, "magicNode", !simple)) {
    807803            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    808804            psFree(output);
     
    817813
    818814
    819 static bool addskyfilemaskMode(pxConfig *config)
     815static bool tomaskMode(pxConfig *config)
     816{
     817    PS_ASSERT_PTR_NON_NULL(config, false);
     818
     819    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     820    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     821
     822    // look for "inputs" that need to processed
     823    psString query = pxDataGet("magictool_tomask.sql");
     824    if (!query) {
     825        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     826        return false;
     827    }
     828
     829    // treat limit == 0 as "no limit"
     830    if (limit) {
     831        psString limitString = psDBGenerateLimitSQL(limit);
     832        psStringAppend(&query, " %s", limitString);
     833        psFree(limitString);
     834    }
     835
     836    if (!p_psDBRunQuery(config->dbh, query)) {
     837        psError(PS_ERR_UNKNOWN, false, "database error");
     838        psFree(query);
     839        return false;
     840    }
     841    psFree(query);
     842
     843    psArray *output = p_psDBFetchResult(config->dbh);
     844    if (!output) {
     845        psErrorCode err = psErrorCodeLast();
     846        switch (err) {
     847            case PS_ERR_DB_CLIENT:
     848                psError(PXTOOLS_ERR_SYS, false, "database error");
     849            case PS_ERR_DB_SERVER:
     850                psError(PXTOOLS_ERR_PROG, false, "database error");
     851            default:
     852                psError(PXTOOLS_ERR_PROG, false, "unknown error");
     853        }
     854
     855        return false;
     856    }
     857    if (!psArrayLength(output)) {
     858        psTrace("magictool", PS_LOG_INFO, "no rows found");
     859        psFree(output);
     860        return true;
     861    }
     862
     863    if (psArrayLength(output)) {
     864        // negative simple so the default is true
     865        if (!ippdbPrintMetadatas(stdout, output, "toprocess", !simple)) {
     866            psError(PS_ERR_UNKNOWN, false, "failed to print array");
     867            psFree(output);
     868            return false;
     869        }
     870    }
     871
     872    psFree(output);
     873
     874    return true;
     875}
     876
     877
     878static bool addmaskMode(pxConfig *config)
    820879{
    821880    PS_ASSERT_PTR_NON_NULL(config, false);
     
    823882    // required
    824883    PXOPT_LOOKUP_STR(magic_id, config->args, "-magic_id", true, false);
    825     PXOPT_LOOKUP_STR(diff_id, config->args, "diff_id", true, false);
    826     PXOPT_LOOKUP_STR(uri, config->args, "uri", true, false);
    827 
    828     if (!magicSkyfileMaskInsert(config->dbh,
    829                 (psS64)atoll(magic_id),
    830                 (psS64)atoll(diff_id),
    831                 uri
     884
     885    // optional
     886    PXOPT_LOOKUP_STR(uri, config->args, "-uri", false, false);
     887    PXOPT_LOOKUP_S32(streaks, config->args, "-streaks", false, false);
     888
     889    // default values
     890    PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);
     891
     892    if (!psDBTransaction(config->dbh)) {
     893        psError(PS_ERR_UNKNOWN, false, "database error");
     894        return false;
     895    }
     896
     897    if (!magicMaskInsert(config->dbh,
     898                         (psS64)atoll(magic_id),
     899                         uri,
     900                         streaks,
     901                         code
    832902        )) {
    833903        psError(PS_ERR_UNKNOWN, false, "database error");
    834904        return false;
    835905    }
     906
     907    // Set the magicRun state
     908    psString query = pxDataGet("magictool_addmask.sql");
     909    if (!query) {
     910        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     911        return false;
     912    }
     913
     914    // Add "magic_id = value"
     915    psString whereClause = psDBGenerateWhereConditionSQL(config->where, NULL);
     916    psStringAppend(&query, " AND %s", whereClause);
     917    psFree(whereClause);
     918
     919    if (!p_psDBRunQuery(config->dbh, query)) {
     920        psError(PS_ERR_UNKNOWN, false, "database error");
     921        psFree(query);
     922        return false;
     923    }
     924    psFree(query);
     925
     926    if (!psDBCommit(config->dbh)) {
     927        psError(PS_ERR_UNKNOWN, false, "database error");
     928        return false;
     929    }
     930
     931    return true;
     932}
     933
     934
     935static bool maskMode(pxConfig *config)
     936{
     937    PS_ASSERT_PTR_NON_NULL(config, false);
     938
     939    psMetadata *where = psMetadataAlloc();
     940    PXOPT_COPY_STR(config->args, where, "-magic_id", "magicRun.magic_id", "==");
     941
     942    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     943    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
     944
     945    psString query = pxDataGet("magictool_mask.sql");
     946    if (!query) {
     947        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     948        return false;
     949    }
     950
     951    if (psListLength(where->list)) {
     952        psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
     953        psStringAppend(&query, " AND %s", whereClause);
     954        psFree(whereClause);
     955    }
     956    psFree(where);
     957
     958    // treat limit == 0 as "no limit"
     959    if (limit) {
     960        psString limitString = psDBGenerateLimitSQL(limit);
     961        psStringAppend(&query, " %s", limitString);
     962        psFree(limitString);
     963    }
     964
     965    if (!p_psDBRunQuery(config->dbh, query)) {
     966        psError(PS_ERR_UNKNOWN, false, "database error");
     967        psFree(query);
     968        return false;
     969    }
     970    psFree(query);
     971
     972    psArray *output = p_psDBFetchResult(config->dbh);
     973    if (!output) {
     974        psErrorCode err = psErrorCodeLast();
     975        switch (err) {
     976            case PS_ERR_DB_CLIENT:
     977                psError(PXTOOLS_ERR_SYS, false, "database error");
     978            case PS_ERR_DB_SERVER:
     979                psError(PXTOOLS_ERR_PROG, false, "database error");
     980            default:
     981                psError(PXTOOLS_ERR_PROG, false, "unknown error");
     982        }
     983
     984        return false;
     985    }
     986    if (!psArrayLength(output)) {
     987        psTrace("magictool", PS_LOG_INFO, "no rows found");
     988        psFree(output);
     989        return true;
     990    }
     991
     992    if (psArrayLength(output)) {
     993        // negative simple so the default is true
     994        if (!ippdbPrintMetadatas(stdout, output, "magicNode", !simple)) {
     995            psError(PS_ERR_UNKNOWN, false, "failed to print array");
     996            psFree(output);
     997            return false;
     998        }
     999    }
     1000
     1001    psFree(output);
    8361002
    8371003    return true;
  • branches/eam_branch_20080706/ippTools/src/magictool.h

    r18093 r18530  
    3030    MAGICTOOL_MODE_ADDINPUTSKYFILE,
    3131    MAGICTOOL_MODE_INPUTSKYFILE,
     32    MAGICTOOL_MODE_TOTREE,
    3233    MAGICTOOL_MODE_INPUTTREE,
    3334    MAGICTOOL_MODE_TOPROCESS,
     35    MAGICTOOL_MODE_INPUTS,
    3436    MAGICTOOL_MODE_ADDRESULT,
    3537    MAGICTOOL_MODE_TOMASK,
    3638    MAGICTOOL_MODE_ADDMASK,
    37     MAGICTOOL_MODE_TOSKYFILEMASK,
    38     MAGICTOOL_MODE_ADDSKYFILEMASK,
     39    MAGICTOOL_MODE_MASK,
    3940} MAGICtoolMode;
    4041
  • branches/eam_branch_20080706/ippTools/src/magictoolConfig.c

    r18496 r18530  
    7777    psMetadataAddBool(inputskyfileArgs, PS_LIST_TAIL, "-simple",  0,            "use the simple output format", false);
    7878
     79    // -totree
     80    psMetadata *totreeArgs = psMetadataAlloc();
     81    psMetadataAddStr(totreeArgs, PS_LIST_TAIL, "-magic_id", 0, "search by magic ID", NULL);
     82    psMetadataAddU64(totreeArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0);
     83    psMetadataAddBool(totreeArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false);
     84
    7985    // -inputtree
    8086    psMetadata *inputtreeArgs = psMetadataAlloc();
    8187    psMetadataAddStr(inputtreeArgs, PS_LIST_TAIL, "-magic_id", 0,            "define magictool ID (required)", NULL);
    8288    psMetadataAddStr(inputtreeArgs, PS_LIST_TAIL, "-dep_file", 0,            "order of operations dep. file (required)", NULL);
     89    psMetadataAddS16(inputtreeArgs, PS_LIST_TAIL, "-code",  0, "set fault code", 0);
     90
     91    // -inputs
     92    psMetadata *inputsArgs = psMetadataAlloc();
     93    psMetadataAddStr(inputsArgs, PS_LIST_TAIL, "-magic_id", 0,            "search by magictool ID", NULL);
     94    psMetadataAddStr(inputsArgs, PS_LIST_TAIL, "-node",  0,            "search by symbolic node name", NULL);
     95    psMetadataAddU64(inputsArgs, PS_LIST_TAIL, "-limit",  0,            "limit result set to N items", 0);
     96    psMetadataAddBool(inputsArgs, PS_LIST_TAIL, "-simple",  0,            "use the simple output format", false);
    8397
    8498    // -tooprocess
     
    93107    psMetadataAddStr(addresultArgs, PS_LIST_TAIL, "-node",  0,            "define symbolic node name (required)", NULL);
    94108    psMetadataAddStr(addresultArgs, PS_LIST_TAIL, "-uri",  0,            "define URI (required)", NULL);
     109    psMetadataAddS16(addresultArgs, PS_LIST_TAIL, "-code",  0, "set fault code", 0);
    95110
    96111    // -tomask
     
    101116    // -addmask
    102117    psMetadata *addmaskArgs = psMetadataAlloc();
    103     psMetadataAddStr(addmaskArgs, PS_LIST_TAIL, "-magic_id", 0,            "define magictool ID (required)", NULL);
    104     psMetadataAddStr(addmaskArgs, PS_LIST_TAIL, "-uri",  0,            "define URI (required)", NULL);
     118    psMetadataAddStr(addmaskArgs, PS_LIST_TAIL, "-magic_id", 0,          "define magictool ID (required)", NULL);
     119    psMetadataAddStr(addmaskArgs, PS_LIST_TAIL, "-uri",  0, "define URI", NULL);
     120    psMetadataAddS32(addmaskArgs, PS_LIST_TAIL, "-streaks",  0, "define number of streaks", 0);
     121    psMetadataAddS16(addmaskArgs, PS_LIST_TAIL, "-code",  0, "set fault code", 0);
    105122
     123# if (0)
    106124    // -toskyfilemask
    107125    psMetadata *toskyfilemaskArgs = psMetadataAlloc();
     
    115133    psMetadataAddStr(addskyfilemaskArgs, PS_LIST_TAIL, "-diff_id",  0,            "define difftool ID (required)", NULL);
    116134    psMetadataAddStr(addskyfilemaskArgs, PS_LIST_TAIL, "-uri",  0,            "define URI (required)", NULL);
     135# endif
     136
     137    // -mask
     138    psMetadata *maskArgs = psMetadataAlloc();
     139    psMetadataAddStr(maskArgs, PS_LIST_TAIL, "-magic_id", 0, "define magictool ID", NULL);
     140    psMetadataAddU64(maskArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0);
     141    psMetadataAddBool(maskArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false);
    117142
    118143    psFree(now);
     
    121146    psMetadata *modes   = psMetadataAlloc();
    122147
    123     PXOPT_ADD_MODE("-definebyquery",           "", MAGICTOOL_MODE_DEFINEBYQUERY,           queueArgs);
     148    PXOPT_ADD_MODE("-definebyquery",   "", MAGICTOOL_MODE_DEFINEBYQUERY,   queueArgs);
    124149    PXOPT_ADD_MODE("-definerun",       "", MAGICTOOL_MODE_DEFINERUN,       definerunArgs);
    125150    PXOPT_ADD_MODE("-updaterun",       "", MAGICTOOL_MODE_UPDATERUN,       updaterunArgs);
    126151    PXOPT_ADD_MODE("-addinputskyfile", "", MAGICTOOL_MODE_ADDINPUTSKYFILE, addinputskyfileArgs);
    127152    PXOPT_ADD_MODE("-inputskyfile",    "", MAGICTOOL_MODE_INPUTSKYFILE,    inputskyfileArgs);
     153    PXOPT_ADD_MODE("-totree",          "", MAGICTOOL_MODE_TOTREE,          totreeArgs);
    128154    PXOPT_ADD_MODE("-inputtree",       "", MAGICTOOL_MODE_INPUTTREE,       inputtreeArgs);
    129155    PXOPT_ADD_MODE("-toprocess",       "", MAGICTOOL_MODE_TOPROCESS,       toprocessArgs);
     156    PXOPT_ADD_MODE("-inputs",          "", MAGICTOOL_MODE_INPUTS,          inputsArgs);
    130157    PXOPT_ADD_MODE("-addresult",       "", MAGICTOOL_MODE_ADDRESULT,       addresultArgs);
    131158    PXOPT_ADD_MODE("-tomask",          "", MAGICTOOL_MODE_TOMASK,          tomaskArgs);
    132159    PXOPT_ADD_MODE("-addmask",         "", MAGICTOOL_MODE_ADDMASK,         addmaskArgs);
    133     PXOPT_ADD_MODE("-toskyfilemask",   "", MAGICTOOL_MODE_TOSKYFILEMASK,   toskyfilemaskArgs);
    134     PXOPT_ADD_MODE("-addskyfilemask",  "", MAGICTOOL_MODE_ADDSKYFILEMASK,  addskyfilemaskArgs);
     160    PXOPT_ADD_MODE("-mask",            "", MAGICTOOL_MODE_MASK,            maskArgs);
    135161
    136162    if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
  • branches/eam_branch_20080706/ippTools/src/pxwarp.c

    r18029 r18530  
    7474    }
    7575
    76     psString query = psStringCopy("UPDATE warpRun JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET state = '%s'");
     76    psString query = psStringCopy("UPDATE warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET warpRun.state = '%s'");
    7777
    7878    if (where) {
    7979        psString whereClause = psDBGenerateWhereSQL(where, NULL);
    80         psStringAppend(&query, " %s", whereClause);
     80        if (whereClause && strlen(whereClause) > 0) {
     81            psStringAppend(&query, " %s", whereClause);
     82        }
    8183        psFree(whereClause);
    8284    }
     
    115117    // note label == NULL should be explicitly allowed
    116118
    117     psString query = psStringCopy("UPDATE warpRun JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET warpRun.label = '%s'");
     119    psString query = psStringCopy("UPDATE warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET warpRun.label = '%s'");
    118120
    119121    if (where) {
  • branches/eam_branch_20080706/psModules/src/imcombine/pmPSFEnvelope.c

    r16833 r18530  
    3434#define PEAK_FLUX 1.0e4                 // Peak flux for each source
    3535#define SKY_VALUE 0.0e0                 // Sky value for fake image
    36 #define WEIGHT_VAL 1.0                  // Weighting for image
     36#define WEIGHT_VAL 10.0                 // Weighting for image
     37#define WEIGHT_FACTOR 10.0              // Factor to multiply image by to get weighting
    3738#define PSF_STATS PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV // Statistics options for measuring PSF
    3839
     
    199200    psFree(envelope);
    200201
    201     // XXX This seems the best way to set the weight image so that pixels aren't rejected as "insignificant"
    202     readout->weight = (psImage*)psBinaryOp(NULL, readout->image, "*", readout->image);
     202    // XXX Setting the weight seems to be an art
     203    // Can't set it too high so that pixels are rejected as insignificant
     204    // Can't set it too low so that it's hard to get to the minimum
     205    // Have also tried:
     206    // *** readout->weight = (psImage*)psBinaryOp(NULL, readout->image, "*", readout->image);
     207    // *** readout->weight = (psImage*)psBinaryOp(NULL, readout->image, "*", psScalarAlloc(WEIGHT_FACTOR, PS_TYPE_F32));
     208    readout->weight = (psImage*)psBinaryOp(NULL, readout->image, "+", psScalarAlloc(PS_SQR(WEIGHT_VAL), PS_TYPE_F32));
    203209    readout->mask = psImageAlloc(numCols, numRows, PS_TYPE_MASK);
    204210    psImageInit(readout->mask, 0);
     
    258264    options->psfFieldYo = 0;
    259265
    260     pmSourceFitModelInit (15, 0.01, WEIGHT_VAL, options->poissonErrorsPhotLMM);
     266    pmSourceFitModelInit(50, 0.01, WEIGHT_VAL, false);
    261267
    262268    pmPSFtry *try = pmPSFtryModel(fakes, modelName, options, 0, 0xff);
  • branches/eam_branch_20080706/psModules/src/imcombine/pmStackReject.c

    r17299 r18530  
    2323    PS_ASSERT_ARRAY_NON_NULL(kernels, NULL);
    2424    PS_ASSERT_ARRAYS_SIZE_EQUAL(subRegions, kernels, NULL);
     25
     26    // Trivial case
     27    if (in->n == 0) {
     28        return psPixelsAllocEmpty(0);
     29    }
    2530
    2631    // Get the original image size
Note: See TracChangeset for help on using the changeset viewer.