Changeset 41889
- Timestamp:
- Nov 4, 2021, 5:56:45 PM (5 years ago)
- Location:
- branches/eam_branches/ipp-dev-20210817/psastro
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/psastroLoadGlints.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-dev-20210817/psastro
- Property svn:mergeinfo changed
/trunk/psastro (added) merged: 41809,41858
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-dev-20210817/psastro/src/psastroLoadGlints.c
r41705 r41889 52 52 double GLINT_LENGTH_POS_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_POS_SLOPE"); 53 53 if (!status) { 54 psLogMsg ("psastro", PS_LOG_INFO, "Assuming old-style glint masking , given the recipe keywords");54 psLogMsg ("psastro", PS_LOG_INFO, "Assuming old-style glint masking"); 55 55 glintCheck = 1; 56 56 } … … 150 150 151 151 //Besides brightness, the length of the glints also depends on the position of the star compared to the focal plane. But, seemingly only for stars closer than about 30k pixels 152 if( glintCheck) {152 if(!glintCheck) { 153 153 if ((!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM")) && abs(star->FP->y) < GLINT_LENGTH_POS_CUT ){ 154 154 glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->y)); … … 246 246 pmChip *chip = fpa->chips->data[nChip]; 247 247 if (!chip) {continue;} 248 const char *chipName = psMetadataLookupStr(NULL,chip->concepts, "CHIP.NAME"); 249 int X = chipName[2] - '0'; 248 250 249 251 if (!psastroFindChipInXrange (fpa, nChip, x_glint->data.F32[glint_point], y_glint->data.F32[glint_point])) { … … 255 257 psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip); 256 258 259 //For ease of reference, we adopt a frame in which coords with 0 are always lower in the relevant axis 257 260 if (yFPAs > yFPAe) PS_SWAP (yFPAs, yFPAe); 258 261 if (yFPA0 > yFPA1) { … … 265 268 if (yFPA1 < yFPAs) {continue;} 266 269 267 268 270 //find the y-coord positions for this chip 269 271 double ycFPA0, ycFPA1; … … 272 274 273 275 //now calculate the proper x-coord positions given the angle, for this chip 274 double xcFPA0, xcFPA1, angle; 276 double xcFPA0 = 0.0, xcFPA1 = 0.0; 277 double angle = 0.0, chip_angle = 0.0, glint_length = 0.0; 275 278 angle = atan2(xFPA1 - xFPA0,yFPA1 - yFPA0); 276 279 xcFPA0 = xFPA0 + (ycFPA0-yFPA0)*tan(angle); 277 xcFPA1 = xFPA0 + (ycFPA1-yFPA0)*tan(angle); 278 279 280 double xChip0, yChip0, xChip1, yChip1, chip_angle, glint_length, xChip2,yChip2; 281 psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA0, ycFPA0); 282 psastroFPAtoChip (&xChip1, &yChip1, fpa, nChip, xcFPA1, ycFPA1); 283 psastroFPAtoChip (&xChip2, &yChip2, fpa, nChip, star->FP->x,star->FP->y); 284 285 chip_angle = atan2(yChip1 - yChip0, xChip1 - xChip0); 286 glint_length = sqrt(pow(yChip1 - yChip0,2) + pow(xChip1 - xChip0,2)); 280 xcFPA1 = xFPA0 + (ycFPA1-yFPA0)*tan(angle); 281 282 //use this to calculate the actual glint length as it wll be on this chip 283 glint_length = sqrt(pow(ycFPA1 - ycFPA0,2) + pow(xcFPA1 - xcFPA0,2)); 284 285 //also get the proper orientation of the glint angle, and determine the starting position on this chip. Remember that half of the focal plane is flipped 286 double xChip0, yChip0; 287 if (!strcasecmp(glintType, "TOP")) { 288 if(X<=3){ 289 chip_angle = PM_RAD_DEG * (-90. - glintAngle/PM_RAD_DEG); 290 } else { 291 chip_angle = PM_RAD_DEG * (90. - glintAngle/PM_RAD_DEG); 292 } 293 psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA1, ycFPA1); 294 } 295 if (!strcasecmp(glintType, "BOTTOM")) { 296 if(X<=3){ 297 chip_angle = PM_RAD_DEG * (glintAngle/PM_RAD_DEG +90.); 298 } else { 299 chip_angle = PM_RAD_DEG * (glintAngle/PM_RAD_DEG -90.); 300 } 301 psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA0, ycFPA0); 302 } 287 303 288 304 // select the 0th readout of the 0th cell for this chip … … 403 419 psastroFindChipXedges (&xFPAs, &xFPAe, fpa, nChip); 404 420 421 //For ease of reference, we adopt a frame in which coords with 0 are always lower in the relevant axis 405 422 if (xFPAs > xFPAe) PS_SWAP (xFPAs, xFPAe); 406 423 if (xFPA0 > xFPA1) { … … 419 436 420 437 //now calculate the proper x-coord positions given the angle, for this chip 421 double ycFPA0, ycFPA1, angle; 438 double ycFPA0 = 0.0, ycFPA1 = 0.0; 439 double glint_length = 0.0, angle = 0.0, chip_angle = 0.0; 422 440 angle = atan2(xFPA1 - xFPA0,yFPA1 - yFPA0); 423 441 ycFPA0 = yFPA0 + (xcFPA0-xFPA0)/tan(angle); 424 442 ycFPA1 = yFPA0 + (xcFPA1-xFPA0)/tan(angle); 425 443 426 double xChip0, yChip0, xChip1, yChip1, chip_angle, glint_length,xChip2,yChip2; 427 psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA0, ycFPA0); 428 psastroFPAtoChip (&xChip1, &yChip1, fpa, nChip, xcFPA1, ycFPA1); 429 psastroFPAtoChip (&xChip2, &yChip2, fpa, nChip, star->FP->x,star->FP->y); 430 431 chip_angle = atan2(yChip1 - yChip0, xChip1 - xChip0); 432 glint_length = sqrt(pow(yChip1 - yChip0,2) + pow(xChip1 - xChip0,2)); 444 //use this to calculate the actual glint length as it wll be on this chip 445 glint_length = sqrt(pow(ycFPA1 - ycFPA0,2) + pow(xcFPA1 - xcFPA0,2)); 446 447 //also get the proper orientation of the glint angle, and determine the starting position on this chip. Remember that half of the focal plane is flipped 448 double xChip0, yChip0; 449 if (!strcasecmp(glintType, "LEFT")) { 450 chip_angle = PM_RAD_DEG * (180. - glintAngle/PM_RAD_DEG); 451 psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA0, ycFPA0); 452 } 453 if (!strcasecmp(glintType, "RIGHT")) { 454 chip_angle = PM_RAD_DEG * (glintAngle/PM_RAD_DEG +180.); 455 psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA1, ycFPA1); 456 } 433 457 434 458 // select the 0th readout of the 0th cell for this chip
Note:
See TracChangeset
for help on using the changeset viewer.
