Changeset 40490 for trunk/psastro/src/psastroMaskUpdates.c
- Timestamp:
- Jun 27, 2018, 4:11:05 PM (8 years ago)
- Location:
- trunk/psastro
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/psastroMaskUpdates.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro
-
Property svn:mergeinfo
set to
/branches/czw_branch/20160809/psastro merged eligible /branches/czw_branch/20170908/psastro merged eligible
-
Property svn:mergeinfo
set to
-
trunk/psastro/src/psastroMaskUpdates.c
r33851 r40490 129 129 130 130 bool REFSTAR_MASK_BLEED = psMetadataLookupBool (&status, recipe, "REFSTAR_MASK_BLEED"); 131 131 bool REFSTAR_MASK_BLEED_ORIENTATION_X = psMetadataLookupBool (&status, recipe, "REFSTAR_MASK_BLEED_ORIENTATION_X"); 132 bool REFSTAR_MASK_BLEED_ORIENTATION_Y = psMetadataLookupBool (&status, recipe, "REFSTAR_MASK_BLEED_ORIENTATION_Y"); 133 134 132 135 double REFSTAR_MASK_MAX_MAG = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_MAX_MAG"); 133 136 double REFSTAR_MASK_SATSTAR_MAG_SLOPE = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_SATSTAR_MAG_SLOPE"); … … 143 146 double REFSTAR_MASK_BLEED_MAG_SLOPE = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_BLEED_MAG_SLOPE"); 144 147 148 double REFSTAR_MASK_BLEED_MAG_MAX_X = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_BLEED_MAG_MAX_X"); 149 double REFSTAR_MASK_BLEED_MAG_SLOPE_X = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_BLEED_MAG_SLOPE_X"); 150 double REFSTAR_MASK_BLEED_MAG_MAX_Y = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_BLEED_MAG_MAX_Y"); 151 double REFSTAR_MASK_BLEED_MAG_SLOPE_Y = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_BLEED_MAG_SLOPE_Y"); 152 145 153 double REFSTAR_MASK_CROSSTALK_MAG_MAX = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_CROSSTALK_MAG_MAX"); 146 154 double REFSTAR_MASK_CROSSTALK_MAG_SLOPE= psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_CROSSTALK_MAG_SLOPE"); … … 180 188 } 181 189 190 psTrace("psastro.masks",2,"Configuration loaded for masking."); 191 182 192 // recipe values are given in instrumental magnitudes 183 193 // use the zero point and exposure time to convert to apparent mags: M_ap = M_inst + C_0 + 2.5*log(exptime) … … 187 197 REFSTAR_MASK_SATSPIKE_MAG_MAX += MagOffset; 188 198 REFSTAR_MASK_BLEED_MAG_MAX += MagOffset; 199 REFSTAR_MASK_BLEED_MAG_MAX_X += MagOffset; 200 REFSTAR_MASK_BLEED_MAG_MAX_Y += MagOffset; 201 189 202 GHOST_MAX_MAG += MagOffset; 190 203 204 psTrace("psastro.masks",2,"Magnitudes: max_mag: %f satstar: %f satspike: %f bleed: %f ghost %f\n", 205 REFSTAR_MASK_MAX_MAG,REFSTAR_MASK_SATSTAR_MAG_MAX,REFSTAR_MASK_SATSPIKE_MAG_MAX,REFSTAR_MASK_BLEED_MAG_MAX,GHOST_MAX_MAG); 206 191 207 // select the output mask image :: we mosaic to chip mosaic format 192 208 pmFPAfile *outMask = psMetadataLookupPtr (NULL, config->files, "PSASTRO.OUTPUT.MASK"); … … 287 303 if (!refstars) continue; 288 304 305 psTrace("psastro.masks",2,"In Readout loop."); 289 306 // we need to generate the following masks regions: 290 307 // 1) circle around the saturated stars (scaled by magnitude) … … 301 318 } 302 319 } 303 320 psTrace("psastro.masks",4,"In refstar loop: %d/%ld %f %f\n", 321 i,refstars->n,ref->Mag,REFSTAR_MASK_MAX_MAG); 304 322 if (ref->Mag > REFSTAR_MASK_MAX_MAG) continue; 305 323 … … 334 352 335 353 // The length should also be a function of the image background level 336 354 psTrace("psastro.masks",4,"Masking: Radius: %f Theta: %f Length: %f Width: %f\n", 355 radius,Theta,spikeLength,spikeWidth); 356 psTrace("psastro.masks",4,"Also: %f %f %f %f\n",ref->chip->x,ref->chip->y,ROTANGLE,REFSTAR_MASK_SATSTAR_POS_ZERO); 337 357 psastroMaskBox (readoutMask->mask, spikeMaskValue, ref->chip->x, ref->chip->y, spikeLength, spikeWidth, Theta); 338 358 } … … 349 369 float xCell = 0.0; 350 370 float yCell = 0.0; 351 float xEnd = 0.0; 352 float yEnd = 0.0; 371 float xStart = 0.0; 372 float xEnd = 0.0; 373 float yStart = 0.0; 374 float yEnd = 0.0; 375 // float xEnd = 0.0; 376 // float yEnd = 0.0; 377 float width = 0.0; 378 float length = 0.0; 353 379 // find coordinate of star on cell 354 380 pmCellCoordsForChip (&xCell, &yCell, refCell, ref->chip->x, ref->chip->y); 355 381 // find coordinate of end-point on chip 356 382 357 int ySize = psMetadataLookupS32(NULL, refCell->concepts, "CELL.YSIZE"); 358 pmChipCoordsForCell (&xEnd, &yEnd, refCell, xCell, ySize); 359 360 float width = REFSTAR_MASK_BLEED_MAG_SLOPE*(REFSTAR_MASK_BLEED_MAG_MAX - ref->Mag); 361 psastroMaskRectangle (readoutMask->mask, spikeMaskValue, (int) ref->chip->x-0.5*width, (int) ref->chip->y, (int) ref->chip->x+0.5*width+1, yEnd); 383 if (REFSTAR_MASK_BLEED_ORIENTATION_X) { 384 length = pow(10,REFSTAR_MASK_BLEED_MAG_SLOPE_X*(REFSTAR_MASK_BLEED_MAG_MAX_X - ref->Mag)); 385 width = REFSTAR_MASK_BLEED_MAG_SLOPE *(REFSTAR_MASK_BLEED_MAG_MAX - ref->Mag); 386 387 pmChipCoordsForCell (&xStart, &yStart, refCell, xCell - length, yCell - 0.5 * width); 388 pmChipCoordsForCell (&xEnd, &yEnd, refCell, xCell + length, yCell + 0.5 * width); 389 psastroMaskRectangle (readoutMask->mask, spikeMaskValue, (int) xStart, (int) yStart, (int) xEnd, (int) yEnd + 1); 390 } 391 if (REFSTAR_MASK_BLEED_ORIENTATION_Y) { 392 length = pow(10,REFSTAR_MASK_BLEED_MAG_SLOPE_Y*(REFSTAR_MASK_BLEED_MAG_MAX_Y - ref->Mag)); 393 width = REFSTAR_MASK_BLEED_MAG_SLOPE *(REFSTAR_MASK_BLEED_MAG_MAX - ref->Mag); 394 395 pmChipCoordsForCell (&xStart, &yStart, refCell, xCell - 0.5 * width, yCell - length); 396 pmChipCoordsForCell (&xEnd, &yEnd, refCell, xCell + 0.5 * width, yCell + length); 397 psastroMaskRectangle (readoutMask->mask, spikeMaskValue, (int) xStart, (int) yStart, (int) xEnd + 1, (int) yEnd); 398 } 399 362 400 } 363 401 } … … 392 430 } 393 431 } 394 432 // Because it's very GPC1-specific, handle alternate glint types here 433 psArray *hsc_glints = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.GLINTS.HSC"); 434 if (hsc_glints) { 435 for (int i = 0; i < hsc_glints->n; i++) { 436 // Contains (start_x, start_y, length, width, theta) 437 psVector *glint = hsc_glints->data[i]; 438 439 psTrace("psastro.masks", 4, "Masking glint %d on chip %s with params (%f,%f,%f,%f,%f)\n", 440 i, psMetadataLookupStr(&status,readout->parent->parent->concepts,"CHIP.NAME"), 441 glint->data.F32[0], glint->data.F32[1], 442 glint->data.F32[2], glint->data.F32[3], glint->data.F32[4]); 443 444 psastroMaskBox (readoutMask->mask, glintMaskValue, glint->data.F32[0], glint->data.F32[1], 445 glint->data.F32[2], glint->data.F32[3], glint->data.F32[4]); 446 } 447 } 448 395 449 // Select the crosstalk artifact regions for this readout, and mask a circular region 396 450 // corresponding to the source star
Note:
See TracChangeset
for help on using the changeset viewer.
