Changeset 37198
- Timestamp:
- Aug 7, 2014, 6:20:06 AM (12 years ago)
- Location:
- branches/eam_branches/ipp-20140717/Ohana/src/dvopsps
- Files:
-
- 3 edited
-
include/dvopsps.h (modified) (1 diff)
-
src/DetectionOps.c (modified) (8 diffs)
-
src/insert_detections_dvopsps_catalog.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140717/Ohana/src/dvopsps/include/dvopsps.h
r37176 r37198 14 14 unsigned int ippDetectID; 15 15 int imageID; 16 int catID; 16 17 double ra; 17 18 double dec; -
branches/eam_branches/ipp-20140717/Ohana/src/dvopsps/src/DetectionOps.c
r37176 r37198 51 51 GET_COLUMN(ippDetectID , "ippDetectID", int); 52 52 GET_COLUMN(imageID , "imageID", int); 53 GET_COLUMN(catID , "catID", int); 53 54 GET_COLUMN(ra , "ra", double); // XXX signed vs unsigned? 54 55 GET_COLUMN(dec , "dec", double); … … 76 77 detections[i].ippDetectID = ippDetectID[i]; 77 78 detections[i].imageID = imageID[i]; 79 detections[i].catID = catID[i]; 78 80 detections[i].ra = ra[i]; 79 81 detections[i].dec = dec[i]; … … 99 101 free (ippDetectID); 100 102 free (imageID ); 103 free (catID ); 101 104 free (ra ); 102 105 free (dec ); … … 166 169 gfits_define_bintable_column (&theader, "J", "ippDetectID", NULL, NULL, 1.0, FT_BZERO_INT32); 167 170 gfits_define_bintable_column (&theader, "J", "imageID", NULL, NULL, 1.0, FT_BZERO_INT32); 171 gfits_define_bintable_column (&theader, "J", "catID", NULL, NULL, 1.0, FT_BZERO_INT32); 168 172 gfits_define_bintable_column (&theader, "D", "ra", NULL, NULL, 1.0, 0.0); 169 173 gfits_define_bintable_column (&theader, "D", "dec", NULL, NULL, 1.0, 0.0); … … 191 195 uint32_t *ippDetectID ; ALLOCATE (ippDetectID , uint32_t, Ndetections); 192 196 int32_t *imageID ; ALLOCATE (imageID , int32_t, Ndetections); 197 int32_t *catID ; ALLOCATE (catID , int32_t, Ndetections); 193 198 double *ra ; ALLOCATE (ra , double, Ndetections); 194 199 double *dec ; ALLOCATE (dec , double, Ndetections); … … 214 219 ippDetectID[i] = detections[i].ippDetectID ; 215 220 imageID[i] = detections[i].imageID ; 221 catID[i] = detections[i].catID ; 216 222 ra[i] = detections[i].ra ; 217 223 dec[i] = detections[i].dec ; … … 237 243 gfits_set_bintable_column (&theader, &ftable, "ippDetectID", ippDetectID , Ndetections); 238 244 gfits_set_bintable_column (&theader, &ftable, "imageID", imageID , Ndetections); 245 gfits_set_bintable_column (&theader, &ftable, "catID", catID , Ndetections); 239 246 gfits_set_bintable_column (&theader, &ftable, "ra", ra , Ndetections); 240 247 gfits_set_bintable_column (&theader, &ftable, "dec", dec , Ndetections); … … 258 265 free (ippDetectID ); 259 266 free (imageID ); 267 free (catID ); 260 268 free (ra ); 261 269 free (dec ); -
branches/eam_branches/ipp-20140717/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c
r37176 r37198 6 6 Detections *detections = NULL; 7 7 8 static float ZeroPoint = 25.0; 9 8 10 int init_detections () { 9 11 NDETECTIONS = 1000; … … 15 17 16 18 off_t i, j; 19 20 ZeroPoint = GetZeroPoint(); 17 21 18 22 int missingID = 0; … … 91 95 92 96 off_t found = 0; 97 98 ZeroPoint = GetZeroPoint(); 93 99 94 100 INITTIME; … … 179 185 } 180 186 181 PrintIOBuffer (buffer, "INSERT INTO dvoDetectionFull (objID, detectID, ippObjID, ippDetectID, imageID, "); 182 PrintIOBuffer (buffer, "ra, dec_, raErr, decErr, zp, telluricExt, airmass, expTime, Mpsf, dMpsf, Mkron, dMkron, Map, dMap, flags) VALUES \n"); 187 PrintIOBuffer (buffer, "INSERT INTO dvoDetectionFull (objID, detectID, ippObjID, ippDetectID, imageID, catID, "); 188 PrintIOBuffer (buffer, "ra, dec_, raErr, decErr, zp, telluricExt, airmass, expTime, "); 189 PrintIOBuffer (buffer, "Mpsf, dMpsf, Mkron, dMkron, Map, dMap, flags) VALUES \n"); 183 190 184 191 return TRUE; … … 231 238 PrintIOBuffer (buffer, "%u, ", detection->ippDetectID); // ippDetectID 232 239 PrintIOBuffer (buffer, "%d, ", detection->imageID); // imageID 240 PrintIOBuffer (buffer, "%d, ", detection->catID); // DVO Catalog ID 233 241 234 242 PRINT_FLOAT(buffer, detection->ra, "%.8f, "); … … 252 260 } 253 261 262 float getMagFromValueOrFlux (float flux, float mag, float zp) { 263 264 // first, if mag is finite, use mag: 265 if (isfinite(mag)) { 266 return (zp + mag - ZeroPoint); 267 } 268 269 if (isfinite(flux) && (flux > 0.0)) { 270 fprintf (stderr, "how did we get here?\n"); 271 return (zp - 2.5*log10(flux)); 272 } 273 274 if (isfinite(flux) && (flux <= 0.0)) { 275 return (NAN); 276 } 277 return (NAN); 278 } 279 280 float getdMagFromValueOrFlux (float flux, float dflux, float dmag) { 281 282 // first, if mag is finite, use mag: 283 if (isfinite(dmag)) { 284 return (dmag); 285 } 286 287 if (isfinite(flux) && isfinite(dflux)) { 288 return (dflux / fabs(flux)); 289 } 290 return (NAN); 291 } 292 254 293 int assign_detection_values (Detections *detection, Measure *measure, Average *average) { 255 294 … … 266 305 detection->objID = average->extID; // objID 267 306 detection->detectID = measure->extID; // detectID 268 detection->ippObjID = ippObjID; // ippObID307 detection->ippObjID = ippObjID; // ippObjID 269 308 detection->ippDetectID = measure->detID; // ippDetectID 270 309 detection->imageID = measure->imageID; // imageID 310 detection->catID = measure->catID; // catID 271 311 272 312 detection->ra = measure->R; // ra … … 281 321 282 322 // XXX clean this up with dvo_photcode_ops calls: 283 detection->Mpsf = (measure->FluxPSF > 0.0) ? zp - 2.5*log10(measure->FluxPSF) : NAN; 284 detection->Mkron = (measure->FluxKron > 0.0) ? zp - 2.5*log10(measure->FluxKron) : NAN; 285 detection->Map = (measure->FluxAp > 0.0) ? zp - 2.5*log10(measure->FluxAp) : NAN; 286 287 detection->dMpsf = (measure->FluxPSF > 0.0) ? measure->dFluxPSF / measure->FluxPSF : NAN; 288 detection->dMkron = (measure->FluxKron > 0.0) ? measure->dFluxKron/ measure->FluxKron: NAN; 289 detection->dMap = (measure->FluxAp > 0.0) ? measure->dFluxAp / measure->FluxAp : NAN; 323 // if (isfinite(measure->FluxPSF) && (measure->FluxPSF < 0.0)) 324 detection->Mpsf = getMagFromValueOrFlux (measure->FluxPSF, measure->M, zp); 325 detection->Mkron = getMagFromValueOrFlux (measure->FluxKron, measure->Mkron, zp); 326 detection->Map = getMagFromValueOrFlux (measure->FluxAp, measure->Map, zp); 327 328 detection->dMpsf = getdMagFromValueOrFlux (measure->FluxPSF, measure->dFluxPSF, measure->dM); 329 detection->dMkron = getdMagFromValueOrFlux (measure->FluxKron, measure->dFluxKron, measure->dMkron); 330 detection->dMap = getdMagFromValueOrFlux (measure->FluxAp, measure->dFluxAp, measure->dMap); 290 331 291 332 detection->flags = measure->dbFlags; // flags
Note:
See TracChangeset
for help on using the changeset viewer.
