Changeset 27840 for branches/simtest_nebulous_branches/ppSim
- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 17 edited
- 1 copied
-
. (modified) (1 prop)
-
ppSim (modified) (1 prop)
-
ppSim/src/Makefile.am (modified) (3 diffs)
-
ppSim/src/ppSim.h (modified) (1 diff)
-
ppSim/src/ppSimAddNoise.c (modified) (1 diff)
-
ppSim/src/ppSimInsertGalaxies.c (modified) (2 diffs)
-
ppSim/src/ppSimInsertStars.c (modified) (4 diffs)
-
ppSim/src/ppSimLoadForceSources.c (modified) (1 diff)
-
ppSim/src/ppSimLoadStars.c (modified) (2 diffs)
-
ppSim/src/ppSimLoop.c (modified) (3 diffs)
-
ppSim/src/ppSimMakeStarGrid.c (copied) (copied from trunk/ppSim/src/ppSimMakeStarGrid.c )
-
ppSim/src/ppSimMakeStars.c (modified) (1 diff)
-
ppSim/src/ppSimPhotom.c (modified) (2 diffs)
-
ppSim/src/ppSimPhotomReadout.c (modified) (7 diffs)
-
ppSim/src/ppSimPhotomReadoutFake.c (modified) (6 diffs)
-
ppSim/src/ppSimPhotomReadoutForce.c (modified) (5 diffs)
-
ppSim/src/ppSimSetPSF.c (modified) (2 diffs)
-
ppSim/src/ppSimUtils.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/ppSim
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/ppSim merged eligible /branches/eam_branches/stackphot.20100406/ppSim 27629-27654 /branches/pap_delete/ppSim 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/simtest_nebulous_branches/ppSim/src/Makefile.am
r23808 r27840 30 30 ppSimLoadStars.c \ 31 31 ppSimMakeStars.c \ 32 ppSimMakeStarGrid.c \ 32 33 ppSimMakeGalaxies.c \ 33 34 ppSimMakeBiassec.c \ … … 47 48 ppSimLoadSpots.c \ 48 49 ppSimPhotom.c \ 49 ppSimPhotomReadoutFake.c \50 ppSimPhotomReadoutForce.c \51 50 ppSimPhotomFiles.c \ 52 51 ppSimLoadForceSources.c \ … … 59 58 ppSimBadCTE.c \ 60 59 ppSimVersion.c 60 61 # these functions have been broken by the API change in psphot (Jan 2010) 62 # ppSimPhotomReadoutFake.c 63 # ppSimPhotomReadoutForce.c 61 64 62 65 ppSimSequence_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PSASTRO_CFLAGS) $(ppSim_CFLAGS) -
branches/simtest_nebulous_branches/ppSim/src/ppSim.h
r23836 r27840 103 103 bool ppSimLoadStars (psArray *stars, pmFPA *fpa, pmConfig *config); 104 104 bool ppSimMakeStars(psArray *stars, pmFPA *fpa, pmConfig *config, const psRandom *rng); 105 bool ppSimMakeStarGrid(psArray *stars, pmFPA *fpa, pmConfig *config, const psRandom *rng); 105 106 bool ppSimInsertStars (pmReadout *readout, psImage *expCorr, psArray *stars, pmConfig *config); 106 107 -
branches/simtest_nebulous_branches/ppSim/src/ppSimAddNoise.c
r18011 r27840 16 16 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSIM_RECIPE); // Recipe 17 17 18 float gain = psMetadataLookupF32(NULL, cell->concepts, "CELL.GAIN"); // CCD gain, e/ADU 18 // the recipe should set GAIN to NAN, and only modify to override the concept value 19 float gain = psMetadataLookupF32(&mdok, recipe, "GAIN"); // CCD gain, e/ADU 19 20 if (isnan(gain)) { 20 psWarning("CELL.GAIN is not set; reverting to recipe value GAIN."); 21 gain = psMetadataLookupF32(&mdok, recipe, "GAIN"); 21 gain = psMetadataLookupF32(&mdok, cell->concepts, "CELL.GAIN"); 22 22 if (!mdok) { 23 ps Error(PS_ERR_BAD_PARAMETER_VALUE, false, "Unable to find GAIN in recipe.");24 return false;23 psWarning("CELL.GAIN is not set; assuming gain of 1.0."); 24 gain = 1.0; 25 25 } 26 26 } -
branches/simtest_nebulous_branches/ppSim/src/ppSimInsertGalaxies.c
r18011 r27840 74 74 int dY = PM_CELL_TO_CHIP (0.0, y0Cell, yParityCell, binning); 75 75 76 // psMetadataLookupPtr (readout->analysis, "PSPHOT.SOURCES", 0); 77 78 psArray *sources = psArrayAllocEmpty (galaxies->n); 79 76 pmDetections *detections = psMetadataLookupPtr (&mdok, readout->analysis, "PSPHOT.DETECTIONS"); 77 if (!detections) { 78 detections = pmDetectionsAlloc(); 79 detections->allSources = psArrayAllocEmpty (galaxies->n); 80 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_DATA_ARRAY | PS_META_REPLACE, "psphot detections", detections); 81 } else { 82 psMemIncrRefCounter (detections); 83 } 84 psArray *sources = sources = detections->allSources; 80 85 81 86 // add sources to the readout image & weight … … 181 186 } 182 187 183 // NOTE: readout must be part of the pmFPAfile named "PPSIM.OUTPUT"184 // psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY | PS_META_REPLACE, "psphot sources", sources);188 // XXX many leaks in here, i think 189 psFree (detections); 185 190 186 // XXX many leaks in here, i think187 191 return true; 188 192 } -
branches/simtest_nebulous_branches/ppSim/src/ppSimInsertStars.c
r21365 r27840 26 26 float expTime = psMetadataLookupF32(NULL, recipe, "EXPTIME"); // Exposure time 27 27 float darkRate = psMetadataLookupF32(NULL, recipe, "DARK.RATE"); // Dark rate 28 float nSigmaLim = psMetadataLookupF32(NULL, recipe, "STARS.SIGMA.LIM"); // significance of faintest stars 28 29 29 30 float readnoise = psMetadataLookupF32(NULL, cell->concepts, "CELL.READNOISE");// CCD read noise, e … … 106 107 pmModelSetFlux (model, flux); 107 108 108 // XXX let the flux limit be a user-defined number of sky sigmas (not just 1.0) 109 float radius = model->modelRadius (model->params, roughNoise); 109 float radius = model->modelRadius (model->params, nSigmaLim * roughNoise); 110 110 radius = PS_MAX (radius, 1.0); 111 111 … … 136 136 RESET(source->maskView); 137 137 RESET(source->modelFlux); 138 RESET(source->psf Flux);138 RESET(source->psfImage); 139 139 RESET(source->blends); 140 140 … … 145 145 fclose (outfile); 146 146 147 // NOTE: the pmFPAfile "PPSIM.OUTPUT" points at these sources 148 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "fake sources", sources); 149 psFree(sources); 147 pmDetections *detections = pmDetectionsAlloc(); 148 detections->allSources = sources; 149 150 // save detections on the readout->analysis 151 if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "fake sources", detections)) { 152 psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout"); 153 return false; 154 } 155 psFree(detections); 150 156 151 157 // XXX many leaks in here, i think -
branches/simtest_nebulous_branches/ppSim/src/ppSimLoadForceSources.c
r21365 r27840 102 102 RESET(source->maskView); 103 103 RESET(source->modelFlux); 104 RESET(source->psf Flux);104 RESET(source->psfImage); 105 105 RESET(source->blends); 106 106 -
branches/simtest_nebulous_branches/ppSim/src/ppSimLoadStars.c
r23413 r27840 30 30 psRegion *bounds = ppSimFPABounds (fpa); 31 31 float radius = 0.5 * PS_MAX(bounds->x1 - bounds->x0, bounds->y1 - bounds->y0) * scale; 32 psFree(bounds);33 32 34 33 float x0fpa = 0.5*(bounds->x0 + bounds->x1); 35 34 float y0fpa = 0.5*(bounds->y0 + bounds->y1); 35 36 psFree(bounds); 36 37 37 38 psMetadataAdd(astroRecipe, PS_LIST_TAIL, "RA_MIN", PS_DATA_F32 | PS_META_REPLACE, "", … … 41 42 psMetadataAdd(astroRecipe, PS_LIST_TAIL, "DEC_MIN", PS_DATA_F32 | PS_META_REPLACE, "", dec0 - radius); 42 43 psMetadataAdd(astroRecipe, PS_LIST_TAIL, "DEC_MAX", PS_DATA_F32 | PS_META_REPLACE, "", dec0 + radius); 43 psArray *refStars = psastroLoadRefstars(config, "P SASTRO.INPUT");44 psArray *refStars = psastroLoadRefstars(config, "PPSIM.OUTPUT"); 44 45 if (!refStars) { 45 46 psError(PS_ERR_UNKNOWN, false, "Unable to find reference stars."); -
branches/simtest_nebulous_branches/ppSim/src/ppSimLoop.c
r24486 r27840 30 30 ppSimType type = ppSimTypeFromString (typeStr); // Type of image to simulate 31 31 int binning = psMetadataLookupS32(NULL, recipe, "BINNING"); // Binning in x and y 32 33 ppSimUpdateConceptsFPA (fpa, config); 34 if (fpa->hdu) { // XXX only do this if there is no INPUT image 35 if (!ppSimInitHeader(config, fpa, NULL, NULL)) ESCAPE (PS_ERR_UNKNOWN, "problem setting output header"); 36 } 32 37 33 38 psArray *stars = psArrayAllocEmpty (1); … … 43 48 if (!ppSimMakeStars (stars, fpa, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "failed to make random stars"); 44 49 50 // Add random stars 51 if (!ppSimMakeStarGrid (stars, fpa, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "failed to make random stars"); 52 45 53 // Add random galaxies 46 54 if (!ppSimMakeGalaxies (galaxies, fpa, config, rng)) ESCAPE (PS_ERR_UNKNOWN, "failed to make random galaxies"); … … 57 65 psFree(view); 58 66 return false; 59 }60 61 ppSimUpdateConceptsFPA (fpa, config);62 if (fpa->hdu) { // XXX only do this if there is no INPUT image63 if (!ppSimInitHeader(config, fpa, NULL, NULL)) ESCAPE (PS_ERR_UNKNOWN, "problem setting output header");64 67 } 65 68 -
branches/simtest_nebulous_branches/ppSim/src/ppSimMakeStars.c
r18011 r27840 61 61 if (!status) { 62 62 refMag = brightMag; 63 refSum = 1;63 refSum = starsDensity * xSize * ySize * PS_SQR(scale * 180.0 / M_PI); 64 64 } 65 65 } else { -
branches/simtest_nebulous_branches/ppSim/src/ppSimPhotom.c
r21183 r27840 46 46 if (! readout->data_exists) { continue; } 47 47 48 // these are broken by the Jan 2010 API changes to psphot 49 #if 0 48 50 // run the actual photometry analysis 49 51 if (!ppSimPhotomReadoutFake (config, view)) { … … 56 58 } 57 59 // ppSimDetectionLimits (config, view); 60 #endif 58 61 } 59 62 } -
branches/simtest_nebulous_branches/ppSim/src/ppSimPhotomReadout.c
r21183 r27840 6 6 PS_ASSERT_PTR_NON_NULL (readout, NULL); 7 7 8 psArray *sources = psMetadataLookupPtr (NULL, readout->analysis, "PSPHOT.SOURCES"); 8 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS"); 9 psAssert (detections, "missing detections?"); 10 11 psArray *sources = detections->allSources; 9 12 return sources; 10 13 } … … 39 42 # if 0 40 43 // set the photcode for this image 41 if (!psphotAddPhotcode (recipe, config, view, "PPSIM.CHIP")) {44 if (!psphotAddPhotcodeReadout (recipe, config, view, "PPSIM.CHIP", 0)) { 42 45 psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 43 46 return false; … … 74 77 75 78 // Generate the mask and weight images, including the user-defined analysis region of interest 76 psphotSetMaskAndWeight (config, readout, recipe);79 psphotSetMaskAndWeight (config, view, recipe); 77 80 78 81 // load the psf model, if suppled. FWHM_X,FWHM_Y,etc are saved in the recipe … … 85 88 86 89 // generate a background model (median, smoothed image) 87 if (!psphotModelBackground (config, view, "PPSIM.CHIP")) {90 if (!psphotModelBackgroundReadoutFileIndex (config, view, "PPSIM.CHIP", 0)) { 88 91 return psphotReadoutCleanup (config, readout, recipe, NULL, NULL, NULL); 89 92 } 90 if (!psphotSubtractBackground (config, view, "PPSIM.CHIP")) {93 if (!psphotSubtractBackgroundReadout (config, view, "PPSIM.CHIP", 0)) { 91 94 return psphotReadoutCleanup (config, readout, recipe, NULL, NULL, NULL); 92 95 } … … 151 154 152 155 // create the exported-metadata and free local data 153 // XXX this places the sources on readout->analysis as PSPHOT.SOURCES. modify?154 // (or don't supply the sources, and do this with a different function)155 156 psphotReadoutCleanup(config, readout, recipe, NULL, psf, NULL); 156 157 … … 167 168 psAssert (forceReadout, "no forceReadout?"); 168 169 pmChipSetDataStatus (forceChip, true); 169 psMetadataAddArray (forceReadout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE, "forced photometry ", forceSources); 170 psFree (forceSources); 170 171 pmDetections *detectionsForce = pmDetectionsAlloc(); 172 detectionForce->allSources = forceSources; 173 174 // save detections on the readout->analysis 175 if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "force sources", detectionsForce)) { 176 psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout"); 177 return false; 178 } 179 psFree(detectionsForce); 171 180 172 181 pmCell *fakeCell = pmFPAfileThisCell (config->files, view, "PPSIM.FAKE.SOURCES"); psAssert (fakeCell, "no cell?"); … … 179 188 psAssert (fakeReadout, "no fakeReadout?"); 180 189 pmChipSetDataStatus (fakeChip, true); 181 psMetadataAddArray (fakeReadout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE, "fake photometry ", fakeSources); 190 191 pmDetections *detectionsFake = pmDetectionsAlloc(); 192 detectionFake->allSources = fakeSources; 193 194 // save detections on the readout->analysis 195 if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "fake sources", detectionsFake)) { 196 psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout"); 197 return false; 198 } 199 psFree(detectionsFake); 182 200 183 201 return true; -
branches/simtest_nebulous_branches/ppSim/src/ppSimPhotomReadoutFake.c
r21365 r27840 1 1 # include "ppSim.h" 2 2 3 // XXX this function is currently disabled -- need to update code below to distinguish the fake 4 // and force positions, etc 3 5 bool ppSimPhotomReadoutFake(pmConfig *config, const pmFPAview *view) { 4 6 … … 11 13 return false; 12 14 } 13 14 # if 015 // set the photcode for this image16 if (!psphotAddPhotcode (recipe, config, view, "PPSIM.FAKE.CHIP")) {17 psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode");18 return false;19 }20 # endif21 15 22 16 // *** in this section, perform the photometry for real + fake sources on PPSIM.FAKE.CHIP *** … … 36 30 37 31 // Generate the mask and variance images, including the user-defined analysis region of interest 38 psphotSetMaskAndVariance (config, readout, recipe);32 psphotSetMaskAndVariance (config, view); 39 33 40 34 // XXX need to define the source pixels … … 58 52 // load the psf model, if suppled. FWHM_X,FWHM_Y,etc are saved in the recipe 59 53 // this function uses PSPHOT.PSF.LOAD as the pmFPAfile 60 pmPSF *psf = psphotLoadPSF (config, view, recipe); 61 assert (psf); 54 psphotLoadPSF (config, view); 62 55 63 56 // remove all sources … … 65 58 66 59 // generate a background model (median, smoothed image) 67 if (!psphotModelBackground (config, view, "PPSIM.FAKE.CHIP")) {60 if (!psphotModelBackgroundReadoutFileIndex (config, view, "PPSIM.FAKE.CHIP", 0)) { 68 61 return psphotReadoutCleanup (config, readout, recipe, NULL, NULL, NULL); 69 62 } 70 if (!psphotSubtractBackground (config, view, "PPSIM.FAKE.CHIP")) {63 if (!psphotSubtractBackgroundReadout (config, view, "PPSIM.FAKE.CHIP", 0, recipe)) { 71 64 return psphotReadoutCleanup (config, readout, recipe, NULL, NULL, NULL); 72 65 } … … 118 111 psAssert (fakeReadout, "no fakeReadout?"); 119 112 pmChipSetDataStatus (fakeChip, true); 120 psMetadataAddArray (fakeReadout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE, "fake photometry ", fakeSources); 113 114 pmDetections *detections = pmDetectionsAlloc(); 115 detection->allSources = fakeSources; 116 117 psMetadataAddArray (fakeReadout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE, "fake photometry ", detections); 118 psFree(detections); 121 119 122 120 return true; -
branches/simtest_nebulous_branches/ppSim/src/ppSimPhotomReadoutForce.c
r21365 r27840 14 14 # if 0 15 15 // set the photcode for this image 16 if (!psphotAddPhotcode (recipe, config, view, "PPSIM.FAKE.CHIP")) {16 if (!psphotAddPhotcodeReadout (recipe, config, view, "PPSIM.FAKE.CHIP", 0)) { 17 17 psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 18 18 return false; … … 36 36 37 37 // Generate the mask and variance images, including the user-defined analysis region of interest 38 psphotSetMaskAndVariance (config, readout, recipe);38 psphotSetMaskAndVariance (config, view, recipe); 39 39 40 40 // XXX need to define the source pixels … … 58 58 59 59 // generate a background model (median, smoothed image) 60 if (!psphotModelBackground (config, view, "PPSIM.FORCE.CHIP")) {60 if (!psphotModelBackgroundReadoutFileIndex (config, view, "PPSIM.FORCE.CHIP", 0)) { 61 61 return psphotReadoutCleanup (config, readout, recipe, NULL, NULL, NULL); 62 62 } 63 if (!psphotSubtractBackground (config, view, "PPSIM.FORCE.CHIP")) {63 if (!psphotSubtractBackgroundReadout (config, view, "PPSIM.FORCE.CHIP", 0)) { 64 64 return psphotReadoutCleanup (config, readout, recipe, NULL, NULL, NULL); 65 65 } … … 98 98 99 99 // create the exported-metadata and free local data 100 // XXX this places the sources on readout->analysis as PSPHOT.SOURCES. modify?101 // (or don't supply the sources, and do this with a different function)102 100 psphotReadoutCleanup(config, readout, recipe, NULL, psf, NULL); 103 101 … … 111 109 psAssert (forceReadout, "no forceReadout?"); 112 110 pmChipSetDataStatus (forceChip, true); 113 psMetadataAddArray (forceReadout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE, "force photometry ", forceSources); 111 112 pmDetections *detections = pmDetectionsAlloc(); 113 detection->allSources = forceSources; 114 psMetadataAddArray (forceReadout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE, "force photometry ", detections); 115 psFree(detections); 114 116 115 117 return true; -
branches/simtest_nebulous_branches/ppSim/src/ppSimSetPSF.c
r18011 r27840 20 20 // ppSimArguments) 21 21 float seeing = psMetadataLookupF32(&status, recipe, "SEEING"); // Seeing SIGMA (pixels) 22 float aRatio = psMetadataLookupF32(&status, recipe, "PSF.ARATIO"); // Seeing SIGMA (pixels) 23 float theta = psMetadataLookupF32(&status, recipe, "PSF.THETA"); // Seeing SIGMA (pixels) 22 24 23 25 char *psfModelName = psMetadataLookupStr(&status, recipe, "PSF.MODEL"); // Name of PSF model … … 55 57 // supply the semi-major axis (these are SIGMA values in PIXELS) 56 58 axes.major = seeing; 57 axes.minor = seeing;58 axes.theta = 0.0;59 axes.minor = aRatio * seeing; 60 axes.theta = theta * PS_RAD_DEG; 59 61 60 62 pol = psEllipseAxesToPol (axes); -
branches/simtest_nebulous_branches/ppSim/src/ppSimUtils.c
r24807 r27840 270 270 psArray *ppSimSelectSources (pmConfig *config, const pmFPAview *view, const char *filename) { 271 271 272 bool status; 273 272 274 pmReadout *readout = pmFPAfileThisReadout (config->files, view, filename); 273 275 PS_ASSERT_PTR_NON_NULL (readout, NULL); 274 276 275 psArray *sources = psMetadataLookupPtr (NULL, readout->analysis, "PSPHOT.SOURCES"); 277 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS"); 278 psAssert (detections, "missing detections?"); 279 280 psArray *sources = detections->allSources; 276 281 return sources; 277 282 }
Note:
See TracChangeset
for help on using the changeset viewer.
