Changeset 41809 for trunk/psastro
- Timestamp:
- Sep 14, 2021, 2:17:39 PM (5 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroLoadGlints.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroLoadGlints.c
r41705 r41809 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, xcFPA1, angle, chip_angle, glint_length; 275 277 angle = atan2(xFPA1 - xFPA0,yFPA1 - yFPA0); 276 278 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)); 279 xcFPA1 = xFPA0 + (ycFPA1-yFPA0)*tan(angle); 280 281 //use this to calculate the actual glint length as it wll be on this chip 282 glint_length = sqrt(pow(ycFPA1 - ycFPA0,2) + pow(xcFPA1 - xcFPA0,2)); 283 284 //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 285 double xChip0, yChip0; 286 if (!strcasecmp(glintType, "TOP")) { 287 if(X<=3){ 288 chip_angle = PM_RAD_DEG * (-90. - glintAngle/PM_RAD_DEG); 289 } else { 290 chip_angle = PM_RAD_DEG * (90. - glintAngle/PM_RAD_DEG); 291 } 292 psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA1, ycFPA1); 293 } 294 if (!strcasecmp(glintType, "BOTTOM")) { 295 if(X<=3){ 296 chip_angle = PM_RAD_DEG * (glintAngle/PM_RAD_DEG +90.); 297 } else { 298 chip_angle = PM_RAD_DEG * (glintAngle/PM_RAD_DEG -90.); 299 } 300 psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA0, ycFPA0); 301 } 287 302 288 303 // select the 0th readout of the 0th cell for this chip … … 403 418 psastroFindChipXedges (&xFPAs, &xFPAe, fpa, nChip); 404 419 420 //For ease of reference, we adopt a frame in which coords with 0 are always lower in the relevant axis 405 421 if (xFPAs > xFPAe) PS_SWAP (xFPAs, xFPAe); 406 422 if (xFPA0 > xFPA1) { … … 419 435 420 436 //now calculate the proper x-coord positions given the angle, for this chip 421 double ycFPA0, ycFPA1, angle ;437 double ycFPA0, ycFPA1, angle, chip_angle, glint_length; 422 438 angle = atan2(xFPA1 - xFPA0,yFPA1 - yFPA0); 423 439 ycFPA0 = yFPA0 + (xcFPA0-xFPA0)/tan(angle); 424 440 ycFPA1 = yFPA0 + (xcFPA1-xFPA0)/tan(angle); 425 441 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)); 442 //use this to calculate the actual glint length as it wll be on this chip 443 glint_length = sqrt(pow(ycFPA1 - ycFPA0,2) + pow(xcFPA1 - xcFPA0,2)); 444 445 //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 446 double xChip0, yChip0; 447 if (!strcasecmp(glintType, "LEFT")) { 448 chip_angle = PM_RAD_DEG * (180. - glintAngle/PM_RAD_DEG); 449 psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA0, ycFPA0); 450 } 451 if (!strcasecmp(glintType, "RIGHT")) { 452 chip_angle = PM_RAD_DEG * (glintAngle/PM_RAD_DEG +180.); 453 psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA1, ycFPA1); 454 } 433 455 434 456 // select the 0th readout of the 0th cell for this chip
Note:
See TracChangeset
for help on using the changeset viewer.
