Changeset 17630
- Timestamp:
- May 11, 2008, 10:10:06 AM (18 years ago)
- Location:
- branches/eam_branch_20080511/ppSim/src
- Files:
-
- 4 edited
-
Makefile.am (modified) (1 diff)
-
ppSim.h (modified) (2 diffs)
-
ppSimCreate.c (modified) (3 diffs)
-
ppSimLoop.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080511/ppSim/src/Makefile.am
r16500 r17630 24 24 ppSimUtils.c \ 25 25 ppSimLoop.c \ 26 ppSimLoadSpots.c \ 27 ppSimPhotom.c \ 28 ppSimMosaicChip.c \ 26 29 ppSimBadPixels.c 27 30 -
branches/eam_branch_20080511/ppSim/src/ppSim.h
r17557 r17630 98 98 bool ppSimMakeSky (pmReadout *readout, psImage *expCorr, ppSimType type, pmConfig *config); 99 99 100 psArray *ppSimLoadSpots (pmFPA *fpa, pmConfig *config); 101 100 102 bool ppSimLoadStars (psArray *stars, pmFPA *fpa, pmConfig *config); 101 103 bool ppSimMakeStars(psArray *stars, pmFPA *fpa, pmConfig *config, const psRandom *rng); … … 127 129 bool ppSimInsertGalaxies (pmReadout *readout, psImage *expCorr, psArray *galaxies, pmConfig *config); 128 130 131 bool ppSimMosaicChip(pmConfig *config, const psMaskType blankMask, const pmFPAview *view, 132 const char *outFile, const char *inFile); 133 134 bool ppSimPhotom (pmConfig *config, pmFPAview *view); 135 136 129 137 /// Add bad pixels to an image 130 138 bool ppSimBadPixels(pmReadout *readout, ///< Readout for which to generate bad pixels -
branches/eam_branch_20080511/ppSim/src/ppSimCreate.c
r17557 r17630 40 40 } 41 41 42 // define the output image file 42 // define the output image file -- this is the basis for the ppSimLoop 43 43 pmFPAfile *file = pmFPAfileDefineOutput(config, fpa, OUTPUT_FILE); 44 44 if (!file) { … … 53 53 return NULL; 54 54 } 55 // XXX we should not require the output image to be written 55 56 file->save = true; 56 57 … … 58 59 config->formatName = psStringCopy (file->formatName); 59 60 60 // have we supplied a psf model?61 if (psMetadataLookupPtr(NULL, config->arguments, "PSPHOT.PSF")) {62 bool status = false; 61 // For photometry, we operate on the chip-mosaicked image. we create a copy of the mosaicked 62 // image for psphot so we can write out a clean image 63 if (options->doPhotom) { 63 64 64 // tie the psf file to the chipMosaic 65 pmFPAfileBindFromArgs(&status, file, config, "PSPHOT.PSF.LOAD", "PSPHOT.PSF"); 66 if (!status) { 67 psError(PS_ERR_UNKNOWN, false, "Failed to find/build PSPHOT.PSF.LOAD"); 68 psFree(fpa); 69 psFree(file); 70 return NULL; 65 // we need a chip image if we perform photometry (is it necessary to build it if we don't use it?) 66 pmFPAfile *chipImage = pmFPAfileDefineChipMosaic(config, output->fpa, "PPSIM.CHIP"); 67 if (!chipImage) { 68 psError(PS_ERR_IO, false, _("Unable to generate new file from PPSIM.CHIP")); 69 psFree(options); 70 return NULL; 71 } 72 if (chipImage->type != PM_FPA_FILE_IMAGE) { 73 psError(PS_ERR_IO, true, "PPSIM.CHIP is not of type IMAGE"); 74 psFree(options); 75 return NULL; 76 } 77 78 // this file is just used as a carrier; output files (eg, PSPHOT.RESID) are defined by 79 // psphotDefineFiles 80 pmFPAfile *psphotInput = pmFPAfileDefineFromFile (config, chipImage, 1, 1, "PSPHOT.INPUT"); 81 PS_ASSERT (psphotInput, false); 82 83 // define associated psphot input/output files 84 if (!psphotDefineFiles (config, psphotInput)) { 85 psError(PSPHOT_ERR_CONFIG, false, "Trouble defining the additional input/output files for psphot"); 86 return false; 71 87 } 88 } else { 89 // have we supplied a psf model? this happens in psphotDefineFiles if we request a photometry 90 // analysis. however, even if we do not, a psf model may be used to generate the fake 91 // sources. 92 if (psMetadataLookupPtr(NULL, config->arguments, "PSPHOT.PSF")) { 93 // tie the psf file to the chipMosaic 94 pmFPAfileBindFromArgs(&status, file, config, "PSPHOT.PSF.LOAD", "PSPHOT.PSF"); 95 if (!status) { 96 psError(PS_ERR_UNKNOWN, false, "Failed to find/build PSPHOT.PSF.LOAD"); 97 psFree(fpa); 98 psFree(file); 99 return NULL; 100 } 101 } 72 102 } 73 103 104 // PPSIM.SOURCES carries the constructed, fake sources with their true parameters 74 105 // XXX only invoke this code for OBJECT types of images 75 // PPSIM.SOURCES carries the constructed, fake sources with their true parameters76 106 pmFPAfile *simSources = pmFPAfileDefineOutput (config, file->fpa, "PPSIM.SOURCES"); 77 107 if (!simSources) { -
branches/eam_branch_20080511/ppSim/src/ppSimLoop.c
r15482 r17630 5 5 PS_ASSERT_PTR_NON_NULL(config, PS_EXIT_PROG_ERROR); 6 6 7 // in this program, we are looping over the output image, rather than the input as in ppImage 7 8 pmFPAfile *file = psMetadataLookupPtr(NULL, config->files, OUTPUT_FILE); // Output file 8 9 assert(file); … … 15 16 16 17 int binning = psMetadataLookupS32(NULL, config->arguments, "BINNING"); // Binning in x and y 18 19 // Load forced-photometry positions 20 if (type == PPSIM_TYPE_OBJECT) { 21 psArray *spots = ppSimLoadSpots (fpa, config); 22 } 17 23 18 24 // Load catalogue stars … … 170 176 } 171 177 178 ppSimMosaicChip(config, blankMask, view, "PPSIM.CHIP", "PPSIM.OUTPUT"); 179 180 // we perform photometry on the readouts of this chip in the output 181 ppSimPhotom (config, view); 182 172 183 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) { 173 184 psError(PS_ERR_IO, false, "Unable to write file.");
Note:
See TracChangeset
for help on using the changeset viewer.
