Changeset 35416
- Timestamp:
- Apr 19, 2013, 4:31:05 PM (13 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 69 edited
- 15 copied
-
. (modified) (1 prop)
-
src/addstar/src/GetFileMode.c (modified) (4 diffs)
-
src/addstar/src/MatchHeaders.c (modified) (1 diff)
-
src/addstar/src/ReadStarsFITS.c (modified) (3 diffs)
-
src/addstar/src/load2mass_catalog.c (modified) (1 diff)
-
src/delstar/Makefile (modified) (2 diffs)
-
src/delstar/include/delstar.h (modified) (2 diffs)
-
src/delstar/src/ImageIDsOps.c (copied) (copied from branches/eam_branches/ipp-20130307/Ohana/src/delstar/src/ImageIDsOps.c )
-
src/delstar/src/args.c (modified) (1 diff)
-
src/delstar/src/delete_duplicate_images.c (modified) (4 diffs)
-
src/delstar/src/delstar_client.c (modified) (1 diff)
-
src/dvomerge/Makefile (modified) (4 diffs)
-
src/dvomerge/include/dvomerge.h (modified) (2 diffs)
-
src/dvomerge/src/args.c (modified) (2 diffs)
-
src/dvomerge/src/dvosecfilt.c (modified) (2 diffs)
-
src/dvomerge/src/dvosecfilt_catalogs.c (copied) (copied from branches/eam_branches/ipp-20130307/Ohana/src/dvomerge/src/dvosecfilt_catalogs.c )
-
src/dvomerge/src/dvosecfilt_client.c (copied) (copied from branches/eam_branches/ipp-20130307/Ohana/src/dvomerge/src/dvosecfilt_client.c )
-
src/dvomerge/src/help.c (modified) (2 diffs)
-
src/dvomerge/src/merge_catalogs_old.c (modified) (2 diffs)
-
src/dvomerge/test/dvosecfilt.parallel.sh (copied) (copied from branches/eam_branches/ipp-20130307/Ohana/src/dvomerge/test/dvosecfilt.parallel.sh )
-
src/dvopsps/src/insert_detections_dvopsps.c (modified) (7 diffs)
-
src/dvopsps/src/insert_detections_dvopsps_catalog.c (modified) (8 diffs)
-
src/dvopsps/src/insert_objects_dvopsps_catalog.c (modified) (2 diffs)
-
src/dvopsps/src/mysql_dvopsps.c (modified) (1 diff)
-
src/kapa2/src/DrawObjects.c (modified) (8 diffs)
-
src/kapa2/src/PSObjects.c (modified) (6 diffs)
-
src/kapa2/src/bDrawObjects.c (modified) (6 diffs)
-
src/libautocode/def/cmf-ps1-dv3.d (copied) (copied from branches/eam_branches/ipp-20130307/Ohana/src/libautocode/def/cmf-ps1-dv3.d )
-
src/libautocode/doc/cmf-ps1-dv3.c (copied) (copied from branches/eam_branches/ipp-20130307/Ohana/src/libautocode/doc/cmf-ps1-dv3.c )
-
src/libautocode/doc/cmf-ps1-dv3.h (copied) (copied from branches/eam_branches/ipp-20130307/Ohana/src/libautocode/doc/cmf-ps1-dv3.h )
-
src/libdvo/Makefile (modified) (2 diffs)
-
src/libdvo/include/cmf-ps1-dv3.h (copied) (copied from branches/eam_branches/ipp-20130307/Ohana/src/libdvo/include/cmf-ps1-dv3.h )
-
src/libdvo/include/dvo.h (modified) (3 diffs)
-
src/libdvo/include/dvodb.h (modified) (3 diffs)
-
src/libdvo/src/ImageMetadata.c (modified) (10 diffs)
-
src/libdvo/src/ImageMetadataSelection.c (modified) (4 diffs)
-
src/libdvo/src/ImageSelection.c (modified) (1 diff)
-
src/libdvo/src/cmf-ps1-dv3.c (copied) (copied from branches/eam_branches/ipp-20130307/Ohana/src/libdvo/src/cmf-ps1-dv3.c )
-
src/libdvo/src/dbExtractAverages.c (modified) (2 diffs)
-
src/libdvo/src/dbExtractMeasures.c (modified) (7 diffs)
-
src/libdvo/src/dbFields.c (modified) (3 diffs)
-
src/libdvo/src/dvo_catalog.c (modified) (3 diffs)
-
src/libkapa/src/KapaOpen.c (modified) (3 diffs)
-
src/libohana/src (modified) (1 prop)
-
src/opihi (modified) (1 prop)
-
src/opihi/cmd.astro (modified) (1 prop)
-
src/opihi/cmd.astro/Makefile (modified) (1 diff)
-
src/opihi/cmd.astro/fitplx.c (copied) (copied from branches/eam_branches/ipp-20130307/Ohana/src/opihi/cmd.astro/fitplx.c )
-
src/opihi/cmd.astro/init.c (modified) (2 diffs)
-
src/opihi/cmd.data (modified) (1 prop)
-
src/opihi/cmd.data/Makefile (modified) (1 diff)
-
src/opihi/cmd.data/init.c (modified) (2 diffs)
-
src/opihi/cmd.data/xsection.c (copied) (copied from branches/eam_branches/ipp-20130307/Ohana/src/opihi/cmd.data/xsection.c )
-
src/opihi/dvo/avextract.c (modified) (1 diff)
-
src/opihi/dvo/avmatch.c (modified) (1 diff)
-
src/opihi/dvo/dvo_host_utils.c (modified) (5 diffs)
-
src/opihi/dvo/mextract.c (modified) (2 diffs)
-
src/opihi/dvo/mmatch.c (modified) (3 diffs)
-
src/opihi/dvo/photometry.c (modified) (3 diffs)
-
src/opihi/dvo/remote.c (modified) (1 diff)
-
src/opihi/dvo/skyregion.c (modified) (2 diffs)
-
src/opihi/include/dvoshell.h (modified) (1 diff)
-
src/relastro/Makefile (modified) (2 diffs)
-
src/relastro/include/relastro.h (modified) (2 diffs)
-
src/relastro/src (modified) (1 prop)
-
src/relastro/src/UpdateObjects.c (modified) (5 diffs)
-
src/relastro/src/args.c (modified) (7 diffs)
-
src/relastro/src/hpm_catalogs.c (copied) (copied from branches/eam_branches/ipp-20130307/Ohana/src/relastro/src/hpm_catalogs.c )
-
src/relastro/src/hpm_objects.c (copied) (copied from branches/eam_branches/ipp-20130307/Ohana/src/relastro/src/hpm_objects.c )
-
src/relastro/src/relastro.c (modified) (1 diff)
-
src/relastro/src/relastro_client.c (modified) (1 diff)
-
src/relphot/Makefile (modified) (2 diffs)
-
src/relphot/include/relphot.h (modified) (4 diffs)
-
src/relphot/src/MosaicOps.c (modified) (3 diffs)
-
src/relphot/src/args.c (modified) (3 diffs)
-
src/relphot/src/bcatalog.c (modified) (2 diffs)
-
src/relphot/src/global_stats.c (modified) (2 diffs)
-
src/relphot/src/load_catalogs.c (modified) (1 diff)
-
src/relphot/src/load_images.c (modified) (4 diffs)
-
src/relphot/src/relphot.c (modified) (2 diffs)
-
src/relphot/src/relphot_images.c (copied) (copied from branches/eam_branches/ipp-20130307/Ohana/src/relphot/src/relphot_images.c )
-
src/relphot/src/select_images.c (modified) (5 diffs)
-
src/relphot/src/synthetic_mags.c (copied) (copied from branches/eam_branches/ipp-20130307/Ohana/src/relphot/src/synthetic_mags.c )
-
src/uniphot/src/match_flatcorr_to_images.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
-
trunk/Ohana/src/addstar/src/GetFileMode.c
r35108 r35416 20 20 havePHOT_VER = gfits_scan (header, "PHOT_VER", "%s", 1, ctmp); 21 21 haveTARG_VER = gfits_scan (header, "TARG_VER", "%s", 1, ctmp); 22 if (havePHOT_VER && haveTARG_VER) return SDSS_OBJ; 22 if (havePHOT_VER && haveTARG_VER) { 23 if (VERBOSE) fprintf (stderr, "found SDSS objects\n"); 24 return SDSS_OBJ; 25 } 23 26 24 27 if (haveNaxis && (Naxis == 2)) { … … 28 31 if ((Nx > 0) && (Ny > 0)) { 29 32 if (haveCTYPE && !strcmp (&ctype[4], "-WRP")) { 33 if (VERBOSE) fprintf (stderr, "found MOSAIC CMP\n"); 30 34 return MOSAIC_CMP; 31 35 } 36 if (VERBOSE) fprintf (stderr, "found SIMPLE CMP\n"); 32 37 return SIMPLE_CMP; 33 38 } … … 36 41 if (haveNaxis && (TEXTMODE || !simple)) { 37 42 if (haveCTYPE && !strcmp (&ctype[4], "-WRP")) { 43 if (VERBOSE) fprintf (stderr, "found MOSAIC CMP\n"); 38 44 return MOSAIC_CMP; 39 45 } 46 if (VERBOSE) fprintf (stderr, "found SIMPLE CMP\n"); 40 47 return SIMPLE_CMP; 41 48 } … … 43 50 if (!extend && strcmp (&ctype[4], "-DIS")) { 44 51 if (!strcmp (&ctype[4], "-WRP")) { 52 if (VERBOSE) fprintf (stderr, "found MOSAIC CMF\n"); 45 53 return MOSAIC_CMF; 46 54 } 55 if (VERBOSE) fprintf (stderr, "found SIMPLE CMF\n"); 47 56 return SIMPLE_CMF; 48 57 } 49 58 50 59 if (!extend && !strcmp (&ctype[4], "-DIS")) { 60 if (VERBOSE) fprintf (stderr, "found MOSAIC PHU\n"); 51 61 return MOSAIC_PHU; 52 62 } 53 63 54 64 if (extend && strcmp (&ctype[4], "-DIS")) { 65 if (VERBOSE) fprintf (stderr, "found SIMPLE MEF\n"); 55 66 return SIMPLE_MEF; 56 67 } 57 68 58 69 if (extend && !strcmp (&ctype[4], "-DIS")) { 70 if (VERBOSE) fprintf (stderr, "found MOSAIC MEF\n"); 59 71 return MOSAIC_MEF; 60 72 } 61 73 74 if (VERBOSE) fprintf (stderr, "extension type is unknown\n"); 62 75 return (NONE); 63 76 } -
trunk/Ohana/src/addstar/src/MatchHeaders.c
r34405 r35416 61 61 if (!strcmp (exttype, "PS1_SV1")) goto keep; 62 62 if (!strcmp (exttype, "PS1_SV2")) goto keep; 63 if (!strcmp (exttype, "PS1_DV3")) { 64 goto keep; 65 } 63 66 continue; 64 67 -
trunk/Ohana/src/addstar/src/ReadStarsFITS.c
r34580 r35416 15 15 Stars *Convert_PS1_SV1_Alt PROTO((FTable *table, unsigned int *nstars)); 16 16 Stars *Convert_PS1_SV2 PROTO((FTable *table, unsigned int *nstars)); 17 Stars *Convert_PS1_DV3 PROTO((FTable *table, unsigned int *nstars)); 17 18 18 19 // given a file with the pointer at the start of the table block and the … … 78 79 stars = Convert_PS1_SV2 (&table, &Nstars); 79 80 } 81 if (!strcmp (type, "PS1_DV3")) { 82 stars = Convert_PS1_DV3 (&table, &Nstars); 83 } 80 84 if (stars == NULL) { 81 85 fprintf (stderr, "invalid table type %s\n", type); … … 962 966 } 963 967 964 968 Stars *Convert_PS1_DV3 (FTable *table, unsigned int *nstars) { 969 970 off_t Nstars; 971 unsigned int i; 972 double ZeroPt; 973 Stars *stars; 974 CMF_PS1_DV3 *ps1data; 975 976 ps1data = gfits_table_get_CMF_PS1_DV3 (table, &Nstars, NULL); 977 if (!ps1data) { 978 fprintf (stderr, "skipping inconsistent entry\n"); 979 return (NULL); 980 } 981 ZeroPt = GetZeroPoint(); 982 983 ALLOCATE (stars, Stars, Nstars); 984 for (i = 0; i < Nstars; i++) { 985 InitStar (&stars[i]); 986 stars[i].measure.Xccd = ps1data[i].X; 987 stars[i].measure.Yccd = ps1data[i].Y; 988 stars[i].measure.dXccd = ToShortPixels(ps1data[i].dX); 989 stars[i].measure.dYccd = ToShortPixels(ps1data[i].dY); 990 991 stars[i].measure.posangle = ToShortDegrees(ps1data[i].posangle); 992 stars[i].measure.pltscale = ps1data[i].pltscale; 993 994 if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) { 995 stars[i].measure.M = NAN; 996 } else { 997 stars[i].measure.M = ps1data[i].M + ZeroPt; 998 } 999 stars[i].measure.dM = ps1data[i].dM; 1000 stars[i].measure.dMcal = ps1data[i].dMcal; 1001 stars[i].measure.Map = ps1data[i].Map + ZeroPt; 1002 1003 stars[i].measure.Mkron = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN; 1004 stars[i].measure.dMkron = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN; 1005 1006 // these fluxes are converted from counts to counts/sec in FilterStars.c 1007 stars[i].measure.FluxPSF = ps1data[i].Flux; 1008 stars[i].measure.dFluxPSF = ps1data[i].dFlux; 1009 stars[i].measure.FluxKron = ps1data[i].kronFlux; 1010 stars[i].measure.dFluxKron = ps1data[i].kronFluxErr; 1011 1012 stars[i].measure.Sky = ps1data[i].sky; 1013 stars[i].measure.dSky = ps1data[i].dSky; 1014 1015 stars[i].measure.psfChisq = ps1data[i].psfChisq; 1016 stars[i].measure.psfQF = ps1data[i].psfQF; 1017 stars[i].measure.psfQFperf = ps1data[i].psfQFperf; 1018 stars[i].measure.psfNdof = ps1data[i].psfNdof; 1019 stars[i].measure.psfNpix = ps1data[i].psfNpix; 1020 stars[i].measure.crNsigma = ps1data[i].crNsigma; 1021 stars[i].measure.extNsigma = ps1data[i].extNsigma; 1022 1023 stars[i].measure.FWx = ToShortPixels(ps1data[i].fx); 1024 stars[i].measure.FWy = ToShortPixels(ps1data[i].fy); 1025 stars[i].measure.theta = ToShortDegrees(ps1data[i].df); 1026 1027 stars[i].measure.Mxx = ToShortPixels(ps1data[i].Mxx); 1028 stars[i].measure.Mxy = ToShortPixels(ps1data[i].Mxy); 1029 stars[i].measure.Myy = ToShortPixels(ps1data[i].Myy); 1030 1031 stars[i].measure.photFlags = ps1data[i].flags; 1032 1033 // this is may optionally be replaced by the internal sequence (see FilterStars.c) 1034 stars[i].measure.detID = ps1data[i].detID; 1035 1036 // the Average fields and the following Measure fields are set in FilterStars after 1037 // the image metadata is in hand: dR, dD, Mcal, dt, airmass, az, t, imageID, extID. 1038 1039 // averef is set in find_matches 1040 1041 // dbFlags is zero on ingest. 1042 1043 // the following fields are currently not being set anywhere: t_msec 1044 } 1045 *nstars = Nstars; 1046 return (stars); 1047 } 1048 1049 1050 -
trunk/Ohana/src/addstar/src/load2mass_catalog.c
r34405 r35416 20 20 // XXX for now, the output objects will have limited astrometric interpretation... 21 21 // XXX every 3 stars represents 3 measurements and 1 average 22 dvo_average_init (&catalog[0].average[Nave]); 22 23 catalog[0].average[Nave].R = stars[i].average.R; 23 24 catalog[0].average[Nave].D = stars[i].average.D; 24 catalog[0].average[Nave].dR = 0;25 catalog[0].average[Nave].dD = 0;26 catalog[0].average[Nave].uR = 0;27 catalog[0].average[Nave].uD = 0;28 catalog[0].average[Nave].duR = 0;29 catalog[0].average[Nave].duD = 0;30 catalog[0].average[Nave].P = 0;31 catalog[0].average[Nave].dP = 0;32 33 // XXX for now, set the average mag data to NULL34 catalog[0].average[Nave].Nmeasure = 0;35 catalog[0].average[Nave].Nmissing = 0;36 catalog[0].average[Nave].ChiSqAve = NAN_S_SHORT;37 25 catalog[0].average[Nave].measureOffset = Nmeas; 38 catalog[0].average[Nave].missingOffset = -1;39 catalog[0].average[Nave].flags = 0;40 26 41 27 for (j = 0; j < Nsec; j++) { 42 catalog[0].secfilt[Nave*Nsec+j].M = NAN; 43 catalog[0].secfilt[Nave*Nsec+j].dM = NAN; 44 catalog[0].secfilt[Nave*Nsec+j].Xm = NAN_S_SHORT; 45 catalog[0].secfilt[Nave*Nsec+j].M_20 = NAN_S_SHORT; 46 catalog[0].secfilt[Nave*Nsec+j].M_80 = NAN_S_SHORT; 47 catalog[0].secfilt[Nave*Nsec+j].Ncode = 0; 48 catalog[0].secfilt[Nave*Nsec+j].Nused = 0; 28 dvo_secfilt_init (&catalog[0].secfilt[Nave*Nsec+j]); 49 29 } 50 30 -
trunk/Ohana/src/delstar/Makefile
r35237 r35416 38 38 $(SRC)/find_matches.$(ARCH).o \ 39 39 $(SRC)/parse_time.$(ARCH).o \ 40 $(SRC)/ImageIDsOps.$(ARCH).o \ 40 41 $(SRC)/check_permissions.$(ARCH).o \ 41 42 $(SRC)/Shutdown.$(ARCH).o … … 49 50 $(SRC)/delete_photcodes.$(ARCH).o \ 50 51 $(SRC)/delete_photcodes_single.$(ARCH).o \ 52 $(SRC)/ImageIDsOps.$(ARCH).o \ 51 53 $(SRC)/Shutdown.$(ARCH).o 52 54 -
trunk/Ohana/src/delstar/include/delstar.h
r35243 r35416 117 117 int delete_duplicate_images (int hostID, char *hostpath, FITS_DB *db); 118 118 int delete_duplicate_image_measures (int hostID, char *hostpath, IndexArray *imageID); 119 int delete_duplicate_image_measures_parallel (SkyList *sky );119 int delete_duplicate_image_measures_parallel (SkyList *sky, IndexArray *imageID); 120 120 int delete_duplicate_image_measures_catalog (Catalog *catalog, IndexArray *imageID); 121 121 … … 123 123 IndexArray *make_index_array (Image *image, off_t Nimage, int mode); 124 124 125 IndexArray *ImageIDLoad(char *filename); 126 int ImageIDSave(char *filename, IndexArray *imageID); -
trunk/Ohana/src/delstar/src/args.c
r35237 r35416 328 328 remove_argument (N, &argc, argv); 329 329 } 330 if ((N = get_argument (argc, argv, "-dup-images"))) { 331 if (MODE != MODE_NONE) usage(); 332 MODE = MODE_DUP_IMAGES; 333 remove_argument (N, &argc, argv); 334 } 330 335 331 336 if (MODE == MODE_NONE) delstar_client_usage (); -
trunk/Ohana/src/delstar/src/delete_duplicate_images.c
r35265 r35416 84 84 // launch the remote jobs 85 85 if (PARALLEL && !hostID) { 86 int status = delete_duplicate_image_measures_parallel (skylist );86 int status = delete_duplicate_image_measures_parallel (skylist, imageID); 87 87 return status; 88 88 } … … 128 128 129 129 // CATDIR is supplied globally 130 int delete_duplicate_image_measures_parallel (SkyList *sky) { 130 int delete_duplicate_image_measures_parallel (SkyList *sky, IndexArray *imageID) { 131 132 // write out the subset table of image information 133 char imageFile[512]; 134 snprintf (imageFile, 512, "%s/ImageIDs.tmp.fits", CATDIR); 135 136 if (!ImageIDSave (imageFile, imageID)) { 137 fprintf (stderr, "failed to write image ID table\n"); 138 exit (1); 139 } 131 140 132 141 // launch the delstar_client jobs to the parallel hosts … … 157 166 158 167 fprintf (stderr, "command: %s\n", command); 159 160 fprintf (stderr, "parallel version is not ready (need to save / load the imageID array\n");161 168 162 169 if (PARALLEL_MANUAL) continue; … … 463 470 // XXX this is probably bad : it assumes all chips 464 471 // should be deleted for a given exposure 465 off_t parentID = image[i].parentID;466 if (parentID) {467 off_t Np = parentID - imageID->minID;468 myAssert (Np >= 0, "oops");469 myAssert (Np < imageID->range, "oops");470 imageID->value[Np] = TRUE;471 }472 // off_t parentID = image[i].parentID; 473 // if (parentID) { 474 // off_t Np = parentID - imageID->minID; 475 // myAssert (Np >= 0, "oops"); 476 // myAssert (Np < imageID->range, "oops"); 477 // imageID->value[Np] = TRUE; 478 // } 472 479 } 473 480 -
trunk/Ohana/src/delstar/src/delstar_client.c
r34844 r35416 6 6 int main (int argc, char **argv) { 7 7 8 char imageFile[512]; 9 8 10 SetSignals (); 9 11 ConfigInit (&argc, argv); 10 12 args_client (argc, argv); 11 13 12 // load the current sky table (layout of all SkyRegions)13 SkyTable *sky = SkyTableLoadOptimal (CATDIR, NULL, NULL, TRUE, -1, VERBOSE);14 if (!sky) {15 fprintf (stderr, "ERROR running loading sky table from %s\n", CATDIR);16 exit (2);17 }18 SkyTableSetFilenames (sky, CATDIR, "cpt");19 20 SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch);21 if (!skylist) {22 fprintf (stderr, "ERROR setting up skylist for %s\n", CATDIR);23 exit (2);24 }25 26 14 switch (MODE) { 15 case MODE_DUP_IMAGES: 16 // read the subset table of image information 17 snprintf (imageFile, 512, "%s/ImageIDs.tmp.fits", CATDIR); 18 19 IndexArray *imageID = ImageIDLoad (imageFile); 20 if (!imageID) { 21 fprintf (stderr, "failed to read image ID table\n"); 22 exit (1); 23 } 24 if (!delete_duplicate_image_measures (HOST_ID, HOSTDIR, imageID)) exit (1); 25 exit (0); 26 break; 27 27 case MODE_IMAGEFILE: 28 28 break; -
trunk/Ohana/src/dvomerge/Makefile
r34405 r35416 23 23 dvoverify_client : $(BIN)/dvoverify_client.$(ARCH) 24 24 25 all: dvomerge dvomerge_client dvoconvert dvosecfilt dvo verify dvoverify_client25 all: dvomerge dvomerge_client dvoconvert dvosecfilt dvosecfilt_client dvoverify dvoverify_client 26 26 27 27 # $(SRC)/dvomergeContinue.$(ARCH).o … … 93 93 DVOSECFILT = \ 94 94 $(SRC)/dvosecfilt.$(ARCH).o \ 95 $(SRC)/dvosecfilt_catalogs.$(ARCH).o \ 95 96 $(SRC)/SetSignals.$(ARCH).o \ 96 97 $(SRC)/ConfigInit.$(ARCH).o \ … … 101 102 $(DVOSECFILT) : $(INC)/dvomerge.h 102 103 $(BIN)/dvosecfilt.$(ARCH) : $(DVOSECFILT) 104 105 DVOSECFILT_CLIENT = \ 106 $(SRC)/dvosecfilt_client.$(ARCH).o \ 107 $(SRC)/dvosecfilt_catalogs.$(ARCH).o \ 108 $(SRC)/SetSignals.$(ARCH).o \ 109 $(SRC)/ConfigInit.$(ARCH).o \ 110 $(SRC)/Shutdown.$(ARCH).o \ 111 $(SRC)/help.$(ARCH).o \ 112 $(SRC)/args.$(ARCH).o 113 114 $(DVOSECFILT_CLIENT) : $(INC)/dvomerge.h 115 $(BIN)/dvosecfilt_client.$(ARCH) : $(DVOSECFILT_CLIENT) 103 116 104 117 DVOREPAIR = \ … … 136 149 $(BIN)/dvoverify_client.$(ARCH) : $(DVOVERIFY_CLIENT) 137 150 138 INSTALL = dvomerge dvomerge_client dvoconvert dvosecfilt dvo repair dvoverify dvoverify_client151 INSTALL = dvomerge dvomerge_client dvoconvert dvosecfilt dvosecfilt_client dvorepair dvoverify dvoverify_client 139 152 140 153 # dependancy rules for binary code ######################### -
trunk/Ohana/src/dvomerge/include/dvomerge.h
r34405 r35416 36 36 int REPLACE_BY_PHOTCODE; 37 37 38 char *SINGLE_CPT; 38 39 SkyRegion UserPatch; // used by MODE CAT 39 40 … … 103 104 void dvosecfilt_help PROTO((int argc, char **argv)); 104 105 int dvosecfilt_args PROTO((int *argc, char **argv)); 106 107 void dvosecfilt_client_usage PROTO((void)); 108 void dvosecfilt_client_help PROTO((int argc, char **argv)); 109 int dvosecfilt_client_args PROTO((int *argc, char **argv)); 110 111 int dvosecfilt_catalogs PROTO((int Nsecfilt)); 112 int dvosecfilt_parallel PROTO((SkyTable *insky, int Nsecfilt)); 105 113 106 114 int SkyTablePopulatedRange PROTO((off_t *ns, off_t *ne, SkyTable *sky, off_t Nstart)); -
trunk/Ohana/src/dvomerge/src/args.c
r34260 r35416 170 170 int N; 171 171 172 /* extra error messages */ 173 VERBOSE = FALSE; 174 if ((N = get_argument (*argc, argv, "-v"))) { 175 VERBOSE = TRUE; 172 HOST_ID = 0; 173 174 /* extra error messages */ 175 VERBOSE = FALSE; 176 if ((N = get_argument (*argc, argv, "-v"))) { 177 VERBOSE = TRUE; 178 remove_argument (N, argc, argv); 179 } 180 181 SINGLE_CPT = NULL; 182 if ((N = get_argument (*argc, argv, "-cpt"))) { 183 remove_argument (N, argc, argv); 184 SINGLE_CPT = strcreate (argv[N]); 185 remove_argument (N, argc, argv); 186 } 187 188 /* specify portion of the sky : allow default of all sky? */ 189 UserPatch.Rmin = 0; 190 UserPatch.Rmax = 360; 191 UserPatch.Dmin = -90; 192 UserPatch.Dmax = +90; 193 if ((N = get_argument (*argc, argv, "-region"))) { 194 remove_argument (N, argc, argv); 195 UserPatch.Rmin = atof (argv[N]); 196 remove_argument (N, argc, argv); 197 UserPatch.Rmax = atof (argv[N]); 198 remove_argument (N, argc, argv); 199 UserPatch.Dmin = atof (argv[N]); 200 remove_argument (N, argc, argv); 201 UserPatch.Dmax = atof (argv[N]); 202 remove_argument (N, argc, argv); 203 } 204 205 PARALLEL = FALSE; 206 if ((N = get_argument (*argc, argv, "-parallel"))) { 207 PARALLEL = TRUE; 208 remove_argument (N, argc, argv); 209 } 210 // this is a test mode : rather than launching the remote jobs and waiting for completion, 211 // relphot will simply list the remote command and wait for the user to signal completion 212 PARALLEL_MANUAL = FALSE; 213 if ((N = get_argument (*argc, argv, "-parallel-manual"))) { 214 PARALLEL = TRUE; // -parallel-manual implies -parallel 215 PARALLEL_MANUAL = TRUE; 216 remove_argument (N, argc, argv); 217 } 218 // this is a test mode : rather than launching the relphot_client jobs remotely, they are 219 // run in serial via 'system' 220 PARALLEL_SERIAL = FALSE; 221 if ((N = get_argument (*argc, argv, "-parallel-serial"))) { 222 if (PARALLEL_MANUAL) { 223 fprintf (stderr, "ERROR: cannot mix -parallel-manual and -parallel-serial\n"); 224 exit (1); 225 } 226 PARALLEL = TRUE; // -parallel-serial implies -parallel 227 PARALLEL_SERIAL = TRUE; 176 228 remove_argument (N, argc, argv); 177 229 } … … 180 232 return TRUE; 181 233 } 234 235 /*** check for command line options ***/ 236 int dvosecfilt_client_args (int *argc, char **argv) { 237 238 int N; 239 240 // by definition, the client is not parallel 241 PARALLEL = FALSE; 242 PARALLEL_MANUAL = FALSE; 243 PARALLEL_SERIAL = FALSE; 244 245 SINGLE_CPT = NULL; 246 if ((N = get_argument (*argc, argv, "-cpt"))) { 247 remove_argument (N, argc, argv); 248 SINGLE_CPT = strcreate (argv[N]); 249 remove_argument (N, argc, argv); 250 } 251 252 /* specify portion of the sky : allow default of all sky? */ 253 UserPatch.Rmin = 0; 254 UserPatch.Rmax = 360; 255 UserPatch.Dmin = -90; 256 UserPatch.Dmax = +90; 257 if ((N = get_argument (*argc, argv, "-region"))) { 258 remove_argument (N, argc, argv); 259 UserPatch.Rmin = atof (argv[N]); 260 remove_argument (N, argc, argv); 261 UserPatch.Rmax = atof (argv[N]); 262 remove_argument (N, argc, argv); 263 UserPatch.Dmin = atof (argv[N]); 264 remove_argument (N, argc, argv); 265 UserPatch.Dmax = atof (argv[N]); 266 remove_argument (N, argc, argv); 267 } 268 269 HOST_ID = 0; 270 if ((N = get_argument (*argc, argv, "-hostID"))) { 271 remove_argument (N, argc, argv); 272 HOST_ID = atoi (argv[N]); 273 remove_argument (N, argc, argv); 274 } 275 if (!HOST_ID) dvosecfilt_client_usage(); 276 277 HOSTDIR = NULL; 278 if ((N = get_argument (*argc, argv, "-hostdir"))) { 279 remove_argument (N, argc, argv); 280 HOSTDIR = strcreate (argv[N]); 281 remove_argument (N, argc, argv); 282 } 283 if (!HOSTDIR) dvosecfilt_client_usage(); 284 285 /* extra error messages */ 286 VERBOSE = FALSE; 287 if ((N = get_argument (*argc, argv, "-v"))) { 288 VERBOSE = TRUE; 289 remove_argument (N, argc, argv); 290 } 291 292 if (*argc != 3) dvosecfilt_client_usage(); 293 return TRUE; 294 } -
trunk/Ohana/src/dvomerge/src/dvosecfilt.c
r29001 r35416 3 3 // modify the number of average photcodes : change only secfilt tables in place 4 4 int main (int argc, char **argv) { 5 6 char filename[256], *input;7 off_t i, j, k, Nsecfilt, NsecInput, Nstart;8 SkyTable *insky;9 Catalog catalog;10 SecFilt *insec, *outsec;11 5 12 6 SetSignals (); … … 15 9 dvosecfilt_args (&argc, argv); 16 10 17 input = argv[1];18 Nsecfilt = atoi(argv[2]);11 strcpy (CATDIR, argv[1]); 12 int Nsecfilt = atoi(argv[2]); 19 13 20 // load the sky table for the existing database 21 insky = SkyTableLoadOptimal (input, NULL, NULL, FALSE, SKY_DEPTH_HST, VERBOSE); 22 SkyTableSetFilenames (insky, input, "cpt"); 23 24 // loop over all input catalogs 25 for (i = 0; i < insky[0].Nregions; i++) { 26 if (!insky[0].regions[i].table) continue; 27 if (VERBOSE) fprintf (stderr, "table: %s\n", insky[0].regions[i].name); 28 29 // set the parameters which guide catalog open/load/create 30 catalog.filename = insky[0].filename[i]; 31 catalog.Nsecfilt = 0; 32 33 // always load all of the data (if any exists) 34 catalog.catflags = LOAD_SECF; 35 catalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 36 catalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data 37 38 if (!dvo_catalog_open (&catalog, &insky[0].regions[i], VERBOSE, "w")) { 39 fprintf (stderr, "ERROR: failure to open catalog file %s\n", filename); 40 exit (2); 41 } 42 43 if (catalog.Naves_disk == 0) { 44 dvo_catalog_unlock (&catalog); 45 dvo_catalog_free (&catalog); 46 continue; 47 } 48 49 if (Nsecfilt == catalog.Nsecfilt) { 50 dvo_catalog_unlock (&catalog); 51 dvo_catalog_free (&catalog); 52 continue; 53 } 54 55 NsecInput = catalog.Nsecfilt; 56 Nstart = MIN(Nsecfilt, NsecInput); 57 58 insec = catalog.secfilt; 59 ALLOCATE (outsec, SecFilt, catalog.Naves_disk * Nsecfilt); 60 61 for (k = 0; k < catalog.Naves_disk; k++) { 62 for (j = 0; (j < catalog.Nsecfilt) && (j < Nsecfilt); j++) { 63 outsec[k*Nsecfilt + j].M = insec[k*NsecInput + j].M; 64 outsec[k*Nsecfilt + j].dM = insec[k*NsecInput + j].dM; 65 outsec[k*Nsecfilt + j].Xm = insec[k*NsecInput + j].Xm; 66 outsec[k*Nsecfilt + j].flags = insec[k*NsecInput + j].flags; 67 outsec[k*Nsecfilt + j].Ncode = insec[k*NsecInput + j].Ncode; 68 outsec[k*Nsecfilt + j].Nused = insec[k*NsecInput + j].Nused; 69 outsec[k*Nsecfilt + j].M_20 = insec[k*NsecInput + j].M_20; 70 outsec[k*Nsecfilt + j].M_80 = insec[k*NsecInput + j].M_80; 71 } 72 for (j = Nstart; j < Nsecfilt; j++) { 73 outsec[k*Nsecfilt + j].M = NAN; 74 outsec[k*Nsecfilt + j].dM = NAN; 75 outsec[k*Nsecfilt + j].Xm = NAN_S_SHORT; 76 } 77 } 78 free (catalog.secfilt); 79 catalog.secfilt = outsec; 80 catalog.Nsecfilt = Nsecfilt; 81 catalog.Nsecf_mem = Nsecfilt * catalog.Naves_disk; 82 catalog.Nsecf_disk = Nsecfilt * catalog.Naves_disk; 83 84 dvo_catalog_save (&catalog, VERBOSE); 85 dvo_catalog_unlock (&catalog); 86 dvo_catalog_free (&catalog); 87 } 14 dvosecfilt_catalogs (Nsecfilt); 88 15 89 16 exit (0); -
trunk/Ohana/src/dvomerge/src/help.c
r33963 r35416 25 25 void dvosecfilt_usage(void) { 26 26 27 fprintf (stderr, "USAGE: dvosecfilt (catdir) (Nsecfilt)\n"); 27 fprintf (stderr, "USAGE: dvosecfilt (catdir) (Nsecfilt)\n\n"); 28 fprintf (stderr, " optional flags:\n"); 29 fprintf (stderr, " -v : verbose mode\n"); 30 31 exit (2); 32 } 33 34 void dvosecfilt_client_usage(void) { 35 36 fprintf (stderr, "USAGE: dvosecfilt_client (catdir) (Nsecfilt)\n\n"); 37 fprintf (stderr, " optional flags:\n"); 38 fprintf (stderr, " -v : verbose mode\n"); 28 39 29 40 exit (2); … … 123 134 } 124 135 136 void dvosecfilt_client_help (int argc, char **argv) { 137 138 /* check for help request */ 139 if (get_argument (argc, argv, "-help")) goto show_help; 140 if (get_argument (argc, argv, "-h")) goto show_help; 141 return; 142 143 show_help: 144 145 fprintf (stderr, "USAGE\n"); 146 fprintf (stderr, " dvosecfilt_client (catdir) (Nsecfilt)\n\n"); 147 148 fprintf (stderr, " change number of secfilt entries in photcode table (updates secfilt tables (cps), NSECFILT in cpt files)\n"); 149 fprintf (stderr, " NOTE: the user must change the photcode table to reflect the change (use photcode-table -export / -import)\n"); 150 151 fprintf (stderr, " optional flags:\n"); 152 fprintf (stderr, " -v : verbose mode\n"); 153 fprintf (stderr, " -help : this list\n"); 154 fprintf (stderr, " -h : this list\n\n"); 155 exit (2); 156 } 157 125 158 void dvorepair_help (int argc, char **argv) { 126 159 -
trunk/Ohana/src/dvomerge/src/merge_catalogs_old.c
r34405 r35416 299 299 300 300 // XXX should we accept the input measurements for these fields? 301 301 dvo_average_init (&output[0].average[Nave]); 302 302 output[0].average[Nave].R = input[0].average[N].R; 303 303 output[0].average[Nave].D = input[0].average[N].D; 304 output[0].average[Nave].dR = 0;305 output[0].average[Nave].dD = 0;306 307 output[0].average[Nave].Nmeasure = 0; // this value is update as the measurements are associated with this entry below308 output[0].average[Nave].Nmissing = 0;309 output[0].average[Nave].Nextend = 0;310 311 304 output[0].average[Nave].measureOffset = Nmeas; 312 output[0].average[Nave].missingOffset = -1;313 output[0].average[Nave].extendOffset = -1;314 315 output[0].average[Nave].uR = 0;316 output[0].average[Nave].uD = 0;317 output[0].average[Nave].duR = 0;318 output[0].average[Nave].duD = 0;319 output[0].average[Nave].P = 0;320 output[0].average[Nave].dP = 0;321 322 output[0].average[Nave].stargal = 0;323 output[0].average[Nave].ChiSqAve = 0.0;324 output[0].average[Nave].ChiSqPM = 0.0;325 output[0].average[Nave].ChiSqPar = 0.0;326 output[0].average[Nave].Tmean = 0;327 output[0].average[Nave].Trange = 0;328 output[0].average[Nave].Npos = 0;329 330 305 output[0].average[Nave].objID = objID; // we create objID values in the context of the output db 331 306 output[0].average[Nave].catID = catID; // we create catID values in the context of the output db 332 output[0].average[Nave].flags = 0; // XXX why reset these? 307 333 308 if (PSPS_ID) { 334 309 output[0].average[Nave].extID = CreatePSPSObjectID(output[0].average[Nave].R, output[0].average[Nave].D); 335 } else { 336 output[0].average[Nave].extID = 0; 337 } 310 } 338 311 339 312 objID ++; 340 313 314 // init the new secfilt entries 341 315 for (j = 0; j < NsecfiltOut; j++) { 342 316 int outputIndex = (Nave * NsecfiltOut) + j; 343 output[0].secfilt[outputIndex].M = NAN; 344 output[0].secfilt[outputIndex].dM = NAN; 345 output[0].secfilt[outputIndex].Xm = NAN_S_SHORT; 346 output[0].secfilt[outputIndex].M_20 = NAN_S_SHORT; 347 output[0].secfilt[outputIndex].M_80 = NAN_S_SHORT; 348 output[0].secfilt[outputIndex].Ncode = 0; 349 output[0].secfilt[outputIndex].Nused = 0; 317 dvo_secfilt_init (&output[0].secfilt[outputIndex]); 350 318 } 351 319 … … 359 327 360 328 if (isfinite(input[0].secfilt[N*NsecfiltIn+j].M)) { 361 output[0].secfilt[outputIndex].M = input[0].secfilt[N*NsecfiltIn+j].M; 362 output[0].secfilt[outputIndex].dM = input[0].secfilt[N*NsecfiltIn+j].dM; 363 output[0].secfilt[outputIndex].Xm = input[0].secfilt[N*NsecfiltIn+j].Xm; 364 output[0].secfilt[outputIndex].M_20 = input[0].secfilt[N*NsecfiltIn+j].M_20; 365 output[0].secfilt[outputIndex].M_80 = input[0].secfilt[N*NsecfiltIn+j].M_80; 366 output[0].secfilt[outputIndex].Ncode = input[0].secfilt[N*NsecfiltIn+j].Ncode; 367 output[0].secfilt[outputIndex].Nused = input[0].secfilt[N*NsecfiltIn+j].Nused; 329 output[0].secfilt[outputIndex] = input[0].secfilt[N*NsecfiltIn+j]; 368 330 } 369 331 } -
trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps.c
r35221 r35416 57 57 } 58 58 59 int status = TRUE; 59 60 // select measurements for each populated catalog 60 61 for (i = 0; i < skylist[0].Nregions; i++) { … … 86 87 // NOTE: this is where the real action happens 87 88 if (SAVE_REMOTE && HOST_ID) { 88 append_detections_dvopsps_catalog (&catalog); 89 if (!append_detections_dvopsps_catalog (&catalog)) { 90 fprintf (stderr, "ERROR: failure to append detections to output catalog\n"); 91 status = FALSE; 92 } 89 93 } else { 90 insert_detections_dvopsps_catalog (&catalog, mysqlReal); 94 if (!insert_detections_dvopsps_catalog (&catalog, mysqlReal)) { 95 fprintf (stderr, "ERROR: failure to insert detections into mysql database\n"); 96 status = FALSE; 97 } 91 98 } 92 99 … … 97 104 98 105 if (SAVE_REMOTE && HOST_ID) { 99 save_detections_dvopsps (); 100 } 101 102 return (TRUE); 106 if (!save_detections_dvopsps ()) { 107 fprintf (stderr, "ERROR: failure to save output file with detections\n"); 108 status = FALSE; 109 } 110 } 111 112 return (status); 103 113 } 104 114 … … 189 199 190 200 for (i = 0; i < table->Nhosts; i++) { 191 while((detections = DetectionsLoad (table->hosts[i].results, &Ndetections)) == NULL) {201 if ((detections = DetectionsLoad (table->hosts[i].results, &Ndetections)) == NULL) { 192 202 // failed to get the data from this host. This can happen for various reasons. Give the user a chance to try again... 203 // fprintf (stderr, "you may run the command manually\n"); 193 204 fprintf (stderr, "failed to read data from %s\n", table->hosts[i].hostname); 194 fprintf (stderr, "you may run the command manually\n");205 return FALSE; 195 206 } 196 207 free (table->hosts[i].results); 197 208 table->hosts[i].results = NULL; 198 209 199 insert_detections_mysql_array (mysql, detections, Ndetections); 210 if (!insert_detections_mysql_array (mysql, detections, Ndetections)) { 211 fprintf (stderr, "failed to insert data for %s\n", table->hosts[i].hostname); 212 return FALSE; 213 } 200 214 201 215 free (detections); … … 218 232 insert_detections_mysql_init (&buffer); 219 233 234 int status = TRUE; 235 220 236 gettimeofday (&start, (void *) NULL); 221 237 for (i = 0; i < Ndetections; i++) { … … 224 240 insert_detections_mysql_detvalue (&buffer, &detections[i]); 225 241 if (buffer.Nbuffer > MAX_BUFFER) { 226 insert_detections_mysql_commit (&buffer, mysql); 242 if (!insert_detections_mysql_commit (&buffer, mysql)) { 243 fprintf (stderr, "failure to insert detections in mysql (commit)\n"); 244 status = FALSE; 245 } 227 246 buffer.Nbuffer = 0; 228 247 bzero (buffer.buffer, buffer.Nalloc); … … 230 249 } 231 250 } 232 insert_detections_mysql_commit (&buffer, mysql); 251 if (!insert_detections_mysql_commit (&buffer, mysql)) { 252 fprintf (stderr, "failure to insert detections in mysql (commit 2)\n"); 253 status = FALSE; 254 } 233 255 FreeIOBuffer (&buffer); 234 256 257 if (!status) { 258 MARKTIME("-- failed to insert %d rows in %f sec\n", Ndetections, dtime); 259 return FALSE; 260 } 261 235 262 MARKTIME("-- inserted %d rows in %f sec\n", Ndetections, dtime); 236 return (TRUE);263 return TRUE; 237 264 } 238 265 -
trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c
r35221 r35416 74 74 int save_detections_dvopsps () { 75 75 76 int status = TRUE; 77 76 78 if (!DetectionsSave (RESULT_FILE, detections, Ndetections)) { 77 79 fprintf (stderr, "failed to save detection file %s\n", RESULT_FILE); 80 status = FALSE; 78 81 } 79 82 80 83 free (detections); 81 84 Ndetections = 0; 82 return ( TRUE);85 return (status); 83 86 } 84 87 … … 101 104 int Ninsert = 0; 102 105 106 int status = TRUE; 107 103 108 // NOTE for testing, just do a few objects 104 109 if (!mysql) { … … 115 120 116 121 // XXX check return status 117 insert_detections_mysql_value (&buffer, &average[i], &measure[m+j]); 122 if (!insert_detections_mysql_value (&buffer, &average[i], &measure[m+j])) { 123 fprintf (stderr, "failure to insert detections in mysql\n"); 124 status = FALSE; 125 } 118 126 119 127 if (buffer.Nbuffer > MAX_BUFFER) { 120 insert_detections_mysql_commit (&buffer, mysql); 128 if (!insert_detections_mysql_commit (&buffer, mysql)) { 129 fprintf (stderr, "failure to insert detections in mysql (commit)\n"); 130 status = FALSE; 131 } 121 132 if (DEBUG) fprintf (stderr, "inserted %d rows\n", Ninsert); 122 133 Ninsert = 0; … … 134 145 } 135 146 } 136 insert_detections_mysql_commit (&buffer, mysql); 147 if (!insert_detections_mysql_commit (&buffer, mysql)) { 148 fprintf (stderr, "failure to insert detections in mysql (commit)\n"); 149 status = FALSE; 150 } 151 137 152 if (VERBOSE) fprintf (stderr, "inserted %d rows\n", Ninsert); 138 153 FreeIOBuffer (&buffer); 154 155 if (!status) { 156 MARKTIME("-- failed to insert "OFF_T_FMT" rows in %f sec\n", found, dtime); 157 return (FALSE); 158 } 139 159 140 160 MARKTIME("-- inserted "OFF_T_FMT" rows in %f sec, skipped %d without IDs\n", found, dtime, missingID); … … 188 208 PrintIOBuffer (buffer, "%lu, ", average->extID); // objID 189 209 PrintIOBuffer (buffer, "%u, ", measure->dbFlags); // flags 210 190 211 float zp = code->C * 0.001 + code->K * (measure->airmass - 1) - measure->Mcal; 191 212 float exptime = pow(10.0, 0.4 * measure->dt); … … 211 232 MYSQL_RES *result; 212 233 234 int status = TRUE; 235 213 236 // check that the last two chars are ,\n and replace with ;\n 214 237 if (!strcmp(&buffer->buffer[buffer->Nbuffer-2], ",\n")) { … … 222 245 if (mysql) { 223 246 if (DEBUG) fprintf (stderr, "%s\n", buffer->buffer); 224 int status = mysql_query(mysql, buffer->buffer);225 if ( status) {247 int mysqlStatus = mysql_query(mysql, buffer->buffer); 248 if (mysqlStatus) { 226 249 fprintf (stderr, "error with insert:\n"); 227 250 fprintf (stderr, "%s\n", mysql_error(mysql)); 228 251 fprintf (stderr, "Nbuffer: %d\n", buffer->Nbuffer); 252 status = FALSE; 229 253 } 230 254 result = mysql_store_result (mysql); … … 234 258 } 235 259 236 return TRUE;237 } 260 return status; 261 } -
trunk/Ohana/src/dvopsps/src/insert_objects_dvopsps_catalog.c
r35221 r35416 96 96 97 97 PrintIOBuffer (&buffer, "CREATE TABLE %s_cpt (" 98 "RA FLOAT, "99 "DEC_ FLOAT, "100 "RA_ERR REAL, "101 "DEC_ERR REAL, "102 "U_RA REAL, "103 "U_DEC REAL, "104 "V_RA_ERR REAL, "105 "V_DEC_ERR REAL, "106 "PAR REAL, "107 "PAR_ERR REAL, "108 "CHISQ_POS REAL, "109 "CHISQ_PM REAL, "110 "CHISQ_PAP REAL, "98 "RA DOUBLE, " 99 "DEC_ DOUBLE, " 100 "RA_ERR FLOAT, " 101 "DEC_ERR FLOAT, " 102 "U_RA FLOAT, " 103 "U_DEC FLOAT, " 104 "V_RA_ERR FLOAT, " 105 "V_DEC_ERR FLOAT, " 106 "PAR FLOAT, " 107 "PAR_ERR FLOAT, " 108 "CHISQ_POS FLOAT, " 109 "CHISQ_PM FLOAT, " 110 "CHISQ_PAP FLOAT, " 111 111 "MEAN_EPOCH INT, " 112 112 "TIME_RANGE INT, " 113 "PSF_QF REAL, "114 "PSF_QF_PERF REAL, "115 "STARGAL_SEP REAL, "113 "PSF_QF FLOAT, " 114 "PSF_QF_PERF FLOAT, " 115 "STARGAL_SEP FLOAT, " 116 116 "NUMBER_POS SMALLINT, " 117 117 "NMEASURE SMALLINT, " … … 152 152 153 153 PrintIOBuffer (&buffer, "CREATE TABLE %s_cps (" 154 "MAG REAL, "155 "MAG_AP REAL, "156 "MAG_KRON REAL, "157 "MAG_KRON_ERR REAL, "158 "MAG_ERR REAL, "159 "MAG_CHI REAL, "160 "FLUX_PSF REAL, "161 "FLUX_PSF_ERR REAL, "162 "FLUX_KRON REAL, "163 "FLUX_KRON_ERR REAL, "154 "MAG FLOAT, " 155 "MAG_AP FLOAT, " 156 "MAG_KRON FLOAT, " 157 "MAG_KRON_ERR FLOAT, " 158 "MAG_ERR FLOAT, " 159 "MAG_CHI FLOAT, " 160 "FLUX_PSF FLOAT, " 161 "FLUX_PSF_ERR FLOAT, " 162 "FLUX_KRON FLOAT, " 163 "FLUX_KRON_ERR FLOAT, " 164 164 "FLAGS INT, " 165 165 "NCODE SMALLINT, " -
trunk/Ohana/src/dvopsps/src/mysql_dvopsps.c
r35098 r35416 58 58 // dump_result (connection); 59 59 60 sprintf (query, "show variables like 'max_allowed_packet';");61 if (mysql_query (connection, query)) {62 fprintf (stderr, "failed to set max_allowed_packet\n");63 fprintf (stderr, "%s\n", mysql_error (connection));64 return NULL;65 }66 dump_result (connection);60 // sprintf (query, "show variables like 'max_allowed_packet';"); 61 // if (mysql_query (connection, query)) { 62 // fprintf (stderr, "failed to set max_allowed_packet\n"); 63 // fprintf (stderr, "%s\n", mysql_error (connection)); 64 // return NULL; 65 // } 66 // dump_result (connection); 67 67 68 68 if (0) { -
trunk/Ohana/src/kapa2/src/DrawObjects.c
r32346 r35416 633 633 float *x, *y, *dxm, *dxp; 634 634 double mxi, mxj, myi, myj, bxi, bxj, byi, byj, bx, by; 635 double sx0, sy0, sx1, sy1, sz, sx10, sx11 ;635 double sx0, sy0, sx1, sy1, sz, sx10, sx11, X0, X1, Y0, Y1; 636 636 637 637 mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); … … 651 651 bar = object[0].ebar; sz = object[0].size*graph[0].axis[1].dfy*0.03; 652 652 653 X0 = graph[0].axis[0].fx; 654 X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 655 Y0 = graph[0].axis[1].fy; 656 Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 657 653 658 for (i = 0; i < object[0].Npts; i++) { 654 659 if (!(finite(x[i]) && finite(y[i]) && finite(dxp[i]))) continue; … … 662 667 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 663 668 { 664 DrawLine (sx0, sy0, sx1, sy1);669 ClipLine (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 665 670 if (bar) { 666 671 sx10 = sy1 - sz; 667 672 sx11 = sy1 + sz; 668 DrawLine (sx1, sx10, sx1, sx11);673 ClipLine (sx1, sx10, sx1, sx11, X0, Y0, X1, Y1); 669 674 } 670 675 } … … 679 684 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 680 685 { 681 DrawLine (sx0, sy0, sx1, sy1);686 ClipLine (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 682 687 if (bar) { 683 688 sx10 = sy1 - sz; 684 689 sx11 = sy1 + sz; 685 DrawLine (sx1, sx10, sx1, sx11);690 ClipLine (sx1, sx10, sx1, sx11, X0, Y0, X1, Y1); 686 691 } 687 692 } … … 695 700 float *x, *y, *dym, *dyp; 696 701 double mxi, mxj, myi, myj, bxi, bxj, byi, byj, bx, by; 697 double sx0, sy0, sx1, sy1, sz, sx10, sx11 ;702 double sx0, sy0, sx1, sy1, sz, sx10, sx11, X0, X1, Y0, Y1; 698 703 699 704 mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); … … 713 718 bar = object[0].ebar; sz = object[0].size*graph[0].axis[0].dfx*0.03; 714 719 720 X0 = graph[0].axis[0].fx; 721 X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 722 Y0 = graph[0].axis[1].fy; 723 Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 724 715 725 for (i = 0; i < object[0].Npts; i++) { 716 726 if (!(finite(x[i]) && finite(y[i]) && finite(dyp[i]))) continue; … … 724 734 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 725 735 { 726 DrawLine (sx0, sy0, sx1, sy1);736 ClipLine (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 727 737 if (bar) { 728 738 sx10 = sx1 - sz; 729 739 sx11 = sx1 + sz; 730 DrawLine (sx10, sy1, sx11, sy1);740 ClipLine (sx10, sy1, sx11, sy1, X0, Y0, X1, Y1); 731 741 } 732 742 } … … 741 751 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 742 752 { 743 DrawLine (sx0, sy0, sx1, sy1);753 ClipLine (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 744 754 if (bar) { 745 755 sx10 = sx1 - sz; 746 756 sx11 = sx1 + sz; 747 DrawLine (sx10, sy1, sx11, sy1);748 } 749 } 750 } 751 } 757 ClipLine (sx10, sy1, sx11, sy1, X0, Y0, X1, Y1); 758 } 759 } 760 } 761 } -
trunk/Ohana/src/kapa2/src/PSObjects.c
r32346 r35416 578 578 bar = object[0].ebar; sz = object[0].size*graph[0].axis[1].dfy*0.03; 579 579 580 double X0 = graph[0].axis[0].fx; 581 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 582 double Y0 = graph[0].axis[1].fy; 583 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 584 580 585 for (i = 0; i < object[0].Npts; i++) { 581 586 if (!(finite(x[i]) && finite(y[i]) && finite(dxp[i]))) continue; … … 589 594 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 590 595 { 591 DrawLine (sx0, sy0, sx1, sy1); 596 ClipLinePS (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1, f); 597 // DrawLine (sx0, sy0, sx1, sy1); 592 598 if (bar) { 593 599 sx10 = sy1 - sz; 594 600 sx11 = sy1 + sz; 595 DrawLine (sx1, sx10, sx1, sx11); 601 ClipLinePS (sx1, sx10, sx1, sx11, X0, Y0, X1, Y1, f); 602 // DrawLine (sx1, sx10, sx1, sx11); 596 603 } 597 604 } … … 606 613 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 607 614 { 608 DrawLine (sx0, sy0, sx1, sy1); 615 ClipLinePS (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1, f); 616 // DrawLine (sx0, sy0, sx1, sy1); 609 617 if (bar) { 610 618 sx10 = sy1 - sz; 611 619 sx11 = sy1 + sz; 612 DrawLine (sx1, sx10, sx1, sx11); 620 ClipLinePS (sx1, sx10, sx1, sx11, X0, Y0, X1, Y1, f); 621 // DrawLine (sx1, sx10, sx1, sx11); 613 622 } 614 623 } … … 641 650 bar = object[0].ebar; sz = object[0].size*graph[0].axis[0].dfx*0.03; 642 651 652 double X0 = graph[0].axis[0].fx; 653 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 654 double Y0 = graph[0].axis[1].fy; 655 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 656 643 657 for (i = 0; i < object[0].Npts; i++) { 644 658 if (!(finite(x[i]) && finite(y[i]) && finite(dyp[i]))) continue; … … 652 666 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 653 667 { 654 DrawLine (sx0, sy0, sx1, sy1); 668 ClipLinePS (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1, f); 669 // DrawLine (sx0, sy0, sx1, sy1); 655 670 if (bar) { 656 671 sx10 = sx1 - sz; 657 672 sx11 = sx1 + sz; 658 DrawLine (sx10, sy1, sx11, sy1); 673 ClipLinePS (sx10, sy1, sx11, sy1, X0, Y0, X1, Y1, f); 674 // DrawLine (sx10, sy1, sx11, sy1); 659 675 } 660 676 } … … 669 685 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 670 686 { 671 DrawLine (sx0, sy0, sx1, sy1); 687 ClipLinePS (sx0, sy0, sx1, sy1, X0, Y0, X1, Y1, f); 688 // DrawLine (sx0, sy0, sx1, sy1); 672 689 if (bar) { 673 690 sx10 = sx1 - sz; 674 691 sx11 = sx1 + sz; 675 DrawLine (sx10, sy1, sx11, sy1); 692 ClipLinePS (sx10, sy1, sx11, sy1, X0, Y0, X1, Y1, f); 693 // DrawLine (sx10, sy1, sx11, sy1); 676 694 } 677 695 } -
trunk/Ohana/src/kapa2/src/bDrawObjects.c
r32346 r35416 578 578 bar = object[0].ebar; sz = object[0].size*graph[0].axis[1].dfy*0.03; 579 579 580 double X0 = graph[0].axis[0].fx; 581 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 582 double Y0 = graph[0].axis[1].fy; 583 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 584 580 585 for (i = 0; i < object[0].Npts; i++) { 581 586 if (!(finite(x[i]) && finite(y[i]) && finite(dxp[i]))) continue; … … 589 594 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 590 595 { 591 DrawLine (buffer, sx0, sy0, sx1, sy1); 596 bDrawClipLine (buffer, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 597 // DrawLine (buffer, sx0, sy0, sx1, sy1); 592 598 if (bar) { 593 599 sx10 = sy1 - sz; 594 600 sx11 = sy1 + sz; 595 DrawLine (buffer, sx1, sx10, sx1, sx11); 601 bDrawClipLine (buffer, sx1, sx10, sx1, sx11, X0, Y0, X1, Y1); 602 // DrawLine (buffer, sx1, sx10, sx1, sx11); 596 603 } 597 604 } … … 606 613 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 607 614 { 608 DrawLine (buffer, sx0, sy0, sx1, sy1); 615 bDrawClipLine (buffer, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 616 // DrawLine (buffer, sx0, sy0, sx1, sy1); 609 617 if (bar) { 610 618 sx10 = sy1 - sz; 611 619 sx11 = sy1 + sz; 612 DrawLine (buffer, sx1, sx10, sx1, sx11); 620 bDrawClipLine (buffer, sx1, sx10, sx1, sx11, X0, Y0, X1, Y1); 621 // DrawLine (buffer, sx1, sx10, sx1, sx11); 613 622 } 614 623 } … … 640 649 bar = object[0].ebar; sz = object[0].size*graph[0].axis[0].dfx*0.03; 641 650 651 double X0 = graph[0].axis[0].fx; 652 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 653 double Y0 = graph[0].axis[1].fy; 654 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 655 642 656 for (i = 0; i < object[0].Npts; i++) { 643 657 if (!(finite(x[i]) && finite(y[i]) && finite(dyp[i]))) continue; … … 651 665 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 652 666 { 653 DrawLine (buffer, sx0, sy0, sx1, sy1); 667 bDrawClipLine (buffer, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 668 // DrawLine (buffer, sx0, sy0, sx1, sy1); 654 669 if (bar) { 655 670 sx10 = sx1 - sz; 656 671 sx11 = sx1 + sz; 657 DrawLine (buffer, sx10, sy1, sx11, sy1); 672 bDrawClipLine (buffer, sx10, sy1, sx11, sy1, X0, Y0, X1, Y1); 673 // DrawLine (buffer, sx10, sy1, sx11, sy1); 658 674 } 659 675 } … … 668 684 (sy1 < graph[0].axis[1].fy) && (sy1 > graph[0].axis[1].fy + graph[0].axis[1].dfy))) 669 685 { 670 DrawLine (buffer, sx0, sy0, sx1, sy1); 686 bDrawClipLine (buffer, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 687 // DrawLine (buffer, sx0, sy0, sx1, sy1); 671 688 if (bar) { 672 689 sx10 = sx1 - sz; 673 690 sx11 = sx1 + sz; 674 DrawLine (buffer, sx10, sy1, sx11, sy1); 691 bDrawClipLine (buffer, sx10, sy1, sx11, sy1, X0, Y0, X1, Y1); 692 // DrawLine (buffer, sx10, sy1, sx11, sy1); 675 693 } 676 694 } -
trunk/Ohana/src/libdvo/Makefile
r35263 r35416 36 36 $(DESTINC)/ps1_v3_defs.h \ 37 37 $(DESTINC)/ps1_v4_defs.h \ 38 $(DESTINC)/ps1_ref_defs.h 38 $(DESTINC)/ps1_ref_defs.h \ 39 $(DESTINC)/cmf-ps1-dv3.h 39 40 40 41 INCS = $(DEFS) $(DESTINC)/dvo.h $(DESTINC)/autocode.h $(DESTINC)/dvo_util.h $(DESTINC)/dvodb.h $(DESTINC)/libdvo_astro.h $(DESTINC)/convert.h $(DESTINC)/get_graphdata.h … … 84 85 $(SRC)/cmf-ps1-v1-alt.$(ARCH).o \ 85 86 $(SRC)/cmf-ps1-sv1-alt.$(ARCH).o \ 87 $(SRC)/cmf-ps1-dv3.$(ARCH).o \ 86 88 $(SRC)/dvo_util.$(ARCH).o \ 87 89 $(SRC)/dbBooleanCond.$(ARCH).o \ -
trunk/Ohana/src/libdvo/include/dvo.h
r35102 r35416 129 129 ID_MEAS_BLEND_MEAS_X = 0x00001000, // detection is within radius of multiple objects across catalogs 130 130 ID_MEAS_ARTIFACT = 0x00002000, // detection is thought to be non-astronomical 131 ID_MEAS_ UNDEF_5 = 0x00004000, // unused131 ID_MEAS_SYNTH_MAG = 0x00004000, // magnitude is synthetic 132 132 ID_MEAS_PHOTOM_UBERCAL = 0x00008000, // externally-supplied zero point from ubercal analysis 133 133 ID_MEAS_STACK_PRIMARY = 0x00010000, // this stack measurement is in the primary skycell … … 288 288 CMF_PS1_SV1 *gfits_table_get_CMF_PS1_SV1_Alt (FTable *ftable, off_t *Ndata, char *swapped); 289 289 290 // another special case : does not match byte-boundaries 291 # include "cmf-ps1-dv3.h" 292 290 293 typedef struct { 291 294 int Ncode; // number of photcodes … … 717 720 718 721 void dvo_average_init (Average *average); 722 void dvo_averageT_init (AverageTiny *average); 719 723 void dvo_secfilt_init (SecFilt *secfilt); 720 724 void dvo_measure_init (Measure *measure); 725 void dvo_measureT_init (MeasureTiny *measure); 721 726 722 727 # endif // DVO_H -
trunk/Ohana/src/libdvo/include/dvodb.h
r35263 r35416 125 125 MEAS_YFIX, 126 126 MEAS_POS_SYS_ERR, 127 MEAS_XFIELD, 128 MEAS_YFIELD, 127 129 MEAS_XMOSAIC, 128 130 MEAS_YMOSAIC, … … 301 303 double crval1; 302 304 double crval2; 305 float theta; 303 306 unsigned int imageID; 304 307 unsigned int externID; … … 382 385 ImageMetadata *MatchImageMetadataDVO (unsigned int imageID); 383 386 Coords *MatchMosaicMetadata (unsigned int imageID); 387 Coords *MatchFieldMetadata (unsigned int imageID); 384 388 off_t match_image_by_ID (ImageMetadata *image, off_t Nimage, unsigned int ID); 385 389 void sort_image_metadata (ImageMetadata *image, off_t Nimage); -
trunk/Ohana/src/libdvo/src/ImageMetadata.c
r35263 r35416 63 63 GET_COLUMN (crval1, "CRVAL1", double); 64 64 GET_COLUMN (crval2, "CRVAL2", double); 65 GET_COLUMN (theta, "THETA", float); 65 66 GET_COLUMN (Mcal, "MCAL", float); 66 67 GET_COLUMN (secz, "SECZ", float); … … 75 76 image[i].crval1 = crval1[i] ; 76 77 image[i].crval2 = crval2[i] ; 78 image[i].theta = theta[i] ; 77 79 image[i].Mcal = Mcal[i] ; 78 80 image[i].secz = secz[i] ; … … 87 89 free (crval1); 88 90 free (crval2); 91 free (theta); 89 92 free (Mcal); 90 93 free (secz); … … 112 115 FTable ftable; 113 116 117 BuildChipMatch (image, Nimage); 118 114 119 gfits_init_header (&header); 115 120 header.extend = TRUE; … … 124 129 gfits_define_bintable_column (&theader, "D", "CRVAL1", "ra at center", "degrees", 1.0, 0.0); 125 130 gfits_define_bintable_column (&theader, "D", "CRVAL2", "dec at center", "degrees", 1.0, 0.0); 131 gfits_define_bintable_column (&theader, "E", "THETA", "camera rot angle", "degrees", 1.0, 0.0); 126 132 gfits_define_bintable_column (&theader, "E", "MCAL", "zero point offset", "magnitudes", 1.0, 0.0); 127 133 gfits_define_bintable_column (&theader, "E", "SECZ", "airmass", "none", 1.0, 0.0); … … 134 140 unsigned int *imageID, *externID, *expname; 135 141 double *crval1, *crval2; 136 float *Mcal, *Xcenter, *Ycenter, *secz ;142 float *Mcal, *Xcenter, *Ycenter, *secz, *theta; 137 143 138 144 // create intermediate storage arrays … … 142 148 ALLOCATE (crval1, double, Nimage); 143 149 ALLOCATE (crval2, double, Nimage); 150 ALLOCATE (theta, float, Nimage); 144 151 ALLOCATE (Mcal, float, Nimage); 145 152 ALLOCATE (secz, float, Nimage); … … 149 156 // assign the storage arrays 150 157 for (i = 0; i < Nimage; i++) { 158 int Nmosaic = FindMosaicForImage (image, Nimage, i); 159 if (!Nmosaic) continue; 160 Nmosaic --; 151 161 imageID[i] = image[i].imageID; 152 162 externID[i] = image[i].externID; 153 crval1[i] = image[i].coords.crval1; 154 crval2[i] = image[i].coords.crval2; 163 crval1[i] = image[Nmosaic].coords.crval1; 164 crval2[i] = image[Nmosaic].coords.crval2; 165 166 theta[i] = DEG_RAD*atan2(image[Nmosaic].coords.pc1_2, image[Nmosaic].coords.pc1_1); 167 155 168 Mcal[i] = image[i].Mcal; 156 169 secz[i] = image[i].secz; … … 172 185 gfits_set_bintable_column (&theader, &ftable, "CRVAL1", crval1, Nimage); 173 186 gfits_set_bintable_column (&theader, &ftable, "CRVAL2", crval2, Nimage); 187 gfits_set_bintable_column (&theader, &ftable, "THETA", theta, Nimage); 174 188 gfits_set_bintable_column (&theader, &ftable, "MCAL", Mcal, Nimage); 175 189 gfits_set_bintable_column (&theader, &ftable, "SECZ", secz, Nimage); … … 182 196 free (crval1); 183 197 free (crval2); 198 free (theta); 184 199 free (Mcal); 185 200 free (secz); -
trunk/Ohana/src/libdvo/src/ImageMetadataSelection.c
r35263 r35416 5 5 static off_t Nimage = 0; 6 6 static Coords mosaic; 7 static Coords field; 7 8 8 9 /* load images based on parameters and region, etc */ … … 11 12 image = NULL; 12 13 14 /* field defines a frame with 0,0 at the field center, and 1 arcsec / pixel */ 15 field.crpix1 = field.crpix2 = 0.0; 16 field.cdelt1 = field.cdelt2 = 1.0 / 3600; 17 field.pc1_1 = field.pc2_2 = 1.0; 18 field.pc1_2 = field.pc2_1 = 0.0; 19 field.Npolyterms = 0; 20 strcpy (field.ctype, "RA---SIN"); 21 13 22 /* mosaic defines a frame with 0,0 at the mosaic center, and 1 arcsec / pixel */ 14 23 mosaic.crpix1 = mosaic.crpix2 = 0.0; … … 42 51 } 43 52 53 Coords *MatchFieldMetadata (unsigned int imageID) { 54 55 int m; 56 57 m = match_image_by_ID (image, Nimage, imageID); 58 if (m == -1) return (NULL); 59 60 // if WRP, return the image, otherwise return NULL 61 // if (strcmp(&image[m].coords.ctype[4], "-WRP")) return NULL; 62 // return (&image[m].coords); 63 64 field.crval1 = image[m].crval1; 65 field.crval2 = image[m].crval2; 66 return (&field); 67 } 68 44 69 Coords *MatchMosaicMetadata (unsigned int imageID) { 45 70 … … 48 73 m = match_image_by_ID (image, Nimage, imageID); 49 74 if (m == -1) return (NULL); 75 76 // if WRP, return the image, otherwise return NULL 77 // if (strcmp(&image[m].coords.ctype[4], "-WRP")) return NULL; 78 // return (&image[m].coords); 79 50 80 mosaic.crval1 = image[m].crval1; 51 81 mosaic.crval2 = image[m].crval2; 82 83 mosaic.pc1_1 = cos(RAD_DEG*image[m].theta); 84 mosaic.pc1_2 = sin(RAD_DEG*image[m].theta); 85 mosaic.pc2_2 = cos(RAD_DEG*image[m].theta); 86 mosaic.pc2_1 = -sin(RAD_DEG*image[m].theta); 87 52 88 return (&mosaic); 53 89 } -
trunk/Ohana/src/libdvo/src/ImageSelection.c
r35263 r35416 93 93 int m; 94 94 95 // mosaic.crval1 = 0; 96 // mosaic.crval2 = 0; 95 97 m = match_image_subset (image, subset, Nsubset, time, source); 96 98 if (m == -1) return (NULL); 97 mosaic.crval1 = image[m].coords.crval1; 98 mosaic.crval2 = image[m].coords.crval2; 99 return (&mosaic); 99 // mosaic = image[m].coords.crval1; 100 // mosaic = image[m].coords.crval2; 101 102 // if WRP, return the image, otherwise return NULL 103 if (strcmp(&image[m].coords.ctype[4], "-WRP")) return NULL; 104 return (&image[m].coords); 100 105 } -
trunk/Ohana/src/libdvo/src/dbExtractAverages.c
r34844 r35416 141 141 value.Flt = average[0].ChiSqPar; 142 142 break; 143 144 // XXX case AVE_PM_GROUPS: 145 // XXX value.Int = GetProperMotionGroups (average, measure); 146 // XXX break; 143 147 144 148 case AVE_TMEAN: … … 278 282 } 279 283 284 // XXX int GetProperMotionGroups (Average *average, Measure *measure) { 285 // XXX // need the times, excluding ignored detections 286 // XXX // sort the images 287 // XXX for (i = 0; i < Ntimes - 1; i++) { 288 // XXX if (time[i+1] - time[i] < TRANGE) Ngroup ++; 289 // XXX } 290 // XXX return Ngroup; 291 // XXX } 292 // XXX -
trunk/Ohana/src/libdvo/src/dbExtractMeasures.c
r35263 r35416 16 16 static int REMOTE_CLIENT = FALSE; 17 17 18 // the following values are calculated together in a single function, eg., 19 // ApplyTransform() returning Glon & Glat. for a single measurement, we want to do this 20 // calculation once and save both values in case both are requested (usually both are if 21 // either is) 18 22 static int haveGalacticAve = FALSE; 19 23 static double GLON_AVE = 0.0; … … 31 35 static double ELON_MEAS = 0.0; 32 36 static double ELAT_MEAS = 0.0; 37 38 static int haveMosaicMeas = FALSE; 39 static double XMOS_MEAS = 0.0; 40 static double YMOS_MEAS = 0.0; 41 42 static int haveFieldMeas = FALSE; 43 static double XFIELD_MEAS = 0.0; 44 static double YFIELD_MEAS = 0.0; 33 45 34 46 int dbExtractMeasuresInit (int isRemoteClient) { … … 66 78 67 79 int dbExtractMeasuresInitMeas () { 80 haveMosaicMeas = FALSE; 68 81 haveGalacticMeas = FALSE; 69 82 haveEclipticMeas = FALSE; … … 76 89 int Nsec; 77 90 dbValue value; 78 double ra, dec, x, y, dT; 79 80 Coords *mosaic; 91 double dT; 92 93 Coords *mosaic, *fieldc; 94 81 95 PhotCode *equiv; 82 96 … … 85 99 86 100 switch (field->ID) { 87 case MEAS_MAG: /* magnitudes are already determined above */ 88 equiv = GetPhotcodeEquivbyCode (measure[0].photcode); 89 90 // we return the magnitude for this measure if: 91 if (field->photcode->type == PHOT_MAG) goto valid_photcode; 101 case MEAS_MAG: { /* magnitudes are already determined above */ 102 PhotCode *myEquiv = GetPhotcodeEquivbyCode (measure[0].photcode); 103 104 // if we request mag:ave, use equiv for photcode 105 if (field->photcode->type == PHOT_MAG) { 106 equiv = myEquiv; 107 goto valid_photcode; 108 } 109 110 // if we ask for 2MASS_K, etc (REF values), return NAN unless measure->code matches 92 111 if ((field->photcode->type == PHOT_REF) && (measure[0].photcode == field->photcode->code)) goto valid_photcode; 112 113 // if we ask for GPC1.g.XY03:rel, etc (DEP values), return NAN unless measure->code matches 93 114 if ((field->photcode->type == PHOT_DEP) && (measure[0].photcode == field->photcode->code)) goto valid_photcode; 94 115 95 if ((equiv != NULL) && (field->photcode->type == PHOT_SEC) && (equiv[0].code == field->photcode->code)) goto valid_photcode; 116 // if we ask for g:ave, or other SEC-level values, return the corresponding field 117 if (field->photcode->type == PHOT_SEC) { 118 switch (field->magMode) { 119 // measure-like : return non-NAN if measure.equiv.photcode matches field.photcode 120 case MAG_INST: 121 case MAG_CAT: 122 case MAG_SYS: 123 case MAG_REL: 124 case MAG_CAL: 125 case MAG_APER: 126 case MAG_APER_INST: 127 case MAG_KRON: 128 case MAG_KRON_INST: 129 case MAG_KRON_ERR: 130 case MAG_ERR: 131 case MAG_PHOT_FLAGS: 132 equiv = myEquiv; 133 if (equiv && (equiv->code == field->photcode->code)) goto valid_photcode; 134 break; 135 136 // mean-like : return value for the given photcode 137 case MAG_AVE: 138 case MAG_REF: 139 case MAG_CHISQ: 140 case MAG_AVE_ERR: 141 case MAG_NCODE: 142 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 equiv = field->photcode; 148 goto valid_photcode; 149 break; 150 default: 151 fprintf (stderr, "error"); 152 return value; 153 } 154 } 96 155 break; 97 156 … … 182 241 } 183 242 break; 243 } 184 244 case MEAS_RA: /* OK */ 185 245 value.Flt = average[0].R - measure[0].dR / 3600.0; … … 465 525 value.Flt = FromShortPixels(measure[0].dRsys); 466 526 break; 467 case MEAS_XMOSAIC: /* OK */ 468 ra = average[0].R - measure[0].dR / 3600.0; 469 dec = average[0].D - measure[0].dD / 3600.0; 470 mosaic = MatchMosaicMetadata (measure[0].imageID); 471 if (mosaic == NULL) break; 472 RD_to_XY (&x, &y, ra, dec, mosaic); 473 value.Flt = x; 527 528 case MEAS_XFIELD: /* offset relative to exposure center in ra,dec space */ 529 if (!haveFieldMeas) { 530 if (REMOTE_CLIENT) { 531 fieldc = MatchFieldMetadata (measure[0].imageID); 532 } else { 533 fprintf (stderr, "non-parallel Xmos broken\n"); 534 abort(); 535 // fieldc = MatchField (measure[0].t, measure[0].photcode); 536 } 537 if (fieldc == NULL) break; 538 double Rm = average[0].R - measure[0].dR / 3600.0; 539 double Dm = average[0].D - measure[0].dD / 3600.0; 540 RD_to_XY (&XFIELD_MEAS, &YFIELD_MEAS, Rm, Dm, fieldc); 541 } 542 value.Flt = XFIELD_MEAS; 543 break; 544 case MEAS_YFIELD: /* OK */ 545 if (!haveFieldMeas) { 546 if (REMOTE_CLIENT) { 547 fieldc = MatchFieldMetadata (measure[0].imageID); 548 } else { 549 fprintf (stderr, "non-parallel Xmos broken\n"); 550 abort(); 551 // fieldc = MatchField (measure[0].t, measure[0].photcode); 552 } 553 if (fieldc == NULL) break; 554 double Rm = average[0].R - measure[0].dR / 3600.0; 555 double Dm = average[0].D - measure[0].dD / 3600.0; 556 RD_to_XY (&XFIELD_MEAS, &YFIELD_MEAS, Rm, Dm, fieldc); 557 } 558 value.Flt = YFIELD_MEAS; 559 break; 560 561 case MEAS_XMOSAIC: /* offset relative to exposure center in camera coords */ 562 if (!haveMosaicMeas) { 563 if (REMOTE_CLIENT) { 564 mosaic = MatchMosaicMetadata (measure[0].imageID); 565 } else { 566 fprintf (stderr, "non-parallel Xmos broken\n"); 567 abort(); 568 mosaic = MatchMosaic (measure[0].t, measure[0].photcode); 569 } 570 if (mosaic == NULL) break; 571 double Rm = average[0].R - measure[0].dR / 3600.0; 572 double Dm = average[0].D - measure[0].dD / 3600.0; 573 RD_to_XY (&XMOS_MEAS, &YMOS_MEAS, Rm, Dm, mosaic); 574 } 575 value.Flt = XMOS_MEAS; 474 576 break; 475 577 case MEAS_YMOSAIC: /* OK */ 476 ra = average[0].R - measure[0].dR / 3600.0; 477 dec = average[0].D - measure[0].dD / 3600.0; 478 mosaic = MatchMosaic (measure[0].t, measure[0].photcode); 479 if (mosaic == NULL) break; 480 RD_to_XY (&x, &y, ra, dec, mosaic); 481 value.Flt = y; 578 if (!haveMosaicMeas) { 579 if (REMOTE_CLIENT) { 580 mosaic = MatchMosaicMetadata (measure[0].imageID); 581 } else { 582 fprintf (stderr, "non-parallel Xmos broken\n"); 583 abort(); 584 mosaic = MatchMosaic (measure[0].t, measure[0].photcode); 585 } 586 if (mosaic == NULL) break; 587 double Rm = average[0].R - measure[0].dR / 3600.0; 588 double Dm = average[0].D - measure[0].dD / 3600.0; 589 RD_to_XY (&XMOS_MEAS, &YMOS_MEAS, Rm, Dm, mosaic); 590 } 591 value.Flt = YMOS_MEAS; 482 592 break; 483 593 -
trunk/Ohana/src/libdvo/src/dbFields.c
r35237 r35416 87 87 strcpy (code[0].name, "MAG"); 88 88 code[0].type = PHOT_MAG; 89 // the field call 'mag' is only valid for mextract 90 // it should default to REL, but other types should default to AVE 91 if (useDefault) { 92 *mode = MAG_REL; 93 } 89 94 free (tmpstring); 90 95 return (code); … … 220 225 if (!strcasecmp (fieldName, "YFIX")) ESCAPE (MEAS_YFIX, MAG_NONE, OPIHI_FLT); 221 226 if (!strcasecmp (fieldName, "POS_SYS_ERR")) ESCAPE (MEAS_POS_SYS_ERR, MAG_NONE, OPIHI_FLT); 227 if (!strcasecmp (fieldName, "XFIELD")) ESCAPE (MEAS_XFIELD, MAG_NONE, OPIHI_FLT); 228 if (!strcasecmp (fieldName, "YFIELD")) ESCAPE (MEAS_YFIELD, MAG_NONE, OPIHI_FLT); 222 229 if (!strcasecmp (fieldName, "XMOSAIC")) ESCAPE (MEAS_XMOSAIC, MAG_NONE, OPIHI_FLT); 223 230 if (!strcasecmp (fieldName, "YMOSAIC")) ESCAPE (MEAS_YMOSAIC, MAG_NONE, OPIHI_FLT); … … 254 261 255 262 // check for code:mode in photcode name 256 code = ParsePhotcodeField (fieldName, &mode, MAG_ REL);263 code = ParsePhotcodeField (fieldName, &mode, MAG_AVE); 257 264 if (code == NULL) { 258 265 gprint (GP_ERR, "unknown field '%s' for measurement table in DVO database\n", fieldName); -
trunk/Ohana/src/libdvo/src/dvo_catalog.c
r35102 r35416 112 112 113 113 // init all data, or just catalog data 114 void dvo_averageT_init (AverageTiny *average) { 115 average->R = 0; 116 average->D = 0; 117 average->flags = 0; 118 average->Nmeasure = 0; 119 average->measureOffset = -1; 120 average->catID = 0; 121 } 122 123 // init all data, or just catalog data 114 124 void dvo_secfilt_init (SecFilt *secfilt) { 115 125 secfilt->M = NAN; … … 142 152 measure->dR = NAN; 143 153 measure->dD = NAN; 144 measure->M = NAN;145 154 measure->Mcal = NAN; 146 155 measure->Map = NAN; … … 203 212 measure->dbFlags = 0; 204 213 measure->photFlags = 0; 214 } 215 216 void dvo_measureT_init (MeasureTiny *measure) { 217 measure->dR = NAN; 218 measure->dD = NAN; 219 measure->M = NAN; 220 measure->Mcal = NAN; 221 measure->dM = NAN; 222 223 measure->airmass = NAN; 224 measure->Xccd = NAN; 225 measure->Yccd = NAN; 226 measure->Xfix = NAN; 227 measure->Yfix = NAN; 228 229 measure->t = 0; 230 measure->dt = NAN; 231 measure->averef = 0; 232 233 measure->imageID = 0; 234 235 measure->dbFlags = 0; 236 measure->photFlags = 0; 237 measure->photcode = 0; 238 239 measure->catID = 0; 240 241 measure->dXccd = 0; 242 measure->dYccd = 0; 243 measure->dRsys = 0; 205 244 } 206 245 -
trunk/Ohana/src/libkapa/src/KapaOpen.c
r35237 r35416 120 120 return (-1); 121 121 122 accepted: 122 accepted: 123 { 124 // we need to do some minimal handshake here. I will send out 125 // a 4 char message : KAPA 126 int Nout = write (BindSocket, "KAPA", 4); 127 if (Nout != 4) { 128 if (DEBUG) fprintf (stderr, "connection failed\n"); 129 close (BindSocket); 130 return (-1); 131 } 132 } 133 123 134 if (DEBUG) fprintf (stderr, "connection accepted\n"); 124 135 return (BindSocket); … … 203 214 perror ("connect: "); 204 215 exit (2); 216 } 217 218 // apparently, I can connect on someone else's port (eg GoogleTalkPlugin) 219 // do a simple handshake before we set !NONBLOCK: 220 char line[5]; 221 int Nout = read (InitSocket, line, 4); 222 if (Nout != 4) { 223 if (DEBUG) fprintf (stderr, "connection failed\n"); 224 close (InitSocket); 225 return (-1); 226 } 227 if (strncmp (line, "KAPA", 4)) { 228 if (DEBUG) fprintf (stderr, "connection to the wrong server\n"); 229 close (InitSocket); 230 return (-1); 205 231 } 206 232 … … 290 316 291 317 if (name == NULL) { 292 sprintf (temp, "%s -socket %s &", kapa_exec, socket_name);318 sprintf (temp, "%s -socket %s", kapa_exec, socket_name); 293 319 } else { 294 sprintf (temp, "%s -socket %s -name %s &", kapa_exec, socket_name, name);320 sprintf (temp, "%s -socket %s -name %s", kapa_exec, socket_name, name); 295 321 } 296 322 -
trunk/Ohana/src/libohana/src
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/Ohana/src/libohana/src (added) merged: 35350,35412
- Property svn:mergeinfo changed
-
trunk/Ohana/src/opihi
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/Ohana/src/opihi (added) merged: 35316,35327,35339-35340,35342,35347,35350,35355,35401,35412
- Property svn:mergeinfo changed
-
trunk/Ohana/src/opihi/cmd.astro
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/Ohana/src/opihi/cmd.astro (added) merged: 35339-35340,35347,35350,35355,35412
- Property svn:mergeinfo changed
-
trunk/Ohana/src/opihi/cmd.astro/Makefile
r34342 r35416 30 30 $(SRC)/drizzle.$(ARCH).o \ 31 31 $(SRC)/flux.$(ARCH).o \ 32 $(SRC)/fitplx.$(ARCH).o \ 32 33 $(SRC)/fixwrap.$(ARCH).o \ 33 34 $(SRC)/fixcols.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.astro/init.c
r34342 r35416 14 14 int drizzle PROTO((int, char **)); 15 15 int flux PROTO((int, char **)); 16 int fitplx PROTO((int, char **)); 16 17 int fixwrap PROTO((int, char **)); 17 18 int fiximage PROTO((int, char **)); … … 71 72 {1, "drizzle", drizzle, "transform image to image"}, 72 73 {1, "flux", flux, "flux in a convex contour"}, 74 {1, "fitplx", fitplx, "fit proper motion and parallax"}, 73 75 {1, "fixwrap", fixwrap, "fix megacam over-wrapped pixels"}, 74 76 {1, "fiximage", fiximage, "fix pixels in an image by interpolation"}, -
trunk/Ohana/src/opihi/cmd.data
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130307/Ohana/src/opihi/cmd.data (added) merged: 35316,35350,35412
- Property svn:mergeinfo changed
-
trunk/Ohana/src/opihi/cmd.data/Makefile
r35237 r35416 150 150 $(SRC)/vsmooth.$(ARCH).o \ 151 151 $(SRC)/vstats.$(ARCH).o \ 152 $(SRC)/xsection.$(ARCH).o \ 152 153 $(SRC)/wd.$(ARCH).o \ 153 154 $(SRC)/write_vectors.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/init.c
r35237 r35416 141 141 int wd PROTO((int, char **)); 142 142 int write_vectors PROTO((int, char **)); 143 int xsection PROTO((int, char **)); 143 144 int zap PROTO((int, char **)); 144 145 int zplot PROTO((int, char **)); … … 299 300 {1, "wd", wd, "write an image to a file"}, 300 301 {1, "write", write_vectors, "write vectors to datafile"}, 302 {1, "xsection", xsection, "generate cross-section histogram for an image (or region)"}, 301 303 {1, "zap", zap, "assign values to pixel regions"}, 302 304 {1, "zplot", zplot, "plot x y with size scaled by z"}, -
trunk/Ohana/src/opihi/dvo/avextract.c
r34749 r35416 137 137 // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results 138 138 if (PARALLEL && !HOST_ID) { 139 int status = HostTableParallelOps (argc, argv, RESULT_FILE, TRUE, 0, VERBOSE);139 int status = HostTableParallelOps (skylist, argc, argv, RESULT_FILE, TRUE, 0, VERBOSE); 140 140 141 141 dbFreeFields (fields, Nfields); -
trunk/Ohana/src/opihi/dvo/avmatch.c
r34749 r35416 95 95 96 96 // I need to pass the RA & DEC vectors to the remote clients... 97 int status = HostTableParallelOps ( argc, argv, RESULT_FILE, TRUE, RAvec->Nelements, VERBOSE);97 int status = HostTableParallelOps (skylist, argc, argv, RESULT_FILE, TRUE, RAvec->Nelements, VERBOSE); 98 98 if (vec) free (vec); 99 99 -
trunk/Ohana/src/opihi/dvo/dvo_host_utils.c
r35109 r35416 8 8 # define DIE(WHO,MSG) { perror(WHO); myAbort(MSG); } 9 9 10 int HostTableLaunchJobs ( HostTable *table, char *basecmd, char *options, int VERBOSE) {10 int HostTableLaunchJobs (SkyList *sky, HostTable *table, char *basecmd, char *options, int VERBOSE) { 11 11 12 12 char uniquer[12]; … … 35 35 36 36 int top_status = TRUE; 37 int i ;37 int i, j; 38 38 for (i = 0; i < table->Nhosts; i++) { 39 40 if (sky && (sky->Nregions < table->Nhosts)) { 41 // do any of the regions want this host? 42 int wantThisHost = FALSE; 43 for (j = 0; j < sky->Nregions; j++) { 44 if (HostTableTestHost (sky->regions[j], table->hosts[i].hostID)) { 45 wantThisHost = TRUE; 46 break; 47 } 48 } 49 if (!wantThisHost) { 50 // fprintf (stderr, "skip host %s\n", table->hosts[i].hostname); 51 continue; 52 } 53 // fprintf (stderr, "not skip host %s\n", table->hosts[i].hostname); 54 } 39 55 40 56 // ensure that the paths are absolute path names … … 88 104 // an alternative ending step ignores the result files and instead saves the names into 89 105 // the list 'result:n' for the user to access as desired 90 int HostTableParallelOps ( int argc, char **argv, char *ResultFile, int ReadVectors, int Nelements, int VERBOSE) {106 int HostTableParallelOps (SkyList *sky, int argc, char **argv, char *ResultFile, int ReadVectors, int Nelements, int VERBOSE) { 91 107 92 108 int i; 93 109 94 // load the list of hosts95 SkyTable *sky = GetSkyTable();96 if (!sky) {97 gprint (GP_ERR, "failed to load sky table for database\n");98 return FALSE;99 }110 // XX // load the list of hosts 111 // XX SkyTable *sky = GetSkyTable(); 112 // XX if (!sky) { 113 // XX gprint (GP_ERR, "failed to load sky table for database\n"); 114 // XX return FALSE; 115 // XX } 100 116 101 117 char *tmppath = GetCATDIR (); … … 145 161 146 162 // launch this command remotely 147 HostTableLaunchJobs ( table, basecmd, options, VERBOSE);163 HostTableLaunchJobs (sky, table, basecmd, options, VERBOSE); 148 164 free (options); 149 165 free (basecmd); … … 183 199 184 200 if (table->hosts[i].status) continue; 201 if (!table->hosts[i].pid) continue; 185 202 186 203 if (ReadVectors) { -
trunk/Ohana/src/opihi/dvo/mextract.c
r35263 r35416 16 16 if (field->ID == MEAS_CENTER_OFFSET) return TRUE; // 0.5*NX, 0.5*NY 17 17 if (field->ID == MEAS_EXPNAME_AS_INT) return TRUE; // expname (or as int) 18 if (field->ID == MEAS_ AIRMASS)return TRUE; // airmass18 if (field->ID == MEAS_MEAN_AIRMASS) return TRUE; // airmass 19 19 return FALSE; 20 20 } … … 171 171 172 172 // call the remote client 173 int status = HostTableParallelOps ( targc, targv, RESULT_FILE, TRUE, 0, VERBOSE);173 int status = HostTableParallelOps (skylist, targc, targv, RESULT_FILE, TRUE, 0, VERBOSE); 174 174 175 175 dbFreeFields (fields, Nfields); -
trunk/Ohana/src/opihi/dvo/mmatch.c
r35263 r35416 106 106 RAvec = NULL; 107 107 DECvec = NULL; 108 if (PARALLEL && !HOST_ID) {109 110 // We need to copy the args to a temp array and modify them so that we send the111 // correct set to the remote client. The args list looks like this:112 // if (!CoordsFile) : mmatch (RA) (DEC) (RADIUS) field, ...113 // if ( CoordsFile) : mmatch (RADIUS) field, ... [because we stripped off the -coords filename elements]114 115 // allocate the temp array and copy all but (RA) (DEC)116 int targc = 0;117 char **targv = NULL;118 ALLOCATE (targv, char *, argc + 2);119 for (i = 0; i < argc; i++) {120 if (!CoordsFile && (i == 1)) continue;121 if (!CoordsFile && (i == 2)) continue;122 targv[targc] = strcreate (argv[i]);123 targc ++;124 }125 126 // if not specified, create the coords.fits input file127 if (!CoordsFile) {128 // get vectors corresponding to coordinates of interest129 if ((RAvec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto help;130 if ((DECvec = SelectVector (argv[2], ANYVECTOR, TRUE)) == NULL) goto help;131 132 ALLOCATE (vec, Vector *, 2);133 vec[0] = RAvec;134 vec[1] = DECvec;135 136 CoordsFile = abspath("coords.fits", 1024);137 int status = WriteVectorTableFITS (CoordsFile, "COORDS", vec, 2, FALSE, NULL);138 if (!status) goto escape;139 }140 141 // add the coords file to the args list142 targv[targc+0] = strcreate ("-coords");143 targv[targc+1] = CoordsFile; // this gets freed with targv144 targc += 2;145 146 // if needed, add the index vector to the args list147 if (IDXvec) {148 REALLOCATE (targv, char *, targc + 2);149 targv[targc+0] = strcreate ("-index");150 targv[targc+1] = strcreate (IDXvec[0].name);151 targc += 2;152 }153 154 if (loadImages) {155 Image *image;156 off_t Nimage;157 if ((image = LoadImagesDVO (&Nimage)) == NULL) goto escape;158 159 char *filename = abspath("image.metadata.fits", DVO_MAX_PATH);160 ImageMetadataSave (filename, image, Nimage);161 162 REALLOCATE (targv, char *, targc + 2);163 targv[targc+0] = strcreate ("-image-metadata");164 targv[targc+1] = strcreate (filename);165 targc += 2;166 }167 168 // call the remote client169 int status = HostTableParallelOps (targc, targv, RESULT_FILE, TRUE, 0, VERBOSE);170 if (vec) free (vec);171 172 // free up targv173 for (i = 0; i < targc; i++) {174 free (targv[i]);175 }176 free (targv);177 178 return status;179 }180 108 181 109 // get vectors corresponding to coordinates of interest … … 193 121 remove_argument (1, &argc, argv); 194 122 } 123 124 /* load regions which contain all supplied RA,DEC coordinates */ 125 if ((skylist = SelectRegionsByCoordVectors (RAvec, DECvec)) == NULL) goto escape; 126 127 if (PARALLEL && !HOST_ID) { 128 129 // We need to copy the args to a temp array and modify them so that we send the 130 // correct set to the remote client. The args list looks like this: 131 // if (!CoordsFile) : mmatch (RADIUS) field, ... [we removed RA & DEC above] 132 // if ( CoordsFile) : mmatch (RADIUS) field, ... [because we stripped off the -coords filename elements] 133 134 // allocate the temp array and copy all but (RA) (DEC) 135 int targc = 0; 136 char **targv = NULL; 137 ALLOCATE (targv, char *, argc + 2); 138 for (i = 0; i < argc; i++) { 139 targv[targc] = strcreate (argv[i]); 140 targc ++; 141 } 142 143 // if not specified, create the coords.fits input file 144 // NOTE: RAvec, DECvec were set above 145 if (!CoordsFile) { 146 ALLOCATE (vec, Vector *, 2); 147 vec[0] = RAvec; 148 vec[1] = DECvec; 149 150 // XXX this is now set for both cases... 151 CoordsFile = abspath("coords.fits", 1024); 152 int status = WriteVectorTableFITS (CoordsFile, "COORDS", vec, 2, FALSE, NULL); 153 if (!status) goto escape; 154 } 155 156 // add the coords file to the args list 157 targv[targc+0] = strcreate ("-coords"); 158 targv[targc+1] = CoordsFile; // this gets freed with targv 159 targc += 2; 160 161 // if needed, add the index vector to the args list 162 if (IDXvec) { 163 REALLOCATE (targv, char *, targc + 2); 164 targv[targc+0] = strcreate ("-index"); 165 targv[targc+1] = strcreate (IDXvec[0].name); 166 targc += 2; 167 } 168 169 if (loadImages) { 170 Image *image; 171 off_t Nimage; 172 if ((image = LoadImagesDVO (&Nimage)) == NULL) goto escape; 173 174 char *filename = abspath("image.metadata.fits", DVO_MAX_PATH); 175 ImageMetadataSave (filename, image, Nimage); 176 177 REALLOCATE (targv, char *, targc + 2); 178 targv[targc+0] = strcreate ("-image-metadata"); 179 targv[targc+1] = strcreate (filename); 180 targc += 2; 181 } 182 183 // call the remote client 184 int status = HostTableParallelOps (skylist, targc, targv, RESULT_FILE, TRUE, 0, VERBOSE); 185 if (vec) free (vec); 186 187 // free up targv 188 for (i = 0; i < targc; i++) { 189 free (targv[i]); 190 } 191 free (targv); 192 193 return status; 194 } // END of remote call section 195 195 196 RADIUS = atof (argv[1]); 196 197 remove_argument (1, &argc, argv); … … 209 210 } 210 211 211 /* load regions which contain all supplied RA,DEC coordinates */212 if ((skylist = SelectRegionsByCoordVectors (RAvec, DECvec)) == NULL) goto escape;213 212 214 213 /* create output storage vectors */ -
trunk/Ohana/src/opihi/dvo/photometry.c
r34405 r35416 1127 1127 double value; 1128 1128 Image *image; 1129 Coords *mosaic;1129 // Coords *mosaic; 1130 1130 1131 1131 value = 0; … … 1193 1193 # endif 1194 1194 break; 1195 # if 0 1195 1196 case MEAS_XMOSAIC: /* OK */ 1196 1197 ra = average[0].R - measure[0].dR / 3600.0; 1197 1198 dec = average[0].D - measure[0].dD / 3600.0; 1198 mosaic = MatchMosaic (measure[0].t, measure[0].photcode); 1199 mosaic = MatchMosaic (measure[0].t, measure[0].photcode); // XXX not used anymore 1199 1200 if (mosaic == NULL) break; 1200 1201 RD_to_XY (&x, &y, ra, dec, mosaic); … … 1204 1205 ra = average[0].R - measure[0].dR / 3600.0; 1205 1206 dec = average[0].D - measure[0].dD / 3600.0; 1206 mosaic = MatchMosaic (measure[0].t, measure[0].photcode); 1207 mosaic = MatchMosaic (measure[0].t, measure[0].photcode); // XXX not used anymore 1207 1208 if (mosaic == NULL) break; 1208 1209 RD_to_XY (&x, &y, ra, dec, mosaic); 1209 1210 value = y; 1210 1211 break; 1212 # endif 1211 1213 } 1212 1214 return (value); -
trunk/Ohana/src/opihi/dvo/remote.c
r35109 r35416 61 61 } 62 62 63 // load the list of hosts 64 SkyTable *sky = GetSkyTable(); 65 if (!sky) { 66 gprint (GP_ERR, "failed to load sky table for database\n"); 67 return FALSE; 68 } 69 SkyList *skylist = NULL; 70 ALLOCATE (skylist, SkyList, 1); 71 skylist[0].Nregions = sky[0].Nregions; 72 strcpy (skylist[0].hosts, sky[0].hosts); 73 63 74 // strip of the 'remote' and send the remaining arguments to the remote machine 64 int status = HostTableParallelOps (argc - 1, &argv[1], NULL, ReadVectors, 0, VERBOSE); 75 int status = HostTableParallelOps (skylist, argc - 1, &argv[1], NULL, ReadVectors, 0, VERBOSE); 76 free (skylist); 65 77 return status; 66 78 } -
trunk/Ohana/src/opihi/dvo/skyregion.c
r33662 r35416 98 98 new[0].Nregions = 0; 99 99 new[0].ownElements = FALSE; // this list is only holding a view to the elements 100 strcpy (new[0].hosts, sky[0].hosts); 100 101 101 102 // output list … … 107 108 list[0].Nregions = 0; 108 109 list[0].ownElements = FALSE; // this list is only holding a view to the elements 110 strcpy (list[0].hosts, sky[0].hosts); 109 111 110 112 for (i = 0; i < Npts; i++) { -
trunk/Ohana/src/opihi/include/dvoshell.h
r35109 r35416 99 99 dbValue dbExtractImages PROTO((Image *image, off_t Nimage, off_t N, dbField *field)); 100 100 101 int HostTableLaunchJobs PROTO(( HostTable *table, char *basecmd, char *options, int VERBOSE));102 int HostTableParallelOps PROTO(( int argc, char **argv, char *ResultFile, int ReadVectors, int Nelements, int VERBOSE));101 int HostTableLaunchJobs PROTO((SkyList *sky, HostTable *table, char *basecmd, char *options, int VERBOSE)); 102 int HostTableParallelOps PROTO((SkyList *sky, int argc, char **argv, char *ResultFile, int ReadVectors, int Nelements, int VERBOSE)); 103 103 int HostTableReloadResults PROTO((char *uniquer, int VERBOSE)); 104 104 int HostTableGetResults PROTO((char *uniquer, int VERBOSE)); -
trunk/Ohana/src/relastro/Makefile
r33652 r35416 64 64 $(SRC)/high_speed_objects.$(ARCH).o \ 65 65 $(SRC)/high_speed_utils.$(ARCH).o \ 66 $(SRC)/hpm_catalogs.$(ARCH).o \ 67 $(SRC)/hpm_objects.$(ARCH).o \ 66 68 $(SRC)/relastro_merge_source.$(ARCH).o \ 67 69 $(SRC)/resort_catalog.$(ARCH).o \ … … 106 108 $(SRC)/high_speed_objects.$(ARCH).o \ 107 109 $(SRC)/high_speed_utils.$(ARCH).o \ 110 $(SRC)/hpm_catalogs.$(ARCH).o \ 111 $(SRC)/hpm_objects.$(ARCH).o \ 108 112 $(SRC)/relastro_merge_source.$(ARCH).o \ 109 113 $(SRC)/resort_catalog.$(ARCH).o \ -
trunk/Ohana/src/relastro/include/relastro.h
r35105 r35416 20 20 typedef enum {FIT_NONE, FIT_AVERAGE, FIT_PM_ONLY, FIT_PAR_ONLY, FIT_PM_AND_PAR} FitMode; 21 21 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 } FitTarget;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; 23 23 24 24 typedef enum { … … 442 442 443 443 PhotCode **ParsePhotcodeList (char *rawlist, int *nphotcodes, int needAve); 444 445 int hpm_catalogs (SkyTable *sky, SkyList *skylist, int hostID, char *hostpath); 446 int hpm_catalogs_parallel (SkyList *skylist); 447 int hpm_objects (SkyRegion *region, Catalog *catalog); -
trunk/Ohana/src/relastro/src
- Property svn:mergeinfo set to
-
trunk/Ohana/src/relastro/src/UpdateObjects.c
r34749 r35416 224 224 225 225 if ((mode == FIT_PM_ONLY) || (mode == FIT_PM_AND_PAR)) { 226 // project all of the R,D coordinates to a plane centered on this coordinate set226 // project all of the R,D coordinates to a plane centered on this coordinate. set 227 227 // the times to be relative to Tmean (this is required for parallax as well) 228 228 for (k = 0; k < N; k++) { … … 270 270 catalog[i].average[j].flags |= ID_STAR_FIT_PAR; 271 271 Npar ++; 272 } else { 273 // need to set mode = FIT_PM_ONLY if we do not fit for parallax 274 mode = FIT_PM_ONLY; 272 275 } 273 276 } … … 321 324 fit.uD); 322 325 323 // make sure that the fit succeeded326 // make sure that the fit succeeded 324 327 status = TRUE; 325 328 status &= finite(fit.Ro); … … 364 367 catalog[i].average[j].ChiSqPM = fitPM.chisq; 365 368 catalog[i].average[j].ChiSqPar = fitPAR.chisq; 366 catalog[i].average[j].Tmean = (Tmean * 86400 * 365.2 6) + T2000;367 catalog[i].average[j].Trange = (Trange * 86400 * 365.2 6);369 catalog[i].average[j].Tmean = (Tmean * 86400 * 365.25) + T2000; 370 catalog[i].average[j].Trange = (Trange * 86400 * 365.25); 368 371 catalog[i].average[j].Npos = fit.Nfit; 369 372 if (XVERB) fprintf (stderr, "%f %f -> %f %f (%f,%f) pm=(%f %f) chisq=(%f, %f, %f)\n", … … 385 388 } 386 389 387 fprintf (stderr, "fitted "OFF_T_FMT" objects ("OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par), skipped "OFF_T_FMT"\n", (NaveSum + NpmSum + NparSum), NaveSum, NpmSum, NparSum, NskipSum);390 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"\n", (NaveSum + NpmSum + NparSum), NaveSum, NpmSum, NparSum, NskipSum); 388 391 return (TRUE); 389 392 } -
trunk/Ohana/src/relastro/src/args.c
r34749 r35416 89 89 if ((N = get_argument (argc, argv, "-high-speed"))) { 90 90 // XXX include a parallax / no-parallax option 91 if (N >= argc - 3) usage();91 if (N >= argc - 4) usage(); 92 92 FIT_TARGET = TARGET_HIGH_SPEED; 93 93 remove_argument (N, &argc, argv); … … 95 95 remove_argument (N, &argc, argv); 96 96 PHOTCODE_B_LIST = strcreate(argv[N]); 97 remove_argument (N, &argc, argv); 98 RADIUS = atof(argv[N]); 99 remove_argument (N, &argc, argv); 100 HIGH_SPEED_DIR = abspath(argv[N], DVO_MAX_PATH); 101 remove_argument (N, &argc, argv); 102 } 103 104 if ((N = get_argument (argc, argv, "-hpm"))) { 105 if (N >= argc - 2) usage(); 106 FIT_TARGET = TARGET_HPM; 97 107 remove_argument (N, &argc, argv); 98 108 RADIUS = atof(argv[N]); … … 106 116 remove_argument (N, &argc, argv); 107 117 PARALLEL_OUTPUT = TRUE; 108 if ( FIT_TARGET != TARGET_HIGH_SPEED) {109 fprintf (stderr, "-parallel-output only valid for -high-speed mode\n");118 if ((FIT_TARGET != TARGET_HIGH_SPEED) && (FIT_TARGET != TARGET_HPM)) { 119 fprintf (stderr, "-parallel-output only valid for -high-speed or -hpm modes\n"); 110 120 exit (1); 111 121 } … … 456 466 if ((N = get_argument (argc, argv, "-high-speed"))) { 457 467 // XXX include a parallax / no-parallax option 458 if (N >= argc - 3) usage_client();468 if (N >= argc - 5) usage_client(); 459 469 FIT_TARGET = TARGET_HIGH_SPEED; 460 470 remove_argument (N, &argc, argv); … … 466 476 remove_argument (N, &argc, argv); 467 477 HIGH_SPEED_DIR = strcreate(argv[N]); 478 remove_argument (N, &argc, argv); 479 } 480 481 if ((N = get_argument (argc, argv, "-hpm"))) { 482 if (N >= argc - 3) usage(); 483 FIT_TARGET = TARGET_HPM; 484 remove_argument (N, &argc, argv); 485 RADIUS = atof(argv[N]); 486 remove_argument (N, &argc, argv); 487 HIGH_SPEED_DIR = abspath(argv[N], DVO_MAX_PATH); 468 488 remove_argument (N, &argc, argv); 469 489 } … … 668 688 fprintf (stderr, " OR: relastro -update-objects [options]\n"); 669 689 fprintf (stderr, " OR: relastro -high-speed [options]\n"); 690 fprintf (stderr, " OR: relastro -hpm [options]\n"); 670 691 fprintf (stderr, " OR: relastro -merge-source [options]\n\n"); 671 692 … … 679 700 fprintf (stderr, " -update-mosaics\n"); 680 701 fprintf (stderr, " -high-speed (code[,code,code]) (code[,code,code]) (radius) (output catdir)\n"); 702 fprintf (stderr, " -hpm (radius) (output catdir)\n"); 681 703 fprintf (stderr, " -merge-source (objID) (catID) into (objID) (catID)\n\n"); 682 704 -
trunk/Ohana/src/relastro/src/relastro.c
r33652 r35416 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 exit (0); 22 23 case TARGET_HPM: 24 hpm_catalogs (sky, skylist, 0, NULL); 21 25 exit (0); 22 26 -
trunk/Ohana/src/relastro/src/relastro_client.c
r33652 r35416 58 58 } 59 59 60 case TARGET_HPM: { 61 // USAGE: relastro_client -high-speed 62 hpm_catalogs (sky, skylist, HOST_ID, HOSTDIR); 63 break; 64 } 65 60 66 // XXX loading the images is fairly costly -- see if we can do an image subset 61 67 case TARGET_UPDATE_OFFSETS: { -
trunk/Ohana/src/relphot/Makefile
r34844 r35416 40 40 $(SRC)/load_catalogs.$(ARCH).o \ 41 41 $(SRC)/load_images.$(ARCH).o \ 42 $(SRC)/synthetic_mags.$(ARCH).o \ 42 43 $(SRC)/plot_scatter.$(ARCH).o \ 43 44 $(SRC)/plotstuff.$(ARCH).o \ 44 45 $(SRC)/reload_catalogs.$(ARCH).o \ 45 46 $(SRC)/relphot.$(ARCH).o \ 47 $(SRC)/relphot_images.$(ARCH).o \ 46 48 $(SRC)/relphot_objects.$(ARCH).o \ 47 49 $(SRC)/select_images.$(ARCH).o \ … … 69 71 $(SRC)/args.$(ARCH).o \ 70 72 $(SRC)/help.$(ARCH).o \ 73 $(SRC)/synthetic_mags.$(ARCH).o \ 71 74 $(SRC)/plotstuff.$(ARCH).o \ 72 75 $(SRC)/liststats.$(ARCH).o \ -
trunk/Ohana/src/relphot/include/relphot.h
r35104 r35416 4 4 # include <signal.h> 5 5 # include <pthread.h> 6 7 # define MARKTIME(MSG,...) { \ 8 gettimeofday (&stopTimer, (void *) NULL); \ 9 float dtime = DTIME (stopTimer, startTimer); \ 10 fprintf (stderr, MSG, __VA_ARGS__); } 11 12 # define INITTIME \ 13 struct timeval startTimer, stopTimer; \ 14 gettimeofday (&startTimer, (void *) NULL); 6 15 7 16 /* # define GRID_V1 */ … … 193 202 int UpdateAverages; 194 203 int ApplyOffsets; 204 int SyntheticPhotometry; 195 205 196 206 char *PhotcodeList; … … 353 363 void write_coords PROTO((Header *header, Coords *coords)); 354 364 int relphot_objects (int hostID, char *hostpath); 365 int relphot_images (void); 355 366 356 367 void relphot_usage (void); … … 390 401 391 402 void SetMrelInfoInit (SetMrelInfo *results, int allocLists); 403 404 int init_synthetic_mags (); 405 int add_synthetic_mags (AverageTiny *average, SecFilt *secfilt, MeasureTiny *measure, off_t *Nmeasure, off_t *Nm); -
trunk/Ohana/src/relphot/src/MosaicOps.c
r34088 r35416 152 152 } 153 153 154 # define MARKTIME(MSG,...) { \155 float dtime; \156 gettimeofday (&stopTimer, (void *) NULL); \157 dtime = DTIME (stopTimer, startTimer); \158 fprintf (stderr, MSG, __VA_ARGS__); }159 160 154 /* find mosaic frames (unique time periods) (NOTE : we do NOT require matching photcodes...) 161 155 this function will also identify the images NOT in the subset which belong to a selected mosaic … … 167 161 char *pname; 168 162 169 struct timeval startTimer, stopTimer;170 171 163 if (!MOSAIC_ZEROPT) return; 172 164 173 gettimeofday (&startTimer, (void *) NULL);165 INITTIME; 174 166 175 167 /* a 'mosaic' in relphot is (unlike relastro) a virtual concept: there is no … … 264 256 } 265 257 } 266 fprintf (stderr, "%d total images, %d overlap skyregion , %d do not overlap, but match overlapping mosaics\n", (int) Nimage, (int) Nskip, (int) Nmark);258 fprintf (stderr, "%d total images, %d overlap skyregion & match selection criteria, %d do not overlap, but match overlapping mosaics\n", (int) Nimage, (int) Nskip, (int) Nmark); 267 259 MARKTIME("find unselected images matching selected mosaics: %f sec\n", dtime); 268 260 -
trunk/Ohana/src/relphot/src/args.c
r35104 r35416 251 251 remove_argument (N, &argc, argv); 252 252 MOSAIC_ZEROPT = TRUE; 253 if (!strcasecmp (MOSAICNAME, "none")) { 254 fprintf (stderr, "mosaic astrometry selected by MOSAICNAME not defined\n"); 255 exit (2); 256 } 253 257 } 254 258 … … 315 319 remove_argument (N, &argc, argv); 316 320 DophotSelect = TRUE; 321 } 322 323 SyntheticPhotometry = FALSE; 324 if ((N = get_argument (argc, argv, "-synthphot"))) { 325 remove_argument (N, &argc, argv); 326 SyntheticPhotometry = TRUE; 327 init_synthetic_mags(); 317 328 } 318 329 … … 516 527 } 517 528 529 SyntheticPhotometry = FALSE; 530 if ((N = get_argument (argc, argv, "-synthphot"))) { 531 remove_argument (N, &argc, argv); 532 SyntheticPhotometry = FALSE; 533 init_synthetic_mags(); 534 } 535 518 536 ImagSelect = FALSE; 519 537 if ((N = get_argument (argc, argv, "-instmag"))) { -
trunk/Ohana/src/relphot/src/bcatalog.c
r34405 r35416 179 179 REALLOCATE (subcatalog[0].measureT, MeasureTiny, NMEASURE); 180 180 } 181 myAssert (Nmeasure < NMEASURE, "realloc failure"); 181 182 } 182 183 … … 204 205 continue; 205 206 } 207 208 // for w-band photometry (& other cases?) convert gri photometry 209 // to a synthetic w-band magnitude 210 add_synthetic_mags (&subcatalog[0].averageT[Naverage], 211 &subcatalog[0].secfilt[Nsecfilt*Naverage], 212 &subcatalog[0].measureT[Nmeasure], 213 &Nmeasure, 214 &Nm); 215 if (Nmeasure == NMEASURE) { 216 NMEASURE += 1000; 217 REALLOCATE (subcatalog[0].measureT, MeasureTiny, NMEASURE); 218 } 219 myAssert (Nmeasure < NMEASURE, "realloc failure"); 206 220 207 221 subcatalog[0].averageT[Naverage].Nmeasure = Nm; -
trunk/Ohana/src/relphot/src/global_stats.c
r33963 r35416 1 1 # include "relphot.h" 2 3 # define MARKTIME(MSG,...) { \4 float dtime; \5 gettimeofday (&stopTimer, (void *) NULL); \6 dtime = DTIME (stopTimer, startTimer); \7 fprintf (stderr, MSG, __VA_ARGS__); }8 2 9 3 void global_stats (Catalog *catalog, int Ncatalog, FlatCorrectionTable *flatcorr) { … … 11 5 StatType stN, stX, stS, imN, imX, imM, imD, msM, msX, msN, msD; 12 6 13 // struct timeval startTimer, stopTimer;7 // INITTIME; 14 8 15 9 fprintf (stderr, "\n"); 16 10 fprintf (stderr, "STATS median mean sigma min max Nmeas\n"); 17 18 // gettimeofday (&startTimer, (void *) NULL);19 11 20 12 int Ns; -
trunk/Ohana/src/relphot/src/load_catalogs.c
r34642 r35416 148 148 149 149 char tmpline[1024]; 150 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 151 if (VERBOSE2) { snprintf (tmpline, 1024, "%s -vv", command); strcpy (command, tmpline); } 152 if (RESET) { snprintf (tmpline, 1024, "%s -reset", command); strcpy (command, tmpline); } 153 if (RESET_ZEROPTS) { snprintf (tmpline, 1024, "%s -reset-zpts", command); strcpy (command, tmpline); } 154 if (!KEEP_UBERCAL) { snprintf (tmpline, 1024, "%s -reset-ubercal", command); strcpy (command, tmpline); } 155 if (DophotSelect) { snprintf (tmpline, 1024, "%s -dophot %d", command, DophotValue); strcpy (command, tmpline); } 156 if (ImagSelect) { snprintf (tmpline, 1024, "%s -instmag %f %f", command, ImagMin, ImagMax); strcpy (command, tmpline); } 157 if (MaxDensityUse) { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue); strcpy (command, tmpline); } 150 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 151 if (VERBOSE2) { snprintf (tmpline, 1024, "%s -vv", command); strcpy (command, tmpline); } 152 if (RESET) { snprintf (tmpline, 1024, "%s -reset", command); strcpy (command, tmpline); } 153 if (RESET_ZEROPTS) { snprintf (tmpline, 1024, "%s -reset-zpts", command); strcpy (command, tmpline); } 154 if (!KEEP_UBERCAL) { snprintf (tmpline, 1024, "%s -reset-ubercal", command); strcpy (command, tmpline); } 155 if (DophotSelect) { snprintf (tmpline, 1024, "%s -dophot %d", command, DophotValue); strcpy (command, tmpline); } 156 if (ImagSelect) { snprintf (tmpline, 1024, "%s -instmag %f %f", command, ImagMin, ImagMax); strcpy (command, tmpline); } 157 if (MaxDensityUse) { snprintf (tmpline, 1024, "%s -max-density %f", command, MaxDensityValue); strcpy (command, tmpline); } 158 if (SyntheticPhotometry) { snprintf (tmpline, 1024, "%s -synthphot", command); strcpy (command, tmpline); } 159 158 160 if (TimeSelect) { 159 161 char *tstart = ohana_sec_to_date (TSTART); -
trunk/Ohana/src/relphot/src/load_images.c
r33963 r35416 1 1 # include "relphot.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 // This function generates a subset of the images based on selections. Input db has already … … 14 8 off_t Nimage, Nsubset, Nchar; 15 9 off_t *LineNumber; 16 struct timeval start, stop;17 10 char *inSubset; 18 11 … … 20 13 SkyList *skylist = NULL; 21 14 22 gettimeofday (&start, (void *) NULL);15 INITTIME; 23 16 24 17 // load the current sky table (layout of all SkyRegions) … … 93 86 } 94 87 95 # if ( 1)88 # if (0) 96 89 FILE *ftest = fopen ("skydump.dat", "w"); 97 90 int i; -
trunk/Ohana/src/relphot/src/relphot.c
r33963 r35416 1 1 # include "relphot.h" 2 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 9 3 int main (int argc, char **argv) { 10 11 int i, status, Ncatalog;12 Catalog *catalog = NULL;13 FITS_DB db;14 struct timeval start, stop;15 SkyList *skylist = NULL;16 17 gettimeofday (&start, (void *) NULL);18 4 19 5 /* get configuration info, args */ … … 36 22 } 37 23 38 /* register database handle with shutdown procedure */ 39 set_db (&db); 40 db.mode = dvo_catalog_catmode (CATMODE); 41 db.format = dvo_catalog_catformat (CATFORMAT); 42 43 /* lock and load the image db table */ 44 status = dvo_image_lock (&db, ImageCat, 60.0, (UPDATE ? LCK_XCLD : LCK_SOFT)); 45 if (!status && UPDATE) { 46 fprintf (stderr, "error\n"); 47 Shutdown ("ERROR: failure to lock image catalog %s", db.filename); 48 } 49 // if the file is missing, db.dbstate will have a value of either: 50 // LCK_EMPTY (if UPDATE) or LCK_MISSING (if !UPDATE) 51 if ((db.dbstate == LCK_EMPTY) || (db.dbstate == LCK_MISSING)) { 52 53 // 25.0 is the nominal zero point for measurements in the database 54 // for all measurements except PHOT_REF: 55 // measure.M contains: -2.5*log(DN) + 2.5*log(exptime) + 25.0 56 // for measurements using PHOT_REF: 57 // measure.M contains: -2.5*log(DN) + 2.5*log(exptime) + True Zero Point (but exptime and ZP are known) 58 dvo_image_create (&db, 25.0); 59 60 // XXX why are we running relphot on an empty database? 61 } else { 62 if (!dvo_image_load (&db, VERBOSE, FALSE)) Shutdown ("can't read image catalog %s", db.filename); 63 } 64 MARKTIME("-- load image data: %f sec\n", dtime); 65 66 /* load regions and images based on specified sky patch and/or catalog */ 67 skylist = load_images (&db, UserCatalog, &UserPatch); 68 MARKTIME("-- load images: %f sec\n", dtime); 69 70 /* unlock, if we can (else, unlocked below) */ 71 if (!UPDATE) dvo_image_unlock (&db); 72 73 // load the flat correction table (if defined) 74 char flatcorrfile[256]; 75 sprintf (flatcorrfile, "%s/flatcorr.fits", CATDIR); 76 FlatCorrectionTable *flatcorr = FlatCorrectionLoad (flatcorrfile, VERBOSE); 77 78 if (NLOOP > 0) { 79 /* load catalog data from region files (hostID is 0 since we are not a client */ 80 catalog = load_catalogs (skylist, &Ncatalog, 0, NULL); 81 MARKTIME("-- load catalog data: %f sec\n", dtime); 82 83 /* add in a loop over the catalogs calling dvo_catalog_chipcoords */ 84 85 /* match measurements with images, mosaics */ 86 initImageBins (catalog, Ncatalog, TRUE); 87 MARKTIME("-- make image bins: %f sec\n", dtime); 88 89 initMosaicBins (catalog, Ncatalog, TRUE); 90 initGridBins (catalog, Ncatalog); 91 initMrel (catalog, Ncatalog); 92 93 findImages (catalog, Ncatalog, TRUE); 94 MARKTIME("-- set up image indexes: %f sec\n", dtime); 95 96 findMosaics (catalog, Ncatalog, TRUE); /* also sets Grid values */ 97 MARKTIME("-- set up mosaic indexes: %f sec\n", dtime); 98 99 SAVEPLOT = FALSE; 100 101 setExclusions (catalog, Ncatalog, TRUE); 102 103 global_stats (catalog, Ncatalog, flatcorr); 104 105 if (PLOTSTUFF) { 106 plot_star_coords (catalog, Ncatalog); 107 // plot_mosaic_fields (catalog); 108 } 109 110 // if we are measuring the flat-field correction grid, we need to perform a number of iterations first: 111 if (USE_GRID) { 112 int star_toofew; 113 114 // until we finish the grid analysis, do not reject stars out-of-hand based on ID_STAR_FEW 115 // XXX this is kind of poor: need to have a better distinctions about STAR_BAD in setMrel vs getMrel 116 star_toofew = STAR_TOOFEW; 117 STAR_TOOFEW = 0; 118 for (i = 0; i < NGRID; i++) { 119 STAR_BAD = ID_STAR_POOR; 120 setMrel (catalog, Ncatalog, flatcorr); 121 STAR_BAD = ID_STAR_POOR | ID_STAR_FEW; 122 setMgrid (catalog, flatcorr); 123 } 124 STAR_BAD = ID_STAR_POOR | ID_STAR_FEW; 125 STAR_TOOFEW = star_toofew; 126 } 127 128 /* determine fit values */ 129 for (i = 0; i < NLOOP; i++) { 130 if (PLOTSTUFF) { 131 plot_scatter (catalog, Ncatalog, flatcorr); 132 } 133 setMrel (catalog, Ncatalog, flatcorr); // threaded 134 if (PLOTSTUFF) { 135 plot_scatter (catalog, Ncatalog, flatcorr); 136 } 137 setMcal (catalog, FALSE, flatcorr); 138 setMmos (catalog, FALSE, flatcorr); 139 setMgrid (catalog, flatcorr); 140 MARKTIME("-- set Mrel, Mcal, Mmos, Mgrid : %f sec\n", dtime); 141 142 if (PLOTSTUFF) { 143 plot_scatter (catalog, Ncatalog, flatcorr); 144 plot_grid (catalog, flatcorr); 145 plot_mosaics (); 146 plot_images (); 147 plot_stars (catalog, Ncatalog); 148 plot_chisq (catalog, Ncatalog); 149 } 150 // if (i < NLOOP - 1) rationalize_mosaics (catalog, Ncatalog); 151 // if (i % 6 == 1) rationalize_images (); 152 153 // NOTE : in the past, I was not iterating enough before cleaning. make sure we do 154 // at least 8 loops first -- that should get the systematic errors down to the ~1% 155 // level, even in cases where we have an even split between photometric data and 156 // data with 1 mag of extinction. 157 158 if ((i > 8) && (i % 8 == 2)) clean_measures (catalog, Ncatalog, FALSE, flatcorr); 159 if ((i > 8) && (i % 8 == 3)) clean_stars (catalog, Ncatalog); 160 if ((i > 8) && (i % 8 == 5)) clean_mosaics (); 161 if ((i > 8) && (i % 8 == 5)) clean_images (); 162 163 // if ((i == 1) || (i == 5) || (i == 9) || (i == 13)) clean_measures (catalog, Ncatalog, FALSE); 164 // if ((i == 2) || (i == 6) || (i == 10) || (i == 14)) clean_stars (catalog, Ncatalog); 165 // if ((i == 4) || (i == 8) || (i == 12) || (i == 16)) clean_mosaics (); 166 // if ((i == 4) || (i == 8) || (i == 12) || (i == 16)) clean_images (); 167 if (i % 3 == 2) global_stats (catalog, Ncatalog, flatcorr); 168 MARKTIME("-- finished loop %d: %f sec\n", i, dtime); 169 } 170 171 if (PLOTSTUFF) { 172 plot_scatter (catalog, Ncatalog, flatcorr); 173 plot_grid (catalog, flatcorr); 174 plot_mosaics (); 175 plot_images (); 176 plot_stars (catalog, Ncatalog); 177 plot_chisq (catalog, Ncatalog); 178 } 179 180 if (USE_GRID) dump_grid (); 181 182 /* set Mcal & Mmos for bad images */ 183 setMcal (catalog, TRUE, flatcorr); 184 setMmos (catalog, TRUE, flatcorr); 185 MARKTIME("-- finalize Mcal values: %f sec\n", dtime); 186 187 setMcalFinal (); // copy per-mosaic calibrations to the images 188 189 if (SAVE_IMAGE_UPDATES) { 190 191 FITS_DB dbX; 192 off_t *LineNumber; 193 Image *image, *subset; 194 off_t Nimage, Nsubset, i, Nx; 195 char filename[1024]; 196 197 gfits_db_init (&dbX); 198 dbX.lockstate = LCK_XCLD; 199 dbX.timeout = 60.0; 200 dbX.mode = db.mode; 201 dbX.format = db.format; 202 203 snprintf (filename, 1024, "%s.bck", ImageCat); 204 if (!gfits_db_lock (&dbX, filename)) { 205 fprintf (stderr, "can't lock backup image image catalog\n"); 206 return (FALSE); 207 } 208 209 // apply the changes from the image subset to the full table: 210 211 // convert database table to internal structure (binary to Image) 212 // 'image' points to the same memory as db->ftable->buffer 213 image = gfits_table_get_Image (&db.ftable, &Nimage, &db.swapped); 214 if (!image) { 215 fprintf (stderr, "ERROR: failed to read images\n"); 216 exit (2); 217 } 218 gfits_scan (db.ftable.header, "NAXIS1", OFF_T_FMT, 1, &Nx); 219 220 subset = getimages (&Nsubset, &LineNumber); 221 for (i = 0; i < Nsubset; i++) { 222 if (LineNumber[i] == -1) continue; 223 memcpy (&image[LineNumber[i]], &subset[i], Nx); 224 } 225 226 // copy Images.dat data (all or only the subset / vtable elements?) I think I need to dump 227 // the entire Image table, but with the updates in place I think this says: re-work the 228 // ftable/vtable usage in this program to be more sensible... 229 gfits_copy_header (&db.header, &dbX.header); 230 gfits_copy_matrix (&db.matrix, &dbX.matrix); 231 gfits_copy_header (&db.theader, &dbX.theader); 232 gfits_copy_ftable (&db.ftable, &dbX.ftable); 233 234 dbX.ftable.header = &dbX.theader; 235 dbX.virtual = FALSE; 236 237 // save Images.dat using the copied structure 238 if (UPDATE_CATFORMAT) { 239 // ensure the db format is updated 240 dbX.format = dvo_catalog_catformat (UPDATE_CATFORMAT); 241 char photcodeFile[1024]; 242 sprintf (photcodeFile, "%s/Photcodes.dat", CATDIR); 243 SavePhotcodesFITS (photcodeFile); 244 } 245 dvo_image_save (&dbX, VERBOSE); 246 dvo_image_unlock (&dbX); 247 MARKTIME("-- save Image.dat.bck: %f sec\n", dtime); 248 } 249 250 /* at this point, we have correct cal coeffs in the image/mosaic structures */ 251 for (i = 0; i < Ncatalog; i++) { 252 free_tiny_values (&catalog[i]); 253 dvo_catalog_free (&catalog[i]); 254 } 255 freeImageBins (Ncatalog, TRUE); 256 freeMosaicBins (Ncatalog, TRUE); 257 freeGridBins (Ncatalog); 258 259 } // (NLOOP > 0) : this loop determines the offsets per chip 260 261 reload_images (&db); 262 263 // only change the real database files if -update is requested 264 if (!UPDATE) exit (0); 265 266 /* load catalog data from region files, update Mrel include all data */ 267 reload_catalogs (skylist, flatcorr, 0, NULL); 268 MARKTIME("-- updated all catalogs: %f sec\n", dtime); 269 270 if (UPDATE_CATFORMAT) { 271 // ensure the db format is updated 272 db.format = dvo_catalog_catformat (UPDATE_CATFORMAT); 273 } 274 dvo_image_update (&db, VERBOSE); 275 dvo_image_unlock (&db); 24 relphot_images (); 276 25 277 26 exit (0); -
trunk/Ohana/src/relphot/src/select_images.c
r34642 r35416 17 17 off_t getRegionStartByRA (double R, double *Rref, off_t Nregions); 18 18 19 # define MARKTIME(MSG,...) { \20 float dtime; \21 gettimeofday (&stop, (void *) NULL); \22 dtime = DTIME (stop, start); \23 fprintf (stderr, MSG, __VA_ARGS__); }24 25 19 Image *select_images (SkyList *skylist, Image *timage, off_t Ntimage, char *inSubset, off_t **LineNumber, off_t *Nimage, SkyRegion *region) { 26 20 … … 31 25 double Ri[5], Di[5], Xi[5], Yi[5]; 32 26 Coords tcoords; 33 struct timeval start, stop;34 27 35 28 if (skylist[0].Nregions < 1) { … … 40 33 } 41 34 42 gettimeofday (&start, (void *) NULL);35 INITTIME; 43 36 44 37 // the comparison is made in the catalog local projection. below we set crval1,2 … … 82 75 } 83 76 84 # if ( 1)77 # if (0) 85 78 // XXX quick test of the dec bands: 86 79 FILE *fout = fopen ("dec.bands.dat", "w"); … … 132 125 // this adds 1.3 sec for 3M images 133 126 if (!FindMosaicForImage (timage, Ntimage, i)) { 134 fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);127 if (VERBOSE2) fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i); 135 128 continue; 136 129 } -
trunk/Ohana/src/uniphot/src/match_flatcorr_to_images.c
r33654 r35416 43 43 for (i = 0; i < Nimage; i++) { 44 44 if (!image[i].photcode) continue; // skip PHU images 45 if (image[i].photcode > maxCode) continue; // skip PHU images 45 46 46 47 int found = FALSE;
Note:
See TracChangeset
for help on using the changeset viewer.
