Changeset 24557 for branches/eam_branches/20090522/Ohana
- Timestamp:
- Jun 25, 2009, 2:00:56 PM (17 years ago)
- Location:
- branches/eam_branches/20090522
- Files:
-
- 23 edited
- 4 copied
-
. (modified) (1 prop)
-
Ohana (modified) (1 prop)
-
Ohana/src/addstar/include/addstar.h (modified) (1 diff)
-
Ohana/src/addstar/src/MatchHeaders.c (modified) (1 diff)
-
Ohana/src/addstar/src/ReadStarsFITS.c (modified) (3 diffs)
-
Ohana/src/getstar/src/ReadImageFiles.c (modified) (1 diff)
-
Ohana/src/libautocode/Makefile.Targets (modified) (2 diffs)
-
Ohana/src/libautocode/def/autocode.c (modified) (2 diffs)
-
Ohana/src/libautocode/def/cmf-ps1-v2.d (copied) (copied from trunk/Ohana/src/libautocode/def/cmf-ps1-v2.d )
-
Ohana/src/libdvo/Makefile (modified) (2 diffs)
-
Ohana/src/libdvo/include/dvo.h (modified) (2 diffs)
-
Ohana/src/libdvo/src/cmf-ps1-v1-alt.c (copied) (copied from trunk/Ohana/src/libdvo/src/cmf-ps1-v1-alt.c )
-
Ohana/src/relastro (modified) (1 prop)
-
Ohana/src/relastro/Makefile (modified) (1 diff)
-
Ohana/src/relastro/include/relastro.h (modified) (7 diffs)
-
Ohana/src/relastro/src/ConfigInit.c (modified) (2 diffs)
-
Ohana/src/relastro/src/FitChip.c (modified) (9 diffs)
-
Ohana/src/relastro/src/GetAstromError.c (modified) (1 diff)
-
Ohana/src/relastro/src/ImageOps.c (modified) (17 diffs)
-
Ohana/src/relastro/src/UpdateObjects.c (modified) (4 diffs)
-
Ohana/src/relastro/src/args.c (modified) (1 diff)
-
Ohana/src/relastro/src/bcatalog.c (modified) (5 diffs)
-
Ohana/src/relastro/src/initialize.c (modified) (2 diffs)
-
Ohana/src/relastro/src/load_catalogs.c (modified) (1 diff)
-
Ohana/src/relastro/src/relastroVisual.c (copied) (copied from trunk/Ohana/src/relastro/src/relastroVisual.c )
-
Ohana/src/relastro/src/relastroVisual.h (copied) (copied from trunk/Ohana/src/relastro/src/relastroVisual.h )
-
Ohana/src/relastro/src/relastro_objects.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090522
- Property svn:mergeinfo changed
-
branches/eam_branches/20090522/Ohana
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/20090522/Ohana/src/addstar/include/addstar.h
r21508 r24557 263 263 Stars *Convert_PS1_DEV_1 PROTO((FTable *table, int *nstars)); 264 264 Stars *Convert_PS1_V1 PROTO((FTable *table, int *nstars)); 265 Stars *Convert_PS1_V1_Alt PROTO((FTable *table, int *nstars)); 266 Stars *Convert_PS1_V2 PROTO((FTable *table, int *nstars)); 265 267 266 268 int InitStar PROTO((Stars *star)); -
branches/eam_branches/20090522/Ohana/src/addstar/src/MatchHeaders.c
r21508 r24557 52 52 if (!strcmp (exttype, "PS1_DEV_1")) goto keep; 53 53 if (!strcmp (exttype, "PS1_V1")) goto keep; 54 if (!strcmp (exttype, "PS1_V2")) goto keep; 54 55 continue; 55 56 -
branches/eam_branches/20090522/Ohana/src/addstar/src/ReadStarsFITS.c
r21508 r24557 43 43 stars = Convert_PS1_V1 (&table, &Nstars); 44 44 } 45 if (!strcmp (type, "PS1_V2")) { 46 stars = Convert_PS1_V2 (&table, &Nstars); 47 } 45 48 if (stars == NULL) { 46 49 fprintf (stderr, "ERROR: invalid table type %s\n", type); … … 188 191 Stars *stars; 189 192 CMF_PS1_V1 *ps1data; 193 194 // CMF_PS1_V1 was modified 2009.05.26 (r24251) to use doubles for ra & dec. this was a 195 // mistake in two ways: a few format should have been defined (eg, CMF_PS1_V2), and the 196 // layout used did not have clean byte-boundaries for the corresponding structure. The 197 // former means we have two varieties of CMF_PS1_V1 out there; the latter means that the 198 // autocode tools do not work to read in the new version, even if we recognize it. Here we 199 // test for the existence of the broken version (table[0].headers[0].Naxis[0] == 136), and 200 // call a special conversion function if it is found. 201 202 if (table[0].header[0].Naxis[0] == 136) { 203 stars = Convert_PS1_V1_Alt (table, nstars); 204 return (stars); 205 } 190 206 191 207 ps1data = gfits_table_get_CMF_PS1_V1 (table, &Nstars, NULL); … … 244 260 return (stars); 245 261 } 262 263 Stars *Convert_PS1_V1_Alt (FTable *table, int *nstars) { 264 265 int i, Nstars; 266 double ZeroPt; 267 Stars *stars; 268 CMF_PS1_V2 *ps1data; 269 270 // CMF_PS1_V1 was modified 2009.05.26 (r24251) to use doubles for ra & dec. this was a 271 // mistake in two ways: a few format should have been defined (eg, CMF_PS1_V2), and the 272 // layout used did not have clean byte-boundaries for the corresponding structure. The 273 // former means we have two varieties of CMF_PS1_V1 out there; the latter means that the 274 // autocode tools do not work to read in the new version, even if we recognize it. Here we 275 // test for the existence of the broken version (table[0].headers[0].Naxis[0] == 136), and 276 // call a special conversion function if it is found. 277 278 ps1data = gfits_table_get_CMF_PS1_V1_Alt (table, &Nstars, NULL); 279 ZeroPt = GetZeroPoint(); 280 281 ALLOCATE (stars, Stars, Nstars); 282 for (i = 0; i < Nstars; i++) { 283 InitStar (&stars[i]); 284 stars[i].measure.Xccd = ps1data[i].X; 285 stars[i].measure.Yccd = ps1data[i].Y; 286 stars[i].measure.dXccd = ShortPixels(ps1data[i].dX); 287 stars[i].measure.dYccd = ShortPixels(ps1data[i].dY); 288 289 stars[i].measure.posangle = ShortDegree(ps1data[i].posangle); 290 stars[i].measure.pltscale = ps1data[i].pltscale; 291 292 if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) { 293 stars[i].measure.M = NAN; 294 } else { 295 stars[i].measure.M = ps1data[i].M + ZeroPt; 296 } 297 stars[i].measure.dM = ps1data[i].dM; 298 stars[i].measure.dMcal = ps1data[i].dMcal; 299 stars[i].measure.Map = ps1data[i].Map + ZeroPt; 300 301 stars[i].measure.Sky = ps1data[i].sky; 302 stars[i].measure.dSky = ps1data[i].dSky; 303 304 stars[i].measure.psfChisq = ps1data[i].psfChisq; 305 stars[i].measure.psfQual = ps1data[i].psfQual; 306 stars[i].measure.psfNdof = ps1data[i].psfNdof; 307 stars[i].measure.psfNpix = ps1data[i].psfNpix; 308 stars[i].measure.crNsigma = ps1data[i].crNsigma; 309 stars[i].measure.extNsigma = ps1data[i].extNsigma; 310 311 stars[i].measure.FWx = ShortPixels(ps1data[i].fx); 312 stars[i].measure.FWy = ShortPixels(ps1data[i].fy); 313 stars[i].measure.theta = ShortDegree(ps1data[i].df); 314 315 stars[i].measure.Mxx = ShortPixels(ps1data[i].Mxx); 316 stars[i].measure.Mxy = ShortPixels(ps1data[i].Mxy); 317 stars[i].measure.Myy = ShortPixels(ps1data[i].Myy); 318 319 stars[i].measure.photFlags = ps1data[i].flags; 320 321 // this is may optionally be replaced by the internal sequence (see FilterStars.c) 322 stars[i].measure.detID = ps1data[i].detID; 323 324 // the Average fields and the following Measure fields are set in FilterStars after 325 // the image metadata is in hand: dR, dD, Mcal, dt, airmass, az, t, imageID, extID, 326 // averef is set in find_matches, dbFlags is zero on ingest. 327 328 // the following fields are currently not being set anywhere: t_msec 329 } 330 *nstars = Nstars; 331 return (stars); 332 } 333 334 Stars *Convert_PS1_V2 (FTable *table, int *nstars) { 335 336 int i, Nstars; 337 double ZeroPt; 338 Stars *stars; 339 CMF_PS1_V2 *ps1data; 340 341 ps1data = gfits_table_get_CMF_PS1_V2 (table, &Nstars, NULL); 342 ZeroPt = GetZeroPoint(); 343 344 ALLOCATE (stars, Stars, Nstars); 345 for (i = 0; i < Nstars; i++) { 346 InitStar (&stars[i]); 347 stars[i].measure.Xccd = ps1data[i].X; 348 stars[i].measure.Yccd = ps1data[i].Y; 349 stars[i].measure.dXccd = ShortPixels(ps1data[i].dX); 350 stars[i].measure.dYccd = ShortPixels(ps1data[i].dY); 351 352 stars[i].measure.posangle = ShortDegree(ps1data[i].posangle); 353 stars[i].measure.pltscale = ps1data[i].pltscale; 354 355 if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) { 356 stars[i].measure.M = NAN; 357 } else { 358 stars[i].measure.M = ps1data[i].M + ZeroPt; 359 } 360 stars[i].measure.dM = ps1data[i].dM; 361 stars[i].measure.dMcal = ps1data[i].dMcal; 362 stars[i].measure.Map = ps1data[i].Map + ZeroPt; 363 364 stars[i].measure.Sky = ps1data[i].sky; 365 stars[i].measure.dSky = ps1data[i].dSky; 366 367 stars[i].measure.psfChisq = ps1data[i].psfChisq; 368 stars[i].measure.psfQual = ps1data[i].psfQual; 369 stars[i].measure.psfNdof = ps1data[i].psfNdof; 370 stars[i].measure.psfNpix = ps1data[i].psfNpix; 371 stars[i].measure.crNsigma = ps1data[i].crNsigma; 372 stars[i].measure.extNsigma = ps1data[i].extNsigma; 373 374 stars[i].measure.FWx = ShortPixels(ps1data[i].fx); 375 stars[i].measure.FWy = ShortPixels(ps1data[i].fy); 376 stars[i].measure.theta = ShortDegree(ps1data[i].df); 377 378 stars[i].measure.Mxx = ShortPixels(ps1data[i].Mxx); 379 stars[i].measure.Mxy = ShortPixels(ps1data[i].Mxy); 380 stars[i].measure.Myy = ShortPixels(ps1data[i].Myy); 381 382 stars[i].measure.photFlags = ps1data[i].flags; 383 384 // this is may optionally be replaced by the internal sequence (see FilterStars.c) 385 stars[i].measure.detID = ps1data[i].detID; 386 387 // the Average fields and the following Measure fields are set in FilterStars after 388 // the image metadata is in hand: dR, dD, Mcal, dt, airmass, az, t, imageID, extID, 389 // averef is set in find_matches, dbFlags is zero on ingest. 390 391 // the following fields are currently not being set anywhere: t_msec 392 } 393 *nstars = Nstars; 394 return (stars); 395 } -
branches/eam_branches/20090522/Ohana/src/getstar/src/ReadImageFiles.c
r21527 r24557 136 136 !strcmp (tmpword, "PS1_DEV_0") || 137 137 !strcmp (tmpword, "PS1_DEV_1") || 138 !strcmp (tmpword, "PS1_V1")) { 138 !strcmp (tmpword, "PS1_V1") || 139 !strcmp (tmpword, "PS1_V2")) { 139 140 140 141 exttype[Nimage] = strcreate (tmpword); -
branches/eam_branches/20090522/Ohana/src/libautocode/Makefile.Targets
r21508 r24557 48 48 $(ASRC)/cmf-ps1-dev-1.$(ARCH).o \ 49 49 $(ASRC)/cmf-ps1-v1.$(ARCH).o \ 50 $(ASRC)/cmf-ps1-v2.$(ARCH).o \ 50 51 $(ASRC)/cmf-smpdata.$(ARCH).o \ 51 52 $(ASRC)/getstar-ps1-dev-0.$(ARCH).o \ … … 107 108 $(AINC)/cmf-ps1-dev-1.h \ 108 109 $(AINC)/cmf-ps1-v1.h \ 110 $(AINC)/cmf-ps1-v2.h \ 109 111 $(AINC)/cmf-smpdata.h \ 110 112 $(AINC)/getstar-ps1-dev-0.h \ -
branches/eam_branches/20090522/Ohana/src/libautocode/def/autocode.c
r15038 r24557 7 7 8 8 if (size != $SIZE) { 9 fprintf (stderr, "ERROR: mismatch in data types $STRUCT: %d vs %d\n", 10 size, $SIZE); 11 exit (1); 9 fprintf (stderr, "WARNING: mismatch in data types $STRUCT: %d vs %d\n", size, $SIZE); 10 return (FALSE); 12 11 } 13 12 … … 26 25 } 27 26 27 $STRUCT *gfits_downsize_and_convert_$STRUCT ($STRUCT *data, int size, int nitems) { 28 29 int i; 30 unsigned char *byte, tmp; 31 $STRUCT *output; 32 33 if ($SIZE > size) { 34 fprintf (stderr, "ERROR: uncorrectable mismatch in data types $STRUCT: %d vs %d\n", size, $SIZE); 35 exit (1); 36 } 37 38 // allocate a new array 39 ALLOCATE (output, $STRUCT, nitems); 40 for (i = 0; i < nitems; i++) { 41 memcpy (&output[i], &data[i], $SIZE); 42 } 43 44 /* provide initial values to avoid compiler warnings for non-BYTE_SWAP arch */ 45 i = tmp = 0; 46 byte = NULL; 47 48 # ifdef BYTE_SWAP 49 byte = (unsigned char *) output; 50 for (i = 0; i < nitems; i++, byte += size) { 51 /** BYTE SWAP **/ 52 } 53 # endif 54 55 return (output); 56 } 57 28 58 /*** add test of EXTNAME and header-defined columns? ***/ 29 59 /* return internal structure representation */ 30 60 $STRUCT *gfits_table_get_$STRUCT (FTable *ftable, int *Ndata, int *swapped) { 31 61 32 $STRUCT *data ;62 $STRUCT *data, *output; 33 63 34 64 *Ndata = ftable[0].header[0].Naxis[1]; 35 65 data = ($STRUCT *) ftable[0].buffer; 36 66 if ((swapped == NULL) || (*swapped == FALSE)) { 37 gfits_convert_$STRUCT (data, sizeof ($STRUCT), *Ndata); 67 if (!gfits_convert_$STRUCT (data, sizeof ($STRUCT), *Ndata)) { 68 output = gfits_downsize_and_convert_$STRUCT (data, sizeof ($STRUCT), *Ndata); 69 free (ftable[0].buffer); 70 ftable[0].buffer = output; 71 // XXX do I need to change NX? 72 } 38 73 gfits_table_scale_data (ftable); 39 74 if (swapped != NULL) *swapped = TRUE; -
branches/eam_branches/20090522/Ohana/src/libdvo/Makefile
r21508 r24557 69 69 $(SRC)/skyregion_io.$(ARCH).o \ 70 70 $(SRC)/skyregion_gsc.$(ARCH).o \ 71 $(SRC)/skyregion_ops.$(ARCH).o 71 $(SRC)/skyregion_ops.$(ARCH).o \ 72 $(SRC)/cmf-ps1-v1-alt.$(ARCH).o 72 73 73 74 # $(SRC)/dvo_convert_panstarrs.$(ARCH).o \ … … 118 119 cleandef: 119 120 cd $(AUTO) && make clean 121 122 .PRECIOUS: $(ASRC)/%.c -
branches/eam_branches/20090522/Ohana/src/libdvo/include/dvo.h
r21508 r24557 108 108 # define ID_MEAS_POOR_ASTROM 0x0010 /* detection is astrometry outlier */ 109 109 # define ID_MEAS_SKIP_ASTROM 0x0020 /* detection was ignored for astrometry measurement */ 110 # define ID_MEAS_U NDEF_1 0x0040 /* unused*/111 # define ID_MEAS_U NDEF_2 0x0080 /* unused*/110 # define ID_MEAS_USED_OBJ 0x0040 /* detection was used during opdate objects */ 111 # define ID_MEAS_USED_CHIP 0x0080 /* detection was used during update chips */ 112 112 # define ID_MEAS_BLEND_MEAS 0x0100 /* detection is within radius of multiple objects */ 113 113 # define ID_MEAS_BLEND_OBJ 0x0200 /* multiple detections within radius of object */ … … 184 184 SkyRegion **regions; 185 185 } SkyList; 186 187 // special-case function: 188 CMF_PS1_V2 *gfits_table_get_CMF_PS1_V1_Alt (FTable *ftable, int *Ndata, int *swapped); 186 189 187 190 # if (0) -
branches/eam_branches/20090522/Ohana/src/relastro
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/pap/Ohana/src/relastro merged eligible /branches/cnb_branches/cnb_branch_20090301/Ohana/src/relastro 22723-24307 /branches/eam_branches/eam_branch_20090303/Ohana/src/relastro 23158-23228 /branches/eam_branches/eam_branch_20090322/Ohana/src/relastro 23482-23529 /branches/pap_magic/Ohana/src/relastro 24120-24173 /branches/pap_mops/Ohana/src/relastro 24221-24510
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/eam_branches/20090522/Ohana/src/relastro/Makefile
r17243 r24557 55 55 $(SRC)/relastro_objects.$(ARCH).o \ 56 56 $(SRC)/save_catalogs.$(ARCH).o \ 57 $(SRC)/write_coords.$(ARCH).o 57 $(SRC)/write_coords.$(ARCH).o \ 58 $(SRC)/relastroVisual.$(ARCH).o 58 59 59 60 $(RELASTRO): $(INC)/relastro.h $(KAPA_INCS) -
branches/eam_branches/20090522/Ohana/src/relastro/include/relastro.h
r21508 r24557 44 44 double Ro, dRo; 45 45 double Do, dDo; 46 46 47 47 double uR, duR; 48 48 double uD, duD; … … 63 63 char flags; 64 64 Coords coords; 65 } Mosaic; 65 } Mosaic; 66 66 67 67 typedef struct { … … 87 87 88 88 double SIGMA_LIM; 89 int SRC_MEAS_TOOFEW; //catalog objects wich fewer detections then this are ignored 89 90 double MIN_ERROR; 90 91 … … 119 120 int TimeSelect; 120 121 time_t TSTART, TSTOP; 122 123 int FlagOutlier; 124 int CLIP_THRESH; 121 125 122 126 FitMode FIT_MODE; … … 145 149 int corner_check PROTO((double *x1, double *y1, double *x2, double *y2)); 146 150 void dumpGrid PROTO((void)); 147 void dump_grid PROTO((void)); 151 void dump_grid PROTO((void)); 148 152 int edge_check PROTO((double *x1, double *y1, double *x2, double *y2)); 149 153 void findImages PROTO((Catalog *catalog, int Ncatalog)); … … 220 224 int setMrelOutput PROTO((Catalog *catalog, int Ncatalog, int mark)); 221 225 void set_ZP PROTO((double ZERO)); 222 int setrefcode PROTO((Image *image, int Nimage)); 226 int setrefcode PROTO((Image *image, int Nimage)); 223 227 void skip_measurements PROTO((Catalog *catalog, int pass)); 224 228 void sortA PROTO((double *X, int N)); … … 265 269 int UpdateMeasures (Catalog *catalog, int Ncatalog); 266 270 void fixImageRaw (Catalog *catalog, int Ncatalog, int im); 271 void FlagOutliers(Catalog *catalog); 272 int MeasFilterTest(Measure *measure); 267 273 268 274 int sun_ecliptic (double jd, double *lambda, double *beta, double *epsilon); -
branches/eam_branches/20090522/Ohana/src/relastro/src/ConfigInit.c
r17207 r24557 20 20 21 21 GetConfig (config, "RELASTRO_SIGMA_LIM", "%lf", 0, &SIGMA_LIM); 22 GetConfig (config, "RELASTRO_SRC_MEAS_TOOFEW", "%d", 0, &SRC_MEAS_TOOFEW); 22 23 23 24 // XXX these are used in relphot to identify poor stars / images -- define … … 55 56 fprintf (stderr, "directory %s does not exist, giving up\n", CATDIR); 56 57 exit (1); 57 } 58 } 58 59 59 60 /* update master photcode table if not defined */ -
branches/eam_branches/20090522/Ohana/src/relastro/src/FitChip.c
r17209 r24557 1 1 # include "relastro.h" 2 # include "relastroVisual.h" 2 3 3 4 // XXX make these user parameters … … 5 6 # define FIT_CHIP_NITER 3 6 7 # define FIT_CHIP_NSIGMA 3.0 8 7 9 8 10 // XXX we should test if the fit is sufficiently constrained across the chip, or if the … … 22 24 23 25 ALLOCATE (values, double, Nmatch); 24 25 26 for (Niter = 0; Niter < FIT_CHIP_NITER; Niter ++) { 26 27 … … 28 29 for (i = Nscatter = 0; i < Nmatch; i++) { 29 30 if (raw[i].mask) continue; 30 if ( raw[i].dMag > FIT_CHIP_MAX_ERROR) continue;31 if (isnan(raw[i].dMag) || raw[i].dMag > FIT_CHIP_MAX_ERROR) continue; 31 32 32 33 dL = raw[i].L - ref[i].L; 33 34 dM = raw[i].M - ref[i].M; 34 35 dR = hypot (dL, dM); 35 36 36 37 values[Nscatter] = dR; 37 38 Nscatter++; … … 41 42 dsort (values, Nscatter); 42 43 dRmax = FIT_CHIP_NSIGMA*values[(int)(0.40*Nscatter)]; 44 relastroVisualPlotScatter(values, dRmax, Nscatter); 45 relastroVisualPlotRawRef(raw, ref, dRmax, Nmatch); 43 46 44 47 // fit the requested order polynomial … … 50 53 // generate the fit matches 51 54 for (i = 0; i < Nmatch; i++) { 52 if (raw[i].mask) continue; 55 if (raw[i].mask) { 56 continue; 57 } 58 if (isnan(raw[i].dMag) || raw[i].dMag > FIT_CHIP_MAX_ERROR) { 59 continue; 60 } 53 61 54 62 // only keep objects within dRmax … … 57 65 dR = hypot (dL, dM); 58 66 if (dR > dRmax) continue; 59 67 60 68 fit_add (fit, raw[i].X, raw[i].Y, ref[i].L, ref[i].M, raw[i].dPos); 61 69 } … … 66 74 case 0: 67 75 case 1: 68 skip = (fit[0].Npts < 8);69 break;76 skip = (fit[0].Npts < 8); 77 break; 70 78 case 2: 71 skip = (fit[0].Npts < 11);72 break;79 skip = (fit[0].Npts < 11); 80 break; 73 81 case 3: 74 skip = (fit[0].Npts < 15);75 break;82 skip = (fit[0].Npts < 15); 83 break; 76 84 default: 77 fprintf (stderr, "invalid chip order %d\n", coords[0].Npolyterms);78 abort ();85 fprintf (stderr, "invalid chip order %d\n", coords[0].Npolyterms); 86 abort (); 79 87 } 80 88 if (skip) { … … 95 103 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, coords); 96 104 } 105 97 106 } 98 107 -
branches/eam_branches/20090522/Ohana/src/relastro/src/GetAstromError.c
r16810 r24557 30 30 31 31 dPtotal = sqrt(SQ(dPsys) + AS*SQ(dPobs) + MS*SQ(dM)); 32 33 //XXX dXccd, dYccd are now working correctly 34 //dPtotal = AS * dPobs; 35 32 36 dPtotal = MAX (dPtotal, MIN_ERROR); 33 37 -
branches/eam_branches/20090522/Ohana/src/relastro/src/ImageOps.c
r17243 r24557 1 1 # include "relastro.h" 2 #define TESTING 2 3 3 4 static unsigned int *start; … … 91 92 for (i = 0; VERBOSE && (i < Nimage); i++) { 92 93 name = GetPhotcodeNamebyCode (image[i].photcode); 93 fprintf (stderr, "image %d has %d measures (%s, %s)\n", i, Nlist[i], 94 ohana_sec_to_date(image[i].tzero), name);95 } 94 fprintf (stderr, "image %d has %d measures (%s, %s)\n", i, Nlist[i], 95 ohana_sec_to_date(image[i].tzero), name); 96 } 96 97 } 97 98 … … 101 102 int i; 102 103 Measure *measure; 103 104 104 105 measure = &catalog[cat].measure[meas]; 105 106 … … 110 111 if (measure[0].t < start[i]) continue; 111 112 if (measure[0].t > stop[i]) continue; 112 113 113 114 // index for (catalog, measure) -> image 114 115 bin[cat][meas] = i; … … 125 126 REALLOCATE (clist[i], int, NLIST[i]); 126 127 REALLOCATE (mlist[i], int, NLIST[i]); 127 } 128 } 128 129 return; 129 130 } … … 157 158 158 159 plot_defaults (&graphdata); 159 graphdata.ymin = PlotdMmin; 160 graphdata.ymin = PlotdMmin; 160 161 graphdata.ymax = PlotdMmax; 161 162 plot_list (&graphdata, xlist, Mlist, Nimage, "airmass vs Mcal", "airmass.png"); … … 163 164 plot_list (&graphdata, Mlist, dlist, Nimage, "Mcal vs dMcal", NULL); 164 165 165 # define NBIN 20 0166 # define NBIN 20 166 167 REALLOCATE (xlist, double, NBIN); 167 168 REALLOCATE (Mlist, double, NBIN); … … 191 192 int i, m, c, n; 192 193 double X, Y, L, M, P, Q, R, D, dR, dD; 193 194 194 195 Mosaic *mosaic; 195 196 Coords *moscoords, *imcoords; 196 197 197 198 moscoords = NULL; 198 199 mosaic = getMosaicForImage (im); … … 224 225 dR = 3600.0*(catalog[c].average[n].R - R); 225 226 dD = 3600.0*(catalog[c].average[n].D - D); 226 227 227 228 if (fabs(catalog[c].measure[m].dR - dR) > 10.0) { 228 229 // XXXXX running into this still for last megacam exposure: wrong mosaic? … … 249 250 catalog[c].measure[m].dR = 3600.0*(catalog[c].average[n].R - R); 250 251 } 251 } 252 } 252 253 return; 253 254 } … … 259 260 260 261 int i, m, c, n; 261 262 262 263 Mosaic *mosaic; 263 264 Coords *moscoords; 264 265 StarData *raw; 265 266 266 267 ALLOCATE (raw, StarData, Nlist[im]); 267 268 … … 271 272 mosaic = getMosaicForImage (im); 272 273 if (mosaic == NULL) { 273 fprintf (stderr, "mosaic not found for image %s\n", image[im].name);274 exit (1);274 fprintf (stderr, "mosaic not found for image %s\n", image[im].name); 275 exit (1); 275 276 } 276 277 moscoords = &mosaic[0].coords; … … 284 285 raw[i].X = catalog[c].measure[m].Xccd; 285 286 raw[i].Y = catalog[c].measure[m].Yccd; 286 287 287 288 raw[i].Mag = catalog[c].measure[m].M; 288 289 raw[i].dMag = catalog[c].measure[m].dM; … … 292 293 293 294 // an object with only one detection provides no information about the image calibration 295 //XXX this is already taken care of in bcatalog 294 296 raw[i].mask = FALSE; 295 if (catalog[c].average[n].Nmeasure < 2) { 296 raw[i].mask = TRUE; 297 } 297 int mask = FALSE; 298 if (catalog[c].average[n].Nmeasure <= SRC_MEAS_TOOFEW) { 299 mask = TRUE; 300 } 301 if (!finite(catalog[c].measure[m].dR) || !finite(catalog[c].measure[m].dD)) { 302 mask = TRUE; 303 } 304 305 raw[i].mask = mask; 306 298 307 299 308 switch (mode) { 300 309 case MODE_SIMPLE: 301 /* note that for a Simple image, L,M = P,Q */302 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords);303 raw[i].P = raw[i].L;304 raw[i].Q = raw[i].M;305 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords);306 break;310 /* note that for a Simple image, L,M = P,Q */ 311 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords); 312 raw[i].P = raw[i].L; 313 raw[i].Q = raw[i].M; 314 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords); 315 break; 307 316 case MODE_MOSAIC: 308 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords);309 XY_to_LM (&raw[i].P, &raw[i].Q, raw[i].L, raw[i].M, moscoords);310 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, moscoords);311 break;317 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords); 318 XY_to_LM (&raw[i].P, &raw[i].Q, raw[i].L, raw[i].M, moscoords); 319 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, moscoords); 320 break; 312 321 default: 313 322 fprintf (stderr, "error: invalid mode in getImageRaw"); 314 323 abort (); 315 324 } 316 } 325 } 317 326 318 327 *Nstars = Nlist[im]; … … 330 339 Coords *moscoords; 331 340 StarData *ref; 332 341 333 342 ALLOCATE (ref, StarData, Nlist[im]); 334 343 … … 352 361 ref[i].R = catalog[c].average[n].R; 353 362 ref[i].D = catalog[c].average[n].D; 354 363 355 364 ref[i].Mag = catalog[c].measure[m].M; 356 365 ref[i].dMag = catalog[c].measure[m].dM; … … 373 382 break; 374 383 default: 375 fprintf (stderr, "invalid case");376 abort();377 } 378 } 379 384 fprintf (stderr, "invalid case"); 385 abort(); 386 } 387 } 388 380 389 *Nstars = Nlist[im]; 381 390 return (ref); 382 391 } 392 393 /** lifted from relphot/StarOps.clean_measures */ 394 void FlagOutliers2D(Catalog *catalog); 395 396 void FlagOutliers (Catalog *catalog) { 397 // XXX FlagOutliers is just using FlagOutliers2D 398 FlagOutliers2D(catalog); 399 return; 400 401 int i, j, k, m, N, Ndel, Nave, Nmax, TOOFEW, Nsecfilt; 402 double Ns, theta, x, y; 403 double *R, *D, *dR, *dD; 404 StatType statsR, statsD; 405 406 Nsecfilt = GetPhotcodeNsecfilt(); 407 assert(catalog[0].Nsecfilt == Nsecfilt); 408 409 if (VERBOSE) fprintf (stderr, "marking poor measures\n"); 410 Nmax = 0; 411 for (i = 0; i < catalog[0].Naverage; i++) { 412 Nmax = MAX (Nmax, catalog[0].average[i].Nmeasure); 413 } 414 415 ALLOCATE (R, double, Nmax); 416 ALLOCATE (D, double, Nmax); 417 ALLOCATE (dR, double, Nmax); 418 ALLOCATE (dD, double, Nmax); 419 420 /* it makes no sense to mark 3-sigma outliers with <5 measurements */ 421 TOOFEW = MAX (5, SRC_MEAS_TOOFEW); 422 423 Ns = CLIP_THRESH; 424 Ndel = Nave = 0; 425 426 /* loop over each object in the catalog */ 427 for (j = 0; j < catalog[0].Naverage; j++) { 428 429 /* accumulate list of valid measurements */ 430 m = catalog[0].average[j].measureOffset; 431 N = 0; 432 for (k = 0; k < catalog[0].average[j].Nmeasure; k++, m++) { 433 434 // skip measurements based on user selected criteria 435 if (!MeasFilterTest(&catalog[0].measure[m])) continue; 436 R[N] = catalog[0].measure[m].dR; 437 D[N] = catalog[0].measure[m].dD; 438 dR[N] = GetAstromError( &catalog[0].measure[m], ERROR_MODE_RA); 439 dD[N] = GetAstromError( &catalog[0].measure[m], ERROR_MODE_DEC); 440 if (isnan(R[N]) || isnan(D[N])) continue; 441 N++; 442 } 443 if (N <= TOOFEW) continue; 444 445 /* 3-sigma clip based on stats of inner 50% */ 446 initstats ("MEAN"); 447 liststats (R, dR, N, &statsR); 448 liststats (D, dD, N, &statsD); 449 450 statsR.sigma = MAX (MIN_ERROR, statsR.sigma); 451 statsD.sigma = MAX (MIN_ERROR, statsD.sigma); 452 453 /* compare per-object distance to this standard deviation, and flag outliers*/ 454 m = catalog[0].average[j].measureOffset; 455 N = 0; 456 for (k = 0; k < catalog[0].average[j].Nmeasure; k++, m++) { 457 //reset flag on each invocation 458 catalog[0].measure[m].dbFlags &= ~ID_MEAS_POOR_ASTROM; 459 460 // skip measurements based on user selected criteria 461 if (!MeasFilterTest(&catalog[0].measure[m])) continue; 462 463 x = catalog[0].measure[m].dR - statsR.median; 464 y = catalog[0].measure[m].dD - statsD.median; 465 theta = atan2(y,x); 466 if ((x*x + y*y) > (SQR(statsR.sigma * Ns * cos(theta)) + 467 SQR(statsD.sigma * Ns * sin(theta)))) { 468 catalog[0].measure[m].dbFlags |= ID_MEAS_POOR_ASTROM; 469 Ndel++; 470 } 471 N++; 472 Nave ++; 473 } 474 475 //examine results 476 relastroVisualPlotOutliers(catalog, catalog[0].average[j].measureOffset, 477 catalog[0].average[j].Nmeasure, 478 statsR, statsD, Ns); 479 } 480 481 if (VERBOSE) fprintf (stderr, "%d measures marked poor, %d total\n", Ndel, Nave); 482 free (R); 483 free(dR); 484 free(D); 485 free(dD); 486 } 487 488 489 /** an alternative outlier rejection scheme */ 490 void FlagOutliers2D (Catalog *catalog) { 491 492 int i, j, k, m, N, Ndel, Nave, Nmax, TOOFEW, Nsecfilt; 493 double *index; 494 double Ns, theta, x, y; 495 double *R, *D, *dR, *dD, *d2; 496 StatType statsR, statsD; 497 498 Nsecfilt = GetPhotcodeNsecfilt(); 499 assert(catalog[0].Nsecfilt == Nsecfilt); 500 501 if (VERBOSE) fprintf (stderr, "marking poor measures\n"); 502 Nmax = 0; 503 for (i = 0; i < catalog[0].Naverage; i++) { 504 Nmax = MAX (Nmax, catalog[0].average[i].Nmeasure); 505 } 506 507 ALLOCATE (R, double, Nmax); 508 ALLOCATE (D, double, Nmax); 509 ALLOCATE (dR, double, Nmax); 510 ALLOCATE (dD, double, Nmax); 511 ALLOCATE (d2, double, Nmax); 512 ALLOCATE (index, double, Nmax); 513 514 /* it makes no sense to mark 3-sigma outliers with <5 measurements */ 515 TOOFEW = MAX (5, SRC_MEAS_TOOFEW); 516 517 Ns = CLIP_THRESH; 518 Ndel = Nave = 0; 519 520 /* loop over each object in the catalog */ 521 for (j = 0; j < catalog[0].Naverage; j++) { 522 523 /* accumulate list of valid measurements */ 524 m = catalog[0].average[j].measureOffset; 525 N = 0; 526 527 for (k = 0; k < catalog[0].average[j].Nmeasure; k++, m++) { 528 529 //reset flag on each invocation 530 catalog[0].measure[m].dbFlags &= ~ID_MEAS_POOR_ASTROM; 531 532 // skip measurements based on user selected criteria 533 if (!MeasFilterTest(&catalog[0].measure[m])) continue; 534 R[N] = catalog[0].measure[m].dR; 535 D[N] = catalog[0].measure[m].dD; 536 dR[N] = GetAstromError( &catalog[0].measure[m], ERROR_MODE_RA); 537 dD[N] = GetAstromError( &catalog[0].measure[m], ERROR_MODE_DEC); 538 if (isnan(R[N]) || isnan(D[N])) continue; 539 N++; 540 } 541 if (N <= TOOFEW) continue; 542 543 /* calculate mean of all points*/ 544 initstats ("MEAN"); 545 liststats (R, dR, N, &statsR); 546 liststats (D, dD, N, &statsD); 547 statsR.sigma = MAX (MIN_ERROR, statsR.sigma); 548 statsD.sigma = MAX (MIN_ERROR, statsD.sigma); 549 550 /* calculate deviations of all points*/ 551 m = catalog[0].average[j].measureOffset; 552 N = 0; 553 for (k = 0; k < catalog[0].average[j].Nmeasure; k++, m++) { 554 //skip bad measurements 555 if (!MeasFilterTest(&catalog[0].measure[m])) continue; 556 x = catalog[0].measure[m].dR - statsR.median; 557 y = catalog[0].measure[m].dD - statsD.median; 558 theta = atan2(y,x); 559 d2[N] = (x*x + y*y) / (SQR(statsR.sigma * Ns * cos(theta)) + 560 SQR(statsD.sigma * Ns * sin(theta))); 561 index[N] = m; 562 N++; 563 } 564 565 // sort d2 566 dsortpair(d2, index, N); 567 N = (N/2 > (N-1)) ? N/2 : N-1; 568 569 // recalculate image center, sigma based on closest 50% of points 570 for(k = 0; k < N; k++) { 571 int ind = (int) index[k]; 572 R[k] = catalog[0].measure[ind].dR; 573 D[k] = catalog[0].measure[ind].dD; 574 dR[k] = GetAstromError( &catalog[0].measure[ind], ERROR_MODE_RA); 575 dD[k] = GetAstromError( &catalog[0].measure[ind], ERROR_MODE_DEC); 576 } 577 liststats (R, dR, N, &statsR); 578 liststats (D, dD, N, &statsD); 579 statsR.sigma = MAX (MIN_ERROR, statsR.sigma); 580 statsD.sigma = MAX (MIN_ERROR, statsD.sigma); 581 582 // use these new statistics to flag outliers 583 m = catalog[0].average[j].measureOffset; 584 N = 0; 585 for (k = 0; k < catalog[0].average[j].Nmeasure; k++, m++) { 586 //skip bad measurements 587 if (!MeasFilterTest(&catalog[0].measure[m])) continue; 588 x = catalog[0].measure[m].dR - statsR.median; 589 y = catalog[0].measure[m].dD - statsD.median; 590 theta = atan2(y,x); 591 d2[N] = (x*x + y*y) / (SQR(statsR.sigma * Ns * cos(theta)) + 592 SQR(statsD.sigma * Ns * sin(theta))); 593 if ((d2[N]) > 1) { 594 catalog[0].measure[m].dbFlags |= ID_MEAS_POOR_ASTROM; 595 Ndel ++; 596 } 597 N++; 598 Nave++; 599 } //done rejecting outliers 600 601 //examine results 602 relastroVisualPlotOutliers(catalog, catalog[0].average[j].measureOffset, 603 catalog[0].average[j].Nmeasure, 604 statsR, statsD, Ns); 605 606 } //done looping over objects 607 608 if (VERBOSE) fprintf (stderr, "%d measures marked poor, %d total\n", Ndel, Nave); 609 free (R); 610 free(dR); 611 free(D); 612 free(dD); 613 free(d2); 614 free(index); 615 } 616 617 618 619 /** Determine whether a measurement should be included in the analysis, based on supplied filter criteria */ 620 int MeasFilterTest(Measure *measure) { 621 int found, k; 622 long mask; 623 PhotCode *code; 624 float mag; 625 626 if (!finite(measure[0].dR) || !finite(measure[0].dD)) return FALSE; 627 if (!finite(measure[0].M)) return FALSE; //XXX is this necessary for all relastro tasks? 628 629 /* select measurements by photcode, or equiv photcode, if specified */ 630 if (NphotcodesKeep > 0) { 631 found = FALSE; 632 for (k = 0; (k < NphotcodesKeep) && !found; k++) { 633 if (photcodesKeep[k][0].code == measure[0].photcode) found = TRUE; 634 if (photcodesKeep[k][0].code == GetPhotcodeEquivCodebyCode(measure[0].photcode)) found = TRUE; 635 } 636 if (!found) return FALSE; 637 } 638 639 if (NphotcodesSkip > 0) { 640 found = FALSE; 641 for (k = 0; (k < NphotcodesSkip) && !found; k++) { 642 if (photcodesSkip[k][0].code == measure[0].photcode) found = TRUE; 643 if (photcodesSkip[k][0].code == GetPhotcodeEquivCodebyCode(measure[0].photcode)) found = TRUE; 644 } 645 if (found) return FALSE; 646 } 647 648 /* select measurements by time */ 649 if (TimeSelect) { 650 if (measure[0].t < TSTART) return FALSE; 651 if (measure[0].t > TSTOP) return FALSE; 652 } 653 654 /* select measurements by quality */ 655 if (PhotFlagSelect) { 656 if (PhotFlagBad) { 657 mask = PhotFlagBad; 658 } else { 659 code = GetPhotcodebyCode (measure[0].photcode); 660 mask = code[0].astromBadMask; 661 } 662 if (mask & measure[0].photFlags) return FALSE; 663 } 664 665 /* select measurements by measurement error */ 666 if ((SIGMA_LIM > 0) && (measure[0].dM > SIGMA_LIM)) return FALSE; 667 668 /* select measurements by mag limit */ 669 if (ImagSelect) { 670 mag = PhotInst (measure); 671 if (mag < ImagMin || mag > ImagMax) return FALSE; 672 } 673 674 return TRUE; 675 } -
branches/eam_branches/20090522/Ohana/src/relastro/src/UpdateObjects.c
r23595 r24557 97 97 for (k = 0; k < catalog[i].average[j].Nmeasure; k++, m++) { 98 98 99 //exclude measurements which have non-finite astrometry 100 if (!finite(catalog[i].measure[m].dR) || !finite(catalog[i].measure[m].dD)) continue; 99 //does the measurement pass the supplied filtering constraints? 100 if (!MeasFilterTest(&catalog[i].measure[m])) { 101 catalog[i].measure[m].dbFlags &= ~ID_MEAS_USED_OBJ; 102 continue; 103 } 104 105 //outlier rejection 106 if (FlagOutlier && (catalog[i].measure[m].dbFlags & ID_MEAS_POOR_ASTROM)) { 107 catalog[i].measure[m].dbFlags &= ~ID_MEAS_USED_OBJ; 108 continue; 109 } 101 110 102 111 // exclude measurements by previous outlier detection … … 109 118 # endif 110 119 111 /* exclude measurements by quality */ 112 if (PhotFlagSelect) { 113 if (PhotFlagBad) { 114 mask = PhotFlagBad; 115 } else { 116 code = GetPhotcodebyCode (catalog[i].measure[m].photcode); 117 mask = code[0].astromBadMask; 118 } 119 if (mask & catalog[i].measure[m].photFlags) { 120 catalog[i].measure[m].dbFlags |= ID_MEAS_SKIP_ASTROM; 121 continue; 122 } 123 } 124 125 /* exclude measurements by mag limit */ 126 if (ImagSelect) { 127 mag = PhotInst (&catalog[i].measure[m]); 128 if (mag < ImagMin) { 129 catalog[i].measure[m].dbFlags |= ID_MEAS_SKIP_ASTROM; 130 continue; 131 } 132 if (mag > ImagMax) { 133 catalog[i].measure[m].dbFlags |= ID_MEAS_SKIP_ASTROM; 134 continue; 135 } 136 } 137 138 /* select or exclude measurements by photcode, or equiv photcode, if specified */ 139 if (NphotcodesKeep > 0) { 140 found = FALSE; 141 for (kp = 0; (kp < NphotcodesKeep) && !found; kp++) { 142 if (photcodesKeep[kp][0].code == catalog[i].measure[m].photcode) found = TRUE; 143 if (photcodesKeep[kp][0].code == GetPhotcodeEquivCodebyCode(catalog[i].measure[m].photcode)) found = TRUE; 144 } 145 if (!found) continue; 146 } 147 if (NphotcodesSkip > 0) { 148 found = FALSE; 149 for (kp = 0; (kp < NphotcodesSkip) && !found; kp++) { 150 if (photcodesSkip[kp][0].code == catalog[i].measure[m].photcode) found = TRUE; 151 if (photcodesSkip[kp][0].code == GetPhotcodeEquivCodebyCode(catalog[i].measure[m].photcode)) found = TRUE; 152 } 153 if (found) continue; 154 } 120 catalog[i].measure[m].dbFlags |= ID_MEAS_USED_OBJ; 155 121 156 122 R[N] = getMeanR (&catalog[i].measure[m], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); … … 179 145 180 146 // too few measurements for average position (require 2 values) 181 if (N < 2) {147 if (N < SRC_MEAS_TOOFEW) { 182 148 // XXX need to define PHOTOM and ASTROM object flags 183 // catalog[i].average[j].code|= ID_STAR_FEW;184 continue;149 catalog[i].average[j].flags |= ID_STAR_FEW; 150 if (N < 2) continue; 185 151 } 186 152 … … 276 242 } 277 243 244 //make sure that the fit succeeded 245 assert(finite(fit.Ro) && finite(fit.Do) && 246 finite(fit.dRo) && finite(fit.dDo) && 247 finite(fit.uR) && finite(fit.uD) && 248 finite(fit.duR) && finite(fit.duD) && 249 finite(fit.p) && finite(fit.dp)); 250 278 251 // the measure fields must be updated before the average fields 279 252 m = catalog[i].average[j].measureOffset; -
branches/eam_branches/20090522/Ohana/src/relastro/src/args.c
r17205 r24557 40 40 FIT_TARGET = TARGET_MOSAICS; 41 41 } 42 43 FlagOutlier = FALSE; 44 if ((N = get_argument (argc, argv, "-clip"))) { 45 remove_argument (N, &argc, argv); 46 CLIP_THRESH = atof (argv[N]); 47 remove_argument (N, &argc, argv); 48 FlagOutlier = TRUE; 49 } 50 42 51 if (FIT_TARGET == TARGET_NONE) usage(); 43 52 -
branches/eam_branches/20090522/Ohana/src/relastro/src/bcatalog.c
r21508 r24557 2 2 3 3 int bcatalog (Catalog *subcatalog, Catalog *catalog) { 4 4 5 5 int i, j, k, offset, found; 6 6 int NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm, Nsecfilt; … … 23 23 /* exclude stars not in range or with too few measurements */ 24 24 for (i = 0; i < catalog[0].Naverage; i++) { 25 if (catalog[0].average[i].Nmeasure < 2) continue; 26 25 if (catalog[0].average[i].Nmeasure <= SRC_MEAS_TOOFEW) { 26 continue; 27 } 28 27 29 /* start with all stars good */ 28 30 subcatalog[0].average[Naverage] = catalog[0].average[i]; … … 44 46 45 47 offset = catalog[0].average[i].measureOffset + j; 46 47 /* select measurements by photcode, or equiv photcode, if specified */ 48 if (NphotcodesKeep > 0) { 49 found = FALSE; 50 for (k = 0; (k < NphotcodesKeep) && !found; k++) { 51 if (photcodesKeep[k][0].code == catalog[0].measure[offset].photcode) found = TRUE; 52 if (photcodesKeep[k][0].code == GetPhotcodeEquivCodebyCode(catalog[0].measure[offset].photcode)) found = TRUE; 53 } 54 if (!found) continue; 55 } 56 if (NphotcodesSkip > 0) { 57 found = FALSE; 58 for (k = 0; (k < NphotcodesSkip) && !found; k++) { 59 if (photcodesSkip[k][0].code == catalog[0].measure[offset].photcode) found = TRUE; 60 if (photcodesSkip[k][0].code == GetPhotcodeEquivCodebyCode(catalog[0].measure[offset].photcode)) found = TRUE; 61 } 62 if (found) continue; 48 49 //filter objects based on user supplied criteria 50 if (!MeasFilterTest(&catalog[0].measure[offset])) { 51 catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP; 52 continue; 63 53 } 64 54 65 / * select measurements by time */66 if ( TimeSelect) {67 if (catalog[0].measure[offset].t < TSTART) continue;68 if (catalog[0].measure[offset].t > TSTOP)continue;55 //filter out outliers 56 if (FlagOutlier && (catalog[0].measure[offset].dbFlags & ID_MEAS_POOR_ASTROM)) { 57 catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP; 58 continue; 69 59 } 70 71 /* select measurements by quality */ 72 // XXX FIX THIS!! 73 // if (DophotSelect && (catalog[0].measure[offset].dophot != DophotValue)) continue; 74 75 /* select measurements by quality */ 76 if (PhotFlagSelect) { 77 if (PhotFlagBad) { 78 mask = PhotFlagBad; 79 } else { 80 code = GetPhotcodebyCode (catalog[0].measure[offset].photcode); 81 mask = code[0].astromBadMask; 82 } 83 if (mask & catalog[0].measure[offset].photFlags) continue; 84 } 85 86 /* select measurements by measurement error */ 87 if ((SIGMA_LIM > 0) && (catalog[0].measure[offset].dM > SIGMA_LIM)) continue; 88 89 /* select measurements by mag limit */ 90 if (ImagSelect) { 91 mag = PhotInst (&catalog[0].measure[offset]); 92 if (mag < ImagMin) continue; 93 if (mag > ImagMax) continue; 94 } 60 catalog[0].measure[offset].dbFlags |= ID_MEAS_USED_CHIP; 95 61 96 62 // re-assess on each run of relastro if a measurement should be used … … 110 76 subcatalog[0].measure[Nmeasure] = catalog[0].measure[offset]; 111 77 subcatalog[0].measure[Nmeasure].averef = Naverage; 112 if (RESET) { 113 subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_POOR_ASTROM;114 subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_AREA;78 if (RESET) { 79 subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_POOR_ASTROM; 80 subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_AREA; 115 81 } 82 116 83 Nmeasure ++; 117 84 Nm ++; 118 85 if (Nmeasure == NMEASURE) { 119 NMEASURE += 1000;120 REALLOCATE (subcatalog[0].measure, Measure, NMEASURE);86 NMEASURE += 1000; 87 REALLOCATE (subcatalog[0].measure, Measure, NMEASURE); 121 88 } 122 89 } … … 139 106 140 107 if (VERBOSE) { 141 fprintf (stderr, "%d: using %d stars (%d measures) for catalog\n", i, 142 subcatalog[0].Naverage, subcatalog[0].Nmeasure);108 fprintf (stderr, "%d: using %d stars (%d measures) for catalog\n", i, 109 subcatalog[0].Naverage, subcatalog[0].Nmeasure); 143 110 } 144 111 return (TRUE); -
branches/eam_branches/20090522/Ohana/src/relastro/src/initialize.c
r17213 r24557 25 25 fprintf (stderr, "codename: %s\n", codename); 26 26 if ((photcodesKeep[NphotcodesKeep] = GetPhotcodebyName (codename)) == NULL) { 27 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename);28 exit (1);27 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename); 28 exit (1); 29 29 } 30 30 NphotcodesKeep ++; … … 46 46 fprintf (stderr, "codename: %s\n", codename); 47 47 if ((photcodesSkip[NphotcodesSkip] = GetPhotcodebyName (codename)) == NULL) { 48 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename);49 exit (1);48 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename); 49 exit (1); 50 50 } 51 51 NphotcodesSkip ++; -
branches/eam_branches/20090522/Ohana/src/relastro/src/load_catalogs.c
r21508 r24557 29 29 } 30 30 if (VERBOSE && !pcatalog[0].Naves_disk) fprintf (stderr, "no data in %s, skipping\n", pcatalog[0].filename); 31 32 //outlier rejection 33 if (FlagOutlier) { 34 FlagOutliers(&tcatalog); 35 } 31 36 32 37 // select only the brighter stars -
branches/eam_branches/20090522/Ohana/src/relastro/src/relastro_objects.c
r21508 r24557 8 8 SkyList *skylist = NULL; 9 9 Catalog catalog; 10 10 11 11 12 // load the current sky table (layout of all SkyRegions) … … 37 38 } 38 39 40 if (FlagOutlier) { 41 FlagOutliers(&catalog); 42 } 43 39 44 // XXX consider what gets reset (only ASTROM flags) 40 45 if (RESET) {
Note:
See TracChangeset
for help on using the changeset viewer.
