Changeset 37084
- Timestamp:
- Jul 17, 2014, 4:21:39 PM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140717/Ohana/src/dvomerge
- Files:
-
- 11 edited
-
include/dvomerge.h (modified) (1 diff)
-
src/LoadCatalog.c (modified) (1 diff)
-
src/build_links.c (modified) (13 diffs)
-
src/dvomergeContinue.c (modified) (1 diff)
-
src/dvomergeContinue_threaded.c (modified) (1 diff)
-
src/dvomergeCreate.c (modified) (1 diff)
-
src/dvomergeFromList.c (modified) (1 diff)
-
src/dvomergeUpdate_catalogs.c (modified) (1 diff)
-
src/dvomergeUpdate_threaded.c (modified) (1 diff)
-
src/merge_catalogs_new.c (modified) (4 diffs)
-
src/merge_catalogs_old.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140717/Ohana/src/dvomerge/include/dvomerge.h
r35765 r37084 129 129 int merge_catalogs_old PROTO((SkyRegion *region, Catalog *output, Catalog *input, double RADIUS, int *secflitMap)); 130 130 131 off_t *build_measure_links PROTO((Average *average, off_t Naverage, Measure *measure, off_t Nmeasure)); 131 132 off_t *init_measure_links PROTO((Average *average, off_t Naverage, Measure *measure, off_t Nmeasure)); 133 int add_meas_link PROTO((Average *average, off_t *next, off_t Nmeasure, off_t NMEASURE)); 134 Measure *sort_measure PROTO((Average *average, off_t Naverage, Measure *measure, off_t Nmeasure, off_t *next)); 135 136 off_t *build_lensing_links PROTO((Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing)); 137 off_t *init_lensing_links PROTO((Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing)); 138 int add_lens_link PROTO((Average *average, off_t *next, off_t Nlensing, off_t NLENSING)); 139 Lensing *sort_lensing PROTO((Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing, off_t *next)); 140 132 141 off_t *init_missing_links PROTO((Average *average, off_t Naverage, Missing *missing, off_t Nmissing)); 133 off_t *build_measure_links PROTO((Average *average, off_t Naverage, Measure *measure, off_t Nmeasure));134 int add_meas_link PROTO((Average *average, off_t *next, off_t Nmeasure, off_t NMEASURE));135 142 int add_miss_link PROTO((Average *average, off_t *next, off_t Nmissing)); 136 Measure *sort_measure PROTO((Average *average, off_t Naverage, Measure *measure, off_t Nmeasure, off_t *next));137 143 Missing *sort_missing PROTO((Average *average, off_t Naverage, Missing *missing, off_t Nmissing, off_t *next_miss)); 138 144 -
branches/eam_branches/ipp-20140717/Ohana/src/dvomerge/src/LoadCatalog.c
r29938 r37084 8 8 9 9 // always load all of the data (if any exists) 10 catalog[0].catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF ;10 catalog[0].catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF | LOAD_LENSING | LOAD_LENSOBJ; 11 11 12 12 catalog[0].catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data -
branches/eam_branches/ipp-20140717/Ohana/src/dvomerge/src/build_links.c
r27435 r37084 1 1 # include "dvomerge.h" 2 3 /* 4 5 There are two modes for the measure table: sorted and unsorted. 6 7 In sorted mode, all measures associated with a given average are in a single block. The block 8 is pointed to by average->measureOffset and the range is average->Nmeasure 9 10 In unsorted mode, it is not possible to go directly from average to measure without scanning. 11 In this case, it is necessary to use the value measure->averef to find the corresponding 12 average entry. 13 14 Note that average->measureOffset and measure->averef are only valid for a given load of the 15 data: they refer to the sequence number in the data blocks. 16 17 next_meas is a list of the equivalent sequence of the measure block as if it were sorted. 18 19 to find the sequence of measurements for a given average: 20 n_0 = average->measureOffset 21 n_1 = next_meas[n_0] 22 n_i = next_meas[n_i-1] 23 24 */ 2 25 3 26 /* build the initial links assuming the table is sorted, … … 6 29 7 30 off_t i, j, N; 8 off_t *next ;31 off_t *next_meas; 9 32 10 33 N = 0; 11 34 12 ALLOCATE (next , off_t, Nmeasure);35 ALLOCATE (next_meas, off_t, Nmeasure); 13 36 for (i = 0; i < Naverage; i++, N++) { 14 37 for (j = 0; j < average[i].Nmeasure - 1; j++, N++) { 15 next [N] = N + 1;38 next_meas[N] = N + 1; 16 39 if (N >= Nmeasure) { 17 40 fprintf (stderr, "WARNING: N out of bounds (1)\n"); 18 41 } 19 42 } 20 next [N] = -1;43 next_meas[N] = -1; 21 44 if (N >= Nmeasure) { 22 45 fprintf (stderr, "WARNING: N out of bounds (2)\n"); … … 28 51 } 29 52 } 30 return (next); 31 } 32 33 /* average[].measureOffset, average[].Nmeasure are valid within an addstar run */ 34 int add_meas_link (Average *average, off_t *next, off_t Nmeasure, off_t NMEASURE) { 35 36 off_t k, m; 37 38 /* if we have trouble, check validity of next[m] : m < Nmeasure */ 39 m = average[0].measureOffset; 40 41 for (k = 0; k < average[0].Nmeasure - 1; k++) { 42 m = next[m]; 43 if (m >= NMEASURE) { 44 fprintf (stderr, "WARNING: m out of bounds (3)\n"); 45 } 46 } 47 48 /* set up references */ 49 next[Nmeasure] = -1; 50 if (Nmeasure >= NMEASURE) { 51 fprintf (stderr, "WARNING: Nmeasure out of bounds (1)\n"); 52 } 53 54 if (m == -1) { 55 average[0].measureOffset = Nmeasure; 56 } else { 57 next[m] = Nmeasure; 58 if (m >= NMEASURE) { 59 fprintf (stderr, "WARNING: m out of bounds (4)\n"); 60 } 61 } 62 63 return (TRUE); 64 } 65 66 Measure *sort_measure (Average *average, off_t Naverage, Measure *measure, off_t Nmeasure, off_t *next) { 67 68 off_t i, k, n, N; 69 Measure *tmpmeasure; 70 71 /* fix order of Measure (memory intensive, but fast) */ 72 N = 0; 73 ALLOCATE (tmpmeasure, Measure, Nmeasure); 74 for (i = 0; i < Naverage; i++) { 75 n = average[i].measureOffset; 76 average[i].measureOffset = N; 77 for (k = 0; k < average[i].Nmeasure; k++, N++) { 78 tmpmeasure[N] = measure[n]; 79 tmpmeasure[N].averef = i; 80 n = next[n]; 81 } 82 } 83 free (measure); 84 return (tmpmeasure); 53 return (next_meas); 85 54 } 86 55 … … 95 64 96 65 off_t i, m, k, Nm, averef; 97 off_t *next ;98 99 ALLOCATE (next , off_t, Nmeasure);66 off_t *next_meas; 67 68 ALLOCATE (next_meas, off_t, Nmeasure); 100 69 101 70 /* reset the Nm, offset values for average */ … … 108 77 averef = measure[Nm].averef; 109 78 m = average[averef].measureOffset; 110 next [Nm] = -1;79 next_meas[Nm] = -1; 111 80 112 81 if (m == -1) { /* no links yet for source */ … … 116 85 } 117 86 118 for (k = 0; next [m] != -1; k++) {119 m = next [m];87 for (k = 0; next_meas[m] != -1; k++) { 88 m = next_meas[m]; 120 89 if (m >= Nmeasure) { 121 90 fprintf (stderr, "WARNING: m out of bounds (1)\n"); … … 124 93 125 94 average[averef].Nmeasure = k + 2; 126 next [m] = Nm;95 next_meas[m] = Nm; 127 96 if (m >= Nmeasure) { 128 97 fprintf (stderr, "WARNING: m out of bounds (2)\n"); 129 98 } 130 99 } 131 return (next); 132 } 100 return (next_meas); 101 } 102 103 /* average[].measureOffset, average[].Nmeasure are valid within an addstar run */ 104 int add_meas_link (Average *average, off_t *next_meas, off_t Nmeasure, off_t NMEASURE) { 105 106 off_t k, m; 107 108 /* if we have trouble, check validity of next_meas[m] : m < Nmeasure */ 109 m = average[0].measureOffset; 110 111 for (k = 0; k < average[0].Nmeasure - 1; k++) { 112 m = next_meas[m]; 113 if (m >= NMEASURE) { 114 fprintf (stderr, "WARNING: m out of bounds (3)\n"); 115 } 116 } 117 118 /* set up references */ 119 next_meas[Nmeasure] = -1; 120 if (Nmeasure >= NMEASURE) { 121 fprintf (stderr, "WARNING: Nmeasure out of bounds (1)\n"); 122 } 123 124 if (m == -1) { 125 average[0].measureOffset = Nmeasure; 126 } else { 127 next_meas[m] = Nmeasure; 128 if (m >= NMEASURE) { 129 fprintf (stderr, "WARNING: m out of bounds (4)\n"); 130 } 131 } 132 133 return (TRUE); 134 } 135 136 Measure *sort_measure (Average *average, off_t Naverage, Measure *measure, off_t Nmeasure, off_t *next_meas) { 137 138 off_t i, k, n, N; 139 Measure *tmpmeasure; 140 141 /* fix order of Measure (memory intensive, but fast) */ 142 N = 0; 143 ALLOCATE (tmpmeasure, Measure, Nmeasure); 144 for (i = 0; i < Naverage; i++) { 145 n = average[i].measureOffset; 146 average[i].measureOffset = N; 147 for (k = 0; k < average[i].Nmeasure; k++, N++) { 148 if (n == -1) abort(); 149 tmpmeasure[N] = measure[n]; 150 if (measure[n].averef != i) abort(); 151 tmpmeasure[N].averef = i; 152 n = next_meas[n]; 153 } 154 } 155 free (measure); 156 return (tmpmeasure); 157 } 158 159 /*******************************************************************************************/ 133 160 134 161 /* build the initial links assuming the table is sorted */ … … 136 163 137 164 off_t i, j, N; 138 off_t *next ;165 off_t *next_miss; 139 166 140 167 N = 0; 141 168 142 ALLOCATE (next , off_t, Nmissing);169 ALLOCATE (next_miss, off_t, Nmissing); 143 170 for (i = 0; i < Naverage; i++) { 144 171 for (j = 0; j < average[i].Nmissing - 1; j++, N++) { 145 next [N] = N + 1;172 next_miss[N] = N + 1; 146 173 } 147 174 if (average[i].Nmissing > 0) { 148 next [N] = -1;175 next_miss[N] = -1; 149 176 if (N >= Nmissing) { 150 177 fprintf (stderr, "overflow in init_missing_links"); … … 155 182 156 183 } 157 return (next );158 } 159 160 int add_miss_link (Average *average, off_t *next , off_t Nmissing) {184 return (next_miss); 185 } 186 187 int add_miss_link (Average *average, off_t *next_miss, off_t Nmissing) { 161 188 162 189 off_t k, m; … … 165 192 if (average[0].Nmissing < 1) { 166 193 average[0].missingOffset = Nmissing; 167 next [Nmissing] = -1;194 next_miss[Nmissing] = -1; 168 195 return (TRUE); 169 196 } 170 197 171 198 m = average[0].missingOffset; 172 for (k = 0; k < average[0].Nmissing - 1; k++) m = next [m];199 for (k = 0; k < average[0].Nmissing - 1; k++) m = next_miss[m]; 173 200 /* set up references */ 174 next [Nmissing] = -1;175 next [m] = Nmissing;201 next_miss[Nmissing] = -1; 202 next_miss[m] = Nmissing; 176 203 return (TRUE); 177 204 } … … 180 207 we must always save the missing table, if it exists */ 181 208 182 Missing *sort_missing (Average *average, off_t Naverage, Missing *missing, off_t Nmissing, off_t *next ) {209 Missing *sort_missing (Average *average, off_t Naverage, Missing *missing, off_t Nmissing, off_t *next_miss) { 183 210 184 211 off_t i, k, n, N; … … 193 220 for (k = 0; k < average[i].Nmissing; k++, N++) { 194 221 tmpmissing[N] = missing[n]; 195 n = next [n];222 n = next_miss[n]; 196 223 } 197 224 } … … 199 226 return (tmpmissing); 200 227 } 228 229 /*******************************************************************************************/ 230 231 /* build the initial links assuming the table is sorted, 232 not partial, and has a correct set of average[].lensingOffset,Nlensing values */ 233 off_t *init_lensing_links (Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing) { 234 235 off_t i, j, N; 236 off_t *next_lens; 237 238 N = 0; 239 240 ALLOCATE (next_lens, off_t, Nlensing); 241 for (i = 0; i < Naverage; i++) { 242 if (!average[i].Nlensing) continue; 243 for (j = 0; j < average[i].Nlensing - 1; j++, N++) { 244 next_lens[N] = N + 1; 245 if (N >= Nlensing) { 246 fprintf (stderr, "WARNING: N out of bounds (1)\n"); 247 } 248 } 249 next_lens[N] = -1; 250 if (N >= Nlensing) { 251 fprintf (stderr, "WARNING: N out of bounds (2)\n"); 252 } 253 254 if (N >= Nlensing) { 255 fprintf (stderr, "overflow in init_lensing_links\n"); 256 abort (); 257 } 258 N++; 259 } 260 return (next_lens); 261 } 262 263 /* construct lensing links which are valid FOR THIS LOAD 264 * - if we have a full load, we will get links which can 265 * be used by other programs (eg, relphot, etc) 266 * - if we have a partial load, the links are only valid 267 * for that partial load 268 */ 269 270 off_t *build_lensing_links (Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing) { 271 272 off_t i, m, k, Nm, averef; 273 off_t *next_lens; 274 275 ALLOCATE (next_lens, off_t, Nlensing); 276 277 /* reset the Nm, offset values for average */ 278 for (i = 0; i < Naverage; i++) { 279 average[i].lensingOffset = -1; 280 average[i].Nlensing = 0; 281 } 282 283 for (Nm = 0; Nm < Nlensing; Nm++) { 284 averef = lensing[Nm].averef; 285 m = average[averef].lensingOffset; 286 next_lens[Nm] = -1; 287 288 if (m == -1) { /* no links yet for source */ 289 average[averef].lensingOffset = Nm; 290 average[averef].Nlensing = 1; 291 continue; 292 } 293 294 for (k = 0; next_lens[m] != -1; k++) { 295 m = next_lens[m]; 296 if (m >= Nlensing) { 297 fprintf (stderr, "WARNING: m out of bounds (1)\n"); 298 } 299 } 300 301 average[averef].Nlensing = k + 2; 302 next_lens[m] = Nm; 303 if (m >= Nlensing) { 304 fprintf (stderr, "WARNING: m out of bounds (2)\n"); 305 } 306 } 307 return (next_lens); 308 } 309 310 /* average[].lensingOffset, average[].Nlensing are valid within an addstar run */ 311 int add_lens_link (Average *average, off_t *next_lens, off_t Nlensing, off_t NLENSING) { 312 313 off_t k, m; 314 315 /* if we have trouble, check validity of next_lens[m] : m < Nlensing */ 316 m = average[0].lensingOffset; 317 318 for (k = 0; k < average[0].Nlensing - 1; k++) { 319 m = next_lens[m]; 320 if (m >= NLENSING) { 321 fprintf (stderr, "WARNING: m out of bounds (3)\n"); 322 } 323 } 324 325 /* set up references */ 326 next_lens[Nlensing] = -1; 327 if (Nlensing >= NLENSING) { 328 fprintf (stderr, "WARNING: Nlensing out of bounds (1)\n"); 329 } 330 331 if (m == -1) { 332 average[0].lensingOffset = Nlensing; 333 } else { 334 next_lens[m] = Nlensing; 335 if (m >= NLENSING) { 336 fprintf (stderr, "WARNING: m out of bounds (4)\n"); 337 } 338 } 339 340 return (TRUE); 341 } 342 343 Lensing *sort_lensing (Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing, off_t *next_lens) { 344 345 off_t i, k, n, N; 346 Lensing *tmplensing; 347 348 /* fix order of Lensing (memory intensive, but fast) */ 349 N = 0; 350 ALLOCATE (tmplensing, Lensing, Nlensing); 351 for (i = 0; i < Naverage; i++) { 352 if (!average[i].Nlensing) continue; 353 n = average[i].lensingOffset; 354 average[i].lensingOffset = N; 355 for (k = 0; k < average[i].Nlensing; k++, N++) { 356 if (n == -1) abort(); 357 tmplensing[N] = lensing[n]; 358 if (lensing[n].averef != i) abort(); 359 tmplensing[N].averef = i; 360 n = next_lens[n]; 361 } 362 } 363 free (lensing); 364 return (tmplensing); 365 } 366 367 -
branches/eam_branches/ipp-20140717/Ohana/src/dvomerge/src/dvomergeContinue.c
r34260 r37084 131 131 merge_catalogs_old (&outsky[0].regions[j], &outcatalog, &incatalog, RADIUS, secfiltMap); 132 132 133 outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;134 135 133 // if we receive a signal which would cause us to exit, wait until the full catalog is written 136 134 SetProtect (TRUE); -
branches/eam_branches/ipp-20140717/Ohana/src/dvomerge/src/dvomergeContinue_threaded.c
r34260 r37084 74 74 merge_catalogs_old (&threadData->outsky->regions[j], &outcatalog, &incatalog, RADIUS, threadData->secfiltMap); 75 75 76 outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;77 78 76 // if we receive a signal which would cause us to exit, wait until the full catalog is written 79 77 SetProtect (TRUE); -
branches/eam_branches/ipp-20140717/Ohana/src/dvomerge/src/dvomergeCreate.c
r33963 r37084 178 178 SkyListFree (inlist); 179 179 180 outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;181 180 dvo_catalog_save (&outcatalog, VERBOSE); 182 181 dvo_catalog_unlock (&outcatalog); -
branches/eam_branches/ipp-20140717/Ohana/src/dvomerge/src/dvomergeFromList.c
r35590 r37084 143 143 merge_catalogs_old (&skyregion, &outcatalog, &incatalog, RADIUS, secfiltMap); 144 144 145 outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;146 147 145 dmhObjectAdd (outstat[0].history, &outcatalog.header, inStats); 148 146 -
branches/eam_branches/ipp-20140717/Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c
r37046 r37084 165 165 merge_catalogs_old (outlist[0].regions[j], &outcatalog, &incatalog, RADIUS, secfiltMap); 166 166 167 outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;168 169 167 if (outstat[j].missed) { 170 168 dmhObjectAdd (outstat[j].history, &outcatalog.header, inStats); -
branches/eam_branches/ipp-20140717/Ohana/src/dvomerge/src/dvomergeUpdate_threaded.c
r35765 r37084 72 72 merge_catalogs_old (&threadData->outsky->regions[j], &outcatalog, &incatalog, RADIUS, threadData->secfiltMap); 73 73 74 outcatalog.catflags = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF;75 76 74 // if we receive a signal which would cause us to exit, wait until the full catalog is written 77 75 SetProtect (TRUE); -
branches/eam_branches/ipp-20140717/Ohana/src/dvomerge/src/merge_catalogs_new.c
r28855 r37084 8 8 // input entries always define new objects 9 9 10 #define notyet 111 12 10 int merge_catalogs_new (SkyRegion *region, Catalog *output, Catalog *input, int *secfiltMap) { 13 11 14 12 off_t i, j, offset; 15 off_t NAVERAGE, NMEASURE, N average, Nmeasure, NsecfiltIn, NsecfiltOut, Nm;13 off_t NAVERAGE, NMEASURE, NLENSING, Naverage, Nmeasure, Nlensing, NsecfiltIn, NsecfiltOut, Nm; 16 14 17 15 Naverage = output[0].Naverage; … … 63 61 } 64 62 output[0].average[Naverage].Nmeasure = Nm; 63 64 Nm = 0; 65 for (j = 0; j < input[0].average[i].Nlensing; j++) { 66 offset = input[0].average[i].lensingOffset + j; 67 68 output[0].lensing[Nlensing] = input[0].lensing[offset]; 69 output[0].lensing[Nlensing].averef = Naverage; 70 71 Nlensing ++; 72 Nm ++; 73 if (Nlensing == NLENSING) { 74 NLENSING += 1000; 75 REALLOCATE (output[0].lensing, Lensing, NLENSING); 76 } 77 } 78 output[0].average[Naverage].Nlensing = Nm; 79 65 80 Naverage ++; 66 81 if (Naverage == NAVERAGE) { … … 72 87 REALLOCATE (output[0].average, Average, MAX (Naverage, 1)); 73 88 REALLOCATE (output[0].measure, Measure, MAX (Nmeasure, 1)); 89 REALLOCATE (output[0].lensing, Lensing, MAX (Nlensing, 1)); 74 90 REALLOCATE (output[0].secfilt, SecFilt, NsecfiltOut*MAX (Naverage, 1)); 75 91 output[0].Naverage = Naverage; 76 output[0].N measure = Nmeasure;92 output[0].Nlensing = Nlensing; 77 93 output[0].Nsecf_mem = Naverage * NsecfiltOut; 78 94 … … 84 100 85 101 if (VERBOSE) { 86 fprintf (stderr, OFF_T_FMT": using "OFF_T_FMT" stars ("OFF_T_FMT" measures ) for catalog\n",102 fprintf (stderr, OFF_T_FMT": using "OFF_T_FMT" stars ("OFF_T_FMT" measures, "OFF_T_FMT" lensing) for catalog\n", 87 103 i, 88 104 output[0].Naverage, 89 output[0].Nmeasure); 105 output[0].Nmeasure, 106 output[0].Nlensing); 90 107 } 91 108 return (TRUE); -
branches/eam_branches/ipp-20140717/Ohana/src/dvomerge/src/merge_catalogs_old.c
r37046 r37084 14 14 double *X1, *Y1, *X2, *Y2; 15 15 double dX, dY, dR; 16 off_t *N1, *N2, *next_meas;17 off_t Nave, NAVE, Nmeas, NMEAS, Nmatch ;16 off_t *N1, *N2, *next_meas, *next_lens; 17 off_t Nave, NAVE, Nmeas, NMEAS, Nmatch, Nlens, NLENS; 18 18 int NsecfiltIn; 19 19 int NsecfiltOut; … … 52 52 Nmatch = 0; 53 53 NMEAS = Nmeas = output[0].Nmeasure; 54 NLENS = Nlens = output[0].Nlensing; 54 55 55 56 // current max obj ID for this catalog … … 113 114 } 114 115 115 116 116 /* set up pointers for linked list of measure */ 117 117 if (output[0].sorted && (output[0].Nmeasure >= output[0].Nmeas_disk)) { … … 119 119 // is sorted while processed 120 120 next_meas = init_measure_links (output[0].average, Nave, output[0].measure, Nmeas); 121 next_lens = init_lensing_links (output[0].average, Nave, output[0].lensing, Nlens); 121 122 } else { 122 123 next_meas = build_measure_links (output[0].average, Nave, output[0].measure, Nmeas); 124 next_lens = build_lensing_links (output[0].average, Nave, output[0].lensing, Nlens); 123 125 } 124 126 … … 182 184 REALLOCATE (output[0].measure, Measure, NMEAS); 183 185 } 186 if (Nlens + input[0].average[N].Nmeasure >= NLENS) { 187 NLENS = Nlens + input[0].average[N].Nmeasure + 1000; 188 REALLOCATE (next_lens, off_t, NLENS); 189 REALLOCATE (output[0].lensing, Lensing, NLENS); 190 } 184 191 185 192 // 4) average properties from the input and the output db need to be properly merged. … … 191 198 if (REPLACE_BY_PHOTCODE) { 192 199 // index to first measure for this object 200 // XXX this does not support lensing measurements 193 201 int Mout = output[0].average[n].measureOffset; 194 202 if (replace_match(&output[0].average[n], &output[0].measure[Mout], &input[0].average[N], &input[0].measure[offset])) { … … 248 256 } 249 257 258 // if lensing measurements exist, add them too 259 if (output[0].lensing) { 260 for (Nin = 0; Nin < input[0].average[N].Nlensing; Nin++) { 261 /* add to end of lensing list */ 262 add_lens_link (&output[0].average[n], next_lens, Nlens, NLENS); 263 264 // set the new lensing 265 off_t lensoff = input[0].average[N].lensingOffset + Nin; 266 output[0].lensing[Nlens] = input[0].lensing[lensoff]; 267 268 output[0].lensing[Nlens].averef = n; 269 output[0].lensing[Nlens].objID = output[0].average[n].objID; 270 output[0].lensing[Nlens].catID = output[0].catID; 271 Nlens ++; 272 } 273 } 274 250 275 // update the average properties to reflect the incoming entries: 251 276 // if the original value is NAN but the input value is not, accept the input: … … 288 313 REALLOCATE (output[0].measure, Measure, NMEAS); 289 314 } 315 if (Nlens + input[0].average[N].Nlensing >= NLENS) { 316 NLENS = Nlens + input[0].average[N].Nlensing + 1000; 317 REALLOCATE (next_lens, off_t, NLENS); 318 REALLOCATE (output[0].lensing, Lensing, NLENS); 319 } 290 320 if (Nave >= NAVE) { 291 321 NAVE = Nave + 1000; … … 355 385 next_meas[Nmeas - Ngroup + j] = Nmeas - Ngroup + j + 1; 356 386 } 387 388 /** add lensing for this input average object **/ 389 if (output[0].lensing) { 390 for (Nin = 0; Nin < input[0].average[N].Nlensing; Nin ++) { 391 // supply the lensing values from this detection 392 off_t lensoff = input[0].average[N].lensingOffset + Nin; 393 output[0].lensing[Nlens] = input[0].lensing[lensoff]; 394 395 // the following lensing elements cannot be set until here: 396 output[0].lensing[Nlens].averef = Nave; 397 output[0].lensing[Nlens].objID = output[0].average[Nave].objID; 398 output[0].lensing[Nlens].catID = output[0].catID; 399 400 // as we add lensing, update Nlensing to match 401 output[0].average[Nave].Nlensing ++; 402 403 /* we set next[Nlens] to -1 here, and update correctly below */ 404 next_lens[Nlens] = -1; 405 Nlens ++; 406 } 407 int Ngroup = input[0].average[N].Nlensing; 408 for (j = 0; j < Ngroup - 1; j++) { 409 next_lens[Nlens - Ngroup + j] = Nlens - Ngroup + j + 1; 410 } 411 } 412 357 413 Nave ++; 358 414 } … … 362 418 REALLOCATE (output[0].average, Average, Nave); 363 419 REALLOCATE (output[0].measure, Measure, Nmeas); 420 REALLOCATE (output[0].lensing, Lensing, Nlens); 364 421 365 422 # define NOSORT 0 … … 369 426 output[0].sorted = TRUE; 370 427 output[0].measure = sort_measure (output[0].average, Nave, output[0].measure, Nmeas, next_meas); 428 output[0].lensing = sort_lensing (output[0].average, Nave, output[0].lensing, Nlens, next_lens); 371 429 } 372 430 … … 384 442 output[0].Naverage = Nave; 385 443 output[0].Nmeasure = Nmeas; 444 output[0].Nlensing = Nlens; 386 445 output[0].Nsecf_mem = Nave*NsecfiltOut; 387 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas : "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n", Nstars, Nave, Nmeas,Nmatch);446 if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas, Nlens: "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT" "OFF_T_FMT", ("OFF_T_FMT" matches)\n", Nstars, Nave, Nmeas, Nlens, Nmatch); 388 447 389 448 free (next_meas); 449 free (next_lens); 390 450 391 451 free (X2);
Note:
See TracChangeset
for help on using the changeset viewer.
