Changeset 41338 for trunk/psastro/src/psastroLoadGlints.c
- Timestamp:
- Apr 16, 2020, 1:39:13 PM (6 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroLoadGlints.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroLoadGlints.c
r41290 r41338 43 43 double GLINT_LENGTH_MAG_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_MAG_SLOPE"); 44 44 double GLINT_LENGTH_MAG_ZERO = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_MAG_ZERO"); 45 double GLINT_LENGTH_POS_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_POS_SLOPE"); 46 double GLINT_LENGTH_POS_REF = psMetadataLookupF32 (&status, recipe, "GLINT_LENGTH_POS_REF"); 47 double GLINT_ANGLE_POS_SLOPE = psMetadataLookupF32 (&status, recipe, "GLINT_ANGLE_POS_SLOPE"); 48 double GLINT_ANGLE_POS_REF = psMetadataLookupF32 (&status, recipe, "GLINT_ANGLE_POS_REF"); 45 49 double glintWidth = psMetadataLookupF32 (&status, recipe, "GLINT_WIDTH"); 46 50 double pixelScale = psMetadataLookupF32 (&status, recipe, "PSASTRO.PIXEL.SCALE"); 47 48 51 49 52 // select the set of glint regions (GLINT.REGION is a MULTI of METADATA items) … … 88 91 psastroChipBounds (fpa); 89 92 90 // find the possible glint star:s for each glint star, convert the position to FPA coordinates. 93 94 // find the possible glint stars, and convert the position to FPA coordinates. 91 95 // search for stars within the glint regions 92 96 for (int i = 0; i < glintStars->n; i++) { 97 93 98 pmAstromObj *star = glintStars->data[i]; 94 99 if (star->Mag > GLINT_MAX_MAG) continue; // XXX should not be needed... … … 115 120 psRegion glintRegion = psRegionFromString (glintRegionString); 116 121 117 // select stars that land in this regio 122 // select stars that land in this region 118 123 if (star->FP->x < glintRegion.x0) continue; 119 124 if (star->FP->x > glintRegion.x1) continue; 120 125 if (star->FP->y < glintRegion.y0) continue; 121 126 if (star->FP->y > glintRegion.y1) continue; 122 123 double glintLength = GLINT_LENGTH_MAG_SLOPE*(GLINT_LENGTH_MAG_ZERO - star->Mag);124 127 125 128 char *glintType = psMetadataLookupStr (&status, glintItem->data.md, "GLINT.TYPE"); … … 129 132 } 130 133 131 // depending on the glint type, we need to find either the chips in the row or in the column. 134 double glintLength = GLINT_LENGTH_MAG_SLOPE*(GLINT_LENGTH_MAG_ZERO - star->Mag); 135 double glintAngle = 0; 136 137 //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 30k pixels 138 if ((!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM")) && abs(star->FP->y) < 30000 ){ 139 glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->y)); 140 141 } 142 if ((!strcasecmp(glintType, "LEFT") || !strcasecmp(glintType, "RIGHT")) && abs(star->FP->x) < 30000 ) { 143 glintLength /= GLINT_LENGTH_POS_SLOPE*(GLINT_LENGTH_POS_REF - abs(star->FP->x)); 144 } 145 //also compute the angle of the glint, which depends on position parallel to the FPX 146 if (!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM") ){ 147 glintAngle = PM_RAD_DEG * (GLINT_ANGLE_POS_SLOPE*((GLINT_ANGLE_POS_REF - star->FP->x)/1000.)); 148 149 } 150 if (!strcasecmp(glintType, "LEFT") || !strcasecmp(glintType, "RIGHT") ) { 151 glintAngle = PM_RAD_DEG * (GLINT_ANGLE_POS_SLOPE*((GLINT_ANGLE_POS_REF - star->FP->y)/1000.)); 152 } 153 154 155 psVector *x_glint = psVectorAlloc(2,PS_TYPE_F32); 156 psVector *y_glint = psVectorAlloc(2,PS_TYPE_F32); 157 132 158 if (!strcasecmp(glintType, "TOP") || !strcasecmp(glintType, "BOTTOM")) { 133 for (int nChip = 0; nChip < fpa->chips->n; nChip++) { 134 135 pmChip *chip = fpa->chips->data[nChip]; 136 if (!chip) continue; 137 138 if (!psastroFindChipInXrange (fpa, nChip, star->FP->x, star->FP->y)) { 139 continue; 140 } 141 142 // find the coordinate of the end point 143 double xFPA = star->FP->x; 144 double yFPA0 = star->FP->y; 145 double yFPA1; 146 if (!strcasecmp(glintType, "TOP")) { 147 yFPA1 = yFPA0 - glintLength; 148 } else { 149 yFPA1 = yFPA0 + glintLength; 150 } 151 152 // FPA coordinates of intersections with chip edges 153 double yFPAs, yFPAe; 154 psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip); 155 156 if (yFPA0 > yFPA1) PS_SWAP (yFPA0, yFPA1); 157 if (yFPAs > yFPAe) PS_SWAP (yFPAs, yFPAe); 158 159 // does this glint cross this chip? 160 if (yFPA0 > yFPAe) continue; 161 if (yFPA1 < yFPAs) continue; 162 163 yFPA0 = PS_MAX (yFPA0, yFPAs); 164 yFPA1 = PS_MIN (yFPA1, yFPAe); 165 166 double xChip0, yChip0, xChip1, yChip1; 167 psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xFPA, yFPA0); 168 psastroFPAtoChip (&xChip1, &yChip1, fpa, nChip, xFPA, yFPA1); 169 170 // we now have the location of the glint ends or edge-intersections in chip coordinates 171 // double-check if this chip overlaps this glint 172 if (xChip0 > xChip1) PS_SWAP (xChip0, xChip1); 173 if (yChip0 > yChip1) PS_SWAP (yChip0, yChip1); 174 175 // bounds of this chip 176 psRegion *region = pmChipPixels (chip); 177 if (yChip1 < region->y0) continue; 178 if (yChip0 > region->y1) continue; 179 180 // this glint touches this chip. calculate the start and end 181 // coordinates on this chip 182 double xChipS = PS_MAX(xChip0 - 0.5*glintWidth, region->x0); 183 double xChipE = PS_MIN(xChip1 + 0.5*glintWidth, region->x1); 184 double yChipS = PS_MAX (yChip0, region->y0); 185 double yChipE = PS_MIN (yChip1, region->y1); 186 187 // select the 0th readout of the 0th cell for this chip 188 if (!chip->cells) continue; 189 if (!chip->cells->n) continue; 190 pmCell *glintCell = chip->cells->data[0]; 191 if (!glintCell) continue; 192 if (!glintCell->readouts) continue; 193 if (!glintCell->readouts->n) continue; 194 pmReadout *glintReadout = glintCell->readouts->data[0]; 195 if (!glintReadout) continue; 196 197 // save the glints on the readout->analysis metadata, creating if needed 198 psArray *glints = psMetadataLookupPtr (&status, glintReadout->analysis, "PSASTRO.GLINTS"); 199 if (glints == NULL) { 200 glints = psArrayAllocEmpty (100); 201 if (!psMetadataAdd (glintReadout->analysis, PS_LIST_TAIL, "PSASTRO.GLINTS", PS_DATA_ARRAY, "astrometry matches", glints)) { 202 psWarning("failure to add glints to readout"); 203 psFree (glints); 204 continue; 205 } 206 psFree (glints); 207 } 208 209 fprintf (stderr, "glint %s : %f,%f to %f,%f (%f,%f to %f,%f)\n", glintType, xChip0, yChip0, xChip1, yChip1, xChipS, yChipS, xChipE, yChipE); 210 psRegion *glint = psRegionAlloc(xChipS, xChipE, yChipS, yChipE); 211 psArrayAdd (glints, 100, glint); 212 psFree (glint); 213 psFree (region); 159 // We want to find the coordinates of the glint end points. However, the glint is straight off the pixel focal plane and has an angle only on the focal plane. So, first find the edge 160 double xFPA0 = star->FP->x; 161 double yFPA0 = star->FP->y; 162 double xFPA1; 163 double yFPA1; 164 //angles for TOP and LEFT have been flipped in the fitting 165 if (!strcasecmp(glintType, "TOP")) { 166 //find the edge chip and determine the FPA coords of the edge. Then, grab the edge coord and new glint length 167 for (int nChip = 0; nChip < fpa->chips->n; nChip++) { 168 pmChip *chip = fpa->chips->data[nChip]; 169 if (!chip) continue; 170 171 if (!psastroFindChipInXrange (fpa, nChip, star->FP->x, 20000.)) { 172 continue; 173 } 174 if (!psastroFindChipInYrange (fpa, nChip, star->FP->x, 20000.)) { 175 continue; 176 } 177 178 // FPA coordinates of intersections with chip edges 179 double yFPAs, yFPAe; 180 psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip); 181 182 xFPA0 = star->FP->x; 183 yFPA0 = yFPAe; 184 glintLength-= (star->FP->y-yFPAe); 185 } 186 187 xFPA1 = xFPA0 + glintLength*sin(glintAngle*-1.); 188 yFPA1 = yFPA0 - glintLength*cos(glintAngle*-1.); 189 190 } else { 191 //find the edge chip and determine the FPA coords of the edge. Then, grab the edge coord and new glint length 192 for (int nChip = 0; nChip < fpa->chips->n; nChip++) { 193 pmChip *chip = fpa->chips->data[nChip]; 194 if (!chip) continue; 195 196 if (!psastroFindChipInXrange (fpa, nChip, star->FP->x, -20000.)) { 197 continue; 198 } 199 if (!psastroFindChipInYrange (fpa, nChip, star->FP->x, -20000.)) { 200 continue; 201 } 202 203 // FPA coordinates of intersections with chip edges 204 double yFPAs, yFPAe; 205 psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip); 206 207 xFPA0 = star->FP->x; 208 yFPA0 = yFPAs; 209 glintLength-= (yFPAs-star->FP->y); 210 } 211 212 xFPA1 = xFPA0 - glintLength*sin(glintAngle); 213 yFPA1 = yFPA0 + glintLength*cos(glintAngle); 214 } 215 216 x_glint->data.F32[0] = xFPA0; 217 y_glint->data.F32[0] = yFPA0; 218 x_glint->data.F32[1] = xFPA1; 219 y_glint->data.F32[1] = yFPA1; 220 221 //we need to loop over each corner to select the chips that can have the glint on it 222 for (int glint_point = 0; glint_point < 2; glint_point++) { 223 for (int nChip = 0; nChip < fpa->chips->n; nChip++) { 224 225 pmChip *chip = fpa->chips->data[nChip]; 226 if (!chip) continue; 227 228 if (!psastroFindChipInXrange (fpa, nChip, x_glint->data.F32[glint_point], y_glint->data.F32[glint_point])) { 229 continue; 230 } 231 232 // FPA coordinates of intersections with chip edges 233 double yFPAs, yFPAe; 234 psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip); 235 236 if (yFPAs > yFPAe) PS_SWAP (yFPAs, yFPAe); 237 if (yFPA0 > yFPA1) { 238 PS_SWAP (xFPA0, xFPA1); 239 PS_SWAP (yFPA0, yFPA1); 240 } 241 242 // does this glint cross this chip? 243 if (yFPA0 > yFPAe) continue; 244 if (yFPA1 < yFPAs) continue; 245 246 //find the y-coord positions for this chip 247 double ycFPA0, ycFPA1; 248 ycFPA0 = PS_MAX (yFPA0, yFPAs); 249 ycFPA1 = PS_MIN (yFPA1, yFPAe); 250 251 //now calculate the proper x-coord positions given the angle, for this chip 252 double xcFPA0, xcFPA1, angle; 253 angle = atan2(xFPA1 - xFPA0,yFPA1 - yFPA0); 254 xcFPA0 = xFPA0 + (ycFPA0-yFPA0)*tan(angle); 255 xcFPA1 = xFPA0 + (ycFPA1-yFPA0)*tan(angle); 256 257 258 double xChip0, yChip0, xChip1, yChip1, chip_angle, glint_length, xChip2,yChip2; 259 psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA0, ycFPA0); 260 psastroFPAtoChip (&xChip1, &yChip1, fpa, nChip, xcFPA1, ycFPA1); 261 psastroFPAtoChip (&xChip2, &yChip2, fpa, nChip, star->FP->x,star->FP->y); 262 263 chip_angle = atan2(yChip1 - yChip0, xChip1 - xChip0); 264 glint_length = sqrt(pow(yChip1 - yChip0,2) + pow(xChip1 - xChip0,2)); 265 266 // select the 0th readout of the 0th cell for this chip 267 if (!chip->cells) continue; 268 if (!chip->cells->n) continue; 269 pmCell *glintCell = chip->cells->data[0]; 270 if (!glintCell) continue; 271 if (!glintCell->readouts) continue; 272 if (!glintCell->readouts->n) continue; 273 pmReadout *glintReadout = glintCell->readouts->data[0]; 274 if (!glintReadout) continue; 275 276 // save the glints on the readout->analysis metadata, creating if needed 277 psArray *glints = psMetadataLookupPtr (&status, glintReadout->analysis, "PSASTRO.GLINTS"); 278 if (glints == NULL) { 279 glints = psArrayAllocEmpty (100); 280 if (!psMetadataAdd (glintReadout->analysis, PS_LIST_TAIL, "PSASTRO.GLINTS", PS_DATA_ARRAY, "astrometry matches", glints)) { 281 psWarning("failure to add glints to readout"); 282 psFree (glints); 283 continue; 284 } 285 psFree (glints); 286 } 287 288 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); 289 psVector *glint = psVectorAlloc(5,PS_TYPE_F32); 290 glint->data.F32[0] = xChip0; 291 glint->data.F32[1] = yChip0; 292 glint->data.F32[2] = glint_length; 293 glint->data.F32[3] = glintWidth; 294 glint->data.F32[4] = chip_angle; 295 296 psArrayAdd (glints, 100, glint); 297 298 psFree (glint); 299 } 214 300 } 215 301 } 216 302 217 // depending on the glint type, we need to find either the chips in the row or in the column.218 303 if (!strcasecmp(glintType, "LEFT") || !strcasecmp(glintType, "RIGHT")) { 219 for (int nChip = 0; nChip < fpa->chips->n; nChip++) { 220 221 pmChip *chip = fpa->chips->data[nChip]; 222 if (!chip) continue; 223 224 if (!psastroFindChipInYrange (fpa, nChip, star->FP->x, star->FP->y)) { 225 continue; 226 } 227 228 // find the coordinate of the end point 229 double yFPA = star->FP->y; 230 double xFPA0 = star->FP->x; 231 double xFPA1; 232 if (!strcasecmp(glintType, "RIGHT")) { 233 xFPA1 = xFPA0 - glintLength; 234 } else { 235 xFPA1 = xFPA0 + glintLength; 236 } 237 238 // FPA coordinates of intersections with chip edges 239 double xFPAs, xFPAe; 240 psastroFindChipXedges (&xFPAs, &xFPAe, fpa, nChip); 241 242 if (xFPA0 > xFPA1) PS_SWAP (xFPA0, xFPA1); 243 if (xFPAs > xFPAe) PS_SWAP (xFPAs, xFPAe); 244 245 // does this glint cross this chip? 246 if (xFPA0 > xFPAe) continue; 247 if (xFPA1 < xFPAs) continue; 248 249 xFPA0 = PS_MAX (xFPA0, xFPAs); 250 xFPA1 = PS_MIN (xFPA1, xFPAe); 251 252 double xChip0, yChip0, xChip1, yChip1; 253 psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xFPA0, yFPA); 254 psastroFPAtoChip (&xChip1, &yChip1, fpa, nChip, xFPA1, yFPA); 255 256 // we now have the location of the glint ends or edge-intersections in chip coordinates 257 // double-check if this chip overlaps this glint 258 if (xChip0 > xChip1) PS_SWAP (xChip0, xChip1); 259 if (yChip0 > yChip1) PS_SWAP (yChip0, yChip1); 260 261 // bounds of this chip 262 psRegion *region = pmChipPixels (chip); 263 if (xChip1 < region->x0) continue; 264 if (xChip0 > region->x1) continue; 265 266 // this glint touches this chip. calculate the start and end 267 // coordinates on this chip 268 double yChipS = PS_MAX (yChip0 - 0.5*glintWidth, region->y0); 269 double yChipE = PS_MIN (yChip1 + 0.5*glintWidth, region->y1); 270 double xChipS = PS_MAX (xChip0, region->x0); 271 double xChipE = PS_MIN (xChip1, region->x1); 272 273 // select the 0th readout of the 0th cell for this chip 274 if (!chip->cells) continue; 275 if (!chip->cells->n) continue; 276 pmCell *glintCell = chip->cells->data[0]; 277 if (!glintCell) continue; 278 if (!glintCell->readouts) continue; 279 if (!glintCell->readouts->n) continue; 280 pmReadout *glintReadout = glintCell->readouts->data[0]; 281 if (!glintReadout) continue; 282 283 // save the glints on the readout->analysis metadata, creating if needed 284 psArray *glints = psMetadataLookupPtr (&status, glintReadout->analysis, "PSASTRO.GLINTS"); 285 if (glints == NULL) { 286 glints = psArrayAllocEmpty (100); 287 if (!psMetadataAdd (glintReadout->analysis, PS_LIST_TAIL, "PSASTRO.GLINTS", PS_DATA_ARRAY, "astrometry matches", glints)) { 288 psWarning("failure to add glints to readout"); 289 psFree (glints); 290 continue; 291 } 292 psFree (glints); 293 } 294 295 fprintf (stderr, "glint %s : %f,%f to %f,%f (%f,%f to %f,%f)\n", glintType, xChip0, yChip0, xChip1, yChip1, xChipS, yChipS, xChipE, yChipE); 296 psRegion *glint = psRegionAlloc(xChipS, xChipE, yChipS, yChipE); 297 psArrayAdd (glints, 100, glint); 298 psFree (glint); 299 psFree (region); 304 // We want to find the coordinates of the glint end points. However, the glint is straight off the pixel focal plane and has an angle only on the focal plane. So, first find the edge 305 double xFPA0 = star->FP->x; 306 double yFPA0 = star->FP->y; 307 double xFPA1; 308 double yFPA1; 309 //angles for TOP and LEFT have been flipped in the fitting 310 if (!strcasecmp(glintType, "RIGHT")) { 311 //find the edge chip and determine the FPA coords of the edge. Then, grab the edge coord and new glint length 312 for (int nChip = 0; nChip < fpa->chips->n; nChip++) { 313 pmChip *chip = fpa->chips->data[nChip]; 314 if (!chip) continue; 315 316 if (!psastroFindChipInXrange (fpa, nChip, 20000.,star->FP->y)) { 317 continue; 318 } 319 if (!psastroFindChipInYrange (fpa, nChip, 20000.,star->FP->y)) { 320 continue; 321 } 322 323 // FPA coordinates of intersections with chip edges 324 double yFPAs, yFPAe; 325 psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip); 326 327 xFPA0 = yFPAe; 328 yFPA0 = star->FP->y; 329 glintLength-= (star->FP->x-yFPAe); 330 } 331 332 xFPA1 = xFPA0 - glintLength*cos(glintAngle); 333 yFPA1 = yFPA0 - glintLength*sin(glintAngle); 334 335 } else { 336 //find the edge chip and determine the FPA coords of the edge. Then, grab the edge coord and new glint length 337 for (int nChip = 0; nChip < fpa->chips->n; nChip++) { 338 pmChip *chip = fpa->chips->data[nChip]; 339 if (!chip) continue; 340 341 if (!psastroFindChipInXrange (fpa, nChip, -20000.,star->FP->y)) { 342 continue; 343 } 344 if (!psastroFindChipInYrange (fpa, nChip, -20000.,star->FP->y)) { 345 continue; 346 } 347 348 // FPA coordinates of intersections with chip edges 349 double yFPAs, yFPAe; 350 psastroFindChipYedges (&yFPAs, &yFPAe, fpa, nChip); 351 352 xFPA0 = yFPAs; 353 yFPA0 = star->FP->y; 354 glintLength-= (yFPAs-star->FP->x); 355 } 356 357 xFPA1 = xFPA0 + glintLength*cos(glintAngle*-1.); 358 yFPA1 = yFPA0 + glintLength*sin(glintAngle*-1.); 359 } 360 361 x_glint->data.F32[0] = xFPA0; 362 y_glint->data.F32[0] = yFPA0; 363 x_glint->data.F32[1] = xFPA1; 364 y_glint->data.F32[1] = yFPA1; 365 366 //we need to loop over each corner to select the chips that can have the glint on it 367 for (int glint_point = 0; glint_point < 2; glint_point++) { 368 for (int nChip = 0; nChip < fpa->chips->n; nChip++) { 369 370 pmChip *chip = fpa->chips->data[nChip]; 371 if (!chip) continue; 372 373 if (!psastroFindChipInYrange (fpa, nChip, x_glint->data.F32[glint_point], y_glint->data.F32[glint_point])) { 374 continue; 375 } 376 377 // FPA coordinates of intersections with chip edges 378 double xFPAs, xFPAe; 379 psastroFindChipXedges (&xFPAs, &xFPAe, fpa, nChip); 380 381 if (xFPAs > xFPAe) PS_SWAP (xFPAs, xFPAe); 382 if (xFPA0 > xFPA1) { 383 PS_SWAP (xFPA0, xFPA1); 384 PS_SWAP (yFPA0, yFPA1); 385 } 386 387 // does this glint cross this chip? 388 if (xFPA0 > xFPAe) continue; 389 if (xFPA1 < xFPAs) continue; 390 391 //find the x-coord positions for this chip 392 double xcFPA0, xcFPA1; 393 xcFPA0 = PS_MAX (xFPA0, xFPAs); 394 xcFPA1 = PS_MIN (xFPA1, xFPAe); 395 396 //now calculate the proper x-coord positions given the angle, for this chip 397 double ycFPA0, ycFPA1, angle; 398 angle = atan2(xFPA1 - xFPA0,yFPA1 - yFPA0); 399 ycFPA0 = yFPA0 + (xcFPA0-xFPA0)/tan(angle); 400 ycFPA1 = yFPA0 + (xcFPA1-xFPA0)/tan(angle); 401 402 double xChip0, yChip0, xChip1, yChip1, chip_angle, glint_length,xChip2,yChip2; 403 psastroFPAtoChip (&xChip0, &yChip0, fpa, nChip, xcFPA0, ycFPA0); 404 psastroFPAtoChip (&xChip1, &yChip1, fpa, nChip, xcFPA1, ycFPA1); 405 psastroFPAtoChip (&xChip2, &yChip2, fpa, nChip, star->FP->x,star->FP->y); 406 407 chip_angle = atan2(yChip1 - yChip0, xChip1 - xChip0); 408 glint_length = sqrt(pow(yChip1 - yChip0,2) + pow(xChip1 - xChip0,2)); 409 410 // select the 0th readout of the 0th cell for this chip 411 if (!chip->cells) continue; 412 if (!chip->cells->n) continue; 413 pmCell *glintCell = chip->cells->data[0]; 414 if (!glintCell) continue; 415 if (!glintCell->readouts) continue; 416 if (!glintCell->readouts->n) continue; 417 pmReadout *glintReadout = glintCell->readouts->data[0]; 418 if (!glintReadout) continue; 419 420 // save the glints on the readout->analysis metadata, creating if needed 421 psArray *glints = psMetadataLookupPtr (&status, glintReadout->analysis, "PSASTRO.GLINTS"); 422 if (glints == NULL) { 423 glints = psArrayAllocEmpty (100); 424 if (!psMetadataAdd (glintReadout->analysis, PS_LIST_TAIL, "PSASTRO.GLINTS", PS_DATA_ARRAY, "astrometry matches", glints)) { 425 psWarning("failure to add glints to readout"); 426 psFree (glints); 427 continue; 428 } 429 psFree (glints); 430 } 431 432 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); 433 psVector *glint = psVectorAlloc(5,PS_TYPE_F32); 434 glint->data.F32[0] = xChip0; 435 glint->data.F32[1] = yChip0; 436 glint->data.F32[2] = glint_length; 437 glint->data.F32[3] = glintWidth; 438 glint->data.F32[4] = chip_angle; 439 440 psArrayAdd (glints, 100, glint); 441 442 psFree (glint); 443 } 300 444 } 301 445 } 446 447 302 448 if (!strcasecmp(glintType, "HSC")) { 303 449 // It's inefficient to keep looking these up.
Note:
See TracChangeset
for help on using the changeset viewer.
