Changeset 41348 for trunk/psastro
- Timestamp:
- Apr 28, 2020, 1:26:07 PM (6 years ago)
- Location:
- trunk/psastro/src
- Files:
-
- 3 edited
-
psastroLoadGhosts.c (modified) (5 diffs)
-
psastroLoadGlints.c (modified) (8 diffs)
-
psastroMaskUpdates.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroLoadGhosts.c
r41338 r41348 105 105 psPolynomial2D *centerX = NULL; 106 106 psPolynomial2D *centerY = NULL; 107 psPolynomial1D *mirrorRad = NULL; 107 108 psPolynomial1D *outerMajor = NULL; 108 109 psPolynomial1D *outerMinor = NULL; … … 110 111 psPolynomial1D *innerMinor = NULL; 111 112 112 113 113 pmFPAview *view = pmFPAviewAlloc (0); 114 114 115 GET_1D_POLY ("GHOST.MIRROR.RAD", mirrorRad); 115 116 GET_2D_POLY ("GHOST.CENTER.X", centerX); 116 117 GET_2D_POLY ("GHOST.CENTER.Y", centerY); … … 178 179 ghost->srcFP->y = ref->FP->y; 179 180 180 // XXX it is stupid that this takes -X_fpa,-Y_fpa --> the analysis script is reporting the guess FPA position, and the fit is using that... 181 ghost->FP->x = -ref->FP->x + psPolynomial2DEval(centerX, -ref->FP->x, -ref->FP->y); 182 ghost->FP->y = -ref->FP->y + psPolynomial2DEval(centerY, -ref->FP->x, -ref->FP->y); 183 184 float rSrc = hypot (ref->FP->x, ref->FP->y); 181 //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle 182 double rSrc = hypot (ref->FP->x, ref->FP->y); 183 double theta0 = atan2(ref->FP->y,ref->FP->x); 184 185 double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc); 186 double ghost_x_fpa_mirror = ref->FP->x + ((ref->FP->x*-1.)/abs(ref->FP->x)*abs(cos(theta0)*ghost_offset_rad)); 187 double ghost_y_fpa_mirror = ref->FP->y + ((ref->FP->y*-1.)/abs(ref->FP->y)*abs(sin(theta0)*ghost_offset_rad)); 188 189 // Now use the mirrored position together with the 2D ghost center fitting to get the actual ghost position in FPA coords 190 ghost->FP->x = ghost_x_fpa_mirror + psPolynomial2DEval(centerX, ghost_x_fpa_mirror, ghost_y_fpa_mirror); 191 ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror); 185 192 186 193 ghost->inner.major = psPolynomial1DEval (innerMajor, rSrc); … … 203 210 ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, ghost->FP->x, ghost->FP->y); 204 211 // fprintf (stderr, "-> model chip position: %f, %f\n", ghost->chip->x, ghost->chip->y); 205 206 psPlane coordFPA,ptCH2;207 psPlane coordCell,ptFP2;208 coordCell.x = ghost->chip->x;209 coordCell.y = ghost->chip->y;210 psPlaneTransformApply(&coordFPA,ghostChip->toFPA,&coordCell);211 ptCH2.x = ghost->chip->x;212 ptCH2.y = ghost->chip->y;213 psPlaneTransformApply(&ptFP2,ghostChip->toFPA,&ptCH2);214 215 psPlane ptCH, ptFP;216 ptFP.x = ghost->FP->x;217 ptFP.y = ghost->FP->y;218 psPlaneTransformApply (&ptCH, ghostChip->fromFPA, &ptFP);219 220 psastroUpdateChipToFPA (fpa, ghostChip);221 psPlane ptCH3, ptFP3;222 ptCH3.x = ghost->chip->x;223 ptCH3.y = ghost->chip->y;224 psPlaneTransformApply(&ptFP3,ghostChip->toFPA,&ptCH3);225 226 227 228 psLogMsg ("psastro", 3, "Ghost refpos: %f %f %s pos: %f %f %f %f %f %f %f %f %f %f %f %f mag: %f inshape: %f %f %f outshape: %f %f %f \n", ref->FP->x,ref->FP->y,psMetadataLookupStr(NULL,chip->concepts,"CHIP.NAME"), ghost->FP->x,ghost->FP->y,coordFPA.x,coordFPA.y,ghost->chip->x, ghost->chip->y,ptCH.x,ptCH.y,ptFP2.x,ptFP2.y,ptFP3.x,ptFP3.y, ghost->Mag,ghost->inner.major,ghost->inner.minor,ghost->inner.theta/PM_RAD_DEG,ghost->outer.major,ghost->outer.minor,ghost->outer.theta/PM_RAD_DEG);229 212 230 213 if (ghostChip) { … … 257 240 ghost->outer.major,ghost->outer.minor,ghost->outer.theta); 258 241 } 259 260 261 242 262 243 if (!ghostChip) goto skip; 263 244 if (!ghostChip->cells) goto skip; -
trunk/psastro/src/psastroLoadGlints.c
r41338 r41348 152 152 } 153 153 154 //do a rudimentary check of whether the glint enters the pixel FPA 155 if (!strcasecmp(glintType, "TOP") && ((star->FP->y - glintLength) > 20000.)) continue; 156 if (!strcasecmp(glintType, "BOTTOM") && ((star->FP->y + glintLength) < -20000.)) continue; 157 if (!strcasecmp(glintType, "LEFT") && ((star->FP->x + glintLength) < -20000.)) continue; 158 if (!strcasecmp(glintType, "RIGHT") && ((star->FP->x - glintLength) > 20000.)) continue; 154 159 155 160 psVector *x_glint = psVectorAlloc(2,PS_TYPE_F32); … … 179 184 double yFPAs, yFPAe; 180 185 psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip); 186 if (yFPAs > yFPAe) PS_SWAP (yFPAs, yFPAe); 181 187 182 188 xFPA0 = star->FP->x; … … 204 210 double yFPAs, yFPAe; 205 211 psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip); 212 if (yFPAs > yFPAe) PS_SWAP (yFPAs, yFPAe); 206 213 207 214 xFPA0 = star->FP->x; … … 218 225 x_glint->data.F32[1] = xFPA1; 219 226 y_glint->data.F32[1] = yFPA1; 227 220 228 221 229 //we need to loop over each corner to select the chips that can have the glint on it … … 243 251 if (yFPA0 > yFPAe) continue; 244 252 if (yFPA1 < yFPAs) continue; 253 245 254 246 255 //find the y-coord positions for this chip … … 322 331 323 332 // FPA coordinates of intersections with chip edges 324 double yFPAs, yFPAe; 325 psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip); 326 327 xFPA0 = yFPAe; 333 double xFPAs, xFPAe; 334 psastroFindChipXedges (&xFPAs, &xFPAe, fpa, nChip); 335 if (xFPAs > xFPAe) PS_SWAP (xFPAs, xFPAe); 336 337 xFPA0 = xFPAe; 328 338 yFPA0 = star->FP->y; 329 glintLength-= (star->FP->x- yFPAe);339 glintLength-= (star->FP->x-xFPAe); 330 340 } 331 341 … … 347 357 348 358 // FPA coordinates of intersections with chip edges 349 double yFPAs, yFPAe; 350 psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip); 351 352 xFPA0 = yFPAs; 359 double xFPAs, xFPAe; 360 psastroFindChipXedges (&xFPAs, &xFPAe, fpa, nChip); 361 if (xFPAs > xFPAe) PS_SWAP (xFPAs, xFPAe); 362 363 xFPA0 = xFPAs; 353 364 yFPA0 = star->FP->y; 354 glintLength-= ( yFPAs-star->FP->x);365 glintLength-= (xFPAs-star->FP->x); 355 366 } 356 367 … … 431 442 432 443 fprintf (stderr, "glint %s : %d %f,%f to %f,%f (%f %f %f)\n", glintType, nChip, xChip0, yChip0, xChip1, yChip1, glint_length, glintWidth, chip_angle); 444 433 445 psVector *glint = psVectorAlloc(5,PS_TYPE_F32); 434 446 glint->data.F32[0] = xChip0; -
trunk/psastro/src/psastroMaskUpdates.c
r41342 r41348 424 424 psastroGhost *ghost = ghosts->data[i]; 425 425 //offset the ghost angles with the astrometric rotation angle 426 ghost->inner.theta -= (ROT_PARITY * ROTANGLE);427 ghost->outer.theta -= (ROT_PARITY * ROTANGLE);426 ghost->inner.theta = ghost->inner.theta - AST_T0; 427 ghost->outer.theta = ghost->outer.theta - AST_T0; 428 428 // XXX bright vs faint ghost bits? (OR with SUSPECT) 429 429 psastroMaskEllipticalAnnulus (readoutMask->mask, ghostMaskValue, ghost->chip->x, ghost->chip->y, ghost->inner, ghost->outer); … … 444 444 //psastroMaskRectangle (readoutMask->mask, glintMaskValue, glint->x0, glint->y0, glint->x1, glint->y1); 445 445 446 psLogMsg ("psastro", 3, "glint: %d %f %f %f %f %f\n",i, glint->data.F32[0], glint->data.F32[1],glint->data.F32[2], glint->data.F32[3], glint->data.F32[4]); 446 447 psastroMaskBox (readoutMask->mask, glintMaskValue, glint->data.F32[0], glint->data.F32[1], 447 448 glint->data.F32[2], glint->data.F32[3], glint->data.F32[4]);
Note:
See TracChangeset
for help on using the changeset viewer.
