Changeset 12276
- Timestamp:
- Mar 6, 2007, 8:55:39 AM (19 years ago)
- Location:
- branches/dvo-mods-2007-02/Ohana/src/relastro
- Files:
-
- 14 edited
-
Makefile (modified) (5 diffs)
-
include/relastro.h (modified) (4 diffs)
-
src/ImageOps.c (modified) (7 diffs)
-
src/MosaicOps.c (modified) (8 diffs)
-
src/Shutdown.c (modified) (1 diff)
-
src/args.c (modified) (8 diffs)
-
src/bcatalog.c (modified) (2 diffs)
-
src/initialize.c (modified) (2 diffs)
-
src/load_images.c (modified) (2 diffs)
-
src/plot_scatter.c (modified) (3 diffs)
-
src/relastro.c (modified) (2 diffs)
-
src/reload_catalogs.c (modified) (2 diffs)
-
src/select_images.c (modified) (2 diffs)
-
src/setExclusions.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/dvo-mods-2007-02/Ohana/src/relastro/Makefile
r12220 r12276 15 15 FULL_CFLAGS = $(BASE_CFLAGS) 16 16 FULL_CPPFLAGS = $(BASE_CPPFLAGS) 17 FULL_LDFLAGS = -l dvo -lFITS -lohana $(BASE_LDFLAGS)17 FULL_LDFLAGS = -lkapa -ldvo -lFITS -lohana $(BASE_LDFLAGS) 18 18 19 19 relastro: $(BIN)/relastro.$(ARCH) … … 32 32 $(SRC)/SetSignals.$(ARCH).o \ 33 33 $(SRC)/Shutdown.$(ARCH).o \ 34 $(SRC)/StarOps.$(ARCH).o \35 34 $(SRC)/UpdateChips.$(ARCH).o \ 36 35 $(SRC)/UpdateMosaic.$(ARCH).o \ … … 41 40 $(SRC)/dvo_astrom_ops.$(ARCH).o \ 42 41 $(SRC)/fitpoly.$(ARCH).o \ 43 $(SRC)/global_stats.$(ARCH).o \44 42 $(SRC)/initialize.$(ARCH).o \ 45 43 $(SRC)/liststats.$(ARCH).o \ … … 49 47 $(SRC)/plot_scatter.$(ARCH).o \ 50 48 $(SRC)/plotstuff.$(ARCH).o \ 49 $(SRC)/select_images.$(ARCH).o \ 50 $(SRC)/sort.$(ARCH).o \ 51 51 $(SRC)/relastro.$(ARCH).o \ 52 52 $(SRC)/reload_catalogs.$(ARCH).o \ … … 56 56 DROP = \ 57 57 $(SRC)/setMrelFinal.$(ARCH).o \ 58 $(SRC)/StarOps.$(ARCH).o 58 59 59 60 -
branches/dvo-mods-2007-02/Ohana/src/relastro/include/relastro.h
r12220 r12276 107 107 int RELPHOT_GRID_BINNING; 108 108 109 PhotCode *photcode; 109 char *PHOTCODE_LIST; 110 int Nphotcodes; 111 PhotCode **photcodes; 110 112 int PhotPrimary; 111 113 int PhotNsec; 112 int PhotSec;113 114 114 115 int AreaSelect; … … 129 130 130 131 SkyRegion UserPatch; 131 int UserPatchSelect;132 132 133 133 int DoUpdateObjects; … … 189 189 int liststats PROTO((double *value, double *dvalue, int N, StatType *stats)); 190 190 Catalog *load_catalogs PROTO((SkyList *skylist, int *Ncatalog)); 191 SkyList *load_images PROTO((FITS_DB *db, char *regionName, SkyRegion *region, int RegionSelect));191 SkyList *load_images PROTO((FITS_DB *db, SkyRegion *region)); 192 192 Image *select_images PROTO((SkyList *skylist, Image *timage, int Ntimage, int **LineNumber, int *Nimage)); 193 193 … … 272 272 int FitPMandPar (PMFit *fit, double *X, double *dX, double *Y, double *dY, time_t *T, double *pR, double *pD, int Npts); 273 273 274 Coords*getMosaicForImage (int N);274 Image *getMosaicForImage (int N); 275 275 276 276 StarData *getImageRef (Catalog *catalog, int Ncatalog, int im, int *Nstars, int isMosaic); -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/ImageOps.c
r12220 r12276 77 77 } 78 78 79 /* select all image equivalent to the current photcode*/79 /* match measurements to images */ 80 80 void findImages (Catalog *catalog, int Ncatalog) { 81 81 82 int i, j , ecode;82 int i, j; 83 83 84 84 for (i = 0; i < Ncatalog; i++) { 85 85 for (j = 0; j < catalog[i].Nmeasure; j++) { 86 ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].photcode);87 if (photcode[0].code != ecode) continue;88 86 matchImage (catalog, j, i); 89 87 } … … 181 179 int i, m, c; 182 180 183 Coords *mosaic; 181 Image *mosaic; 182 Coords *moscoords; 184 183 StarData *raw; 185 184 … … 187 186 188 187 mosaic = NULL; 188 moscoords = NULL; 189 189 if (isMosaic) { 190 190 mosaic = getMosaicForImage (im); 191 moscoords = &mosaic[0].coords; 191 192 } 192 193 … … 205 206 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords); 206 207 if (isMosaic) { 207 XY_to_LM (&raw[i].P, &raw[i].Q, raw[i].L, raw[i].M, mos aic);208 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, mos aic);208 XY_to_LM (&raw[i].P, &raw[i].Q, raw[i].L, raw[i].M, moscoords); 209 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, moscoords); 209 210 } else { 210 211 raw[i].P = raw[i].L; … … 222 223 int i, m, c, n; 223 224 224 Coords *mosaic; 225 Image *mosaic; 226 Coords *moscoords; 225 227 StarData *ref; 226 228 … … 228 230 229 231 mosaic = NULL; 232 moscoords = NULL; 230 233 if (isMosaic) { 231 234 mosaic = getMosaicForImage (im); 235 moscoords = &mosaic[0].coords; 232 236 } 233 237 … … 244 248 RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, &image[im].coords); 245 249 if (isMosaic) { 246 LM_to_XY (&ref[i].M, &ref[i].L, ref[i].P, ref[i].Q, mos aic);247 LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, mos aic);250 LM_to_XY (&ref[i].M, &ref[i].L, ref[i].P, ref[i].Q, moscoords); 251 LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, moscoords); 248 252 } else { 249 253 ref[i].L = ref[i].P; -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/MosaicOps.c
r12048 r12276 16 16 17 17 /* find mosaic frames (unique time periods & photcode name matches mosaic) */ 18 /* XXX what is a mosaic? do we need to use the 'DIS/WRP' info to track? */ 18 19 void initMosaics (Image *image, int Nimage) { 19 20 … … 86 87 } 87 88 } 88 89 initMosaicGrid (image, Nimage);90 89 return; 91 }92 93 void initMosaicGrid (Image *image, int Nimage) {94 95 /* find max dR, dD range for all mosaics */96 /* define mosaic.coords to cover dR, dD */97 /* send results to initGridBins */98 99 int i, j, m, NX, NY;100 int dXmax, dYmax;101 double dS, dX, dY;102 double R, D, Rmin, Rmax, Dmin, Dmax;103 double Mcal, dMcal, Xm;104 105 dXmax = dYmax = 0.0;106 for (i = 0; i < Nmosaic; i++) {107 Dmin = Rmin = 360.0;108 Dmax = Rmax = -360.0;109 dS = 0.0;110 Mcal = dMcal = Xm = 0;111 for (j = 0; j < Nimlist[i]; j++) {112 m = imlist[i][j];113 NX = image[m].NX;114 NY = image[m].NY;115 dS += hypot (image[m].coords.cdelt1*image[m].coords.pc1_1, image[m].coords.cdelt1*image[m].coords.pc2_1);116 XY_to_RD (&R, &D, 0.0, 0.0, &image[m].coords);117 Rmin = MIN (Rmin, R);118 Rmax = MAX (Rmax, R);119 Dmin = MIN (Dmin, D);120 Dmax = MAX (Dmax, D);121 XY_to_RD (&R, &D, (double) NX, 0.0, &image[m].coords);122 Rmin = MIN (Rmin, R);123 Rmax = MAX (Rmax, R);124 Dmin = MIN (Dmin, D);125 Dmax = MAX (Dmax, D);126 XY_to_RD (&R, &D, (double) NX, (double) NY, &image[m].coords);127 Rmin = MIN (Rmin, R);128 Rmax = MAX (Rmax, R);129 Dmin = MIN (Dmin, D);130 Dmax = MAX (Dmax, D);131 XY_to_RD (&R, &D, 0.0, (double) NY, &image[m].coords);132 Rmin = MIN (Rmin, R);133 Rmax = MAX (Rmax, R);134 Dmin = MIN (Dmin, D);135 Dmax = MAX (Dmax, D);136 Mcal += image[m].Mcal;137 dMcal += image[m].dMcal;138 Xm += image[m].Xm;139 /* we are using mosaic.Mcal, not image.Mcal. reset image.Mcal */140 image[m].Mcal = 0.0;141 image[m].dMcal = image[m].Xm = NO_MAG;142 }143 dS /= Nimlist[i];144 strcpy (mosaic[i].coords.ctype, "RA---TAN");145 mosaic[i].coords.crval1 = Rmin;146 mosaic[i].coords.crval2 = Dmin;147 mosaic[i].coords.crpix1 = 0.0;148 mosaic[i].coords.crpix2 = 0.0;149 mosaic[i].coords.cdelt1 = dS;150 mosaic[i].coords.cdelt2 = dS;151 mosaic[i].coords.pc1_1 = 1.0;152 mosaic[i].coords.pc2_2 = 1.0;153 mosaic[i].coords.pc1_2 = 0.0;154 mosaic[i].coords.pc2_1 = 0.0;155 RD_to_XY (&dX, &dY, Rmax, Dmax, &mosaic[i].coords);156 157 mosaic[i].Mcal = Mcal / Nimlist[i];158 mosaic[i].dMcal = dMcal / Nimlist[i];159 mosaic[i].Xm = Xm / Nimlist[i];160 }161 if (!USE_GRID) return;162 163 dXmax = MAX (dXmax, dX);164 dYmax = MAX (dYmax, dY);165 initGrid (dXmax, dYmax);166 return;167 }168 169 void setMcalFinal () {170 171 int i, j, im, Nimage;172 Image *image;173 174 if (!MOSAICNAME[0]) return;175 176 image = getimages (&Nimage);177 178 for (i = 0; i < Nmosaic; i++) {179 for (j = 0; j < Nimlist[i]; j++) {180 im = imlist[i][j];181 image[im].Mcal = mosaic[i].Mcal;182 image[im].dMcal = mosaic[i].dMcal;183 image[im].Xm = mosaic[i].Xm;184 image[im].code |= (mosaic[i].code & ID_IMAGE_FEW);185 image[im].code |= (mosaic[i].code & ID_IMAGE_POOR);186 }187 }188 90 } 189 91 … … 238 140 int findMosaics (Catalog *catalog, int Ncatalog) { 239 141 240 int i, j , ecode;142 int i, j; 241 143 242 144 if (!MOSAICNAME[0]) return (FALSE); … … 247 149 if (catalog[i].measure[j].t > TSTOP) continue; 248 150 } 249 ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[j].photcode);250 if (photcode[0].code != ecode) continue;251 151 matchMosaics (catalog, j, i); 252 152 } … … 255 155 } 256 156 157 /* modify this function to use the measure->imageID field ? */ 257 158 void matchMosaics (Catalog *catalog, int meas, int cat) { 258 159 … … 263 164 if (catalog[cat].measure[meas].t > mosaic[i].stop) continue; 264 165 265 # ifdef GRID_V1266 if (USE_GRID) {267 ave = catalog[cat].measure[meas].averef;268 ra = catalog[cat].average[ave].R - catalog[cat].measure[meas].dR / 3600.0;269 dec = catalog[cat].average[ave].D - catalog[cat].measure[meas].dD / 3600.0;270 271 /* X,Y always positive-definite in range 0,0 - dX, dY */272 RD_to_XY (&X, &Y, ra, dec, &mosaic[i].coords);273 setGridMeasure (meas, cat, X, Y);274 }275 # endif276 277 166 bin[cat][meas] = i; 278 167 … … 288 177 return; 289 178 } 290 fprintf (stderr, "missed measurement\n");291 179 return; 292 }293 294 float getMmos (int meas, int cat) {295 296 int i;297 float value;298 299 if (!MOSAICNAME[0]) return (0);300 i = bin[cat][meas];301 if (i == -1) return (NO_MAG);302 303 if (mosaic[i].code & IMAGE_BAD) return (NO_MAG);304 value = mosaic[i].Mcal;305 return (value);306 }307 308 int setMmos (Catalog *catalog, int PoorImages) {309 310 int i, j, m, c, n, N, Nmax, mark, bad;311 float Msys, Mrel, Mcal, Mgrid;312 double *list, *dlist, *Mlist, *dMlist;313 StatType stats;314 Image *image;315 316 if (!MOSAICNAME[0]) return (FALSE);317 318 image = getimages (&N);319 320 if (PoorImages) {321 IMAGE_BAD = 0;322 }323 324 Nmax = 0;325 for (i = 0; i < Nmosaic; i++) {326 Nmax = MAX (Nmax, Nlist[i]);327 }328 ALLOCATE (list, double, Nmax);329 ALLOCATE (dlist, double, Nmax);330 ALLOCATE (Mlist, double, Nmax);331 ALLOCATE (dMlist, double, Nmax);332 333 for (i = 0; i < Nmosaic; i++) {334 335 /* on PoorImages run, skip good images */336 if (PoorImages) {337 bad = mosaic[i].code & (ID_IMAGE_FEW | ID_IMAGE_POOR | ID_IMAGE_SKIP);338 if (!bad) continue;339 }340 341 N = 0;342 for (j = 0; j < Nlist[i]; j++) {343 344 m = mlist[i][j];345 c = clist[i][j];346 347 if (catalog[c].measure[m].flags & MEAS_BAD) continue;348 if ((Mcal = getMcal (m, c)) == NO_MAG) continue;349 if ((Mgrid = getMgrid (m, c)) == NO_MAG) continue;350 if ((Mrel = getMrel (catalog, m, c)) == NO_MAG) continue;351 352 n = catalog[c].measure[m].averef;353 Msys = PhotSys (&catalog[c].measure[m], &catalog[c].average[n], &catalog[c].secfilt[n*PhotNsec]);354 list[N] = Msys - Mrel - Mcal - Mgrid;355 dlist[N] = MAX (catalog[c].measure[m].dM, MIN_ERROR);356 Mlist[N] = Msys;357 dMlist[N] = list[N];358 N++;359 }360 /* Nlist[i] is all measurements, N is good measurements */361 362 /* too few good measurements or too many bad measurements (skip in PoorImages run) */363 364 if (!PoorImages) {365 mark = (N < IMAGE_TOOFEW) || (N < IMAGE_GOOD_FRACTION*Nlist[i]);366 if (mark) {367 fprintf (stderr, "marked image %s (%d), (%d < %d) || (%d < %f*%d)\n", image[imlist[i][0]].name, i, N, IMAGE_TOOFEW, N, IMAGE_GOOD_FRACTION, Nlist[i]);368 mosaic[i].code |= ID_IMAGE_FEW;369 } else {370 mosaic[i].code &= ~ID_IMAGE_FEW;371 }372 }373 liststats (list, dlist, N, &stats);374 if (PoorImages) fprintf (stderr, "Mmos: %f %f %d %d\n", stats.mean, stats.sigma, stats.Nmeas, N);375 mosaic[i].Mcal = stats.mean;376 mosaic[i].dMcal = stats.sigma;377 mosaic[i].Xm = 100.0*log10(stats.chisq);378 }379 free (list);380 free (dlist);381 free (Mlist);382 free (dMlist);383 384 if (PoorImages) {385 IMAGE_BAD = ID_IMAGE_POOR | ID_IMAGE_FEW | ID_IMAGE_SKIP;386 STAR_BAD = ID_STAR_POOR | ID_STAR_FEW;387 MEAS_BAD = ID_MEAS_NOCAL | ID_MEAS_POOR | ID_MEAS_SKIP | ID_MEAS_AREA;388 }389 return (TRUE);390 }391 392 StatType statsMosaicM (Catalog *catalog) {393 394 int i, n;395 double *list, *dlist;396 StatType stats;397 398 bzero (&stats, sizeof (StatType));399 if (!MOSAICNAME[0]) return (stats);400 401 ALLOCATE (list, double, Nmosaic);402 ALLOCATE (dlist, double, Nmosaic);403 404 n = 0;405 for (i = 0; i < Nmosaic; i++) {406 if (mosaic[i].code & IMAGE_BAD) continue;407 list[n] = mosaic[i].Mcal;408 dlist[n] = 1;409 n++;410 }411 412 liststats (list, dlist, n, &stats);413 free (list);414 free (dlist);415 return (stats);416 }417 418 StatType statsMosaicdM (Catalog *catalog) {419 420 int i, n;421 double *list, *dlist;422 StatType stats;423 424 bzero (&stats, sizeof (StatType));425 if (!MOSAICNAME[0]) return (stats);426 427 ALLOCATE (list, double, Nmosaic);428 ALLOCATE (dlist, double, Nmosaic);429 430 n = 0;431 for (i = 0; i < Nmosaic; i++) {432 433 if (mosaic[i].code & IMAGE_BAD) continue;434 list[n] = mosaic[i].dMcal;435 dlist[n] = 1;436 n++;437 }438 439 liststats (list, dlist, n, &stats);440 free (list);441 free (dlist);442 return (stats);443 }444 445 StatType statsMosaicN (Catalog *catalog) {446 447 int i, j, m, c, n, N;448 double *list, *dlist;449 StatType stats;450 451 bzero (&stats, sizeof (StatType));452 if (!MOSAICNAME[0]) return (stats);453 454 ALLOCATE (list, double, Nmosaic);455 ALLOCATE (dlist, double, Nmosaic);456 457 n = 0;458 for (i = 0; i < Nmosaic; i++) {459 if (mosaic[i].code & IMAGE_BAD) continue;460 461 N = 0;462 for (j = 0; j < Nlist[i]; j++) {463 464 m = mlist[i][j];465 c = clist[i][j];466 467 if (getMcal (m, c) == NO_MAG) continue;468 if (getMgrid (m, c) == NO_MAG) continue;469 if (getMrel (catalog, m, c) == NO_MAG) continue;470 N++;471 }472 list[n] = N;473 dlist[n] = 1;474 n++;475 }476 fprintf (stderr, "Nmosaic: %d, n: %d\n", Nmosaic, n);477 478 liststats (list, dlist, n, &stats);479 free (list);480 free (dlist);481 return (stats);482 }483 484 StatType statsMosaicX (Catalog *catalog) {485 486 int i, n;487 double *list, *dlist;488 StatType stats;489 490 bzero (&stats, sizeof (StatType));491 if (!MOSAICNAME[0]) return (stats);492 493 ALLOCATE (list, double, Nmosaic);494 ALLOCATE (dlist, double, Nmosaic);495 496 n = 0;497 for (i = 0; i < Nmosaic; i++) {498 499 if (mosaic[i].code & IMAGE_BAD) continue;500 list[n] = pow(10.0, 0.01*mosaic[i].Xm);501 dlist[n] = 1;502 n++;503 }504 505 liststats (list, dlist, n, &stats);506 free (list);507 free (dlist);508 return (stats);509 }510 511 /* mark mosaic if: abs(Mcal - <Mcal>) too large, dMcal too large */512 void clean_mosaics () {513 514 int i, N, mark, Nmark;515 double *mlist, *slist, *dlist;516 double MaxOffset, MedOffset, MaxScatter;517 StatType stats;518 519 if (!MOSAICNAME[0]) return;520 521 if (VERBOSE) fprintf (stderr, "marking poor mosaics\n");522 523 ALLOCATE (mlist, double, Nmosaic);524 ALLOCATE (slist, double, Nmosaic);525 ALLOCATE (dlist, double, Nmosaic);526 527 for (i = N = 0; i < Nmosaic; i++) {528 if (mosaic[i].code & IMAGE_BAD) continue;529 mlist[N] = mosaic[i].Mcal;530 slist[N] = mosaic[i].dMcal;531 dlist[N] = 1;532 N++;533 }534 initstats ("MEAN");535 liststats (mlist, dlist, N, &stats);536 MaxOffset = MAX (IMAGE_OFFSET, 2*stats.sigma);537 MedOffset = stats.median;538 liststats (slist, dlist, N, &stats);539 MaxScatter = MAX (IMAGE_SCATTER, 2*stats.median);540 fprintf (stderr, "Mrel: %f, dMrel: %f, Max Scatter: %f, Max Offset: %f\n", MedOffset, stats.median, MaxScatter, MaxOffset);541 542 Nmark = 0;543 for (i = 0; i < Nmosaic; i++) {544 mark = FALSE;545 mark = (mosaic[i].dMcal > MaxScatter) || (fabs(mosaic[i].Mcal - MedOffset) > MaxOffset);546 if (mark) {547 Nmark ++;548 mosaic[i].code |= ID_IMAGE_POOR;549 } else {550 mosaic[i].code &= ~ID_IMAGE_POOR;551 }552 }553 554 fprintf (stderr, "%d mosaics marked poor\n", Nmark);555 initstats (STATMODE);556 free (mlist);557 free (slist);558 free (dlist);559 180 } 560 181 … … 655 276 } 656 277 278 Image *getMosaicForImage (int Nim) { 279 280 Image *mosaic; 281 282 mosaic = NULL; 283 return mosaic; 284 } 285 657 286 int *SelectRefMosaic (Mosaic **refmosaic, int *Nimage) { 658 287 -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/Shutdown.c
r12048 r12276 27 27 } 28 28 29 30 /* XXX this is probably not needed anymore : just protect the write statements */ -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/args.c
r12220 r12276 34 34 } 35 35 36 /* specify portion of the sky */36 /* specify portion of the sky : allow default of all sky? */ 37 37 UserPatch.Rmin = 0; 38 38 UserPatch.Rmax = 360; 39 39 UserPatch.Dmin = -90; 40 40 UserPatch.Dmax = +90; 41 UserPatchSelect = FALSE;42 41 if ((N = get_argument (argc, argv, "-region"))) { 43 42 remove_argument (N, &argc, argv); … … 50 49 UserPatch.Dmax = atof (argv[N]); 51 50 remove_argument (N, &argc, argv); 52 UserPatchSelect = TRUE; 51 } else { 52 usage (); 53 } 54 55 PHOTCODE_LIST = NULL; 56 if ((N = get_argument (argc, argv, "-photcode"))) { 57 remove_argument (N, &argc, argv); 58 PHOTCODE_LIST = strcreate(argv[N]); 59 remove_argument (N, &argc, argv); 53 60 } 54 61 … … 72 79 } 73 80 81 # if (0) 82 /* XXX is this still relevant?? */ 74 83 strcpy (STATMODE, "CHI_INNER_WTMEAN"); 75 84 if ((N = get_argument (argc, argv, "-statmode"))) { … … 78 87 remove_argument (N, &argc, argv); 79 88 } 80 81 NLOOP = 8; 82 if ((N = get_argument (argc, argv, "-n"))) { 83 remove_argument (N, &argc, argv); 84 NLOOP = atof (argv[N]); 85 remove_argument (N, &argc, argv); 86 } 89 # endif 87 90 88 91 RESET = FALSE; … … 104 107 } 105 108 109 /* XXX update these for relevant plots */ 106 110 PlotMmin = 10.0; PlotMmax = 20.0; PlotdMmin = -1.0; PlotdMmax = 1.0; 107 111 if ((N = get_argument (argc, argv, "-plrange"))) { … … 117 121 } 118 122 119 /* group images by mosaic, find Mmos */ 120 MOSAICNAME[0] = 0; 121 if ((N = get_argument (argc, argv, "-mosaic"))) { 122 remove_argument (N, &argc, argv); 123 strcpy (MOSAICNAME, argv[N]); 124 remove_argument (N, &argc, argv); 125 } 126 127 FREEZE_IMAGES = FALSE; 128 if ((N = get_argument (argc, argv, "-imfreeze"))) { 129 remove_argument (N, &argc, argv); 130 FREEZE_IMAGES = TRUE; 131 } 132 133 USE_GRID = FALSE; 134 if ((N = get_argument (argc, argv, "-grid"))) { 135 remove_argument (N, &argc, argv); 136 USE_GRID = TRUE; 137 if (!MOSAICNAME[0]) { 138 fprintf (stderr, "-grid is only valid with -mosaic\n"); 139 exit (2); 140 } 141 } 142 123 /* XXX update this */ 143 124 MIN_ERROR = 0.001; 144 125 if ((N = get_argument (argc, argv, "-minerror"))) { … … 195 176 } 196 177 178 /* XXX drop this? */ 197 179 DophotSelect = FALSE; 198 180 if ((N = get_argument (argc, argv, "-dophot"))) { … … 203 185 } 204 186 205 if ( UserPatchSelect && (argc != 2)) usage (); 206 if (!UserPatchSelect && (argc != 3)) usage (); 207 187 if (argc != 1) usage (); 208 188 return TRUE; 209 189 } 210 190 211 191 void usage () { 212 fprintf (stderr, "ERROR: USAGE: relphot (region) (photcode)\n"); 213 fprintf (stderr, " or: relphot (photcode) -region RA RA DEC DEC\n"); 214 fprintf (stderr, " options: \n"); 192 fprintf (stderr, "ERROR: USAGE: relastro -region RA RA DEC DEC\n"); 193 fprintf (stderr, " working options: \n"); 215 194 fprintf (stderr, " -time (start) (stop)\n"); 216 195 fprintf (stderr, " -v\n"); 217 196 fprintf (stderr, " -plot\n"); 218 197 fprintf (stderr, " -plotdelay (seconds)\n"); 219 fprintf (stderr, " -statmode (mode)\n");220 fprintf (stderr, " -n (nloop)\n");221 fprintf (stderr, " -reset\n");222 198 fprintf (stderr, " -update\n"); 223 199 fprintf (stderr, " -params\n"); 224 fprintf (stderr, " -mosaic (mosaic)\n"); 225 fprintf (stderr, " -imfreeze\n"); 226 fprintf (stderr, " -grid\n"); 200 fprintf (stderr, " -reset\n"); 227 201 fprintf (stderr, " -area Xmin Xmax Ymin Ymax\n"); 228 fprintf (stderr, " -instmag min max\n"); 202 fprintf (stderr, " -instmag min max\n\n"); 203 fprintf (stderr, " planned options: \n"); 204 fprintf (stderr, " -photcode code[,code,code,..]\n"); 229 205 fprintf (stderr, " \n"); 230 206 exit (2); -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/bcatalog.c
r12220 r12276 3 3 int bcatalog (Catalog *subcatalog, Catalog *catalog) { 4 4 5 int i, j, offset, ecode;5 int i, j, k, offset, found; 6 6 int NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm; 7 7 float mag; … … 37 37 offset = catalog[0].average[i].offset + j; 38 38 39 /* select measurements by photcode */ 40 ecode = GetPhotcodeEquivCodebyCode (catalog[0].measure[offset].photcode); 41 if (ecode != photcode[0].code) continue; 39 /* select measurements by photcode, if specified */ 40 if (Nphotcodes > 0) { 41 found = FALSE; 42 for (k = 0; (k < Nphotcodes) && !found; k++) { 43 if (photcodes[k][0].code == catalog[0].measure[offset].photcode) found = TRUE; 44 } 45 if (!found) continue; 46 } 42 47 43 48 /* select measurements by time */ -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/initialize.c
r12048 r12276 3 3 void initialize (int argc, char **argv) { 4 4 5 int N; 5 int NPHOTCODES; 6 char *codename, *ptr; 6 7 7 8 ConfigInit (&argc, argv); 8 9 args (argc, argv); 9 10 10 N = UserPatchSelect ? 1 : 2; 11 if ((photcode = GetPhotcodebyName (argv[N])) == NULL) { 12 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", argv[N]); 13 exit (1); 11 /* XXX we need to build a list of accepted photcodes. these will be used by bcatalog to accept or 12 reject loaded data */ 13 14 Nphotcodes = 0; 15 photcodes = NULL; 16 if (PHOTCODE_LIST != NULL) { 17 NPHOTCODES = 10; 18 ALLOCATE (photcodes, PhotCode *, NPHOTCODES); 19 20 /* parse the comma-separated list of photcodes */ 21 strtok_r (PHOTCODE_LIST, ",", &ptr); 22 while ((codename = strtok_r (NULL, ",", &ptr)) != NULL) { 23 fprintf (stderr, "PHOTCODE_LIST: %s\n", PHOTCODE_LIST); 24 fprintf (stderr, "codename: %s\n", codename); 25 if ((photcodes[Nphotcodes] = GetPhotcodebyName (codename)) == NULL) { 26 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", codename); 27 exit (1); 28 } 29 Nphotcodes ++; 30 CHECK_REALLOCATE (photcodes, PhotCode *, NPHOTCODES, Nphotcodes, 10); 31 } 14 32 } 15 if (photcode[0].type != PHOT_SEC) {16 fprintf (stderr, "photcode %s is not a primary or secondary filter\n", argv[N]);17 exit (1);18 }19 20 33 PhotNsec = GetPhotcodeNsecfilt (); 21 PhotSec = GetPhotcodeNsec (photcode[0].code);22 34 23 35 initstats (STATMODE); … … 27 39 MEAS_BAD = ID_MEAS_NOCAL | ID_MEAS_POOR | ID_MEAS_SKIP | ID_MEAS_AREA; 28 40 41 /* XXX drop irrelevant entries */ 29 42 if (SHOW_PARAMS) { 30 43 fprintf (stderr, "current parameter settings:\n"); -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/load_images.c
r12068 r12276 1 1 # include "relastro.h" 2 2 3 SkyList *load_images (FITS_DB *db, char *regionName, SkyRegion *region, int RegionSelect) {3 SkyList *load_images (FITS_DB *db, SkyRegion *region) { 4 4 5 5 Image *image, *subset; 6 int Nimage, Nsubset , Nchar;6 int Nimage, Nsubset; 7 7 int *LineNumber; 8 8 … … 15 15 16 16 // determine the populated SkyRegions overlapping the requested area 17 if (RegionSelect) { 18 skylist = SkyListByPatch (sky, -1, region); 19 } else { 20 Nchar = strlen(regionName); 21 if (!strcmp (®ionName[Nchar-4], ".cpt")) regionName[Nchar-4] = 0; 22 skylist = SkyListByName (sky, regionName); 23 } 17 skylist = SkyListByPatch (sky, -1, region); 24 18 25 19 // convert database table to internal structure -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/plot_scatter.c
r12220 r12276 3 3 void plot_scatter (Catalog *catalog, int Ncatalog) { 4 4 5 # if (0) 5 6 int i, j, k, m, N, Ntot; 6 7 float Mrel, Mcal, Mmos, Mgrid; … … 28 29 for (k = 0; k < catalog[i].average[j].Nm; k++, m++) { 29 30 if (catalog[i].measure[m].flags & MEAS_BAD) continue; 30 if ((Mcal = getMcal (m, i)) == NO_MAG) continue;31 if ((Mmos = getMmos (m, i)) == NO_MAG) continue;32 if ((Mgrid = getMgrid (m, i)) == NO_MAG) continue;33 31 34 32 Mrel = catalog[i].secfilt[PhotNsec*j+PhotSec].M; … … 55 53 free (ylist); 56 54 free (ilist); 55 56 # endif 57 57 } 58 59 /* XXX this should become astrometrically relevant */ -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/relastro.c
r12220 r12276 22 22 23 23 /* load regions and images based on specified sky patch */ 24 // XXX need to mimic old-style load by passing patch name 25 // XXX need to reduce number of global variables in use. 26 // XXX this is fairly lame: argv[1] is photcode if UserPatchSelect is true 27 skylist = load_images (&db, argv[1], &UserPatch, UserPatchSelect); 24 skylist = load_images (&db, &UserPatch); 28 25 29 26 /* load catalog data from region files */ … … 38 35 39 36 if (PLOTSTUFF) { 40 plot_star_coords (catalog, Ncatalog);37 // plot_star_coords (catalog, Ncatalog); 41 38 plot_mosaic_fields (catalog); 42 39 } -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/reload_catalogs.c
r12048 r12276 38 38 initImageBins (&catalog, 1); 39 39 initMosaicBins (&catalog, 1); 40 initGridBins (&catalog, 1);41 40 42 41 findImages (&catalog, 1); 43 42 findMosaics (&catalog, 1); 44 43 45 setMrelFinal (&catalog);46 44 dvo_catalog_save (&catalog, VERBOSE); 47 45 dvo_catalog_unlock (&catalog); … … 50 48 freeImageBins (1); 51 49 freeMosaicBins (1); 52 freeGridBins (1);53 50 } 54 51 } -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/select_images.c
r12048 r12276 17 17 Image *image; 18 18 int i, j, k, m, found, nimage, NIMAGE; 19 int InRange , ecode;19 int InRange; 20 20 double Ri[5], Di[5], Xi[5], Yi[5], dx, dy; 21 21 int *line_number; … … 75 75 for (i = 0; i < Ntimage; i++) { 76 76 77 /* exclude images by photcode */ 78 ecode = GetPhotcodeEquivCodebyCode (timage[i].photcode); 79 if (ecode != photcode[0].code) continue; 77 /* exclude images by photcode, if selected */ 78 if (Nphotcodes > 0) { 79 found = FALSE; 80 for (j = 0; (j < Nphotcodes) && !found; j++) { 81 if (photcodes[j][0].code == timage[i].photcode) found = TRUE; 82 } 83 if (!found) continue; 84 } 80 85 81 86 /* exclude images by time */ -
branches/dvo-mods-2007-02/Ohana/src/relastro/src/setExclusions.c
r12068 r12276 4 4 int setExclusions (Catalog *catalog, int Ncatalog) { 5 5 6 int i, j, k, m, Narea, Nnocal , ecode;6 int i, j, k, m, Narea, Nnocal; 7 7 Coords *coords; 8 8 double r, d, x, y; … … 15 15 16 16 /* select measurements by photcode */ 17 ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[m].photcode); 18 if (ecode != photcode[0].code) goto mark_nocal; 17 // XXXX is this done when loaded, or is it needed for reload? 18 // ecode = GetPhotcodeEquivCodebyCode (catalog[i].measure[m].photcode); 19 // if (ecode != photcode[0].code) goto mark_nocal; 19 20 20 21 /* select measurements by time */
Note:
See TracChangeset
for help on using the changeset viewer.
