IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 31, 2006, 3:24:14 PM (20 years ago)
Author:
Paul Price
Message:

ppImage now working again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageParseCamera.c

    r6260 r6747  
    11#include <stdio.h>
    22#include "pslib.h"
    3 #include "pmFPA.h"
    4 #include "pmFPAConstruct.h"
    5 #include "pmConfig.h"
     3#include "psmodules.h"
    64#include "ppImage.h"
    75
    8 bool ppImageParseCamera(ppImageData *data, ppConfig *config)
     6bool ppImageParseCamera(ppImageData *data, pmConfig *config)
    97{
    108    // Initialise the containers where the files will go
     
    2220    data->input->fits = psFitsOpen(data->input->filename, "r"); // File handle for FITS file
    2321    if (! data->input->fits) {
    24         // There's no point in continuing if we can't open the input
     22        // We can't open the input
    2523        psErrorStackPrint(stderr, "Can't open input image: %s\n", data->input->filename);
    2624        exit(EXIT_FAILURE);
     
    2927
    3028    // Get camera configuration from header if not already defined
     29    psMetadata *cameraFormat = NULL;    // Camera format description
    3130    if (! config->camera) {
    32         config->camera = pmConfigCameraFromHeader(config->site, data->input->phu);
     31        cameraFormat = pmConfigCameraFormatFromHeader(config, data->input->phu);
    3332        if (! config->camera) {
    3433             // There's no point in continuing if we can't recognise what we've got
     
    3635            exit(EXIT_FAILURE);
    3736        }
    38    } else if (! pmConfigValidateCamera(config->camera, data->input->phu)) {
    39        // There's no point in continuing if what we've got doesn't match what we've been told
     37    } else if (! pmConfigValidateCameraFormat(config->camera, data->input->phu)) {
     38        // What we've got doesn't match what we've been told
    4039        psError(PS_ERR_IO, true, "%s does not seem to be from the specified camera.\n",
    4140                data->input->filename);
     
    4342    }
    4443
    45     // Determine the correct recipe to use
    46     if (! config->recipe && !(config->recipe = pmConfigRecipeFromCamera(config->camera, RECIPE))) {
    47         // There's no point in continuing if we can't work out what recipe to use
    48         psErrorStackPrint(stderr, "Can't find recipe configuration!\n");
    49         exit(EXIT_FAILURE);
    50     }
     44    // Construct cameras in preparation for reading
     45    data->input->fpa  = pmFPAConstruct(config->camera);
     46    data->input->view = pmFPAAddSource(data->input->fpa, data->input->phu, cameraFormat);
    5147
    52     // Construct cameras in preparation for reading
    53     data->input->fpa   = pmFPAConstruct(config->camera);
    54     data->mask->fpa    = pmFPAConstruct(config->camera);
    55     data->bias->fpa    = pmFPAConstruct(config->camera);
    56     data->dark->fpa    = pmFPAConstruct(config->camera);
    57     data->flat->fpa    = pmFPAConstruct(config->camera);
    58     data->fringe->fpa  = pmFPAConstruct(config->camera);
     48    ppFileOpen(data->mask, "-mask", config, config->camera, cameraFormat);
     49    ppFileOpen(data->bias, "-bias", config, config->camera, cameraFormat);
     50    ppFileOpen(data->dark, "-dark", config, config->camera, cameraFormat);
     51    ppFileOpen(data->flat, "-flat", config, config->camera, cameraFormat);
     52    ppFileOpen(data->fringe, "-fringe", config, config->camera, cameraFormat);
     53
     54    psFree(cameraFormat);
    5955
    6056    // Open output file
     
    6662    }
    6763
    68     // XXX EAM : extend this to allow an array of selected chips by name
    69     // Chip selection: if we are using a single chip, select it for each FPA
    70     int chipNum = psMetadataLookupS32(NULL, config->arguments, "-chip"); // Chip number to work on
    71     if (chipNum >= 0) {
    72         if (! pmFPASelectChip(data->input->fpa, chipNum)) {
    73             psErrorStackPrint(stderr, "Chip number %d doesn't exist in camera.\n", chipNum);
    74             exit(EXIT_FAILURE);
    75         }
    76         psLogMsg("ppImage", PS_LOG_INFO, "Operating only on chip %d\n", chipNum);
    77     }
    7864    return true;
    7965}
    8066
    81 // XXX EAM : I dropped the pre-open of the output files; replace with a stats test of output permissions
    82 
    83 // XXX : for split data (data spread across multiple files), this step is only operating on a component
    84 //       of the FPA.  the other components should be set to 'invalid' in this case?
Note: See TracChangeset for help on using the changeset viewer.