IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 5, 2006, 1:11:17 AM (20 years ago)
Author:
eugene
Message:

adding update pmFPAfile methods

File:
1 edited

Legend:

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

    r6791 r6792  
    11# include "psphot.h"
    22
    3 ppFile *psastroParseCamera (ppConfig *config) {
     3bool *psastroParseCamera (pmConfig *config) {
    44
    55    ppFile *input = ppFileAlloc ();
    66
    7     input->filename = psMetadataLookupStr(NULL, config->arguments, "INPUT_FILE");
    8     psMemCopy (input->filename); // keep for external use
    9 
    10     // Open the input image
    11     psLogMsg("psphot", PS_LOG_INFO, "Opening input image: %s\n", input->filename);
    12     input->fits = psFitsOpen (input->filename, "r"); // File handle for FITS file
    13     if (! input->fits) {
    14         psErrorStackPrint(stderr, "Can't open input image: %s\n", input->filename);
    15         exit(EXIT_FAILURE);
     7    // the input image(s) are required arguments; they define the camera
     8    input = pmFPAfileAddSource (config, "INPUT", "PSASTRO.INPUT", true);
     9    if (input == NULL) {
     10        psAbort (__func__, "missing INPUT entry");
    1611    }
    17     input->phu = psFitsReadHeader(NULL, input->fits); // FITS header
    18 
    19     // Get camera configuration from header if not already defined
    20     if (! config->camera) {
    21         config->camera = pmConfigCameraFromHeader(config->site, input->phu);
    22         if (! config->camera) {
    23              // There's no point in continuing if we can't recognize what we've got
    24             psErrorStackPrint(stderr, "Can't find camera configuration!\n");
    25             exit(EXIT_FAILURE);
    26         }
    27    } else if (! pmConfigValidateCamera(config->camera, input->phu)) {
    28        // There's no point in continuing if what we've got doesn't match what we've been told
    29         psError(PS_ERR_IO, true, "%s does not seem to be from the specified camera.\n",
    30                 input->filename);
    31         exit(EXIT_FAILURE);
    32     }
    33 
    34     // Determine the correct recipe to use (from camera or from user)
    35     // if config->recipe is not NULL, it is a user-supplied recipe
    36     if (!config->recipe) {
    37         config->recipe = pmConfigRecipeFromCamera(config->camera, PSPHOT_RECIPE);
    38         if (config->recipe == NULL) {
    39             psErrorStackPrint(stderr, "Can't find recipe configuration!\n");
    40             exit(EXIT_FAILURE);
    41         }
    42     }
    43 
    44     // recipe override values (command-line options):
    45     psMetadataItem *item = NULL;
    46     psMetadataIterator *iter = psMetadataIteratorAlloc (config->options, PS_LIST_HEAD, NULL);
    47     while ((item = psMetadataGetAndIncrement (iter)) != NULL) {
    48         psMetadataAddItem (config->recipe, item, PS_LIST_TAIL, PS_META_REPLACE);
    49     }
    50     psFree (iter);
    5112
    5213    // set default recipe values here
     
    5415    psMetadataAddStr (recipe, PS_LIST_TAIL, "BREAK_POINT", PS_META_NO_REPLACE, "default fitting mode", "NONE");
    5516
    56     // Chip selection: if we are using a single chip, select it for each FPA
    57     // Chip numbers to work on: -chip 1,2,3,5,8,10
    58     # if (0)
    59     char *chips = psMetadataLookupStr(NULL, config->arguments, "CHIP_SELECTIONS");
    60     if (chips != NULL) {
    61         char *p = chips;
    62         while (strlen(p)) {
    63             char *q = strchr (p, ',');
    64             if (q == NULL) {
    65                 q = p + strlen(p);
    66             } else {
    67                 *q = 0;
    68                 q = q + 1;
    69             }
    70             int chipNum = atoi(p);
    71             // XXX EAM : extend this to allow an array of selected chips (by name)
    72             if (! pmFPASelectChip(input->fpa, chipNum)) {
    73                 psErrorStackPrint(stderr, "Chip number %d doesn't exist in camera.\n", chipNum);
    74                 exit(EXIT_FAILURE);
    75             }
    76             psLogMsg("psphot", PS_LOG_INFO, "Operating only on chip %d\n", chipNum);
    77             p = q;
    78         }
    79     }
    80     # endif
    81 
    82     psTrace(__func__, 1, "Done with psphotParseCamera...\n");
    83     return input;
     17    psTrace(__func__, 1, "Done with psastroParseCamera...\n");
     18    return true;
    8419}
Note: See TracChangeset for help on using the changeset viewer.