Changeset 24244 for branches/cnb_branches/cnb_branch_20090301/ppSim/src
- Timestamp:
- May 26, 2009, 1:59:32 PM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090301
- Files:
-
- 9 edited
- 1 copied
-
. (modified) (1 prop)
-
ppSim/src (modified) (1 prop)
-
ppSim/src/Makefile.am (modified) (1 diff)
-
ppSim/src/ppSim.h (modified) (1 diff)
-
ppSim/src/ppSimArguments.c (modified) (2 diffs)
-
ppSim/src/ppSimCreate.c (modified) (8 diffs)
-
ppSim/src/ppSimSequenceObject.c (modified) (1 diff)
-
ppSim/src/ppSimUtils.c (modified) (10 diffs)
-
ppSim/src/ppSimVersion.c (modified) (3 diffs)
-
ppSim/src/ppSimVersionDefinitions.h.in (copied) (copied from trunk/ppSim/src/ppSimVersionDefinitions.h.in )
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090301
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090301/ppSim/src
- Property svn:ignore
-
old new 8 8 .libs 9 9 ppSimSequence 10 ppSimVersionDefinitions.h
-
- Property svn:ignore
-
branches/cnb_branches/cnb_branch_20090301/ppSim/src/Makefile.am
r23594 r24244 1 1 bin_PROGRAMS = ppSim ppSimSequence 2 2 3 # PPSIM_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 # PPSIM_BRANCH=`if [ -e ../../BRANCH ]; then cat ../../BRANCH; else svn info | sed -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'; fi` 5 # PPSIM_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 6 # 7 # # Force recompilation of ppSimVersion.c, since it gets the version information 8 # ppSimVersion.c: FORCE 9 # touch ppSimVersion.c 10 # FORCE: ; 3 if HAVE_SVNVERSION 4 PPSIM_VERSION=`$(SVNVERSION) ..` 5 else 6 PPSIM_VERSION="UNKNOWN" 7 endif 11 8 12 ppSim_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PSPHOT_CFLAGS) $(PSASTRO_CFLAGS) $(ppSim_CFLAGS) -DPPSIM_VERSION=$(SVN_VERSION) -DPPSIM_BRANCH=$(SVN_BRANCH) -DPPSIM_SOURCE=$(SVN_SOURCE) 9 if HAVE_SVN 10 PPSIM_BRANCH=`$(SVN) info .. | $(SED) -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'` 11 PPSIM_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'` 12 else 13 PPSIM_BRANCH="UNKNOWN" 14 PPSIM_SOURCE="UNKNOWN" 15 endif 16 17 # Force recompilation of ppSimVersion.c, since it gets the version information 18 ppSimVersion.c: ppSimVersionDefinitions.h 19 ppSimVersionDefinitions.h: ppSimVersionDefinitions.h.in FORCE 20 -$(RM) ppSimVersionDefinitions.h 21 $(SED) -e "s|@PPSIM_VERSION@|\"$(PPSIM_VERSION)\"|" -e "s|@PPSIM_BRANCH@|\"$(PPSIM_BRANCH)\"|" -e "s|@PPSIM_SOURCE@|\"$(PPSIM_SOURCE)\"|" ppSimVersionDefinitions.h.in > ppSimVersionDefinitions.h 22 FORCE: ; 23 24 ppSim_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PSPHOT_CFLAGS) $(PSASTRO_CFLAGS) $(ppSim_CFLAGS) 13 25 ppSim_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PSPHOT_LIBS) $(PSASTRO_LIBS) 14 26 ppSim_SOURCES = \ -
branches/cnb_branches/cnb_branch_20090301/ppSim/src/ppSim.h
r23594 r24244 183 183 char *ppSimTypeToString (ppSimType type); 184 184 185 float ppSimGetZeroPoint (psMetadata *recipe,char *filter);185 float ppSimGetZeroPoint(psMetadata *recipe, const char *filter); 186 186 187 187 bool ppSimMergeReadouts (pmConfig *config, pmFPAview *view); -
branches/cnb_branches/cnb_branch_20090301/ppSim/src/ppSimArguments.c
r18011 r24244 31 31 psMetadataAddStr(arguments, PS_LIST_TAIL, "-format", 0, "Camera format name", NULL); 32 32 psMetadataAddStr(arguments, PS_LIST_TAIL, "-type", 0, "Exposure type (BIAS|DARK|FLAT|OBJECT)", NULL); 33 psMetadataAddStr(arguments, PS_LIST_TAIL, "-obs_mode", 0, "observation mode", NULL); 33 34 psMetadataAddStr(arguments, PS_LIST_TAIL, "-filter", 0, "Filter name", NULL); 34 35 psMetadataAddF32(arguments, PS_LIST_TAIL, "-exptime", 0, "Exposure time (s)", NAN); … … 108 109 ppSimArgToRecipeF32(&status, options, "STARS.DENSITY", arguments, "-starsdensity"); 109 110 ppSimArgToRecipeBool(&status, options, "PHOTOM", arguments, "+photom"); 111 psString obs_mode = psMetadataLookupStr(&status, arguments, "-obs_mode"); 112 if (obs_mode) { 113 psMetadataAddStr(options, PS_LIST_TAIL, "OBS_MODE", 0, "observation mode", obs_mode); 114 } 115 110 116 111 117 // if we are loading the input image (not creating it), then we can skip the remaining arguments -
branches/cnb_branches/cnb_branch_20090301/ppSim/src/ppSimCreate.c
r18011 r24244 12 12 pmFPAfile *input = pmFPAfileDefineFromArgs (&status, config, "PPSIM.INPUT", "INPUT"); 13 13 if (!input) { 14 // if we have not specified the camera already, we need to interpolate the recipes associated with this camera, and read other command-line recipes15 if (!pmConfigReadRecipes(config, PM_RECIPE_SOURCE_CL)) {16 psError(PS_ERR_IO, false, "Error merging recipes from camera config for %s", config->cameraName);17 return NULL;18 }14 // if we have not specified the camera already, we need to interpolate the recipes associated with this camera, and read other command-line recipes 15 if (!pmConfigReadRecipes(config, PM_RECIPE_SOURCE_CL)) { 16 psError(PS_ERR_IO, false, "Error merging recipes from camera config for %s", config->cameraName); 17 return NULL; 18 } 19 19 } else { 20 // If an image is supplied, we still generate a fake image and merge them together downstream21 // (otherwise, we get the variance wrong).22 if (input->type != PM_FPA_FILE_IMAGE) {23 psError(PS_ERR_IO, true, "PPSIM.INPUT is not of type IMAGE");24 return NULL;25 }20 // If an image is supplied, we still generate a fake image and merge them together downstream 21 // (otherwise, we get the variance wrong). 22 if (input->type != PM_FPA_FILE_IMAGE) { 23 psError(PS_ERR_IO, true, "PPSIM.INPUT is not of type IMAGE"); 24 return NULL; 25 } 26 26 } 27 27 … … 30 30 fpa = pmFPAConstruct(config->camera, config->cameraName); // FPA to contain the observation 31 31 if (!fpa) { 32 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to construct an FPA from camera configuration.");33 return NULL;32 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to construct an FPA from camera configuration."); 33 return NULL; 34 34 } 35 35 … … 37 37 pmFPAfile *output = pmFPAfileDefineOutput(config, fpa, "PPSIM.OUTPUT"); 38 38 if (!output) { 39 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to create output file from PPSIM.OUTPUT. Did you forget to specify the format?");40 return NULL;39 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to create output file from PPSIM.OUTPUT. Did you forget to specify the format?"); 40 return NULL; 41 41 } 42 42 if (output->type != PM_FPA_FILE_IMAGE) { 43 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "PPSIM.OUTPUT type is not IMAGE");44 psFree(fpa);45 return NULL;43 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "PPSIM.OUTPUT type is not IMAGE"); 44 psFree(fpa); 45 return NULL; 46 46 } 47 47 // XXX we should not require the output image to be written … … 58 58 59 59 if (type == PPSIM_TYPE_OBJECT) { 60 // adjust the seeing by the scale61 float seeing = psMetadataLookupF32(&status, recipe, "SEEING");62 if (isnan(seeing)) {63 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "seeing is not defined");64 psFree(fpa);65 return NULL;66 }67 float scale = psMetadataLookupF32(&status, recipe, "PIXEL.SCALE");68 if (isnan(scale)) {69 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "pixel scale is not defined");70 psFree(fpa);71 return NULL;72 }73 psMetadataAddF32(recipe, PS_LIST_TAIL, "SEEING", PS_META_REPLACE, "Seeing SIGMA (pixels)", seeing / 2.0 / sqrt(2.0 * log(2.0)) / scale);74 75 // if we have been supplied an input image, but no ra & dec, use the input image values76 if (input) {77 float ra = psMetadataLookupF32(&status, recipe, "RA");78 if (isnan(ra)) {79 ra = psMetadataLookupF64(&status, input->fpa->concepts, "FPA.RA");80 psMetadataAddF32(recipe, PS_LIST_TAIL, "RA", PS_META_REPLACE, "ra (radians)", ra);81 }82 float dec = psMetadataLookupF32(&status, recipe, "DEC");83 if (isnan(dec)) {84 dec = psMetadataLookupF64(&status, input->fpa->concepts, "FPA.DEC");85 psMetadataAddF32(recipe, PS_LIST_TAIL, "DEC", PS_META_REPLACE, "dec (radians)", dec);86 }87 }60 // adjust the seeing by the scale 61 float seeing = psMetadataLookupF32(&status, recipe, "SEEING"); 62 if (isnan(seeing)) { 63 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "seeing is not defined"); 64 psFree(fpa); 65 return NULL; 66 } 67 float scale = psMetadataLookupF32(&status, recipe, "PIXEL.SCALE"); 68 if (isnan(scale)) { 69 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "pixel scale is not defined"); 70 psFree(fpa); 71 return NULL; 72 } 73 psMetadataAddF32(recipe, PS_LIST_TAIL, "SEEING", PS_META_REPLACE, "Seeing SIGMA (pixels)", seeing / 2.0 / sqrt(2.0 * log(2.0)) / scale); 74 75 // if we have been supplied an input image, but no ra & dec, use the input image values 76 if (input) { 77 float ra = psMetadataLookupF32(&status, recipe, "RA"); 78 if (isnan(ra)) { 79 ra = psMetadataLookupF64(&status, input->fpa->concepts, "FPA.RA"); 80 psMetadataAddF32(recipe, PS_LIST_TAIL, "RA", PS_META_REPLACE, "ra (radians)", ra); 81 } 82 float dec = psMetadataLookupF32(&status, recipe, "DEC"); 83 if (isnan(dec)) { 84 dec = psMetadataLookupF64(&status, input->fpa->concepts, "FPA.DEC"); 85 psMetadataAddF32(recipe, PS_LIST_TAIL, "DEC", PS_META_REPLACE, "dec (radians)", dec); 86 } 87 } 88 88 } 89 89 90 90 if ((type == PPSIM_TYPE_OBJECT) || (type == PPSIM_TYPE_FLAT)) { 91 // determine the zeropoint from the filter92 float zp = psMetadataLookupF32(&status, recipe, "ZEROPOINT");93 if (isnan(zp)) {94 char *filter = psMetadataLookupStr(&status, recipe, "FILTER");95 float zp = ppSimGetZeroPoint (recipe, filter);96 psMetadataAddF32(recipe, PS_LIST_TAIL, "ZEROPOINT", PS_META_REPLACE, "Photometric zeropoint", zp);97 }91 // determine the zeropoint from the filter 92 float zp = psMetadataLookupF32(&status, recipe, "ZEROPOINT"); 93 if (isnan(zp)) { 94 char *filter = psMetadataLookupStr(&status, recipe, "FILTER"); 95 float zp = ppSimGetZeroPoint (recipe, filter); 96 psMetadataAddF32(recipe, PS_LIST_TAIL, "ZEROPOINT", PS_META_REPLACE, "Photometric zeropoint", zp); 97 } 98 98 } 99 99 … … 103 103 if (doPhotom) { 104 104 105 // XXX at the moment, we can perform photometry on the fake sources and the forced106 // photometry positions, but not one or the other. Also, we only support photometry in107 // the context of an image previously analysed by psphot. Add support for:108 // * photometry of a pure fake image (requires peak detection and psf creation)109 // * photometry of forced source positions without fake image (this might work, it just110 // requires not generating any fake features).111 112 if (!input) {113 psError(PS_ERR_UNKNOWN, false, "input image not found; currently required for photometry");114 return NULL;115 }116 117 // we need a chip image if we perform photometry (is it necessary to build it if we don't use it?)118 pmFPAfile *fakeImage = pmFPAfileDefineChipMosaic(config, output->fpa, "PPSIM.FAKE.CHIP");119 if (!fakeImage) {120 psError(PS_ERR_IO, false, _("Unable to generate new file from PPSIM.FAKE.CHIP"));121 psFree(fpa);122 return NULL;123 }124 if (fakeImage->type != PM_FPA_FILE_IMAGE) {125 psError(PS_ERR_IO, true, "PPSIM.FAKE.CHIP is not of type IMAGE");126 psFree(fpa);127 return NULL;128 }129 130 // we need a chip image if we perform photometry (is it necessary to build it if we don't use it?)131 pmFPAfile *forceImage = NULL;132 if (input) {133 forceImage = pmFPAfileDefineChipMosaic(config, input->fpa, "PPSIM.FORCE.CHIP");134 if (!forceImage) {135 psError(PS_ERR_IO, false, _("Unable to generate new file from PPSIM.FORCE.CHIP"));136 psFree(fpa);137 return NULL;138 }139 if (forceImage->type != PM_FPA_FILE_IMAGE) {140 psError(PS_ERR_IO, true, "PPSIM.FORCE.CHIP is not of type IMAGE");141 psFree(fpa);142 return NULL;143 }144 }145 146 // define associated psphot input/output files147 if (!ppSimPhotomFiles (config, fakeImage, forceImage)) {148 psError(PSPHOT_ERR_CONFIG, false, "Trouble defining the additional input/output files for psphot");149 psFree(fpa);150 return NULL;151 }105 // XXX at the moment, we can perform photometry on the fake sources and the forced 106 // photometry positions, but not one or the other. Also, we only support photometry in 107 // the context of an image previously analysed by psphot. Add support for: 108 // * photometry of a pure fake image (requires peak detection and psf creation) 109 // * photometry of forced source positions without fake image (this might work, it just 110 // requires not generating any fake features). 111 112 if (!input) { 113 psError(PS_ERR_UNKNOWN, false, "input image not found; currently required for photometry"); 114 return NULL; 115 } 116 117 // we need a chip image if we perform photometry (is it necessary to build it if we don't use it?) 118 pmFPAfile *fakeImage = pmFPAfileDefineChipMosaic(config, output->fpa, "PPSIM.FAKE.CHIP"); 119 if (!fakeImage) { 120 psError(PS_ERR_IO, false, _("Unable to generate new file from PPSIM.FAKE.CHIP")); 121 psFree(fpa); 122 return NULL; 123 } 124 if (fakeImage->type != PM_FPA_FILE_IMAGE) { 125 psError(PS_ERR_IO, true, "PPSIM.FAKE.CHIP is not of type IMAGE"); 126 psFree(fpa); 127 return NULL; 128 } 129 130 // we need a chip image if we perform photometry (is it necessary to build it if we don't use it?) 131 pmFPAfile *forceImage = NULL; 132 if (input) { 133 forceImage = pmFPAfileDefineChipMosaic(config, input->fpa, "PPSIM.FORCE.CHIP"); 134 if (!forceImage) { 135 psError(PS_ERR_IO, false, _("Unable to generate new file from PPSIM.FORCE.CHIP")); 136 psFree(fpa); 137 return NULL; 138 } 139 if (forceImage->type != PM_FPA_FILE_IMAGE) { 140 psError(PS_ERR_IO, true, "PPSIM.FORCE.CHIP is not of type IMAGE"); 141 psFree(fpa); 142 return NULL; 143 } 144 } 145 146 // define associated psphot input/output files 147 if (!ppSimPhotomFiles (config, fakeImage, forceImage)) { 148 psError(PSPHOT_ERR_CONFIG, false, "Trouble defining the additional input/output files for psphot"); 149 psFree(fpa); 150 return NULL; 151 } 152 152 } else { 153 // have we supplied a psf model? this happens in ppSimPhotomFiles if we request a photometry154 // analysis. however, even if we do not, a psf model may be used to generate the fake155 // sources.156 if (psMetadataLookupPtr(NULL, config->arguments, "PSPHOT.PSF")) {157 // tie the psf file to the chipMosaic 158 pmFPAfileBindFromArgs(&status, output, config, "PSPHOT.PSF.LOAD", "PSPHOT.PSF");159 if (!status) {160 psError(PS_ERR_UNKNOWN, false, "Failed to find/build PSPHOT.PSF.LOAD");161 psFree(fpa);162 return NULL;163 }164 }153 // have we supplied a psf model? this happens in ppSimPhotomFiles if we request a photometry 154 // analysis. however, even if we do not, a psf model may be used to generate the fake 155 // sources. 156 if (psMetadataLookupPtr(NULL, config->arguments, "PSPHOT.PSF")) { 157 // tie the psf file to the chipMosaic 158 pmFPAfileBindFromArgs(&status, output, config, "PSPHOT.PSF.LOAD", "PSPHOT.PSF"); 159 if (!status) { 160 psError(PS_ERR_UNKNOWN, false, "Failed to find/build PSPHOT.PSF.LOAD"); 161 psFree(fpa); 162 return NULL; 163 } 164 } 165 165 } 166 166 … … 169 169 pmFPAfile *simSources = pmFPAfileDefineOutput (config, output->fpa, "PPSIM.SOURCES"); 170 170 if (!simSources) { 171 psError(PS_ERR_UNKNOWN, false, "Cannot find a rule for PPSIM.SOURCES");172 return false;171 psError(PS_ERR_UNKNOWN, false, "Cannot find a rule for PPSIM.SOURCES"); 172 return false; 173 173 } 174 174 simSources->save = true; … … 176 176 // if we have loaded an input image, we derive certain values from the image, if possible 177 177 if (input) { 178 // we need to extract certain metadata from the image and populate the recipe. 179 // or else we need to set the fpa concepts based on the recipe options... 180 181 psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, PPSIM_RECIPE); // Recipe 182 183 ppSimArgToRecipeF32(&status, recipe, "EXPTIME", input->fpa->concepts, "FPA.EXPOSURE"); 184 char *filter = ppSimArgToRecipeStr(&status, recipe, "FILTER", input->fpa->concepts, "FPA.FILTER"); 185 186 float zp = ppSimGetZeroPoint (recipe, filter); 187 psMetadataAddF32(recipe, PS_LIST_TAIL, "ZEROPOINT", PS_META_REPLACE, "Photometric zeropoint", zp); 178 // we need to extract certain metadata from the image and populate the recipe. 179 // or else we need to set the fpa concepts based on the recipe options... 180 181 psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, PPSIM_RECIPE); // Recipe 182 183 ppSimArgToRecipeF32(&status, recipe, "EXPTIME", input->fpa->concepts, "FPA.EXPOSURE"); 184 char *filter = ppSimArgToRecipeStr(&status, recipe, "FILTER", input->fpa->concepts, "FPA.FILTERID"); 185 186 float zp = ppSimGetZeroPoint(recipe, filter); 187 if (!isfinite(zp)) { 188 psError(PS_ERR_UNKNOWN, false, "Unable to find zero point for filter %s", filter); 189 psFree(fpa); 190 return NULL; 191 } 192 psMetadataAddF32(recipe, PS_LIST_TAIL, "ZEROPOINT", PS_META_REPLACE, "Photometric zeropoint", zp); 188 193 } 189 194 … … 193 198 194 199 if (phuLevel == PM_FPA_LEVEL_FPA) { 195 if (!pmFPAAddSourceFromView(fpa, "Simulation", view, output->format)) {196 psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");197 psFree(fpa);198 psFree(view);199 return NULL;200 }200 if (!pmFPAAddSourceFromView(fpa, "Simulation", view, output->format)) { 201 psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA."); 202 psFree(fpa); 203 psFree(view); 204 return NULL; 205 } 201 206 } 202 207 203 208 pmChip *chip; // Chip from FPA 204 209 while ((chip = pmFPAviewNextChip(view, fpa, 1))) { 205 if (phuLevel == PM_FPA_LEVEL_CHIP) {206 if (!pmFPAAddSourceFromView(fpa, "Simulation", view, output->format)) {207 psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");208 psFree(fpa);209 psFree(view);210 return NULL;211 }212 }213 214 pmCell *cell; // Cell from chip215 while ((cell = pmFPAviewNextCell(view, fpa, 1))) {216 if (phuLevel == PM_FPA_LEVEL_CELL) {217 if (!pmFPAAddSourceFromView(fpa, "Simulation", view, output->format)) {218 psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA.");219 psFree(fpa);220 psFree(view);221 return NULL;222 }223 }224 }210 if (phuLevel == PM_FPA_LEVEL_CHIP) { 211 if (!pmFPAAddSourceFromView(fpa, "Simulation", view, output->format)) { 212 psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA."); 213 psFree(fpa); 214 psFree(view); 215 return NULL; 216 } 217 } 218 219 pmCell *cell; // Cell from chip 220 while ((cell = pmFPAviewNextCell(view, fpa, 1))) { 221 if (phuLevel == PM_FPA_LEVEL_CELL) { 222 if (!pmFPAAddSourceFromView(fpa, "Simulation", view, output->format)) { 223 psError(PS_ERR_UNKNOWN, false, "Unable to add PHU to FPA."); 224 psFree(fpa); 225 psFree(view); 226 return NULL; 227 } 228 } 229 } 225 230 } 226 231 -
branches/cnb_branches/cnb_branch_20090301/ppSim/src/ppSimSequenceObject.c
r19315 r24244 95 95 psStringAppend (&command, " -dec %f", dec); 96 96 psStringAppend (&command, " -pa %f", pos); 97 psStringAppend (&command, " -obs_mode OBJECT.%s", (char *) filters->data[i]); 97 98 98 99 double frnd = psRandomUniform(rng); -
branches/cnb_branches/cnb_branch_20090301/ppSim/src/ppSimUtils.c
r20365 r24244 112 112 ppSimType ppSimTypeFromString (char *typeStr) { 113 113 114 if (!strcasecmp (typeStr, "BIAS")) return PPSIM_TYPE_BIAS;115 if (!strcasecmp (typeStr, "DARK")) return PPSIM_TYPE_DARK;116 if (!strcasecmp (typeStr, "FLAT")) return PPSIM_TYPE_FLAT;114 if (!strcasecmp (typeStr, "BIAS")) return PPSIM_TYPE_BIAS; 115 if (!strcasecmp (typeStr, "DARK")) return PPSIM_TYPE_DARK; 116 if (!strcasecmp (typeStr, "FLAT")) return PPSIM_TYPE_FLAT; 117 117 if (!strcasecmp (typeStr, "OBJECT")) return PPSIM_TYPE_OBJECT; 118 118 psAbort("Should never get here."); … … 133 133 134 134 char *typeStr = psMetadataLookupStr(NULL, recipe, "IMAGE.TYPE"); // Type of image to simulate 135 char *obs_mode = psMetadataLookupStr(NULL, recipe, "OBS_MODE"); 135 136 136 137 psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.OBSTYPE", PS_META_REPLACE, "Observation type", typeStr); 137 138 psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.OBJECT", PS_META_REPLACE, "Observation name", typeStr); 139 psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.OBS.MODE", PS_META_REPLACE, "Observation mode", obs_mode); 138 140 psMetadataAddF32(fpa->concepts, PS_LIST_TAIL, "FPA.EXPOSURE", PS_META_REPLACE, "Exposure time (sec)", expTime); 139 141 psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.FILTERID", PS_META_REPLACE, "Filter name", filter); … … 174 176 if (binning <= 0) { 175 177 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Binning (%d) is non-positive.", binning); 176 exit(PS_EXIT_CONFIG_ERROR);178 exit(PS_EXIT_CONFIG_ERROR); 177 179 } 178 180 return true; … … 181 183 // Get a value from the command-line arguments and add it to recipe options 182 184 float ppSimArgToRecipeF32(bool *status, 183 psMetadata *options, // Target to which to add value184 const char *recipeName, // Name for value in the recipe185 psMetadata *arguments, // Command-line arguments186 const char *argName// Argument name in the command-line arguments185 psMetadata *options, // Target to which to add value 186 const char *recipeName, // Name for value in the recipe 187 psMetadata *arguments, // Command-line arguments 188 const char *argName // Argument name in the command-line arguments 187 189 ) 188 190 { … … 198 200 // Get a value from the command-line arguments and add it to recipe options 199 201 int ppSimArgToRecipeS32(bool *status, 200 psMetadata *options, // Target to which to add value201 const char *recipeName, // Name for value in the recipe202 psMetadata *arguments, // Command-line arguments203 const char *argName// Argument name in the command-line arguments202 psMetadata *options, // Target to which to add value 203 const char *recipeName, // Name for value in the recipe 204 psMetadata *arguments, // Command-line arguments 205 const char *argName // Argument name in the command-line arguments 204 206 ) 205 207 { … … 214 216 // Get a value from the command-line arguments and add it to recipe options 215 217 bool ppSimArgToRecipeBool(bool *status, 216 psMetadata *options, // Target to which to add value217 const char *recipeName, // Name for value in the recipe218 psMetadata *arguments, // Command-line arguments219 const char *argName// Argument name in the command-line arguments218 psMetadata *options, // Target to which to add value 219 const char *recipeName, // Name for value in the recipe 220 psMetadata *arguments, // Command-line arguments 221 const char *argName // Argument name in the command-line arguments 220 222 ) 221 223 { … … 231 233 // if it is not specified, do not override the existing recipe value 232 234 char *ppSimArgToRecipeStr(bool *status, 233 psMetadata *options, // Target to which to add value234 const char *recipeName, // Name for value in the recipe235 psMetadata *arguments, // Command-line arguments236 const char *argName// Argument name in the command-line arguments235 psMetadata *options, // Target to which to add value 236 const char *recipeName, // Name for value in the recipe 237 psMetadata *arguments, // Command-line arguments 238 const char *argName // Argument name in the command-line arguments 237 239 ) 238 240 { … … 241 243 char *value = psMetadataLookupStr(&myStatus, arguments, argName); // Value of interest 242 244 if (status) { 243 *status = myStatus;245 *status = myStatus; 244 246 } 245 247 if (!value) return NULL; … … 248 250 } 249 251 250 float ppSimGetZeroPoint (psMetadata *recipe, char *filter) {251 252 bool mdok;253 float zp;252 float ppSimGetZeroPoint(psMetadata *recipe, const char *filter) 253 { 254 PS_ASSERT_METADATA_NON_NULL(recipe, NAN); 255 PS_ASSERT_STRING_NON_EMPTY(filter, NAN); 254 256 255 257 // use the filter to get the zeropoint from the recipe 256 psMetadataItem *zpItem = psMetadataLookup (recipe, "ZEROPTS"); 257 // check that item is multi... 258 259 psArray *entries = psListToArray (zpItem->data.list); 260 261 // search for matching filter 262 for (int i = 0; i < entries->n; i++) { 263 psMetadataItem *item = entries->data[i]; 264 psMetadata *entry = item->data.V; 265 266 char *filterName = psMetadataLookupStr (&mdok, entry, "FILTER"); 267 assert (filterName); 268 269 if (strcmp(filterName, filter)) continue; 270 271 zp = psMetadataLookupF32 (&mdok, entry, "ZERO_PT"); 272 assert (mdok); 273 psFree (entries); 274 return zp; 275 } 276 psFree (entries); 277 return NAN; 258 psMetadata *zeropoints = psMetadataLookupMetadata(NULL, recipe, "ZEROPTS"); 259 if (!zeropoints) { 260 psError(PS_ERR_UNKNOWN, false, "Unable to find ZEROPTS in recipe"); 261 return NAN; 262 } 263 264 return psMetadataLookupF32(NULL, zeropoints, filter); 278 265 } 279 266 … … 295 282 296 283 for (int i = 0; i < sources->n; i++) { 297 pmSource *source = sources->data[i];284 pmSource *source = sources->data[i]; 298 285 299 286 // allocate image, weight, mask arrays for each peak (square of radius OUTER) -
branches/cnb_branches/cnb_branch_20090301/ppSim/src/ppSimVersion.c
r23352 r24244 1 1 #include "ppSim.h" 2 #include "ppSimVersionDefinitions.h" 2 3 3 4 #ifndef PPSIM_VERSION … … 11 12 #endif 12 13 13 #define xstr(s) str(s)14 #define str(s) #s15 16 14 psString ppSimVersion(void) 17 15 { 18 16 char *value = NULL; 19 psStringAppend(&value, "%s@%s", xstr(PPSIM_BRANCH), xstr(PPSIM_VERSION));17 psStringAppend(&value, "%s@%s", PPSIM_BRANCH, PPSIM_VERSION); 20 18 return value; 21 19 } … … 23 21 psString ppSimSource(void) 24 22 { 25 return psStringCopy( xstr(PPSIM_SOURCE));23 return psStringCopy(PPSIM_SOURCE); 26 24 } 27 25
Note:
See TracChangeset
for help on using the changeset viewer.
