- Timestamp:
- Nov 13, 2020, 2:48:11 PM (6 years ago)
- Location:
- trunk/psastro/src
- Files:
-
- 5 edited
-
psastroConvert.c (modified) (2 diffs)
-
psastroLoadCrosstalk.c (modified) (9 diffs)
-
psastroLoadGhosts.c (modified) (9 diffs)
-
psastroLoadGlints.c (modified) (1 diff)
-
psastroUtils.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroConvert.c
r41367 r41434 14 14 // leak free 2006.04.27 15 15 16 // To select good stars, I want them to have a PSFmodel fit (PM_SOURCE_MODE_PSFMODEL & PM_SOURCE_MODE_FITTED) and exlcude things that are CR, EXT, FAIL, POOR 17 // Stars are allowed to be saturated, as long as the PSF model fits 18 # define PHOT_SOURCE_MASK (PM_SOURCE_MODE_FAIL | PM_SOURCE_MODE_BLEND | PM_SOURCE_MODE_BADPSF | \ 19 PM_SOURCE_MODE_DEFECT | PM_SOURCE_MODE_CR_LIMIT | PM_SOURCE_MODE_EXT_LIMIT | \ 20 PM_SOURCE_MODE_POOR) // Mask to apply to sources for rejection 21 16 22 static psArray *chooseStars(psArray *inStars, char *listName, psArray *sources, psVector *index, int nMax, float iMagMin, float iMagMax, pmSourceMode skip); 17 23 … … 142 148 } 143 149 } 150 151 //also select a sample of stars which are allowed to be saturated and bright, as long as they are well fit by a PSF model 152 int j = 0; 153 psArray *calStars = psArrayAlloc(inStars->n); 154 155 for (int i = 0; (i < inStars->n) && (j < rawStars->n); i++) { 156 int n = index->data.S32[i]; 157 pmSource *source = sources->data[n]; 158 159 // we only want to use stars which are not bad. Use the source->mode to check for the rejection mask while keeping fitted PSFmodel 160 if (source->mode & PHOT_SOURCE_MASK || !isfinite(source->psfMag)) { 161 continue; 162 } 163 164 //Ensure the source has a fitted PSF model 165 if (!(source->mode & PM_SOURCE_MODE_PSFMODEL) || !(source->mode & PM_SOURCE_MODE_FITTED) ) { 166 continue; 167 } 168 169 calStars->data[j] = psMemIncrRefCounter (inStars->data[n]); 170 j++; 171 } 172 calStars->n = j; 173 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.CALSTARS", PS_DATA_ARRAY, "astrometry objects for masking", calStars); 144 174 145 175 psFree (index); -
trunk/psastro/src/psastroLoadCrosstalk.c
r41430 r41434 53 53 pmFPAview *viewMask = pmFPAviewAlloc (0); 54 54 55 float zeropt, exptime, MAX_MAG, SPIKE_MAX_MAG;55 float zeropt, exptime, MAX_MAG, INSTR_MAX_MAG, SPIKE_MAX_MAG; 56 56 57 57 psLogMsg ("psastro", PS_LOG_INFO, "determine crosstalk positions"); … … 99 99 } 100 100 101 MAX_MAG = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_CROSSTALK_MAG_MAX");101 INSTR_MAX_MAG = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_CROSSTALK_MAG_MAX"); 102 102 // recipe values are given in instrumental magnitudes 103 103 // use the zero point and exposure time to convert to apparent mags: M_ap = M_inst + C_0 + 2.5*log(exptime) 104 104 float MagOffset = zeropt + 2.5*log10(exptime); 105 MAX_MAG +=MagOffset;105 MAX_MAG = INSTR_MAX_MAG + MagOffset; 106 106 107 107 // Get the spike maximum, as well … … 141 141 } 142 142 143 // Get the array of reference stars we're concerned with. 144 psArray *refstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.REFSTARS"); 145 if (refstars == NULL) { return(true); } 146 147 // Check each reference star 148 for (int i = 0; i < refstars->n; i++) { 149 // This is the source of the ct. 150 pmAstromObj *ref = refstars->data[i]; 151 152 if (ref->Mag > MAX_MAG) { 143 // To check for the presence of crosstalk we first make use the actual detections on this image. 144 // That way we can include things like movers creating crosstalk features. 145 psArray *calstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.CALSTARS"); 146 if (calstars == NULL) { continue; } 147 148 for (int i = 0; i < calstars->n; i++) { 149 pmAstromObj *cal = calstars->data[i]; 150 151 if (cal->Mag > INSTR_MAX_MAG) { 153 152 continue; 154 153 } … … 156 155 // Identify which cell holds the star 157 156 pmChip *CTsourceChip = refChip; 158 pmCell *CTsourceCell = pmCellInChip(refChip, ref->chip->x,ref->chip->y);157 pmCell *CTsourceCell = pmCellInChip(refChip,cal->chip->x,cal->chip->y); 159 158 160 159 if (!CTsourceCell) { … … 162 161 } 163 162 164 psTrace ("psastro.crosstalk",2,"REF: %d %f (%f %f) %f %f :: %f %f\n", 165 i,ref->Mag, ref->sky->r,ref->sky->d, ref->FP->x,ref->FP->y, ref->chip->x,ref->chip->y); 166 163 psTrace ("psastro.crosstalk",2,"DETEC: %d %f :: %f %f\n", 164 i,cal->Mag, cal->chip->x,cal->chip->y); 167 165 168 166 const char *cellName = psMetadataLookupStr(NULL,CTsourceCell->concepts, "CELL.NAME"); … … 176 174 float x_t_chip,y_t_chip; 177 175 // int faint_ct = 0; NOTE: not currently used 178 pmCellCoordsForChip(&x_cell,&y_cell,CTsourceCell, ref->chip->x,ref->chip->y);176 pmCellCoordsForChip(&x_cell,&y_cell,CTsourceCell,cal->chip->x,cal->chip->y); 179 177 180 178 x_t_cell = x_cell; … … 245 243 psStringAppend(&targetCellName,"xy%d%d",Ut,Vt); 246 244 247 psTrace ("psastro.crosstalk",2,"CTsource @ OTA%d%dxy%d%d@%f,%f CTtarget OTA%d%dxy%d%d@%f,%f [%s %s]",245 psTrace ("psastro.crosstalk",2,"CTsource from DETEC @ OTA%d%dxy%d%d@%f,%f CTtarget OTA%d%dxy%d%d@%f,%f [%s %s]", 248 246 X,Y,U,V,x_cell,y_cell,Xt,Yt,Ut,Vt,x_t_cell,y_t_cell, 249 247 targetChipName,targetCellName); 250 248 249 251 250 pmCell *CTtargetCell = getCellByName (CTsourceChip,targetCellName); 252 251 if (!CTtargetCell) continue; … … 254 253 pmChipCoordsForCell(&x_t_chip,&y_t_chip,CTtargetCell,x_t_cell,y_t_cell); 255 254 256 psTrace ("psastro.crosstalk",2,"CTsource @ OTA%d%dxy%d%d@%f,%f CTtarget OTA%d%dxy%d%d@%f,%f ChipLoc: (%f,%f)",255 psTrace ("psastro.crosstalk",2,"CTsource from DETEC @ OTA%d%dxy%d%d@%f,%f CTtarget OTA%d%dxy%d%d@%f,%f ChipLoc: (%f,%f)", 257 256 X,Y,U,V,x_cell,y_cell,Xt,Yt,Ut,Vt,x_t_cell,y_t_cell,x_t_chip,y_t_chip); 258 257 … … 272 271 pmAstromObj *crosstalk = pmAstromObjAlloc(); 273 272 273 crosstalk->Mag = cal->Mag; 274 crosstalk->chip->x = x_t_chip; 275 crosstalk->chip->y = y_t_chip; 276 277 psArray *crosstalks = psMetadataLookupPtr (&status, targetReadout->analysis, "PSASTRO.CROSSTALKS"); 278 if (crosstalks == NULL) { 279 crosstalks = psArrayAllocEmpty(100); 280 if (!psMetadataAdd(targetReadout->analysis,PS_LIST_TAIL,"PSASTRO.CROSSTALKS", PS_DATA_ARRAY, "crosstalk locations", crosstalks)) { 281 psError(PSASTRO_ERR_CONFIG, false, "failure to add crosstalks to readout"); 282 goto escape; 283 } 284 psFree(crosstalks); 285 } 286 psArrayAdd(crosstalks,100,crosstalk); 287 288 psFree(targetChipName); 289 psFree(targetCellName); 290 psFree(crosstalk); 291 } 292 293 294 // We also want to use the refstars to check for crosstalk. In particular, the detections 295 // do not do well for bright stars, and saturated detections will underestimate the size of the crostalk 296 // Get the array of reference stars we're concerned with. 297 psArray *refstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.REFSTARS"); 298 if (refstars == NULL) { return(true); } 299 300 // Check each reference star 301 for (int i = 0; i < refstars->n; i++) { 302 // This is the source of the ct. 303 pmAstromObj *ref = refstars->data[i]; 304 305 if (ref->Mag > MAX_MAG) { 306 continue; 307 } 308 309 // Identify which cell holds the star 310 pmChip *CTsourceChip = refChip; 311 pmCell *CTsourceCell = pmCellInChip(refChip,ref->chip->x,ref->chip->y); 312 313 if (!CTsourceCell) { 314 continue; 315 } 316 317 psTrace ("psastro.crosstalk",2,"REF: %d %f (%f %f) %f %f :: %f %f\n", 318 i,ref->Mag, ref->sky->r,ref->sky->d, ref->FP->x,ref->FP->y, ref->chip->x,ref->chip->y); 319 320 const char *cellName = psMetadataLookupStr(NULL,CTsourceCell->concepts, "CELL.NAME"); 321 int U = cellName[2] - '0'; 322 int V = cellName[3] - '0'; 323 324 int Xt = X,Yt = Y,Ut = U,Vt = V; 325 float x_cell,y_cell; 326 float x_t_cell,y_t_cell; 327 328 float x_t_chip,y_t_chip; 329 // int faint_ct = 0; NOTE: not currently used 330 pmCellCoordsForChip(&x_cell,&y_cell,CTsourceCell,ref->chip->x,ref->chip->y); 331 332 x_t_cell = x_cell; 333 y_t_cell = y_cell; 334 335 // 2020-10-21 TdB: Here is the list of known cross talks from the bright star analysis: 336 // The relationships work using OTA"XY"XY"UV" 337 // Inter-chip 338 // OTA2yXY3v => OTA3yXY3v 339 // OTA4yXY3v <= OTA5yXY3v 340 // Intra-chip 341 // OTA2yXY5v <=> OTA2yXY6v 342 // OTA5yXY5v <=> OTA5yXY6v 343 // One way fainter 344 // OTA2yXY7v => OTA3yXY2v 345 // OTA5yXY7v => OTA4yXY2v 346 // Determine if this combination of chip and cell produces a crosstalk artifact 347 if ((X == 2)&&(! ((U == 3)||(U == 5)||(U == 6)||(U == 7)))) { 348 psTrace ("psastro.crosstalk",2,"Cell (%d%d) on chip (%d%d) not a known crosstalk source.",U,V,X,Y); 349 psTrace ("psastro.crosstalk",2,"t1: %d t2: %d", 350 (X == 2), 351 (! ((U == 3)||(U == 5)||(U == 6)||(U == 7)))); 352 continue; 353 } 354 if ((X == 5)&&(! ((U == 3)||(U == 5)||(U == 6)||(U == 7)))) { 355 psTrace ("psastro.crosstalk",2,"Cell (%d%d) on chip (%d%d) not a known crosstalk source.",U,V,X,Y); 356 continue; 357 } 358 359 // Calculate destination positions 360 if (X == 2) { 361 if (U == 3) { 362 Xt = 3; 363 } 364 if (U == 5) { 365 Ut = 6; 366 } 367 if (U == 6) { 368 Ut = 5; 369 } 370 if (U == 7) { 371 Xt = 3; 372 Ut = 2; 373 // faint_ct = 1; NOTE: not currently used 374 } 375 } 376 if (X == 5) { 377 if (U == 3) { 378 Xt = 4; 379 } 380 if (U == 5) { 381 Ut = 6; 382 } 383 if (U == 6) { 384 Ut = 5; 385 } 386 if (U == 7) { 387 Xt = 4; 388 Ut = 2; 389 // faint_ct = 1; NOTE: not currently used 390 } 391 } 392 393 // Convert target cell coordinates to target chip coordinates 394 psString targetChipName = NULL; 395 psStringAppend(&targetChipName,"XY%d%d",Xt,Yt); 396 psString targetCellName = NULL; 397 psStringAppend(&targetCellName,"xy%d%d",Ut,Vt); 398 399 psTrace ("psastro.crosstalk",2,"CTsource @ OTA%d%dxy%d%d@%f,%f CTtarget OTA%d%dxy%d%d@%f,%f [%s %s]", 400 X,Y,U,V,x_cell,y_cell,Xt,Yt,Ut,Vt,x_t_cell,y_t_cell, 401 targetChipName,targetCellName); 402 403 pmCell *CTtargetCell = getCellByName (CTsourceChip,targetCellName); 404 if (!CTtargetCell) continue; 405 406 pmChipCoordsForCell(&x_t_chip,&y_t_chip,CTtargetCell,x_t_cell,y_t_cell); 407 408 psTrace ("psastro.crosstalk",2,"CTsource @ OTA%d%dxy%d%d@%f,%f CTtarget OTA%d%dxy%d%d@%f,%f ChipLoc: (%f,%f)", 409 X,Y,U,V,x_cell,y_cell,Xt,Yt,Ut,Vt,x_t_cell,y_t_cell,x_t_chip,y_t_chip); 410 411 // Hunt down the readout for the target, and save the chip position and magnitude of source star. 412 pmChip *targetChip = getChipByName(fpa,targetChipName); 413 if (!targetChip) continue; 414 if (!targetChip->cells) continue; 415 if (!targetChip->cells->n) continue; 416 417 pmCell *targetCell = targetChip->cells->data[0]; 418 if (!targetCell) continue; 419 if (!targetCell->readouts) continue; 420 if (!targetCell->readouts->n) continue; 421 pmReadout *targetReadout = targetCell->readouts->data[0]; 422 if (!targetReadout) continue; 423 424 pmAstromObj *crosstalk = pmAstromObjAlloc(); 425 274 426 crosstalk->Mag = ref->Mag - MagOffset; 275 427 crosstalk->chip->x = x_t_chip; 428 crosstalk->chip->y = y_t_chip; 276 429 crosstalk->chip->y = y_t_chip; 277 430 -
trunk/psastro/src/psastroLoadGhosts.c
r41367 r41434 41 41 } 42 42 43 // To select good stars, I want them to have a PSFmodel fit (PM_SOURCE_MODE_PSFMODEL & PM_SOURCE_MODE_FITTED) and exlcude things that are CR, EXT, FAIL, POOR 44 // Stars are allowed to be saturated, as long as the PSF model fits 45 # define PHOT_SOURCE_MASK (PM_SOURCE_MODE_FAIL | PM_SOURCE_MODE_BLEND | PM_SOURCE_MODE_BADPSF | \ 46 PM_SOURCE_MODE_DEFECT | PM_SOURCE_MODE_CR_LIMIT | PM_SOURCE_MODE_EXT_LIMIT | \ 47 PM_SOURCE_MODE_POOR) // Mask to apply to sources for rejection 48 43 49 /** 44 50 * calculate ghost FPA and Chip positions for the stars loaded on the FPA … … 101 107 pmCell *cell = NULL; 102 108 pmReadout *readout = NULL; 103 float zeropt, exptime, MAX_MAG;109 float zeropt, exptime,MAX_MAG, INSTR_MAX_MAG; 104 110 psMetadata *md = NULL; 105 111 psPolynomial2D *centerX = NULL; … … 139 145 140 146 // raise an error if the config is broken 141 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, & MAX_MAG, NULL, fpa, recipe)) {147 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &INSTR_MAX_MAG, NULL, fpa, recipe)) { 142 148 psError(PSASTRO_ERR_CONFIG, true, "failed to load zeropt data from recipe"); 143 149 goto escape; … … 147 153 // use the zero point and exposure time to convert to apparent mags: M_ap = M_inst + C_0 + 2.5*log(exptime) 148 154 float MagOffset = zeropt + 2.5*log10(exptime); 149 MAX_MAG +=MagOffset;155 MAX_MAG = INSTR_MAX_MAG + MagOffset; 150 156 151 157 // this loop selects the matched stars for all chips … … 163 169 if (! readout->data_exists) { continue; } 164 170 171 //First, select bright sources for ghosts from the detections. Later on, do the same using the refcat 172 // That way we can include things like movers creating crosstalk features. 173 psArray *calstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.CALSTARS"); 174 if (calstars == NULL) { continue; } 175 176 // identify the bright stars of interest 177 for (int i = 0; i < calstars->n; i++) { 178 pmAstromObj *cal = calstars->data[i]; 179 psTrace("psastro.ghost",5,"Begin ghost %d/%ld: MAX_MAG: %g; ref_mag: %g @ (%.10g,%.10g)",i,calstars->n,INSTR_MAX_MAG,cal->Mag,cal->sky->r * 180 / M_PI,cal->sky->d * 180.0 / M_PI); 180 181 if (cal->Mag > INSTR_MAX_MAG) { 182 continue; 183 } 184 185 psastroGhost *ghost = psastroGhostAlloc (); 186 ghost->srcFP->x = cal->FP->x; 187 ghost->srcFP->y = cal->FP->y; 188 189 double rSrc = hypot (cal->FP->x, cal->FP->y); 190 double theta0 = atan2(cal->FP->x,cal->FP->y); 191 192 if(mirCheck) { 193 //TdB: first mirror the reference star positions (around the 0,0 pixel) using the radial offset coefficients and the ghost/star angle 194 double ghost_offset_rad = psPolynomial1DEval (mirrorRad, rSrc); 195 double ghost_x_fpa_mirror = cal->FP->x + ((cal->FP->x*-1.)/abs(cal->FP->x)*abs(cos(theta0)*ghost_offset_rad)); 196 double ghost_y_fpa_mirror = cal->FP->y + ((cal->FP->y*-1.)/abs(cal->FP->y)*abs(sin(theta0)*ghost_offset_rad)); 197 198 // Now use the mirrored position together with the 2D ghost center fitting to get the actual ghost position in FPA coords 199 ghost->FP->x = ghost_x_fpa_mirror + psPolynomial2DEval(centerX, ghost_x_fpa_mirror, ghost_y_fpa_mirror); 200 ghost->FP->y = ghost_y_fpa_mirror + psPolynomial2DEval(centerY, ghost_x_fpa_mirror, ghost_y_fpa_mirror); 201 } 202 if(!mirCheck) { 203 //Use the old-style ghost position determination 204 ghost->FP->x = -cal->FP->x + psPolynomial2DEval(centerX, -cal->FP->x, -cal->FP->y); 205 ghost->FP->y = -cal->FP->y + psPolynomial2DEval(centerY, -cal->FP->x, -cal->FP->y); 206 } 207 208 ghost->inner.major = psPolynomial1DEval (innerMajor, rSrc); 209 ghost->inner.minor = psPolynomial1DEval (innerMinor, rSrc); 210 ghost->inner.theta = atan2(cal->FP->y, cal->FP->x); 211 212 ghost->outer.major = psPolynomial1DEval (outerMajor, rSrc); 213 ghost->outer.minor = psPolynomial1DEval (outerMinor, rSrc); 214 ghost->outer.theta = atan2(cal->FP->y, cal->FP->x); 215 216 // report instrumental ghost star mags 217 ghost->Mag = cal->Mag; 218 219 // XXX this code yields a single chip: we need to provide results for any chips 220 // which encompass the full size of the ghost 221 pmChip *ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, -ghost->srcFP->x, -ghost->srcFP->y); 222 /* float star_chip_x = ghost->chip->x; */ 223 /* float star_chip_y = ghost->chip->y; */ 224 ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, ghost->FP->x, ghost->FP->y); 225 //psLogMsg ("psastro", PS_LOG_INFO, "-> DETEC model chip position: %f, %f %f, %f %g\n", ghost->chip->x, ghost->chip->y,ghost->srcFP->x, ghost->srcFP->y,cal->Mag+MagOffset); 226 227 if (ghostChip) { 228 psTrace("psastro.ghost",5," in ghost: %d/%ld: ref: (%f,%f) or (%s) ghost: (%f,%f) or (%f,%f,%s) %f inner: (%f,%f,%f) outer: (%f,%f,%f)", 229 i,calstars->n, 230 cal->FP->x,cal->FP->y, 231 psMetadataLookupStr(NULL,chip->concepts,"CHIP.NAME"), 232 ghost->FP->x,ghost->FP->y, 233 ghost->chip->x,ghost->chip->y,psMetadataLookupStr(NULL,ghostChip->concepts,"CHIP.NAME"), 234 rSrc, 235 ghost->inner.major,ghost->inner.minor,ghost->inner.theta, 236 ghost->outer.major,ghost->outer.minor,ghost->outer.theta); 237 /* psWarning(" GHOST_DATA: %d/%ld: ref: (%f,%f) or (%f,%f,%s) ghost: (%f,%f) or (%f,%f,%s) %f inner: (%f,%f,%f) outer: (%f,%f,%f)", */ 238 /* i,calstars->n, */ 239 /* cal->FP->x,cal->FP->y, */ 240 /* ref_chip_x,ref_chip_y,psMetadataLookupStr(NULL,chip->concepts,"CHIP.NAME"), */ 241 /* ghost->FP->x,ghost->FP->y, */ 242 /* ghost->chip->x,ghost->chip->y,psMetadataLookupStr(NULL,ghostChip->concepts,"CHIP.NAME"), */ 243 /* rSrc, */ 244 /* ghost->inner.major,ghost->inner.minor,ghost->inner.theta, */ 245 /* ghost->outer.major,ghost->outer.minor,ghost->outer.theta); */ 246 } 247 else { 248 psTrace("psastro.ghost",5," in ghost: %d/%ld: ref: (%f,%f) ghost: (%f,%f) or (%f,%f,%s) inner: (%f,%f,%f) outer: (%f,%f,%f)", 249 i,calstars->n, 250 cal->FP->x,cal->FP->y, 251 ghost->FP->x,ghost->FP->y, 252 ghost->chip->x,ghost->chip->y,"NONE", 253 ghost->inner.major,ghost->inner.minor,ghost->inner.theta, 254 ghost->outer.major,ghost->outer.minor,ghost->outer.theta); 255 } 256 257 if (!ghostChip) goto skip; 258 if (!ghostChip->cells) goto skip; 259 if (!ghostChip->cells->n) goto skip; 260 261 262 pmCell *ghostCell = ghostChip->cells->data[0]; 263 if (!ghostCell) goto skip; 264 if (!ghostCell->readouts) goto skip; 265 if (!ghostCell->readouts->n) goto skip; 266 pmReadout *ghostReadout = ghostCell->readouts->data[0]; 267 if (!ghostReadout) goto skip; 268 269 psArray *ghosts = psMetadataLookupPtr (&status, ghostReadout->analysis, "PSASTRO.GHOSTS"); 270 if (ghosts == NULL) { 271 ghosts = psArrayAllocEmpty (100); 272 if (!psMetadataAdd (ghostReadout->analysis, PS_LIST_TAIL, "PSASTRO.GHOSTS", PS_DATA_ARRAY, "astrometry matches", ghosts)) { 273 psError(PSASTRO_ERR_CONFIG, false, "failure to add ghosts to readout"); 274 goto escape; 275 } 276 psFree (ghosts); 277 } 278 279 psArrayAdd (ghosts, 100, ghost); 280 281 skip: 282 283 psFree (ghost); 284 } 285 165 286 // select the raw objects for this readout (loaded in psastroChooseRefstars.c) 166 287 // XXX : note that we place limits on the refstar sample in psastroChooseRefstars.c: … … 173 294 pmAstromObj *ref = refstars->data[i]; 174 295 psTrace("psastro.ghost",5,"Begin ghost %d/%ld: MAX_MAG: %g; ref_mag: %g @ (%.10g,%.10g)",i,refstars->n,MAX_MAG,ref->Mag,ref->sky->r * 180 / M_PI,ref->sky->d * 180.0 / M_PI); 296 175 297 if (ref->Mag > MAX_MAG) continue; 176 298 … … 224 346 /* float ref_chip_y = ghost->chip->y; */ 225 347 ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, ghost->FP->x, ghost->FP->y); 226 // fprintf (stderr, "-> model chip position: %f, %f\n", ghost->chip->x, ghost->chip->y); 227 348 //psLogMsg ("psastro", PS_LOG_INFO, "-> model chip position: %f, %f %f, %f %g\n", ghost->chip->x, ghost->chip->y,ghost->srcFP->x, ghost->srcFP->y,ref->Mag); 228 349 229 350 if (ghostChip) { … … 257 378 } 258 379 259 if (!ghostChip) goto skip ;260 if (!ghostChip->cells) goto skip ;261 if (!ghostChip->cells->n) goto skip ;380 if (!ghostChip) goto skipref; 381 if (!ghostChip->cells) goto skipref; 382 if (!ghostChip->cells->n) goto skipref; 262 383 263 384 264 385 pmCell *ghostCell = ghostChip->cells->data[0]; 265 if (!ghostCell) goto skip ;266 if (!ghostCell->readouts) goto skip ;267 if (!ghostCell->readouts->n) goto skip ;386 if (!ghostCell) goto skipref; 387 if (!ghostCell->readouts) goto skipref; 388 if (!ghostCell->readouts->n) goto skipref; 268 389 pmReadout *ghostReadout = ghostCell->readouts->data[0]; 269 if (!ghostReadout) goto skip ;390 if (!ghostReadout) goto skipref; 270 391 271 392 psArray *ghosts = psMetadataLookupPtr (&status, ghostReadout->analysis, "PSASTRO.GHOSTS"); … … 281 402 psArrayAdd (ghosts, 100, ghost); 282 403 283 skip :404 skipref: 284 405 285 406 psFree (ghost); 286 407 } 408 287 409 } 288 410 } -
trunk/psastro/src/psastroLoadGlints.c
r41367 r41434 307 307 psFree (glints); 308 308 } 309 psVector *glint = psVectorAlloc(5,PS_TYPE_F32);309 psVector *glint = psVectorAlloc(5,PS_TYPE_F32); 310 310 glint->data.F32[0] = xChip0; 311 311 glint->data.F32[1] = yChip0; -
trunk/psastro/src/psastroUtils.c
r26259 r41434 132 132 psPlaneTransformApply (raw->TP, fpa->toTPA, raw->FP); 133 133 psDeproject (raw->sky, raw->TP, fpa->toSky); 134 } 135 } 136 137 psArray *calstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.CALSTARS"); 138 if (calstars) { 139 for (int i = 0; i < calstars->n; i++) { 140 pmAstromObj *cal = calstars->data[i]; 141 psPlaneTransformApply (cal->FP, chip->toFPA, cal->chip); 142 psPlaneTransformApply (cal->TP, fpa->toTPA, cal->FP); 143 psDeproject (cal->sky, cal->TP, fpa->toSky); 134 144 } 135 145 }
Note:
See TracChangeset
for help on using the changeset viewer.
