Changeset 25626
- Timestamp:
- Sep 27, 2009, 11:36:17 AM (17 years ago)
- Location:
- branches/eam_branches/20090715/psModules/src
- Files:
-
- 12 edited
-
camera/pmReadoutFake.c (modified) (1 prop)
-
concepts/pmConcepts.c (modified) (2 diffs)
-
concepts/pmConceptsRead.c (modified) (4 diffs)
-
concepts/pmConceptsStandard.c (modified) (2 diffs)
-
concepts/pmConceptsStandard.h (modified) (1 diff)
-
imcombine/pmPSFEnvelope.c (modified) (5 diffs)
-
imcombine/pmStackReject.c (modified) (6 diffs)
-
imcombine/pmSubtractionMatch.c (modified) (1 diff)
-
objects/pmDetEff.c (modified) (1 diff)
-
objects/pmPetrosian.c (modified) (1 prop)
-
objects/pmPetrosian.h (modified) (1 prop)
-
objects/pmSourceIO.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psModules/src/camera/pmReadoutFake.c
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/20090715/psModules/src/concepts/pmConcepts.c
r25407 r25626 329 329 conceptRegisterF32("FPA.TELTEMP.EXTRA", "Telescope Temperatures: extra", p_pmConceptParse_TELTEMPS, NULL, NULL, false, PM_FPA_LEVEL_FPA); 330 330 conceptRegisterF32("FPA.PON.TIME", "Power On Time", NULL, NULL, NULL, false, PM_FPA_LEVEL_FPA); 331 conceptRegisterS32("FPA.BURNTOOL.APPLIED", "Status of burntool processing", p_pmConceptParse_BTOOLAPP,NULL,NULL,false,PM_FPA_LEVEL_FPA); 331 332 conceptRegisterF32("FPA.EXPOSURE", "Exposure time (sec)", NULL, NULL, NULL, false, PM_FPA_LEVEL_FPA); 332 333 } … … 344 345 conceptRegisterF32("CHIP.TEMP", "Temperature of chip", NULL, NULL, NULL, false, PM_FPA_LEVEL_CHIP); 345 346 conceptRegisterStr("CHIP.ID", "Chip identifier", NULL, NULL, NULL, false, PM_FPA_LEVEL_CHIP); 347 346 348 } 347 349 -
branches/eam_branches/20090715/psModules/src/concepts/pmConceptsRead.c
r25022 r25626 73 73 return false; 74 74 } 75 76 75 psTrace ("psModules.concepts", 3, "parsing concept: %s\n", spec->blank->name); 77 76 if (!strcmp (spec->blank->name, "CELL.XPARITY")) { … … 275 274 psMetadataItem *headerItem = NULL; // The value of the concept from the header 276 275 276 277 277 psTrace ("psModules.concepts", 3, "reading concept: %s\n", name); 278 278 if (!strcmp (name, "CELL.XPARITY")) { … … 307 307 } 308 308 } 309 310 309 if (!headerItem) { 311 310 psMetadataItem *formatItem = psMetadataLookup(transSpec, name); // Item with keyword … … 328 327 } 329 328 psString keywords = formatItem->data.str; // The FITS keywords 330 331 329 // In case there are multiple headers 332 330 psList *keys = psStringSplit(keywords, " ,;", true); // List of keywords -
branches/eam_branches/20090715/psModules/src/concepts/pmConceptsStandard.c
r25407 r25626 160 160 assert(concept); 161 161 assert(pattern); 162 163 162 double value = NAN; 164 163 switch (concept->type) { … … 632 631 return psMetadataItemAllocS32(pattern->name, pattern->comment, binning); 633 632 } 633 634 // BTOOLAPP 635 psMetadataItem *p_pmConceptParse_BTOOLAPP(const psMetadataItem *concept, 636 const psMetadataItem *pattern, 637 pmConceptSource source, 638 const psMetadata *cameraFormat, 639 const pmFPA *fpa, 640 const pmChip *chip, 641 const pmCell *cell) 642 { 643 assert(concept); 644 assert(pattern); 645 646 int bt_status = 0; 647 648 if (concept->type != PS_DATA_BOOL) { 649 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Type for %s (%x) is not BOOL\n", 650 concept->name, concept->type); 651 return NULL; 652 } 653 654 if (concept->data.B == true) { 655 bt_status = -2; 656 } 657 else if (concept->data.B == false) { 658 bt_status = 1 ; 659 } 660 661 return psMetadataItemAllocS32(concept->name, concept->comment, bt_status); 662 } 634 663 635 664 // Get the current value of a concept -
branches/eam_branches/20090715/psModules/src/concepts/pmConceptsStandard.h
r22699 r25626 115 115 ); 116 116 117 /// Format for the BTOOLAPP conceptn 118 psMetadataItem *p_pmConceptParse_BTOOLAPP( 119 const psMetadataItem *concept, ///< Concept to format 120 const psMetadataItem *pattern, 121 pmConceptSource source, ///< Source for concept 122 const psMetadata *cameraFormat, ///< Camera format definition 123 const pmFPA *fpa, ///< FPA for concept, or NULL 124 const pmChip *chip, ///< Chip for concept, or NULL 125 const pmCell *cell ///< Cell for concept, or NULL 126 ); 127 128 117 129 /// Parse the cell binning concepts: CELL.XBIN, CELL.YBIN 118 130 psMetadataItem *p_pmConceptParse_CELL_Binning( -
branches/eam_branches/20090715/psModules/src/imcombine/pmPSFEnvelope.c
r25496 r25626 34 34 35 35 // #define TESTING // Enable test output 36 // #define PEAK_NORM // Normalise peaks? 36 37 #define PEAK_FLUX 1.0e4 // Peak flux for each source 37 38 #define SKY_VALUE 0.0e0 // Sky value for fake image … … 122 123 continue; 123 124 } 125 126 if (psTraceGetLevel("psModules.imcombine") >= 1) { 127 psString string = NULL; // String with values 128 psStringAppend(&string, "PSF %d: ", i); 129 float x = numCols / 2.0, y = numRows / 2.0; // Coordinates of interest 130 for (int j = 4; j < psf->params->n; j++) { 131 pmTrend2D *trend = psf->params->data[j]; // Trend of interest 132 double val = pmTrend2DEval(trend, x, y); 133 double err; 134 switch (trend->mode) { 135 case PM_TREND_POLY_ORD: 136 case PM_TREND_POLY_CHEB: 137 err = NAN; 138 break; 139 case PM_TREND_MAP: 140 err = psImageUnbinPixel(x, y, trend->map->error, trend->map->binning); 141 break; 142 default: 143 psAbort("Unsupported mode: %x", trend->mode); 144 } 145 psStringAppend(&string, "%lf %lf ", val, err); 146 } 147 psTrace("psModules.imcombine", 1, "%s\n", string); 148 psFree(string); 149 } 150 124 151 pmResiduals *resid = psf->residuals;// PSF residuals 125 152 psf->residuals = NULL; … … 144 171 float y = source->peak->yf + yOffset->data.S32[j]; // y coordinate of source 145 172 146 double flux = fakeRO->image->data.F32[(int)y][(int)x]; 173 #ifdef PEAK_NORM 174 // Perhaps I'm being paranoid, but specify a range to check 175 int uMax = PS_MIN(x + radius, numCols - 1), uMin = PS_MAX(x - radius, 0); 176 int vMax = PS_MIN(y + radius, numRows - 1), vMin = PS_MAX(y - radius, 0); 177 178 double flux = -INFINITY; // Peak flux 179 for (int v = vMin; v <= vMax; v++) { 180 for (int u = uMin; u <= uMax; u++) { 181 if (fakeRO->image->data.F32[v][u] > flux) { 182 flux = fakeRO->image->data.F32[v][u]; 183 } 184 } 185 } 147 186 if (!isfinite(flux) || flux < 0) { 148 187 continue; 149 188 } 150 189 float norm = PEAK_FLUX / flux; // Normalisation for source 190 #endif 151 191 psRegion region = psRegionSet(x - radius, x + radius, y - radius, y + radius); // PSF region 152 192 psImage *subImage = psImageSubset(fakeRO->image, region); // Subimage of fake PSF 153 193 psImage *subEnv = psImageSubset(envelope, region); // Subimage of envelope 194 #ifdef PEAK_NORM 154 195 psBinaryOp(subImage, subImage, "*", psScalarAlloc(norm, PS_TYPE_F32)); 196 #endif 155 197 psBinaryOp(subEnv, subEnv, "MAX", subImage); 156 198 psFree(subImage); … … 345 387 psFree(try); 346 388 389 if (psTraceGetLevel("psModules.imcombine") >= 1) { 390 psString string = NULL; // String with values 391 psStringAppend(&string, "Envelope PSF: "); 392 float x = numCols / 2.0, y = numRows / 2.0; // Coordinates of interest 393 for (int j = 4; j < psf->params->n; j++) { 394 pmTrend2D *trend = psf->params->data[j]; // Trend of interest 395 double val = pmTrend2DEval(trend, x, y); 396 double err; 397 switch (trend->mode) { 398 case PM_TREND_POLY_ORD: 399 case PM_TREND_POLY_CHEB: 400 err = NAN; 401 break; 402 case PM_TREND_MAP: 403 err = psImageUnbinPixel(x, y, trend->map->error, trend->map->binning); 404 break; 405 default: 406 psAbort("Unsupported mode: %x", trend->mode); 407 } 408 psStringAppend(&string, "%lf %lf ", val, err); 409 } 410 psTrace("psModules.imcombine", 1, "%s\n", string); 411 psFree(string); 412 } 413 347 414 #ifdef TESTING 348 415 { … … 358 425 359 426 pmReadout *generated = pmReadoutAlloc(NULL); // Generated image 360 pmReadoutFakeFromSources(generated, numCols, numRows, fakes, NULL, NULL, psf, NAN, radius,427 pmReadoutFakeFromSources(generated, numCols, numRows, fakes, 0, NULL, NULL, psf, NAN, radius, 361 428 false, true); 362 429 { -
branches/eam_branches/20090715/psModules/src/imcombine/pmStackReject.c
r21351 r25626 43 43 if (box > 0) { 44 44 // Convolve a subimage, then stick it in the target 45 // XXX if (threaded) {46 // XXX psMutexLock(source);47 // XXX }48 45 psImage *mask = psImageSubset(source, psRegionSet(xMin - box, xMax + box, 49 46 yMin - box, yMax + box)); // Mask to convolve 50 // XXX if (threaded) {51 // XXX psMutexUnlock(source);52 // XXX }53 47 psImage *convolved = psImageConvolveMask(NULL, mask, PM_STACK_MASK_BAD, PM_STACK_MASK_CONVOLVE, 54 48 -box, box, -box, box); // Convolved mask 55 // XXX if (threaded) {56 // XXX psMutexLock(source);57 // XXX }58 49 psFree(mask); 59 // XXX if (threaded) {60 // XXX psMutexUnlock(source);61 // XXX }62 50 63 51 int numBytes = (xMax - xMin) * PSELEMTYPE_SIZEOF(PS_TYPE_IMAGE_MASK); // Number of bytes to copy … … 162 150 pmReadout *inRO = pmReadoutAlloc(NULL); // Readout with input image 163 151 inRO->image = image; 164 // XXX if (threaded) {165 // XXX psMutexInit(image);166 // XXX }167 152 for (int i = 0; i < numRegions; i++) { 168 153 psRegion *region = subRegions->data[i]; // Region of interest 169 154 pmSubtractionKernels *kernels = subKernels->data[i]; // Kernel of interest 170 if (!pmSubtractionConvolve( convRO, NULL, inRO, NULL, NULL, stride, 0, 0, 1.0, 0.0,155 if (!pmSubtractionConvolve(NULL, convRO, NULL, inRO, NULL, stride, 0, 0, 1.0, 0.0, 171 156 region, kernels, false, true)) { 172 157 psError(PS_ERR_UNKNOWN, false, "Unable to convolve mask image in region %d.", i); … … 211 196 } 212 197 } 213 // XXX if (threaded) {214 // XXX psMutexDestroy(image);215 // XXX }216 198 psFree(inRO); 217 199 psImage *convolved = psMemIncrRefCounter(convRO->image); … … 264 246 psImage *target = psImageRecycle(convolved, numCols, numRows, PS_TYPE_IMAGE_MASK); // Grown image 265 247 psImageInit(target, 0); 266 // XXX if (threaded) {267 // XXX psMutexInit(source);268 // XXX }269 248 for (int i = 0; i < subRegions->n; i++) { 270 249 psRegion *region = subRegions->data[i]; // Subtraction region … … 287 266 psArray *args = job->args; // Job arguments 288 267 psArrayAdd(args, 1, target); 289 // XXX psMutexLock(source);290 268 psArrayAdd(args, 1, source); 291 // XXX psMutexUnlock(source);292 269 psArrayAdd(args, 1, kernels); 293 270 PS_ARRAY_ADD_SCALAR(args, numCols, PS_TYPE_S32); … … 332 309 } 333 310 334 // XXX psMutexDestroy(source);335 311 } 336 312 -
branches/eam_branches/20090715/psModules/src/imcombine/pmSubtractionMatch.c
r25407 r25626 628 628 variance = NULL; 629 629 630 if (!pmSubtractionBorder(conv1->image, conv1->variance, conv1->mask, size, maskBad)) { 630 if (conv1 && !pmSubtractionBorder(conv1->image, conv1->variance, conv1->mask, size, maskBad)) { 631 psError(PS_ERR_UNKNOWN, false, "Unable to set border of convolved image."); 632 goto MATCH_ERROR; 633 } 634 if (conv2 && !pmSubtractionBorder(conv2->image, conv2->variance, conv2->mask, size, maskBad)) { 631 635 psError(PS_ERR_UNKNOWN, false, "Unable to set border of convolved image."); 632 636 goto MATCH_ERROR; -
branches/eam_branches/20090715/psModules/src/objects/pmDetEff.c
r25407 r25626 164 164 } 165 165 166 return psMetadataAddPtr(readout->analysis, PS_LIST_TAIL, PM_DETEFF_ANALYSIS, 167 PS_META_REPLACE | PS_DATA_UNKNOWN, "Detection efficiency", de); 166 bool status = psMetadataAddPtr(readout->analysis, PS_LIST_TAIL, PM_DETEFF_ANALYSIS, PS_META_REPLACE | PS_DATA_UNKNOWN, "Detection efficiency", de); 167 psFree (de); 168 return status; 168 169 } -
branches/eam_branches/20090715/psModules/src/objects/pmPetrosian.c
- Property svn:mergeinfo changed
/trunk/psModules/src/objects/pmPetrosian.c (added) merged: 25396-25623
- Property svn:mergeinfo changed
-
branches/eam_branches/20090715/psModules/src/objects/pmPetrosian.h
- Property svn:mergeinfo changed
/trunk/psModules/src/objects/pmPetrosian.h (added) merged: 25396-25623
- Property svn:mergeinfo changed
-
branches/eam_branches/20090715/psModules/src/objects/pmSourceIO.c
r25589 r25626 986 986 987 987 if (!pmReadoutReadDetEff(file->fits, readout, deteffname)) { 988 #if 0 988 989 psError(PS_ERR_IO, false, "Unable to read detection efficiency"); 989 990 return false; 991 #else 992 // No great loss 993 psErrorClear(); 994 #endif 990 995 } 991 996 }
Note:
See TracChangeset
for help on using the changeset viewer.
