Changeset 25027 for branches/pap/psastro
- Timestamp:
- Aug 7, 2009, 4:08:25 PM (17 years ago)
- Location:
- branches/pap
- Files:
-
- 21 edited
- 2 copied
-
. (modified) (1 prop)
-
psastro (modified) (1 prop)
-
psastro/src/Makefile.am (modified) (1 diff)
-
psastro/src/psastro.h (modified) (3 diffs)
-
psastro/src/psastroAnalysis.c (modified) (1 diff)
-
psastro/src/psastroAstromGuess.c (modified) (1 diff)
-
psastro/src/psastroChipAstrom.c (modified) (1 diff)
-
psastro/src/psastroChooseGlintStars.c (copied) (copied from trunk/psastro/src/psastroChooseGlintStars.c )
-
psastro/src/psastroChooseRefstars.c (modified) (3 diffs)
-
psastro/src/psastroExtractGhosts.c (modified) (1 diff)
-
psastro/src/psastroExtractStars.c (modified) (1 diff)
-
psastro/src/psastroFindChip.c (modified) (1 diff, 1 prop)
-
psastro/src/psastroFixChipsTest.c (modified) (3 diffs)
-
psastro/src/psastroLoadGhosts.c (modified) (4 diffs)
-
psastro/src/psastroLoadGlints.c (copied) (copied from trunk/psastro/src/psastroLoadGlints.c )
-
psastro/src/psastroLoadRefstars.c (modified) (3 diffs)
-
psastro/src/psastroMaskUpdates.c (modified) (5 diffs)
-
psastro/src/psastroMaskUtils.c (modified) (1 diff)
-
psastro/src/psastroModelAnalysis.c (modified) (1 diff)
-
psastro/src/psastroModelFitBoresite.c (modified) (1 diff)
-
psastro/src/psastroMosaicOneChip.c (modified) (1 diff)
-
psastro/src/psastroOneChipFit.c (modified) (1 diff)
-
psastro/src/psastroZeroPoint.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap
- Property svn:mergeinfo changed
-
branches/pap/psastro
- Property svn:mergeinfo deleted
-
branches/pap/psastro/src/Makefile.am
r23810 r25027 89 89 psastroMaskUpdates.c \ 90 90 psastroMaskUtils.c \ 91 psastroChooseGlintStars.c \ 92 psastroLoadGlints.c \ 91 93 psastroLoadGhosts.c \ 92 94 psastroGhostUtils.c \ -
branches/pap/psastro/src/psastro.h
r23810 r25027 73 73 bool psastroMaskUpdates (pmConfig *config); 74 74 75 bool psastroLoadGlints (pmConfig *config); 76 bool psastroChooseGlintStars (pmConfig *config, psArray *refs, const char *source); 77 75 78 psArray *psastroLoadRefstars (pmConfig *config, const char *source); 76 79 bool psastroChipAstrom (pmConfig *config); … … 144 147 bool psastroZeroPoint (pmConfig *config); 145 148 bool psastroZeroPointReadout(pmReadout *readout, float zeropt, float exptime); 146 bool psastroZeroPointFromRecipe (float *zeropt, float *exptime, pmFPA *fpa, psMetadata *recipe);149 bool psastroZeroPointFromRecipe (float *zeropt, float *exptime, float *ghostMaxMag, pmFPA *fpa, psMetadata *recipe); 147 150 148 151 // masking functions … … 162 165 pmChip *psastroFindChip (double *xChip, double *yChip, pmFPA *fpa, double xFPA, double yFPA); 163 166 bool psastroChipBounds (pmFPA *fpa); 167 bool psastroFindChipInXrange (pmFPA *fpa, int nChip, double xFPA, double yFPA); 168 bool psastroFindChipInYrange (pmFPA *fpa, int nChip, double xFPA, double yFPA); 169 bool psastroFindChipYedges (double *yFPAs, double *yFPAe, pmFPA *fpa, int nChip); 170 bool psastroFindChipXedges (double *yFPAs, double *yFPAe, pmFPA *fpa, int nChip); 171 bool psastroFPAtoChip (double *xChip, double *yChip, pmFPA *fpa, int nChip, double xFPA, double yFPA); 172 164 173 165 174 // psastroExtract functions -
branches/pap/psastro/src/psastroAnalysis.c
r23688 r25027 86 86 return false; 87 87 } 88 89 if (!psastroChooseGlintStars (config, refs, "PSASTRO.INPUT")) { 90 psError (PSASTRO_ERR_UNKNOWN, false, "failed to select glint stars from reference star list\n"); 91 psFree(refs); 92 return false; 93 } 88 94 psFree (refs); // refs of interest are saved on readout->analysis 89 95 -
branches/pap/psastro/src/psastroAstromGuess.c
r21422 r25027 382 382 psStats *statsQ = psStatsAlloc (PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV); 383 383 384 psVectorStats (statsP, cornerPd, NULL, cornerMK, 1); 385 psVectorStats (statsQ, cornerQd, NULL, cornerMK, 1); 384 if (!psVectorStats (statsP, cornerPd, NULL, cornerMK, 1)) { 385 psError(PS_ERR_UNKNOWN, false, "failure to measure stats"); 386 return false; 387 } 388 if (!psVectorStats (statsQ, cornerQd, NULL, cornerMK, 1)) { 389 psError(PS_ERR_UNKNOWN, false, "failure to measure stats"); 390 return false; 391 } 386 392 387 393 float angle = atan2 (map->y->coeff[1][0], map->x->coeff[1][0]); -
branches/pap/psastro/src/psastroChipAstrom.c
r21409 r25027 130 130 } 131 131 132 if (numGoodChips == 0) { 133 psError(PSASTRO_ERR_UNKNOWN, false, "Failed to fit any chips"); 134 return false; 135 } 136 132 137 if (!psastroFixChips (config, recipe)) { 133 138 psError(PSASTRO_ERR_UNKNOWN, false, "failed to align problematic chips"); -
branches/pap/psastro/src/psastroChooseRefstars.c
r23412 r25027 6 6 * 7 7 * @author IfA 8 * @version $Revision: 1.21 $ $Name: not supported by cvs2svn $8 * @version $Revision: 1.21 $ 9 9 * @date $Date: 2009-02-07 02:03:34 $ 10 10 * Copyright 2009 Institute for Astronomy, University of Hawaii … … 49 49 pmFPAview *view = pmFPAviewAlloc (0); 50 50 pmFPA *fpa = input->fpa; 51 52 // XXX kind of a hack -- think this through a bit more clearly: 53 if (psMetadataLookupPtr (&status, fpa->analysis, "MATCHED_REFS")) { 54 // we loaded a set of matched references from an earlier astrometry 55 // analysis. however, we are re-doing the astrometry here, so remove 56 // that prior set of matched references 57 psMetadataRemoveKey (fpa->analysis, "MATCHED_REFS"); 58 } 51 59 52 60 // sort by mag … … 114 122 psTrace ("psastro", 4, "Added %ld refstars\n", refstars->n); 115 123 124 # if (0) 125 // XXX test 126 FILE *outfile = fopen ("refstars.dat", "w"); 127 assert (outfile); 128 for (int nn = 0; nn < refstars->n; nn++) { 129 pmAstromObj *ref = refstars->data[nn]; 130 fprintf (outfile, "%lf %lf\n", ref->sky->r*PS_DEG_RAD, ref->sky->d*PS_DEG_RAD); 131 } 132 fclose (outfile); 133 # endif 134 116 135 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.REFSTARS", PS_DATA_ARRAY, "astrometry matches", refstars); 117 136 psFree (refstars); -
branches/pap/psastro/src/psastroExtractGhosts.c
r23810 r25027 53 53 54 54 // really error-out here? or just skip? 55 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, fpa, recipe)) {55 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, fpa, recipe)) { 56 56 psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe"); 57 57 return false; -
branches/pap/psastro/src/psastroExtractStars.c
r23666 r25027 65 65 66 66 // really error-out here? or just skip? 67 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, fpa, recipe)) {67 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, fpa, recipe)) { 68 68 psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe"); 69 69 return false; -
branches/pap/psastro/src/psastroFindChip.c
- Property svn:mergeinfo deleted
r23810 r25027 110 110 } 111 111 112 // identify chips which land on this column (FP coords) 113 bool psastroFindChipInXrange (pmFPA *fpa, int nChip, double xFPA, double yFPA) { 114 115 if (!chipXmin || !chipXmax) { 116 psAbort ("chip bounds not set"); 117 } 118 119 if (xFPA < chipXmin->data.F32[nChip]) return false; 120 if (xFPA >= chipXmax->data.F32[nChip]) return false; 121 return true; 122 } 123 124 // identify chips which land on this row (FP coords) 125 bool psastroFindChipInYrange (pmFPA *fpa, int nChip, double xFPA, double yFPA) { 126 127 if (!chipYmin || !chipYmax) { 128 psAbort ("chip bounds not set"); 129 } 130 131 if (yFPA < chipYmin->data.F32[nChip]) return false; 132 if (yFPA >= chipYmax->data.F32[nChip]) return false; 133 return true; 134 } 135 136 // return the FPA coordinates of the Y edges of the chip 137 bool psastroFindChipYedges (double *yFPAs, double *yFPAe, pmFPA *fpa, int nChip) { 138 139 *yFPAs = chipYmin->data.F32[nChip]; 140 *yFPAe = chipYmax->data.F32[nChip]; 141 return true; 142 } 143 144 // return the FPA coordinates of the X edges of the chip 145 bool psastroFindChipXedges (double *yFPAs, double *yFPAe, pmFPA *fpa, int nChip) { 146 147 *yFPAs = chipXmin->data.F32[nChip]; 148 *yFPAe = chipXmax->data.F32[nChip]; 149 return true; 150 } 151 152 // convert FPA to Chip coordinates 153 bool psastroFPAtoChip (double *xChip, double *yChip, pmFPA *fpa, int nChip, double xFPA, double yFPA) { 154 155 pmChip *chip = fpa->chips->data[nChip]; 156 157 psPlane ptCH, ptFP; 158 ptFP.x = xFPA; 159 ptFP.y = yFPA; 160 psPlaneTransformApply (&ptCH, chip->fromFPA, &ptFP); 161 162 *xChip = ptCH.x; 163 *yChip = ptCH.y; 164 return true; 165 } 166 112 167 bool psastroExtractFreeChipBounds () { 113 168 -
branches/pap/psastro/src/psastroFixChipsTest.c
r21409 r25027 140 140 psStats *stats; 141 141 stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); 142 psVectorStats (stats, dX, NULL, NULL, 0); 142 if (!psVectorStats (stats, dX, NULL, NULL, 0)) { 143 psError(PS_ERR_UNKNOWN, false, "failure to measure stats"); 144 return false; 145 } 143 146 Xo = stats->robustMedian; 144 147 fprintf (stderr, "offset x: %f +/- %f\n", stats->robustMedian, stats->robustStdev); … … 146 149 147 150 stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); 148 psVectorStats (stats, dY, NULL, NULL, 0); 151 if (!psVectorStats (stats, dY, NULL, NULL, 0)) { 152 psError(PS_ERR_UNKNOWN, false, "failure to measure stats"); 153 return false; 154 } 149 155 Yo = stats->robustMedian; 150 156 fprintf (stderr, "offset y: %f +/- %f\n", stats->robustMedian, stats->robustStdev); … … 168 174 } 169 175 stats = psStatsAlloc (PS_STAT_ROBUST_MEDIAN | PS_STAT_ROBUST_STDEV); 170 psVectorStats (stats, dT, NULL, NULL, 0); 176 if (!psVectorStats (stats, dT, NULL, NULL, 0)) { 177 psError(PS_ERR_UNKNOWN, false, "failure to measure stats"); 178 return false; 179 } 171 180 float To = stats->robustMedian; 172 181 fprintf (stderr, "offset t: %f +/- %f\n", stats->robustMedian, stats->robustStdev); -
branches/pap/psastro/src/psastroLoadGhosts.c
r23810 r25027 46 46 pmCell *cell = NULL; 47 47 pmReadout *readout = NULL; 48 float zeropt, exptime ;48 float zeropt, exptime, MAX_MAG; 49 49 psMetadata *md = NULL; 50 50 psPolynomial2D *centerX = NULL; … … 71 71 if (!strcasecmp(ghostFile, "NONE")) return true; 72 72 73 double MAX_MAG = psMetadataLookupF32 (&status, recipe, "GHOST_MAX_MAG");74 75 73 if (!pmConfigFileRead (&ghostModel, ghostFile, "GHOST MODEL")) { 76 74 psError(PSASTRO_ERR_CONFIG, true, "Trouble loading ghost model"); … … 97 95 98 96 // really error-out here? or just skip? 99 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, fpa, recipe)) {97 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &MAX_MAG, fpa, recipe)) { 100 98 psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe"); 101 99 goto escape; … … 162 160 // which encompass the full size of the ghost 163 161 pmChip *ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, -ghost->srcFP->x, -ghost->srcFP->y); 164 fprintf (stderr, "raw chip position: %f, %f ", ghost->chip->x, ghost->chip->y);162 // fprintf (stderr, "raw chip position: %f, %f ", ghost->chip->x, ghost->chip->y); 165 163 166 164 ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, ghost->FP->x, ghost->FP->y); 167 fprintf (stderr, "-> model chip position: %f, %f\n", ghost->chip->x, ghost->chip->y);165 // fprintf (stderr, "-> model chip position: %f, %f\n", ghost->chip->x, ghost->chip->y); 168 166 169 167 if (!ghostChip) goto skip; -
branches/pap/psastro/src/psastroLoadRefstars.c
r23412 r25027 128 128 if (!strcmp (outformat, "PS1_DEV_0")) { 129 129 refstars = psastroReadGetstar_PS1_DEV_0 (fits); 130 131 // XXX test 132 // FILE *outfile = fopen ("refstars.dat", "w"); 133 // assert (outfile); 134 // for (int nn = 0; nn < refstars->n; nn++) { 135 // pmAstromObj *ref = refstars->data[nn]; 136 // fprintf (outfile, "%lf %lf\n", ref->sky->r*PS_DEG_RAD, ref->sky->d*PS_DEG_RAD); 137 // } 138 // fclose (outfile); 130 139 } 131 140 if (refstars == NULL) { … … 181 190 ref->sky->d = RAD_DEG*psMetadataLookupF32 (&status, row, "DEC"); 182 191 ref->Mag = 0.001*psMetadataLookupS32 (&status, row, "MAG"); // ELIXIR uses millimags 192 ref->Color = 0.0; 183 193 } else { 184 194 ref->sky->r = RAD_DEG*psMetadataLookupF64 (&status, row, "RA"); 185 195 ref->sky->d = RAD_DEG*psMetadataLookupF64 (&status, row, "DEC"); 186 196 ref->Mag = psMetadataLookupF32 (&status, row, "MAG"); // PANSTARRS uses mags 197 ref->Color = 0.0; 187 198 } 188 199 … … 216 227 psMetadata *row = psFitsReadTableRow(fits, i); // Table row 217 228 218 ref->sky->r = RAD_DEG*psMetadataLookupF 32(&status, row, "RA");219 ref->sky->d = RAD_DEG*psMetadataLookupF 32(&status, row, "DEC");229 ref->sky->r = RAD_DEG*psMetadataLookupF64 (&status, row, "RA"); 230 ref->sky->d = RAD_DEG*psMetadataLookupF64 (&status, row, "DEC"); 220 231 ref->Mag = psMetadataLookupF32 (&status, row, "MAG"); 232 float MagC1 = psMetadataLookupF32 (&status, row, "MAG_C1"); 233 float MagC2 = psMetadataLookupF32 (&status, row, "MAG_C2"); 234 if (!isnan(MagC1) && !isnan(MagC2)) { 235 ref->Color = MagC1 - MagC2; 236 } else { 237 // XXX save the color and the slope in the table header? 238 ref->Color = 0.0; 239 } 221 240 222 241 // XXX VERY temporary hack to avoid M31 bulge -
branches/pap/psastro/src/psastroMaskUpdates.c
r23844 r25027 28 28 pmCell *cell = NULL; 29 29 pmReadout *readout = NULL; 30 float zeropt, exptime ;30 float zeropt, exptime, GHOST_MAX_MAG; 31 31 32 32 psImageMaskType ghostMaskValue = pmConfigMaskGet("GHOST", config); // Mask value for ghost pixels 33 psImageMaskType glintMaskValue = pmConfigMaskGet("GHOST", config); // Mask value for glint pixels (overload ghost) 33 34 psImageMaskType spikeMaskValue = pmConfigMaskGet("SPIKE", config); // Mask value for ghost pixels 34 35 psImageMaskType starMaskValue = pmConfigMaskGet("STARCORE", config); // Mask value for ghost pixels … … 53 54 } 54 55 bool COUNT_GHOSTS = psMetadataLookupF32 (&status, recipe, "REFSTAR_COUNT_GHOSTS"); 55 double GHOST_MAX_MAG = psMetadataLookupF32 (&status, recipe, "GHOST_MAX_MAG");56 56 int nGhosts = 0; 57 58 // convert star positions to glint positions and add to the fpa->analysis data 59 if (!psastroLoadGlints (config)) { 60 psError(PSASTRO_ERR_CONFIG, false, "Error loading glints"); 61 return false; 62 } 57 63 58 64 psLogMsg ("psastro", PS_LOG_INFO, "generating a bright-star mask"); … … 79 85 80 86 // really error-out here? or just skip? 81 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, fpa, recipe)) {87 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &GHOST_MAX_MAG, fpa, recipe)) { 82 88 psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe"); 83 89 return false; … … 221 227 } 222 228 229 // This masking option was needed for persistent charge trails in GPC1; it 230 // has since been replaced with 'burntool', which is applied upon readout 231 // by the camera software, and therefore is aware of the image sequence. 223 232 if (REFSTAR_MASK_BLEED) { 224 225 233 // convert x,y chip coordinates to cells in maskChip 226 234 pmCell *refCell = pmCellInChip (refChip, ref->chip->x, ref->chip->y); … … 245 253 } 246 254 247 // select the raw objects for this readout (loaded in psastroExtract.c) 255 // select the ghost object for this readout (loaded in psastroExtractGhosts.c). 256 // These differ from the reference stars since the star position is not 257 // contained by the readout; instead, the ghost position is predicted based on 258 // the ghost model, and the ghost positions associated with a given readout are 259 // supplied here. 248 260 psArray *ghosts = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.GHOSTS"); 249 if (ghosts == NULL) { continue; } 250 251 // identify the bright stars of interest 252 for (int i = 0; i < ghosts->n; i++) { 253 psastroGhost *ghost = ghosts->data[i]; 254 // XXX bright vs faint ghost bits? (OR with SUSPECT) 255 psastroMaskEllipticalAnnulus (readoutMask->mask, ghostMaskValue, ghost->chip->x, ghost->chip->y, ghost->inner, ghost->outer); 256 } 257 258 // select the raw objects for this readout, flag is they fall in a mask 259 psArray *rawstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.RAWSTARS"); 260 if (rawstars == NULL) return false; 261 if (ghosts) { 262 // mask the ghosts on this readout 263 for (int i = 0; i < ghosts->n; i++) { 264 psastroGhost *ghost = ghosts->data[i]; 265 // XXX bright vs faint ghost bits? (OR with SUSPECT) 266 psastroMaskEllipticalAnnulus (readoutMask->mask, ghostMaskValue, ghost->chip->x, ghost->chip->y, ghost->inner, ghost->outer); 267 } 268 } 269 270 // Select the glint mask regions for this readout (loaded in 271 // psastroExtractGlints.c). These glint regions are defined as rectangular 272 // boxes and are generated for each chip based on the position of the bright 273 // stars beyond the edge of the focal plane. This masking is currently very 274 // GPC1-specific 275 psArray *glints = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.GLINTS"); 276 if (glints) { 277 // mask the glints on this readout 278 for (int i = 0; i < glints->n; i++) { 279 psRegion *glint = glints->data[i]; 280 psastroMaskRectangle (readoutMask->mask, glintMaskValue, glint->x0, glint->y0, glint->x1, glint->y1); 281 } 282 } 283 284 // this probably should move into a function of its own: 285 { 286 // select the raw objects for this readout, flag is they fall in a mask 287 psArray *inSources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES"); 288 if (inSources == NULL) continue; 261 289 262 // XXX finish this: 263 for (int i = 0; i < rawstars->n; i++) { 264 pmAstromObj *raw = rawstars->data[i]; 265 psImageMaskType value = readoutMask->mask->data.PS_TYPE_IMAGE_MASK_DATA[(int)(raw->chip->x)][(int)(raw->chip->y)]; 266 if (value) continue; 290 // create a replacement output array: 291 // psArray *outSources = psAllocArrayEmpty(100); 292 293 // XXX finish this: raise a bit for stars that land on certain types of masks; 294 // others (eg, bright star core) should be ignored. 295 for (int i = 0; i < inSources->n; i++) { 296 pmSource *source = inSources->data[i]; 297 298 int xChip = source->peak->x; 299 int yChip = source->peak->y; 300 301 bool onChip = true; 302 onChip &= (xChip >= 0); 303 onChip &= (xChip < readoutMask->mask->numCols); 304 onChip &= (yChip >= 0); 305 onChip &= (yChip < readoutMask->mask->numRows); 306 if (!onChip) { 307 // if the source is off the edge of the chip, raise a different bit? 308 source->mode |= PM_SOURCE_MODE_OFF_CHIP; 309 continue; 310 } 311 312 psImageMaskType value = readoutMask->mask->data.PS_TYPE_IMAGE_MASK_DATA[yChip][xChip]; 313 if (value & ghostMaskValue) { 314 source->mode |= PM_SOURCE_MODE_ON_GHOST; 315 } 316 // XXX note that for now, glint and ghost are identical 317 pmSourceMode PM_SOURCE_MODE_ON_GLINT = PM_SOURCE_MODE_ON_GHOST; 318 if (value & glintMaskValue) { 319 source->mode |= PM_SOURCE_MODE_ON_GLINT; 320 } 321 if (value & spikeMaskValue) { 322 source->mode |= PM_SOURCE_MODE_ON_SPIKE; 323 } 324 } 267 325 } 268 326 } -
branches/pap/psastro/src/psastroMaskUtils.c
r23810 r25027 181 181 bool psastroMaskEllipticalAnnulus (psImage *mask, psImageMaskType value, float x0, float y0, psEllipseAxes eInner, psEllipseAxes eOuter) { 182 182 183 // skip the masking if the outer ellipse is nonsensical 184 psEllipseShape sOuter = psEllipseAxesToShape (eOuter); 185 if (isnan(sOuter.sx) || isnan(sOuter.sy) || isnan(sOuter.sxy)) return false; 186 183 187 psEllipseShape sInner = psEllipseAxesToShape (eInner); 184 psEllipseShape sOuter = psEllipseAxesToShape (eOuter); 188 if (isnan(sInner.sx) || isnan(sInner.sy) || isnan(sInner.sxy)) { 189 // use a solid ellipse if the inner ellipse is nonsensical 190 sInner.sx = 0.1; 191 sInner.sy = 0.1; 192 sInner.sxy = 0.0; 193 } 185 194 186 195 // phi is the coordinate along the elliptical path -
branches/pap/psastro/src/psastroModelAnalysis.c
r21409 r25027 153 153 154 154 psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV); 155 psVectorStats (stats, posZero, NULL, NULL, 0); 155 if (!psVectorStats (stats, posZero, NULL, NULL, 0)) { 156 psError(PS_ERR_UNKNOWN, false, "failure to measure stats"); 157 return false; 158 } 156 159 157 160 fprintf (outfile, "# pos zero %f +/- %f\n", stats->sampleMedian, stats->sampleStdev); -
branches/pap/psastro/src/psastroModelFitBoresite.c
r21409 r25027 62 62 63 63 // center (Xo) = mean(Xo), RX = range / 2 64 psVectorStats (stats, Xo, NULL, NULL, 0); 64 if (!psVectorStats (stats, Xo, NULL, NULL, 0)) { 65 psError(PS_ERR_UNKNOWN, false, "failure to measure stats"); 66 return NULL; 67 } 65 68 params->data.F32[PAR_X0] = stats->sampleMean; 66 69 params->data.F32[PAR_RX] = (stats->max - stats->min) / 2.0; 67 70 68 71 // center (Yo) = mean(Yo), RY = range / 2 69 psVectorStats (stats, Yo, NULL, NULL, 0); 72 if (!psVectorStats (stats, Yo, NULL, NULL, 0)) { 73 psError(PS_ERR_UNKNOWN, false, "failure to measure stats"); 74 return NULL; 75 } 70 76 params->data.F32[PAR_Y0] = stats->sampleMean; 71 77 params->data.F32[PAR_RY] = (stats->max - stats->min) / 2.0; -
branches/pap/psastro/src/psastroMosaicOneChip.c
r21422 r25027 58 58 59 59 // modify the order to correspond to the actual number of matched stars: 60 if ((match->n < 17) && (order >= 3)) order = 2; 61 if ((match->n < 13) && (order >= 2)) order = 1; 62 if ((match->n < 9) && (order >= 1)) order = 0; 63 if ((match->n < 3) || (order < 0) || (order > 3)) { 60 int Ndof_min = 3; 61 int order_max = 0.5*(sqrt(4*match->n - 4*Ndof_min + 1) - 3); 62 order = PS_MIN (order, order_max); 63 64 // if ((match->n < 17) && (order >= 3)) order = 2; 65 // if ((match->n < 13) && (order >= 2)) order = 1; 66 // if ((match->n < 9) && (order >= 1)) order = 0; 67 68 if (order < 0) { 64 69 psLogMsg ("psastro", 3, "insufficient stars (%ld) or invalid order (%d)", match->n, order); 65 70 return false; -
branches/pap/psastro/src/psastroOneChipFit.c
r21422 r25027 64 64 // modify the order to correspond to the actual number of matched stars: 65 65 int Ndof_min = 3; 66 int order_max = 0.5*( 3 + sqrt(4*match->n - 4*Ndof_min + 1));66 int order_max = 0.5*(sqrt(4*match->n - 4*Ndof_min + 1) - 3); 67 67 order = PS_MIN (order, order_max); 68 69 // order 0 : Ro -> nterms = 1 * 2; 70 // order 1 : Ro, Rx, Ry -> nterms = 3 * 2; 71 // order 2 : Ro, Rx, Ry, Rxx, Rxy, Ryy -> nterms = 6 * 2; 72 // order 3 : Ro, Rx, Ry, Rxx, Rxy, Ryy, Rxxx, Rxxy, Rxyy, Ryyy -> nterms = 10 * 2 73 // 2*(N+1)*(N+2)/2 = (N+1)*(N+2) = nterms; 74 // (order+1)(order+2) + ndof = nvalues 75 // order^2 + 3*order + 2 + ndof = nvalue; 76 // order^2 + 3*order + 2 + ndof - nvalue = 0; 77 // 2*order = -3 +/- sqrt (9 - 4*(2 - nvalue + ndof)); 78 // 2*order = -3 +/- sqrt (9 - 8 + 4*nvalue - 4*ndof); 79 // 2*order = (sqrt (1 + 4*nvalue - 4*ndof) - 3); 68 80 69 81 // if ((match->n < 11) && (order >= 3)) order = 2; -
branches/pap/psastro/src/psastroZeroPoint.c
r21409 r25027 50 50 51 51 // really error-out here? or just skip? 52 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, fpa, recipe)) {52 if (!psastroZeroPointFromRecipe (&zeropt, &exptime, NULL, fpa, recipe)) { 53 53 psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe"); 54 54 return false; … … 126 126 // this analysis has too few data points to use the robust median method 127 127 psStats *stats = psStatsAlloc (PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV); 128 psVectorStats (stats, dMag, NULL, NULL, 0); 128 if (!psVectorStats (stats, dMag, NULL, NULL, 0)) { 129 psError(PS_ERR_UNKNOWN, false, "failure to measure stats"); 130 return false; 131 } 129 132 fprintf (stderr, "zero point %f +/- %f using %d stars; transparency %f\n", stats->clippedMean, stats->clippedStdev, Npts, zeropt - stats->clippedMean); 130 133 … … 145 148 return false; } 146 149 147 bool psastroZeroPointFromRecipe (float *zeropt, float *exptime, pmFPA *fpa, psMetadata *recipe) {150 bool psastroZeroPointFromRecipe (float *zeropt, float *exptime, float *ghostMaxMag, pmFPA *fpa, psMetadata *recipe) { 148 151 149 152 bool status; … … 170 173 char *refFilter = psMetadataLookupStr (&status, refItem->data.md, "FILTER"); 171 174 if (!status) { 172 psLogMsg ("psastro", PS_LOG_INFO, "a PHOTCODE.DATA recipe folder is missing FILTER");175 // psLogMsg ("psastro", PS_LOG_INFO, "a PHOTCODE.DATA recipe folder is missing FILTER"); 173 176 continue; 174 177 } … … 181 184 *zeropt = psMetadataLookupF32 (&status, refItem->data.md, "ZEROPT"); 182 185 if (!status) { 183 psLogMsg ("psastro", PS_LOG_INFO, "a PHOTCODE.DATA recipe folder is missing FILTER");186 psLogMsg ("psastro", PS_LOG_INFO, "a PHOTCODE.DATA recipe folder is missing ZEROPT"); 184 187 continue; 188 } 189 if (ghostMaxMag) { 190 *ghostMaxMag = psMetadataLookupF32 (&status, refItem->data.md, "GHOST_MAX_MAG"); 191 if (!status) { 192 psLogMsg ("psastro", PS_LOG_INFO, "a PHOTCODE.DATA recipe folder is missing GHOST_MAX_MAG"); 193 continue; 194 } 185 195 } 186 196 psFree (iter);
Note:
See TracChangeset
for help on using the changeset viewer.
