IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9574


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

all sorts of error handling fixes

Location:
trunk/psastro/src
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/Makefile.am

    r7573 r9574  
    3131psastroMosaicHeaders.c      \
    3232psastroMosaicRescaleChips.c \
    33 psastroWCS.c       
     33psastroWCS.c                \
     34psastroErrorCodes.c
    3435
    3536include_HEADERS = \
     
    4445
    4546### Error codes.
    46 #BUILT_SOURCES = psastroErrorCodes.h psastroErrorCodes.c
    47 #CLEANFILES = psastroErrorCodes.h psastroErrorCodes.c
     47BUILT_SOURCES = psastroErrorCodes.h psastroErrorCodes.c
     48CLEANFILES = psastroErrorCodes.h psastroErrorCodes.c
    4849
    49 #psastroErrorCodes.h : psastroErrorCodes.dat psastroErrorCodes.h.in
    50 #       $(ERRORCODES) --data=psastroErrorCodes.dat --outdir=. psastroErrorCodes.h
     50psastroErrorCodes.h : psastroErrorCodes.dat psastroErrorCodes.h.in
     51        $(ERRORCODES) --data=psastroErrorCodes.dat --outdir=. psastroErrorCodes.h
    5152
    52 #psastroErrorCodes.c : psastroErrorCodes.dat psastroErrorCodes.c.in psastroErrorCodes.h
    53 #       $(ERRORCODES) --data=psastroEerrorCodes.dat --outdir=. psastroErrorCodes.c
     53psastroErrorCodes.c : psastroErrorCodes.dat psastroErrorCodes.c.in psastroErrorCodes.h
     54        $(ERRORCODES) --data=psastroErrorCodes.dat --outdir=. psastroErrorCodes.c
  • 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"));
  • trunk/psastro/src/psastro.h

    r9373 r9574  
    99# include <pslib.h>
    1010# include <psmodules.h>
     11
     12# include "psastroErrorCodes.h"
    1113
    1214# define psMemCopy(A)(psMemIncrRefCounter((A)))
     
    3739bool              psastroOneChip (pmFPA *fpa, pmChip *chip, psArray *refset, psArray *rawset, psMetadata *recipe, psMetadata *updates);
    3840
    39 // bool              psVectorSmooth (psVector *vector, double sigma, double Nsigma);
    40 
    4141// utility functions:
    4242bool              psastroUpdateChipToFPA (pmFPA *fpa, pmChip *chip, psArray *rawstars, psArray *refstars);
  • trunk/psastro/src/psastroArguments.c

    r9373 r9574  
    11# include "psastro.h"
    22# include <glob.h>
    3 // XXX leak free 2006.04.27
    4 
    5 static void usage (void) {
    6     fprintf (stderr, "USAGE: psastro [-file image(s)] [-list imagelist] (output)\n");
    7     exit (2);
    8 }
    93
    104pmConfig *psastroArguments (int argc, char **argv) {
     
    137    int N;
    148
    15     if (argc == 1) usage ();
     9    if (argc == 1) {
     10        psError(PSASTRO_ERR_ARGUMENTS, true, "No arguments supplied");
     11        return NULL;
     12    }
    1613
    1714    // basic pslib options
     
    5047
    5148    status = pmConfigFileSetsMD (config->arguments, config, "INPUT", "-file", "-list");
    52     if (!status) { usage ();}
    53 
    54     if (argc != 2) usage ();
    55 
     49    if (!status) {
     50        psError(PSASTRO_ERR_ARGUMENTS, true, "Missing -file (input) or -list (input)");
     51        return NULL;
     52    }
     53   
     54    if (argc != 2) {
     55        psError(PSASTRO_ERR_ARGUMENTS, true, "Incorrect arguments supplied");
     56        return NULL;
     57    }
     58   
    5659    // output positions is fixed
    5760    psMetadataAddStr (config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "", argv[1]);
    5861
    59     psTrace(__func__, 1, "Done with psastroArguments...\n");
     62    psTrace("psastro", 1, "Done with psastroArguments...\n");
    6063    return (config);
    6164}
  • trunk/psastro/src/psastroAstromGuess.c

    r9374 r9574  
    2626    psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, "PSASTRO");
    2727    if (!recipe) {
    28         psErrorStackPrint(stderr, "Can't find PSASTRO recipe!\n");
    29         exit(EXIT_FAILURE);
     28        psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe!");
     29        return false;
    3030    }
    3131
     
    3333    pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
    3434    if (!input) {
    35         psErrorStackPrint(stderr, "Can't find input data!\n");
    36         exit(EXIT_FAILURE);
     35        psError(PSASTRO_ERR_CONFIG, true, "Can't find input data");
     36        return false;
    3737    }
    3838
     
    4545
    4646    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
    47         psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     47        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    4848        if (!chip->process || !chip->file_exists) { continue; }
    4949
     
    6363        // XXX should this go into a different function? this would separate WCS interpretation from application
    6464        while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
    65             psTrace (__func__, 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     65            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    6666            if (!cell->process || !cell->file_exists) { continue; }
    6767
     
    8080                    p_psDeproject (raw->sky, raw->TP, fpa->projection);
    8181
    82                     if (i < 0) {
     82                    if ((i < 10) && (psTraceGetLevel("psastro.guess") > 5)) {
    8383                        fprintf (stderr, "up: %f,%f -> %f,%f -> %f,%f -> %f,%f\n",
    8484                                 raw->chip->x, raw->chip->y,
  • trunk/psastro/src/psastroChipAstrom.c

    r9374 r9574  
    1111    psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, "PSASTRO");
    1212    if (!recipe) {
    13         psErrorStackPrint(stderr, "Can't find PSASTRO recipe!\n");
    14         exit(EXIT_FAILURE);
     13        psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe");
     14        return false;
    1515    }
    1616
     
    1818    pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
    1919    if (!input) {
    20         psErrorStackPrint(stderr, "Can't find input data!\n");
    21         exit(EXIT_FAILURE);
     20        psError(PSASTRO_ERR_CONFIG, true, "Can't find input data");
     21        return false;
    2222    }
    2323
     
    2929
    3030    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
    31         psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     31        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    3232        if (!chip->process || !chip->file_exists) { continue; }
    3333       
    3434        while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
    35             psTrace (__func__, 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     35            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    3636            if (!cell->process || !cell->file_exists) { continue; }
    3737
  • trunk/psastro/src/psastroConvert.c

    r9374 r9574  
    1010 
    1111    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
    12         psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     12        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    1313        if (!chip->process || !chip->file_exists) { continue; }
    1414
    1515        while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
    16             psTrace (__func__, 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     16            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    1717            if (!cell->process || !cell->file_exists) { continue; }
    1818
  • trunk/psastro/src/psastroDataLoad.c

    r9374 r9574  
    11# include "psastro.h"
    2 // XXX leak free 2006.04.27
    3 
    42// this loop loads the data from the input files and selects the
    53// brighter stars for astrometry
    64// at the end of this function, the complete stellar data is loaded
    75// into the correct fpa structure locations (readout.analysis:PSPHOT.SOURCES)
    8 //
     6
    97// all of the different astrometry analysis modes use the same data load loop
    108bool psastroDataLoad (pmConfig *config) {
     
    1715    psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, "PSASTRO");
    1816    if (!recipe) {
    19         psErrorStackPrint(stderr, "Can't find PSASTRO recipe!\n");
    20         exit(EXIT_FAILURE);
     17        psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe!\n");
     18        return false;
    2119    }
    2220
     
    2422    pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
    2523    if (!input) {
    26         psErrorStackPrint(stderr, "Can't find input data!\n");
    27         exit(EXIT_FAILURE);
     24        psError(PSASTRO_ERR_CONFIG, true, "Can't find input data!\n");
     25        return false;
    2826    }
     27
    2928    // de-activate all files except PSASTRO.INPUT
    3029    pmFPAfileActivate (config->files, false, NULL);
     
    3736
    3837    while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
    39         psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     38        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    4039        if (!chip->process || !chip->file_exists) { continue; }
    4140        pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
    4241
    4342        while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
    44             psTrace (__func__, 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     43            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    4544            if (!cell->process || !cell->file_exists) { continue; }
    4645            pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
  • trunk/psastro/src/psastroDataSave.c

    r9374 r9574  
    1212    psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, "PSASTRO");
    1313    if (!recipe) {
    14         psErrorStackPrint(stderr, "Can't find PSASTRO recipe!\n");
    15         exit(EXIT_FAILURE);
     14        psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe!\n");
     15        return false;
    1616    }
    1717
     
    1919    pmFPAfile *output = psMetadataLookupPtr (NULL, config->files, "PSASTRO.OUTPUT");
    2020    if (!output) {
    21         psErrorStackPrint(stderr, "Can't find output data!\n");
    22         exit(EXIT_FAILURE);
     21        psError(PSASTRO_ERR_CONFIG, true, "Can't find output data!\n");
     22        return false;
    2323    }
    2424
     
    3333
    3434    while ((chip = pmFPAviewNextChip (view, output->fpa, 1)) != NULL) {
    35         psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     35        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    3636        if (!chip->process || !chip->file_exists) { continue; }
    3737        pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
    3838
    3939        while ((cell = pmFPAviewNextCell (view, output->fpa, 1)) != NULL) {
    40             psTrace (__func__, 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     40            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    4141            if (!cell->process || !cell->file_exists) { continue; }
    4242            pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
  • trunk/psastro/src/psastroLoadReferences.c

    r9368 r9574  
    4242    # if ELIXIR_MODE
    4343    if (CATDIR) {
    44         sprintf (tempLine, "getstar -D CATDIR %s -D CATFORMAT elixir -D CATMODE mef -region %f %f %f %f > %s", CATDIR, RAmin, DECmin, RAmax, DECmax, tempFile);
     44        sprintf (tempLine, "getstar -D CATDIR %s -D CATFORMAT elixir -D CATMODE mef -region %f %f %f %f -o %s", CATDIR, RAmin, DECmin, RAmax, DECmax, tempFile);
    4545    } else {
    46         sprintf (tempLine, "getstar -D CATFORMAT elixir -D CATMODE mef -region %f %f %f %f > %s", RAmin, DECmin, RAmax, DECmax, tempFile);
     46        sprintf (tempLine, "getstar -D CATFORMAT elixir -D CATMODE mef -region %f %f %f %f -o %s", RAmin, DECmin, RAmax, DECmax, tempFile);
    4747    }
    4848    # else
    4949    if (CATDIR) {
    50         sprintf (tempLine, "getstar -D CATDIR %s -D CATFORMAT panstarrs -D CATMODE mef -region %f %f %f %f > %s", CATDIR, RAmin, DECmin, RAmax, DECmax, tempFile);
     50        sprintf (tempLine, "getstar -D CATDIR %s -D CATFORMAT panstarrs -D CATMODE mef -region %f %f %f %f -o %s", CATDIR, RAmin, DECmin, RAmax, DECmax, tempFile);
    5151    } else {
    52         sprintf (tempLine, "getstar -D CATFORMAT panstarrs -D CATMODE mef -region %f %f %f %f > %s", RAmin, DECmin, RAmax, DECmax, tempFile);
     52        sprintf (tempLine, "getstar -D CATFORMAT panstarrs -D CATMODE mef -region %f %f %f %f -o %s", RAmin, DECmin, RAmax, DECmax, tempFile);
    5353    }
    5454    # endif
    5555
    56     psTrace (__func__, 3, "%s\n", tempLine);
     56    psTrace ("psastro", 3, "%s\n", tempLine);
    5757    status = system (tempLine);
    5858    if (status) {
     
    9999    psFree (table);
    100100
    101     psTrace (__func__, 3, "loaded %ld reference stars from (%10.6f,%10.6f) - (%10.6f,%10.6f)\n",
     101    psTrace ("psastro", 3, "loaded %ld reference stars from (%10.6f,%10.6f) - (%10.6f,%10.6f)\n",
    102102             refs->n, RAmin, DECmin, RAmax, DECmax);
    103103    return refs;
  • trunk/psastro/src/psastroMosaicAstrom.c

    r9374 r9574  
    99    psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, "PSASTRO");
    1010    if (!recipe) {
    11         psErrorStackPrint(stderr, "Can't find PSASTRO recipe!\n");
    12         exit(EXIT_FAILURE);
     11        psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe!\n");
     12        return false;
    1313    }
    1414
     
    1616    pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
    1717    if (!input) {
    18         psErrorStackPrint(stderr, "Can't find input data!\n");
    19         exit(EXIT_FAILURE);
     18        psError(PSASTRO_ERR_CONFIG, true, "Can't find input data!\n");
     19        return false;
    2020    }
    2121
  • trunk/psastro/src/psastroMosaicChipAstrom.c

    r9374 r9574  
    1010    // this loop selects the matched stars for all chips
    1111    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
    12         psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     12        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    1313        if (!chip->process || !chip->file_exists) { continue; }
    1414       
    1515        while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
    16             psTrace (__func__, 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     16            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    1717            if (!cell->process || !cell->file_exists) { continue; }
    1818
  • trunk/psastro/src/psastroMosaicGetGrads.c

    r9374 r9574  
    1212    // this loop selects the matched stars for all chips
    1313    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
    14         psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     14        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    1515        if (!chip->process || !chip->file_exists) { continue; }
    1616       
    1717        while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
    18             psTrace (__func__, 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     18            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    1919            if (!cell->process || !cell->file_exists) { continue; }
    2020
  • trunk/psastro/src/psastroMosaicGetRefstars.c

    r9374 r9574  
    1111    psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, "PSASTRO");
    1212    if (!recipe) {
    13         psErrorStackPrint(stderr, "Can't find PSASTRO recipe!\n");
    14         exit(EXIT_FAILURE);
     13        psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe!\n");
     14        return false;
    1515    }
    1616
     
    1818    pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
    1919    if (!input) {
    20         psErrorStackPrint(stderr, "Can't find input data!\n");
    21         exit(EXIT_FAILURE);
     20        psError(PSASTRO_ERR_CONFIG, true, "Can't find input data!\n");
     21        return false;
    2222    }
    2323
     
    3030    // this loop selects the matched stars for all chips
    3131    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
    32         psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     32        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    3333        if (!chip->process || !chip->file_exists) { continue; }
    3434       
    3535        while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
    36             psTrace (__func__, 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     36            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    3737            if (!cell->process || !cell->file_exists) { continue; }
    3838
     
    7575                    psFree (ref);
    7676                }
    77                 psTrace (__func__, 4, "Added %ld refstars\n", refstars->n);
     77                psTrace ("psastro", 4, "Added %ld refstars\n", refstars->n);
    7878                psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.REFSTARS", PS_DATA_ARRAY, "astrometry matches", refstars);
    7979
  • trunk/psastro/src/psastroMosaicHeaders.c

    r9374 r9574  
    99    psMetadata *recipe  = psMetadataLookupPtr (NULL, config->recipes, "PSASTRO");
    1010    if (!recipe) {
    11         psErrorStackPrint(stderr, "Can't find PSASTRO recipe!\n");
    12         exit(EXIT_FAILURE);
     11        psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe!\n");
     12        return false;
    1313    }
     14
    1415
    1516    // select the input data sources
    1617    pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
    1718    if (!input) {
    18         psErrorStackPrint(stderr, "Can't find input data!\n");
    19         exit(EXIT_FAILURE);
     19        psError(PSASTRO_ERR_CONFIG, true, "Can't find input data!\n");
     20        return false;
    2021    }
    2122
     
    2930
    3031    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
    31         psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     32        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    3233        if (!chip->process || !chip->file_exists) { continue; }
    3334
  • trunk/psastro/src/psastroMosaicRescaleChips.c

    r9374 r9574  
    88    // this loop selects the matched stars for all chips
    99    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
    10         psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     10        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    1111        if (!chip->process || !chip->file_exists) { continue; }
    1212       
  • trunk/psastro/src/psastroMosaicSetAstrom.c

    r9374 r9574  
    1010    // this loop selects the matched stars for all chips
    1111    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
    12         psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     12        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    1313        if (!chip->process || !chip->file_exists) { continue; }
    1414       
    1515        while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
    16             psTrace (__func__, 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     16            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    1717            if (!cell->process || !cell->file_exists) { continue; }
    1818
  • trunk/psastro/src/psastroMosaicSetMatch.c

    r9374 r9574  
    1616    // this loop selects the matched stars for all chips
    1717    while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
    18         psTrace (__func__, 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     18        psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    1919        if (!chip->process || !chip->file_exists) { continue; }
    2020       
    2121        while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
    22             psTrace (__func__, 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     22            psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    2323            if (!cell->process || !cell->file_exists) { continue; }
    2424
     
    3535                psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS");
    3636                if (refstars == NULL) { continue; }
    37                 psTrace (__func__, 4, "Trying %ld refstars\n", refstars->n);
     37                psTrace ("psastro", 4, "Trying %ld refstars\n", refstars->n);
    3838
    3939                // use small radius to match stars (assume starting astrometry is good)
    4040                // XXX should this take a (double radius)?
    4141                psArray *matches = pmAstromRadiusMatchChip (rawstars, refstars, recipe);
    42                 psTrace (__func__, 4, "Matched %ld refstars\n", matches->n);
     42                psTrace ("psastro", 4, "Matched %ld refstars\n", matches->n);
    4343
    4444                sprintf (name, "raw.%02d.dat", view->chip);
  • trunk/psastro/src/psastroOneChip.c

    r9374 r9574  
    1313    pmAstromStats stats = pmAstromGridMatch (rawstars, refstars, recipe);
    1414    stats = pmAstromGridTweak (rawstars, refstars, recipe, stats);
    15     psLogMsg (__func__, 3, "grid search result: %f,%f @ %f deg\n", stats.offset.x, stats.offset.y, DEG_RAD*stats.angle);
     15    psLogMsg ("psastro", 3, "grid search result: %f,%f @ %f deg\n", stats.offset.x, stats.offset.y, DEG_RAD*stats.angle);
    1616
    1717    // adjust the chip.toFPA terms only
  • trunk/psastro/src/psastroParseCamera.c

    r9374 r9574  
    11# include "psastro.h"
    2 // XXX leak free 2006.04.27
    32
    43bool psastroParseCamera (pmConfig *config) {
     
    87    // the input image(s) are required arguments; they define the camera
    98    pmFPAfile *input = pmFPAfileDefineFromArgs (&status, config, "PSASTRO.INPUT", "INPUT");
    10     if (!status) { psAbort (__func__, "missing INPUT entry"); }
     9    if (!status) {
     10        psError(PSASTRO_ERR_CONFIG, false, "Failed to build FPA from PSASTRO.INPUT");
     11        return false;
     12    }
    1113
    1214    // select recipe options supplied on command line
     
    3032            int chipNum = atoi(chips->data[i]);
    3133            if (! pmFPASelectChip(input->fpa, chipNum, false)) {
    32                 psErrorStackPrint(stderr, "Chip number %d doesn't exist in camera.\n", chipNum);
    33                 exit(EXIT_FAILURE);
     34                psError(PSASTRO_ERR_CONFIG, true, "Chip number %d doesn't exist in camera.\n", chipNum);
     35                return false;
    3436            }
    3537        }
     
    3739    psFree (chips);
    3840
    39     psTrace(__func__, 1, "Done with psastroParseCamera...\n");
     41    psTrace("psastro", 1, "Done with psastroParseCamera...\n");
    4042    return true;
    4143}
  • trunk/psastro/src/psastroTestFuncs.c

    r9374 r9574  
    3232        for (int j = 0; j < map->x->nY + 1; j++) {
    3333            if (map->x->mask[i][j]) continue;
    34             psLogMsg (__func__, 4, "x term %d,%d: %f +/- %f\n", i, j, map->x->coeff[i][j], map->x->coeffErr[i][j]);
     34            psLogMsg ("psastro", 4, "x term %d,%d: %f +/- %f\n", i, j, map->x->coeff[i][j], map->x->coeffErr[i][j]);
    3535        }
    3636    }
     
    3939        for (int j = 0; j < map->y->nY + 1; j++) {
    4040            if (map->y->mask[i][j]) continue;
    41             psLogMsg (__func__, 4, "y term %d,%d: %f +/- %f\n", i, j, map->y->coeff[i][j], map->y->coeffErr[i][j]);
     41            psLogMsg ("psastro", 4, "y term %d,%d: %f +/- %f\n", i, j, map->y->coeff[i][j], map->y->coeffErr[i][j]);
    4242        }
    4343    }
  • trunk/psastro/src/psastroWCS.c

    r9373 r9574  
    66
    77    psProjectionType type;
    8     bool status;
     8    bool status, pcKeys, cdKeys;
    99    float crval1, crval2, crpix1, crpix2, cdelt1, cdelt2;
    1010    float pc1_1, pc1_2, pc2_1, pc2_2;
     
    2929    }
    3030
     31    // what type of WCS keywords are available?
     32    psMetadataLookupF32 (&pcKeys, header, "PC001001");
     33    psMetadataLookupF32 (&cdKeys, header, "CD1_1");
     34
     35    if (cdKeys && pcKeys) {
     36        psLogMsg ("psastro", 2, "warning: both CDi_j and PC00i00j defined in headers, using CDi_j terms\n");
     37    }
     38    if (!cdKeys && !pcKeys) {
     39        psError(PS_ERR_UNKNOWN, true, "missing both CDi_j and PC00i00j WCS terms");
     40        // XXX we could default here to RA, DEC, ROTANGLE
     41        return false;
     42    }
     43
    3144    crval1 = psMetadataLookupF32 (&status, header, "CRVAL1");
    3245    crval2 = psMetadataLookupF32 (&status, header, "CRVAL2");
     
    3548   
    3649    // test the CDELTi varient
    37     cdelt1 = psMetadataLookupF32 (&status, header, "CDELT1");
    38     if (status) {
     50    if (pcKeys) {
     51        cdelt1 = psMetadataLookupF32 (&status, header, "CDELT1");
    3952        cdelt2 = psMetadataLookupF32 (&status, header, "CDELT2");
    4053
     
    6578
    6679    // test the CDi_j varient
    67     pc1_1 = psMetadataLookupF32 (&status, header, "CD1_1");
    68     if (status) {
     80    if (cdKeys) {
     81        pc1_1 = psMetadataLookupF32 (&status, header, "CD1_1");
    6982        pc1_2 = psMetadataLookupF32 (&status, header, "CD1_2");
    7083        pc2_1 = psMetadataLookupF32 (&status, header, "CD2_1");
Note: See TracChangeset for help on using the changeset viewer.