Changeset 11352
- Timestamp:
- Jan 27, 2007, 5:02:24 PM (19 years ago)
- Location:
- trunk/ppImage/src
- Files:
-
- 3 edited
-
ppImageAstrom.c (modified) (3 diffs)
-
ppImageLoop.c (modified) (1 diff)
-
ppImagePhotom.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageAstrom.c
r10439 r11352 5 5 # include "ppImage.h" 6 6 7 // this function is mostly equivalent to the top-level of psastro, with some 8 // modifications since the data has already been loaded. 7 9 bool ppImageAstrom (pmConfig *config) { 8 10 … … 16 18 pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSASTRO.INPUT"); 17 19 if (!status) { 18 19 20 // psphotReadout requires a pmFPAfile supplied with the name PSASTRO.INPUT 20 21 // create a pmFPAfile which points at PSPHOT.OUTPUT … … 27 28 } 28 29 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 } 30 35 31 36 // interpret the available initial astrometric information 32 37 // 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 } 34 42 35 43 // load the reference stars overlapping the data stars 36 44 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); 45 48 } 46 49 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? 47 77 psastroDataSave (config); 48 78 -
trunk/ppImage/src/ppImageLoop.c
r10717 r11352 209 209 ppImageAstrom(config); 210 210 } 211 // XXX should we keep the addstar command as an option, or just run it externally? 211 212 if (options->doAddstar) { 212 213 ppImageAddstar(config); -
trunk/ppImage/src/ppImagePhotom.c
r11351 r11352 7 7 // the top portion of this function is equivalent to psphotParseCamera, 8 8 // but different in a few important ways. 9 // XXX move this section to ppImageParseCamera? 9 10 bool ppImagePhotom (pmConfig *config, pmFPAview *view) { 10 11 … … 27 28 // we set the freeLevel to be FPA so this pmFPAfile may be used as input to psastro 28 29 // 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 } 31 37 } 32 38 33 39 // if we have requested PSPHOT.SRC (externally supplied sources), attempt to resolve it 34 40 if (psMetadataLookupPtr(NULL, config->arguments, "PSPHOT.SRC")) { 35 pmFPAfileDefineFromArgs (&status, config, "PSPHOT.SRC", " SRC");41 pmFPAfileDefineFromArgs (&status, config, "PSPHOT.SRC", "PSPHOT.SRC"); 36 42 if (!status) { 37 43 psError(PSPHOT_ERR_CONFIG, false, "Failed to find/build PSPHOT.SRC"); … … 42 48 // select recipe options supplied on command line 43 49 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"); 44 56 45 57 // set default recipe values here … … 60 72 // optionally save the residual image 61 73 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 } 63 78 } 64 79 … … 70 85 // optionally save the background model (small FITS image) 71 86 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 } 73 91 } 74 92 // optionally save the full background image 75 93 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 } 77 98 } 78 99 // optionally save the background-subtracted image 79 100 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 } 81 105 } 82 106 // optionally save the PSF Model 83 107 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 } 85 112 } 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 } 89 122 } 90 123 … … 92 125 // pmFPAfileConstruct (config->files, format, config->camera, "PSPHOT.PSF_SAMPLE"); 93 126 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 94 131 // XXX worry about this not having unique PHOTCODES... 95 132 // view->cell = -1;
Note:
See TracChangeset
for help on using the changeset viewer.
