- Timestamp:
- Apr 1, 2014, 12:03:17 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 57 edited
- 24 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)
-
Ohana/src/libfits/table/F_get_column.c (modified) (1 diff)
-
Ohana/src/libohana/src (modified) (1 prop)
-
Ohana/src/opihi/dvo/photometry.c (modified) (2 diffs)
-
Ohana/src/relastro/Makefile (modified) (1 diff)
-
Ohana/src/relastro/include/relastro.h (modified) (8 diffs)
-
Ohana/src/relastro/src/ConfigInit.c (modified) (3 diffs)
-
Ohana/src/relastro/src/ImageOps.c (modified) (2 diffs)
-
Ohana/src/relastro/src/ImagePosIO.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/ImagePosIO.c )
-
Ohana/src/relastro/src/ImageTable.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/ImageTable.c )
-
Ohana/src/relastro/src/MeanPosIO.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/MeanPosIO.c )
-
Ohana/src/relastro/src/MosaicOps.c (modified) (8 diffs)
-
Ohana/src/relastro/src/StarMaps.c (modified) (1 diff)
-
Ohana/src/relastro/src/UpdateObjects.c (modified) (4 diffs)
-
Ohana/src/relastro/src/args.c (modified) (14 diffs)
-
Ohana/src/relastro/src/assign_images.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/assign_images.c )
-
Ohana/src/relastro/src/indexCatalogs.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/indexCatalogs.c )
-
Ohana/src/relastro/src/initialize.c (modified) (1 diff)
-
Ohana/src/relastro/src/launch_region_hosts.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/launch_region_hosts.c )
-
Ohana/src/relastro/src/load_catalogs.c (modified) (2 diffs)
-
Ohana/src/relastro/src/load_images.c (modified) (3 diffs)
-
Ohana/src/relastro/src/markObjects.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/markObjects.c )
-
Ohana/src/relastro/src/relastro.c (modified) (1 diff)
-
Ohana/src/relastro/src/relastro_client.c (modified) (4 diffs)
-
Ohana/src/relastro/src/relastro_images.c (modified) (1 diff)
-
Ohana/src/relastro/src/relastro_objects.c (modified) (1 diff)
-
Ohana/src/relastro/src/relastro_parallel_images.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/relastro_parallel_images.c )
-
Ohana/src/relastro/src/relastro_parallel_regions.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/relastro_parallel_regions.c )
-
Ohana/src/relastro/src/resort_catalog.c (modified) (1 diff)
-
Ohana/src/relastro/src/select_images.c (modified) (4 diffs)
-
Ohana/src/relastro/src/share_images_pos.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/share_images_pos.c )
-
Ohana/src/relastro/src/share_mean_pos.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/share_mean_pos.c )
-
Ohana/src/relastro/src/syncfile.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relastro/src/syncfile.c )
-
Ohana/src/relphot/Makefile (modified) (1 diff)
-
Ohana/src/relphot/doc/parallel.txt (modified) (1 diff)
-
Ohana/src/relphot/include/relphot.h (modified) (8 diffs)
-
Ohana/src/relphot/src/BrightCatalog.c (modified) (9 diffs)
-
Ohana/src/relphot/src/ImageMagIO.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/ImageMagIO.c )
-
Ohana/src/relphot/src/ImageOps.c (modified) (3 diffs)
-
Ohana/src/relphot/src/ImageTable.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/ImageTable.c )
-
Ohana/src/relphot/src/MeanMagIO.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/MeanMagIO.c )
-
Ohana/src/relphot/src/MosaicOps.c (modified) (4 diffs)
-
Ohana/src/relphot/src/StarOps.c (modified) (1 diff)
-
Ohana/src/relphot/src/args.c (modified) (4 diffs)
-
Ohana/src/relphot/src/assign_images.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/assign_images.c )
-
Ohana/src/relphot/src/client_logger.c (modified) (2 diffs)
-
Ohana/src/relphot/src/help.c (modified) (2 diffs)
-
Ohana/src/relphot/src/indexCatalog.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/indexCatalog.c )
-
Ohana/src/relphot/src/initialize.c (modified) (2 diffs)
-
Ohana/src/relphot/src/launch_region_hosts.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/launch_region_hosts.c )
-
Ohana/src/relphot/src/load_catalogs.c (modified) (3 diffs)
-
Ohana/src/relphot/src/reload_catalogs.c (modified) (1 diff)
-
Ohana/src/relphot/src/relphot.c (modified) (1 diff)
-
Ohana/src/relphot/src/relphot_client.c (modified) (1 diff)
-
Ohana/src/relphot/src/relphot_images.c (modified) (1 diff)
-
Ohana/src/relphot/src/relphot_parallel_images.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/relphot_parallel_images.c )
-
Ohana/src/relphot/src/relphot_parallel_regions.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/relphot_parallel_regions.c )
-
Ohana/src/relphot/src/setMrelCatalog.c (modified) (3 diffs)
-
Ohana/src/relphot/src/share_image_mags.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/share_image_mags.c )
-
Ohana/src/relphot/src/share_mean_mags.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/share_mean_mags.c )
-
Ohana/src/relphot/src/syncfile.c (copied) (copied from branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/syncfile.c )
-
Ohana/src/uniphot/src/update_dvo_setphot.c (modified) (1 diff)
-
ippScripts/scripts/ipp_apply_burntool_single.pl (modified) (1 prop)
-
ippScripts/scripts/publish_file.pl (modified) (1 prop)
-
ippconfig/recipes/ppSub.config (modified) (1 prop)
-
ippconfig/recipes/reductionClasses.mdc (modified) (1 prop)
-
psphot/src (modified) (1 prop)
-
psphot/src/psphotFullForceReadout.c (modified) (1 diff)
-
psphot/src/psphotStackImageLoop.c (modified) (1 prop)
-
psphot/src/psphotStackReadout.c (modified) (1 diff)
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 } -
trunk/Ohana/src/libfits/table/F_get_column.c
r35101 r36630 174 174 int gfits_get_bintable_column (Header *header, FTable *table, char *label, void **data) { 175 175 176 off_t Nx, Ny; 177 int i, N, Nfields, Nval, Nbytes, Nstart, Nv, Nb; 178 char tlabel[80], field[80], format[80], type[16], tmpline[16]; 179 char *Pin, *Pout, *array; 180 double Bscale, Bzero; 181 182 if (label == (char *) NULL) return (FALSE); 183 if (label[0] == 0) return (FALSE); 184 185 /* find label in header */ 186 tlabel[0] = 0; 187 gfits_scan (header, "TFIELDS", "%d", 1, &Nfields); 188 for (i = 1; strcasecmp (label, tlabel) && (i < Nfields + 1); i++) { 189 sprintf (field, "TTYPE%d", i); 190 gfits_scan (header, field, "%s", 1, tlabel); 191 } 192 if (strcasecmp (label, tlabel)) return (FALSE); 193 N = i - 1; 194 195 Bscale = 1; 196 Bzero = 0; 197 198 /* interpret format */ 199 sprintf (field, "TSCAL%d", N); 200 gfits_scan (header, field, "%lf", 1, &Bscale); 201 sprintf (field, "TZERO%d", N); 202 gfits_scan (header, field, "%lf", 1, &Bzero); 203 sprintf (field, "TFORM%d", N); 204 gfits_scan (header, field, "%s", 1, format); 205 206 if (!gfits_bintable_format (format, type, &Nval, &Nbytes)) return (FALSE); 207 208 /* check existing table dimensions */ 209 gfits_scan (header, "NAXIS1", OFF_T_FMT, 1, &Nx); 210 gfits_scan (header, "NAXIS2", OFF_T_FMT, 1, &Ny); 211 212 /* scan columns to find insert point */ 213 Nstart = 0; 214 for (i = 1; i < N; i++) { 215 sprintf (field, "TFORM%d", i); 216 gfits_scan (header, field, "%s", 1, format); 217 gfits_bintable_format (format, tmpline, &Nv, &Nb); 218 Nstart += Nv*Nb; 219 } 220 221 /* extract bytes from table into temporary array */ 222 ALLOCATE (array, char, Nbytes*Nval*Ny); 223 Pin = table[0].buffer + Nstart; 224 Pout = array; 225 for (i = 0; i < Ny; i++, Pin += Nx, Pout += Nval*Nbytes) { 226 memcpy (Pout, Pin, Nval*Nbytes); 227 } 228 229 /* convert data in-situ with correct type, byte swap and Bzero/Bscale */ 230 Pin = array; 231 Pout = array; 232 if (!strcmp (type, "char")) { 233 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 234 *(char *)Pout = *(char *)Pin*Bscale + Bzero; 235 } 236 } 237 if (!strcmp (type, "short")) { 238 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 239 # ifdef BYTE_SWAP 240 SWAP_BYTE; 241 # endif 242 *(short *)Pout = *(short *)Pin*Bscale + Bzero; 243 } 244 } 245 if (!strcmp (type, "int")) { 246 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 247 # ifdef BYTE_SWAP 248 SWAP_WORD; 249 # endif 250 *(int *)Pout = *(int *)Pin*Bscale + Bzero; 251 } 252 } 253 if (!strcmp (type, "int64_t")) { 254 // XXX 64 bit int operations with Bzero & Bscale are inaccurate even with doubles 255 if ((Bzero == 0.0) && (Bscale == 1.0)) { 256 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 257 # ifdef BYTE_SWAP 258 SWAP_DBLE; 259 # endif 260 *(int64_t *)Pout = *(int64_t *)Pin; 261 } 262 } else { 263 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 264 # ifdef BYTE_SWAP 265 SWAP_DBLE; 266 # endif 267 *(int64_t *)Pout = *(int64_t *)Pin*Bscale + Bzero; 268 } 269 } 270 } 271 if (!strcmp (type, "float")) { 272 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 273 # ifdef BYTE_SWAP 274 SWAP_WORD; 275 # endif 276 *(float *)Pout = *(float *)Pin*Bscale + Bzero; 277 } 278 } 279 if (!strcmp (type, "double")) { 280 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 281 # ifdef BYTE_SWAP 282 SWAP_DBLE; 283 # endif 284 *(double *)Pout = *(double *)Pin*Bscale + Bzero; 285 } 286 } 176 char type[16]; 177 off_t Nrow; 178 int Ncol; 179 180 char *array = gfits_get_bintable_column_data (header, table, label, type, &Nrow, &Ncol); 181 if (array == NULL) return (FALSE); 287 182 288 183 *data = array; 289 return (TRUE);184 return TRUE; 290 185 } 291 186 -
trunk/Ohana/src/libohana/src
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20140206/Ohana/src/libohana/src (added) merged: 36536,36626 /branches/eam_branches/ipp-20140214/Ohana/src/libohana/src (added) merged: 36525-36527
- Property svn:mergeinfo changed
-
trunk/Ohana/src/opihi/dvo/photometry.c
r35416 r36630 662 662 break; 663 663 case AVE_dMAG: 664 value = Phot dM(code, average, secfilt);664 value = PhotAveErr (code, average, secfilt); 665 665 break; 666 666 case AVE_Xm: … … 865 865 /* for ErrSelect, check average errors */ 866 866 if (ErrSelect) { 867 dM = Phot dM(code, average, secfilt);867 dM = PhotAveErr (code, average, secfilt); 868 868 if (dM > ErrValue) return (FALSE); 869 869 } -
trunk/Ohana/src/relastro/Makefile
r35416 r36630 69 69 $(SRC)/resort_catalog.$(ARCH).o \ 70 70 $(SRC)/BrightCatalog.$(ARCH).o \ 71 $(SRC)/assign_images.$(ARCH).o \ 72 $(SRC)/launch_region_hosts.$(ARCH).o \ 73 $(SRC)/relastro_parallel_images.$(ARCH).o \ 74 $(SRC)/relastro_parallel_regions.$(ARCH).o \ 75 $(SRC)/MeanPosIO.$(ARCH).o \ 76 $(SRC)/share_mean_pos.$(ARCH).o \ 77 $(SRC)/share_images_pos.$(ARCH).o \ 78 $(SRC)/ImagePosIO.$(ARCH).o \ 79 $(SRC)/ImageTable.$(ARCH).o \ 80 $(SRC)/markObjects.$(ARCH).o \ 81 $(SRC)/indexCatalogs.$(ARCH).o \ 82 $(SRC)/syncfile.$(ARCH).o \ 71 83 $(SRC)/relastroVisual.$(ARCH).o 72 84 -
trunk/Ohana/src/relastro/include/relastro.h
r35763 r36630 6 6 # include <pthread.h> 7 7 8 # define MARKTIME(MSG,...) { \ 9 gettimeofday (&stopTimer, (void *) NULL); \ 10 float dtime = DTIME (stopTimer, startTimer); \ 11 fprintf (stderr, MSG, __VA_ARGS__); } 12 13 # define INITTIME \ 14 struct timeval startTimer, stopTimer; \ 15 gettimeofday (&startTimer, (void *) NULL); 16 8 17 // choose off_t or int depending on full-scale relphot analysis resources 9 18 // # define IDX_T off_t … … 20 29 typedef enum {FIT_NONE, FIT_AVERAGE, FIT_PM_ONLY, FIT_PAR_ONLY, FIT_PM_AND_PAR} FitMode; 21 30 22 typedef enum {TARGET_NONE, TARGET_SIMPLE, TARGET_CHIPS, TARGET_MOSAICS, TARGET_HIGH_SPEED, TARGET_MERGE_SOURCE, TARGET_UPDATE_OBJECTS, TARGET_UPDATE_OFFSETS, TARGET_LOAD_OBJECTS, TARGET_HPM} FitTarget; 31 typedef enum {OP_NONE, OP_IMAGES, OP_HIGH_SPEED, OP_MERGE_SOURCE, OP_UPDATE_OBJECTS, OP_UPDATE_OFFSETS, OP_LOAD_OBJECTS, OP_HPM, OP_PARALLEL_REGIONS, OP_PARALLEL_IMAGES} RelastroOp; 32 33 typedef enum {TARGET_NONE, TARGET_SIMPLE, TARGET_CHIPS, TARGET_MOSAICS} FitTarget; 23 34 24 35 typedef enum { … … 30 41 MARK_BIG_OFFSET = 0x0010, 31 42 } MeasurementMask; 43 44 typedef struct { 45 float R; 46 float D; 47 unsigned int objID; 48 unsigned int catID; 49 } MeanPos; 50 51 typedef struct { 52 Coords coords; 53 float dXpixSys; 54 float dYpixSys; 55 unsigned int imageID; 56 int nFitAstrom; 57 int flags; 58 } ImagePos; 32 59 33 60 typedef struct { … … 93 120 unsigned int start; 94 121 unsigned int stop; 122 off_t myImage; 95 123 float Mcal; 96 124 float dMcal; … … 113 141 } StatType; 114 142 115 # define MARKTIME(MSG,...) { \116 float dtime; \117 gettimeofday (&stop, (void *) NULL); \118 dtime = DTIME (stop, start); \119 fprintf (stderr, MSG, __VA_ARGS__); }120 121 143 /* global variables set in parameter file */ 122 144 # define DVO_MAX_PATH 1024 … … 129 151 char SKY_TABLE[DVO_MAX_PATH]; 130 152 int SKY_DEPTH; /** XXX EAM : depth of catalog tables, fix usage */ 153 154 // globals for parallel region operations 155 char *REGION_FILE; 156 char *IMAGE_TABLE; 157 int REGION_HOST_ID; 158 int PARALLEL_REGIONS_MANUAL; 131 159 132 160 int HOST_ID; … … 208 236 FitMode FIT_MODE; 209 237 238 RelastroOp RELASTRO_OP; 210 239 FitTarget FIT_TARGET; 211 240 … … 450 479 int hpm_catalogs_parallel (SkyList *skylist); 451 480 int hpm_objects (SkyRegion *region, Catalog *catalog); 481 482 int strextend (char *input, char *format,...); 483 int launch_region_hosts (RegionHostTable *regionHosts); 484 485 int assign_images (FITS_DB *db, RegionHostTable *regionHosts); 486 int select_images_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage); 487 int calculate_image_bounds (Image *image, double *rmin, double *rmax, double *dmin, double *dmax, double Rmid); 488 int calculate_host_image_bounds (RegionHostTable *regionHosts); 489 int find_host_for_coords (RegionHostTable *regionHosts, double Rc, double Dc); 490 491 int relastro_parallel_regions (); 492 int relastro_parallel_images (); 493 494 char *make_filename (char *dirname, char *hostname, int hostID, char *tailname); 495 int check_sync_file (char *filename, int nloop); 496 int clear_sync_file (char *filename); 497 int update_sync_file (char *filename, int nloop); 498 499 int share_mean_pos (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop); 500 int slurp_mean_pos (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop); 501 int set_mean_pos (MeanPos *meanpos, Average *average); 502 MeanPos *merge_mean_pos (MeanPos *target, int *ntarget, MeanPos *source, int Nsource); 503 504 int MeanPosSave(char *filename, MeanPos *meanpos, off_t Nmeanpos); 505 MeanPos *MeanPosLoad(char *filename, off_t *nmeanpos); 506 507 int indexCatalogs (Catalog *catalog, int Ncatalog); 508 int catID_and_objID_to_seq (int catID, int objID, int *catSeq, off_t *objSeq); 509 510 int markObjects (Catalog *catalog, int Ncatalog); 511 512 int ImagePosSave(char *filename, ImagePos *image_pos, off_t Nimage_pos); 513 ImagePos *ImagePosLoad(char *filename, off_t *nimage_pos); 514 515 int share_image_pos (RegionHostTable *regionHosts, int nloop); 516 int slurp_image_pos (RegionHostTable *regionHosts, int nloop); 517 ImagePos *merge_image_pos (ImagePos *target, int *ntarget, ImagePos *source, int Nsource); 518 int set_image_pos (ImagePos *image_pos, Image *image); 519 520 Image *ImageTableLoad(char *filename, off_t *nimage); 521 int ImageTableSave (char *filename, Image *images, off_t Nimages); 522 int select_mosaics_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage); -
trunk/Ohana/src/relastro/src/ConfigInit.c
r35105 r36630 18 18 if (VERBOSE) fprintf (stderr, "loaded config file: %s\n", file); 19 19 20 GetConfig (config, "RELASTRO_SIGMA_LIM", "%lf", 0, &SIGMA_LIM); // exclude measurements on this basis 21 GetConfig (config, "RELASTRO_SRC_MEAS_TOOFEW", "%d", 0, &SRC_MEAS_TOOFEW); 20 // set defaults for all of these if they are not used by parallel / remote clients 21 if (!ScanConfig (config, "RELASTRO_SIGMA_LIM", "%lf", 0, &SIGMA_LIM)) SIGMA_LIM = 0.01; 22 if (!ScanConfig (config, "RELASTRO_SRC_MEAS_TOOFEW", "%d", 0, &SRC_MEAS_TOOFEW)) SRC_MEAS_TOOFEW = 3; 22 23 23 24 if (!ScanConfig (config, "RELASTRO_IMFIT_CLIP_NITER", "%d", 0, &IMFIT_CLIP_NITER)) IMFIT_CLIP_NITER = 3; … … 25 26 if (!ScanConfig (config, "RELASTRO_IMFIT_SYS_SIGMA_LIM", "%lf", 0, &IMFIT_SYS_SIGMA_LIM)) IMFIT_SYS_SIGMA_LIM = 0.01; 26 27 27 GetConfig (config, "PM_DT_MIN", "%lf", 0, &PM_DT_MIN); 28 GetConfig (config, "PM_TOOFEW", "%d", 0, &PM_TOOFEW); 29 GetConfig (config, "POS_TOOFEW", "%d", 0, &POS_TOOFEW); 28 if (!ScanConfig (config, "PM_DT_MIN", "%lf", 0, &PM_DT_MIN)) PM_DT_MIN = 0.25; 29 if (!ScanConfig (config, "PM_TOOFEW", "%d", 0, &PM_TOOFEW)) PM_TOOFEW = 4; 30 if (!ScanConfig (config, "POS_TOOFEW", "%d", 0, &POS_TOOFEW)) POS_TOOFEW = 1; 31 if (!ScanConfig (config, "PAR_FACTOR_MIN", "%lf", 0, &PAR_FACTOR_MIN)) PAR_FACTOR_MIN = 0.2; 32 if (!ScanConfig (config, "RELASTRO_MAP_NX", "%d", 0, &NX_MAP)) NX_MAP = 5; 33 if (!ScanConfig (config, "RELASTRO_MAP_NY", "%d", 0, &NY_MAP)) NY_MAP = 5; 34 if (!ScanConfig (config, "RELASTRO_DPOS_MAX", "%lf", 0, &DPOS_MAX)) DPOS_MAX = 6.0; 35 if (!ScanConfig (config, "ADDSTAR_RADIUS", "%lf", 0, &ADDSTAR_RADIUS)) ADDSTAR_RADIUS = 1.0; 30 36 31 GetConfig (config, "PAR_FACTOR_MIN", "%lf", 0, &PAR_FACTOR_MIN); 32 33 GetConfig (config, "RELASTRO_MAP_NX", "%d", 0, &NX_MAP); 34 GetConfig (config, "RELASTRO_MAP_NY", "%d", 0, &NY_MAP); 35 GetConfig (config, "RELASTRO_DPOS_MAX", "%lf", 0, &DPOS_MAX); 36 GetConfig (config, "ADDSTAR_RADIUS", "%lf", 0, &ADDSTAR_RADIUS); 37 38 if (!ScanConfig (config, "USE_FIXED_PIXCOORDS", "%d", 0, &USE_FIXED_PIXCOORDS)) { 39 USE_FIXED_PIXCOORDS = FALSE; 40 } 37 if (!ScanConfig (config, "USE_FIXED_PIXCOORDS", "%d", 0, &USE_FIXED_PIXCOORDS)) USE_FIXED_PIXCOORDS = FALSE; 41 38 42 39 // force CATDIR to be absolute (so parallel mode will work) … … 56 53 sprintf (ImageCat, "%s/Images.dat", CATDIR); 57 54 58 if (!ScanConfig (config, "SKY_DEPTH", "%d", 0, &SKY_DEPTH)) { 59 SKY_DEPTH = 2; 60 } 61 if (!ScanConfig (config, "SKY_TABLE", "%s", 0, SKY_TABLE)) { 62 SKY_TABLE[0] = 0; 63 } 55 if (!ScanConfig (config, "SKY_DEPTH", "%d", 0, &SKY_DEPTH)) SKY_DEPTH = 2; 56 if (!ScanConfig (config, "SKY_TABLE", "%s", 0, SKY_TABLE)) SKY_TABLE[0] = 0; 64 57 65 58 if (*CATMODE == 0) strcpy (CATMODE, "RAW"); -
trunk/Ohana/src/relastro/src/ImageOps.c
r35763 r36630 226 226 Measure *measureBig = &catalog[cat].measure[meas]; 227 227 int TESTPT = FALSE; 228 TESTPT |= (measureBig->imageID == CAT_ID_SRC) && (measureBig->detID == OBJ_ID_SRC);229 TESTPT |= (measureBig->imageID == CAT_ID_DST) && (measureBig->detID == OBJ_ID_DST);228 TESTPT |= CAT_ID_SRC && OBJ_ID_SRC && (measureBig->imageID == CAT_ID_SRC) && (measureBig->detID == OBJ_ID_SRC); 229 TESTPT |= CAT_ID_DST && OBJ_ID_DST && (measureBig->imageID == CAT_ID_DST) && (measureBig->detID == OBJ_ID_DST); 230 230 if (TESTPT) { 231 231 fprintf (stderr, "got test det\n"); … … 462 462 int TESTPT = FALSE; 463 463 464 TESTPT |= (measure->imageID == CAT_ID_SRC) && (measure->detID == OBJ_ID_SRC);465 TESTPT |= (measure->imageID == CAT_ID_DST) && (measure->detID == OBJ_ID_DST);464 TESTPT |= CAT_ID_SRC && OBJ_ID_SRC && (measure->imageID == CAT_ID_SRC) && (measure->detID == OBJ_ID_SRC); 465 TESTPT |= CAT_ID_DST && OBJ_ID_DST && (measure->imageID == CAT_ID_DST) && (measure->detID == OBJ_ID_DST); 466 466 if (TESTPT) { 467 467 fprintf (stderr, "got test det\n"); -
trunk/Ohana/src/relastro/src/MosaicOps.c
r27581 r36630 11 11 12 12 // list of mosaic associated with each image 13 static off_t Nmosaic_for_images; // number of images (for off_ternal checks)13 static off_t Nmosaic_for_images; // number of images (for internal checks) 14 14 static off_t *mosaic_for_images; // array of: image -> mosaic 15 15 … … 105 105 mosaic[Nmosaic].secz = image[i].secz; 106 106 mosaic[Nmosaic].coords = image[i].coords; 107 mosaic[Nmosaic].myImage = i; 107 108 108 109 // init the mosaic_own_images array data … … 135 136 ALLOCATE (mosaic_for_images, off_t, Nmosaic_for_images); 136 137 138 // emit an error if we miss mosaics, but stop if we miss too many 139 int NmissMosaic = 0; 140 int NtestMosaic = 0; 141 137 142 /* now assign the WRP images to these mosaics */ 138 143 for (i = 0; i < Nimage; i++) { … … 140 145 141 146 if (strcmp(&image[i].coords.ctype[4], "-WRP")) continue; 147 NtestMosaic ++; 142 148 143 149 /* set image time range */ … … 147 153 Nmos = getMosaicByTimes (start, stop, startMos, stopMos, indexMos); 148 154 if (Nmos == -1) { 149 fprintf (stderr, "cannot match mosaic for %s\n", image[i].name); 155 if (NmissMosaic < 1000) { 156 fprintf (stderr, "cannot match mosaic for %s\n", image[i].name); 157 } 158 NmissMosaic ++; 150 159 continue; 151 160 } … … 164 173 } 165 174 175 fprintf (stderr, "mosaic matching : %d of possible %d failed to match\n", NmissMosaic, NtestMosaic); 176 if (NmissMosaic > 0.5*NtestMosaic) { 177 fprintf (stderr, "serious problem with mosaic matching\n"); 178 exit (5); 179 } 180 166 181 free (startMos); 167 182 free (stopMos); … … 250 265 if (im >= Nmosaic_for_images) abort(); 251 266 252 // search for the mosaic that 267 // search for the mosaic that matches this image 253 268 mos = mosaic_for_images[im]; 254 269 if (mos < 0) return NULL; … … 256 271 return &mosaic[mos]; 257 272 } 273 274 // extend each host image table to include the mosaic 'images' needed by the host 275 int select_mosaics_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage) { 276 277 int i; 278 off_t j; 279 char *mosaicUsed; 280 281 ALLOCATE (mosaicUsed, char, Nmosaic); 282 283 // we need to add the mosaics to each of the region hosts lists of images 284 for (i = 0; i < regionHosts->Nhosts; i++) { 285 286 int Nadd = 0; 287 int NADD = 100; 288 off_t *addMosaic = NULL; 289 ALLOCATE (addMosaic, off_t, NADD); 290 291 // reset the mosaicUsed flags (valid only for this host) 292 memset (mosaicUsed, 0, Nmosaic * sizeof(char)); 293 294 RegionHostInfo *host = ®ionHosts->hosts[i]; 295 296 // find the mosaics associated with a given 297 for (j = 0; j < host->Nimage; j++) { 298 299 int im = host->imseq[j]; 300 301 if (im < 0) abort(); 302 if (im >= Nmosaic_for_images) abort(); 303 304 // search for the mosaic that matches this image (skip unmatched images) 305 off_t mos = mosaic_for_images[im]; 306 if (mos < 0) continue; 307 308 if (mosaicUsed[mos]) continue; 309 310 mosaicUsed[mos] = TRUE; 311 addMosaic[Nadd] = mos; 312 Nadd ++; 313 314 CHECK_REALLOCATE (addMosaic, off_t, NADD, Nadd, 100); 315 } 316 317 REALLOCATE (host->image, Image, host->Nimage + Nadd); 318 319 for (j = 0; j < Nadd; j++) { 320 off_t mos = addMosaic[j]; 321 off_t mos_im = mosaic[mos].myImage; 322 323 host->image[host->Nimage + j] = image[mos_im]; 324 } 325 326 host->Nimage += Nadd; 327 } 328 return TRUE; 329 } 330 -
trunk/Ohana/src/relastro/src/StarMaps.c
r35105 r36630 59 59 off_t i, N, Nimages; 60 60 int xbin, ybin; 61 struct timeval start, stop;62 61 63 gettimeofday (&start, (void *) NULL);62 INITTIME; 64 63 65 64 // Images *images = getimages(&Nimages, NULL); return value ignored -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r36482 r36630 1 1 # include "relastro.h" 2 2 3 static off_t Nmax;3 static off_t Nmax; 4 4 static double *X, *dX; 5 5 static double *Y, *dY; … … 36 36 ALLOCATE (pX, double, MAX (1, Nmax)); 37 37 ALLOCATE (pY, double, MAX (1, Nmax)); 38 } 39 40 void freeObjectData () { 41 42 free (R); 43 free (D); 44 free (T); 45 free (X); 46 free (Y); 47 48 free (dR); 49 free (dD); 50 free (dT); 51 free (dX); 52 free (dY); 53 54 free (pX); 55 free (pY); 38 56 } 39 57 … … 205 223 if (((mode == FIT_PM_ONLY) || (mode == FIT_PM_AND_PAR)) && (N <= PM_TOOFEW)) mode = FIT_AVERAGE; 206 224 207 if ( FIT_TARGET == TARGET_HIGH_SPEED) {225 if (RELASTRO_OP == OP_HIGH_SPEED) { 208 226 Tmean = 0.5*(Tmax - Tmin); 209 227 } else { … … 412 430 } 413 431 432 freeObjectData (); 433 414 434 if (VERBOSE) fprintf (stderr, "fitted "OFF_T_FMT" objects ("OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par), skipped "OFF_T_FMT", "OFF_T_FMT" have too large an offset\n", (NaveSum + NpmSum + NparSum), NaveSum, NpmSum, NparSum, NskipSum, NoffSum); 415 435 return (TRUE); -
trunk/Ohana/src/relastro/src/args.c
r35763 r36630 13 13 /* possible operations */ 14 14 FIT_TARGET = TARGET_NONE; 15 RELASTRO_OP = OP_NONE; 15 16 FIT_MODE = FIT_AVERAGE; 16 17 … … 21 22 if (N > argc - 6) usage_merge_source(); 22 23 if (strcmp(argv[N+3], "into")) usage_merge_source(); 23 FIT_TARGET = TARGET_MERGE_SOURCE;24 RELASTRO_OP = OP_MERGE_SOURCE; 24 25 remove_argument (N, &argc, argv); 25 26 OBJ_ID_SRC = strtol(argv[N], &endptr, 0); … … 43 44 if ((N = get_argument (argc, argv, "-update-objects"))) { 44 45 remove_argument (N, &argc, argv); 45 FIT_TARGET = TARGET_UPDATE_OBJECTS;46 RELASTRO_OP = OP_UPDATE_OBJECTS; 46 47 } 47 48 48 49 if ((N = get_argument (argc, argv, "-update-offsets"))) { 49 50 remove_argument (N, &argc, argv); 50 FIT_TARGET = TARGET_UPDATE_OFFSETS; 51 RELASTRO_OP = OP_UPDATE_OFFSETS; 52 } 53 54 // elements needed for parallel regions / parallel images 55 REGION_FILE = NULL; 56 if ((N = get_argument (argc, argv, "-region-hosts"))) { 57 remove_argument (N, &argc, argv); 58 REGION_FILE = strcreate (argv[N]); 59 remove_argument (N, &argc, argv); 60 } 61 62 REGION_HOST_ID = 0; 63 if ((N = get_argument (argc, argv, "-region-hostID"))) { 64 remove_argument (N, &argc, argv); 65 REGION_HOST_ID = atoi (argv[N]); 66 remove_argument (N, &argc, argv); 67 } 68 69 IMAGE_TABLE = NULL; 70 if ((N = get_argument (argc, argv, "-parallel-images"))) { 71 remove_argument (N, &argc, argv); 72 RELASTRO_OP = OP_PARALLEL_IMAGES; 73 if (N >= argc) usage(); 74 IMAGE_TABLE = strcreate (argv[N]); 75 remove_argument (N, &argc, argv); 76 if (!REGION_FILE) usage(); 77 } 78 79 if ((N = get_argument (argc, argv, "-images"))) { 80 remove_argument (N, &argc, argv); 81 RELASTRO_OP = OP_IMAGES; 82 } 83 84 PARALLEL_REGIONS_MANUAL = FALSE; 85 if ((N = get_argument (argc, argv, "-parallel-regions"))) { 86 remove_argument (N, &argc, argv); 87 RELASTRO_OP = OP_PARALLEL_REGIONS; 88 if (!REGION_FILE) usage(); 89 if ((N = get_argument (argc, argv, "-parallel-regions-manual"))) { 90 remove_argument (N, &argc, argv); 91 PARALLEL_REGIONS_MANUAL = TRUE; 92 } 51 93 } 52 94 … … 90 132 // XXX include a parallax / no-parallax option 91 133 if (N >= argc - 4) usage(); 92 FIT_TARGET = TARGET_HIGH_SPEED;134 RELASTRO_OP = OP_HIGH_SPEED; 93 135 remove_argument (N, &argc, argv); 94 136 PHOTCODE_A_LIST = strcreate(argv[N]); … … 104 146 if ((N = get_argument (argc, argv, "-hpm"))) { 105 147 if (N >= argc - 2) usage(); 106 FIT_TARGET = TARGET_HPM;148 RELASTRO_OP = OP_HPM; 107 149 remove_argument (N, &argc, argv); 108 150 RADIUS = atof(argv[N]); … … 116 158 remove_argument (N, &argc, argv); 117 159 PARALLEL_OUTPUT = TRUE; 118 if (( FIT_TARGET != TARGET_HIGH_SPEED) && (FIT_TARGET != TARGET_HPM)) {160 if ((RELASTRO_OP != OP_HIGH_SPEED) && (RELASTRO_OP != OP_HPM)) { 119 161 fprintf (stderr, "-parallel-output only valid for -high-speed or -hpm modes\n"); 120 162 exit (1); … … 143 185 } 144 186 145 if (FIT_TARGET == TARGET_NONE) usage(); 187 if (RELASTRO_OP == OP_NONE) usage(); 188 189 if (((RELASTRO_OP == OP_IMAGES) || (RELASTRO_OP == OP_PARALLEL_REGIONS) || (RELASTRO_OP == OP_PARALLEL_IMAGES)) && (FIT_TARGET == TARGET_NONE)) usage(); 146 190 147 191 /* specify portion of the sky : allow default of all sky? */ … … 427 471 428 472 /* possible operations */ 429 FIT_TARGET= TARGET_NONE;473 RELASTRO_OP = TARGET_NONE; 430 474 FIT_MODE = FIT_AVERAGE; 431 475 … … 437 481 BCATALOG = NULL; 438 482 483 REGION_FILE = NULL; 484 REGION_HOST_ID = 0; 485 IMAGE_TABLE = NULL; 486 PARALLEL_REGIONS_MANUAL = FALSE; 487 439 488 HOST_ID = 0; 440 489 if ((N = get_argument (argc, argv, "-hostID"))) { … … 457 506 BCATALOG = strcreate(argv[N]); 458 507 remove_argument (N, &argc, argv); 459 FIT_TARGET = TARGET_LOAD_OBJECTS;508 RELASTRO_OP = OP_LOAD_OBJECTS; 460 509 } 461 510 462 511 if ((N = get_argument (argc, argv, "-update-objects"))) { 463 512 remove_argument (N, &argc, argv); 464 FIT_TARGET = TARGET_UPDATE_OBJECTS;513 RELASTRO_OP = OP_UPDATE_OBJECTS; 465 514 } 466 515 467 516 if ((N = get_argument (argc, argv, "-update-offsets"))) { 468 517 remove_argument (N, &argc, argv); 469 FIT_TARGET = TARGET_UPDATE_OFFSETS;518 RELASTRO_OP = OP_UPDATE_OFFSETS; 470 519 } 471 520 … … 487 536 // XXX include a parallax / no-parallax option 488 537 if (N >= argc - 5) usage_client(); 489 FIT_TARGET = TARGET_HIGH_SPEED;538 RELASTRO_OP = OP_HIGH_SPEED; 490 539 remove_argument (N, &argc, argv); 491 540 PHOTCODE_A_LIST = strcreate(argv[N]); … … 501 550 if ((N = get_argument (argc, argv, "-hpm"))) { 502 551 if (N >= argc - 3) usage(); 503 FIT_TARGET = TARGET_HPM;552 RELASTRO_OP = OP_HPM; 504 553 remove_argument (N, &argc, argv); 505 554 RADIUS = atof(argv[N]); … … 539 588 } 540 589 541 if ( FIT_TARGET == TARGET_NONE) usage_client();590 if (RELASTRO_OP == OP_NONE) usage_client(); 542 591 543 592 /* specify portion of the sky : allow default of all sky? */ … … 718 767 719 768 void usage () { 720 fprintf (stderr, "ERROR: USAGE: relastro -update-simple [options]\n"); 721 fprintf (stderr, " OR: relastro -update-chips [options]\n"); 722 fprintf (stderr, " OR: relastro -update-mosaic [options]\n"); 769 fprintf (stderr, "ERROR: USAGE: relastro -images -update-simple [options]\n"); 770 fprintf (stderr, " OR: relastro -images -update-chips [options]\n"); 771 fprintf (stderr, " OR: relastro -images -update-mosaic [options]\n"); 772 fprintf (stderr, " OR: relastro -parallel-regions -update-simple [options]\n"); 773 fprintf (stderr, " OR: relastro -parallel-regions -update-chips [options]\n"); 774 fprintf (stderr, " OR: relastro -parallel-regions -update-mosaic [options]\n"); 775 fprintf (stderr, " OR: relastro -parallel-images -update-simple [options]\n"); 776 fprintf (stderr, " OR: relastro -parallel-images -update-chips [options]\n"); 777 fprintf (stderr, " OR: relastro -parallel-images -update-mosaic [options]\n"); 723 778 fprintf (stderr, " OR: relastro -update-objects [options]\n"); 724 779 fprintf (stderr, " OR: relastro -high-speed [options]\n"); -
trunk/Ohana/src/relastro/src/initialize.c
r34429 r36630 6 6 args (argc, argv); 7 7 8 if ( FIT_TARGET == TARGET_MERGE_SOURCE) return;8 if (RELASTRO_OP == OP_MERGE_SOURCE) return; 9 9 10 10 fprintf (stderr, "PHOTCODE_KEEP_LIST: %s\n", PHOTCODE_KEEP_LIST); -
trunk/Ohana/src/relastro/src/load_catalogs.c
r35105 r36630 115 115 Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog) { 116 116 117 char uniquer[12]; 118 int TIME = time(NULL); 119 int PID = getpid(); 120 snprintf (uniquer, 12, "%05d.%05d", PID, TIME % 100000); 121 117 122 // load the list of hosts 118 123 HostTable *table = HostTableLoad (CATDIR, sky->hosts); … … 131 136 132 137 ALLOCATE (table->hosts[i].results, char, 1024); 133 snprintf (table->hosts[i].results, 1024, "%s/relastro.catalog. subset.dat", table->hosts[i].pathname);138 snprintf (table->hosts[i].results, 1024, "%s/relastro.catalog.%s.dat", table->hosts[i].pathname, uniquer); 134 139 135 140 // options / arguments that can affect relastro_client -load: -
trunk/Ohana/src/relastro/src/load_images.c
r35763 r36630 1 1 # include "relastro.h" 2 3 # define MARKTIME(MSG,...) { \4 float dtime; \5 gettimeofday (&stop, (void *) NULL); \6 dtime = DTIME (stop, start); \7 fprintf (stderr, MSG, __VA_ARGS__); }8 2 9 3 int load_images (FITS_DB *db, SkyList *skylist, int UseFullOverlap) { … … 12 6 off_t Nimage, Nsubset; 13 7 off_t *LineNumber; 14 struct timeval start, stop;15 8 16 gettimeofday (&start, (void *) NULL);9 INITTIME; 17 10 18 11 // convert database table to internal structure … … 35 28 36 29 /* unlock, if we can (else, unlocked below) */ 37 int unlockImages = !UPDATE || ( FIT_TARGET == TARGET_UPDATE_OFFSETS);30 int unlockImages = !UPDATE || (RELASTRO_OP == OP_UPDATE_OFFSETS); 38 31 if (unlockImages) dvo_image_unlock (db); 39 32 -
trunk/Ohana/src/relastro/src/relastro.c
r35763 r36630 10 10 SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch); 11 11 12 switch ( FIT_TARGET) {13 case TARGET_UPDATE_OBJECTS:12 switch (RELASTRO_OP) { 13 case OP_UPDATE_OBJECTS: 14 14 /* the object analysis is a separate process iterating over catalogs */ 15 15 relastro_objects (skylist, 0, NULL); 16 16 exit (0); 17 17 18 case TARGET_HIGH_SPEED:18 case OP_HIGH_SPEED: 19 19 /* high-speed is a 2pt cross-correlation process for linking moving objects (high PM) */ 20 20 high_speed_catalogs (sky, skylist, 0, NULL); 21 21 exit (0); 22 22 23 case TARGET_HPM:23 case OP_HPM: 24 24 hpm_catalogs (sky, skylist, 0, NULL); 25 25 exit (0); 26 26 27 case TARGET_MERGE_SOURCE:27 case OP_MERGE_SOURCE: 28 28 /* a special method to manually merge unlinked detections of sources togther (not parallel) */ 29 29 relastro_merge_source (sky); 30 30 exit (0); 31 31 32 case TARGET_SIMPLE: 33 case TARGET_CHIPS: 34 case TARGET_MOSAICS: 32 case OP_IMAGES: 35 33 relastro_images (skylist); 36 34 exit (0); 37 35 38 case TARGET_UPDATE_OFFSETS:36 case OP_UPDATE_OFFSETS: 39 37 // iterate over catalogs to make detection coordinates consistant 40 38 UpdateObjectOffsets (skylist, 0, NULL); 39 exit (0); 40 41 case OP_PARALLEL_REGIONS: 42 // run image updates in parallel across multiple remote machines 43 relastro_parallel_regions (); 44 exit (0); 45 46 case OP_PARALLEL_IMAGES: 47 // operation on the remote machines in the PARALLEL_REGION mode 48 relastro_parallel_images (); 41 49 exit (0); 42 50 -
trunk/Ohana/src/relastro/src/relastro_client.c
r35763 r36630 28 28 SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch); 29 29 30 switch ( FIT_TARGET) {30 switch (RELASTRO_OP) { 31 31 32 case TARGET_LOAD_OBJECTS: {32 case OP_LOAD_OBJECTS: { 33 33 // USAGE: relastro_client -load-objects 34 34 int Ncatalog; 35 35 Catalog *catalog = load_catalogs (skylist, &Ncatalog, TRUE, HOST_ID, HOSTDIR); 36 36 if (!catalog) { 37 fprintf (stderr, "ERROR loading catalogs from %s\n", CATDIR);38 exit (2);37 fprintf (stderr, "ERROR loading catalogs from %s\n", CATDIR); 38 exit (2); 39 39 } 40 40 BrightCatalog *bcatalog = BrightCatalogMerge (catalog, Ncatalog); 41 41 if (!BrightCatalogSave (BCATALOG, bcatalog)) { 42 fprintf (stderr, "ERROR saving bright catalog from %s\n", CATDIR);43 exit (2);42 fprintf (stderr, "ERROR saving bright catalog from %s\n", CATDIR); 43 exit (2); 44 44 } 45 45 break; 46 46 } 47 47 48 case TARGET_UPDATE_OBJECTS: {48 case OP_UPDATE_OBJECTS: { 49 49 // USAGE: relastro_client -update-objects 50 50 relastro_objects (skylist, HOST_ID, HOSTDIR); … … 52 52 } 53 53 54 case TARGET_HIGH_SPEED: {54 case OP_HIGH_SPEED: { 55 55 // USAGE: relastro_client -high-speed 56 56 high_speed_catalogs (sky, skylist, HOST_ID, HOSTDIR); … … 58 58 } 59 59 60 case TARGET_HPM: {60 case OP_HPM: { 61 61 // USAGE: relastro_client -high-speed 62 62 hpm_catalogs (sky, skylist, HOST_ID, HOSTDIR); … … 64 64 } 65 65 66 // XXX loading the images is fairly costly -- see if we can do an image subset 67 case TARGET_UPDATE_OFFSETS: {66 // XXX loading the images is fairly costly -- see if we can do an image subset? 67 case OP_UPDATE_OFFSETS: { 68 68 FITS_DB db; 69 69 -
trunk/Ohana/src/relastro/src/relastro_images.c
r35763 r36630 6 6 Catalog *catalog; 7 7 FITS_DB db; 8 struct timeval start, stop;9 8 10 gettimeofday (&start, (void *) NULL);9 INITTIME; 11 10 12 11 /* register database handle with shutdown procedure */ -
trunk/Ohana/src/relastro/src/relastro_objects.c
r35763 r36630 144 144 // PM_TOOFEW 145 145 // SRC_MEAS_TOOFEW 146 // FIT_TARGET147 146 148 147 char command[1024]; -
trunk/Ohana/src/relastro/src/resort_catalog.c
r34088 r36630 30 30 if (catalog[0].sorted == TRUE) return; 31 31 32 // struct timeval start, stop; 33 // gettimeofday (&start, NULL); 32 // INITTIME; 34 33 35 34 /* internal counters */ -
trunk/Ohana/src/relastro/src/select_images.c
r36482 r36630 15 15 void dsortindex (double *X, off_t *Y, int N); 16 16 off_t getRegionStartByRA (double R, double *Rref, off_t Nregions); 17 18 # define MARKTIME(MSG,...) { \19 float dtime; \20 gettimeofday (&stop, (void *) NULL); \21 dtime = DTIME (stop, start); \22 fprintf (stderr, MSG, __VA_ARGS__); }23 17 24 18 Image *select_images (SkyList *skylist, Image *timage, off_t Ntimage, off_t **LineNumber, off_t *Nimage, int UseFullOverlap) { … … 31 25 Coords tcoords; 32 26 SkyRegionCoords *skycoords; 33 struct timeval start, stop;34 27 35 28 double RmaxSkyRegion, RminSkyRegion, RmidSkyRegion, DminSkyRegion, DmaxSkyRegion; … … 50 43 } 51 44 52 gettimeofday (&start, (void *) NULL);45 INITTIME; 53 46 54 47 // the comparison is made in the catalog local projection. below we set crval1,2 … … 132 125 if (NphotcodesKeep > 0) { 133 126 found = FALSE; 134 // XXX this bit of code excludes DIS mosaics and should be fixed 127 // we have to keep DIS mosaics explicitly (photcode = 0) 128 if (!strcmp(&timage[i].coords.ctype[4], "-DIS")) found = TRUE; 135 129 for (k = 0; (k < NphotcodesKeep) && !found; k++) { 136 130 if (photcodesKeep[k][0].code == timage[i].photcode) found = TRUE; -
trunk/Ohana/src/relphot/Makefile
r35416 r36630 47 47 $(SRC)/relphot_images.$(ARCH).o \ 48 48 $(SRC)/relphot_objects.$(ARCH).o \ 49 $(SRC)/relphot_parallel_regions.$(ARCH).o \ 50 $(SRC)/relphot_parallel_images.$(ARCH).o \ 49 51 $(SRC)/select_images.$(ARCH).o \ 52 $(SRC)/assign_images.$(ARCH).o \ 53 $(SRC)/launch_region_hosts.$(ARCH).o \ 54 $(SRC)/ImageTable.$(ARCH).o \ 55 $(SRC)/ImageMagIO.$(ARCH).o \ 56 $(SRC)/syncfile.$(ARCH).o \ 57 $(SRC)/share_image_mags.$(ARCH).o \ 58 $(SRC)/share_mean_mags.$(ARCH).o \ 59 $(SRC)/MeanMagIO.$(ARCH).o \ 60 $(SRC)/indexCatalog.$(ARCH).o \ 50 61 $(SRC)/client_logger.$(ARCH).o \ 51 62 $(SRC)/setExclusions.$(ARCH).o \ -
trunk/Ohana/src/relphot/doc/parallel.txt
r33651 r36630 1 2 2014.02.15 3 4 Nearly done with the relphot mods. some outstanding questions; 5 6 * image vs mosaic? 7 * how do decide which images need to be shared? 8 9 2014.02.14 10 11 more relphot notes: 12 13 * I load the catalogs, with a 14 15 2014.02.12 16 17 I am making progess on the relphot -parallel-regions implementation. some things I need to deal with: 18 19 * assign_images: select mosaics for all images saved for a given host (need to supply them as well) 20 ** I need to decide on the Image / Mosaic split. If I am calibrating by image, then the image center defines ownership 21 ** if I am calibrating by exposure, then the mosaic center must define ownership 22 o determine SkyList covering the images for region host 23 o tag detections and objects which I own or do not own 24 o ImageOps.c / matchImage matches detections to images and needs to handle mine / not mine cases 25 o ditto for matchMosaics 26 o load_catalogs : I need to make my requested catalogs unique (just add uniquer to load_catalogs.c:130 27 o figure out what fields I'm saving in meanmags and how to construct it 28 -- mag, objID, catID, photcode, (dmag or other stats?) 29 * from which hosts do I slurp mean mags? 30 o function to merge a new meanmag array into the existing one 31 o how to go from (objID,catID) to a given catalog[i].average[j] 32 33 2014.02.06 34 35 ** a single region-level host owns images for which the center lands 36 in its region. 37 38 ** it owns detections which come from images which it owns 39 40 ** it owns objects which land in its region 41 42 Extending parallel relphot processing to split the sky (and images) 43 into regions, each of which runs in parallel at the same time: 44 45 Top Level (relphot -parallel-images): 46 * define regions of the sky -> hosts 47 * load images, assign to hosts 48 * launch region-level jobs on remote hosts 49 50 Region Level (relphot -parallel-images-region) 51 * load my image subset table 52 * request objects and detections for my skyregion 53 * match images & objects, etc 54 55 * update my image parameters 56 * update my detections 57 * write out detections 58 * load detections from my border hosts 59 * match to my objects 60 * update my objects 61 * write out objects 62 * load objects from my border hosts 63 * update images 64 (iterate N times) 65 * write out image parameters 66 67 Top Level 68 * read image parameters, update 69 * update objects 1 70 2 71 2012.02.13 -
trunk/Ohana/src/relphot/include/relphot.h
r36528 r36630 23 23 // # define IDX_T off_t 24 24 # define IDX_T int 25 26 typedef enum { 27 MODE_ERROR = 0, 28 UPDATE_IMAGES, 29 UPDATE_AVERAGES, 30 PARALLEL_REGIONS, 31 PARALLEL_IMAGES, 32 APPLY_OFFSETS, 33 } RelphotMode; 25 34 26 35 typedef enum { … … 108 117 109 118 typedef struct { 119 float M; 120 float dM; 121 float Xm; 122 int Nsec; 123 unsigned int objID; 124 unsigned int catID; 125 int photcode; 126 } MeanMag; 127 128 typedef struct { 129 float Mcal; 130 float dMcal; 131 float dMagSys; 132 float Xm; 133 int nFitPhotom; 134 int flags; 135 unsigned int imageID; 136 short ubercalDist; 137 } ImageMag; 138 139 typedef struct { 110 140 AverageTiny *average; // array of (minimal) average data 111 141 MeasureTiny *measure; // array of (minimal) measure data … … 155 185 int SKY_DEPTH; /** XXX EAM : depth of catalog tables, fix usage */ 156 186 187 // globals for parallel region operations 188 char *REGION_FILE; 189 char *IMAGE_TABLE; 190 int REGION_HOST_ID; 191 157 192 int HOST_ID; 158 193 char *HOSTDIR; … … 179 214 int PARALLEL_MANUAL; 180 215 int PARALLEL_SERIAL; 216 217 int PARALLEL_REGIONS_MANUAL; 181 218 182 219 int NTHREADS; … … 266 303 void InterpolateGrid PROTO((float *buffer, int Nx, int Ny, Coords *ccd, Coords *gcoords)); 267 304 off_t *SelectRefMosaic PROTO((Mosaic **refmosaic, off_t *Nimage)); 268 intargs PROTO((int argc, char **argv));305 RelphotMode args PROTO((int argc, char **argv)); 269 306 int args_client PROTO((int argc, char **argv)); 270 307 int bcatalog PROTO((Catalog *subcatalog, Catalog *catalog, int Ncat)); … … 279 316 void findImages PROTO((Catalog *catalog, int Ncatalog, int doImageList)); 280 317 int findMosaics PROTO((Catalog *catalog, int Ncatalog, int doMosaicList)); 318 319 void makeMosaics (Image *image, off_t Nimage); 320 Mosaic *getMosaicForImage (off_t im); 321 void setMosaicCenters (Image *image, off_t Nimage); 281 322 282 323 void set_db (FITS_DB *in); … … 315 356 void initMosaics PROTO((Image *subset, off_t Nsubset, Image *image, char *inSubset, off_t Nimage)); 316 357 void initMrel PROTO((Catalog *catalog, int Ncatalog)); 317 voidinitialize PROTO((int argc, char **argv));358 RelphotMode initialize PROTO((int argc, char **argv)); 318 359 void initialize_client PROTO((int argc, char **argv)); 319 360 void liststats_setmode PROTO((StatType *stats, char *strmode)); … … 426 467 int init_synthetic_mags (); 427 468 int add_synthetic_mags (AverageTiny *average, SecFilt *secfilt, MeasureTiny *measure, off_t *Nmeasure, off_t *Nm); 469 470 int relphot_parallel_regions (); 471 472 int assign_images (FITS_DB *db, RegionHostTable *regionHosts); 473 int select_images_hostregion (RegionHostTable *hosts, Image *image, off_t Nimage); 474 int find_host_for_coords (RegionHostTable *regionHosts, double R, double d); 475 int calculate_image_bounds (Image *image, double *rmin, double *rmax, double *dmin, double *dmax, double Rmid); 476 477 int launch_region_hosts (RegionHostTable *regionHosts); 478 int strextend (char *input, char *format,...); 479 480 Image *ImageTableLoad(char *filename, off_t *nimage); 481 int ImageTableSave (char *filename, Image *images, off_t Nimages); 482 483 int indexCatalogs (Catalog *catalog, int Ncatalog); 484 int catID_and_objID_to_seq (int catID, int objID, int *catSeq, off_t *objSeq); 485 486 int check_sync_file (char *filename, int nloop); 487 int clear_sync_file (char *filename); 488 int update_sync_file (char *filename, int nloop); 489 char *make_filename (char *dirname, char *hostname, int hostID, char *tailname); 490 491 int share_mean_mags (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop); 492 int slurp_mean_mags (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop); 493 int set_mean_mags (MeanMag *meanmags, AverageTiny *average, SecFilt *secfilt, int Nsec); 494 MeanMag *merge_mean_mags (MeanMag *target, int *ntarget, MeanMag *source, int Nsource); 495 496 MeanMag *MeanMagLoad(char *filename, off_t *nmeanmags); 497 int MeanMagSave(char *filename, MeanMag *meanmags, off_t Nmeanmags); 498 499 int share_image_mags (RegionHostTable *regionHosts, int nloop); 500 int slurp_image_mags (RegionHostTable *regionHosts, int nloop); 501 int set_image_mags (ImageMag *image_mags, Image *image); 502 ImageMag *merge_image_mags (ImageMag *target, int *ntarget, ImageMag *source, int Nsource); 503 504 ImageMag *ImageMagLoad(char *filename, off_t *nimage_mags); 505 int ImageMagSave(char *filename, ImageMag *image_mags, off_t Nimage_mags); 506 507 int markObjects (Catalog *catalog, int Ncatalog); 508 509 int relphot_parallel_images (); 510 int relphot_parallel_regions (); -
trunk/Ohana/src/relphot/src/BrightCatalog.c
r33651 r36630 101 101 measure[i].catID = catID[i]; 102 102 measure[i].photcode = photcode[i]; 103 measure[i].myDet = FALSE; 103 104 } 104 105 fprintf (stderr, "loaded data for %lld measure\n", (long long) Nrow); … … 141 142 GET_COLUMN(flags, "FLAGS", int); 142 143 GET_COLUMN(catID, "CAT_ID", int); 144 GET_COLUMN(objID, "OBJ_ID", int); 143 145 gfits_free_header (&theader); 144 146 gfits_free_table (&ftable); … … 153 155 average[i].flags = flags[i]; 154 156 average[i].catID = catID[i]; 157 average[i].objID = objID[i]; 158 average[i].nOwn = 0; 155 159 } 156 160 fprintf (stderr, "loaded data for %lld average\n", (long long) Nrow); … … 162 166 free (flags ); 163 167 free (catID ); 168 free (objID ); 164 169 165 170 catalog->average = average; … … 370 375 gfits_define_bintable_column (&theader, "J", "FLAGS", "flags", NULL, 1.0, 0.0); 371 376 gfits_define_bintable_column (&theader, "J", "CAT_ID", "catalog ref", NULL, 1.0, 0.0); 377 gfits_define_bintable_column (&theader, "J", "OBJ_ID", "object ref", NULL, 1.0, 0.0); 372 378 373 379 // generate the output array that carries the data … … 381 387 int *flags ; ALLOCATE (flags, int, catalog->Naverage); 382 388 int *catID ; ALLOCATE (catID, int, catalog->Naverage); 389 int *objID ; ALLOCATE (objID, int, catalog->Naverage); 383 390 384 391 // assign the storage arrays … … 391 398 flags[i] = average[i].flags; 392 399 catID[i] = average[i].catID; 400 objID[i] = average[i].objID; 393 401 } 394 402 … … 400 408 gfits_set_bintable_column (&theader, &ftable, "FLAGS", flags, catalog->Naverage); 401 409 gfits_set_bintable_column (&theader, &ftable, "CAT_ID", catID, catalog->Naverage); 410 gfits_set_bintable_column (&theader, &ftable, "OBJ_ID", objID, catalog->Naverage); 402 411 403 412 free (R ); … … 407 416 free (flags ); 408 417 free (catID ); 418 free (objID ); 409 419 410 420 gfits_fwrite_Theader (f, &theader); -
trunk/Ohana/src/relphot/src/ImageOps.c
r36491 r36630 244 244 245 245 int Nmatch = 0; 246 for (i = 0; i < Ncatalog; i++) {246 for (i = 0; i < Ncatalog; i++) { 247 247 for (j = 0; j < catalog[i].Nmeasure; j++) { 248 catalog[i].measureT[j].myDet = FALSE; // a detetion is not mine until proven otherwise 248 249 ecode = GetPhotcodeEquivCodebyCode (catalog[i].measureT[j].photcode); 250 251 // skip measurements which do not match one of the requested photcodes ( 252 // (do we not already exclude in bcatalog -- maybe needed for reload_objects? 249 253 found = FALSE; 250 254 for (Ns = 0; !found && (Ns < Nphotcodes); Ns++) { … … 252 256 } 253 257 if (!found) continue; 258 259 // if we match one of our images, myDet gets set to TRUE 254 260 matchImage (catalog, j, i, doImageList); 255 261 Nmatch ++; … … 322 328 return; 323 329 } 330 catalog[cat].measureT[meas].myDet = TRUE; 324 331 325 332 if (USE_GRID) { -
trunk/Ohana/src/relphot/src/MosaicOps.c
r36491 r36630 320 320 } 321 321 322 /* find mosaic frames (unique time periods) (NOTE : we do NOT require matching photcodes but we 323 match images by MOSAICNAME. this last point is weak: it forces a single camera at a time. 324 we can extend the logic to multiple cameras if we make list of MOSAICNAMES (better to assign a camera ID) 325 */ 326 void makeMosaics (Image *image, off_t Nimage) { 327 328 off_t i, j, status, found, NMOSAIC, *MosaicN_IMAGE; 329 unsigned int start, stop, *startTimes, *startTimesMosaic; 330 char *pname; 331 332 if (!MOSAIC_ZEROPT) return; 333 334 INITTIME; 335 336 /* a 'mosaic' in relphot is (unlike relastro) a virtual concept: there is no 337 * entry in the image table that represents this mosaic. Instead, it is an 338 * internal construct that defines a group of related images 339 */ 340 341 // generate a list of all image start times 342 ALLOCATE (startTimes, unsigned int, Nimage); 343 for (i = 0; i < Nimage; i++) { 344 startTimes[i] = image[i].tzero; 345 } 346 sort_times (startTimes, Nimage); 347 MARKTIME("create array of all image obstimes: %f sec\n", dtime); 348 349 Nmosaic = 0; 350 NMOSAIC = 1000; 351 ALLOCATE (startTimesMosaic, unsigned int, NMOSAIC); 352 startTimesMosaic[0] = startTimes[0]; 353 354 // generate a list of the unique start times (these define the mosaics) 355 for (i = 0; i < Nimage; i++) { 356 if (startTimes[i] < startTimesMosaic[Nmosaic]) { 357 fprintf (stderr, "error?\n"); 358 abort(); 359 } 360 if (startTimes[i] == startTimesMosaic[Nmosaic]) continue; 361 Nmosaic ++; 362 if (Nmosaic >= NMOSAIC) { 363 NMOSAIC += 1000; 364 REALLOCATE (startTimesMosaic, unsigned int, NMOSAIC); 365 } 366 startTimesMosaic[Nmosaic] = startTimes[i]; 367 } 368 Nmosaic ++; 369 MARKTIME("create array of mosaic obstimes: %f sec\n", dtime); 370 371 // now I have a list of uniq start times, and they are in order 372 // create the mosaic arrays for these times 373 ALLOCATE (mosaic, Mosaic, Nmosaic); 374 375 ALLOCATE (MosaicToImage, off_t *, Nmosaic); 376 ALLOCATE (MosaicN_Image, off_t, Nmosaic); 377 ALLOCATE (MosaicN_IMAGE, off_t, Nmosaic); 378 379 // init the mosaic array values 380 for (i = 0; i < Nmosaic; i++) { 381 mosaic[i].start = startTimesMosaic[i]; 382 mosaic[i].stop = 0; 383 mosaic[i].Mcal = 0.0; 384 mosaic[i].dMcal = 0.0; 385 mosaic[i].dMsys = 0.0; 386 mosaic[i].Xm = 0.0; 387 mosaic[i].flags = 0; 388 mosaic[i].secz = NAN; 389 mosaic[i].photcode = 0; 390 mosaic[i].skipCal = FALSE; 391 392 memset (&mosaic[i].coords, 0, sizeof(Coords)); 393 394 MosaicN_IMAGE[i] = 10; 395 MosaicN_Image[i] = 0; 396 ALLOCATE (MosaicToImage[i], off_t, MosaicN_IMAGE[i]); 397 MosaicToImage[i][0] = -1; 398 } 399 400 ALLOCATE (ImageToMosaic, off_t, Nimage); // mosaic to which image belongs 401 402 // assign each image to a mosaic 403 for (i = 0; i < Nimage; i++) { 404 ImageToMosaic[i] = -1; 405 406 /* select valid mosaic images by photcode */ 407 pname = GetPhotcodeNamebyCode (image[i].photcode); 408 if (!pname) continue; 409 410 status = strncmp (pname, MOSAICNAME, strlen (MOSAICNAME)); 411 if (status) continue; 412 413 start = image[i].tzero; 414 stop = image[i].tzero + MAX(1.01*image[i].trate*image[i].NY, 1); 415 416 j = findMosaic(startTimesMosaic, Nmosaic, start); 417 if (j == -1) { 418 fprintf (stderr, "programming error? all image images should belong to a mosaic\n"); 419 abort(); 420 } 421 422 // add reference from image to mosaic 423 ImageToMosaic[i] = j; 424 425 // have we already found this mosaic? 426 found = (MosaicN_Image[j] > 0); 427 428 /* add image to mosaic image list */ 429 MosaicToImage[j][MosaicN_Image[j]] = i; 430 MosaicN_Image[j] ++; 431 if (MosaicN_Image[j] == MosaicN_IMAGE[j]) { 432 MosaicN_IMAGE[j] += 10; 433 REALLOCATE (MosaicToImage[j], off_t, MosaicN_IMAGE[j]); 434 } 435 if (found) continue; 436 437 /* a new mosaic, define ranges */ 438 if (mosaic[j].start != start) { 439 fprintf (stderr, "error?\n"); 440 abort(); 441 } 442 mosaic[j].stop = stop; 443 mosaic[j].Mcal = 0.0; 444 mosaic[j].dMcal = 0.0; 445 mosaic[j].Xm = 0.0; 446 mosaic[j].dMsys = image[i].flags; 447 mosaic[j].flags = image[i].flags; 448 mosaic[j].secz = image[i].secz; 449 mosaic[j].photcode = GetPhotcodeEquivCodebyCode (image[i].photcode); 450 } 451 MARKTIME("assign images to mosaic: %f sec\n", dtime); 452 453 // free this or not? 454 free (MosaicN_IMAGE); 455 free (startTimes); 456 free (startTimesMosaic); 457 458 fprintf (stderr, "matched %d images to %d mosaics\n", (int) Nimage, (int) Nmosaic); 459 460 return; 461 } 462 463 Mosaic *getMosaicForImage (off_t im) { 464 465 if (im < 0) return NULL; 466 if (!ImageToMosaic) return NULL; 467 468 off_t m = ImageToMosaic[im]; 469 if (m < 0) return NULL; 470 if (m >= Nmosaic) return NULL; 471 472 return (&mosaic[m]); 473 } 474 322 475 // use bisection to find the overlapping mosaic (returns exact match) 323 476 // startTimes is a sorted, unique list of times … … 350 503 } 351 504 return (-1); 505 } 506 507 void setMosaicCenters (Image *image, off_t Nimage) { 508 509 /* find max dR, dD range for all mosaics */ 510 /* define mosaic.coords to cover dR, dD */ 511 /* send results to initGridBins */ 512 513 off_t i, j, m, NX, NY, NC, Nc; 514 double R, D, Rmid, Dmid; 515 double Mcal, dMcal, Xm; 516 double *Rc, *Dc; 517 518 NC = 100; 519 ALLOCATE (Rc, double, NC); 520 ALLOCATE (Dc, double, NC); 521 522 for (i = 0; i < Nmosaic; i++) { 523 Nc = 0; 524 Rmid = Dmid = NAN; 525 Mcal = dMcal = Xm = 0; 526 for (j = 0; j < MosaicN_Image[i]; j++) { 527 m = MosaicToImage[i][j]; 528 529 if (!FindMosaicForImage (image, Nimage, m)) { 530 if (VERBOSE2) fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i); 531 continue; 532 } 533 534 NX = image[m].NX; 535 NY = image[m].NY; 536 XY_to_RD (&R, &D, 0.5*NX, 0.5*NY, &image[m].coords); 537 R = ohana_normalize_angle_to_midpoint (R, 180.0); 538 539 // Exclude images with crazy astrometry 540 // XXX NOTE : this is gpc1-specific 541 { 542 double dP1 = hypot(image[m].coords.pc1_1, image[m].coords.pc1_2); 543 double dP2 = hypot(image[m].coords.pc2_1, image[m].coords.pc2_2); 544 if (fabs(dP1 - 1.0) > 0.02) continue; 545 if (fabs(dP2 - 1.0) > 0.02) continue; 546 547 double X00, Y00, X10, Y10, X01, Y01; 548 XY_to_LM (&X00, &Y00, 0.0, 0.0, &image[m].coords); 549 XY_to_LM (&X10, &Y10, image[m].NX, 0.0, &image[m].coords); 550 XY_to_LM (&X01, &Y01, 0.0, image[m].NY, &image[m].coords); 551 double dS0 = hypot ((X00 - X10), (Y00 - Y10)); 552 double dS1 = hypot ((X00 - X01), (Y00 - Y01)); 553 if (dS0 > 6000) continue; 554 if (dS1 > 6500) continue; 555 } 556 557 Rc[Nc] = R; 558 Dc[Nc] = D; 559 Nc ++; 560 if (Nc >= NC) { 561 NC += 100; 562 REALLOCATE (Rc, double, NC); 563 REALLOCATE (Dc, double, NC); 564 } 565 566 Mcal += image[m].Mcal; 567 dMcal += image[m].dMcal; 568 Xm += image[m].Xm; 569 570 // for ubercal images, we (elsewhere) keep Mcal frozen 571 572 /* we are using mosaic.Mcal, not image.Mcal. reset image.Mcal */ 573 image[m].Mcal = 0.0; 574 image[m].dMcal = NAN; 575 image[m].Xm = NAN_S_SHORT; 576 } 577 578 if (Nc > 0) { 579 dsort (Rc, Nc); 580 if (Rc[Nc-1] - Rc[0] > 180.0) { 581 // in our list, Rc is in the range 0.0 to 360.0. 582 // any mosaic which is close to the 0.0, 360.0 boundary may have some on 583 // one side or the other. count how many have values more than Rc[0] + 180. 584 // if more than half are at the large end, re-normalize to that range 585 int Nbig = 0; 586 for (j = 1; j < Nc; j++) { 587 if (Rc[j] - Rc[0] > 180.0) Nbig ++; 588 } 589 if (Nbig > 0.5*Nc) { 590 for (j = 0; j < Nc; j++) { 591 Rc[j] = ohana_normalize_angle_to_midpoint (Rc[j], 360.0); 592 } 593 dsort (Rc, Nc); 594 } else if (Nbig > 0) { 595 for (j = 0; j < Nc; j++) { 596 Rc[j] = ohana_normalize_angle_to_midpoint (Rc[j], 0.0); 597 } 598 dsort (Rc, Nc); 599 } 600 } 601 dsort (Dc, Nc); 602 603 Rmid = Rc[(int)(0.5*Nc)]; 604 Dmid = Dc[(int)(0.5*Nc)]; 605 } 606 607 strcpy (mosaic[i].coords.ctype, "DEC--TAN"); 608 mosaic[i].coords.crval1 = Rmid; 609 mosaic[i].coords.crval2 = Dmid; 610 mosaic[i].coords.crpix1 = 0.0; 611 mosaic[i].coords.crpix2 = 0.0; 612 mosaic[i].coords.cdelt1 = 1.0 / 3600.0; 613 mosaic[i].coords.cdelt2 = 1.0 / 3600.0; 614 mosaic[i].coords.pc1_1 = 1.0; 615 mosaic[i].coords.pc2_2 = 1.0; 616 mosaic[i].coords.pc1_2 = 0.0; 617 mosaic[i].coords.pc2_1 = 0.0; 618 619 mosaic[i].Mcal = Mcal / MosaicN_Image[i]; 620 mosaic[i].dMcal = dMcal / MosaicN_Image[i]; 621 mosaic[i].Xm = Xm / MosaicN_Image[i]; 622 } 623 return; 352 624 } 353 625 … … 527 799 528 800 if (!MOSAIC_ZEROPT) return (FALSE); 801 // if we are calibrating by mosaic, redefine myDet == on one of my mosaics 529 802 530 803 int Nmatch = 0; 531 804 for (i = 0; i < Ncatalog; i++) { 532 805 for (j = 0; j < catalog[i].Nmeasure; j++) { 806 catalog[i].measureT[j].myDet = FALSE; // a detetion is not mine until proven otherwise 807 533 808 if (TimeSelect) { 534 809 if (catalog[i].measureT[j].t < TSTART) continue; … … 582 857 } 583 858 859 // this measurement is on one of my mosaics, mark it as mine. 860 catalog[cat].measureT[meas].myDet = TRUE; 584 861 MeasureToMosaic[cat][meas] = mosID; 585 862 -
trunk/Ohana/src/relphot/src/StarOps.c
r36528 r36630 908 908 } 909 909 910 int markObjects (Catalog *catalog, int Ncatalog) { 911 912 int i, n; 913 off_t j; 914 915 // How strongly do I own this object? 916 for (i = 0; i < Ncatalog; i++) { 917 for (j = 0; j < catalog[i].Naverage; j++) { 918 int nOwn = 0; 919 int m = catalog[i].averageT[j].measureOffset; 920 for (n = 0; n < catalog[i].averageT[j].Nmeasure; n++) { 921 if (!catalog[i].measureT[m+n].myDet) continue; 922 nOwn ++; 923 } 924 catalog[i].averageT[j].nOwn = nOwn; 925 } 926 } 927 return TRUE; 928 } 929 930 int dumpObjects (char *filename, Catalog *catalog, int Ncatalog) { 931 932 int i, n; 933 off_t j; 934 935 FILE *ftest = fopen (filename, "w"); 936 937 for (i = 0; i < Ncatalog; i++) { 938 for (j = 0; j < catalog[i].Naverage; j++) { 939 int m = catalog[i].averageT[j].measureOffset; 940 for (n = 0; n < catalog[i].averageT[j].Nmeasure; n++) { 941 fprintf (ftest, "%08x %08x %10.6f %10.6f %3d %1d\n", catalog[i].averageT[j].catID, catalog[i].averageT[j].objID, catalog[i].averageT[j].R, catalog[i].averageT[j].D, catalog[i].averageT[j].Nmeasure, catalog[i].measureT[m+n].myDet); 942 } 943 } 944 } 945 fclose (ftest); 946 return TRUE; 947 } 948 910 949 void clean_stars (Catalog *catalog, int Ncatalog) { 911 950 -
trunk/Ohana/src/relphot/src/args.c
r36491 r36630 1 1 # include "relphot.h" 2 2 3 intargs (int argc, char **argv) {3 RelphotMode args (int argc, char **argv) { 4 4 5 5 int N; 6 6 double trange; 7 8 /* define time */ 9 TimeSelect = FALSE; 10 if ((N = get_argument (argc, argv, "-time"))) { 11 remove_argument (N, &argc, argv); 12 if (!ohana_str_to_time (argv[N], &TSTART)) { 13 fprintf (stderr, "ERROR: syntax error\n"); 14 return (MODE_ERROR); 15 } 16 remove_argument (N, &argc, argv); 17 if (!ohana_str_to_dtime (argv[N], &trange)) { 18 if (!ohana_str_to_time (argv[N], &TSTOP)) { 19 fprintf (stderr, "ERROR: syntax error\n"); 20 return (MODE_ERROR); 21 } 22 } else { 23 if (trange < 0) { 24 trange = fabs (trange); 25 TSTOP = TSTART; 26 TSTART -= trange; 27 } else { 28 TSTOP = TSTART + trange; 29 } 30 } 31 remove_argument (N, &argc, argv); 32 TimeSelect = TRUE; 33 } 34 35 /* specify portion of the sky */ 36 UserPatch.Rmin = 0; 37 UserPatch.Rmax = 360; 38 UserPatch.Dmin = -90; 39 UserPatch.Dmax = +90; 40 if ((N = get_argument (argc, argv, "-region"))) { 41 remove_argument (N, &argc, argv); 42 UserPatch.Rmin = atof (argv[N]); 43 remove_argument (N, &argc, argv); 44 UserPatch.Rmax = atof (argv[N]); 45 remove_argument (N, &argc, argv); 46 UserPatch.Dmin = atof (argv[N]); 47 remove_argument (N, &argc, argv); 48 UserPatch.Dmax = atof (argv[N]); 49 remove_argument (N, &argc, argv); 50 } 51 52 /* specify region file by name (eg n0000/0000.00) */ 53 UserCatalog = NULL; 54 if ((N = get_argument (argc, argv, "-catalog"))) { 55 remove_argument (N, &argc, argv); 56 UserCatalog = strcreate (argv[N]); 57 remove_argument (N, &argc, argv); 58 } 59 60 USE_BASIC_CHECK = FALSE; 61 if ((N = get_argument (argc, argv, "-basic-image-search"))) { 62 remove_argument (N, &argc, argv); 63 USE_BASIC_CHECK = TRUE; 64 } 65 66 USE_FULL_OVERLAP = TRUE; 67 if ((N = get_argument (argc, argv, "-sloppy-image-overlap"))) { 68 remove_argument (N, &argc, argv); 69 USE_FULL_OVERLAP = FALSE; 70 } 71 72 SET_MREL_VERSION = 1; 73 if ((N = get_argument (argc, argv, "-set-mrel-version"))) { 74 remove_argument (N, &argc, argv); 75 SET_MREL_VERSION = atof(argv[N]); 76 remove_argument (N, &argc, argv); 77 } 78 79 VERBOSE = VERBOSE2 = FALSE; 80 if ((N = get_argument (argc, argv, "-v"))) { 81 VERBOSE = TRUE; 82 remove_argument (N, &argc, argv); 83 } 84 if ((N = get_argument (argc, argv, "-vv"))) { 85 VERBOSE2 = VERBOSE = TRUE; 86 remove_argument (N, &argc, argv); 87 } 88 89 NTHREADS = 0; 90 if ((N = get_argument (argc, argv, "-threads"))) { 91 remove_argument (N, &argc, argv); 92 NTHREADS = atof (argv[N]); 93 remove_argument (N, &argc, argv); 94 } 95 96 // XXX for the moment, make this selection manual. it needs to be automatic 97 // based on the state of the SkyTable 98 HOST_ID = 0; 99 PARALLEL = FALSE; 100 if ((N = get_argument (argc, argv, "-parallel"))) { 101 PARALLEL = TRUE; 102 remove_argument (N, &argc, argv); 103 } 104 // this is a test mode : rather than launching the remote jobs and waiting for completion, 105 // relphot will simply list the remote command and wait for the user to signal completion 106 PARALLEL_MANUAL = FALSE; 107 if ((N = get_argument (argc, argv, "-parallel-manual"))) { 108 PARALLEL = TRUE; // -parallel-manual implies -parallel 109 PARALLEL_MANUAL = TRUE; 110 remove_argument (N, &argc, argv); 111 } 112 // this is a test mode : rather than launching the relphot_client jobs remotely, they are 113 // run in serial via 'system' 114 PARALLEL_SERIAL = FALSE; 115 if ((N = get_argument (argc, argv, "-parallel-serial"))) { 116 if (PARALLEL_MANUAL) { 117 fprintf (stderr, "ERROR: cannot mix -parallel-manual and -parallel-serial\n"); 118 exit (1); 119 } 120 PARALLEL = TRUE; // -parallel-serial implies -parallel 121 PARALLEL_SERIAL = TRUE; 122 remove_argument (N, &argc, argv); 123 } 124 125 PLOTSTUFF = FALSE; 126 if ((N = get_argument (argc, argv, "-plot"))) { 127 PLOTSTUFF = TRUE; 128 remove_argument (N, &argc, argv); 129 } 130 131 PLOTDELAY = 500000; 132 if ((N = get_argument (argc, argv, "-plotdelay"))) { 133 remove_argument (N, &argc, argv); 134 PLOTDELAY = 1e6*atof(argv[N]); 135 PLOTSTUFF = TRUE; // always turn on plotting if i request a plot delay 136 remove_argument (N, &argc, argv); 137 } 138 139 if ((N = get_argument (argc, argv, "-outroot"))) { 140 remove_argument (N, &argc, argv); 141 OUTROOT = strcreate (argv[N]); 142 remove_argument (N, &argc, argv); 143 } else { 144 OUTROOT = strcreate ("relphot"); 145 } 146 147 strcpy (STATMODE, "WT_MEAN"); 148 if ((N = get_argument (argc, argv, "-statmode"))) { 149 remove_argument (N, &argc, argv); 150 strcpy (STATMODE, argv[N]); 151 remove_argument (N, &argc, argv); 152 } 153 154 NLOOP = 8; 155 if ((N = get_argument (argc, argv, "-n"))) { 156 remove_argument (N, &argc, argv); 157 NLOOP = atof (argv[N]); 158 remove_argument (N, &argc, argv); 159 } 160 if ((N = get_argument (argc, argv, "-nloop"))) { 161 remove_argument (N, &argc, argv); 162 NLOOP = atof (argv[N]); 163 remove_argument (N, &argc, argv); 164 } 165 166 NGRID = 8; 167 if ((N = get_argument (argc, argv, "-ngrid"))) { 168 remove_argument (N, &argc, argv); 169 NGRID = atof (argv[N]); 170 remove_argument (N, &argc, argv); 171 } 172 173 RESET = FALSE; 174 if ((N = get_argument (argc, argv, "-reset"))) { 175 remove_argument (N, &argc, argv); 176 RESET = TRUE; 177 } 178 179 RESET_ZEROPTS = FALSE; 180 if ((N = get_argument (argc, argv, "-reset-zpts"))) { 181 remove_argument (N, &argc, argv); 182 RESET_ZEROPTS = TRUE; 183 } 184 185 UPDATE = FALSE; 186 if ((N = get_argument (argc, argv, "-update"))) { 187 remove_argument (N, &argc, argv); 188 UPDATE = TRUE; 189 } 190 191 UPDATE_CATFORMAT = NULL; 192 if ((N = get_argument (argc, argv, "-update-catformat"))) { 193 remove_argument (N, &argc, argv); 194 UPDATE_CATFORMAT = strcreate (argv[N]); 195 remove_argument (N, &argc, argv); 196 } 197 198 SAVE_IMAGE_UPDATES = TRUE; 199 if ((N = get_argument (argc, argv, "-skip-image-updates"))) { 200 remove_argument (N, &argc, argv); 201 SAVE_IMAGE_UPDATES = FALSE; 202 } 203 204 MaxDensityUse = FALSE; 205 if ((N = get_argument (argc, argv, "-max-density"))) { 206 remove_argument (N, &argc, argv); 207 MaxDensityValue = atof(argv[N]); 208 remove_argument (N, &argc, argv); 209 MaxDensityUse = TRUE; 210 } 211 212 CLOUD_TOLERANCE = 0.02; 213 if ((N = get_argument (argc, argv, "-cloud-limit"))) { 214 remove_argument (N, &argc, argv); 215 CLOUD_TOLERANCE = atof(argv[N]); 216 remove_argument (N, &argc, argv); 217 } 218 219 // XXX should we load a tree from CATDIR by default? 220 // NOTE: a given catdir needs an appropriate boundary tree 221 BOUNDARY_TREE = NULL; 222 if ((N = get_argument (argc, argv, "-boundary-tree"))) { 223 remove_argument (N, &argc, argv); 224 BOUNDARY_TREE = strcreate(argv[N]); 225 load_tess (BOUNDARY_TREE); 226 remove_argument (N, &argc, argv); 227 } 228 229 SHOW_PARAMS = FALSE; 230 if ((N = get_argument (argc, argv, "-params"))) { 231 remove_argument (N, &argc, argv); 232 SHOW_PARAMS = TRUE; 233 } 234 235 PlotMmin = 10.0; PlotMmax = 20.0; PlotdMmin = -1.0; PlotdMmax = 1.0; 236 if ((N = get_argument (argc, argv, "-plrange"))) { 237 remove_argument (N, &argc, argv); 238 PlotMmin = atof (argv[N]); 239 remove_argument (N, &argc, argv); 240 PlotMmax = atof (argv[N]); 241 remove_argument (N, &argc, argv); 242 PlotdMmin = atof (argv[N]); 243 remove_argument (N, &argc, argv); 244 PlotdMmax = atof (argv[N]); 245 remove_argument (N, &argc, argv); 246 } 247 248 /* XXX this argument used to do two things: specify the camera name and tell the analysis to 249 calculate a common zero point for a single mosaic. I've moved the MOSAICNAME concept into the 250 config system, but need to use this argument to specify that the mosaic zeropoints should be 251 calculated. */ 252 MOSAIC_ZEROPT = FALSE; 253 if ((N = get_argument (argc, argv, "-mosaic"))) { 254 remove_argument (N, &argc, argv); 255 MOSAIC_ZEROPT = TRUE; 256 if (!strcasecmp (MOSAICNAME, "none")) { 257 fprintf (stderr, "mosaic astrometry selected by MOSAICNAME not defined\n"); 258 exit (2); 259 } 260 } 261 262 FREEZE_IMAGES = FALSE; 263 if ((N = get_argument (argc, argv, "-imfreeze"))) { 264 remove_argument (N, &argc, argv); 265 FREEZE_IMAGES = TRUE; 266 } 267 268 FREEZE_MOSAICS = FALSE; 269 if ((N = get_argument (argc, argv, "-mosfreeze"))) { 270 remove_argument (N, &argc, argv); 271 FREEZE_MOSAICS = TRUE; 272 } 273 274 // USE_GRID is not valid for all cases, probably should be its own mode... 275 USE_GRID = FALSE; 276 if ((N = get_argument (argc, argv, "-grid"))) { 277 remove_argument (N, &argc, argv); 278 USE_GRID = TRUE; 279 } 280 281 KEEP_UBERCAL = TRUE; 282 if ((N = get_argument (argc, argv, "-reset-ubercal"))) { 283 remove_argument (N, &argc, argv); 284 KEEP_UBERCAL = FALSE; 285 } 286 287 MIN_ERROR = 0.001; 288 if ((N = get_argument (argc, argv, "-minerror"))) { 289 remove_argument (N, &argc, argv); 290 MIN_ERROR = atof (argv[N]); 291 remove_argument (N, &argc, argv); 292 /* require MIN_ERROR > 0 */ 293 } 294 295 AreaSelect = FALSE; 296 if ((N = get_argument (argc, argv, "-area"))) { 297 remove_argument (N, &argc, argv); 298 AreaXmin = atof (argv[N]); 299 remove_argument (N, &argc, argv); 300 AreaXmax = atof (argv[N]); 301 remove_argument (N, &argc, argv); 302 AreaYmin = atof (argv[N]); 303 remove_argument (N, &argc, argv); 304 AreaYmax = atof (argv[N]); 305 remove_argument (N, &argc, argv); 306 AreaSelect = TRUE; 307 } 308 309 ImagSelect = FALSE; 310 if ((N = get_argument (argc, argv, "-instmag"))) { 311 remove_argument (N, &argc, argv); 312 ImagMin = atof (argv[N]); 313 remove_argument (N, &argc, argv); 314 ImagMax = atof (argv[N]); 315 remove_argument (N, &argc, argv); 316 ImagSelect = TRUE; 317 } 318 319 DophotSelect = FALSE; 320 if ((N = get_argument (argc, argv, "-dophot"))) { 321 remove_argument (N, &argc, argv); 322 DophotValue = atof (argv[N]); 323 remove_argument (N, &argc, argv); 324 DophotSelect = TRUE; 325 } 326 327 SyntheticPhotometry = FALSE; 328 if ((N = get_argument (argc, argv, "-synthphot"))) { 329 remove_argument (N, &argc, argv); 330 SyntheticPhotometry = TRUE; 331 init_synthetic_mags(); 332 } 333 334 refPhotcode = NULL; 335 if ((N = get_argument (argc, argv, "-refcode"))) { 336 remove_argument (N, &argc, argv); 337 refPhotcode = GetPhotcodebyName (argv[N]); 338 if (!refPhotcode) { 339 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", argv[N]); 340 exit (1); 341 } 342 remove_argument (N, &argc, argv); 343 } 344 345 REGION_FILE = NULL; 346 if ((N = get_argument (argc, argv, "-region-hosts"))) { 347 remove_argument (N, &argc, argv); 348 REGION_FILE = strcreate (argv[N]); 349 remove_argument (N, &argc, argv); 350 } 351 352 REGION_HOST_ID = 0; 353 if ((N = get_argument (argc, argv, "-region-hostID"))) { 354 remove_argument (N, &argc, argv); 355 REGION_HOST_ID = atoi (argv[N]); 356 remove_argument (N, &argc, argv); 357 } 358 359 RelphotMode mode = MODE_ERROR; 360 if ((N = get_argument (argc, argv, "-images"))) { 361 remove_argument (N, &argc, argv); 362 mode = UPDATE_IMAGES; 363 } 364 if ((N = get_argument (argc, argv, "-averages"))) { 365 remove_argument (N, &argc, argv); 366 mode = UPDATE_AVERAGES; 367 } 368 if ((N = get_argument (argc, argv, "-apply-offsets"))) { 369 remove_argument (N, &argc, argv); 370 mode = APPLY_OFFSETS; 371 } 372 IMAGE_TABLE = NULL; 373 if ((N = get_argument (argc, argv, "-parallel-images"))) { 374 remove_argument (N, &argc, argv); 375 mode = PARALLEL_IMAGES; 376 if (N >= argc) relphot_usage(); 377 IMAGE_TABLE = strcreate (argv[N]); 378 remove_argument (N, &argc, argv); 379 if (!REGION_FILE) relphot_usage(); 380 } 381 382 PARALLEL_REGIONS_MANUAL = FALSE; 383 if ((N = get_argument (argc, argv, "-parallel-regions"))) { 384 remove_argument (N, &argc, argv); 385 mode = PARALLEL_REGIONS; 386 if (!REGION_FILE) relphot_usage(); 387 if ((N = get_argument (argc, argv, "-parallel-regions-manual"))) { 388 remove_argument (N, &argc, argv); 389 PARALLEL_REGIONS_MANUAL = TRUE; 390 } 391 } 392 393 switch (mode) { 394 case UPDATE_AVERAGES: 395 if (argc != 1) relphot_usage(); 396 break; 397 398 case UPDATE_IMAGES: 399 case PARALLEL_IMAGES: 400 case PARALLEL_REGIONS: 401 PhotcodeList = strcreate (argv[1]); 402 photcodes = ParsePhotcodeList (PhotcodeList, &Nphotcodes, TRUE); // require SEC photcodes 403 remove_argument (1, &argc, argv); 404 break; 405 406 default: 407 fprintf (stderr, "no valid mode selected\n"); 408 relphot_usage(); 409 break; 410 } 411 if (argc != 1) relphot_usage (); 412 413 return mode; 414 } 415 416 int args_client (int argc, char **argv) { 417 418 int N; 419 double trange; 420 421 // by definition, the client is not parallel 422 PARALLEL = FALSE; 423 PARALLEL_MANUAL = FALSE; 424 PARALLEL_SERIAL = FALSE; 425 426 HOST_ID = 0; 427 if ((N = get_argument (argc, argv, "-hostID"))) { 428 remove_argument (N, &argc, argv); 429 HOST_ID = atoi (argv[N]); 430 remove_argument (N, &argc, argv); 431 } 432 if (!HOST_ID) relphot_client_usage(); 433 434 HOSTDIR = NULL; 435 if ((N = get_argument (argc, argv, "-hostdir"))) { 436 remove_argument (N, &argc, argv); 437 HOSTDIR = strcreate (argv[N]); 438 remove_argument (N, &argc, argv); 439 } 440 if (!HOSTDIR) relphot_client_usage(); 441 442 IMAGES = NULL; // used in -update mode 443 BCATALOG = NULL; // used in -load mode 444 MODE = MODE_NONE; 445 if ((N = get_argument (argc, argv, "-load"))) { 446 MODE = MODE_LOAD; 447 remove_argument (N, &argc, argv); 448 BCATALOG = strcreate (argv[N]); 449 remove_argument (N, &argc, argv); 450 } 451 if ((N = get_argument (argc, argv, "-update-catalogs"))) { 452 if (MODE) { 453 fprintf (stderr, "ERROR: cannot mix modes (-load, -update-catalogs, -update-objects)\n"); 454 relphot_client_usage(); 455 } 456 MODE = MODE_UPDATE; 457 remove_argument (N, &argc, argv); 458 IMAGES = strcreate (argv[N]); 459 remove_argument (N, &argc, argv); 460 } 461 if ((N = get_argument (argc, argv, "-update-objects"))) { 462 if (MODE) { 463 fprintf (stderr, "ERROR: cannot mix modes (-load, -update-catalogs, -update-objects)\n"); 464 relphot_client_usage(); 465 } 466 MODE = MODE_UPDATE_OBJECTS; 467 remove_argument (N, &argc, argv); 468 } 469 if (!MODE) relphot_client_usage(); 470 471 strcpy (STATMODE, "WT_MEAN"); 472 if ((N = get_argument (argc, argv, "-statmode"))) { 473 remove_argument (N, &argc, argv); 474 strcpy (STATMODE, argv[N]); 475 remove_argument (N, &argc, argv); 476 } 477 478 BOUNDARY_TREE = NULL; 479 if ((N = get_argument (argc, argv, "-boundary-tree"))) { 480 remove_argument (N, &argc, argv); 481 BOUNDARY_TREE = strcreate(argv[N]); 482 load_tess (BOUNDARY_TREE); 483 remove_argument (N, &argc, argv); 484 } 485 486 /* specify portion of the sky */ 487 UserPatch.Rmin = 0; 488 UserPatch.Rmax = 360; 489 UserPatch.Dmin = -90; 490 UserPatch.Dmax = +90; 491 if ((N = get_argument (argc, argv, "-region"))) { 492 remove_argument (N, &argc, argv); 493 UserPatch.Rmin = atof (argv[N]); 494 remove_argument (N, &argc, argv); 495 UserPatch.Rmax = atof (argv[N]); 496 remove_argument (N, &argc, argv); 497 UserPatch.Dmin = atof (argv[N]); 498 remove_argument (N, &argc, argv); 499 UserPatch.Dmax = atof (argv[N]); 500 remove_argument (N, &argc, argv); 501 } 502 503 SET_MREL_VERSION = 1; 504 if ((N = get_argument (argc, argv, "-set-mrel-version"))) { 505 remove_argument (N, &argc, argv); 506 SET_MREL_VERSION = atof(argv[N]); 507 remove_argument (N, &argc, argv); 508 } 509 510 VERBOSE = VERBOSE2 = FALSE; 511 if ((N = get_argument (argc, argv, "-v"))) { 512 VERBOSE = TRUE; 513 remove_argument (N, &argc, argv); 514 } 515 if ((N = get_argument (argc, argv, "-vv"))) { 516 VERBOSE2 = VERBOSE = TRUE; 517 remove_argument (N, &argc, argv); 518 } 519 520 RESET = FALSE; 521 if ((N = get_argument (argc, argv, "-reset"))) { 522 remove_argument (N, &argc, argv); 523 RESET = TRUE; 524 } 525 526 RESET_ZEROPTS = FALSE; 527 if ((N = get_argument (argc, argv, "-reset-zpts"))) { 528 remove_argument (N, &argc, argv); 529 RESET_ZEROPTS = TRUE; 530 } 531 532 KEEP_UBERCAL = TRUE; 533 if ((N = get_argument (argc, argv, "-reset-ubercal"))) { 534 remove_argument (N, &argc, argv); 535 KEEP_UBERCAL = FALSE; 536 } 7 537 8 538 /* define time */ … … 33 563 } 34 564 35 /* specify portion of the sky */ 36 UserPatch.Rmin = 0; 37 UserPatch.Rmax = 360; 38 UserPatch.Dmin = -90; 39 UserPatch.Dmax = +90; 40 if ((N = get_argument (argc, argv, "-region"))) { 41 remove_argument (N, &argc, argv); 42 UserPatch.Rmin = atof (argv[N]); 43 remove_argument (N, &argc, argv); 44 UserPatch.Rmax = atof (argv[N]); 45 remove_argument (N, &argc, argv); 46 UserPatch.Dmin = atof (argv[N]); 47 remove_argument (N, &argc, argv); 48 UserPatch.Dmax = atof (argv[N]); 49 remove_argument (N, &argc, argv); 50 } 51 52 /* specify region file by name (eg n0000/0000.00) */ 53 UserCatalog = NULL; 54 if ((N = get_argument (argc, argv, "-catalog"))) { 55 remove_argument (N, &argc, argv); 56 UserCatalog = strcreate (argv[N]); 57 remove_argument (N, &argc, argv); 58 } 59 60 USE_BASIC_CHECK = FALSE; 61 if ((N = get_argument (argc, argv, "-basic-image-search"))) { 62 remove_argument (N, &argc, argv); 63 USE_BASIC_CHECK = TRUE; 64 } 65 66 USE_FULL_OVERLAP = TRUE; 67 if ((N = get_argument (argc, argv, "-sloppy-image-overlap"))) { 68 remove_argument (N, &argc, argv); 69 USE_FULL_OVERLAP = FALSE; 70 } 71 72 SET_MREL_VERSION = 1; 73 if ((N = get_argument (argc, argv, "-set-mrel-version"))) { 74 remove_argument (N, &argc, argv); 75 SET_MREL_VERSION = atof(argv[N]); 76 remove_argument (N, &argc, argv); 77 } 78 79 VERBOSE = VERBOSE2 = FALSE; 80 if ((N = get_argument (argc, argv, "-v"))) { 81 VERBOSE = TRUE; 82 remove_argument (N, &argc, argv); 83 } 84 if ((N = get_argument (argc, argv, "-vv"))) { 85 VERBOSE2 = VERBOSE = TRUE; 86 remove_argument (N, &argc, argv); 87 } 88 89 NTHREADS = 0; 90 if ((N = get_argument (argc, argv, "-threads"))) { 91 remove_argument (N, &argc, argv); 92 NTHREADS = atof (argv[N]); 93 remove_argument (N, &argc, argv); 94 } 95 96 // XXX for the moment, make this selection manual. it needs to be automatic 97 // based on the state of the SkyTable 98 HOST_ID = 0; 99 PARALLEL = FALSE; 100 if ((N = get_argument (argc, argv, "-parallel"))) { 101 PARALLEL = TRUE; 102 remove_argument (N, &argc, argv); 103 } 104 // this is a test mode : rather than launching the remote jobs and waiting for completion, 105 // relphot will simply list the remote command and wait for the user to signal completion 106 PARALLEL_MANUAL = FALSE; 107 if ((N = get_argument (argc, argv, "-parallel-manual"))) { 108 PARALLEL = TRUE; // -parallel-manual implies -parallel 109 PARALLEL_MANUAL = TRUE; 110 remove_argument (N, &argc, argv); 111 } 112 // this is a test mode : rather than launching the relphot_client jobs remotely, they are 113 // run in serial via 'system' 114 PARALLEL_SERIAL = FALSE; 115 if ((N = get_argument (argc, argv, "-parallel-serial"))) { 116 if (PARALLEL_MANUAL) { 117 fprintf (stderr, "ERROR: cannot mix -parallel-manual and -parallel-serial\n"); 118 exit (1); 119 } 120 PARALLEL = TRUE; // -parallel-serial implies -parallel 121 PARALLEL_SERIAL = TRUE; 122 remove_argument (N, &argc, argv); 123 } 124 125 PLOTSTUFF = FALSE; 126 if ((N = get_argument (argc, argv, "-plot"))) { 127 PLOTSTUFF = TRUE; 128 remove_argument (N, &argc, argv); 129 } 130 131 PLOTDELAY = 500000; 132 if ((N = get_argument (argc, argv, "-plotdelay"))) { 133 remove_argument (N, &argc, argv); 134 PLOTDELAY = 1e6*atof(argv[N]); 135 PLOTSTUFF = TRUE; // always turn on plotting if i request a plot delay 136 remove_argument (N, &argc, argv); 137 } 138 139 if ((N = get_argument (argc, argv, "-outroot"))) { 140 remove_argument (N, &argc, argv); 141 OUTROOT = strcreate (argv[N]); 142 remove_argument (N, &argc, argv); 143 } else { 144 OUTROOT = strcreate ("relphot"); 145 } 146 147 strcpy (STATMODE, "WT_MEAN"); 148 if ((N = get_argument (argc, argv, "-statmode"))) { 149 remove_argument (N, &argc, argv); 150 strcpy (STATMODE, argv[N]); 151 remove_argument (N, &argc, argv); 152 } 153 154 NLOOP = 8; 155 if ((N = get_argument (argc, argv, "-n"))) { 156 remove_argument (N, &argc, argv); 157 NLOOP = atof (argv[N]); 158 remove_argument (N, &argc, argv); 159 } 160 if ((N = get_argument (argc, argv, "-nloop"))) { 161 remove_argument (N, &argc, argv); 162 NLOOP = atof (argv[N]); 163 remove_argument (N, &argc, argv); 164 } 165 166 NGRID = 8; 167 if ((N = get_argument (argc, argv, "-ngrid"))) { 168 remove_argument (N, &argc, argv); 169 NGRID = atof (argv[N]); 170 remove_argument (N, &argc, argv); 171 } 172 173 RESET = FALSE; 174 if ((N = get_argument (argc, argv, "-reset"))) { 175 remove_argument (N, &argc, argv); 176 RESET = TRUE; 177 } 178 179 RESET_ZEROPTS = FALSE; 180 if ((N = get_argument (argc, argv, "-reset-zpts"))) { 181 remove_argument (N, &argc, argv); 182 RESET_ZEROPTS = TRUE; 183 } 565 566 MIN_ERROR = 0.001; 567 if ((N = get_argument (argc, argv, "-minerror"))) { 568 remove_argument (N, &argc, argv); 569 MIN_ERROR = atof (argv[N]); 570 remove_argument (N, &argc, argv); 571 /* require MIN_ERROR > 0 */ 572 } 184 573 185 574 UPDATE = FALSE; … … 196 585 } 197 586 198 SAVE_IMAGE_UPDATES = TRUE; 199 if ((N = get_argument (argc, argv, "-skip-image-updates"))) { 200 remove_argument (N, &argc, argv); 201 SAVE_IMAGE_UPDATES = FALSE; 587 AreaSelect = FALSE; 588 if ((N = get_argument (argc, argv, "-area"))) { 589 remove_argument (N, &argc, argv); 590 AreaXmin = atof (argv[N]); 591 remove_argument (N, &argc, argv); 592 AreaXmax = atof (argv[N]); 593 remove_argument (N, &argc, argv); 594 AreaYmin = atof (argv[N]); 595 remove_argument (N, &argc, argv); 596 AreaYmax = atof (argv[N]); 597 remove_argument (N, &argc, argv); 598 AreaSelect = TRUE; 599 } 600 601 SyntheticPhotometry = FALSE; 602 if ((N = get_argument (argc, argv, "-synthphot"))) { 603 remove_argument (N, &argc, argv); 604 SyntheticPhotometry = FALSE; 605 init_synthetic_mags(); 606 } 607 608 ImagSelect = FALSE; 609 if ((N = get_argument (argc, argv, "-instmag"))) { 610 remove_argument (N, &argc, argv); 611 ImagMin = atof (argv[N]); 612 remove_argument (N, &argc, argv); 613 ImagMax = atof (argv[N]); 614 remove_argument (N, &argc, argv); 615 ImagSelect = TRUE; 616 } 617 618 DophotSelect = FALSE; 619 if ((N = get_argument (argc, argv, "-dophot"))) { 620 remove_argument (N, &argc, argv); 621 DophotValue = atof (argv[N]); 622 remove_argument (N, &argc, argv); 623 DophotSelect = TRUE; 202 624 } 203 625 … … 210 632 } 211 633 212 CLOUD_TOLERANCE = 0.02; 213 if ((N = get_argument (argc, argv, "-cloud-limit"))) { 214 remove_argument (N, &argc, argv); 215 CLOUD_TOLERANCE = atof(argv[N]); 216 remove_argument (N, &argc, argv); 217 } 218 219 // XXX should we load a tree from CATDIR by default? 220 // NOTE: a given catdir needs an appropriate boundary tree 221 BOUNDARY_TREE = NULL; 222 if ((N = get_argument (argc, argv, "-boundary-tree"))) { 223 remove_argument (N, &argc, argv); 224 BOUNDARY_TREE = strcreate(argv[N]); 225 load_tess (BOUNDARY_TREE); 226 remove_argument (N, &argc, argv); 227 } 228 229 SHOW_PARAMS = FALSE; 230 if ((N = get_argument (argc, argv, "-params"))) { 231 remove_argument (N, &argc, argv); 232 SHOW_PARAMS = TRUE; 233 } 234 235 PlotMmin = 10.0; PlotMmax = 20.0; PlotdMmin = -1.0; PlotdMmax = 1.0; 236 if ((N = get_argument (argc, argv, "-plrange"))) { 237 remove_argument (N, &argc, argv); 238 PlotMmin = atof (argv[N]); 239 remove_argument (N, &argc, argv); 240 PlotMmax = atof (argv[N]); 241 remove_argument (N, &argc, argv); 242 PlotdMmin = atof (argv[N]); 243 remove_argument (N, &argc, argv); 244 PlotdMmax = atof (argv[N]); 245 remove_argument (N, &argc, argv); 246 } 247 248 /* XXX this argument used to do two things: specify the camera name and tell the analysis to 249 calculate a common zero point for a single mosaic. I've moved the MOSAICNAME concept into the 250 config system, but need to use this argument to specify that the mosaic zeropoints should be 251 calculated. */ 252 MOSAIC_ZEROPT = FALSE; 253 if ((N = get_argument (argc, argv, "-mosaic"))) { 254 remove_argument (N, &argc, argv); 255 MOSAIC_ZEROPT = TRUE; 256 if (!strcasecmp (MOSAICNAME, "none")) { 257 fprintf (stderr, "mosaic astrometry selected by MOSAICNAME not defined\n"); 258 exit (2); 259 } 260 } 261 262 FREEZE_IMAGES = FALSE; 263 if ((N = get_argument (argc, argv, "-imfreeze"))) { 264 remove_argument (N, &argc, argv); 265 FREEZE_IMAGES = TRUE; 266 } 267 268 FREEZE_MOSAICS = FALSE; 269 if ((N = get_argument (argc, argv, "-mosfreeze"))) { 270 remove_argument (N, &argc, argv); 271 FREEZE_MOSAICS = TRUE; 272 } 273 274 USE_GRID = FALSE; 275 if ((N = get_argument (argc, argv, "-grid"))) { 276 remove_argument (N, &argc, argv); 277 USE_GRID = TRUE; 278 } 279 280 KEEP_UBERCAL = TRUE; 281 if ((N = get_argument (argc, argv, "-reset-ubercal"))) { 282 remove_argument (N, &argc, argv); 283 KEEP_UBERCAL = FALSE; 284 } 285 286 MIN_ERROR = 0.001; 287 if ((N = get_argument (argc, argv, "-minerror"))) { 288 remove_argument (N, &argc, argv); 289 MIN_ERROR = atof (argv[N]); 290 remove_argument (N, &argc, argv); 291 /* require MIN_ERROR > 0 */ 292 } 293 294 AreaSelect = FALSE; 295 if ((N = get_argument (argc, argv, "-area"))) { 296 remove_argument (N, &argc, argv); 297 AreaXmin = atof (argv[N]); 298 remove_argument (N, &argc, argv); 299 AreaXmax = atof (argv[N]); 300 remove_argument (N, &argc, argv); 301 AreaYmin = atof (argv[N]); 302 remove_argument (N, &argc, argv); 303 AreaYmax = atof (argv[N]); 304 remove_argument (N, &argc, argv); 305 AreaSelect = TRUE; 306 } 307 308 ImagSelect = FALSE; 309 if ((N = get_argument (argc, argv, "-instmag"))) { 310 remove_argument (N, &argc, argv); 311 ImagMin = atof (argv[N]); 312 remove_argument (N, &argc, argv); 313 ImagMax = atof (argv[N]); 314 remove_argument (N, &argc, argv); 315 ImagSelect = TRUE; 316 } 317 318 DophotSelect = FALSE; 319 if ((N = get_argument (argc, argv, "-dophot"))) { 320 remove_argument (N, &argc, argv); 321 DophotValue = atof (argv[N]); 322 remove_argument (N, &argc, argv); 323 DophotSelect = TRUE; 324 } 325 326 SyntheticPhotometry = FALSE; 327 if ((N = get_argument (argc, argv, "-synthphot"))) { 328 remove_argument (N, &argc, argv); 329 SyntheticPhotometry = TRUE; 330 init_synthetic_mags(); 331 } 332 333 refPhotcode = NULL; 334 if ((N = get_argument (argc, argv, "-refcode"))) { 335 remove_argument (N, &argc, argv); 336 refPhotcode = GetPhotcodebyName (argv[N]); 337 if (!refPhotcode) { 338 fprintf (stderr, "ERROR: photcode %s not found in photcode table\n", argv[N]); 339 exit (1); 340 } 341 remove_argument (N, &argc, argv); 342 } 343 344 UpdateAverages = FALSE; 345 if ((N = get_argument (argc, argv, "-averages"))) { 346 remove_argument (N, &argc, argv); 347 UpdateAverages = TRUE; 348 } 349 350 ApplyOffsets = FALSE; 351 if ((N = get_argument (argc, argv, "-apply-offsets"))) { 352 remove_argument (N, &argc, argv); 353 ApplyOffsets = TRUE; 354 } 355 356 if (UpdateAverages && (argc == 1)) return TRUE; 357 if (argc != 2) relphot_usage (); 634 if ((MODE == MODE_UPDATE_OBJECTS) && (argc == 1)) return TRUE; 635 if (argc != 2) relphot_client_usage (); 358 636 359 637 return TRUE; 360 638 } 361 639 362 int args_client (int argc, char **argv) {363 364 int N;365 double trange;366 367 // by definition, the client is not parallel368 PARALLEL = FALSE;369 PARALLEL_MANUAL = FALSE;370 PARALLEL_SERIAL = FALSE;371 372 HOST_ID = 0;373 if ((N = get_argument (argc, argv, "-hostID"))) {374 remove_argument (N, &argc, argv);375 HOST_ID = atoi (argv[N]);376 remove_argument (N, &argc, argv);377 }378 if (!HOST_ID) relphot_client_usage();379 380 HOSTDIR = NULL;381 if ((N = get_argument (argc, argv, "-hostdir"))) {382 remove_argument (N, &argc, argv);383 HOSTDIR = strcreate (argv[N]);384 remove_argument (N, &argc, argv);385 }386 if (!HOSTDIR) relphot_client_usage();387 388 IMAGES = NULL; // used in -update mode389 BCATALOG = NULL; // used in -load mode390 MODE = MODE_NONE;391 if ((N = get_argument (argc, argv, "-load"))) {392 MODE = MODE_LOAD;393 remove_argument (N, &argc, argv);394 BCATALOG = strcreate (argv[N]);395 remove_argument (N, &argc, argv);396 }397 if ((N = get_argument (argc, argv, "-update-catalogs"))) {398 if (MODE) {399 fprintf (stderr, "ERROR: cannot mix modes (-load, -update-catalogs, -update-objects)\n");400 relphot_client_usage();401 }402 MODE = MODE_UPDATE;403 remove_argument (N, &argc, argv);404 IMAGES = strcreate (argv[N]);405 remove_argument (N, &argc, argv);406 }407 if ((N = get_argument (argc, argv, "-update-objects"))) {408 if (MODE) {409 fprintf (stderr, "ERROR: cannot mix modes (-load, -update-catalogs, -update-objects)\n");410 relphot_client_usage();411 }412 MODE = MODE_UPDATE_OBJECTS;413 remove_argument (N, &argc, argv);414 }415 if (!MODE) relphot_client_usage();416 417 strcpy (STATMODE, "WT_MEAN");418 if ((N = get_argument (argc, argv, "-statmode"))) {419 remove_argument (N, &argc, argv);420 strcpy (STATMODE, argv[N]);421 remove_argument (N, &argc, argv);422 }423 424 BOUNDARY_TREE = NULL;425 if ((N = get_argument (argc, argv, "-boundary-tree"))) {426 remove_argument (N, &argc, argv);427 BOUNDARY_TREE = strcreate(argv[N]);428 load_tess (BOUNDARY_TREE);429 remove_argument (N, &argc, argv);430 }431 432 /* specify portion of the sky */433 UserPatch.Rmin = 0;434 UserPatch.Rmax = 360;435 UserPatch.Dmin = -90;436 UserPatch.Dmax = +90;437 if ((N = get_argument (argc, argv, "-region"))) {438 remove_argument (N, &argc, argv);439 UserPatch.Rmin = atof (argv[N]);440 remove_argument (N, &argc, argv);441 UserPatch.Rmax = atof (argv[N]);442 remove_argument (N, &argc, argv);443 UserPatch.Dmin = atof (argv[N]);444 remove_argument (N, &argc, argv);445 UserPatch.Dmax = atof (argv[N]);446 remove_argument (N, &argc, argv);447 }448 449 SET_MREL_VERSION = 1;450 if ((N = get_argument (argc, argv, "-set-mrel-version"))) {451 remove_argument (N, &argc, argv);452 SET_MREL_VERSION = atof(argv[N]);453 remove_argument (N, &argc, argv);454 }455 456 VERBOSE = VERBOSE2 = FALSE;457 if ((N = get_argument (argc, argv, "-v"))) {458 VERBOSE = TRUE;459 remove_argument (N, &argc, argv);460 }461 if ((N = get_argument (argc, argv, "-vv"))) {462 VERBOSE2 = VERBOSE = TRUE;463 remove_argument (N, &argc, argv);464 }465 466 RESET = FALSE;467 if ((N = get_argument (argc, argv, "-reset"))) {468 remove_argument (N, &argc, argv);469 RESET = TRUE;470 }471 472 RESET_ZEROPTS = FALSE;473 if ((N = get_argument (argc, argv, "-reset-zpts"))) {474 remove_argument (N, &argc, argv);475 RESET_ZEROPTS = TRUE;476 }477 478 KEEP_UBERCAL = TRUE;479 if ((N = get_argument (argc, argv, "-reset-ubercal"))) {480 remove_argument (N, &argc, argv);481 KEEP_UBERCAL = FALSE;482 }483 484 /* define time */485 TimeSelect = FALSE;486 if ((N = get_argument (argc, argv, "-time"))) {487 remove_argument (N, &argc, argv);488 if (!ohana_str_to_time (argv[N], &TSTART)) {489 fprintf (stderr, "ERROR: syntax error\n");490 return (FALSE);491 }492 remove_argument (N, &argc, argv);493 if (!ohana_str_to_dtime (argv[N], &trange)) {494 if (!ohana_str_to_time (argv[N], &TSTOP)) {495 fprintf (stderr, "ERROR: syntax error\n");496 return (FALSE);497 }498 } else {499 if (trange < 0) {500 trange = fabs (trange);501 TSTOP = TSTART;502 TSTART -= trange;503 } else {504 TSTOP = TSTART + trange;505 }506 }507 remove_argument (N, &argc, argv);508 TimeSelect = TRUE;509 }510 511 512 MIN_ERROR = 0.001;513 if ((N = get_argument (argc, argv, "-minerror"))) {514 remove_argument (N, &argc, argv);515 MIN_ERROR = atof (argv[N]);516 remove_argument (N, &argc, argv);517 /* require MIN_ERROR > 0 */518 }519 520 UPDATE = FALSE;521 if ((N = get_argument (argc, argv, "-update"))) {522 remove_argument (N, &argc, argv);523 UPDATE = TRUE;524 }525 526 UPDATE_CATFORMAT = NULL;527 if ((N = get_argument (argc, argv, "-update-catformat"))) {528 remove_argument (N, &argc, argv);529 UPDATE_CATFORMAT = strcreate (argv[N]);530 remove_argument (N, &argc, argv);531 }532 533 AreaSelect = FALSE;534 if ((N = get_argument (argc, argv, "-area"))) {535 remove_argument (N, &argc, argv);536 AreaXmin = atof (argv[N]);537 remove_argument (N, &argc, argv);538 AreaXmax = atof (argv[N]);539 remove_argument (N, &argc, argv);540 AreaYmin = atof (argv[N]);541 remove_argument (N, &argc, argv);542 AreaYmax = atof (argv[N]);543 remove_argument (N, &argc, argv);544 AreaSelect = TRUE;545 }546 547 SyntheticPhotometry = FALSE;548 if ((N = get_argument (argc, argv, "-synthphot"))) {549 remove_argument (N, &argc, argv);550 SyntheticPhotometry = FALSE;551 init_synthetic_mags();552 }553 554 ImagSelect = FALSE;555 if ((N = get_argument (argc, argv, "-instmag"))) {556 remove_argument (N, &argc, argv);557 ImagMin = atof (argv[N]);558 remove_argument (N, &argc, argv);559 ImagMax = atof (argv[N]);560 remove_argument (N, &argc, argv);561 ImagSelect = TRUE;562 }563 564 DophotSelect = FALSE;565 if ((N = get_argument (argc, argv, "-dophot"))) {566 remove_argument (N, &argc, argv);567 DophotValue = atof (argv[N]);568 remove_argument (N, &argc, argv);569 DophotSelect = TRUE;570 }571 572 MaxDensityUse = FALSE;573 if ((N = get_argument (argc, argv, "-max-density"))) {574 remove_argument (N, &argc, argv);575 MaxDensityValue = atof(argv[N]);576 remove_argument (N, &argc, argv);577 MaxDensityUse = TRUE;578 }579 580 if ((MODE == MODE_UPDATE_OBJECTS) && (argc == 1)) return TRUE;581 if (argc != 2) relphot_client_usage ();582 583 return TRUE;584 }585 -
trunk/Ohana/src/relphot/src/client_logger.c
r33963 r36630 5 5 6 6 static FILE *logfile = NULL; 7 int client_logger_init ( ) {7 int client_logger_init (char *dirname) { 8 8 9 9 char filename[DVO_MAX_PATH]; 10 10 11 snprintf (filename, DVO_MAX_PATH, "%s/log.rlpc.XXXXXX", HOSTDIR);11 snprintf (filename, DVO_MAX_PATH, "%s/log.rlpc.XXXXXX", dirname); 12 12 13 13 int fd = mkstemp (filename); 14 14 if (fd == -1) { 15 fprintf (stderr, "failed to open client logger , exiting\n");15 fprintf (stderr, "failed to open client logger %s, exiting\n", filename); 16 16 exit (50); 17 17 } … … 32 32 vfprintf (logfile, format, argp); 33 33 va_end (argp); 34 35 fflush (logfile); 34 36 return TRUE; 35 37 } -
trunk/Ohana/src/relphot/src/help.c
r33651 r36630 2 2 3 3 void relphot_usage (void) { 4 fprintf (stderr, "ERROR: USAGE: relphot (photcodes) -region RA RA DEC DEC\n"); 5 fprintf (stderr, " or: relphot (photcodes) -catalog (name)\n"); 6 fprintf (stderr, " or: relphot -averages -region RA RA DEC DEC\n"); 4 fprintf (stderr, "ERROR: USAGE: relphot (photcodes) -images\n"); 5 fprintf (stderr, " or: relphot -averages\n"); 6 fprintf (stderr, " or: relphot -apply-offsets\n"); 7 fprintf (stderr, " or: relphot (photcodes) -parallel-regions -region-hosts (RegionFile)\n"); 8 fprintf (stderr, " or: relphot (photcodes) -parallel-images (ImageTable) -region-hosts (RegionFile)\n\n"); 9 fprintf (stderr, " regions: -region RA RA DEC DEC)\n"); 10 fprintf (stderr, " or: -catalog (name)\n"); 7 11 fprintf (stderr, " use -h for more usage information\n"); 8 12 exit (2); … … 18 22 19 23 show_help: 20 fprintf (stderr, "ERROR: USAGE: relphot (photcode) -region RA RA DEC DEC\n"); 21 fprintf (stderr, " or: relphot (photcode) -catalog (name)\n"); 22 fprintf (stderr, " or: relphot -averages -region RA RA DEC DEC\n"); 24 fprintf (stderr, "ERROR: USAGE: relphot (photcodes) -images\n"); 25 fprintf (stderr, " or: relphot -averages\n"); 26 fprintf (stderr, " or: relphot -apply-offsets\n"); 27 fprintf (stderr, " or: relphot (photcodes) -parallel-regions -region-hosts (RegionFile)\n"); 28 fprintf (stderr, " or: relphot (photcodes) -parallel-images (ImageTable) -region-hosts (RegionFile)\n\n"); 29 fprintf (stderr, " regions: -region RA RA DEC DEC)\n"); 30 fprintf (stderr, " or: -catalog (name)\n"); 23 31 fprintf (stderr, " options: \n"); 24 32 fprintf (stderr, " -time (start) (stop)\n"); -
trunk/Ohana/src/relphot/src/initialize.c
r34429 r36630 1 1 # include "relphot.h" 2 2 3 voidinitialize (int argc, char **argv) {3 RelphotMode initialize (int argc, char **argv) { 4 4 5 5 relphot_help (argc, argv); 6 6 ConfigInit (&argc, argv); 7 args (argc, argv); 7 RelphotMode mode = args (argc, argv); 8 if (!mode) exit (2); 8 9 9 if (!UpdateAverages) { 10 // load the list of photcodes into the globals (photcodes, Nphotcodes) 11 // only a single remaining argument in this mode (the list of photcodes, eg g,r,i) 12 PhotcodeList = strcreate (argv[1]); 13 photcodes = ParsePhotcodeList (PhotcodeList, &Nphotcodes, TRUE); // require SEC photcodes 14 } else { 10 // UPDATE_AVERAGES always operates on all photcodes? 11 if (mode == UPDATE_AVERAGES) { 15 12 char tmpline1[256]; 16 13 int Ns; … … 67 64 for (B = 0; A == time(NULL); B++); 68 65 srand48(B); 66 67 return mode; 69 68 } 70 69 -
trunk/Ohana/src/relphot/src/load_catalogs.c
r35416 r36630 89 89 90 90 fprintf (stderr, "using "OFF_T_FMT" of "OFF_T_FMT" stars ("OFF_T_FMT" of "OFF_T_FMT" measurements)\n", Nstar, Nstar_total, Nmeas, Nmeas_total); 91 if (!hostID && (Nstar < 1)) Shutdown ("%s", "ERROR: no stars match the minimum requirements; exiting \n");91 if (!hostID && !REGION_HOST_ID && (Nstar < 1)) Shutdown ("%s", "ERROR: no stars match the minimum requirements; exiting \n"); 92 92 // in regular relphot, we shutdown here; in relphot_client, we generate and return an empty table (for consistency) 93 94 93 95 94 // XXX consider only returning the populated catalogs … … 107 106 # define DEBUG 1 108 107 Catalog *load_catalogs_parallel (SkyList *sky, int *Ncatalog) { 108 109 char uniquer[12]; 110 int TIME = time(NULL); 111 int PID = getpid(); 112 snprintf (uniquer, 12, "%05d.%05d", PID, TIME % 100000); 109 113 110 114 int Nsecfilt = GetPhotcodeNsecfilt (); // set the desired number in case we need to create the catalog … … 128 132 129 133 ALLOCATE (table->hosts[i].results, char, 1024); 130 snprintf (table->hosts[i].results, 1024, "%s/relphot.catalog. subset.dat", table->hosts[i].pathname);134 snprintf (table->hosts[i].results, 1024, "%s/relphot.catalog.%s.dat", table->hosts[i].pathname, uniquer); 131 135 132 136 // options / arguments that can affect relphot_client -load: -
trunk/Ohana/src/relphot/src/reload_catalogs.c
r35806 r36630 156 156 // load the list of hosts 157 157 HostTable *table = HostTableLoad (CATDIR, sky->hosts); 158 if (!table) { 159 fprintf (stderr, "ERROR: problem with parallel host table\n"); 160 exit (2); 161 } 158 162 159 163 if (BOUNDARY_TREE) { -
trunk/Ohana/src/relphot/src/relphot.c
r35416 r36630 3 3 int main (int argc, char **argv) { 4 4 5 /* get configuration info, args */ 6 initialize (argc, argv); 5 // get configuration info, args 6 RelphotMode mode = initialize (argc, argv); 7 if (!mode) exit (2); 7 8 8 /* the object analysis is a separate process iterating over catalogs */ 9 if (UpdateAverages) { 10 relphot_objects (0, NULL); 11 exit (0); 9 switch (mode) { 10 case UPDATE_IMAGES: 11 relphot_images (); 12 exit (0); 13 14 case UPDATE_AVERAGES: 15 // take the current set of detections and set the mean magnitudes 16 relphot_objects (0, NULL); 17 exit (0); 18 19 case PARALLEL_REGIONS: 20 // run image updates in parallel across multiple remote machines 21 relphot_parallel_regions (); 22 exit (0); 23 24 case PARALLEL_IMAGES: 25 // operation on the remote machines in the PARALLEL_REGION mode 26 relphot_parallel_images (); 27 exit (0); 28 29 case APPLY_OFFSETS: 30 // re-run this step from a previous attempt (assumes an existing Images.subset.dat file) 31 if (!PARALLEL) { 32 fprintf (stderr, "-apply-offsets only makes sense in an parallel context\n"); 33 exit (2); 34 } 35 reload_catalogs (NULL, NULL, 0, NULL); 36 exit (0); 37 38 default: 39 fprintf (stderr, "ERROR: no valid relphot mode chosen\n"); 40 exit (2); 12 41 } 13 14 if (ApplyOffsets) { 15 // re-run this step from a previous attempt (assumes an existing Images.subset.dat file) 16 if (!PARALLEL) { 17 fprintf (stderr, "-apply-offsets only makes sense in an parallel context\n"); 18 exit (2); 19 } 20 reload_catalogs (NULL, NULL, 0, NULL); 21 exit (0); 22 } 23 24 relphot_images (); 25 26 exit (0); 42 fprintf (stderr, "IMPOSSIBLE: skipped out of switch?\n"); 43 exit (1); 27 44 } 28 -
trunk/Ohana/src/relphot/src/relphot_client.c
r33963 r36630 19 19 // get configuration info, args, lockfile (set CATDIR, HOST_ID, HOSTDIR, etc) 20 20 initialize_client (argc, argv); 21 client_logger_init ( );21 client_logger_init (HOSTDIR); 22 22 23 23 // load the current sky table (layout of all SkyRegions) -
trunk/Ohana/src/relphot/src/relphot_images.c
r35806 r36630 244 244 if (!UPDATE) exit (0); 245 245 246 /* load catalog data from region files, update Mrel include all data */ 246 /* Load catalog data from region files, update Mrel include all data. In a parallel 247 context, this function writes the image parameters as a subset table for the remote 248 clients */ 247 249 reload_catalogs (skylist, flatcorr, 0, NULL); 248 250 MARKTIME("-- updated all catalogs: %f sec\n", dtime); -
trunk/Ohana/src/relphot/src/setMrelCatalog.c
r36528 r36630 255 255 256 256 // Map (Maplist) and Mkron (Mkronlist,dkronlist) are used to calculate mean mags per filter 257 float Map = PhotAper (&measure[k]);257 float Map = PhotAperCat (&measure[k]); 258 258 if (!isnan(Map)) { 259 259 Maplist[Nap] = Map - Mcal - Mmos - Mgrid; … … 263 263 } 264 264 265 float Mkron = PhotKron (&measure[k]);265 float Mkron = PhotKronCat (&measure[k]); 266 266 if (!isnan(Mkron)) { 267 267 Mkronlist[Nkron] = Mkron - Mcal - Mmos - Mgrid; … … 282 282 wpsflist[Npsf] = isUbercal ? 10.0 : 1.0; 283 283 284 // NOTE: 285 // Msys is measure[i].M + zp corrections 286 // Mcal is image[j].Mcal 287 // Mmos and Mgrid are offsets for mosaic and grid 284 288 285 289 // tie down reference photometry if the -refcode (code) option is selected -
trunk/Ohana/src/uniphot/src/update_dvo_setphot.c
r35103 r36630 2 2 int update_dvo_setphot_parallel (SkyTable *sky, Image *image, off_t Nimage); 3 3 4 // XXX convert this to use the ImageSubset to save space 4 5 int update_dvo_setphot (Image *image, off_t Nimage, FlatCorrectionTable *flatcorr) { 5 6 -
trunk/ippScripts/scripts/ipp_apply_burntool_single.pl
- Property svn:mergeinfo changed
-
trunk/ippScripts/scripts/publish_file.pl
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20140206/ippScripts/scripts/publish_file.pl (added) merged: 36536,36627 /branches/eam_branches/ipp-20140214/ippScripts/scripts/publish_file.pl (added) merged: 36525-36527
- Property svn:mergeinfo changed
-
trunk/ippconfig/recipes/ppSub.config
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20140206/ippconfig/recipes/ppSub.config (added) merged: 36536,36627 /branches/eam_branches/ipp-20140214/ippconfig/recipes/ppSub.config (added) merged: 36525-36527
- Property svn:mergeinfo changed
-
trunk/ippconfig/recipes/reductionClasses.mdc
- Property svn:mergeinfo changed
-
trunk/psphot/src
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20140206/psphot/src (added) merged: 36536,36627-36629 /branches/eam_branches/ipp-20140214/psphot/src (added) merged: 36525-36527
- Property svn:mergeinfo changed
-
trunk/psphot/src/psphotFullForceReadout.c
r36375 r36630 100 100 psphotMagnitudes(config, view, filerule); 101 101 102 // calculate lensing parameters 103 if (!psphotLensing(config, view, filerule)) { 104 psErrorStackPrint(stderr, "Unable to do lensing parameters."); 105 psErrorClear(); 106 } 107 102 108 // replace background in residual image 103 109 psphotSkyReplace (config, view, filerule); -
trunk/psphot/src/psphotStackImageLoop.c
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20140206/psphot/src/psphotStackImageLoop.c (added) merged: 36536,36627 /branches/eam_branches/ipp-20140214/psphot/src/psphotStackImageLoop.c (added) merged: 36525-36527
- Property svn:mergeinfo changed
-
trunk/psphot/src/psphotStackReadout.c
r36542 r36630 418 418 // calculate source magnitudes 419 419 psphotMagnitudes(config, view, STACK_RAW); 420 421 // calculate lensing parameters 422 if (!psphotLensing(config, view, STACK_RAW)) { 423 psErrorStackPrint(stderr, "Unable to do lensing parameters."); 424 psErrorClear(); 425 } 420 426 421 427 if (!psphotEfficiency(config, view, STACK_RAW)) {
Note:
See TracChangeset
for help on using the changeset viewer.
