Changeset 12834 for trunk/ppSim
- Timestamp:
- Apr 16, 2007, 10:13:57 AM (19 years ago)
- Location:
- trunk/ppSim
- Files:
-
- 6 edited
-
. (modified) (1 prop)
-
.cvsignore (modified) (1 diff)
-
src/ppSim.h (modified) (1 diff)
-
src/ppSimArguments.c (modified) (5 diffs)
-
src/ppSimCreate.c (modified) (2 diffs)
-
src/ppSimLoop.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim
- Property svn:ignore
-
old new 13 13 Makefile.in 14 14 missing 15 test
-
- Property svn:ignore
-
trunk/ppSim/.cvsignore
r12833 r12834 13 13 Makefile.in 14 14 missing 15 test -
trunk/ppSim/src/ppSim.h
r12833 r12834 24 24 /// 25 25 /// Returns a borrowed pointer to the FPA file. 26 pmFPAfile *ppSimCreate( constpmConfig *config ///< Configuration26 pmFPAfile *ppSimCreate(pmConfig *config ///< Configuration 27 27 ); 28 28 -
trunk/ppSim/src/ppSimArguments.c
r12833 r12834 55 55 psMetadataAddStr(arguments, PS_LIST_TAIL, "-format", 0, "Camera format name", NULL); 56 56 psMetadataAddStr(arguments, PS_LIST_TAIL, "-type", 0, "Exposure type (BIAS|DARK|FLAT|OBJECT)", NULL); 57 psMetadataAddStr(arguments, PS_LIST_TAIL, "-filter", 0, "Filter name", NULL); 57 58 psMetadataAddF32(arguments, PS_LIST_TAIL, "-exptime", 0, "Exposure time (s)", NAN); 58 59 psMetadataAddF32(arguments, PS_LIST_TAIL, "-biaslevel", 0, "Bias level (e)", NAN); … … 69 70 } 70 71 71 if (*config->argc == 1 || !psArgumentParse(arguments, config->argc, config->argv) ) {72 if (*config->argc == 1 || !psArgumentParse(arguments, config->argc, config->argv) || *config->argc != 2) { 72 73 usage(arguments, config); 73 74 } … … 98 99 usage(arguments, config); 99 100 } 100 psMetadataAdd(config->arguments, PS_LIST_TAIL, "TYPE", 0, "Exposure type", type); 101 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "TYPE", 0, "Exposure type", type); 102 103 const char *filter = psMetadataLookupStr(NULL, arguments, "-filter"); // Filter name 104 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "FILTER", 0, "Filter name", filter); 101 105 102 106 float expTime; … … 110 114 } 111 115 } 112 psMetadataAdd (config->arguments, PS_LIST_TAIL, "EXPTIME", 0, "Exposure time (s)", expTime);116 psMetadataAddF32(config->arguments, PS_LIST_TAIL, "EXPTIME", 0, "Exposure time (s)", expTime); 113 117 114 118 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSIM_RECIPE); // Recipe for ppSim … … 128 132 valueArgRecipe(config, arguments, "-skyrate", recipe, "SKY.RATE", config->arguments); 129 133 134 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Name of the output image", 135 config->argv[1]); 136 130 137 psFree(arguments); 131 138 } -
trunk/ppSim/src/ppSimCreate.c
r12833 r12834 9 9 #include "ppSim.h" 10 10 11 pmFPAfile *ppSimCreate( constpmConfig *config)11 pmFPAfile *ppSimCreate(pmConfig *config) 12 12 { 13 13 PS_ASSERT_PTR_NON_NULL(config, NULL); 14 14 15 const char *formatName = psMetadataLookupStr(NULL, config->arguments, "FORMAT"); // Input format name 15 psString formatName = psMetadataLookupStr(NULL, config->arguments, "FORMAT"); // Input format name 16 config->formatName = psMemIncrRefCounter(formatName); 16 17 17 18 psMetadata *formats = psMetadataLookupMetadata(NULL, config->camera, "FORMATS"); // The camera formats … … 20 21 return NULL; 21 22 } 22 psMetadata *format = psMetadataLookupMetadata(NULL, formats, config->formatName); // The format of interest23 psMetadata *format = psMetadataLookupMetadata(NULL, formats, formatName); // Format of interest 23 24 if (!format) { 24 25 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find format %s in camera FORMATS.", formatName); -
trunk/ppSim/src/ppSimLoop.c
r12833 r12834 93 93 94 94 psRegion *bounds = fpaBounds(fpa); // Bounds of FPA 95 if (!bounds ) {95 if (!bounds || (bounds->x0 == 0.0 && bounds->x1 == 0.0) || (bounds->y0 == 0.0 && bounds->y1 == 0.0)) { 96 96 psError(PS_ERR_UNKNOWN, false, "Unable to determine bounds of FPA"); 97 97 return PS_EXIT_CONFIG_ERROR; … … 105 105 float shutterTime = psMetadataLookupF32(NULL, config->arguments, "SHUTTER.TIME"); // Shutter time 106 106 float skyRate = psMetadataLookupF32(NULL, config->arguments, "SKY.RATE"); // Sky rate 107 107 108 float expTime = psMetadataLookupF32(NULL, config->arguments, "EXPTIME"); // Exposure time 109 const char *filter = psMetadataLookupStr(NULL, config->arguments, "FILTER"); // Filter name 108 110 ppSimType type = psMetadataLookupS32(NULL, config->arguments, "TYPE"); // Type of image to simulate 109 111 110 112 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); // Random number generator 111 113 pmFPAview *view = pmFPAviewAlloc(0);// View for iterating over FPA 114 115 // Update concepts 116 const char *typeStr; // Exposure type String 117 switch (type) { 118 case PPSIM_TYPE_BIAS: typeStr = "BIAS"; break; 119 case PPSIM_TYPE_DARK: typeStr = "DARK"; break; 120 case PPSIM_TYPE_FLAT: typeStr = "FLAT"; break; 121 case PPSIM_TYPE_OBJECT: typeStr = "OBJECT"; break; 122 default: 123 psAbort("Should never get here."); 124 } 125 psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.OBSTYPE", PS_META_REPLACE, 126 "Observation type", typeStr); 127 psMetadataAddF32(fpa->concepts, PS_LIST_TAIL, "FPA.EXPTIME", PS_META_REPLACE, 128 "Exposure time (sec)", expTime); 129 psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.FILTERID", PS_META_REPLACE, "Filter name", filter); 130 psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.FILTER", PS_META_REPLACE, "Filter name", filter); 131 112 132 113 133 pmChip *chip; // Chip from FPA … … 144 164 145 165 // TO DO: Decide if cell is to be video readout 146 int numReadouts = 0.0;// Number of readouts in cell166 int numReadouts = 1; // Number of readouts in cell 147 167 148 168 for (int i = 0; i < numReadouts; i++) { … … 203 223 } 204 224 225 // TO DO: Add overscan 226 227 #if 0 205 228 // Add the noise into the image 206 229 for (int y = 0; y < numRows; y++) { … … 211 234 } 212 235 } 236 #endif 213 237 readout->image = signal; 214 238 psFree(variance); … … 217 241 } 218 242 219 psMetadataAddF32(cell->concepts, PS_LIST_TAIL, "CELL.EXPTIME", 0, "Exposure time (sec)", expTime); 220 psMetadataAddF32(cell->concepts, PS_LIST_TAIL, "CELL.DARKTIME", 0, "Dark time (sec)", expTime); 243 psMetadataAddF32(cell->concepts, PS_LIST_TAIL, "CELL.EXPOSURE", PS_META_REPLACE, 244 "Exposure time (sec)", expTime); 245 psMetadataAddF32(cell->concepts, PS_LIST_TAIL, "CELL.DARKTIME", PS_META_REPLACE, 246 "Dark time (sec)", expTime); 221 247 222 248 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) { … … 239 265 } 240 266 241 const char *typeStr; // Exposure type String 242 switch (type) { 243 case PPSIM_TYPE_BIAS: typeStr = "BIAS"; break; 244 case PPSIM_TYPE_DARK: typeStr = "DARK"; break; 245 case PPSIM_TYPE_FLAT: typeStr = "FLAT"; break; 246 case PPSIM_TYPE_OBJECT: typeStr = "OBJECT"; break; 247 default: 248 psAbort("Should never get here."); 249 } 250 251 psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.OBSTYPE", 0, "Observation type", typeStr); 252 psMetadataAddF32(fpa->concepts, PS_LIST_TAIL, "FPA.EXPTIME", 0, "Exposure time (sec)", expTime); 253 254 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) { 255 psError(PS_ERR_IO, false, "Unable to write file."); 256 psFree(rng); 257 psFree(view); 258 psFree(bounds); 259 return PS_EXIT_SYS_ERROR; 260 } 261 267 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) { 268 psError(PS_ERR_IO, false, "Unable to write file."); 269 psFree(rng); 270 psFree(view); 271 psFree(bounds); 272 return PS_EXIT_SYS_ERROR; 273 } 262 274 263 275 psFree(rng);
Note:
See TracChangeset
for help on using the changeset viewer.
