Changeset 24982
- Timestamp:
- Aug 3, 2009, 4:08:06 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/sj_branches/sj_SDSSaddstar_branch_r23928_20090420/Ohana/src/addstar/src/ReadStarsSDSS.c
r23943 r24982 67 67 strcpy (filtname[4], "z"); 68 68 69 // XXXYYY Why these? and not the 'ref' version? see 'Why these?' below, too. 69 // XXXJester: SDSS photometry is read with 'dep' photcodes - recalibratable in principle, not standard-star 70 // photometry (which would get 'ref'). 70 71 NAMED_PHOTCODE_AND_ZP (photcode[0], zeropt[0], "U_SDSS"); 71 72 NAMED_PHOTCODE_AND_ZP (photcode[1], zeropt[1], "G_SDSS"); … … 74 75 NAMED_PHOTCODE_AND_ZP (photcode[4], zeropt[4], "Z_SDSS"); 75 76 76 // XXXYYYZZZ SDSS tables have special flags for undefined/unmeasured values and errors: 77 // -9999 flags unmeasured values, and the corresponding error may or may not be meaningful 78 // -1000 flags errors that are not determined, even though the corresponding quantity is. 79 // These special values need to be trapped here to avoid averaging meaningful numbers with the flag values. 77 // XXXJester:ZZZ SDSS tables have special flags for undefined/unmeasured values and errors: -9999 flags 78 // unmeasured values, and the corresponding error may or may not be meaningful -1000 flags errors that are 79 // not determined, even though the corresponding quantity is. These special values need to be trapped here 80 // to avoid averaging meaningful numbers with the flag values. However, we can't just skip an entire star 81 // just because one measurement is missing in one quantity. Perhaps the right thing to do is to replace 82 // -9999 and -1000 by NaN; however, does the averaging routine (i.e. liststats() in 83 // Ohana/src/relphot/src/liststats.c, or maybe rather the sort functions in there) correctly ignore NaNs? I don't 84 // think so. In fact, I think not ignoring NaNs is a generic problem, because NaNs tend to be contagious, 85 // and just a single bad/missing measurement should not invalidate the average quantity of anything. 80 86 81 87 // various header values needed to calculate per-star data below … … 94 100 tzero[4] = ohana_mjd_to_sec (mjd[4]); 95 101 96 // XXX YYYEDR paper says "psfWidth is is the effective width also determined at the center of each frame. It102 // XXXJester: EDR paper says "psfWidth is is the effective width also determined at the center of each frame. It 97 103 // is a good generic number to quote for the seeing on each frame." It is stored in the tsField file as 98 // psf_width. 104 // psf_width. If we read the actual per-field zero points and extinction coefficients, we could also read psf_width. 99 105 gfits_scan (table.header, "SEEING_U", "%f", 1, &seeing[0]); 100 106 gfits_scan (table.header, "SEEING_G", "%f", 1, &seeing[1]); … … 103 109 gfits_scan (table.header, "SEEING_Z", "%f", 1, &seeing[4]); 104 110 105 // XXX YYYWhat's the meaning of photErr? Where is it used again?111 // XXXJester: What's the meaning of photErr? Where is it used again? 106 112 gfits_scan (table.header, "PSFERR_U", "%f", 1, &photErr[0]); 107 113 gfits_scan (table.header, "PSFERR_G", "%f", 1, &photErr[1]); … … 112 118 gfits_scan (header, "CAMCOL", "%d", 1, &camcol); // value in header is usec / unbinned row 113 119 114 // XXXYYY which number is read here? In other words, where is the zeropoint set that is returned by 115 // GetZeroPoint()? I can't find the corresponding SetZeroPoint() 120 // XXXJester: The corresponding SetZeroPoint() is in ConfigInit.c, where ZERO_PT from ~/.ptolemyrc is read 116 121 ZeroPt = GetZeroPoint(); 117 122 … … 147 152 // compensate for the difference. 148 153 149 Nstars_used = Nstars; 154 // XXXYYYJester: the actual C_0 and the airmass coefficient are reported in the tsField file that go with 155 // every tsObj file (i.e. C_0 = - aa - kk * airmass). Worse, SDSS reports *luptitudes* (asinh magnitudes) 156 // not conventional ("Pogson") magnitudes, so in fact SDSS reports -(2.5/ln(10))*[asinh((f/f0)/2b)+ln(b)] 157 // where f/f0 = counts/sec * 10^[0.4*(aa + kk * airmass)]. See 158 // http://www.sdss.org/dr7/algorithms/fluxcal.html#counts2mag 159 160 Nstars_used = 0; 150 161 for (i = 0; i < Nstars; i++) { 151 // Skip objects that are not OK_RUN 152 if ( ((status[i]) & AR_OBJECT_STATUS_OK_RUN) != 0) {153 Nstars_used--;162 // Skip objects that are not OK_RUN (including other objects leads to counting the same photons more than 163 // once - see comment near images[N].NY = ... below) 164 if ( ((status[i]) & AR_OBJECT_STATUS_OK_RUN) == 0) { 154 165 continue; 155 166 } 167 Nstars_used += 1; 156 168 for (j = 0; j < NFILTER; j++) { 157 N = NFILTER *i+ j;169 N = NFILTER * (Nstars_used-1) + j; 158 170 InitStar (&stars[N]); 159 171 160 172 // any values not explicitly set are left at 0.0 161 stars[N].average.R = ra[i] + dCOS(dec[i]) * offsetRa[N] / 3600.0; 173 // XXXYYYJester: the offsetRa here used to be multiplied by dCOS(dec[i]), but that's already been done 174 // by SDSS 175 stars[N].average.R = ra[i] + offsetRa[N] / 3600.0; 162 176 stars[N].average.D = dec[i] + offsetDec[N] / 3600.0; 163 177 stars[N].average.dR = NAN; … … 168 182 stars[N].measure.dXccd = ShortPixels(colcErr[N]); 169 183 stars[N].measure.dYccd = ShortPixels(rowcErr[N]); 170 // XXX YYYagain the question what ZeroPt-zeropt[j] evalutes to - according to what it says above, this184 // XXXJester: again the question what ZeroPt-zeropt[j] evalutes to - according to what it says above, this 171 185 // should take .M back into instrumental magnitudes, but does it? In particular, the *actual* zeropoint 172 186 // that was used for the computation of this calibrated magnitude is in the tsField file; in general, it … … 176 190 stars[N].measure.dM = psfCountsErr[N]; 177 191 stars[N].measure.Map = fiberCounts[N] + ZeroPt - zeropt[j]; 178 stars[N].measure.Sky = sky[N]; // adjust this to counts? XXX YYY It's given in maggies; to get back to counts,192 stars[N].measure.Sky = sky[N]; // adjust this to counts? XXXJester: The SDSS Sky is given in maggies/arcsec^2; a maggie is a linear flux measure, 1 maggie corresponds to 0 magnitude, a surface brightness of 20 mag/square arcsec corresponds to 10-8 maggies per square arcsec. 179 193 stars[N].measure.dSky = skyErr[N]; 180 stars[N].measure.FWx = ShortPixels(seeing[j]); // reported in arcsec? XXX YYY: Yes!194 stars[N].measure.FWx = ShortPixels(seeing[j]); // reported in arcsec? XXXJester:: Yes! 181 195 stars[N].measure.FWy = ShortPixels(seeing[j]); 182 196 stars[N].measure.psfChisq = prob_psf[N]; // XXX not really the correct value... 183 197 stars[N].measure.detID = N; 184 198 stars[N].measure.t = tzero[j] + clockRate*rowc[N]; // time since row 0 185 stars[N].measure.dt = 53.907456; // is this 2048*clockRate ? XXX YYYNearly - 4 milliseconds more. shouldn't this be a #define?199 stars[N].measure.dt = 53.907456; // is this 2048*clockRate ? XXXJester: Nearly - 4 milliseconds more. shouldn't this be a #define? 186 200 187 201 SetSDSSFlags (&stars[N], flags[N], flags2[N]); … … 199 213 altaz (&alt, &az, sidtime - stars[N].average.R, stars[N].average.D, Latitude); 200 214 201 // XXX YYYairmass is in tsField file215 // XXXJester: airmass is in tsField file 202 216 stars[N].measure.airmass = 1.0 / dCOS(90.0 - alt); 203 217 stars[N].measure.az = az; … … 206 220 } 207 221 208 // Throw away unneeded trailing (I hope) part of Stars209 REALLOCATE (stars, Stars, NFILTER*Nstars_used);210 222 211 223 for (i = 0; i < NFILTER; i++) { … … 215 227 // XXX for now, we define a totally fake coordinate system centered on the first listed star 216 228 217 // XXX YYYwhat's happening here? *Exact* astrometry for SDSS can only be retrieved using the229 // XXXJester: what's happening here? *Exact* astrometry for SDSS can only be retrieved using the 218 230 // colour-dependent distortion coefficients from the tsField file. See 219 231 // www.sdss.org/dr7/products/general/astrometry.html … … 242 254 243 255 images[N].NX = 2048; 244 // XXXYYY NZ should be 1361, since the last 128 rows are the duplicate of the neighbouring frame, and only 256 images[N].NY = 1490; 257 // XXXJester: NY should be 1361, since the last 128 rows are the duplicate of the neighbouring frame, and only 245 258 // objects in 64 <= row < 1361+64 (or maybe the <= is at the upper limit?) are counted as belonging to 246 259 // "this" field. I.e. we also need to read the status flag and use only primary and secondary objects … … 261 274 // run. This is desired in the case of dvo. Hence we need exactly those objects with OK_RUN set, not more, 262 275 // not less. 263 264 // And once more, NY = 1361, which led into the whole 'status' discussion. In any case, why is this 1490 265 // not 1489? 266 images[N].NY = 1490; 276 // 277 // And once more, I think we need NY = 1361, which led into the whole 'status' discussion. In any case, 278 // why is this 1490 not 1489? 267 279 268 280 images[N].tzero = tzero[i]; … … 270 282 271 283 // set photcodes for the 5 images (SDSS_U,G,R,I,Z) 272 // XXXYYY Why these? and not the 'u_sdss etc. 'ref' photcodes (see above where it says U_SDSS etc.) 284 // 285 // We use the 'dep' photcodes and not 'ref' because we can in principle recalibrate the SDSS photometry in 286 // dvo; looks like 'ref' is reserved for real standard-star observations 273 287 images[N].photcode = photcode[i]; 274 288 … … 343 357 int SetSDSSFlags (Stars *star, unsigned int flags1, unsigned int flags2) { 344 358 345 // XXX this is wrong, need to roll left to set the correct bit346 359 if (flags1 & 0x00000002) star[0].measure.photFlags |= 0x0001; // BRIGHT - 1 1 347 360 if (flags1 & 0x00000004) star[0].measure.photFlags |= 0x0002; // EDGE - 1 2
Note:
See TracChangeset
for help on using the changeset viewer.
