Changeset 36833
- Timestamp:
- Jun 7, 2014, 6:33:11 AM (12 years ago)
- Location:
- trunk/Ohana/src
- Files:
-
- 68 edited
- 24 copied
-
addstar/src/ReadImageHeader.c (modified) (1 diff)
-
checkastro (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro )
-
checkastro/Makefile (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/Makefile )
-
checkastro/bin (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/bin )
-
checkastro/doc (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/doc )
-
checkastro/include (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/include )
-
checkastro/include/checkastro.h (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/include/checkastro.h )
-
checkastro/src (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src )
-
checkastro/src/BrightCatalog.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/BrightCatalog.c )
-
checkastro/src/ConfigInit.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/ConfigInit.c )
-
checkastro/src/ImageOps.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/ImageOps.c )
-
checkastro/src/MeasFilterTest.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/MeasFilterTest.c )
-
checkastro/src/SetSignals.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/SetSignals.c )
-
checkastro/src/Shutdown.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/Shutdown.c )
-
checkastro/src/args.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/args.c )
-
checkastro/src/bcatalog.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/bcatalog.c )
-
checkastro/src/checkastro.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/checkastro.c )
-
checkastro/src/checkastro_client.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/checkastro_client.c )
-
checkastro/src/checkastro_images.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/checkastro_images.c )
-
checkastro/src/initialize.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/initialize.c )
-
checkastro/src/load_catalogs.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/load_catalogs.c )
-
checkastro/src/load_images.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/load_images.c )
-
checkastro/src/select_images.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/checkastro/src/select_images.c )
-
delstar/include/delstar.h (modified) (2 diffs)
-
delstar/src/args.c (modified) (2 diffs)
-
delstar/src/delete_duplicate_images.c (modified) (3 diffs)
-
dvomerge/src/dvo_image_merge_dbs.c (modified) (1 diff)
-
dvomerge/src/dvomergeImageIDs.c (modified) (2 diffs)
-
dvomerge/src/dvorepairCPT.c (modified) (1 diff)
-
dvomerge/src/dvorepairDeleteImageList.c (modified) (1 diff)
-
dvomerge/src/dvorepairFixTables.c (modified) (1 diff)
-
dvopsps/src/insert_objects_dvopsps_catalog.c (modified) (1 diff)
-
kapa2/src/CheckPipe.c (modified) (2 diffs)
-
kapa2/src/EventLoop.c (modified) (3 diffs)
-
kapa2/src/FlushDisplay.c (modified) (1 diff)
-
kapa2/src/Refresh.c (modified) (1 diff)
-
libautocode/def/average-ps1-dev-2.d (modified) (1 diff)
-
libautocode/def/average-ps1-v1.d (modified) (1 diff)
-
libautocode/def/average-ps1-v2.d (modified) (1 diff)
-
libautocode/def/average-ps1-v3.d (modified) (1 diff)
-
libautocode/def/average-ps1-v4.d (modified) (1 diff)
-
libautocode/def/average.d (modified) (1 diff)
-
libautocode/def/image-ps1-v2.d (modified) (1 diff)
-
libautocode/def/image-ps1-v3.d (modified) (1 diff)
-
libautocode/def/image-ps1-v4.d (modified) (1 diff)
-
libautocode/def/image.d (modified) (1 diff)
-
libdvo/include/dvo.h (modified) (2 diffs)
-
libdvo/include/dvodb.h (modified) (2 diffs)
-
libdvo/src/dbExtractAverages.c (modified) (1 diff)
-
libdvo/src/dbExtractImages.c (modified) (7 diffs)
-
libdvo/src/dbFields.c (modified) (2 diffs)
-
libdvo/src/dvo_catalog.c (modified) (1 diff)
-
libdvo/src/dvo_convert_PS1_DEV_2.c (modified) (2 diffs)
-
libdvo/src/dvo_convert_PS1_V1.c (modified) (2 diffs)
-
libdvo/src/dvo_convert_PS1_V2.c (modified) (4 diffs)
-
libdvo/src/dvo_convert_PS1_V3.c (modified) (4 diffs)
-
libdvo/src/dvo_convert_PS1_V4.c (modified) (5 diffs)
-
libdvo/src/skyregion_io.c (modified) (1 diff)
-
libkapa/src/KapaOpen.c (modified) (3 diffs)
-
libkapa/src/KiiPicture.c (modified) (5 diffs)
-
libohana/src (modified) (1 prop)
-
opihi/dvo/Makefile (modified) (1 diff)
-
opihi/dvo/coordmosaic.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/opihi/dvo/coordmosaic.c )
-
opihi/dvo/init.c (modified) (2 diffs)
-
photdbc/Makefile (modified) (2 diffs)
-
photdbc/include/photdbc.h (modified) (3 diffs)
-
photdbc/src/args.c (modified) (4 diffs)
-
photdbc/src/copy_images.c (modified) (2 diffs)
-
photdbc/src/initialize.c (modified) (2 diffs)
-
photdbc/src/make_subcatalog.c (modified) (5 diffs)
-
photdbc/src/photdbc.c (modified) (1 diff)
-
photdbc/src/photdbc_catalogs.c (modified) (1 diff)
-
photdbc/src/select_images.c (copied) (copied from branches/eam_branches/ipp-20140423/Ohana/src/photdbc/src/select_images.c )
-
relastro/Makefile (modified) (1 diff)
-
relastro/include/relastro.h (modified) (7 diffs)
-
relastro/src/BrightCatalog.c (modified) (8 diffs)
-
relastro/src/FitChip.c (modified) (7 diffs)
-
relastro/src/GetAstromError.c (modified) (2 diffs)
-
relastro/src/ImageOps.c (modified) (12 diffs)
-
relastro/src/UpdateObjectOffsets.c (modified) (1 diff)
-
relastro/src/UpdateObjects.c (modified) (14 diffs)
-
relastro/src/args.c (modified) (6 diffs)
-
relastro/src/bcatalog.c (modified) (10 diffs)
-
relastro/src/dvo_astrom_ops.c (modified) (2 diffs)
-
relastro/src/initialize.c (modified) (2 diffs)
-
relastro/src/launch_region_hosts.c (modified) (3 diffs)
-
relastro/src/load_catalogs.c (modified) (8 diffs)
-
relastro/src/relastro_client.c (modified) (1 diff)
-
relastro/src/relastro_images.c (modified) (2 diffs)
-
relastro/src/relastro_objects.c (modified) (1 diff)
-
relastro/src/relastro_parallel_images.c (modified) (1 diff)
-
uniphot/src/update_catalog_fiximids.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/src/ReadImageHeader.c
r31395 r36833 44 44 image[0].NX = Nx; 45 45 image[0].NY = Ny; 46 47 image[0].refColor = NAN; 46 48 47 49 if (!gfits_scan (header, "TZERO", "%d", 1, &image[0].tzero) && !ACCEPT_TIME) { -
trunk/Ohana/src/delstar/include/delstar.h
r35837 r36833 2 2 # include <dvo.h> 3 3 # include <signal.h> 4 5 # define MARKTIME(MSG,...) { \ 6 gettimeofday (&stopTimer, (void *) NULL); \ 7 float dtime = DTIME (stopTimer, startTimer); \ 8 fprintf (stderr, MSG, __VA_ARGS__); } 9 10 # define INITTIME \ 11 struct timeval startTimer, stopTimer; \ 12 gettimeofday (&startTimer, (void *) NULL); 4 13 5 14 // options for generating the IndexArray used to select images for deletion (delete_duplicate_images.c) … … 67 76 int UPDATE; 68 77 int IMAGE_DETAILS; 78 int IMAGE_DUPLICATES_BY_OBSTIME; 69 79 int IMAGE_ONLY; 70 80 int ORPHAN; -
trunk/Ohana/src/delstar/src/args.c
r35758 r36833 18 18 fprintf (stderr, " -image-details : list info about the deleted images (-dup-images only)\n"); 19 19 fprintf (stderr, " -image-only : only examine the image table (changes are NOT saved; -dup-images only)\n"); 20 fprintf (stderr, " -image-only-force : modify only the image table (-dup-images only)\n"); 21 fprintf (stderr, " -image-by-obstime : use date/time and photcode (not externID) to find duplicates\n"); 20 22 fprintf (stderr, " -region Rmin Rmax Dmin Dmax : apply changes to this part of the sky\n"); 21 23 … … 68 70 if ((N = get_argument (argc, argv, "-image-details"))) { 69 71 IMAGE_DETAILS = TRUE; 72 remove_argument (N, &argc, argv); 73 } 74 75 IMAGE_DUPLICATES_BY_OBSTIME = FALSE; 76 if ((N = get_argument (argc, argv, "-image-by-obstime"))) { 77 IMAGE_DUPLICATES_BY_OBSTIME = TRUE; 70 78 remove_argument (N, &argc, argv); 71 79 } -
trunk/Ohana/src/delstar/src/delete_duplicate_images.c
r35758 r36833 1 1 # include "delstar.h" 2 3 IndexArray *find_duplicates_obstime (Image *image, off_t Nimage, off_t *Nduplicates); 4 off_t find_obstime_range (Image *image, off_t Nimage, off_t firstEntry); 5 void sort_by_obstime (e_time *T, short *P, off_t *I, off_t N); 6 void sort_by_photcode (short *P, off_t *I, off_t N); 2 7 3 8 // this function identifies the images to be deleted based on duplication of the … … 18 23 19 24 off_t Nduplicates = 0; 20 IndexArray *imageID = find_duplicates (image, Nimage, &Nduplicates); 25 IndexArray *imageID = NULL; 26 27 if (IMAGE_DUPLICATES_BY_OBSTIME) { 28 imageID = find_duplicates_obstime (image, Nimage, &Nduplicates); 29 } else { 30 imageID = find_duplicates (image, Nimage, &Nduplicates); 31 } 21 32 22 33 if (Nduplicates == 0) { … … 494 505 } 495 506 507 // sort by increasing obstime 508 void sort_by_obstime (e_time *T, short *P, off_t *I, off_t N) { 509 510 # define SWAPFUNC(A,B){ e_time tmpT; short tmpP; off_t tmpI; \ 511 tmpT = T[A]; T[A] = T[B]; T[B] = tmpT; \ 512 tmpP = P[A]; P[A] = P[B]; P[B] = tmpP; \ 513 tmpI = I[A]; I[A] = I[B]; I[B] = tmpI; \ 514 } 515 # define COMPARE(A,B)(T[A] < T[B]) 516 517 OHANA_SORT (N, COMPARE, SWAPFUNC); 518 519 # undef SWAPFUNC 520 # undef COMPARE 521 522 } 523 524 // sort by increasing photcode 525 void sort_by_photcode (short *P, off_t *I, off_t N) { 526 527 # define SWAPFUNC(A,B){ short tmpP; off_t tmpI; \ 528 tmpP = P[A]; P[A] = P[B]; P[B] = tmpP; \ 529 tmpI = I[A]; I[A] = I[B]; I[B] = tmpI; \ 530 } 531 # define COMPARE(A,B)(P[A] < P[B]) 532 533 OHANA_SORT (N, COMPARE, SWAPFUNC); 534 535 # undef SWAPFUNC 536 # undef COMPARE 537 538 } 539 540 static e_time *obstime = NULL; 541 static short *photcode = NULL; 542 static off_t *primary = NULL; 543 static off_t *idx = NULL; 544 static char *keep = NULL; 545 546 static short *photcode_subset = NULL; 547 static off_t *idx_subset = NULL; 548 549 static off_t Nsubset = 0; 550 static off_t NSUBSET = 300; 551 552 off_t find_obstime_range (Image *image, off_t Nimage, off_t firstEntry) { 553 554 Nsubset = 0; 555 556 // find all entries with the same obstime: 557 e_time firstTime = obstime[firstEntry]; 558 559 idx_subset[Nsubset] = idx[firstEntry]; 560 photcode_subset[Nsubset] = photcode[firstEntry]; 561 Nsubset++; 562 563 off_t i = firstEntry + Nsubset; 564 while ((i < Nimage) && (obstime[i] == firstTime)) { 565 idx_subset[Nsubset] = idx[i]; 566 photcode_subset[Nsubset] = photcode[i]; 567 Nsubset++; 568 i++; 569 if (Nsubset >= NSUBSET) { 570 NSUBSET += 1000; 571 REALLOCATE (photcode_subset, short, NSUBSET); 572 REALLOCATE (idx_subset, off_t, NSUBSET); 573 } 574 } 575 576 sort_by_photcode (photcode_subset, idx_subset, Nsubset); 577 578 return i; 579 } 580 581 // alternative version to find duplicates based on obstime and photcode 582 IndexArray *find_duplicates_obstime (Image *image, off_t Nimage, off_t *Nduplicates) { 583 584 if (Nimage < 1) return NULL; 585 586 // how to find duplicates: 587 // generate a set of arrays (idx, obstime, photcode, keep) 588 // sort the arrays by obstime 589 // loop over obstime. 590 // for a given new obstime, scan through the entries with the same value 591 // create a sub-array of photcodes, idx 592 // sort by photcode 593 // loop over entries 594 // find matching photcodes 595 // mark duplicate enties 596 597 ALLOCATE (obstime, e_time, Nimage); 598 ALLOCATE (photcode, short, Nimage); 599 ALLOCATE (primary, off_t, Nimage); 600 ALLOCATE (idx, off_t, Nimage); 601 ALLOCATE (keep, char, Nimage); 602 603 off_t i; 604 605 INITTIME; 606 607 // skip entries with photcode == 0? 608 for (i = 0; i < Nimage; i++) { 609 idx[i] = i; 610 primary[i] = -1; // only duplicates get a value for primary 611 keep[i] = TRUE; 612 obstime[i] = image[i].tzero; 613 photcode[i] = image[i].photcode; 614 } 615 MARKTIME(" generate index arrays: %f sec\n", dtime); 616 617 // sort the 4 arrays 618 sort_by_obstime (obstime, photcode, idx, Nimage); 619 MARKTIME(" sort index arrays: %f sec\n", dtime); 620 621 // image[idx[i]].tzero = obstime[i] 622 // keep[i] -> keep image[i] ('keep' is NOT resorted) 623 624 // allocate arrays to store the subsets (these are global static) 625 // These get reallocated if necessary in find_obstime_range() 626 ALLOCATE (photcode_subset, short, NSUBSET); 627 ALLOCATE (idx_subset, off_t, NSUBSET); 628 629 // entries of idx_subset correspond to the original image sequence: 630 // image[idx_subset[i]].tzero = obstime[i] 631 632 off_t firstEntry = 0; 633 off_t nextEntry = 0; 634 635 while (nextEntry < Nimage) { 636 if (firstEntry >= Nimage) { 637 fprintf (stderr, "error, too far?\n"); 638 } 639 640 // generate photcode_subset, idx_subset in order of photcode for this unique obstime[firstEntry] 641 // returned value is the first value of the next entry 642 nextEntry = find_obstime_range (image, Nimage, firstEntry); 643 644 // step through the photcodes and find duplicates 645 int j; 646 int firstCodeEntry = 0; 647 short firstCode = photcode_subset[firstCodeEntry]; 648 for (j = 1; j < Nsubset; j++) { 649 if (photcode_subset[j] == firstCode) { 650 // mark as duplicate 651 off_t dupIndex = idx_subset[j]; 652 keep[dupIndex] = FALSE; 653 primary[dupIndex] = idx_subset[firstCodeEntry]; 654 } else { 655 // new value of photcode, call if the first one 656 firstCodeEntry = j; 657 firstCode = photcode_subset[firstCodeEntry]; 658 } 659 } 660 firstEntry = nextEntry; 661 } 662 MARKTIME(" find duplicates: %f sec\n", dtime); 663 664 IndexArray *imageID = make_index_array (image, Nimage, IMAGE_ID); 665 MARKTIME(" make index array: %f sec\n", dtime); 666 667 // set imageID->value to TRUE for images we want to delete 668 off_t Ndup = 0; 669 for (i = 0; i < Nimage; i++) { 670 if (keep[i]) continue; 671 off_t Ni = image[i].imageID - imageID->minID; 672 myAssert (Ni >= 0, "oops"); 673 myAssert (Ni < imageID->range, "oops"); 674 imageID->value[Ni] = TRUE; 675 Ndup ++; 676 } 677 MARKTIME(" mark duplicates: %f sec\n", dtime); 678 679 for (i = 0; IMAGE_DETAILS && (i < Nimage); i++) { 680 off_t Ni = image[i].imageID - imageID->minID; 681 if (!imageID->value[Ni]) continue; 682 683 char *date = NULL; 684 date = ohana_sec_to_date (image[i].tzero); 685 fprintf (stderr, "delete image : (" OFF_T_FMT "), extID = %d : %30s : %20s %5d == ", i, image[i].externID, image[i].name, date, image[i].photcode); 686 free (date); 687 688 off_t myPrimary = primary[i]; 689 if (myPrimary < 0) { 690 fprintf (stderr, "ERROR: this should never happen\n"); 691 abort(); 692 } 693 date = ohana_sec_to_date (image[myPrimary].tzero); 694 fprintf (stderr, "parent image : (" OFF_T_FMT "), extID = %d : %30s : %20s %5d\n", myPrimary, image[myPrimary].externID, image[myPrimary].name, date, image[myPrimary].photcode); 695 free (date); 696 } 697 698 *Nduplicates = Ndup; 699 700 free (photcode_subset); 701 free (idx_subset); 702 703 free (obstime); 704 free (photcode); 705 free (primary); 706 free (idx); 707 free (keep); 708 709 return imageID;; 710 } 711 496 712 // find the min & max values of the given ID (externID or imageID) 497 713 // construct an empty array with length needed to fit IDs -
trunk/Ohana/src/dvomerge/src/dvo_image_merge_dbs.c
r36528 r36833 168 168 169 169 if (!IDmap->old) { 170 fprintf (stderr, "input database has image IDs, but no Image table\n"); 171 return FALSE; 172 } 173 174 if (!IDmap->Nmap) { 170 175 fprintf (stderr, "input database has image IDs, but no Image table\n"); 171 176 return FALSE; -
trunk/Ohana/src/dvomerge/src/dvomergeImageIDs.c
r35765 r36833 18 18 if (inDB.dbstate == LCK_EMPTY) { 19 19 dvo_image_unlock (&inDB); // unlock input 20 IDmap->old = NULL; 21 IDmap->new = NULL; 20 22 IDmap->Nmap = 0; 21 23 return TRUE; … … 99 101 if (inDB.dbstate == LCK_EMPTY) { 100 102 dvo_image_unlock (&inDB); // unlock input 103 IDmap->old = NULL; 104 IDmap->new = NULL; 101 105 IDmap->Nmap = 0; 102 106 return TRUE; -
trunk/Ohana/src/dvomerge/src/dvorepairCPT.c
r33657 r36833 126 126 average[Nave].measureOffset = -1; 127 127 average[Nave].missingOffset = -1; 128 average[Nave]. extendOffset = -1;128 average[Nave].refColor = NAN; 129 129 130 130 average[Nave].objID = measure[i].objID; -
trunk/Ohana/src/dvomerge/src/dvorepairDeleteImageList.c
r29938 r36833 411 411 average[Nave].measureOffset = -1; 412 412 average[Nave].missingOffset = -1; 413 average[Nave]. extendOffset = -1;413 average[Nave].refColor = NAN; 414 414 415 415 average[Nave].objID = measure[i].objID; -
trunk/Ohana/src/dvomerge/src/dvorepairFixTables.c
r29938 r36833 266 266 average[Nave].measureOffset = -1; 267 267 average[Nave].missingOffset = -1; 268 average[Nave]. extendOffset = -1;268 average[Nave].refColor = NAN; 269 269 270 270 average[Nave].objID = measure[i].objID; -
trunk/Ohana/src/dvopsps/src/insert_objects_dvopsps_catalog.c
r35450 r36833 292 292 PrintIOBuffer (ave_buffer, "%d, ", average->measureOffset); 293 293 PrintIOBuffer (ave_buffer, "%d, ", average->missingOffset); 294 PrintIOBuffer (ave_buffer, "%d, ", average->extendOffset);294 PrintIOBuffer (ave_buffer, "%d, ", 0); // was : average->extendOffset); 295 295 PrintIOBuffer (ave_buffer, "%u, ", average->flags); 296 296 PrintIOBuffer (ave_buffer, "%u, ", average->photFlagsUpper); -
trunk/Ohana/src/kapa2/src/CheckPipe.c
r29938 r36833 1 1 # include "Ximage.h" 2 # include <errno.h> 2 3 # define STRCONST(A) ((int)(0x1000000*A[0] + 0x10000*A[1] + 0x100*A[2] + 0x1*A[3])) 3 4 … … 41 42 word[4] = 0; 42 43 switch (status) { 43 case -1: /* no input from pipe: continue */ 44 return (TRUE); 44 case -1: 45 if (errno == EAGAIN) { 46 /* no input from pipe: continue */ 47 return (TRUE); 48 } 49 perror ("exiting due to problem with socket connection in CheckPipe"); 50 return (FALSE); 45 51 break; 46 52 -
trunk/Ohana/src/kapa2/src/EventLoop.c
r21153 r36833 1 1 # include "Ximage.h" 2 # define DEBUG 0 2 3 3 4 /* list events being selected below, all other masks are ignored */ … … 6 7 int LastEvent (Display *display, int type, XEvent *event) { 7 8 8 int found ;9 int found, Nfound; 9 10 10 11 found = FALSE; 12 Nfound = 0; 11 13 while (XCheckTypedEvent (display, type, event)) { 14 // If the link is slow, then I should wait a little while for some config events to 15 // build up (typically, the window is being dragged around, so we get a whole series of 16 // config events. the flush / sync time is slow on a slow link, so we should try to wait 17 // for the config events to stop, but on a timescale deteremined by the flush/sync time 18 // if (type == ConfigureNotify) fprintf (stderr, "config (%d)\n", Nfound); 19 Nfound ++; 12 20 found = TRUE; 21 } 22 if (DEBUG && found) { 23 if (type == ConfigureNotify) fprintf (stderr, "config (%d)\n", Nfound); 24 if (type == CirculateNotify) fprintf (stderr, "circul (%d)\n", Nfound); 25 if (type == Expose) fprintf (stderr, "expose (%d)\n", Nfound); 26 } 27 28 // if I have a ConfigureNotify event, I should purge all Expose events as well: 29 if (found && (type == ConfigureNotify)) { 30 XEvent discard; 31 while (XCheckTypedEvent (display, Expose, &discard)); 13 32 } 14 33 return (found); … … 38 57 39 58 if (XEventsQueued (display, QueuedAfterFlush) < 1) { 40 /* fprintf (stderr, "."); */41 59 usleep (50000); 42 60 continue; 43 61 } 44 62 63 // If I have a config event, I want to also purge all expose events 64 45 65 /* grab the last entry for these events */ 46 if (LastEvent (display, ConfigureNotify, &event)) Reconfig (&event);47 if (LastEvent (display, CirculateNotify, &event)) Reconfig (&event);48 if (LastEvent (display, Expose, &event)) Refresh ();66 if (LastEvent (display, ConfigureNotify, &event)) { Reconfig (&event); continue; } 67 if (LastEvent (display, CirculateNotify, &event)) { Reconfig (&event); continue; } 68 if (LastEvent (display, Expose, &event)) { Refresh (); continue; } 49 69 if (LastEvent (display, MappingNotify, &event)) XRefreshKeyboardMapping ((XMappingEvent *) &event); 50 70 if (LastEvent (display, MotionNotify, &event)) UpdatePointer (graphic, (XMotionEvent *) &event); -
trunk/Ohana/src/kapa2/src/FlushDisplay.c
r21153 r36833 30 30 31 31 if (flush) { 32 XFlush (graphic->display); 32 // I changed XFlush to XSync to avoid lag 33 // of the display (build up of config events) 34 XSync (graphic->display, FALSE); 33 35 reftime = now; 34 36 } -
trunk/Ohana/src/kapa2/src/Refresh.c
r27790 r36833 47 47 Y0 = graphic[0].dy - graphic[0].dy * section[0].y - dY; 48 48 X0 = graphic[0].dx * section[0].x; 49 // fprintf (stderr, "section: (%s) %d %d - %d %d\n", section[0].name, X0, Y0, dX, dY);50 49 51 50 XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, X0, Y0, dX, dY); -
trunk/Ohana/src/libautocode/def/average-ps1-dev-2.d
r16810 r36833 25 25 FIELD measureOffset, OFF_MEASURE, int, offset to first psf measurement 26 26 FIELD missingOffset, OFF_MISSING, int, offset to first missing obs 27 FIELD extendOffset, OFF_EXTEND, int, offset to first extended measurement27 FIELD refColor, REF_COLOR, float, color of astrometry ref stars 28 28 29 29 FIELD code, code, unsigned short, ID code (star; ghost; etc) -
trunk/Ohana/src/libautocode/def/average-ps1-v1.d
r21508 r36833 30 30 FIELD measureOffset, OFF_MEASURE, uint32_t, offset to first psf measurement 31 31 FIELD missingOffset, OFF_MISSING, uint32_t, offset to first missing obs 32 FIELD extendOffset, OFF_EXTEND, uint32_t, offset to first extended measurement32 FIELD refColor, REF_COLOR, float, color of astrometry ref stars 33 33 34 34 # 'flags' was called 'code' prior to 2009.02.07 -
trunk/Ohana/src/libautocode/def/average-ps1-v2.d
r33647 r36833 35 35 FIELD measureOffset, OFF_MEASURE, uint32_t, offset to first psf measurement 36 36 FIELD missingOffset, OFF_MISSING, uint32_t, offset to first missing obs 37 FIELD extendOffset, OFF_EXTEND, uint32_t, offset to first extended measurement37 FIELD refColor, REF_COLOR, float, color of astrometry ref stars 38 38 39 39 # 'flags' was called 'code' prior to 2009.02.07 -
trunk/Ohana/src/libautocode/def/average-ps1-v3.d
r33647 r36833 35 35 FIELD measureOffset, OFF_MEASURE, uint32_t, offset to first psf measurement 36 36 FIELD missingOffset, OFF_MISSING, uint32_t, offset to first missing obs 37 FIELD extendOffset, OFF_EXTEND, uint32_t, offset to first extended measurement37 FIELD refColor, REF_COLOR, float, color of astrometry ref stars 38 38 39 39 # 'flags' was called 'code' prior to 2009.02.07 -
trunk/Ohana/src/libautocode/def/average-ps1-v4.d
r34405 r36833 38 38 FIELD measureOffset, OFF_MEASURE, uint32_t, offset to first psf measurement 39 39 FIELD missingOffset, OFF_MISSING, uint32_t, offset to first missing obs 40 FIELD extendOffset, OFF_EXTEND, uint32_t, offset to first extended measurement40 FIELD refColor, REF_COLOR, float, color of reference stars 41 41 42 42 # 'flags' was called 'code' prior to 2009.02.07 -
trunk/Ohana/src/libautocode/def/average.d
r34405 r36833 38 38 FIELD measureOffset, OFF_MEASURE, int, offset to first psf measurement 39 39 FIELD missingOffset, OFF_MISSING, int, offset to first missing obs 40 FIELD extendOffset, OFF_EXTEND, int, offset to first extended measurement40 FIELD refColor, REF_COLOR, float, color of astrometry ref stars 41 41 42 42 # 'flags' was called 'code' prior to 2009.02.07 -
trunk/Ohana/src/libautocode/def/image-ps1-v2.d
r30604 r36833 42 42 FIELD DECo, DEC_CENTER, float, image center, degrees 43 43 FIELD Radius, RADIUS, float, image radius, degrees 44 FIELD DUMMY, DUMMY,float, dummy44 FIELD refColor, REF_COLOR, float, dummy 45 45 46 46 # should we define the max length of name as a macro? -
trunk/Ohana/src/libautocode/def/image-ps1-v3.d
r33647 r36833 42 42 FIELD DECo, DEC_CENTER, float, image center, degrees 43 43 FIELD Radius, RADIUS, float, image radius, degrees 44 FIELD DUMMY, DUMMY,float, dummy44 FIELD refColor, REF_COLOR, float, dummy 45 45 46 46 # should we define the max length of name as a macro? -
trunk/Ohana/src/libautocode/def/image-ps1-v4.d
r34260 r36833 42 42 FIELD DECo, DEC_CENTER, float, image center, degrees 43 43 FIELD Radius, RADIUS, float, image radius, degrees 44 FIELD DUMMY, DUMMY,float, dummy44 FIELD refColor, REF_COLOR, float, dummy 45 45 46 46 # should we define the max length of name as a macro? -
trunk/Ohana/src/libautocode/def/image.d
r33963 r36833 44 44 FIELD DECo, DEC_CENTER, float, image center, degrees 45 45 FIELD Radius, RADIUS, float, image radius, degrees 46 FIELD DUMMY, DUMMY,float, dummy46 FIELD refColor, REF_COLOR, float, dummy 47 47 48 48 FIELD name, NAME, char[121], name of original image -
trunk/Ohana/src/libdvo/include/dvo.h
r36630 r36833 171 171 ID_STAR_USE_PAR = 0x00200000, // parallax used (not AVE or PM) 172 172 ID_STAR_NO_ASTROM = 0x00400000, // mean astrometry could not be measured 173 ID_STAR_BAD_PM = 0x00800000, // mean astrometry could not be measured 173 174 ID_OBJ_EXT = 0x01000000, // extended in our data (eg, PS) 174 175 ID_OBJ_EXT_ALT = 0x02000000, // extended in external data (eg, 2MASS) … … 481 482 uint32_t measureOffset; // offset to first psf measurement 482 483 uint32_t missingOffset; // offset to first missing obs 483 uint32_t extendOffset;// offset to first extended measurement484 float refColor; // offset to first extended measurement 484 485 uint32_t flags; // average object flags (star; ghost; etc) 485 486 uint32_t photFlagsUpper; // upper bit of 2 bit summary of per-measure photflags -
trunk/Ohana/src/libdvo/include/dvodb.h
r36630 r36833 222 222 AVE_EXTID_HI, 223 223 AVE_EXTID_LO, 224 AVE_REF_COLOR, 224 225 }; 225 226 … … 289 290 IMAGE_NFIT_ASTROM, 290 291 IMAGE_NLINK_PHOTOM, 291 IMAGE_NLINK_ASTROM 292 IMAGE_NLINK_ASTROM, 293 IMAGE_REF_COLOR 292 294 }; 293 295 -
trunk/Ohana/src/libdvo/src/dbExtractAverages.c
r36630 r36833 161 161 case AVE_STARGAL: 162 162 value.Flt = average[0].stargal; 163 break; 164 case AVE_REF_COLOR: 165 value.Flt = average[0].refColor; 163 166 break; 164 167 -
trunk/Ohana/src/libdvo/src/dbExtractImages.c
r35102 r36833 69 69 if (!haveCelestial) { 70 70 if (!FindMosaicForImage (image, Nimage, N)) return value; 71 x = 0.5*image[N].NX; 72 y = 0.5*image[N].NY; 71 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 72 x = 0.0; 73 y = 0.0; 74 } else { 75 x = 0.5*image[N].NX; 76 y = 0.5*image[N].NY; 77 } 73 78 XY_to_RD (&RAo, &DECo, x, y, &image[N].coords); 74 79 haveCelestial = TRUE; … … 79 84 if (!haveCelestial) { 80 85 if (!FindMosaicForImage (image, Nimage, N)) return value; 81 x = 0.5*image[N].NX; 82 y = 0.5*image[N].NY; 86 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 87 x = 0.0; 88 y = 0.0; 89 } else { 90 x = 0.5*image[N].NX; 91 y = 0.5*image[N].NY; 92 } 83 93 XY_to_RD (&RAo, &DECo, x, y, &image[N].coords); 84 94 haveCelestial = TRUE; … … 90 100 if (!haveCelestial) { 91 101 if (!FindMosaicForImage (image, Nimage, N)) return value; 92 x = 0.5*image[N].NX; 93 y = 0.5*image[N].NY; 102 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 103 x = 0.0; 104 y = 0.0; 105 } else { 106 x = 0.5*image[N].NX; 107 y = 0.5*image[N].NY; 108 } 94 109 XY_to_RD (&RAo, &DECo, x, y, &image[N].coords); 95 110 haveCelestial = TRUE; … … 104 119 if (!haveCelestial) { 105 120 if (!FindMosaicForImage (image, Nimage, N)) return value; 106 x = 0.5*image[N].NX; 107 y = 0.5*image[N].NY; 121 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 122 x = 0.0; 123 y = 0.0; 124 } else { 125 x = 0.5*image[N].NX; 126 y = 0.5*image[N].NY; 127 } 108 128 XY_to_RD (&RAo, &DECo, x, y, &image[N].coords); 109 129 haveCelestial = TRUE; … … 118 138 if (!haveCelestial) { 119 139 if (!FindMosaicForImage (image, Nimage, N)) return value; 120 x = 0.5*image[N].NX; 121 y = 0.5*image[N].NY; 140 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 141 x = 0.0; 142 y = 0.0; 143 } else { 144 x = 0.5*image[N].NX; 145 y = 0.5*image[N].NY; 146 } 122 147 XY_to_RD (&RAo, &DECo, x, y, &image[N].coords); 123 148 haveCelestial = TRUE; … … 132 157 if (!haveCelestial) { 133 158 if (!FindMosaicForImage (image, Nimage, N)) return value; 134 x = 0.5*image[N].NX; 135 y = 0.5*image[N].NY; 159 if (!strcmp(&image[N].coords.ctype[4], "-DIS")) { 160 x = 0.0; 161 y = 0.0; 162 } else { 163 x = 0.5*image[N].NX; 164 y = 0.5*image[N].NY; 165 } 136 166 XY_to_RD (&RAo, &DECo, x, y, &image[N].coords); 137 167 haveCelestial = TRUE; … … 344 374 value.Int = image[N].nLinkAstrom; 345 375 break; 376 377 case IMAGE_REF_COLOR: 378 value.Flt = image[N].refColor; 379 break; 346 380 } 347 381 return (value); -
trunk/Ohana/src/libdvo/src/dbFields.c
r36630 r36833 381 381 if (!strcasecmp (fieldName, "EXTID_HI")) ESCAPE (AVE_EXTID_HI, MAG_NONE, OPIHI_INT); 382 382 if (!strcasecmp (fieldName, "EXTID_LO")) ESCAPE (AVE_EXTID_LO, MAG_NONE, OPIHI_INT); 383 if (!strcasecmp (fieldName, "REF_COLOR")) ESCAPE (AVE_REF_COLOR, MAG_NONE, OPIHI_FLT); 383 384 384 385 // check for code:mode in photcode name … … 522 523 if (!strcasecmp (fieldName, "UCDIST")) ESCAPE (IMAGE_UBERCAL_DIST,MAG_NONE, OPIHI_INT); 523 524 524 if (!strcasecmp (fieldName, "NFIT_PHOTOM")) ESCAPE (IMAGE_NFIT_PHOTOM,MAG_NONE, OPIHI_INT); 525 if (!strcasecmp (fieldName, "NFIT_ASTROM")) ESCAPE (IMAGE_NFIT_ASTROM,MAG_NONE, OPIHI_INT); 526 if (!strcasecmp (fieldName, "NLINK_PHOTOM")) ESCAPE (IMAGE_NLINK_PHOTOM,MAG_NONE, OPIHI_INT); 527 if (!strcasecmp (fieldName, "NLINK_ASTROM")) ESCAPE (IMAGE_NLINK_ASTROM,MAG_NONE, OPIHI_INT); 525 if (!strcasecmp (fieldName, "NFIT_PHOTOM")) ESCAPE (IMAGE_NFIT_PHOTOM, MAG_NONE, OPIHI_INT); 526 if (!strcasecmp (fieldName, "NFIT_ASTROM")) ESCAPE (IMAGE_NFIT_ASTROM, MAG_NONE, OPIHI_INT); 527 if (!strcasecmp (fieldName, "NLINK_PHOTOM")) ESCAPE (IMAGE_NLINK_PHOTOM, MAG_NONE, OPIHI_INT); 528 if (!strcasecmp (fieldName, "NLINK_ASTROM")) ESCAPE (IMAGE_NLINK_ASTROM, MAG_NONE, OPIHI_INT); 529 if (!strcasecmp (fieldName, "REF_COLOR")) ESCAPE (IMAGE_REF_COLOR, MAG_NONE, OPIHI_FLT); 528 530 529 531 // for words that don't parse, try a photcode -
trunk/Ohana/src/libdvo/src/dvo_catalog.c
r36630 r36833 100 100 average->measureOffset = -1; 101 101 average->missingOffset = -1; 102 average-> extendOffset = -1;102 average->refColor = NAN; 103 103 104 104 average->flags = 0; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c
r35162 r36833 119 119 out[i].measureOffset = in[i].measureOffset; 120 120 out[i].missingOffset = in[i].missingOffset; 121 out[i]. extendOffset = in[i].extendOffset;121 out[i].refColor = in[i].refColor; 122 122 out[i].objID = in[i].objID; 123 123 out[i].catID = in[i].catID; … … 153 153 out[i].measureOffset = in[i].measureOffset; 154 154 out[i].missingOffset = in[i].missingOffset; 155 out[i]. extendOffset = in[i].extendOffset;155 out[i].refColor = in[i].refColor; 156 156 out[i].objID = in[i].objID; 157 157 out[i].catID = in[i].catID; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c
r35162 r36833 140 140 out[i].measureOffset = in[i].measureOffset; 141 141 out[i].missingOffset = in[i].missingOffset; 142 out[i]. extendOffset = in[i].extendOffset;142 out[i].refColor = in[i].refColor; 143 143 out[i].flags = in[i].flags; 144 144 out[i].objID = in[i].objID; … … 175 175 out[i].measureOffset = in[i].measureOffset; 176 176 out[i].missingOffset = in[i].missingOffset; 177 out[i]. extendOffset = in[i].extendOffset;177 out[i].refColor = in[i].refColor; 178 178 out[i].flags = in[i].flags; 179 179 out[i].objID = in[i].objID; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c
r35162 r36833 145 145 out[i].measureOffset = in[i].measureOffset; 146 146 out[i].missingOffset = in[i].missingOffset; 147 out[i]. extendOffset = in[i].extendOffset;147 out[i].refColor = in[i].refColor; 148 148 out[i].flags = in[i].flags; 149 149 out[i].objID = in[i].objID; … … 184 184 out[i].measureOffset = in[i].measureOffset; 185 185 out[i].missingOffset = in[i].missingOffset; 186 out[i]. extendOffset = in[i].extendOffset;186 out[i].refColor = in[i].refColor; 187 187 out[i].flags = in[i].flags; 188 188 out[i].objID = in[i].objID; … … 269 269 out[i].DECo = in[i].DECo; 270 270 out[i].Radius = in[i].Radius; 271 out[i].refColor = in[i].refColor; 271 272 272 273 out[i].detection_limit = in[i].detection_limit; … … 331 332 out[i].DECo = in[i].DECo; 332 333 out[i].Radius = in[i].Radius; 334 out[i].refColor = in[i].refColor; 333 335 334 336 out[i].detection_limit = in[i].detection_limit; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V3.c
r35162 r36833 145 145 out[i].measureOffset = in[i].measureOffset; 146 146 out[i].missingOffset = in[i].missingOffset; 147 out[i]. extendOffset = in[i].extendOffset;147 out[i].refColor = in[i].refColor; 148 148 out[i].flags = in[i].flags; 149 149 out[i].photFlagsUpper = in[i].photFlagsUpper; … … 186 186 out[i].measureOffset = in[i].measureOffset; 187 187 out[i].missingOffset = in[i].missingOffset; 188 out[i]. extendOffset = in[i].extendOffset;188 out[i].refColor = in[i].refColor; 189 189 out[i].flags = in[i].flags; 190 190 out[i].photFlagsUpper = in[i].photFlagsUpper; … … 279 279 out[i].DECo = in[i].DECo; 280 280 out[i].Radius = in[i].Radius; 281 out[i].refColor = in[i].refColor; 281 282 282 283 out[i].detection_limit = in[i].detection_limit; … … 341 342 out[i].DECo = in[i].DECo; 342 343 out[i].Radius = in[i].Radius; 344 out[i].refColor = in[i].refColor; 343 345 344 346 out[i].detection_limit = in[i].detection_limit; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c
r36630 r36833 166 166 out[i].measureOffset = in[i].measureOffset; 167 167 out[i].missingOffset = in[i].missingOffset; 168 out[i]. extendOffset = in[i].extendOffset;168 out[i].refColor = in[i].refColor; 169 169 out[i].flags = in[i].flags; 170 170 out[i].photFlagsUpper = in[i].photFlagsUpper; … … 210 210 out[i].measureOffset = in[i].measureOffset; 211 211 out[i].missingOffset = in[i].missingOffset; 212 out[i]. extendOffset = in[i].extendOffset;212 out[i].refColor = in[i].refColor; 213 213 out[i].flags = in[i].flags; 214 214 out[i].photFlagsUpper = in[i].photFlagsUpper; … … 317 317 out[i].DECo = in[i].DECo; 318 318 out[i].Radius = in[i].Radius; 319 out[i].refColor = in[i].refColor; 319 320 320 321 out[i].detection_limit = in[i].detection_limit; … … 379 380 out[i].DECo = in[i].DECo; 380 381 out[i].Radius = in[i].Radius; 382 out[i].refColor = in[i].refColor; 381 383 382 384 out[i].detection_limit = in[i].detection_limit; … … 680 682 out[i].measureOffset = in[i].measureOffset; 681 683 out[i].missingOffset = in[i].missingOffset; 682 out[i]. extendOffset = in[i].extendOffset;684 out[i].refColor = in[i].refColor; 683 685 out[i].flags = in[i].flags; 684 686 out[i].photFlagsUpper = in[i].photFlagsUpper; -
trunk/Ohana/src/libdvo/src/skyregion_io.c
r33649 r36833 78 78 gfits_free_matrix (&matrix); 79 79 gfits_free_header (&theader); 80 fclose (f); 80 81 81 82 return (skytable); -
trunk/Ohana/src/libkapa/src/KapaOpen.c
r35761 r36833 218 218 // apparently, I can connect on someone else's port (eg GoogleTalkPlugin) 219 219 // do a simple handshake before we set !NONBLOCK: 220 char line[5]; 221 int Nout = read (InitSocket, line, 4); 222 if (Nout != 4) { 223 if (DEBUG) fprintf (stderr, "connection failed\n"); 224 close (InitSocket); 225 return (-1); 226 } 227 if (strncmp (line, "KAPA", 4)) { 228 if (DEBUG) fprintf (stderr, "connection to the wrong server\n"); 229 close (InitSocket); 230 return (-1); 220 221 // ensure the socket is NONBLOCK first... 222 fcntl (InitSocket, F_SETFL, O_NONBLOCK); 223 224 int Ntry = 0; 225 retry_message: 226 { 227 char line[5]; 228 int Nout = read (InitSocket, line, 4); 229 if ((Nout == -1) && (errno == EAGAIN)) { 230 Ntry ++; 231 if (Ntry > 500) { 232 if (DEBUG) fprintf (stderr, "handshake failure\n"); 233 close (InitSocket); 234 return (-1); 235 } 236 usleep (10000); 237 goto retry_message; 238 } 239 if (Nout != 4) { 240 if (DEBUG) fprintf (stderr, "connection failed\n"); 241 close (InitSocket); 242 return (-1); 243 } 244 if (strncmp (line, "KAPA", 4)) { 245 if (DEBUG) fprintf (stderr, "connection to the wrong server\n"); 246 close (InitSocket); 247 return (-1); 248 } 231 249 } 232 250 … … 265 283 } 266 284 267 # define NTRY 500285 # define NTRY 1000 268 286 Ntry = 0; 269 287 while (Ntry < NTRY) { 270 288 sock = KapaClientSocket ("localhost"); 271 289 if (sock != -1) break; 272 // if (errno != EAGAIN) break; 273 if (errno != ECONNREFUSED) break; 290 if (errno != ECONNREFUSED) { 291 perror ("KapaOpen"); 292 break; 293 } 274 294 // no connection yet. try again, but first check 275 295 // if the kapa job has exited … … 330 350 fcntl (InitSocket, F_SETFL, O_NONBLOCK); 331 351 332 # define NTRY 500352 # define NTRY 1000 333 353 Ntry = 0; 334 354 while (Ntry < NTRY) { -
trunk/Ohana/src/libkapa/src/KiiPicture.c
r34088 r36833 21 21 int KiiNewPicture1D (int fd, KiiImage *image, KapaImageData *data, Coords *coords) { 22 22 23 int Nwrite, Npix, Ncolors, size; 23 int Ncolors; 24 off_t Nwrite, Npix, size; 24 25 float min, max; 25 26 … … 36 37 KiiSendMessage (fd, "%8d %8d", image[0].Nx, image[0].Ny); 37 38 KiiSendMessage (fd, "%f %f %s %s", data[0].zero, data[0].range, data[0].name, data[0].file); 38 KiiSendMessage (fd, "%f %f %d", min, max, size);39 KiiSendMessage (fd, "%f %f "OFF_T_FMT" ", min, max, size); 39 40 KiiSendMessage (fd, "%f %f %g %g %g ", coords[0].crval1, coords[0].crpix1, coords[0].cdelt1, coords[0].pc1_1, coords[0].pc1_2); 40 41 KiiSendMessage (fd, "%f %f %g %g %g ", coords[0].crval2, coords[0].crpix2, coords[0].cdelt2, coords[0].pc2_1, coords[0].pc2_2); … … 42 43 43 44 /* send the image data */ 44 Nwrite = write (fd, image[0].data1d, size); 45 if (Nwrite != size) { 46 fprintf (stderr, "error sending picture to kapa\n"); 47 return (FALSE); 45 off_t bytes_left = size; 46 while (bytes_left > 0) { 47 Nwrite = write (fd, image[0].data1d, bytes_left); 48 if (Nwrite == 0) { 49 fprintf (stderr, "unable to send more data to kapa?\n"); 50 return FALSE; 51 } 52 if (Nwrite < 0) { 53 if (errno == EAGAIN) continue; 54 if (errno == EWOULDBLOCK) continue; 55 perror ("KiiNewPicture1D:"); 56 return FALSE; 57 } 58 bytes_left -= Nwrite; 48 59 } 49 60 … … 114 125 int KiiNewPicture2D (int fd, KiiImage *image, KapaImageData *data, Coords *coords) { 115 126 116 int j;117 int Nwrite, Nbytes, Npix, Ncolors, size;127 int Ncolors; 128 off_t j, Nwrite, Nbytes, Npix, size; 118 129 float min, max; 119 130 … … 130 141 KiiSendMessage (fd, "%8d %8d", image[0].Nx, image[0].Ny); 131 142 KiiSendMessage (fd, "%f %f %s %s", data[0].zero, data[0].range, data[0].name, data[0].file); 132 KiiSendMessage (fd, "%f %f %d", min, max, size);143 KiiSendMessage (fd, "%f %f "OFF_T_FMT" ", min, max, size); 133 144 KiiSendMessage (fd, "%f %f %g %g %g ", coords[0].crval1, coords[0].crpix1, coords[0].cdelt1, coords[0].pc1_1, coords[0].pc1_2); 134 145 KiiSendMessage (fd, "%f %f %g %g %g ", coords[0].crval2, coords[0].crpix2, coords[0].cdelt2, coords[0].pc2_1, coords[0].pc2_2); -
trunk/Ohana/src/libohana/src
- Property svn:mergeinfo deleted
-
trunk/Ohana/src/opihi/dvo/Makefile
r36375 r36833 41 41 $(SRC)/cmpread.$(ARCH).o \ 42 42 $(SRC)/coordimage.$(ARCH).o \ 43 $(SRC)/coordmosaic.$(ARCH).o \ 43 44 $(SRC)/ddmags.$(ARCH).o \ 44 45 $(SRC)/detrend.$(ARCH).o \ -
trunk/Ohana/src/opihi/dvo/init.c
r36375 r36833 14 14 int cmpread PROTO((int, char **)); 15 15 int coordimage PROTO((int, char **)); 16 int coordmosaic PROTO((int, char **)); 17 int psastro_model PROTO((int, char **)); 16 18 int ddmags PROTO((int, char **)); 17 19 int detrend PROTO((int, char **)); … … 73 75 {1, "cmpread", cmpread, "read data from cmp format files"}, 74 76 {1, "coordimage", coordimage, "generate a map of the transformation residuals"}, 77 {1, "coordmosaic", coordmosaic, "generate a map of the distortion"}, 78 {1, "psastro_model", psastro_model, "save psastro-format astrometry model"}, 75 79 {1, "ddmags", ddmags, "plot magnitude differences"}, 76 80 {1, "detrend", detrend, "extract from detrend database?"}, -
trunk/Ohana/src/photdbc/Makefile
r33655 r36833 31 31 $(SRC)/args.$(ARCH).o \ 32 32 $(SRC)/copy_images.$(ARCH).o \ 33 $(SRC)/select_images.$(ARCH).o \ 33 34 $(SRC)/Shutdown.$(ARCH).o \ 34 35 $(SRC)/join_stars.$(ARCH).o \ … … 41 42 $(SRC)/ConfigInit.$(ARCH).o \ 42 43 $(SRC)/args.$(ARCH).o \ 43 $(SRC)/copy_images.$(ARCH).o \44 44 $(SRC)/Shutdown.$(ARCH).o \ 45 45 $(SRC)/join_stars.$(ARCH).o \ -
trunk/Ohana/src/photdbc/include/photdbc.h
r33963 r36833 20 20 int Nmeas; 21 21 } StatType; 22 23 typedef struct { 24 double Xc[5]; 25 double Yc[5]; 26 double Rc; 27 double Dc; 28 } SkyRegionCoords; 29 30 # define MARKTIME(MSG,...) { \ 31 gettimeofday (&stopTimer, (void *) NULL); \ 32 float dtime = DTIME (stopTimer, startTimer); \ 33 fprintf (stderr, MSG, __VA_ARGS__); } 34 35 # define INITTIME \ 36 struct timeval startTimer, stopTimer; \ 37 gettimeofday (&startTimer, (void *) NULL); 22 38 23 39 int PARALLEL; … … 80 96 PhotCodeData photcodes; 81 97 82 char *PHOTCODE_DROP_LIST, *PHOTCODE_ SKIP_LIST;83 int NphotcodesDrop, Nphotcodes Skip;84 PhotCode **photcodesDrop, **photcodes Skip;98 char *PHOTCODE_DROP_LIST, *PHOTCODE_KEEP_LIST; 99 int NphotcodesDrop, NphotcodesKeep; 100 PhotCode **photcodesDrop, **photcodesKeep; 85 101 86 102 # define FLAG_AREA 0X0001 … … 131 147 void SetProtect (int mode); 132 148 int SetSignals (void); 133 int copy_images (char *outdir );149 int copy_images (char *outdir, SkyList *skylist); 134 150 void usage(); 151 152 void dsortindex (double *X, off_t *Y, int N); 153 off_t getRegionStartByRA (double R, double *Rref, off_t Nregions); 154 155 Image *select_images (SkyList *skylist, Image *timage, off_t Ntimage, off_t **LineNumber, off_t *Nimage, int UseFullOverlap); 135 156 136 157 int photdbc_catalogs (char *outroot, SkyList *skylist, int hostID); -
trunk/Ohana/src/photdbc/src/args.c
r33655 r36833 85 85 } 86 86 87 // measurements with these photcodes are not copied to the output 87 88 PHOTCODE_DROP_LIST = NULL; 88 89 if ((N = get_argument (argc, argv, "-photcode-drop"))) { … … 92 93 } 93 94 94 PHOTCODE_SKIP_LIST = NULL; 95 if ((N = get_argument (argc, argv, "-photcode-skip"))) { 96 remove_argument (N, &argc, argv); 97 PHOTCODE_SKIP_LIST = strcreate(argv[N]); 95 // measurements with these photcodes are kept ***regardless of quality*** 96 // -photcode-keep J will keep all J-band measurements of all kinds 97 // -photcode-keep GPC1.02.g will keep all g-band measurements from chip XY02 98 PHOTCODE_KEEP_LIST = NULL; 99 if ((N = get_argument (argc, argv, "-photcode-keep"))) { 100 remove_argument (N, &argc, argv); 101 PHOTCODE_KEEP_LIST = strcreate(argv[N]); 98 102 remove_argument (N, &argc, argv); 99 103 } … … 254 258 } 255 259 256 PHOTCODE_ SKIP_LIST = NULL;257 if ((N = get_argument (argc, argv, "-photcode- skip"))) {258 remove_argument (N, &argc, argv); 259 PHOTCODE_ SKIP_LIST = strcreate(argv[N]);260 PHOTCODE_KEEP_LIST = NULL; 261 if ((N = get_argument (argc, argv, "-photcode-keep"))) { 262 remove_argument (N, &argc, argv); 263 PHOTCODE_KEEP_LIST = strcreate(argv[N]); 260 264 remove_argument (N, &argc, argv); 261 265 } … … 290 294 291 295 fprintf (stderr, " -photcode-drop : remove these photcodes from the output (REF or DEP only)\n"); 292 fprintf (stderr, " -photcode- skip : ignore these photcodes when assessing the validity (keep unless object is dropped)\n");296 fprintf (stderr, " -photcode-keep : ignore these photcodes when assessing the validity (keep unless object is dropped)\n"); 293 297 294 298 fprintf (stderr, " -instmag (min) (max) : range of valid instrumental magnitudes (or measurements are dropped)\n"); -
trunk/Ohana/src/photdbc/src/copy_images.c
r33655 r36833 1 1 # include "photdbc.h" 2 2 3 int copy_images (char *outdir ) {3 int copy_images (char *outdir, SkyList *skylist) { 4 4 5 5 int status; 6 off_t Nimage; 6 off_t Nimage, Nsubset; 7 off_t *LineNumber; 7 8 char *ImageOut; 8 9 unsigned int imageID; 9 10 FITS_DB in; 10 11 FITS_DB out; 11 Image *image ;12 Image *image, *subset; 12 13 struct stat filestat; 13 14 char *path; … … 50 51 exit (2); 51 52 } 52 dvo_image_addrows (&out, image, Nimage); 53 54 subset = select_images (skylist, image, Nimage, &LineNumber, &Nsubset, FALSE); 55 56 dvo_image_addrows (&out, subset, Nsubset); 53 57 54 58 // note that imageID is unsigned int -
trunk/Ohana/src/photdbc/src/initialize.c
r33655 r36833 13 13 14 14 photcodesDrop = ParsePhotcodeList (PHOTCODE_DROP_LIST, &NphotcodesDrop, FALSE); 15 photcodes Skip = ParsePhotcodeList (PHOTCODE_SKIP_LIST, &NphotcodesSkip, FALSE);15 photcodesKeep = ParsePhotcodeList (PHOTCODE_KEEP_LIST, &NphotcodesKeep, FALSE); 16 16 17 17 if (SHOW_PARAMS) { … … 54 54 55 55 photcodesDrop = ParsePhotcodeList (PHOTCODE_DROP_LIST, &NphotcodesDrop, FALSE); 56 photcodes Skip = ParsePhotcodeList (PHOTCODE_SKIP_LIST, &NphotcodesSkip, FALSE);56 photcodesKeep = ParsePhotcodeList (PHOTCODE_KEEP_LIST, &NphotcodesKeep, FALSE); 57 57 58 58 if (SHOW_PARAMS) { -
trunk/Ohana/src/photdbc/src/make_subcatalog.c
r31635 r36833 9 9 off_t NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm, Nsecfilt; 10 10 double mag, minMag, minSigma; 11 int keep, *sec Skip;11 int keep, *secKeep; 12 12 PhotCode *photcode; 13 13 … … 16 16 17 17 // set up a list of SEC entries to ignore when evaluating a source 18 ALLOCATE (sec Skip, int, Nsecfilt);18 ALLOCATE (secKeep, int, Nsecfilt); 19 19 for (i = 0; i < Nsecfilt; i++) { 20 sec Skip[i] = FALSE;20 secKeep[i] = FALSE; 21 21 photcode = GetPhotcodebyNsec(i); 22 for (k = 0; k < Nphotcodes Skip; k++) {23 if (photcodes Skip[k][0].code != photcode[0].code) continue;24 sec Skip[i] = TRUE;22 for (k = 0; k < NphotcodesKeep; k++) { 23 if (photcodesKeep[k][0].code != photcode[0].code) continue; 24 secKeep[i] = TRUE; 25 25 } 26 26 } … … 67 67 keep = FALSE; 68 68 for (j = 0; !keep && (j < Nsecfilt); j++) { 69 if (sec Skip[j]) continue;69 if (secKeep[j]) continue; 70 70 if (catalog[0].secfilt[Nsecfilt*i+j].Ncode >= NCODE_MIN) { 71 71 keep = TRUE; … … 101 101 if (NphotcodesDrop > 0) { 102 102 found = FALSE; 103 for (k = 0; (k < Nphotcodes Skip) && !found; k++) {104 if (photcodes Skip[k][0].code == catalog[0].measure[offset].photcode) found = TRUE;105 if (photcodes Skip[k][0].code == GetPhotcodeEquivCodebyCode(catalog[0].measure[offset].photcode)) found = TRUE;103 for (k = 0; (k < NphotcodesDrop) && !found; k++) { 104 if (photcodesDrop[k][0].code == catalog[0].measure[offset].photcode) found = TRUE; 105 if (photcodesDrop[k][0].code == GetPhotcodeEquivCodebyCode(catalog[0].measure[offset].photcode)) found = TRUE; 106 106 } 107 107 if (found) continue; … … 109 109 110 110 // ignore certain photcodes to assess the measurements 111 if (Nphotcodes Skip > 0) {111 if (NphotcodesKeep > 0) { 112 112 found = FALSE; 113 for (k = 0; (k < Nphotcodes Skip) && !found; k++) {114 if (photcodes Skip[k][0].code == catalog[0].measure[offset].photcode) found = TRUE;115 if (photcodes Skip[k][0].code == GetPhotcodeEquivCodebyCode(catalog[0].measure[offset].photcode)) found = TRUE;113 for (k = 0; (k < NphotcodesKeep) && !found; k++) { 114 if (photcodesKeep[k][0].code == catalog[0].measure[offset].photcode) found = TRUE; 115 if (photcodesKeep[k][0].code == GetPhotcodeEquivCodebyCode(catalog[0].measure[offset].photcode)) found = TRUE; 116 116 } 117 117 if (found) goto keep; -
trunk/Ohana/src/photdbc/src/photdbc.c
r33655 r36833 9 9 initialize (argc, argv); 10 10 11 // load and copy the image table12 copy_images (argv[1]);13 14 11 // the output catalog needs to inherit the SKY_DEPTH of the input catalog 15 12 sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, TRUE, 0, VERBOSE); 16 13 SkyTableSetFilenames (sky, CATDIR, "cpt"); 17 14 skylist = SkyListByPatch (sky, -1, ®ION); 15 16 // load and copy the image table 17 copy_images (argv[1], skylist); 18 18 19 19 // hostID is 0 for master program -
trunk/Ohana/src/photdbc/src/photdbc_catalogs.c
r33963 r36833 120 120 if (ExcludeByMaxMinMag) { snprintf (tmpline, DVO_MAX_PATH, "%s -maxminmag %f", command, MAX_MIN_MAG); strcpy (command, tmpline); } 121 121 if (PHOTCODE_DROP_LIST) { snprintf (tmpline, DVO_MAX_PATH, "%s -photcode-drop %s", command, PHOTCODE_DROP_LIST); strcpy (command, tmpline); } 122 if (PHOTCODE_ SKIP_LIST) { snprintf (tmpline, DVO_MAX_PATH, "%s -photcode-skip %s", command, PHOTCODE_SKIP_LIST); strcpy (command, tmpline); }122 if (PHOTCODE_KEEP_LIST) { snprintf (tmpline, DVO_MAX_PATH, "%s -photcode-keep %s", command, PHOTCODE_KEEP_LIST); strcpy (command, tmpline); } 123 123 if (CATFORMAT) { snprintf (tmpline, DVO_MAX_PATH, "%s -set-format %s", command, CATFORMAT); strcpy (command, tmpline); } 124 124 if (CATMODE) { snprintf (tmpline, DVO_MAX_PATH, "%s -set-mode %s", command, CATMODE); strcpy (command, tmpline); } -
trunk/Ohana/src/relastro/Makefile
r36630 r36833 127 127 $(SRC)/plotstuff.$(ARCH).o \ 128 128 $(SRC)/relastroVisual.$(ARCH).o \ 129 $(SRC)/syncfile.$(ARCH).o \ 129 130 $(SRC)/BrightCatalog.$(ARCH).o 130 131 -
trunk/Ohana/src/relastro/include/relastro.h
r36630 r36833 83 83 double L, M; /* Focal Plane - pixels */ 84 84 double X, Y; /* Chip Coords - pixels */ 85 double Mag; 86 double dMag; 87 double dPos; 85 float Mag; 86 float Color; 87 float dMag; 88 float dPos; 88 89 int mask; 89 90 int Nmeas; … … 207 208 double MaxDensityValue; 208 209 209 char *PHOTCODE_KEEP_LIST, *PHOTCODE_SKIP_LIST ;210 int NphotcodesKeep, NphotcodesSkip ;211 PhotCode **photcodesKeep, **photcodesSkip ;210 char *PHOTCODE_KEEP_LIST, *PHOTCODE_SKIP_LIST, *PHOTCODE_RESET_LIST; 211 int NphotcodesKeep, NphotcodesSkip, NphotcodesReset; 212 PhotCode **photcodesKeep, **photcodesSkip, **photcodesReset; 212 213 213 214 char *PHOTCODE_A_LIST, *PHOTCODE_B_LIST; … … 217 218 SkyRegionSelection SELECTION; 218 219 220 char *DCR_COLOR_POS, *DCR_COLOR_NEG; 221 PhotCode *DCR_PHOTCODE_POS, *DCR_PHOTCODE_NEG; 222 int DCR_NSEC_POS, DCR_NSEC_NEG; 223 219 224 int ImagSelect; 220 225 double ImagMin, ImagMax; … … 233 238 int CLIP_THRESH; 234 239 int USE_BASIC_CHECK; 240 241 int ExcludeBogus; 242 double ExcludeBogusRadius; 235 243 236 244 FitMode FIT_MODE; … … 307 315 int liststats PROTO((double *value, double *dvalue, int N, StatType *stats)); 308 316 int liststats_pos PROTO((double *value, double *dvalue, int N, StatType *stats, int XVERB)); 309 Catalog *load_catalogs PROTO((SkyList *skylist, int *Ncatalog, int subselect, int hostID, char *hostpath ));317 Catalog *load_catalogs PROTO((SkyList *skylist, int *Ncatalog, int subselect, int hostID, char *hostpath, char *syncfile)); 310 318 int load_images PROTO((FITS_DB *db, SkyList *skylist, int UseFullOverlap)); 311 319 Image *select_images PROTO((SkyList *skylist, Image *timage, off_t Ntimage, off_t **LineNumber, off_t *Nimage, int UseFullOverlap)); … … 417 425 int setMeanR (double ra_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt); 418 426 int setMeanD (double dec_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt); 427 double getMeanR_Big (Measure *measure, Average *average, SecFilt *secfilt); 428 double getMeanD_Big (Measure *measure, Average *average, SecFilt *secfilt); 419 429 int setMeanR_Big (double ra_fit, Measure *measure, Average *average, SecFilt *secfilt); 420 430 int setMeanD_Big (double dec_fit, Measure *measure, Average *average, SecFilt *secfilt); … … 521 531 int ImageTableSave (char *filename, Image *images, off_t Nimages); 522 532 int select_mosaics_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage); 533 534 float getColor (off_t meas, int cat); 535 536 int strextend (char *input, char *format,...); 537 538 int areImagesLoaded (); 539 int areImagesMatched (); -
trunk/Ohana/src/relastro/src/BrightCatalog.c
r35105 r36833 167 167 GET_COLUMN(measureOffset, "OFF_MEASURE", int); 168 168 GET_COLUMN(missingOffset, "OFF_MISSING", int); 169 GET_COLUMN( extendOffset, "OFF_EXTEND", int);169 GET_COLUMN(refColor, "REF_COLOR", float); 170 170 GET_COLUMN(flags, "FLAGS", int); 171 171 GET_COLUMN(photFlagsUpper, "PHOTFLAGS_U", int); … … 202 202 average[i].measureOffset = measureOffset[i] ; 203 203 average[i].missingOffset = missingOffset[i] ; 204 average[i]. extendOffset = extendOffset[i] ;204 average[i].refColor = refColor[i] ; 205 205 average[i].flags = flags[i] ; 206 206 average[i].photFlagsUpper = photFlagsUpper[i] ; … … 234 234 free (measureOffset); 235 235 free (missingOffset); 236 free ( extendOffset);236 free (refColor); 237 237 free (flags); 238 238 free (photFlagsUpper); … … 476 476 gfits_define_bintable_column (&theader, "J", "OFF_MEASURE", "offset to first psf measurement", "", 1.0, 1.0*0x8000); 477 477 gfits_define_bintable_column (&theader, "J", "OFF_MISSING", "offset to first missing obs", "", 1.0, 1.0*0x8000); 478 gfits_define_bintable_column (&theader, " J", "OFF_EXTEND", "offset to first extended measurement", "", 1.0, 1.0*0x8000);478 gfits_define_bintable_column (&theader, "E", "REF_COLOR", "reference color", "", 1.0, 0.0); 479 479 gfits_define_bintable_column (&theader, "J", "FLAGS", "average object flags (star; ghost; etc)", "", 1.0, 1.0*0x8000); 480 480 gfits_define_bintable_column (&theader, "J", "PHOTFLAGS_U", "upper bit of 2 bit summary of per-measure photflags", "", 1.0, 1.0*0x8000); … … 510 510 int *measureOffset ; ALLOCATE (measureOffset , int , catalog->Naverage); 511 511 int *missingOffset ; ALLOCATE (missingOffset , int , catalog->Naverage); 512 int *extendOffset ; ALLOCATE (extendOffset , int , catalog->Naverage);512 float *refColor ; ALLOCATE (refColor , float , catalog->Naverage); 513 513 int *flags ; ALLOCATE (flags , int , catalog->Naverage); 514 514 int *photFlagsUpper; ALLOCATE (photFlagsUpper, int , catalog->Naverage); … … 543 543 measureOffset[i] = average[i].measureOffset ; 544 544 missingOffset[i] = average[i].missingOffset ; 545 extendOffset[i] = average[i].extendOffset;545 refColor[i] = average[i].refColor ; 546 546 flags[i] = average[i].flags ; 547 547 photFlagsUpper[i] = average[i].photFlagsUpper ; … … 575 575 gfits_set_bintable_column (&theader, &ftable, "OFF_MEASURE", measureOffset, catalog->Naverage); 576 576 gfits_set_bintable_column (&theader, &ftable, "OFF_MISSING", missingOffset, catalog->Naverage); 577 gfits_set_bintable_column (&theader, &ftable, " OFF_EXTEND", extendOffset,catalog->Naverage);577 gfits_set_bintable_column (&theader, &ftable, "REF_COLOR", refColor, catalog->Naverage); 578 578 gfits_set_bintable_column (&theader, &ftable, "FLAGS", flags, catalog->Naverage); 579 579 gfits_set_bintable_column (&theader, &ftable, "PHOTFLAGS_U", photFlagsUpper, catalog->Naverage); … … 605 605 free (measureOffset); 606 606 free (missingOffset); 607 free ( extendOffset);607 free (refColor); 608 608 free (flags); 609 609 free (photFlagsUpper); -
trunk/Ohana/src/relastro/src/FitChip.c
r33652 r36833 4 4 int FitChip (StarData *raw, StarData *ref, int Nmatch, Image *image) { 5 5 6 int i, NstatFull, Nstat, Niter ;6 int i, NstatFull, Nstat, Niter, Nkeep; 7 7 float dLsig, dMsig, dRsig; 8 8 float dLsigFull, dMsigFull, dRsigFull; … … 24 24 25 25 // measure the scatter distribution (use only the bright end detections) 26 Nkeep = 0; 26 27 for (i = 0; i < Nmatch; i++) { 27 28 if (raw[i].mask) continue; … … 42 43 continue; 43 44 } 44 } 45 Nkeep ++; 46 } 47 48 // I'm rejecting some points from the fit above; I count the remainders and actually 49 // use that count to set order_use below 45 50 46 51 // figures to assess the fitting process: … … 50 55 relastroVisualPlotChipFit(raw, ref, dRmax, Nmatch); 51 56 52 // fit the requested order polynomial 53 if (CHIPORDER > 0) { 54 int Ndof_min = 3; 55 int order_max = 0.5*(sqrt(4*Nmatch - 4*Ndof_min + 1) - 3); 56 int order_use = MIN (CHIPORDER, order_max); 57 if (order_use < 1) { 58 if (VERBOSE2) fprintf (stderr, "insufficient measurements (%d) for linear fit\n", Nmatch); 59 image[0].flags |= ID_IMAGE_ASTROM_FEW; 60 return FALSE; 61 } 62 image[0].coords.Npolyterms = order_use; 63 } 57 // set the maximum order for the polynomial (based on number of stars kept above) 58 int order_use = 0; 59 if (Nkeep > 5) order_use = 1; // 4 stars per polynomial term (per dimension) 60 if (Nkeep > 30) order_use = 2; // 5 stars per polynomial term (per dimension) 61 if (Nkeep > 60) order_use = 3; // 6 stars per polynomial term (per dimension) 62 if (order_use < 1) { 63 if (VERBOSE2) fprintf (stderr, "insufficient measurements (%d) for linear fit\n", Nkeep); 64 image[0].flags |= ID_IMAGE_ASTROM_FEW; 65 return FALSE; 66 } 67 image[0].coords.Npolyterms = order_use; 64 68 65 69 if (fit) fit_free (fit); … … 71 75 fit_add (fit, raw[i].X, raw[i].Y, ref[i].L, ref[i].M, raw[i].dPos); 72 76 } 73 74 # if (0)75 // check if the fit has enough data points for the polynomial order76 skip = FALSE;77 switch (image[0].coords.Npolyterms) {78 case 0:79 case 1:80 skip = (fit[0].Npts < 8);81 break;82 case 2:83 skip = (fit[0].Npts < 11);84 break;85 case 3:86 skip = (fit[0].Npts < 15);87 break;88 default:89 fprintf (stderr, "invalid chip order %d\n", image[0].coords.Npolyterms);90 skip = TRUE;91 }92 if (skip) {93 if (VERBOSE2) fprintf (stderr, "insufficient measurements (%d) for requested order (%d)\n", fit[0].Npts, image[0].coords.Npolyterms);94 fit_free (fit);95 image[0].flags |= ID_IMAGE_ASTROM_FEW;96 return FALSE;97 }98 # endif99 77 100 78 // measure the fit, update the coords & object coordinates … … 134 112 } 135 113 114 int Ncolor = 0; 115 float *colorList = NULL; 116 ALLOCATE (colorList, float, Nmatch); 117 118 for (i = 0; i < Nmatch; i++) { 119 if (!raw[i].mask) continue; 120 if (!isnan(ref[i].Color)) { 121 colorList[Ncolor] = ref[i].Color; 122 Ncolor ++; 123 } 124 } 125 fsort (colorList, Ncolor); 126 float colorMedian = (Ncolor > 0) ? colorList[(int)(0.5*Ncolor)] : NAN; 127 image[0].refColor = colorMedian; 128 free (colorList); 129 136 130 GetScatterRawRef(&dLsigFull, &dMsigFull, &dRsigFull, &NstatFull, raw, ref, Nmatch, SIGMA_LIM); 137 131 GetScatterRawRef(&dLsig, &dMsig, &dRsig, &Nstat, raw, ref, Nmatch, IMFIT_SYS_SIGMA_LIM); … … 151 145 image[0].dYpixSys = dMsig; 152 146 image[0].nFitAstrom = fit[0].Npts; 147 148 // fprintf (stderr, "%s %6.3f %4d %4d\n", image[0].name, image[0].refColor, Ncolor, image[0].nFitAstrom); 153 149 154 150 if (fit) fit_free (fit); -
trunk/Ohana/src/relastro/src/GetAstromError.c
r33652 r36833 30 30 31 31 code = GetPhotcodebyCode (measure[0].photcode); 32 if (!code) return NAN; 32 33 33 34 // do not raise an exception, just send back the result … … 72 73 73 74 code = GetPhotcodebyCode (measure[0].photcode); 75 if (!code) return NAN; 74 76 75 77 // do not raise an exception, just send back the result -
trunk/Ohana/src/relastro/src/ImageOps.c
r36630 r36833 39 39 // N_onImage was 'Nlist' 40 40 // N_ONIMAGE was 'NLIST' 41 42 int areImagesLoaded () { 43 44 if (image) return TRUE; 45 return FALSE; 46 } 47 48 int areImagesMatched () { 49 50 if (MeasureToImage) return TRUE; 51 return FALSE; 52 } 41 53 42 54 Image *getimages (off_t *N, off_t **line_number) { … … 333 345 */ 334 346 347 float getColor (off_t meas, int cat) { 348 349 off_t i; 350 351 i = MeasureToImage[cat][meas]; 352 if (i == -1) return (NAN); 353 return (image[i].refColor); 354 } 355 335 356 void plot_images () { 336 357 … … 468 489 } 469 490 491 X = measure[0].Xccd; 492 Y = measure[0].Yccd; 470 493 if (USE_FIXED_PIXCOORDS) { 471 X = isfinite(measure[0].Xfix) ? measure[0].Xfix : measure[0].Xccd; 472 Y = isfinite(measure[0].Yfix) ? measure[0].Yfix : measure[0].Yccd; 473 } else { 474 X = measure[0].Xccd; 475 Y = measure[0].Yccd; 494 if (isfinite(measure[0].Xfix) && isfinite(measure[0].Yfix)) { 495 float dX = measure[0].Xfix - measure[0].Xccd; 496 float dY = measure[0].Yfix - measure[0].Yccd; 497 if (hypot(dX,dY) < 2.0) { 498 X = measure[0].Xfix; 499 Y = measure[0].Yfix; 500 } 501 } 476 502 } 477 503 n = measure[0].averef; … … 560 586 561 587 int Noff = NoffRAave + NoffDECave + NoffRAori + NoffDECori; 562 if (VERBOSE && (Noff > 0)) fprintf (stderr, "Noff ave RA %d, Noff ave DEC %d, Noff ori RA %d, Noff ori DEC %d\n", NoffRAave, NoffDECave, NoffRAori, NoffDECori);588 if (VERBOSE2 && (Noff > 0)) fprintf (stderr, "Noff ave RA %d, Noff ave DEC %d, Noff ori RA %d, Noff ori DEC %d\n", NoffRAave, NoffDECave, NoffRAori, NoffDECori); 563 589 saveOffsets (dPos, nPos, im); 564 590 … … 609 635 Measure *measure = &catalog[c].measure[m]; 610 636 637 X = measure[0].Xccd; 638 Y = measure[0].Yccd; 611 639 if (USE_FIXED_PIXCOORDS) { 612 X = isfinite(measure[0].Xfix) ? measure[0].Xfix : measure[0].Xccd; 613 Y = isfinite(measure[0].Yfix) ? measure[0].Yfix : measure[0].Yccd; 614 } else { 615 X = measure[0].Xccd; 616 Y = measure[0].Yccd; 640 if (isfinite(measure[0].Xfix) && isfinite(measure[0].Yfix)) { 641 float dX = measure[0].Xfix - measure[0].Xccd; 642 float dY = measure[0].Yfix - measure[0].Yccd; 643 if (hypot(dX,dY) < 2.0) { 644 X = measure[0].Xfix; 645 Y = measure[0].Yfix; 646 } 647 } 617 648 } 618 649 n = measure[0].averef; … … 679 710 680 711 /* apply the current image transformation or use the current value of R+dR, D+dD? */ 712 raw[i].X = measure[0].Xccd; 713 raw[i].Y = measure[0].Yccd; 681 714 if (USE_FIXED_PIXCOORDS) { 682 raw[i].X = isfinite(measure[0].Xfix) ? measure[0].Xfix : measure[0].Xccd; 683 raw[i].Y = isfinite(measure[0].Yfix) ? measure[0].Yfix : measure[0].Yccd; 684 } else { 685 raw[i].X = measure[0].Xccd; 686 raw[i].Y = measure[0].Yccd; 687 } 688 715 if (isfinite(measure[0].Xfix) && isfinite(measure[0].Yfix)) { 716 float dX = measure[0].Xfix - measure[0].Xccd; 717 float dY = measure[0].Yfix - measure[0].Yccd; 718 if (hypot(dX,dY) < 2.0) { 719 raw[i].X = measure[0].Xfix; 720 raw[i].Y = measure[0].Yfix; 721 } 722 } 723 } 689 724 raw[i].Mag = measure[0].M; 690 725 raw[i].dMag = measure[0].dM; … … 738 773 StarData *ref; 739 774 775 int Nsecfilt = GetPhotcodeNsecfilt(); 776 740 777 mosaic = NULL; 741 778 moscoords = NULL; … … 765 802 ref[i].dMag = measure[0].dM; 766 803 ref[i].dPos = GetAstromErrorTiny (&measure[0], ERROR_MODE_POS); 804 805 if ((DCR_NSEC_POS >= 0) && (DCR_NSEC_NEG >= -1)) { 806 ref[i].Color = catalog[c].secfilt[n*Nsecfilt + DCR_NSEC_POS].M - catalog[c].secfilt[n*Nsecfilt + DCR_NSEC_NEG].M; 807 } 767 808 768 809 ref[i].mask = FALSE; … … 859 900 N = 0; 860 901 for (k = 0; k < catalog[0].average[j].Nmeasure; k++) { 861 // reset flag on each invocation902 // reset flag on each invocation 862 903 measure[k].dbFlags &= ~ID_MEAS_POOR_ASTROM; 863 904 … … 898 939 double *R, *D, *dR, *dD, *d2; 899 940 StatType statsR, statsD; 941 942 // XXX we are not going to use this for now 943 return; 900 944 901 945 Nsecfilt = GetPhotcodeNsecfilt(); … … 1063 1107 } else { 1064 1108 code = GetPhotcodebyCode (measure[0].photcode); 1109 if (!code) return FALSE; 1065 1110 mask = code[0].astromBadMask; 1066 1111 } … … 1129 1174 } else { 1130 1175 code = GetPhotcodebyCode (measure[0].photcode); 1176 if (!code) return FALSE; 1131 1177 mask = code[0].astromBadMask; 1132 1178 } -
trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c
r35763 r36833 126 126 table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, MIN_ERROR); 127 127 128 char tmpline[1024]; 129 if (FIT_MODE == FIT_PM_ONLY) { snprintf (tmpline, 1024, "%s -pm", command); strcpy (command, tmpline); } 130 if (FIT_MODE == FIT_PAR_ONLY) { snprintf (tmpline, 1024, "%s -par", command); strcpy (command, tmpline); } 131 if (FIT_MODE == FIT_PM_AND_PAR) { snprintf (tmpline, 1024, "%s -pmpar", command); strcpy (command, tmpline); } 132 133 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 134 if (VERBOSE2) { snprintf (tmpline, 1024, "%s -vv", command); strcpy (command, tmpline); } 135 if (RESET) { snprintf (tmpline, 1024, "%s -reset", command); strcpy (command, tmpline); } 136 if (UPDATE) { snprintf (tmpline, 1024, "%s -update", command); strcpy (command, tmpline); } 137 138 if (RESET_BAD_IMAGES) { snprintf (tmpline, 1024, "%s -reset-bad-images", command); strcpy (command, tmpline); } 139 140 if (ImagSelect) { snprintf (tmpline, 1024, "%s -instmag %f %f", command, ImagMin, ImagMax); strcpy (command, tmpline); } 141 if (MaxDensityUse) { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue); strcpy (command, tmpline); } 128 if (FIT_MODE == FIT_PM_ONLY) strextend (command, "-pm"); 129 if (FIT_MODE == FIT_PAR_ONLY) strextend (command, "-par"); 130 if (FIT_MODE == FIT_PM_AND_PAR) strextend (command, "-pmpar"); 131 132 if (VERBOSE) strextend (command, "-v"); 133 if (VERBOSE2) strextend (command, "-vv"); 134 if (RESET) strextend (command, "-reset"); 135 if (UPDATE) strextend (command, "-update"); 136 137 if (RESET_BAD_IMAGES) strextend (command, "-reset-bad-images"); 138 139 if (ImagSelect) strextend (command, "-instmag %f %f", ImagMin, ImagMax); 140 if (MaxDensityUse) strextend (command, "-max-density %f", MaxDensityValue); 142 141 143 if (USE_BASIC_CHECK) { snprintf (tmpline, 1024, "%s -basic-image-search", command); strcpy (command, tmpline); } 144 if (FlagOutlier) { snprintf (tmpline, 1024, "%s -clip %d", command, CLIP_THRESH); strcpy (command, tmpline); } 142 if (USE_BASIC_CHECK) strextend (command, "-basic-image-search"); 143 if (FlagOutlier) strextend (command, "-clip %d", CLIP_THRESH); 144 if (ExcludeBogus) strextend (command, "-exclude-bogus %f", ExcludeBogusRadius); 145 145 146 if (USE_FIXED_PIXCOORDS) { snprintf (tmpline, 1024, "%s -D USE_FIXED_PIXCOORDS 1", command); strcpy (command, tmpline); }147 148 if (PHOTCODE_KEEP_LIST) { snprintf (tmpline, 1024, "%s +photcode %s", command, PHOTCODE_KEEP_LIST); strcpy (command, tmpline); }149 if (PHOTCODE_SKIP_LIST) { snprintf (tmpline, 1024, "%s -photcode %s", command, PHOTCODE_SKIP_LIST); strcpy (command, tmpline); }150 if (PhotFlagSelect) { snprintf (tmpline, 1024, "%s +photflags", command); strcpy (command, tmpline); }151 if (PhotFlagBad) { snprintf (tmpline, 1024, "%s +photflagbad %d", command, PhotFlagBad); strcpy (command, tmpline); }152 if (PhotFlagPoor) { snprintf (tmpline, 1024, "%s +photflagpoor %d", command, PhotFlagPoor); strcpy (command, tmpline); }146 if (USE_FIXED_PIXCOORDS) strextend (command, "-D USE_FIXED_PIXCOORDS 1"); 147 148 if (PHOTCODE_KEEP_LIST) strextend (command, "+photcode %s", PHOTCODE_KEEP_LIST); 149 if (PHOTCODE_SKIP_LIST) strextend (command, "-photcode %s", PHOTCODE_SKIP_LIST); 150 if (PhotFlagSelect) strextend (command, "+photflags"); 151 if (PhotFlagBad) strextend (command, "+photflagbad %d", PhotFlagBad); 152 if (PhotFlagPoor) strextend (command, "+photflagpoor %d", PhotFlagPoor); 153 153 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 154 154 155 if (MinBadQF > 0.0) { snprintf (tmpline, 1024, "%s -min-bad-psfqf %f", command, MinBadQF); strcpy (command, tmpline); } 156 if (MaxMeanOffset != 10.0) { snprintf (tmpline, 1024, "%s -max-mean-offset %f", command, MaxMeanOffset); strcpy (command, tmpline); } 155 if (DCR_COLOR_POS && DCR_COLOR_NEG) { 156 strextend (command, "-dcr-color %s %s", DCR_COLOR_POS, DCR_COLOR_NEG); 157 } 158 159 if (MinBadQF > 0.0) strextend (command, "-min-bad-psfqf %f", MinBadQF); 160 if (MaxMeanOffset != 10.0) strextend (command, "-max-mean-offset %f", MaxMeanOffset); 157 161 158 162 if (TimeSelect) { 159 163 char *tstart = ohana_sec_to_date (TSTART); 160 164 char *tstop = ohana_sec_to_date (TSTOP); 161 s nprintf (tmpline, 1024, "%s -time %s %s", command, tstart, tstop);165 strextend (command, "-time %s %s", tstart, tstop); 162 166 free (tstart); 163 167 free (tstop); 164 strcpy (command, tmpline);165 168 } 166 169 fprintf (stderr, "command: %s\n", command); -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r36630 r36833 10 10 static double *T; 11 11 static double *dT; 12 static double *C; 12 13 13 14 void initObjectData (Catalog *catalog, int Ncatalog) { … … 36 37 ALLOCATE (pX, double, MAX (1, Nmax)); 37 38 ALLOCATE (pY, double, MAX (1, Nmax)); 39 40 ALLOCATE (C, double, MAX (1, Nmax)); 38 41 } 39 42 … … 54 57 free (pX); 55 58 free (pY); 59 60 free (C); 56 61 } 57 62 … … 61 66 62 67 off_t j, k, m; 63 int i, N, N secfilt, mode, result, status, XVERB;68 int i, N, Nc, Nsecfilt, mode, result, status, XVERB; 64 69 StatType statsR, statsD; 65 70 Coords coords; … … 75 80 memset (&fitPAR, 0, sizeof(fitPAR)); 76 81 initObjectData (catalog, Ncatalog); 82 83 int setRefColor = areImagesMatched(); 77 84 78 85 /* project coordinates to a plane centered on the object with units of arcsec */ … … 112 119 fitPAR.chisq = NAN; 113 120 121 // if we fail to fit the astrometry for some reason, we need to set/reset these 122 catalog[i].average[j].flags |= ID_STAR_NO_ASTROM; 123 catalog[i].average[j].ChiSqAve = NAN; 124 catalog[i].average[j].ChiSqPM = NAN; 125 catalog[i].average[j].ChiSqPar = NAN; 126 catalog[i].average[j].Npos = 0; 127 114 128 if (catalog[i].average[j].Nmeasure == 0) { 115 continue; 116 } 117 129 continue; 130 } 131 132 Nc = 0; 118 133 N = 0; 119 134 m = catalog[i].average[j].measureOffset; … … 138 153 } 139 154 155 // reset the bit to note that a detection was used (or not) 156 measure[k].dbFlags &= ~ID_MEAS_USED_OBJ; 157 if (measureBig) { measureBig[k].dbFlags &= ~ID_MEAS_USED_OBJ; } 158 140 159 // does the measurement pass the supplied filtering constraints? 141 160 // MeasFilterTestTiny does not test psfQF 161 // exclude bad detections based on: photcodes, psfQF, time range, photflags & astromBadMask, mag_inst 142 162 int keepMeasure = measureBig ? MeasFilterTest(&measureBig[k], FALSE) : MeasFilterTestTiny(&measure[k], FALSE); 143 163 if (!keepMeasure) { 144 measure[k].dbFlags &= ~ID_MEAS_USED_OBJ;145 if (measureBig) { measureBig[k].dbFlags &= ~ID_MEAS_USED_OBJ; }146 164 continue; 147 165 } 148 166 167 // mark (as POOR) any measurements which are deviant from the mean by > ExcludeBogusRadius 168 if (ExcludeBogus) { 169 double Ri = getMeanR (&measure[k], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); 170 double Di = getMeanD (&measure[k], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); 171 coords.crval1 = catalog[i].average[j].R; 172 coords.crval2 = catalog[i].average[j].D; 173 double Xi, Yi; 174 RD_to_XY (&Xi, &Yi, Ri, Di, &coords); 175 double radius = hypot(Xi, Yi); 176 if (radius > ExcludeBogusRadius) { 177 measure[k].dbFlags |= ID_MEAS_POOR_ASTROM; 178 if (measureBig) { measureBig[k].dbFlags |= ID_MEAS_POOR_ASTROM; } 179 continue; 180 } 181 measure[k].dbFlags &= ~ID_MEAS_POOR_ASTROM; 182 if (measureBig) { measureBig[k].dbFlags &= ~ID_MEAS_POOR_ASTROM; } 183 } 184 149 185 // outlier rejection 150 if (FlagOutlier && (measure[k].dbFlags & ID_MEAS_POOR_ASTROM)) { 151 measure[k].dbFlags &= ~ID_MEAS_USED_OBJ; 152 if (measureBig) { measureBig[k].dbFlags &= ~ID_MEAS_USED_OBJ; } 186 if (FALSE && FlagOutlier && (measure[k].dbFlags & ID_MEAS_POOR_ASTROM)) { 153 187 continue; 154 188 } 155 156 measure[k].dbFlags |= ID_MEAS_USED_OBJ;157 if (measureBig) { measureBig[k].dbFlags |= ID_MEAS_USED_OBJ; }158 189 159 190 R[N] = getMeanR (&measure[k], &catalog[i].average[j], &catalog[i].secfilt[j*Nsecfilt]); … … 170 201 // allow a given photcode or measurement to be 171 202 // ignored if the error is NAN (for photcode, set astromErrSys to NaN) 172 if (isnan(dX[N])) { 173 measure[k].dbFlags &= ~ID_MEAS_USED_OBJ; 174 if (measureBig) { measureBig[k].dbFlags &= ~ID_MEAS_USED_OBJ; } 175 continue; 176 } 177 if (isnan(dY[N])) { 178 measure[k].dbFlags &= ~ID_MEAS_USED_OBJ; 179 if (measureBig) { measureBig[k].dbFlags &= ~ID_MEAS_USED_OBJ; } 180 continue; 181 } 203 if (isnan(dX[N])) continue; 204 if (isnan(dY[N])) continue; 182 205 183 206 // add systematic error in quadrature, if desired … … 201 224 dD[N] = dY[N] / 3600.0; 202 225 226 if (setRefColor) { 227 float color = getColor (m+k, i); 228 if (!isnan(color)) { 229 C[Nc] = color; 230 Nc++; 231 } 232 } 233 234 measure[k].dbFlags |= ID_MEAS_USED_OBJ; 235 if (measureBig) { measureBig[k].dbFlags |= ID_MEAS_USED_OBJ; } 236 203 237 N++; 204 } 238 } // loop over measurements : catalog[i].average[j].Nmeasure 205 239 206 240 // if we have too few good detections for the desired fit, or too limited a 207 241 // baseline, use a fit with fewer parameters. XXX if we have too few measurements 208 242 // for even the average position, consider including the lower-quality detections? 209 210 catalog[i].average[j].flags &= ~ID_STAR_NO_ASTROM;211 243 212 244 // find Tmin & Tmax from the list of accepted measurements … … 231 263 // too few measurements for average position (require 2 values) 232 264 if (N < SRC_MEAS_TOOFEW) { 233 // XXX need to define PHOTOM and ASTROM object flags234 // XXX reset the average value fields?235 catalog[i].average[j].flags |= ID_STAR_NO_ASTROM;236 catalog[i].average[j].ChiSqAve = NAN;237 catalog[i].average[j].ChiSqPM = NAN;238 catalog[i].average[j].ChiSqPar = NAN;239 265 if (N < 2) continue; 240 266 } … … 268 294 catalog[i].average[j].flags |= ID_STAR_FIT_PM; 269 295 Npm ++; 296 297 // XXX a hard-wired hack... 298 if ((fabs(fitPM.uR) > 2.0) || (fabs(fitPM.uD) > 2.0)) { 299 mode = FIT_AVERAGE; 300 catalog[i].average[j].flags |= ID_STAR_BAD_PM; 301 } 270 302 } 271 303 272 304 if (mode == FIT_PM_AND_PAR) { 273 // fprintf (stderr, "parallax fitting is still untested (%s, %d)\n", __FILE__, __LINE__);274 275 305 float pXmin = +2.0; 276 306 float pXmax = -2.0; … … 296 326 catalog[i].average[j].flags |= ID_STAR_FIT_PAR; 297 327 Npar ++; 328 329 // XXX a hard-wired hack... 330 if ((fabs(fitPAR.uR) > 2.0) || (fabs(fitPAR.uD) > 2.0)) { 331 mode = FIT_AVERAGE; 332 catalog[i].average[j].flags |= ID_STAR_BAD_PM; 333 } 298 334 } else { 299 335 // need to set mode = FIT_PM_ONLY if we do not fit for parallax … … 321 357 catalog[i].average[j].flags |= ID_STAR_FIT_AVE; 322 358 Nave ++; 359 } 360 361 if (setRefColor) { 362 dsort (C, Nc); 363 float colorMedian = (Nc > 0) ? C[(int)(0.5*Nc)] : NAN; 364 catalog[i].average[j].refColor = colorMedian; 323 365 } 324 366 … … 411 453 catalog[i].average[j].Trange = (Trange * 86400 * 365.25); 412 454 catalog[i].average[j].Npos = fit.Nfit; 455 456 // unset the NO_ASTROM bit (not(NO_ASTROM) == HAVE_ASTROM) 457 catalog[i].average[j].flags &= ~ID_STAR_NO_ASTROM; 458 413 459 if (XVERB) fprintf (stderr, "%f %f -> %f %f (%f,%f) pm=(%f %f) chisq=(%f, %f, %f)\n", 414 460 catalog[i].average[j].R, -
trunk/Ohana/src/relastro/src/args.c
r36630 r36833 179 179 FlagOutlier = FALSE; 180 180 if ((N = get_argument (argc, argv, "-clip"))) { 181 fprintf (stderr, "-clip is currently disabled\n"); 181 182 remove_argument (N, &argc, argv); 182 183 CLIP_THRESH = atof (argv[N]); 183 184 remove_argument (N, &argc, argv); 184 185 FlagOutlier = TRUE; 186 } 187 188 ExcludeBogus = FALSE; 189 ExcludeBogusRadius = 0.0; 190 if ((N = get_argument (argc, argv, "-exclude-bogus"))) { 191 remove_argument (N, &argc, argv); 192 ExcludeBogusRadius = atof (argv[N]); 193 remove_argument (N, &argc, argv); 194 ExcludeBogus = TRUE; 185 195 } 186 196 … … 284 294 } 285 295 296 DCR_COLOR_POS = NULL; 297 DCR_COLOR_NEG = NULL; 298 if ((N = get_argument (argc, argv, "-dcr-color"))) { 299 remove_argument (N, &argc, argv); 300 DCR_COLOR_POS = strcreate(argv[N]); 301 remove_argument (N, &argc, argv); 302 DCR_COLOR_NEG = strcreate(argv[N]); 303 remove_argument (N, &argc, argv); 304 } 305 306 PHOTCODE_RESET_LIST = NULL; 307 if ((N = get_argument (argc, argv, "-reset-to-photcode"))) { 308 remove_argument (N, &argc, argv); 309 PHOTCODE_RESET_LIST = strcreate(argv[N]); 310 remove_argument (N, &argc, argv); 311 } 312 286 313 PHOTCODE_KEEP_LIST = NULL; 287 314 if ((N = get_argument (argc, argv, "+photcode"))) { … … 291 318 } 292 319 293 PHOTCODE_SKIP_LIST = strcreate("SCOS.103a.E,SCOS.4414.OG590,SCOS.4415.OG590,SCOS.IIIaF.OG590,SCOS.IIIaF.RG610,SCOS.IIIaF.RG630,SCOS.IIIaJ.GG385,SCOS.IIIaJ.GG395,SCOS.IVN.RG715,SCOS.IVN.RG9"); 320 char *SuperCOSMOS_SKIP = strcreate("SCOS.103a.E,SCOS.4414.OG590,SCOS.4415.OG590,SCOS.IIIaF.OG590,SCOS.IIIaF.RG610,SCOS.IIIaF.RG630,SCOS.IIIaJ.GG385,SCOS.IIIaJ.GG395,SCOS.IVN.RG715,SCOS.IVN.RG9"); 321 322 PHOTCODE_SKIP_LIST = NULL; 294 323 if ((N = get_argument (argc, argv, "-photcode"))) { 295 324 remove_argument (N, &argc, argv); 296 char * tmp1= strcreate(argv[N]);297 298 int Ntotal = strlen(tmp1) + strlen(PHOTCODE_SKIP_LIST) + 5;299 300 char *tmp2 = NULL;301 ALLOCATE (tmp2, char, Ntotal);302 snprintf (tmp2, Ntotal, "%s,%s", PHOTCODE_SKIP_LIST, tmp1);303 304 free (tmp1);305 free (PHOTCODE_SKIP_LIST);306 307 PHOTCODE_SKIP_LIST = tmp2;325 char *RawSkip = strcreate(argv[N]); 326 327 char *GotSkip = strstr (RawSkip, SuperCOSMOS_SKIP); 328 if (!GotSkip) { 329 int Ntotal = strlen(RawSkip) + strlen(SuperCOSMOS_SKIP) + 5; 330 ALLOCATE (PHOTCODE_SKIP_LIST, char, Ntotal); 331 snprintf (PHOTCODE_SKIP_LIST, Ntotal, "%s,%s", SuperCOSMOS_SKIP, RawSkip); 332 free (RawSkip); 333 free (SuperCOSMOS_SKIP); 334 } else { 335 PHOTCODE_SKIP_LIST = RawSkip; 336 } 308 337 remove_argument (N, &argc, argv); 309 338 } … … 582 611 FlagOutlier = FALSE; 583 612 if ((N = get_argument (argc, argv, "-clip"))) { 613 fprintf (stderr, "-clip is currently disabled\n"); 584 614 remove_argument (N, &argc, argv); 585 615 CLIP_THRESH = atof (argv[N]); 586 616 remove_argument (N, &argc, argv); 587 617 FlagOutlier = TRUE; 618 } 619 620 ExcludeBogus = FALSE; 621 ExcludeBogusRadius = 0.0; 622 if ((N = get_argument (argc, argv, "-exclude-bogus"))) { 623 remove_argument (N, &argc, argv); 624 ExcludeBogusRadius = atof (argv[N]); 625 remove_argument (N, &argc, argv); 626 ExcludeBogus = TRUE; 588 627 } 589 628 … … 655 694 remove_argument (N, &argc, argv); 656 695 TimeSelect = TRUE; 696 } 697 698 DCR_COLOR_POS = NULL; 699 DCR_COLOR_NEG = NULL; 700 if ((N = get_argument (argc, argv, "-dcr-color"))) { 701 remove_argument (N, &argc, argv); 702 DCR_COLOR_POS = strcreate(argv[N]); 703 remove_argument (N, &argc, argv); 704 DCR_COLOR_NEG = strcreate(argv[N]); 705 remove_argument (N, &argc, argv); 706 } 707 708 PHOTCODE_RESET_LIST = NULL; 709 if ((N = get_argument (argc, argv, "-reset-to-photcode"))) { 710 remove_argument (N, &argc, argv); 711 PHOTCODE_RESET_LIST = strcreate(argv[N]); 712 remove_argument (N, &argc, argv); 657 713 } 658 714 … … 861 917 exit (2); 862 918 } 919 920 int strextend (char *input, char *format,...) { 921 922 char tmpextra[1024], tmpline[1024]; 923 va_list argp; 924 925 va_start (argp, format); 926 vsnprintf (tmpextra, 1024, format, argp); 927 snprintf (tmpline, 1024, "%s %s", input, tmpextra); 928 strcpy (input, tmpline); 929 930 return TRUE; 931 } -
trunk/Ohana/src/relastro/src/bcatalog.c
r34429 r36833 1 1 # include "relastro.h" 2 2 3 static int Nkeep1 = 0; 4 static int Nkeep2 = 0; 3 5 static int Nskip1 = 0; 4 6 static int Nskip2 = 0; 5 static unsigned int Tref = 1323353985; 6 static short Cref = 10355; 7 8 FILE *fbogus = NULL; 9 static int NskipBogus = 0; 10 11 // test image: 2013/06/15,13:25:51, GPC1.r.XY50 12 static int CHECK_TEST_IMAGE = FALSE; 13 // static unsigned int Tref = 1378812312; 14 // static short Cref = 10001; 15 16 static unsigned int Tref = 1379570672; 17 static short Cref = 10341; 18 19 int LimitDensityCatalog_ByNmeasureGrid (Catalog *subcatalog, Catalog *oldcatalog); 7 20 8 21 int bcatalog (Catalog *subcatalog, Catalog *catalog) { … … 11 24 off_t NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm; 12 25 int Nsecfilt; 26 Coords coords; 27 28 /* for outlier rejection, project coordinates to a plane centered on the object with units of arcsec */ 29 coords.crval1 = 0; 30 coords.crval2 = 0; 31 coords.crpix1 = 0; 32 coords.crpix2 = 0; 33 coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0; 34 coords.pc1_1 = coords.pc2_2 = 1.0; 35 coords.pc1_2 = coords.pc2_1 = 0.0; 36 coords.Npolyterms = 1; 37 strcpy (coords.ctype, "DEC--SIN"); 13 38 14 39 // XXX in the future, use catalog[0].Nsecfilt only? allow catalogs to have variable Nsecfilt? … … 34 59 ID_STAR_NO_ASTROM ; 35 60 61 if (VERBOSE2 && ExcludeBogus && (fbogus == NULL)) { 62 char name[1024]; 63 snprintf (name, 1024, "%s/bogus.%02d.dat", CATDIR, HOST_ID); 64 fbogus = fopen (name, "w"); 65 if (!fbogus) { 66 fprintf (stderr, "trouble opening bogus detection dump : %s\n", name); 67 } 68 } 69 36 70 /* exclude stars not in range or with too few measurements */ 37 71 for (i = 0; i < catalog[0].Naverage; i++) { … … 60 94 if (!MeasFilterTest(&catalog[0].measure[offset], TRUE)) { 61 95 catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP; 62 if ( FALSE && (abs(catalog[0].measure[offset].t - Tref) < 10) && (catalog[0].measure[offset].photcode == Cref)) {96 if (CHECK_TEST_IMAGE && (abs(catalog[0].measure[offset].t - Tref) < 10) && (catalog[0].measure[offset].photcode == Cref)) { 63 97 Nskip1 ++; 64 98 } 65 99 continue; 66 100 } 67 68 // filter out outliers 69 if (FlagOutlier && (catalog[0].measure[offset].dbFlags & ID_MEAS_POOR_ASTROM)) { 101 if (CHECK_TEST_IMAGE && (abs(catalog[0].measure[offset].t - Tref) < 10) && (catalog[0].measure[offset].photcode == Cref)) { 102 Nkeep1 ++; 103 } 104 105 // filter out outliers - these are detections inconsistent with the offset distribution 106 // XXX disable this for now 107 if (FALSE && FlagOutlier && (catalog[0].measure[offset].dbFlags & ID_MEAS_POOR_ASTROM)) { 70 108 catalog[0].measure[offset].dbFlags &= ~ID_MEAS_USED_CHIP; 71 109 if (FALSE && (abs(catalog[0].measure[offset].t - Tref) < 10) && (catalog[0].measure[offset].photcode == Cref)) { … … 76 114 catalog[0].measure[offset].dbFlags |= ID_MEAS_USED_CHIP; 77 115 116 // exclude bogus 117 if (ExcludeBogus) { 118 double Ri = getMeanR_Big (&catalog[0].measure[offset], &catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt]); 119 double Di = getMeanD_Big (&catalog[0].measure[offset], &catalog[0].average[i], &catalog[0].secfilt[i*Nsecfilt]); 120 coords.crval1 = catalog[0].average[i].R; 121 coords.crval2 = catalog[0].average[i].D; 122 double Xi, Yi; 123 RD_to_XY (&Xi, &Yi, Ri, Di, &coords); 124 double radius = hypot(Xi, Yi); 125 if (radius > ExcludeBogusRadius) { 126 NskipBogus ++; 127 if (VERBOSE2) { 128 FILE *foutput = fbogus ? fbogus : stderr; 129 char *date = ohana_sec_to_date(catalog[0].measure[offset].t); 130 fprintf (foutput, "exclude bogus: %10.6f %10.6f : %10.6f %10.6f : %6.2f %6.2f : %6.2f : %5d %s\n", catalog[0].average[i].R, catalog[0].average[i].D, Ri, Di, Xi, Yi, radius, catalog[0].measure[offset].photcode, date); 131 free (date); 132 } 133 continue; 134 } 135 } 136 78 137 // re-assess on each run of relastro if a measurement should be used 79 138 … … 87 146 // but before the final average properties are calculated, these measurements may be 88 147 // allowed. 148 149 if (CHECK_TEST_IMAGE && (abs(catalog[0].measure[offset].t - Tref) < 10) && (catalog[0].measure[offset].photcode == Cref)) { 150 Nkeep2 ++; 151 } 89 152 90 153 CopyMeasureToTiny (&subcatalog[0].measureT[Nmeasure], &catalog[0].measure[offset]); … … 125 188 // limit the total number of stars in the catalog 126 189 if (MaxDensityUse) { 127 LimitDensityCatalog_ByNmeasure (subcatalog, catalog);190 LimitDensityCatalog_ByNmeasureGrid (subcatalog, catalog); 128 191 } else { 129 192 if (VERBOSE2) { … … 134 197 } 135 198 } 199 if (CHECK_TEST_IMAGE && (Nkeep1 + Nkeep2 + Nskip1 + Nskip2 > 0)) { 200 fprintf (stderr, "kept %d %d, skipped %d %d\n", Nkeep1, Nkeep2, Nskip1, Nskip2); 201 } 202 136 203 return (TRUE); 137 204 } 138 205 139 206 void bcatalog_show_skips () { 140 fprintf (stderr, "Nskip: %d, %d\n", Nskip1, Nskip2); 207 if (ExcludeBogus) { 208 if (fbogus) fclose (fbogus); 209 fprintf (stderr, "NskipBogus: %d\n", NskipBogus); 210 // fprintf (stderr, "Nskip: %d, %d\n", Nskip1, Nskip2); 211 // fprintf (stderr, "Nkeep: %d, %d\n", Nkeep1, Nkeep2); 212 } 141 213 } 142 214 … … 155 227 # undef COMPARE 156 228 229 } 230 231 /* generate a grid in a locally-projected coordinate system, try to select average entries 232 from each grid cell in decending Nmeasure order. 233 */ 234 int LimitDensityCatalog_ByNmeasureGrid (Catalog *subcatalog, Catalog *oldcatalog) { 235 236 off_t i, j; 237 int ix, iy; 238 239 Catalog tmpcatalog; 240 241 double Rmin, Rmax, Dmin, Dmax; 242 243 int Nsecfilt = GetPhotcodeNsecfilt (); 244 245 gfits_scan (&oldcatalog[0].header, "RA0", "%lf", 1, &Rmin); 246 gfits_scan (&oldcatalog[0].header, "DEC0", "%lf", 1, &Dmin); 247 gfits_scan (&oldcatalog[0].header, "RA1", "%lf", 1, &Rmax); 248 gfits_scan (&oldcatalog[0].header, "DEC1", "%lf", 1, &Dmax); 249 250 if (VERBOSE2) fprintf (stderr, "extracting from catalog covering region %f,%f to %f,%f\n", Rmin, Dmin, Rmax, Dmax); 251 252 float AREA = fabs(Dmax - Dmin) * fabs(Rmax - Rmin) * cos (0.5*RAD_DEG*(Dmax + Dmin)); 253 assert (AREA > 0); 254 255 off_t Nmax = MaxDensityValue * AREA; 256 if (subcatalog[0].Naverage <= Nmax) { 257 if (VERBOSE) { 258 fprintf (stderr, "subcatalog has less than the max density\n"); 259 } 260 return (TRUE); 261 } 262 263 off_t Naverage = subcatalog[0].Naverage; 264 265 // generate a grid in locally projected space 266 double Rc = 0.5*(Rmin + Rmax); 267 double Dc = 0.5*(Dmin + Dmax); 268 269 /* project coordinates to a plane centered on the object with units of arcsec */ 270 Coords coords; 271 coords.crval1 = Rc; 272 coords.crval2 = Dc; 273 coords.crpix1 = 0; 274 coords.crpix2 = 0; 275 coords.cdelt1 = coords.cdelt2 = 1.0 / 3600.0; 276 coords.pc1_1 = coords.pc2_2 = 1.0; 277 coords.pc1_2 = coords.pc2_1 = 0.0; 278 coords.Npolyterms = 1; 279 strcpy (coords.ctype, "DEC--SIN"); 280 281 // convert all average R,D values to X,Y: 282 double *X, *Y; 283 ALLOCATE (X, double, Naverage); 284 ALLOCATE (Y, double, Naverage); 285 float Xmin = +10000.0, Ymin = +10000.0; 286 float Xmax = -10000.0, Ymax = -10000.0; 287 for (i = 0; i < Naverage; i++) { 288 X[i] = NAN; 289 Y[i] = NAN; 290 // skip any stars which are outside of nominal catalog range 291 if (subcatalog[0].average[i].R < Rmin) continue; 292 if (subcatalog[0].average[i].R > Rmax) continue; 293 if (subcatalog[0].average[i].D < Dmin) continue; 294 if (subcatalog[0].average[i].D > Dmax) continue; 295 RD_to_XY (&X[i], &Y[i], subcatalog[0].average[i].R, subcatalog[0].average[i].D, &coords); 296 Xmin = MIN (Xmin, X[i]); 297 Xmax = MAX (Xmax, X[i]); 298 Ymin = MIN (Ymin, Y[i]); 299 Ymax = MAX (Ymax, Y[i]); 300 } 301 302 // how many grid cells? what is the grid spacing? 303 float dX = Xmax - Xmin; 304 float dY = Ymax - Ymin; 305 306 // *** XXX for the moment, I'm using a hard-wired cell size (200 arcsec ~ 3.3 arcmin) 307 int NX = (int)(dX / 200) + 1; 308 int NY = (int)(dY / 200) + 1; 309 // fprintf (stderr, "Density Grid: %d x %d\n", NX, NY); 310 // XXX check that NX,NY are sensible (5 degrees / 200 arcsec seems like the absolute max) 311 if (NX > 1000) { 312 fprintf (stderr, "serious problem with %s: NX = %d\n", subcatalog[0].filename, NX); 313 exit (3); 314 } 315 if (NY > 1000) { 316 fprintf (stderr, "serious problem with %s: NY = %d\n", subcatalog[0].filename, NY); 317 exit (3); 318 } 319 320 // kind of ugly : generate a grid of index, Nmeasure arrays 321 // to be filled below (I also need NN and Nn to track the number of 322 // entries in each). 323 int **NN_grid; 324 int **Nn_grid; 325 int ***Nm_grid; 326 off_t ***idxgrid; 327 ALLOCATE (NN_grid, int *, NX); 328 ALLOCATE (Nn_grid, int *, NX); 329 ALLOCATE (Nm_grid, int **, NX); 330 ALLOCATE (idxgrid, off_t **, NX); 331 332 for (ix = 0; ix < NX; ix++) { 333 ALLOCATE (NN_grid[ix], int, NY); 334 ALLOCATE (Nn_grid[ix], int, NY); 335 ALLOCATE (Nm_grid[ix], int *, NY); 336 ALLOCATE (idxgrid[ix], off_t *, NY); 337 for (iy = 0; iy < NY; iy++) { 338 Nn_grid[ix][iy] = 0; 339 NN_grid[ix][iy] = 100; 340 ALLOCATE (Nm_grid[ix][iy], int, NN_grid[ix][iy]); 341 ALLOCATE (idxgrid[ix][iy], off_t, NN_grid[ix][iy]); 342 } 343 } 344 345 // assign all of the average entries to a grid cell 346 for (i = 0; i < Naverage; i++) { 347 if (isnan(X[i])) continue; 348 if (isnan(Y[i])) continue; 349 ix = (X[i] - Xmin) / 200.0; 350 iy = (Y[i] - Ymin) / 200.0; 351 int Nn = Nn_grid[ix][iy]; 352 Nm_grid[ix][iy][Nn] = subcatalog[0].average[i].Nmeasure; 353 354 // if we are resetting to a given photcode, we need to have that photcode... 355 if (NphotcodesReset) { 356 int k; 357 int foundReset = FALSE; 358 int m = subcatalog[0].average[i].measureOffset; 359 MeasureTiny *measure = &subcatalog[0].measureT[m]; 360 for (j = 0; (j < subcatalog[0].average[i].Nmeasure) && !foundReset; j++) { 361 if (CHECK_TEST_IMAGE && (abs(measure[j].t - Tref) < 10) && (measure[j].photcode == Cref)) { 362 fprintf (stderr, "."); 363 } 364 for (k = 0; (k < NphotcodesReset) && !foundReset; k++) { 365 if (photcodesReset[k][0].code == measure[j].photcode) foundReset = TRUE; 366 } 367 } 368 if (!foundReset) { 369 Nm_grid[ix][iy][Nn] = 0; 370 } 371 } 372 373 idxgrid[ix][iy][Nn] = i; 374 Nn_grid[ix][iy] ++; 375 if (Nn_grid[ix][iy] >= NN_grid[ix][iy]) { 376 NN_grid[ix][iy] += 100; 377 REALLOCATE (Nm_grid[ix][iy], int, NN_grid[ix][iy]); 378 REALLOCATE (idxgrid[ix][iy], off_t, NN_grid[ix][iy]); 379 } 380 } 381 382 // sort all of the grid cells 383 for (ix = 0; ix < NX; ix++) { 384 for (iy = 0; iy < NY; iy++) { 385 sort_by_Nmeasure (Nm_grid[ix][iy], idxgrid[ix][iy], Nn_grid[ix][iy]); 386 NN_grid[ix][iy] = 0; // I'm going to use this array to track which element I've already selected 387 } 388 } 389 390 // cycle over the grid until we ready Nmax 391 off_t *keepidx = NULL; 392 ALLOCATE (keepidx, off_t, Naverage); 393 memset (keepidx, 0, Naverage*sizeof(off_t)); 394 int Nkeep = 0; 395 396 for (i = 0; (i < 20) && (Nkeep < Nmax); i++) { 397 for (ix = 0; (ix < NX) && (Nkeep < Nmax); ix++) { 398 for (iy = 0; (iy < NY) && (Nkeep < Nmax); iy++) { 399 if (NN_grid[ix][iy] >= Nn_grid[ix][iy]) continue; // all used up! 400 int Nn = NN_grid[ix][iy]; 401 keepidx[Nkeep] = idxgrid[ix][iy][Nn]; 402 Nkeep ++; 403 NN_grid[ix][iy] ++; 404 } 405 } 406 } 407 408 // count the number of measurements this selection will yield 409 off_t ave, NMEASURE = 0; 410 for (i = 0; i < Nkeep; i++) { 411 ave = keepidx[i]; 412 NMEASURE += subcatalog[0].average[ave].Nmeasure; 413 } 414 415 // test catID : 37262 37261 37257 37258 416 int dumpit = FALSE; 417 dumpit |= (oldcatalog[0].catID == 37007); 418 // dumpit |= (oldcatalog[0].catID == 37261); 419 // dumpit |= (oldcatalog[0].catID == 37257); 420 // dumpit |= (oldcatalog[0].catID == 37258); 421 if (dumpit) { 422 char name[64]; 423 snprintf (name, 64, "cat.%05d.dump.dat", oldcatalog[0].catID); 424 FILE *fdump = fopen (name, "w"); 425 for (i = 0; i < Nkeep; i++) { 426 ave = keepidx[i]; 427 fprintf (fdump, "%10.6f %10.6f %d\n", subcatalog[0].average[ave].R, subcatalog[0].average[ave].D, subcatalog[0].average[ave].Nmeasure); 428 } 429 fclose (fdump); 430 } 431 432 // allocate the output data 433 ALLOCATE (tmpcatalog.average, Average, Nkeep); 434 ALLOCATE (tmpcatalog.measureT, MeasureTiny, NMEASURE); 435 ALLOCATE (tmpcatalog.secfilt, SecFilt, Nkeep * Nsecfilt); 436 437 off_t Nmeasure = 0; 438 439 // copy the Nkeep selected entries from subcatalog to tmpcatalog (adjusting links) 440 for (i = 0; i < Nkeep; i++) { 441 ave = keepidx[i]; 442 tmpcatalog.average[i] = subcatalog[0].average[ave]; 443 tmpcatalog.average[i].measureOffset = Nmeasure; 444 for (j = 0; j < tmpcatalog.average[i].Nmeasure; j++) { 445 off_t offset = subcatalog[0].average[ave].measureOffset + j; 446 tmpcatalog.measureT[Nmeasure] = subcatalog[0].measureT[offset]; 447 tmpcatalog.measureT[Nmeasure].averef = i; 448 Nmeasure ++; 449 } 450 for (j = 0; j < Nsecfilt; j++) { 451 tmpcatalog.secfilt[i*Nsecfilt + j] = subcatalog[0].secfilt[ave*Nsecfilt + j]; 452 } 453 } 454 455 if (VERBOSE2) { 456 char *basename = filebasename (oldcatalog[0].filename); 457 fprintf (stderr, "limited to %d ("OFF_T_FMT" subset, "OFF_T_FMT" total) stars, "OFF_T_FMT" ("OFF_T_FMT" subset, "OFF_T_FMT" total) measures for catalog %s\n", 458 Nkeep, subcatalog[0].Naverage, oldcatalog[0].Naverage, Nmeasure, subcatalog[0].Nmeasure, oldcatalog[0].Nmeasure, basename); 459 free (basename); 460 } 461 462 free (X); 463 free (Y); 464 465 for (ix = 0; ix < NX; ix++) { 466 for (iy = 0; iy < NY; iy++) { 467 free (Nm_grid[ix][iy]); 468 free (idxgrid[ix][iy]); 469 } 470 free (NN_grid[ix]); 471 free (Nn_grid[ix]); 472 free (Nm_grid[ix]); 473 free (idxgrid[ix]); 474 } 475 free (NN_grid); 476 free (Nn_grid); 477 free (Nm_grid); 478 free (idxgrid); 479 480 free (keepidx); 481 482 free (subcatalog[0].average); 483 free (subcatalog[0].measureT); 484 free (subcatalog[0].secfilt); 485 486 subcatalog[0].average = tmpcatalog.average; 487 subcatalog[0].measureT = tmpcatalog.measureT; 488 subcatalog[0].secfilt = tmpcatalog.secfilt; 489 subcatalog[0].Naverage = Nkeep; 490 subcatalog[0].Nmeasure = Nmeasure; 491 subcatalog[0].Nsecfilt = oldcatalog[0].Nsecfilt; 492 subcatalog[0].Nsecf_mem = Naverage * oldcatalog[0].Nsecfilt; 493 494 return (TRUE); 157 495 } 158 496 … … 205 543 NMEASURE += subcatalog[0].average[ave].Nmeasure; 206 544 } 545 546 # if (0) 547 if (oldcatalog[0].catID == 59962) { 548 FILE *fdump = fopen ("cat.dump.dat", "w"); 549 for (i = 0; i < Nmax; i++) { 550 ave = index[i]; 551 fprintf (fdump, "%10.6f %10.6f %d\n", subcatalog[0].average[ave].R, subcatalog[0].average[ave].D, subcatalog[0].average[ave].Nmeasure); 552 } 553 fclose (fdump); 554 } 555 # endif 207 556 208 557 // allocate the output data -
trunk/Ohana/src/relastro/src/dvo_astrom_ops.c
r33652 r36833 91 91 } 92 92 93 double getMeanR_Big (Measure *measure, Average *average, SecFilt *secfilt) { 94 95 double ra; 96 97 /* the measure carries the instantaneous mean position at the epoch t */ 98 ra = average[0].R - measure[0].dR / 3600.0; 99 100 /* possible corrections to mean ra: 101 102 - proper-motion and parallax 103 - abberation 104 - precession and nutation, etc 105 - refraction 106 - DCR 107 108 */ 109 110 return (ra); 111 } 112 113 double getMeanD_Big (Measure *measure, Average *average, SecFilt *secfilt) { 114 115 double dec; 116 117 /* the measure carries the instantaneous mean position at the epoch t */ 118 dec = average[0].D - measure[0].dD / 3600.0; 119 120 /* possible corrections to mean ra: 121 122 - proper-motion and parallax 123 - abberation 124 - precession and nutation, etc 125 - refraction 126 - DCR 127 128 */ 129 130 return (dec); 131 } 132 93 133 int setMeanR_Big (double ra_fit, Measure *measure, Average *average, SecFilt *secfilt) { 94 134 … … 144 184 return (TRUE); 145 185 } 186 -
trunk/Ohana/src/relastro/src/initialize.c
r36630 r36833 8 8 if (RELASTRO_OP == OP_MERGE_SOURCE) return; 9 9 10 fprintf (stderr, "PHOTCODE_KEEP_LIST: %s\n", PHOTCODE_KEEP_LIST); 11 fprintf (stderr, "PHOTCODE_SKIP_LIST: %s\n", PHOTCODE_SKIP_LIST); 12 fprintf (stderr, "PHOTCODE_A_LIST: %s\n", PHOTCODE_A_LIST); 13 fprintf (stderr, "PHOTCODE_B_LIST: %s\n", PHOTCODE_B_LIST); 10 if (DCR_COLOR_POS) fprintf (stderr, "DCR_COLOR_POS: %s\n", DCR_COLOR_POS); 11 if (DCR_COLOR_NEG) fprintf (stderr, "DCR_COLOR_NEG: %s\n", DCR_COLOR_NEG); 14 12 15 photcodesKeep = ParsePhotcodeList (PHOTCODE_KEEP_LIST, &NphotcodesKeep, FALSE); 16 photcodesSkip = ParsePhotcodeList (PHOTCODE_SKIP_LIST, &NphotcodesSkip, FALSE); 17 photcodesGroupA = ParsePhotcodeList (PHOTCODE_A_LIST, &NphotcodesGroupA, TRUE); 18 photcodesGroupB = ParsePhotcodeList (PHOTCODE_B_LIST, &NphotcodesGroupB, TRUE); 13 if (PHOTCODE_KEEP_LIST) fprintf (stderr, "PHOTCODE_KEEP_LIST: %s\n", PHOTCODE_KEEP_LIST); 14 if (PHOTCODE_SKIP_LIST) fprintf (stderr, "PHOTCODE_SKIP_LIST: %s\n", PHOTCODE_SKIP_LIST); 15 if (PHOTCODE_RESET_LIST) fprintf (stderr, "PHOTCODE_RESET_LIST: %s\n", PHOTCODE_RESET_LIST); 16 if (PHOTCODE_A_LIST) fprintf (stderr, "PHOTCODE_A_LIST: %s\n", PHOTCODE_A_LIST); 17 if (PHOTCODE_B_LIST) fprintf (stderr, "PHOTCODE_B_LIST: %s\n", PHOTCODE_B_LIST); 18 19 photcodesKeep = ParsePhotcodeList (PHOTCODE_KEEP_LIST, &NphotcodesKeep, FALSE); 20 photcodesSkip = ParsePhotcodeList (PHOTCODE_SKIP_LIST, &NphotcodesSkip, FALSE); 21 photcodesReset = ParsePhotcodeList (PHOTCODE_RESET_LIST, &NphotcodesReset, FALSE); 22 photcodesGroupA = ParsePhotcodeList (PHOTCODE_A_LIST, &NphotcodesGroupA, TRUE); 23 photcodesGroupB = ParsePhotcodeList (PHOTCODE_B_LIST, &NphotcodesGroupB, TRUE); 24 25 DCR_NSEC_POS = DCR_NSEC_NEG = -1; 26 if (DCR_COLOR_POS) { 27 DCR_PHOTCODE_POS = GetPhotcodebyName (DCR_COLOR_POS); 28 if (!DCR_PHOTCODE_POS) { 29 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", DCR_COLOR_POS); 30 exit (1); 31 } 32 DCR_NSEC_POS = GetPhotcodeNsec (DCR_PHOTCODE_POS[0].code); 33 } 34 if (DCR_COLOR_NEG) { 35 DCR_PHOTCODE_NEG = GetPhotcodebyName (DCR_COLOR_NEG); 36 if (!DCR_PHOTCODE_NEG) { 37 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", DCR_COLOR_NEG); 38 exit (1); 39 } 40 DCR_NSEC_NEG = GetPhotcodeNsec (DCR_PHOTCODE_NEG[0].code); 41 } 19 42 20 43 initstats (STATMODE); … … 42 65 args_client (argc, argv); 43 66 44 fprintf (stderr, "PHOTCODE_KEEP_LIST: %s\n", PHOTCODE_KEEP_LIST); 45 fprintf (stderr, "PHOTCODE_SKIP_LIST: %s\n", PHOTCODE_SKIP_LIST); 46 fprintf (stderr, "PHOTCODE_A_LIST: %s\n", PHOTCODE_A_LIST); 47 fprintf (stderr, "PHOTCODE_B_LIST: %s\n", PHOTCODE_B_LIST); 67 if (PHOTCODE_KEEP_LIST) fprintf (stderr, "PHOTCODE_KEEP_LIST: %s\n", PHOTCODE_KEEP_LIST); 68 if (PHOTCODE_SKIP_LIST) fprintf (stderr, "PHOTCODE_SKIP_LIST: %s\n", PHOTCODE_SKIP_LIST); 69 if (PHOTCODE_RESET_LIST) fprintf (stderr, "PHOTCODE_RESET_LIST: %s\n", PHOTCODE_RESET_LIST); 70 if (PHOTCODE_A_LIST) fprintf (stderr, "PHOTCODE_A_LIST: %s\n", PHOTCODE_A_LIST); 71 if (PHOTCODE_B_LIST) fprintf (stderr, "PHOTCODE_B_LIST: %s\n", PHOTCODE_B_LIST); 48 72 49 photcodesKeep = ParsePhotcodeList (PHOTCODE_KEEP_LIST, &NphotcodesKeep, FALSE); 50 photcodesSkip = ParsePhotcodeList (PHOTCODE_SKIP_LIST, &NphotcodesSkip, FALSE); 51 photcodesGroupA = ParsePhotcodeList (PHOTCODE_A_LIST, &NphotcodesGroupA, TRUE); 52 photcodesGroupB = ParsePhotcodeList (PHOTCODE_B_LIST, &NphotcodesGroupB, TRUE); 73 photcodesKeep = ParsePhotcodeList (PHOTCODE_KEEP_LIST, &NphotcodesKeep, FALSE); 74 photcodesSkip = ParsePhotcodeList (PHOTCODE_SKIP_LIST, &NphotcodesSkip, FALSE); 75 photcodesReset = ParsePhotcodeList (PHOTCODE_RESET_LIST, &NphotcodesReset, FALSE); 76 photcodesGroupA = ParsePhotcodeList (PHOTCODE_A_LIST, &NphotcodesGroupA, TRUE); 77 photcodesGroupB = ParsePhotcodeList (PHOTCODE_B_LIST, &NphotcodesGroupB, TRUE); 53 78 54 79 initstats (STATMODE); -
trunk/Ohana/src/relastro/src/launch_region_hosts.c
r36630 r36833 1 1 # include "relastro.h" 2 2 # define DEBUG 0 3 4 int strextend (char *input, char *format,...) {5 6 char tmpextra[1024], tmpline[1024];7 va_list argp;8 9 va_start (argp, format);10 vsnprintf (tmpextra, 1024, format, argp);11 snprintf (tmpline, 1024, "%s %s", input, tmpextra);12 strcpy (input, tmpline);13 14 return TRUE;15 }16 3 17 4 int launch_region_hosts (RegionHostTable *regionHosts) { … … 88 75 if (PHOTCODE_KEEP_LIST) strextend (command, "+photcode %s", PHOTCODE_KEEP_LIST); 89 76 if (PHOTCODE_SKIP_LIST) strextend (command, "-photcode %s", PHOTCODE_SKIP_LIST); 77 if (PHOTCODE_RESET_LIST) strextend (command, "-reset-to-photcode %s", PHOTCODE_RESET_LIST); 90 78 91 79 if (MaxDensityUse) strextend (command, "-max-density %f", MaxDensityValue); 92 80 if (ImagSelect) strextend (command, "-instmag %f %f", ImagMin, ImagMax); 81 if (ExcludeBogus) strextend (command, "-exclude-bogus %f", ExcludeBogusRadius); 82 83 if (DCR_COLOR_POS && DCR_COLOR_NEG) { 84 strextend (command, "-dcr-color %s %s", DCR_COLOR_POS, DCR_COLOR_NEG); 85 } 86 93 87 if (PhotFlagSelect) strextend (command, "+photflags"); 94 88 if (PhotFlagBad) strextend (command, "+photflagbad %d", PhotFlagBad); … … 97 91 if (MinBadQF > 0.0) strextend (command, "-min-bad-psfqf %f", MinBadQF); 98 92 if (MaxMeanOffset != 10.0) strextend (command, "-max-mean-offset %f", MaxMeanOffset); 93 94 strextend (command, "-D RELASTRO_SRC_MEAS_TOOFEW %d", SRC_MEAS_TOOFEW); 95 strextend (command, "-D RELASTRO_SIGMA_LIM %f", SIGMA_LIM); 96 strextend (command, "-D RELASTRO_DPOS_MAX %f", DPOS_MAX); 97 strextend (command, "-D ADDSTAR_RADIUS %f", ADDSTAR_RADIUS); 98 99 if (USE_FIXED_PIXCOORDS) strextend (command, "-D USE_FIXED_PIXCOORDS 1"); 99 100 100 101 if (TimeSelect) { -
trunk/Ohana/src/relastro/src/load_catalogs.c
r36630 r36833 1 1 # include "relastro.h" 2 2 3 Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog );3 Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog, char *syncfile); 4 4 void bcatalog_show_skips (); 5 5 6 Catalog *load_catalogs (SkyList *skylist, int *Ncatalog, int subselect, int hostID, char *hostpath) { 7 8 int i, j, k, m, Nstar; 6 Catalog *load_catalogs (SkyList *skylist, int *Ncatalog, int subselect, int hostID, char *hostpath, char *syncfile) { 7 8 int i, j, Nstar; 9 // int k, m; 9 10 Catalog *catalog, *pcatalog, tcatalog; 10 11 11 12 // XXX need to decide how to determine PARALLEL mode... 12 13 if (PARALLEL && !hostID) { 13 catalog = load_catalogs_parallel (skylist, Ncatalog );14 catalog = load_catalogs_parallel (skylist, Ncatalog, syncfile); 14 15 return catalog; 15 16 } … … 73 74 if (RESET) { 74 75 for (j = 0; j < catalog[Ncat].Naverage; j++) { 76 # if (0) 75 77 catalog[Ncat].average[j].flags = 0; 76 78 m = catalog[Ncat].average[j].measureOffset; … … 78 80 catalog[Ncat].measure[m+k].dbFlags = 0; 79 81 } 82 # endif 80 83 } 81 84 } … … 84 87 } 85 88 86 // XXX TEST :bcatalog_show_skips();89 bcatalog_show_skips(); 87 90 88 91 Nstar = 0; … … 113 116 // CATDIR is supplied globally 114 117 # define DEBUG 1 115 Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog ) {118 Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog, char *syncfile) { 116 119 117 120 char uniquer[12]; … … 150 153 table->hosts[i].results, table->hosts[i].hostID, CATDIR, table->hosts[i].pathname, UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax, STATMODE, MIN_ERROR, SIGMA_LIM); 151 154 152 char tmpline[1024]; 153 if (FIT_MODE == FIT_PM_ONLY) { snprintf (tmpline, 1024, "%s -pm", command); strcpy (command, tmpline); } 154 if (FIT_MODE == FIT_PAR_ONLY) { snprintf (tmpline, 1024, "%s -par", command); strcpy (command, tmpline); } 155 if (FIT_MODE == FIT_PM_AND_PAR) { snprintf (tmpline, 1024, "%s -pmpar", command); strcpy (command, tmpline); } 156 157 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 158 if (VERBOSE2) { snprintf (tmpline, 1024, "%s -vv", command); strcpy (command, tmpline); } 159 if (RESET) { snprintf (tmpline, 1024, "%s -reset", command); strcpy (command, tmpline); } 160 if (ImagSelect) { snprintf (tmpline, 1024, "%s -instmag %f %f", command, ImagMin, ImagMax); strcpy (command, tmpline); } 161 if (MaxDensityUse) { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue); strcpy (command, tmpline); } 155 if (FIT_MODE == FIT_PM_ONLY) strextend (command, "-pm"); 156 if (FIT_MODE == FIT_PAR_ONLY) strextend (command, "-par"); 157 if (FIT_MODE == FIT_PM_AND_PAR) strextend (command, "-pmpar"); 158 159 if (VERBOSE) strextend (command, "-v"); 160 if (VERBOSE2) strextend (command, "-vv"); 161 if (RESET) strextend (command, "-reset"); 162 if (ImagSelect) strextend (command, "-instmag %f %f", ImagMin, ImagMax); 163 if (MaxDensityUse) strextend (command, "-max-density %f", MaxDensityValue); 164 if (FlagOutlier) strextend (command, "-clip %d", CLIP_THRESH); 165 if (ExcludeBogus) strextend (command, "-exclude-bogus %f", ExcludeBogusRadius); 162 166 163 if (FlagOutlier) { snprintf (tmpline, 1024, "%s -clip %d", command, CLIP_THRESH); strcpy (command, tmpline); } 164 165 if (USE_FIXED_PIXCOORDS) { snprintf (tmpline, 1024, "%s -D USE_FIXED_PIXCOORDS 1", command); strcpy (command, tmpline); } 166 167 if (PHOTCODE_KEEP_LIST) { snprintf (tmpline, 1024, "%s +photcode %s", command, PHOTCODE_KEEP_LIST); strcpy (command, tmpline); } 168 if (PHOTCODE_SKIP_LIST) { snprintf (tmpline, 1024, "%s -photcode %s", command, PHOTCODE_SKIP_LIST); strcpy (command, tmpline); } 169 if (PhotFlagSelect) { snprintf (tmpline, 1024, "%s +photflags", command); strcpy (command, tmpline); } 170 if (PhotFlagBad) { snprintf (tmpline, 1024, "%s +photflagbad %d", command, PhotFlagBad); strcpy (command, tmpline); } 171 if (PhotFlagPoor) { snprintf (tmpline, 1024, "%s +photflagpoor %d", command, PhotFlagPoor); strcpy (command, tmpline); } 167 if (DCR_COLOR_POS && DCR_COLOR_NEG) { 168 strextend (command, "-dcr-color %s %s", DCR_COLOR_POS, DCR_COLOR_NEG); 169 } 170 171 if (USE_FIXED_PIXCOORDS) strextend (command, "-D USE_FIXED_PIXCOORDS 1"); 172 if (PHOTCODE_KEEP_LIST) strextend (command, "+photcode %s", PHOTCODE_KEEP_LIST); 173 if (PHOTCODE_SKIP_LIST) strextend (command, "-photcode %s", PHOTCODE_SKIP_LIST); 174 if (PhotFlagSelect) strextend (command, "+photflags"); 175 if (PhotFlagBad) strextend (command, "+photflagbad %d", PhotFlagBad); 176 if (PhotFlagPoor) strextend (command, "+photflagpoor %d", PhotFlagPoor); 172 177 // XXX note that the above pass in the flag as decimal -- also note that args.c cannot handle 0xHEX values 173 178 … … 175 180 char *tstart = ohana_sec_to_date (TSTART); 176 181 char *tstop = ohana_sec_to_date (TSTOP); 177 s nprintf (tmpline, 1024, "%s -time %s %s", command, tstart, tstop);182 strextend (command, "-time %s %s", tstart, tstop); 178 183 free (tstart); 179 184 free (tstop); 180 strcpy (command, tmpline);181 185 } 182 186 … … 211 215 } 212 216 217 // update syncfile here (save lots of I/O time) 218 219 // NOTE: if I let all hosts load blindly, I saturate the data clients with too many 220 // relastro_client requests. I need to have the master mediate this. the master 221 // will not launch the next remote job until this one says it is done 222 if (syncfile) { 223 update_sync_file (syncfile, 1); 224 } 225 213 226 // each host generates a BrightCatalog structure, with the measure, average, etc value 214 227 // loaded into a single set of arrays (of MeasureTiny, AverageTiny, Secfilt). I need to -
trunk/Ohana/src/relastro/src/relastro_client.c
r36630 r36833 33 33 // USAGE: relastro_client -load-objects 34 34 int Ncatalog; 35 Catalog *catalog = load_catalogs (skylist, &Ncatalog, TRUE, HOST_ID, HOSTDIR );35 Catalog *catalog = load_catalogs (skylist, &Ncatalog, TRUE, HOST_ID, HOSTDIR, NULL); 36 36 if (!catalog) { 37 37 fprintf (stderr, "ERROR loading catalogs from %s\n", CATDIR); -
trunk/Ohana/src/relastro/src/relastro_images.c
r36630 r36833 28 28 // XXX pass in the image table 29 29 // XXX who carries the image grid? 30 catalog = load_catalogs (skylist, &Ncatalog, TRUE, 0, NULL); 30 31 // photcodesKeep is used here to allow measurements from the images being calibrated 32 // note if -reset-to-photcode is selected, photocodesKeep is replaced with below with photcodesReset 33 catalog = load_catalogs (skylist, &Ncatalog, TRUE, 0, NULL, NULL); 31 34 MARKTIME("load catalog data: %f sec\n", dtime); 35 36 if (photcodesReset) { 37 photcodesKeep = photcodesReset; 38 NphotcodesKeep = NphotcodesReset; 39 } 32 40 33 41 if (Ncatalog == 0) { … … 50 58 // set test points based on the starmap 51 59 createStarMap (catalog, Ncatalog); 60 61 // XXX NOTE : for 2mass reset, photcodesKeep should now limit to 2MASS measurements 52 62 53 63 /* major modes */ -
trunk/Ohana/src/relastro/src/relastro_objects.c
r36630 r36833 40 40 snprintf (hostfile, 1024, "%s/%s.cpt", hostpath, skylist[0].regions[i]->name); 41 41 catalog.filename = hostID ? hostfile : skylist[0].filename[i]; 42 43 // set up the basic catalog info 42 44 catalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 43 45 catalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data -
trunk/Ohana/src/relastro/src/relastro_parallel_images.c
r36630 r36833 45 45 46 46 /* load catalog data from region files (hostID is 0 since we are not a client */ 47 catalog = load_catalogs (skylist, &Ncatalog, TRUE, 0, NULL); 47 char *syncfile = make_filename (CATDIR, regionHosts->hosts[myHost].hostname, REGION_HOST_ID, "loadcat.sync"); 48 catalog = load_catalogs (skylist, &Ncatalog, TRUE, 0, NULL, syncfile); 48 49 MARKTIME("-- load catalog data: %f sec\n", dtime); 50 free (syncfile); 49 51 50 // NOTE: if I let all hosts load blindly, I saturate the data clients with too many 51 // relastro_client requests. I need to have the master mediate this. the master 52 // will not launch the next remote job until this one says it is done 53 char *syncfile = make_filename (CATDIR, regionHosts->hosts[myHost].hostname, REGION_HOST_ID, "loadcat.sync"); 54 update_sync_file (syncfile, 1); 55 52 if (photcodesReset) { 53 photcodesKeep = photcodesReset; 54 NphotcodesKeep = NphotcodesReset; 55 } 56 56 57 // generate tables go from catID,objID -> catSeq,objSeq 57 58 indexCatalogs (catalog, Ncatalog); -
trunk/Ohana/src/uniphot/src/update_catalog_fiximids.c
r35764 r36833 1 1 # include "fiximids.h" 2 3 // test image: 2013/06/15,13:25:51, GPC1.r.XY50 4 static int CHECK_TEST_IMAGE = FALSE; 5 static unsigned int Tref = 1378812312; 6 static short Cref = 10001; 2 7 3 8 void update_catalog_fiximids (Catalog *catalog) { … … 18 23 short photcode = catalog[0].measure[i].photcode; 19 24 e_time time = catalog[0].measure[i].t; 25 26 if (CHECK_TEST_IMAGE && (abs(time - Tref) < 10) && (photcode == Cref)) { 27 fprintf (stderr, "."); 28 } 20 29 21 30 // skip detections with no valid imageID (eg, ref photcode)
Note:
See TracChangeset
for help on using the changeset viewer.
