Changeset 36630 for trunk/Ohana/src/libdvo
- Timestamp:
- Apr 1, 2014, 12:03:17 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
- 1 copied
-
. (modified) (1 prop)
-
Ohana/src/libdvo/Makefile (modified) (1 diff)
-
Ohana/src/libdvo/include/dvo.h (modified) (7 diffs)
-
Ohana/src/libdvo/include/dvodb.h (modified) (1 diff)
-
Ohana/src/libdvo/src/RegionHostTable.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/libdvo/src/RegionHostTable.c )
-
Ohana/src/libdvo/src/dbExtractAverages.c (modified) (3 diffs)
-
Ohana/src/libdvo/src/dbExtractMeasures.c (modified) (8 diffs)
-
Ohana/src/libdvo/src/dbFields.c (modified) (2 diffs)
-
Ohana/src/libdvo/src/dvo_catalog.c (modified) (2 diffs)
-
Ohana/src/libdvo/src/dvo_convert_PS1_V4.c (modified) (3 diffs)
-
Ohana/src/libdvo/src/dvo_photcode_ops.c (modified) (6 diffs)
-
Ohana/src/libdvo/src/dvo_tiny_values.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
trunk/Ohana/src/libdvo/Makefile
r36490 r36630 103 103 $(SRC)/ImageMetadata.$(ARCH).o \ 104 104 $(SRC)/ImageOps.$(ARCH).o \ 105 $(SRC)/RegionHostTable.$(ARCH).o \ 105 106 $(SRC)/match_image.$(ARCH).o \ 106 107 $(SRC)/db_utils.$(ARCH).o \ -
trunk/Ohana/src/libdvo/include/dvo.h
r36528 r36630 285 285 } HostTable; 286 286 287 // A RegionHost processes data for some region in parallel with other regions 288 typedef struct RegionHostInfo { 289 double Rmin; // (Rmin,Rmax),(Dmin,Dmax) arehard RA,DEC boundaries of the 290 double Rmax; // region for which each host is responsible. A given host 291 double Dmin; // calibrates the images for which the fiducial point (center) 292 double Dmax; // lands in the region, and all objects in the region 293 294 double RminCat; // (RminCat,RmaxCat),(DminCat,DmaxCat) are the region for which 295 double RmaxCat; // the catalogs need to be loaded : this is the outer bounds 296 double DminCat; // of the region containing all images completely 297 double DmaxCat; 298 299 char *hostname; 300 301 int hostID; // remove machine ID in SkyTable 302 int stdio[3]; // fd's for communication with the remote host 303 int pid; // remote process ID 304 int status; 305 IOBuffer stdout; 306 IOBuffer stderr; 307 308 off_t Nimage; 309 off_t NIMAGE; 310 Image *image; 311 off_t *imseq; 312 313 int *neighbors; // list of neighbor index values 314 int Nneighbors; // number of neighbors 315 char isNeighbor; // TRUE if I am a neighbor to the current region host 316 } RegionHostInfo; 317 318 typedef struct { 319 double Rmin; 320 double Rmax; 321 double Dmin; 322 double Dmax; 323 324 int Nhosts; 325 RegionHostInfo *hosts; 326 short *index; 327 } RegionHostTable; 328 287 329 // special-case function: 288 330 CMF_PS1_V2 *gfits_table_get_CMF_PS1_V1_Alt (FTable *ftable, off_t *Ndata, char *swapped); … … 385 427 uint32_t flags; 386 428 int catID; 429 int objID; 430 int nOwn; 387 431 } AverageTiny; 388 432 … … 410 454 short dYccd; 411 455 short dRsys; 456 char myDet; 412 457 } MeasureTiny; 413 458 … … 555 600 float *X; 556 601 float *Y; 602 int *nOwn; // relastro uses this to count owned detections per object 557 603 558 604 } Catalog; … … 616 662 float PhotInst (Measure *measure); 617 663 float PhotCat (Measure *measure); 618 float PhotAper (Measure *measure);619 float PhotKron (Measure *measure);620 664 float PhotSys (Measure *measure, Average *average, SecFilt *secfilt); 621 665 float PhotRel (Measure *measure, Average *average, SecFilt *secfilt); … … 623 667 float PhotAve (PhotCode *code, Average *average, SecFilt *secfilt); 624 668 float PhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure); 669 float PhotAveErr (PhotCode *code, Average *average, SecFilt *secfilt); 670 671 float PhotAperInst (Measure *measure); 672 float PhotAperCat (Measure *measure); 673 float PhotAperSys (Measure *measure, Average *average, SecFilt *secfilt); 674 float PhotAperRel (Measure *measure, Average *average, SecFilt *secfilt); 675 float PhotAperCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code); 676 float PhotAperAve (PhotCode *code, Average *average, SecFilt *secfilt); 677 float PhotAperRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure); 678 679 float PhotKronInst (Measure *measure); 680 float PhotKronCat (Measure *measure); 681 float PhotKronSys (Measure *measure, Average *average, SecFilt *secfilt); 682 float PhotKronRel (Measure *measure, Average *average, SecFilt *secfilt); 683 float PhotKronCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code); 684 float PhotKronAve (PhotCode *code, Average *average, SecFilt *secfilt); 685 float PhotKronRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure); 686 float PhotKronAveErr (PhotCode *code, Average *average, SecFilt *secfilt); 687 625 688 float PhotXm (PhotCode *code, Average *average, SecFilt *secfilt); 626 float PhotdM (PhotCode *code, Average *average, SecFilt *secfilt);627 628 float PhotAperInst (Measure *measure);629 float PhotAperAve (PhotCode *code, Average *average, SecFilt *secfilt);630 float PhotKronInst (Measure *measure);631 float PhotKronAve (PhotCode *code, Average *average, SecFilt *secfilt);632 float PhotKronAveErr (PhotCode *code, Average *average, SecFilt *secfilt);633 689 634 690 float PhotZeroPoint (Measure *measure, Average *average, SecFilt *secfilt); … … 855 911 void dvo_measureT_init (MeasureTiny *measure); 856 912 913 void InitRegionHosts (RegionHostInfo *hosts, int Nhosts, int NHOSTS); 914 void FreeRegionHosts (RegionHostInfo *hosts, int Nhosts); 915 void FreeRegionHostTable (RegionHostTable *table); 916 RegionHostTable *RegionHostTableLoad (char *catdir, char *rootname); 917 int RegionHostTableWaitJobs (RegionHostTable *regionHosts, char *file, int lineno); 918 int RegionHostTableWaitJobsGetIO (RegionHostTable *regionHosts, char *file, int lineno, int VERBOSE); 919 int RegionHostFindNeighbors (RegionHostTable *table, int Nhost); 920 857 921 # endif // DVO_H -
trunk/Ohana/src/libdvo/include/dvodb.h
r36490 r36630 23 23 /* magnitude types */ 24 24 enum {MAG_NONE, 25 MAG_INST, 26 MAG_CAT, 27 MAG_APER, 28 MAG_APER_INST, 29 MAG_KRON, 30 MAG_KRON_INST, 31 MAG_KRON_ERR, 32 MAG_SYS, 33 MAG_REL, 34 MAG_CAL, 25 26 // these magnitude types are from the measurement table (or derived therein) 27 // the following imply PSF magnitudes: 28 MAG_INST, // -2.5*log(DN) [ie, not DN/sec] 29 MAG_CAT, // MAG_INST + 2.5*log(exptime) + C_lambda + K_lambda*(airmass - 1) 30 MAG_SYS, // MAG_CAT + \sum_i A_i * (color_i - color_o) [color correction for measure photcode] 31 MAG_REL, // MAG_SYS - Mcal [specific zero point for image] 32 MAG_CAL, // MAG_REL + \sum_i A_i * (color_i - color_o) [color correction for average photcode] 33 MAG_ERR, // error on PSF MAG 34 35 // the following imply APERTURE magnitudes: 36 MAG_APER_INST, // -2.5*log(DN) [ie, not DN/sec] 37 MAG_APER_CAT, // MAG_APER_INST + 2.5*log(exptime) + C_lambda + K_lambda*(airmass - 1) 38 MAG_APER_SYS, // MAG_APER_CAT + \sum_i A_i * (color_i - color_o) [color correction for measure photcode] 39 MAG_APER_REL, // MAG_APER_SYS - Mcal [specific zero point for image] 40 MAG_APER_CAL, // MAG_APER_REL + \sum_i A_i * (color_i - color_o) [color correction for average photcode] 41 MAG_APER_ERR, // error on APER MAG (if known, else psf error) 42 MAG_APER, // in mextract -> MAG_APER_REL, in avextract -> MAG_APER_AVE 43 44 // the following imply KRON magnitudes: 45 MAG_KRON_INST, // -2.5*log(DN) [ie, not DN/sec] 46 MAG_KRON_CAT, // MAG_KRON_INST + 2.5*log(exptime) + C_lambda + K_lambda*(airmass - 1) 47 MAG_KRON_SYS, // MAG_KRON_CAT + \sum_i A_i * (color_i - color_o) [color correction for measure photcode] 48 MAG_KRON_REL, // MAG_KRON_SYS - Mcal [specific zero point for image] 49 MAG_KRON_CAL, // MAG_KRON_REL + \sum_i A_i * (color_i - color_o) [color correction for average photcode] 50 MAG_KRON_ERR, // error on KRON MAG 51 MAG_KRON, // in mextract -> MAG_KRON_REL, in avextract -> MAG_KRON_AVE 52 53 // these magnitude types are from the average (secfilt) table: 54 // the following imply PSF magnitudes (or fluxes) 35 55 MAG_AVE, 36 56 MAG_REF, 37 MAG_ERR,38 57 MAG_STDEV, 39 58 MAG_AVE_ERR, 59 MAG_CHISQ, 60 MAG_20, 61 MAG_80, 62 MAG_FLUX_PSF, 63 MAG_FLUX_PSF_ERR, 64 65 // the following imply APERTURE magnitudes: 66 MAG_APER_AVE, 67 MAG_APER_REF, 68 69 // the following imply KRON magnitudes or fluxes: 70 MAG_KRON_AVE, 71 MAG_KRON_REF, 72 MAG_FLUX_KRON, 73 MAG_FLUX_KRON_ERR, 74 75 // other secfilt fields of interest 40 76 MAG_PHOT_FLAGS, 41 MAG_CHISQ,42 77 MAG_NCODE, 43 78 MAG_NPHOT, 44 MAG_20,45 MAG_80,46 79 MAG_UC_DIST, 47 80 MAG_STACK_DET_ID, 48 MAG_FLUX_PSF,49 MAG_FLUX_PSF_ERR,50 MAG_FLUX_KRON,51 MAG_FLUX_KRON_ERR,52 81 }; 53 82 -
trunk/Ohana/src/libdvo/src/dbExtractAverages.c
r36528 r36630 211 211 } 212 212 } else { 213 value.Flt = Phot dM(field->photcode, average, secfilt);213 value.Flt = PhotAveErr (field->photcode, average, secfilt); 214 214 } 215 215 break; … … 244 244 245 245 case MAG_APER: 246 case MAG_APER_AVE: 246 247 value.Flt = PhotAperAve (field->photcode, average, secfilt); 247 248 break; 248 249 250 case MAG_APER_REF: 251 value.Flt = PhotAperRef (field->photcode, average, secfilt, measure); 252 break; 253 249 254 case MAG_KRON: 255 case MAG_KRON_AVE: 250 256 value.Flt = PhotKronAve (field->photcode, average, secfilt); 257 break; 258 259 case MAG_KRON_REF: 260 value.Flt = PhotKronRef (field->photcode, average, secfilt, measure); 251 261 break; 252 262 … … 283 293 break; 284 294 case AVE_dMAG: 285 value.Flt = Phot dM(field->photcode, average, secfilt);295 value.Flt = PhotAveErr (field->photcode, average, secfilt); 286 296 break; 287 297 case AVE_Xm: -
trunk/Ohana/src/libdvo/src/dbExtractMeasures.c
r35508 r36630 123 123 case MAG_REL: 124 124 case MAG_CAL: 125 case MAG_APER: 125 case MAG_ERR: 126 126 127 case MAG_APER_INST: 127 case MAG_KRON: 128 case MAG_APER_CAT: 129 case MAG_APER_SYS: 130 case MAG_APER_REL: 131 case MAG_APER_CAL: 132 case MAG_APER_ERR: 133 128 134 case MAG_KRON_INST: 135 case MAG_KRON_CAT: 136 case MAG_KRON_SYS: 137 case MAG_KRON_REL: 138 case MAG_KRON_CAL: 129 139 case MAG_KRON_ERR: 130 case MAG_ERR: 140 131 141 case MAG_PHOT_FLAGS: 132 142 equiv = myEquiv; … … 137 147 case MAG_AVE: 138 148 case MAG_REF: 149 case MAG_STDEV: 150 case MAG_AVE_ERR: 139 151 case MAG_CHISQ: 140 case MAG_AVE_ERR: 152 case MAG_FLUX_PSF: 153 case MAG_FLUX_PSF_ERR: 154 155 case MAG_APER_AVE: 156 157 case MAG_KRON_AVE: 158 case MAG_FLUX_KRON: 159 case MAG_FLUX_KRON_ERR: 160 161 case MAG_20: 162 case MAG_80: 163 case MAG_UC_DIST: 164 case MAG_STACK_DET_ID: 165 141 166 case MAG_NCODE: 142 167 case MAG_NPHOT: 143 case MAG_FLUX_PSF:144 case MAG_FLUX_PSF_ERR:145 case MAG_FLUX_KRON:146 case MAG_FLUX_KRON_ERR:147 168 equiv = field->photcode; 148 169 goto valid_photcode; … … 178 199 value.Flt = PhotRef (equiv, average, secfilt, measure); 179 200 break; 180 case MAG_APER: 181 value.Flt = PhotAper (measure); 182 break; 201 case MAG_ERR: 202 value.Flt = measure[0].dM; 203 break; 204 case MAG_AVE_ERR: 205 value.Flt = PhotAveErr (equiv, average, secfilt); 206 break; 207 183 208 case MAG_APER_INST: 184 209 value.Flt = PhotAperInst (measure); 185 210 break; 186 case MAG_KRON: 187 value.Flt = PhotKron (measure); 188 break; 211 case MAG_APER_CAT: 212 value.Flt = PhotAperCat (measure); 213 break; 214 case MAG_APER_SYS: 215 value.Flt = PhotAperSys (measure, average, secfilt); 216 break; 217 case MAG_APER: 218 case MAG_APER_REL: 219 value.Flt = PhotAperRel (measure, average, secfilt); 220 break; 221 case MAG_APER_CAL: 222 value.Flt = PhotAperCal (measure, average, secfilt, measure, equiv); 223 break; 224 case MAG_APER_AVE: 225 value.Flt = PhotAperAve (equiv, average, secfilt); 226 break; 227 case MAG_APER_REF: 228 value.Flt = PhotAperRef (equiv, average, secfilt, measure); 229 break; 230 case MAG_APER_ERR: 231 value.Flt = measure[0].dM; 232 break; 233 189 234 case MAG_KRON_INST: 190 235 value.Flt = PhotKronInst (measure); 191 236 break; 237 case MAG_KRON_CAT: 238 value.Flt = PhotKronCat (measure); 239 break; 240 case MAG_KRON_SYS: 241 value.Flt = PhotKronSys (measure, average, secfilt); 242 break; 243 case MAG_KRON: 244 case MAG_KRON_REL: 245 value.Flt = PhotKronRel (measure, average, secfilt); 246 break; 247 case MAG_KRON_CAL: 248 value.Flt = PhotKronCal (measure, average, secfilt, measure, equiv); 249 break; 250 case MAG_KRON_AVE: 251 value.Flt = PhotKronAve (equiv, average, secfilt); 252 break; 253 case MAG_KRON_REF: 254 value.Flt = PhotKronRef (equiv, average, secfilt, measure); 255 break; 192 256 case MAG_KRON_ERR: 193 value.Flt = measure[0].dMkron; 194 break; 195 case MAG_ERR: 196 value.Flt = measure[0].dM; 197 break; 198 case MAG_AVE_ERR: 199 value.Flt = PhotdM (equiv, average, secfilt); 200 break; 257 value.Flt = measure[0].dMkron; 258 break; 259 201 260 case MAG_PHOT_FLAGS: 202 261 if ((field->photcode->type == PHOT_REF) || (field->photcode->type == PHOT_DEP)) { 203 262 value.Int = measure[0].photFlags; 204 } else {205 value.Int = 0;206 263 } 207 264 break; 208 case MAG_CHISQ: 209 value.Flt = PhotXm (equiv, average, secfilt); 210 break; 265 211 266 case MAG_NCODE: 212 if (equiv == NULL) { 213 value.Int = 0; 214 break; 215 } 267 if (equiv == NULL) break; 216 268 Nsec = GetPhotcodeNsec (equiv->code); 217 269 if (Nsec == -1) break; … … 219 271 break; 220 272 case MAG_NPHOT: 221 if (equiv == NULL) { 222 value.Int = 0; 223 break; 224 } 273 if (equiv == NULL) break; 225 274 Nsec = GetPhotcodeNsec (equiv->code); 226 275 if (Nsec == -1) break; 227 276 value.Int = secfilt[Nsec].Nused; 228 277 break; 278 279 case MAG_CHISQ: 280 value.Flt = PhotXm (equiv, average, secfilt); 281 break; 282 case MAG_STDEV: 283 value.Flt = PhotMstdev (equiv, average, secfilt); 284 break; 285 case MAG_20: 286 value.Flt = PhotM20 (equiv, average, secfilt); 287 break; 288 case MAG_80: 289 value.Flt = PhotM80 (equiv, average, secfilt); 290 break; 291 case MAG_UC_DIST: 292 value.Flt = PhotUCdist (equiv, average, secfilt); 293 break; 294 229 295 case MAG_FLUX_PSF: 230 296 value.Flt = PhotAveFluxPSF (field->photcode, average, secfilt); … … 531 597 fieldc = MatchFieldMetadata (measure[0].imageID); 532 598 } else { 533 fprintf (stderr, "non-parallel Xmos broken\n");534 abort();599 // fprintf (stderr, "non-parallel Xmos broken\n"); 600 // abort(); 535 601 // fieldc = MatchField (measure[0].t, measure[0].photcode); 602 fieldc = MatchFieldMetadata (measure[0].imageID); 536 603 } 537 604 if (fieldc == NULL) break; … … 547 614 fieldc = MatchFieldMetadata (measure[0].imageID); 548 615 } else { 549 fprintf (stderr, "non-parallel Xmos broken\n");550 abort();616 // fprintf (stderr, "non-parallel Xmos broken\n"); 617 // abort(); 551 618 // fieldc = MatchField (measure[0].t, measure[0].photcode); 619 fieldc = MatchFieldMetadata (measure[0].imageID); 552 620 } 553 621 if (fieldc == NULL) break; … … 564 632 mosaic = MatchMosaicMetadata (measure[0].imageID); 565 633 } else { 566 fprintf (stderr, "non-parallel Xmos broken\n"); 567 abort(); 568 mosaic = MatchMosaic (measure[0].t, measure[0].photcode); 634 // fprintf (stderr, "non-parallel Xmos broken\n"); 635 // abort(); 636 // mosaic = MatchMosaic (measure[0].t, measure[0].photcode); 637 mosaic = MatchMosaicMetadata (measure[0].imageID); 569 638 } 570 639 if (mosaic == NULL) break; … … 580 649 mosaic = MatchMosaicMetadata (measure[0].imageID); 581 650 } else { 582 fprintf (stderr, "non-parallel Xmos broken\n"); 583 abort(); 584 mosaic = MatchMosaic (measure[0].t, measure[0].photcode); 651 // fprintf (stderr, "non-parallel Xmos broken\n"); 652 // abort(); 653 // mosaic = MatchMosaic (measure[0].t, measure[0].photcode); 654 mosaic = MatchMosaicMetadata (measure[0].imageID); 585 655 } 586 656 if (mosaic == NULL) break; -
trunk/Ohana/src/libdvo/src/dbFields.c
r36084 r36630 30 30 int GetMagMode (char *string) { 31 31 32 // these all imply PSF mags: 32 33 if (!strcasecmp (string, "inst")) return (MAG_INST); 33 34 if (!strcasecmp (string, "cat")) return (MAG_CAT); … … 37 38 if (!strcasecmp (string, "ave")) return (MAG_AVE); 38 39 if (!strcasecmp (string, "ref")) return (MAG_REF); 40 if (!strcasecmp (string, "err")) return (MAG_ERR); 41 if (!strcasecmp (string, "aveerr")) return (MAG_AVE_ERR); 42 43 // these are explicit PSF mags: 44 if (!strcasecmp (string, "psf_inst")) return (MAG_INST); 45 if (!strcasecmp (string, "psf_cat")) return (MAG_CAT); 46 if (!strcasecmp (string, "psf_sys")) return (MAG_SYS); 47 if (!strcasecmp (string, "psf_rel")) return (MAG_REL); 48 if (!strcasecmp (string, "psf_cal")) return (MAG_CAL); 49 if (!strcasecmp (string, "psf_ave")) return (MAG_AVE); 50 if (!strcasecmp (string, "psf_ref")) return (MAG_REF); 51 if (!strcasecmp (string, "psf_err")) return (MAG_ERR); 52 if (!strcasecmp (string, "psf_aveerr")) return (MAG_AVE_ERR); 53 54 // these are aper mags: 39 55 if (!strcasecmp (string, "ap")) return (MAG_APER); 40 56 if (!strcasecmp (string, "aper")) return (MAG_APER); 41 57 if (!strcasecmp (string, "aperinst")) return (MAG_APER_INST); 42 58 if (!strcasecmp (string, "aper_inst")) return (MAG_APER_INST); 59 if (!strcasecmp (string, "aper_cat")) return (MAG_APER_CAT); 60 if (!strcasecmp (string, "aper_sys")) return (MAG_APER_SYS); 61 if (!strcasecmp (string, "aper_rel")) return (MAG_APER_REL); 62 if (!strcasecmp (string, "aper_cal")) return (MAG_APER_CAL); 63 if (!strcasecmp (string, "aper_ave")) return (MAG_APER_AVE); 64 if (!strcasecmp (string, "aper_ref")) return (MAG_APER_REF); 65 if (!strcasecmp (string, "aper_err")) return (MAG_APER_ERR); 66 67 // these are kron mags: 43 68 if (!strcasecmp (string, "kron")) return (MAG_KRON); 69 if (!strcasecmp (string, "kron_inst")) return (MAG_KRON_INST); 70 if (!strcasecmp (string, "kron_cat")) return (MAG_KRON_CAT); 71 if (!strcasecmp (string, "kron_sys")) return (MAG_KRON_SYS); 72 if (!strcasecmp (string, "kron_rel")) return (MAG_KRON_REL); 73 if (!strcasecmp (string, "kron_cal")) return (MAG_KRON_CAL); 74 if (!strcasecmp (string, "kron_ave")) return (MAG_KRON_AVE); 75 if (!strcasecmp (string, "kron_ref")) return (MAG_KRON_REF); 76 if (!strcasecmp (string, "kron_err")) return (MAG_KRON_ERR); 44 77 if (!strcasecmp (string, "kroninst")) return (MAG_KRON_INST); 45 if (!strcasecmp (string, "kron_inst")) return (MAG_KRON_INST);46 78 if (!strcasecmp (string, "kronerr")) return (MAG_KRON_ERR); 47 if (!strcasecmp (string, "err")) return (MAG_ERR); 48 if (!strcasecmp (string, "aveerr")) return (MAG_AVE_ERR);79 80 // other fields: 49 81 if (!strcasecmp (string, "photflags")) return (MAG_PHOT_FLAGS); 50 82 if (!strcasecmp (string, "flags")) return (MAG_PHOT_FLAGS); -
trunk/Ohana/src/libdvo/src/dvo_catalog.c
r35416 r36630 119 119 average->measureOffset = -1; 120 120 average->catID = 0; 121 average->nOwn = 0; 121 122 } 122 123 … … 242 243 measure->dYccd = 0; 243 244 measure->dRsys = 0; 245 measure->myDet = FALSE; 244 246 } 245 247 -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c
r36528 r36630 549 549 } 550 550 551 // XXX note that there are 2 bad versions of PS1_V4 : the other one does have have PSF_QF_PERFECT, but has PAD instead 551 552 int gfits_convert_Measure_PS1_V4alt (Measure_PS1_V4alt *data, off_t size, off_t nitems) { 552 553 … … 708 709 # ifdef BYTE_SWAP 709 710 byte = (unsigned char *) data; 710 for (i = 0; i < nitems; i++, byte += 12 9) {711 for (i = 0; i < nitems; i++, byte += 120) { 711 712 /** BYTE SWAP **/ 712 713 SWAP_DBLE (0); // RA … … 754 755 Ncols = ftable[0].header[0].Naxis[0]; 755 756 if (Ncols != 120) { 756 fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, 1 76);757 fprintf (stderr, "ERROR: mis-match in table size: width is %d but should be %d bytes\n", Ncols, 120); 757 758 return NULL; 758 759 } -
trunk/Ohana/src/libdvo/src/dvo_photcode_ops.c
r36528 r36630 169 169 } 170 170 171 // returns Nsec if code is PRI/SEC, else -1 171 172 int GetPhotcodeNsec (int code) { 172 173 … … 259 260 } 260 261 261 float PhotAper (Measure *measure) {262 263 int Np;264 float Mcat;265 PhotCode *code;266 267 Np = photcodes[0].hashcode[measure[0].photcode];268 if (Np == -1) return (NAN);269 270 if (photcodes[0].code[Np].type == PHOT_REF) {271 Mcat = measure[0].Map;272 return (Mcat);273 }274 code = &photcodes[0].code[Np];275 Mcat = measure[0].Map - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;276 277 return (Mcat);278 }279 280 float PhotAperInst (Measure *measure) {281 282 int Np;283 float Minst;284 285 Np = photcodes[0].hashcode[measure[0].photcode];286 if (Np == -1) return (NAN);287 288 if (photcodes[0].code[Np].type == PHOT_REF) {289 Minst = measure[0].Map;290 return (Minst);291 }292 Minst = measure[0].Map - measure[0].dt - ZERO_POINT;293 294 return (Minst);295 }296 297 float PhotKron (Measure *measure) {298 299 int Np;300 float Mcat;301 PhotCode *code;302 303 Np = photcodes[0].hashcode[measure[0].photcode];304 if (Np == -1) return (NAN);305 306 if (photcodes[0].code[Np].type == PHOT_REF) {307 Mcat = measure[0].Mkron;308 return (Mcat);309 }310 code = &photcodes[0].code[Np];311 Mcat = measure[0].Mkron - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;312 313 return (Mcat);314 }315 316 float PhotKronInst (Measure *measure) {317 318 int Np;319 float Minst;320 321 Np = photcodes[0].hashcode[measure[0].photcode];322 if (Np == -1) return (NAN);323 324 if (photcodes[0].code[Np].type == PHOT_REF) {325 Minst = measure[0].Mkron;326 return (Minst);327 }328 Minst = measure[0].Mkron - measure[0].dt - ZERO_POINT;329 330 return (Minst);331 }332 333 262 float PhotSys (Measure *measure, Average *average, SecFilt *secfilt) { 334 263 … … 362 291 } 363 292 364 float PhotZeroPoint (Measure *measure, Average *average, SecFilt *secfilt) {365 366 int Np;367 float ZP;368 PhotCode *code;369 370 Np = photcodes[0].hashcode[measure[0].photcode];371 if (Np == -1) return (NAN);372 373 if (photcodes[0].code[Np].type == PHOT_REF) {374 ZP = 0.0;375 return (ZP);376 }377 code = &photcodes[0].code[Np];378 ZP = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;379 380 return (ZP);381 }382 383 293 float PhotRel (Measure *measure, Average *average, SecFilt *secfilt) { 384 294 … … 444 354 Mcal += Mcol; 445 355 return (Mcal); 356 } 357 358 /***/ 359 float PhotAve (PhotCode *code, Average *average, SecFilt *secfilt) { 360 361 int Ns; 362 float Mave; 363 364 if (code == NULL) return NAN; 365 366 Ns = photcodes[0].hashNsec[code[0].code]; 367 Mave = (Ns == -1) ? NAN : secfilt[Ns].M; 368 return (Mave); 369 } 370 371 /* return calibrated magnitude from average/secfilt for given photcode */ 372 float PhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure) { 373 374 int i, Ns; 375 float Mave, Mref, Mcol, mc; 376 double Mc; 377 378 if (code == NULL) return NAN; 379 380 Ns = photcodes[0].hashNsec[code[0].code]; 381 Mave = (Ns == -1) ? NAN : secfilt[Ns].M; 382 Mref = Mave + SCALE*code[0].C; 383 384 mc = PhotColorForCode (average, secfilt, measure, code); 385 if (isnan(mc)) return (Mref); 386 mc = mc - SCALE*code[0].dX; 387 388 Mc = mc; 389 Mcol = 0; 390 for (i = 0; i < code[0].Nc; i++) { 391 Mcol += code[0].X[i]*Mc; 392 Mc *= mc; /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */ 393 } 394 Mref += Mcol; 395 return (Mref); 396 } 397 398 float PhotAveErr (PhotCode *code, Average *average, SecFilt *secfilt) { 399 400 int Ns; 401 float dM; 402 403 if (code == NULL) return NAN; 404 405 Ns = photcodes[0].hashNsec[code[0].code]; 406 dM = (Ns == -1) ? NAN : secfilt[Ns].dM; 407 return (dM); 408 } 409 410 /************************************** APERTURE-related Magnitudes ***********************************************/ 411 412 float PhotAperInst (Measure *measure) { 413 414 int Np; 415 float Minst; 416 417 Np = photcodes[0].hashcode[measure[0].photcode]; 418 if (Np == -1) return (NAN); 419 420 if (photcodes[0].code[Np].type == PHOT_REF) { 421 Minst = measure[0].Map; 422 return (Minst); 423 } 424 Minst = measure[0].Map - measure[0].dt - ZERO_POINT; 425 426 return (Minst); 427 } 428 429 float PhotAperCat (Measure *measure) { 430 431 int Np; 432 float Mcat; 433 PhotCode *code; 434 435 Np = photcodes[0].hashcode[measure[0].photcode]; 436 if (Np == -1) return (NAN); 437 438 if (photcodes[0].code[Np].type == PHOT_REF) { 439 Mcat = measure[0].Map; 440 return (Mcat); 441 } 442 code = &photcodes[0].code[Np]; 443 Mcat = measure[0].Map - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C; 444 445 return (Mcat); 446 } 447 448 float PhotAperSys (Measure *measure, Average *average, SecFilt *secfilt) { 449 450 int i, Np; 451 float Mcat, Mcol, Msys, mc, Mc; 452 PhotCode *code; 453 454 Np = photcodes[0].hashcode[measure[0].photcode]; 455 if (Np == -1) return (NAN); 456 457 if (photcodes[0].code[Np].type == PHOT_REF) { 458 Mcat = measure[0].Map; 459 return (Mcat); 460 } 461 code = &photcodes[0].code[Np]; 462 Mcat = measure[0].Map - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C; 463 464 /* for DEP, color must be made of PRI/SEC */ 465 mc = PhotColorForCode (average, secfilt, NULL, code); 466 if (isnan(mc)) return (Mcat); 467 mc = mc - SCALE*code[0].dX; 468 469 Mc = mc; 470 Mcol = 0; 471 for (i = 0; i < code[0].Nc; i++) { 472 Mcol += code[0].X[i]*Mc; 473 Mc *= mc; 474 } 475 Msys = Mcat + Mcol; 476 return (Msys); 477 } 478 479 float PhotAperRel (Measure *measure, Average *average, SecFilt *secfilt) { 480 481 int i, Np; 482 float Mcat, Mcol, Mrel, mc, Mc; 483 PhotCode *code; 484 485 Np = photcodes[0].hashcode[measure[0].photcode]; 486 if (Np == -1) return (NAN); 487 488 if (photcodes[0].code[Np].type == PHOT_REF) { 489 Mcat = measure[0].Map; 490 return (Mcat); 491 } 492 code = &photcodes[0].code[Np]; 493 Mrel = measure[0].Map - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure[0].Mcal; 494 495 /* for DEP, color must be made of PRI/SEC */ 496 mc = PhotColorForCode (average, secfilt, NULL, code); 497 if (isnan(mc)) return (Mrel); 498 mc = mc - SCALE*code[0].dX; 499 500 Mc = mc; 501 Mcol = 0; 502 for (i = 0; i < code[0].Nc; i++) { 503 Mcol += code[0].X[i]*Mc; 504 Mc *= mc; /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */ 505 } 506 Mrel += Mcol; 507 return (Mrel); 508 } 509 510 /* return calibrated magnitude from measure for given photcode */ 511 float PhotAperCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code) { 512 513 int i, Np; 514 float Mcal, Mrel, Mcol, mc, Mc; 515 516 if (code == NULL) return NAN; 517 518 /* code must be the matching PRI/SEC code for this measurement or an equivalent ALT */ 519 Np = photcodes[0].hashcode[thisone[0].photcode]; 520 if (Np == -1) return (NAN); 521 522 if (photcodes[0].code[Np].type == PHOT_REF) { 523 Mrel = thisone[0].Map; 524 return (Mrel); 525 } 526 if (code[0].code != photcodes[0].code[Np].equiv) return (NAN); 527 528 Mcal = PhotAperRel (thisone, average, secfilt) + SCALE*code[0].C; 529 530 mc = PhotColorForCode (average, secfilt, measure, code); 531 if (isnan(mc)) return (Mcal); 532 mc = mc - SCALE*code[0].dX; 533 534 Mc = mc; 535 Mcol = 0; 536 for (i = 0; i < code[0].Nc; i++) { 537 Mcol += code[0].X[i]*Mc; 538 Mc *= mc; 539 } 540 Mcal += Mcol; 541 return (Mcal); 542 } 543 544 float PhotAperAve (PhotCode *code, Average *average, SecFilt *secfilt) { 545 546 int Ns; 547 float Maper; 548 549 if (code == NULL) return NAN; 550 551 Ns = photcodes[0].hashNsec[code[0].code]; 552 Maper = (Ns == -1) ? NAN : secfilt[Ns].Map; 553 return (Maper); 554 } 555 556 /* return calibrated magnitude from average/secfilt for given photcode */ 557 float PhotAperRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure) { 558 559 int i, Ns; 560 float Mave, Mref, Mcol, mc; 561 double Mc; 562 563 if (code == NULL) return NAN; 564 565 Ns = photcodes[0].hashNsec[code[0].code]; 566 Mave = (Ns == -1) ? NAN : secfilt[Ns].Map; 567 Mref = Mave + SCALE*code[0].C; 568 569 mc = PhotColorForCode (average, secfilt, measure, code); 570 if (isnan(mc)) return (Mref); 571 mc = mc - SCALE*code[0].dX; 572 573 Mc = mc; 574 Mcol = 0; 575 for (i = 0; i < code[0].Nc; i++) { 576 Mcol += code[0].X[i]*Mc; 577 Mc *= mc; /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */ 578 } 579 Mref += Mcol; 580 return (Mref); 581 } 582 583 /************************************** KRON-related Magnitudes ***********************************************/ 584 585 float PhotKronInst (Measure *measure) { 586 587 int Np; 588 float Minst; 589 590 Np = photcodes[0].hashcode[measure[0].photcode]; 591 if (Np == -1) return (NAN); 592 593 if (photcodes[0].code[Np].type == PHOT_REF) { 594 Minst = measure[0].Mkron; 595 return (Minst); 596 } 597 Minst = measure[0].Mkron - measure[0].dt - ZERO_POINT; 598 599 return (Minst); 600 } 601 602 float PhotKronCat (Measure *measure) { 603 604 int Np; 605 float Mcat; 606 PhotCode *code; 607 608 Np = photcodes[0].hashcode[measure[0].photcode]; 609 if (Np == -1) return (NAN); 610 611 if (photcodes[0].code[Np].type == PHOT_REF) { 612 Mcat = measure[0].Mkron; 613 return (Mcat); 614 } 615 code = &photcodes[0].code[Np]; 616 Mcat = measure[0].Mkron - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C; 617 618 return (Mcat); 619 } 620 621 float PhotKronSys (Measure *measure, Average *average, SecFilt *secfilt) { 622 623 int i, Np; 624 float Mcat, Mcol, Msys, mc, Mc; 625 PhotCode *code; 626 627 Np = photcodes[0].hashcode[measure[0].photcode]; 628 if (Np == -1) return (NAN); 629 630 if (photcodes[0].code[Np].type == PHOT_REF) { 631 Msys = measure[0].Mkron; 632 return (Msys); 633 } 634 code = &photcodes[0].code[Np]; 635 Mcat = measure[0].Mkron - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C; 636 637 /* for DEP, color must be made of PRI/SEC */ 638 mc = PhotColorForCode (average, secfilt, NULL, code); 639 if (isnan(mc)) return (Mcat); 640 mc = mc - SCALE*code[0].dX; 641 642 Mc = mc; 643 Mcol = 0; 644 for (i = 0; i < code[0].Nc; i++) { 645 Mcol += code[0].X[i]*Mc; 646 Mc *= mc; 647 } 648 Msys = Mcat + Mcol; 649 return (Msys); 650 } 651 652 float PhotKronRel (Measure *measure, Average *average, SecFilt *secfilt) { 653 654 int i, Np; 655 float Mcat, Mcol, Mrel, mc, Mc; 656 PhotCode *code; 657 658 Np = photcodes[0].hashcode[measure[0].photcode]; 659 if (Np == -1) return (NAN); 660 661 if (photcodes[0].code[Np].type == PHOT_REF) { 662 Mcat = measure[0].Mkron; 663 return (Mcat); 664 } 665 code = &photcodes[0].code[Np]; 666 Mrel = measure[0].Mkron - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure[0].Mcal; 667 668 /* for DEP, color must be made of PRI/SEC */ 669 mc = PhotColorForCode (average, secfilt, NULL, code); 670 if (isnan(mc)) return (Mrel); 671 mc = mc - SCALE*code[0].dX; 672 673 Mc = mc; 674 Mcol = 0; 675 for (i = 0; i < code[0].Nc; i++) { 676 Mcol += code[0].X[i]*Mc; 677 Mc *= mc; /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */ 678 } 679 Mrel += Mcol; 680 return (Mrel); 681 } 682 683 /* return calibrated magnitude from measure for given photcode */ 684 float PhotKronCal (Measure *thisone, Average *average, SecFilt *secfilt, Measure *measure, PhotCode *code) { 685 686 int i, Np; 687 float Mcal, Mrel, Mcol, mc, Mc; 688 689 if (code == NULL) return NAN; 690 691 /* code must be the matching PRI/SEC code for this measurement or an equivalent ALT */ 692 Np = photcodes[0].hashcode[thisone[0].photcode]; 693 if (Np == -1) return (NAN); 694 695 if (photcodes[0].code[Np].type == PHOT_REF) { 696 Mrel = thisone[0].Mkron; 697 return (Mrel); 698 } 699 if (code[0].code != photcodes[0].code[Np].equiv) return (NAN); 700 701 Mcal = PhotKronRel (thisone, average, secfilt) + SCALE*code[0].C; 702 703 mc = PhotColorForCode (average, secfilt, measure, code); 704 if (isnan(mc)) return (Mcal); 705 mc = mc - SCALE*code[0].dX; 706 707 Mc = mc; 708 Mcol = 0; 709 for (i = 0; i < code[0].Nc; i++) { 710 Mcol += code[0].X[i]*Mc; 711 Mc *= mc; 712 } 713 Mcal += Mcol; 714 return (Mcal); 715 } 716 717 float PhotKronAve (PhotCode *code, Average *average, SecFilt *secfilt) { 718 719 int Ns; 720 float Mkron; 721 722 if (code == NULL) return NAN; 723 724 Ns = photcodes[0].hashNsec[code[0].code]; 725 Mkron = (Ns == -1) ? NAN : secfilt[Ns].Mkron; 726 return (Mkron); 727 } 728 729 /* return calibrated magnitude from average/secfilt for given photcode */ 730 float PhotKronRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure) { 731 732 int i, Ns; 733 float Mave, Mref, Mcol, mc; 734 double Mc; 735 736 if (code == NULL) return NAN; 737 738 Ns = photcodes[0].hashNsec[code[0].code]; 739 Mave = (Ns == -1) ? NAN : secfilt[Ns].Mkron; 740 Mref = Mave + SCALE*code[0].C; 741 742 mc = PhotColorForCode (average, secfilt, measure, code); 743 if (isnan(mc)) return (Mref); 744 mc = mc - SCALE*code[0].dX; 745 746 Mc = mc; 747 Mcol = 0; 748 for (i = 0; i < code[0].Nc; i++) { 749 Mcol += code[0].X[i]*Mc; 750 Mc *= mc; /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */ 751 } 752 Mref += Mcol; 753 return (Mref); 754 } 755 756 float PhotKronAveErr (PhotCode *code, Average *average, SecFilt *secfilt) { 757 758 int Ns; 759 float dMkron; 760 761 if (code == NULL) return NAN; 762 763 Ns = photcodes[0].hashNsec[code[0].code]; 764 dMkron = (Ns == -1) ? NAN : secfilt[Ns].dMkron; 765 return (dMkron); 766 } 767 768 /********************* other support functions ********************************/ 769 770 float PhotZeroPoint (Measure *measure, Average *average, SecFilt *secfilt) { 771 772 int Np; 773 float ZP; 774 PhotCode *code; 775 776 Np = photcodes[0].hashcode[measure[0].photcode]; 777 if (Np == -1) return (NAN); 778 779 if (photcodes[0].code[Np].type == PHOT_REF) { 780 ZP = 0.0; 781 return (ZP); 782 } 783 code = &photcodes[0].code[Np]; 784 ZP = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C; 785 786 return (ZP); 446 787 } 447 788 … … 496 837 } 497 838 498 /* return calibrated magnitude from average/secfilt for given photcode */499 float PhotRef (PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure) {500 501 int i, Ns;502 float Mave, Mref, Mcol, mc;503 double Mc;504 505 if (code == NULL) return NAN;506 507 Ns = photcodes[0].hashNsec[code[0].code];508 Mave = (Ns == -1) ? NAN : secfilt[Ns].M;509 Mref = Mave + SCALE*code[0].C;510 511 mc = PhotColorForCode (average, secfilt, measure, code);512 if (isnan(mc)) return (Mref);513 mc = mc - SCALE*code[0].dX;514 515 Mc = mc;516 Mcol = 0;517 for (i = 0; i < code[0].Nc; i++) {518 Mcol += code[0].X[i]*Mc;519 Mc *= mc; /* the 0.001 is needed for higher order terms to keep the units mag = mag^n */520 }521 Mref += Mcol;522 return (Mref);523 }524 525 /***/526 float PhotAve (PhotCode *code, Average *average, SecFilt *secfilt) {527 528 int Ns;529 float Mave;530 531 if (code == NULL) return NAN;532 533 Ns = photcodes[0].hashNsec[code[0].code];534 Mave = (Ns == -1) ? NAN : secfilt[Ns].M;535 return (Mave);536 }537 538 float PhotdM (PhotCode *code, Average *average, SecFilt *secfilt) {539 540 int Ns;541 float dM;542 543 if (code == NULL) return NAN;544 545 Ns = photcodes[0].hashNsec[code[0].code];546 dM = (Ns == -1) ? NAN : secfilt[Ns].dM;547 return (dM);548 }549 550 839 float PhotMstdev (PhotCode *code, Average *average, SecFilt *secfilt) { 551 840 … … 558 847 Mstdev = (Ns == -1) ? NAN : 0.001*secfilt[Ns].Mstdev; 559 848 return (Mstdev); 560 }561 562 float PhotAperAve (PhotCode *code, Average *average, SecFilt *secfilt) {563 564 int Ns;565 float Maper;566 567 if (code == NULL) return NAN;568 569 Ns = photcodes[0].hashNsec[code[0].code];570 Maper = (Ns == -1) ? NAN : secfilt[Ns].Map;571 return (Maper);572 }573 574 float PhotKronAve (PhotCode *code, Average *average, SecFilt *secfilt) {575 576 int Ns;577 float Mkron;578 579 if (code == NULL) return NAN;580 581 Ns = photcodes[0].hashNsec[code[0].code];582 Mkron = (Ns == -1) ? NAN : secfilt[Ns].Mkron;583 return (Mkron);584 }585 586 float PhotKronAveErr (PhotCode *code, Average *average, SecFilt *secfilt) {587 588 int Ns;589 float dMkron;590 591 if (code == NULL) return NAN;592 593 Ns = photcodes[0].hashNsec[code[0].code];594 dMkron = (Ns == -1) ? NAN : secfilt[Ns].dMkron;595 return (dMkron);596 849 } 597 850 -
trunk/Ohana/src/libdvo/src/dvo_tiny_values.c
r35102 r36630 8 8 averageT[0].measureOffset = average[0].measureOffset; 9 9 averageT[0].catID = average[0].catID; 10 averageT[0].objID = average[0].objID; 11 averageT[0].nOwn = -1; 10 12 return; 11 13 } … … 33 35 measureT[0].dYccd = measure[0].dYccd; 34 36 measureT[0].dRsys = measure[0].dRsys; 37 measureT[0].myDet = 0; 35 38 return ; 36 39 }
Note:
See TracChangeset
for help on using the changeset viewer.
