IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 11, 2007, 1:57:26 PM (19 years ago)
Author:
eugene
Message:

moved psphot library function prototypes to psphot.h, created psphotInternal.h and psphotStandAlone.h; moved file definitions into psphotDefineFiles.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotParseCamera.c

    r12792 r12805  
    1 # include "psphotInternal.h"
     1# include "psphotStandAlone.h"
    22
    33// define the needed / desired I/O files
     
    1515    load->dataLevel = PM_FPA_LEVEL_CHIP; // force load at the CHIP level
    1616
     17    // if MASK or WEIGHT was supplied on command line, bind files to 'load'
     18    // the mask and weight will be mosaicked with the image
     19    pmFPAfileBindFromArgs (NULL, load, config, "PSPHOT.MASK",   "MASK");
     20    pmFPAfileBindFromArgs (NULL, load, config, "PSPHOT.WEIGHT", "WEIGHT");
     21
    1722    // the psphot analysis is performed on chips
    1823    pmFPAfile *input = pmFPAfileDefineChipMosaic(config, load->fpa, "PSPHOT.INPUT");
     
    2227    }
    2328
    24     // if we have requested PSPHOT.SRC, attempt to resolve it
    25     // this is a list of input sources, stored in a psphot output format file
    26 # if (0)   
    27     if (psMetadataLookupPtr(NULL, config->arguments, "SRC")) {
    28         pmFPAfileDefineFromArgs (&status, config, "PSPHOT.SRC", "SRC");
    29         if (!status) {
    30             psError(PSPHOT_ERR_CONFIG, false, "Failed to find/build PSPHOT.SRC");
    31             return status;
    32         }
     29    // define the additional input/output files associated with psphot
     30    if (!psphotDefineFiles (config, input)) {
     31        psError(PSPHOT_ERR_CONFIG, false, "Trouble defining the additional input/output files");
     32        return false;
    3333    }
    34 # endif
    35 
    36     // select recipe options supplied on command line
    37     psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
    38 
    39     // these values are used below to define the background subtraction images.
    40 
    41     // if MASK or WEIGHT was supplied on command line, bind files to input fpa
    42     // XXX these do not quite yet work: pmFPAAddSourceFromHeader is not appropriate
    43     // the mask and weight will be mosaic'ed with the image
    44     pmFPAfileBindFromArgs (NULL, load, config, "PSPHOT.MASK",   "MASK");
    45     pmFPAfileBindFromArgs (NULL, load, config, "PSPHOT.WEIGHT", "WEIGHT");
    46 
    47     // optionally load the PSF Model and/or fixed stars
    48     // XXX bind this to the input or the load file?
    49     // if the readout->analysis entries are copied, we can bind to the load file
    50     // XXX add this back in later
    51     // pmFPAfileBindFromArgs (NULL, input, config, "PSPHOT.PSF", "PSF");
    52 
    53     // XXX we need to be able to distinguish several cases:
    54     // 1) the particular output data was not requested
    55     // 2) the particular output data was requested but was not generated (skipped)
    56     // 3) the particular output data was requested but was not generated (for valid failure)
    57     // 4) the particular output data was requested but was not generated (surprising failure)
    58 
    59     // the output sources are carried on the input->fpa structures
    60     if (psMetadataLookupBool (NULL, recipe, "SAVE.OUTPUT")) {
    61         if (!pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.OUTPUT")) {
    62             psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.OUTPUT");
    63             return false;
    64         }
    65     }
    66     // optionally save the residual image
    67     if (psMetadataLookupBool(NULL, recipe, "SAVE.RESID")) {
    68         if (!pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.RESID")) {
    69             psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.BACKMDL");
    70             return false;
    71         }
    72     }
    73     // optionally save the background model (small FITS image)
    74     if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKMDL")) {
    75         int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND.XBIN");
    76         int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND.YBIN");
    77         if (!pmFPAfileDefineFromFPA (config, input->fpa, DX, DY, "PSPHOT.BACKMDL")) {
    78             psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.BACKMDL");
    79             return false;
    80         }
    81     }
    82     // optionally save the full background image
    83     if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKGND")) {
    84         if (!pmFPAfileDefineFromFPA (config, input->fpa,  1,  1, "PSPHOT.BACKGND")) {
    85             psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.BACKGND");
    86             return false;
    87         }
    88     }
    89     // optionally save the background-subtracted image
    90     if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKSUB")) {
    91         if (!pmFPAfileDefineFromFPA (config, input->fpa,  1,  1, "PSPHOT.BACKSUB")) {
    92             psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.");
    93             return false;
    94         }
    95     }
    96     // optionally save the PSF Model
    97     if (psMetadataLookupBool(NULL, recipe, "SAVE.PSF")) {
    98         if (!pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.PSF.SAVE")) {
    99             psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.PSF.SAVE");
    100             return false;
    101         }
    102     }
    103 
    104     // optionally save output plots
    105     if (psMetadataLookupBool(NULL, recipe, "SAVE.PLOTS")) {
    106         if (!pmFPAfileDefineOutput (config, input->fpa, "SOURCE.PLOT.MOMENTS")) {
    107             psTrace ("psphot", 3, "Cannot find a rule for SOURCE.PLOT.MOMENTS");
    108         }
    109         if (!pmFPAfileDefineOutput (config, input->fpa, "SOURCE.PLOT.PSFMODEL")) {
    110             psTrace ("psphot", 3, "Cannot find a rule for SOURCE.PLOT.PSFMODEL");
    111         }
    112     }
    113 
    114     // XXX add in example PSF image thumbnails
    115     // pmFPAfileConstruct (config->files, format, config->camera, "PSPHOT.PSF_SAMPLE");
    11634
    11735    // Chip selection: turn on only the chips specified (pass status to suppress missing-key log msg)
Note: See TracChangeset for help on using the changeset viewer.