IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11352


Ignore:
Timestamp:
Jan 27, 2007, 5:02:24 PM (19 years ago)
Author:
eugene
Message:

update psphot and psastro in ppImage

Location:
trunk/ppImage/src
Files:
3 edited

Legend:

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

    r10439 r11352  
    55# include "ppImage.h"
    66
     7// this function is mostly equivalent to the top-level of psastro, with some
     8// modifications since the data has already been loaded.
    79bool ppImageAstrom (pmConfig *config) {
    810
     
    1618    pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSASTRO.INPUT");
    1719    if (!status) {
    18 
    1920        // psphotReadout requires a pmFPAfile supplied with the name PSASTRO.INPUT
    2021        // create a pmFPAfile which points at PSPHOT.OUTPUT
     
    2728    }
    2829
    29     psastroConvertFPA (input->fpa, recipe);
     30    // convert the output sources created by psphot into astrometry objects
     31    if (!psastroConvertFPA (input->fpa, recipe)) {
     32        psErrorStackPrint(stderr, "error loading input data\n");
     33        exit (1);
     34    }
    3035
    3136    // interpret the available initial astrometric information
    3237    // apply the initial guess
    33     psastroAstromGuess (config);
     38    if (!psastroAstromGuess (config)) {
     39        psErrorStackPrint(stderr, "failed to determine initial astrometry guess\n");
     40        exit (1);
     41    }
    3442
    3543    // load the reference stars overlapping the data stars
    3644    psArray *refs = psastroLoadRefstars(config);
    37 
    38     psastroChooseRefstars(config, refs);
    39 
    40     if (psMetadataLookupBool (NULL, recipe, "ASTROM.CHIP")) {
    41         psastroChipAstrom (config, refs);
    42     }
    43     if (psMetadataLookupBool (NULL, recipe, "ASTROM.MOSAIC")) {
    44         psastroMosaicAstrom (config, refs);
     45    if (!refs) {
     46        psErrorStackPrint(stderr, "failed to load reference data\n");
     47        exit (1);
    4548    }
    4649
     50    if (!psastroChooseRefstars (config, refs)) {
     51        psErrorStackPrint(stderr, "failed to select reference data for chips\n");
     52        exit (1);
     53    }
     54
     55    // XXX does this check the recipe??
     56    bool chipastro = psMetadataLookupBool (NULL, config->arguments, "PSASTRO.CHIP.MODE");
     57    bool mosastro  = psMetadataLookupBool (NULL, config->arguments, "PSASTRO.MOSAIC.MODE");
     58    if (!chipastro && !mosastro) {
     59        psLogMsg ("psastro", 3, "no astrometry mode selected, assuming chip mode\n");
     60        chipastro= true;
     61    }
     62
     63    if (chipastro) {
     64      if (!psastroChipAstrom (config, refs)) {
     65            psErrorStackPrint(stderr, "failed to perform single chip astrometry\n");
     66            exit (1);
     67        }
     68    }
     69    if (mosastro) {
     70        if (!psastroMosaicAstrom (config, refs)) {
     71            psErrorStackPrint(stderr, "failed to perform mosaic camera astrometry\n");
     72            exit (1);
     73        }
     74    }
     75
     76    // XXX should this be left to the ppImageLoop?
    4777    psastroDataSave (config);
    4878
  • trunk/ppImage/src/ppImageLoop.c

    r10717 r11352  
    209209        ppImageAstrom(config);
    210210    }
     211    // XXX should we keep the addstar command as an option, or just run it externally?
    211212    if (options->doAddstar) {
    212213        ppImageAddstar(config);
  • trunk/ppImage/src/ppImagePhotom.c

    r11351 r11352  
    77// the top portion of this function is equivalent to psphotParseCamera,
    88// but different in a few important ways. 
     9// XXX move this section to ppImageParseCamera?
    910bool ppImagePhotom (pmConfig *config, pmFPAview *view) {
    1011
     
    2728        // we set the freeLevel to be FPA so this pmFPAfile may be used as input to psastro
    2829        // XXX make this the resonsibility of a ppImageAstrom call?
    29         pmFPAfile *outfile = pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.OUTPUT");
    30         outfile->freeLevel = PM_FPA_LEVEL_FPA;
     30        // XXX test for psastro requests?
     31        // XXX need to make this an INTERNAL file if output is not requested.
     32        bool saveOutput = psMetadataLookupBool (NULL, recipe, "SAVE.OUTPUT");
     33        if (saveOutput) {
     34          pmFPAfile *outfile = pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.OUTPUT");
     35          outfile->freeLevel = PM_FPA_LEVEL_FPA;
     36        }
    3137    }
    3238
    3339    // if we have requested PSPHOT.SRC (externally supplied sources), attempt to resolve it
    3440    if (psMetadataLookupPtr(NULL, config->arguments, "PSPHOT.SRC")) {
    35         pmFPAfileDefineFromArgs (&status, config, "PSPHOT.SRC", "SRC");
     41        pmFPAfileDefineFromArgs (&status, config, "PSPHOT.SRC", "PSPHOT.SRC");
    3642        if (!status) {
    3743            psError(PSPHOT_ERR_CONFIG, false, "Failed to find/build PSPHOT.SRC");
     
    4248    // select recipe options supplied on command line
    4349    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);
     50
     51    // NOTE the difference here from psphotParseCamera: the mask and weight
     52    // images are supplied by ppImage and need not / should not be loaded here.
     53
     54    // optionally load the PSF Model and/or fixed stars
     55    pmFPAfileBindFromArgs (NULL, input, config, "PSPHOT.PSF", "PSPHOT.PSF");
    4456
    4557    // set default recipe values here
     
    6072    // optionally save the residual image
    6173    if (psMetadataLookupBool(NULL, recipe, "SAVE.RESID")) {
    62         pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.RESID");
     74        if (!pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.RESID")) {
     75            psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.BACKMDL");
     76            return false;
     77        }
    6378    }
    6479
     
    7085    // optionally save the background model (small FITS image)
    7186    if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKMDL")) {
    72         pmFPAfileDefineFromFPA (config, input->fpa, DX, DY, "PSPHOT.BACKMDL");
     87        if (!pmFPAfileDefineFromFPA (config, input->fpa, DX, DY, "PSPHOT.BACKMDL")) {
     88            psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.BACKMDL");
     89            return false;
     90        }
    7391    }
    7492    // optionally save the full background image
    7593    if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKGND")) {
    76         pmFPAfileDefineFromFPA (config, input->fpa,  1,  1, "PSPHOT.BACKGND");
     94        if (!pmFPAfileDefineFromFPA (config, input->fpa,  1,  1, "PSPHOT.BACKGND")) {
     95            psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.BACKGND");
     96            return false;
     97        }
    7798    }
    7899    // optionally save the background-subtracted image
    79100    if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKSUB")) {
    80         pmFPAfileDefineFromFPA (config, input->fpa,  1,  1, "PSPHOT.BACKSUB");
     101        if (!pmFPAfileDefineFromFPA (config, input->fpa,  1,  1, "PSPHOT.BACKSUB")) {
     102            psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.");
     103            return false;
     104        }
    81105    }
    82106    // optionally save the PSF Model
    83107    if (psMetadataLookupBool(NULL, recipe, "SAVE.PSF")) {
    84         pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.PSF.SAVE");
     108        if (!pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.PSF.SAVE")) {
     109            psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.PSF.SAVE");
     110            return false;
     111        }
    85112    }
    86     // optionally load the PSF Model
    87     if (psMetadataLookupBool(NULL, recipe, "LOAD.PSF")) {
    88         pmFPAfileDefineInput (config, input->fpa, "PSPHOT.PSF.LOAD");
     113
     114    // optionally save output plots
     115    if (psMetadataLookupBool(NULL, recipe, "SAVE.PLOTS")) {
     116        if (!pmFPAfileDefineOutput (config, input->fpa, "SOURCE.PLOT.MOMENTS")) {
     117            psTrace ("psphot", 3, "Cannot find a rule for SOURCE.PLOT.MOMENTS");
     118        }
     119        if (!pmFPAfileDefineOutput (config, input->fpa, "SOURCE.PLOT.PSFMODEL")) {
     120            psTrace ("psphot", 3, "Cannot find a rule for SOURCE.PLOT.PSFMODEL");
     121        }
    89122    }
    90123
     
    92125    // pmFPAfileConstruct (config->files, format, config->camera, "PSPHOT.PSF_SAMPLE");
    93126
     127    // XXX probably need to deactivate all files and activate the psphot ones explicitly
     128
     129    // In this section, we iterate over the cells and readout for this chip
     130    // and run the psphot analysis routine here
    94131    // XXX worry about this not having unique PHOTCODES...
    95132    // view->cell = -1;
Note: See TracChangeset for help on using the changeset viewer.