Changeset 21508 for trunk/Ohana/src/libdvo
- Timestamp:
- Feb 16, 2009, 11:33:52 AM (17 years ago)
- Location:
- trunk/Ohana/src/libdvo
- Files:
-
- 2 added
- 18 edited
-
Makefile (modified) (2 diffs)
-
doc/notes.txt (modified) (3 diffs)
-
include/dvo.h (modified) (3 diffs)
-
include/ps1_v1_defs.h (added)
-
src/LoadPhotcodesFITS.c (modified) (2 diffs)
-
src/SavePhotcodesFITS.c (modified) (1 diff)
-
src/dvo_catalog.c (modified) (1 diff)
-
src/dvo_catalog_raw.c (modified) (8 diffs)
-
src/dvo_convert.c (modified) (9 diffs)
-
src/dvo_convert_PS1_DEV_1.c (modified) (15 diffs)
-
src/dvo_convert_PS1_DEV_2.c (modified) (17 diffs)
-
src/dvo_convert_PS1_DEV_3.c (modified) (6 diffs)
-
src/dvo_convert_PS1_V1.c (added)
-
src/dvo_convert_elixir.c (modified) (18 diffs)
-
src/dvo_convert_loneos.c (modified) (15 diffs)
-
src/dvo_convert_panstarrs_DEV_0.c (modified) (13 diffs)
-
src/dvo_convert_panstarrs_DEV_1.c (modified) (13 diffs)
-
src/dvo_image.c (modified) (1 diff)
-
src/dvo_image_raw.c (modified) (2 diffs)
-
src/dvosorts.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libdvo/Makefile
r17419 r21508 31 31 $(DESTINC)/ps1_dev_1_defs.h \ 32 32 $(DESTINC)/ps1_dev_2_defs.h \ 33 $(DESTINC)/ps1_dev_3_defs.h 33 $(DESTINC)/ps1_dev_3_defs.h \ 34 $(DESTINC)/ps1_v1_defs.h 34 35 35 36 INCS = $(DEFS) $(DESTINC)/dvo.h $(DESTINC)/autocode.h … … 65 66 $(SRC)/dvo_convert_PS1_DEV_2.$(ARCH).o \ 66 67 $(SRC)/dvo_convert_PS1_DEV_3.$(ARCH).o \ 68 $(SRC)/dvo_convert_PS1_V1.$(ARCH).o \ 67 69 $(SRC)/skyregion_io.$(ARCH).o \ 68 70 $(SRC)/skyregion_gsc.$(ARCH).o \ -
trunk/Ohana/src/libdvo/doc/notes.txt
r12332 r21508 2 2 Adding a new dvo catalog format. Assume the new format name is 'foo'. 3 3 4 1) create the autocode definition files for average, measure, secfilt, image5 these files must be a subset of the internal versions of these same6 tables. if you intend to add fields which don't exist in the7 internal tables, you must update the internal tables as well. the8 naming convention is: average-foo.d, etc.4 1) create the autocode definition files for average, measure, secfilt, 5 image, and photcode. these files must be a subset of the internal 6 versions of these same tables. if you intend to add fields which 7 don't exist in the internal tables, you must update the internal 8 tables as well. the naming convention is: average-foo.d, etc. 9 9 10 10 2) add the new definition files to libautocode/Makefile.Targets (both … … 22 22 (libdvo/src/dvo_catalog.c). The name should be "FOO". 23 23 24 6) add entry for structure size in dvo_catalog_load_raw 25 (libdvo/src/dvo_catalog_raw.c), since this is not available from 26 the header. 24 6) in libdvo/src/dvo_catalog_raw.c, update the FORMAT_CASE lists to 25 include the new STRUCT name. 27 26 28 7) add entries in ReadRawAverage, WriteRawAverage, ReadRawMeasure, 29 WriteRawMeasure, ReadRawSecFilt, WriteRawSecFilt. Make sure to use 30 the new STRUCT names. the conversion function gfit_convert_Foo will 31 be automatically generated. 27 7) create a new conversion file dvo_convert_foo.c and define the 28 internal to Foo conversions. 32 29 33 8) add entry in WriteRawAverage, making sure to use the new STRUCT 34 name. the conversion function gfit_convert_Foo will be 35 automatically generated. 30 8) add the new format to the list of FORMAT conversion in dvo_convert.c. 36 31 37 9) create a new conversion file dvo_convert_foo.c and define the 38 internal to Foo conversions. 32 9) any changes to the internal format need to be reflected in the 33 functions in the dvo_convert_*.c files. These files are defined so 34 that changed fields are sequential in the functions. This should 35 make is easy to identify the new changes needed. 36 37 10) add the new format to the section at the end of dvo_image.c 38 39 11) add the new format to the dvo_image_raw.c 40 41 12) add the photcode format conversions to libdvo/src/LoadPhotcodesFITS.c 42 43 12) switch the output photcode format conversion ina libdvo/src/SavePhotcodesFITS.c 44 45 13) Add the conversion functions to the header file libdvo/include/foo_defs.h 39 46 40 47 * Note some esoteric format issues: … … 54 61 keywords. 55 62 63 ---- 64 65 20090207 : adding PS1_V1 66 67 measure: 68 new fields : t_msec, extID, Mxx, Mxy, Myy, dTccd; deprecated dophot 69 dbFlags, photFlags : uint16_t to uint64_t 70 71 average: 72 new fields : ChiSq, Npos, flags (was code, uint16_t), extID 73 74 secfilt: 75 new fields : M_20, M_80; dropped dummy 76 77 image: 78 new fields : parentID, flags (was code char), changed name to 121 bytes. 79 80 photcode: 81 new fields : NONE 82 83 ** parentID was added to enable easy lookups from chip->fpa for mosaic 84 astrometry. In old databases, this conversion was done by making 85 the match via the time and photcode. This conversion needs to be 86 done on load... -
trunk/Ohana/src/libdvo/include/dvo.h
r21153 r21508 18 18 DVO_FORMAT_PS1_DEV_1, 19 19 DVO_FORMAT_PS1_DEV_2, 20 DVO_FORMAT_PS1_DEV_3 20 DVO_FORMAT_PS1_DEV_3, 21 DVO_FORMAT_PS1_V1 21 22 } DVOTableFormat; 22 23 … … 407 408 # include "ps1_dev_2_defs.h" 408 409 # include "ps1_dev_3_defs.h" 410 # include "ps1_v1_defs.h" 409 411 410 412 /*** DVO image db I/O Functions ***/ … … 444 446 void sort_image_subset (Image *image, int *subset, int N); 445 447 void sort_coords_index (double *X, double *Y, int *S, int N); 446 void sort_stars_ra (Stars *stars, int N);447 448 void sort_regions (SkyRegion *region, int N); 448 449 -
trunk/Ohana/src/libdvo/src/LoadPhotcodesFITS.c
r17190 r21508 40 40 gfits_scan (&db.theader, "EXTNAME", "%s", 1, extname); 41 41 42 if (!strcmp (extname, "DVO_PHOTCODE") || !strcmp (extname, "DVO_PHOTCODE_ELIXIR")) { 42 if (!strcmp (extname, "DVO_PHOTCODE")) { 43 PhotCode_Elixir *photcode_elixir = gfits_table_get_PhotCode_Elixir (&db.ftable, &Ncode, &db.swapped); 44 photcode = PhotCode_Elixir_To_Internal (photcode_elixir, Ncode); 45 free (photcode_elixir); 46 } 47 48 if (!strcmp (extname, "DVO_PHOTCODE_ELIXIR")) { 43 49 PhotCode_Elixir *photcode_elixir = gfits_table_get_PhotCode_Elixir (&db.ftable, &Ncode, &db.swapped); 44 50 photcode = PhotCode_Elixir_To_Internal (photcode_elixir, Ncode); … … 62 68 photcode = PhotCode_PS1_DEV_3_To_Internal (photcode_ps1_dev_3, Ncode); 63 69 free (photcode_ps1_dev_3); 70 } 71 72 if (!strcmp (extname, "DVO_PHOTCODE_PS1_V1")) { 73 PhotCode_PS1_V1 *photcode_ps1_v1 = gfits_table_get_PhotCode_PS1_V1 (&db.ftable, &Ncode, &db.swapped); 74 photcode = PhotCode_PS1_V1_To_Internal (photcode_ps1_v1, Ncode); 75 free (photcode_ps1_v1); 64 76 } 65 77 -
trunk/Ohana/src/libdvo/src/SavePhotcodesFITS.c
r17190 r21508 29 29 // for the moment, we simply support the latest photcode format for output 30 30 // XXX update this as needed as new formats are defined 31 PhotCode_PS1_ DEV_3 *photcode_output = PhotCode_Internal_To_PS1_DEV_3(table[0].code, table[0].Ncode);31 PhotCode_PS1_V1 *photcode_output = PhotCode_Internal_To_PS1_V1 (table[0].code, table[0].Ncode); 32 32 33 33 /* convert FITS format data to internal format (byteswaps & EXTNAME) */ 34 34 gfits_db_create (&db); 35 gfits_table_set_PhotCode_PS1_ DEV_3(&db.ftable, photcode_output, table[0].Ncode);35 gfits_table_set_PhotCode_PS1_V1 (&db.ftable, photcode_output, table[0].Ncode); 36 36 gfits_db_save (&db); 37 37 gfits_db_close (&db); -
trunk/Ohana/src/libdvo/src/dvo_catalog.c
r20981 r21508 52 52 if (!strcasecmp (catformat, "PS1_DEV_1")) return (DVO_FORMAT_PS1_DEV_1); 53 53 if (!strcasecmp (catformat, "PS1_DEV_2")) return (DVO_FORMAT_PS1_DEV_2); 54 if (!strcasecmp (catformat, "PS1_V1")) return (DVO_FORMAT_PS1_V1); 54 55 return (DVO_FORMAT_UNDEF); 55 56 } -
trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c
r20982 r21508 86 86 FORMAT_CASE (PS1_DEV_1, PS1_DEV_1); 87 87 FORMAT_CASE (PS1_DEV_2, PS1_DEV_2); 88 FORMAT_CASE (PS1_V1, PS1_V1); 88 89 89 90 default: … … 271 272 if (catalog[0].catformat == DVO_FORMAT_PS1_DEV_1) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_DEV_1"); 272 273 if (catalog[0].catformat == DVO_FORMAT_PS1_DEV_2) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_DEV_2"); 274 if (catalog[0].catformat == DVO_FORMAT_PS1_V1) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_V1"); 273 275 274 276 /* rewind file pointers and truncate file */ … … 366 368 FORMAT_CASE (PS1_DEV_1, PS1_DEV_1); 367 369 FORMAT_CASE (PS1_DEV_2, PS1_DEV_2); 370 FORMAT_CASE (PS1_V1, PS1_V1); 368 371 369 372 default: … … 412 415 FORMAT_CASE (PS1_DEV_1, PS1_DEV_1); 413 416 FORMAT_CASE (PS1_DEV_2, PS1_DEV_2); 417 FORMAT_CASE (PS1_V1, PS1_V1); 414 418 415 419 default: … … 462 466 FORMAT_CASE (PS1_DEV_1, PS1_DEV_1); 463 467 FORMAT_CASE (PS1_DEV_2, PS1_DEV_2); 468 FORMAT_CASE (PS1_V1, PS1_V1); 464 469 465 470 default: … … 508 513 FORMAT_CASE (PS1_DEV_1, PS1_DEV_1); 509 514 FORMAT_CASE (PS1_DEV_2, PS1_DEV_2); 515 FORMAT_CASE (PS1_V1, PS1_V1); 510 516 511 517 default: … … 558 564 FORMAT_CASE (PS1_DEV_1, PS1_DEV_1); 559 565 FORMAT_CASE (PS1_DEV_2, PS1_DEV_2); 566 FORMAT_CASE (PS1_V1, PS1_V1); 560 567 561 568 default: … … 604 611 FORMAT_CASE (PS1_DEV_1, PS1_DEV_1); 605 612 FORMAT_CASE (PS1_DEV_2, PS1_DEV_2); 613 FORMAT_CASE (PS1_V1, PS1_V1); 606 614 607 615 default: -
trunk/Ohana/src/libdvo/src/dvo_convert.c
r19185 r21508 49 49 CONVERT_FORMAT ("DVO_AVERAGE_PS1_DEV_1", PS1_DEV_1, PS1_DEV_1); 50 50 CONVERT_FORMAT ("DVO_AVERAGE_PS1_DEV_2", PS1_DEV_2, PS1_DEV_2); 51 CONVERT_FORMAT ("DVO_AVERAGE_PS1_V1", PS1_V1, PS1_V1); 51 52 # undef CONVERT_FORMAT 52 53 … … 79 80 FORMAT_CASE (PS1_DEV_1, PS1_DEV_1); 80 81 FORMAT_CASE (PS1_DEV_2, PS1_DEV_2); 82 FORMAT_CASE (PS1_V1, PS1_V1); 81 83 # undef FORMAT_CASE 82 84 … … 122 124 CONVERT_FORMAT ("DVO_MEASURE_PS1_DEV_1", PS1_DEV_1, PS1_DEV_1); 123 125 CONVERT_FORMAT ("DVO_MEASURE_PS1_DEV_2", PS1_DEV_2, PS1_DEV_2); 126 CONVERT_FORMAT ("DVO_MEASURE_PS1_V1", PS1_V1, PS1_V1); 124 127 # undef CONVERT_FORMAT 125 128 … … 152 155 FORMAT_CASE (PS1_DEV_1, PS1_DEV_1); 153 156 FORMAT_CASE (PS1_DEV_2, PS1_DEV_2); 157 FORMAT_CASE (PS1_V1, PS1_V1); 154 158 # undef FORMAT_CASE 155 159 … … 195 199 CONVERT_FORMAT ("DVO_SECFILT_PS1_DEV_1", PS1_DEV_1, PS1_DEV_1); 196 200 CONVERT_FORMAT ("DVO_SECFILT_PS1_DEV_2", PS1_DEV_2, PS1_DEV_2); 201 CONVERT_FORMAT ("DVO_SECFILT_PS1_V1", PS1_V1, PS1_V1); 197 202 # undef CONVERT_FORMAT 198 203 … … 225 230 FORMAT_CASE (PS1_DEV_1, PS1_DEV_1); 226 231 FORMAT_CASE (PS1_DEV_2, PS1_DEV_2); 232 FORMAT_CASE (PS1_V1, PS1_V1); 227 233 # undef FORMAT_CASE 228 234 … … 288 294 CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_1", PS1_DEV_1, PS1_DEV_1); 289 295 CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_2", PS1_DEV_2, PS1_DEV_2); 290 CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_3", PS1_DEV_3, PS1_DEV_3); 296 CONVERT_FORMAT ("DVO_IMAGE_PS1_V1", PS1_V1, PS1_V1); 297 298 // XXX Not sure this was ever actually used -- it was not complete... 299 // CONVERT_FORMAT ("DVO_IMAGE_PS1_DEV_3", PS1_DEV_3, PS1_DEV_3); 300 291 301 # undef CONVERT_FORMAT 292 302 … … 322 332 FORMAT_CASE (PS1_DEV_1, PS1_DEV_1); 323 333 FORMAT_CASE (PS1_DEV_2, PS1_DEV_2); 324 FORMAT_CASE (PS1_DEV_3, PS1_DEV_3); 334 FORMAT_CASE (PS1_V1, PS1_V1); 335 336 // XXX not sure this was actually used: it was incomplete 337 // FORMAT_CASE (PS1_DEV_3, PS1_DEV_3); 325 338 # undef FORMAT_CASE 326 339 … … 372 385 FORMAT_CASE (PS1_DEV_1, PS1_DEV_1); 373 386 FORMAT_CASE (PS1_DEV_2, PS1_DEV_2); 374 FORMAT_CASE (PS1_DEV_3, PS1_DEV_3); 387 FORMAT_CASE (PS1_V1, PS1_V1); 388 389 // XXX not sure this was used, it was incomplete 390 // FORMAT_CASE (PS1_DEV_3, PS1_DEV_3); 391 375 392 # undef FORMAT_CASE 376 393 -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c
r19185 r21508 15 15 out[i].M = in[i].M; 16 16 out[i].Mcal = in[i].Mcal; 17 out[i].Map = in[i].Mgal;18 17 out[i].dM = in[i].dM; 19 18 out[i].dt = in[i].dt; … … 28 27 out[i].detID = in[i].detID; 29 28 out[i].imageID = in[i].imageID; 30 out[i]. qPSF = in[i].qPSF;29 out[i].psfQual = in[i].psfQual; 31 30 out[i].psfChisq = in[i].psfChisq; 32 31 out[i].crNsigma = in[i].crNsigma; … … 40 39 out[i].dbFlags = in[i].dbFlags; 41 40 out[i].photFlags = in[i].photFlags; 42 out[i].stargal = in[i].stargal; 43 out[i].dophot = in[i].dophot; 41 42 // changed or added for PS1_DEV_2 43 out[i].Map = in[i].Mgal; 44 out[i].dMcal = 0; 45 46 // changed or added for PS1_V1 47 out[i].photFlags = in[i].photFlags | (in[i].dophot << 16); 48 out[i].t_msec = 0; 49 out[i].extID = 0; 50 out[i].objID = 0; 51 out[i].catID = 0; 52 out[i].Mxx = 0.0; 53 out[i].Mxy = 0.0; 54 out[i].Myy = 0.0; 55 out[i].posangle = 0; 56 out[i].pltscale = 0; 57 out[i].psfNdof = 0; 58 out[i].psfNpix = 0; 44 59 } 45 60 return (out); … … 58 73 out[i].M = in[i].M; 59 74 out[i].Mcal = in[i].Mcal; 60 out[i].Mgal = in[i].Map;61 75 out[i].dM = in[i].dM; 62 76 out[i].dt = in[i].dt; … … 71 85 out[i].detID = in[i].detID; 72 86 out[i].imageID = in[i].imageID; 73 out[i]. qPSF = in[i].qPSF;87 out[i].psfQual = in[i].psfQual; 74 88 out[i].psfChisq = in[i].psfChisq; 75 89 out[i].crNsigma = in[i].crNsigma; … … 82 96 out[i].dYccd = in[i].dYccd; 83 97 out[i].dbFlags = in[i].dbFlags; 84 out[i].photFlags = in[i].photFlags; 85 out[i].stargal = in[i].stargal; 86 out[i].dophot = in[i].dophot; 98 99 // changed or added for PS1_DEV_2 100 out[i].Mgal = in[i].Map; 101 102 // changed or added for PS1_V1 103 out[i].photFlags = in[i].photFlags & 0x0000ffff; 104 out[i].dophot = in[i].photFlags >> 16; 87 105 } 88 106 return (out); … … 101 119 out[i].D = in[i].D; 102 120 out[i].Xp = in[i].Xp; 103 out[i].Nmeasure = in[i].Nm;104 out[i].Nmissing = in[i].Nn;105 out[i].code = in[i].code;106 out[i].measureOffset = in[i].offset;107 out[i].missingOffset = in[i].missing;108 121 out[i].dR = in[i].dR; 109 122 out[i].dD = in[i].dD; … … 116 129 out[i].objID = in[i].objID; 117 130 out[i].catID = in[i].catID; 131 132 // changed or added for PS1_DEV_2 133 out[i].Nmeasure = in[i].Nm; 134 out[i].Nmissing = in[i].Nn; 135 out[i].measureOffset = in[i].offset; 136 out[i].missingOffset = in[i].missing; 137 out[i].Nextend = 0; 138 out[i].extendOffset = 0; 139 140 // changed or added for PS1_V1 141 out[i].flags = in[i].code; 142 out[i].ChiSq = 0.0; 143 out[i].Npos = 0.0; 144 out[i].extID = 0; 118 145 } 119 146 return (out); … … 129 156 130 157 for (i = 0; i < Nvalues; i++) { 131 out[i].R = in[i].R; 132 out[i].D = in[i].D; 133 out[i].Xp = in[i].Xp; 134 out[i].Nm = in[i].Nmeasure; 135 out[i].Nn = in[i].Nmissing; 136 out[i].code = in[i].code; 137 out[i].offset = in[i].measureOffset; 138 out[i].missing = in[i].missingOffset; 139 out[i].dR = in[i].dR; 140 out[i].dD = in[i].dD; 141 out[i].uR = in[i].uR; 142 out[i].uD = in[i].uD; 143 out[i].duR = in[i].duR; 144 out[i].duD = in[i].duD; 145 out[i].P = in[i].P; 146 out[i].dP = in[i].dP; 147 out[i].objID = in[i].objID; 148 out[i].catID = in[i].catID; 158 out[i].R = in[i].R; 159 out[i].D = in[i].D; 160 out[i].Xp = in[i].Xp; 161 out[i].dR = in[i].dR; 162 out[i].dD = in[i].dD; 163 out[i].uR = in[i].uR; 164 out[i].uD = in[i].uD; 165 out[i].duR = in[i].duR; 166 out[i].duD = in[i].duD; 167 out[i].P = in[i].P; 168 out[i].dP = in[i].dP; 169 out[i].objID = in[i].objID; 170 out[i].catID = in[i].catID; 171 172 // changed or added for PS1_DEV_2 173 out[i].Nm = in[i].Nmeasure; 174 out[i].Nn = in[i].Nmissing; 175 out[i].offset = in[i].measureOffset; 176 out[i].missing = in[i].missingOffset; 177 178 // changed or added for PS1_V1 179 out[i].code = in[i].flags; 149 180 } 150 181 return (out); … … 164 195 out[i].Ncode = in[i].Ncode; 165 196 out[i].Nused = in[i].Nused; 197 198 // changed or added for PS1_V1 199 out[i].M_20 = 0; 200 out[i].M_80 = 0; 166 201 } 167 202 return (out); … … 218 253 out[i].fwhm_y = in[i].fwhm_y; 219 254 out[i].trate = in[i].trate; 220 out[i].code = in[i].code;221 255 out[i].ccdnum = in[i].ccdnum; 222 256 out[i].imageID = in[i].imageID; … … 237 271 out[i].Mxyyy = in[i].Mxyyy; 238 272 out[i].Myyyy = in[i].Myyyy; 273 274 // changed or added for PS1_DEV_2 275 out[i].externID = 0; 276 out[i].sourceID = 0; 277 278 // changed or added for PS1_V1 279 out[i].flags = in[i].code; 280 out[i].parentID = 0; 239 281 } 240 282 return (out); … … 275 317 out[i].fwhm_y = in[i].fwhm_y; 276 318 out[i].trate = in[i].trate; 277 out[i].code = in[i].code;278 319 out[i].ccdnum = in[i].ccdnum; 279 320 out[i].imageID = in[i].imageID; … … 294 335 out[i].Mxyyy = in[i].Mxyyy; 295 336 out[i].Myyyy = in[i].Myyyy; 337 338 // changed or added for PS1_V1 339 out[i].code = in[i].flags; 340 } 341 return (out); 342 } 343 344 PhotCode *PhotCode_PS1_DEV_1_To_Internal (PhotCode_PS1_DEV_1 *in, int Nvalues) { 345 346 int i; 347 PhotCode *out; 348 349 ALLOCATE (out, PhotCode, Nvalues); 350 351 for (i = 0; i < Nvalues; i++) { 352 strncpy (out[i].name, in[i].name, 31); // out[32], in[32] 353 out[i].name[31] = 0; // force termination 354 355 out[i].code = in[i].code; 356 out[i].type = in[i].type; 357 out[i].C = in[i].C; 358 out[i].dC = in[i].dC; 359 out[i].dX = in[i].dX; 360 out[i].K = in[i].K; 361 out[i].c1 = in[i].c1; 362 out[i].c2 = in[i].c2; 363 out[i].equiv = in[i].equiv; 364 out[i].Nc = in[i].Nc; 365 memcpy (out[i].X, in[i].X, 4*sizeof(float)); 366 367 out[i].astromErrMagScale = in[i].astromErrMagScale; 368 out[i].photomErrSys = in[i].photomErrSys; 369 370 // changed or added for PS1_DEV_2 371 out[i].astromErrSys = 0.0; 372 out[i].astromErrScale = 0.0; 373 374 // changed or added for PS1_V1 (also PS1_DEV_3, deprecated) 375 out[i].photomPoorMask = 0; 376 out[i].photomBadMask = 0; 377 out[i].astromPoorMask = 0; 378 out[i].astromBadMask = 0; 296 379 } 297 380 return (out); … … 323 406 out[i].astromErrMagScale = out[i].astromErrMagScale; 324 407 out[i].photomErrSys = out[i].photomErrSys; 325 326 } 327 return (out); 328 } 329 330 PhotCode *PhotCode_PS1_DEV_1_To_Internal (PhotCode_PS1_DEV_1 *in, int Nvalues) { 331 332 int i; 333 PhotCode *out; 334 335 ALLOCATE (out, PhotCode, Nvalues); 336 337 for (i = 0; i < Nvalues; i++) { 338 strncpy (out[i].name, in[i].name, 31); // out[32], in[32] 339 out[i].name[31] = 0; // force termination 340 341 out[i].code = in[i].code; 342 out[i].type = in[i].type; 343 out[i].C = in[i].C; 344 out[i].dC = in[i].dC; 345 out[i].dX = in[i].dX; 346 out[i].K = in[i].K; 347 out[i].c1 = in[i].c1; 348 out[i].c2 = in[i].c2; 349 out[i].equiv = in[i].equiv; 350 out[i].Nc = in[i].Nc; 351 352 // not defined in PS1_DEV_1 353 out[i].astromErrSys = 0.0; 354 out[i].astromErrScale = 0.0; 355 out[i].astromErrMagScale = in[i].astromErrMagScale; 356 out[i].photomErrSys = in[i].photomErrSys; 357 358 memcpy (out[i].X, in[i].X, 4*sizeof(float)); 359 360 out[i].photomPoorMask = 0; 361 out[i].photomBadMask = 0; 362 out[i].astromPoorMask = 0; 363 out[i].astromBadMask = 0; 364 } 365 return (out); 366 } 408 } 409 return (out); 410 } -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c
r19185 r21508 29 29 out[i].detID = in[i].detID; 30 30 out[i].imageID = in[i].imageID; 31 out[i]. qPSF = in[i].qPSF;31 out[i].psfQual = in[i].psfQual; 32 32 out[i].psfChisq = in[i].psfChisq; 33 33 out[i].crNsigma = in[i].crNsigma; … … 40 40 out[i].dYccd = in[i].dYccd; 41 41 out[i].dbFlags = in[i].dbFlags; 42 out[i].photFlags = in[i].photFlags; 43 out[i].stargal = in[i].stargal; 44 out[i].dophot = in[i].dophot; 42 43 // changed or added for PS1_V1 44 out[i].photFlags = in[i].photFlags | (in[i].dophot << 16); 45 out[i].t_msec = 0; 46 out[i].extID = 0; 47 out[i].objID = 0; 48 out[i].catID = 0; 49 out[i].Mxx = 0.0; 50 out[i].Mxy = 0.0; 51 out[i].Myy = 0.0; 52 out[i].posangle = 0; 53 out[i].pltscale = 0; 54 out[i].psfNdof = 0; 55 out[i].psfNpix = 0; 45 56 } 46 57 return (out); … … 73 84 out[i].detID = in[i].detID; 74 85 out[i].imageID = in[i].imageID; 75 out[i]. qPSF = in[i].qPSF;86 out[i].psfQual = in[i].psfQual; 76 87 out[i].psfChisq = in[i].psfChisq; 77 88 out[i].crNsigma = in[i].crNsigma; … … 84 95 out[i].dYccd = in[i].dYccd; 85 96 out[i].dbFlags = in[i].dbFlags; 86 out[i].photFlags = in[i].photFlags; 87 out[i].stargal = in[i].stargal; 88 out[i].dophot = in[i].dophot; 97 98 // changed or added for PS1_V1 99 out[i].photFlags = in[i].photFlags & 0x0000ffff; 100 out[i].dophot = in[i].photFlags >> 16; 89 101 } 90 102 return (out); … … 114 126 out[i].Nmissing = in[i].Nmissing; 115 127 out[i].Nextend = in[i].Nextend; 116 out[i].code = in[i].code;117 128 out[i].measureOffset = in[i].measureOffset; 118 129 out[i].missingOffset = in[i].missingOffset; … … 120 131 out[i].objID = in[i].objID; 121 132 out[i].catID = in[i].catID; 133 134 // changed or added for PS1_V1 135 out[i].flags = in[i].code; 136 out[i].ChiSq = 0.0; 137 out[i].Npos = 0.0; 138 out[i].extID = 0; 122 139 } 123 140 return (out); … … 147 164 out[i].Nmissing = in[i].Nmissing; 148 165 out[i].Nextend = in[i].Nextend; 149 out[i].code = in[i].code;150 166 out[i].measureOffset = in[i].measureOffset; 151 167 out[i].missingOffset = in[i].missingOffset; … … 153 169 out[i].objID = in[i].objID; 154 170 out[i].catID = in[i].catID; 171 172 // changed or added for PS1_V1 173 out[i].code = in[i].flags; 155 174 } 156 175 return (out); … … 170 189 out[i].Ncode = in[i].Ncode; 171 190 out[i].Nused = in[i].Nused; 191 192 // changed or added for PS1_V1 193 out[i].M_20 = 0; 194 out[i].M_80 = 0; 172 195 } 173 196 return (out); … … 201 224 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 202 225 203 strncpy (out[i].name, in[i].name, 63); // out[12 8], int[64]226 strncpy (out[i].name, in[i].name, 63); // out[121], int[64] 204 227 out[i].name[63] = 0; // force termination 205 228 … … 224 247 out[i].fwhm_y = in[i].fwhm_y; 225 248 out[i].trate = in[i].trate; 226 out[i].code = in[i].code;227 249 out[i].ccdnum = in[i].ccdnum; 228 250 out[i].imageID = in[i].imageID; … … 245 267 out[i].Mxyyy = in[i].Mxyyy; 246 268 out[i].Myyyy = in[i].Myyyy; 269 270 // changed or added for PS1_V1 271 out[i].flags = in[i].code; 272 out[i].parentID = 0; 247 273 } 248 274 return (out); … … 259 285 memcpy (&out[i].coords, &in[i].coords, sizeof(Coords)); 260 286 261 strncpy (out[i].name, in[i].name, 63); // in[12 8], out[64]287 strncpy (out[i].name, in[i].name, 63); // in[121], out[64] 262 288 out[i].name[63] = 0; // force termination 263 289 … … 282 308 out[i].fwhm_y = in[i].fwhm_y; 283 309 out[i].trate = in[i].trate; 284 out[i].code = in[i].code;285 310 out[i].ccdnum = in[i].ccdnum; 286 311 out[i].imageID = in[i].imageID; … … 303 328 out[i].Mxyyy = in[i].Mxyyy; 304 329 out[i].Myyyy = in[i].Myyyy; 305 } 306 return (out); 307 } 308 309 PhotCode_PS1_DEV_2 *PhotCode_Internal_To_PS1_DEV_2 (PhotCode *in, int Nvalues) { 310 311 int i; 312 PhotCode_PS1_DEV_2 *out; 313 314 ALLOCATE (out, PhotCode_PS1_DEV_2, Nvalues); 330 331 // changed or added for PS1_V1 332 out[i].code = in[i].flags; 333 } 334 return (out); 335 } 336 337 PhotCode *PhotCode_PS1_DEV_2_To_Internal (PhotCode_PS1_DEV_2 *in, int Nvalues) { 338 339 int i; 340 PhotCode *out; 341 342 ALLOCATE (out, PhotCode, Nvalues); 315 343 316 344 for (i = 0; i < Nvalues; i++) { … … 334 362 out[i].astromErrMagScale = in[i].astromErrMagScale; 335 363 out[i].photomErrSys = in[i].photomErrSys; 336 } 337 return (out); 338 } 339 340 PhotCode *PhotCode_PS1_DEV_2_To_Internal (PhotCode_PS1_DEV_2 *in, int Nvalues) { 341 342 int i; 343 PhotCode *out; 344 345 ALLOCATE (out, PhotCode, Nvalues); 364 365 // changed or added for PS1_V1 (also PS1_DEV_3, deprecated) 366 out[i].photomPoorMask = 0; 367 out[i].photomBadMask = 0; 368 out[i].astromPoorMask = 0; 369 out[i].astromBadMask = 0; 370 } 371 return (out); 372 } 373 374 PhotCode_PS1_DEV_2 *PhotCode_Internal_To_PS1_DEV_2 (PhotCode *in, int Nvalues) { 375 376 int i; 377 PhotCode_PS1_DEV_2 *out; 378 379 ALLOCATE (out, PhotCode_PS1_DEV_2, Nvalues); 346 380 347 381 for (i = 0; i < Nvalues; i++) { … … 365 399 out[i].astromErrMagScale = in[i].astromErrMagScale; 366 400 out[i].photomErrSys = in[i].photomErrSys; 367 368 out[i].photomPoorMask = 0; 369 out[i].photomBadMask = 0; 370 out[i].astromPoorMask = 0; 371 out[i].astromBadMask = 0; 372 } 373 return (out); 374 } 401 } 402 return (out); 403 } -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_3.c
r19185 r21508 3 3 /* convert PS1_DEV_3 formats to internal formats */ 4 4 5 // XXX EAM I am not yet ready to commit to a full PS1_DEV_3 release, but I am providingimage and photcode conversion5 // We only provide image and photcode conversion 6 6 7 7 Image *Image_PS1_DEV_3_ToInternal (Image_PS1_DEV_3 *in, int Nvalues) { … … 38 38 out[i].fwhm_y = in[i].fwhm_y; 39 39 out[i].trate = in[i].trate; 40 out[i].code = in[i].code;41 40 out[i].ccdnum = in[i].ccdnum; 42 41 out[i].imageID = in[i].imageID; … … 59 58 out[i].Mxyyy = in[i].Mxyyy; 60 59 out[i].Myyyy = in[i].Myyyy; 60 61 // changed or added for PS1_V1 62 out[i].flags = in[i].code; 63 out[i].parentID = 0; 61 64 } 62 65 return (out); … … 96 99 out[i].fwhm_y = in[i].fwhm_y; 97 100 out[i].trate = in[i].trate; 98 out[i].code = in[i].code;99 101 out[i].ccdnum = in[i].ccdnum; 100 102 out[i].imageID = in[i].imageID; … … 117 119 out[i].Mxyyy = in[i].Mxyyy; 118 120 out[i].Myyyy = in[i].Myyyy; 121 122 // changed or added for PS1_V1 123 out[i].code = in[i].flags; 124 } 125 return (out); 126 } 127 128 PhotCode *PhotCode_PS1_DEV_3_To_Internal (PhotCode_PS1_DEV_3 *in, int Nvalues) { 129 130 int i; 131 PhotCode *out; 132 133 ALLOCATE (out, PhotCode, Nvalues); 134 135 for (i = 0; i < Nvalues; i++) { 136 strncpy (out[i].name, in[i].name, 31); // out[32], in[32] 137 out[i].name[31] = 0; // force termination 138 139 out[i].code = in[i].code; 140 out[i].type = in[i].type; 141 out[i].C = in[i].C; 142 out[i].dC = in[i].dC; 143 out[i].dX = in[i].dX; 144 out[i].K = in[i].K; 145 out[i].c1 = in[i].c1; 146 out[i].c2 = in[i].c2; 147 out[i].equiv = in[i].equiv; 148 out[i].Nc = in[i].Nc; 149 memcpy (out[i].X, in[i].X, 4*sizeof(float)); 150 151 out[i].astromErrSys = in[i].astromErrSys; 152 out[i].astromErrScale = in[i].astromErrScale; 153 out[i].astromErrMagScale = in[i].astromErrMagScale; 154 out[i].photomErrSys = in[i].photomErrSys; 155 156 out[i].photomPoorMask = in[i].photomPoorMask; 157 out[i].photomBadMask = in[i].photomBadMask; 158 out[i].astromPoorMask = in[i].astromPoorMask; 159 out[i].astromBadMask = in[i].astromBadMask; 119 160 } 120 161 return (out); … … 157 198 } 158 199 159 PhotCode *PhotCode_PS1_DEV_3_To_Internal (PhotCode_PS1_DEV_3 *in, int Nvalues) {160 161 int i;162 PhotCode *out;163 164 ALLOCATE (out, PhotCode, Nvalues);165 166 for (i = 0; i < Nvalues; i++) {167 strncpy (out[i].name, in[i].name, 31); // out[32], in[32]168 out[i].name[31] = 0; // force termination169 170 out[i].code = in[i].code;171 out[i].type = in[i].type;172 out[i].C = in[i].C;173 out[i].dC = in[i].dC;174 out[i].dX = in[i].dX;175 out[i].K = in[i].K;176 out[i].c1 = in[i].c1;177 out[i].c2 = in[i].c2;178 out[i].equiv = in[i].equiv;179 out[i].Nc = in[i].Nc;180 memcpy (out[i].X, in[i].X, 4*sizeof(float));181 182 out[i].astromErrSys = in[i].astromErrSys;183 out[i].astromErrScale = in[i].astromErrScale;184 out[i].astromErrMagScale = in[i].astromErrMagScale;185 out[i].photomErrSys = in[i].photomErrSys;186 187 out[i].photomPoorMask = in[i].photomPoorMask;188 out[i].photomBadMask = in[i].photomBadMask;189 out[i].astromPoorMask = in[i].astromPoorMask;190 out[i].astromBadMask = in[i].astromBadMask;191 }192 return (out);193 } -
trunk/Ohana/src/libdvo/src/dvo_convert_elixir.c
r19185 r21508 10 10 11 11 for (i = 0; i < Nvalues; i++) { 12 out[i].FWx = in[i].FWx; 13 out[i].t = in[i].t; 14 out[i].averef = in[i].averef; 15 16 // changed for PANSTARRS_DEV_0 12 17 out[i].dR = (in[i].dR == NAN_S_SHORT) ? NAN : in[i].dR * 0.01; 13 18 out[i].dD = (in[i].dD == NAN_S_SHORT) ? NAN : in[i].dD * 0.01; … … 16 21 out[i].dt = (in[i].dt == NAN_S_SHORT) ? NAN : in[i].dt * 0.001; 17 22 out[i].Mcal = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 18 19 // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture20 // magnitudes. Most uses of Mgal in the past were actually aperture (isophotal) mags21 23 out[i].Map = (in[i].Mgal == NAN_S_SHORT) ? NAN : in[i].Mgal * 0.001; 22 24 out[i].airmass = (in[i].airmass == NAN_S_SHORT) ? NAN : in[i].airmass* 0.001; 23 out[i].FWx = in[i].FWx;24 25 out[i].FWy = in[i].fwy * in[i].FWx * 0.01; 25 26 out[i].theta = in[i].theta*(0x10000 / 0x100); 26 out[i].dophot = in[i].dophot;27 27 out[i].photcode = in[i].source; 28 out[i].t = in[i].t;29 out[i].averef = in[i].averef;30 out[i].dbFlags = in[i].flags;31 28 32 /* these can be determined if needed / desired */ 33 out[i].Xccd = 0; 34 out[i].Yccd = 0; 35 out[i].dXccd = 0; 36 out[i].dYccd = 0; 37 38 /* these do not have a corresponding value */ 29 // added for PANSTARRS_DEV_0 30 out[i].Xccd = 0; // determine on-the-fly 31 out[i].Yccd = 0; // determine on-the-fly 32 out[i].dXccd = 0; 33 out[i].dYccd = 0; 39 34 out[i].az = 0; 40 out[i].stargal = 0;41 35 out[i].Sky = 0; 42 36 out[i].dSky = 0; 43 out[i]. qPSF= 0;37 out[i].psfQual = 0; 44 38 out[i].psfChisq = 0; 45 39 out[i].crNsigma = 0; 46 40 out[i].extNsigma = 0; 47 out[i].photFlags = 0; 48 49 /* XXX add these later */ 50 out[i].detID = 0; 51 out[i].imageID = 0; 41 out[i].detID = 0; // determine on-the-fly 42 out[i].imageID = 0; // determine on-the-fly 43 44 // changed or added for PS1_DEV_1 (2008.02.26) 45 out[i].dbFlags = in[i].flags; 46 out[i].detID = 0; 47 out[i].imageID = 0; 48 49 // changed or added for PS1_DEV_2 50 out[i].Map = in[i].Mgal; 51 out[i].dMcal = 0; 52 53 // changed or added for PS1_V1 54 out[i].photFlags = in[i].dophot << 16; 55 out[i].t_msec = 0; 56 out[i].extID = 0; 57 out[i].objID = 0; 58 out[i].catID = 0; 59 out[i].Mxx = 0.0; 60 out[i].Mxy = 0.0; 61 out[i].Myy = 0.0; 62 out[i].posangle = 0; 63 out[i].pltscale = 0; 64 out[i].psfNdof = 0; 65 out[i].psfNpix = 0; 52 66 } 53 67 return (out); … … 63 77 64 78 for (i = 0; i < Nvalues; i++) { 79 out[i].FWx = in[i].FWx; 80 out[i].t = in[i].t; 81 out[i].averef = in[i].averef; 82 83 // changed for PANSTARRS_DEV_0 65 84 out[i].dR = isnan(in[i].dR ) ? NAN_S_SHORT : in[i].dR * 100.0; 66 85 out[i].dD = isnan(in[i].dD ) ? NAN_S_SHORT : in[i].dD * 100.0; … … 71 90 out[i].Mgal = isnan(in[i].Map ) ? NAN_S_SHORT : in[i].Map * 1000.0; 72 91 out[i].airmass = isnan(in[i].airmass) ? NAN_S_SHORT : in[i].airmass * 1000.0; 92 out[i].fwy = in[i].FWy * 100.0 / in[i].FWx; 93 out[i].theta = in[i].theta*(0x100/ 0x10000); 94 out[i].source = in[i].photcode; 73 95 74 96 if (out[i].M < 0) { … … 76 98 } 77 99 78 out[i].FWx = in[i].FWx; 79 out[i].fwy = in[i].FWy * 100.0 / in[i].FWx; 80 out[i].theta = in[i].theta*(0x100/ 0x10000); 81 out[i].dophot = in[i].dophot; 82 out[i].source = in[i].photcode; 83 out[i].t = in[i].t; 84 out[i].averef = in[i].averef; 100 // changed or added for PS1_DEV_1 (2008.02.26) 85 101 out[i].flags = in[i].dbFlags; 102 103 // changed or added for PS1_V1 104 out[i].dophot = in[i].photFlags >> 16; 86 105 } 87 106 return (out); … … 101 120 out[i].D = in[i].D; 102 121 out[i].Xp = in[i].Xp; 103 out[i].Nmeasure = in[i].Nm; 104 out[i].Nmissing = in[i].Nn; 105 out[i].code = in[i].code; 106 out[i].measureOffset = in[i].offset; 107 out[i].missingOffset = in[i].missing; 108 109 /* these don't exist in Elixir */ 122 123 // changed for PANSTARRS_DEV_0 (moved from Average to Measure) 124 primary[0][i].M = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001; 125 primary[0][i].dM = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM * 0.001; 126 primary[0][i].Xm = in[i].Xm; 127 128 primary[0][i].Ncode = 0; 129 primary[0][i].Nused = 0; 130 131 // added for PANSTARRS_DEV_0 110 132 out[i].dR = 0; 111 133 out[i].dD = 0; … … 116 138 out[i].P = 0; 117 139 out[i].dP = 0; 118 119 /* XXX add these later */ 120 out[i].objID = 0; 121 out[i].catID = 0; 122 123 primary[0][i].M = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001; 124 primary[0][i].dM = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM * 0.001; 125 primary[0][i].Xm = in[i].Xm; 126 primary[0][i].Ncode = 0; 127 primary[0][i].Nused = 0; 140 out[i].objID = 0; // determine on-the-fly 141 out[i].catID = 0; // determine on-the-fly 142 143 // changed or added for PS1_DEV_2 144 out[i].Nmeasure = in[i].Nm; 145 out[i].Nmissing = in[i].Nn; 146 out[i].measureOffset = in[i].offset; 147 out[i].missingOffset = in[i].missing; 148 out[i].Nextend = 0; 149 out[i].extendOffset = 0; 150 151 // changed or added for PS1_V1 152 out[i].flags = in[i].code; 153 out[i].ChiSq = 0.0; 154 out[i].Npos = 0.0; 155 out[i].extID = 0; 128 156 } 129 157 return (out); … … 142 170 out[i].D = in[i].D; 143 171 out[i].Xp = in[i].Xp; 144 out[i].Nm = in[i].Nmeasure; 145 out[i].Nn = in[i].Nmissing; 146 out[i].code = in[i].code; 147 out[i].offset = in[i].measureOffset; 148 out[i].missing = in[i].missingOffset; 149 172 173 // changed for PANSTARRS_DEV_0 (moved from Average to Measure) 150 174 out[i].M = isnan(primary[i].M) ? NAN_S_SHORT : primary[i].M * 1000.0; 151 175 out[i].dM = isnan(primary[i].dM) ? NAN_S_SHORT : primary[i].dM * 1000.0; 152 176 out[i].Xm = primary[i].Xm; 177 178 // changed or added for PS1_DEV_2 179 out[i].Nm = in[i].Nmeasure; 180 out[i].Nn = in[i].Nmissing; 181 out[i].offset = in[i].measureOffset; 182 out[i].missing = in[i].missingOffset; 183 184 // changed or added for PS1_V1 185 out[i].code = in[i].flags; 153 186 } 154 187 return (out); … … 164 197 165 198 for (i = 0; i < Nvalues; i++) { 199 out[i].Xm = in[i].Xm; 200 201 // added or changed for PANSTARRS_DEV_0 166 202 out[i].M = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001; 167 203 out[i].dM = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM * 0.001; 168 out[i].Xm = in[i].Xm;169 204 out[i].Ncode = 0; 170 205 out[i].Nused = 0; 206 207 // changed or added for PS1_V1 208 out[i].M_20 = 0; 209 out[i].M_80 = 0; 171 210 } 172 211 return (out); … … 182 221 183 222 for (i = 0; i < Nvalues; i++) { 223 out[i].Xm = in[i].Xm; 224 225 // added or changed for PANSTARRS_DEV_0 184 226 out[i].M = isnan(in[i].M) ? NAN_S_SHORT : in[i].M * 1000.0; 185 227 out[i].dM = isnan(in[i].dM) ? NAN_S_SHORT : in[i].dM * 1000.0; 186 out[i].Xm = in[i].Xm;187 228 } 188 229 return (out); … … 207 248 out[i].NX = in[i].NX; 208 249 out[i].NY = in[i].NY; 209 out[i].secz = (in[i].secz == NAN_S_SHORT) ? NAN : in[i].secz * 0.001;210 out[i].apmifit = (in[i].apmifit == NAN_S_SHORT) ? NAN : in[i].apmifit * 0.001;211 out[i].dapmifit = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001;212 out[i].Mcal = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001;213 out[i].dMcal = (in[i].dMcal == NAN_S_SHORT) ? NAN : in[i].dMcal * 0.001;214 250 out[i].Xm = in[i].Xm; 215 251 out[i].photcode = in[i].source; … … 221 257 out[i].fwhm_y = in[i].fwhm_y; 222 258 out[i].trate = in[i].trate; 223 out[i].code = in[i].code;224 259 out[i].ccdnum = in[i].ccdnum; 225 260 … … 240 275 out[i].Myyyy = in[i].Myyyy; 241 276 242 /* XXX add these later */ 243 out[i].imageID = 0; 244 245 // not available in ELIXIR 277 // added or changed for PANSTARRS_DEV_0 278 out[i].secz = (in[i].secz == NAN_S_SHORT) ? NAN : in[i].secz * 0.001; 279 out[i].apmifit = (in[i].apmifit == NAN_S_SHORT) ? NAN : in[i].apmifit * 0.001; 280 out[i].dapmifit = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001; 281 out[i].Mcal = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 282 out[i].dMcal = (in[i].dMcal == NAN_S_SHORT) ? NAN : in[i].dMcal * 0.001; 246 283 out[i].sidtime = NAN; 247 284 out[i].latitude = NAN; 285 out[i].imageID = 0; // determine on-the-fly 286 287 // changed or added for PS1_DEV_2 288 out[i].externID = 0; 289 out[i].sourceID = 0; 290 291 // changed or added for PS1_V1 292 out[i].flags = in[i].code; 293 out[i].parentID = 0; 248 294 } 249 295 return (out); … … 268 314 out[i].NX = in[i].NX; 269 315 out[i].NY = in[i].NY; 270 out[i].secz = isnan(in[i].secz ) ? NAN_S_SHORT : in[i].secz * 1000.0; 271 out[i].apmifit = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit * 1000.0; 272 out[i].dapmifit = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0; 273 out[i].Mcal = isnan(in[i].Mcal ) ? NAN_S_SHORT : in[i].Mcal * 1000.0; 274 out[i].dMcal = isnan(in[i].dMcal ) ? NAN_S_SHORT : in[i].dMcal * 1000.0; 316 275 317 out[i].Xm = in[i].Xm; 276 318 out[i].source = in[i].photcode; … … 282 324 out[i].fwhm_y = in[i].fwhm_y; 283 325 out[i].trate = in[i].trate; 284 out[i].code = in[i].code;285 326 out[i].ccdnum = in[i].ccdnum; 286 327 … … 300 341 out[i].Mxyyy = in[i].Mxyyy; 301 342 out[i].Myyyy = in[i].Myyyy; 302 } 303 return (out); 304 } 305 306 PhotCode_Elixir *PhotCode_Internal_To_Elixir (PhotCode *in, int Nvalues) { 307 308 int i; 309 PhotCode_Elixir *out; 310 311 ALLOCATE (out, PhotCode_Elixir, Nvalues); 343 344 // added or changed for PANSTARRS_DEV_0 345 out[i].secz = isnan(in[i].secz ) ? NAN_S_SHORT : in[i].secz * 1000.0; 346 out[i].apmifit = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit * 1000.0; 347 out[i].dapmifit = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0; 348 out[i].Mcal = isnan(in[i].Mcal ) ? NAN_S_SHORT : in[i].Mcal * 1000.0; 349 out[i].dMcal = isnan(in[i].dMcal ) ? NAN_S_SHORT : in[i].dMcal * 1000.0; 350 351 // changed or added for PS1_V1 352 out[i].code = in[i].flags; 353 } 354 return (out); 355 } 356 357 PhotCode *PhotCode_Elixir_To_Internal (PhotCode_Elixir *in, int Nvalues) { 358 359 int i; 360 PhotCode *out; 361 362 ALLOCATE (out, PhotCode, Nvalues); 312 363 313 364 for (i = 0; i < Nvalues; i++) { … … 326 377 out[i].Nc = in[i].Nc; 327 378 memcpy (out[i].X, in[i].X, 4*sizeof(float)); 328 } 329 return (out); 330 } 331 332 PhotCode *PhotCode_Elixir_To_Internal (PhotCode_Elixir *in, int Nvalues) { 333 334 int i; 335 PhotCode *out; 336 337 ALLOCATE (out, PhotCode, Nvalues); 379 380 // changed or added for PS1_DEV_1 381 out[i].astromErrMagScale = 0.0; 382 out[i].photomErrSys = 0.0; 383 384 // changed or added for PS1_DEV_2 385 out[i].astromErrSys = 0.0; 386 out[i].astromErrScale = 0.0; 387 388 // changed or added for PS1_V1 (also PS1_DEV_3, deprecated) 389 out[i].photomPoorMask = 0; 390 out[i].photomBadMask = 0; 391 out[i].astromPoorMask = 0; 392 out[i].astromBadMask = 0; 393 } 394 return (out); 395 } 396 397 PhotCode_Elixir *PhotCode_Internal_To_Elixir (PhotCode *in, int Nvalues) { 398 399 int i; 400 PhotCode_Elixir *out; 401 402 ALLOCATE (out, PhotCode_Elixir, Nvalues); 338 403 339 404 for (i = 0; i < Nvalues; i++) { … … 352 417 out[i].Nc = in[i].Nc; 353 418 memcpy (out[i].X, in[i].X, 4*sizeof(float)); 354 355 // not defined in Elixir: 356 out[i].astromErrSys = 0.0; 357 out[i].astromErrScale = 0.0; 358 out[i].astromErrMagScale = 0.0; 359 out[i].photomErrSys = 0.0; 360 361 out[i].photomPoorMask = 0; 362 out[i].photomBadMask = 0; 363 out[i].astromPoorMask = 0; 364 out[i].astromBadMask = 0; 365 } 366 return (out); 367 } 419 } 420 return (out); 421 } -
trunk/Ohana/src/libdvo/src/dvo_convert_loneos.c
r19185 r21508 10 10 11 11 for (i = 0; i < Nvalues; i++) { 12 out[i].dR = (in[i].dR == NAN_S_SHORT) ? NAN : in[i].dR * 0.01; 13 out[i].dD = (in[i].dD == NAN_S_SHORT) ? NAN : in[i].dD * 0.01; 14 out[i].M = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001; 15 out[i].dM = (in[i].dM == NAN_U_CHAR) ? NAN : in[i].dM * 0.001; 16 out[i].Mcal = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 17 out[i].dophot = in[i].dophot; 18 out[i].photcode = in[i].source; 19 out[i].t = in[i].t; 20 21 /* flags and averef are now split */ 12 out[i].t = in[i].t; 13 14 // added or changed for ELIXIR 22 15 out[i].averef = in[i].averef & 0x00ffffff; 23 16 out[i].dbFlags = (in[i].averef & 0xff000000) >> 24; 24 25 /* these values don't exist in the Loneos format */ 26 27 // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture 28 // magnitudes. Most uses of Mgal in the past were actually aperture (isophotal) mags 29 out[i].Map = out[i].M; 17 out[i].t = in[i].t; 30 18 out[i].dt = 0; 31 19 out[i].airmass = 0; 20 out[i].FWy = 0; 21 out[i].FWx = 0; 22 out[i].theta = 0; 23 24 // changed for PANSTARRS_DEV_0 25 out[i].dR = (in[i].dR == NAN_S_SHORT) ? NAN : in[i].dR * 0.01; 26 out[i].dD = (in[i].dD == NAN_S_SHORT) ? NAN : in[i].dD * 0.01; 27 out[i].M = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001; 28 out[i].dM = (in[i].dM == NAN_U_CHAR) ? NAN : in[i].dM * 0.001; 29 out[i].Mcal = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 30 out[i].Map = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001; 31 out[i].photcode = in[i].source; 32 33 // added for PANSTARRS_DEV_0 34 out[i].Xccd = 0; // determine on-the-fly 35 out[i].Yccd = 0; // determine on-the-fly 36 out[i].dXccd = 0; 37 out[i].dYccd = 0; 32 38 out[i].az = 0; 33 out[i].FWx = 0;34 out[i].FWy = 0;35 out[i].theta = 0;36 out[i].stargal = 0;37 39 out[i].Sky = 0; 38 40 out[i].dSky = 0; 39 out[i]. qPSF= 0;41 out[i].psfQual = 0; 40 42 out[i].psfChisq = 0; 41 43 out[i].crNsigma = 0; 42 44 out[i].extNsigma = 0; 43 out[i].photFlags = 0; 44 45 /* these can be determined if needed / desired */ 46 out[i].Xccd = 0; 47 out[i].Yccd = 0; 48 out[i].dXccd = 0; 49 out[i].dYccd = 0; 50 51 /* XXX add these later */ 52 out[i].detID = 0; 53 out[i].imageID = 0; 45 out[i].detID = 0; // determine on-the-fly 46 out[i].imageID = 0; // determine on-the-fly 47 48 // changed or added for PS1_DEV_1 (2008.02.26) 49 out[i].detID = 0; 50 out[i].imageID = 0; 51 52 // changed or added for PS1_DEV_2 53 out[i].dMcal = 0; 54 55 // changed or added for PS1_V1 56 out[i].photFlags = in[i].dophot << 16; 57 out[i].t_msec = 0; 58 out[i].extID = 0; 59 out[i].objID = 0; 60 out[i].catID = 0; 61 out[i].Mxx = 0.0; 62 out[i].Mxy = 0.0; 63 out[i].Myy = 0.0; 64 out[i].posangle = 0; 65 out[i].pltscale = 0; 66 out[i].psfNdof = 0; 67 out[i].psfNpix = 0; 54 68 } 55 69 return (out); … … 65 79 66 80 for (i = 0; i < Nvalues; i++) { 81 82 // changed for PANSTARRS_DEV_0 67 83 out[i].dR = isnan(in[i].dR ) ? NAN_S_SHORT : in[i].dR * 100.0; 68 84 out[i].dD = isnan(in[i].dD ) ? NAN_S_SHORT : in[i].dD * 100.0; … … 70 86 out[i].dM = isnan(in[i].dM ) ? NAN_U_CHAR : in[i].dM * 1000.0; 71 87 out[i].Mcal = isnan(in[i].Mcal ) ? NAN_S_SHORT : in[i].Mcal * 1000.0; 72 out[i].dophot = in[i].dophot;73 88 out[i].source = in[i].photcode; 74 89 out[i].t = in[i].t; … … 76 91 /* flags and averef are merged in Loneos */ 77 92 out[i].averef = (in[i].averef & 0x00ffffff) | (in[i].dbFlags << 24); 93 94 // changed or added for PS1_V1 95 out[i].dophot = in[i].photFlags >> 16; 78 96 } 79 97 return (out); … … 93 111 out[i].D = in[i].D; 94 112 out[i].Xp = in[i].Xp; 95 out[i].Nmeasure = in[i].Nm; 96 out[i].Nmissing = in[i].Nn; 97 out[i].code = in[i].code; 98 out[i].measureOffset = in[i].offset; 99 out[i].missingOffset = in[i].missing; 100 101 /* these don't exist in Loneos */ 113 114 // added for ELIXIR 115 primary[0][i].dM = NAN; 116 117 // changed for PANSTARRS_DEV_0 (moved from Average to Measure) 118 primary[0][i].M = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001; 119 primary[0][i].Xm = in[i].Xm; 120 primary[0][i].Ncode = 0; 121 primary[0][i].Nused = 0; 122 123 // added for PANSTARRS_DEV_0 102 124 out[i].dR = 0; 103 125 out[i].dD = 0; … … 108 130 out[i].P = 0; 109 131 out[i].dP = 0; 110 111 /* XXX add these later */ 112 out[i].objID = 0; 113 out[i].catID = 0; 114 115 primary[0][i].M = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001; 116 primary[0][i].Xm = in[i].Xm; 117 primary[0][i].dM = NAN; 118 primary[0][i].Ncode = 0; 119 primary[0][i].Nused = 0; 132 out[i].objID = 0; // determine on-the-fly 133 out[i].catID = 0; // determine on-the-fly 134 135 // changed or added for PS1_DEV_2 136 out[i].Nmeasure = in[i].Nm; 137 out[i].Nmissing = in[i].Nn; 138 out[i].measureOffset = in[i].offset; 139 out[i].missingOffset = in[i].missing; 140 out[i].Nextend = 0; 141 out[i].extendOffset = 0; 142 143 // changed or added for PS1_V1 144 out[i].flags = in[i].code; 145 out[i].ChiSq = 0.0; 146 out[i].Npos = 0.0; 147 out[i].extID = 0; 120 148 } 121 149 return (out); … … 134 162 out[i].D = in[i].D; 135 163 out[i].Xp = in[i].Xp; 164 165 // changed for PANSTARRS_DEV_0 (moved from Average to Measure) 166 out[i].M = isnan(primary[i].M) ? NAN_S_SHORT : primary[i].M * 1000.0; 167 out[i].Xm = primary[i].Xm; 168 169 // changed or added for PS1_DEV_2 136 170 out[i].Nm = in[i].Nmeasure; 137 171 out[i].Nn = in[i].Nmissing; 138 out[i].code = in[i].code;139 172 out[i].offset = in[i].measureOffset; 140 173 out[i].missing = in[i].missingOffset; 141 174 142 out[i].M = isnan(primary[i].M) ? NAN_S_SHORT : primary[i].M * 1000.0;143 out[i]. Xm = primary[i].Xm;175 // changed or added for PS1_V1 176 out[i].code = in[i].flags; 144 177 } 145 178 return (out); … … 155 188 156 189 for (i = 0; i < Nvalues; i++) { 190 out[i].Xm = in[i].Xm; 191 192 // added for ELIXIR 193 out[i].dM = NAN; 194 195 // added or changed for PANSTARRS_DEV_0 157 196 out[i].M = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001; 158 out[i].Xm = in[i].Xm;159 out[i].dM = NAN;160 197 out[i].Ncode = 0; 161 198 out[i].Nused = 0; 199 200 // changed or added for PS1_V1 201 out[i].M_20 = 0; 202 out[i].M_80 = 0; 162 203 } 163 204 return (out); … … 173 214 174 215 for (i = 0; i < Nvalues; i++) { 216 out[i].Xm = in[i].Xm; 217 218 // added or changed for PANSTARRS_DEV_0 175 219 out[i].M = isnan(in[i].M) ? NAN_S_SHORT : in[i].M * 1000.0; 176 out[i].Xm = in[i].Xm;177 220 } 178 221 return (out); … … 197 240 out[i].NX = in[i].NX; 198 241 out[i].NY = in[i].NY; 199 200 out[i].secz = (in[i].secz == NAN_S_SHORT) ? NAN : in[i].secz * 0.001;201 out[i].apmifit = (in[i].apmifit == NAN_S_SHORT) ? NAN : in[i].apmifit * 0.001;202 out[i].dapmifit = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001;203 out[i].Mcal = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001;204 out[i].dMcal = (in[i].dMcal == NAN_S_SHORT) ? NAN : in[i].dMcal * 0.001;205 242 206 243 out[i].Xm = in[i].Xm; … … 213 250 out[i].fwhm_y = in[i].fwhm_y; 214 251 out[i].trate = in[i].trate; 215 out[i].code = in[i].code;216 252 out[i].ccdnum = in[i].ccdnum; 253 217 254 out[i].order = in[i].order; 218 255 out[i].Mx = in[i].Mx; … … 231 268 out[i].Myyyy = in[i].Myyyy; 232 269 233 /* XXX add these later */ 234 out[i].imageID = 0; 270 // added or changed for PANSTARRS_DEV_0 271 out[i].secz = (in[i].secz == NAN_S_SHORT) ? NAN : in[i].secz * 0.001; 272 out[i].apmifit = (in[i].apmifit == NAN_S_SHORT) ? NAN : in[i].apmifit * 0.001; 273 out[i].dapmifit = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001; 274 out[i].Mcal = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 275 out[i].dMcal = (in[i].dMcal == NAN_S_SHORT) ? NAN : in[i].dMcal * 0.001; 276 out[i].sidtime = NAN; 277 out[i].latitude = NAN; 278 out[i].imageID = 0; // determine on-the-fly 279 280 // changed or added for PS1_DEV_2 281 out[i].externID = 0; 282 out[i].sourceID = 0; 283 284 // changed or added for PS1_V1 285 out[i].flags = in[i].code; 286 out[i].parentID = 0; 235 287 } 236 288 return (out); … … 255 307 out[i].NX = in[i].NX; 256 308 out[i].NY = in[i].NY; 257 258 out[i].secz = isnan(in[i].secz ) ? NAN_S_SHORT : in[i].secz * 1000.0;259 out[i].apmifit = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit * 1000.0;260 out[i].dapmifit = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0;261 out[i].Mcal = isnan(in[i].Mcal ) ? NAN_S_SHORT : in[i].Mcal * 1000.0;262 out[i].dMcal = isnan(in[i].dMcal ) ? NAN_S_SHORT : in[i].dMcal * 1000.0;263 309 264 310 out[i].Xm = in[i].Xm; … … 271 317 out[i].fwhm_y = in[i].fwhm_y; 272 318 out[i].trate = in[i].trate; 273 out[i].code = in[i].code;274 319 out[i].ccdnum = in[i].ccdnum; 320 275 321 out[i].order = in[i].order; 276 322 out[i].Mx = in[i].Mx; … … 288 334 out[i].Mxyyy = in[i].Mxyyy; 289 335 out[i].Myyyy = in[i].Myyyy; 290 } 291 return (out); 292 } 336 337 // added or changed for PANSTARRS_DEV_0 338 out[i].secz = isnan(in[i].secz ) ? NAN_S_SHORT : in[i].secz * 1000.0; 339 out[i].apmifit = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit * 1000.0; 340 out[i].dapmifit = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0; 341 out[i].Mcal = isnan(in[i].Mcal ) ? NAN_S_SHORT : in[i].Mcal * 1000.0; 342 out[i].dMcal = isnan(in[i].dMcal ) ? NAN_S_SHORT : in[i].dMcal * 1000.0; 343 344 // changed or added for PS1_V1 345 out[i].code = in[i].flags; 346 } 347 return (out); 348 } -
trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c
r19185 r21508 16 16 out[i].Mcal = in[i].Mcal; 17 17 18 // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture19 // magnitudes. Most uses of Mgal in the past were actually aperture (isophotal) mags20 out[i].Map = in[i].Mgal;21 18 out[i].airmass = in[i].airmass; 22 19 out[i].az = in[i].az; … … 25 22 out[i].FWy = in[i].FWy; 26 23 out[i].theta = in[i].theta; 27 out[i].dophot = in[i].dophot;28 24 out[i].photcode = in[i].photcode; 29 25 out[i].t = in[i].t; 30 26 out[i].averef = in[i].averef; 31 out[i].dbFlags = in[i].flags;32 27 out[i].Xccd = in[i].Xccd; 33 28 out[i].Yccd = in[i].Yccd; 34 29 out[i].dXccd = in[i].dXccd; 35 30 out[i].dYccd = in[i].dYccd; 36 out[i].stargal = in[i].stargal;37 31 out[i].Sky = in[i].Sky; 38 32 out[i].dSky = in[i].dSky; 39 out[i].qPSF = (in[i].qPSF == NAN_S_SHORT) ? NAN : in[i].qPSF; 33 34 // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture 35 // magnitudes. Most uses of Mgal in the past were actually aperture (isophotal) mags 36 37 // changed or added for PS1_DEV_1 (2008.02.26) 38 out[i].psfQual = (in[i].psfQual == NAN_S_SHORT) ? NAN : in[i].psfQual; 39 out[i].dbFlags = in[i].flags; 40 40 out[i].detID = in[i].detID_lo; 41 41 out[i].imageID = in[i].imageID_lo; 42 43 // these don't have a correspondence 44 out[i].psfChisq = 0; 45 out[i].crNsigma = 0; 46 out[i].extNsigma = 0; 47 out[i].photFlags = 0; 42 out[i].psfChisq = 0; 43 out[i].crNsigma = 0; 44 out[i].extNsigma = 0; 45 46 // changed or added for PS1_DEV_2 47 out[i].Map = in[i].Mgal; 48 out[i].dMcal = 0; 49 50 // changed or added for PS1_V1 51 out[i].photFlags = in[i].dophot << 16; 52 out[i].t_msec = 0; 53 out[i].extID = 0; 54 out[i].objID = 0; 55 out[i].catID = 0; 56 out[i].Mxx = 0.0; 57 out[i].Mxy = 0.0; 58 out[i].Myy = 0.0; 59 out[i].posangle = 0; 60 out[i].pltscale = 0; 61 out[i].psfNdof = 0; 62 out[i].psfNpix = 0; 48 63 } 49 64 return (out); … … 64 79 out[i].dM = in[i].dM; 65 80 out[i].Mcal = in[i].Mcal; 66 out[i].Mgal = in[i].Map;67 81 out[i].airmass = in[i].airmass; 68 82 out[i].az = in[i].az; … … 71 85 out[i].FWy = in[i].FWy; 72 86 out[i].theta = in[i].theta; 73 out[i].dophot = in[i].dophot;74 87 out[i].photcode = in[i].photcode; 75 88 out[i].t = in[i].t; 76 89 out[i].averef = in[i].averef; 77 out[i].flags = in[i].dbFlags;78 90 out[i].Xccd = in[i].Xccd; 79 91 out[i].Yccd = in[i].Yccd; 80 92 out[i].dXccd = in[i].dXccd; 81 93 out[i].dYccd = in[i].dYccd; 82 out[i].stargal = in[i].stargal;83 94 out[i].Sky = in[i].Sky; 84 95 out[i].dSky = in[i].dSky; 85 out[i].qPSF = isnan(in[i].qPSF) ? NAN_S_SHORT : in[i].qPSF; 96 97 // changed or added for PS1_DEV_1 (2008.02.26) 98 out[i].flags = in[i].dbFlags; 99 out[i].psfQual = isnan(in[i].psfQual) ? NAN_S_SHORT : in[i].psfQual; 86 100 out[i].detID_hi = 0; 87 101 out[i].detID_lo = in[i].detID; 88 102 out[i].imageID_hi = 0; 89 103 out[i].imageID_lo = in[i].imageID; 104 105 // changed or added for PS1_DEV_2 106 out[i].Mgal = in[i].Map; 107 108 // changed or added for PS1_V1 109 // out[i].photFlags = in[i].photFlags & 0x0000ffff; (only dophot pre PS1_DEV_1) 110 out[i].dophot = in[i].photFlags >> 16; 90 111 } 91 112 return (out); … … 105 126 out[i].D = in[i].D; 106 127 out[i].Xp = in[i].Xp; 107 out[i].Nmeasure = in[i].Nm;108 out[i].Nmissing = in[i].Nn;109 out[i].code = in[i].code;110 out[i].measureOffset = in[i].offset;111 out[i].missingOffset = in[i].missing;112 128 out[i].dR = in[i].dR; 113 129 out[i].dD = in[i].dD; … … 120 136 out[i].objID = in[i].objID; 121 137 out[i].catID = in[i].catID; 138 139 // changed or added for PS1_DEV_2 140 out[i].Nmeasure = in[i].Nm; 141 out[i].Nmissing = in[i].Nn; 142 out[i].measureOffset = in[i].offset; 143 out[i].missingOffset = in[i].missing; 144 out[i].Nextend = 0; 145 out[i].extendOffset = 0; 146 147 // changed or added for PS1_V1 148 out[i].flags = in[i].code; 149 out[i].ChiSq = 0.0; 150 out[i].Npos = 0.0; 151 out[i].extID = 0; 122 152 } 123 153 return (out); … … 137 167 out[i].D = in[i].D; 138 168 out[i].Xp = in[i].Xp; 139 out[i].Nm = in[i].Nmeasure;140 out[i].Nn = in[i].Nmissing;141 out[i].code = in[i].code;142 out[i].offset = in[i].measureOffset;143 out[i].missing = in[i].missingOffset;144 169 out[i].dR = in[i].dR; 145 170 out[i].dD = in[i].dD; … … 152 177 out[i].objID = in[i].objID; 153 178 out[i].catID = in[i].catID; 179 180 // changed or added for PS1_DEV_2 181 out[i].Nm = in[i].Nmeasure; 182 out[i].Nn = in[i].Nmissing; 183 out[i].offset = in[i].measureOffset; 184 out[i].missing = in[i].missingOffset; 185 186 // changed or added for PS1_V1 187 out[i].code = in[i].flags; 154 188 } 155 189 return (out); … … 170 204 out[i].Ncode = in[i].Ncode; 171 205 out[i].Nused = in[i].Nused; 206 207 // changed or added for PS1_V1 208 out[i].M_20 = 0; 209 out[i].M_80 = 0; 172 210 } 173 211 return (out); … … 226 264 out[i].fwhm_y = in[i].fwhm_y; 227 265 out[i].trate = in[i].trate; 228 out[i].code = in[i].code;229 266 out[i].ccdnum = in[i].ccdnum; 230 out[i].imageID = in[i].imageID_lo;231 267 232 268 out[i].order = in[i].order; … … 245 281 out[i].Mxyyy = in[i].Mxyyy; 246 282 out[i].Myyyy = in[i].Myyyy; 283 284 // changed or added for PS1_DEV_1 285 out[i].imageID = in[i].imageID_lo; 286 287 // changed or added for PS1_DEV_2 288 out[i].externID = 0; 289 out[i].sourceID = 0; 290 291 // changed or added for PS1_V1 292 out[i].flags = in[i].code; 293 out[i].parentID = 0; 247 294 } 248 295 return (out); … … 283 330 out[i].fwhm_y = in[i].fwhm_y; 284 331 out[i].trate = in[i].trate; 285 out[i].code = in[i].code;286 332 out[i].ccdnum = in[i].ccdnum; 287 out[i].imageID_hi = 0;288 out[i].imageID_lo = in[i].imageID;289 333 290 334 out[i].order = in[i].order; … … 303 347 out[i].Mxyyy = in[i].Mxyyy; 304 348 out[i].Myyyy = in[i].Myyyy; 305 } 306 return (out); 307 } 349 350 // changed or added for PS1_DEV_1 351 out[i].imageID_hi = 0; 352 out[i].imageID_lo = in[i].imageID; 353 354 // changed or added for PS1_V1 355 out[i].code = in[i].flags; 356 } 357 return (out); 358 } -
trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c
r19185 r21508 16 16 out[i].Mcal = in[i].Mcal; 17 17 18 // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture19 // magnitudes. Most uses of Mgal in the past were actually aperture (isophotal) mags20 out[i].Map = in[i].Mgal;21 18 out[i].airmass = in[i].airmass; 22 19 out[i].az = in[i].az; … … 25 22 out[i].FWy = in[i].FWy; 26 23 out[i].theta = in[i].theta; 27 out[i].dophot = in[i].dophot;28 24 out[i].photcode = in[i].photcode; 29 25 out[i].t = in[i].t; 30 26 out[i].averef = in[i].averef; 31 out[i].dbFlags = in[i].flags;32 27 out[i].Xccd = in[i].Xccd; 33 28 out[i].Yccd = in[i].Yccd; 34 29 out[i].dXccd = in[i].dXccd; 35 30 out[i].dYccd = in[i].dYccd; 36 out[i].stargal = in[i].stargal;37 31 out[i].Sky = in[i].Sky; 38 32 out[i].dSky = in[i].dSky; 39 out[i].qPSF = (in[i].qPSF == NAN_S_SHORT) ? NAN : in[i].qPSF; 33 34 // 2008.02.26 : I've renamed Mgal to Map, and intend it to be used per aperture 35 // magnitudes. Most uses of Mgal in the past were actually aperture (isophotal) mags 36 37 // changed or added for PS1_DEV_1 (2008.02.26) 38 out[i].psfQual = (in[i].psfQual == NAN_S_SHORT) ? NAN : in[i].psfQual; 39 out[i].dbFlags = in[i].flags; 40 40 out[i].detID = in[i].detID_lo; 41 41 out[i].imageID = in[i].imageID_lo; 42 43 // these don't have a correspondence 44 out[i].psfChisq = 0; 45 out[i].crNsigma = 0; 46 out[i].extNsigma = 0; 47 out[i].photFlags = 0; 42 out[i].psfChisq = 0; 43 out[i].crNsigma = 0; 44 out[i].extNsigma = 0; 45 46 // changed or added for PS1_DEV_2 47 out[i].Map = in[i].Mgal; 48 out[i].dMcal = 0; 49 50 // changed or added for PS1_V1 51 out[i].photFlags = in[i].dophot << 16; 52 out[i].t_msec = 0; 53 out[i].extID = 0; 54 out[i].objID = 0; 55 out[i].catID = 0; 56 out[i].Mxx = 0.0; 57 out[i].Mxy = 0.0; 58 out[i].Myy = 0.0; 59 out[i].posangle = 0; 60 out[i].pltscale = 0; 61 out[i].psfNdof = 0; 62 out[i].psfNpix = 0; 48 63 } 49 64 return (out); … … 64 79 out[i].dM = in[i].dM; 65 80 out[i].Mcal = in[i].Mcal; 66 out[i].Mgal = in[i].Map;67 81 out[i].airmass = in[i].airmass; 68 82 out[i].az = in[i].az; … … 71 85 out[i].FWy = in[i].FWy; 72 86 out[i].theta = in[i].theta; 73 out[i].dophot = in[i].dophot;74 87 out[i].photcode = in[i].photcode; 75 88 out[i].t = in[i].t; 76 89 out[i].averef = in[i].averef; 77 out[i].flags = in[i].dbFlags;78 90 out[i].Xccd = in[i].Xccd; 79 91 out[i].Yccd = in[i].Yccd; 80 92 out[i].dXccd = in[i].dXccd; 81 93 out[i].dYccd = in[i].dYccd; 82 out[i].stargal = in[i].stargal;83 94 out[i].Sky = in[i].Sky; 84 95 out[i].dSky = in[i].dSky; 85 out[i].qPSF = isnan(in[i].qPSF) ? NAN_S_SHORT : in[i].qPSF; 96 97 // changed or added for PS1_DEV_1 (2008.02.26) 98 out[i].flags = in[i].dbFlags; 99 out[i].psfQual = isnan(in[i].psfQual) ? NAN_S_SHORT : in[i].psfQual; 86 100 out[i].detID_hi = 0; 87 101 out[i].detID_lo = in[i].detID; 88 102 out[i].imageID_hi = 0; 89 103 out[i].imageID_lo = in[i].imageID; 104 105 // changed or added for PS1_DEV_2 106 out[i].Mgal = in[i].Map; 107 108 // changed or added for PS1_V1 109 // out[i].photFlags = in[i].photFlags & 0x0000ffff; (only dophot pre PS1_DEV_1) 110 out[i].dophot = in[i].photFlags >> 16; 90 111 } 91 112 return (out); … … 105 126 out[i].D = in[i].D; 106 127 out[i].Xp = in[i].Xp; 107 out[i].Nmeasure = in[i].Nm;108 out[i].Nmissing = in[i].Nn;109 out[i].code = in[i].code;110 out[i].measureOffset = in[i].offset;111 out[i].missingOffset = in[i].missing;112 128 out[i].dR = in[i].dR; 113 129 out[i].dD = in[i].dD; … … 120 136 out[i].objID = in[i].objID; 121 137 out[i].catID = in[i].catID; 138 139 // changed or added for PS1_DEV_2 140 out[i].Nmeasure = in[i].Nm; 141 out[i].Nmissing = in[i].Nn; 142 out[i].measureOffset = in[i].offset; 143 out[i].missingOffset = in[i].missing; 144 out[i].Nextend = 0; 145 out[i].extendOffset = 0; 146 147 // changed or added for PS1_V1 148 out[i].flags = in[i].code; 149 out[i].ChiSq = 0.0; 150 out[i].Npos = 0.0; 151 out[i].extID = 0; 122 152 } 123 153 return (out); … … 137 167 out[i].D = in[i].D; 138 168 out[i].Xp = in[i].Xp; 139 out[i].Nm = in[i].Nmeasure;140 out[i].Nn = in[i].Nmissing;141 out[i].code = in[i].code;142 out[i].offset = in[i].measureOffset;143 out[i].missing = in[i].missingOffset;144 169 out[i].dR = in[i].dR; 145 170 out[i].dD = in[i].dD; … … 152 177 out[i].objID = in[i].objID; 153 178 out[i].catID = in[i].catID; 179 180 // changed or added for PS1_DEV_2 181 out[i].Nm = in[i].Nmeasure; 182 out[i].Nn = in[i].Nmissing; 183 out[i].offset = in[i].measureOffset; 184 out[i].missing = in[i].missingOffset; 185 186 // changed or added for PS1_V1 187 out[i].code = in[i].flags; 154 188 } 155 189 return (out); … … 170 204 out[i].Ncode = in[i].Ncode; 171 205 out[i].Nused = in[i].Nused; 206 207 // changed or added for PS1_V1 208 out[i].M_20 = 0; 209 out[i].M_80 = 0; 172 210 } 173 211 return (out); … … 226 264 out[i].fwhm_y = in[i].fwhm_y; 227 265 out[i].trate = in[i].trate; 228 out[i].code = in[i].code;229 266 out[i].ccdnum = in[i].ccdnum; 230 out[i].imageID = in[i].imageID_lo;231 267 232 268 out[i].order = in[i].order; … … 245 281 out[i].Mxyyy = in[i].Mxyyy; 246 282 out[i].Myyyy = in[i].Myyyy; 283 284 // changed or added for PS1_DEV_1 285 out[i].imageID = in[i].imageID_lo; 286 287 // changed or added for PS1_DEV_2 288 out[i].externID = 0; 289 out[i].sourceID = 0; 290 291 // changed or added for PS1_V1 292 out[i].flags = in[i].code; 293 out[i].parentID = 0; 247 294 } 248 295 return (out); … … 283 330 out[i].fwhm_y = in[i].fwhm_y; 284 331 out[i].trate = in[i].trate; 285 out[i].code = in[i].code;286 332 out[i].ccdnum = in[i].ccdnum; 287 out[i].imageID_hi = 0;288 out[i].imageID_lo = in[i].imageID;289 333 290 334 out[i].order = in[i].order; … … 303 347 out[i].Mxyyy = in[i].Mxyyy; 304 348 out[i].Myyyy = in[i].Myyyy; 305 } 306 return (out); 307 } 349 350 // changed or added for PS1_DEV_1 351 out[i].imageID_hi = 0; 352 out[i].imageID_lo = in[i].imageID; 353 354 // changed or added for PS1_V1 355 out[i].code = in[i].flags; 356 } 357 return (out); 358 } 359 360 // XXX no photcode conversions? this may be from before we had a photcode FITS table... 361 -
trunk/Ohana/src/libdvo/src/dvo_image.c
r19185 r21508 196 196 if (db[0].format == DVO_FORMAT_PS1_DEV_2) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_DEV_2"); 197 197 if (db[0].format == DVO_FORMAT_PS1_DEV_3) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_DEV_3"); 198 if (db[0].format == DVO_FORMAT_PS1_V1) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_V1"); 198 199 199 200 return; -
trunk/Ohana/src/libdvo/src/dvo_image_raw.c
r16810 r21508 54 54 if (db[0].format == DVO_FORMAT_PS1_DEV_1) ImageSize = sizeof(Image_PS1_DEV_1); 55 55 if (db[0].format == DVO_FORMAT_PS1_DEV_2) ImageSize = sizeof(Image_PS1_DEV_2); 56 if (db[0].format == DVO_FORMAT_PS1_DEV_3) ImageSize = sizeof(Image_PS1_DEV_3); 57 if (db[0].format == DVO_FORMAT_PS1_V1) ImageSize = sizeof(Image_PS1_V1); 56 58 57 59 /* check that filesize makes sense */ … … 78 80 if (db[0].format == DVO_FORMAT_PS1_DEV_1) gfits_table_mkheader_Image_PS1_DEV_1 (&db[0].theader); 79 81 if (db[0].format == DVO_FORMAT_PS1_DEV_2) gfits_table_mkheader_Image_PS1_DEV_2 (&db[0].theader); 82 if (db[0].format == DVO_FORMAT_PS1_DEV_3) gfits_table_mkheader_Image_PS1_DEV_3 (&db[0].theader); 83 if (db[0].format == DVO_FORMAT_PS1_V1) gfits_table_mkheader_Image_PS1_V1 (&db[0].theader); 80 84 81 85 /* read data from file */ -
trunk/Ohana/src/libdvo/src/dvosorts.c
r16040 r21508 46 46 } 47 47 48 void sort_stars_ra (Stars *stars, int N) {49 50 # define SWAPFUNC(A,B){ Stars tmp; tmp = stars[A]; stars[A] = stars[B]; stars[B] = tmp; }51 # define COMPARE(A,B)(stars[A].R < stars[B].R)52 53 OHANA_SORT (N, COMPARE, SWAPFUNC);54 55 # undef SWAPFUNC56 # undef COMPARE57 58 }59 60 48 void sort_regions (SkyRegion *region, int N) { 61 49 … … 70 58 } 71 59 60 # if (0) 61 // deprecated along with Stars as an autocode type 62 void sort_stars_ra (Stars *stars, int N) { 63 64 # define SWAPFUNC(A,B){ Stars tmp; tmp = stars[A]; stars[A] = stars[B]; stars[B] = tmp; } 65 # define COMPARE(A,B)(stars[A].R < stars[B].R) 66 67 OHANA_SORT (N, COMPARE, SWAPFUNC); 68 69 # undef SWAPFUNC 70 # undef COMPARE 71 72 } 73 # endif
Note:
See TracChangeset
for help on using the changeset viewer.
