Changeset 31160
- Timestamp:
- Apr 4, 2011, 1:19:27 PM (15 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 58 edited
- 6 copied
-
configure.tcsh (modified) (1 diff)
-
src/addstar/include/addstar.h (modified) (1 diff)
-
src/addstar/src/MatchHeaders.c (modified) (1 diff)
-
src/addstar/src/ReadStarsFITS.c (modified) (2 diffs)
-
src/addstar/src/resort_catalog.c (modified) (1 diff)
-
src/dvomerge/src/dvoverify.c (modified) (6 diffs)
-
src/kapa2/src/PSObjects.c (modified) (5 diffs)
-
src/kapa2/src/SetImageData.c (modified) (1 diff)
-
src/kapa2/src/bDrawObjects.c (modified) (4 diffs)
-
src/libautocode/Makefile.Targets (modified) (2 diffs)
-
src/libautocode/def/cmf-ps1-sv1.d (copied) (copied from branches/eam_branches/ipp-20110213/Ohana/src/libautocode/def/cmf-ps1-sv1.d )
-
src/libdvo/Makefile (modified) (1 diff)
-
src/libdvo/include/dvo.h (modified) (1 diff)
-
src/libdvo/lib (modified) (1 prop)
-
src/libdvo/src/cmf-ps1-sv1-alt.c (copied) (copied from branches/eam_branches/ipp-20110213/Ohana/src/libdvo/src/cmf-ps1-sv1-alt.c )
-
src/libfits/lib (modified) (1 prop)
-
src/libkapa/include/kapa.h (modified) (2 diffs)
-
src/libkapa/lib (modified) (1 prop)
-
src/libkapa/src/KiiPicture.c (modified) (1 diff)
-
src/libohana/include/ohana.h (modified) (1 diff)
-
src/libohana/lib (modified) (1 prop)
-
src/libohana/test (modified) (1 prop)
-
src/libohana/test/typetest.c (modified) (1 diff)
-
src/libtap/lib (modified) (1 prop)
-
src/opihi/cmd.astro/region.c (modified) (2 diffs)
-
src/opihi/cmd.data/densify.c (modified) (3 diffs)
-
src/opihi/cmd.data/fit1d.c (modified) (1 diff)
-
src/opihi/cmd.data/fit2d.c (modified) (1 diff)
-
src/opihi/cmd.data/histogram.c (modified) (1 diff)
-
src/opihi/cmd.data/limits.c (modified) (3 diffs)
-
src/opihi/cmd.data/section.c (modified) (2 diffs)
-
src/opihi/dvo/dbExtractImages.c (modified) (2 diffs)
-
src/opihi/dvo/dbFields.c (modified) (1 diff)
-
src/opihi/dvo/imextract.c (modified) (1 diff)
-
src/opihi/dvo/skycoverage.c (modified) (7 diffs)
-
src/opihi/include/dvoshell.h (modified) (2 diffs)
-
src/opihi/lib.data/graphtools.c (modified) (2 diffs)
-
src/opihi/lib.shell/VectorOps.c (modified) (2 diffs)
-
src/relastro/include/relastro.h (modified) (2 diffs)
-
src/relastro/src/UpdateObjects.c (modified) (1 diff)
-
src/relastro/src/args.c (modified) (1 diff)
-
src/relastro/src/high_speed_objects.c (modified) (6 diffs)
-
src/relastro/src/select_images.c (modified) (4 diffs)
-
src/relphot/src/args.c (modified) (1 diff)
-
src/relphot/src/bcatalog.c (modified) (6 diffs)
-
src/relphot/src/load_images.c (modified) (3 diffs)
-
src/relphot/src/select_images.c (modified) (6 diffs)
-
src/tools/src/fhead.c (modified) (2 diffs)
-
src/tools/src/ftable.c (modified) (5 diffs)
-
src/uniphot/Makefile (modified) (4 diffs)
-
src/uniphot/include/uniphot.h (modified) (3 diffs)
-
src/uniphot/src/args.c (modified) (1 diff)
-
src/uniphot/src/convert.c (copied) (copied from branches/eam_branches/ipp-20110213/Ohana/src/uniphot/src/convert.c )
-
src/uniphot/src/dumpresult.c (modified) (1 diff)
-
src/uniphot/src/find_image_sgroups.c (modified) (4 diffs)
-
src/uniphot/src/find_image_tgroups.c (modified) (6 diffs)
-
src/uniphot/src/fit_groups.c (modified) (2 diffs)
-
src/uniphot/src/initialize.c (modified) (1 diff)
-
src/uniphot/src/load_fwhm_table.c (copied) (copied from branches/eam_branches/ipp-20110213/Ohana/src/uniphot/src/load_fwhm_table.c )
-
src/uniphot/src/match_fwhm_to_images.c (copied) (copied from branches/eam_branches/ipp-20110213/Ohana/src/uniphot/src/match_fwhm_to_images.c )
-
src/uniphot/src/setfwhm.c (copied) (copied from branches/eam_branches/ipp-20110213/Ohana/src/uniphot/src/setfwhm.c )
-
src/uniphot/src/subset_images.c (modified) (3 diffs)
-
src/uniphot/src/uniphot.c (modified) (5 diffs)
-
src/uniphot/src/update.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/configure.tcsh
r28241 r31160 321 321 set sysincpath = "$sysincpath /sw/include" 322 322 set dlltype = dylib 323 set CFLAGS = "$CFLAGS -D_DARWIN_C_SOURCE"324 set defines = "-D_DARWIN_C_SOURCE"323 # set CFLAGS = "$CFLAGS -D_DARWIN_C_SOURCE" 324 # set defines = "-D_DARWIN_C_SOURCE" 325 325 breaksw; 326 326 case HP-UX: -
trunk/Ohana/src/addstar/include/addstar.h
r30613 r31160 263 263 Stars *Convert_PS1_V2 PROTO((FTable *table, unsigned int *nstars)); 264 264 Stars *Convert_PS1_V3 PROTO((FTable *table, unsigned int *nstars)); 265 Stars *Convert_PS1_SV1 PROTO((FTable *table, unsigned int *nstars)); 266 Stars *Convert_PS1_SV1_Alt PROTO((FTable *table, unsigned int *nstars)); 265 267 266 268 int InitStar PROTO((Stars *star)); -
trunk/Ohana/src/addstar/src/MatchHeaders.c
r29541 r31160 58 58 if (!strcmp (exttype, "PS1_V2")) goto keep; 59 59 if (!strcmp (exttype, "PS1_V3")) goto keep; 60 if (!strcmp (exttype, "PS1_SV1")) goto keep; 60 61 continue; 61 62 -
trunk/Ohana/src/addstar/src/ReadStarsFITS.c
r30725 r31160 54 54 stars = Convert_PS1_V3 (&table, &Nstars); 55 55 } 56 if (!strcmp (type, "PS1_SV1")) { 57 stars = Convert_PS1_SV1 (&table, &Nstars); 58 } 56 59 if (stars == NULL) { 57 60 fprintf (stderr, "invalid table type %s\n", type); … … 501 504 return (stars); 502 505 } 506 507 Stars *Convert_PS1_SV1 (FTable *table, unsigned int *nstars) { 508 509 off_t Nstars; 510 unsigned int i; 511 double ZeroPt; 512 Stars *stars; 513 CMF_PS1_SV1 *ps1data; 514 515 if (table[0].header[0].Naxis[0] == 196) { 516 stars = Convert_PS1_SV1_Alt (table, nstars); 517 return (stars); 518 } 519 520 ps1data = gfits_table_get_CMF_PS1_SV1 (table, &Nstars, NULL); 521 if (!ps1data) { 522 fprintf (stderr, "skipping inconsistent entry\n"); 523 return (NULL); 524 } 525 ZeroPt = GetZeroPoint(); 526 527 ALLOCATE (stars, Stars, Nstars); 528 for (i = 0; i < Nstars; i++) { 529 InitStar (&stars[i]); 530 stars[i].measure.Xccd = ps1data[i].X; 531 stars[i].measure.Yccd = ps1data[i].Y; 532 stars[i].measure.dXccd = ToShortPixels(ps1data[i].dX); 533 stars[i].measure.dYccd = ToShortPixels(ps1data[i].dY); 534 535 stars[i].measure.posangle = ToShortDegrees(ps1data[i].posangle); 536 stars[i].measure.pltscale = ps1data[i].pltscale; 537 538 if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) { 539 stars[i].measure.M = NAN; 540 } else { 541 stars[i].measure.M = ps1data[i].M + ZeroPt; 542 } 543 stars[i].measure.dM = ps1data[i].dM; 544 stars[i].measure.dMcal = ps1data[i].dMcal; 545 stars[i].measure.Map = ps1data[i].Map + ZeroPt; 546 547 stars[i].measure.Sky = ps1data[i].sky; 548 stars[i].measure.dSky = ps1data[i].dSky; 549 550 stars[i].measure.psfChisq = ps1data[i].psfChisq; 551 stars[i].measure.psfQual = ps1data[i].psfQual; 552 stars[i].measure.psfNdof = ps1data[i].psfNdof; 553 stars[i].measure.psfNpix = ps1data[i].psfNpix; 554 stars[i].measure.crNsigma = ps1data[i].crNsigma; 555 stars[i].measure.extNsigma = ps1data[i].extNsigma; 556 557 stars[i].measure.FWx = ToShortPixels(ps1data[i].fx); 558 stars[i].measure.FWy = ToShortPixels(ps1data[i].fy); 559 stars[i].measure.theta = ToShortDegrees(ps1data[i].df); 560 561 stars[i].measure.Mxx = ToShortPixels(ps1data[i].Mxx); 562 stars[i].measure.Mxy = ToShortPixels(ps1data[i].Mxy); 563 stars[i].measure.Myy = ToShortPixels(ps1data[i].Myy); 564 565 stars[i].measure.photFlags = ps1data[i].flags; 566 567 // this is may optionally be replaced by the internal sequence (see FilterStars.c) 568 stars[i].measure.detID = ps1data[i].detID; 569 570 // the Average fields and the following Measure fields are set in FilterStars after 571 // the image metadata is in hand: dR, dD, Mcal, dt, airmass, az, t, imageID, extID, 572 // averef is set in find_matches, dbFlags is zero on ingest. 573 574 // the following fields are currently not being set anywhere: t_msec 575 } 576 *nstars = Nstars; 577 return (stars); 578 } 579 580 Stars *Convert_PS1_SV1_Alt (FTable *table, unsigned int *nstars) { 581 582 off_t Nstars; 583 unsigned int i; 584 double ZeroPt; 585 Stars *stars; 586 CMF_PS1_SV1 *ps1data; 587 588 // some test output files were produced called CMF_PS1_SV1 but with mismatch byte boundaries 589 590 ps1data = gfits_table_get_CMF_PS1_SV1_Alt (table, &Nstars, NULL); 591 if (!ps1data) { 592 fprintf (stderr, "skipping inconsistent entry\n"); 593 return (NULL); 594 } 595 ZeroPt = GetZeroPoint(); 596 597 ALLOCATE (stars, Stars, Nstars); 598 for (i = 0; i < Nstars; i++) { 599 InitStar (&stars[i]); 600 stars[i].measure.Xccd = ps1data[i].X; 601 stars[i].measure.Yccd = ps1data[i].Y; 602 stars[i].measure.dXccd = ToShortPixels(ps1data[i].dX); 603 stars[i].measure.dYccd = ToShortPixels(ps1data[i].dY); 604 605 stars[i].measure.posangle = ToShortDegrees(ps1data[i].posangle); 606 stars[i].measure.pltscale = ps1data[i].pltscale; 607 608 if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) { 609 stars[i].measure.M = NAN; 610 } else { 611 stars[i].measure.M = ps1data[i].M + ZeroPt; 612 } 613 stars[i].measure.dM = ps1data[i].dM; 614 stars[i].measure.dMcal = ps1data[i].dMcal; 615 stars[i].measure.Map = ps1data[i].Map + ZeroPt; 616 617 stars[i].measure.Sky = ps1data[i].sky; 618 stars[i].measure.dSky = ps1data[i].dSky; 619 620 stars[i].measure.psfChisq = ps1data[i].psfChisq; 621 stars[i].measure.psfQual = ps1data[i].psfQual; 622 stars[i].measure.psfNdof = ps1data[i].psfNdof; 623 stars[i].measure.psfNpix = ps1data[i].psfNpix; 624 stars[i].measure.crNsigma = ps1data[i].crNsigma; 625 stars[i].measure.extNsigma = ps1data[i].extNsigma; 626 627 stars[i].measure.FWx = ToShortPixels(ps1data[i].fx); 628 stars[i].measure.FWy = ToShortPixels(ps1data[i].fy); 629 stars[i].measure.theta = ToShortDegrees(ps1data[i].df); 630 631 stars[i].measure.Mxx = ToShortPixels(ps1data[i].Mxx); 632 stars[i].measure.Mxy = ToShortPixels(ps1data[i].Mxy); 633 stars[i].measure.Myy = ToShortPixels(ps1data[i].Myy); 634 635 stars[i].measure.photFlags = ps1data[i].flags; 636 637 // this is may optionally be replaced by the internal sequence (see FilterStars.c) 638 stars[i].measure.detID = ps1data[i].detID; 639 640 // the Average fields and the following Measure fields are set in FilterStars after 641 // the image metadata is in hand: dR, dD, Mcal, dt, airmass, az, t, imageID, extID, 642 // averef is set in find_matches, dbFlags is zero on ingest. 643 644 // the following fields are currently not being set anywhere: t_msec 645 } 646 *nstars = Nstars; 647 return (stars); 648 } 649 -
trunk/Ohana/src/addstar/src/resort_catalog.c
r30613 r31160 92 92 averageSeq[i] = measure[i].averef; 93 93 94 myAssert(average[averageSeq[i]].objID == measure[measureSeq[i]].objID, "object / detection mismatch"); 95 myAssert(average[averageSeq[i]].catID == measure[measureSeq[i]].catID, "object / detection mismatch"); 94 if (catalog[0].catformat >= DVO_FORMAT_PS1_V1) { 95 // earlier formats did not carry the objID or catID, so they are not available (we could assign on load, but we don't) 96 myAssert(average[averageSeq[i]].objID == measure[measureSeq[i]].objID, "object / detection mismatch"); 97 myAssert(average[averageSeq[i]].catID == measure[measureSeq[i]].catID, "object / detection mismatch"); 98 } 96 99 } 97 100 -
trunk/Ohana/src/dvomerge/src/dvoverify.c
r30830 r31160 13 13 # define DEBUG 0 14 14 15 int VERBOSE; 16 int CHECKSORTED; 15 int VERBOSE = FALSE; 17 16 int NNotSorted = 0; 18 17 … … 28 27 // Catalog catalog; 29 28 30 VERBOSE = FALSE; 29 int CHECKSORTED; 30 31 31 if ((N = get_argument (argc, argv, "-v"))) { 32 32 VERBOSE = TRUE; 33 33 remove_argument (N, &argc, argv); 34 34 } 35 if ((N = get_argument (argc, argv, "-verbose"))) { 36 VERBOSE = TRUE; 37 remove_argument (N, &argc, argv); 38 } 35 39 if ((N = get_argument (argc, argv, "-s"))) { 36 40 CHECKSORTED = TRUE; 37 41 remove_argument (N, &argc, argv); 38 42 } 39 43 if ((N = get_argument (argc, argv, "-sorted"))) { 44 CHECKSORTED = TRUE; 45 remove_argument (N, &argc, argv); 46 } 40 47 41 48 // restrict to a portion of the sky … … 57 64 58 65 if (argc != 2) { 59 fprintf (stderr, "USAGE: dvoverify (catdir) [-region Rmin Rmax Dmin Dmax] [-v -s]\n\n -v = verbose \n -s = checks if sorted, return error if not\n"); 60 fprintf (stderr, " catdir : database of interest\n"); 66 fprintf (stderr, "USAGE: dvoverify (catdir) [-region Rmin Rmax Dmin Dmax] [-v] [-s]\n\n"); 67 fprintf (stderr, " -v : VERBOSE\n"); 68 fprintf (stderr, " -s : checks if sorted, return error if not\n"); 69 fprintf (stderr, " (catdir) : database of interest\n"); 61 70 exit (2); 62 71 } … … 96 105 for (i = 0; i < inlist[0].Nregions; i++) { 97 106 if (!inlist[0].regions[i][0].table) continue; 98 if ((NNotSorted > 0) && CHECKSORTED) continue;99 107 if (i % 1000 == 0) fprintf (stderr, "."); 100 108 … … 116 124 if (!CheckCatalogIndexes(catdir, inlist[0].filename[i], inlist[0].regions[i])){ 117 125 Nbad ++; 126 } 127 128 // exit immediately if any file are unsorted and we require sorted tables 129 if (CHECKSORTED && NNotSorted) { 130 fprintf (stderr, "ERROR: files are not sorted\n"); 131 exit (1); 118 132 } 119 133 } … … 123 137 exit (1); 124 138 } 125 if ((NNotSorted > 0) && CHECKSORTED) {126 fprintf (stderr, "ERROR: files are not sorted\n");127 exit (1);128 }129 139 130 140 fprintf (stderr, "SUCCESS: no files are bad\n"); 141 if (NNotSorted) { 142 fprintf (stderr, "NOTE: %d files are not sorted\n", NNotSorted); 143 } 131 144 exit (0); 132 145 } -
trunk/Ohana/src/kapa2/src/PSObjects.c
r30606 r31160 270 270 float *x, *y, *z; 271 271 double mxi, mxj, myi, myj, bxi, bxj, byi, byj, bx, by; 272 double sx, sy, d, sx1, sy1, sx2, sy2 ;272 double sx, sy, d, sx1, sy1, sx2, sy2, X0, Y0, X1, Y1; 273 273 274 274 mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); … … 432 432 } 433 433 if (object[0].ptype == 100) { /* connect a pair of points */ 434 X0 = graph[0].axis[0].fx; 435 X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 436 Y0 = graph[0].axis[1].fy; 437 Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 438 434 439 for (i = 0; i + 1 < object[0].Npts; i+=2) { 435 440 if (!(finite(x[i]) && finite(y[i]))) continue; … … 438 443 sx2 = x[i+1]*mxi + y[i+1]*mxj + bx; 439 444 sy2 = x[i+1]*myi + y[i+1]*myj + by; 440 DrawLine (sx1, sy1, sx2, sy2);445 ClipLinePS (sx1, sy1, sx2, sy2, X0, Y0, X1, Y1, f); 441 446 } 442 447 } … … 585 590 } 586 591 if (object[0].ptype == 100) { 592 X0 = graph[0].axis[0].fx; 593 X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 594 Y0 = graph[0].axis[1].fy; 595 Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 596 587 597 for (i = 0; i + 1 < object[0].Npts; i+=2) { 588 598 if (!(finite(x[i]) && finite(y[i]))) continue; … … 591 601 sx2 = x[i+1]*mxi + y[i+1]*mxj + bx; 592 602 sy2 = x[i+1]*myi + y[i+1]*myj + by; 593 DrawLine (sx1, sy1, sx2, sy2);603 ClipLinePS (sx1, sy1, sx2, sy2, X0, Y0, X1, Y1, f); 594 604 } 595 605 } -
trunk/Ohana/src/kapa2/src/SetImageData.c
r27435 r31160 128 128 Picture_to_Image (&Xmax, &Ymax, image[0].picture.dx, image[0].picture.dy, &image[0].picture); 129 129 130 KiiSendMessage (sock, "%g %g %g %g ", Xmin, Xmax, Ymin, Ymax);130 KiiSendMessage (sock, "%g %g %g %g %d %d", Xmin, Xmax, Ymin, Ymax, image[0].picture.dx, image[0].picture.dy); 131 131 132 132 return (TRUE); -
trunk/Ohana/src/kapa2/src/bDrawObjects.c
r30606 r31160 415 415 } 416 416 if (object[0].ptype == 100) { /* connect a pair of points */ 417 418 double X0 = graph[0].axis[0].fx; 419 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 420 double Y0 = graph[0].axis[1].fy; 421 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 422 417 423 for (i = 0; i + 1 < object[0].Npts; i+=2) { 418 424 if (!(finite(x[i]) && finite(y[i]))) continue; … … 421 427 sx2 = x[i+1]*mxi + y[i+1]*mxj + bx; 422 428 sy2 = x[i+1]*myi + y[i+1]*myj + by; 423 DrawLine (buffer, sx1, sy1, sx2, sy2);429 bDrawClipLine (buffer, sx1, sy1, sx2, sy2, X0, Y0, X1, Y1); 424 430 } 425 431 } … … 561 567 } 562 568 if (object[0].ptype == 100) { 569 570 double X0 = graph[0].axis[0].fx; 571 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 572 double Y0 = graph[0].axis[1].fy; 573 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 574 563 575 for (i = 0; i + 1 < object[0].Npts; i+=2) { 564 576 if (!(finite(x[i]) && finite(y[i]))) continue; … … 567 579 sx2 = x[i+1]*mxi + y[i+1]*mxj + bx; 568 580 sy2 = x[i+1]*myi + y[i+1]*myj + by; 569 DrawLine (buffer, sx1, sy1, sx2, sy2);581 bDrawClipLine (buffer, sx1, sy1, sx2, sy2, X0, Y0, X1, Y1); 570 582 } 571 583 } -
trunk/Ohana/src/libautocode/Makefile.Targets
r29537 r31160 60 60 $(ASRC)/cmf-ps1-v2.$(ARCH).o \ 61 61 $(ASRC)/cmf-ps1-v3.$(ARCH).o \ 62 $(ASRC)/cmf-ps1-sv1.$(ARCH).o \ 62 63 $(ASRC)/cmf-smpdata.$(ARCH).o \ 63 64 $(ASRC)/getstar-ps1-dev-0.$(ARCH).o \ … … 131 132 $(AINC)/cmf-ps1-v2.h \ 132 133 $(AINC)/cmf-ps1-v3.h \ 134 $(AINC)/cmf-ps1-sv1.h \ 133 135 $(AINC)/cmf-smpdata.h \ 134 136 $(AINC)/getstar-ps1-dev-0.h \ -
trunk/Ohana/src/libdvo/Makefile
r30605 r31160 74 74 $(SRC)/skyregion_ops.$(ARCH).o \ 75 75 $(SRC)/cmf-ps1-v1-alt.$(ARCH).o \ 76 $(SRC)/cmf-ps1-sv1-alt.$(ARCH).o \ 76 77 $(SRC)/dvo_util.$(ARCH).o 77 78 -
trunk/Ohana/src/libdvo/include/dvo.h
r29938 r31160 199 199 // special-case function: 200 200 CMF_PS1_V2 *gfits_table_get_CMF_PS1_V1_Alt (FTable *ftable, off_t *Ndata, char *swapped); 201 CMF_PS1_SV1 *gfits_table_get_CMF_PS1_SV1_Alt (FTable *ftable, off_t *Ndata, char *swapped); 201 202 202 203 typedef struct { -
trunk/Ohana/src/libdvo/lib
- Property svn:ignore
-
old new 1 1 *.a 2 2 *.so 3 *.dylib
-
- Property svn:ignore
-
trunk/Ohana/src/libfits/lib
- Property svn:ignore
-
old new 1 1 *.a 2 2 *.so 3 *.dylib
-
- Property svn:ignore
-
trunk/Ohana/src/libkapa/include/kapa.h
r29938 r31160 3 3 4 4 /* linux is happy with this, not solaris */ 5 # include <netinet/ip.h> 5 //# include <netinet/in_systm.h> 6 //# include <netinet/ip.h> 7 8 # include <sys/types.h> 9 # include <sys/socket.h> 10 # include <netinet/in.h> 6 11 # include <netdb.h> 7 12 # include <arpa/inet.h> 8 13 9 # include <sys/types.h>10 # include <sys/socket.h>11 14 # include <X11/Xlib.h> 12 15 # include <png.h> … … 151 154 int KapaSetImageCoords (int fd, Coords *coords); 152 155 int KapaGetImageCoords (int fd, Coords *coords); 153 int KapaGetImageRange (int fd, double *Xmin, double *Xmax, double *Ymin, double *Ymax );156 int KapaGetImageRange (int fd, double *Xmin, double *Xmax, double *Ymin, double *Ymax, int *dX, int *dY); 154 157 155 158 /* KiiOverlay.c */ -
trunk/Ohana/src/libkapa/lib
- Property svn:ignore
-
old new 1 1 *.a 2 2 *.so 3 *.dylib
-
- Property svn:ignore
-
trunk/Ohana/src/libkapa/src/KiiPicture.c
r27761 r31160 203 203 } 204 204 205 int KapaGetImageRange (int fd, double *Xmin, double *Xmax, double *Ymin, double *Ymax ) {205 int KapaGetImageRange (int fd, double *Xmin, double *Xmax, double *Ymin, double *Ymax, int *dX, int *dY) { 206 206 207 207 /* tell kapa to look for the incoming image */ 208 208 KiiSendCommand (fd, 4, "GIMR"); 209 209 210 KiiScanMessage (fd, "%lf %lf %lf %lf ", Xmin, Xmax, Ymin, Ymax);210 KiiScanMessage (fd, "%lf %lf %lf %lf %d %d", Xmin, Xmax, Ymin, Ymax, dX, dY); 211 211 212 212 KiiWaitAnswer (fd, "DONE"); -
trunk/Ohana/src/libohana/include/ohana.h
r30602 r31160 155 155 # define OFF_T_FMT "%jd" 156 156 # endif 157 # ifdef _DARWIN_C_SOURCE 157 // # ifdef _DARWIN_C_SOURCE 158 // # define OFF_T_FMT "%lld" 159 // # endif 160 # ifdef darwin_x86 158 161 # define OFF_T_FMT "%lld" 159 # endif162 # endif 160 163 # ifndef OFF_T_FMT 161 164 # define OFF_T_FMT "%ld" -
trunk/Ohana/src/libohana/lib
- Property svn:ignore
-
old new 1 1 *.a 2 2 *.so 3 *.dylib
-
- Property svn:ignore
-
trunk/Ohana/src/libohana/test
- Property svn:ignore
-
old new 2 2 *.lin64 3 3 *.sol 4 *.darwin_x86 5 *.dSYM
-
- Property svn:ignore
-
trunk/Ohana/src/libohana/test/typetest.c
r28241 r31160 68 68 fprintf (stderr, "STDC_VERSION is not set\n"); 69 69 # endif 70 } 70 71 71 } 72 // 3) have we defined OFF_T_FMT correctly? 73 off_t big_value; 74 75 big_value = 10; 76 fprintf (stderr, "this is a bit int: "OFF_T_FMT" n'est pas?\n", big_value); 77 72 78 exit (status); 73 79 } -
trunk/Ohana/src/libtap/lib
- Property svn:ignore
-
old new 1 1 *.a 2 2 *.so 3 *.dylib
-
- Property svn:ignore
-
trunk/Ohana/src/opihi/cmd.astro/region.c
r30611 r31160 5 5 double Ra, Dec, Radius; 6 6 float dx, dy; 7 int N, kapa, NoClear ;7 int N, kapa, NoClear, dXpix, dYpix; 8 8 char *name; 9 9 Graphdata graphmode; … … 27 27 remove_argument (N, &argc, argv); 28 28 KapaGetImageCoords (kapa, &graphmode.coords); 29 KapaGetImageRange (kapa, &graphmode.xmin, &graphmode.xmax, &graphmode.ymax, &graphmode.ymin );29 KapaGetImageRange (kapa, &graphmode.xmin, &graphmode.xmax, &graphmode.ymax, &graphmode.ymin, &dXpix, &dYpix); 30 30 31 31 set_variable ("XMIN", graphmode.xmin); -
trunk/Ohana/src/opihi/cmd.data/densify.c
r29938 r31160 1 1 # include "data.h" 2 3 # define CHECKVAL(ARG) if (!isfinite(ARG)) { gprint (GP_ERR, "illegal value for %s: %f\n", #ARG, ARG); return (FALSE); } 2 4 3 5 int densify (int argc, char **argv) { 4 6 5 int i, Nx, Ny, Xb, Yb, Normalize, N ;6 floatXmin, Xmax, dX, Ymin, Ymax, dY;7 int i, Nx, Ny, Xb, Yb, Normalize, N, Xpix, Ypix, good, UseGraph; 8 double Xmin, Xmax, dX, Ymin, Ymax, dY; 7 9 float *val; 8 10 Buffer *bf; … … 16 18 } 17 19 18 if (argc != 10) { 20 UseGraph = FALSE; 21 if ((N = get_argument (argc, argv, "-graph"))) { 22 remove_argument (N, &argc, argv); 23 UseGraph = TRUE; 24 } 25 26 good = UseGraph ? (argc == 4) : (argc == 10); 27 if (!good) { 19 28 gprint (GP_ERR, "USAGE: densify buffer x y Xmin Xmax dX Ymin Ymax dY\n"); 29 gprint (GP_ERR, " OR: densify buffer x y -graph\n"); 20 30 return (FALSE); 21 31 } … … 30 40 REQUIRE_VECTOR_FLT (vy, FALSE); 31 41 32 Xmin = atof (argv[4]); 33 Xmax = atof (argv[5]); 34 dX = atof (argv[6]); 42 if (UseGraph) { 43 int kapa; 44 Graphdata graphmode; 45 if (!GetGraph (&graphmode, &kapa, NULL)) return (FALSE); 46 KapaGetImageRange (kapa, &Xmin, &Xmax, &Ymax, &Ymin, &Xpix, &Ypix); 47 Xmax = graphmode.xmax; 48 Xmin = graphmode.xmin; 49 Ymax = graphmode.ymax; 50 Ymin = graphmode.ymin; 51 dX = (Xmax - Xmin) / (Xpix - 1); 52 dY = (Ymax - Ymin) / (Ypix - 1); 53 } else { 54 Xmin = atof (argv[4]); 55 Xmax = atof (argv[5]); 56 dX = atof (argv[6]); 35 57 36 Ymin = atof (argv[7]); 37 Ymax = atof (argv[8]); 38 dY = atof (argv[9]); 58 Ymin = atof (argv[7]); 59 Ymax = atof (argv[8]); 60 dY = atof (argv[9]); 61 } 62 63 CHECKVAL(Xmin); 64 CHECKVAL(Xmax); 65 CHECKVAL(dX); 66 67 CHECKVAL(Ymin); 68 CHECKVAL(Ymax); 69 CHECKVAL(dY); 39 70 40 71 Nx = (Xmax - Xmin) / dX + 1; -
trunk/Ohana/src/opihi/cmd.data/fit1d.c
r27817 r31160 42 42 43 43 if (argc != 4) { 44 gprint (GP_ERR, "USAGE: fit x y order [-dy wt] [-quiet/-q] [-clip Nsigma Niter]\n");44 gprint (GP_ERR, "USAGE: fit1d x y order [-dy wt] [-quiet/-q] [-clip Nsigma Niter]\n"); 45 45 return (FALSE); 46 46 } -
trunk/Ohana/src/opihi/cmd.data/fit2d.c
r29001 r31160 48 48 49 49 if (argc != 5) { 50 gprint (GP_ERR, "USAGE: fit x y z order [-dz wt]\n");50 gprint (GP_ERR, "USAGE: fit2d x y z order [-dz wt] [-quiet/-q] [-clip Nsigma Niter]\n"); 51 51 return (FALSE); 52 52 } -
trunk/Ohana/src/opihi/cmd.data/histogram.c
r27817 r31160 61 61 opihi_int *V = xvec[0].elements.Int; 62 62 for (i = 0; i < xvec[0].Nelements; i++, V++) { 63 if (isnan(*V)) continue;64 63 bin = MIN (MAX (0, (*V - start) / delta), Nbins - 1); 65 64 OUT[bin]++; -
trunk/Ohana/src/opihi/cmd.data/limits.c
r30610 r31160 3 3 int limits (int argc, char **argv) { 4 4 5 int N, APPLY ;5 int N, APPLY, dX, dY; 6 6 int kapa; 7 7 char *name; … … 28 28 if ((N = get_argument (argc, argv, "-image"))) { 29 29 remove_argument (N, &argc, argv); 30 KapaGetImageRange (kapa, &graphmode.xmin, &graphmode.xmax, &graphmode.ymax, &graphmode.ymin );30 KapaGetImageRange (kapa, &graphmode.xmin, &graphmode.xmax, &graphmode.ymax, &graphmode.ymin, &dX, &dY); 31 31 32 32 set_variable ("XMIN", graphmode.xmin); … … 34 34 set_variable ("YMIN", graphmode.ymin); 35 35 set_variable ("YMAX", graphmode.ymax); 36 37 set_variable ("KAPA_XMIN", graphmode.xmin); 38 set_variable ("KAPA_XMAX", graphmode.xmax); 39 set_variable ("KAPA_YMIN", graphmode.ymin); 40 set_variable ("KAPA_YMAX", graphmode.ymax); 41 42 set_variable ("KAPA_XPIX", dX); 43 set_variable ("KAPA_YPIX", dY); 36 44 37 45 // if (!NoClear) KapaClearSections (kapa); -
trunk/Ohana/src/opihi/cmd.data/section.c
r29938 r31160 68 68 if ((argc == 1) && (action == NONE)) { 69 69 KapaGetSection (kapa, "*"); 70 gprint (GP_ERR, "USAGE: section name [x y dx dy] [options]\n");70 gprint (GP_ERR, "USAGE: section name [x y dx dy] or [options]\n"); 71 71 gprint (GP_ERR, "OPTIONS: -list : show properties of all sections\n"); 72 72 gprint (GP_ERR, " -up : move section up in display stack\n"); … … 76 76 gprint (GP_ERR, " -imtool (position) : set location of image zoom / status box\n"); 77 77 gprint (GP_ERR, " (position may be: -x, +x, -y, +y, none)\n"); 78 gprint (GP_ERR, " -image : define section upper-right corner so image fills the section\n"); 79 gprint (GP_ERR, " -bg (color) : set background color (see style -c help for color choices)\n"); 80 78 81 return (TRUE); 79 82 } 80 83 84 if ((argc != 2) && (action != NONE)) { 85 gprint (GP_ERR, "can only use dash options without numbers\n"); 86 return (FALSE); 87 } 88 81 89 if (argc == 2) { 82 90 /* select / show section */ -
trunk/Ohana/src/opihi/dvo/dbExtractImages.c
r30612 r31160 59 59 time_t t; 60 60 dbValue value; 61 off_t Nmosaic; 61 62 62 63 value.Flt = NAN; … … 236 237 value.Flt = image[N].fwhm_y / 25.0; 237 238 break; 239 240 case IMAGE_FWHM_MEDIAN: 241 if (!(Nmosaic = FindMosaicForImage (image, Nimage, N))) return value; 242 Nmosaic --; // XXX kind of a hack: FindMosaicForImage returns 0 or the mosaic seq number + 1 243 value.Flt = (image[Nmosaic].fwhm_x + image[Nmosaic].fwhm_y) / 50.0; 244 break; 245 case IMAGE_FWHM_MAJ_MEDIAN: 246 if (!(Nmosaic = FindMosaicForImage (image, Nimage, N))) return value; 247 Nmosaic --; // XXX kind of a hack: FindMosaicForImage returns 0 or the mosaic seq number + 1 248 value.Flt = image[Nmosaic].fwhm_x / 25.0; 249 break; 250 case IMAGE_FWHM_MIN_MEDIAN: 251 if (!(Nmosaic = FindMosaicForImage (image, Nimage, N))) return value; 252 Nmosaic --; // XXX kind of a hack: FindMosaicForImage returns 0 or the mosaic seq number + 1 253 value.Flt = image[Nmosaic].fwhm_y / 25.0; 254 break; 255 238 256 case IMAGE_TRATE: 239 257 value.Flt = image[N].trate / 10000.0; -
trunk/Ohana/src/opihi/dvo/dbFields.c
r30612 r31160 395 395 if (!strcasecmp (fieldName, "cerror" )) ESCAPE (IMAGE_CERROR, MAG_NONE, OPIHI_FLT); 396 396 397 if (!strcasecmp (fieldName, "FWHM" )) ESCAPE (IMAGE_FWHM, MAG_NONE, OPIHI_FLT); 398 if (!strcasecmp (fieldName, "FWHM_MAJ" )) ESCAPE (IMAGE_FWHM_MAJ, MAG_NONE, OPIHI_FLT); 399 if (!strcasecmp (fieldName, "FWHM_MIN" )) ESCAPE (IMAGE_FWHM_MIN, MAG_NONE, OPIHI_FLT); 397 if (!strcasecmp (fieldName, "FWHM" )) ESCAPE (IMAGE_FWHM, MAG_NONE, OPIHI_FLT); 398 if (!strcasecmp (fieldName, "FWHM_MAJ" )) ESCAPE (IMAGE_FWHM_MAJ, MAG_NONE, OPIHI_FLT); 399 if (!strcasecmp (fieldName, "FWHM_MIN" )) ESCAPE (IMAGE_FWHM_MIN, MAG_NONE, OPIHI_FLT); 400 if (!strcasecmp (fieldName, "FWHM_MAJOR" )) ESCAPE (IMAGE_FWHM_MAJ, MAG_NONE, OPIHI_FLT); 401 if (!strcasecmp (fieldName, "FWHM_MINOR" )) ESCAPE (IMAGE_FWHM_MIN, MAG_NONE, OPIHI_FLT); 402 403 if (!strcasecmp (fieldName, "FWHM_MEDIAN" )) ESCAPE (IMAGE_FWHM_MEDIAN, MAG_NONE, OPIHI_FLT); 404 if (!strcasecmp (fieldName, "FWHM_MAJ_MEDIAN")) ESCAPE (IMAGE_FWHM_MAJ_MEDIAN, MAG_NONE, OPIHI_FLT); 405 if (!strcasecmp (fieldName, "FWHM_MIN_MEDIAN")) ESCAPE (IMAGE_FWHM_MIN_MEDIAN, MAG_NONE, OPIHI_FLT); 406 if (!strcasecmp (fieldName, "FWHM_MAJOR_MEDIAN")) ESCAPE (IMAGE_FWHM_MAJ_MEDIAN, MAG_NONE, OPIHI_FLT); 407 if (!strcasecmp (fieldName, "FWHM_MINOR_MEDIAN")) ESCAPE (IMAGE_FWHM_MIN_MEDIAN, MAG_NONE, OPIHI_FLT); 408 400 409 if (!strcasecmp (fieldName, "trate" )) ESCAPE (IMAGE_TRATE, MAG_NONE, OPIHI_FLT); 401 410 -
trunk/Ohana/src/opihi/dvo/imextract.c
r30612 r31160 197 197 gprint (GP_ERR, " cerror : astrometric scatter\n"); 198 198 199 gprint (GP_ERR, " FWHM : mean fwhm of exposure\n"); 200 gprint (GP_ERR, " FWHM_MAJ : fwhm of major axis\n"); 201 gprint (GP_ERR, " FWHM_MIN : fwhm of minor axis\n"); 199 gprint (GP_ERR, " -- Note: the follow FWHM are from the PSF model --\n"); 200 gprint (GP_ERR, " FWHM : mean fwhm of chip\n"); 201 gprint (GP_ERR, " FWHM_MAJ : fwhm of chip (major axis)\n"); 202 gprint (GP_ERR, " FWHM_MIN : fwhm of chip (minor axis)\n"); 203 gprint (GP_ERR, " FWHM_MAJOR : fwhm of chip (major axis)\n"); 204 gprint (GP_ERR, " FWHM_MININ : fwhm of chip (minor axis)\n"); 205 206 gprint (GP_ERR, " FWHM_MEDIAN : median fwhm of exposure\n"); 207 gprint (GP_ERR, " FWHM_MAJ_MEDIAN : median fwhm of major axis\n"); 208 gprint (GP_ERR, " FWHM_MIN_MEDIAN : median fwhm of minor axis\n"); 209 gprint (GP_ERR, " FWHM_MAJOR_MEDIAN : median fwhm of major axis\n"); 210 gprint (GP_ERR, " FWHM_MININ_MEDIAN : median fwhm of minor axis\n"); 211 202 212 gprint (GP_ERR, " trate : tracking rate for TDI images\n"); 203 213 -
trunk/Ohana/src/opihi/dvo/skycoverage.c
r29540 r31160 5 5 int skycoverage (int argc, char **argv) { 6 6 7 int WITH_MOSAIC, SOLO_MOSAIC ;7 int WITH_MOSAIC, SOLO_MOSAIC, ShowDensity; 8 8 off_t i, Nimage; 9 9 int N, status, TimeSelect, ByName, xs, ys; … … 60 60 } 61 61 62 ShowDensity = FALSE; 63 if ((N = get_argument (argc, argv, "-density"))) { 64 remove_argument (N, &argc, argv); 65 ShowDensity = TRUE; 66 } 67 62 68 ByName = FALSE; 63 69 if ((N = get_argument (argc, argv, "-name"))) { … … 141 147 if (argc != 3) { 142 148 gprint (GP_ERR, "USAGE: skycoverage (buffer) (Npts)\n"); 143 gprint (GP_ERR, " options: [-scale pixscale] [-center ra dec] [-size Nx Nx] [-proj projection] [-time start range] [-trange start stop] [-name name] [-photcode name] [+mosaic] [-mosaic] \n");149 gprint (GP_ERR, " options: [-scale pixscale] [-center ra dec] [-size Nx Nx] [-proj projection] [-time start range] [-trange start stop] [-name name] [-photcode name] [+mosaic] [-mosaic] [-density]\n"); 144 150 gprint (GP_ERR, " (buffer) saves bitmapped image\n"); 145 151 gprint (GP_ERR, " (Npts) gives the number of test points per image in each dimension\n"); … … 148 154 gprint (GP_ERR, " -size (Nx) (Ny) : specifies the size of the image [360/scale, 180/scale]\n"); 149 155 gprint (GP_ERR, " -proj (projection) : specifies the projection choice [AIT]\n"); 156 gprint (GP_ERR, " -density : create image with relative density (else binary on/off)\n"); 150 157 gprint (GP_ERR, " note: we need 64800 / (pixscale)^2 pixels to represent the sky\n"); 151 158 return (FALSE); … … 186 193 187 194 V = (float *)buf[0].matrix.buffer; 188 bzero (V, Nx*Ny*sizeof(float));189 195 190 196 for (ys = 0; ys < Ny; ys++) { … … 194 200 status &= (r <= 360); 195 201 if (status) { 196 V[ys*Nx + xs] = 2; 202 V[ys*Nx + xs] = ShowDensity ? 0 : 2; 203 } else { 204 V[ys*Nx + xs] = ShowDensity ? -1 : 0; 197 205 } 198 206 } … … 249 257 xs = (int)Xs; 250 258 ys = (int)Ys; 251 V[ys*Nx + xs] = 1; 259 if (ShowDensity) { 260 V[ys*Nx + xs] += 1; 261 } else { 262 V[ys*Nx + xs] = 1; 263 } 252 264 } 253 265 } -
trunk/Ohana/src/opihi/include/dvoshell.h
r30614 r31160 179 179 IMAGE_TIME, 180 180 IMAGE_FWHM, 181 IMAGE_FWHM_MEDIAN, 181 182 IMAGE_EXPTIME, 182 183 IMAGE_NSTAR, … … 200 201 IMAGE_FWHM_MAJ, 201 202 IMAGE_FWHM_MIN, 203 IMAGE_FWHM_MAJ_MEDIAN, 204 IMAGE_FWHM_MIN_MEDIAN, 202 205 IMAGE_TRATE, 203 206 IMAGE_IMAGE_ID, -
trunk/Ohana/src/opihi/lib.data/graphtools.c
r20936 r31160 59 59 set_variable ("YMIN", graphmode[0].ymin); 60 60 set_variable ("YMAX", graphmode[0].ymax); 61 62 set_variable ("KAPA_XMIN", graphmode[0].xmin); 63 set_variable ("KAPA_XMAX", graphmode[0].xmax); 64 set_variable ("KAPA_YMIN", graphmode[0].ymin); 65 set_variable ("KAPA_YMAX", graphmode[0].ymax); 61 66 } 62 67 … … 95 100 SetGraph (graphmode); 96 101 102 set_variable ("KAPA_XMIN", graphmode[0].xmin); 103 set_variable ("KAPA_XMAX", graphmode[0].xmax); 104 set_variable ("KAPA_YMIN", graphmode[0].ymin); 105 set_variable ("KAPA_YMAX", graphmode[0].ymax); 106 97 107 set_variable ("XMIN", graphmode[0].xmin); 98 108 set_variable ("XMAX", graphmode[0].xmax); -
trunk/Ohana/src/opihi/lib.shell/VectorOps.c
r30614 r31160 218 218 } 219 219 free (vec[0].elements.Int); 220 vec[0].elements.Flt = vo;220 vec[0].elements.Flt = temp; 221 221 vec[0].type = OPIHI_FLT; 222 222 } else { … … 229 229 } 230 230 free (vec[0].elements.Flt); 231 vec[0].elements.Int = vo;231 vec[0].elements.Int = temp; 232 232 vec[0].type = OPIHI_INT; 233 233 } -
trunk/Ohana/src/relastro/include/relastro.h
r30616 r31160 89 89 char GSCFILE[256]; 90 90 char CATDIR[256]; 91 char *HIGH_SPEED_DIR; 91 92 char CATMODE[16]; /* raw, mef, split, mysql */ 92 93 char CATFORMAT[16]; /* internal, elixir, loneos, panstarrs */ … … 95 96 96 97 double SIGMA_LIM; 97 int SRC_MEAS_TOOFEW; //catalog objects wich fewer detections then this are ignored98 int SRC_MEAS_TOOFEW; //catalog objects wich fewer detections then this are ignored 98 99 double MIN_ERROR; 99 100 -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r30616 r31160 92 92 } 93 93 # endif 94 95 if (catalog[i].average[j].Nmeasure == 0) { 96 continue; 97 } 94 98 95 99 N = 0; -
trunk/Ohana/src/relastro/src/args.c
r30616 r31160 39 39 remove_argument (N, &argc, argv); 40 40 RADIUS = atof(argv[N]); 41 remove_argument (N, &argc, argv); 42 HIGH_SPEED_DIR = strcreate(argv[N]); 41 43 remove_argument (N, &argc, argv); 42 44 } -
trunk/Ohana/src/relastro/src/high_speed_objects.c
r29938 r31160 22 22 int zcode, zNsec, ycode, yNsec, jcode, jNsec, hcode, hNsec, kcode, kNsec, USNO_R, USNO_N, Nsecfilt; 23 23 char filename[1024]; 24 char outdir[]="/data/ipp022.0/ndeacon/hispeedzy";25 24 Noff = strlen(CATDIR); 26 sprintf (filename, "%s/%s", outdir, &catalog[0].filename[Noff]); 25 sprintf (filename, "%s/%s", HIGH_SPEED_DIR, &catalog[0].filename[Noff]); 26 printf("%s\n",filename); 27 27 dvo_catalog_init(&catalog1, TRUE); /*initialise new catalogue*/ 28 28 catalog1.filename = strcreate(filename); … … 121 121 foundA = FALSE; 122 122 for (j = 0; !foundA && (j < catalog[0].average[i].Nmeasure); j++, m++) { 123 if((catalog[0].average[i].R>204.1923)&&(catalog[0].average[i].R<204.1924)&&(catalog[0].average[i].D>11.376)&&(catalog[0].average[i].D<11.377))124 {125 printf("Hello");126 }127 123 128 124 if (MeasMatchesPhotcode(&catalog[0].measure[m], photcodesGroupA, NphotcodesGroupA)) { … … 135 131 foundB = FALSE; 136 132 for (j = 0; !foundB && (j < catalog[0].average[i].Nmeasure); j++, m++) { 137 138 if((catalog[0].average[i].R>204.192)&&(catalog[0].average[i].R<204.1925)&&(catalog[0].average[i].D>11.376)&&(catalog[0].average[i].D<11.377)) 139 { 140 printf("Hello"); 141 } 133 142 134 143 135 if (MeasMatchesPhotcode(&catalog[0].measure[m], photcodesGroupB, NphotcodesGroupB)) { … … 158 150 if (foundA && !foundB) { 159 151 // average-based tests: 160 161 if((catalog[0].average[i].R>204.1923)&&(catalog[0].average[i].R<204.1924)&&(catalog[0].average[i].D>11.376)&&(catalog[0].average[i].D<11.377)) 162 { 163 printf("Hello"); 164 } 152 165 153 166 154 valid = TRUE; … … 204 192 205 193 // average-based tests: 206 if((catalog[0].average[i].R>204.192)&&(catalog[0].average[i].R<204.193)&&(catalog[0].average[i].D>11.372)&&(catalog[0].average[i].D<11.373))207 {208 printf("Hello");209 }210 194 valid = TRUE; 211 195 valid &= ((catalog[0].average[i].flags & 0x01000000) == 0); … … 214 198 215 199 valid &= ((catalog[0].secfilt[i*Nsecfilt + jNsec].M < 1.0)||(isnan(catalog[0].secfilt[i*Nsecfilt + jNsec].M))); 216 valid &= ( catalog[0].secfilt[i*Nsecfilt + yNsec].Nused > 1);217 valid &= ( catalog[0].secfilt[i*Nsecfilt + yNsec].dM < 0.2);200 valid &= ((catalog[0].secfilt[i*Nsecfilt + yNsec].Nused > 1)||(catalog[0].secfilt[i*Nsecfilt + zNsec].Nused > 1)); 201 valid &= ((catalog[0].secfilt[i*Nsecfilt + yNsec].dM < 0.2)||(catalog[0].secfilt[i*Nsecfilt + zNsec].dM < 0.2)); 218 202 219 203 /*if ((catalog[0].secfilt[i*Nsecfilt + zNsec].M < 1.0) || (catalog[0].secfilt[i*Nsecfilt + zNsec].Nused == 1)) { -
trunk/Ohana/src/relastro/src/select_images.c
r30616 r31160 144 144 } 145 145 146 // this adds 1.3 sec for 3M images 146 147 if (!FindMosaicForImage (timage, Ntimage, i)) { 147 fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);148 fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i); 148 149 continue; 149 150 } … … 165 166 found = FALSE; 166 167 167 /* transform corners to ra,dec */168 /* transform corners to ra,dec -- costs ~3sec for 3M images (pikake) */ 168 169 double RminImage = 360.0; 169 170 double RmaxImage = 0.0; 170 171 double DminImage = +90.0; 171 172 double DmaxImage = -90.0; 172 // int leftside = FALSE;173 173 for (j = 0; j < 5; j++) { 174 174 XY_to_RD (&Ri[j], &Di[j], Xi[j], Yi[j], &timage[i].coords); … … 197 197 if (USE_BASIC_CHECK) goto found_it; 198 198 199 // RA(nStart) is guaranteed to be < RminImage: 199 // RA(nStart) is guaranteed to be < RminImage: -- costs 0.5sec for 3M images 200 200 nStart = getRegionStartByRA (RminImage, RmaxSky, skylist[0].Nregions); 201 201 … … 258 258 } 259 259 MARKTIME("finish image selection: %f sec\n", dtime); 260 261 if (VERBOSE) fprintf (stderr, "found "OFF_T_FMT" images\n", nimage);260 261 if (VERBOSE) fprintf (stderr, "found "OFF_T_FMT" images\n", nimage); 262 262 263 263 REALLOCATE (image, Image, MAX (nimage, 1)); -
trunk/Ohana/src/relphot/src/args.c
r30616 r31160 78 78 remove_argument (N, &argc, argv); 79 79 PLOTDELAY = 1e6*atof(argv[N]); 80 PLOTSTUFF = TRUE; // always turn on plotting if i request a plot delay 80 81 remove_argument (N, &argc, argv); 81 82 } -
trunk/Ohana/src/relphot/src/bcatalog.c
r30616 r31160 7 7 off_t NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm; 8 8 float mag; 9 int Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew ;9 int Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew, Ngalaxy, Npsfqf; 10 10 11 11 // XXX PhotNsec as a global is a bad idea; either get it from catalog … … 23 23 Nmeasure = Naverage = 0; 24 24 25 Ncode = Ntime = Ndophot = Nmag = Nsigma = Nimag = Nfew = 0;25 Ncode = Ntime = Ndophot = Nmag = Nsigma = Nimag = Nfew = Npsfqf = Ngalaxy = 0; 26 26 27 27 /* exclude stars not in range or with too few measurements */ … … 44 44 45 45 Nm = 0; 46 int nEXT = 0; 47 int nPSF = 0; 46 48 for (j = 0; j < catalog[0].average[i].Nmeasure; j++) { 47 49 … … 62 64 // XXX chnage this to select by bitflags 63 65 if (DophotSelect && ((catalog[0].measure[offset].photFlags >> 16) != DophotValue)) { Ndophot ++; continue; } 66 67 // skip garbage measurements 68 if (catalog[0].measure[offset].psfQual < 0.85) { Npsfqf ++; continue; } 69 70 // check for galaxies 71 if (!isnan(catalog[0].measure[offset].Map)) { 72 if (catalog[0].measure[offset].M - catalog[0].measure[offset].Map > 0.15) { 73 nEXT ++; 74 } else { 75 nPSF ++; 76 } 77 } 64 78 65 79 /* select measurements by mag limit */ … … 95 109 } 96 110 111 // skip object if it is likely to be a galaxy 112 if (nEXT >= nPSF) { 113 Nmeasure -= Nm; 114 Ngalaxy ++; 115 continue; 116 } 117 97 118 // XXXX test : what checks do I need to make elsewhere to avoid problems here? 98 119 if (Nm <= STAR_TOOFEW) { /* enough measurements in band? */ … … 121 142 fprintf (stderr, "using "OFF_T_FMT" stars ("OFF_T_FMT" measures) of "OFF_T_FMT" for catalog %s\n", 122 143 subcatalog[0].Naverage, subcatalog[0].Nmeasure, i, catalog[0].filename); 123 fprintf (stderr, "rejections: %d code, %d time, %d dophot, %d mag, %d sigma, %d imag, %d few \n",124 Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew );144 fprintf (stderr, "rejections: %d code, %d time, %d dophot, %d mag, %d sigma, %d imag, %d few, %d psfqf, %d galaxies\n", 145 Ncode, Ntime, Ndophot, Nmag, Nsigma, Nimag, Nfew, Npsfqf, Ngalaxy); 125 146 } 126 147 return (TRUE); -
trunk/Ohana/src/relphot/src/load_images.c
r30616 r31160 7 7 fprintf (stderr, MSG, __VA_ARGS__); } 8 8 9 // This function generates a subset of the images based on selections. Input db has already 10 // been loaded with the raw fits table data 9 11 SkyList *load_images (FITS_DB *db, char *regionName, SkyRegion *region, int RegionSelect) { 10 12 … … 32 34 } 33 35 34 // convert database table to internal structure 36 // convert database table to internal structure (binary to Image) 35 37 image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped); 36 38 if (!image) { … … 44 46 MARKTIME("selected images: %f sec\n", dtime); 45 47 48 // generate db->vtable from db->ftable based on the selection 49 // XXX does this simply duplicate the memory needlessly? we recreate these lines 50 // in reload_images. If we had saved the line numbers, we could avoid this 46 51 gfits_vtable_from_ftable (&db[0].ftable, &db[0].vtable, LineNumber, Nsubset); 47 52 MARKTIME("converted ftable to vtable: %f sec\n", dtime); 48 53 54 // save the subset of images in the static reference in ImageOps, set up indexes 49 55 initImages (subset, Nsubset); 50 56 MARKTIME("init images: %f sec\n", dtime); 51 57 58 // match chips to mosaics (if applicable) 52 59 initMosaics (subset, Nsubset); 53 60 MARKTIME("init mosaics: %f sec\n", dtime); -
trunk/Ohana/src/relphot/src/select_images.c
r30616 r31160 33 33 struct timeval start, stop; 34 34 35 double RmaxSkyRegion, RminSkyRegion, DminSkyRegion, DmaxSkyRegion, RmidSkyRegion;35 double RmaxSkyRegion, RminSkyRegion, RmidSkyRegion, DminSkyRegion, DmaxSkyRegion; 36 36 37 37 double *RmaxSky; … … 131 131 } 132 132 133 /* define image corners */ 134 Xi[0] = 0; Yi[0] = 0; 135 Xi[1] = timage[i].NX; Yi[1] = 0; 136 Xi[2] = timage[i].NX; Yi[2] = timage[i].NY; 137 Xi[3] = 0; Yi[3] = timage[i].NY; 138 Xi[4] = 0; Yi[4] = 0; 133 /* define image corners - note the DIS images (mosaic phu) are special */ 134 if (!strcmp(&timage[i].coords.ctype[4], "-DIS")) { 135 Xi[0] = -0.5*timage[i].NX; Yi[0] = -0.5*timage[i].NY; 136 Xi[1] = +0.5*timage[i].NX; Yi[1] = -0.5*timage[i].NY; 137 Xi[2] = +0.5*timage[i].NX; Yi[2] = +0.5*timage[i].NY; 138 Xi[3] = -0.5*timage[i].NX; Yi[3] = +0.5*timage[i].NY; 139 Xi[4] = -0.5*timage[i].NX; Yi[4] = -0.5*timage[i].NY; 140 } else { 141 Xi[0] = 0; Yi[0] = 0; 142 Xi[1] = timage[i].NX; Yi[1] = 0; 143 Xi[2] = timage[i].NX; Yi[2] = timage[i].NY; 144 Xi[3] = 0; Yi[3] = timage[i].NY; 145 Xi[4] = 0; Yi[4] = 0; 146 } 139 147 found = FALSE; 140 148 141 /* transform corners to ra,dec -- costs ~3sec for 3M images */149 /* transform corners to ra,dec -- costs ~3sec for 3M images (pikake) */ 142 150 double RminImage = 360.0; 143 151 double RmaxImage = 0.0; … … 147 155 XY_to_RD (&Ri[j], &Di[j], Xi[j], Yi[j], &timage[i].coords); 148 156 Ri[j] = ohana_normalize_angle_to_midpoint (Ri[j], RmidSkyRegion); 149 157 150 158 RminImage = MIN(RminImage, Ri[j]); 151 159 RmaxImage = MAX(RmaxImage, Ri[j]); … … 158 166 RminImage = tmp - 360.0; 159 167 } 160 168 161 169 // check that this image is even in range of the searched region 162 170 if (DminImage > DmaxSkyRegion) continue; … … 182 190 tcoords.crval2 = skycoords[m].Dc; 183 191 184 /* transform to ra,dec*/192 /* transform corner coords to X,Y in this catalog system */ 185 193 InRange = TRUE; 186 194 for (j = 0; (j < 5) && InRange; j++) { … … 352 360 return (Nlo); 353 361 } 354 355 off_t getRegionStopByRA (double R, double *Rref, off_t Nregions) {356 357 // use bisection to find the overlapping mosaic358 359 off_t Nlo, Nhi, N;360 361 // find the last mosaic before start362 Nlo = 0; Nhi = Nregions;363 while (Nhi - Nlo > 10) {364 N = 0.5*(Nlo + Nhi);365 if (Rref[N] < R) {366 Nlo = MAX(N, 0);367 } else {368 Nhi = MIN(N, Nregions);369 }370 }371 return (Nlo);372 } -
trunk/Ohana/src/tools/src/fhead.c
r27491 r31160 1 1 # include <ohana.h> 2 2 # include <gfitsio.h> 3 # include <regex.h> 3 4 4 5 int main (int argc, char **argv) { 5 6 6 int N, Ext end, Nextend, status;7 int N, Extnum, Nextend, status; 7 8 int i, j; 8 9 off_t nbytes; 9 10 Header head; 10 char *p; 11 char *p, *CCDKeyword, *Extname, extname[80]; 12 FILE *f; 13 off_t Nbytes; 14 regex_t preg; 11 15 12 Extend = FALSE; 16 CCDKeyword = NULL; 17 if ((N = get_argument (argc, argv, "-keyword"))) { 18 remove_argument (N, &argc, argv); 19 CCDKeyword = strcreate (argv[N]); 20 remove_argument (N, &argc, argv); 21 } 22 if (CCDKeyword == NULL) { 23 CCDKeyword = strcreate ("EXTNAME"); 24 } 25 26 Extnum = FALSE; 13 27 Nextend = 0; 14 28 if ((N = get_argument (argc, argv, "-x"))) { 15 Ext end= TRUE;29 Extnum = TRUE; 16 30 remove_argument (N, &argc, argv); 17 31 Nextend = atoi (argv[N]); 18 32 remove_argument (N, &argc, argv); 33 } 34 35 Extname = NULL; 36 if ((N = get_argument (argc, argv, "-n"))) { 37 remove_argument (N, &argc, argv); 38 Extname = strcreate (argv[N]); 39 remove_argument (N, &argc, argv); 40 regcomp (&preg, Extname, REG_EXTENDED); 19 41 } 20 42 … … 23 45 fprintf (stdout, "------> %s <------\n", argv[i]); 24 46 25 if (Extend) { 26 status = gfits_read_Xheader (argv[i], &head, Nextend); 27 } else { 28 status = gfits_read_header (argv[i], &head); 29 } 30 31 if (!status) continue; 32 33 for (j = 79; j < head.datasize; j+= 80) { 34 head.buffer[j] = 10; 47 status = FALSE; 48 if (!Extnum && !Extname) { 49 if (!gfits_read_header (argv[i], &head)) { 50 continue; 51 } 52 } 53 if (Extnum) { 54 if (!gfits_read_Xheader (argv[i], &head, Nextend)) { 55 continue; 56 } 57 } 58 if (Extname) { 59 /* keep reading headers until we reach the one we want */ 60 Nextend = 0; 61 f = fopen (argv[i], "r"); 62 if (f == NULL) continue; 63 while (gfits_fread_header (f, &head)) { 64 /* extract the EXTNAME (or other CCDKeyword) for this component (set to PHU for 0th component) */ 65 if (!gfits_scan (&head, CCDKeyword, "%s", 1, extname)) { 66 if (Nextend == 0) { 67 strcpy (extname, "PHU"); 68 } else { 69 strcpy (extname, "UNKNOWN"); 70 } 71 } 72 if (!regexec (&preg, extname, 0, NULL, 0)) { 73 goto done; 74 } 75 76 Nbytes = gfits_data_size (&head); 77 fseeko (f, Nbytes, SEEK_CUR); 78 Nextend ++; 79 } 80 // failed to find the desired header 81 continue; 35 82 } 36 83 37 p = gfits_header_field (&head, "END", 1);38 nbytes = p - head.buffer;39 fwrite (head.buffer, nbytes, 1, stdout);40 gfits_free_header (&head);84 done: 85 for (j = 79; j < head.datasize; j+= 80) { 86 head.buffer[j] = 10; 87 } 41 88 89 p = gfits_header_field (&head, "END", 1); 90 nbytes = p - head.buffer; 91 fwrite (head.buffer, nbytes, 1, stdout); 92 gfits_free_header (&head); 93 94 } 95 exit (0); 42 96 } 43 exit (0);44 } -
trunk/Ohana/src/tools/src/ftable.c
r28241 r31160 3 3 # include "inttypes.h" 4 4 5 char *print_table_row (char *row, Header *header);5 int print_table_rows (FTable *table, int start, int Nrows); 6 6 FILE *load_extension (char *file, int Nextend, char *Extname, Header *header); 7 7 void print_column (FTable *table, int Column, char *Colname); … … 13 13 int main (int argc, char **argv) { 14 14 15 off_t i,Nx, Ny, Nbytes, Nread, Row;15 off_t Nx, Ny, Nbytes, Nread, Row; 16 16 int N, Nextend, Column, ListExtname, Layout; 17 char *Extname, *Colname, *line,ttype[80];17 char *Extname, *Colname, ttype[80]; 18 18 FTable table; 19 19 Header header; … … 104 104 /* print a row */ 105 105 if (Row) { 106 line = print_table_row (&table.buffer[Nx*Row], table.header);107 fprintf (stdout, "%s\n", line);108 free (line);106 if (!print_table_rows (&table, Row, 1)) { 107 fprintf (stderr, "failed to print row\n"); 108 } 109 109 exit (0); 110 110 } 111 111 112 112 /* print complete table */ 113 for (i = 0; i < Ny; i++) { 114 line = print_table_row (&table.buffer[Nx*i], table.header); 115 fprintf (stdout, "%s\n", line); 116 free (line); 113 if (!print_table_rows (&table, 0, Ny)) { 114 fprintf (stderr, "failed to print table\n"); 117 115 } 118 116 exit (0); 119 117 } 120 118 121 /* print an ASCII table to a row with single spaces separating value */ 122 char *print_table_row (char *row, Header *header) { 119 # define SWAP_BYTE(BYTE) \ 120 tmp = BYTE[0]; BYTE[0] = BYTE[1]; BYTE[1] = tmp; 121 # define SWAP_WORD(BYTE) \ 122 tmp = BYTE[0]; BYTE[0] = BYTE[3]; BYTE[3] = tmp; \ 123 tmp = BYTE[1]; BYTE[1] = BYTE[2]; BYTE[2] = tmp; 124 # define SWAP_DBLE(BYTE) \ 125 tmp = BYTE[0]; BYTE[0] = BYTE[7]; BYTE[7] = tmp; \ 126 tmp = BYTE[1]; BYTE[1] = BYTE[6]; BYTE[6] = tmp; \ 127 tmp = BYTE[2]; BYTE[2] = BYTE[5]; BYTE[5] = tmp; \ 128 tmp = BYTE[3]; BYTE[3] = BYTE[4]; BYTE[4] = tmp; 129 130 /* print Nrows of the given table starting at row 'start' */ 131 int print_table_rows (FTable *table, int start, int Nrows) { 123 132 124 off_t Nx; 125 int i, j, Nfields, Nbytes, Nvals, Oout, Oin; 126 char field[16], type[16], format[16], *line; 127 128 gfits_scan (header, "NAXIS1", OFF_T_FMT, 1, &Nx); 129 gfits_scan (header, "TFIELDS", "%d", 1, &Nfields); 133 off_t Nx, Ny; 134 int n, i, j, Nfields, *Nbyte, *Nvals, Oout, Oin, Nv, Nb, byte, status; 135 char field[16], **types, format[16], type[80], *line, *row, tmp; 136 double *Tzero, *Tscal; 137 138 gfits_scan (table->header, "NAXIS1", OFF_T_FMT, 1, &Nx); 139 gfits_scan (table->header, "NAXIS2", OFF_T_FMT, 1, &Ny); 140 gfits_scan (table->header, "TFIELDS", "%d", 1, &Nfields); 141 142 if (start < 0) return FALSE; 143 if (start >= Ny) return FALSE; 144 if (Nrows < 0) return FALSE; 145 if (start + Nrows > Ny) return FALSE; 130 146 131 147 /* assume we have one space per byte column */ 132 ALLOCATE (line, char, 2*Nx + 1); 133 134 Oin = Oout = 0; 135 for (i = 1; i <= Nfields; i++) { 136 sprintf (field, "TFORM%d", i); 137 gfits_scan (header, field, "%s", 1, format); /* get field format */ 138 gfits_table_format (format, type, &Nvals, &Nbytes); /* convert to c-style */ 139 memcpy (&line[Oout], &row[Oin], Nvals*Nbytes); 140 for (j = 0; j < Nvals*Nbytes; j++) if (line[Oout+j] == 0) line[Oout+j] = ' '; 141 line[Oout+Nvals*Nbytes] = ' '; 142 Oout += Nvals*Nbytes + 1; 143 Oin += Nvals*Nbytes; 144 } 145 146 return (line); 148 ALLOCATE (line, char, MAX(2*Nx+1,512)); 149 150 ALLOCATE (types, char *, Nfields); 151 ALLOCATE (Nvals, int, Nfields); 152 ALLOCATE (Nbyte, int, Nfields); 153 ALLOCATE (Tzero, double, Nfields); 154 ALLOCATE (Tscal, double, Nfields); 155 156 // determine the layout of the columns 157 for (i = 0; i < Nfields; i++) { 158 sprintf (field, "TFORM%d", i+1); 159 gfits_scan (table->header, field, "%s", 1, format); /* get field format */ 160 161 if (Binary) { 162 gfits_bintable_format (format, type, &Nv, &Nb); /* convert to c-style */ 163 164 sprintf (field, "TZERO%d", i+1); 165 status = gfits_scan (table[0].header, field, "%lf", 1, &Tzero[i]); /* get field format */ 166 if (!status) Tzero[i] = 0.0; 167 168 sprintf (field, "TSCAL%d", i+1); 169 status = gfits_scan (table[0].header, field, "%lf", 1, &Tscal[i]); /* get field format */ 170 if (!status) Tscal[i] = 1.0; 171 } else { 172 gfits_table_format (format, type, &Nv, &Nb); /* convert to c-style */ 173 } 174 175 types[i] = strcreate (type); 176 Nvals[i] = Nv; 177 Nbyte[i] = Nb; 178 } 179 180 for (n = start; n < start + Nrows; n++) { 181 182 row = &table->buffer[Nx*n]; 183 184 if (Binary) { 185 byte = 0; // counter for byte element of this row 186 for (i = 0; i < Nfields; i++) { 187 int found = FALSE; 188 if (!strcmp (types[i], "char")) { 189 memcpy (line, &row[byte], Nvals[i]*Nbyte[i]); 190 fprintf (stdout, "%s ", line); 191 found = TRUE; 192 } else { 193 for (j = 0; j < Nvals[i]; j++) { 194 memcpy (line, &row[byte + Nbyte[i]*j], Nbyte[i]); 195 if (!strcmp (types[i], "int")) { 196 # ifdef BYTE_SWAP 197 SWAP_WORD (line); 198 # endif 199 fprintf (stdout, "%d ", (int)(*(int *)line * Tscal[i] + Tzero[i])); 200 found = TRUE; 201 } 202 if (!strcmp (types[i], "short")) { 203 # ifdef BYTE_SWAP 204 SWAP_BYTE (line); 205 # endif 206 fprintf (stdout, "%d ", (int)(*(short *)line * Tscal[i] + Tzero[i])); 207 found = TRUE; 208 } 209 if (!strcmp (types[i], "int64_t")) { 210 # ifdef BYTE_SWAP 211 SWAP_DBLE (line); 212 # endif 213 fprintf (stdout, "%" PRId64" ", (int64_t)(*(int64_t*)line * Tscal[i] + Tzero[i])); 214 found = TRUE; 215 } 216 if (!strcmp (types[i], "float")) { 217 # ifdef BYTE_SWAP 218 SWAP_WORD (line); 219 # endif 220 fprintf (stdout, "%e ", (*(float *)line * Tscal[i] + Tzero[i])); 221 found = TRUE; 222 } 223 if (!strcmp (types[i], "double")) { 224 # ifdef BYTE_SWAP 225 SWAP_DBLE (line); 226 # endif 227 fprintf (stdout, "%e ", (*(double *)line * Tscal[i] + Tzero[i])); 228 found = TRUE; 229 } 230 } 231 } 232 byte += Nvals[i]*Nbyte[i]; 233 if (!found) { 234 fprintf (stderr, "failed to find format for %d : %s\n", i, types[i]); 235 } 236 } 237 } else { 238 Oout = 0; 239 Oin = 0; 240 for (i = 0; i < Nfields; i++) { 241 memcpy (&line[Oout], &row[Oin], Nvals[i]*Nbyte[i]); 242 for (j = 0; j < Nvals[i]*Nbyte[i]; j++) if (line[Oout+j] == 0) line[Oout+j] = ' '; 243 line[Oout+Nvals[i]*Nbyte[i]] = ' '; 244 Oout += Nvals[i]*Nbyte[i] + 1; 245 Oin += Nvals[i]*Nbyte[i]; 246 } 247 fprintf (stdout, "%s ", line); 248 } 249 fprintf (stdout, "\n"); 250 } 251 return (TRUE); 147 252 } 148 253 … … 325 430 sprintf (field, "TFORM%d", i); 326 431 gfits_scan (header, field, "%s", 1, format); 327 if (Binary) 432 if (Binary) { 433 gfits_bintable_format (format, type, &Nv, &Nb); 434 } else { 328 435 gfits_table_format (format, type, &Nv, &Nb); 329 else 330 gfits_bintable_format (format, type, &Nv, &Nb); 436 } 331 437 Nstart += Nv*Nb; 332 438 } … … 334 440 sprintf (field, "TFORM%d", Column); 335 441 gfits_scan (header, field, "%s", 1, format); 336 if (Binary) 442 if (Binary) { 337 443 gfits_bintable_format (format, type, &Nv, &Nb); /* convert to c-style */ 338 else444 } else { 339 445 gfits_table_format (format, type, &Nv, &Nb); /* convert to c-style */ 340 446 } 341 447 ALLOCATE (line, char, Nv*Nb + 1); 342 448 -
trunk/Ohana/src/uniphot/Makefile
r27790 r31160 1 default: uniphot setphot 1 default: uniphot setphot setfwhm 2 2 help: 3 @echo "make options: uniphot setphot default help install default (uniphot setphot)"3 @echo "make options: uniphot setphot setfwhm default help install default (uniphot setphot setfwhm)" 4 4 5 5 include ../../Makefile.System … … 19 19 uniphot: $(BIN)/uniphot.$(ARCH) 20 20 setphot: $(BIN)/setphot.$(ARCH) 21 install: $(DESTBIN)/uniphot $(DESTBIN)/setphot 21 setfwhm: $(BIN)/setfwhm.$(ARCH) 22 install: $(DESTBIN)/uniphot $(DESTBIN)/setphot $(DESTBIN)/setfwhm 22 23 23 24 UNIPHOT = \ … … 34 35 $(SRC)/update.$(ARCH).o \ 35 36 $(SRC)/update_catalog.$(ARCH).o \ 37 $(SRC)/convert.$(ARCH).o \ 36 38 $(SRC)/SetSignals.$(ARCH).o \ 37 39 $(SRC)/Shutdown.$(ARCH).o \ … … 56 58 $(SETPHOT): $(INC)/uniphot.h 57 59 $(BIN)/setphot.$(ARCH): $(SETPHOT) 60 61 SETFWHM = \ 62 $(SRC)/setfwhm.$(ARCH).o \ 63 $(SRC)/initialize.$(ARCH).o \ 64 $(SRC)/ConfigInit.$(ARCH).o \ 65 $(SRC)/args.$(ARCH).o \ 66 $(SRC)/liststats.$(ARCH).o \ 67 $(SRC)/load_fwhm_table.$(ARCH).o \ 68 $(SRC)/load_images.$(ARCH).o \ 69 $(SRC)/match_fwhm_to_images.$(ARCH).o \ 70 $(SRC)/SetSignals.$(ARCH).o \ 71 $(SRC)/Shutdown.$(ARCH).o 72 73 $(SETFWHM): $(INC)/uniphot.h 74 $(BIN)/setfwhm.$(ARCH): $(SETFWHM) -
trunk/Ohana/src/uniphot/include/uniphot.h
r28717 r31160 29 29 30 30 typedef struct { 31 char tstart[64]; 32 char tstop[64]; 31 33 char label[64]; 32 34 float M; … … 45 47 int found; 46 48 } ZptTable; 49 50 typedef struct { 51 float fwhm_major; 52 float fwhm_minor; 53 e_time time; 54 int found; 55 unsigned short photcode; 56 } FWHMTable; 47 57 48 58 /* global variables set in parameter file */ … … 124 134 int update_setphot PROTO((Image *image, off_t Nimage)); 125 135 void update_catalog_setphot PROTO((Catalog *catalog, Image *image, off_t *index, off_t Nimage)); 136 137 /*** time/coord conversion functions not supplied by libohana ***/ 138 time_t TimeRef PROTO((double time, time_t TimeReference, int TimeFormat)); 139 double TimeValue PROTO((time_t time, time_t TimeReference, int TimeFormat)); 140 141 int hh_hms PROTO((double hh, int *hr, int *mn, double *sc)); 142 int dd_dms PROTO((double dd, int *dg, int *mn, double *sc)); 143 int hms_format PROTO((char *line, double value)); 144 int dms_format PROTO((char *line, double value)); 145 int hh_hm PROTO((double hh, int *hr, double *mn)); 146 int day_to_sec PROTO((char *string, time_t *second)); 147 int hms_to_sec PROTO((char *string, time_t *second)); 148 char *ohana_sec_to_hms PROTO((time_t second)); 149 char *ohana_sec_to_day PROTO((time_t second)); 150 151 char *meade_deg_to_str PROTO((double deg)); 152 char *meade_ra_to_str PROTO((double deg)); 153 char *meade_dec_to_str PROTO((double deg)); 154 char *strptime PROTO((const char *s, const char *format, struct tm *tm)); 155 time_t GetTimeReference PROTO((char *reference)); 156 int GetTimeUnits PROTO((char *name)); 157 158 void initialize_setfwhm PROTO((int argc, char **argv)); 159 int args_setfwhm PROTO((int argc, char **argv)); 160 FWHMTable *load_fwhm_table PROTO((char *filename, int *nfwhm)); 161 int match_fwhm_to_images PROTO((Image *image, off_t Nimage, FWHMTable *fwhm, int Nfwhm)); 162 -
trunk/Ohana/src/uniphot/src/args.c
r27790 r31160 96 96 } 97 97 98 int args_setfwhm (int argc, char **argv) { 99 100 int N; 101 102 VERBOSE = FALSE; 103 if ((N = get_argument (argc, argv, "-v"))) { 104 VERBOSE = TRUE; 105 remove_argument (N, &argc, argv); 106 } 107 108 UPDATE = FALSE; 109 if ((N = get_argument (argc, argv, "-update"))) { 110 remove_argument (N, &argc, argv); 111 UPDATE = TRUE; 112 } 113 114 if (argc != 2) { 115 fprintf (stderr, "ERROR: USAGE: setfwhm (fwhmfile) [options]\n"); 116 exit (2); 117 } 118 119 return (TRUE); 120 } 121 -
trunk/Ohana/src/uniphot/src/dumpresult.c
r4797 r31160 17 17 Mgrp = tgrp[0].M; 18 18 fprintf (f, "%7.4f %7.4f %7.4f %7.4f %10.6f %10.6f %f %s\n", 19 0.001*Mcal, 0.001*Mgrp, 0.001*Mset, 0.001*sgroup[i].image[j][0].dMcal,19 Mcal, Mgrp, Mset, sgroup[i].image[j][0].dMcal, 20 20 sgroup[i].image[j][0].coords.crval1, sgroup[i].image[j][0].coords.crval2, (sgroup[i].image[j][0].tzero-915148800)/86400.0, tgrp[0].label); 21 21 } -
trunk/Ohana/src/uniphot/src/find_image_sgroups.c
r29001 r31160 3 3 Group *find_image_sgroups (FITS_DB *db, ImageLink **Imlink, int *Nsgroup) { 4 4 5 off_t i, Nimage;6 int j,Ngroup, Nentry, NENTRY;5 off_t i, j, Nimage; 6 int Ngroup, Nentry, NENTRY; 7 7 double r, d, x, y, radius; 8 8 Group *group; … … 27 27 ALLOCATE (group, Group, Nimage); 28 28 29 if (VERBOSE) fprintf (stderr, "finding images\n"); 30 BuildChipMatch (image, Nimage); 31 // MARKTIME("build chip match: %f sec\n", dtime); 32 29 33 /* set imlink.sgroups = NULL as a marker */ 30 34 for (i = 0; i < Nimage; i++) imlink[i].sgroup = NULL; … … 34 38 if (image[i].flags & ID_IMAGE_PHOTOM_NOCAL) continue; 35 39 40 // XXX optionally, we should be able to use ONLY the DIS or NOT the DIS images 41 // NOCAL above is used to mark images which do not match the photcode (including the DIS) 42 // if (!strcmp(&image[i].coords.ctype[4], "-DIS")) continue; 43 44 // this adds 1.3 sec for 3M images 45 if (!FindMosaicForImage (image, Nimage, i)) { 46 fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i); 47 continue; 48 } 49 50 /* define image center - note the DIS images (mosaic phu) are special */ 51 if (!strcmp(&image[i].coords.ctype[4], "-DIS")) { 52 XY_to_RD (&r, &d, 0.0, 0.0, &image[i].coords); 53 } else { 54 XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NX, &image[i].coords); 55 } 56 36 57 /* new sgroup, set ref coords */ 37 XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NX, &image[i].coords);38 58 coords.crval1 = r; 39 59 coords.crval2 = d; … … 59 79 if (image[j].flags & ID_IMAGE_PHOTOM_NOCAL) continue; 60 80 if (imlink[j].sgroup != NULL) continue; 81 // XXX optionally, we should be able to use ONLY the DIS or NOT the DIS images 82 // NOCAL above is used to mark images which do not match the photcode (including the DIS) 83 // if (!strcmp(&image[j].coords.ctype[4], "-DIS")) continue; 84 85 // this adds 1.3 sec for 3M images 86 if (!FindMosaicForImage (image, Nimage, j)) { 87 fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", j); 88 continue; 89 } 61 90 62 91 /* project image center to local coords, check radius */ 63 XY_to_RD (&r, &d, 0.5*image[j].NX, 0.5*image[j].NX, &image[j].coords); 92 if (!strcmp(&image[j].coords.ctype[4], "-DIS")) { 93 XY_to_RD (&r, &d, 0.0, 0.0, &image[j].coords); 94 } else { 95 XY_to_RD (&r, &d, 0.5*image[j].NX, 0.5*image[j].NX, &image[j].coords); 96 } 64 97 if (!RD_to_XY (&x, &y, r, d, &coords)) continue; 98 65 99 /* RD_to_XY returns FALSE if opposite hemispheres */ 66 100 radius = hypot (x, y); -
trunk/Ohana/src/uniphot/src/find_image_tgroups.c
r29001 r31160 5 5 char *start, *stop; 6 6 int j, Ngroup, NGROUP, Nentry, NENTRY; 7 off_t i, Nimage ;7 off_t i, Nimage, Ntime; 8 8 unsigned int *time, *tmin, *tmax; 9 9 Group *group; … … 21 21 /* sort time list (use only valid images?) */ 22 22 ALLOCATE (time, unsigned int, Nimage); 23 Ntime = 0; 23 24 for (i = 0; i < Nimage; i++) { 24 time[i] = image[i].tzero; 25 if (image[i].flags & ID_IMAGE_PHOTOM_NOCAL) continue; 26 if (!strcmp(&image[i].coords.ctype[4], "-DIS")) continue; 27 time[Ntime] = image[i].tzero; 28 Ntime ++; 25 29 } 26 sort_time (time, N image);30 sort_time (time, Ntime); 27 31 28 32 /* find groups with dt < TRANGE */ … … 34 38 35 39 /* generate tgroups */ 36 for (i = 0; i < N image - 1; i++) {40 for (i = 0; i < Ntime - 1; i++) { 37 41 if (time[i+1] - time[i] < TRANGE) continue; 38 42 … … 47 51 tmin[Ngroup] = time[i + 1]; 48 52 } 49 tmax[Ngroup] = time[N image - 1];53 tmax[Ngroup] = time[Ntime - 1]; 50 54 Ngroup ++; 51 55 ALLOCATE (group, Group, Ngroup); … … 63 67 stop = ohana_sec_to_date (tmax[i]); 64 68 snprintf (group[i].label, 64, "%s - %s", start, stop); 69 strcpy(group[i].tstart, start); 70 strcpy(group[i].tstop, stop); 65 71 free (start); 66 72 free (stop); … … 70 76 if (image[j].tzero > tmax[i]) continue; 71 77 if (image[j].flags & ID_IMAGE_PHOTOM_NOCAL) continue; 78 if (!strcmp(&image[j].coords.ctype[4], "-DIS")) continue; 72 79 73 80 group[i].image[Nentry] = &image[j]; -
trunk/Ohana/src/uniphot/src/fit_groups.c
r21508 r31160 29 29 tgroup[i].Ngood = stats.Nmeas; 30 30 31 // fprintf (stderr, "tgroup %d : %f +/- %f : %d stars\n", i, stats.mean, stats.sigma, stats.Nmeas); 32 31 33 initstats ("MEAN"); 32 34 liststats (mlist, dlist, Nlist, &stats); … … 67 69 sgroup[i].Ngood = stats.Nmeas; 68 70 71 // fprintf (stderr, "sgroup %d : %f +/- %f : %d stars\n", i, stats.mean, stats.sigma, stats.Nmeas); 72 69 73 initstats ("MEAN"); 70 74 liststats (mlist, dlist, Nlist, &stats); -
trunk/Ohana/src/uniphot/src/initialize.c
r29001 r31160 28 28 } 29 29 30 void initialize_setfwhm (int argc, char **argv) { 31 32 /* are these set correctly? */ 33 ConfigInit (&argc, argv); 34 args_setfwhm (argc, argv); 35 } 36 -
trunk/Ohana/src/uniphot/src/subset_images.c
r29001 r31160 3 3 int subset_images (FITS_DB *db) { 4 4 5 off_t i, Nimage , Nkeep, *keep;5 off_t i, Nimage; 6 6 int equiv; 7 7 Image *image; 8 8 9 / * use a vtable to keep the images to be calibrated */9 // convert from the binary I/O format to the internal structure (Image) 10 10 image = gfits_table_get_Image (&db[0].ftable, &Nimage, &db[0].swapped); 11 11 if (!image) { … … 13 13 exit (2); 14 14 } 15 16 Nkeep = 0;17 ALLOCATE (keep, off_t, Nimage);18 15 19 16 /* mark images to be calibrated */ … … 32 29 } 33 30 image[i].flags &= ~ID_IMAGE_PHOTOM_NOCAL; 34 keep[Nkeep] = i;35 Nkeep ++;36 31 } 37 38 gfits_vtable_from_ftable (&db[0].ftable, &db[0].vtable, keep, Nkeep);39 32 return (TRUE); 40 33 } -
trunk/Ohana/src/uniphot/src/uniphot.c
r27790 r31160 1 1 # include "uniphot.h" 2 3 static char *timeref = "2000/01/01,00:00:00"; 4 static char *timeunit = "days"; 2 5 3 6 int main (int argc, char **argv) { … … 8 11 FITS_DB db; 9 12 13 // set up time format stuff 14 time_t TimeReference = GetTimeReference (timeref); 15 int TimeUnits = GetTimeUnits (timeunit); 16 10 17 /* get configuration info, args, lockfile */ 11 18 initialize_uniphot (argc, argv); … … 15 22 if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename); 16 23 if (db.dbstate == LCK_EMPTY) Shutdown ("ERROR: No images in catalog %s (1)", db.filename); 17 if (!UPDATE) dvo_image_unlock (&db);18 24 19 25 /* load images */ 20 26 load_images_uniphot (&db); 27 if (!UPDATE) dvo_image_unlock (&db); 21 28 22 29 /* filter image list by selection */ … … 38 45 fprintf (stdout, "# NLOOP: %d\n", NLOOP); 39 46 fprintf (stdout, "# time groups : %d\n", Ntgroup); 47 fprintf (stdout, "# TIMEREF : %s\n", timeref); 48 fprintf (stdout, "# TIMEFORMAT : %s\n", timeunit); 40 49 for (i = 0; i < Ntgroup; i++) { 41 fprintf (stdout, "%s %5d %5d %7.4f %7.4f %7.4f\n", tgroup[i].label, 42 tgroup[i].Nimage, tgroup[i].Ngood, 0.001*tgroup[i].M, 0.001*tgroup[i].dM, 0.001*tgroup[i].dMsub); 50 51 double tstart = NAN; 52 double tstop = NAN; 53 54 time_t time; 55 if (ohana_str_to_time (tgroup[i].tstart, &time)) { 56 tstart = TimeValue (time, TimeReference, TimeUnits); 57 } 58 if (ohana_str_to_time (tgroup[i].tstop, &time)) { 59 tstop = TimeValue (time, TimeReference, TimeUnits); 60 } 61 62 fprintf (stdout, "%s : %12.6f %12.6f : %5d %5d %7.4f %7.4f %7.4f\n", 63 tgroup[i].label, tstart, tstop, 64 tgroup[i].Nimage, tgroup[i].Ngood, 65 tgroup[i].M, tgroup[i].dM, tgroup[i].dMsub); 43 66 } 44 67 fprintf (stdout, "\n"); … … 47 70 for (i = 0; i < Nsgroup; i++) { 48 71 fprintf (stdout, "%s %5d %5d %7.4f %7.4f %7.4f\n", sgroup[i].label, 49 sgroup[i].Nimage, sgroup[i].Ngood, 0.001*sgroup[i].M, 0.001*sgroup[i].dM, 0.001*sgroup[i].dMsub);72 sgroup[i].Nimage, sgroup[i].Ngood, sgroup[i].M, sgroup[i].dM, sgroup[i].dMsub); 50 73 } 51 74 if (!UPDATE) exit (0); -
trunk/Ohana/src/uniphot/src/update.c
r29001 r31160 4 4 void update (FITS_DB *db, Group *sgroup, int Nsgroup) { 5 5 6 off_t i, Nimage ;6 off_t i, Nimage, Nkeep, *keep; 7 7 int j, status, Nmin; 8 8 char line[256]; … … 19 19 } 20 20 21 /* clear the NOCAL flags */ 21 // create a subset list so we can make a vtable 22 Nkeep = 0; 23 ALLOCATE (keep, off_t, Nimage); 24 25 // identify the images used and clear the NOCAL flags on the rest 22 26 for (i = 0; i < Nimage; i++) { 23 image[i].flags &= ~ID_IMAGE_PHOTOM_NOCAL; 27 if (image[i].flags & ID_IMAGE_PHOTOM_NOCAL) { 28 image[i].flags &= ~ID_IMAGE_PHOTOM_NOCAL; 29 continue; 30 } 31 keep[Nkeep] = i; 32 Nkeep ++; 24 33 } 25 34 … … 31 40 } 32 41 33 /** write image table **/ 42 // save the rows in the image table which were used in this analysis 43 gfits_vtable_from_ftable (&db[0].ftable, &db[0].vtable, keep, Nkeep); 44 45 // write image table 34 46 dvo_image_update (db, VERBOSE); 47 48 // XXX need to fix the update for the catalog (or make it optional) 49 return; 35 50 36 51 // XXX this process uses the existence of the file to perform the update
Note:
See TracChangeset
for help on using the changeset viewer.
