Changeset 14614
- Timestamp:
- Aug 22, 2007, 3:05:47 PM (19 years ago)
- Location:
- branches/eam_branch_20070817/ppSim/src
- Files:
-
- 1 added
- 7 edited
-
Makefile.am (modified) (1 diff)
-
ppSim.c (modified) (2 diffs)
-
ppSim.h (modified) (2 diffs)
-
ppSimArguments.c (modified) (2 diffs)
-
ppSimCreate.c (modified) (2 diffs)
-
ppSimInsertSources.c (modified) (4 diffs)
-
ppSimLoop.c (modified) (8 diffs)
-
ppSimSetPSF.c (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20070817/ppSim/src/Makefile.am
r14547 r14614 19 19 ppSimBounds.c \ 20 20 ppSimStars.c \ 21 ppSimSetPSF.c \ 21 22 ppSimUtils.c \ 22 23 ppSimLoop.c -
branches/eam_branch_20070817/ppSim/src/ppSim.c
r14463 r14614 4 4 { 5 5 psLibInit(NULL); 6 if (!pmModelClassInit ()) abort(); 7 6 8 pmConfig *config = pmConfigRead(&argc, argv, NULL); // Configuration 7 9 if (!config) { … … 18 20 } 19 21 20 psExit loopError; 21 if ((loopError = ppSimLoop(config))) { 22 if (!ppSimLoop(config)) { 22 23 psErrorStackPrint(stderr, "Unable to generate data."); 23 24 psFree(config); 24 exit( loopError);25 exit(PS_EXIT_SYS_ERROR); 25 26 } 26 27 -
branches/eam_branch_20070817/ppSim/src/ppSim.h
r14547 r14614 72 72 73 73 /// Loop over the output file, generating simulated data 74 psExitppSimLoop(pmConfig *config ///< Configuration74 bool ppSimLoop(pmConfig *config ///< Configuration 75 75 ); 76 76 … … 115 115 ); 116 116 117 bool ppSimSetPSF (pmChip *chip, pmConfig *config); 118 117 119 #endif -
branches/eam_branch_20070817/ppSim/src/ppSimArguments.c
r14531 r14614 66 66 psMetadataAddF32(arguments, PS_LIST_TAIL, "-starsmag", 0, "Brightest magnitude for fake stars", NAN); 67 67 psMetadataAddF32(arguments, PS_LIST_TAIL, "-starsdensity", 0, "Density of fake stars at magnitude", NAN); 68 psMetadataAddStr(arguments, PS_LIST_TAIL, "-psfclass", 0, "Type of PSF model", NULL); 68 69 psMetadataAddS32(arguments, PS_LIST_TAIL, "-bin", 0, "Binning in x and y", 1); 69 70 … … 194 195 psMetadataAddF32(config->arguments, PS_LIST_TAIL, "PA", 0, "Boresight position angle (radians)", 195 196 pa * M_PI / 180.0); 197 198 199 const char *psfClass = psMetadataLookupStr(NULL, arguments, "-psfclass"); // Filter name 200 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "PSF.MODEL", 0, "PSF model class", psfClass); 196 201 } 197 202 -
branches/eam_branch_20070817/ppSim/src/ppSimCreate.c
r14547 r14614 1 1 # include "ppSim.h" 2 3 // XXX this function forces us to define the camera (on the command line) and format (via the 4 // PPSIM.OUTPUT entry). In this case, we need to set config->format,formatName based on these 5 // values. This will be a problem when we want to load an input image (in order to add fake 6 // stars). We will need to add some logic in ppSimArguments to distinguish the cases of 1) 7 // input image and 2) specified camera 2 8 3 9 pmFPAfile *ppSimCreate(pmConfig *config) … … 25 31 file->save = true; 26 32 33 config->format = psMemIncrRefCounter (file->format); 34 config->formatName = psStringCopy (file->formatName); 35 27 36 // have we supplied a psf model? 28 37 if (psMetadataLookupPtr(NULL, config->arguments, "PSPHOT.PSF")) { 29 38 bool status = false; 39 40 // tie the psf file to the chipMosaic 30 41 pmFPAfileBindFromArgs(&status, file, config, "PSPHOT.PSF.LOAD", "PSPHOT.PSF"); 31 42 if (!status) { -
branches/eam_branch_20070817/ppSim/src/ppSimInsertSources.c
r14547 r14614 3 3 bool ppSimInsertSources (pmReadout *readout, psImage *expCorr, psArray *stars, pmConfig *config) { 4 4 5 bool mdok; 5 6 6 7 assert (stars); 8 assert (readout); 7 9 8 10 pmCell *cell = readout->parent; 9 11 pmChip *chip = cell->parent; 10 12 11 // XXX we probably need this to get the size right12 # if (0) 13 bool mdok;13 // XXX this is an estimate of the sky noise based on the inputs to the image simulation. 14 // XXX update this to allow the estimate based on the measured sky background 15 // XXX this is missing the gain. 14 16 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSIM_RECIPE); // Recipe 15 17 … … 29 31 // Rough noise estimate, appropriate for entire cell (use for source radius?) 30 32 float roughNoise = sqrtf(PS_SQR(readnoise) + (darkRate + skyRate) * expTime); 31 # endif32 33 33 34 int x0Chip = psMetadataLookupS32(NULL, chip->concepts, "CHIP.X0"); … … 43 44 int binning = psMetadataLookupS32(NULL, config->arguments, "BINNING"); // Binning in x and y 44 45 45 pmPSF *psf = psMetadataLookupPtr (NULL, chip->analysis, "PSF"); 46 pmPSF *psf = psMetadataLookupPtr (&mdok, chip->analysis, "PSPHOT.PSF"); 47 assert (psf); 46 48 47 49 int dX = PM_CELL_TO_CHIP (0.0, x0Cell, xParityCell, binning); … … 74 76 pmModelSetFlux (model, star->flux); 75 77 78 // XXX let the flux limit be a user-defined number of sky sigmas (not just 1.0) 79 float radius = model->modelRadius (model->params, roughNoise); 80 radius = PS_MAX (radius, 1.0); 81 76 82 // construct a source, with model flux pixels set, based on the model 77 pmSource *source = pmSourceFromModel (model, readout, PM_SOURCE_TYPE_STAR);83 pmSource *source = pmSourceFromModel (model, readout, radius, PM_SOURCE_TYPE_STAR); 78 84 79 85 // XXX add the sources to a source array 80 86 87 // insert the source flux in the image 81 88 pmSourceAddWithOffset (source, PM_MODEL_OP_FULL, 0xff, dX, dY); 82 89 } -
branches/eam_branch_20070817/ppSim/src/ppSimLoop.c
r14547 r14614 1 1 #include "ppSim.h" 2 2 3 psExitppSimLoop(pmConfig *config)3 bool ppSimLoop(pmConfig *config) 4 4 { 5 5 PS_ASSERT_PTR_NON_NULL(config, PS_EXIT_PROG_ERROR); … … 48 48 } 49 49 50 // XXX check for a supplied PSF, otherwise generate a basic one51 50 if (type == PPSIM_TYPE_OBJECT) { 52 // XXX TBD : ppSimSetPSF (chip, config); 51 if (!ppSimSetPSF (chip, config)) { 52 psError(PS_ERR_UNKNOWN, false, "failed IO for chip %d in ppSim\n", view->chip); 53 psFree (view); 54 return false; 55 } 53 56 } 54 57 … … 64 67 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "CELL.READDIR = 1 is the only supported mode."); 65 68 psFree(rng); 66 return PS_EXIT_CONFIG_ERROR;69 return false; 67 70 } 68 71 … … 90 93 ppSimMakeSky (readout, expCorr, type, config); 91 94 if (type == PPSIM_TYPE_FLAT) goto done; 92 93 // if (type == PPSIM_TYPE_OBJECT) {94 // ppSimInsertStars (readout, expCorr, stars, config, chip, cell);95 // }96 95 97 96 if (type == PPSIM_TYPE_OBJECT) { … … 123 122 psFree(rng); 124 123 psFree(view); 125 return PS_EXIT_SYS_ERROR; 124 // return PS_EXIT_SYS_ERROR; 125 return false; 126 126 } 127 127 } … … 135 135 psFree(rng); 136 136 psFree(view); 137 return PS_EXIT_SYS_ERROR; 137 // return PS_EXIT_SYS_ERROR; 138 return false; 138 139 } 139 140 … … 148 149 psFree(rng); 149 150 psFree(view); 150 return PS_EXIT_SYS_ERROR; 151 // return PS_EXIT_SYS_ERROR; 152 return false; 151 153 } 152 154 … … 154 156 psFree(view); 155 157 156 return 0;158 return true; 157 159 }
Note:
See TracChangeset
for help on using the changeset viewer.
