IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8279


Ignore:
Timestamp:
Aug 10, 2006, 3:16:23 PM (20 years ago)
Author:
jhoblitt
Message:

big database scheme change -- now partially normalized
full implement p0search -updateexp through p2 (p1 support is unimplemented)
delete "frame" level functions from p0search as they are now unused

Location:
trunk/ippTools/src
Files:
5 edited

Legend:

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

    r8248 r8279  
    474474        iteration,
    475475        rawExp->exp_id,
    476         rawExp->camera,
    477         rawExp->telescope,
    478         rawExp->exp_type,
    479         rawExp->imfiles,
    480         rawExp->filter,
    481         rawExp->airmass,
    482         rawExp->ra,
    483         rawExp->decl,
    484         rawExp->exp_time,
    485         rawExp->background
     476        true,   // use
     477        false   // accept
    486478    );
    487479}
     
    17881780        return false;
    17891781    }
     1782    psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");
     1783    if (!status) {
     1784        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id");
     1785        return false;
     1786    }
     1787    if (!class_id) {
     1788        psError(PS_ERR_UNKNOWN, true, "-class_id is required");
     1789        return false;
     1790    }
    17901791    psString recipe = psMetadataLookupStr(&status, config->args, "-recip");
    17911792    if (!status) {
     
    18441845                iteration,
    18451846                exp_id,
     1847                class_id,
    18461848                recipe,
    18471849                accept
     
    21492151            newIteration,
    21502152            inputExp->exp_id,
    2151             inputExp->camera,
    2152             inputExp->telescope,
    2153             inputExp->exp_type,
    2154             inputExp->imfiles,
    2155             inputExp->filter,
    2156             inputExp->airmass,
    2157             inputExp->ra,
    2158             inputExp->decl,
    2159             inputExp->exp_time,
    2160             inputExp->background
     2153            true,   // use
     2154            true    // accept
    21612155        );
    21622156        psArrayAdd(newInputExps, 0, newInputExp);
  • trunk/ippTools/src/p2insertPendingFrames.c

    r8121 r8279  
    4141        p2PendingExpRow *pendingExposure = p2PendingExpRowAlloc(
    4242            rawFrame->exposure->exp_id,
    43             rawFrame->exposure->camera,
    44             rawFrame->exposure->telescope,
    45             rawFrame->exposure->exp_type,
    46             rawFrame->exposure->imfiles,
    47             rawFrame->exposure->filter,
    48             rawFrame->exposure->airmass,
    49             rawFrame->exposure->ra,
    50             rawFrame->exposure->decl,
    51             rawFrame->exposure->exp_time,
    52             rawFrame->exposure->background,
    5343            "my recipe",
    5444            0xff,
  • trunk/ippTools/src/p2pendingToDone.c

    r8121 r8279  
    1818        p2DoneExpRow *doneExposure = p2DoneExpRowAlloc(
    1919            pendingFrame->exposure->exp_id,
    20             pendingFrame->exposure->camera,
    21             pendingFrame->exposure->telescope,
    22             pendingFrame->exposure->exp_type,
    23             pendingFrame->exposure->imfiles,
    24             pendingFrame->exposure->filter,
    25             pendingFrame->exposure->airmass,
    26             pendingFrame->exposure->ra,
    27             pendingFrame->exposure->decl,
    28             pendingFrame->exposure->exp_time,
    29             pendingFrame->exposure->background,
    3020            "my recipe",
    3121            pendingFrame->exposure->p1_version,
     
    7060    p2DoneExpRow *doneExp = p2DoneExpRowAlloc(
    7161        pendingExp->exp_id,
    72         pendingExp->camera,
    73         pendingExp->telescope,
    74         pendingExp->exp_type,
    75         pendingExp->imfiles, // XXX ndone is uneeded?
    76         pendingExp->filter,
    77         pendingExp->airmass,
    78         pendingExp->ra,
    79         pendingExp->decl,
    80         pendingExp->exp_time,
    81         pendingExp->background,
    8262        "my recipe",
    8363        pendingExp->p1_version,
  • trunk/ippTools/src/regtool.c

    r8268 r8279  
    1212static bool updateexpMode(pxConfig *config);
    1313static bool updateimfileMode(pxConfig *config);
    14 static psArray *newFrameSearchPending(pxConfig *config);
    15 static p1PendingExpRow *newToP1PendingExp(newExpRow *newExp);
     14// static p1PendingExpRow *newToP1PendingExp(newExpRow *newExp);
    1615static p2PendingExpRow *newToP2PendingExp(pxConfig *config, newExpRow *newExp);
    17 static p2PendingImfileRow *newImfileToP2PendingImfile(newImfileRow *newImfile);
    18 static rawScienceFrame *newToRawScienceFrame(pxConfig *config, newFrame *newFrame);
     16static p2PendingImfileRow *rawImfileToP2PendingImfile(pxConfig *config, rawImfileRow *rawImfile);
    1917static rawScienceExpRow *newToRawScienceExp(pxConfig *config, newExpRow *exp);
    2018static rawDetrendExpRow *newToRawDetrendExp(pxConfig *config, newExpRow *exp);
     
    179177        if (!status) {
    180178            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
     179            psFree(query);
    181180            return false;
    182181        }
     
    188187    if (!p_psDBRunQuery(config->dbh, query)) {
    189188        psError(PS_ERR_UNKNOWN, false, "database error");
    190         return false;
    191     }
     189        psFree(query);
     190        return false;
     191    }
     192    psFree(query);
    192193
    193194    psArray *output = p_psDBFetchResult(config->dbh);
     
    205206    }
    206207
     208    // start a transaction so we don't end up with an exp in
     209    // rawScience/DetrendExp and in newExp
     210    if (!psDBTransaction(config->dbh)) {
     211        psError(PS_ERR_UNKNOWN, false, "database error");
     212        psFree(output);
     213        return false;
     214    }
     215
     216    // if it's a detrend exp
     217    if (detrend) {       
     218        for (long i = 0; psArrayLength(output) > i; i++) {
     219            psMetadata *row = output->data[i];
     220            // convert metadata into a newExp object
     221            newExpRow *newExp = newExpObjectFromMetadata(row);
     222            // convert newExp object into a rawDetrendExp object
     223            rawDetrendExpRow *rawExp = newToRawDetrendExp(config, newExp);
     224            if (!rawExp) {
     225                // rollback
     226                if (!psDBRollback(config->dbh)) {
     227                    psError(PS_ERR_UNKNOWN, false, "database error");
     228                }
     229                psError(PS_ERR_UNKNOWN, false, "failed to convert newExp to rawDetrendExp");
     230                psFree(newExp);
     231                psFree(output);
     232                return false;
     233            }
     234            // insert the rawDetrendExp object into the database
     235            if (!rawDetrendExpInsertObject(config->dbh, rawExp)) {
     236                // rollback
     237                if (!psDBRollback(config->dbh)) {
     238                    psError(PS_ERR_UNKNOWN, false, "database error");
     239                }
     240                psError(PS_ERR_UNKNOWN, false, "database error");
     241                psFree(rawExp);
     242                psFree(newExp);
     243                psFree(output);
     244                return false;
     245            }
     246            psFree(rawExp);
     247            // delete the newExp object from the database
     248            if (!newExpDeleteObject(config->dbh, newExp)) {
     249                // rollback
     250                if (!psDBRollback(config->dbh)) {
     251                    psError(PS_ERR_UNKNOWN, false, "database error");
     252                }
     253                psError(PS_ERR_UNKNOWN, false, "database error");
     254                psFree(newExp);
     255                psFree(output);
     256                return false;
     257            }
     258            psFree(newExp);
     259        }
     260    }
     261
     262    // else
     263    // it's a science exp
    207264    for (long i = 0; psArrayLength(output) > i; i++) {
     265        psMetadata *row = output->data[i];
     266        // convert metadata into a newExp object
     267        newExpRow *newExp = newExpObjectFromMetadata(row);
     268        // convert newExp object into a rawDetrendExp object
     269        rawScienceExpRow *rawExp = newToRawScienceExp(config, newExp);
     270        if (!rawExp) {
     271            // rollback
     272            if (!psDBRollback(config->dbh)) {
     273                psError(PS_ERR_UNKNOWN, false, "database error");
     274            }
     275            psError(PS_ERR_UNKNOWN, false, "failed to convert newExp to rawScienceExp");
     276            psFree(newExp);
     277            psFree(output);
     278            return false;
     279        }
     280        // insert the rawDetrendExp object into the database
     281        if (!rawScienceExpInsertObject(config->dbh, rawExp)) {
     282            // rollback
     283            if (!psDBRollback(config->dbh)) {
     284                psError(PS_ERR_UNKNOWN, false, "database error");
     285            }
     286            psError(PS_ERR_UNKNOWN, false, "database error");
     287            psFree(rawExp);
     288            psFree(newExp);
     289            psFree(output);
     290            return false;
     291        }
     292        psFree(rawExp);
     293        // delete the newExp object from the database
     294        if (!newExpDeleteObject(config->dbh, newExp)) {
     295            // rollback
     296            if (!psDBRollback(config->dbh)) {
     297                psError(PS_ERR_UNKNOWN, false, "database error");
     298            }
     299            psError(PS_ERR_UNKNOWN, false, "database error");
     300            psFree(newExp);
     301            psFree(output);
     302            return false;
     303        }
     304        // insert an entry into the p2PendingExp table
     305        p2PendingExpRow *p2PendingExp = newToP2PendingExp(config, newExp);
     306        if (!p2PendingExp) {
     307            psError(PS_ERR_UNKNOWN, false, "failed to convert newExp to p2PendingExp");
     308            psFree(newExp);
     309            psFree(output);
     310            return false;
     311        }
     312        // insert the p2PendingExp object into the database
     313        if (!p2PendingExpInsertObject(config->dbh, p2PendingExp)) {
     314            // rollback
     315            if (!psDBRollback(config->dbh)) {
     316                psError(PS_ERR_UNKNOWN, false, "database error");
     317            }
     318            psError(PS_ERR_UNKNOWN, false, "database error");
     319            psFree(p2PendingExp);
     320            psFree(newExp);
     321            psFree(output);
     322            return false;
     323        }
     324        psFree(p2PendingExp);
     325        // find all of the rawImfiles associated with the p2PendingExp object
     326        psArray *rawImfiles = NULL;
     327        {
     328            psMetadata *where = psMetadataAlloc();
     329            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", newExp->exp_id)) {
     330                // rollback
     331                if (!psDBRollback(config->dbh)) {
     332                    psError(PS_ERR_UNKNOWN, false, "database error");
     333                }
     334                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     335                psFree(where);
     336                psFree(newExp);
     337                psFree(output);
     338                return false;
     339            }
     340            rawImfiles = rawImfileSelectRowObjects(config->dbh, where, 0);
     341            psFree(where);
     342        }
     343        // sanity check the number of rawImfiles found
     344        if (!rawImfiles) {
     345            // rollback
     346            if (!psDBRollback(config->dbh)) {
     347                psError(PS_ERR_UNKNOWN, false, "database error");
     348            }
     349            psError(PS_ERR_UNKNOWN, false, "found no rawImfiles associated with exp_id %s", newExp->exp_id);
     350            psFree(newExp);
     351            psFree(output);
     352            return false;
     353        }
     354        if (psArrayLength(rawImfiles) != newExp->imfiles) {
     355            // rollback
     356            if (!psDBRollback(config->dbh)) {
     357                psError(PS_ERR_UNKNOWN, false, "database error");
     358            }
     359            psError(PS_ERR_UNKNOWN, false, "found %d rawImfiles but expected %d",
     360                    psArrayLength(rawImfiles), newExp->imfiles);
     361            psFree(newExp);
     362            psFree(output);
     363            return false;
     364        }
     365        // convert the rawImfiles into p2PendingImfiles and insert them into
     366        // the database
     367        for (long i = 0; i < psArrayLength(rawImfiles); i++) {
     368            rawImfileRow *rawImfile = rawImfiles->data[i];
     369            p2PendingImfileRow *pendingImfile = rawImfileToP2PendingImfile(config, rawImfile);
     370            if (!p2PendingImfileInsertObject(config->dbh, pendingImfile)){
     371                // rollback
     372                if (!psDBRollback(config->dbh)) {
     373                    psError(PS_ERR_UNKNOWN, false, "database error");
     374                }
     375                psError(PS_ERR_UNKNOWN, false, "database error");
     376                psFree(pendingImfile);
     377                psFree(rawImfiles);
     378                psFree(newExp);
     379                psFree(output);
     380            }
     381            psFree(pendingImfile);
     382        }
     383        psFree(rawImfiles);
     384        psFree(newExp);
     385    }
     386
     387    psFree(output);
     388
     389    if (!psDBCommit(config->dbh)) {
     390        psError(PS_ERR_UNKNOWN, false, "database error");
     391        return false;
    208392    }
    209393
     
    349533}
    350534
    351 #if 0
    352 static psArray *newFrameSearchPending(pxConfig *config)
    353 {
    354     PS_ASSERT_PTR_NON_NULL(config, NULL);
    355 
    356     char *query = "select newImfile.* from newImfile
    357         LEFT JOIN newExp USING(exp_id)
    358         LEFT JOIN rawScienceExp USING(exp_id)
    359         LEFT JOIN rawDetrendExp USING (exp_id)
    360         WHERE newExp.exp_id is NOT NULL
    361         AND rawScienceExp.exp_id IS NULL
    362         AND rawDetrendExp.exp_id IS NULL";
    363 
    364     if (!p_psDBRunQuery(config->dbh, query)) {
    365         psError(PS_ERR_UNKNOWN, false, "database error");
    366         return false;
    367     }
    368 
    369     psArray *newExp = p_psDBFetchResult(config->dbh);
    370     if (!output) {
    371         // XXX check psError here
    372         psError(PS_ERR_UNKNOWN, false, "failed to fetch the database result");
    373         return false;
    374     }
    375 
    376     for (long i = 0; i < psArrayLength(newExp); i++) {
    377         newExpRow *exp = newExp->data[i];
    378         psMetadata *where = psMetadataAlloc();
    379         if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, NULL, exp->exp_id)) {
    380             psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    381             psFree(where);
    382             psFree(newExp);
    383             return NULL;
    384         }
    385         new
    386 
    387         psFree(where);
    388     }
    389 
    390 
    391     return new;
    392 }
    393 
    394 #endif
    395 
     535# if 0
    396536static p1PendingExpRow *newToP1PendingExp(newExpRow *newExp)
    397537{
     
    412552    );
    413553}
     554#endif
    414555
    415556static p2PendingExpRow *newToP2PendingExp(pxConfig *config, newExpRow *exp)
     
    418559    PS_ASSERT_PTR_NON_NULL(exp, NULL);
    419560
    420     bool status = false;
    421     psString filter = psMetadataLookupStr(&status, config->args, "-filter");
    422     if (!status) {
    423         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -filter");
    424         return false;
    425     }
    426     if (!filter) {
    427         psError(PS_ERR_UNKNOWN, true, "-filter is required");
    428         return false;
    429     }
    430     psF32 airmass = psMetadataLookupF32(&status, config->args, "-airmass");
    431     if (!status) {
    432         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -airmass");
    433         return false;
    434     }
    435     if (isnan(airmass)) {
    436         psError(PS_ERR_UNKNOWN, true, "-airmass is required");
    437         return false;
    438     }
    439     psF64 ra = psMetadataLookupF64(&status, config->args, "-ra");
    440     if (!status) {
    441         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -ra");
    442         return false;
    443     }
    444     if (isnan(ra)) {
    445         psError(PS_ERR_UNKNOWN, true, "-ra is required");
    446         return false;
    447     }
    448     psF64 decl = psMetadataLookupF64(&status, config->args, "-decl");
    449     if (!status) {
    450         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -decl");
    451         return false;
    452     }
    453     if (isnan(decl)) {
    454         psError(PS_ERR_UNKNOWN, true, "-decl is required");
    455         return false;
    456     }
    457     psF32 exp_time = psMetadataLookupF32(&status, config->args, "-exp_time");
    458     if (!status) {
    459         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_time");
    460         return false;
    461     }
    462     if (isnan(exp_time)) {
    463         psError(PS_ERR_UNKNOWN, true, "-exp_time is required");
    464         return false;
    465     }
    466     psF64 background = psMetadataLookupF64(&status, config->args, "-background");
    467     if (!status) {
    468         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -background");
    469         return false;
    470     }
    471     if (isnan(background)) {
    472         psError(PS_ERR_UNKNOWN, true, "-background is required");
    473         return false;
    474     }
    475 
    476561    return p2PendingExpRowAlloc(
    477562        exp->exp_id,
    478         exp->camera,
    479         exp->telescope,
    480         exp->exp_type,
    481         exp->imfiles,
    482         filter,
    483         airmass,
    484         ra,
    485         decl,
    486         exp_time,
    487         background,
    488563        "my recipe",
    489564        0xff, // XXX calc version number
     
    492567}
    493568
    494 static p2PendingImfileRow *newImfileToP2PendingImfile(newImfileRow *newImfile)
     569static p2PendingImfileRow *rawImfileToP2PendingImfile(pxConfig *config, rawImfileRow *rawImfile)
    495570{
    496571    return p2PendingImfileRowAlloc(
    497         newImfile->exp_id,
    498         newImfile->class_id,
    499         newImfile->uri,
     572        rawImfile->exp_id,
     573        rawImfile->class_id,
     574        rawImfile->uri,
    500575        "my recipe",
    501576        0xff, // XXX calc version number
     
    504579}
    505580
    506 #if 0
    507 static rawScienceFrame *newToRawScienceFrame(pxConfig *config, newFrame *newFrame)
    508 {
    509     PS_ASSERT_PTR_NON_NULL(config, NULL);
    510     PS_ASSERT_PTR_NON_NULL(newFrame, NULL);
    511 
    512     newExpRow *newExp = newFrame->exposure;
    513     rawScienceExpRow *rawScienceExp = newToRawScienceExp(config, newExp);
    514     if (!rawScienceExp) {
    515         psError(PS_ERR_UNKNOWN, false, "failed to convert newExp to rawScienceExp");
    516         return NULL;
    517     }
    518 
    519     psArray *newImages = newFrame->images;
    520     psArray *rawImages = psArrayAlloc(psArrayLength(newImages));
    521     for (long i = 0; i < psArrayLength(newImages); i++) {
    522         newImfileRow *newImfile = newImages->data[i];
    523         rawImfileRow *rawImfile = rawImfileRowAlloc(
    524             newImfile->exp_id,
    525             newImfile->class,
    526             newImfile->class_id,
    527             newImfile->uri
    528         );
    529         psArrayAdd(rawImages, 0, rawImfile);
    530         psFree(rawImfile);
    531     }
    532 
    533     rawScienceFrame *rawScienceFrame = rawScienceFrameAlloc(rawScienceExp, rawImages);
    534     psFree(rawScienceExp);
    535     psFree(rawImages);
    536 
    537     return rawScienceFrame;
    538 }
    539 
    540 #endif
    541 
    542581static rawScienceExpRow *newToRawScienceExp(pxConfig *config, newExpRow *exp)
    543582{
     
    545584    PS_ASSERT_PTR_NON_NULL(exp, NULL);
    546585
    547     bool status = false;
    548     psString filter = psMetadataLookupStr(&status, config->args, "-filter");
    549     if (!status) {
    550         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -filter");
    551         return NULL;
    552     }
    553     if (!filter) {
    554         psError(PS_ERR_UNKNOWN, true, "-filter is required");
    555         return NULL;
    556     }
    557     psF32 airmass = psMetadataLookupF32(&status, config->args, "-airmass");
    558     if (!status) {
    559         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -airmass");
    560         return NULL;
    561     }
    562     if (isnan(airmass)) {
    563         psError(PS_ERR_UNKNOWN, true, "-airmass is required");
    564         return NULL;
    565     }
    566     psF64 ra = psMetadataLookupF64(&status, config->args, "-ra");
    567     if (!status) {
    568         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -ra");
    569         return NULL;
    570     }
    571     if (isnan(ra)) {
    572         psError(PS_ERR_UNKNOWN, true, "-ra is required");
    573         return NULL;
    574     }
    575     psF64 decl = psMetadataLookupF64(&status, config->args, "-decl");
    576     if (!status) {
    577         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -decl");
    578         return NULL;
    579     }
    580     if (isnan(decl)) {
    581         psError(PS_ERR_UNKNOWN, true, "-decl is required");
    582         return NULL;
    583     }
    584     psF32 exp_time = psMetadataLookupF32(&status, config->args, "-exp_time");
    585     if (!status) {
    586         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_time");
    587         return NULL;
    588     }
    589     if (isnan(exp_time)) {
    590         psError(PS_ERR_UNKNOWN, true, "-exp_time is required");
    591         return NULL;
    592     }
    593     psF64 background = psMetadataLookupF64(&status, config->args, "-background");
    594     if (!status) {
    595         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -background");
    596         return NULL;
    597     }
    598     if (isnan(background)) {
    599         psError(PS_ERR_UNKNOWN, true, "-background is required");
    600         return NULL;
    601     }
    602 
    603     return rawScienceExpRowAlloc(
    604         exp->exp_id,
    605         exp->camera,
    606         exp->telescope,
    607         exp->exp_type,
    608         exp->imfiles,
    609         filter,
    610         airmass,
    611         ra,
    612         decl,
    613         exp_time,
    614         background
    615     );
     586    // XXX this is dangerous but we should be able to get away with this as
     587    // long rawScienceExp & rawDetrendExp are idetnical
     588    return (rawScienceExpRow *)newToRawDetrendExp(config, exp);
    616589}
    617590
     
    667640        return false;
    668641    }
    669     psF64 background = psMetadataLookupF64(&status, config->args, "-background");
    670     if (!status) {
    671         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -background");
    672         return false;
    673     }
    674     if (!exp_time) {
    675         psError(PS_ERR_UNKNOWN, true, "-background is required");
     642    psF64 bg = psMetadataLookupF64(&status, config->args, "-bg");
     643    if (!status) {
     644        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg");
     645        return false;
     646    }
     647    if (isnan(bg)) {
     648        psError(PS_ERR_UNKNOWN, true, "-bg is required");
     649        return false;
     650    }
     651    psF64 bg_stdev = psMetadataLookupF64(&status, config->args, "-bg_stdev");
     652    if (!status) {
     653        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg_stdev");
     654        return false;
     655    }
     656    if (isnan(bg_stdev)) {
     657        psError(PS_ERR_UNKNOWN, true, "-bg_stdev is required");
     658        return false;
     659    }
     660    psF64 bg_mean_stdev = psMetadataLookupF64(&status, config->args, "-bg_mean_stdev");
     661    if (!status) {
     662        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg_mean_stdev");
     663        return false;
     664    }
     665    if (isnan(bg_mean_stdev)) {
     666        psError(PS_ERR_UNKNOWN, true, "-bg_mean_stdev is required");
     667        return false;
     668    }
     669    psF64 alt = psMetadataLookupF64(&status, config->args, "-alt");
     670    if (!status) {
     671        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -alt");
     672        return false;
     673    }
     674    if (isnan(alt)) {
     675        psError(PS_ERR_UNKNOWN, true, "-alt is required");
     676        return false;
     677    }
     678    psF64 az = psMetadataLookupF64(&status, config->args, "-az");
     679    if (!status) {
     680        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -az");
     681        return false;
     682    }
     683    if (isnan(az)) {
     684        psError(PS_ERR_UNKNOWN, true, "-az is required");
     685        return false;
     686    }
     687    psF32 ccd_temp = psMetadataLookupF32(&status, config->args, "-ccd_temp");
     688    if (!status) {
     689        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -ccd_temp");
     690        return false;
     691    }
     692    if (isnan(ccd_temp)) {
     693        psError(PS_ERR_UNKNOWN, true, "-ccd_temp is required");
     694        return false;
     695    }
     696    psF64 posang = psMetadataLookupF32(&status, config->args, "-posang");
     697    if (!status) {
     698        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -posang");
     699        return false;
     700    }
     701    if (isnan(posang)) {
     702        psError(PS_ERR_UNKNOWN, true, "-posang is required");
    676703        return false;
    677704    }
     
    688715        decl,
    689716        exp_time,
    690         background
     717        bg,
     718        bg_stdev,
     719        bg_mean_stdev,
     720        alt,
     721        az,
     722        ccd_temp,
     723        posang
    691724    );
    692725}
     
    752785        return false;
    753786    }
    754     psF64 bg_stdev = psMetadataLookupF64(&status, config->args, "-bg");
     787    psF64 bg_stdev = psMetadataLookupF64(&status, config->args, "-bg_stdev");
    755788    if (!status) {
    756789        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg_stdev");
     
    761794        return false;
    762795    }
    763     psF64 bg_mean_stdev = psMetadataLookupF64(&status, config->args, "-bg");
     796    psF64 bg_mean_stdev = psMetadataLookupF64(&status, config->args, "-bg_mean_stdev");
    764797    if (!status) {
    765798        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg_mean_stdev");
     
    770803        return false;
    771804    }
    772     psF64 alt = psMetadataLookupF64(&status, config->args, "-bg");
     805    psF64 alt = psMetadataLookupF64(&status, config->args, "-alt");
    773806    if (!status) {
    774807        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -alt");
     
    779812        return false;
    780813    }
    781     psF64 az = psMetadataLookupF64(&status, config->args, "-bg");
     814    psF64 az = psMetadataLookupF64(&status, config->args, "-az");
    782815    if (!status) {
    783816        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -az");
     
    788821        return false;
    789822    }
    790     psF32 ccd_temp = psMetadataLookupF32(&status, config->args, "-bg");
     823    psF32 ccd_temp = psMetadataLookupF32(&status, config->args, "-ccd_temp");
    791824    if (!status) {
    792825        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -ccd_temp");
     
    797830        return false;
    798831    }
    799     psF64 posang = psMetadataLookupF32(&status, config->args, "-bg");
     832    psF64 posang = psMetadataLookupF32(&status, config->args, "-posang");
    800833    if (!status) {
    801834        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -posang");
  • trunk/ippTools/src/regtoolConfig.c

    r8268 r8279  
    6565    psMetadataAddF64(updateexpArgs, PS_LIST_TAIL, "-background",  0,
    6666        "define exposue background", NAN);
     67    psMetadataAddF64(updateexpArgs, PS_LIST_TAIL, "-bg",  0,
     68        "define exposue background", NAN);
     69    psMetadataAddF64(updateexpArgs, PS_LIST_TAIL, "-bg_stdev",  0,
     70        "define exposue background stdev", NAN);
     71    psMetadataAddF64(updateexpArgs, PS_LIST_TAIL, "-bg_mean_stdev",  0,
     72        "define exposue background mean stdev", NAN);
     73    psMetadataAddF64(updateexpArgs, PS_LIST_TAIL, "-alt",  0,
     74        "define altitute", NAN);
     75    psMetadataAddF64(updateexpArgs, PS_LIST_TAIL, "-az",  0,
     76        "define azimuth", NAN);
     77    psMetadataAddF64(updateexpArgs, PS_LIST_TAIL, "-ccd_temp",  0,
     78        "define ccd tempature", NAN);
     79    psMetadataAddF64(updateexpArgs, PS_LIST_TAIL, "-posang",  0,
     80        "define rotator position angle", NAN);
    6781    /*
    6882    psMetadataAddStr(updateArgs, PS_LIST_TAIL, "-recip",  0,
     
    96110    psMetadataAddF64(updateimfileArgs, PS_LIST_TAIL, "-background_stdev",  0,
    97111        "define exposue background standard dev.", NAN);
     112    psMetadataAddF64(updateimfileArgs, PS_LIST_TAIL, "-bg_stdev",  0,
     113        "define exposue background stdev", NAN);
     114    psMetadataAddF64(updateimfileArgs, PS_LIST_TAIL, "-bg_mean_stdev",  0,
     115        "define exposue background mean stdev", NAN);
     116    psMetadataAddF64(updateimfileArgs, PS_LIST_TAIL, "-alt",  0,
     117        "define altitute", NAN);
     118    psMetadataAddF64(updateimfileArgs, PS_LIST_TAIL, "-az",  0,
     119        "define azimuth", NAN);
     120    psMetadataAddF64(updateimfileArgs, PS_LIST_TAIL, "-ccd_temp",  0,
     121        "define ccd tempature", NAN);
     122    psMetadataAddF64(updateimfileArgs, PS_LIST_TAIL, "-posang",  0,
     123        "define rotator position angle", NAN);
     124
    98125
    99126#define PXTOOL_MODE(option, modeval, argset) \
Note: See TracChangeset for help on using the changeset viewer.