Changeset 17212
- Timestamp:
- Mar 28, 2008, 3:42:32 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/relastro/src/bcatalog.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relastro/src/bcatalog.c
r17129 r17212 4 4 5 5 int i, j, k, offset, found; 6 int NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm ;6 int NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm, Nsecfilt; 7 7 float mag; 8 int mask; 9 PhotCode *code; 8 10 9 // XXX PhotNsec as a global is a bad idea; either get it from catalog 10 // or get it from: 11 // Nsecfilt = GetPhotcodeNsecfilt (); 12 // assert (catalog[0].Nsecfilt == Nsecfilt); 11 // XXX in the future, use catalog[0].Nsecfilt only? allow catalogs to have variable Nsecfilt? 12 Nsecfilt = GetPhotcodeNsecfilt (); 13 assert (catalog[0].Nsecfilt == Nsecfilt); 13 14 14 15 /* we are moving only the subset of measurements from catalog[0] to subcatalog[0] */ … … 16 17 NMEASURE = 1000; 17 18 ALLOCATE (subcatalog[0].average, Average, NAVERAGE); 18 ALLOCATE (subcatalog[0].secfilt, SecFilt, NAVERAGE* PhotNsec);19 ALLOCATE (subcatalog[0].secfilt, SecFilt, NAVERAGE*Nsecfilt); 19 20 ALLOCATE (subcatalog[0].measure, Measure, NMEASURE); 20 21 Nmeasure = Naverage = 0; … … 27 28 subcatalog[0].average[Naverage] = catalog[0].average[i]; 28 29 subcatalog[0].average[Naverage].measureOffset = Nmeasure; 29 for (j = 0; j < PhotNsec; j++) {30 subcatalog[0].secfilt[ PhotNsec*Naverage+j] = catalog[0].secfilt[PhotNsec*i+j];30 for (j = 0; j < Nsecfilt; j++) { 31 subcatalog[0].secfilt[Nsecfilt*Naverage+j] = catalog[0].secfilt[Nsecfilt*i+j]; 31 32 } 32 33 33 34 if (RESET) { 34 35 // XXX reset the ra,dec coords? 36 // XXX define astrometry vs photometry average.dbFlags 37 // XXX put photometry flags in secfilt (ie, per average mag?) 35 38 subcatalog[0].average[Naverage].code &= ~ID_STAR_FEW; 36 39 subcatalog[0].average[Naverage].code &= ~ID_STAR_POOR; … … 42 45 offset = catalog[0].average[i].measureOffset + j; 43 46 44 /* select measurements by photcode, if specified */45 if (Nphotcodes > 0) {47 /* select measurements by photcode, or equiv photcode, if specified */ 48 if (NphotcodesKeep > 0) { 46 49 found = FALSE; 47 for (k = 0; (k < Nphotcodes) && !found; k++) { 48 if (photcodes[k][0].code == catalog[0].measure[offset].photcode) found = TRUE; 50 for (k = 0; (k < NphotcodesKeep) && !found; k++) { 51 if (photcodesKeep[k][0].code == catalog[0].measure[offset].photcode) found = TRUE; 52 if (photcodesKeep[k][0].code == GetPhotcodeEquivCodebyCode(catalog[0].measure[offset].photcode)) found = TRUE; 49 53 } 50 54 if (!found) continue; 55 } 56 if (NphotcodesSkip > 0) { 57 found = FALSE; 58 for (k = 0; (k < NphotcodesSkip) && !found; k++) { 59 if (photcodesSkip[k][0].code == catalog[0].measure[offset].photcode) found = TRUE; 60 if (photcodesSkip[k][0].code == GetPhotcodeEquivCodebyCode(catalog[0].measure[offset].photcode)) found = TRUE; 61 } 62 if (found) continue; 51 63 } 52 64 … … 61 73 62 74 /* select measurements by quality */ 63 if (PhotFlagSelect && (catalog[0].measure[offset].photFlags & PhotFlagValue)) continue; 75 if (PhotFlagSelect) { 76 if (PhotFlagBad) { 77 mask = PhotFlagBad; 78 } else { 79 code = GetPhotcodebyCode (catalog[0].measure[offset].photcode); 80 mask = code[0].astromBadMask; 81 } 82 if (mask & catalog[0].measure[offset].photFlags) continue; 83 } 64 84 65 85 /* select measurements by measurement error */ … … 73 93 } 74 94 75 subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_SKIP; 76 subcatalog[0].measure[Nmeasure] = catalog[0].measure[offset]; 77 subcatalog[0].measure[Nmeasure].averef = Naverage; 95 // re-assess on each run of relastro if a measurement should be used 96 97 // NOCAL : this flag is used to mark measurements which must be ignored for this 98 // analysis. an example would be time ranges or photcodes which are ignored. NOCAL 99 // is internal only; it is not written out. 100 101 // SKIP : this flag is used to mark measurements currently ignored, but may be 102 // allowed before the analysis is complete. for example, a star with measurements 103 // only near the edge of images will have this flag set for most of the analysis, 104 // but before the final average properties are calculated, these measurements may be 105 // allowed. 106 107 subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_SKIP_ASTROM; 108 subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_NOCAL; 109 subcatalog[0].measure[Nmeasure] = catalog[0].measure[offset]; 110 subcatalog[0].measure[Nmeasure].averef = Naverage; 78 111 if (RESET) { 79 subcatalog[0].measure[Nmeasure].Mcal = 0; 80 subcatalog[0].measure[Nmeasure].dbFlags &= 0xff00; 81 subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_POOR; 112 subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_POOR_ASTROM; 82 113 subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_AREA; 83 subcatalog[0].measure[Nmeasure].dbFlags &= ~ID_MEAS_NOCAL;84 114 } 85 115 Nmeasure ++; … … 95 125 NAVERAGE += 50; 96 126 REALLOCATE (subcatalog[0].average, Average, NAVERAGE); 97 REALLOCATE (subcatalog[0].secfilt, SecFilt, NAVERAGE* PhotNsec);127 REALLOCATE (subcatalog[0].secfilt, SecFilt, NAVERAGE*Nsecfilt); 98 128 } 99 129 } 100 130 REALLOCATE (subcatalog[0].average, Average, MAX (Naverage, 1)); 101 131 REALLOCATE (subcatalog[0].measure, Measure, MAX (Nmeasure, 1)); 102 REALLOCATE (subcatalog[0].secfilt, SecFilt, PhotNsec*MAX (Naverage, 1));132 REALLOCATE (subcatalog[0].secfilt, SecFilt, Nsecfilt*MAX (Naverage, 1)); 103 133 subcatalog[0].Naverage = Naverage; 104 134 subcatalog[0].Nmeasure = Nmeasure; 105 135 subcatalog[0].Nsecfilt = catalog[0].Nsecfilt; 106 subcatalog[0].Nsecf_mem = Naverage * PhotNsec;107 assert ( PhotNsec== catalog[0].Nsecfilt);136 subcatalog[0].Nsecf_mem = Naverage * Nsecfilt; 137 assert (Nsecfilt == catalog[0].Nsecfilt); 108 138 109 139 if (VERBOSE) {
Note:
See TracChangeset
for help on using the changeset viewer.
