Changeset 37246 for trunk/Ohana
- Timestamp:
- Aug 12, 2014, 4:10:18 PM (12 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 30 edited
-
. (modified) (1 prop)
-
src/addstar/src/ReadStarsFITS.c (modified) (26 diffs)
-
src/addstar/src/mkcmf.c (modified) (2 diffs)
-
src/dvopsps/include/dvopsps.h (modified) (2 diffs)
-
src/dvopsps/src/DetectionOps.c (modified) (5 diffs)
-
src/dvopsps/src/insert_detections_dvopsps.c (modified) (1 diff)
-
src/dvopsps/src/insert_detections_dvopsps_catalog.c (modified) (7 diffs)
-
src/dvopsps/src/insert_objects_dvopsps_catalog.c (modified) (5 diffs)
-
src/getstar (modified) (1 prop)
-
src/libautocode/def/average-ps1-v5.d (modified) (2 diffs)
-
src/libautocode/def/average.d (modified) (2 diffs)
-
src/libautocode/def/measure-ps1-v5.d (modified) (1 diff)
-
src/libautocode/def/measure.d (modified) (1 diff)
-
src/libautocode/def/secfilt-ps1-v5.d (modified) (4 diffs)
-
src/libautocode/def/secfilt.d (modified) (5 diffs)
-
src/libdvo/include/dvo.h (modified) (3 diffs)
-
src/libdvo/src/dbExtractMeasures.c (modified) (1 diff)
-
src/libdvo/src/dvo_catalog.c (modified) (6 diffs)
-
src/libdvo/src/dvo_convert.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_DEV_1.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_DEV_2.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_V1.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_V2.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_V3.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_V4.c (modified) (3 diffs)
-
src/libdvo/src/dvo_convert_PS1_V5.c (modified) (11 diffs)
-
src/opihi/cmd.astro/cplot.c (modified) (5 diffs)
-
src/opihi/dvo/gstar.c (modified) (1 diff)
-
src/relastro/src/UpdateObjects.c (modified) (1 diff)
-
src/relphot/src/setMrelCatalog.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20140717/Ohana merged: 37176,37198,37225-37231,37240,37243
- Property svn:mergeinfo changed
-
trunk/Ohana/src/addstar/src/ReadStarsFITS.c
r37036 r37246 182 182 stars[i].measure.psfNdof = NAN_S_INT; // not provided by SMPDATA: 183 183 stars[i].measure.psfNpix = NAN_S_INT; // not provided by SMPDATA: 184 stars[i].measure.crNsigma = NAN; // not provided by SMPDATA:185 184 stars[i].measure.extNsigma = NAN; // not provided by SMPDATA: 186 185 … … 251 250 stars[i].measure.psfNdof = NAN_S_INT; // not provided by PS1_DEV_0: 252 251 stars[i].measure.psfNpix = NAN_S_INT; // not provided by PS1_DEV_0: 253 stars[i].measure.crNsigma = NAN; // not provided by PS1_DEV_0:254 252 stars[i].measure.extNsigma = NAN; // not provided by PS1_DEV_0: 255 253 … … 323 321 stars[i].measure.psfNdof = NAN_S_INT; // not provided by PS1_DEV_1: 324 322 stars[i].measure.psfNpix = NAN_S_INT; // not provided by PS1_DEV_1: 325 stars[i].measure.crNsigma = ps1data[i].crNsigma;326 323 stars[i].measure.extNsigma = ps1data[i].extNsigma; 327 324 … … 408 405 stars[i].measure.psfNdof = ps1data[i].psfNdof; 409 406 stars[i].measure.psfNpix = ps1data[i].psfNpix; 410 stars[i].measure.crNsigma = ps1data[i].crNsigma;411 407 stars[i].measure.extNsigma = ps1data[i].extNsigma; 412 408 … … 494 490 stars[i].measure.psfNdof = ps1data[i].psfNdof; 495 491 stars[i].measure.psfNpix = ps1data[i].psfNpix; 496 stars[i].measure.crNsigma = ps1data[i].crNsigma;497 492 stars[i].measure.extNsigma = ps1data[i].extNsigma; 498 493 … … 572 567 stars[i].measure.psfNdof = ps1data[i].psfNdof; 573 568 stars[i].measure.psfNpix = ps1data[i].psfNpix; 574 stars[i].measure.crNsigma = ps1data[i].crNsigma;575 569 stars[i].measure.extNsigma = ps1data[i].extNsigma; 576 570 … … 653 647 stars[i].measure.psfNdof = ps1data[i].psfNdof; 654 648 stars[i].measure.psfNpix = ps1data[i].psfNpix; 655 stars[i].measure.crNsigma = ps1data[i].crNsigma;656 649 stars[i].measure.extNsigma = ps1data[i].extNsigma; 657 650 … … 665 658 666 659 stars[i].measure.photFlags = ps1data[i].flags; 660 stars[i].measure.photFlags2 = ps1data[i].flags2; 667 661 668 662 // this is may optionally be replaced by the internal sequence (see FilterStars.c) … … 738 732 stars[i].measure.psfNdof = ps1data[i].psfNdof; 739 733 stars[i].measure.psfNpix = ps1data[i].psfNpix; 740 stars[i].measure.crNsigma = ps1data[i].crNsigma;741 734 stars[i].measure.extNsigma = ps1data[i].extNsigma; 742 735 … … 750 743 751 744 stars[i].measure.photFlags = ps1data[i].flags; 745 stars[i].measure.photFlags2 = ps1data[i].flags2; 752 746 753 747 // this is may optionally be replaced by the internal sequence (see FilterStars.c) … … 823 817 stars[i].measure.psfNdof = ps1data[i].psfNdof; 824 818 stars[i].measure.psfNpix = ps1data[i].psfNpix; 825 stars[i].measure.crNsigma = ps1data[i].crNsigma;826 819 stars[i].measure.extNsigma = ps1data[i].extNsigma; 827 820 … … 835 828 836 829 stars[i].measure.photFlags = ps1data[i].flags; 830 stars[i].measure.photFlags2 = ps1data[i].flags2; 837 831 838 832 // this is may optionally be replaced by the internal sequence (see FilterStars.c) … … 908 902 stars[i].measure.psfNdof = ps1data[i].psfNdof; 909 903 stars[i].measure.psfNpix = ps1data[i].psfNpix; 910 stars[i].measure.crNsigma = ps1data[i].crNsigma;911 904 stars[i].measure.extNsigma = ps1data[i].extNsigma; 912 905 … … 920 913 921 914 stars[i].measure.photFlags = ps1data[i].flags; 915 stars[i].measure.photFlags2 = ps1data[i].flags2; 922 916 923 917 // this is may optionally be replaced by the internal sequence (see FilterStars.c) … … 1038 1032 stars[i].measure.psfNdof = ps1data[i].psfNdof; 1039 1033 stars[i].measure.psfNpix = ps1data[i].psfNpix; 1040 stars[i].measure.crNsigma = ps1data[i].crNsigma;1041 1034 stars[i].measure.extNsigma = ps1data[i].extNsigma; 1042 1035 … … 1050 1043 1051 1044 stars[i].measure.photFlags = ps1data[i].flags; 1045 stars[i].measure.photFlags2 = ps1data[i].flags2; 1052 1046 1053 1047 // this is may optionally be replaced by the internal sequence (see FilterStars.c) … … 1120 1114 stars[i].measure.psfNdof = ps1data[i].psfNdof; 1121 1115 stars[i].measure.psfNpix = ps1data[i].psfNpix; 1122 stars[i].measure.crNsigma = ps1data[i].crNsigma;1123 1116 stars[i].measure.extNsigma = ps1data[i].extNsigma; 1124 1117 … … 1132 1125 1133 1126 stars[i].measure.photFlags = ps1data[i].flags; 1127 stars[i].measure.photFlags2 = ps1data[i].flags2; 1134 1128 1135 1129 // this is may optionally be replaced by the internal sequence (see FilterStars.c) … … 1202 1196 stars[i].measure.psfNdof = ps1data[i].psfNdof; 1203 1197 stars[i].measure.psfNpix = ps1data[i].psfNpix; 1204 stars[i].measure.crNsigma = ps1data[i].crNsigma;1205 1198 stars[i].measure.extNsigma = ps1data[i].extNsigma; 1206 1199 … … 1214 1207 1215 1208 stars[i].measure.photFlags = ps1data[i].flags; 1209 stars[i].measure.photFlags2 = ps1data[i].flags2; 1216 1210 1217 1211 // this is may optionally be replaced by the internal sequence (see FilterStars.c) … … 1284 1278 stars[i].measure.psfNdof = ps1data[i].psfNdof; 1285 1279 stars[i].measure.psfNpix = ps1data[i].psfNpix; 1286 stars[i].measure.crNsigma = ps1data[i].crNsigma;1287 1280 stars[i].measure.extNsigma = ps1data[i].extNsigma; 1288 1281 … … 1296 1289 1297 1290 stars[i].measure.photFlags = ps1data[i].flags; 1291 stars[i].measure.photFlags2 = ps1data[i].flags2; 1298 1292 1299 1293 // this is may optionally be replaced by the internal sequence (see FilterStars.c) … … 1365 1359 stars[i].measure.psfNdof = ps1data[i].psfNdof; 1366 1360 stars[i].measure.psfNpix = ps1data[i].psfNpix; 1367 stars[i].measure.crNsigma = ps1data[i].crNsigma;1368 1361 stars[i].measure.extNsigma = ps1data[i].extNsigma; 1369 1362 … … 1377 1370 1378 1371 stars[i].measure.photFlags = ps1data[i].flags; 1372 stars[i].measure.photFlags2 = ps1data[i].flags2; 1379 1373 1380 1374 // this is may optionally be replaced by the internal sequence (see FilterStars.c) … … 1451 1445 stars[i].measure.psfNdof = ps1data[i].psfNdof; 1452 1446 stars[i].measure.psfNpix = ps1data[i].psfNpix; 1453 stars[i].measure.crNsigma = ps1data[i].crNsigma;1454 1447 stars[i].measure.extNsigma = ps1data[i].extNsigma; 1455 1448 … … 1463 1456 1464 1457 stars[i].measure.photFlags = ps1data[i].flags; 1458 stars[i].measure.photFlags2 = ps1data[i].flags2; 1465 1459 1466 1460 // this is may optionally be replaced by the internal sequence (see FilterStars.c) -
trunk/Ohana/src/addstar/src/mkcmf.c
r37036 r37246 31 31 static Coords coords; 32 32 33 static char reserved[] = "Reserved space. This line can be used to add a new FITS card."; 34 33 35 int main (int argc, char **argv) { 34 36 … … 305 307 PutCoords (&coords, &header); 306 308 gfits_modify (&header, "EXTNAME", "%s", 1, exthead); 309 310 int i; 311 for (i = 1; i < 32; i++) { 312 gfits_modify_alt (&header, "COMMENT", "%C", i, reserved); 313 } 307 314 308 315 ftable.header = &theader; -
trunk/Ohana/src/dvopsps/include/dvopsps.h
r36188 r37246 9 9 10 10 typedef struct { 11 int imageID; 12 unsigned int ippDetectID; 11 uint64_t objID; 13 12 uint64_t detectID; 14 13 uint64_t ippObjID; 15 uint64_t objID; 16 int photcode; 17 unsigned int flags; 18 float zp; 19 float zpErr; 20 float airMass; 21 float expTime; 14 unsigned int ippDetectID; 15 int imageID; 16 int catID; 22 17 double ra; 23 18 double dec; 24 19 float raErr; 25 20 float decErr; 21 float zp; 22 float telluricExt; 23 float airmass; 24 float expTime; 25 26 float Mpsf; 27 float dMpsf; 28 float Mkron; 29 float dMkron; 30 float Map; 31 float dMap; 32 33 unsigned int flags; 26 34 } Detections; 27 35 … … 78 86 79 87 int insert_detections_mysql_commit PROTO((IOBuffer *buffer, MYSQL *mysql)); 80 int insert_detections_mysql_value PROTO((IOBuffer *buffer, Average *average, Measure *measure));88 // int insert_detections_mysql_value PROTO((IOBuffer *buffer, Average *average, Measure *measure)); 81 89 int insert_detections_mysql_init PROTO((IOBuffer *buffer)); 82 90 83 91 int insert_detections_mysql_array PROTO((MYSQL *mysql, Detections *detections, int Ndetections)); 84 92 int insert_detections_mysql_detvalue PROTO((IOBuffer *buffer, Detections *detection)); 93 int assign_detection_values PROTO((Detections *detection, Measure *measure, Average *average)); 85 94 86 95 int init_detections PROTO(()); -
trunk/Ohana/src/dvopsps/src/DetectionOps.c
r35578 r37246 1 1 # include "dvopsps.h" 2 # define BZERO_INT16 1.0*0x80003 # define BZERO_INT32 1.0*0x800000004 # define BZERO_INT64 1.0*0x80000000000000005 2 6 3 # define GET_COLUMN(OUT,NAME,TYPE) \ … … 49 46 50 47 // need to create and assign to flat-field correction 51 GET_COLUMN(imageID , "imageID", int); 52 GET_COLUMN(ippDetectID , "ippDetectID", int); 48 GET_COLUMN(objID , "objID", int64_t); 53 49 GET_COLUMN(detectID , "detectID", int64_t); 54 50 GET_COLUMN(ippObjID , "ippObjID", int64_t); 55 GET_COLUMN(objID , "objID", int64_t); 56 GET_COLUMN(photcode , "photcode", int); 57 GET_COLUMN(flags , "flags", int); 58 GET_COLUMN(zp , "zp", float); 59 GET_COLUMN(zpErr , "zpErr", float); 60 GET_COLUMN(airMass , "airMass", float); 61 GET_COLUMN(expTime , "expTime", float); 51 GET_COLUMN(ippDetectID , "ippDetectID", int); 52 GET_COLUMN(imageID , "imageID", int); 53 GET_COLUMN(catID , "catID", int); 62 54 GET_COLUMN(ra , "ra", double); // XXX signed vs unsigned? 63 55 GET_COLUMN(dec , "dec", double); 64 56 GET_COLUMN(raErr , "raErr", float); 65 57 GET_COLUMN(decErr , "decErr", float); 58 GET_COLUMN(zp , "zp", float); 59 GET_COLUMN(telluricExt , "telluricExt", float); 60 GET_COLUMN(airmass , "airmass", float); 61 GET_COLUMN(expTime , "expTime", float); 62 GET_COLUMN(Mpsf , "Mpsf", float); 63 GET_COLUMN(dMpsf , "dMpsf", float); 64 GET_COLUMN(Mkron , "Mkron", float); 65 GET_COLUMN(dMkron , "dMkron", float); 66 GET_COLUMN(Map , "Map", float); 67 GET_COLUMN(dMap , "dMap", float); 68 GET_COLUMN(flags , "flags", int); 66 69 gfits_free_header (&theader); 67 70 gfits_free_table (&ftable); … … 69 72 ALLOCATE (detections, Detections, Nrow); 70 73 for (i = 0; i < Nrow; i++) { 71 detections[i].imageID = imageID[i]; 72 detections[i].ippDetectID = ippDetectID[i]; 74 detections[i].objID = objID[i]; 73 75 detections[i].detectID = detectID[i]; 74 76 detections[i].ippObjID = ippObjID[i]; 75 detections[i].objID = objID[i]; 76 detections[i].photcode = photcode[i]; 77 detections[i].flags = flags[i]; 78 detections[i].zp = zp[i]; 79 detections[i].zpErr = zpErr[i]; 80 detections[i].airMass = airMass[i]; 81 detections[i].expTime = expTime[i]; 77 detections[i].ippDetectID = ippDetectID[i]; 78 detections[i].imageID = imageID[i]; 79 detections[i].catID = catID[i]; 82 80 detections[i].ra = ra[i]; 83 81 detections[i].dec = dec[i]; 84 82 detections[i].raErr = raErr[i]; 85 83 detections[i].decErr = decErr[i]; 84 detections[i].zp = zp[i]; 85 detections[i].telluricExt = telluricExt[i]; 86 detections[i].airmass = airmass[i]; 87 detections[i].expTime = expTime[i]; 88 detections[i].Mpsf = Mpsf[i]; 89 detections[i].dMpsf = dMpsf[i]; 90 detections[i].Mkron = Mkron[i]; 91 detections[i].dMkron = dMkron[i]; 92 detections[i].Map = Map[i]; 93 detections[i].dMap = dMap[i]; 94 detections[i].flags = flags[i]; 86 95 } 87 96 fprintf (stderr, "loaded data for %lld detections\n", (long long) Nrow); 88 97 89 free (imageID ); 90 free (ippDetectID); 98 free (objID ); 91 99 free (detectID ); 92 100 free (ippObjID ); 93 free (objID ); 94 free (photcode ); 95 free (flags ); 96 free (zp ); 97 free (zpErr ); 98 free (airMass ); 99 free (expTime ); 101 free (ippDetectID); 102 free (imageID ); 103 free (catID ); 100 104 free (ra ); 101 105 free (dec ); 102 106 free (raErr ); 103 107 free (decErr ); 108 free (zp ); 109 free (telluricExt); 110 free (airmass ); 111 free (expTime ); 112 free (Mpsf ); 113 free (dMpsf ); 114 free (Mkron ); 115 free (dMkron ); 116 free (Map ); 117 free (dMap ); 118 free (flags ); 104 119 105 120 gfits_free_header (&header); … … 149 164 150 165 // XXX need to get the bzero values right 151 gfits_define_bintable_column (&theader, "J", "imageID", NULL, NULL, 1.0, BZERO_INT32); 152 gfits_define_bintable_column (&theader, "J", "ippDetectID", NULL, NULL, 1.0, BZERO_INT32); 166 gfits_define_bintable_column (&theader, "K", "objID", NULL, NULL, 1.0, 0); 153 167 gfits_define_bintable_column (&theader, "K", "detectID", NULL, NULL, 1.0, 0); 154 168 gfits_define_bintable_column (&theader, "K", "ippObjID", NULL, NULL, 1.0, 0); 155 gfits_define_bintable_column (&theader, "K", "objID", NULL, NULL, 1.0, 0); 156 // gfits_define_bintable_column (&theader, "K", "detectID", NULL, NULL, 1.0, BZERO_INT64); 157 // gfits_define_bintable_column (&theader, "K", "ippObjID", NULL, NULL, 1.0, BZERO_INT64); 158 // gfits_define_bintable_column (&theader, "K", "objID", NULL, NULL, 1.0, BZERO_INT64); 159 gfits_define_bintable_column (&theader, "J", "photcode", NULL, NULL, 1.0, 0.0); 160 gfits_define_bintable_column (&theader, "J", "flags", NULL, NULL, 1.0, BZERO_INT32); 161 gfits_define_bintable_column (&theader, "E", "zp", NULL, NULL, 1.0, 0.0); 162 gfits_define_bintable_column (&theader, "E", "zpErr", NULL, NULL, 1.0, 0.0); 163 gfits_define_bintable_column (&theader, "E", "airMass", NULL, NULL, 1.0, 0.0); 164 gfits_define_bintable_column (&theader, "E", "expTime", NULL, NULL, 1.0, 0.0); 169 gfits_define_bintable_column (&theader, "J", "ippDetectID", NULL, NULL, 1.0, FT_BZERO_INT32); 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); 165 172 gfits_define_bintable_column (&theader, "D", "ra", NULL, NULL, 1.0, 0.0); 166 173 gfits_define_bintable_column (&theader, "D", "dec", NULL, NULL, 1.0, 0.0); 167 174 gfits_define_bintable_column (&theader, "E", "raErr", NULL, NULL, 1.0, 0.0); 168 175 gfits_define_bintable_column (&theader, "E", "decErr", NULL, NULL, 1.0, 0.0); 176 gfits_define_bintable_column (&theader, "E", "zp", NULL, NULL, 1.0, 0.0); 177 gfits_define_bintable_column (&theader, "E", "telluricExt", NULL, NULL, 1.0, 0.0); 178 gfits_define_bintable_column (&theader, "E", "airmass", NULL, NULL, 1.0, 0.0); 179 gfits_define_bintable_column (&theader, "E", "expTime", NULL, NULL, 1.0, 0.0); 180 gfits_define_bintable_column (&theader, "E", "Mpsf", NULL, NULL, 1.0, 0.0); 181 gfits_define_bintable_column (&theader, "E", "dMpsf", NULL, NULL, 1.0, 0.0); 182 gfits_define_bintable_column (&theader, "E", "Mkron", NULL, NULL, 1.0, 0.0); 183 gfits_define_bintable_column (&theader, "E", "dMkron", NULL, NULL, 1.0, 0.0); 184 gfits_define_bintable_column (&theader, "E", "Map", NULL, NULL, 1.0, 0.0); 185 gfits_define_bintable_column (&theader, "E", "dMap", NULL, NULL, 1.0, 0.0); 186 gfits_define_bintable_column (&theader, "J", "flags", NULL, NULL, 1.0, FT_BZERO_INT32); 169 187 170 188 // generate the output array that carries the data … … 172 190 173 191 // create intermediate storage arrays 174 int32_t *imageID ; ALLOCATE (imageID , int32_t, Ndetections); 175 uint32_t *ippDetectID ; ALLOCATE (ippDetectID , uint32_t, Ndetections); 192 uint64_t *objID ; ALLOCATE (objID , uint64_t, Ndetections); 176 193 uint64_t *detectID ; ALLOCATE (detectID , uint64_t, Ndetections); 177 194 uint64_t *ippObjID ; ALLOCATE (ippObjID , uint64_t, Ndetections); 178 uint64_t *objID ; ALLOCATE (objID , uint64_t, Ndetections); 179 int *photcode ; ALLOCATE (photcode , int, Ndetections); 180 uint32_t *flags ; ALLOCATE (flags , uint32_t, Ndetections); 181 float *zp ; ALLOCATE (zp , float, Ndetections); 182 float *zpErr ; ALLOCATE (zpErr , float, Ndetections); 183 float *airMass ; ALLOCATE (airMass , float, Ndetections); 184 float *expTime ; ALLOCATE (expTime , float, Ndetections); 195 uint32_t *ippDetectID ; ALLOCATE (ippDetectID , uint32_t, Ndetections); 196 int32_t *imageID ; ALLOCATE (imageID , int32_t, Ndetections); 197 int32_t *catID ; ALLOCATE (catID , int32_t, Ndetections); 185 198 double *ra ; ALLOCATE (ra , double, Ndetections); 186 199 double *dec ; ALLOCATE (dec , double, Ndetections); 187 200 float *raErr ; ALLOCATE (raErr , float, Ndetections); 188 201 float *decErr ; ALLOCATE (decErr , float, Ndetections); 202 float *zp ; ALLOCATE (zp , float, Ndetections); 203 float *telluricExt ; ALLOCATE (telluricExt , float, Ndetections); 204 float *airmass ; ALLOCATE (airmass , float, Ndetections); 205 float *expTime ; ALLOCATE (expTime , float, Ndetections); 206 float *Mpsf ; ALLOCATE (Mpsf , float, Ndetections); 207 float *dMpsf ; ALLOCATE (dMpsf , float, Ndetections); 208 float *Mkron ; ALLOCATE (Mkron , float, Ndetections); 209 float *dMkron ; ALLOCATE (dMkron , float, Ndetections); 210 float *Map ; ALLOCATE (Map , float, Ndetections); 211 float *dMap ; ALLOCATE (dMap , float, Ndetections); 212 uint32_t *flags ; ALLOCATE (flags , uint32_t, Ndetections); 189 213 190 214 // assign the storage arrays 191 215 for (i = 0; i < Ndetections; i++) { 192 imageID[i] = detections[i].imageID ; 193 ippDetectID[i] = detections[i].ippDetectID ; 216 objID[i] = detections[i].objID ; 194 217 detectID[i] = detections[i].detectID ; 195 218 ippObjID[i] = detections[i].ippObjID ; 196 objID[i] = detections[i].objID ; 197 photcode[i] = detections[i].photcode ; 198 flags[i] = detections[i].flags ; 199 zp[i] = detections[i].zp ; 200 zpErr[i] = detections[i].zpErr ; 201 airMass[i] = detections[i].airMass ; 202 expTime[i] = detections[i].expTime ; 219 ippDetectID[i] = detections[i].ippDetectID ; 220 imageID[i] = detections[i].imageID ; 221 catID[i] = detections[i].catID ; 203 222 ra[i] = detections[i].ra ; 204 223 dec[i] = detections[i].dec ; 205 224 raErr[i] = detections[i].raErr ; 206 225 decErr[i] = detections[i].decErr ; 226 zp[i] = detections[i].zp ; 227 telluricExt[i] = detections[i].telluricExt ; 228 airmass[i] = detections[i].airmass ; 229 expTime[i] = detections[i].expTime ; 230 Mpsf[i] = detections[i].Mpsf ; 231 dMpsf[i] = detections[i].dMpsf ; 232 Mkron[i] = detections[i].Mkron ; 233 dMkron[i] = detections[i].dMkron ; 234 Map[i] = detections[i].Map ; 235 dMap[i] = detections[i].dMap ; 236 flags[i] = detections[i].flags ; 207 237 } 208 238 209 239 // add the columns to the output array 210 gfits_set_bintable_column (&theader, &ftable, "imageID", imageID , Ndetections); 211 gfits_set_bintable_column (&theader, &ftable, "ippDetectID", ippDetectID , Ndetections); 240 gfits_set_bintable_column (&theader, &ftable, "objID", objID , Ndetections); 212 241 gfits_set_bintable_column (&theader, &ftable, "detectID", detectID , Ndetections); 213 242 gfits_set_bintable_column (&theader, &ftable, "ippObjID", ippObjID , Ndetections); 214 gfits_set_bintable_column (&theader, &ftable, "objID", objID , Ndetections); 215 gfits_set_bintable_column (&theader, &ftable, "photcode", photcode , Ndetections); 216 gfits_set_bintable_column (&theader, &ftable, "flags", flags , Ndetections); 217 gfits_set_bintable_column (&theader, &ftable, "zp", zp , Ndetections); 218 gfits_set_bintable_column (&theader, &ftable, "zpErr", zpErr , Ndetections); 219 gfits_set_bintable_column (&theader, &ftable, "airMass", airMass , Ndetections); 220 gfits_set_bintable_column (&theader, &ftable, "expTime", expTime , Ndetections); 243 gfits_set_bintable_column (&theader, &ftable, "ippDetectID", ippDetectID , Ndetections); 244 gfits_set_bintable_column (&theader, &ftable, "imageID", imageID , Ndetections); 245 gfits_set_bintable_column (&theader, &ftable, "catID", catID , Ndetections); 221 246 gfits_set_bintable_column (&theader, &ftable, "ra", ra , Ndetections); 222 247 gfits_set_bintable_column (&theader, &ftable, "dec", dec , Ndetections); 223 248 gfits_set_bintable_column (&theader, &ftable, "raErr", raErr , Ndetections); 224 249 gfits_set_bintable_column (&theader, &ftable, "decErr", decErr , Ndetections); 225 226 free (imageID ); 227 free (ippDetectID ); 250 gfits_set_bintable_column (&theader, &ftable, "zp", zp , Ndetections); 251 gfits_set_bintable_column (&theader, &ftable, "telluricExt", telluricExt , Ndetections); 252 gfits_set_bintable_column (&theader, &ftable, "airmass", airmass , Ndetections); 253 gfits_set_bintable_column (&theader, &ftable, "expTime", expTime , Ndetections); 254 gfits_set_bintable_column (&theader, &ftable, "Mpsf", Mpsf , Ndetections); 255 gfits_set_bintable_column (&theader, &ftable, "dMpsf", dMpsf , Ndetections); 256 gfits_set_bintable_column (&theader, &ftable, "Mkron", Mkron , Ndetections); 257 gfits_set_bintable_column (&theader, &ftable, "dMkron", dMkron , Ndetections); 258 gfits_set_bintable_column (&theader, &ftable, "Map", Map , Ndetections); 259 gfits_set_bintable_column (&theader, &ftable, "dMap", dMap , Ndetections); 260 gfits_set_bintable_column (&theader, &ftable, "flags", flags , Ndetections); 261 262 free (objID ); 228 263 free (detectID ); 229 264 free (ippObjID ); 230 free (objID ); 231 free (photcode ); 232 free (flags ); 233 free (zp ); 234 free (zpErr ); 235 free (airMass ); 236 free (expTime ); 265 free (ippDetectID ); 266 free (imageID ); 267 free (catID ); 237 268 free (ra ); 238 269 free (dec ); 239 270 free (raErr ); 240 271 free (decErr ); 272 free (zp ); 273 free (telluricExt ); 274 free (airmass ); 275 free (expTime ); 276 free (Mpsf ); 277 free (dMpsf ); 278 free (Mkron ); 279 free (dMkron ); 280 free (Map ); 281 free (dMap ); 282 free (flags ); 241 283 242 284 gfits_fwrite_Theader (f, &theader); -
trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps.c
r37048 r37246 281 281 } 282 282 283 # define PRINT_FLOAT(BUFFER,FIELD,FORMAT) \284 if (!isfinite(FIELD)) PrintIOBuffer (BUFFER, "NULL, "); \285 else PrintIOBuffer (BUFFER, FORMAT, FIELD);286 287 int insert_detections_mysql_detvalue (IOBuffer *buffer, Detections *detection) {288 289 PrintIOBuffer (buffer, "(%d, ", detection->imageID); // imageID290 PrintIOBuffer (buffer, "%u, ", detection->ippDetectID); // ippDetectID291 PrintIOBuffer (buffer, "%lu, ", detection->detectID); // detectID292 PrintIOBuffer (buffer, "%lu, ", detection->ippObjID); // ippObjID293 PrintIOBuffer (buffer, "%lu, ", detection->objID); // objID294 PrintIOBuffer (buffer, "%u, ", detection->flags); // flags295 PRINT_FLOAT(buffer, detection->zp, "%.6f, ");296 PRINT_FLOAT(buffer, detection->zpErr, "%.6f, ");297 PRINT_FLOAT(buffer, detection->airMass, "%.6f, ");298 PRINT_FLOAT(buffer, detection->expTime, "%.6f, ");299 PRINT_FLOAT(buffer, detection->ra, "%.8f, ");300 PRINT_FLOAT(buffer, detection->dec, "%.8f, ");301 PRINT_FLOAT(buffer, detection->raErr, "%.6f, ");302 PRINT_FLOAT(buffer, detection->decErr, "%.6f),\n");303 return TRUE;304 } -
trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c
r37048 r37246 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; … … 47 51 if (measure->photcode >= PHOTCODE_END) continue; 48 52 49 PhotCode *code = GetPhotcodebyCode(measure->photcode); 50 51 detections[Ndetections].imageID = measure->imageID; // imageID 52 detections[Ndetections].ippDetectID = measure->detID; // ippDetectID 53 detections[Ndetections].detectID = measure->extID; // detectID 54 detections[Ndetections].ippObjID = ((uint64_t)average->catID * 1000000000) + (uint64_t)average->objID; // ippObjID 55 // NOTE: this is better, but the above is the current ippToPsps value 56 // detections[Ndetections]. ((uint64_t)average->catID << 32) + (uint64_t)average->objID; // ippObjID 57 detections[Ndetections].objID = average->extID; // objID 58 detections[Ndetections].photcode = measure->photcode; // photcode 59 detections[Ndetections].flags = measure->dbFlags; // flags 60 detections[Ndetections].zp = code->C * 0.001 + code->K * (measure->airmass - 1) - measure->Mcal; // zp 61 detections[Ndetections].zpErr = measure->dMcal; // zpErr 62 detections[Ndetections].airMass = measure->airmass; 63 detections[Ndetections].expTime = pow(10.0, 0.4 * measure->dt); // expTime 64 detections[Ndetections].ra = measure->R; // ra 65 detections[Ndetections].dec = measure->D; // dec 66 detections[Ndetections].raErr = measure->dXccd * 0.01 * fabs(measure->pltscale); // estimate of raErr 67 detections[Ndetections].decErr = measure->dYccd * 0.01 * fabs(measure->pltscale); // estimate of decErr 68 53 assign_detection_values (&detections[Ndetections], measure, average); 69 54 Ndetections ++; 55 70 56 myAssert (Ndetections <= NDETECTIONS, "programming error"); 71 57 } … … 109 95 110 96 off_t found = 0; 97 98 ZeroPoint = GetZeroPoint(); 111 99 112 100 INITTIME; … … 143 131 144 132 // XXX check return status 145 if (!insert_detections_mysql_value (&buffer, &average[i], &measure[Nmeas])) { 133 Detections detection; 134 assign_detection_values (&detection, &measure[Nmeas], &average[i]); 135 136 if (!insert_detections_mysql_detvalue (&buffer, &detection)) { 146 137 fprintf (stderr, "failure to insert detections in mysql\n"); 147 138 status = FALSE; … … 194 185 } 195 186 196 // PrintIOBuffer (buffer, "INSERT INTO dvoDetectionFull (imageID, ippDetectID, detectID, ippObjID, objID, photcode, flags, zp, zpErr, airMass, expTime, ra, dec_, raErr, decErr) VALUES \n"); 197 PrintIOBuffer (buffer, "INSERT INTO dvoDetectionFull (imageID, ippDetectID, detectID, ippObjID, objID, flags, zp, zpErr, airMass, expTime, ra, dec_, raErr, decErr) VALUES \n"); 198 199 return TRUE; 200 } 201 202 # define PRINT_FLOAT(BUFFER,FIELD,FORMAT) \ 203 if (isinf(FIELD) || isnan(FIELD)) PrintIOBuffer (BUFFER, "NULL, "); \ 204 else PrintIOBuffer (BUFFER, FORMAT, FIELD); 205 206 int insert_detections_mysql_value (IOBuffer *buffer, Average *average, Measure *measure) { 207 208 PhotCode *code = GetPhotcodebyCode(measure->photcode); 209 PrintIOBuffer (buffer, "(%d, ", measure->imageID); // imageID 210 PrintIOBuffer (buffer, "%u, ", measure->detID); // ippDetectID 211 PrintIOBuffer (buffer, "%lu, ", measure->extID); // detectID 212 PrintIOBuffer (buffer, "%lu, ", ((uint64_t)average->catID * 1000000000) + (uint64_t)average->objID); // ippObjID 213 // NOTE: the following is better, but the above is the current ippToPsps value 214 // ((uint64_t)average->catID << 32) + (uint64_t)average->objID, // ippObjID 215 PrintIOBuffer (buffer, "%lu, ", average->extID); // objID 216 // XXX PrintIOBuffer (buffer, "%d, ", measure->photcode); // photcode 217 PrintIOBuffer (buffer, "%u, ", measure->dbFlags); // flags 218 219 float zp = code->C * 0.001 + code->K * (measure->airmass - 1) - measure->Mcal; 220 float exptime = pow(10.0, 0.4 * measure->dt); 221 double ra = measure->R; 222 double dec = measure->D; 223 double dR = measure->dXccd * 0.01 * fabs(measure->pltscale); 224 double dD = measure->dYccd * 0.01 * fabs(measure->pltscale); 225 226 PRINT_FLOAT(buffer, zp, "%.6f, "); 227 PRINT_FLOAT(buffer, measure->dMcal, "%.6f, "); 228 PRINT_FLOAT(buffer, measure->airmass, "%.6f, "); 229 PRINT_FLOAT(buffer, exptime, "%.6f, "); 230 PRINT_FLOAT(buffer, ra, "%.8f, "); 231 PRINT_FLOAT(buffer, dec, "%.8f, "); 232 PRINT_FLOAT(buffer, dR, "%.6f, "); 233 PRINT_FLOAT(buffer, dD, "%.6f),\n"); 234 235 return TRUE; 236 } 237 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"); 190 191 return TRUE; 192 } 193 238 194 int insert_detections_mysql_commit (IOBuffer *buffer, MYSQL *mysql) { 239 195 … … 270 226 return status; 271 227 } 228 229 # define PRINT_FLOAT(BUFFER,FIELD,FORMAT) \ 230 if (!isfinite(FIELD)) PrintIOBuffer (BUFFER, "NULL, "); \ 231 else PrintIOBuffer (BUFFER, FORMAT, FIELD); 232 233 int insert_detections_mysql_detvalue (IOBuffer *buffer, Detections *detection) { 234 235 PrintIOBuffer (buffer, "(%lu, ", detection->objID); // objID 236 PrintIOBuffer (buffer, "%lu, ", detection->detectID); // detectID 237 PrintIOBuffer (buffer, "%lu, ", detection->ippObjID); // ippObjID 238 PrintIOBuffer (buffer, "%u, ", detection->ippDetectID); // ippDetectID 239 PrintIOBuffer (buffer, "%d, ", detection->imageID); // imageID 240 PrintIOBuffer (buffer, "%d, ", detection->catID); // DVO Catalog ID 241 242 PRINT_FLOAT(buffer, detection->ra, "%.8f, "); 243 PRINT_FLOAT(buffer, detection->dec, "%.8f, "); 244 PRINT_FLOAT(buffer, detection->raErr, "%.6f, "); 245 PRINT_FLOAT(buffer, detection->decErr, "%.6f, "); 246 PRINT_FLOAT(buffer, detection->zp, "%.6f, "); 247 PRINT_FLOAT(buffer, detection->telluricExt, "%.6f, "); 248 PRINT_FLOAT(buffer, detection->airmass, "%.6f, "); 249 PRINT_FLOAT(buffer, detection->expTime, "%.6f, "); 250 251 PRINT_FLOAT(buffer, detection->Mpsf, "%.6f, "); 252 PRINT_FLOAT(buffer, detection->dMpsf, "%.6f, "); 253 PRINT_FLOAT(buffer, detection->Mkron, "%.6f, "); 254 PRINT_FLOAT(buffer, detection->dMkron, "%.6f, "); 255 PRINT_FLOAT(buffer, detection->Map, "%.6f, "); 256 PRINT_FLOAT(buffer, detection->dMap, "%.6f, "); 257 258 PrintIOBuffer (buffer, "%u),\n", detection->flags); // flags 259 return TRUE; 260 } 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 293 int assign_detection_values (Detections *detection, Measure *measure, Average *average) { 294 295 PhotCode *code = GetPhotcodebyCode(measure->photcode); 296 297 uint64_t ippObjID = ((uint64_t)average->catID << 32) + (uint64_t)average->objID; // ippObjID 298 299 float nominalZP = code->C * 0.001 + code->K * (measure->airmass - 1); 300 float zp = nominalZP - measure->Mcal; 301 float telluricExt = - measure->Mcal; 302 float expTime = pow(10.0, 0.4 * measure->dt); 303 float airmass = measure->airmass; 304 305 detection->objID = average->extID; // objID 306 detection->detectID = measure->extID; // detectID 307 detection->ippObjID = ippObjID; // ippObjID 308 detection->ippDetectID = measure->detID; // ippDetectID 309 detection->imageID = measure->imageID; // imageID 310 detection->catID = measure->catID; // catID 311 312 detection->ra = measure->R; // ra 313 detection->dec = measure->D; // dec 314 detection->raErr = measure->dXccd * 0.01 * fabs(measure->pltscale); // estimate of raErr 315 detection->decErr = measure->dYccd * 0.01 * fabs(measure->pltscale); // estimate of decErr 316 317 detection->zp = zp; 318 detection->telluricExt = telluricExt; 319 detection->airmass = airmass; 320 detection->expTime = expTime; 321 322 // XXX clean this up with dvo_photcode_ops calls: 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); 331 332 detection->flags = measure->dbFlags; // flags 333 334 return TRUE; 335 } 336 -
trunk/Ohana/src/dvopsps/src/insert_objects_dvopsps_catalog.c
r37116 r37246 88 88 bzero (buffer.buffer, buffer.Nalloc); 89 89 90 // Only send the necessary fields (eg, do not sent parallax and pm) 90 91 PrintIOBuffer (&buffer, "CREATE TABLE %s_cpt (" 91 "RA DOUBLE, " 92 "DEC_ DOUBLE, " 93 "RA_ERR FLOAT, " 94 "DEC_ERR FLOAT, " 95 "U_RA FLOAT, " 96 "U_DEC FLOAT, " 97 "V_RA_ERR FLOAT, " 98 "V_DEC_ERR FLOAT, " 99 "PAR FLOAT, " 100 "PAR_ERR FLOAT, " 101 "CHISQ_POS FLOAT, " 102 "CHISQ_PM FLOAT, " 103 "CHISQ_PAP FLOAT, " 104 "MEAN_EPOCH INT, " 105 "TIME_RANGE INT, " 106 "PSF_QF FLOAT, " 107 "PSF_QF_PERF FLOAT, " 108 "STARGAL_SEP FLOAT, " 109 "NUMBER_POS SMALLINT, " 110 "NMEASURE SMALLINT, " 111 "NMISSING SMALLINT, " 112 "NEXTEND SMALLINT, " 113 "OFF_MEASURE INT, " 114 "OFF_MISSING INT, " 115 "OFF_EXTEND INT, " 116 "FLAGS INT, " 117 "PHOTFLAGS_U INT, " 118 "PHOTFLAGS_L INT, " 119 "OBJ_ID INT, " 120 "CAT_ID INT, " 121 "EXT_ID BIGINT" 92 "EXT_ID BIGINT, " 93 "OBJ_ID INT, " 94 "CAT_ID INT, " 95 "TESS_ID TINYINT, " 96 "PROJECTION_ID SMALLINT, " 97 "SKYCELL_ID TINYINT, " 98 "RA_STK DOUBLE, " 99 "DEC_STK DOUBLE, " 100 "RA_STK_ERR FLOAT, " 101 "DEC_STK_ERR FLOAT, " 102 "RA_MEAN DOUBLE, " 103 "DEC_MEAN DOUBLE, " 104 "RA_ERR FLOAT, " 105 "DEC_ERR FLOAT, " 106 "CHISQ_POS FLOAT, " 107 "CHISQ_PM FLOAT, " 108 "CHISQ_PAR FLOAT, " 109 "FLAGS INT " 122 110 ")\n", basename); 111 112 // skipping these cpt fields: 113 // "U_RA FLOAT, " 114 // "U_DEC FLOAT, " 115 // "V_RA_ERR FLOAT, " 116 // "V_DEC_ERR FLOAT, " 117 // "PAR FLOAT, " 118 // "PAR_ERR FLOAT, " 119 // "OFF_MEASURE INT, " 120 // "OFF_MISSING INT, " 121 // "OFF_EXTEND INT, " 122 // "PSF_QF FLOAT, " 123 // "PSF_QF_PERF FLOAT, " 124 // "STARGAL_SEP FLOAT, " 125 // "NUMBER_POS SMALLINT, " 126 // "NMEASURE SMALLINT, " 127 // "NMISSING SMALLINT, " 128 // "NEXTEND SMALLINT, " 129 // "PHOTFLAGS_U INT, " 130 // "PHOTFLAGS_L INT, " 131 132 123 133 124 134 if (DEBUG) fprintf (stderr, "%s\n", buffer.buffer); … … 145 155 146 156 PrintIOBuffer (&buffer, "CREATE TABLE %s_cps (" 147 "MAG FLOAT, "148 "MAG_ AP FLOAT, "149 "MAG_ KRON FLOAT, "150 "MAG_ KRON_ERR FLOAT, "151 "MAG_ ERRFLOAT, "152 " MAG_CHI FLOAT, "153 " STACK_PSF_MAGFLOAT, "154 " STACK_PSF_MAG_ERRFLOAT, "155 " STACK_KRON_MAG FLOAT, "156 " STACK_KRON_MAG_ERR FLOAT, "157 " FLAGS INT, "158 " NCODE SMALLINT, "159 " NUSED SMALLINT, "160 " MAG_20 SMALLINT, "161 " MAG_80 SMALLINT, "162 " UBERCAL_DIST SMALLINT, "163 " MAG_STDEV SMALLINT, "164 " STACK_DETECT_ID BIGINT"157 "MAG FLOAT, " 158 "MAG_ERR FLOAT, " 159 "MAG_STDEV FLOAT, " 160 "MAG_MIN FLOAT, " 161 "MAG_MAX FLOAT, " 162 "NUSED SMALLINT, " 163 "MAG_KRON FLOAT, " 164 "MAG_KRON_ERR FLOAT, " 165 "MAG_KRON_STDEV FLOAT, " 166 "NUSED_KRON SMALLINT, " 167 "MAG_AP FLOAT, " 168 "MAG_AP_ERR FLOAT, " 169 "MAG_AP_STDEV FLOAT, " 170 "NUSED_AP SMALLINT, " 171 "NCODE SMALLINT, " 172 "NSTACK_DET SMALLINT, " 173 "PSF_QF_PERF_MAX FLOAT, " 174 "FLAGS INT " 165 175 ")\n", basename); 166 167 // "FLUX_PSF FLOAT, "168 // "FLUX_PSF_ERR FLOAT, "169 // "FLUX_KRON FLOAT, "170 // "FLUX_KRON_ERR FLOAT, "171 176 172 177 if (DEBUG) fprintf (stderr, "%s\n", buffer.buffer); … … 191 196 192 197 PrintIOBuffer (ave_buffer, "INSERT INTO %s_cpt (" 193 "RA, " 194 "DEC_, " 195 "RA_ERR, " 196 "DEC_ERR, " 197 "U_RA, " 198 "U_DEC, " 199 "V_RA_ERR, " 200 "V_DEC_ERR, " 201 "PAR, " 202 "PAR_ERR, " 203 "CHISQ_POS, " 204 "CHISQ_PM, " 205 "CHISQ_PAP, " 206 "MEAN_EPOCH, " 207 "TIME_RANGE, " 208 "PSF_QF, " 209 "PSF_QF_PERF, " 210 "STARGAL_SEP, " 211 "NUMBER_POS, " 212 "NMEASURE, " 213 "NMISSING, " 214 "NEXTEND, " 215 "OFF_MEASURE, " 216 "OFF_MISSING, " 217 "OFF_EXTEND, " 218 "FLAGS, " 219 "PHOTFLAGS_U, " 220 "PHOTFLAGS_L, " 221 "OBJ_ID, " 222 "CAT_ID, " 223 "EXT_ID" 198 "EXT_ID, " 199 "OBJ_ID, " 200 "CAT_ID, " 201 "TESS_ID, " 202 "PROJECTION_ID, " 203 "SKYCELL_ID, " 204 "RA_STK, " 205 "DEC_STK, " 206 "RA_STK_ERR, " 207 "DEC_STK_ERR, " 208 "RA_MEAN, " 209 "DEC_MEAN, " 210 "RA_ERR, " 211 "DEC_ERR, " 212 "CHISQ_POS, " 213 "CHISQ_PM, " 214 "CHISQ_PAR, " 215 "FLAGS " 224 216 ") VALUES \n", basename); 225 217 … … 230 222 PrintIOBuffer (sec_buffer, "INSERT INTO %s_cps (" 231 223 "MAG, " 232 "MAG_AP, " 224 "MAG_ERR, " 225 "MAG_STDEV, " 226 "MAG_MIN, " 227 "MAG_MAX, " 228 "NUSED, " 229 233 230 "MAG_KRON, " 234 231 "MAG_KRON_ERR, " 235 "MAG_ERR, " 236 "MAG_CHI, " 237 "STACK_PSF_MAG, " 238 "STACK_PSF_MAG_ERR, " 239 "STACK_KRON_MAG, " 240 "STACK_KRON_MAG_ERR, " 241 "FLAGS, " 232 "MAG_KRON_STDEV, " 233 "NUSED_KRON, " 234 235 "MAG_AP, " 236 "MAG_AP_ERR, " 237 "MAG_AP_STDEV, " 238 "NUSED_AP, " 239 242 240 "NCODE, " 243 "NUSED, " 244 "MAG_20, " 245 "MAG_80, " 246 "UBERCAL_DIST, " 247 "MAG_STDEV, " 248 "STACK_DETECT_ID " 241 "NSTACK_DET, " 242 "PSF_QF_PERF_MAX, " 243 "FLAGS " 249 244 ") VALUES \n", basename); 250 245 return TRUE; … … 261 256 // XXX this bit could/should be autocoded... 262 257 PrintIOBuffer (ave_buffer, " ("); 258 PrintIOBuffer (ave_buffer, "%lu, ", average->extID); 259 PrintIOBuffer (ave_buffer, "%u, ", average->objID); 260 PrintIOBuffer (ave_buffer, "%u, ", average->catID); 261 262 PrintIOBuffer (ave_buffer, "%hhd, ", average->tessID); 263 PrintIOBuffer (ave_buffer, "%hd, ", average->projectionID); 264 PrintIOBuffer (ave_buffer, "%hhd, ", average->skycellID); 265 266 PRINT_FLOAT(ave_buffer, average->Rstk, "%.8f, "); // 0.036 mas precision 267 PRINT_FLOAT(ave_buffer, average->Dstk, "%.8f, "); // 0.036 mas precision 268 PRINT_FLOAT(ave_buffer, average->dRstk, "%.5f, "); // 0.010 mas precision 269 PRINT_FLOAT(ave_buffer, average->dDstk, "%.5f, "); // 0.010 mas precision 270 263 271 PRINT_FLOAT(ave_buffer, average->R, "%.8f, "); // 0.036 mas precision 264 272 PRINT_FLOAT(ave_buffer, average->D, "%.8f, "); // 0.036 mas precision 265 273 PRINT_FLOAT(ave_buffer, average->dR, "%.5f, "); // 0.010 mas precision 266 274 PRINT_FLOAT(ave_buffer, average->dD, "%.5f, "); // 0.010 mas precision 267 PRINT_FLOAT(ave_buffer, average->uR, "%.5f, "); // 0.010 mas/yr precision 268 PRINT_FLOAT(ave_buffer, average->uD, "%.5f, "); 269 PRINT_FLOAT(ave_buffer, average->duR, "%.5f, "); 270 PRINT_FLOAT(ave_buffer, average->duD, "%.5f, "); 271 PRINT_FLOAT(ave_buffer, average->P, "%.5f, "); 272 PRINT_FLOAT(ave_buffer, average->dP, "%.5f, "); 275 273 276 PRINT_FLOAT(ave_buffer, average->ChiSqAve, "%.4f, "); 274 277 PRINT_FLOAT(ave_buffer, average->ChiSqPM, "%.4f, "); 275 278 PRINT_FLOAT(ave_buffer, average->ChiSqPar, "%.4f, "); 276 PrintIOBuffer (ave_buffer, "%d, ", average->Tmean); 277 PrintIOBuffer (ave_buffer, "%d, ", average->Trange); 278 PRINT_FLOAT(ave_buffer, average->psfQF, "%.3f, "); 279 PRINT_FLOAT(ave_buffer, average->psfQFperf, "%.3f, "); 280 PRINT_FLOAT(ave_buffer, average->stargal, "%.3f, "); 281 PrintIOBuffer (ave_buffer, "%hu, ", average->Npos); 282 PrintIOBuffer (ave_buffer, "%hu, ", average->Nmeasure); 283 PrintIOBuffer (ave_buffer, "%hu, ", average->Nmissing); 284 PrintIOBuffer (ave_buffer, "%hu, ", average->Nextend); 285 PrintIOBuffer (ave_buffer, "%d, ", average->measureOffset); 286 PrintIOBuffer (ave_buffer, "%d, ", average->missingOffset); 287 PrintIOBuffer (ave_buffer, "%d, ", 0); // was : average->extendOffset); 288 PrintIOBuffer (ave_buffer, "%u, ", average->flags); 289 PrintIOBuffer (ave_buffer, "%u, ", average->photFlagsUpper); 290 PrintIOBuffer (ave_buffer, "%u, ", average->photFlagsLower); 291 PrintIOBuffer (ave_buffer, "%u, ", average->objID); 292 PrintIOBuffer (ave_buffer, "%u, ", average->catID); 293 PrintIOBuffer (ave_buffer, "%lu", average->extID); 279 280 PrintIOBuffer (ave_buffer, "%u ", average->flags); 281 294 282 PrintIOBuffer (ave_buffer, "),\n"); 295 283 284 // XXX what rules for keeping or NAN-ing various mags? 296 285 for (i = 0; i < Nsecfilt; i++) { 297 286 float meanPSFMag = -999.0; 298 287 float meanPSFMagErr = -999.0; 288 float meanPSFMagStd = -999.0; 289 float meanPSFMagMin = -999.0; 290 float meanPSFMagMax = -999.0; 299 291 if (isfinite(secfilt->dM) && isfinite(secfilt->M)) { 300 meanPSFMag = secfilt->M;292 meanPSFMag = secfilt->M; 301 293 meanPSFMagErr = secfilt->dM; 294 meanPSFMagStd = secfilt->Mstdev; 295 meanPSFMagMin = secfilt->Mmin; 296 meanPSFMagMax = secfilt->Mmax; 302 297 } 303 298 304 299 float meanKronMag = -999.0; 305 300 float meanKronMagErr = -999.0; 301 float meanKronMagStd = -999.0; 306 302 if (isfinite(secfilt->dMkron) && isfinite(secfilt->Mkron) && (secfilt->dMkron < 0.333)) { 307 meanKronMag = secfilt->Mkron;303 meanKronMag = secfilt->Mkron; 308 304 meanKronMagErr = secfilt->dMkron; 305 meanKronMagStd = secfilt->sMkron; 309 306 } 310 307 311 308 float meanApMag = -999.0; 312 if (isfinite(secfilt->Map)) { 313 meanApMag = secfilt->Map; 314 } 315 316 float stackPSFMag = -999.0; 317 float stackPSFMagErr = -999.0; 318 if (isfinite(secfilt->dFpsfStk) && isfinite(secfilt->FpsfStk) && (secfilt->dFpsfStk > 0.0)) { 319 float SN = secfilt->FpsfStk / secfilt->dFpsfStk; 320 if (SN > 3.0) { 321 stackPSFMag = -2.5 * log10(secfilt->FpsfStk) + 8.9; 322 stackPSFMagErr = secfilt->dFpsfStk / secfilt->FpsfStk; 323 } 324 } 325 326 float stackKronMag = -999.0; 327 float stackKronMagErr = -999.0; 328 if (isfinite(secfilt->dFkronStk) && isfinite(secfilt->FkronStk) && (secfilt->dFkronStk > 0.0)) { 329 float SN = secfilt->FkronStk / secfilt->dFkronStk; 330 if (SN > 3.0) { 331 stackKronMag = -2.5 * log10(secfilt->FkronStk) + 8.9; 332 stackKronMagErr = secfilt->dFkronStk / secfilt->FkronStk; 333 } 309 float meanApMagErr = -999.0; 310 float meanApMagStd = -999.0; 311 if (isfinite(secfilt->dMap) && isfinite(secfilt->Map)) { 312 meanApMag = secfilt->Map; 313 meanApMagErr = secfilt->dMap; 314 meanApMagStd = secfilt->sMap; 334 315 } 335 316 336 317 PrintIOBuffer (sec_buffer, " ("); 337 318 PRINT_FLOAT(sec_buffer, meanPSFMag, "%.6f, "); // umag precision 338 PRINT_FLOAT(sec_buffer, meanApMag, "%.6f, "); // umag precision 319 PRINT_FLOAT(sec_buffer, meanPSFMagErr, "%.6f, "); // umag precision 320 PRINT_FLOAT(sec_buffer, meanPSFMagStd, "%.6f, "); // umag precision 321 PRINT_FLOAT(sec_buffer, meanPSFMagMin, "%.6f, "); // umag precision 322 PRINT_FLOAT(sec_buffer, meanPSFMagMax, "%.6f, "); // umag precision 323 PrintIOBuffer (sec_buffer, "%hd, ", secfilt->Nused); 324 339 325 PRINT_FLOAT(sec_buffer, meanKronMag, "%.6f, "); // umag precision 340 326 PRINT_FLOAT(sec_buffer, meanKronMagErr, "%.6f, "); // umag precision 341 PRINT_FLOAT(sec_buffer, mean PSFMagErr,"%.6f, "); // umag precision342 P RINT_FLOAT(sec_buffer, secfilt->Mchisq, "%.6f, ");343 PRINT_FLOAT(sec_buffer, stackPSFMag, "%.6f, "); // umag precision 344 PRINT_FLOAT(sec_buffer, stackPSFMagErr,"%.6f, "); // umag precision345 PRINT_FLOAT(sec_buffer, stackKronMag,"%.6f, "); // umag precision346 PRINT_FLOAT(sec_buffer, stackKronMagErr, "%.6f, "); // 0.36umag precision347 PrintIOBuffer (sec_buffer, "% u, ", secfilt->flags);327 PRINT_FLOAT(sec_buffer, meanKronMagStd, "%.6f, "); // umag precision 328 PrintIOBuffer (sec_buffer, "%hd, ", secfilt->NusedKron); 329 330 PRINT_FLOAT(sec_buffer, meanApMag, "%.6f, "); // umag precision 331 PRINT_FLOAT(sec_buffer, meanApMagErr, "%.6f, "); // umag precision 332 PRINT_FLOAT(sec_buffer, meanApMagStd, "%.6f, "); // umag precision 333 PrintIOBuffer (sec_buffer, "%hd, ", secfilt->NusedAp); 348 334 PrintIOBuffer (sec_buffer, "%hd, ", secfilt->Ncode); 349 PrintIOBuffer (sec_buffer, "%hd, ", secfilt->Nused); 350 PrintIOBuffer (sec_buffer, "%.6f, ", secfilt->Mmin); 351 PrintIOBuffer (sec_buffer, "%.6f, ", secfilt->Mmax); 352 PrintIOBuffer (sec_buffer, "%hd, ", secfilt->ubercalDist); 353 PrintIOBuffer (sec_buffer, "%.6f, ", secfilt->Mstdev); 354 PrintIOBuffer (sec_buffer, "%lu ", 0L); // secfilt->stackDetectID 335 PrintIOBuffer (sec_buffer, "%hd, ", secfilt->NstackDet); 336 337 PRINT_FLOAT(sec_buffer, secfilt->psfQfPerfMax, "%.6f,"); 338 PrintIOBuffer (sec_buffer, "%u ", secfilt->flags); 355 339 PrintIOBuffer (sec_buffer, "),\n"); 356 340 secfilt ++; -
trunk/Ohana/src/getstar
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20140717/Ohana/src/getstar merged: 37243
- Property svn:mergeinfo changed
-
trunk/Ohana/src/libautocode/def/average-ps1-v5.d
r37034 r37246 2 2 EXTNAME DVO_AVERAGE_PS1_V5 3 3 TYPE BINTABLE 4 SIZE 1 844 SIZE 192 5 5 DESCRIPTION DVO Average Object Table 6 6 … … 53 53 FIELD refColorRed, REF_COLOR_RED, float, color of astrometry ref stars 54 54 55 FIELD tessID, TESS_ID, char, ID of tessellation for primary skycell 56 FIELD skycellID, SKYCELL_ID, char, ID of skycell for primary skycell 57 FIELD projectionID, PROJECTION_ID, short, ID of projection for primary skycell 58 59 FIELD dummy, DUMMY, int, unassigned bytes 60 55 61 # 'flags' was called 'code' prior to 2009.02.07 56 62 FIELD flags, FLAGS, uint32_t, average object flags (star; ghost; etc) -
trunk/Ohana/src/libautocode/def/average.d
r37034 r37246 2 2 EXTNAME DVO_AVERAGE 3 3 TYPE BINTABLE 4 SIZE 1 844 SIZE 192 5 5 DESCRIPTION DVO Average Object Table 6 6 … … 53 53 FIELD refColorRed, REF_COLOR_RED, float, color of astrometry ref stars 54 54 55 FIELD tessID, TESS_ID, char, ID of tessellation for primary skycell 56 FIELD skycellID, SKYCELL_ID, char, ID of skycell for primary skycell 57 FIELD projectionID, PROJECTION_ID, short, ID of projection for primary skycell 58 59 FIELD dummy, DUMMY, int, unassigned bytes 60 55 61 # 'flags' was called 'code' prior to 2009.02.07 56 62 FIELD flags, FLAGS, uint32_t, average object flags (star; ghost; etc) -
trunk/Ohana/src/libautocode/def/measure-ps1-v5.d
r37034 r37246 68 68 FIELD psfNdof, PSF_NDOF, int, psf degrees of freedom 69 69 FIELD psfNpix, PSF_NPIX, int, psf number of pixels 70 FIELD crNsigma, CR_NSIGMA, float, Nsigma deviation towards CR70 FIELD photFlags2, PHOT_FLAGS, int, flags supplied by photometry program 71 71 FIELD extNsigma, EXT_NSIGMA, float, Nsigma deviation towards EXT 72 72 -
trunk/Ohana/src/libautocode/def/measure.d
r37034 r37246 66 66 FIELD psfNdof, PSF_NDOF, int, psf degrees of freedom 67 67 FIELD psfNpix, PSF_NPIX, int, psf number of pixels 68 FIELD crNsigma, CR_NSIGMA, float, Nsigma deviation towards CR68 FIELD photFlags2, PHOT_FLAGS, int, flags supplied by photometry program 69 69 FIELD extNsigma, EXT_NSIGMA, float, Nsigma deviation towards EXT 70 70 -
trunk/Ohana/src/libautocode/def/secfilt-ps1-v5.d
r37116 r37246 2 2 EXTNAME DVO_SECFILT_PS1_V5 3 3 TYPE BINTABLE 4 SIZE 1 604 SIZE 176 5 5 DESCRIPTION DVO SecFilt : Secondary Filter Data 6 6 … … 15 15 FIELD sMkron, MAG_KRON_STDEV, float, standard deviation of kron mags, mags 16 16 17 # XXX I could add these fields to secfilt or calculate in dvopsps? 18 FIELD psfQfMax, PSF_QF_MAX, float, best psfQf for this filter 19 FIELD psfQfPerfMax, PSF_QF_PERF_MAX, float, best psfQfPerfect for this filter 20 17 21 # these statistics are PSF-specific 18 22 FIELD Mstdev, MAG_STDEV, float, standard deviation of measurements, mags … … 42 46 FIELD dFapStk, FLUX_AP_STK_ERR, float, mean flux ap error 43 47 48 FIELD Nstack, NSTACK, short, number of measurements in band (gpc1 stack only) 49 FIELD NstackDet, NSTACK_DET, short, number of stack detections in band (gpc1 stack only) 50 44 51 FIELD stackPrmryOff, STACK_PRIMARY_OFF, int, measure entry which is primary stack detection 45 52 FIELD stackBestOff, STACK_BEST_OFF, int, measure entry which is best stack detection … … 66 73 FIELD NusedApWrp, NUSED_AP_WRP, short, number of detections used in average 67 74 75 FIELD Nwarp, NWARP, short, number of measurements in band (gpc1 warp only) 76 FIELD NwarpGood, NWARP_GOOD, short, number of meas with psf_qf > 0.85 in band (gpc1 warp only) 77 68 78 FIELD ubercalDist, UBERCAL_DIST, short, number of images from an ubercal-image 69 79 -
trunk/Ohana/src/libautocode/def/secfilt.d
r37116 r37246 2 2 EXTNAME DVO_SECFILT 3 3 TYPE BINTABLE 4 SIZE 1 604 SIZE 176 5 5 DESCRIPTION DVO SecFilt : Secondary Filter Data 6 6 … … 15 15 FIELD sMkron, MAG_KRON_STDEV, float, standard deviation of kron mags, mags 16 16 17 # XXX I could add these fields to secfilt or calculate in dvopsps? 18 FIELD psfQfMax, PSF_QF_MAX, float, best psfQf for this filter 19 FIELD psfQfPerfMax, PSF_QF_PERF_MAX, float, best psfQfPerfect for this filter 20 17 21 # these statistics are PSF-specific 18 22 FIELD Mstdev, MAG_STDEV, float, standard deviation of measurements, mags … … 21 25 FIELD Mchisq, MAG_CHI, float, chisq on average mag, value 22 26 23 FIELD Ncode, NCODE, short, number of detections in band 24 FIELD Nused, NUSED, short, number of detections used in average25 FIELD NusedKron, NUSED_KRON, short, number of detections used in average26 FIELD NusedAp, NUSED_AP, short, number of detections used in average27 FIELD Ncode, NCODE, short, number of detections in band (gpc1 chip only) 28 FIELD Nused, NUSED, short, number of detections used to calculate secfilt.M 29 FIELD NusedKron, NUSED_KRON, short, number of detections used to calculate secfilt.Mkron 30 FIELD NusedAp, NUSED_AP, short, number of detections used to calculate secfilt.Map 27 31 28 32 FIELD flags, FLAGS, uint32_t, photometry flags … … 42 46 FIELD dFapStk, FLUX_AP_STK_ERR, float, mean flux ap error 43 47 44 FIELD stackPrmryOff, STACK_PRIMARY_OFF, int, measure entry which is primary stack detection 45 FIELD stackBestOff, STACK_BEST_OFF, int, measure entry which is best stack detection 48 FIELD Nstack, NSTACK, short, number of measurements in band (gpc1 stack only) 49 FIELD NstackDet, NSTACK_DET, short, number of stack detections in band (gpc1 stack only) 50 51 FIELD stackPrmryOff, STACK_PRIMARY_OFF, int, measure entry which is primary stack detection 52 FIELD stackBestOff, STACK_BEST_OFF, int, measure entry which is best stack detection 46 53 47 54 ## *** this section is for forced-warp mean values *** … … 66 73 FIELD NusedApWrp, NUSED_AP_WRP, short, number of detections used in average 67 74 68 FIELD ubercalDist, UBERCAL_DIST, short, number of images from an ubercal-image 75 FIELD Nwarp, NWARP, short, number of measurements in band (gpc1 warp only) 76 FIELD NwarpGood, NWARP_GOOD, short, number of meas with psf_qf > 0.85 in band (gpc1 warp only) 77 78 FIELD ubercalDist, UBERCAL_DIST, short, number of images from an ubercal-image 69 79 70 80 # *** 20090206 : new fields : M_20, M_80; dropped dummy -
trunk/Ohana/src/libdvo/include/dvo.h
r37116 r37246 464 464 } MeasureTiny; 465 465 466 / ** STRUCT DEFINITION **/466 // alternate version of PS1_V4 (old dev version) 467 467 typedef struct { 468 468 double R; // RA (decimal degrees ) … … 500 500 Average *Average_PS1_V4alt_ToInternal (Average_PS1_V4alt *in, off_t Nvalues); 501 501 502 / ** STRUCT DEFINITION **/502 // alternate version of PS1_V4 (old dev version) 503 503 typedef struct { 504 504 float dR; // RA offset (arcsec) … … 556 556 Measure *Measure_PS1_V4alt_ToInternal (Average *ave, Measure_PS1_V4alt *in, off_t Nvalues); 557 557 558 // alternate version of PS1_V5 (old dev version) 559 typedef struct { 560 float M; // average mag in this band (mags) 561 float dM; // formal error on average mag (mags) 562 float Map; // ave aperture mag in this band (mags) 563 float dMap; // ave aperture mag in this band (mags) 564 float sMap; // standard deviation of ap mags (mags) 565 float Mkron; // ave kron mag in this band (mags) 566 float dMkron; // formal error on average kron mag (mags) 567 float sMkron; // standard deviation of kron mags (mags) 568 float Mstdev; // standard deviation of measurements (mags) 569 float Mmin; // min accepted mag (mags) 570 float Mmax; // max accepted mag (mags) 571 float Mchisq; // chisq on average mag (value) 572 short Ncode; // number of detections in band 573 short Nused; // number of detections used in average 574 short NusedKron; // number of detections used in average 575 short NusedAp; // number of detections used in average 576 uint32_t flags; // photometry flags 577 float MpsfStk; // magnitude from stack (primary if available) 578 float FpsfStk; // flux from stack (primary if available) 579 float dFpsfStk; // mean flux psf error 580 float MkronStk; // magnitude from stack (primary if available) 581 float FkronStk; // flux from stack (primary if available) 582 float dFkronStk; // mean flux kron error 583 float MapStk; // magnitude from stack (primary if available) 584 float FapStk; // flux from stack (primary if available) 585 float dFapStk; // mean flux ap error 586 int stackPrmryOff; // measure entry which is primary stack detection 587 int stackBestOff; // measure entry which is best stack detection 588 float MpsfWrp; // psf magnitude from stack (primary if available) 589 float FpsfWrp; // psf flux from stack (primary if available) 590 float dFpsfWrp; // mean flux psf error 591 float sFpsfWrp; // mean flux psf stdev 592 float MkronWrp; // kron magnitude from stack (primary if available) 593 float FkronWrp; // kron flux from stack (primary if available) 594 float dFkronWrp; // mean flux kron error 595 float sFkronWrp; // mean flux kron stdev 596 float MapWrp; // aper magnitude from stack (primary if available) 597 float FapWrp; // aper flux from stack (primary if available) 598 float dFapWrp; // mean flux ap error 599 float sFapWrp; // mean flux ap stdev 600 short NusedWrp; // number of detections used in average 601 short NusedKronWrp; // number of detections used in average 602 short NusedApWrp; // number of detections used in average 603 short ubercalDist; // number of images from an ubercal-image 604 } SecFilt_PS1_V5alt; 605 606 SecFilt_PS1_V5alt *gfits_table_get_SecFilt_PS1_V5alt (FTable *table, off_t *Ndata, char *swapped); 607 int gfits_convert_SecFilt_PS1_V5alt (SecFilt_PS1_V5alt *data, off_t size, off_t nitems); 608 SecFilt *SecFilt_PS1_V5alt_ToInternal (SecFilt_PS1_V5alt *in, off_t Nvalues); 609 610 // alternate version of PS1_V5alt (old dev version) 611 typedef struct { 612 double R; // RA (decimal degrees ) 613 double D; // DEC (decimal degrees ) 614 float dR; // RA error (arcsec) 615 float dD; // DEC error (arcsec) 616 float uR; // RA*cos(D) proper-motion (arcsec/year) 617 float uD; // DEC proper-motion (arcsec/year) 618 float duR; // RA*cos(D) p-m error (arcsec/year) 619 float duD; // DEC p-m error (arcsec/year) 620 float P; // parallax (arcsec) 621 float dP; // parallax error (arcsec) 622 double Rstk; // RA on stack (decimal degrees ) 623 double Dstk; // DEC on stack (decimal degrees ) 624 float dRstk; // RA error on stack (arcsec) 625 float dDstk; // DEC error on stack (arcsec) 626 float ChiSqAve; // astrometry analysis chisq 627 float ChiSqPM; // astrometry analysis chisq 628 float ChiSqPar; // astrometry analysis chisq 629 int Tmean; // mean epoch (PM,PAR ref) (unix time seconds) 630 int Trange; // mean epoch (PM,PAR ref) (unix time seconds) 631 float psfQF; // psf coverage (bad masks) 632 float psfQFperf; // psf coverage (all masks) 633 float stargal; // star / galaxy separator (1/100 arcsec) 634 unsigned short Npos; // number of detections used for astrometry 635 unsigned short Nmeasure; // number of psf measurements 636 unsigned short Nmissing; // number of missings 637 unsigned short Nlensing; // number of lensing measurements 638 unsigned short Nlensobj; // number of lensing measurements 639 unsigned short Nextend; // number of extended measurements 640 int measureOffset; // offset to first psf measurement 641 int missingOffset; // offset to first missing obs 642 int lensingOffset; // offset to first lensing obs 643 int lensobjOffset; // offset to mean lensing data 644 int extendOffset; // offset to extended object entry 645 int paramsOffset; // offset to stellar parameter data 646 float refColorBlue; // color of astrometry ref stars 647 float refColorRed; // color of astrometry ref stars 648 uint32_t flags; // average object flags (star; ghost; etc) 649 uint32_t photFlagsUpper; // upper bit of 2 bit summary of per-measure photflags 650 uint32_t photFlagsLower; // lower bit of 2 bit summary of per-measure photflags 651 unsigned int objID; // unique ID for object in table 652 unsigned int catID; // unique ID for table in which object was first realized 653 uint64_t extID; // external ID for object (eg PSPS objID) 654 uint64_t extIDgc; // external ID for object in galactic coords 655 } Average_PS1_V5alt; 656 657 Average_PS1_V5alt *gfits_table_get_Average_PS1_V5alt (FTable *table, off_t *Ndata, char *swapped); 658 int gfits_convert_Average_PS1_V5alt (Average_PS1_V5alt *data, off_t size, off_t nitems); 659 Average *Average_PS1_V5alt_ToInternal (Average_PS1_V5alt *in, off_t Nvalues); 660 558 661 /* for some reason I have merged the set of tables and the file description, 559 662 so I need to have an internal structure to point to the separate files */ -
trunk/Ohana/src/libdvo/src/dbExtractMeasures.c
r37116 r37246 646 646 case MEAS_PSF_NPIX: /* OK */ 647 647 value.Int = measure[0].psfNpix; 648 break;649 case MEAS_CR_NSIGMA: /* OK */650 value.Flt = measure[0].crNsigma;651 648 break; 652 649 case MEAS_EXT_NSIGMA: /* OK */ -
trunk/Ohana/src/libdvo/src/dvo_catalog.c
r37116 r37246 141 141 average->refColorRed = NAN; 142 142 143 average->tessID = 0; 144 average->skycellID = 0; 145 average->projectionID = 0; 146 average->dummy = 0; 147 143 148 average->flags = 0; 144 149 average->photFlagsUpper = 0; … … 173 178 secfilt->sMkron = NAN; 174 179 180 secfilt->psfQfMax = NAN; 181 secfilt->psfQfPerfMax = NAN; 182 175 183 secfilt->Mstdev = NAN; 176 184 secfilt->Mmin = NAN; … … 197 205 secfilt->dFapStk = NAN; 198 206 207 secfilt->Nstack = 0; 208 secfilt->NstackDet = 0; 209 199 210 secfilt->stackPrmryOff = -1; 200 211 secfilt->stackBestOff = -1; … … 218 229 secfilt->NusedKronWrp = 0; 219 230 secfilt->NusedApWrp = 0; 231 232 secfilt->Nwarp = 0; 233 secfilt->NwarpGood = 0; 220 234 221 235 secfilt->ubercalDist = 1000; … … 279 293 measure->psfNdof = 0; 280 294 measure->psfNpix = 0; 281 measure->crNsigma = NAN;282 295 measure->extNsigma = NAN; 283 296 … … 302 315 measure->dbFlags = 0; 303 316 measure->photFlags = 0; 317 measure->photFlags2= 0; 304 318 } 305 319 -
trunk/Ohana/src/libdvo/src/dvo_convert.c
r37116 r37246 80 80 } 81 81 82 // block to convert old tables (PS1_V5 versions made during development) 83 if (!strcmp (extname, "DVO_AVERAGE_PS1_V5") && (ftable[0].header[0].Naxis[0] == 184)) { 84 Average_PS1_V5alt *tmpAverage; 85 tmpAverage = gfits_table_get_Average_PS1_V5alt (ftable, Naverage, NULL); 86 if (!tmpAverage) { 87 fprintf (stderr, "ERROR: failed to read averages\n"); 88 exit (2); 89 } 90 average = Average_PS1_V5alt_ToInternal (tmpAverage, *Naverage); 91 free (tmpAverage); 92 *format = DVO_FORMAT_PS1_V5; 93 return (average); 94 } 95 82 96 # define CONVERT_FORMAT(NAME, FORMAT, TYPE) \ 83 97 if (!strcmp (extname, NAME)) { \ … … 285 299 return (FALSE); 286 300 } 301 302 // block to convert old tables (PS1_V5 versions made during development) 303 if (!strcmp (extname, "DVO_SECFILT_PS1_V5") && (ftable[0].header[0].Naxis[0] == 160)) { 304 SecFilt_PS1_V5alt *tmpSecFilt; 305 tmpSecFilt = gfits_table_get_SecFilt_PS1_V5alt (ftable, Nsecfilt, NULL); 306 if (!tmpSecFilt) { 307 fprintf (stderr, "ERROR: failed to read secfilts\n"); 308 exit (2); 309 } 310 secfilt = SecFilt_PS1_V5alt_ToInternal (tmpSecFilt, *Nsecfilt); 311 free (tmpSecFilt); 312 *format = DVO_FORMAT_PS1_V5; 313 return (secfilt); 314 } 315 287 316 288 317 # define CONVERT_FORMAT(NAME, FORMAT, TYPE) \ -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c
r37035 r37246 32 32 out[i].psfQF = in[i].psfQF; 33 33 out[i].psfChisq = in[i].psfChisq; 34 out[i].crNsigma = in[i].crNsigma;35 34 out[i].extNsigma = in[i].extNsigma; 36 35 out[i].FWx = in[i].FWx; … … 80 79 out[i].psfQF = in[i].psfQF; 81 80 out[i].psfChisq = in[i].psfChisq; 82 out[i].crNsigma = in[i].crNsigma;83 81 out[i].extNsigma = in[i].extNsigma; 84 82 out[i].FWx = in[i].FWx; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c
r37035 r37246 34 34 out[i].psfQF = in[i].psfQF; 35 35 out[i].psfChisq = in[i].psfChisq; 36 out[i].crNsigma = in[i].crNsigma;37 36 out[i].extNsigma = in[i].extNsigma; 38 37 out[i].FWx = in[i].FWx; … … 80 79 out[i].psfQF = in[i].psfQF; 81 80 out[i].psfChisq = in[i].psfChisq; 82 out[i].crNsigma = in[i].crNsigma;83 81 out[i].extNsigma = in[i].extNsigma; 84 82 out[i].FWx = in[i].FWx; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c
r37035 r37246 40 40 out[i].psfNdof = in[i].psfNdof; 41 41 out[i].psfNpix = in[i].psfNpix; 42 out[i].crNsigma = in[i].crNsigma;43 42 out[i].extNsigma = in[i].extNsigma; 44 43 out[i].FWx = in[i].FWx; … … 95 94 out[i].psfNdof = in[i].psfNdof; 96 95 out[i].psfNpix = in[i].psfNpix; 97 out[i].crNsigma = in[i].crNsigma;98 96 out[i].extNsigma = in[i].extNsigma; 99 97 out[i].FWx = in[i].FWx; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c
r37035 r37246 40 40 out[i].psfNdof = in[i].psfNdof; 41 41 out[i].psfNpix = in[i].psfNpix; 42 out[i].crNsigma = in[i].crNsigma;43 42 out[i].extNsigma = in[i].extNsigma; 44 43 out[i].FWx = in[i].FWx; … … 96 95 out[i].psfNdof = in[i].psfNdof; 97 96 out[i].psfNpix = in[i].psfNpix; 98 out[i].crNsigma = in[i].crNsigma;99 97 out[i].extNsigma = in[i].extNsigma; 100 98 out[i].FWx = in[i].FWx; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V3.c
r37035 r37246 40 40 out[i].psfNdof = in[i].psfNdof; 41 41 out[i].psfNpix = in[i].psfNpix; 42 out[i].crNsigma = in[i].crNsigma;43 42 out[i].extNsigma = in[i].extNsigma; 44 43 out[i].FWx = in[i].FWx; … … 96 95 out[i].psfNdof = in[i].psfNdof; 97 96 out[i].psfNpix = in[i].psfNpix; 98 out[i].crNsigma = in[i].crNsigma;99 97 out[i].extNsigma = in[i].extNsigma; 100 98 out[i].FWx = in[i].FWx; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c
r37116 r37246 49 49 out[i].psfNdof = in[i].psfNdof; 50 50 out[i].psfNpix = in[i].psfNpix; 51 out[i].crNsigma = in[i].crNsigma;52 51 out[i].extNsigma = in[i].extNsigma; 53 52 out[i].FWx = in[i].FWx; … … 114 113 out[i].psfNdof = in[i].psfNdof; 115 114 out[i].psfNpix = in[i].psfNpix; 116 out[i].crNsigma = in[i].crNsigma;117 115 out[i].extNsigma = in[i].extNsigma; 118 116 out[i].FWx = in[i].FWx; … … 541 539 out[i].psfNdof = in[i].psfNdof; 542 540 out[i].psfNpix = in[i].psfNpix; 543 out[i].crNsigma = in[i].crNsigma;544 541 out[i].extNsigma = in[i].extNsigma; 545 542 out[i].FWx = in[i].FWx; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c
r37116 r37246 56 56 out[i].psfNdof = in[i].psfNdof; 57 57 out[i].psfNpix = in[i].psfNpix; 58 out[i].crNsigma = in[i].crNsigma;59 58 out[i].extNsigma = in[i].extNsigma; 60 59 out[i].FWx = in[i].FWx; … … 73 72 out[i].dbFlags = in[i].dbFlags; 74 73 out[i].photFlags = in[i].photFlags; 74 out[i].photFlags2 = in[i].photFlags2; 75 75 } 76 76 return (out); … … 128 128 out[i].psfNdof = in[i].psfNdof; 129 129 out[i].psfNpix = in[i].psfNpix; 130 out[i].crNsigma = in[i].crNsigma;131 130 out[i].extNsigma = in[i].extNsigma; 132 131 out[i].FWx = in[i].FWx; … … 145 144 out[i].dbFlags = in[i].dbFlags; 146 145 out[i].photFlags = in[i].photFlags; 146 out[i].photFlags2 = in[i].photFlags2; 147 147 } 148 148 return (out); … … 203 203 out[i].refColorRed = in[i].refColorRed; 204 204 205 out[i].tessID = in[i].tessID; 206 out[i].skycellID = in[i].skycellID; 207 out[i].projectionID = in[i].projectionID; 208 205 209 out[i].flags = in[i].flags; 206 210 out[i].photFlagsUpper = in[i].photFlagsUpper; … … 223 227 224 228 for (i = 0; i < Nvalues; i++) { 225 out[i].R = in[i].R; 226 out[i].D = in[i].D; 227 out[i].dR = in[i].dR; 228 out[i].dD = in[i].dD; 229 out[i].uR = in[i].uR; 230 out[i].uD = in[i].uD; 231 out[i].duR = in[i].duR; 232 out[i].duD = in[i].duD; 233 out[i].P = in[i].P; 234 out[i].dP = in[i].dP; 235 236 out[i].Rstk = in[i].Rstk; 237 out[i].Dstk = in[i].Dstk; 238 out[i].dRstk = in[i].dRstk; 239 out[i].dDstk = in[i].dDstk; 240 241 out[i].ChiSqAve = in[i].ChiSqAve; 242 out[i].ChiSqPM = in[i].ChiSqPM; 243 out[i].ChiSqPar = in[i].ChiSqPar; 244 out[i].Tmean = in[i].Tmean; 245 out[i].Trange = in[i].Trange; 246 247 out[i].psfQF = in[i].psfQF; 248 out[i].psfQFperf = in[i].psfQFperf; 249 out[i].stargal = in[i].stargal; 250 out[i].Npos = in[i].Npos; 251 252 out[i].Nmeasure = in[i].Nmeasure; 253 out[i].Nmissing = in[i].Nmissing; 254 out[i].Nlensing = in[i].Nlensing; 255 out[i].Nlensobj = in[i].Nlensobj; 256 out[i].Nextend = in[i].Nextend; 257 258 out[i].measureOffset = in[i].measureOffset; 259 out[i].missingOffset = in[i].missingOffset; 260 out[i].lensingOffset = in[i].lensingOffset; 261 out[i].lensobjOffset = in[i].lensobjOffset; 262 out[i].extendOffset = in[i].extendOffset; 263 out[i].paramsOffset = in[i].paramsOffset; 264 265 out[i].refColorBlue = in[i].refColorBlue; 266 out[i].refColorRed = in[i].refColorRed; 267 268 out[i].flags = in[i].flags; 229 out[i].R = in[i].R; 230 out[i].D = in[i].D; 231 out[i].dR = in[i].dR; 232 out[i].dD = in[i].dD; 233 out[i].uR = in[i].uR; 234 out[i].uD = in[i].uD; 235 out[i].duR = in[i].duR; 236 out[i].duD = in[i].duD; 237 out[i].P = in[i].P; 238 out[i].dP = in[i].dP; 239 240 out[i].Rstk = in[i].Rstk; 241 out[i].Dstk = in[i].Dstk; 242 out[i].dRstk = in[i].dRstk; 243 out[i].dDstk = in[i].dDstk; 244 245 out[i].ChiSqAve = in[i].ChiSqAve; 246 out[i].ChiSqPM = in[i].ChiSqPM; 247 out[i].ChiSqPar = in[i].ChiSqPar; 248 out[i].Tmean = in[i].Tmean; 249 out[i].Trange = in[i].Trange; 250 251 out[i].psfQF = in[i].psfQF; 252 out[i].psfQFperf = in[i].psfQFperf; 253 out[i].stargal = in[i].stargal; 254 out[i].Npos = in[i].Npos; 255 256 out[i].Nmeasure = in[i].Nmeasure; 257 out[i].Nmissing = in[i].Nmissing; 258 out[i].Nlensing = in[i].Nlensing; 259 out[i].Nlensobj = in[i].Nlensobj; 260 out[i].Nextend = in[i].Nextend; 261 262 out[i].measureOffset = in[i].measureOffset; 263 out[i].missingOffset = in[i].missingOffset; 264 out[i].lensingOffset = in[i].lensingOffset; 265 out[i].lensobjOffset = in[i].lensobjOffset; 266 out[i].extendOffset = in[i].extendOffset; 267 out[i].paramsOffset = in[i].paramsOffset; 268 269 out[i].refColorBlue = in[i].refColorBlue; 270 out[i].refColorRed = in[i].refColorRed; 271 272 out[i].tessID = in[i].tessID; 273 out[i].skycellID = in[i].skycellID; 274 out[i].projectionID = in[i].projectionID; 275 276 out[i].flags = in[i].flags; 269 277 out[i].photFlagsUpper = in[i].photFlagsUpper; 270 278 out[i].photFlagsLower = in[i].photFlagsLower; 271 out[i].objID = in[i].objID;272 out[i].catID = in[i].catID;273 out[i].extID = in[i].extID;274 out[i].extIDgc = in[i].extIDgc;279 out[i].objID = in[i].objID; 280 out[i].catID = in[i].catID; 281 out[i].extID = in[i].extID; 282 out[i].extIDgc = in[i].extIDgc; 275 283 } 276 284 return (out); … … 286 294 for (i = 0; i < Nvalues; i++) { 287 295 dvo_secfilt_init (&out[i]); 288 289 out[i].M = in[i].M;290 out[i].dM = in[i].dM;291 out[i].Map = in[i].Map;292 out[i].dMap = in[i].dMap;293 out[i].sMap = in[i].sMap;294 out[i].Mkron = in[i].Mkron;295 out[i].dMkron = in[i].dMkron;296 297 out[i].Mstdev = in[i].Mstdev;298 out[i].Mmin = in[i].Mmin;299 out[i].Mmax = in[i].Mmax;300 out[i].Mchisq = in[i].Mchisq;301 302 out[i].Ncode = in[i].Ncode;303 out[i].Nused = in[i].Nused;304 out[i].NusedKron = in[i].NusedKron;305 out[i].NusedAp = in[i].NusedAp;306 307 out[i].flags = in[i].flags;308 309 out[i].MpsfStk = in[i].MpsfStk;310 out[i].FpsfStk = in[i].FpsfStk;311 out[i].dFpsfStk = in[i].dFpsfStk;312 313 out[i].MkronStk = in[i].MkronStk;314 out[i].FkronStk = in[i].FkronStk;315 out[i].dFkronStk = in[i].dFkronStk;316 317 out[i].MapStk = in[i].MapStk;318 out[i].FapStk = in[i].FapStk;319 out[i].dFapStk = in[i].dFapStk;320 321 out[i].stackPrmryOff = in[i].stackPrmryOff;322 out[i].stackBestOff = in[i].stackBestOff;323 324 out[i].MpsfWrp = in[i].MpsfWrp;325 out[i].FpsfWrp = in[i].FpsfWrp;326 out[i].dFpsfWrp = in[i].dFpsfWrp;327 out[i].sFpsfWrp = in[i].sFpsfWrp;328 329 out[i].MkronWrp = in[i].MkronWrp;330 out[i].FkronWrp = in[i].FkronWrp;331 out[i].dFkronWrp = in[i].dFkronWrp;332 out[i].sFkronWrp = in[i].sFkronWrp;333 334 out[i].MapWrp = in[i].MapWrp;335 out[i].FapWrp = in[i].FapWrp;336 out[i].dFapWrp = in[i].dFapWrp;337 out[i].sFapWrp = in[i].sFapWrp;338 339 out[i].NusedWrp = in[i].NusedWrp;340 out[i].NusedKronWrp = in[i].NusedKronWrp;341 out[i].NusedApWrp = in[i].NusedApWrp;342 343 out[i].ubercalDist = in[i].ubercalDist;344 }345 return (out);346 }347 348 SecFilt_PS1_V5 *SecFiltInternalTo_PS1_V5 (SecFilt *in, off_t Nvalues) {349 350 off_t i;351 SecFilt_PS1_V5 *out;352 353 ALLOCATE_ZERO (out, SecFilt_PS1_V5, Nvalues);354 355 for (i = 0; i < Nvalues; i++) {356 296 357 297 out[i].M = in[i].M; … … 364 304 out[i].sMkron = in[i].sMkron; 365 305 306 out[i].psfQfMax = in[i].psfQfMax; 307 out[i].psfQfPerfMax = in[i].psfQfPerfMax; 308 366 309 out[i].Mstdev = in[i].Mstdev; 367 310 out[i].Mmin = in[i].Mmin; … … 388 331 out[i].dFapStk = in[i].dFapStk; 389 332 333 out[i].Nstack = in[i].Nstack; 334 out[i].NstackDet = in[i].NstackDet; 335 390 336 out[i].stackPrmryOff = in[i].stackPrmryOff; 391 337 out[i].stackBestOff = in[i].stackBestOff; … … 409 355 out[i].NusedKronWrp = in[i].NusedKronWrp; 410 356 out[i].NusedApWrp = in[i].NusedApWrp; 357 358 out[i].Nwarp = in[i].Nwarp; 359 out[i].NwarpGood = in[i].NwarpGood; 360 361 out[i].ubercalDist = in[i].ubercalDist; 362 } 363 return (out); 364 } 365 366 SecFilt_PS1_V5 *SecFiltInternalTo_PS1_V5 (SecFilt *in, off_t Nvalues) { 367 368 off_t i; 369 SecFilt_PS1_V5 *out; 370 371 ALLOCATE_ZERO (out, SecFilt_PS1_V5, Nvalues); 372 373 for (i = 0; i < Nvalues; i++) { 374 375 out[i].M = in[i].M; 376 out[i].dM = in[i].dM; 377 out[i].Map = in[i].Map; 378 out[i].dMap = in[i].dMap; 379 out[i].sMap = in[i].sMap; 380 out[i].Mkron = in[i].Mkron; 381 out[i].dMkron = in[i].dMkron; 382 out[i].sMkron = in[i].sMkron; 383 384 out[i].psfQfMax = in[i].psfQfMax; 385 out[i].psfQfPerfMax = in[i].psfQfPerfMax; 386 387 out[i].Mstdev = in[i].Mstdev; 388 out[i].Mmin = in[i].Mmin; 389 out[i].Mmax = in[i].Mmax; 390 out[i].Mchisq = in[i].Mchisq; 391 392 out[i].Ncode = in[i].Ncode; 393 out[i].Nused = in[i].Nused; 394 out[i].NusedKron = in[i].NusedKron; 395 out[i].NusedAp = in[i].NusedAp; 396 397 out[i].flags = in[i].flags; 398 399 out[i].MpsfStk = in[i].MpsfStk; 400 out[i].FpsfStk = in[i].FpsfStk; 401 out[i].dFpsfStk = in[i].dFpsfStk; 402 403 out[i].MkronStk = in[i].MkronStk; 404 out[i].FkronStk = in[i].FkronStk; 405 out[i].dFkronStk = in[i].dFkronStk; 406 407 out[i].MapStk = in[i].MapStk; 408 out[i].FapStk = in[i].FapStk; 409 out[i].dFapStk = in[i].dFapStk; 410 411 out[i].Nstack = in[i].Nstack; 412 out[i].NstackDet = in[i].NstackDet; 413 414 out[i].stackPrmryOff = in[i].stackPrmryOff; 415 out[i].stackBestOff = in[i].stackBestOff; 416 417 out[i].MpsfWrp = in[i].MpsfWrp; 418 out[i].FpsfWrp = in[i].FpsfWrp; 419 out[i].dFpsfWrp = in[i].dFpsfWrp; 420 out[i].sFpsfWrp = in[i].sFpsfWrp; 421 422 out[i].MkronWrp = in[i].MkronWrp; 423 out[i].FkronWrp = in[i].FkronWrp; 424 out[i].dFkronWrp = in[i].dFkronWrp; 425 out[i].sFkronWrp = in[i].sFkronWrp; 426 427 out[i].MapWrp = in[i].MapWrp; 428 out[i].FapWrp = in[i].FapWrp; 429 out[i].dFapWrp = in[i].dFapWrp; 430 out[i].sFapWrp = in[i].sFapWrp; 431 432 out[i].NusedWrp = in[i].NusedWrp; 433 out[i].NusedKronWrp = in[i].NusedKronWrp; 434 out[i].NusedApWrp = in[i].NusedApWrp; 435 436 out[i].Nwarp = in[i].Nwarp; 437 out[i].NwarpGood = in[i].NwarpGood; 411 438 412 439 out[i].ubercalDist = in[i].ubercalDist; … … 834 861 return (out); 835 862 } 863 864 /*********************** old / alternate version **********************/ 865 866 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 867 Average *Average_PS1_V5alt_ToInternal (Average_PS1_V5alt *in, off_t Nvalues) { 868 869 off_t i; 870 Average *out; 871 872 ALLOCATE_ZERO (out, Average, Nvalues); 873 874 for (i = 0; i < Nvalues; i++) { 875 dvo_average_init (&out[i]); 876 877 out[i].R = in[i].R; 878 out[i].D = in[i].D; 879 out[i].dR = in[i].dR; 880 out[i].dD = in[i].dD; 881 out[i].uR = in[i].uR; 882 out[i].uD = in[i].uD; 883 out[i].duR = in[i].duR; 884 out[i].duD = in[i].duD; 885 out[i].P = in[i].P; 886 out[i].dP = in[i].dP; 887 888 out[i].Rstk = in[i].Rstk; 889 out[i].Dstk = in[i].Dstk; 890 out[i].dRstk = in[i].dRstk; 891 out[i].dDstk = in[i].dDstk; 892 893 out[i].ChiSqAve = in[i].ChiSqAve; 894 out[i].ChiSqPM = in[i].ChiSqPM; 895 out[i].ChiSqPar = in[i].ChiSqPar; 896 out[i].Tmean = in[i].Tmean; 897 out[i].Trange = in[i].Trange; 898 899 out[i].psfQF = in[i].psfQF; 900 out[i].psfQFperf = in[i].psfQFperf; 901 out[i].stargal = in[i].stargal; 902 out[i].Npos = in[i].Npos; 903 904 out[i].Nmeasure = in[i].Nmeasure; 905 out[i].Nmissing = in[i].Nmissing; 906 out[i].Nlensing = in[i].Nlensing; 907 out[i].Nlensobj = in[i].Nlensobj; 908 out[i].Nextend = in[i].Nextend; 909 910 out[i].measureOffset = in[i].measureOffset; 911 out[i].missingOffset = in[i].missingOffset; 912 out[i].lensingOffset = in[i].lensingOffset; 913 out[i].lensobjOffset = in[i].lensobjOffset; 914 out[i].extendOffset = in[i].extendOffset; 915 out[i].paramsOffset = in[i].paramsOffset; 916 917 out[i].refColorBlue = in[i].refColorBlue; 918 out[i].refColorRed = in[i].refColorRed; 919 920 out[i].flags = in[i].flags; 921 out[i].photFlagsUpper = in[i].photFlagsUpper; 922 out[i].photFlagsLower = in[i].photFlagsLower; 923 out[i].objID = in[i].objID; 924 out[i].catID = in[i].catID; 925 out[i].extID = in[i].extID; 926 out[i].extIDgc = in[i].extIDgc; 927 } 928 return (out); 929 } 930 931 int gfits_convert_Average_PS1_V5alt (Average_PS1_V5alt *data, off_t size, off_t nitems) { 932 933 off_t i; 934 unsigned char *byte, tmp; 935 936 if (size != 184) { 937 fprintf (stderr, "WARNING: mismatch in data types Average_PS1_V5alt: "OFF_T_FMT" vs %d\n", size, 184); 938 return (FALSE); 939 } 940 941 /* provide initial values to avoid compiler warnings for non-BYTE_SWAP arch */ 942 i = tmp = 0; 943 byte = NULL; 944 945 # ifdef BYTE_SWAP 946 byte = (unsigned char *) data; 947 for (i = 0; i < nitems; i++, byte += 184) { 948 /** BYTE SWAP **/ 949 SWAP_DBLE (0); // RA 950 SWAP_DBLE (8); // DEC 951 SWAP_WORD (16); // RA_ERR 952 SWAP_WORD (20); // DEC_ERR 953 SWAP_WORD (24); // U_RA 954 SWAP_WORD (28); // U_DEC 955 SWAP_WORD (32); // V_RA_ERR 956 SWAP_WORD (36); // V_DEC_ERR 957 SWAP_WORD (40); // PAR 958 SWAP_WORD (44); // PAR_ERR 959 SWAP_DBLE (48); // RA_STK 960 SWAP_DBLE (56); // DEC_STK 961 SWAP_WORD (64); // RA_STK_ERR 962 SWAP_WORD (68); // DEC_STK_ERR 963 SWAP_WORD (72); // CHISQ_POS 964 SWAP_WORD (76); // CHISQ_PM 965 SWAP_WORD (80); // CHISQ_PAP 966 SWAP_WORD (84); // MEAN_EPOCH 967 SWAP_WORD (88); // TIME_RANGE 968 SWAP_WORD (92); // PSF_QF 969 SWAP_WORD (96); // PSF_QF_PERF 970 SWAP_WORD (100); // STARGAL_SEP 971 SWAP_BYTE (104); // NUMBER_POS 972 SWAP_BYTE (106); // NMEASURE 973 SWAP_BYTE (108); // NMISSING 974 SWAP_BYTE (110); // NLENSING 975 SWAP_BYTE (112); // NLENSOBJ 976 SWAP_BYTE (114); // NEXTEND 977 SWAP_WORD (116); // OFF_MEASURE 978 SWAP_WORD (120); // OFF_MISSING 979 SWAP_WORD (124); // OFF_LENSING 980 SWAP_WORD (128); // OFF_LENSOBJ 981 SWAP_WORD (132); // OFF_EXTEND 982 SWAP_WORD (136); // OFF_PARAMS 983 SWAP_WORD (140); // REF_COLOR_BLUE 984 SWAP_WORD (144); // REF_COLOR_RED 985 SWAP_WORD (148); // FLAGS 986 SWAP_WORD (152); // PHOTFLAGS_U 987 SWAP_WORD (156); // PHOTFLAGS_L 988 SWAP_WORD (160); // OBJ_ID 989 SWAP_WORD (164); // CAT_ID 990 SWAP_DBLE (168); // EXT_ID 991 SWAP_DBLE (176); // EXT_ID_GC 992 } 993 # endif 994 995 return (TRUE); 996 } 997 998 /*** add test of EXTNAME and header-defined columns? ***/ 999 /* return internal structure representation */ 1000 Average_PS1_V5alt *gfits_table_get_Average_PS1_V5alt (FTable *ftable, off_t *Ndata, char *swapped) { 1001 1002 int Ncols; 1003 Average_PS1_V5alt *data; 1004 1005 Ncols = ftable[0].header[0].Naxis[0]; 1006 if (Ncols != 184) { 1007 fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, 184); 1008 return NULL; 1009 } 1010 1011 *Ndata = ftable[0].header[0].Naxis[1]; 1012 data = (Average_PS1_V5alt *) ftable[0].buffer; 1013 if ((swapped == NULL) || (*swapped == FALSE)) { 1014 if (!gfits_convert_Average_PS1_V5alt (data, sizeof (Average_PS1_V5alt), *Ndata)) { 1015 return NULL; 1016 } 1017 gfits_table_scale_data (ftable); 1018 if (swapped != NULL) *swapped = TRUE; 1019 } 1020 return (data); 1021 } 1022 1023 /****** alt secfilt **********/ 1024 1025 SecFilt *SecFilt_PS1_V5alt_ToInternal (SecFilt_PS1_V5alt *in, off_t Nvalues) { 1026 1027 off_t i; 1028 SecFilt *out; 1029 1030 ALLOCATE_ZERO (out, SecFilt, Nvalues); 1031 1032 for (i = 0; i < Nvalues; i++) { 1033 dvo_secfilt_init (&out[i]); 1034 1035 out[i].M = in[i].M; 1036 out[i].dM = in[i].dM; 1037 out[i].Map = in[i].Map; 1038 out[i].dMap = in[i].dMap; 1039 out[i].sMap = in[i].sMap; 1040 out[i].Mkron = in[i].Mkron; 1041 out[i].dMkron = in[i].dMkron; 1042 1043 out[i].Mstdev = in[i].Mstdev; 1044 out[i].Mmin = in[i].Mmin; 1045 out[i].Mmax = in[i].Mmax; 1046 out[i].Mchisq = in[i].Mchisq; 1047 1048 out[i].Ncode = in[i].Ncode; 1049 out[i].Nused = in[i].Nused; 1050 out[i].NusedKron = in[i].NusedKron; 1051 out[i].NusedAp = in[i].NusedAp; 1052 1053 out[i].flags = in[i].flags; 1054 1055 out[i].MpsfStk = in[i].MpsfStk; 1056 out[i].FpsfStk = in[i].FpsfStk; 1057 out[i].dFpsfStk = in[i].dFpsfStk; 1058 1059 out[i].MkronStk = in[i].MkronStk; 1060 out[i].FkronStk = in[i].FkronStk; 1061 out[i].dFkronStk = in[i].dFkronStk; 1062 1063 out[i].MapStk = in[i].MapStk; 1064 out[i].FapStk = in[i].FapStk; 1065 out[i].dFapStk = in[i].dFapStk; 1066 1067 out[i].stackPrmryOff = in[i].stackPrmryOff; 1068 out[i].stackBestOff = in[i].stackBestOff; 1069 1070 out[i].MpsfWrp = in[i].MpsfWrp; 1071 out[i].FpsfWrp = in[i].FpsfWrp; 1072 out[i].dFpsfWrp = in[i].dFpsfWrp; 1073 out[i].sFpsfWrp = in[i].sFpsfWrp; 1074 1075 out[i].MkronWrp = in[i].MkronWrp; 1076 out[i].FkronWrp = in[i].FkronWrp; 1077 out[i].dFkronWrp = in[i].dFkronWrp; 1078 out[i].sFkronWrp = in[i].sFkronWrp; 1079 1080 out[i].MapWrp = in[i].MapWrp; 1081 out[i].FapWrp = in[i].FapWrp; 1082 out[i].dFapWrp = in[i].dFapWrp; 1083 out[i].sFapWrp = in[i].sFapWrp; 1084 1085 out[i].NusedWrp = in[i].NusedWrp; 1086 out[i].NusedKronWrp = in[i].NusedKronWrp; 1087 out[i].NusedApWrp = in[i].NusedApWrp; 1088 1089 out[i].ubercalDist = in[i].ubercalDist; 1090 } 1091 return (out); 1092 } 1093 1094 int gfits_convert_SecFilt_PS1_V5alt (SecFilt_PS1_V5alt *data, off_t size, off_t nitems) { 1095 1096 off_t i; 1097 unsigned char *byte, tmp; 1098 1099 if (size != 160) { 1100 fprintf (stderr, "WARNING: mismatch in data types SecFilt_PS1_V5alt: "OFF_T_FMT" vs %d\n", size, 160); 1101 return (FALSE); 1102 } 1103 1104 /* provide initial values to avoid compiler warnings for non-BYTE_SWAP arch */ 1105 i = tmp = 0; 1106 byte = NULL; 1107 1108 # ifdef BYTE_SWAP 1109 byte = (unsigned char *) data; 1110 for (i = 0; i < nitems; i++, byte += 160) { 1111 /** BYTE SWAP **/ 1112 SWAP_WORD (0); // MAG 1113 SWAP_WORD (4); // MAG_ERR 1114 SWAP_WORD (8); // MAG_AP 1115 SWAP_WORD (12); // MAG_AP_ERR 1116 SWAP_WORD (16); // MAG_AP_STDEV 1117 SWAP_WORD (20); // MAG_KRON 1118 SWAP_WORD (24); // MAG_KRON_ERR 1119 SWAP_WORD (28); // MAG_KRON_STDEV 1120 SWAP_WORD (32); // MAG_STDEV 1121 SWAP_WORD (36); // MAG_MIN 1122 SWAP_WORD (40); // MAG_MAX 1123 SWAP_WORD (44); // MAG_CHI 1124 SWAP_BYTE (48); // NCODE 1125 SWAP_BYTE (50); // NUSED 1126 SWAP_BYTE (52); // NUSED_KRON 1127 SWAP_BYTE (54); // NUSED_AP 1128 SWAP_WORD (56); // FLAGS 1129 SWAP_WORD (60); // MAG_PSF_STK 1130 SWAP_WORD (64); // FLUX_PSF_STK 1131 SWAP_WORD (68); // FLUX_PSF_STK_ERR 1132 SWAP_WORD (72); // MAG_KRON_STK 1133 SWAP_WORD (76); // FLUX_KRON_STK 1134 SWAP_WORD (80); // FLUX_KRON_STK_ERR 1135 SWAP_WORD (84); // MAG_AP_STK 1136 SWAP_WORD (88); // FLUX_AP_STK 1137 SWAP_WORD (92); // FLUX_AP_STK_ERR 1138 SWAP_WORD (96); // STACK_PRIMARY_OFF 1139 SWAP_WORD (100); // STACK_BEST_OFF 1140 SWAP_WORD (104); // MAG_PSF_WRP 1141 SWAP_WORD (108); // FLUX_PSF_WRP 1142 SWAP_WORD (112); // FLUX_PSF_WRP_ERR 1143 SWAP_WORD (116); // FLUX_PSF_WRP_STD 1144 SWAP_WORD (120); // MAG_KRON_WRP 1145 SWAP_WORD (124); // FLUX_KRON_WRP 1146 SWAP_WORD (128); // FLUX_KRON_WRP_ERR 1147 SWAP_WORD (132); // FLUX_KRON_WRP_STD 1148 SWAP_WORD (136); // MAG_AP_WRP 1149 SWAP_WORD (140); // FLUX_AP_WRP 1150 SWAP_WORD (144); // FLUX_AP_WRP_ERR 1151 SWAP_WORD (148); // FLUX_AP_WRP_STD 1152 SWAP_BYTE (152); // NUSED_WRP 1153 SWAP_BYTE (154); // NUSED_KRON_WRP 1154 SWAP_BYTE (156); // NUSED_AP_WRP 1155 SWAP_BYTE (158); // UBERCAL_DIST 1156 } 1157 # endif 1158 1159 return (TRUE); 1160 } 1161 1162 /*** add test of EXTNAME and header-defined columns? ***/ 1163 /* return internal structure representation */ 1164 SecFilt_PS1_V5alt *gfits_table_get_SecFilt_PS1_V5alt (FTable *ftable, off_t *Ndata, char *swapped) { 1165 1166 int Ncols; 1167 SecFilt_PS1_V5alt *data; 1168 1169 Ncols = ftable[0].header[0].Naxis[0]; 1170 if (Ncols != 160) { 1171 fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, 160); 1172 return NULL; 1173 } 1174 1175 *Ndata = ftable[0].header[0].Naxis[1]; 1176 data = (SecFilt_PS1_V5alt *) ftable[0].buffer; 1177 if ((swapped == NULL) || (*swapped == FALSE)) { 1178 if (!gfits_convert_SecFilt_PS1_V5alt (data, sizeof (SecFilt_PS1_V5alt), *Ndata)) { 1179 return NULL; 1180 } 1181 gfits_table_scale_data (ftable); 1182 if (swapped != NULL) *swapped = TRUE; 1183 } 1184 return (data); 1185 } 1186 1187 -
trunk/Ohana/src/opihi/cmd.astro/cplot.c
r34613 r37246 4 4 5 5 double ra_prev = 0; 6 int i, kapa, Npts, status, leftside ;6 int i, kapa, Npts, status, leftside, valid, size; 7 7 opihi_flt *x, *y, *r, *d, Rmin, Rmax, Rmid; 8 8 Vector Xvec, Yvec, *xvec, *yvec; … … 11 11 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 12 12 13 if (argc != 3) { 13 valid = (argc == 3); 14 valid |= (argc > 4) && !strcmp (argv[3], "where"); 15 if (!valid) { 14 16 gprint (GP_ERR, "USAGE: cplot <ra> <dec> [style]\n"); 17 gprint (GP_ERR, " OR: cplot <ra> <dec> [style] where (condition)\n"); 15 18 return (FALSE); 16 19 } … … 32 35 } 33 36 37 // tvec is used for logical test (truth vector) 38 Vector *tvec = NULL; 39 if (argc > 4) { 40 char *out = dvomath (argc - 4, &argv[4], &size, 1); 41 if (out == NULL) { 42 print_error (); 43 return FALSE; 44 } 45 if ((tvec = SelectVector (out, OLDVECTOR, TRUE)) == NULL) { 46 gprint (GP_ERR, " invalid logic result\n"); 47 DeleteNamedVector (out); 48 free (out); 49 return (FALSE); 50 } 51 } 52 53 if (tvec && tvec[0].Nelements != yvec[0].Nelements) { 54 gprint (GP_ERR, "logic test vector not the same length as data vectors\n"); 55 DeleteVector (tvec); 56 return (FALSE); 57 } 58 34 59 SetVector (&Xvec, OPIHI_FLT, xvec[0].Nelements); 35 60 SetVector (&Yvec, OPIHI_FLT, xvec[0].Nelements); … … 42 67 Npts = 0; 43 68 for (i = 0; i < Xvec.Nelements; i++, r++, d++) { 69 if (tvec) { 70 int skip = (tvec->type == OPIHI_FLT) ? (tvec->elements.Flt[i] == 0.0) : (tvec->elements.Int[i] == 0.0); 71 if (skip) continue; 72 } 73 44 74 double ra = ohana_normalize_angle (*r); 45 75 while (ra < Rmin) ra += 360.0; … … 88 118 free (Yvec.elements.Ptr); 89 119 120 if (tvec) DeleteVector (tvec); 121 90 122 return (TRUE); 91 123 } -
trunk/Ohana/src/opihi/dvo/gstar.c
r37116 r37246 627 627 gprint (GP_LOG, "%5.3f ", catalog.measure[Nv].psfQF); 628 628 gprint (GP_LOG, "%7.1f ", catalog.measure[Nv].psfChisq); 629 gprint (GP_LOG, "%3.1f ", catalog.measure[Nv].crNsigma);629 // gprint (GP_LOG, "%3.1f ", catalog.measure[Nv].crNsigma); 630 630 gprint (GP_LOG, "%4.1f ", catalog.measure[Nv].extNsigma); 631 631 gprint (GP_LOG, "%5.1f ", FromShortDegrees(catalog.measure[Nv].theta)); -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r37038 r37246 467 467 catalog[i].average[j].Npos = fit.Nfit; 468 468 469 // XXX EAM 20140812: for a test, set average.Rstk,Dstk, etc to match R,D 470 catalog[i].average[j].Rstk = fit.Ro; // RA in degrees 471 catalog[i].average[j].Dstk = fit.Do; // DEC in degrees 472 catalog[i].average[j].dRstk = fit.dRo; // RA scatter in arcsec 473 catalog[i].average[j].dDstk = fit.dDo; // DEC scatter in arcsec 474 469 475 // unset the NO_ASTROM bit (not(NO_ASTROM) == HAVE_ASTROM) 470 476 catalog[i].average[j].flags &= ~ID_STAR_NO_ASTROM; -
trunk/Ohana/src/relphot/src/setMrelCatalog.c
r37116 r37246 147 147 off_t meas = measureOffset; 148 148 149 float psfQfMax = 0.0; 150 float psfQfPerfMax = 0.0; 151 149 152 int Nap = 0; 150 153 int Npsf = 0; … … 166 169 // SKIP gpc1 forced-warp data 167 170 if (isGPC1warp(measureT[k].photcode)) continue; 171 172 if (isSetMrelFinal) { 173 if (measure[k].psfQF > psfQfMax) psfQfMax = measure[k].psfQF; 174 if (measure[k].psfQFperf > psfQfPerfMax) psfQfPerfMax = measure[k].psfQFperf; 175 } 168 176 169 177 if (measureT[k].dbFlags & MEAS_BAD) SKIP_THIS_MEAS(Nbad); … … 367 375 secfilt[Nsec].Mmin = psfstats->min; 368 376 377 secfilt[Nsec].psfQfMax = psfQfMax; 378 secfilt[Nsec].psfQfPerfMax = psfQfPerfMax; 379 369 380 // NOTE : use the modified weight for apmags as well as psf mags 370 381 liststats (Maplist, daplist, waplist, Nap, apstats); … … 457 468 get_tess_ids(&tessID, &projectID, &skycellID, average[0].R, average[0].D); 458 469 470 average[0].tessID = tessID; 471 average[0].projectionID = projectID; 472 average[0].skycellID = skycellID; 473 459 474 int NstackGood = 0; 460 475 int NstackSuspect = 0; … … 478 493 int isBad = FALSE; 479 494 int isSuspect = FALSE; 495 496 int Nstack = 0; // number for this photcode 497 int NstackDet = 0; // number for this photcode 480 498 481 499 off_t meas = measureOffset; … … 489 507 if (!code) continue; 490 508 if (code->equiv != thisCode) { continue; } 509 510 Nstack ++; 511 if (measure[k].photFlags2 & 0x00000004 == 0) NstackDet ++; 491 512 492 513 // clear this bit for all measurements … … 615 636 secfilt[Nsec].stackBestOff = k + measureOffset; 616 637 638 secfilt[Nsec].Nstack = Nstack; 639 secfilt[Nsec].NstackDet = NstackDet; 640 617 641 // this is the measurement used by secfilt[] 618 642 measure[k].dbFlags |= ID_MEAS_STACK_PHOT_SRC; … … 694 718 int Npsf = 0; 695 719 int Nkron = 0; 720 721 int Nwarp = 0; 722 int NwarpGood = 0; 696 723 for (k = 0; k < average[0].Nmeasure; k++, meas++) { 697 724 … … 703 730 if (!code) continue; 704 731 if (code->equiv != thisCode) { continue; } 732 733 Nwarp ++; 734 if (measure[k].psfQFperf > 0.85) NwarpGood ++; 705 735 706 736 measure[k].dbFlags &= ~ID_MEAS_WARP_USED; … … 799 829 secfilt[Nsec].NusedKronWrp = Nkron; 800 830 secfilt[Nsec].MkronWrp = isnan(secfilt[Nsec].FkronWrp) ? NAN : 8.9 - 2.5*log10(secfilt[Nsec].FkronWrp); // 8.9 since flux is in Jy 831 832 secfilt[Nsec].Nwarp = Nwarp; 833 secfilt[Nsec].NwarpGood = NwarpGood; 801 834 } 802 835 return (TRUE);
Note:
See TracChangeset
for help on using the changeset viewer.
