IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 13, 2006, 5:10:34 PM (20 years ago)
Author:
eugene
Message:

all sorts of error handling fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastro.c

    r9374 r9574  
    11# include "psastro.h"
     2
     3static void usage (void) {
     4    psErrorStackPrint(stderr, "USAGE: psastro [-file image(s)] [-list imagelist] (output)");
     5    exit (2);
     6}
    27
    38int main (int argc, char **argv) {
     
    1116    // load configuration information
    1217    pmConfig *config = psastroArguments (argc, argv);
     18    if (!config) usage ();
    1319
    1420    // load identify the data sources
    15     psastroParseCamera (config);
     21    if (!psastroParseCamera (config)) {
     22        psErrorStackPrint(stderr, "error setting up the camera");
     23        exit (1);
     24    }
    1625
    1726    // load the raw pixel data (from PSPHOT.SOURCES)
    1827    // select subset of stars for astrometry
    19     psastroDataLoad (config);
     28    if (!psastroDataLoad (config)) {
     29        psErrorStackPrint(stderr, "error loading input data");
     30        exit (1);
     31    }
    2032
    2133    // interpret the available initial astrometric information
    2234    // apply the initial guess
    23     psastroAstromGuess (config);
     35    if (!psastroAstromGuess (config)) {
     36        psErrorStackPrint(stderr, "failed to determine initial astrometry guess");
     37        exit (1);
     38    }
    2439
    2540    // load the reference stars overlapping the data stars
    2641    psArray *refs = psastroLoadReferences (config);
     42    if (!refs) {
     43        psErrorStackPrint(stderr, "failed to load reference data");
     44        exit (1);
     45    }
    2746
     47    // XXX ?? what does this do ??
    2848    psastroMosaicGetRefstars (config, refs);
    2949
    3050    char *mosastro = psMetadataLookupStr (NULL, config->arguments, "MOSASTRO");
    3151    if (mosastro == NULL) {
    32         psastroChipAstrom (config, refs);
     52        if (!psastroChipAstrom (config, refs)) {
     53            psErrorStackPrint(stderr, "failed to perform single chip astrometry");
     54            exit (1);
     55        }
    3356    } else {
    34         psastroMosaicAstrom (config, refs);
     57        if (!psastroMosaicAstrom (config, refs)) {
     58            psErrorStackPrint(stderr, "failed to perform mosaic camera astrometry");
     59            exit (1);
     60        }
    3561    }
    3662
     
    3965
    4066    // write out the results
    41     psastroDataSave (config);
     67    if (!psastroDataSave (config)) {
     68        psErrorStackPrint(stderr, "failed to write out data");
     69        exit (1);
     70    }
    4271
    4372    psLogMsg ("psastro", 3, "complete psastro run: %f sec\n", psTimerMark ("complete"));
Note: See TracChangeset for help on using the changeset viewer.