- Timestamp:
- Feb 5, 2010, 1:38:43 PM (16 years ago)
- Location:
- branches/eam_branches/20091201/psphot
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/psphotLoadPSF.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/psphot
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/eam_branches/psphot.stack.20100120 merged eligible /branches/eam_branches/20091113/psphot 26119-26255
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/eam_branches/20091201/psphot/src/psphotLoadPSF.c
r18002 r26788 1 1 # include "psphotInternal.h" 2 2 3 // NOTE : pmPSF_IO.c functions must load the psf model onto the chip->analysis metadata because 4 // the I/O operation likely occurs before the readout exists. This implementation assumes that 5 // a single psf model is valid for the entire set of readouts (not valid for a time series of readouts) 6 7 // XXX for now (2010.01.27), the supporting programs do not define multiple PSPHOT.PSF.LOAD 8 // files to go with multiple PSPHOT.INPUT files. as a result, the implementation below is 9 // currently going to work for the case of a single input file, but will fail if we try with a 10 // stack of images. 11 3 12 // load an externally supplied psf model 4 pmPSF *psphotLoadPSF (pmConfig *config, const pmFPAview *view, psMetadata *recipe) { 13 bool psphotLoadPSFReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index) { 14 15 bool status; 16 17 // find the currently selected readout 18 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest 19 psAssert (file, "missing file?"); 5 20 6 21 // find the currently selected chip 7 pmChip *chip = pmFPA fileThisChip (config->files, view, "PSPHOT.PSF.LOAD");8 if (!chip) return NULL;22 pmChip *chip = pmFPAviewThisChip (view, file->fpa); 23 if (!chip) return false; 9 24 10 25 // find the currently selected readout 11 pmReadout *readout = pmFPA fileThisReadout (config->files, view, "PSPHOT.PSF.LOAD");12 if (!readout) return NULL;26 pmReadout *readout = pmFPAviewThisReadout (view, file->fpa); 27 if (!readout) return false; 13 28 14 29 // check if a PSF model is supplied by the user 15 pmPSF *psf = psMetadataLookupPtr ( NULL, chip->analysis, "PSPHOT.PSF");30 pmPSF *psf = psMetadataLookupPtr (&status, chip->analysis, "PSPHOT.PSF"); 16 31 if (psf == NULL) { 17 32 psLogMsg ("psphot", 3, "no psf supplied for this chip"); 18 return NULL;33 return true; 19 34 } 20 35 21 if (!psphotPSFstats (readout, recipe, psf)) psAbort("cannot measure PSF shape terms"); 36 if (!psphotPSFstats (readout, psf)) { 37 psAbort("cannot measure PSF shape terms"); 38 } 22 39 23 40 psLogMsg ("psphot", 3, "using externally supplied PSF model for this readout"); 24 41 25 // we return a psf which can be free (and which may be removed from the metadata) 26 psMemIncrRefCounter (psf); 27 return psf; 42 // save PSF on readout->analysis 43 if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_META_REPLACE | PS_DATA_UNKNOWN, "psphot psf model", psf)) { 44 psError (PSPHOT_ERR_UNKNOWN, false, "problem saving sources on readout"); 45 return false; 46 } 47 48 return true; 28 49 } 50 51 bool psphotLoadPSF (pmConfig *config, const pmFPAview *view) { 52 53 bool status = false; 54 55 // XXX PSPHOT.PSF.LOAD vs PSPHOT.INPUT -- see note at top 56 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 57 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 58 59 // loop over the available readouts 60 for (int i = 0; i < num; i++) { 61 62 // Generate the mask and weight images, including the user-defined analysis region of interest 63 if (!psphotLoadPSFReadout (config, view, "PSPHOT.PSF.LOAD", i)) { 64 psError (PSPHOT_ERR_CONFIG, false, "failed to load PSF model for PSPHOT.PSF.LOAD entry %d", i); 65 return false; 66 } 67 } 68 return true; 69 }
Note:
See TracChangeset
for help on using the changeset viewer.
