Changeset 5239
- Timestamp:
- Oct 7, 2005, 3:00:23 PM (21 years ago)
- Location:
- trunk/Ohana/src/addstar
- Files:
-
- 9 edited
-
Makefile (modified) (1 diff)
-
doc/Changes.txt (modified) (1 diff)
-
include/addstar.h (modified) (1 diff)
-
src/addstar.c (modified) (7 diffs)
-
src/build_links.c (modified) (4 diffs)
-
src/find_matches.c (modified) (5 diffs)
-
src/find_matches_closest.c (modified) (6 diffs)
-
src/replace_match.c (modified) (1 diff)
-
src/update_coords.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/addstar/Makefile
r5229 r5239 17 17 # 18 18 INCS = -I$(INC) -I$(LINC) -I$(XINC) 19 LIBS = -L$(LLIB) -l ohana -lFITS-lz -lm19 LIBS = -L$(LLIB) -ldvo -lFITS -lohana -lz -lm 20 20 CFLAGS = $(INCS) -g 21 21 LFLAGS = $(LIBS) -
trunk/Ohana/src/addstar/doc/Changes.txt
r5234 r5239 1 2 2005.10.07 3 4 I have finished the basic implementation of the update mode. 5 I have been able to demonstrate substantial improvements in 6 speed when the number of existing measurements dominates the 7 total number of measurements and the number of averages is 8 typically small compared to the number of measurements (ie, 9 most objects are real, detected in most images, and each new 10 image supplies many new measurements of objects which exist 11 and not many of objects which don't exist already). The speed 12 gain is significant in this context because the average table 13 is small compared to the measure table; since both update and 14 full-load methods require the complete average table, there is 15 no difference in the load time for the average table. 16 17 I was having some memory collision problems, and attempting to 18 use the ohana_allocate functions reminded me that the libFITS 19 functions were not supported under ohana_allocate. This was 20 unhelpful. I bit the bullet and split libohana into libohana 21 (base functions only, including ohana_allocate) and libdvo 22 (functions based on the libautocode structures). Doing this 23 allowed me to make libFITS depend on libohana (including 24 ohana_allocate). BUT, this forced me to change all LDFLAGS 25 entries in ohana to swap -lohana -lFITS for -lFITS -lohana, 26 and to add include <fitsio.h> in some cases. 1 27 2 28 2005.10.06 -
trunk/Ohana/src/addstar/include/addstar.h
r5234 r5239 189 189 int *init_measure_links (Average *average, int Naverage, Measure *measure, int Nmeasure); 190 190 int *init_missing_links (Average *average, int Naverage, Missing *missing, int Nmissing); 191 int add_meas_link (Average *average, int *next, int Nmeasure );191 int add_meas_link (Average *average, int *next, int Nmeasure, int NMEASURE); 192 192 int add_miss_link (Average *average, int *next, int Nmissing); 193 193 int *build_measure_links (Average *average, int Naverage, Measure *measure, int Nmeasure); -
trunk/Ohana/src/addstar/src/addstar.c
r5229 r5239 3 3 int main (int argc, char **argv) { 4 4 5 int Nm, Na, Ns; 5 6 int i, Nstars, Noverlap, Nregions, Nsubset, Naverage, Nmeasure; 6 7 Stars *stars, **subset; … … 11 12 12 13 double dtime; 13 struct timeval start, stop ;14 struct timeval start, stop, t1, t2; 14 15 15 16 gettimeofday (&start, NULL); … … 28 29 /* we use the image table to lock db access -- perhaps this is not necessary?*/ 29 30 lock_image_db (&db, ImageCat); 31 gettimeofday (&stop, NULL); 32 dtime = DTIME (stop, start); 33 fprintf (stderr, "mark: lock_image_db: time %9.4f sec\n", dtime); 30 34 31 35 switch (MODE) { … … 51 55 if (VERBOSE) fprintf (stderr, "writing to %d regions\n", Nregions); 52 56 57 gettimeofday (&stop, NULL); 58 dtime = DTIME (stop, start); 59 fprintf (stderr, "mark: gstars: time %9.4f sec\n", dtime); 60 53 61 Naverage = Nmeasure = 0; 54 62 for (i = 0; i < Nregions; i++) { 63 64 gettimeofday (&t1, NULL); 65 55 66 if (!load_pt_catalog (&catalog, ®ions[i])) continue; 67 Nm = catalog.Nmeasure + catalog.Nmeas_off; 68 Na = catalog.Naverage; 69 Ns = Nstars; 70 71 gettimeofday (&t2, NULL); 72 dtime = DTIME (t2, t1); 73 fprintf (stderr, "load time %9.4f sec for %5d stars, %6d average, %7d measure\n", dtime, Ns, Na, Nm); 56 74 57 75 Naverage += catalog.Naverage; 58 76 Nmeasure += catalog.Nmeasure; 77 78 gettimeofday (&t1, NULL); 59 79 60 80 switch (MODE) { … … 75 95 break; 76 96 } 97 98 gettimeofday (&t2, NULL); 99 dtime = DTIME (t2, t1); 100 fprintf (stderr, "match time %9.4f sec for %5d stars, %6d average, %7d measure\n", dtime, Ns, Na, Nm); 101 102 gettimeofday (&t1, NULL); 103 77 104 if (Nsubset == 0) { 78 105 unlock_catalog (&catalog); … … 80 107 save_pt_catalog (&catalog); 81 108 } 109 110 gettimeofday (&t2, NULL); 111 dtime = DTIME (t2, t1); 112 fprintf (stderr, "save time %9.4f sec for %5d stars, %6d average, %7d measure\n", dtime, Ns, Na, Nm); 113 82 114 } 115 116 gettimeofday (&stop, NULL); 117 dtime = DTIME (stop, start); 118 fprintf (stderr, "mark: match: time %9.4f sec\n", dtime); 83 119 84 120 if (CALIBRATE) { FindCalibration (&image); } … … 102 138 gettimeofday (&stop, NULL); 103 139 dtime = DTIME (stop, start); 104 fprintf (stderr, "SUCCESS: elapsed time % 8.3f sec for %5d stars, %6d average, %7d measure\n", dtime, Nstars, Naverage, Nmeasure);140 fprintf (stderr, "SUCCESS: elapsed time %9.4f sec for %5d stars, %6d average, %7d measure\n", dtime, Nstars, Naverage, Nmeasure); 105 141 exit (0); 106 142 } -
trunk/Ohana/src/addstar/src/build_links.c
r5234 r5239 1 1 # include "addstar.h" 2 2 3 /* build the initial links assuming the table is sorted */ 3 /* build the initial links assuming the table is sorted, 4 not partial, and has a correct set of average[].offset,Nm values */ 4 5 int *init_measure_links (Average *average, int Naverage, Measure *measure, int Nmeasure) { 5 6 … … 13 14 for (j = 0; j < average[i].Nm - 1; j++, N++) { 14 15 next[N] = N + 1; 16 if (N >= Nmeasure) { 17 fprintf (stderr, "WARNING: N out of bounds (1)\n"); 18 } 15 19 } 16 20 next[N] = -1; 21 if (N >= Nmeasure) { 22 fprintf (stderr, "WARNING: N out of bounds (2)\n"); 23 } 24 17 25 if (N >= Nmeasure) { 18 26 fprintf (stderr, "overflow in init_measure_links\n"); … … 49 57 } 50 58 51 int add_meas_link (Average *average, int *next, int Nmeasure) { 59 /* average[].offset, average[].Nm are valid within an addstar run */ 60 int add_meas_link (Average *average, int *next, int Nmeasure, int NMEASURE) { 52 61 53 62 int k, m; 54 63 64 /* if we have trouble, check validity of next[m] : m < Nmeasure */ 55 65 m = average[0].offset; 56 for (k = 0; k < average[0].Nm - 1; k++) m = next[m]; 66 67 for (k = 0; k < average[0].Nm - 1; k++) { 68 m = next[m]; 69 if (m >= NMEASURE) { 70 fprintf (stderr, "WARNING: m out of bounds (3)\n"); 71 } 72 } 73 57 74 /* set up references */ 58 75 next[Nmeasure] = -1; 59 next[m] = Nmeasure; 76 if (Nmeasure >= NMEASURE) { 77 fprintf (stderr, "WARNING: Nmeasure out of bounds (1)\n"); 78 } 79 80 if (m == -1) { 81 average[0].offset = Nmeasure; 82 } else { 83 next[m] = Nmeasure; 84 if (m >= NMEASURE) { 85 fprintf (stderr, "WARNING: m out of bounds (4)\n"); 86 } 87 } 88 60 89 return (TRUE); 61 90 } … … 80 109 } 81 110 111 /* construct measure links which are valid FOR THIS LOAD 112 * - if we have a full load, we will get links which can 113 * be used by other programs (eg, relphot, etc) 114 * - if we have a partial load, the links are only valid 115 * for that partial load 116 */ 117 82 118 int *build_measure_links (Average *average, int Naverage, Measure *measure, int Nmeasure) { 83 119 84 int m, k, Nm, averef;120 int i, m, k, Nm, averef; 85 121 int *next; 86 122 87 123 ALLOCATE (next, int, Nmeasure); 88 124 125 /* reset the Nm, offset values for average */ 126 for (i = 0; i < Naverage; i++) { 127 average[i].offset = -1; 128 average[i].Nm = 0; 129 } 130 89 131 for (Nm = 0; Nm < Nmeasure; Nm++) { 90 next[Nm] = -1;91 132 averef = measure[Nm].averef; 92 133 m = average[averef].offset; 134 next[Nm] = -1; 135 136 if (m == -1) { /* no links yet for source */ 137 average[averef].offset = Nm; 138 average[averef].Nm = 1; 139 continue; 140 } 141 93 142 for (k = 0; next[m] != -1; k++) { 94 143 m = next[m]; 95 } 96 if (m == Nm) { 97 average[averef].Nm = k + 1; 98 } else { 99 average[averef].Nm = k + 2; 100 next[m] = Nm; 144 if (m >= Nmeasure) { 145 fprintf (stderr, "WARNING: m out of bounds (1)\n"); 146 } 147 } 148 149 average[averef].Nm = k + 2; 150 next[m] = Nm; 151 if (m >= Nmeasure) { 152 fprintf (stderr, "WARNING: m out of bounds (2)\n"); 101 153 } 102 154 } -
trunk/Ohana/src/addstar/src/find_matches.c
r5234 r5239 8 8 float dX, dY, dR; 9 9 int *N1, *N2, *next_meas, *next_miss; 10 int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch , offset;10 int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch; 11 11 Coords tcoords; 12 12 int Nsecfilt, Nsec; … … 41 41 NMEAS = Nmeas = catalog[0].Nmeasure; 42 42 NMISS = Nmiss = catalog[0].Nmissing; 43 offset = catalog[0].Nmeas_off;44 43 45 44 /* project onto rectilinear grid with 1 arcsec pixels */ … … 130 129 131 130 /* add to end of measurement list */ 132 add_meas_link (&catalog[0].average[n], next_meas, Nmeas );131 add_meas_link (&catalog[0].average[n], next_meas, Nmeas, NMEAS); 133 132 134 133 /* calculate accurate per-star airmass */ … … 253 252 catalog[0].average[Nave].Xm = NO_MAG; 254 253 catalog[0].average[Nave].Xg = NO_MAG; 255 catalog[0].average[Nave].offset = Nmeas + offset; /* this needs to be an absolute reference */254 catalog[0].average[Nave].offset = Nmeas; 256 255 catalog[0].average[Nave].missing = -1; 257 256 catalog[0].average[Nave].code = 0; … … 317 316 REALLOCATE (catalog[0].missing, Missing, Nmiss); 318 317 319 /* XXX EAM - temporary examination of next_meas320 for (i = 0; i < 5; i++) {321 m = catalog[0].average[i].offset;322 for (j = 0; j < catalog[0].average[i].Nm; j++) {323 fprintf (stderr, "this: %d (%f), next: %d\n", m, catalog[0].measure[m].M_PS, next_meas[m]);324 m = next_meas[m];325 }326 } */327 328 318 if (NOSORT) { 329 319 catalog[0].sorted = FALSE; -
trunk/Ohana/src/addstar/src/find_matches_closest.c
r5234 r5239 8 8 float dX, dY, dR; 9 9 int *N1, *N2, *next_meas, *next_miss; 10 int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch , offset;10 int Nave, NAVE, Nmeas, NMEAS, Nmiss, NMISS, Nmatch; 11 11 Coords tcoords; 12 12 int Nsecfilt, Nsec; … … 41 41 NMEAS = Nmeas = catalog[0].Nmeasure; 42 42 NMISS = Nmiss = catalog[0].Nmissing; 43 offset = catalog[0].Nmeas_off;44 43 45 44 /* project onto rectilinear grid with 1 arcsec pixels */ … … 145 144 146 145 /* add to end of measurement list */ 147 add_meas_link (&catalog[0].average[n], next_meas, Nmeas); 146 add_meas_link (&catalog[0].average[n], next_meas, Nmeas, NMEAS); 147 ohana_memcheck (0); 148 148 149 149 /* calculate accurate per-star airmass, if required */ … … 192 192 Nmeas ++; 193 193 i++; 194 }195 194 ohana_memcheck (0); 195 } 196 196 ohana_memcheck (0); 197 197 … … 250 250 catalog[0].average[Nave].Xm = NO_MAG; 251 251 catalog[0].average[Nave].Xg = NO_MAG; 252 catalog[0].average[Nave].offset = Nmeas + offset;252 catalog[0].average[Nave].offset = Nmeas; 253 253 catalog[0].average[Nave].missing = -1; 254 254 catalog[0].average[Nave].code = 0; … … 314 314 REALLOCATE (catalog[0].missing, Missing, Nmiss); 315 315 316 /* XXX EAM - temporary examination of next_meas317 for (i = 0; i < 5; i++) {318 m = catalog[0].average[i].offset;319 for (j = 0; j < catalog[0].average[i].Nm; j++) {320 fprintf (stderr, "this: %d (%f), next: %d\n", m, catalog[0].measure[m].M_PS, next_meas[m]);321 m = next_meas[m];322 }323 } */324 325 316 if (NOSORT) { 326 317 catalog[0].sorted = FALSE; -
trunk/Ohana/src/addstar/src/replace_match.c
r4865 r5239 14 14 measure[i].M_PS = MIN (star[0].M, NO_MAG); 15 15 measure[i].dM_PS = MIN (star[0].dM, NO_ERR); 16 star[0].found = average[0].offset + i;16 star[0].found = average[0].offset + i; 17 17 return (TRUE); 18 18 } -
trunk/Ohana/src/addstar/src/update_coords.c
r4800 r5239 12 12 if (average[0].Nm < 2) return; 13 13 14 /* find the average & sum-square */14 /* find the average & sum-square (does not use reference coordinates) */ 15 15 m = average[0].offset; /* first measurement of this star */ 16 16 for (i = 0; i < average[0].Nm; i++) {
Note:
See TracChangeset
for help on using the changeset viewer.
