Changeset 40291
- Timestamp:
- Dec 13, 2017, 10:53:48 AM (8 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 173 edited
- 15 copied
-
. (modified) (1 prop)
-
src/addstar/src/FilterStars.c (modified) (1 diff)
-
src/addstar/src/LoadDataPMM.c (modified) (1 diff)
-
src/addstar/src/ReadImageHeader.c (modified) (1 diff)
-
src/addstar/src/ReadSDSSHeader.c (modified) (1 diff)
-
src/addstar/src/ReadStarsSDSS.c (modified) (1 diff)
-
src/addstar/src/ReadStarsUKIRT.c (modified) (2 diffs)
-
src/addstar/src/SEDfit.c (modified) (1 diff)
-
src/addstar/src/calibrate.c (modified) (6 diffs)
-
src/addstar/src/fakeimage.c (modified) (2 diffs)
-
src/addstar/src/find_matches.c (modified) (2 diffs)
-
src/addstar/src/find_matches_closest.c (modified) (2 diffs)
-
src/addstar/src/find_matches_gaia.c (modified) (1 diff)
-
src/addstar/src/find_proper.c (modified) (1 diff)
-
src/addstar/src/loadsupercos_plates.c (modified) (1 diff)
-
src/addstar/src/loadsupercos_rawdata.c (modified) (1 diff)
-
src/addstar/src/mkcmf.c (modified) (16 diffs)
-
src/checkastro/src/BrightCatalog.c (modified) (9 diffs)
-
src/delstar/Makefile (modified) (2 diffs)
-
src/delstar/include/delstar.h (modified) (3 diffs)
-
src/delstar/src/args.c (modified) (4 diffs)
-
src/delstar/src/delete_measures_by_detID.c (copied) (copied from branches/eam_branches/ohana.20170822/src/delstar/src/delete_measures_by_detID.c )
-
src/delstar/src/delstar.c (modified) (1 diff)
-
src/delstar/src/delstar_client.c (modified) (1 diff)
-
src/delstar/src/gimages.c (modified) (1 diff)
-
src/dvolens/src/update_objects_catalog.c (modified) (1 diff)
-
src/dvomerge/src/build_links.c (modified) (1 diff)
-
src/dvomerge/src/merge_catalogs_old.c (modified) (3 diffs)
-
src/dvopsps/include/dvopsps.h (modified) (2 diffs)
-
src/dvopsps/src/DetectionOps.c (modified) (8 diffs)
-
src/dvopsps/src/initialize_dvopsps.c (modified) (2 diffs)
-
src/dvopsps/src/insert_FWobjects_dvopsps.c (modified) (1 diff)
-
src/dvopsps/src/insert_FWobjects_dvopsps_catalog.c (modified) (1 diff)
-
src/dvopsps/src/insert_detections_dvopsps_catalog.c (modified) (6 diffs)
-
src/dvopsps/src/insert_objects_dvopsps_catalog.c (modified) (9 diffs)
-
src/fakeastro/src/insert_fakestar.c (modified) (1 diff)
-
src/fakeastro/src/load_template_images.c (modified) (1 diff)
-
src/fakeastro/src/make_2mass_measures.c (modified) (2 diffs)
-
src/fakeastro/src/make_fake_stars_catalog.c (modified) (3 diffs)
-
src/fakeastro/src/make_gaia_measures.c (modified) (2 diffs)
-
src/getstar/src/ReadImageHeader.c (modified) (1 diff)
-
src/getstar/src/select_by_region.c (modified) (2 diffs)
-
src/getstar/src/write_getstar_ps1_dev_0.c (modified) (3 diffs)
-
src/getstar/src/write_getstar_ps1_dev_1.c (modified) (3 diffs)
-
src/getstar/src/write_getstar_ps1_dev_2.c (modified) (3 diffs)
-
src/imregister/imphot/dumpfits.c (modified) (1 diff)
-
src/imregister/imphot/output.c (modified) (1 diff)
-
src/kapa2/src/DrawObjects.c (modified) (1 diff)
-
src/libautocode/Makefile.Targets (modified) (14 diffs)
-
src/libautocode/def/average-ps1-v6.d (copied) (copied from branches/eam_branches/ohana.20170822/src/libautocode/def/average-ps1-v6.d )
-
src/libautocode/def/convert.sh (copied) (copied from branches/eam_branches/ohana.20170822/src/libautocode/def/convert.sh )
-
src/libautocode/def/galphot-ps1-v6.d (copied) (copied from branches/eam_branches/ohana.20170822/src/libautocode/def/galphot-ps1-v6.d )
-
src/libautocode/def/image-ps1-v6.d (copied) (copied from branches/eam_branches/ohana.20170822/src/libautocode/def/image-ps1-v6.d )
-
src/libautocode/def/image.d (modified) (2 diffs)
-
src/libautocode/def/lensing-ps1-v6.d (copied) (copied from branches/eam_branches/ohana.20170822/src/libautocode/def/lensing-ps1-v6.d )
-
src/libautocode/def/lensobj-ps1-v6.d (copied) (copied from branches/eam_branches/ohana.20170822/src/libautocode/def/lensobj-ps1-v6.d )
-
src/libautocode/def/measure-ps1-v6.d (copied) (copied from branches/eam_branches/ohana.20170822/src/libautocode/def/measure-ps1-v6.d )
-
src/libautocode/def/measure.d (modified) (4 diffs)
-
src/libautocode/def/photcode-ps1-v6.d (copied) (copied from branches/eam_branches/ohana.20170822/src/libautocode/def/photcode-ps1-v6.d )
-
src/libautocode/def/secfilt-ps1-v6.d (copied) (copied from branches/eam_branches/ohana.20170822/src/libautocode/def/secfilt-ps1-v6.d )
-
src/libautocode/def/secfilt.d (modified) (2 diffs)
-
src/libautocode/def/starpar-ps1-v6.d (copied) (copied from branches/eam_branches/ohana.20170822/src/libautocode/def/starpar-ps1-v6.d )
-
src/libdvo/Makefile (modified) (2 diffs)
-
src/libdvo/doc/notes.txt (modified) (2 diffs)
-
src/libdvo/include/dvo.h (modified) (4 diffs)
-
src/libdvo/include/dvodb.h (modified) (5 diffs)
-
src/libdvo/include/libdvo_astro.h (modified) (1 diff)
-
src/libdvo/include/ps1_v6_defs.h (copied) (copied from branches/eam_branches/ohana.20170822/src/libdvo/include/ps1_v6_defs.h )
-
src/libdvo/src/ImageMetadata.c (modified) (4 diffs)
-
src/libdvo/src/LoadPhotcodesFITS.c (modified) (1 diff)
-
src/libdvo/src/SavePhotcodesFITS.c (modified) (1 diff)
-
src/libdvo/src/dbCheckStack.c (modified) (1 diff)
-
src/libdvo/src/dbExtractImages.c (modified) (2 diffs)
-
src/libdvo/src/dbExtractMeasures.c (modified) (1 diff)
-
src/libdvo/src/dbFields.c (modified) (4 diffs)
-
src/libdvo/src/dvo_catalog.c (modified) (6 diffs)
-
src/libdvo/src/dvo_catalog_raw.c (modified) (8 diffs)
-
src/libdvo/src/dvo_catalog_split.c (modified) (1 diff)
-
src/libdvo/src/dvo_convert.c (modified) (20 diffs)
-
src/libdvo/src/dvo_convert_PS1_DEV_1.c (modified) (6 diffs)
-
src/libdvo/src/dvo_convert_PS1_DEV_2.c (modified) (6 diffs)
-
src/libdvo/src/dvo_convert_PS1_DEV_3.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_REF.c (modified) (4 diffs)
-
src/libdvo/src/dvo_convert_PS1_SIM.c (modified) (6 diffs)
-
src/libdvo/src/dvo_convert_PS1_V1.c (modified) (6 diffs)
-
src/libdvo/src/dvo_convert_PS1_V2.c (modified) (6 diffs)
-
src/libdvo/src/dvo_convert_PS1_V3.c (modified) (8 diffs)
-
src/libdvo/src/dvo_convert_PS1_V4.c (modified) (9 diffs)
-
src/libdvo/src/dvo_convert_PS1_V5.c (modified) (8 diffs)
-
src/libdvo/src/dvo_convert_PS1_V5_LOAD.c (modified) (6 diffs)
-
src/libdvo/src/dvo_convert_PS1_V6.c (copied) (copied from branches/eam_branches/ohana.20170822/src/libdvo/src/dvo_convert_PS1_V6.c )
-
src/libdvo/src/dvo_convert_elixir.c (modified) (10 diffs)
-
src/libdvo/src/dvo_convert_loneos.c (modified) (10 diffs)
-
src/libdvo/src/dvo_convert_panstarrs_DEV_0.c (modified) (6 diffs)
-
src/libdvo/src/dvo_convert_panstarrs_DEV_1.c (modified) (6 diffs)
-
src/libdvo/src/dvo_image.c (modified) (3 diffs)
-
src/libdvo/src/dvo_image_raw.c (modified) (2 diffs)
-
src/libdvo/src/dvo_photcode_ops.c (modified) (31 diffs)
-
src/libdvo/src/dvo_tiny_values.c (modified) (1 diff)
-
src/libohana/include/ohana.h (modified) (1 diff)
-
src/libohana/include/ohana_sort.h (modified) (1 diff)
-
src/libohana/src/bisection.c (modified) (1 diff)
-
src/libohana/src/isolate_elements.c (modified) (1 diff)
-
src/libohana/src/sorts.c (modified) (1 diff)
-
src/markrock/src/find_slow_rocks.c (modified) (2 diffs)
-
src/opihi/cmd.astro/fitplx.c (modified) (4 diffs)
-
src/opihi/cmd.astro/fitplx_irls.c (modified) (3 diffs)
-
src/opihi/cmd.astro/fitpm.c (modified) (1 diff)
-
src/opihi/cmd.astro/fitpm_irls.c (modified) (1 diff)
-
src/opihi/cmd.astro/star.c (modified) (4 diffs)
-
src/opihi/cmd.data/Makefile (modified) (1 diff)
-
src/opihi/cmd.data/init.c (modified) (2 diffs)
-
src/opihi/cmd.data/limits.c (modified) (4 diffs)
-
src/opihi/cmd.data/print_vectors.c (modified) (3 diffs)
-
src/opihi/cmd.data/reindex.c (modified) (2 diffs)
-
src/opihi/cmd.data/test/periodogram-fm.sh (modified) (15 diffs)
-
src/opihi/cmd.data/test/periodogram.sh (modified) (4 diffs)
-
src/opihi/cmd.data/test/uniqpair.sh (copied) (copied from branches/eam_branches/ohana.20170822/src/opihi/cmd.data/test/uniqpair.sh )
-
src/opihi/cmd.data/uniq.c (modified) (1 diff)
-
src/opihi/cmd.data/uniqpair.c (copied) (copied from branches/eam_branches/ohana.20170822/src/opihi/cmd.data/uniqpair.c )
-
src/opihi/cmd.data/write_vectors.c (modified) (1 diff)
-
src/opihi/dvo/dvo_host_utils.c (modified) (1 diff)
-
src/opihi/dvo/gimages.c (modified) (1 diff)
-
src/opihi/dvo/gstar.c (modified) (12 diffs)
-
src/opihi/dvo/imdata.c (modified) (1 diff)
-
src/opihi/dvo/imlist.c (modified) (1 diff)
-
src/opihi/dvo/imphot.c (modified) (3 diffs)
-
src/opihi/dvo/imstats.c (modified) (2 diffs)
-
src/opihi/dvo/objectcoverage.c (modified) (1 diff)
-
src/opihi/dvo/paverage.c (modified) (1 diff)
-
src/opihi/dvo/remote.c (modified) (1 diff)
-
src/opihi/dvo/skycoverage.c (modified) (1 diff)
-
src/opihi/include/astro.h (modified) (1 diff)
-
src/opihi/include/data.h (modified) (1 diff)
-
src/opihi/lib.data/graphtools.c (modified) (2 diffs)
-
src/opihi/lib.data/starfuncs.c (modified) (1 diff)
-
src/opihi/lib.shell/VectorIO.c (modified) (4 diffs)
-
src/opihi/lib.shell/convert_to_RPN.c (modified) (2 diffs)
-
src/opihi/lib.shell/dvomath.c (modified) (2 diffs)
-
src/opihi/lib.shell/evaluate_stack.c (modified) (5 diffs)
-
src/opihi/lib.shell/parse.c (modified) (1 diff)
-
src/photdbc/src/get_mags.c (modified) (2 diffs)
-
src/photdbc/src/join_stars.c (modified) (1 diff)
-
src/photdbc/src/make_subcatalog.c (modified) (8 diffs)
-
src/relastro/include/relastro.h (modified) (2 diffs)
-
src/relastro/src (modified) (1 prop)
-
src/relastro/src/BrightCatalog.c (modified) (9 diffs)
-
src/relastro/src/ImageOps.c (modified) (2 diffs)
-
src/relastro/src/MosaicOps.c (modified) (1 diff)
-
src/relastro/src/UpdateMeasures.c (modified) (3 diffs)
-
src/relastro/src/UpdateObjectOffsets.c (modified) (2 diffs)
-
src/relastro/src/args.c (modified) (4 diffs)
-
src/relphot/include/relphot.h (modified) (6 diffs)
-
src/relphot/src/BrightCatalog.c (modified) (14 diffs)
-
src/relphot/src/GridOps.c (modified) (4 diffs)
-
src/relphot/src/ImageMagIO.c (modified) (8 diffs)
-
src/relphot/src/ImageOps.c (modified) (23 diffs)
-
src/relphot/src/ImageSubset.c (modified) (9 diffs)
-
src/relphot/src/MosaicOps.c (modified) (30 diffs)
-
src/relphot/src/StarOps.c (modified) (15 diffs)
-
src/relphot/src/args.c (modified) (2 diffs)
-
src/relphot/src/bcatalog.c (modified) (1 diff)
-
src/relphot/src/launch_region_hosts.c (modified) (1 diff)
-
src/relphot/src/liststats.c (modified) (5 diffs)
-
src/relphot/src/load_images.c (modified) (1 diff)
-
src/relphot/src/plot_scatter.c (modified) (2 diffs)
-
src/relphot/src/plotstuff.c (modified) (1 diff)
-
src/relphot/src/reload_catalogs.c (modified) (1 diff)
-
src/relphot/src/relphot_images.c (modified) (6 diffs)
-
src/relphot/src/relphot_objects.c (modified) (1 diff)
-
src/relphot/src/relphot_parallel_images.c (modified) (4 diffs)
-
src/relphot/src/relphot_parallel_regions.c (modified) (2 diffs)
-
src/relphot/src/relphot_synthphot_catalog.c (modified) (1 diff)
-
src/relphot/src/select_images.c (modified) (1 diff)
-
src/relphot/src/setMrelCatalog.c (modified) (19 diffs)
-
src/relphot/src/setMrelFinal.c (modified) (3 diffs)
-
src/relphot/src/share_image_mags.c (modified) (2 diffs)
-
src/relphot/src/share_mean_mags.c (modified) (2 diffs)
-
src/relphot/src/synthetic_mags.c (modified) (1 diff)
-
src/uniphot/include/setphot.h (modified) (1 diff)
-
src/uniphot/src/ImageSubset.c (modified) (4 diffs)
-
src/uniphot/src/dumpresult.c (modified) (2 diffs)
-
src/uniphot/src/fit_groups.c (modified) (2 diffs)
-
src/uniphot/src/match_zpts_to_images.c (modified) (3 diffs)
-
src/uniphot/src/update_catalog_setastrom.c (modified) (2 diffs)
-
src/uniphot/src/update_catalog_setphot.c (modified) (2 diffs)
-
src/uniphot/src/update_catalog_uniphot.c (modified) (2 diffs)
-
src/uniphot/src/update_dvo_uniphot.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
-
trunk/Ohana/src/addstar/src/FilterStars.c
r39473 r40291 73 73 outcat->measure[N].airmass = airmass (image[0].secz, outcat->average[N].R, outcat->average[N].D, image[0].sidtime, image[0].latitude); 74 74 outcat->measure[N].az = azimuth (15.0*image[0].sidtime - outcat->average[N].R, outcat->average[N].D, image[0].latitude); 75 outcat->measure[N].Mcal = image[0].Mcal; 75 outcat->measure[N].McalPSF = image[0].McalPSF; 76 outcat->measure[N].McalAPER= image[0].McalAPER; 76 77 outcat->measure[N].t = image[0].tzero + 1e-4*outcat->measure[N].Yccd*image[0].trate; /* trate is in 0.1 msec / row */ 77 78 outcat->measure[N].dt = MTIME; -
trunk/Ohana/src/addstar/src/LoadDataPMM.c
r38553 r40291 234 234 // altaz (&alt, &az, 15.0*image[0].sidtime - image[0].coords.crval1, image[0].coords.crval2, Latitude); 235 235 236 // secz is in units of airmass 236 237 image[0].trate = 0.0; 237 238 image[0].secz = 1.0; 238 239 image[0].ccdnum = 0; 239 240 240 // secz is in units milli-airmass 241 image[0].Mcal = 0.0; 242 image[0].Xm = NAN_S_SHORT; 243 image[0].flags = 0; 241 image[0].McalPSF = 0.0; 242 image[0].McalAPER = 0.0; 243 image[0].McalChiSq = NAN; 244 image[0].dMcal = NAN; 245 image[0].flags = 0; 244 246 245 247 image[0].nstar = 0; -
trunk/Ohana/src/addstar/src/ReadImageHeader.c
r39457 r40291 265 265 } 266 266 267 /* secz is in units milli-airmass */268 image[0].Mcal = ZERO_POINT_OFFSET;269 image[0].dMcal = ZERO_POINT_ERROR;270 image[0]. Xm = NAN_S_SHORT;271 image[0].flags = 0;267 image[0].McalPSF = ZERO_POINT_OFFSET; 268 image[0].McalAPER = ZERO_POINT_OFFSET; 269 image[0].dMcal = ZERO_POINT_ERROR; 270 image[0].McalChiSq = NAN; 271 image[0].flags = 0; 272 272 273 273 /* find expected number of stars */ -
trunk/Ohana/src/addstar/src/ReadSDSSHeader.c
r16810 r40291 47 47 48 48 // secz is in units milli-airmass 49 image[0].Mcal = 0.0; 50 image[0].Xm = NAN_S_SHORT; 49 image[0].McalPSF = 0.0; 50 image[0].McalAPER = 0.0; 51 image[0].McalChiSq = NAN; 52 image[0].dMcal = NAN; 51 53 image[0].code = 0; 52 54 memset (image[0].dummy, 0, sizeof(image[0].dummy)); -
trunk/Ohana/src/addstar/src/ReadStarsSDSS.c
r39161 r40291 258 258 altaz (&alt, &az, 15.0*images[N].sidtime - images[N].coords.crval1, images[N].coords.crval2, Latitude); 259 259 260 // secz is in units of airmass 260 261 images[N].trate = clockRate * 1e-4; 261 262 images[N].secz = catalog->measure[0].airmass; 262 263 images[N].ccdnum = camcol; 263 264 264 // secz is in units milli-airmass 265 images[N].Mcal = 0.0; 266 images[N].Xm = NAN_S_SHORT; 267 images[N].flags = 0; 265 images[N].McalPSF = 0.0; 266 images[N].McalAPER = 0.0; 267 images[N].McalChiSq = NAN; 268 images[N].dMcal = NAN; 269 images[N].flags = 0; 268 270 269 271 images[N].nstar = Nstars; -
trunk/Ohana/src/addstar/src/ReadStarsUKIRT.c
r39161 r40291 196 196 catalog->measure[i].FWy = ToShortPixels(seeing); 197 197 198 catalog->measure[i].Mcal = Mcal; 198 catalog->measure[i].McalPSF = Mcal; 199 catalog->measure[i].McalAPER = Mcal; 199 200 200 201 catalog->measure[i].detID = i; … … 251 252 252 253 // secz is in units milli-airmass 253 images[N].Mcal = Mcal; 254 images[N].Xm = NAN_S_SHORT; 255 images[N].flags = 0; 254 images[N].McalPSF = Mcal; 255 images[N].McalAPER = Mcal; 256 images[N].McalChiSq = NAN; 257 images[N].dMcal = NAN; 258 images[N].flags = 0; 256 259 257 260 images[N].nstar = Nstars; -
trunk/Ohana/src/addstar/src/SEDfit.c
r38467 r40291 172 172 outcat[0].measure[Nmeas].M = table[0].row[minFit.row][0].mags[n] + minFit.Md; 173 173 outcat[0].measure[Nmeas].dM = 0.0; 174 outcat[0].measure[Nmeas].Mcal = 0; 174 outcat[0].measure[Nmeas].McalPSF = 0; 175 outcat[0].measure[Nmeas].McalAPER = 0; 175 176 outcat[0].measure[Nmeas].t = TIMEREF; 176 177 outcat[0].measure[Nmeas].averef = Nave; -
trunk/Ohana/src/addstar/src/calibrate.c
r39457 r40291 74 74 /* check if this reference code is an average magnitude */ 75 75 if (Nsec != -1) { 76 CalM0 = secfilt[Nsec].M ;77 dCalM = secfilt[Nsec].dM ;76 CalM0 = secfilt[Nsec].MpsfChp; 77 dCalM = secfilt[Nsec].dMpsfChp; 78 78 found0 = TRUE; 79 79 } … … 82 82 Nsec = GetPhotcodeNsec (CalC1); 83 83 if (Nsec != -1) { 84 CalM1 = secfilt[Nsec].M ;84 CalM1 = secfilt[Nsec].MpsfChp; 85 85 found1 = TRUE; 86 86 } … … 89 89 Nsec = GetPhotcodeNsec (CalC2); 90 90 if (Nsec != -1) { 91 CalM2 = secfilt[Nsec].M ;91 CalM2 = secfilt[Nsec].MpsfChp; 92 92 found2 = TRUE; 93 93 } … … 151 151 if (MaxN == -1) { 152 152 fprintf (stderr, "no clean stars\n"); 153 image[0].Mcal = 10.000; 154 image[0].dMcal = 10.000; 153 image[0].McalPSF = 10.000; 154 image[0].McalAPER = 10.000; 155 image[0].dMcal = 10.000; 155 156 return; 156 157 } … … 187 188 if (Nkeep < 5) { 188 189 fprintf (stderr, "too few stars\n"); 189 image[0].Mcal = 10.000; 190 image[0].dMcal = 10.000; 190 image[0].McalPSF = 10.000; 191 image[0].McalAPER = 10.000; 192 image[0].dMcal = 10.000; 191 193 return; 192 194 } … … 225 227 fprintf (stdout, "ZERO_POINT_NSTARS = %4.0f\n", N); 226 228 // fprintf (stderr, "N: %.0f, mean: %f, wt mean: %f, stdev: %f, precision: %f\n", N, M1, Mw, M2, M2 / sqrt (N)); 227 image[0].Mcal = M1; 228 image[0].dMcal = M2 / sqrt (N); 229 image[0].McalPSF = M1; 230 image[0].McalAPER = M1; 231 image[0].dMcal = M2 / sqrt (N); 229 232 image[0].nFitPhotom = N; 230 233 } else { 231 234 fprintf (stderr, "too few stars\n"); 232 image[0].Mcal = 10.000; 233 image[0].dMcal = 10.000; 235 image[0].McalPSF = 10.000; 236 image[0].McalAPER = 10.000; 237 image[0].dMcal = 10.000; 234 238 image[0].nFitPhotom = 0; 235 239 } -
trunk/Ohana/src/addstar/src/fakeimage.c
r37807 r40291 110 110 image[i+1].ccdnum = 0xff; 111 111 112 image[i+1].Mcal = 0.0; 113 image[i+1].Xm = NAN_S_SHORT; 112 image[i+1].McalPSF = 0.0; 113 image[i+1].McalAPER = 0.0; 114 image[i+1].McalChiSq = NAN; 115 image[i+1].dMcal = NAN; 114 116 image[i+1].flags = 0; 115 117 … … 165 167 image[0].secz = 1.0; 166 168 image[0].ccdnum = 0xff; 167 image[0].Mcal = 0.0; 168 image[0].Xm = NAN_S_SHORT; 169 170 image[0].McalPSF = 0.0; 171 image[0].McalAPER = 0.0; 172 image[0].McalChiSq = NAN; 173 image[0].dMcal = NAN; 169 174 image[0].flags = 0; 175 170 176 image[0].nstar = 0; 171 177 -
trunk/Ohana/src/addstar/src/find_matches.c
r38986 r40291 212 212 /* in UPDATE mode, this value is not saved; use relphot to recalculate */ 213 213 if (Nsec > -1) { 214 if (isnan(tgtcat[0].secfilt[n*Nsecfilt+Nsec].M )) {215 tgtcat[0].secfilt[n*Nsecfilt+Nsec].M = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF);214 if (isnan(tgtcat[0].secfilt[n*Nsecfilt+Nsec].MpsfChp)) { 215 tgtcat[0].secfilt[n*Nsecfilt+Nsec].MpsfChp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF); 216 216 } 217 217 } … … 305 305 /* in UPDATE mode, this value is not saved; use relphot to recalculate */ 306 306 if (Nsec > -1) { 307 tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].M = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF);307 tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].MpsfChp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF); 308 308 } 309 309 -
trunk/Ohana/src/addstar/src/find_matches_closest.c
r38986 r40291 248 248 /* in UPDATE mode, this value is not saved; use relphot to recalculate */ 249 249 if (Nsec > -1) { 250 if (isnan(tgtcat[0].secfilt[n*Nsecfilt+Nsec].M )) {251 tgtcat[0].secfilt[n*Nsecfilt+Nsec].M = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF);250 if (isnan(tgtcat[0].secfilt[n*Nsecfilt+Nsec].MpsfChp)) { 251 tgtcat[0].secfilt[n*Nsecfilt+Nsec].MpsfChp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF); 252 252 } 253 253 } … … 352 352 /* in UPDATE mode, this value is not saved; use relphot to recalculate */ 353 353 if (Nsec > -1) { 354 tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].M = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF);354 tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].MpsfChp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF); 355 355 } 356 356 -
trunk/Ohana/src/addstar/src/find_matches_gaia.c
r39926 r40291 267 267 /* in UPDATE mode, this value is not saved; use relphot to recalculate */ 268 268 if (Nsec > -1) { 269 tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].M = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF);269 tgtcat[0].secfilt[Nave*Nsecfilt+Nsec].MpsfChp = PhotCat (&tgtcat[0].measure[Nmeas], MAG_CLASS_PSF); 270 270 } 271 271 -
trunk/Ohana/src/addstar/src/find_proper.c
r15036 r40291 104 104 105 105 /** add measurements for this star **/ 106 catalog[0].measure[Nmeas].dR = 360000.0*(catalog[0].average[n].R - usno[N].R); 107 catalog[0].measure[Nmeas].dD = 360000.0*(catalog[0].average[n].D - usno[N].D); 108 catalog[0].measure[Nmeas].M = 1000.0*fabs(usno[N].r); 109 catalog[0].measure[Nmeas].Mcal= 0; /* above measurement is exact */ 110 catalog[0].measure[Nmeas].dM = 100; /* error in input files stored in thousandths of mag */ 111 catalog[0].measure[Nmeas].t = 0; /* a flag: if 0, image is not in database */ 112 catalog[0].measure[Nmeas].averef = n; 113 catalog[0].measure[Nmeas].photcode = USNO_RED; 114 catalog[0].measure[Nmeas+1].dR = catalog[0].measure[Nmeas].dR; 115 catalog[0].measure[Nmeas+1].dD = catalog[0].measure[Nmeas].dD; 116 catalog[0].measure[Nmeas+1].M = 1000.0*fabs(usno[N].b); 117 catalog[0].measure[Nmeas+1].Mcal= 0; /* above measurement is exact */ 118 catalog[0].measure[Nmeas+1].dM = 100; /* error in input files stored in thousandths of mag */ 119 catalog[0].measure[Nmeas+1].t = 0; /* a flag: if 0, image is not in database */ 120 catalog[0].measure[Nmeas+1].averef = n; 106 catalog[0].measure[Nmeas].dR = 360000.0*(catalog[0].average[n].R - usno[N].R); 107 catalog[0].measure[Nmeas].dD = 360000.0*(catalog[0].average[n].D - usno[N].D); 108 catalog[0].measure[Nmeas].M = 1000.0*fabs(usno[N].r); 109 catalog[0].measure[Nmeas].McalPSF = 0; /* above measurement is exact */ 110 catalog[0].measure[Nmeas].McalAPER = 0; /* above measurement is exact */ 111 catalog[0].measure[Nmeas].dM = 100; /* error in input files stored in thousandths of mag */ 112 catalog[0].measure[Nmeas].t = 0; /* a flag: if 0, image is not in database */ 113 catalog[0].measure[Nmeas].averef = n; 114 catalog[0].measure[Nmeas].photcode = USNO_RED; 115 catalog[0].measure[Nmeas+1].dR = catalog[0].measure[Nmeas].dR; 116 catalog[0].measure[Nmeas+1].dD = catalog[0].measure[Nmeas].dD; 117 catalog[0].measure[Nmeas+1].M = 1000.0*fabs(usno[N].b); 118 catalog[0].measure[Nmeas+1].McalPSF = 0; /* above measurement is exact */ 119 catalog[0].measure[Nmeas+1].McalAPER = 0; /* above measurement is exact */ 120 catalog[0].measure[Nmeas+1].dM = 100; /* error in input files stored in thousandths of mag */ 121 catalog[0].measure[Nmeas+1].t = 0; /* a flag: if 0, image is not in database */ 122 catalog[0].measure[Nmeas+1].averef = n; 121 123 catalog[0].measure[Nmeas+1].photcode = USNO_BLUE; 122 124 /* add flag in average to mark as matched with the USNO catalog */ -
trunk/Ohana/src/addstar/src/loadsupercos_plates.c
r37807 r40291 72 72 image[Nimage].apmifit = 0.0; 73 73 image[Nimage].dapmifit = 0.0; 74 image[Nimage].Mcal = 0.0; 75 image[Nimage].dMcal = 0.0; 76 image[Nimage].Xm = 0.0; 74 image[Nimage].McalPSF = 0.0; 75 image[Nimage].McalAPER = 0.0; 76 image[Nimage].McalChiSq = 0.0; 77 image[Nimage].dMcal = 0.0; 77 78 78 79 char photname[128]; -
trunk/Ohana/src/addstar/src/loadsupercos_rawdata.c
r39457 r40291 86 86 87 87 // XXX fix these 88 newcat->measure[i].Mcal = 0.0; 88 newcat->measure[i].McalPSF = 0.0; 89 newcat->measure[i].McalAPER = 0.0; 89 90 newcat->measure[i].dt = image[Ni].exptime; 90 91 -
trunk/Ohana/src/addstar/src/mkcmf.c
r39457 r40291 33 33 float BAD_PSFQF_FRAC = 0.0; 34 34 35 static Coords coords; 35 36 static float exptime = 1.0; 36 static Coords coords; 37 static float aper_offset = 0.0; 38 static float aper_scale = 1.0; // this is set to 10^-0.4*aper_offset below is aper_offset is non-zero 39 static float kron_scale = 1.0; // extra offset between psf and kron mags 37 40 38 41 static char reserved[] = "Reserved space. This line can be used to add a new FITS card."; … … 178 181 } 179 182 183 // aperture-like and psf-like mags may have different effective zero points. 184 // by setting this, we can check that we can apply different zero points 185 if ((N = get_argument (argc, argv, "-aper-offset"))) { 186 remove_argument (N, &argc, argv); 187 aper_offset = atof (argv[N]); 188 aper_scale = pow(10.0, -0.4*aper_offset); 189 remove_argument (N, &argc, argv); 190 } 191 if ((N = get_argument (argc, argv, "-kron-scale"))) { 192 remove_argument (N, &argc, argv); 193 kron_scale = atof (argv[N]); 194 remove_argument (N, &argc, argv); 195 } 196 180 197 // XXX note that the airmass and ra,dec,mjd can be inconsistent (for a given observatory location) 181 198 float airmass = 1.0; … … 254 271 struct timeval now; 255 272 gettimeofday (&now, NULL); 256 long A = now.tv_sec + now.tv_usec * 1000000; 273 int B = getpid(); 274 long A = now.tv_sec - now.tv_usec * 1000000 + B*100000; 257 275 srand48(A); 258 276 } … … 412 430 gfits_modify (&header, "NINPUTS", "%d", 1, 5); 413 431 432 // if we have multiple stacks using the same input image IDs, we run into trouble 433 int nFrame = 800 * drand48(); 434 414 435 int i; 415 436 for (i = 0; i < 5; i++) { 416 437 char field[64], expname[64]; 417 438 sprintf (field, "INP_%04d", i); 418 sprintf (expname, "o5745g01%02do. 356%03d.wrp.1199763.skycell.1315.090.fits", i, i);439 sprintf (expname, "o5745g01%02do.%03d%03d.wrp.1199763.skycell.1315.090.fits", i, nFrame, i); 419 440 gfits_modify (&header, field, "%s", 1, expname); 420 441 … … 791 812 stars[i].Y = Y[i]; 792 813 stars[i].M = M[i]; 793 stars[i].Map = M[i] - 0.05;814 stars[i].Map = M[i] + aper_offset - 0.05; 794 815 795 816 // randomly give poor PSFQF values … … 818 839 stars[i].flags = Flag[i]; 819 840 820 stars[i].kronFlux = flux * 1.25;821 stars[i].kronFluxErr = fSN * flux * 1.25;841 stars[i].kronFlux = flux * kron_scale * aper_scale; 842 stars[i].kronFluxErr = fSN * flux * kron_scale * aper_scale; 822 843 } 823 844 … … 852 873 stars[i].Y = Y[i]; 853 874 stars[i].M = M[i]; 854 stars[i].Map = M[i] - 0.05;855 stars[i].MapRaw = M[i] - 0.10;875 stars[i].Map = M[i] + aper_offset - 0.05; 876 stars[i].MapRaw = M[i] + aper_offset - 0.10; 856 877 857 878 stars[i].Flux = flux; … … 888 909 stars[i].flags = Flag[i]; 889 910 890 stars[i].kronFlux = flux * 1.25;891 stars[i].kronFluxErr = fSN * flux * 1.25;911 stars[i].kronFlux = flux * kron_scale * aper_scale; 912 stars[i].kronFluxErr = fSN * flux * kron_scale * aper_scale; 892 913 } 893 914 … … 933 954 stars[i].dFlux = flux * fSN; 934 955 935 stars[i].Map = M[i] - 0.05;936 stars[i].MapRaw = M[i] - 0.10;956 stars[i].Map = M[i] + aper_offset - 0.05; 957 stars[i].MapRaw = M[i] + aper_offset - 0.10; 937 958 938 959 stars[i].apRadius = 8.0; … … 983 1004 stars[i].Mrh = FX; 984 1005 985 stars[i].kronFlux = flux * 1.25;986 stars[i].kronFluxErr = fSN * flux * 1.25;987 988 stars[i].kronInner = fSN * flux * 0.9 ;989 stars[i].kronOuter = fSN * flux * 1.5 ;1006 stars[i].kronFlux = flux * kron_scale * aper_scale; 1007 stars[i].kronFluxErr = fSN * flux * kron_scale * aper_scale; 1008 1009 stars[i].kronInner = fSN * flux * 0.9 * aper_scale; 1010 stars[i].kronOuter = fSN * flux * 1.5 * aper_scale; 990 1011 991 1012 stars[i].skyLimitRad = 1; … … 1040 1061 stars[i].dFlux = flux * fSN; 1041 1062 1042 stars[i].Map = M[i] - 0.05;1043 stars[i].MapRaw = M[i] - 0.10;1063 stars[i].Map = M[i] + aper_offset - 0.05; 1064 stars[i].MapRaw = M[i] + aper_offset - 0.10; 1044 1065 1045 1066 stars[i].apRadius = 8.0; … … 1090 1111 stars[i].Mrh = FX; 1091 1112 1092 stars[i].kronFlux = flux * 1.25;1093 stars[i].kronFluxErr = fSN * flux * 1.25;1094 1095 stars[i].kronInner = fSN * flux * 0.9 ;1096 stars[i].kronOuter = fSN * flux * 1.5 ;1113 stars[i].kronFlux = flux * kron_scale * aper_scale; 1114 stars[i].kronFluxErr = fSN * flux * kron_scale * aper_scale; 1115 1116 stars[i].kronInner = fSN * flux * 0.9 * aper_scale; 1117 stars[i].kronOuter = fSN * flux * 1.5 * aper_scale; 1097 1118 1098 1119 // stars[i].skyLimitRad = 1; … … 1144 1165 stars[i].dFlux = flux * fSN; 1145 1166 1146 stars[i].Map = M[i] - 0.05;1147 stars[i].MapRaw = M[i] - 0.10;1167 stars[i].Map = M[i] + aper_offset - 0.05; 1168 stars[i].MapRaw = M[i] + aper_offset - 0.10; 1148 1169 1149 1170 stars[i].apRadius = 8.0; … … 1185 1206 stars[i].Mrh = FX; 1186 1207 1187 stars[i].kronFlux = flux * 1.25;1188 stars[i].kronFluxErr = fSN * flux * 1.25;1189 1190 stars[i].kronInner = fSN * flux * 0.9 ;1191 stars[i].kronOuter = fSN * flux * 1.5 ;1208 stars[i].kronFlux = flux * kron_scale * aper_scale; 1209 stars[i].kronFluxErr = fSN * flux * kron_scale * aper_scale; 1210 1211 stars[i].kronInner = fSN * flux * 0.9 * aper_scale; 1212 stars[i].kronOuter = fSN * flux * 1.5 * aper_scale; 1192 1213 1193 1214 stars[i].chipNum = 1; … … 1270 1291 stars[i].dFlux = flux * fSN; 1271 1292 1272 stars[i].Map = M[i] - 0.05;1273 stars[i].MapRaw = M[i] - 0.10;1293 stars[i].Map = M[i] + aper_offset - 0.05; 1294 stars[i].MapRaw = M[i] + aper_offset - 0.10; 1274 1295 1275 1296 stars[i].apRadius = 8.0; … … 1347 1368 stars[i].srcChipY = Y[i] + 10.0; 1348 1369 1349 stars[i].kronFlux = flux * 1.25;1350 stars[i].kronFluxErr = fSN * flux * 1.25;1351 1352 stars[i].kronInner = fSN * flux * 0.9 ;1353 stars[i].kronOuter = fSN * flux * 1.5 ;1370 stars[i].kronFlux = flux * kron_scale * aper_scale; 1371 stars[i].kronFluxErr = fSN * flux * kron_scale * aper_scale; 1372 1373 stars[i].kronInner = fSN * flux * 0.9 * aper_scale; 1374 stars[i].kronOuter = fSN * flux * 1.5 * aper_scale; 1354 1375 1355 1376 stars[i].skyLimitRad = 1; -
trunk/Ohana/src/checkastro/src/BrightCatalog.c
r37043 r40291 71 71 GET_COLUMN(dD, "DEC_OFF", float); 72 72 GET_COLUMN(M, "MAG_SYS", float); 73 GET_COLUMN(Mcal, "MAG_CAL", float); 73 GET_COLUMN(McalPSF, "MCAL_PSF", float); 74 GET_COLUMN(McalAPER, "MCAL_APER", float); 74 75 GET_COLUMN(dM, "MAG_ERR", float); 75 76 GET_COLUMN(airmass, "AIRMASS", float); … … 95 96 measure[i].dD = dD[i]; 96 97 measure[i].M = M[i]; 97 measure[i].Mcal = Mcal[i]; 98 measure[i].McalPSF = McalPSF[i]; 99 measure[i].McalAPER = McalAPER[i]; 98 100 measure[i].dM = dM[i]; 99 101 measure[i].airmass = airmass[i]; … … 116 118 free (dD ); 117 119 free (M ); 118 free (Mcal ); 120 free (McalPSF ); 121 free (McalAPER); 119 122 free (dM ); 120 123 free (airmass ); … … 270 273 ALLOCATE (secfilt, SecFilt, Nrow); 271 274 for (i = 0; i < Nrow; i++) { 272 secfilt[i].M = M[i];273 secfilt[i].dM = dM[i];274 secfilt[i].Mchisq = Mchisq[i];275 secfilt[i].flags = flags[i];276 secfilt[i].Ncode = Ncode[i];277 secfilt[i].Nused = Nused[i];278 secfilt[i].M_20 = M_20[i];279 secfilt[i].M_80 = M_80[i];275 secfilt[i].MpsfChp = M[i]; 276 secfilt[i].dMpsfChp = dM[i]; 277 secfilt[i].Mchisq = Mchisq[i]; 278 secfilt[i].flags = flags[i]; 279 secfilt[i].Ncode = Ncode[i]; 280 secfilt[i].Nused = Nused[i]; 281 secfilt[i].M_20 = M_20[i]; 282 secfilt[i].M_80 = M_80[i]; 280 283 } 281 284 fprintf (stderr, "loaded data for %lld averages\n", (long long) Nrow); … … 366 369 float *dD ; ALLOCATE (dD , float, catalog->Nmeasure); 367 370 float *M ; ALLOCATE (M , float, catalog->Nmeasure); 368 float *Mcal ; ALLOCATE (Mcal , float, catalog->Nmeasure); 371 float *McalPSF ; ALLOCATE (McalPSF , float, catalog->Nmeasure); 372 float *McalAPER ; ALLOCATE (McalAPER , float, catalog->Nmeasure); 369 373 float *dM ; ALLOCATE (dM , float, catalog->Nmeasure); 370 374 float *airmass ; ALLOCATE (airmass , float, catalog->Nmeasure); … … 388 392 dD[i] = measure[i].dD ; 389 393 M[i] = measure[i].M ; 390 Mcal[i] = measure[i].Mcal ; 394 McalPSF[i] = measure[i].McalPSF ; 395 McalAPER[i] = measure[i].McalAPER ; 391 396 dM[i] = measure[i].dM ; 392 397 airmass[i] = measure[i].airmass ; … … 409 414 gfits_set_bintable_column (&theader, &ftable, "DEC_OFF", dD, catalog->Nmeasure); 410 415 gfits_set_bintable_column (&theader, &ftable, "MAG_SYS", M, catalog->Nmeasure); 411 gfits_set_bintable_column (&theader, &ftable, "MAG_CAL", Mcal, catalog->Nmeasure); 416 gfits_set_bintable_column (&theader, &ftable, "MCAL_PSF", McalPSF, catalog->Nmeasure); 417 gfits_set_bintable_column (&theader, &ftable, "MCAL_APER", McalAPER, catalog->Nmeasure); 412 418 gfits_set_bintable_column (&theader, &ftable, "MAG_ERR", dM, catalog->Nmeasure); 413 419 gfits_set_bintable_column (&theader, &ftable, "AIRMASS", airmass, catalog->Nmeasure); … … 428 434 free (dD ); 429 435 free (M ); 430 free (Mcal ); 436 free (McalPSF ); 437 free (McalAPER); 431 438 free (dM ); 432 439 free (airmass ); … … 652 659 SecFilt *secfilt = catalog->secfilt; 653 660 for (i = 0; i < Nsec; i++) { 654 M [i] = secfilt[i].M ;655 dM [i] = secfilt[i].dM ;656 Mchisq[i] = secfilt[i].Mchisq ;657 flags [i] = secfilt[i].flags ;658 Ncode [i] = secfilt[i].Ncode ;659 Nused [i] = secfilt[i].Nused ;660 M_20 [i] = secfilt[i].M_20 ;661 M_80 [i] = secfilt[i].M_80 ;661 M [i] = secfilt[i].MpsfChp ; 662 dM [i] = secfilt[i].dMpsfChp; 663 Mchisq[i] = secfilt[i].Mchisq ; 664 flags [i] = secfilt[i].flags ; 665 Ncode [i] = secfilt[i].Ncode ; 666 Nused [i] = secfilt[i].Nused ; 667 M_20 [i] = secfilt[i].M_20 ; 668 M_80 [i] = secfilt[i].M_80 ; 662 669 } 663 670 -
trunk/Ohana/src/delstar/Makefile
r39692 r40291 32 32 $(SRC)/delete_duplicate_measures.$(ARCH).o \ 33 33 $(SRC)/delete_measures_by_match.$(ARCH).o \ 34 $(SRC)/delete_measures_by_detID.$(ARCH).o \ 34 35 $(SRC)/delete_fix_LAP.$(ARCH).o \ 35 36 $(SRC)/delete_fix_LAP_edges.$(ARCH).o \ … … 58 59 $(SRC)/delete_duplicate_measures.$(ARCH).o \ 59 60 $(SRC)/delete_measures_by_match.$(ARCH).o \ 61 $(SRC)/delete_measures_by_detID.$(ARCH).o \ 60 62 $(SRC)/delete_fix_LAP.$(ARCH).o \ 61 63 $(SRC)/delete_fix_LAP_edges.$(ARCH).o \ -
trunk/Ohana/src/delstar/include/delstar.h
r39926 r40291 96 96 int SKIP_IMAGES; 97 97 char *BACKUP_EXTNAME; 98 char *DELLIST_FILENAME; 98 99 99 100 time_t START; … … 105 106 106 107 int MODE; 107 enum {MODE_NONE, MODE_IMAGENAME, MODE_IMAGEFILE, MODE_TIME, MODE_ORPHAN, MODE_MISSED, MODE_PHOTCODES, MODE_DUP_IMAGES, MODE_DUP_MEASURES, MODE_DELETE_MEASURES_BY_MATCH, MODE_ FIX_LAP, MODE_FIX_LAP_STATS, MODE_FIX_LAP_EDGES, MODE_FIX_LAP_EDGES_DELETE};108 enum {MODE_NONE, MODE_IMAGENAME, MODE_IMAGEFILE, MODE_TIME, MODE_ORPHAN, MODE_MISSED, MODE_PHOTCODES, MODE_DUP_IMAGES, MODE_DUP_MEASURES, MODE_DELETE_MEASURES_BY_MATCH, MODE_DELETE_MEASURES_BY_DETID, MODE_FIX_LAP, MODE_FIX_LAP_STATS, MODE_FIX_LAP_EDGES, MODE_FIX_LAP_EDGES_DELETE}; 108 109 109 110 char DateKeyword[64], DateMode[64], UTKeyword[64], MJDKeyword[64], JDKeyword[64]; … … 230 231 int delete_fix_LAP_edges_drop_measures (Catalog *catalog, MeasureEdge *measure_edge, off_t Nmeasure_edge, int catIDcount); 231 232 int delete_fix_LAP_edges_delete_parallel (SkyList *sky); 233 234 typedef struct { 235 int catID; 236 int *objID; 237 int *detID; 238 int *imageID; 239 int NdetID; 240 } CatIDGroup; 241 242 int dvo_catalog_subset_backup (Catalog *catalog, char *suffix); 243 void isortthree (int *X, int *Y, int *Z, int N); 244 int thisCatID (int *catID, int NcatID, int index); 245 int needCatID (int *catID, int NcatID, int index); 246 int delete_measures_by_detID_catalog (Catalog *catalog, CatIDGroup *catIDgroup); 247 int delete_measures_by_detID_parallel (SkyList *sky); 248 int delete_measures_by_detID (); 249 -
trunk/Ohana/src/delstar/src/args.c
r39926 r40291 202 202 } 203 203 204 DELLIST_FILENAME = NULL; 205 if ((N = get_argument (argc, argv, "-delete-measures-by-detID"))) { 206 if (MODE != MODE_NONE) usage(); 207 MODE = MODE_DELETE_MEASURES_BY_DETID; 208 remove_argument (N, &argc, argv); 209 SKIP_IMAGES = TRUE; // we do not need to load the images for -dup-measures 210 DELLIST_FILENAME = strcreate (argv[N]); 211 remove_argument (N, &argc, argv); 212 } 213 204 214 DELETE_MIN_DET_ID = 0; 205 215 DELETE_MAX_DET_ID = 0; … … 374 384 FREE (PHOTCODE_LIST); 375 385 FREE (IMSTATS_FILE); 386 FREE (DELLIST_FILENAME); 376 387 } 377 388 … … 494 505 remove_argument (N, &argc, argv); 495 506 SKIP_IMAGES = TRUE; // we do not need to load the images for -dup-measures 507 } 508 509 DELLIST_FILENAME = NULL; 510 if ((N = get_argument (argc, argv, "-delete-measures-by-detID"))) { 511 if (MODE != MODE_NONE) usage(); 512 MODE = MODE_DELETE_MEASURES_BY_DETID; 513 remove_argument (N, &argc, argv); 514 SKIP_IMAGES = TRUE; // we do not need to load the images for -dup-measures 515 DELLIST_FILENAME = strcreate (argv[N]); 516 remove_argument (N, &argc, argv); 496 517 } 497 518 … … 603 624 FREE (MEASURE_EDGE_FILE); 604 625 FREE (IMSTATS_FILE); 626 FREE (DELLIST_FILENAME); 605 627 } 606 628 -
trunk/Ohana/src/delstar/src/delstar.c
r39692 r40291 34 34 case MODE_DELETE_MEASURES_BY_MATCH: 35 35 if (!delete_measures_by_match ()) exit (1); 36 delstar_args_free (); 37 ohana_memcheck (TRUE); 38 ohana_memdump (TRUE); 39 exit (0); 40 break; 41 case MODE_DELETE_MEASURES_BY_DETID: 42 if (!delete_measures_by_detID ()) exit (1); 36 43 delstar_args_free (); 37 44 ohana_memcheck (TRUE); -
trunk/Ohana/src/delstar/src/delstar_client.c
r39692 r40291 37 37 case MODE_DELETE_MEASURES_BY_MATCH: 38 38 if (!delete_measures_by_match ()) exit (1); 39 delstar_args_free (); 40 ohana_memcheck (TRUE); 41 ohana_memdump (TRUE); 42 exit (0); 43 break; 44 case MODE_DELETE_MEASURES_BY_DETID: 45 if (!delete_measures_by_detID ()) exit (1); 39 46 delstar_args_free (); 40 47 ohana_memcheck (TRUE); -
trunk/Ohana/src/delstar/src/gimages.c
r39457 r40291 88 88 89 89 /* secz is in units milli-airmass */ 90 image[0].Mcal = ALPHA*(image[0].secz - 1.000); 91 image[0].Xm = NAN_S_SHORT; 90 image[0].McalPSF = ALPHA*(image[0].secz - 1.000); 91 image[0].McalAPER = ALPHA*(image[0].secz - 1.000); 92 image[0].McalChiSq = NAN_S_SHORT; 92 93 93 94 free (header.buffer); -
trunk/Ohana/src/dvolens/src/update_objects_catalog.c
r39611 r40291 219 219 220 220 // relphot sets measure->Mcal (setMcalOutput.c, called by setMrelFinal.c) 221 float Mcal = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure->Mcal; 221 // XXX : I'm using McalAPER since these lens measurements are aperture-like, right? 222 float Mcal = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure->McalAPER; 222 223 float Fcal = 3630.8 * MagToFlux(Mcal); 223 224 -
trunk/Ohana/src/dvomerge/src/build_links.c
r40127 r40291 701 701 off_t *next_galphot; 702 702 703 if ( galphot) return NULL;703 if (!galphot) return NULL; 704 704 if (SKIP_GALPHOT) return NULL; 705 705 -
trunk/Ohana/src/dvomerge/src/merge_catalogs_old.c
r39926 r40291 367 367 // secfilt tables of input and output are the same 368 368 for (k = 0; k < NsecfiltIn; k++) { 369 if ( isfinite(output[0].secfilt[n*NsecfiltIn+k].M )) continue;370 if (!isfinite( input[0].secfilt[N*NsecfiltIn+k].M )) continue;369 if ( isfinite(output[0].secfilt[n*NsecfiltIn+k].MpsfChp)) continue; 370 if (!isfinite( input[0].secfilt[N*NsecfiltIn+k].MpsfChp)) continue; 371 371 output[0].secfilt[n*NsecfiltIn+k] = input[0].secfilt[N*NsecfiltIn+k]; 372 372 } … … 378 378 int outputIndex = n * NsecfiltOut + secfiltMap[k]; 379 379 380 if ( isfinite(output[0].secfilt[outputIndex].M )) continue;381 if (!isfinite( input[0].secfilt[N*NsecfiltIn+k].M )) continue;380 if ( isfinite(output[0].secfilt[outputIndex].MpsfChp)) continue; 381 if (!isfinite( input[0].secfilt[N*NsecfiltIn+k].MpsfChp)) continue; 382 382 output[0].secfilt[outputIndex] = input[0].secfilt[N*NsecfiltIn+k]; 383 383 } … … 489 489 } 490 490 491 if (isfinite(input[0].secfilt[N*NsecfiltIn+j].M )) {491 if (isfinite(input[0].secfilt[N*NsecfiltIn+j].MpsfChp)) { 492 492 output[0].secfilt[outputIndex] = input[0].secfilt[N*NsecfiltIn+j]; 493 493 } -
trunk/Ohana/src/dvopsps/include/dvopsps.h
r39112 r40291 19 19 float raErr; 20 20 float decErr; 21 float zp; 22 float zpFactor; 21 float zpPSF; 22 float zpFactorPSF; 23 float zpAPER; 24 float zpFactorAPER; 23 25 float telluricExt; 24 26 float airmass; … … 45 47 46 48 int SAVE_REMOTE; 49 int TEST_MODE; 47 50 48 51 int PARALLEL; -
trunk/Ohana/src/dvopsps/src/DetectionOps.c
r39547 r40291 56 56 GET_COLUMN(raErr , "raErr", float); 57 57 GET_COLUMN(decErr , "decErr", float); 58 GET_COLUMN(zp , "zp", float); 59 GET_COLUMN(zpFactor , "zpFactor", float); 58 GET_COLUMN(zpPSF , "zpPSF", float); 59 GET_COLUMN(zpFactorPSF , "zpFactorPSF", float); 60 GET_COLUMN(zpAPER , "zpAPER", float); 61 GET_COLUMN(zpFactorAPER, "zpFactorAPER",float); 60 62 GET_COLUMN(telluricExt , "telluricExt", float); 61 63 GET_COLUMN(airmass , "airmass", float); … … 84 86 detections[i].raErr = raErr[i]; 85 87 detections[i].decErr = decErr[i]; 86 detections[i].zp = zp[i]; 87 detections[i].zpFactor = zpFactor[i]; 88 detections[i].zpPSF = zpPSF[i]; 89 detections[i].zpFactorPSF = zpFactorPSF[i]; 90 detections[i].zpAPER = zpAPER[i]; 91 detections[i].zpFactorAPER = zpFactorAPER[i]; 88 92 detections[i].telluricExt = telluricExt[i]; 89 93 detections[i].airmass = airmass[i]; … … 110 114 free (raErr ); 111 115 free (decErr ); 112 free (zp ); 113 free (zpFactor ); 116 free (zpPSF ); 117 free (zpFactorPSF); 118 free (zpAPER ); 119 free (zpFactorAPER); 114 120 free (telluricExt); 115 121 free (airmass ); … … 180 186 gfits_define_bintable_column (&theader, "E", "raErr", NULL, NULL, 1.0, 0.0); 181 187 gfits_define_bintable_column (&theader, "E", "decErr", NULL, NULL, 1.0, 0.0); 182 gfits_define_bintable_column (&theader, "E", "zp", NULL, NULL, 1.0, 0.0); 183 gfits_define_bintable_column (&theader, "E", "zpFactor", NULL, NULL, 1.0, 0.0); 188 gfits_define_bintable_column (&theader, "E", "zpPSF", NULL, NULL, 1.0, 0.0); 189 gfits_define_bintable_column (&theader, "E", "zpFactorPSF", NULL, NULL, 1.0, 0.0); 190 gfits_define_bintable_column (&theader, "E", "zpAPER", NULL, NULL, 1.0, 0.0); 191 gfits_define_bintable_column (&theader, "E", "zpFactorAPER", NULL, NULL, 1.0, 0.0); 184 192 gfits_define_bintable_column (&theader, "E", "telluricExt", NULL, NULL, 1.0, 0.0); 185 193 gfits_define_bintable_column (&theader, "E", "airmass", NULL, NULL, 1.0, 0.0); … … 208 216 float *raErr ; ALLOCATE (raErr , float, Ndetections); 209 217 float *decErr ; ALLOCATE (decErr , float, Ndetections); 210 float *zp ; ALLOCATE (zp , float, Ndetections); 211 float *zpFactor ; ALLOCATE (zpFactor , float, Ndetections); 218 float *zpPSF ; ALLOCATE (zpPSF , float, Ndetections); 219 float *zpFactorPSF ; ALLOCATE (zpFactorPSF , float, Ndetections); 220 float *zpAPER ; ALLOCATE (zpAPER , float, Ndetections); 221 float *zpFactorAPER; ALLOCATE (zpFactorAPER, float, Ndetections); 212 222 float *telluricExt ; ALLOCATE (telluricExt , float, Ndetections); 213 223 float *airmass ; ALLOCATE (airmass , float, Ndetections); … … 234 244 raErr[i] = detections[i].raErr ; 235 245 decErr[i] = detections[i].decErr ; 236 zp[i] = detections[i].zp ; 237 zpFactor[i] = detections[i].zpFactor ; 246 zpPSF[i] = detections[i].zpPSF ; 247 zpFactorPSF[i] = detections[i].zpFactorPSF ; 248 zpAPER[i] = detections[i].zpAPER ; 249 zpFactorAPER[i]= detections[i].zpFactorAPER; 238 250 telluricExt[i] = detections[i].telluricExt ; 239 251 airmass[i] = detections[i].airmass ; … … 260 272 gfits_set_bintable_column (&theader, &ftable, "raErr", raErr , Ndetections); 261 273 gfits_set_bintable_column (&theader, &ftable, "decErr", decErr , Ndetections); 262 gfits_set_bintable_column (&theader, &ftable, "zp", zp , Ndetections); 263 gfits_set_bintable_column (&theader, &ftable, "zpFactor", zpFactor , Ndetections); 274 gfits_set_bintable_column (&theader, &ftable, "zpPSF", zpPSF , Ndetections); 275 gfits_set_bintable_column (&theader, &ftable, "zpFactorPSF", zpFactorPSF , Ndetections); 276 gfits_set_bintable_column (&theader, &ftable, "zpAPER", zpAPER , Ndetections); 277 gfits_set_bintable_column (&theader, &ftable, "zpFactorAPER",zpFactorAPER, Ndetections); 264 278 gfits_set_bintable_column (&theader, &ftable, "telluricExt", telluricExt , Ndetections); 265 279 gfits_set_bintable_column (&theader, &ftable, "airmass", airmass , Ndetections); … … 284 298 free (raErr ); 285 299 free (decErr ); 286 free (zp ); 287 free (zpFactor ); 300 free (zpPSF ); 301 free (zpFactorPSF ); 302 free (zpAPER ); 303 free (zpFactorAPER); 288 304 free (telluricExt ); 289 305 free (airmass ); -
trunk/Ohana/src/dvopsps/src/initialize_dvopsps.c
r38674 r40291 123 123 if ((N = get_argument (argc, argv, "-insert-remote"))) { 124 124 SAVE_REMOTE = FALSE; 125 remove_argument (N, &argc, argv); 126 } 127 128 TEST_MODE = FALSE; 129 if ((N = get_argument (argc, argv, "-test-mode"))) { 130 TEST_MODE = TRUE; 125 131 remove_argument (N, &argc, argv); 126 132 } … … 361 367 } 362 368 369 TEST_MODE = FALSE; 370 if ((N = get_argument (argc, argv, "-test-mode"))) { 371 TEST_MODE = TRUE; 372 remove_argument (N, &argc, argv); 373 } 374 363 375 HOST_ID = 0; 364 376 if ((N = get_argument (argc, argv, "-hostID"))) { -
trunk/Ohana/src/dvopsps/src/insert_FWobjects_dvopsps.c
r38471 r40291 136 136 snprintf (tmpline, 1024, "%s -dbname %s", command, DATABASE_NAME); strcpy (command, tmpline); 137 137 138 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 139 if (SINGLE_CPT) { snprintf (tmpline, 1024, "%s -cpt %s", command, SINGLE_CPT); strcpy (command, tmpline); } 138 if (VERBOSE) { snprintf (tmpline, 1024, "%s -v", command); strcpy (command, tmpline); } 139 if (TEST_MODE) { snprintf (tmpline, 1024, "%s -test-mode", command); strcpy (command, tmpline); } 140 if (SINGLE_CPT) { snprintf (tmpline, 1024, "%s -cpt %s", command, SINGLE_CPT); strcpy (command, tmpline); } 140 141 141 142 fprintf (stderr, "command: %s\n", command); -
trunk/Ohana/src/dvopsps/src/insert_FWobjects_dvopsps_catalog.c
r39593 r40291 43 43 } 44 44 45 int hasPS1 = FALSE; 46 for (int j = 0; !hasPS1 && (j < Nsecfilt); j++) { 47 if (secfilt[i*Nsecfilt + j].flags & hasPS1_flag) hasPS1 = TRUE; 48 } 49 if (!hasPS1) continue; // skip non-PS1 data 45 if (!TEST_MODE) { 46 int hasPS1 = FALSE; 47 for (int j = 0; !hasPS1 && (j < Nsecfilt); j++) { 48 if (secfilt[i*Nsecfilt + j].flags & hasPS1_flag) hasPS1 = TRUE; 49 } 50 if (!hasPS1) continue; // skip non-PS1 data 51 } 50 52 51 53 off_t m = average[i].lensobjOffset; -
trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c
r39645 r40291 183 183 184 184 PrintIOBuffer (buffer, "INSERT INTO dvoDetectionFull (objID, detectID, ippObjID, ippDetectID, imageID, catID, "); 185 PrintIOBuffer (buffer, "ra, dec_, raErr, decErr, zp , zpFactor, telluricExt, airmass, expTime, ");185 PrintIOBuffer (buffer, "ra, dec_, raErr, decErr, zpPSF, zpFactorPSF, zpAPER, zpFactorAPER, telluricExt, airmass, expTime, "); 186 186 PrintIOBuffer (buffer, "Mpsf, dMpsf, Mkron, dMkron, Map, dMap, flags, objflags) VALUES \n"); 187 187 … … 254 254 PRINT_FLOAT(buffer, detection->raErr, "%.6f, "); 255 255 PRINT_FLOAT(buffer, detection->decErr, "%.6f, "); 256 PRINT_FLOAT(buffer, detection->zp, "%.6f, "); 257 PRINT_FLOAT(buffer, detection->zpFactor, "%.6e, "); 256 PRINT_FLOAT(buffer, detection->zpPSF, "%.6f, "); 257 PRINT_FLOAT(buffer, detection->zpFactorPSF, "%.6e, "); 258 PRINT_FLOAT(buffer, detection->zpAPER, "%.6f, "); 259 PRINT_FLOAT(buffer, detection->zpFactorAPER,"%.6e, "); 258 260 PRINT_FLOAT(buffer, detection->telluricExt, "%.6f, "); 259 261 PRINT_FLOAT(buffer, detection->airmass, "%.6f, "); … … 305 307 int assign_detection_values (Detections *detection, Measure *measure, Average *average) { 306 308 309 // myAbort ("check on measure->McalPSF vs McalAPER"); 310 307 311 PhotCode *code = GetPhotcodebyCode(measure->photcode); 308 312 … … 311 315 float Mflat = isfinite(measure->Mflat) ? measure->Mflat : 0.0; 312 316 float nominalZP = code->C * 0.001 + code->K * (measure->airmass - 1); 313 float zp = nominalZP - measure->Mcal - Mflat; 314 float zpFactor = pow(10.0, -0.4*zp + 3.56); 315 float telluricExt = - measure->Mcal; 317 float zpPSF = nominalZP - measure->McalPSF - Mflat; 318 float zpFactorPSF = pow(10.0, -0.4*zpPSF + 3.56); 319 float zpAPER = nominalZP - measure->McalAPER - Mflat; 320 float zpFactorAPER= pow(10.0, -0.4*zpAPER + 3.56); 321 float telluricExt = - measure->McalPSF; 316 322 float expTime = pow(10.0, 0.4 * measure->dt); 317 323 float airmass = measure->airmass; … … 329 335 detection->decErr = measure->dYccd * 0.01 * fabs(measure->pltscale); // estimate of decErr 330 336 331 detection->zp = zp; 332 detection->zpFactor = zpFactor; 337 detection->zpPSF = zpPSF; 338 detection->zpFactorPSF = zpFactorPSF; 339 detection->zpAPER = zpAPER; 340 detection->zpFactorAPER = zpFactorAPER; 333 341 detection->telluricExt = telluricExt; 334 342 detection->airmass = airmass; … … 337 345 // XXX clean this up with dvo_photcode_ops calls: 338 346 // if (isfinite(measure->FluxPSF) && (measure->FluxPSF < 0.0)) 339 detection->Mpsf = getMagFromValueOrFlux (measure->FluxPSF, measure->M, zp );340 detection->Mkron = getMagFromValueOrFlux (measure->FluxKron, measure->Mkron, zp );341 detection->Map = getMagFromValueOrFlux (measure->FluxAp, measure->Map, zp );347 detection->Mpsf = getMagFromValueOrFlux (measure->FluxPSF, measure->M, zpPSF); 348 detection->Mkron = getMagFromValueOrFlux (measure->FluxKron, measure->Mkron, zpAPER); 349 detection->Map = getMagFromValueOrFlux (measure->FluxAp, measure->Map, zpAPER); 342 350 343 351 detection->dMpsf = getdMagFromValueOrFlux (measure->FluxPSF, measure->dFluxPSF, measure->dM); -
trunk/Ohana/src/dvopsps/src/insert_objects_dvopsps_catalog.c
r39650 r40291 1 1 # include "dvopsps.h" 2 2 # define DEBUG 0 3 4 int Format_PSX_Name (char *buffer, int Nbuffer, double tmp_ra, double tmp_dec); 3 5 4 6 int insert_objects_dvopsps_catalog (Catalog *catalog, char *basename, MYSQL *mysql) { … … 110 112 "RA_ERR FLOAT, " 111 113 "DEC_ERR FLOAT, " 112 "IAU_NAME VARCHAR(32), "113 114 "PSO_NAME VARCHAR(32), " 115 "PSX_NAME VARCHAR(32), " 114 116 "CHISQ_POS FLOAT, " 115 117 "CHISQ_PM FLOAT, " … … 219 221 "RA_ERR, " 220 222 "DEC_ERR, " 221 "IAU_NAME, "222 223 "PSO_NAME, " 224 "PSX_NAME, " 223 225 "CHISQ_POS, " 224 226 "CHISQ_PM, " … … 267 269 double Tmean = average->Tmean == 0 ? NAN : ohana_sec_to_mjd (average->Tmean); 268 270 269 // XXX this bit could/should be autocoded... 271 char coord_buffer[128]; 272 273 // XXX this bit could/should be autocoded... 270 274 PrintIOBuffer (ave_buffer, " ("); 271 275 PrintIOBuffer (ave_buffer, OFF_T_FMT", ", average->extID); … … 288 292 PRINT_FLOAT(ave_buffer, average->dD, "%.5f, "); // 0.010 mas precision 289 293 290 // Add names. 291 int ra_hr,ra_min,ra_sec,ra_fracsec; 292 int dec_deg,dec_min,dec_sec,dec_fracsec; 293 double tmp_ra,tmp_dec; 294 295 if ((secfilt->NstackDet != 0)&&(isfinite(average->Rstk))&&(isfinite(average->Dstk))) { 296 tmp_ra = average->Rstk; 297 tmp_dec = average->Dstk; 298 } 299 else { 300 tmp_ra = average->R; 301 tmp_dec = average->D; 302 } 303 304 double dec_sign = (tmp_dec == 0.0) ? 0.0 : tmp_dec / fabs(tmp_dec); 305 tmp_dec = fabs(tmp_dec); 306 307 308 tmp_ra /= 15.0; 309 ra_hr = (int) floor(tmp_ra); 310 311 tmp_ra -= ra_hr; 312 tmp_ra *= 60.0; 313 ra_min = (int) floor(tmp_ra); 314 315 tmp_ra -= ra_min; 316 tmp_ra *= 60.0; 317 ra_sec = (int) floor(tmp_ra); 318 319 tmp_ra -= ra_sec; 320 tmp_ra *= 1000.0; 321 ra_fracsec = (int) floor(tmp_ra); 322 323 dec_deg = (int) floor(tmp_dec); 324 325 tmp_dec -= dec_deg; 326 tmp_dec *= 60.0; 327 dec_min = (int) floor(tmp_dec); 328 329 tmp_dec -= dec_min; 330 tmp_dec *= 60.0; 331 dec_sec = (int) floor(tmp_dec); 332 333 tmp_dec -= dec_sec; 334 tmp_dec *= 1000.0; 335 dec_fracsec = (int) floor(tmp_dec); 336 337 dec_deg *= (int) dec_sign; 338 339 // IAU NAME 340 PrintIOBuffer(ave_buffer, "'PSO J%02d%02d%02d.%03d%+03d%02d%02d.%03d', ", 341 ra_hr,ra_min,ra_sec,ra_fracsec, 342 dec_deg,dec_min,dec_sec,dec_fracsec); 343 344 // PSO NAME 345 if ((secfilt->NstackDet != 0)&&(isfinite(average->Rstk))&&(isfinite(average->Dstk))) { 346 tmp_ra = average->Rstk; 347 tmp_dec = average->Dstk; 348 } 349 else { 350 tmp_ra = average->R; 351 tmp_dec = average->D; 352 } 353 354 PrintIOBuffer(ave_buffer, "'PSO J%09.5f%+09.5f', ", 355 tmp_ra,tmp_dec); 294 int useStack = (!isfinite(average->R) || !isfinite(average->D)) && (secfilt->NstackDet != 0) && isfinite(average->Rstk) && isfinite(average->Dstk); 295 296 double tmp_ra = useStack ? average->Rstk : average->R; 297 double tmp_dec = useStack ? average->Dstk : average->D; 298 299 // PSO NAME (IAU approved) 300 PrintIOBuffer(ave_buffer, "'PSO J%08.4f%+08.4f', ", tmp_ra, tmp_dec); 301 302 // PSX NAME 303 Format_PSX_Name (coord_buffer, 128, tmp_ra, tmp_dec); 304 PrintIOBuffer(ave_buffer, "'%s', ", coord_buffer); 356 305 357 306 // End names … … 372 321 float meanPSFMagMin = NAN; 373 322 float meanPSFMagMax = NAN; 374 if (isfinite(secfilt->dM ) && isfinite(secfilt->M)) {375 meanPSFMag = secfilt->M ;376 meanPSFMagErr = secfilt->dM ;377 meanPSFMagStd = secfilt-> Mstdev;323 if (isfinite(secfilt->dMpsfChp) && isfinite(secfilt->MpsfChp)) { 324 meanPSFMag = secfilt->MpsfChp; 325 meanPSFMagErr = secfilt->dMpsfChp; 326 meanPSFMagStd = secfilt->sMpsfChp; 378 327 meanPSFMagMin = secfilt->Mmin; 379 328 meanPSFMagMax = secfilt->Mmax; … … 383 332 float meanKronMagErr = NAN; 384 333 float meanKronMagStd = NAN; 385 if (isfinite(secfilt->dMkron ) && isfinite(secfilt->Mkron) && (secfilt->dMkron< 0.333)) {386 meanKronMag = secfilt->Mkron ;387 meanKronMagErr = secfilt->dMkron ;388 meanKronMagStd = secfilt->sMkron ;334 if (isfinite(secfilt->dMkronChp) && isfinite(secfilt->MkronChp) && (secfilt->dMkronChp < 0.333)) { 335 meanKronMag = secfilt->MkronChp; 336 meanKronMagErr = secfilt->dMkronChp; 337 meanKronMagStd = secfilt->sMkronChp; 389 338 } 390 339 … … 392 341 float meanApMagErr = NAN; 393 342 float meanApMagStd = NAN; 394 if (isfinite(secfilt->dMap ) && isfinite(secfilt->Map)) {395 meanApMag = secfilt->Map ;396 meanApMagErr = secfilt->dMap ;397 meanApMagStd = secfilt->sMap ;343 if (isfinite(secfilt->dMapChp) && isfinite(secfilt->MapChp)) { 344 meanApMag = secfilt->MapChp; 345 meanApMagErr = secfilt->dMapChp; 346 meanApMagStd = secfilt->sMapChp; 398 347 } 399 348 … … 524 473 return TRUE; 525 474 } 475 476 // XXX if the coords have NAN values (not sure why that would happen), return FALSE? 477 int Format_PSX_Name (char *buffer, int Nbuffer, double tmp_ra, double tmp_dec) { 478 479 // Add names. 480 int ra_hr, ra_min, dec_deg, dec_min; 481 float ra_sec, dec_sec; 482 483 // convert to hours: 484 tmp_ra /= 15.0; 485 ra_hr = (int) floor(tmp_ra); 486 487 tmp_ra -= ra_hr; 488 tmp_ra *= 60.0; 489 ra_min = (int) floor(tmp_ra); 490 491 tmp_ra -= ra_min; 492 tmp_ra *= 60.0; 493 ra_sec = trunc(100.0*tmp_ra) / 100.0; // ensure truncation for XX.XX 494 495 char dec_sign = (tmp_dec >= 0.0) ? '+' : '-'; 496 tmp_dec = fabs(tmp_dec); 497 498 dec_deg = (int) floor(tmp_dec); 499 500 tmp_dec -= dec_deg; 501 tmp_dec *= 60.0; 502 dec_min = (int) floor(tmp_dec); 503 504 tmp_dec -= dec_min; 505 tmp_dec *= 60.0; 506 dec_sec = trunc(10.0*tmp_dec) / 10.0; // ensure truncation for XX.X 507 508 // PSX NAME 509 snprintf (buffer, Nbuffer, "PSX J%02d%02d%05.2f%c%02d%02d%04.1f", ra_hr, ra_min, ra_sec, dec_sign, dec_deg, dec_min, dec_sec); 510 511 return TRUE; 512 } -
trunk/Ohana/src/fakeastro/src/insert_fakestar.c
r38469 r40291 93 93 94 94 // I need a photcode for r-band 95 catalog[0].secfilt[Nave*Nsecfilt+0].M = m_g;96 catalog[0].secfilt[Nave*Nsecfilt+1].M = m_r;97 catalog[0].secfilt[Nave*Nsecfilt+2].M = m_i;98 catalog[0].secfilt[Nave*Nsecfilt+3].M = m_z;99 catalog[0].secfilt[Nave*Nsecfilt+4].M = m_y;95 catalog[0].secfilt[Nave*Nsecfilt+0].MpsfChp = m_g; 96 catalog[0].secfilt[Nave*Nsecfilt+1].MpsfChp = m_r; 97 catalog[0].secfilt[Nave*Nsecfilt+2].MpsfChp = m_i; 98 catalog[0].secfilt[Nave*Nsecfilt+3].MpsfChp = m_z; 99 catalog[0].secfilt[Nave*Nsecfilt+4].MpsfChp = m_y; 100 100 101 101 catalog[0].starpar[Nstarpar] = stars[i].starpar; -
trunk/Ohana/src/fakeastro/src/load_template_images.c
r38441 r40291 61 61 62 62 refimage[Nrefimage].secz = childImage->secz; 63 refimage[Nrefimage].Mcal = childImage->Mcal; 63 refimage[Nrefimage].McalPSF = childImage->McalPSF; 64 refimage[Nrefimage].McalAPER = childImage->McalAPER; 64 65 refimage[Nrefimage].dMcal = childImage->dMcal; 65 66 refimage[Nrefimage].exptime = childImage->exptime; -
trunk/Ohana/src/fakeastro/src/make_2mass_measures.c
r39248 r40291 44 44 45 45 // make a crude JHK color for now: 46 double J_PS1 = secfilt[i*Nsecfilt + Nsec].M - 1.0; // make all stars have y-J = 1.046 double J_PS1 = secfilt[i*Nsecfilt + Nsec].MpsfChp - 1.0; // make all stars have y-J = 1.0 47 47 if (J_PS1 > MAX_MAG_2MASS) continue; // only generate 2MASS detections for objects with J_PS1 < 16.0 48 48 49 if (isnan(secfilt[i*Nsecfilt + Nsec].M )) {49 if (isnan(secfilt[i*Nsecfilt + Nsec].MpsfChp)) { 50 50 // look for a non-NAN secfilt mag and just use that (it is not super important) 51 51 int ns; 52 52 for (ns = 0; ns < Nsecfilt; ns++) { 53 if (!isnan(secfilt[i*Nsecfilt + ns].M )) break;53 if (!isnan(secfilt[i*Nsecfilt + ns].MpsfChp)) break; 54 54 } 55 55 if (ns == Nsecfilt) continue; // no non-nan 56 56 57 J_PS1 = secfilt[i*Nsecfilt + ns].M ; // pretend secfilt.M= J57 J_PS1 = secfilt[i*Nsecfilt + ns].MpsfChp; // pretend secfilt.MpsfChp = J 58 58 if (J_PS1 > MAX_MAG_2MASS) continue; // only generate 2MASS detections for objects with J_PS1 < 16.0 59 59 } … … 103 103 measure[Nmeasure].airmass = 1.0; 104 104 measure[Nmeasure].az = 0.0; // irrelevant 105 measure[Nmeasure].Mcal = 0.0; 105 measure[Nmeasure].McalPSF = 0.0; 106 measure[Nmeasure].McalAPER= 0.0; 106 107 measure[Nmeasure].t = tzero_2mass; 107 108 measure[Nmeasure].dt = 0.0; -
trunk/Ohana/src/fakeastro/src/make_fake_stars_catalog.c
r39926 r40291 42 42 43 43 // XXX put in airmass? 44 float ZP = SCALE*code->C - image->Mcal + Mtime;45 float ZPo = 25.0 - image->Mcal + Mtime;44 float ZP = SCALE*code->C - image->McalPSF + Mtime; 45 float ZPo = 25.0 - image->McalPSF + Mtime; 46 46 // float ZP = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure[0].Mcal; 47 47 … … 79 79 // float Minst = Msky - SCALE*code->C - measure[0].dt 80 80 81 double Minst = secfilt[i*Nsecfilt + Nsec].M - ZP;81 double Minst = secfilt[i*Nsecfilt + Nsec].MpsfChp - ZP; 82 82 double Counts = pow(10.0, -0.4*Minst); 83 83 double SkyCts = sky[Nsec]; … … 175 175 176 176 stars[Nstars].measure.az = azimuth (15.0*image->sidtime - stars[Nstars].average.R, stars[Nstars].average.D, image->latitude); 177 stars[Nstars].measure.Mcal = image->Mcal; 177 stars[Nstars].measure.McalPSF = image->McalPSF; 178 stars[Nstars].measure.McalAPER= image->McalAPER; 178 179 stars[Nstars].measure.t = image->tzero + 1e-4*stars[Nstars].measure.Yccd*image->trate; // trate is in 0.1 msec / row 179 180 stars[Nstars].measure.dt = Mtime; -
trunk/Ohana/src/fakeastro/src/make_gaia_measures.c
r39926 r40291 42 42 43 43 // make a crude G-i color for now: 44 double G_PS1 = secfilt[i*Nsecfilt + Nsec].M ; // make all stars have G-i = 1.044 double G_PS1 = secfilt[i*Nsecfilt + Nsec].MpsfChp; // make all stars have G-i = 1.0 45 45 if (G_PS1 > MAX_MAG_GAIA) continue; // only generate GAIA detections for objects with G_PS1 < 21.0 46 46 47 if (isnan(secfilt[i*Nsecfilt + Nsec].M )) {47 if (isnan(secfilt[i*Nsecfilt + Nsec].MpsfChp)) { 48 48 // look for a non-NAN secfilt mag and just use that (it is not super important) 49 49 int ns; 50 50 for (ns = 0; ns < Nsecfilt; ns++) { 51 if (!isnan(secfilt[i*Nsecfilt + ns].M )) break;51 if (!isnan(secfilt[i*Nsecfilt + ns].MpsfChp)) break; 52 52 } 53 53 if (ns == Nsecfilt) continue; // no non-nan 54 54 55 G_PS1 = secfilt[i*Nsecfilt + ns].M ; // pretend secfilt.M = G55 G_PS1 = secfilt[i*Nsecfilt + ns].MpsfChp; // pretend secfilt.M = G 56 56 if (G_PS1 > MAX_MAG_GAIA) continue; // only generate GAIA detections for objects with G_PS1 < 21.0 57 57 } … … 104 104 measure[Nmeasure].airmass = 1.0; 105 105 measure[Nmeasure].az = 0.0; // irrelevant 106 measure[Nmeasure].Mcal = 0.0; 106 measure[Nmeasure].McalPSF = 0.0; 107 measure[Nmeasure].McalAPER= 0.0; 107 108 measure[Nmeasure].t = tzero_gaia; 108 109 measure[Nmeasure].dt = 0.0; -
trunk/Ohana/src/getstar/src/ReadImageHeader.c
r39998 r40291 127 127 128 128 /* secz is in units milli-airmass */ 129 image[0].Mcal = 0.0; 130 image[0].Xm = NAN_S_SHORT; 129 image[0].McalPSF = 0.0; 130 image[0].McalAPER = 0.0; 131 image[0].McalChiSq = NAN; 131 132 image[0].flags = 0; 132 133 -
trunk/Ohana/src/getstar/src/select_by_region.c
r38441 r40291 78 78 } 79 79 } else { 80 mag = catalog[0].secfilt[i*Nsecfilt + Nsec].M ;80 mag = catalog[0].secfilt[i*Nsecfilt + Nsec].MpsfChp; 81 81 } 82 82 if (isnan(mag)) continue; … … 131 131 } 132 132 } else { 133 mag = catalog[0].secfilt[i*Nsecfilt + Nsec].M ;133 mag = catalog[0].secfilt[i*Nsecfilt + Nsec].MpsfChp; 134 134 } 135 135 if (isnan(mag) || (mag > MagLimitValue)) continue; -
trunk/Ohana/src/getstar/src/write_getstar_ps1_dev_0.c
r38441 r40291 55 55 // find primary magnitude 56 56 if (Nsec_c0 != -1) { 57 output[i].mag = secfilt[i*Nsecfilt + Nsec_c0].M ;57 output[i].mag = secfilt[i*Nsecfilt + Nsec_c0].MpsfChp; 58 58 } else { 59 59 output[i].mag = NAN; … … 69 69 // find color term 1 70 70 if (Nsec_c1 != -1) { 71 output[i].c1 = secfilt[i*Nsecfilt + Nsec_c1].M ;71 output[i].c1 = secfilt[i*Nsecfilt + Nsec_c1].MpsfChp; 72 72 } else { 73 73 output[i].c1 = NAN; … … 83 83 // find color term 2 84 84 if (Nsec_c2 != -1) { 85 output[i].c2 = secfilt[i*Nsecfilt + Nsec_c2].M ;85 output[i].c2 = secfilt[i*Nsecfilt + Nsec_c2].MpsfChp; 86 86 } else { 87 87 output[i].c2 = NAN; -
trunk/Ohana/src/getstar/src/write_getstar_ps1_dev_1.c
r38441 r40291 58 58 // find primary magnitude 59 59 if (Nsec_c0 != -1) { 60 output[i].mag = secfilt[i*Nsecfilt + Nsec_c0].M ;60 output[i].mag = secfilt[i*Nsecfilt + Nsec_c0].MpsfChp; 61 61 } else { 62 62 output[i].mag = NAN; … … 72 72 // find color term 1 73 73 if (Nsec_c1 != -1) { 74 output[i].c1 = secfilt[i*Nsecfilt + Nsec_c1].M ;74 output[i].c1 = secfilt[i*Nsecfilt + Nsec_c1].MpsfChp; 75 75 } else { 76 76 output[i].c1 = NAN; … … 86 86 // find color term 2 87 87 if (Nsec_c2 != -1) { 88 output[i].c2 = secfilt[i*Nsecfilt + Nsec_c2].M ;88 output[i].c2 = secfilt[i*Nsecfilt + Nsec_c2].MpsfChp; 89 89 } else { 90 90 output[i].c2 = NAN; -
trunk/Ohana/src/getstar/src/write_getstar_ps1_dev_2.c
r38441 r40291 64 64 // find primary magnitude 65 65 if (Nsec_c0 != -1) { 66 output[i].mag = secfilt[i*Nsecfilt + Nsec_c0].M ;66 output[i].mag = secfilt[i*Nsecfilt + Nsec_c0].MpsfChp; 67 67 } else { 68 68 output[i].mag = NAN; … … 78 78 // find color term 1 79 79 if (Nsec_c1 != -1) { 80 output[i].c1 = secfilt[i*Nsecfilt + Nsec_c1].M ;80 output[i].c1 = secfilt[i*Nsecfilt + Nsec_c1].MpsfChp; 81 81 } else { 82 82 output[i].c1 = NAN; … … 92 92 // find color term 2 93 93 if (Nsec_c2 != -1) { 94 output[i].c2 = secfilt[i*Nsecfilt + Nsec_c2].M ;94 output[i].c2 = secfilt[i*Nsecfilt + Nsec_c2].MpsfChp; 95 95 } else { 96 96 output[i].c2 = NAN; -
trunk/Ohana/src/imregister/imphot/dumpfits.c
r38441 r40291 114 114 startstr = ohana_sec_to_date (subset[0].tzero); 115 115 filtstr = GetPhotcodeNamebyCode (subset[0].photcode); 116 zp = subset[0].Mcal ;116 zp = subset[0].McalPSF; 117 117 dzp = subset[0].dMcal; 118 118 XY_to_RD (&ra, &dec, 0.0, 0.0, &subset[0].coords); -
trunk/Ohana/src/imregister/imphot/output.c
r34088 r40291 37 37 38 38 fprintf (stdout, "%s %s %s %7.4f %7.4f %7.4f %5d %02x\n", image[i].name, photstr, timestr, 39 image[i].Mcal , image[i].dMcal, image[i].secz, image[i].nstar, image[i].flags);39 image[i].McalPSF, image[i].dMcal, image[i].secz, image[i].nstar, image[i].flags); 40 40 free (timestr); 41 41 } -
trunk/Ohana/src/kapa2/src/DrawObjects.c
r40165 r40291 97 97 switch (object[0].style) { 98 98 case KAPA_PLOT_CONNECT: 99 // fprintf (stderr, "plot KAPA_PLOT_CONNECT: \n"); 99 100 DrawConnect (graphic, graph, object); 100 101 break; 101 102 case KAPA_PLOT_HISTOGRAM: 103 // fprintf (stderr, "plot KAPA_PLOT_HISTOGRAM:\n"); 102 104 DrawHistogram (graphic, graph, object); 103 105 break; 104 106 case KAPA_PLOT_BARS_SOLID: 107 // fprintf (stderr, "plot KAPA_PLOT_BARS_SOLID:\n"); 105 108 DrawBars (graphic, graph, object, KAPA_PLOT_BARS_SOLID); 106 109 break; 107 110 case KAPA_PLOT_BARS_OUTLINE: 111 // fprintf (stderr, "plot KAPA_PLOT_BARS_OUTLINE:\n"); 108 112 DrawBars (graphic, graph, object, KAPA_PLOT_BARS_OUTLINE); 109 113 break; 110 114 case KAPA_PLOT_BARS_OUTFILL: 115 // fprintf (stderr, "plot KAPA_PLOT_BARS_OUTFILL:\n"); 111 116 DrawBars (graphic, graph, object, KAPA_PLOT_BARS_OUTFILL); 112 117 break; 113 118 case KAPA_PLOT_POINTS: 114 119 default: 120 // fprintf (stderr, "plot KAPA_PLOT_POINTS:\n"); 115 121 DrawPoints (graphic, graph, object); 116 122 break; -
trunk/Ohana/src/libautocode/Makefile.Targets
r40062 r40291 14 14 $(ASRC)/average-ps1-v4.$(ARCH).o \ 15 15 $(ASRC)/average-ps1-v5.$(ARCH).o \ 16 $(ASRC)/average-ps1-v6.$(ARCH).o \ 16 17 $(ASRC)/average-ps1-v5-ld.$(ARCH).o \ 17 18 $(ASRC)/average-ps1-sim.$(ARCH).o \ … … 29 30 $(ASRC)/secfilt-ps1-v4.$(ARCH).o \ 30 31 $(ASRC)/secfilt-ps1-v5.$(ARCH).o \ 32 $(ASRC)/secfilt-ps1-v6.$(ARCH).o \ 31 33 $(ASRC)/secfilt-ps1-v5-ld.$(ARCH).o \ 32 34 $(ASRC)/secfilt-ps1-sim.$(ARCH).o \ … … 44 46 $(ASRC)/measure-ps1-v4.$(ARCH).o \ 45 47 $(ASRC)/measure-ps1-v5.$(ARCH).o \ 48 $(ASRC)/measure-ps1-v6.$(ARCH).o \ 46 49 $(ASRC)/measure-ps1-v5-ld.$(ARCH).o \ 47 50 $(ASRC)/measure-ps1-sim.$(ARCH).o \ … … 53 56 $(ASRC)/lensing-ps1-v5-r3.$(ARCH).o \ 54 57 $(ASRC)/lensing-ps1-v5-ld.$(ARCH).o \ 58 $(ASRC)/lensing-ps1-v6.$(ARCH).o \ 55 59 $(ASRC)/lensobj.$(ARCH).o \ 56 60 $(ASRC)/lensobj-ps1-v5-r0.$(ARCH).o \ 57 61 $(ASRC)/lensobj-ps1-v5-r1.$(ARCH).o \ 58 62 $(ASRC)/lensobj-ps1-v5-ld.$(ARCH).o \ 63 $(ASRC)/lensobj-ps1-v6.$(ARCH).o \ 59 64 $(ASRC)/starpar.$(ARCH).o \ 60 65 $(ASRC)/starpar-ps1-v5.$(ARCH).o \ 66 $(ASRC)/starpar-ps1-v6.$(ARCH).o \ 61 67 $(ASRC)/starpar-ps1-v5-ld.$(ARCH).o \ 62 68 $(ASRC)/starpar-ps1-sim.$(ARCH).o \ … … 65 71 $(ASRC)/galphot-ps1-v5-r1.$(ARCH).o \ 66 72 $(ASRC)/galphot-ps1-v5-ld.$(ARCH).o \ 73 $(ASRC)/galphot-ps1-v6.$(ARCH).o \ 67 74 $(ASRC)/missing.$(ARCH).o \ 68 75 $(ASRC)/photcode.$(ARCH).o \ … … 76 83 $(ASRC)/photcode-ps1-v4.$(ARCH).o \ 77 84 $(ASRC)/photcode-ps1-v5.$(ARCH).o \ 85 $(ASRC)/photcode-ps1-v6.$(ARCH).o \ 78 86 $(ASRC)/photcode-ps1-v5-ld.$(ARCH).o \ 79 87 $(ASRC)/photcode-ps1-ref.$(ARCH).o \ … … 90 98 $(ASRC)/image-ps1-v4.$(ARCH).o \ 91 99 $(ASRC)/image-ps1-v5.$(ARCH).o \ 100 $(ASRC)/image-ps1-v6.$(ARCH).o \ 92 101 $(ASRC)/image-ps1-v5-ld.$(ARCH).o \ 93 102 $(ASRC)/image-ps1-sim.$(ARCH).o \ … … 136 145 $(AINC)/average-ps1-v4.h \ 137 146 $(AINC)/average-ps1-v5.h \ 147 $(AINC)/average-ps1-v6.h \ 138 148 $(AINC)/average-ps1-v5-ld.h \ 139 149 $(AINC)/average-ps1-sim.h \ … … 151 161 $(AINC)/secfilt-ps1-v4.h \ 152 162 $(AINC)/secfilt-ps1-v5.h \ 163 $(AINC)/secfilt-ps1-v6.h \ 153 164 $(AINC)/secfilt-ps1-v5-ld.h \ 154 165 $(AINC)/secfilt-ps1-sim.h \ … … 166 177 $(AINC)/measure-ps1-v4.h \ 167 178 $(AINC)/measure-ps1-v5.h \ 179 $(AINC)/measure-ps1-v6.h \ 168 180 $(AINC)/measure-ps1-v5-ld.h \ 169 181 $(AINC)/measure-ps1-sim.h \ … … 175 187 $(AINC)/lensing-ps1-v5-r3.h \ 176 188 $(AINC)/lensing-ps1-v5-ld.h \ 189 $(AINC)/lensing-ps1-v6.h \ 177 190 $(AINC)/lensobj.h \ 178 191 $(AINC)/lensobj-ps1-v5-r0.h \ 179 192 $(AINC)/lensobj-ps1-v5-r1.h \ 180 193 $(AINC)/lensobj-ps1-v5-ld.h \ 194 $(AINC)/lensobj-ps1-v6.h \ 181 195 $(AINC)/starpar.h \ 182 196 $(AINC)/starpar-ps1-v5.h \ 197 $(AINC)/starpar-ps1-v6.h \ 183 198 $(AINC)/starpar-ps1-v5-ld.h \ 184 199 $(AINC)/starpar-ps1-sim.h \ … … 187 202 $(AINC)/galphot-ps1-v5-r1.h \ 188 203 $(AINC)/galphot-ps1-v5-ld.h \ 204 $(AINC)/galphot-ps1-v6.h \ 189 205 $(AINC)/missing.h \ 190 206 $(AINC)/photcode.h \ … … 198 214 $(AINC)/photcode-ps1-v4.h \ 199 215 $(AINC)/photcode-ps1-v5.h \ 216 $(AINC)/photcode-ps1-v6.h \ 200 217 $(AINC)/photcode-ps1-v5-ld.h \ 201 218 $(AINC)/photcode-ps1-ref.h \ … … 212 229 $(AINC)/image-ps1-v4.h \ 213 230 $(AINC)/image-ps1-v5.h \ 231 $(AINC)/image-ps1-v6.h \ 214 232 $(AINC)/image-ps1-v5-ld.h \ 215 233 $(AINC)/image-ps1-sim.h \ -
trunk/Ohana/src/libautocode/def/image.d
r37807 r40291 2 2 EXTNAME DVO_IMAGE 3 3 TYPE BINTABLE 4 SIZE 3 844 SIZE 392 5 5 DESCRIPTION DVO Image Table 6 7 ## XXX NOTE: as of 2015.01.11 (r 37807), I had to move this structure from the autocode 8 ## version to libdvo/include/libdvo_astro.h to support self-references 6 9 7 10 # elements of the image structure … … 35 38 FIELD apmifit, APMIFIT, float, aperture correction, mag 36 39 FIELD dapmifit, DAPMIFIT, float, apmifit error, mag 37 FIELD Mcal, MCAL, float, calibration mag, mag 40 FIELD McalPSF, MCAL_PSF, float, calibration mag for PSF, mag 41 FIELD McalAPER, MCAL_APER, float, calibration mag for Aperture, mag 38 42 FIELD dMcal, DMCAL, float, error on Mcal, mag 39 FIELD Xm, XM, short, image chisq, 10*log(value) 43 FIELD McalChiSq, XM, float, image chisq 44 FIELD padding_1, PADDING, short, identifier for CCD, 40 45 FIELD photcode, PHOTCODE, short, identifier for CCD, 41 46 FIELD exptime, EXPTIME, float, exposure time, seconds 42 47 FIELD sidtime, ST, float, sidereal time of exposure 43 48 FIELD latitude, LAT, float, observatory latitude, degrees 44 # 40bytes49 # 56 bytes 45 50 46 51 FIELD RAo, RA_CENTER, float, image center, degrees -
trunk/Ohana/src/libautocode/def/measure.d
r39262 r40291 13 13 FIELD Mkron, M_KRON, float, kron magnitude, mag 14 14 FIELD dMkron, M_KRON_ERR, float, kron magnitude error, mag 15 FIELD Mcal , M_CAL,float, image cal mag, mag15 FIELD McalPSF, MCAL_PSF, float, image cal mag, mag 16 16 FIELD dMcal, MAG_CAL_ERR, float, systematic calibration error, mag 17 17 FIELD dt, M_TIME, float, exposure time, 2.5*log(exptime) … … 44 44 45 45 FIELD Mflat, M_FLAT, float, Static Flat-field offset, mag 46 FIELD dummy2, PADDING, int, unused 4 bytes46 FIELD McalAPER, MCAL_APER, float, image cal mag for apertures, mag 47 47 48 48 # could these be packed into fewer bits? … … 53 53 FIELD averef, AVE_REF, unsigned int, reference to average entry 54 54 55 # internally, this is an unsigned int; however, we do NOT convert with TZERO/TSCAL on output 55 56 FIELD detID, DET_ID, unsigned int, detection ID 56 57 FIELD objID, OBJ_ID, unsigned int, unique ID for object in table 57 58 FIELD catID, CAT_ID, unsigned int, unique ID for table in which object was first realized 58 59 60 # extID needs to be on an 8-byte boundary 59 61 # PSPS uses a 64-bit detection ID 60 62 FIELD extID, EXT_ID, uint64_t, external ID (eg PSPS detID) … … 91 93 FIELD dRsys, POS_SYS_ERR, short, systematic error from astrom, 1/100 of pixels 92 94 95 # local astrometry scales 93 96 FIELD posangle, POSANGLE, short, position angle sky to chip, (0xffff/360) deg 94 97 FIELD pltscale, PLTSCALE, float, plate scale, arcsec/pixel -
trunk/Ohana/src/libautocode/def/secfilt.d
r37246 r40291 5 5 DESCRIPTION DVO SecFilt : Secondary Filter Data 6 6 7 ## 2017.11.22 : To clarify the parallel structures, I am explicitly renaming M,Map,Mkron to MpsfChp, MapChp, MkronChp 8 7 9 ## *** this section is for per-exposure mean values *** (unlabled values are implicitly PSF values) 8 FIELD M, MAG, float, average mag in this band, mags 9 FIELD dM, MAG_ERR, float, formal error on average mag, mags 10 FIELD Map, MAG_AP, float, average mag in this band, mags 11 FIELD dMap, MAG_AP_ERR, float, formal error on average mag, mags 12 FIELD sMap, MAG_AP_STDEV, float, standard deviation of ap mags, mags 13 FIELD Mkron, MAG_KRON, float, ave kron mag in this band, mags 14 FIELD dMkron, MAG_KRON_ERR, float, formal error on average kron mag, mags 15 FIELD sMkron, MAG_KRON_STDEV, float, standard deviation of kron mags, mags 10 FIELD MpsfChp, MAG, float, average mag in this band, mags 11 FIELD dMpsfChp, MAG_ERR, float, formal error on average mag, mags 12 FIELD sMpsfChp, MAG_STDEV, float, standard deviation of measurements, mags 13 14 FIELD MapChp, MAG_AP, float, average mag in this band, mags 15 FIELD dMapChp, MAG_AP_ERR, float, formal error on average mag, mags 16 FIELD sMapChp, MAG_AP_STDEV, float, standard deviation of ap mags, mags 17 18 FIELD MkronChp, MAG_KRON, float, ave kron mag in this band, mags 19 FIELD dMkronChp, MAG_KRON_ERR, float, formal error on average kron mag, mags 20 FIELD sMkronChp, MAG_KRON_STDEV, float, standard deviation of kron mags, mags 16 21 17 22 # XXX I could add these fields to secfilt or calculate in dvopsps? … … 20 25 21 26 # these statistics are PSF-specific 22 FIELD Mstdev, MAG_STDEV, float, standard deviation of measurements, mags23 27 FIELD Mmin, MAG_MIN, float, minimum accepted mag, mags 24 28 FIELD Mmax, MAG_MAX, float, maximum accepted mag, mags -
trunk/Ohana/src/libdvo/Makefile
r40063 r40291 50 50 $(DESTINC)/ps1_v4_defs.h \ 51 51 $(DESTINC)/ps1_v5_defs.h \ 52 $(DESTINC)/ps1_v6_defs.h \ 52 53 $(DESTINC)/ps1_v5_ld_defs.h \ 53 54 $(DESTINC)/ps1_ref_defs.h \ … … 100 101 $(SRC)/dvo_convert_PS1_V4.$(ARCH).o \ 101 102 $(SRC)/dvo_convert_PS1_V5.$(ARCH).o \ 103 $(SRC)/dvo_convert_PS1_V6.$(ARCH).o \ 102 104 $(SRC)/dvo_convert_PS1_V5_LOAD.$(ARCH).o \ 103 105 $(SRC)/dvo_convert_PS1_REF.$(ARCH).o \ -
trunk/Ohana/src/libdvo/doc/notes.txt
r34749 r40291 16 16 uppercase, eg: AveragePanstarrs_DEV_0, AveragePanstarrs_PS1_2). 17 17 18 4) create a DVO TableFormat entry for the new format18 4) create a DVOCatFormat entry for the new format 19 19 (libdvo/include/dvo.h). the naming convention is DVO_FORMAT_FOO. 20 20 … … 37 37 make is easy to identify the new changes needed. 38 38 39 10) add the new format to the section at the end of dvo_image.c 39 10a) if the Image structure must be changed, this is done in libdvo/include/libdvo_astro.h, not autocode 40 10b) add the new format to the section at the end of dvo_image.c 41 10c) update gfits_table_mkheader_Image in dvo_image.c to match modifications to Image (if any) 40 42 41 43 11) add the new format to the dvo_image_raw.c -
trunk/Ohana/src/libdvo/include/dvo.h
r40063 r40291 33 33 DVO_FORMAT_PS1_V4, 34 34 DVO_FORMAT_PS1_V5, 35 DVO_FORMAT_PS1_V6, 35 36 DVO_FORMAT_PS1_V5_LOAD, 36 37 } DVOCatFormat; … … 220 221 /* Secfilt.flags values -- these values are 32 bit (as of PS1_V1) */ 221 222 typedef enum { 222 ID_SECF_STAR_FEW = 0x00000001, // used within relphot: skip star 223 ID_SECF_STAR_POOR = 0x00000002, // used within relphot: skip star 224 ID_SECF_USE_SYNTH = 0x00000004, // synthetic photometry used in average measurement 225 ID_SECF_USE_UBERCAL = 0x00000008, // ubercal photometry used in average measurement 226 ID_SECF_HAS_PS1 = 0x00000010, // PS1 photometry used in average measurement 227 ID_SECF_HAS_PS1_STACK = 0x00000020, // PS1 stack photometry exists 228 ID_SECF_HAS_TYCHO = 0x00000040, // Tycho photometry used for synth mags 229 ID_SECF_FIX_SYNTH = 0x00000080, // synth mags repaired with zpt map 230 ID_SECF_RANK_0 = 0x00000100, // average magnitude uses rank 0 values 231 ID_SECF_RANK_1 = 0x00000200, // average magnitude uses rank 1 values 232 ID_SECF_RANK_2 = 0x00000400, // average magnitude uses rank 2 values 233 ID_SECF_RANK_3 = 0x00000800, // average magnitude uses rank 3 values 234 ID_SECF_RANK_4 = 0x00001000, // average magnitude uses rank 4 values 235 ID_SECF_OBJ_EXT_PSPS = 0x00002000, // In PSPS ID_SECF_OBJ_EXT is moved here so it fits within 16 bits 236 ID_SECF_STACK_PRIMARY = 0x00004000, // PS1 stack photometry comes from primary skycell 237 ID_SECF_STACK_BESTDET = 0x00008000, // PS1 stack best measurement is a detection (not forced) 238 ID_SECF_STACK_PRIMDET = 0x00010000, // PS1 stack primary measurement is a detection (not forced) 239 240 ID_SECF_HAS_SDSS = 0x00100000, // this photcode has SDSS photometry 241 ID_SECF_HAS_HSC = 0x00200000, // this photcode has HSC photometry 242 ID_SECF_HAS_CFH = 0x00400000, // this photcode has CFH photometry (mostly Megacam) 243 ID_SECF_HAS_DES = 0x00800000, // this photcode has DES photometry 244 245 ID_SECF_OBJ_EXT = 0x01000000, // extended in this band 246 247 ID_SECF_CHIP_FLAGS = 0x01003f1f, // all chip-related bits (used to reset the correct bits only) 248 ID_SECF_STACK_FLAGS = 0x00004020, // all stack-related bits ( 223 ID_SECF_STAR_FEW = 0x00000001, // used within relphot: skip star 224 ID_SECF_STAR_POOR = 0x00000002, // used within relphot: skip star 225 ID_SECF_USE_SYNTH = 0x00000004, // synthetic photometry used in average measurement 226 ID_SECF_USE_UBERCAL = 0x00000008, // ubercal photometry used in average measurement 227 ID_SECF_HAS_PS1 = 0x00000010, // PS1 photometry used in average measurement 228 ID_SECF_HAS_PS1_STACK = 0x00000020, // PS1 stack photometry exists 229 ID_SECF_HAS_TYCHO = 0x00000040, // Tycho photometry used for synth mags 230 ID_SECF_FIX_SYNTH = 0x00000080, // synth mags repaired with zpt map 231 ID_SECF_RANK_0 = 0x00000100, // average magnitude uses rank 0 values 232 ID_SECF_RANK_1 = 0x00000200, // average magnitude uses rank 1 values 233 ID_SECF_RANK_2 = 0x00000400, // average magnitude uses rank 2 values 234 ID_SECF_RANK_3 = 0x00000800, // average magnitude uses rank 3 values 235 ID_SECF_RANK_4 = 0x00001000, // average magnitude uses rank 4 values 236 ID_SECF_OBJ_EXT_PSPS = 0x00002000, // In PSPS ID_SECF_OBJ_EXT is moved here so it fits within 16 bits 237 ID_SECF_STACK_PRIMARY = 0x00004000, // PS1 stack photometry includes a primary skycell 238 ID_SECF_STACK_BESTDET = 0x00008000, // PS1 stack best measurement is a detection (not forced) 239 ID_SECF_STACK_PRIMDET = 0x00010000, // PS1 stack primary measurement is a detection (not forced) 240 ID_SECF_STACK_PRIMARY_MULTIPLE = 0x00020000, // PS1 stack object has multiple primary measurements 241 242 ID_SECF_HAS_SDSS = 0x00100000, // this photcode has SDSS photometry 243 ID_SECF_HAS_HSC = 0x00200000, // this photcode has HSC photometry 244 ID_SECF_HAS_CFH = 0x00400000, // this photcode has CFH photometry (mostly Megacam) 245 ID_SECF_HAS_DES = 0x00800000, // this photcode has DES photometry 246 247 ID_SECF_OBJ_EXT = 0x01000000, // extended in this band 248 249 ID_SECF_CHIP_FLAGS = 0x01003f1f, // all chip-related bits (used to reset the correct bits only) 250 ID_SECF_STACK_FLAGS = 0x0003c020, // all stack-related bits ( 249 251 } DVOSecfiltFlags; 250 252 … … 501 503 double R; 502 504 double D; 503 float M; 504 float Mcal; 505 float M; // change to Mpsf eventually to disambiguate 506 float Mkron; 507 float McalPSF; 508 float McalAPER; 505 509 float Mflat; 506 510 float dM; … … 1073 1077 # include "ps1_v4_defs.h" 1074 1078 # include "ps1_v5_defs.h" 1079 # include "ps1_v6_defs.h" 1075 1080 # include "ps1_v5_ld_defs.h" 1076 1081 # include "ps1_ref_defs.h" -
trunk/Ohana/src/libdvo/include/dvodb.h
r39633 r40291 3 3 4 4 # define MEASURE_HAS_XCCD 1 5 6 // Some values used by code moved to libdvo from opihi. 7 enum {OPIHI_NOTYPE, OPIHI_FLT, OPIHI_INT}; 8 # define opihi_flt double 9 // # define opihi_int int64_t 10 # define opihi_int long long int 11 # define OPIHI_INT_FMT "%lld" 5 12 6 13 typedef enum { … … 236 243 MEAS_EXTERN_ID, 237 244 MEAS_EXPNAME_AS_INT, 238 MEAS_MCAL_OFFSET, // make this a dvoMagOption? 245 MEAS_MCAL_OFFSET_PSF, // make this a dvoMagOption? 246 MEAS_MCAL_OFFSET_APER, // make this a dvoMagOption? 239 247 MEAS_FLAT, 240 248 MEAS_CENTER_OFFSET, … … 369 377 IMAGE_XM, 370 378 IMAGE_AIRMASS, 371 IMAGE_MCAL, 379 IMAGE_MCAL_PSF, 380 IMAGE_MCAL_APER, 372 381 IMAGE_dMCAL, 373 382 IMAGE_PHOTCODE, … … 471 480 char type; 472 481 int field; 473 //opihi_flt FltValue;474 //opihi_int IntValue;475 double FltValue;476 int IntValue;482 opihi_flt FltValue; 483 opihi_int IntValue; 484 // double FltValue; 485 // int IntValue; 477 486 } dbStack; 478 487 479 488 typedef struct { 480 //opihi_flt Flt;481 //opihi_int Int;482 double Flt;483 int Int;489 opihi_flt Flt; 490 opihi_int Int; 491 // double Flt; 492 // int Int; 484 493 } dbValue; 485 494 … … 562 571 int dbExtractImagesReset (void); 563 572 564 // Some values used by code moved to libdvo from opihi.565 enum {OPIHI_NOTYPE, OPIHI_FLT, OPIHI_INT};566 #define opihi_flt double567 #define opihi_int int568 569 573 #include "get_graphdata.h" 570 574 -
trunk/Ohana/src/libdvo/include/libdvo_astro.h
r39457 r40291 100 100 float apmifit; // aperture correction (mag) 101 101 float dapmifit; // apmifit error (mag) 102 float Mcal; // calibration mag (mag) 102 float McalPSF; // calibration mag (mag) 103 float McalAPER; // calibration mag (mag) 103 104 float dMcal; // error on Mcal (mag) 104 short Xm;// image chisq (10*log(value))105 float McalChiSq; // image chisq (10*log(value)) 105 106 short photcode; // identifier for CCD, 106 107 float exptime; // exposure time (seconds) -
trunk/Ohana/src/libdvo/src/ImageMetadata.c
r37807 r40291 64 64 GET_COLUMN (crval2, "CRVAL2", double); 65 65 GET_COLUMN (theta, "THETA", float); 66 GET_COLUMN (Mcal ,"MCAL", float);66 GET_COLUMN (McalPSF, "MCAL", float); 67 67 GET_COLUMN (secz, "SECZ", float); 68 68 GET_COLUMN (Xcenter, "X_CENTER", float); … … 77 77 image[i].crval2 = crval2[i] ; 78 78 image[i].theta = theta[i] ; 79 image[i].Mcal = Mcal [i] ;79 image[i].Mcal = McalPSF[i] ; 80 80 image[i].secz = secz[i] ; 81 81 image[i].Xcenter = Xcenter[i] ; … … 90 90 free (crval2); 91 91 free (theta); 92 free (Mcal );92 free (McalPSF); 93 93 free (secz); 94 94 free (Xcenter); … … 166 166 theta[i] = DEG_RAD*atan2(mosaic->pc1_2, mosaic->pc1_1); 167 167 168 Mcal[i] = image[i].Mcal ;168 Mcal[i] = image[i].McalPSF; 169 169 secz[i] = image[i].secz; 170 170 Xcenter[i] = 0.5*image[i].NX; -
trunk/Ohana/src/libdvo/src/LoadPhotcodesFITS.c
r40063 r40291 64 64 CONVERT_FORMAT("DVO_PHOTCODE_PS1_V4", PS1_V4); 65 65 CONVERT_FORMAT("DVO_PHOTCODE_PS1_V5", PS1_V5); 66 CONVERT_FORMAT("DVO_PHOTCODE_PS1_V6", PS1_V6); 66 67 CONVERT_FORMAT("DVO_PHOTCODE_PS1_V5_LOAD", PS1_V5_LOAD); 67 68 -
trunk/Ohana/src/libdvo/src/SavePhotcodesFITS.c
r38553 r40291 30 30 // for the moment, we simply support the latest photcode format for output 31 31 // XXX update this as needed as new formats are defined 32 PhotCode_PS1_V 5 *photcode_output = PhotCode_Internal_To_PS1_V5(table[0].code, table[0].Ncode);32 PhotCode_PS1_V6 *photcode_output = PhotCode_Internal_To_PS1_V6 (table[0].code, table[0].Ncode); 33 33 34 34 /* convert FITS format data to internal format (byteswaps & EXTNAME) */ 35 35 if (!gfits_db_create (&db)) return (FALSE); 36 if (!gfits_table_set_PhotCode_PS1_V 5(&db.ftable, photcode_output, table[0].Ncode, TRUE)) return (FALSE);36 if (!gfits_table_set_PhotCode_PS1_V6 (&db.ftable, photcode_output, table[0].Ncode, TRUE)) return (FALSE); 37 37 if (!gfits_db_save (&db)) return (FALSE); 38 38 if (!gfits_db_close (&db)) return (FALSE); -
trunk/Ohana/src/libdvo/src/dbCheckStack.c
r39578 r40291 43 43 * an int unless proven otherwise **/ 44 44 stack[i].FltValue = strtod (stack[i].name, &c1); 45 stack[i].IntValue = strtol (stack[i].name, &c2, 0);45 stack[i].IntValue = strtoll (stack[i].name, &c2, 0); 46 46 if (c2 == stack[i].name + strlen (stack[i].name)) { 47 47 stack[i].type |= DB_STACK_INT; -
trunk/Ohana/src/libdvo/src/dbExtractImages.c
r39457 r40291 219 219 break; 220 220 221 case IMAGE_MCAL: 222 value.Flt = image[N].Mcal; 221 case IMAGE_MCAL_PSF: 222 value.Flt = image[N].McalPSF; 223 break; 224 case IMAGE_MCAL_APER: 225 value.Flt = image[N].McalAPER; 223 226 break; 224 227 case IMAGE_dMCAL: … … 226 229 break; 227 230 case IMAGE_XM: 228 value.Flt = pow(10.0, 0.01*image[N].Xm);231 value.Flt = image[N].McalChiSq; 229 232 break; 230 233 case IMAGE_PHOTCODE: -
trunk/Ohana/src/libdvo/src/dbExtractMeasures.c
r39926 r40291 740 740 break; 741 741 742 case MEAS_MCAL_OFFSET: { value.Flt = measure[0].Mcal; break; } 742 case MEAS_MCAL_OFFSET_PSF: { value.Flt = measure[0].McalPSF; break; } 743 case MEAS_MCAL_OFFSET_APER: { value.Flt = measure[0].McalAPER; break; } 743 744 case MEAS_FLAT: { value.Flt = measure[0].Mflat; break; } 744 745 -
trunk/Ohana/src/libdvo/src/dbFields.c
r39633 r40291 333 333 334 334 // make a local working copy of fieldName and replace ':' with spaces 335 // XXX memory leak here: 335 336 char *fieldCopy = strcreate(fieldName); 336 337 for (j = 0; fieldCopy[j]; j++) { … … 338 339 } 339 340 341 // XXX potential memory leak here 340 342 char *firstWord = getword(fieldCopy); 343 if (!firstWord) return FALSE; 341 344 342 345 // firstWord may be either flux, mag or photcode … … 606 609 if (!strcasecmp (fieldName, "SKY")) ESCAPE (MEAS_SKY, OPIHI_FLT); 607 610 if (!strcasecmp (fieldName, "SKY_ERR")) ESCAPE (MEAS_dSKY, OPIHI_FLT); 608 if (!strcasecmp (fieldName, "MCAL_OFFSET")) ESCAPE (MEAS_MCAL_OFFSET, OPIHI_FLT); 611 if (!strcasecmp (fieldName, "MCAL_OFFSET")) ESCAPE (MEAS_MCAL_OFFSET_PSF, OPIHI_FLT); 612 if (!strcasecmp (fieldName, "MCAL_OFFSET_PSF")) ESCAPE (MEAS_MCAL_OFFSET_PSF, OPIHI_FLT); 613 if (!strcasecmp (fieldName, "MCAL_OFFSET_APER")) ESCAPE (MEAS_MCAL_OFFSET_APER, OPIHI_FLT); 609 614 if (!strcasecmp (fieldName, "FLAT")) ESCAPE (MEAS_FLAT, OPIHI_FLT); 610 615 if (!strcasecmp (fieldName, "CENTER_OFFSET")) ESCAPE (MEAS_CENTER_OFFSET, OPIHI_FLT); … … 842 847 if (!strcasecmp (fieldName, "dapresid" )) ESCAPE (IMAGE_DAPRESID, OPIHI_FLT); 843 848 844 if (!strcasecmp (fieldName, "Mcal" )) ESCAPE (IMAGE_MCAL, OPIHI_FLT); 845 if (!strcasecmp (fieldName, "dMcal" )) ESCAPE (IMAGE_dMCAL, OPIHI_FLT); 846 if (!strcasecmp (fieldName, "Xm" )) ESCAPE (IMAGE_XM, OPIHI_FLT); 847 if (!strcasecmp (fieldName, "photcode" )) ESCAPE (IMAGE_PHOTCODE, OPIHI_INT); 848 if (!strcasecmp (fieldName, "exptime" )) ESCAPE (IMAGE_EXPTIME, OPIHI_FLT); 849 if (!strcasecmp (fieldName, "expname" )) ESCAPE (IMAGE_EXPNAME_AS_INT, OPIHI_INT); 850 if (!strcasecmp (fieldName, "sidtime" )) ESCAPE (IMAGE_SIDTIME, OPIHI_FLT); 849 if (!strcasecmp (fieldName, "Mcal" )) ESCAPE (IMAGE_MCAL_PSF, OPIHI_FLT); 850 if (!strcasecmp (fieldName, "McalPSF" )) ESCAPE (IMAGE_MCAL_PSF, OPIHI_FLT); 851 if (!strcasecmp (fieldName, "McalAPER" )) ESCAPE (IMAGE_MCAL_APER, OPIHI_FLT); 852 if (!strcasecmp (fieldName, "McalAPERTURE")) ESCAPE (IMAGE_MCAL_APER, OPIHI_FLT); 853 if (!strcasecmp (fieldName, "dMcal" )) ESCAPE (IMAGE_dMCAL, OPIHI_FLT); 854 if (!strcasecmp (fieldName, "Xm" )) ESCAPE (IMAGE_XM, OPIHI_FLT); 855 if (!strcasecmp (fieldName, "photcode" )) ESCAPE (IMAGE_PHOTCODE, OPIHI_INT); 856 if (!strcasecmp (fieldName, "exptime" )) ESCAPE (IMAGE_EXPTIME, OPIHI_FLT); 857 if (!strcasecmp (fieldName, "expname" )) ESCAPE (IMAGE_EXPNAME_AS_INT, OPIHI_INT); 858 if (!strcasecmp (fieldName, "sidtime" )) ESCAPE (IMAGE_SIDTIME, OPIHI_FLT); 851 859 852 860 if (!strcasecmp (fieldName, "latitude" )) ESCAPE (IMAGE_LATITUDE, OPIHI_FLT); -
trunk/Ohana/src/libdvo/src/dvo_catalog.c
r40063 r40291 57 57 if (!strcasecmp (catformat, "PS1_V4")) return (DVO_FORMAT_PS1_V4); 58 58 if (!strcasecmp (catformat, "PS1_V5")) return (DVO_FORMAT_PS1_V5); 59 if (!strcasecmp (catformat, "PS1_V6")) return (DVO_FORMAT_PS1_V6); 59 60 if (!strcasecmp (catformat, "PS1_V5_LOAD")) return (DVO_FORMAT_PS1_V5_LOAD); 60 61 if (!strcasecmp (catformat, "PS1_REF")) return (DVO_FORMAT_PS1_REF); … … 234 235 235 236 if (mode & SECFILT_RESET_CHIP) { 236 secfilt->M = NAN; 237 secfilt->dM = NAN; 238 secfilt->Map = NAN; 239 secfilt->dMap = NAN; 240 secfilt->sMap = NAN; 241 secfilt->Mkron = NAN; 242 secfilt->dMkron = NAN; 243 secfilt->sMkron = NAN; 237 secfilt->MpsfChp = NAN; 238 secfilt->dMpsfChp = NAN; 239 secfilt->sMpsfChp = NAN; 240 secfilt->MapChp = NAN; 241 secfilt->dMapChp = NAN; 242 secfilt->sMapChp = NAN; 243 secfilt->MkronChp = NAN; 244 secfilt->dMkronChp = NAN; 245 secfilt->sMkronChp = NAN; 244 246 245 247 secfilt->psfQfMax = NAN; 246 248 secfilt->psfQfPerfMax = NAN; 247 249 248 secfilt->Mstdev = NAN;249 250 secfilt->Mmin = NAN; 250 251 secfilt->Mmax = NAN; … … 316 317 measure->Mkron = NAN; 317 318 measure->dMkron = NAN; 318 measure->Mcal = NAN; 319 measure->McalPSF = NAN; 320 measure->McalAPER = NAN; 319 321 measure->dMcal = NAN; 320 322 measure->dt = NAN; … … 343 345 344 346 measure->Mflat = 0.0; 345 measure->dummy2 = 0;346 347 347 348 measure->Sky = NAN; … … 394 395 measure->D = NAN; 395 396 measure->M = NAN; 396 measure->Mcal = NAN; 397 measure->McalPSF = NAN; 398 measure->McalAPER = NAN; 397 399 measure->dM = NAN; 398 400 … … 922 924 for (in = out = i = 0; i < catalog[0].Naverage; i++) { 923 925 for (j = 0; j < catalog[0].Nsecfilt; j++, in++, out++) { 924 outsec[out].M = insec[in].M;925 outsec[out].dM = insec[in].dM;926 outsec[out].Mchisq = insec[in].Mchisq;926 outsec[out].MpsfChp = insec[in].MpsfChp; 927 outsec[out].dMpsfChp = insec[in].dMpsfChp; 928 outsec[out].Mchisq = insec[in].Mchisq; 927 929 } 928 930 for (j = 0; j < Nextra; j++, out++) { 929 outsec[out].M = NAN;930 outsec[out].dM = NAN;931 outsec[out].Mchisq = NAN;931 outsec[out].MpsfChp = NAN; 932 outsec[out].dMpsfChp = NAN; 933 outsec[out].Mchisq = NAN; 932 934 } 933 935 } -
trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c
r40063 r40291 91 91 FORMAT_CASE (PS1_V4, PS1_V4); 92 92 FORMAT_CASE (PS1_V5, PS1_V5); 93 FORMAT_CASE (PS1_V6, PS1_V6); 93 94 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD); 94 95 FORMAT_CASE (PS1_REF, PS1_REF); … … 288 289 if (catalog[0].catformat == DVO_FORMAT_PS1_V4) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_V4"); 289 290 if (catalog[0].catformat == DVO_FORMAT_PS1_V5) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_V5"); 291 if (catalog[0].catformat == DVO_FORMAT_PS1_V6) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_V6"); 290 292 if (catalog[0].catformat == DVO_FORMAT_PS1_V5_LOAD) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_V5_LOAD"); 291 293 if (catalog[0].catformat == DVO_FORMAT_PS1_REF) gfits_modify (&catalog[0].header, "FORMAT", "%s", 1, "PS1_REF"); … … 394 396 FORMAT_CASE (PS1_V4, PS1_V4); 395 397 FORMAT_CASE (PS1_V5, PS1_V5); 398 FORMAT_CASE (PS1_V6, PS1_V6); 396 399 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD); 397 400 FORMAT_CASE (PS1_REF, PS1_REF); … … 448 451 FORMAT_CASE (PS1_V4, PS1_V4); 449 452 FORMAT_CASE (PS1_V5, PS1_V5); 453 FORMAT_CASE (PS1_V6, PS1_V6); 450 454 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD); 451 455 FORMAT_CASE (PS1_REF, PS1_REF); … … 505 509 FORMAT_CASE (PS1_V3, PS1_V3); 506 510 FORMAT_CASE (PS1_V5, PS1_V5); 511 FORMAT_CASE (PS1_V6, PS1_V6); 507 512 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD); 508 513 FORMAT_CASE (PS1_REF, PS1_REF); … … 559 564 FORMAT_CASE (PS1_V4, PS1_V4); 560 565 FORMAT_CASE (PS1_V5, PS1_V5); 566 FORMAT_CASE (PS1_V6, PS1_V6); 561 567 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD); 562 568 FORMAT_CASE (PS1_REF, PS1_REF); … … 617 623 FORMAT_CASE (PS1_V4, PS1_V4); 618 624 FORMAT_CASE (PS1_V5, PS1_V5); 625 FORMAT_CASE (PS1_V6, PS1_V6); 619 626 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD); 620 627 FORMAT_CASE (PS1_REF, PS1_REF); … … 671 678 FORMAT_CASE (PS1_V4, PS1_V4); 672 679 FORMAT_CASE (PS1_V5, PS1_V5); 680 FORMAT_CASE (PS1_V6, PS1_V6); 673 681 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD); 674 682 FORMAT_CASE (PS1_REF, PS1_REF); -
trunk/Ohana/src/libdvo/src/dvo_catalog_split.c
r39395 r40291 464 464 catalog[0].Nmissing_disk = Nmissing; 465 465 catalog[0].Nsecfilt_disk = Naverage * Nsecfilt; 466 catalog[0].Nlensing_disk = Nlensing;467 catalog[0].Nlensobj_disk = Nlensobj;468 catalog[0].Nstarpar_disk = Nstarpar;466 catalog[0].Nlensing_disk = Nlensing; 467 catalog[0].Nlensobj_disk = Nlensobj; 468 catalog[0].Nstarpar_disk = Nstarpar; 469 469 catalog[0].Ngalphot_disk = Ngalphot; 470 470 -
trunk/Ohana/src/libdvo/src/dvo_convert.c
r40063 r40291 42 42 CONVERT_FORMAT ("DVO_AVERAGE_PS1_V4", PS1_V4); 43 43 CONVERT_FORMAT ("DVO_AVERAGE_PS1_V5", PS1_V5); 44 CONVERT_FORMAT ("DVO_AVERAGE_PS1_V6", PS1_V6); 44 45 CONVERT_FORMAT ("DVO_AVERAGE_PS1_V5_LOAD", PS1_V5_LOAD); 45 46 CONVERT_FORMAT ("DVO_AVERAGE_PS1_REF", PS1_REF); … … 133 134 CONVERT_FORMAT ("DVO_AVERAGE_PS1_V4", PS1_V4, PS1_V4); 134 135 CONVERT_FORMAT ("DVO_AVERAGE_PS1_V5", PS1_V5, PS1_V5); 136 CONVERT_FORMAT ("DVO_AVERAGE_PS1_V6", PS1_V6, PS1_V6); 135 137 CONVERT_FORMAT ("DVO_AVERAGE_PS1_V5_LOAD", PS1_V5_LOAD, PS1_V5_LOAD); 136 138 CONVERT_FORMAT ("DVO_AVERAGE_PS1_REF", PS1_REF, PS1_REF); … … 171 173 FORMAT_CASE (PS1_V4, PS1_V4); 172 174 FORMAT_CASE (PS1_V5, PS1_V5); 175 FORMAT_CASE (PS1_V6, PS1_V6); 173 176 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD); 174 177 FORMAT_CASE (PS1_REF, PS1_REF); … … 270 273 CONVERT_FORMAT ("DVO_MEASURE_PS1_V4", PS1_V4, PS1_V4, FALSE); 271 274 CONVERT_FORMAT ("DVO_MEASURE_PS1_V5", PS1_V5, PS1_V5, TRUE); 275 CONVERT_FORMAT ("DVO_MEASURE_PS1_V6", PS1_V6, PS1_V6, TRUE); 272 276 CONVERT_FORMAT ("DVO_MEASURE_PS1_V5_LOAD", PS1_V5_LOAD, PS1_V5_LOAD, TRUE); 273 277 CONVERT_FORMAT ("DVO_MEASURE_PS1_REF", PS1_REF, PS1_REF, FALSE); … … 310 314 FORMAT_CASE (PS1_V4, PS1_V4, FALSE); 311 315 FORMAT_CASE (PS1_V5, PS1_V5, TRUE); 316 FORMAT_CASE (PS1_V6, PS1_V6, TRUE); 312 317 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD, TRUE); 313 318 FORMAT_CASE (PS1_REF, PS1_REF, FALSE); … … 391 396 SKIPPING_FORMAT ("DVO_MISSING_PS1_V4", PS1_V4, PS1_V4); 392 397 SKIPPING_FORMAT ("DVO_MISSING_PS1_V5", PS1_V5, PS1_V5); 398 SKIPPING_FORMAT ("DVO_MISSING_PS1_V6", PS1_V6, PS1_V6); 393 399 SKIPPING_FORMAT ("DVO_MISSING_PS1_V5_LOAD", PS1_V5_LOAD, PS1_V5_LOAD); 394 400 # undef CONVERT_FORMAT … … 466 472 CONVERT_FORMAT ("DVO_SECFILT_PS1_V4", PS1_V4, PS1_V4); 467 473 CONVERT_FORMAT ("DVO_SECFILT_PS1_V5", PS1_V5, PS1_V5); 474 CONVERT_FORMAT ("DVO_SECFILT_PS1_V6", PS1_V6, PS1_V6); 468 475 CONVERT_FORMAT ("DVO_SECFILT_PS1_V5_LOAD", PS1_V5_LOAD, PS1_V5_LOAD); 469 476 CONVERT_FORMAT ("DVO_SECFILT_PS1_REF", PS1_REF, PS1_REF); … … 504 511 FORMAT_CASE (PS1_V4, PS1_V4); 505 512 FORMAT_CASE (PS1_V5, PS1_V5); 513 FORMAT_CASE (PS1_V6, PS1_V6); 506 514 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD); 507 515 FORMAT_CASE (PS1_REF, PS1_REF); … … 612 620 SKIPPING_FORMAT ("DVO_LENSING_PS1_V4", PS1_V4, PS1_V4); 613 621 CONVERT_FORMAT ("DVO_LENSING_PS1_V5", PS1_V5, PS1_V5_R3); 622 CONVERT_FORMAT ("DVO_LENSING_PS1_V6", PS1_V6, PS1_V6); 614 623 CONVERT_FORMAT ("DVO_LENSING_PS1_V5_LOAD", PS1_V5_LOAD, PS1_V5_LOAD); 615 624 SKIPPING_FORMAT ("DVO_LENSING_PS1_SIM", PS1_SIM, PS1_SIM); … … 652 661 // FORMAT_CASE (PS1_V4, PS1_V4); 653 662 FORMAT_CASE (PS1_V5, PS1_V5_R3); 663 FORMAT_CASE (PS1_V6, PS1_V6); 654 664 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD); 655 665 # undef FORMAT_CASE … … 732 742 SKIPPING_FORMAT ("DVO_LENSOBJ_PS1_V4", PS1_V4, PS1_V4); 733 743 CONVERT_FORMAT ("DVO_LENSOBJ_PS1_V5", PS1_V5, PS1_V5_R1); 744 CONVERT_FORMAT ("DVO_LENSOBJ_PS1_V6", PS1_V6, PS1_V6); 734 745 CONVERT_FORMAT ("DVO_LENSOBJ_PS1_V5_LOAD", PS1_V5_LOAD, PS1_V5_LOAD); 735 746 SKIPPING_FORMAT ("DVO_LENSOBJ_PS1_SIM", PS1_SIM, PS1_SIM); … … 772 783 // FORMAT_CASE (PS1_V4, PS1_V4); 773 784 FORMAT_CASE (PS1_V5, PS1_V5_R1); 785 FORMAT_CASE (PS1_V6, PS1_V6); 774 786 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD); 775 787 # undef FORMAT_CASE … … 840 852 SKIPPING_FORMAT ("DVO_STARPAR_PS1_V4", PS1_V4, PS1_V4); 841 853 CONVERT_FORMAT ("DVO_STARPAR_PS1_V5", PS1_V5, PS1_V5); 854 CONVERT_FORMAT ("DVO_STARPAR_PS1_V6", PS1_V6, PS1_V6); 842 855 CONVERT_FORMAT ("DVO_STARPAR_PS1_V5_LOAD", PS1_V5_LOAD, PS1_V5_LOAD); 843 856 # undef CONVERT_FORMAT … … 880 893 // FORMAT_CASE (PS1_V4, PS1_V4); 881 894 FORMAT_CASE (PS1_V5, PS1_V5); 895 FORMAT_CASE (PS1_V6, PS1_V6); 882 896 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD); 883 897 # undef FORMAT_CASE … … 961 975 SKIPPING_FORMAT ("DVO_GALPHOT_PS1_V4", PS1_V4, PS1_V4); 962 976 CONVERT_FORMAT ("DVO_GALPHOT_PS1_V5", PS1_V5, PS1_V5_R1); 977 CONVERT_FORMAT ("DVO_GALPHOT_PS1_V6", PS1_V6, PS1_V6); 963 978 CONVERT_FORMAT ("DVO_GALPHOT_PS1_V5_LOAD", PS1_V5_LOAD, PS1_V5_LOAD); 964 979 SKIPPING_FORMAT ("DVO_GALPHOT_PS1_SIM", PS1_SIM, PS1_SIM); … … 1001 1016 // FORMAT_CASE (PS1_V4, PS1_V4); 1002 1017 FORMAT_CASE (PS1_V5, PS1_V5_R1); 1018 FORMAT_CASE (PS1_V6, PS1_V6); 1003 1019 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD); 1004 1020 # undef FORMAT_CASE … … 1075 1091 CONVERT_FORMAT ("DVO_IMAGE_PS1_V4", PS1_V4, PS1_V4); 1076 1092 CONVERT_FORMAT ("DVO_IMAGE_PS1_V5", PS1_V5, PS1_V5); 1093 CONVERT_FORMAT ("DVO_IMAGE_PS1_V6", PS1_V6, PS1_V6); 1077 1094 CONVERT_FORMAT ("DVO_IMAGE_PS1_V5_LOAD", PS1_V5_LOAD, PS1_V5_LOAD); 1078 1095 CONVERT_FORMAT ("DVO_IMAGE_PS1_REF", PS1_REF, PS1_REF); … … 1096 1113 tmpImage = ImageInternalTo_##TYPE ((Image *) ftable[0].buffer, Nimage); \ 1097 1114 free (ftable[0].buffer); \ 1115 ftable[0].buffer = NULL; \ 1098 1116 gfits_free_header (ftable->header); \ 1099 1117 gfits_table_set_Image_##TYPE (ftable, tmpImage, Nimage, TRUE); \ … … 1114 1132 FORMAT_CASE (PS1_V4, PS1_V4); 1115 1133 FORMAT_CASE (PS1_V5, PS1_V5); 1134 FORMAT_CASE (PS1_V6, PS1_V6); 1116 1135 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD); 1117 1136 FORMAT_CASE (PS1_REF, PS1_REF); … … 1166 1185 FORMAT_CASE (PS1_V4, PS1_V4); 1167 1186 FORMAT_CASE (PS1_V5, PS1_V5); 1187 FORMAT_CASE (PS1_V6, PS1_V6); 1168 1188 FORMAT_CASE (PS1_V5_LOAD, PS1_V5_LOAD); 1169 1189 FORMAT_CASE (PS1_REF, PS1_REF); -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c
r39457 r40291 17 17 out[i].D = ave[averef].D - in[i].dD / 3600.0; 18 18 out[i].M = in[i].M; 19 out[i].Mcal = in[i].Mcal; 19 out[i].McalPSF = in[i].Mcal; 20 out[i].McalAPER = in[i].Mcal; 20 21 out[i].dM = in[i].dM; 21 22 out[i].dt = in[i].dt; … … 64 65 out[i].dD = 3600.0*(ave[averef].D - in[i].D); 65 66 out[i].M = in[i].M; 66 out[i].Mcal = in[i].Mcal ;67 out[i].Mcal = in[i].McalPSF; 67 68 out[i].dM = in[i].dM; 68 69 out[i].dt = in[i].dt; … … 182 183 dvo_secfilt_init (&out[i], SECFILT_RESET_ALL); 183 184 184 out[i].M = in[i].M; 185 out[i].dM = in[i].dM; 185 out[i].MpsfChp = in[i].M; 186 out[i].dMpsfChp = in[i].dM; 187 186 188 out[i].Mchisq= pow (10.0, 0.01*in[i].Xm); 187 189 out[i].Ncode = in[i].Ncode; … … 199 201 200 202 for (i = 0; i < Nvalues; i++) { 201 out[i].M = in[i].M; 202 out[i].dM = in[i].dM; 203 out[i].M = in[i].MpsfChp; 204 out[i].dM = in[i].dMpsfChp; 205 203 206 out[i].Xm = 100.0*log10(in[i].Mchisq); 204 207 out[i].Ncode = in[i].Ncode; … … 237 240 out[i].apmifit = in[i].apmifit; 238 241 out[i].dapmifit = in[i].dapmifit; 239 out[i].Mcal = in[i].Mcal; 242 243 out[i].McalPSF = in[i].Mcal; 244 out[i].McalAPER = in[i].Mcal; 240 245 out[i].dMcal = in[i].dMcal; 241 out[i].Xm = in[i].Xm; 246 out[i].McalChiSq = pow(10.0, 0.01*in[i].Xm); 247 242 248 out[i].photcode = in[i].photcode; 243 249 out[i].exptime = in[i].exptime; … … 306 312 out[i].apmifit = in[i].apmifit; 307 313 out[i].dapmifit = in[i].dapmifit; 308 out[i].Mcal = in[i].Mcal; 314 315 out[i].Mcal = in[i].McalPSF; 309 316 out[i].dMcal = in[i].dMcal; 310 out[i].Xm = in[i].Xm; 317 out[i].Xm = 100.0*log10(in[i].McalChiSq); 318 311 319 out[i].photcode = in[i].photcode; 312 320 out[i].exptime = in[i].exptime; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c
r39457 r40291 17 17 out[i].D = ave[averef].D - in[i].dD / 3600.0; 18 18 out[i].M = in[i].M; 19 out[i].Mcal = in[i].Mcal; 19 out[i].McalPSF = in[i].Mcal; 20 out[i].McalAPER = in[i].Mcal; 20 21 out[i].Map = in[i].Map; 21 22 out[i].dM = in[i].dM; … … 62 63 out[i].dD = 3600.0*(ave[averef].D - in[i].D); 63 64 out[i].M = in[i].M; 64 out[i].Mcal = in[i].Mcal ;65 out[i].Mcal = in[i].McalPSF; 65 66 out[i].Map = in[i].Map; 66 67 out[i].dM = in[i].dM; … … 177 178 dvo_secfilt_init (&out[i], SECFILT_RESET_ALL); 178 179 179 out[i].M = in[i].M; 180 out[i].dM = in[i].dM; 180 out[i].MpsfChp = in[i].M; 181 out[i].dMpsfChp = in[i].dM; 182 181 183 out[i].Mchisq= pow (10.0, 0.01*in[i].Xm); 182 184 out[i].Ncode = in[i].Ncode; … … 194 196 195 197 for (i = 0; i < Nvalues; i++) { 196 out[i].M = in[i].M; 197 out[i].dM = in[i].dM; 198 out[i].M = in[i].MpsfChp; 199 out[i].dM = in[i].dMpsfChp; 200 198 201 out[i].Xm = 100.0*log10(in[i].Mchisq); 199 202 out[i].Ncode = in[i].Ncode; … … 232 235 out[i].apmifit = in[i].apmifit; 233 236 out[i].dapmifit = in[i].dapmifit; 234 out[i].Mcal = in[i].Mcal; 237 238 out[i].McalPSF = in[i].Mcal; 239 out[i].McalAPER = in[i].Mcal; 235 240 out[i].dMcal = in[i].dMcal; 236 out[i].Xm = in[i].Xm; 241 out[i].McalChiSq = pow(10.0, 0.01*in[i].Xm); 242 237 243 out[i].photcode = in[i].photcode; 238 244 out[i].exptime = in[i].exptime; … … 298 304 out[i].apmifit = in[i].apmifit; 299 305 out[i].dapmifit = in[i].dapmifit; 300 out[i].Mcal = in[i].Mcal; 306 307 out[i].Mcal = in[i].McalPSF; 301 308 out[i].dMcal = in[i].dMcal; 302 out[i].Xm = in[i].Xm; 309 out[i].Xm = 100.0*log10(in[i].McalChiSq); 310 303 311 out[i].photcode = in[i].photcode; 304 312 out[i].exptime = in[i].exptime; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_3.c
r37807 r40291 34 34 out[i].apmifit = in[i].apmifit; 35 35 out[i].dapmifit = in[i].dapmifit; 36 out[i].Mcal = in[i].Mcal; 36 37 out[i].McalPSF = in[i].Mcal; 38 out[i].McalAPER = in[i].Mcal; 37 39 out[i].dMcal = in[i].dMcal; 38 out[i].Xm = in[i].Xm; 40 out[i].McalChiSq = pow(10.0, 0.01*in[i].Xm); 41 39 42 out[i].photcode = in[i].photcode; 40 43 out[i].exptime = in[i].exptime; … … 95 98 out[i].apmifit = in[i].apmifit; 96 99 out[i].dapmifit = in[i].dapmifit; 97 out[i].Mcal = in[i].Mcal; 100 101 out[i].Mcal = in[i].McalPSF; 98 102 out[i].dMcal = in[i].dMcal; 99 out[i].Xm = in[i].Xm; 103 out[i].Xm = 100.0*log10(in[i].McalChiSq); 104 100 105 out[i].photcode = in[i].photcode; 101 106 out[i].exptime = in[i].exptime; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c
r39457 r40291 114 114 dvo_secfilt_init (&out[i], SECFILT_RESET_ALL); 115 115 116 out[i].M = in[i].M;117 out[i].dM = in[i].dM;116 out[i].MpsfChp = in[i].M; 117 out[i].dMpsfChp = in[i].dM; 118 118 } 119 119 return (out); … … 128 128 129 129 for (i = 0; i < Nvalues; i++) { 130 out[i].M = in[i].M;131 out[i].dM = in[i].dM;130 out[i].M = in[i].MpsfChp; 131 out[i].dM = in[i].dMpsfChp; 132 132 } 133 133 return (out); … … 163 163 out[i].apmifit = in[i].apmifit; 164 164 out[i].dapmifit = in[i].dapmifit; 165 out[i].Mcal = in[i].Mcal; 165 166 out[i].McalPSF = in[i].Mcal; 167 out[i].McalAPER = in[i].Mcal; 166 168 out[i].dMcal = in[i].dMcal; 167 out[i].Xm = in[i].Xm; 169 out[i].McalChiSq = pow(10.0, 0.01*in[i].Xm); 170 168 171 out[i].photcode = in[i].photcode; 169 172 out[i].exptime = in[i].exptime; … … 227 230 out[i].apmifit = in[i].apmifit; 228 231 out[i].dapmifit = in[i].dapmifit; 229 out[i].Mcal = in[i].Mcal; 232 233 out[i].Mcal = in[i].McalPSF; 230 234 out[i].dMcal = in[i].dMcal; 231 out[i].Xm = in[i].Xm; 235 out[i].Xm = 100.0*log10(in[i].McalChiSq); 236 232 237 out[i].photcode = in[i].photcode; 233 238 out[i].exptime = in[i].exptime; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_SIM.c
r39457 r40291 18 18 out[i].M = in[i].M; 19 19 out[i].dM = in[i].dM; 20 out[i].Mcal = in[i].Mcal; 20 out[i].McalPSF = in[i].Mcal; 21 out[i].McalAPER = in[i].Mcal; 21 22 out[i].dt = in[i].dt; 22 23 out[i].airmass = in[i].airmass; … … 64 65 out[i].M = in[i].M; 65 66 out[i].dM = in[i].dM; 66 out[i].Mcal = in[i].Mcal ;67 out[i].Mcal = in[i].McalPSF; 67 68 out[i].dt = in[i].dt; 68 69 out[i].airmass = in[i].airmass; … … 199 200 dvo_secfilt_init (&out[i], SECFILT_RESET_ALL); 200 201 201 out[i].M = in[i].M; 202 out[i].dM = in[i].dM; 202 out[i].MpsfChp = in[i].M; 203 out[i].dMpsfChp = in[i].dM; 204 203 205 out[i].Ncode = in[i].Ncode; 204 206 out[i].Nused = in[i].Nused; … … 217 219 for (i = 0; i < Nvalues; i++) { 218 220 219 out[i].M = in[i].M; 220 out[i].dM = in[i].dM; 221 out[i].M = in[i].MpsfChp; 222 out[i].dM = in[i].dMpsfChp; 223 221 224 out[i].Ncode = in[i].Ncode; 222 225 out[i].Nused = in[i].Nused; … … 320 323 out[i].apmifit = in[i].apmifit; 321 324 out[i].dapmifit = in[i].dapmifit; 322 out[i].Mcal = in[i].Mcal; 325 326 out[i].McalPSF = in[i].Mcal; 327 out[i].McalAPER = in[i].Mcal; 323 328 out[i].dMcal = in[i].dMcal; 324 out[i].Xm = in[i].Xm; 329 out[i].McalChiSq = pow(10.0, 0.01*in[i].Xm); 330 325 331 out[i].photcode = in[i].photcode; 326 332 out[i].exptime = in[i].exptime; … … 386 392 out[i].apmifit = in[i].apmifit; 387 393 out[i].dapmifit = in[i].dapmifit; 388 out[i].Mcal = in[i].Mcal; 394 395 out[i].Mcal = in[i].McalPSF; 389 396 out[i].dMcal = in[i].dMcal; 390 out[i].Xm = in[i].Xm; 397 out[i].Xm = 100.0*log10(in[i].McalChiSq); 398 391 399 out[i].photcode = in[i].photcode; 392 400 out[i].exptime = in[i].exptime; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c
r39457 r40291 17 17 out[i].D = ave[averef].D - in[i].dD / 3600.0; 18 18 out[i].M = in[i].M; 19 out[i].Mcal = in[i].Mcal; 19 out[i].McalPSF = in[i].Mcal; 20 out[i].McalAPER = in[i].Mcal; 20 21 out[i].Map = in[i].Map; 21 22 out[i].dM = in[i].dM; … … 71 72 out[i].dD = 3600.0*(ave[averef].D - in[i].D); 72 73 out[i].M = in[i].M; 73 out[i].Mcal = in[i].Mcal ;74 out[i].Mcal = in[i].McalPSF; 74 75 out[i].Map = in[i].Map; 75 76 out[i].dM = in[i].dM; … … 197 198 dvo_secfilt_init (&out[i], SECFILT_RESET_ALL); 198 199 199 out[i].M = in[i].M; 200 out[i].dM = in[i].dM; 200 out[i].MpsfChp = in[i].M; 201 out[i].dMpsfChp = in[i].dM; 202 201 203 out[i].Mchisq= in[i].Mchisq; 202 204 out[i].Ncode = in[i].Ncode; … … 216 218 217 219 for (i = 0; i < Nvalues; i++) { 218 out[i].M = in[i].M; 219 out[i].dM = in[i].dM; 220 out[i].M = in[i].MpsfChp; 221 out[i].dM = in[i].dMpsfChp; 222 220 223 out[i].Mchisq= in[i].Mchisq; 221 224 out[i].Ncode = in[i].Ncode; … … 256 259 out[i].apmifit = in[i].apmifit; 257 260 out[i].dapmifit = in[i].dapmifit; 258 out[i].Mcal = in[i].Mcal; 261 262 out[i].McalPSF = in[i].Mcal; 263 out[i].McalAPER = in[i].Mcal; 259 264 out[i].dMcal = in[i].dMcal; 260 out[i].Xm = in[i].Xm; 265 out[i].McalChiSq = pow(10.0, 0.01*in[i].Xm); 266 261 267 out[i].photcode = in[i].photcode; 262 268 out[i].exptime = in[i].exptime; … … 321 327 out[i].apmifit = in[i].apmifit; 322 328 out[i].dapmifit = in[i].dapmifit; 323 out[i].Mcal = in[i].Mcal; 329 330 out[i].Mcal = in[i].McalPSF; 324 331 out[i].dMcal = in[i].dMcal; 325 out[i].Xm = in[i].Xm; 332 out[i].Xm = 100.0*log10(in[i].McalChiSq); 333 326 334 out[i].photcode = in[i].photcode; 327 335 out[i].exptime = in[i].exptime; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c
r39457 r40291 17 17 out[i].D = ave[averef].D - in[i].dD / 3600.0; 18 18 out[i].M = in[i].M; 19 out[i].Mcal = in[i].Mcal; 19 out[i].McalPSF = in[i].Mcal; 20 out[i].McalAPER = in[i].Mcal; 20 21 out[i].Map = in[i].Map; 21 22 out[i].dM = in[i].dM; … … 72 73 out[i].dD = 3600.0*(ave[averef].D - in[i].D); 73 74 out[i].M = in[i].M; 74 out[i].Mcal = in[i].Mcal ;75 out[i].Mcal = in[i].McalPSF; 75 76 out[i].Map = in[i].Map; 76 77 out[i].dM = in[i].dM; … … 206 207 dvo_secfilt_init (&out[i], SECFILT_RESET_ALL); 207 208 208 out[i].M = in[i].M; 209 out[i].dM = in[i].dM; 209 out[i].MpsfChp = in[i].M; 210 out[i].dMpsfChp = in[i].dM; 211 210 212 out[i].Mchisq= in[i].Mchisq; 211 213 out[i].flags = in[i].flags; … … 226 228 227 229 for (i = 0; i < Nvalues; i++) { 228 out[i].M = in[i].M; 229 out[i].dM = in[i].dM; 230 out[i].M = in[i].MpsfChp; 231 out[i].dM = in[i].dMpsfChp; 232 230 233 out[i].Mchisq= in[i].Mchisq; 231 234 out[i].flags = in[i].flags; … … 267 270 out[i].apmifit = in[i].apmifit; 268 271 out[i].dapmifit = in[i].dapmifit; 269 out[i].Mcal = in[i].Mcal; 272 273 out[i].McalPSF = in[i].Mcal; 274 out[i].McalAPER = in[i].Mcal; 270 275 out[i].dMcal = in[i].dMcal; 271 out[i].Xm = in[i].Xm; 276 out[i].McalChiSq = pow(10.0, 0.01*in[i].Xm); 277 272 278 out[i].photcode = in[i].photcode; 273 279 out[i].exptime = in[i].exptime; … … 332 338 out[i].apmifit = in[i].apmifit; 333 339 out[i].dapmifit = in[i].dapmifit; 334 out[i].Mcal = in[i].Mcal; 340 341 out[i].Mcal = in[i].McalPSF; 335 342 out[i].dMcal = in[i].dMcal; 336 out[i].Xm = in[i].Xm; 343 out[i].Xm = 100.0*log10(in[i].McalChiSq); 344 337 345 out[i].photcode = in[i].photcode; 338 346 out[i].exptime = in[i].exptime; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V3.c
r39457 r40291 17 17 out[i].D = ave[averef].D - in[i].dD / 3600.0; 18 18 out[i].M = in[i].M; 19 out[i].Mcal = in[i].Mcal; 19 out[i].McalPSF = in[i].Mcal; 20 out[i].McalAPER = in[i].Mcal; 20 21 out[i].Map = in[i].Map; 21 22 out[i].dM = in[i].dM; … … 72 73 out[i].dD = 3600.0*(ave[averef].D - in[i].D); 73 74 out[i].M = in[i].M; 74 out[i].Mcal = in[i].Mcal ;75 out[i].Mcal = in[i].McalPSF; 75 76 out[i].Map = in[i].Map; 76 77 out[i].dM = in[i].dM; … … 210 211 dvo_secfilt_init (&out[i], SECFILT_RESET_ALL); 211 212 212 out[i].M = in[i].M; 213 out[i].Map = in[i].Map; 214 out[i].dM = in[i].dM; 213 out[i].MpsfChp = in[i].M; 214 out[i].sMpsfChp = in[i].Mstdev; 215 out[i].dMpsfChp = in[i].dM; 216 out[i].MapChp = in[i].Map; 217 215 218 out[i].Mchisq = in[i].Mchisq; 216 219 out[i].flags = in[i].flags; … … 219 222 out[i].Mmin = in[i].M_20*0.001; 220 223 out[i].Mmax = in[i].M_80*0.001; 221 out[i].Mstdev = in[i].Mstdev;222 224 out[i].ubercalDist = in[i].ubercalDist; 223 225 } … … 233 235 234 236 for (i = 0; i < Nvalues; i++) { 235 out[i].M = in[i].M; 236 out[i].Map = in[i].Map; 237 out[i].dM = in[i].dM; 237 out[i].M = in[i].MpsfChp; 238 out[i].dM = in[i].dMpsfChp; 239 out[i].Mstdev = in[i].sMpsfChp; 240 out[i].Map = in[i].MapChp; 241 238 242 out[i].Mchisq = in[i].Mchisq; 239 243 out[i].flags = in[i].flags; … … 242 246 out[i].M_20 = in[i].Mmin*1000.0; 243 247 out[i].M_80 = in[i].Mmax*1000.0; 244 out[i].Mstdev = in[i].Mstdev;245 248 out[i].ubercalDist = in[i].ubercalDist; 246 249 } … … 277 280 out[i].apmifit = in[i].apmifit; 278 281 out[i].dapmifit = in[i].dapmifit; 279 out[i].Mcal = in[i].Mcal; 282 283 out[i].McalPSF = in[i].Mcal; 284 out[i].McalAPER = in[i].Mcal; 280 285 out[i].dMcal = in[i].dMcal; 281 out[i].Xm = in[i].Xm; 286 out[i].McalChiSq = pow(10.0, 0.01*in[i].Xm); 287 282 288 out[i].photcode = in[i].photcode; 283 289 out[i].exptime = in[i].exptime; … … 342 348 out[i].apmifit = in[i].apmifit; 343 349 out[i].dapmifit = in[i].dapmifit; 344 out[i].Mcal = in[i].Mcal; 350 351 out[i].Mcal = in[i].McalPSF; 345 352 out[i].dMcal = in[i].dMcal; 346 out[i].Xm = in[i].Xm; 353 out[i].Xm = 100.0*log10(in[i].McalChiSq); 354 347 355 out[i].photcode = in[i].photcode; 348 356 out[i].exptime = in[i].exptime; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c
r39457 r40291 17 17 out[i].D = ave[averef].D - in[i].dD / 3600.0; 18 18 out[i].M = in[i].M; 19 out[i].Mcal = in[i].Mcal; 19 out[i].McalPSF = in[i].Mcal; 20 out[i].McalAPER = in[i].Mcal; 20 21 out[i].Map = in[i].Map; 21 22 out[i].Mkron = in[i].Mkron; … … 81 82 out[i].dD = 3600.0*(ave[averef].D - in[i].D); 82 83 out[i].M = in[i].M; 83 out[i].Mcal = in[i].Mcal ;84 out[i].Mcal = in[i].McalPSF; 84 85 out[i].Map = in[i].Map; 85 86 out[i].Mkron = in[i].Mkron; … … 234 235 dvo_secfilt_init (&out[i], SECFILT_RESET_ALL); 235 236 236 out[i].M = in[i].M; 237 out[i].Map = in[i].Map; 238 out[i].Mkron = in[i].Mkron; 239 out[i].dMkron = in[i].dMkron; 240 out[i].dM = in[i].dM; 237 out[i].MpsfChp = in[i].M; 238 out[i].sMpsfChp = in[i].Mstdev; 239 out[i].dMpsfChp = in[i].dM; 240 out[i].MapChp = in[i].Map; 241 out[i].MkronChp = in[i].Mkron; 242 241 243 out[i].Mchisq = in[i].Mchisq; 242 244 out[i].FpsfStk = in[i].FluxPSF; … … 249 251 out[i].Mmin = in[i].M_20*0.001; 250 252 out[i].Mmax = in[i].M_80*0.001; 251 out[i].Mstdev = in[i].Mstdev;252 253 out[i].ubercalDist = in[i].ubercalDist; 253 254 out[i].stackPrmryOff = in[i].stackPrmryOff; … … 265 266 266 267 for (i = 0; i < Nvalues; i++) { 267 out[i].M = in[i].M; 268 out[i].Map = in[i].Map; 269 out[i].Mkron = in[i].Mkron; 270 out[i].dMkron = in[i].dMkron; 271 out[i].dM = in[i].dM; 268 out[i].M = in[i].MpsfChp; 269 out[i].dM = in[i].dMpsfChp; 270 out[i].Mstdev = in[i].sMpsfChp; 271 out[i].Map = in[i].MapChp; 272 out[i].Mkron = in[i].MkronChp; 273 272 274 out[i].Mchisq = in[i].Mchisq; 273 275 out[i].FluxPSF = in[i].FpsfStk; … … 280 282 out[i].M_20 = in[i].Mmin*1000.0; 281 283 out[i].M_80 = in[i].Mmax*1000.0; 282 out[i].Mstdev = in[i].Mstdev;283 284 out[i].ubercalDist = in[i].ubercalDist; 284 285 out[i].stackPrmryOff = in[i].stackPrmryOff; … … 317 318 out[i].apmifit = in[i].apmifit; 318 319 out[i].dapmifit = in[i].dapmifit; 319 out[i].Mcal = in[i].Mcal; 320 321 out[i].McalPSF = in[i].Mcal; 322 out[i].McalAPER = in[i].Mcal; 320 323 out[i].dMcal = in[i].dMcal; 321 out[i].Xm = in[i].Xm; 324 out[i].McalChiSq = pow(10.0, 0.01*in[i].Xm); 325 322 326 out[i].photcode = in[i].photcode; 323 327 out[i].exptime = in[i].exptime; … … 382 386 out[i].apmifit = in[i].apmifit; 383 387 out[i].dapmifit = in[i].dapmifit; 384 out[i].Mcal = in[i].Mcal; 388 389 out[i].Mcal = in[i].McalPSF; 385 390 out[i].dMcal = in[i].dMcal; 386 out[i].Xm = in[i].Xm; 391 out[i].Xm = 100.0*log10(in[i].McalChiSq); 392 387 393 out[i].photcode = in[i].photcode; 388 394 out[i].exptime = in[i].exptime; … … 513 519 out[i].D = ave[averef].D - in[i].dD / 3600.0; 514 520 out[i].M = in[i].M; 515 out[i].Mcal = in[i].Mcal; 521 out[i].McalPSF = in[i].Mcal; 522 out[i].McalAPER = in[i].Mcal; 516 523 out[i].Map = in[i].Map; 517 524 out[i].Mkron = in[i].Mkron; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c
r39486 r40291 22 22 out[i].Mkron = in[i].Mkron; 23 23 out[i].dMkron = in[i].dMkron; 24 out[i].Mcal = in[i].Mcal; 24 out[i].McalPSF = in[i].Mcal; 25 out[i].McalAPER = in[i].Mcal; 25 26 out[i].dMcal = in[i].dMcal; 26 27 out[i].dt = in[i].dt; … … 96 97 out[i].Mkron = in[i].Mkron; 97 98 out[i].dMkron = in[i].dMkron; 98 out[i].Mcal = in[i].Mcal ;99 out[i].Mcal = in[i].McalPSF; 99 100 out[i].dMcal = in[i].dMcal; 100 101 out[i].dt = in[i].dt; … … 311 312 dvo_secfilt_init (&out[i], SECFILT_RESET_ALL); 312 313 313 out[i].M = in[i].M; 314 out[i].dM = in[i].dM; 315 out[i].Map = in[i].Map; 316 out[i].dMap = in[i].dMap; 317 out[i].sMap = in[i].sMap; 318 out[i].Mkron = in[i].Mkron; 319 out[i].dMkron = in[i].dMkron; 320 out[i].sMkron = in[i].sMkron; 314 out[i].MpsfChp = in[i].M; 315 out[i].sMpsfChp = in[i].Mstdev; 316 out[i].dMpsfChp = in[i].dM; 317 out[i].MapChp = in[i].Map; 318 out[i].dMapChp = in[i].dMap; 319 out[i].sMapChp = in[i].sMap; 320 out[i].MkronChp = in[i].Mkron; 321 out[i].dMkronChp = in[i].dMkron; 322 out[i].sMkronChp = in[i].sMkron; 321 323 322 324 out[i].psfQfMax = in[i].psfQfMax; 323 325 out[i].psfQfPerfMax = in[i].psfQfPerfMax; 324 326 325 out[i].Mstdev = in[i].Mstdev;326 327 out[i].Mmin = in[i].Mmin; 327 328 out[i].Mmax = in[i].Mmax; … … 389 390 for (i = 0; i < Nvalues; i++) { 390 391 391 out[i].M = in[i].M; 392 out[i].dM = in[i].dM; 393 out[i].Map = in[i].Map; 394 out[i].dMap = in[i].dMap; 395 out[i].sMap = in[i].sMap; 396 out[i].Mkron = in[i].Mkron; 397 out[i].dMkron = in[i].dMkron; 398 out[i].sMkron = in[i].sMkron; 392 out[i].M = in[i].MpsfChp; 393 out[i].dM = in[i].dMpsfChp; 394 out[i].Mstdev = in[i].sMpsfChp; 395 out[i].Map = in[i].MapChp; 396 out[i].dMap = in[i].dMapChp; 397 out[i].sMap = in[i].sMapChp; 398 out[i].Mkron = in[i].MkronChp; 399 out[i].dMkron = in[i].dMkronChp; 400 out[i].sMkron = in[i].sMkronChp; 399 401 400 402 out[i].psfQfMax = in[i].psfQfMax; 401 403 out[i].psfQfPerfMax = in[i].psfQfPerfMax; 402 404 403 out[i].Mstdev = in[i].Mstdev;404 405 out[i].Mmin = in[i].Mmin; 405 406 out[i].Mmax = in[i].Mmax; … … 1143 1144 out[i].apmifit = in[i].apmifit; 1144 1145 out[i].dapmifit = in[i].dapmifit; 1145 out[i].Mcal = in[i].Mcal; 1146 1147 out[i].McalPSF = in[i].Mcal; 1148 out[i].McalAPER = in[i].Mcal; 1146 1149 out[i].dMcal = in[i].dMcal; 1147 out[i].Xm = in[i].Xm; 1150 out[i].McalChiSq = pow(10.0, 0.01*in[i].Xm); 1151 1148 1152 out[i].photcode = in[i].photcode; 1149 1153 out[i].exptime = in[i].exptime; … … 1209 1213 out[i].apmifit = in[i].apmifit; 1210 1214 out[i].dapmifit = in[i].dapmifit; 1211 out[i].Mcal = in[i].Mcal; 1215 1216 out[i].Mcal = in[i].McalPSF; 1212 1217 out[i].dMcal = in[i].dMcal; 1213 out[i].Xm = in[i].Xm; 1218 out[i].Xm = 100.0*log10(in[i].McalChiSq); 1219 1214 1220 out[i].photcode = in[i].photcode; 1215 1221 out[i].exptime = in[i].exptime; … … 1495 1501 dvo_secfilt_init (&out[i], SECFILT_RESET_ALL); 1496 1502 1497 out[i].M = in[i].M; 1498 out[i].dM = in[i].dM; 1499 out[i].Map = in[i].Map; 1500 out[i].dMap = in[i].dMap; 1501 out[i].sMap = in[i].sMap; 1502 out[i].Mkron = in[i].Mkron; 1503 out[i].dMkron = in[i].dMkron; 1504 1505 out[i].Mstdev = in[i].Mstdev; 1503 out[i].MpsfChp = in[i].M; 1504 out[i].dMpsfChp = in[i].dM; 1505 out[i].sMpsfChp = in[i].Mstdev; 1506 out[i].MapChp = in[i].Map; 1507 out[i].dMapChp = in[i].dMap; 1508 out[i].sMapChp = in[i].sMap; 1509 out[i].MkronChp = in[i].Mkron; 1510 out[i].dMkronChp = in[i].dMkron; 1511 out[i].sMkronChp = in[i].sMkron; 1512 1506 1513 out[i].Mmin = in[i].Mmin; 1507 1514 out[i].Mmax = in[i].Mmax; … … 1668 1675 out[i].Mkron = in[i].Mkron; 1669 1676 out[i].dMkron = in[i].dMkron; 1670 out[i].Mcal = in[i].Mcal; 1677 out[i].McalPSF = in[i].Mcal; 1678 out[i].McalAPER = in[i].Mcal; 1671 1679 out[i].dMcal = in[i].dMcal; 1672 1680 out[i].dt = in[i].dt; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V5_LOAD.c
r40063 r40291 22 22 out[i].Mkron = in[i].Mkron; 23 23 out[i].dMkron = in[i].dMkron; 24 out[i].Mcal = in[i].Mcal; 24 out[i].McalPSF = in[i].Mcal; 25 out[i].McalAPER = in[i].Mcal; 25 26 out[i].dMcal = in[i].dMcal; 26 27 out[i].dt = in[i].dt; … … 96 97 out[i].Mkron = in[i].Mkron; 97 98 out[i].dMkron = in[i].dMkron; 98 out[i].Mcal = in[i].Mcal ;99 out[i].Mcal = in[i].McalPSF; 99 100 out[i].dMcal = in[i].dMcal; 100 101 out[i].dt = in[i].dt; … … 221 222 dvo_secfilt_init (&out[i], SECFILT_RESET_ALL); 222 223 223 out[i].M = in[i].M;224 out[i].MpsfChp = in[i].M; 224 225 out[i].Ncode = in[i].Ncode; 225 226 out[i].Nused = in[i].Nused; … … 237 238 for (i = 0; i < Nvalues; i++) { 238 239 239 out[i].M = in[i].M ;240 out[i].M = in[i].MpsfChp; 240 241 out[i].Ncode = in[i].Ncode; 241 242 out[i].Nused = in[i].Nused; … … 654 655 out[i].apmifit = in[i].apmifit; 655 656 out[i].dapmifit = in[i].dapmifit; 656 out[i].Mcal = in[i].Mcal; 657 658 out[i].McalPSF = in[i].Mcal; 659 out[i].McalAPER = in[i].Mcal; 657 660 out[i].dMcal = in[i].dMcal; 658 out[i].Xm = in[i].Xm; 661 out[i].McalChiSq = pow(10.0, 0.01*in[i].Xm); 662 659 663 out[i].photcode = in[i].photcode; 660 664 out[i].exptime = in[i].exptime; … … 720 724 out[i].apmifit = in[i].apmifit; 721 725 out[i].dapmifit = in[i].dapmifit; 722 out[i].Mcal = in[i].Mcal; 726 727 out[i].Mcal = in[i].McalPSF; 723 728 out[i].dMcal = in[i].dMcal; 724 out[i].Xm = in[i].Xm; 729 out[i].Xm = 100.0*log10(in[i].McalChiSq); 730 725 731 out[i].photcode = in[i].photcode; 726 732 out[i].exptime = in[i].exptime; -
trunk/Ohana/src/libdvo/src/dvo_convert_elixir.c
r38462 r40291 24 24 out[i].dM = (in[i].dM == NAN_U_CHAR) ? NAN : in[i].dM * 0.001; 25 25 out[i].dt = (in[i].dt == NAN_S_SHORT) ? NAN : in[i].dt * 0.001; 26 out[i].Mcal = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 26 out[i].McalPSF = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 27 out[i].McalAPER = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 27 28 out[i].Map = (in[i].Mgal == NAN_S_SHORT) ? NAN : in[i].Mgal * 0.001; 28 29 out[i].airmass = (in[i].airmass == NAN_S_SHORT) ? NAN : in[i].airmass* 0.001; … … 72 73 out[i].dM = isnan(in[i].dM ) ? NAN_U_CHAR : in[i].dM * 1000.0; 73 74 out[i].dt = isnan(in[i].dt ) ? NAN_S_SHORT : in[i].dt * 1000.0; 74 out[i].Mcal = isnan(in[i].Mcal ) ? NAN_S_SHORT : in[i].Mcal* 1000.0;75 out[i].Mcal = isnan(in[i].McalPSF) ? NAN_S_SHORT : in[i].McalPSF * 1000.0; 75 76 out[i].Mgal = isnan(in[i].Map ) ? NAN_S_SHORT : in[i].Map * 1000.0; 76 77 out[i].airmass = isnan(in[i].airmass) ? NAN_S_SHORT : in[i].airmass * 1000.0; … … 109 110 110 111 // changed for PANSTARRS_DEV_0 (moved from Average to Measure) 111 primary[0][i].M = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001;112 primary[0][i].dM = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM * 0.001;112 primary[0][i].MpsfChp = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001; 113 primary[0][i].dMpsfChp = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM * 0.001; 113 114 primary[0][i].Mchisq= pow (10.0, 0.01*in[i].Xm); 114 115 … … 142 143 143 144 // changed for PANSTARRS_DEV_0 (moved from Average to Measure) 144 out[i].M = isnan(primary[i].M ) ? NAN_S_SHORT : primary[i].M* 1000.0;145 out[i].dM = isnan(primary[i].dM ) ? NAN_S_SHORT : primary[i].dM* 1000.0;145 out[i].M = isnan(primary[i].MpsfChp) ? NAN_S_SHORT : primary[i].MpsfChp * 1000.0; 146 out[i].dM = isnan(primary[i].dMpsfChp) ? NAN_S_SHORT : primary[i].dMpsfChp * 1000.0; 146 147 out[i].Xm = 100.0*log10(primary[i].Mchisq); 147 148 … … 172 173 173 174 // added or changed for PANSTARRS_DEV_0 174 out[i].M = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001;175 out[i].dM = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM * 0.001;175 out[i].MpsfChp = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001; 176 out[i].dMpsfChp = (in[i].dM == NAN_S_SHORT) ? NAN : in[i].dM * 0.001; 176 177 } 177 178 return (out); … … 190 191 191 192 // added or changed for PANSTARRS_DEV_0 192 out[i].M = isnan(in[i].M ) ? NAN_S_SHORT : in[i].M* 1000.0;193 out[i].dM = isnan(in[i].dM ) ? NAN_S_SHORT : in[i].dM* 1000.0;193 out[i].M = isnan(in[i].MpsfChp) ? NAN_S_SHORT : in[i].MpsfChp * 1000.0; 194 out[i].dM = isnan(in[i].dMpsfChp) ? NAN_S_SHORT : in[i].dMpsfChp * 1000.0; 194 195 } 195 196 return (out); … … 223 224 out[i].NX = in[i].NX; 224 225 out[i].NY = in[i].NY; 225 out[i].Xm = in[i].Xm;226 226 out[i].photcode = in[i].source; 227 227 out[i].exptime = in[i].exptime; … … 252 252 out[i].apmifit = (in[i].apmifit == NAN_S_SHORT) ? NAN : in[i].apmifit * 0.001; 253 253 out[i].dapmifit = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001; 254 out[i].Mcal = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 254 255 out[i].McalPSF = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 256 out[i].McalAPER = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 255 257 out[i].dMcal = (in[i].dMcal == NAN_S_SHORT) ? NAN : in[i].dMcal * 0.001; 258 out[i].McalChiSq = (in[i].dMcal == NAN_S_SHORT) ? NAN : pow(10.0, 0.01*in[i].Xm); 259 256 260 out[i].sidtime = NAN; 257 261 out[i].latitude = NAN; … … 295 299 out[i].NY = in[i].NY; 296 300 297 out[i].Xm = in[i].Xm;298 301 out[i].source = in[i].photcode; 299 302 out[i].exptime = in[i].exptime; … … 324 327 out[i].apmifit = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit * 1000.0; 325 328 out[i].dapmifit = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0; 326 out[i].Mcal = isnan(in[i].Mcal ) ? NAN_S_SHORT : in[i].Mcal * 1000.0; 329 330 out[i].Mcal = isnan(in[i].McalPSF ) ? NAN_S_SHORT : in[i].McalPSF * 1000.0; 327 331 out[i].dMcal = isnan(in[i].dMcal ) ? NAN_S_SHORT : in[i].dMcal * 1000.0; 332 out[i].Xm = isnan(in[i].dMcal ) ? NAN_S_SHORT : 100.0*log10(in[i].McalChiSq); 328 333 329 334 // changed or added for PS1_V1 -
trunk/Ohana/src/libdvo/src/dvo_convert_loneos.c
r38462 r40291 26 26 out[i].M = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001; 27 27 out[i].dM = (in[i].dM == NAN_U_CHAR) ? NAN : in[i].dM * 0.001; 28 out[i].Mcal = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 28 out[i].McalPSF = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 29 out[i].McalAPER = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 29 30 out[i].Map = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001; 30 31 out[i].photcode = in[i].source; … … 59 60 out[i].M = isnan(in[i].M ) ? NAN_S_SHORT : in[i].M * 1000.0; 60 61 out[i].dM = isnan(in[i].dM ) ? NAN_U_CHAR : in[i].dM * 1000.0; 61 out[i].Mcal = isnan(in[i].Mcal ) ? NAN_S_SHORT : in[i].Mcal* 1000.0;62 out[i].Mcal = isnan(in[i].McalPSF) ? NAN_S_SHORT : in[i].McalPSF * 1000.0; 62 63 out[i].source = in[i].photcode; 63 64 out[i].t = in[i].t; … … 89 90 90 91 // changed for PANSTARRS_DEV_0 (moved from Average to Measure) 91 primary[0][i].M = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001;92 primary[0][i].Mchisq = pow (10.0, 0.01*in[i].Xm);92 primary[0][i].MpsfChp = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001; 93 primary[0][i].Mchisq = pow (10.0, 0.01*in[i].Xm); 93 94 94 95 // added for PANSTARRS_DEV_0 … … 123 124 124 125 // changed for PANSTARRS_DEV_0 (moved from Average to Measure) 125 out[i].M = isnan(primary[i].M ) ? NAN_S_SHORT : primary[i].M* 1000.0;126 out[i].M = isnan(primary[i].MpsfChp) ? NAN_S_SHORT : primary[i].MpsfChp * 1000.0; 126 127 out[i].Xm = 100.0*log10(primary[i].Mchisq); 127 128 … … 152 153 153 154 // added or changed for PANSTARRS_DEV_0 154 out[i].M = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001;155 out[i].MpsfChp = (in[i].M == NAN_S_SHORT) ? NAN : in[i].M * 0.001; 155 156 } 156 157 return (out); … … 169 170 170 171 // added or changed for PANSTARRS_DEV_0 171 out[i].M = isnan(in[i].M ) ? NAN_S_SHORT : in[i].M* 1000.0;172 out[i].M = isnan(in[i].MpsfChp) ? NAN_S_SHORT : in[i].MpsfChp * 1000.0; 172 173 } 173 174 return (out); … … 202 203 out[i].NY = in[i].NY; 203 204 204 out[i].Xm = in[i].Xm;205 205 out[i].photcode = in[i].source; 206 206 out[i].exptime = in[i].exptime; … … 231 231 out[i].apmifit = (in[i].apmifit == NAN_S_SHORT) ? NAN : in[i].apmifit * 0.001; 232 232 out[i].dapmifit = (in[i].dapmifit == NAN_S_SHORT) ? NAN : in[i].dapmifit * 0.001; 233 out[i].Mcal = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 233 234 out[i].McalPSF = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 235 out[i].McalAPER = (in[i].Mcal == NAN_S_SHORT) ? NAN : in[i].Mcal * 0.001; 234 236 out[i].dMcal = (in[i].dMcal == NAN_S_SHORT) ? NAN : in[i].dMcal * 0.001; 237 out[i].McalChiSq = (in[i].dMcal == NAN_S_SHORT) ? NAN : pow(10.0, 0.01*in[i].Xm); 238 235 239 out[i].sidtime = NAN; 236 240 out[i].latitude = NAN; … … 274 278 out[i].NY = in[i].NY; 275 279 276 out[i].Xm = in[i].Xm;277 280 out[i].source = in[i].photcode; 278 281 out[i].exptime = in[i].exptime; … … 303 306 out[i].apmifit = isnan(in[i].apmifit ) ? NAN_S_SHORT : in[i].apmifit * 1000.0; 304 307 out[i].dapmifit = isnan(in[i].dapmifit) ? NAN_S_SHORT : in[i].dapmifit * 1000.0; 305 out[i].Mcal = isnan(in[i].Mcal ) ? NAN_S_SHORT : in[i].Mcal * 1000.0; 308 309 out[i].Mcal = isnan(in[i].McalPSF ) ? NAN_S_SHORT : in[i].McalPSF * 1000.0; 306 310 out[i].dMcal = isnan(in[i].dMcal ) ? NAN_S_SHORT : in[i].dMcal * 1000.0; 311 out[i].Xm = isnan(in[i].dMcal ) ? NAN_S_SHORT : 100.0*log10(in[i].McalChiSq); 307 312 308 313 // changed or added for PS1_V1 -
trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c
r39457 r40291 17 17 out[i].M = in[i].M; 18 18 out[i].dM = in[i].dM; 19 out[i].Mcal = in[i].Mcal; 19 out[i].McalPSF = in[i].Mcal; 20 out[i].McalAPER = in[i].Mcal; 20 21 21 22 out[i].airmass = in[i].airmass; … … 68 69 out[i].M = in[i].M; 69 70 out[i].dM = in[i].dM; 70 out[i].Mcal = in[i].Mcal ;71 out[i].Mcal = in[i].McalPSF; 71 72 out[i].airmass = in[i].airmass; 72 73 out[i].az = in[i].az; … … 188 189 dvo_secfilt_init (&out[i], SECFILT_RESET_ALL); 189 190 190 out[i].M = in[i].M; 191 out[i].dM = in[i].dM; 191 out[i].MpsfChp = in[i].M; 192 out[i].dMpsfChp = in[i].dM; 193 192 194 out[i].Mchisq= pow (10.0, 0.01*in[i].Xm); 193 195 out[i].Ncode = in[i].Ncode; … … 206 208 207 209 for (i = 0; i < Nvalues; i++) { 208 out[i].M = in[i].M; 209 out[i].dM = in[i].dM; 210 out[i].M = in[i].MpsfChp; 211 out[i].dM = in[i].dMpsfChp; 212 210 213 out[i].Xm = 100.0*log10(in[i].Mchisq); 211 214 out[i].Ncode = in[i].Ncode; … … 245 248 out[i].apmifit = in[i].apmifit; 246 249 out[i].dapmifit = in[i].dapmifit; 247 out[i].Mcal = in[i].Mcal; 250 251 out[i].McalPSF = in[i].Mcal; 252 out[i].McalAPER = in[i].Mcal; 248 253 out[i].dMcal = in[i].dMcal; 249 out[i].Xm = in[i].Xm; 254 out[i].McalChiSq = pow(10.0, 0.01*in[i].Xm); 255 250 256 out[i].photcode = in[i].photcode; 251 257 out[i].exptime = in[i].exptime; … … 316 322 out[i].apmifit = in[i].apmifit; 317 323 out[i].dapmifit = in[i].dapmifit; 318 out[i].Mcal = in[i].Mcal; 324 325 out[i].Mcal = in[i].McalPSF; 319 326 out[i].dMcal = in[i].dMcal; 320 out[i].Xm = in[i].Xm; 327 out[i].Xm = 100.0*log10(in[i].McalChiSq); 328 321 329 out[i].photcode = in[i].photcode; 322 330 out[i].exptime = in[i].exptime; -
trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c
r39457 r40291 17 17 out[i].M = in[i].M; 18 18 out[i].dM = in[i].dM; 19 out[i].Mcal = in[i].Mcal; 19 out[i].McalPSF = in[i].Mcal; 20 out[i].McalAPER = in[i].Mcal; 20 21 21 22 out[i].airmass = in[i].airmass; … … 68 69 out[i].M = in[i].M; 69 70 out[i].dM = in[i].dM; 70 out[i].Mcal = in[i].Mcal ;71 out[i].Mcal = in[i].McalPSF; 71 72 out[i].airmass = in[i].airmass; 72 73 out[i].az = in[i].az; … … 188 189 dvo_secfilt_init (&out[i], SECFILT_RESET_ALL); 189 190 190 out[i].M = in[i].M; 191 out[i].dM = in[i].dM; 191 out[i].MpsfChp = in[i].M; 192 out[i].dMpsfChp = in[i].dM; 193 192 194 out[i].Mchisq= pow (10.0, 0.01*in[i].Xm); 193 195 out[i].Ncode = in[i].Ncode; … … 206 208 207 209 for (i = 0; i < Nvalues; i++) { 208 out[i].M = in[i].M; 209 out[i].dM = in[i].dM; 210 out[i].M = in[i].MpsfChp; 211 out[i].dM = in[i].dMpsfChp; 212 210 213 out[i].Xm = 100.0*log10(in[i].Mchisq); 211 214 out[i].Ncode = in[i].Ncode; … … 245 248 out[i].apmifit = in[i].apmifit; 246 249 out[i].dapmifit = in[i].dapmifit; 247 out[i].Mcal = in[i].Mcal; 250 251 out[i].McalPSF = in[i].Mcal; 252 out[i].McalAPER = in[i].Mcal; 248 253 out[i].dMcal = in[i].dMcal; 249 out[i].Xm = in[i].Xm; 254 out[i].McalChiSq = pow(10.0, 0.01*in[i].Xm); 255 250 256 out[i].photcode = in[i].photcode; 251 257 out[i].exptime = in[i].exptime; … … 316 322 out[i].apmifit = in[i].apmifit; 317 323 out[i].dapmifit = in[i].dapmifit; 318 out[i].Mcal = in[i].Mcal; 324 325 out[i].Mcal = in[i].McalPSF; 319 326 out[i].dMcal = in[i].dMcal; 320 out[i].Xm = in[i].Xm; 327 out[i].Xm = 100.0*log10(in[i].McalChiSq); 328 321 329 out[i].photcode = in[i].photcode; 322 330 out[i].exptime = in[i].exptime; -
trunk/Ohana/src/libdvo/src/dvo_image.c
r40063 r40291 223 223 if (db[0].format == DVO_FORMAT_PS1_V4) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_V4"); 224 224 if (db[0].format == DVO_FORMAT_PS1_V5) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_V5"); 225 if (db[0].format == DVO_FORMAT_PS1_V6) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_V6"); 225 226 if (db[0].format == DVO_FORMAT_PS1_V5_LOAD) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_V5_LOAD"); 226 227 if (db[0].format == DVO_FORMAT_PS1_REF) gfits_modify (&db[0].header, "FORMAT", "%s", 1, "PS1_REF"); … … 256 257 int start_size = header->datasize; 257 258 258 long A = time(NULL); 259 int PID = getpid(); 260 long A = PID + time(NULL); 259 261 srand48(A); 260 262 … … 321 323 gfits_define_bintable_column (header, "E", "APMIFIT", "aperture correction", "mag", 1.0, 0.0); 322 324 gfits_define_bintable_column (header, "E", "DAPMIFIT", "apmifit error", "mag", 1.0, 0.0); 323 gfits_define_bintable_column (header, "E", "MCAL", "calibration mag", "mag", 1.0, 0.0); 325 gfits_define_bintable_column (header, "E", "MCAL_PSF", "calibration mag for psfs", "mag", 1.0, 0.0); 326 gfits_define_bintable_column (header, "E", "MCAL_APER", "calibration mag for aper", "mag", 1.0, 0.0); 324 327 gfits_define_bintable_column (header, "E", "DMCAL", "error on Mcal", "mag", 1.0, 0.0); 325 gfits_define_bintable_column (header, "I", "XM", "image chisq", "10*log(value)", 1.0, 0.0); 328 gfits_define_bintable_column (header, "E", "XM", "image chisq", "10*log(value)", 1.0, 0.0); 329 gfits_define_bintable_column (header, "I", "PADDING", "filler for 8-byte boundaries,", "", 1.0, 0.0); 326 330 gfits_define_bintable_column (header, "I", "PHOTCODE", "identifier for CCD,", "", 1.0, 0.0); 327 331 gfits_define_bintable_column (header, "E", "EXPTIME", "exposure time", "seconds", 1.0, 0.0); -
trunk/Ohana/src/libdvo/src/dvo_image_raw.c
r40063 r40291 60 60 if (db[0].format == DVO_FORMAT_PS1_V4) ImageSize = sizeof(Image_PS1_V4); 61 61 if (db[0].format == DVO_FORMAT_PS1_V5) ImageSize = sizeof(Image_PS1_V5); 62 if (db[0].format == DVO_FORMAT_PS1_V6) ImageSize = sizeof(Image_PS1_V6); 62 63 if (db[0].format == DVO_FORMAT_PS1_V5_LOAD) ImageSize = sizeof(Image_PS1_V5_LOAD); 63 64 if (db[0].format == DVO_FORMAT_PS1_REF) ImageSize = sizeof(Image_PS1_REF); … … 93 94 if (db[0].format == DVO_FORMAT_PS1_V4) gfits_table_mkheader_Image_PS1_V4 (&db[0].theader); 94 95 if (db[0].format == DVO_FORMAT_PS1_V5) gfits_table_mkheader_Image_PS1_V5 (&db[0].theader); 96 if (db[0].format == DVO_FORMAT_PS1_V6) gfits_table_mkheader_Image_PS1_V6 (&db[0].theader); 95 97 if (db[0].format == DVO_FORMAT_PS1_V5_LOAD) gfits_table_mkheader_Image_PS1_V5_LOAD (&db[0].theader); 96 98 if (db[0].format == DVO_FORMAT_PS1_REF) gfits_table_mkheader_Image_PS1_REF (&db[0].theader); -
trunk/Ohana/src/libdvo/src/dvo_photcode_ops.c
r39670 r40291 381 381 382 382 float Mraw = NAN; 383 float Mcal = NAN; 383 384 switch (class) { 384 385 case MAG_CLASS_PSF: 385 386 Mraw = measure[0].M; 387 Mcal = measure[0].McalPSF; 386 388 break; 387 389 case MAG_CLASS_KRON: 388 390 Mraw = measure[0].Mkron; 391 Mcal = measure[0].McalAPER; 389 392 break; 390 393 case MAG_CLASS_APER: 391 394 Mraw = measure[0].Map; 395 Mcal = measure[0].McalAPER; 392 396 break; 393 397 default: … … 398 402 } 399 403 float Mflat = isfinite(measure[0].Mflat) ? measure[0].Mflat : 0.0; 400 float Mcat = Mraw - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure[0].Mcal - Mflat;404 float Mcat = Mraw - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - Mcal - Mflat; 401 405 402 406 /* for DEP, color must be made of PRI/SEC */ … … 479 483 switch (class) { 480 484 case MAG_CLASS_PSF: 481 Mave = secfilt[Ns].M ;485 Mave = secfilt[Ns].MpsfChp; 482 486 break; 483 487 case MAG_CLASS_KRON: 484 Mave = secfilt[Ns].Mkron ;488 Mave = secfilt[Ns].MkronChp; 485 489 break; 486 490 case MAG_CLASS_APER: 487 Mave = secfilt[Ns].Map ;491 Mave = secfilt[Ns].MapChp; 488 492 break; 489 493 default: … … 592 596 switch (class) { 593 597 case MAG_CLASS_PSF: 594 dMave = secfilt[Ns].dM ;598 dMave = secfilt[Ns].dMpsfChp; 595 599 break; 596 600 case MAG_CLASS_KRON: 597 dMave = secfilt[Ns].dMkron ;601 dMave = secfilt[Ns].dMkronChp; 598 602 break; 599 603 case MAG_CLASS_APER: 600 dMave = secfilt[Ns].dMap ;604 dMave = secfilt[Ns].dMapChp; 601 605 break; 602 606 default: … … 677 681 Ns2 = photcodes[0].hashNsec[code[0].c2]; 678 682 679 m1 = (Ns1 == -1) ? NAN : secfilt[Ns1].M ;680 m2 = (Ns2 == -1) ? NAN : secfilt[Ns2].M ;683 m1 = (Ns1 == -1) ? NAN : secfilt[Ns1].MpsfChp; 684 m2 = (Ns2 == -1) ? NAN : secfilt[Ns2].MpsfChp; 681 685 mc = (isnan(m1) || isnan(m2)) ? NAN : (m1 - m2); 682 686 return (mc); … … 694 698 } else { 695 699 Ns = photcodes[0].hashNsec[color[0].code]; 696 m1 = (Ns == -1) ? NAN : secfilt[Ns].M ;700 m1 = (Ns == -1) ? NAN : secfilt[Ns].MpsfChp; 697 701 } 698 702 … … 708 712 } else { 709 713 Ns = photcodes[0].hashNsec[color[0].code]; 710 m2 = (Ns == -1) ? NAN : secfilt[Ns].M ;714 m2 = (Ns == -1) ? NAN : secfilt[Ns].MpsfChp; 711 715 } 712 716 mc = (isnan(m1) || isnan(m2)) ? NAN : (m1 - m2); … … 727 731 switch (class) { 728 732 case MAG_CLASS_PSF: 729 Mstdev = secfilt[Ns]. Mstdev;733 Mstdev = secfilt[Ns].sMpsfChp; 730 734 break; 731 735 case MAG_CLASS_KRON: 732 Mstdev = secfilt[Ns].sMkron ;736 Mstdev = secfilt[Ns].sMkronChp; 733 737 break; 734 738 case MAG_CLASS_APER: 735 Mstdev = secfilt[Ns].sMap ;739 Mstdev = secfilt[Ns].sMapChp; 736 740 break; 737 741 default: … … 1040 1044 } else { 1041 1045 Ns = photcodes[0].hashNsec[code[0].code]; 1042 M1 = (Ns == -1) ? NAN : secfilt[Ns].M ;1046 M1 = (Ns == -1) ? NAN : secfilt[Ns].MpsfChp; 1043 1047 } 1044 1048 … … 1056 1060 } else { 1057 1061 Ns = photcodes[0].hashNsec[code[0].code]; 1058 M2 = (Ns == -1) ? NAN : secfilt[Ns].M ;1062 M2 = (Ns == -1) ? NAN : secfilt[Ns].MpsfChp; 1059 1063 } 1060 1064 … … 1130 1134 1131 1135 // measure.M has the static ZERO_POINT (25.0) applied, but not measure.Flux 1132 float M cal= code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;1133 float Moff = M cal- ZERO_POINT + 8.9;1134 float Foff = 3630.8 * MagToFlux(M cal);1136 float Mzpt = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C; 1137 float Moff = Mzpt - ZERO_POINT + 8.9; 1138 float Foff = 3630.8 * MagToFlux(Mzpt); 1135 1139 float Fcat = NAN; 1136 1140 switch (class) { … … 1158 1162 1159 1163 // measure.M has the static ZERO_POINT (25.0) applied, but not measure.Flux 1160 float M cal= code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;1161 float Moff = M cal- ZERO_POINT + 8.9;1162 float Foff = 3630.8 * MagToFlux(M cal);1164 float Mzpt = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C; 1165 float Moff = Mzpt - ZERO_POINT + 8.9; 1166 float Foff = 3630.8 * MagToFlux(Mzpt); 1163 1167 float Fcat = NAN; 1164 1168 switch (class) { … … 1203 1207 1204 1208 // measure.M has the static ZERO_POINT (25.0) applied, but not measure.Flux 1209 1210 // use Mcal APER for aperture-like data 1211 float Mcal = (class == MAG_CLASS_PSF) ? measure[0].McalPSF : measure[0].McalAPER; 1205 1212 float Mflat = isfinite(measure[0].Mflat) ? measure[0].Mflat : 0.0; 1206 float Mcal = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure[0].Mcal - Mflat; 1207 float Moff = Mcal - ZERO_POINT + 8.9; 1208 float Foff = 3630.8 * MagToFlux(Mcal); 1213 1214 float Mzpt = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - Mcal - Mflat; 1215 float Moff = Mzpt - ZERO_POINT + 8.9; 1216 float Foff = 3630.8 * MagToFlux(Mzpt); 1209 1217 float Fcat = NAN; 1210 1218 switch (class) { … … 1289 1297 switch (class) { 1290 1298 case MAG_CLASS_PSF: 1291 Fave = MagToFlux(secfilt[Ns].M - 8.9);1299 Fave = MagToFlux(secfilt[Ns].MpsfChp - 8.9); 1292 1300 break; 1293 1301 case MAG_CLASS_KRON: 1294 Fave = MagToFlux(secfilt[Ns].Mkron - 8.9);1302 Fave = MagToFlux(secfilt[Ns].MkronChp - 8.9); 1295 1303 break; 1296 1304 case MAG_CLASS_APER: 1297 Fave = MagToFlux(secfilt[Ns].Map - 8.9);1305 Fave = MagToFlux(secfilt[Ns].MapChp - 8.9); 1298 1306 break; 1299 1307 default: … … 1350 1358 switch (class) { 1351 1359 case MAG_CLASS_PSF: 1352 dFave = secfilt[Ns].dM * MagToFlux(secfilt[Ns].M- 8.9);1360 dFave = secfilt[Ns].dMpsfChp * MagToFlux(secfilt[Ns].MpsfChp - 8.9); 1353 1361 break; 1354 1362 case MAG_CLASS_KRON: 1355 dFave = secfilt[Ns].dMkron * MagToFlux(secfilt[Ns].Mkron- 8.9);1363 dFave = secfilt[Ns].dMkronChp * MagToFlux(secfilt[Ns].MkronChp - 8.9); 1356 1364 break; 1357 1365 case MAG_CLASS_APER: 1358 dFave = secfilt[Ns].dMap * MagToFlux(secfilt[Ns].Map - 8.9);1366 dFave = secfilt[Ns].dMapChp * MagToFlux(secfilt[Ns].MapChp - 8.9); 1359 1367 break; 1360 1368 default: … … 1470 1478 1471 1479 // measure.M has the static ZERO_POINT (25.0) applied, but not measure.Flux 1472 float M cal= code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;1473 float Moff = M cal- ZERO_POINT + 8.9;1474 float Foff = 3630.8 * MagToFlux(M cal);1480 float Mzpt = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C; 1481 float Moff = Mzpt - ZERO_POINT + 8.9; 1482 float Foff = 3630.8 * MagToFlux(Mzpt); 1475 1483 1476 1484 // use dFlux if we can, but use dMag if we must: … … 1516 1524 1517 1525 // measure.M has the static ZERO_POINT (25.0) applied, but not measure.Flux 1518 float M cal= code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;1519 float Moff = M cal- ZERO_POINT + 8.9;1520 float Foff = 3630.8 * MagToFlux(M cal);1526 float Mzpt = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C; 1527 float Moff = Mzpt - ZERO_POINT + 8.9; 1528 float Foff = 3630.8 * MagToFlux(Mzpt); 1521 1529 1522 1530 // use dFlux if we can, but use dMag if we must: … … 1579 1587 1580 1588 // measure.M has the static ZERO_POINT (25.0) applied, but not measure.Flux 1589 // XXX fix this too: 1581 1590 float Mflat = isfinite(measure[0].Mflat) ? measure[0].Mflat : 0.0; 1582 float Mcal = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure[0].Mcal - Mflat; 1583 float Moff = Mcal - ZERO_POINT + 8.9; 1584 float Foff = 3630.8 * MagToFlux(Mcal); 1591 float Mcal = (class == MAG_CLASS_PSF) ? measure[0].McalPSF : measure[0].McalAPER; 1592 1593 float Mzpt = code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - Mcal - Mflat; 1594 float Moff = Mzpt - ZERO_POINT + 8.9; 1595 float Foff = 3630.8 * MagToFlux(Mzpt); 1585 1596 1586 1597 // use dFlux if we can, but use dMag if we must: … … 1649 1660 break; 1650 1661 case MAG_CLASS_KRON: 1651 //Mraw = measure[0].Mkron;1662 Mraw = measure[0].Mkron; 1652 1663 break; 1653 1664 case MAG_CLASS_APER: 1654 // Mraw = measure[0].Map; 1665 // Mraw = measure[0].Map; // MeasureTiny does not have Map 1655 1666 break; 1656 1667 default: … … 1677 1688 break; 1678 1689 case MAG_CLASS_KRON: 1679 //Mraw = measure[0].Mkron;1690 Mraw = measure[0].Mkron; 1680 1691 break; 1681 1692 case MAG_CLASS_APER: 1682 // Mraw = measure[0].Map; 1693 // Mraw = measure[0].Map; // MeasureTiny does not have Map 1683 1694 break; 1684 1695 default: … … 1706 1717 break; 1707 1718 case MAG_CLASS_KRON: 1708 //Mraw = measure[0].Mkron;1719 Mraw = measure[0].Mkron; 1709 1720 break; 1710 1721 case MAG_CLASS_APER: 1711 // Mraw = measure[0].Map; 1722 // Mraw = measure[0].Map; // MeasureTiny does not have Map 1712 1723 break; 1713 1724 default: … … 1742 1753 1743 1754 float Mraw = NAN; 1755 float Mcal = NAN; 1744 1756 switch (class) { 1745 1757 case MAG_CLASS_PSF: 1746 1758 Mraw = measure[0].M; 1759 Mcal = measure[0].McalPSF; 1747 1760 break; 1748 1761 case MAG_CLASS_KRON: 1749 // Mraw = measure[0].Mkron; 1762 Mraw = measure[0].Mkron; 1763 Mcal = measure[0].McalAPER; 1750 1764 break; 1751 1765 case MAG_CLASS_APER: 1752 // Mraw = measure[0].Map; 1766 // Mraw = measure[0].Map; // MeasureTiny does not have Map 1767 // Mcal = measure[0].McalAPER; 1753 1768 break; 1754 1769 default: … … 1759 1774 } 1760 1775 float Mflat = isfinite(measure[0].Mflat) ? measure[0].Mflat : 0.0; 1761 float Mcat = Mraw - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - measure[0].Mcal - Mflat;1776 float Mcat = Mraw - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C - Mcal - Mflat; 1762 1777 1763 1778 /* for DEP, color must be made of PRI/SEC */ … … 1799 1814 break; 1800 1815 case MAG_CLASS_KRON: 1801 //Mraw = thisone[0].Mkron;1816 Mraw = thisone[0].Mkron; 1802 1817 break; 1803 1818 case MAG_CLASS_APER: 1804 // Mraw = thisone[0].Map; 1819 // Mraw = thisone[0].Map; // MeasureTiny does not have Map 1805 1820 break; 1806 1821 default: … … 1840 1855 switch (class) { 1841 1856 case MAG_CLASS_PSF: 1842 Mave = secfilt[Ns].M ;1857 Mave = secfilt[Ns].MpsfChp; 1843 1858 break; 1844 1859 case MAG_CLASS_KRON: 1845 Mave = secfilt[Ns].Mkron ;1860 Mave = secfilt[Ns].MkronChp; 1846 1861 break; 1847 1862 case MAG_CLASS_APER: 1848 Mave = secfilt[Ns].Map ;1863 Mave = secfilt[Ns].MapChp; 1849 1864 break; 1850 1865 default: … … 1927 1942 Ns2 = photcodes[0].hashNsec[code[0].c2]; 1928 1943 1929 m1 = (Ns1 == -1) ? NAN : secfilt[Ns1].M ;1930 m2 = (Ns2 == -1) ? NAN : secfilt[Ns2].M ;1944 m1 = (Ns1 == -1) ? NAN : secfilt[Ns1].MpsfChp; 1945 m2 = (Ns2 == -1) ? NAN : secfilt[Ns2].MpsfChp; 1931 1946 mc = (isnan(m1) || isnan(m2)) ? NAN : (m1 - m2); 1932 1947 return (mc); … … 1944 1959 } else { 1945 1960 Ns = photcodes[0].hashNsec[color[0].code]; 1946 m1 = (Ns == -1) ? NAN : secfilt[Ns].M ;1961 m1 = (Ns == -1) ? NAN : secfilt[Ns].MpsfChp; 1947 1962 } 1948 1963 … … 1958 1973 } else { 1959 1974 Ns = photcodes[0].hashNsec[color[0].code]; 1960 m2 = (Ns == -1) ? NAN : secfilt[Ns].M ;1975 m2 = (Ns == -1) ? NAN : secfilt[Ns].MpsfChp; 1961 1976 } 1962 1977 mc = (isnan(m1) || isnan(m2)) ? NAN : (m1 - m2); … … 1973 1988 1974 1989 Ns = photcodes[0].hashNsec[code[0].code]; 1975 dM = (Ns == -1) ? NAN : secfilt[Ns].dM ;1990 dM = (Ns == -1) ? NAN : secfilt[Ns].dMpsfChp; 1976 1991 return (dM); 1977 1992 } … … 2010 2025 } else { 2011 2026 Ns = photcodes[0].hashNsec[code[0].code]; 2012 M1 = (Ns == -1) ? NAN : secfilt[Ns].M ;2027 M1 = (Ns == -1) ? NAN : secfilt[Ns].MpsfChp; 2013 2028 } 2014 2029 … … 2026 2041 } else { 2027 2042 Ns = photcodes[0].hashNsec[code[0].code]; 2028 M2 = (Ns == -1) ? NAN : secfilt[Ns].M ;2043 M2 = (Ns == -1) ? NAN : secfilt[Ns].MpsfChp; 2029 2044 } 2030 2045 -
trunk/Ohana/src/libdvo/src/dvo_tiny_values.c
r39457 r40291 19 19 measureT[0].D = measure[0].D; 20 20 measureT[0].M = measure[0].M; 21 measureT[0].Mcal = measure[0].Mcal; 21 measureT[0].Mkron = measure[0].Mkron; 22 measureT[0].McalPSF = measure[0].McalPSF; 23 measureT[0].McalAPER = measure[0].McalAPER; 22 24 measureT[0].dM = measure[0].dM; 23 25 measureT[0].airmass = measure[0].airmass; -
trunk/Ohana/src/libohana/include/ohana.h
r39457 r40291 485 485 /* in bisection.c */ 486 486 int ohana_bisection_double (double *values, int Nvalues, double threshold); 487 int ohana_bisection_int (int *values, int Nvalues, int threshold); 487 488 488 489 unsigned int sprintf_float (char *output, float value); -
trunk/Ohana/src/libohana/include/ohana_sort.h
r38986 r40291 68 68 void fsort (float *value, int N); 69 69 void isort (int *value, int N); 70 void llsort (long long int *value, int N); 70 71 71 72 void dsortpair (double *X, double *Y, int N); -
trunk/Ohana/src/libohana/src/bisection.c
r38459 r40291 32 32 return (N); 33 33 } 34 35 // return the index of the last value < threshold 36 int ohana_bisection_int (int *values, int Nvalues, int threshold) { 37 38 int Nlo = 0; 39 int Nhi = Nvalues - 1; 40 41 if (Nvalues < 1) return (-1); 42 if (values[Nlo] > threshold) return (-1); 43 44 if (Nvalues < 2) return (0); 45 if (values[Nhi] < threshold) return (Nhi); 46 47 int N; 48 while (Nhi - Nlo > 4) { 49 N = 0.5*(Nlo + Nhi); 50 if (values[N] < threshold) { 51 Nlo = MAX(N, 0); 52 } else { 53 Nhi = MIN(N + 1, Nvalues - 1); 54 } 55 } 56 // values[Nlo] < threshold 57 // values[Nhi] >= threshold 58 59 for (N = Nlo; N < Nhi; N++) { 60 if (values[N] >= threshold) { 61 return (N-1); 62 } 63 } 64 return (N); 65 } -
trunk/Ohana/src/libohana/src/isolate_elements.c
r40013 r40291 171 171 // order matches convert_to_RPN.c 172 172 if (!strncmp (c, "?", 1)) return (TRUE); 173 if (!strncmp (c, ":", 1)) return (TRUE); 173 174 // if (!strncmp (c, ":", 1)) return (TRUE); 175 176 // do not include : in this list: an unisolated colon acts as a modifier 174 177 175 178 if (!strncmp (c, "^", 1)) return (TRUE); -
trunk/Ohana/src/libohana/src/sorts.c
r38986 r40291 30 30 31 31 # define SWAPFUNC(A,B){ int tmp = value[A]; value[A] = value[B]; value[B] = tmp; } 32 # define COMPARE(A,B)(value[A] < value[B]) 33 34 OHANA_SORT (N, COMPARE, SWAPFUNC); 35 36 # undef SWAPFUNC 37 # undef COMPARE 38 39 } 40 41 void llsort (long long int *value, int N) { 42 43 # define SWAPFUNC(A,B){ long long int tmp = value[A]; value[A] = value[B]; value[B] = tmp; } 32 44 # define COMPARE(A,B)(value[A] < value[B]) 33 45 -
trunk/Ohana/src/markrock/src/find_slow_rocks.c
r2490 r40291 69 69 RD_to_XY (&X1[j], &Y1[j], R1[j], D1[j], &catstats[0].coords); 70 70 T1[j] = catalog[0].measure[m+j].t; 71 M1[j] = catalog[0].measure[m+j].M - catalog[0].measure[m+j].Mcal ;71 M1[j] = catalog[0].measure[m+j].M - catalog[0].measure[m+j].McalPSF; 72 72 } 73 73 dt = T1[1] - T1[0]; … … 86 86 RD_to_XY (&X, &Y, R, D, &catstats[0].coords); 87 87 T = catalog[0].measure[m+j].t; 88 M = catalog[0].measure[m+j].M - catalog[0].measure[m+j].Mcal ;88 M = catalog[0].measure[m+j].M - catalog[0].measure[m+j].McalPSF; 89 89 if (T1[0] == T) continue; 90 90 if (T1[1] == T) continue; -
trunk/Ohana/src/opihi/cmd.astro/fitplx.c
r39610 r40291 77 77 double *dD = dDvec->elements.Flt; 78 78 79 int *mask = NULL;79 opihi_int *mask = NULL; 80 80 if (mvec) { 81 81 mask = mvec->elements.Int; … … 380 380 } 381 381 382 int PlxSetMeanEpoch (double *R, double *D, double *T, double *Rmean, double *Dmean, double *Tmean, int *mask, int Ntotal) {382 int PlxSetMeanEpoch (double *R, double *D, double *T, double *Rmean, double *Dmean, double *Tmean, opihi_int *mask, int Ntotal) { 383 383 384 384 int i; … … 413 413 414 414 // generate the fit values (projected X,Y; parallax factors; 415 int PlxSetEpochPosition (PlxFitData *fitdata, double *R, double *D, double *dR, double *dD, double *T, int *mask, int Ntotal, Coords *coords, double Tmean) {415 int PlxSetEpochPosition (PlxFitData *fitdata, double *R, double *D, double *dR, double *dD, double *T, opihi_int *mask, int Ntotal, Coords *coords, double Tmean) { 416 416 417 417 int i; … … 464 464 # define MAX_REJECT 0.1 465 465 466 int PlxOutlierClip (PlxFitData *fitdata, int *mask, int Noutlier, float dPsigMax, Vector *dPvec, int VERBOSE) {466 int PlxOutlierClip (PlxFitData *fitdata, opihi_int *mask, int Noutlier, float dPsigMax, Vector *dPvec, int VERBOSE) { 467 467 468 468 int i, n; -
trunk/Ohana/src/opihi/cmd.astro/fitplx_irls.c
r39926 r40291 81 81 double *dD = dDvec->elements.Flt; 82 82 83 int *mask = NULL;83 opihi_int *mask = NULL; 84 84 if (mvec) { 85 85 mask = mvec->elements.Int; … … 109 109 for (i = 0; (VERBOSE == 2) && (i < fitdata.Npts); i++) { 110 110 int n = fitdata.index[i]; 111 int maskValue = mask ? mask[n] : 1;112 fprintf (stderr, "%f %f : %f %d: %f %f %f\n", R[n], D[n], T[n], maskValue, fitdata.t[i], fitdata.X[i], fitdata.Y[i]);111 opihi_int maskValue = mask ? mask[n] : 1; 112 fprintf (stderr, "%f %f : %f "OPIHI_INT_FMT" : %f %f %f\n", R[n], D[n], T[n], maskValue, fitdata.t[i], fitdata.X[i], fitdata.Y[i]); 113 113 } 114 114 … … 150 150 151 151 if (VERBOSE == 2) { 152 fprintf (stderr, "%f %f : %f %d: %f %f %f : %f %f %f %f\n", R[n], D[n], T[n], mask[n], fitdata.t[i], fitdata.X[i], fitdata.Y[i], fitdata.Wx[i], fitdata.Wy[i], Sum_Wx, Sum_Wy);152 fprintf (stderr, "%f %f : %f "OPIHI_INT_FMT" : %f %f %f : %f %f %f %f\n", R[n], D[n], T[n], mask[n], fitdata.t[i], fitdata.X[i], fitdata.Y[i], fitdata.Wx[i], fitdata.Wy[i], Sum_Wx, Sum_Wy); 153 153 } 154 154 } -
trunk/Ohana/src/opihi/cmd.astro/fitpm.c
r39228 r40291 50 50 double *dD = dDvec->elements.Flt; 51 51 52 int *mask = NULL;52 opihi_int *mask = NULL; 53 53 if (mvec) { 54 54 mask = mvec->elements.Int; -
trunk/Ohana/src/opihi/cmd.astro/fitpm_irls.c
r39596 r40291 58 58 double *dD = dDvec->elements.Flt; 59 59 60 int *mask = NULL;60 opihi_int *mask = NULL; 61 61 if (mvec) { 62 62 mask = mvec->elements.Int; -
trunk/Ohana/src/opihi/cmd.astro/star.c
r36679 r40291 3 3 int star (int argc, char **argv) { 4 4 5 int x, y, N, dx,Nborder;5 int x, y, N, Nborder; 6 6 double max; 7 7 Buffer *buf; … … 33 33 } 34 34 35 int dx = 11; 36 int dy = 11; 37 int BOX = FALSE; 38 if ((N = get_argument (argc, argv, "-box"))) { 39 remove_argument (N, &argc, argv); 40 dx = atoi(argv[N]); 41 remove_argument (N, &argc, argv); 42 dy = atoi(argv[N]); 43 remove_argument (N, &argc, argv); 44 BOX = TRUE; 45 } 46 35 47 if ((argc != 4) && (argc != 5)) { 36 gprint (GP_ERR, "USAGE: star (buffer) x y [dx] [-border N] [-sat cnts] \n");48 gprint (GP_ERR, "USAGE: star (buffer) x y [dx] [-border N] [-sat cnts] [-box dx dy]\n"); 37 49 gprint (GP_ERR, " dx is the aperture diameter, but is adjusted up to the next odd number\n"); 38 50 return (FALSE); … … 40 52 if ((buf = SelectBuffer (argv[1], OLDBUFFER, TRUE)) == NULL) return (FALSE); 41 53 42 dx = 11;43 54 x = atof (argv[2]); 44 55 y = atof (argv[3]); … … 47 58 } 48 59 49 get_aperture_stats (&buf[0].matrix, x, y, dx, Nborder, max, VERBOSE); 60 if (BOX) { 61 get_box_stats (&buf[0].matrix, x, y, dx, dy, Nborder, max, VERBOSE); 62 } else { 63 get_aperture_stats (&buf[0].matrix, x, y, dx, Nborder, max, VERBOSE); 64 } 50 65 51 66 return (TRUE); -
trunk/Ohana/src/opihi/cmd.data/Makefile
r40165 r40291 155 155 $(SRC)/type.$(ARCH).o \ 156 156 $(SRC)/uniq.$(ARCH).o \ 157 $(SRC)/uniqpair.$(ARCH).o \ 157 158 $(SRC)/unsign.$(ARCH).o \ 158 159 $(SRC)/vbin.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/init.c
r40165 r40291 141 141 int tvcontour PROTO((int, char **)); 142 142 int tvgrid PROTO((int, char **)); 143 int opihi_type PROTO((int, char **));143 int opihi_type PROTO((int, char **)); 144 144 int uniq PROTO((int, char **)); 145 int uniqpair PROTO((int, char **)); 145 146 int unsign PROTO((int, char **)); 146 147 int vbin PROTO((int, char **)); … … 325 326 {1, "ungridify", ungridify, "convert image region to vector triplet"}, 326 327 {1, "uniq", uniq, "create a uniq vector subset from a vector"}, 328 {1, "uniqpair", uniqpair, "create a uniq vector subset from a pair of vectors, saving duplicates if desired"}, 327 329 {1, "unsign", unsign, "toggle the UNSIGN status"}, 328 330 {1, "vbin", vbin, "rebin vector data by a factor of N"}, -
trunk/Ohana/src/opihi/cmd.data/limits.c
r31160 r40291 3 3 int limits (int argc, char **argv) { 4 4 5 int N, APPLY,dX, dY;5 int N, dX, dY; 6 6 int kapa; 7 char *name;8 7 Graphdata graphmode; 9 8 Vector *xvec, *yvec; … … 11 10 xvec = yvec = NULL; 12 11 13 APPLY = FALSE; 12 float minLimitX = NAN; 13 float minLimitY = NAN; 14 float maxLimitX = NAN; 15 float maxLimitY = NAN; 16 float delLimitX = NAN; 17 float delLimitY = NAN; 18 19 if ((N = get_argument (argc, argv, "-minX"))) { 20 remove_argument (N, &argc, argv); 21 minLimitX = atof (argv[N]); 22 remove_argument (N, &argc, argv); 23 } 24 if ((N = get_argument (argc, argv, "-maxX"))) { 25 remove_argument (N, &argc, argv); 26 maxLimitX = atof (argv[N]); 27 remove_argument (N, &argc, argv); 28 } 29 if ((N = get_argument (argc, argv, "-delX"))) { 30 if (!isnan(minLimitX) || !isnan(maxLimitX)) { 31 gprint (GP_ERR, "-minX & -maxX cannot be mixed with -delX\n"); 32 return (FALSE); 33 } 34 remove_argument (N, &argc, argv); 35 delLimitX = atof (argv[N]); 36 remove_argument (N, &argc, argv); 37 } 38 if ((N = get_argument (argc, argv, "-minY"))) { 39 remove_argument (N, &argc, argv); 40 minLimitY = atof (argv[N]); 41 remove_argument (N, &argc, argv); 42 } 43 if ((N = get_argument (argc, argv, "-maxY"))) { 44 remove_argument (N, &argc, argv); 45 maxLimitY = atof (argv[N]); 46 remove_argument (N, &argc, argv); 47 } 48 if ((N = get_argument (argc, argv, "-delY"))) { 49 if (!isnan(minLimitY) || !isnan(maxLimitY)) { 50 gprint (GP_ERR, "-minY & -maxY cannot be mixed with -delY\n"); 51 return (FALSE); 52 } 53 remove_argument (N, &argc, argv); 54 delLimitY = atof (argv[N]); 55 remove_argument (N, &argc, argv); 56 } 57 58 int APPLY = FALSE; 14 59 if ((N = get_argument (argc, argv, "-a"))) { 15 60 remove_argument (N, &argc, argv); 16 61 APPLY = TRUE; 17 62 } 18 name = NULL;63 char *name = NULL; 19 64 if ((N = get_argument (argc, argv, "-n"))) { 20 65 remove_argument (N, &argc, argv); … … 22 67 remove_argument (N, &argc, argv); 23 68 } 69 24 70 if (!GetGraph (&graphmode, &kapa, name)) return (FALSE); 25 71 FREE (name); … … 97 143 success: 98 144 SetLimits (xvec, yvec, &graphmode); 145 146 if (!isnan(minLimitX)) graphmode.xmin = MIN (minLimitX, graphmode.xmin); 147 if (!isnan(maxLimitX)) graphmode.xmax = MAX (maxLimitX, graphmode.xmax); 148 if (!isnan(minLimitY)) graphmode.ymin = MIN (minLimitY, graphmode.ymin); 149 if (!isnan(maxLimitY)) graphmode.ymax = MAX (maxLimitY, graphmode.ymax); 150 151 if (!isnan(delLimitX)) { 152 float delta = graphmode.xmax - graphmode.xmin; 153 if (fabs(delLimitX) > fabs(delta)) { 154 float midpt = 0.5*(graphmode.xmax + graphmode.xmin); 155 graphmode.xmax = midpt + 0.5*delLimitX; 156 graphmode.xmin = midpt - 0.5*delLimitX; 157 } 158 } 159 if (!isnan(delLimitY)) { 160 float delta = graphmode.ymax - graphmode.ymin; 161 if (fabs(delLimitY) > fabs(delta)) { 162 float midpt = 0.5*(graphmode.ymax + graphmode.ymin); 163 graphmode.ymax = midpt + 0.5*delLimitY; 164 graphmode.ymin = midpt - 0.5*delLimitY; 165 } 166 } 167 99 168 if (APPLY) KapaSetLimits (kapa, &graphmode); 100 169 return (TRUE); -
trunk/Ohana/src/opihi/cmd.data/print_vectors.c
r37049 r40291 4 4 5 5 Vector **vec; 6 int i, j; 6 int i, j, N; 7 8 int START_VALUE = 0; 9 if ((N = get_argument (argc, argv, "-s"))) { 10 remove_argument (N, &argc, argv); 11 START_VALUE = atoi (argv[N]); 12 remove_argument (N, &argc, argv); 13 } 14 15 int END_VALUE = -1; 16 if ((N = get_argument (argc, argv, "-e"))) { 17 remove_argument (N, &argc, argv); 18 END_VALUE = atoi (argv[N]); 19 remove_argument (N, &argc, argv); 20 } 7 21 8 22 if (argc < 2) { … … 27 41 } 28 42 29 for (j = 0; j < MaxLen; j++) { 43 // start and end may be 0 - N (truncated to N) or may be negative, in which case it refers to 44 // distance from the end (just like vector[-5]) 45 START_VALUE = (START_VALUE < 0) ? MaxLen + START_VALUE + 1 : MIN (START_VALUE, MaxLen); 46 START_VALUE = MAX (0, START_VALUE); 47 48 END_VALUE = (END_VALUE < 0) ? MaxLen + END_VALUE + 1 : MIN (END_VALUE, MaxLen); 49 END_VALUE = MAX (0, END_VALUE); 50 51 for (j = START_VALUE; j < END_VALUE; j++) { 30 52 for (i = 0; i < Nvec; i++) { 31 53 if (j >= vec[i][0].Nelements) { … … 35 57 gprint (GP_LOG, "%f ", vec[i][0].elements.Flt[j]); 36 58 } else { 37 gprint (GP_LOG, "%d", vec[i][0].elements.Int[j]);59 gprint (GP_LOG, OPIHI_INT_FMT" ", vec[i][0].elements.Int[j]); 38 60 } 39 61 } -
trunk/Ohana/src/opihi/cmd.data/reindex.c
r39227 r40291 47 47 continue; 48 48 } 49 if (*vx > Nmax) ESCAPE("unexpected value in index: %d(%d)\n", *vx, i);49 if (*vx > Nmax) ESCAPE("unexpected value in index: "OPIHI_INT_FMT" (%d)\n", *vx, i); 50 50 ovec[0].elements.Flt[Npts] = vi[*vx]; 51 51 Npts++; … … 67 67 continue; 68 68 } 69 if (*vx > Nmax) ESCAPE("unexpected value in index: %d(%d)\n", *vx, i);69 if (*vx > Nmax) ESCAPE("unexpected value in index: "OPIHI_INT_FMT" (%d)\n", *vx, i); 70 70 ovec[0].elements.Int[Npts] = vi[*vx]; 71 71 Npts++; -
trunk/Ohana/src/opihi/cmd.data/test/periodogram-fm.sh
r40165 r40291 55 55 56 56 periodogram_fm t f df 5 50 period power 57 #periodogram t f 5 50 period power58 57 59 58 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f … … 88 87 89 88 periodogram_fm t f df 1 10 period power 90 #periodogram t f 1 10 period power91 89 92 90 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f … … 97 95 if (abs ($peakpos - $P) > 0.05) 98 96 $PASS = 0 97 end 98 99 if ($PLOT) 100 lim period power; clear; box; line -c red70 -lw 3 $P 0 to $P $peakval; plot period power -x line 99 101 end 100 102 end … … 117 119 118 120 periodogram_fm t f df 2 30 period power 119 #periodogram t f 2 30 period power120 121 121 122 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f … … 126 127 if (abs ($peakpos - $P) > 0.05) 127 128 $PASS = 0 129 end 130 131 if ($PLOT) 132 lim period power; clear; box; line -c red70 -lw 3 $P 0 to $P $peakval; plot period power -x line 128 133 end 129 134 end … … 145 150 set df = 0.01 + zero(f) 146 151 147 periodogram_fm t f 2 30 period power152 periodogram_fm t f df 2 30 period power 148 153 149 154 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f … … 155 160 $PASS = 0 156 161 end 157 end 158 159 # test using random samples, offset start, non-zero DC, some noise 162 163 if ($PLOT) 164 lim period power; clear; box; line -c red70 -lw 3 $P 0 to $P $peakval; plot period power -x line 165 end 166 end 167 168 # test using 300 random samples, offset start, non-zero DC, some noise 160 169 macro test6 161 170 $PASS = 1 … … 178 187 set df = 0.01 + zero(f) 179 188 180 periodogram_fm t f 2 30 period power189 periodogram_fm t f df 2 30 period power 181 190 182 191 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f … … 188 197 $PASS = 0 189 198 end 190 end 191 192 # test using fewer random samples, offset start, non-zero DC, some noise 199 200 if ($PLOT) 201 lim period power; clear; box; line -c red70 -lw 3 $P 0 to $P $peakval; plot period power -x line 202 end 203 end 204 205 # test using 100 fewer random samples, offset start, non-zero DC, some noise 193 206 macro test7 194 207 $PASS = 1 … … 211 224 set df = 0.01 + zero(f) 212 225 213 periodogram_fm t f 2 30 period power226 periodogram_fm t f df 2 30 period power 214 227 215 228 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f … … 221 234 $PASS = 0 222 235 end 223 end 224 225 # test using fewer random samples, high frequency, non-zero DC, some noise 236 237 if ($PLOT) 238 lim period power; clear; box; line -c red70 -lw 3 $P 0 to $P $peakval; plot period power -x line 239 end 240 end 241 242 # test using Ndays random samples, RR Lyrae-sized light curves (0.7 mag), 243 # optional noise level 226 244 macro test8 227 if ($0 != 2)228 echo "USAGE: test8: Ndays")245 if ($0 != 4) 246 echo "USAGE: test8: Period Ndays (df)" 229 247 break 230 248 end 231 249 232 250 local Ndays 233 $Ndays = $1 234 235 $PASS = 1 236 break -auto off 237 238 local P PI 239 $PI = 3.14159265359 240 $P = 0.8*rnd(0) + 0.2 251 $P = $1 252 $Ndays = $2 253 $dM = $3 254 255 $PASS = 1 256 break -auto off 257 258 local PI 259 $PI = 3.14159265359 241 260 $trueP = $P 242 261 … … 246 265 247 266 # t is a time in days, but we always have 4 within 1 hour: 248 set t 0 = int(100 * rnd(x))249 set dtx = (3/24) * rnd(x) 250 set t0 = t 0+ dtx267 set tday = int(100 * rnd(x)); # choose Ndays random days between 0 and 100 268 set dtx = (3/24) * rnd(x); # choose a starting time within that night 269 set t0 = tday + dtx 251 270 252 271 set dt1 = (15.0 / 1440) * rnd(x) + ( 0 + 7.5) / 1440 … … 260 279 set tmp = t0 + dt3; concat tmp t 261 280 262 set fraw = sin(2*$PI*t/$P) + 0.5281 set fraw = 0.75*sin(2*$PI*t/$P) 263 282 264 283 # 0.05 : peakpos = 14.95 265 284 # 0.10 : peakpos = 15.04 ( 266 gaussdev df t[] 0.0 0.25285 gaussdev df t[] 0.0 $dM 267 286 set f = fraw + df 268 set df = 0.01+ zero(f)269 270 periodogram_fm t f 0.1 2.0 period power287 set df = $dM + zero(f) 288 289 periodogram_fm t f df 0.1 20.0 period power 271 290 272 291 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f … … 278 297 $PASS = 0 279 298 end 280 end 299 if ($PLOT) 300 lim period power; clear; box; line -c red70 -lw 3 $P 0 to $P $peakval; plot period power -x line 301 end 302 end 303 304 # test using Ndays random samples, RR Lyrae-sized light curves (0.7 mag), 305 # optional noise level 306 # compare periodogram and periodogram_fm 307 macro test9 308 if ($0 != 4) 309 echo "USAGE: test8: Period Ndays (df)" 310 break 311 end 312 313 local Ndays 314 $P = $1 315 $Ndays = $2 316 $dM = $3 317 318 $PASS = 1 319 break -auto off 320 321 local PI 322 $PI = 3.14159265359 323 $trueP = $P 324 325 delete -q x t f period power 326 327 create x 0 $Ndays 328 329 # t is a time in days, but we always have 4 within 1 hour: 330 set tday = int(100 * rnd(x)); # choose Ndays random days between 0 and 100 331 set dtx = (3/24) * rnd(x); # choose a starting time within that night 332 set t0 = tday + dtx 333 334 set dt1 = (15.0 / 1440) * rnd(x) + ( 0 + 7.5) / 1440 335 set dt2 = (15.0 / 1440) * rnd(x) + (15 + 7.5) / 1440 336 set dt3 = (15.0 / 1440) * rnd(x) + (30 + 7.5) / 1440 337 338 delete -q t 339 concat t0 t 340 set tmp = t0 + dt1; concat tmp t 341 set tmp = t0 + dt2; concat tmp t 342 set tmp = t0 + dt3; concat tmp t 343 344 set fraw = 0.75*sin(2*$PI*t/$P) 345 346 # 0.05 : peakpos = 14.95 347 # 0.10 : peakpos = 15.04 ( 348 gaussdev df t[] 0.0 $dM 349 set f = fraw + df 350 set df = $dM + zero(f) 351 352 periodogram_fm t f df 0.1 20.0 period_fm power_fm 353 periodogram t f 0.1 20.0 period power 354 355 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f 356 # lim -n 1 period power; clear; box; plot period power 357 358 peak -q period_fm power_fm 359 $peakval_fm = $peakval 360 361 peak -q period power 362 vstat -q power 363 set power = power / $MAX 364 365 # if (abs ($peakpos - $P) > 0.05) 366 # $PASS = 0 367 # end 368 369 set freq = 1 / period 370 set freq_fm = 1 / period_fm 371 $Freq = 1 / $P 372 373 if ($PLOT) 374 if (1) 375 lim period power; clear; box 376 line -c red70 -lw 3 $P 0 to $P $peakval_fm; 377 plot period power -x line -c grey70 -lw 2 378 plot period_fm power_fm -x line -c black 379 else 380 lim freq power; clear; box 381 line -c red70 -lw 3 $Freq 0 to $Freq 1.0 382 plot freq power -x line -c grey70 -lw 2 383 plot freq_fm power_fm -x line -c black 384 end 385 end 386 end 387 388 389 # test using Ndays random samples, RR Lyrae-sized light curves (0.7 mag), 390 # optional noise level 391 # compare periodogram and periodogram_fm 392 macro test10 393 if ($0 != 4) 394 echo "USAGE: test8: Period Ndays (df)" 395 break 396 end 397 398 local Ndays 399 $P = $1 400 $Ndays = $2 401 $dM = $3 402 403 $PASS = 1 404 break -auto off 405 406 local PI 407 $PI = 3.14159265359 408 $trueP = $P 409 410 delete -q x t f period power 411 412 create x 0 $Ndays 413 414 # t is a time in days, but we always have 4 within 1 hour: 415 set tday = int(100 * rnd(x)); # choose Ndays random days between 0 and 100 416 set dtx = (3/24) * rnd(x); # choose a starting time within that night 417 set t0 = tday + dtx 418 419 set dt1 = (15.0 / 1440) * rnd(x) + ( 0 + 7.5) / 1440 420 set dt2 = (15.0 / 1440) * rnd(x) + (15 + 7.5) / 1440 421 set dt3 = (15.0 / 1440) * rnd(x) + (30 + 7.5) / 1440 422 423 delete -q t 424 concat t0 t 425 set tmp = t0 + dt1; concat tmp t 426 set tmp = t0 + dt2; concat tmp t 427 set tmp = t0 + dt3; concat tmp t 428 429 set fraw = 0.75*sin(2*$PI*t/$P) 430 431 # 0.05 : peakpos = 14.95 432 # 0.10 : peakpos = 15.04 ( 433 gaussdev df t[] 0.0 $dM 434 set f = fraw + df 435 set df = $dM + zero(f) 436 437 periodogram_fm t f df 0.05 20.0 period_fm power_fm 438 439 gaussdev df t[] 0.0 $dM 440 set Fo = df 441 periodogram_fm t Fo df 0.05 20.0 period power 442 443 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f 444 # lim -n 1 period power; clear; box; plot period power 445 446 peak -q period_fm power_fm 447 $peakval_fm = $peakval 448 449 peak -q period power 450 451 # if (abs ($peakpos - $P) > 0.05) 452 # $PASS = 0 453 # end 454 455 set freq = 1 / period 456 set freq_fm = 1 / period_fm 457 $Freq = 1 / $P 458 459 if ($PLOT) 460 if (1) 461 lim period_fm power_fm; clear; box 462 line -c red70 -lw 3 $P 0 to $P $peakval_fm; 463 plot period power -x line -c grey70 -lw 2 464 plot period_fm power_fm -x line -c black 465 else 466 lim freq power; clear; box 467 line -c red70 -lw 3 $Freq 0 to $Freq 1.0 468 plot freq power -x line -c grey70 -lw 2 469 plot freq_fm power_fm -x line -c black 470 end 471 end 472 end 473 474 # we have time (MJD) and mag 475 # we generate the folded lightcure and measure sigma relative to the smoothed version (bins of 0.1 period) 476 macro fold.one.period 477 if ($0 != 5) 478 echo "USAGE: fold.one.period (time) (mag) (magErr) (period)" 479 break 480 end 481 482 local myTime myMag myMagErr myPeriod 483 $myTime = $1 484 $myMag = $2 485 $myMagErr = $3 486 $myPeriod = $4 487 488 set phi = $myTime / $myPeriod - int($myTime / $myPeriod) 489 490 if ($PLOT_FOLD) 491 lim -n phi phi $myMag; clear; box; 492 end 493 494 delete -q magResid 495 496 $dPhi = 0.05; # half of bin size 497 create nphi $dPhi {1 + $dPhi} {2*$dPhi} 498 set magR = zero(nphi) 499 set magS = zero(nphi) 500 for i 0 nphi[] 501 subset tmp_mag_sub = $myMag where (phi >= nphi[$i] - $dPhi) && (phi < nphi[$i] + $dPhi) 502 vstat -q tmp_mag_sub 503 magR[$i] = $MEDIAN 504 magS[$i] = $SIGMA 505 506 set magDelta = tmp_mag_sub - $MEDIAN 507 concat magDelta magResid 508 509 if ($PLOT_FOLD) 510 subset tmp_phi_sub = phi where (phi >= nphi[$i] - $dPhi) && (phi < nphi[$i] + $dPhi) 511 if ($i % 2) 512 plot tmp_phi_sub tmp_mag_sub -pt 7 -sz 3 -c blue -lw 2 513 else 514 plot tmp_phi_sub tmp_mag_sub -pt 7 -sz 3 -c red -lw 2 515 end 516 end 517 end 518 519 if ($PLOT_FOLD) 520 plot -pt 10 -sz 1.5 phi $myMag -dy $myMagErr 521 plot -pt 2 -sz 2.0 -c red nphi magR -dy magS 522 end 523 524 vstat -q magResid 525 end 526 527 281 528 282 529 # Memory test … … 298 545 299 546 for i 0 100 300 periodogram_fm t f 2 30 period power547 periodogram_fm t f df 2 30 period power 301 548 end 302 549 -
trunk/Ohana/src/opihi/cmd.data/test/periodogram.sh
r40165 r40291 209 209 # test using fewer random samples, high frequency, non-zero DC, some noise 210 210 macro test8 211 if ($0 != 2)212 echo "USAGE: test8: Ndays")211 if ($0 != 4) 212 echo "USAGE: test8: Period Ndays df" 213 213 break 214 214 end 215 215 216 216 local Ndays 217 $Ndays = $1 218 219 $PASS = 1 220 break -auto off 221 222 local P PI 223 $PI = 3.14159265359 224 $P = 0.8*rnd(0) + 0.2 217 $P = $1 218 $Ndays = $2 219 $dM = $3 220 221 $PASS = 1 222 break -auto off 223 224 local PI 225 $PI = 3.14159265359 225 226 $trueP = $P 226 227 … … 230 231 231 232 # t is a time in days, but we always have 4 within 1 hour: 232 set t 0 = int(100 * rnd(x))233 set dtx = (3/24) * rnd(x) 234 set t0 = t 0+ dtx233 set tday = int(100 * rnd(x)); # choose Ndays random days between 0 and 100 234 set dtx = (3/24) * rnd(x); # choose a starting time within that night 235 set t0 = tday + dtx 235 236 236 237 set dt1 = (15.0 / 1440) * rnd(x) + ( 0 + 7.5) / 1440 … … 244 245 set tmp = t0 + dt3; concat tmp t 245 246 246 set fraw = sin(2*$PI*t/$P) + 0.5247 set fraw = 0.75*sin(2*$PI*t/$P) 247 248 248 249 # 0.05 : peakpos = 14.95 249 250 # 0.10 : peakpos = 15.04 ( 250 gaussdev df t[] 0.0 0.25251 gaussdev df t[] 0.0 $dM 251 252 set f = fraw + df 252 253 … … 260 261 if (abs ($peakpos - $P) > 0.05) 261 262 $PASS = 0 263 end 264 if ($PLOT) 265 lim period power; clear; box; line -c red70 -lw 3 $P 0 to $P $peakval; plot period power -x line 262 266 end 263 267 end -
trunk/Ohana/src/opihi/cmd.data/uniq.c
r39457 r40291 80 80 memcpy (indata, ivec->elements.Int, ivec[0].Nelements*sizeof(opihi_int)); 81 81 82 isort (indata, ivec->Nelements);82 llsort (indata, ivec->Nelements); 83 83 84 84 Nnew = 0; -
trunk/Ohana/src/opihi/cmd.data/write_vectors.c
r39360 r40291 165 165 } else { 166 166 if (CSV) { 167 fprintf (f, "%d,", vec[j][0].elements.Int[i]);167 fprintf (f, OPIHI_INT_FMT",", vec[j][0].elements.Int[i]); 168 168 } else { 169 fprintf (f, "%d", vec[j][0].elements.Int[i]);169 fprintf (f, OPIHI_INT_FMT" ", vec[j][0].elements.Int[i]); 170 170 } 171 171 } -
trunk/Ohana/src/opihi/dvo/dvo_host_utils.c
r39524 r40291 284 284 // XXX a bit of a waste (but only 1024 * 60 bytes or so 285 285 ALLOCATE (table->hosts[i].results, char, DVO_MAX_PATH); 286 snprintf (table->hosts[i].results, DVO_MAX_PATH, "%s/dvo.results.%s. fits", table->hosts[i].pathname, uniquer);286 snprintf (table->hosts[i].results, DVO_MAX_PATH, "%s/dvo.results.%s.%04d.fits", table->hosts[i].pathname, uniquer, table->hosts[i].hostID); 287 287 288 288 int Ninvec = 0; -
trunk/Ohana/src/opihi/dvo/gimages.c
r39347 r40291 214 214 if (PixelCoords) { 215 215 gprint (GP_LOG, "%3d %5d %s %6.1f %6.1f %20s %5d %2d %4.2f %6.3f %5.3f %5.3f %4x %7d\n", 216 Nfound, (int) i, image[i].name, X, Y, date, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal , image[i].dMcal, image[i].exptime, image[i].flags, image[i].imageID);216 Nfound, (int) i, image[i].name, X, Y, date, image[i].nstar, image[i].photcode, image[i].secz, image[i].McalPSF, image[i].dMcal, image[i].exptime, image[i].flags, image[i].imageID); 217 217 } else { 218 218 XY_to_RD (&ra, &dec, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords); 219 219 gprint (GP_LOG, "%3d %5d %s %8.4f %8.4f %20s %5d %2d %4.2f %6.3f %5.3f %5.3f %4x %7d\n", 220 Nfound, (int) i, image[i].name, ra, dec, date, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal , image[i].dMcal, image[i].exptime, image[i].flags, image[i].imageID);220 Nfound, (int) i, image[i].name, ra, dec, date, image[i].nstar, image[i].photcode, image[i].secz, image[i].McalPSF, image[i].dMcal, image[i].exptime, image[i].flags, image[i].imageID); 221 221 } 222 222 sprintf (name, "IMAGEx:%d", Nfound); -
trunk/Ohana/src/opihi/dvo/gstar.c
r39634 r40291 760 760 761 761 if (FULL_OUTPUT) { 762 gprint (GP_LOG, "%6.3f ", catalog.measure[Nv].Mcal); 762 gprint (GP_LOG, "%6.3f ", catalog.measure[Nv].McalPSF); 763 gprint (GP_LOG, "%6.3f ", catalog.measure[Nv].McalAPER); 763 764 gprint (GP_LOG, "%6.3f ", catalog.measure[Nv].Mflat); 764 gprint (GP_LOG, "%6.3f ", catalog.measure[Nv].Map); 765 gprint (GP_LOG, "%6.3f ", catalog.measure[Nv].Mkron); 765 Mrel = PhotRel (&catalog.measure[Nv], &catalog.average[k], &catalog.secfilt[k*Nsecfilt], MAG_CLASS_APER); 766 gprint (GP_LOG, "%6.3f ", Mrel); 767 Mrel = PhotRel (&catalog.measure[Nv], &catalog.average[k], &catalog.secfilt[k*Nsecfilt], MAG_CLASS_KRON); 768 gprint (GP_LOG, "%6.3f ", Mrel); 766 769 gprint (GP_LOG, "%6.3f ", catalog.measure[Nv].dMkron); 767 770 gprint (GP_LOG, "%5.1f ", pow(10.0, 0.4*catalog.measure[Nv].dt)); … … 960 963 print_double (NAN); 961 964 } else { 962 print_double_exp (secfilt[seq]. Mstdev);965 print_double_exp (secfilt[seq].sMpsfChp); 963 966 } 964 967 break; … … 1023 1026 print_double (NAN); 1024 1027 } else { 1025 print_double (secfilt[seq].M );1028 print_double (secfilt[seq].MpsfChp); 1026 1029 } 1027 1030 break; … … 1031 1034 print_double (NAN); 1032 1035 } else { 1033 print_double (secfilt[seq].dM );1036 print_double (secfilt[seq].dMpsfChp); 1034 1037 } 1035 1038 break; … … 1039 1042 print_double (NAN); 1040 1043 } else { 1041 print_double (secfilt[seq].Map );1044 print_double (secfilt[seq].MapChp); 1042 1045 } 1043 1046 break; … … 1047 1050 print_double (NAN); 1048 1051 } else { 1049 print_double (secfilt[seq].dMap );1052 print_double (secfilt[seq].dMapChp); 1050 1053 } 1051 1054 break; … … 1055 1058 print_double (NAN); 1056 1059 } else { 1057 print_double_exp (secfilt[seq].sMap );1060 print_double_exp (secfilt[seq].sMapChp); 1058 1061 } 1059 1062 break; … … 1063 1066 print_double (NAN); 1064 1067 } else { 1065 print_double_exp (secfilt[seq].dMap );1068 print_double_exp (secfilt[seq].dMapChp); 1066 1069 } 1067 1070 break; … … 1071 1074 print_double (NAN); 1072 1075 } else { 1073 print_double (secfilt[seq].Mkron );1076 print_double (secfilt[seq].MkronChp); 1074 1077 } 1075 1078 break; … … 1079 1082 print_double (NAN); 1080 1083 } else { 1081 print_double (secfilt[seq].dMkron );1084 print_double (secfilt[seq].dMkronChp); 1082 1085 } 1083 1086 break; … … 1087 1090 print_double (NAN); 1088 1091 } else { 1089 print_double_exp (secfilt[seq].sMkron );1092 print_double_exp (secfilt[seq].sMkronChp); 1090 1093 } 1091 1094 break; … … 1095 1098 print_double (NAN); 1096 1099 } else { 1097 print_double_exp (secfilt[seq].dMkron );1100 print_double_exp (secfilt[seq].dMkronChp); 1098 1101 } 1099 1102 break; -
trunk/Ohana/src/opihi/dvo/imdata.c
r39457 r40291 183 183 for (i = 0; i < catalog.Nmeasure; i++) { 184 184 if ((catalog.measure[i].t < start) || (catalog.measure[i].t > stop)) continue; 185 vec[0].elements.Flt[N] = catalog.measure[i].Mcal ;185 vec[0].elements.Flt[N] = catalog.measure[i].McalPSF; 186 186 N++; 187 187 CHECK_REALLOCATE (vec[0].elements.Flt, opihi_flt, NPTS, N, 1000); -
trunk/Ohana/src/opihi/dvo/imlist.c
r39310 r40291 141 141 if (VERBOSE) { 142 142 gprint (GP_LOG, "%3lld %s %8lld %8.4f %8.4f %f %5d %2d %4.2f %5.3f %5.3f", 143 (long long) i, image[i].name, (long long) image[i].imageID, r, d, t, image[i].nstar, image[i].photcode, image[i].secz, image[i].Mcal , image[i].dMcal);143 (long long) i, image[i].name, (long long) image[i].imageID, r, d, t, image[i].nstar, image[i].photcode, image[i].secz, image[i].McalPSF, image[i].dMcal); 144 144 145 145 if (showUR) { -
trunk/Ohana/src/opihi/dvo/imphot.c
r39233 r40291 64 64 for (x = 0; x < 100; x+=1.0, p++) { 65 65 // *p = applyMcal (&image[subset[0]], (fx*x), (fy*y)); 66 *p = image[subset[0]].Mcal ;66 *p = image[subset[0]].McalPSF; 67 67 } 68 68 } … … 71 71 for (j = 0; j < Nsubset; j++) { 72 72 i = subset[j]; 73 gprint (GP_ERR, "%s: %f\n", image[i].name, image[i].Mcal );73 gprint (GP_ERR, "%s: %f\n", image[i].name, image[i].McalPSF); 74 74 75 75 // XXX old code when we had the option of a 2D zero point model … … 77 77 switch (image[i].order) { 78 78 case 0: 79 gprint (GP_ERR, "%s: %d - %f\n", image[i].name, image[i].order, image[i].Mcal );79 gprint (GP_ERR, "%s: %d - %f\n", image[i].name, image[i].order, image[i].McalPSF); 80 80 break; 81 81 case 1: 82 gprint (GP_ERR, "%s: %d - %f, %d %d\n", image[i].name, image[i].order, image[i].Mcal , image[i].Mx, image[i].My);82 gprint (GP_ERR, "%s: %d - %f, %d %d\n", image[i].name, image[i].order, image[i].McalPSF, image[i].Mx, image[i].My); 83 83 break; 84 84 case 2: 85 gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d\n", image[i].name, image[i].order, image[i].Mcal , image[i].Mx, image[i].My, image[i].Mxx, image[i].Mxy, image[i].Myy);85 gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d\n", image[i].name, image[i].order, image[i].McalPSF, image[i].Mx, image[i].My, image[i].Mxx, image[i].Mxy, image[i].Myy); 86 86 break; 87 87 case 3: 88 gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d\n", image[i].name, image[i].order, image[i].Mcal , image[i].Mx, image[i].My,88 gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d\n", image[i].name, image[i].order, image[i].McalPSF, image[i].Mx, image[i].My, 89 89 image[i].Mxx, image[i].Mxy, image[i].Myy, image[i].Mxxx, image[i].Mxxy, image[i].Mxyy, image[i].Myyy); 90 90 break; 91 91 case 4: 92 gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d, %d %d %d %d %d\n", image[i].name, image[i].order, image[i].Mcal , image[i].Mx, image[i].My,92 gprint (GP_ERR, "%s: %d - %f, %d %d, %d %d %d, %d %d %d %d, %d %d %d %d %d\n", image[i].name, image[i].order, image[i].McalPSF, image[i].Mx, image[i].My, 93 93 image[i].Mxx, image[i].Mxy, image[i].Myy, image[i].Mxxx, image[i].Mxxy, image[i].Mxyy, image[i].Myyy, 94 94 image[i].Mxxxx, image[i].Mxxxy, image[i].Mxxyy, image[i].Mxyyy, image[i].Myyyy); -
trunk/Ohana/src/opihi/dvo/imstats.c
r40165 r40291 41 41 Xvec.elements.Flt[i] = image[i].secz; 42 42 if (Mcal) 43 Yvec.elements.Flt[i] = image[i].Mcal ;43 Yvec.elements.Flt[i] = image[i].McalPSF; 44 44 else 45 45 Yvec.elements.Flt[i] = image[i].dMcal; … … 47 47 gprint (GP_ERR, "%d %8.4f %8.4f %10d %6d %5.3f %6.3f %6.3f\n", 48 48 i, r, d, image[i].tzero, image[i].nstar, Xvec.elements.Flt[i], 49 image[i].Mcal , image[i].dMcal);49 image[i].McalPSF, image[i].dMcal); 50 50 } 51 51 if (AutoLimits) SetLimits (&Xvec, &Yvec, &graphmode); -
trunk/Ohana/src/opihi/dvo/objectcoverage.c
r39457 r40291 203 203 if (catalog.secfilt[j*Nsecfilt+Nsec].Ncode < 2) { continue; } 204 204 205 invalid = ((catalog.secfilt[j*Nsecfilt + Nsec].M < 1.0) || (isnan(catalog.secfilt[j*Nsecfilt + Nsec].M)));205 invalid = ((catalog.secfilt[j*Nsecfilt + Nsec].MpsfChp < 1.0) || (isnan(catalog.secfilt[j*Nsecfilt + Nsec].MpsfChp))); 206 206 if (invalid) continue; 207 207 -
trunk/Ohana/src/opihi/dvo/paverage.c
r40165 r40291 125 125 while (average[i].R > Rmax) average[i].R -= 360.0; 126 126 127 mag = secfilt[i*Nsecfilt+Nsec].M ;127 mag = secfilt[i*Nsecfilt+Nsec].MpsfChp; 128 128 Zvec[Npts] = MIN (1.0, MAX (0.01, (mag - Mz) / Mr)); 129 129 if (LimExclude && (Zvec[Npts] > 0.99)) continue; -
trunk/Ohana/src/opihi/dvo/remote.c
r39283 r40291 27 27 gprint (GP_ERR, " -skip-result : do not try to read from the result file\n"); 28 28 gprint (GP_ERR, "OR: remote -reload (uniquer)\n"); 29 gprint (GP_ERR, " (reloads the remote host results into vectors as if a parallel command were run)\n"); 29 30 gprint (GP_ERR, "OR: remote -get-results (uniquer)\n"); 31 gprint (GP_ERR, " (generates the list of remote result filenames and status variables)\n"); 32 gprint (GP_ERR, " (RESULT_FILE:i is the filenme, RESULT_STATUS:i is the dvo_client exit status)\n"); 30 33 return FALSE; 31 34 } -
trunk/Ohana/src/opihi/dvo/skycoverage.c
r39233 r40291 330 330 break; 331 331 case MIN_MCAL: 332 V[ys*Nx + xs] = MIN(V[ys*Nx + xs], image[i].Mcal );332 V[ys*Nx + xs] = MIN(V[ys*Nx + xs], image[i].McalPSF); 333 333 break; 334 334 case MAX_MCAL: 335 V[ys*Nx + xs] = MAX(V[ys*Nx + xs], image[i].Mcal );335 V[ys*Nx + xs] = MAX(V[ys*Nx + xs], image[i].McalPSF); 336 336 break; 337 337 case MIN_TIME: { -
trunk/Ohana/src/opihi/include/astro.h
r39610 r40291 47 47 double VectorFractionInterpolate (double *values, float fraction, int Npts); 48 48 49 int PlxSetMeanEpoch (double *R, double *D, double *T, double *Rmean, double *Dmean, double *Tmean, int *mask, int Ntotal);50 int PlxSetEpochPosition (PlxFitData *fitdata, double *R, double *D, double *dR, double *dD, double *T, int *mask, int Ntotal, Coords *coords, double Tmean);51 int PlxOutlierClip (PlxFitData *fitdata, int *mask, int Noutlier, float dPsigMax, Vector *dPvec, int VERBOSE);49 int PlxSetMeanEpoch (double *R, double *D, double *T, double *Rmean, double *Dmean, double *Tmean, opihi_int *mask, int Ntotal); 50 int PlxSetEpochPosition (PlxFitData *fitdata, double *R, double *D, double *dR, double *dD, double *T, opihi_int *mask, int Ntotal, Coords *coords, double Tmean); 51 int PlxOutlierClip (PlxFitData *fitdata, opihi_int *mask, int Noutlier, float dPsigMax, Vector *dPvec, int VERBOSE); 52 52 53 53 int PlxFitDataAlloc (PlxFitData *data, int N); -
trunk/Ohana/src/opihi/include/data.h
r37807 r40291 162 162 /* starfuncs.c */ 163 163 double get_aperture_stats (Matrix *matrix, int X, int Y, int Npix, int Nborder, double max, int VERBOSE); 164 double get_box_stats (Matrix *matrix, int X, int Y, int dX, int dY, int Nborder, double max, int VERBOSE); 165 164 166 int set_rough_radii (double Ra, double Ri, double Ro); 165 167 int get_rough_star (float *data, int Nx, int Ny, int x, int y, opihi_flt *xc, opihi_flt *yc, opihi_flt *sx, opihi_flt *sy, opihi_flt *sxy, opihi_flt *zs, opihi_flt *zp, opihi_flt *sk); -
trunk/Ohana/src/opihi/lib.data/graphtools.c
r38153 r40291 10 10 if (xvec != NULL) { 11 11 if (xvec->type == OPIHI_FLT) { 12 maxX = DBL_MIN;12 maxX = -DBL_MAX; 13 13 minX = DBL_MAX; 14 14 for (i = 0; i < xvec[0].Nelements; i++) { … … 33 33 if (yvec != NULL) { 34 34 if (yvec->type == OPIHI_FLT) { 35 maxY = DBL_MIN;35 maxY = -DBL_MAX; 36 36 minY = DBL_MAX; 37 37 for (i = 0; i < yvec[0].Nelements; i++) { -
trunk/Ohana/src/opihi/lib.data/starfuncs.c
r36679 r40291 101 101 } 102 102 103 double get_box_stats (Matrix *matrix, int X, int Y, int dX, int dY, int Nborder, double max, int VERBOSE) { 104 105 double *ring; 106 double x, y, x2, y2, xy, I, sky, FWHMx, FWHMy, value, mag, Sxy; 107 int i, j, n, Nring, Nmax; 108 double Npts, gain, dsky2, dmag, peak, offset; 109 char *string; 110 111 string = get_variable ("GAIN"); 112 if (string == (char *) NULL) { 113 gprint (GP_ERR, "assuming a value of 1.0\n"); 114 gain = 1.0; 115 } else { 116 gain = atof (string); 117 } 118 Nborder = MAX (1, Nborder); 119 Nborder = MIN (1000, Nborder); 120 121 int dX2 = (int)(0.5*dX); 122 int dY2 = (int)(0.5*dY); 123 dX = 2 * dX2 + 1; 124 dY = 2 * dY2 + 1; 125 126 Nring = 2*Nborder*(dX + 2*Nborder) + 2*Nborder*(dY + 2*Nborder); 127 ALLOCATE (ring, double, Nring); 128 bzero (ring, sizeof(double)*Nring); 129 130 // get the pixels in the border regions: 131 // XXX gfits_get_matrix_value returns 0 for out-of-bounds pixels, but should return NAN 132 // and they should be skipped 133 n = 0; 134 for (j = 0; j < Nborder; j++) { 135 for (i = X - dX2 - Nborder; i < X + dX2 + Nborder + 1; i++) { 136 value = gfits_get_matrix_value (matrix, i, (int)(Y - dY2 - j)); 137 if (isfinite(value)) { ring[n] = value; n++; } 138 value = gfits_get_matrix_value (matrix, i, (int)(Y + dY2 + j)); 139 if (isfinite(value)) { ring[n] = value; n++; } 140 } 141 for (i = Y - dY2; i < Y + dY2 + 1; i++) { 142 value = gfits_get_matrix_value (matrix, (int)(X - dX2 - j), i); 143 if (isfinite(value)) { ring[n] = value; n++; } 144 value = gfits_get_matrix_value (matrix, (int)(X + dX2 + j), i); 145 if (isfinite(value)) { ring[n] = value; n++; } 146 } 147 } 148 Nring = n; 149 dsort (ring, Nring); 150 for (Npts = sky = dsky2 = 0, i = 0.25*Nring; i < 0.75*Nring; i++, Npts += 1.0) { 151 sky += ring[i]; 152 dsky2 += ring[i]*ring[i]; 153 } 154 sky = sky / Npts; 155 dsky2 = dsky2 / Npts - sky*sky; 156 free (ring); 157 158 float dx, dy; 159 160 peak = 0; 161 Npts = Nmax = 0; 162 x = y = x2 = y2 = xy = I = 0; 163 for (i = X - dX2; i < X + dX2 + 1; i++) { 164 for (j = Y - dY2; j < Y + dY2 + 1; j++) { 165 value = gfits_get_matrix_value (matrix, i, j); 166 if (!isfinite(value)) continue; 167 offset = value - sky; 168 dx = i - X; 169 dy = j - Y; 170 x += dx*offset; 171 y += dy*offset; 172 x2 += dx*dx*offset; 173 y2 += dy*dy*offset; 174 xy += dx*dy*offset; 175 I += offset; 176 Npts ++; 177 if (value > max) { 178 Nmax ++; 179 } 180 if (value > peak) peak = value; 181 } 182 } 183 184 x = x / I; 185 y = y / I; 186 FWHMx = 2.355*sqrt (fabs(x2 / I - x*x)); 187 FWHMy = 2.355*sqrt (fabs(y2 / I - y*y)); 188 Sxy = xy / I - x*y; 189 mag = -2.5*log10(I); 190 191 // flux_error = sqrt( I + Npts*dsky2 ) 192 // dmag = 1.086 * flux_error / flux 193 dmag = 1.086 * sqrt (fabs(I + Npts*dsky2)) / (gain * I); 194 x = x + X; 195 y = y + Y; 196 197 set_variable ("Xg", x); 198 set_variable ("Yg", y); 199 set_variable ("SXg", FWHMx); 200 set_variable ("SYg", FWHMy); 201 set_variable ("SXYg", Sxy); 202 set_variable ("Sg", sky); 203 set_variable ("dSg", sqrt (fabs (dsky2))); 204 set_variable ("Zg", mag); 205 set_variable ("dZg", dmag); 206 set_variable ("Zcg", I); 207 set_variable ("Zpk", peak); 208 set_int_variable ("Nsat", Nmax); 209 set_int_variable ("Npts", Npts); 210 211 if (VERBOSE) gprint (GP_LOG, "%f %f %f %f %f %f %f %f\n", x, y, FWHMx, FWHMy, sky, I, mag, dmag); 212 213 return (mag); 214 215 } 216 103 217 static double Raper = 5; 104 218 static double Rinner = 10; -
trunk/Ohana/src/opihi/lib.shell/VectorIO.c
r39457 r40291 41 41 for (j = 0; j < Nvec; j++) { 42 42 // if the format is not defined, just use the native byte-widths 43 tformat[2*j + 0] = (vec[j][0].type == OPIHI_FLT) ? 'D' : ' J';43 tformat[2*j + 0] = (vec[j][0].type == OPIHI_FLT) ? 'D' : 'K'; // this depends on opihi_int == int64_t for Int 44 44 tformat[2*j + 1] = 0; 45 45 } … … 60 60 for (j = 0; j < Nvec; j++) { 61 61 if (vec[j][0].type == OPIHI_FLT) { 62 gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "double", vec[j][0].elements.Flt, vec[j][0].Nelements, nativeOrder);62 gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "double", vec[j][0].elements.Flt, vec[j][0].Nelements, nativeOrder); 63 63 } else { 64 gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "int", vec[j][0].elements.Int, vec[j][0].Nelements, nativeOrder); 64 // gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "int", vec[j][0].elements.Int, vec[j][0].Nelements, nativeOrder); 65 gfits_set_bintable_column_reformat (theader, ftable, vec[j][0].name, "int64_t", vec[j][0].elements.Int, vec[j][0].Nelements, nativeOrder); 65 66 } 66 67 } … … 328 329 ASSIGN_DATA(short, short, Int); 329 330 ASSIGN_DATA(int, int, Int); 330 ASSIGN_DATA(int64_t, int64_t, Flt); // int64_t has a problem: Int is too small, Flt is wrong precision 331 ASSIGN_DATA(int64_t, int64_t, Int); // XXX this works if opihi_int is assigned to int64_t 332 //ASSIGN_DATA(int64_t, int64_t, Flt); // int64_t has a problem: Int is too small, Flt is wrong precision 331 333 ASSIGN_DATA(float, float, Flt); 332 334 ASSIGN_DATA(double, double, Flt); … … 353 355 ASSIGN_DATA_TRANSPOSE(short, short, Int); 354 356 ASSIGN_DATA_TRANSPOSE(int, int, Int); 355 ASSIGN_DATA_TRANSPOSE(int64_t, int64_t, Flt); 357 ASSIGN_DATA_TRANSPOSE(int64_t, int64_t, Int); 358 //ASSIGN_DATA_TRANSPOSE(int64_t, int64_t, Flt); // see above comment 356 359 ASSIGN_DATA_TRANSPOSE(float, float, Flt); 357 360 ASSIGN_DATA_TRANSPOSE(double, double, Flt); -
trunk/Ohana/src/opihi/lib.shell/convert_to_RPN.c
r39558 r40291 120 120 Nop_stack ++; 121 121 break; 122 case ST_UNARY:123 122 case ST_BINARY: 124 123 case ST_TRINARY: … … 139 138 Nop_stack ++; 140 139 break; 140 case ST_UNARY: 141 141 case ST_LEFT: 142 142 /* push operator on OP stack */ -
trunk/Ohana/src/opihi/lib.shell/dvomath.c
r39457 r40291 29 29 unsigned int Ncstack; 30 30 cstack = isolate_elements (argc, argv, &Ncstack); 31 32 // for (i = 0; i < Ncstack; i++) { 33 // fprintf (stderr, "%d : %s\n", i, cstack[i]); 34 // } 31 35 32 36 /* generate RPN stack from cstack arguments */ … … 82 86 } else { 83 87 if (stack[0].type == ST_SCALAR_INT) { 84 sprintf (outname, "%d", stack[0].IntValue);88 sprintf (outname, OPIHI_INT_FMT, stack[0].IntValue); 85 89 } else { 86 90 sprintf (outname, "%.12g", stack[0].FltValue); -
trunk/Ohana/src/opihi/lib.shell/evaluate_stack.c
r40014 r40291 89 89 } 90 90 if (tmp_stack.type == ST_SCALAR_INT) { 91 gprint (GP_ERR, "---> %d", tmp_stack.IntValue);91 gprint (GP_ERR, "---> "OPIHI_INT_FMT" ", tmp_stack.IntValue); 92 92 } 93 93 if (tmp_stack.type == ST_SCALAR_FLT) { … … 110 110 111 111 if (i < 3) { /* need two variables to operate on */ 112 snprintf (line, 512, "syntax error: trinary operator without three operands: %s\n ", stack[i].name);112 snprintf (line, 512, "syntax error: trinary operator without three operands: %s\n(Note that the : in a trinary operation must be protected by spaces", stack[i].name); 113 113 push_error (line); 114 114 clear_stack (&tmp_stack); … … 124 124 125 125 /* there are no valid unary string operators */ 126 snprintf (line, 512, "invalid operands for trinary operator %s (mismatch types?) ", stack[i].name);126 snprintf (line, 512, "invalid operands for trinary operator %s (mismatch types?)\n(Note that the : in a trinary operation must be protected by spaces)", stack[i].name); 127 127 push_error (line); 128 128 clear_stack (&tmp_stack); … … 131 131 got_three_op: 132 132 if (!status) { 133 snprintf (line, 512, "syntax error: invalid operand for trinary operation: %s or %s or %s\n ", stack[i-1].name, stack[i-2].name, stack[i-3].name);133 snprintf (line, 512, "syntax error: invalid operand for trinary operation: %s or %s or %s\n(Note that the : in a trinary operation must be protected by spaces)", stack[i-1].name, stack[i-2].name, stack[i-3].name); 134 134 push_error (line); 135 135 clear_stack (&tmp_stack); … … 188 188 snprintf (line, 512, "syntax error: invalid operand for binary operation: %s or %s\n", stack[i-1].name, stack[i-2].name); 189 189 push_error (line); 190 if (strchr(stack[i-1].name, ':') || strchr(stack[i-2].name, ':')) { 191 snprintf (line, 512, "syntax error: invalid operand for binary operation: %s or %s\n(Note that the : in a trinary operation must be protected by spaces)\n", stack[i-1].name, stack[i-2].name); 192 push_error (line); 193 } 190 194 clear_stack (&tmp_stack); 191 195 return (FALSE); -
trunk/Ohana/src/opihi/lib.shell/parse.c
r33662 r40291 245 245 vec[0].elements.Flt[Nx] = atof (val); 246 246 } else { 247 vec[0].elements.Int[Nx] = atol (val);247 vec[0].elements.Int[Nx] = atoll (val); 248 248 } 249 249 } -
trunk/Ohana/src/photdbc/src/get_mags.c
r37045 r40291 20 20 Nlist = MAX (Nlist, catalog[0].average[i].Nm); 21 21 for (j = 0; j < Nsecfilt; j++) { 22 catalog[0].secfilt[i*Nsecfilt+j].M = NAN;23 catalog[0].secfilt[i*Nsecfilt+j].dM = NAN;24 catalog[0].secfilt[i*Nsecfilt+j].Mchisq = NAN;22 catalog[0].secfilt[i*Nsecfilt+j].MpsfChp = NAN; 23 catalog[0].secfilt[i*Nsecfilt+j].dMpsfChp = NAN; 24 catalog[0].secfilt[i*Nsecfilt+j].Mchisq = NAN; 25 25 } 26 26 } … … 52 52 if (N < 1) continue; 53 53 54 Mval = (Nsec == -1) ? &catalog[0].average[i].M : &catalog[0].secfilt[i*Nsecfilt+Nsec].M ;54 Mval = (Nsec == -1) ? &catalog[0].average[i].M : &catalog[0].secfilt[i*Nsecfilt+Nsec].MpsfChp; 55 55 *Mval = stats.mean; 56 Mval = (Nsec == -1) ? &catalog[0].average[i].dM : &catalog[0].secfilt[i*Nsecfilt+Nsec].dM ;56 Mval = (Nsec == -1) ? &catalog[0].average[i].dM : &catalog[0].secfilt[i*Nsecfilt+Nsec].dMpsfChp; 57 57 *Mval = stats.sigma; 58 58 Mval = (Nsec == -1) ? &catalog[0].average[i].Mchisq : &catalog[0].secfilt[i*Nsecfilt+Nsec].Mchisq; -
trunk/Ohana/src/photdbc/src/join_stars.c
r38441 r40291 87 87 88 88 // require base star to meet certain conditions: 89 if (isnan(secfilt[Ni*Nsecfilt + baseNsec].M )) {89 if (isnan(secfilt[Ni*Nsecfilt + baseNsec].MpsfChp)) { 90 90 i++; 91 91 continue; -
trunk/Ohana/src/photdbc/src/make_subcatalog.c
r39926 r40291 1 1 # include "photdbc.h" 2 3 # define SKIP_MEASURE FALSE 4 # define SKIP_LENSING FALSE 5 # define SKIP_LENSOBJ FALSE 6 # define SKIP_STARPAR FALSE 7 # define SKIP_GALPHOT FALSE 2 8 3 9 // copy a catalog to a new subcatalog, applying some filters … … 63 69 keep = FALSE; 64 70 for (j = 0; !keep && (j < Nsecfilt); j++) { 65 if (catalog[0].secfilt[Nsecfilt*i+j].dM < AVE_SIGMA_LIM) {71 if (catalog[0].secfilt[Nsecfilt*i+j].dMpsfChp < AVE_SIGMA_LIM) { 66 72 keep = TRUE; 67 73 } … … 98 104 minSigma = 32; 99 105 Nm = 0; 100 for (j = 0; j < catalog[0].average[i].Nmeasure; j++) {106 for (j = 0; !SKIP_MEASURE && (j < catalog[0].average[i].Nmeasure); j++) { 101 107 102 108 offset = catalog[0].average[i].measureOffset + j; … … 164 170 } 165 171 } 172 // End of average[i] loop 166 173 167 174 // exclude faint objects … … 189 196 Nm = 0; 190 197 subcatalog[0].average[Naverage].lensingOffset = Nlensing; 191 for (j = 0; j < catalog[0].average[i].Nlensing; j++) {198 for (j = 0; !SKIP_LENSING && (j < catalog[0].average[i].Nlensing); j++) { 192 199 193 200 offset = catalog[0].average[i].lensingOffset + j; … … 208 215 Nm = 0; 209 216 subcatalog[0].average[Naverage].lensobjOffset = Nlensobj; 210 for (j = 0; j < catalog[0].average[i].Nlensobj; j++) {217 for (j = 0; !SKIP_LENSOBJ && (j < catalog[0].average[i].Nlensobj); j++) { 211 218 212 219 offset = catalog[0].average[i].lensobjOffset + j; … … 226 233 Nm = 0; 227 234 subcatalog[0].average[Naverage].starparOffset = Nstarpar; 228 for (j = 0; j < catalog[0].average[i].Nstarpar; j++) {235 for (j = 0; !SKIP_STARPAR && (j < catalog[0].average[i].Nstarpar); j++) { 229 236 230 237 offset = catalog[0].average[i].starparOffset + j; … … 245 252 Nm = 0; 246 253 subcatalog[0].average[Naverage].galphotOffset = Ngalphot; 247 for (j = 0; j < catalog[0].average[i].Ngalphot; j++) {254 for (j = 0; !SKIP_GALPHOT && (j < catalog[0].average[i].Ngalphot); j++) { 248 255 249 256 offset = catalog[0].average[i].galphotOffset + j; -
trunk/Ohana/src/relastro/include/relastro.h
r39926 r40291 215 215 unsigned int stop; 216 216 off_t myImage; 217 float Mcal; 217 float McalPSF; 218 float McalAPER; 218 219 float dMcal; 219 short Xm;220 float McalChiSq; 220 221 float secz; 221 222 char flags; … … 377 378 int SKIP_CFH; 378 379 380 int UPDATE_ALL_MEASURE; 379 381 int UPDATE_PS1_STACK_MEASURE; 380 382 int UPDATE_PS1_CHIP_MEASURE; -
trunk/Ohana/src/relastro/src
- Property svn:mergeinfo changed
/branches/eam_branches/ohana.20170822/src/relastro/src (added) merged: 40212,40220,40223,40244
- Property svn:mergeinfo changed
-
trunk/Ohana/src/relastro/src/BrightCatalog.c
r39995 r40291 68 68 GET_COLUMN(D, "DEC", double); 69 69 GET_COLUMN(M, "MAG_SYS", float); 70 GET_COLUMN(Mcal, "MAG_CAL", float); 70 GET_COLUMN(McalPSF, "MCAL_PSF", float); 71 GET_COLUMN(McalAPER, "MCAL_APER", float); 71 72 GET_COLUMN(dM, "MAG_ERR", float); 72 73 GET_COLUMN(airmass, "AIRMASS", float); … … 94 95 measure[i].D = D[i]; 95 96 measure[i].M = M[i]; 96 measure[i].Mcal = Mcal[i]; 97 measure[i].McalPSF = McalPSF[i]; 98 measure[i].McalAPER = McalAPER[i]; 97 99 measure[i].dM = dM[i]; 98 100 measure[i].airmass = airmass[i]; … … 120 122 free (D ); 121 123 free (M ); 122 free (Mcal ); 124 free (McalPSF ); 125 free (McalAPER); 123 126 free (dM ); 124 127 free (airmass ); … … 285 288 ALLOCATE (secfilt, SecFilt, Nrow); 286 289 for (i = 0; i < Nrow; i++) { 287 secfilt[i].M = M[i];288 secfilt[i].dM = dM[i];289 secfilt[i].Mchisq = Mchisq[i];290 secfilt[i].flags = flags[i];291 secfilt[i].Ncode = Ncode[i];292 secfilt[i].Nused = Nused[i];293 secfilt[i].Mmin = Mmin[i];294 secfilt[i].Mmax = Mmax[i];290 secfilt[i].MpsfChp = M[i]; 291 secfilt[i].dMpsfChp = dM[i]; 292 secfilt[i].Mchisq = Mchisq[i]; 293 secfilt[i].flags = flags[i]; 294 secfilt[i].Ncode = Ncode[i]; 295 secfilt[i].Nused = Nused[i]; 296 secfilt[i].Mmin = Mmin[i]; 297 secfilt[i].Mmax = Mmax[i]; 295 298 } 296 299 // fprintf (stderr, "loaded data for %lld secfilt\n", (long long) Nrow); … … 385 388 double *D ; ALLOCATE (D , double, catalog->Nmeasure); 386 389 float *M ; ALLOCATE (M , float, catalog->Nmeasure); 387 float *Mcal ; ALLOCATE (Mcal , float, catalog->Nmeasure); 390 float *McalPSF ; ALLOCATE (McalPSF , float, catalog->Nmeasure); 391 float *McalAPER ; ALLOCATE (McalAPER , float, catalog->Nmeasure); 388 392 float *dM ; ALLOCATE (dM , float, catalog->Nmeasure); 389 393 float *airmass ; ALLOCATE (airmass , float, catalog->Nmeasure); … … 408 412 D[i] = measure[i].D ; 409 413 M[i] = measure[i].M ; 410 Mcal[i] = measure[i].Mcal ; 414 McalPSF[i] = measure[i].McalPSF ; 415 McalAPER[i] = measure[i].McalAPER ; 411 416 dM[i] = measure[i].dM ; 412 417 airmass[i] = measure[i].airmass ; … … 434 439 gfits_set_bintable_column (&theader, &ftable, "DEC", D, catalog->Nmeasure); 435 440 gfits_set_bintable_column (&theader, &ftable, "MAG_SYS", M, catalog->Nmeasure); 436 gfits_set_bintable_column (&theader, &ftable, "MAG_CAL", Mcal, catalog->Nmeasure); 441 gfits_set_bintable_column (&theader, &ftable, "MCAL_PSF", McalPSF, catalog->Nmeasure); 442 gfits_set_bintable_column (&theader, &ftable, "MCAL_APER", McalAPER, catalog->Nmeasure); 437 443 gfits_set_bintable_column (&theader, &ftable, "MAG_ERR", dM, catalog->Nmeasure); 438 444 gfits_set_bintable_column (&theader, &ftable, "AIRMASS", airmass, catalog->Nmeasure); … … 454 460 free (D ); 455 461 free (M ); 456 free (Mcal ); 462 free (McalPSF ); 463 free (McalAPER); 457 464 free (dM ); 458 465 free (airmass ); … … 694 701 SecFilt *secfilt = catalog->secfilt; 695 702 for (i = 0; i < Nsec; i++) { 696 M [i] = secfilt[i].M ;697 dM [i] = secfilt[i].dM ;698 Mchisq[i] = secfilt[i].Mchisq ;699 flags [i] = secfilt[i].flags ;700 Ncode [i] = secfilt[i].Ncode ;701 Nused [i] = secfilt[i].Nused ;702 Mmin [i] = secfilt[i].Mmin ;703 Mmax [i] = secfilt[i].Mmax ;703 M [i] = secfilt[i].MpsfChp ; 704 dM [i] = secfilt[i].dMpsfChp; 705 Mchisq[i] = secfilt[i].Mchisq ; 706 flags [i] = secfilt[i].flags ; 707 Ncode [i] = secfilt[i].Ncode ; 708 Nused [i] = secfilt[i].Nused ; 709 Mmin [i] = secfilt[i].Mmin ; 710 Mmax [i] = secfilt[i].Mmax ; 704 711 } 705 712 -
trunk/Ohana/src/relastro/src/ImageOps.c
r39926 r40291 431 431 /**** dMcal vs airmass ****/ 432 432 for (i = 0; i < Nimage; i++) { 433 Mlist[i] = image[i].Mcal ;433 Mlist[i] = image[i].McalPSF; 434 434 dlist[i] = image[i].dMcal; 435 435 xlist[i] = image[i].secz; … … 819 819 820 820 if ((DCR_BLUE_NSEC_POS >= 0) && (DCR_BLUE_NSEC_NEG >= -1)) { 821 ref[i].ColorBlue = catalog[c].secfilt[n*Nsecfilt + DCR_BLUE_NSEC_POS].M - catalog[c].secfilt[n*Nsecfilt + DCR_BLUE_NSEC_NEG].M;821 ref[i].ColorBlue = catalog[c].secfilt[n*Nsecfilt + DCR_BLUE_NSEC_POS].MpsfChp - catalog[c].secfilt[n*Nsecfilt + DCR_BLUE_NSEC_NEG].MpsfChp; 822 822 } 823 823 if ((DCR_RED_NSEC_POS >= 0) && (DCR_RED_NSEC_NEG >= -1)) { 824 ref[i].ColorRed = catalog[c].secfilt[n*Nsecfilt + DCR_RED_NSEC_POS].M - catalog[c].secfilt[n*Nsecfilt + DCR_RED_NSEC_NEG].M;824 ref[i].ColorRed = catalog[c].secfilt[n*Nsecfilt + DCR_RED_NSEC_POS].MpsfChp - catalog[c].secfilt[n*Nsecfilt + DCR_RED_NSEC_NEG].MpsfChp; 825 825 } 826 826 -
trunk/Ohana/src/relastro/src/MosaicOps.c
r39457 r40291 97 97 98 98 /* a new mosaic, define ranges */ 99 mosaic[Nmosaic].start = start; 100 mosaic[Nmosaic].stop = stop; 101 mosaic[Nmosaic].Mcal = 0.0; 102 mosaic[Nmosaic].dMcal = 0.0; 103 mosaic[Nmosaic].Xm = 0.0; 104 mosaic[Nmosaic].flags = image[i].flags; 105 mosaic[Nmosaic].secz = image[i].secz; 106 mosaic[Nmosaic].coords = image[i].coords; 107 mosaic[Nmosaic].myImage = i; 99 mosaic[Nmosaic].start = start; 100 mosaic[Nmosaic].stop = stop; 101 mosaic[Nmosaic].McalPSF = 0.0; 102 mosaic[Nmosaic].McalAPER = 0.0; 103 mosaic[Nmosaic].dMcal = 0.0; 104 mosaic[Nmosaic].McalChiSq = 0.0; 105 mosaic[Nmosaic].flags = image[i].flags; 106 mosaic[Nmosaic].secz = image[i].secz; 107 mosaic[Nmosaic].coords = image[i].coords; 108 mosaic[Nmosaic].myImage = i; 108 109 109 110 // init the mosaic_own_images array data -
trunk/Ohana/src/relastro/src/UpdateMeasures.c
r39926 r40291 114 114 } 115 115 116 // XXX this stuff is rather hackish, added to do GSC/HSC/Megacam astrometry 117 118 // only modify the chip coordinates 119 if (UPDATE_ALL_MEASURE) { 120 measureT->R = R; 121 measureT->D = D; 122 if (measureB) { 123 measureB->R = R; 124 measureB->D = D; 125 } 126 goto set_measure_done; 127 } 116 128 // only modify the chip coordinates 117 129 if (UPDATE_PS1_STACK_MEASURE && isGPC1stack (measureT->photcode)) { … … 122 134 measureB->D = D; 123 135 } 136 goto set_measure_done; 124 137 } 125 138 // only modify the chip coordinates … … 131 144 measureB->D = D; 132 145 } 133 } 134 // only modify the chip coordinates 135 if (UPDATE_HSC_MEASURE && isGPC1chip (measureT->photcode)) { 136 measureT->R = R; 137 measureT->D = D; 138 if (measureB) { 139 measureB->R = R; 140 measureB->D = D; 141 } 142 } 143 // only modify the chip coordinates 144 if (UPDATE_CFH_MEASURE && isGPC1chip (measureT->photcode)) { 145 measureT->R = R; 146 measureT->D = D; 147 if (measureB) { 148 measureB->R = R; 149 measureB->D = D; 150 } 151 } 146 goto set_measure_done; 147 } 148 // only modify the chip coordinates 149 if (UPDATE_HSC_MEASURE && isHSCchip (measureT->photcode)) { 150 measureT->R = R; 151 measureT->D = D; 152 if (measureB) { 153 measureB->R = R; 154 measureB->D = D; 155 } 156 goto set_measure_done; 157 } 158 // only modify the chip coordinates 159 if (UPDATE_CFH_MEASURE && isCFHchip (measureT->photcode)) { 160 measureT->R = R; 161 measureT->D = D; 162 if (measureB) { 163 measureB->R = R; 164 measureB->D = D; 165 } 166 goto set_measure_done; 167 } 168 set_measure_done: 169 continue; // XXX this line is needed only to support the label above 152 170 } 153 171 if (VERBOSE) fprintf (stderr, "%s : Noff ori RA %d ( %d %d %d ), Noff ori DEC %d ( %d %d %d )\n", catalog[i].filename, NoffRAori, NoffRAchip, NoffRAstack, NoffRAwarp, NoffDECori, NoffDECchip, NoffDECstack, NoffDECwarp); -
trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c
r39926 r40291 208 208 if (CHECK_MEASURE_TO_IMAGE) strextend (&command, "-check-measures"); 209 209 210 if (UPDATE_ALL_MEASURE) strextend (&command, "-update-all-cameras"); 210 211 if (UPDATE_PS1_STACK_MEASURE) strextend (&command, "-update-ps1-stack"); 211 if (UPDATE_PS1_CHIP_MEASURE) strextend (&command, "-update-ps1-chip");212 if (UPDATE_HSC_MEASURE) strextend (&command, "-update-hsc");213 if (UPDATE_CFH_MEASURE) strextend (&command, "-update-cfh");214 215 if (UPDATE) strextend (&command, "-update");212 if (UPDATE_PS1_CHIP_MEASURE) strextend (&command, "-update-ps1-chip"); 213 if (UPDATE_HSC_MEASURE) strextend (&command, "-update-hsc"); 214 if (UPDATE_CFH_MEASURE) strextend (&command, "-update-cfh"); 215 216 if (UPDATE) strextend (&command, "-update"); 216 217 if (RESET_BAD_IMAGES) strextend (&command, "-reset-bad-images"); 217 if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search");218 if (USE_ALL_IMAGES) strextend (&command, "-use-all-images");218 if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search"); 219 if (USE_ALL_IMAGES) strextend (&command, "-use-all-images"); 219 220 220 221 if (MinBadQF > 0.0) strextend (&command, "-min-bad-psfqf %f", MinBadQF); … … 347 348 if (CHECK_MEASURE_TO_IMAGE) strextend (&command, "-check-measures"); 348 349 350 if (UPDATE_ALL_MEASURE) strextend (&command, "-update-all-cameras"); 349 351 if (UPDATE_PS1_STACK_MEASURE) strextend (&command, "-update-ps1-stack"); 350 if (UPDATE_PS1_CHIP_MEASURE) strextend (&command, "-update-ps1-chip");351 if (UPDATE_HSC_MEASURE) strextend (&command, "-update-hsc");352 if (UPDATE_CFH_MEASURE) strextend (&command, "-update-cfh");352 if (UPDATE_PS1_CHIP_MEASURE) strextend (&command, "-update-ps1-chip"); 353 if (UPDATE_HSC_MEASURE) strextend (&command, "-update-hsc"); 354 if (UPDATE_CFH_MEASURE) strextend (&command, "-update-cfh"); 353 355 354 356 if (UPDATE) strextend (&command, "-update"); -
trunk/Ohana/src/relastro/src/args.c
r39926 r40291 158 158 } 159 159 160 UPDATE_ALL_MEASURE = FALSE; 161 if ((N = get_argument (argc, argv, "-update-all-cameras"))) { 162 remove_argument (N, &argc, argv); 163 UPDATE_ALL_MEASURE = TRUE; 164 } 160 165 UPDATE_PS1_STACK_MEASURE = FALSE; 161 166 if ((N = get_argument (argc, argv, "-update-ps1-stack"))) { … … 179 184 } 180 185 if (RELASTRO_OP == OP_UPDATE_OFFSETS) { 181 if (!UPDATE_ PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) {182 fprintf (stderr, "for -update-offsets, need to select at least one of -update- ps1-stack, -update-ps1-chip, -update-hsc, -update-cfh\n");186 if (!UPDATE_ALL_MEASURE && !UPDATE_PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) { 187 fprintf (stderr, "for -update-offsets, need to select at least one of -update-all-cameras, -update-ps1-stack, -update-ps1-chip, -update-hsc, -update-cfh\n"); 183 188 exit (2); 184 189 } 185 190 } 186 191 if ((RELASTRO_OP == OP_PARALLEL_IMAGES) || (RELASTRO_OP == OP_IMAGES)) { 187 if (APPLY_OFFSETS && !UPDATE_ PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) {192 if (APPLY_OFFSETS && !UPDATE_ALL_MEASURE && !UPDATE_PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) { 188 193 fprintf (stderr, "for [-images or -parallel-images] with -apply-offsets, need to select at least one of -update-ps1-stack, -update-ps1-chip, -update-hsc, -update-cfh\n"); 189 194 exit (2); … … 890 895 } 891 896 897 UPDATE_ALL_MEASURE = FALSE; 898 if ((N = get_argument (argc, argv, "-update-all-cameras"))) { 899 remove_argument (N, &argc, argv); 900 UPDATE_ALL_MEASURE = TRUE; 901 } 892 902 UPDATE_PS1_STACK_MEASURE = FALSE; 893 903 if ((N = get_argument (argc, argv, "-update-ps1-stack"))) { … … 911 921 } 912 922 if (RELASTRO_OP == OP_UPDATE_OFFSETS) { 913 if (!UPDATE_ PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) {923 if (!UPDATE_ALL_MEASURE && !UPDATE_PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) { 914 924 fprintf (stderr, "for -update-offsets, need to select at least one of -update-ps1-stack, -update-ps1-chip, -update-hsc, -update-cfh\n"); 915 925 exit (2); -
trunk/Ohana/src/relphot/include/relphot.h
r39926 r40291 77 77 unsigned int stop; 78 78 short photcode; 79 float Mcal; 79 float McalPSF; 80 float McalAPER; 80 81 float dMcal; 81 82 float dMsys; 82 unsigned short nFitPhotom; 83 short Xm; 83 float McalChiSq; 84 84 float secz; 85 85 float ubercalDist; 86 unsigned short nFitPhotom; 86 87 unsigned int flags; 87 88 char skipCal; // if TRUE, this mosaic is incomplete and should not be calibrated … … 201 202 202 203 typedef struct { 203 float Mcal; 204 float McalPSF; 205 float McalAPER; 204 206 float dMcal; 205 207 float dMagSys; 206 short Xm;208 float McalChiSq; 207 209 int nFitPhotom; 208 210 int flags; … … 220 222 221 223 typedef struct { 222 float Mcal; 224 float McalPSF; 225 float McalAPER; 223 226 float dMcal; 224 227 unsigned int imageID; … … 336 339 int SyntheticPhotometry; 337 340 341 int USE_MCAL_PSF_FOR_STACK_APER; 342 338 343 char *PhotcodeList; 339 344 … … 404 409 int findMosaics PROTO((Catalog *catalog, int Ncatalog, int doMosaicList)); 405 410 411 void clearImages (void); 412 void checkImages (char *name); 413 int dumpMags (FILE *fout, Catalog *catalog, int Ncatalog); 414 406 415 void makeMosaics (Image *image, off_t Nimage, int mergeMcal); 407 416 Mosaic *getMosaicForImage (off_t im); … … 422 431 off_t getImageEntry PROTO((off_t meas, int cat)); 423 432 424 float getMcal_alt PROTO((off_t meas, int cat, FlatCorrectionTable *flatcorr, float Xccd, float Yccd)); 425 float getMcal PROTO((off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog)); 433 float getMcal PROTO((off_t meas, int cat, dvoMagClassType class)); 426 434 float getMflat PROTO((off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog)); 427 435 float getMgrid PROTO((off_t meas, int cat)); 428 436 float getMmos PROTO((off_t meas, int cat)); 429 float getMrel PROTO((Catalog *catalog, off_t meas, int cat ));437 float getMrel PROTO((Catalog *catalog, off_t meas, int cat, dvoMagClassType class, dvoMagSourceType source)); 430 438 short getUbercalDist PROTO((off_t meas, int cat)); 431 439 float getCenterOffset PROTO((off_t meas, int cat, Measure *measure, unsigned int *myID)); -
trunk/Ohana/src/relphot/src/BrightCatalog.c
r39478 r40291 66 66 GET_COLUMN(D, "DEC", double); 67 67 GET_COLUMN(M, "MAG_SYS", float); 68 GET_COLUMN(Mcal, "MAG_CAL", float); 68 GET_COLUMN(Mkron, "MAG_KRON", float); 69 GET_COLUMN(McalPSF, "MCAL_PSF", float); 70 GET_COLUMN(McalAPER, "MCAL_APER", float); 69 71 GET_COLUMN(Mflat, "MAG_FLAT", float); 70 72 GET_COLUMN(dM, "MAG_ERR", float); … … 89 91 measure[i].D = D[i]; 90 92 measure[i].M = M[i]; 91 measure[i].Mcal = Mcal[i]; 93 measure[i].Mkron = Mkron[i]; 94 measure[i].McalPSF = McalPSF[i]; 95 measure[i].McalAPER = McalAPER[i]; 92 96 measure[i].Mflat = Mflat[i]; 93 97 measure[i].dM = dM[i]; … … 110 114 free (D ); 111 115 free (M ); 112 free (Mcal ); 116 free (Mkron ); 117 free (McalPSF ); 118 free (McalAPER); 113 119 free (Mflat ); 114 120 free (dM ); … … 186 192 // need to create and assign to flat-field correction 187 193 GET_COLUMN(M, "MAG", float); 194 GET_COLUMN(Mkron, "MAG_KRON", float); 188 195 GET_COLUMN(dM, "MAG_ERR", float); 189 196 GET_COLUMN(Mchisq, "MAG_CHI", float); … … 199 206 ALLOCATE (secfilt, SecFilt, Nrow); 200 207 for (i = 0; i < Nrow; i++) { 201 secfilt[i].M = M[i]; 202 secfilt[i].dM = dM[i]; 203 secfilt[i].Mchisq = Mchisq[i]; 204 secfilt[i].flags = flags[i]; 205 secfilt[i].Ncode = Ncode[i]; 206 secfilt[i].Nused = Nused[i]; 207 secfilt[i].Mmin = Mmin[i]; 208 secfilt[i].Mmax = Mmax[i]; 208 secfilt[i].MpsfChp = M[i]; 209 secfilt[i].MkronChp = Mkron[i]; 210 secfilt[i].dMpsfChp = dM[i]; 211 secfilt[i].Mchisq = Mchisq[i]; 212 secfilt[i].flags = flags[i]; 213 secfilt[i].Ncode = Ncode[i]; 214 secfilt[i].Nused = Nused[i]; 215 secfilt[i].Mmin = Mmin[i]; 216 secfilt[i].Mmax = Mmax[i]; 209 217 } 210 218 fprintf (stderr, "loaded data for %lld secfilt\n", (long long) Nrow); 211 219 212 220 free (M ); 221 free (Mkron ); 213 222 free (dM ); 214 223 free (Mchisq); … … 271 280 gfits_define_bintable_column (&theader, "D", "DEC", "dec", "degree", 1.0, 0.0); 272 281 gfits_define_bintable_column (&theader, "E", "MAG_SYS", "magnitude (sys)", NULL, 1.0, 0.0); 273 gfits_define_bintable_column (&theader, "E", "MAG_CAL", "magnitude (cal)", NULL, 1.0, 0.0); 282 gfits_define_bintable_column (&theader, "E", "MAG_KRON", "magnitude (sys,kron)", NULL, 1.0, 0.0); 283 gfits_define_bintable_column (&theader, "E", "MCAL_PSF", "magnitude (cal)", NULL, 1.0, 0.0); 284 gfits_define_bintable_column (&theader, "E", "MCAL_APER","magnitude (cal)", NULL, 1.0, 0.0); 274 285 gfits_define_bintable_column (&theader, "E", "MAG_FLAT", "magnitude (flat)", NULL, 1.0, 0.0); 275 286 gfits_define_bintable_column (&theader, "E", "MAG_ERR", "magnitude (err)", NULL, 1.0, 0.0); … … 293 304 double *D ; ALLOCATE (D , double, catalog->Nmeasure); 294 305 float *M ; ALLOCATE (M , float, catalog->Nmeasure); 295 float *Mcal ; ALLOCATE (Mcal , float, catalog->Nmeasure); 306 float *Mkron ; ALLOCATE (Mkron , float, catalog->Nmeasure); 307 float *McalPSF ; ALLOCATE (McalPSF , float, catalog->Nmeasure); 308 float *McalAPER ; ALLOCATE (McalAPER , float, catalog->Nmeasure); 296 309 float *Mflat ; ALLOCATE (Mflat , float, catalog->Nmeasure); 297 310 float *dM ; ALLOCATE (dM , float, catalog->Nmeasure); … … 311 324 MeasureTiny *measure = catalog->measure; 312 325 for (i = 0; i < catalog->Nmeasure; i++) { 313 R[i] = measure[i].R ;314 D[i] = measure[i].D ;326 R[i] = measure[i].R ; 327 D[i] = measure[i].D ; 315 328 M[i] = measure[i].M ; 316 Mcal[i] = measure[i].Mcal ; 329 Mkron[i] = measure[i].Mkron ; 330 McalPSF[i] = measure[i].McalPSF ; 331 McalAPER[i] = measure[i].McalAPER ; 317 332 Mflat[i] = measure[i].Mflat ; 318 333 dM[i] = measure[i].dM ; … … 334 349 gfits_set_bintable_column (&theader, &ftable, "DEC", D, catalog->Nmeasure); 335 350 gfits_set_bintable_column (&theader, &ftable, "MAG_SYS", M, catalog->Nmeasure); 336 gfits_set_bintable_column (&theader, &ftable, "MAG_CAL", Mcal, catalog->Nmeasure); 351 gfits_set_bintable_column (&theader, &ftable, "MAG_KRON", Mkron, catalog->Nmeasure); 352 gfits_set_bintable_column (&theader, &ftable, "MCAL_PSF", McalPSF, catalog->Nmeasure); 353 gfits_set_bintable_column (&theader, &ftable, "MCAL_APER", McalAPER, catalog->Nmeasure); 337 354 gfits_set_bintable_column (&theader, &ftable, "MAG_FLAT", Mflat, catalog->Nmeasure); 338 355 gfits_set_bintable_column (&theader, &ftable, "MAG_ERR", dM, catalog->Nmeasure); … … 352 369 free (D ); 353 370 free (M ); 354 free (Mcal ); 371 free (Mkron ); 372 free (McalPSF ); 373 free (McalAPER); 355 374 free (Mflat ); 356 375 free (dM ); … … 436 455 gfits_create_table_header (&theader, "BINTABLE", "SECFILT"); 437 456 438 gfits_define_bintable_column (&theader, "E", "MAG", "", "arcsec", 1.0, 0.0); 439 gfits_define_bintable_column (&theader, "E", "MAG_ERR", "", "arcsec", 1.0, 0.0); 457 gfits_define_bintable_column (&theader, "E", "MAG", "", "mag", 1.0, 0.0); 458 gfits_define_bintable_column (&theader, "E", "MAG_KRON", "", "mag", 1.0, 0.0); 459 gfits_define_bintable_column (&theader, "E", "MAG_ERR", "", "mag", 1.0, 0.0); 440 460 gfits_define_bintable_column (&theader, "E", "MAG_CHI", "", NULL, 1.0, 0.0); 441 461 gfits_define_bintable_column (&theader, "J", "FLAGS", "", NULL, 1.0, 0.0); … … 454 474 // create intermediate storage arrays 455 475 float *M ; ALLOCATE (M , float, Nsec); 476 float *Mkron ; ALLOCATE (Mkron , float, Nsec); 456 477 float *dM ; ALLOCATE (dM , float, Nsec); 457 478 float *Mchisq ; ALLOCATE (Mchisq , float, Nsec); … … 465 486 SecFilt *secfilt = catalog->secfilt; 466 487 for (i = 0; i < Nsec; i++) { 467 M [i] = secfilt[i].M ; 468 dM [i] = secfilt[i].dM ; 469 Mchisq[i] = secfilt[i].Mchisq ; 470 flags [i] = secfilt[i].flags ; 471 Ncode [i] = secfilt[i].Ncode ; 472 Nused [i] = secfilt[i].Nused ; 473 Mmin [i] = secfilt[i].Mmin ; 474 Mmax [i] = secfilt[i].Mmax ; 488 M [i] = secfilt[i].MpsfChp ; 489 Mkron [i] = secfilt[i].MkronChp; 490 dM [i] = secfilt[i].dMpsfChp; 491 Mchisq[i] = secfilt[i].Mchisq ; 492 flags [i] = secfilt[i].flags ; 493 Ncode [i] = secfilt[i].Ncode ; 494 Nused [i] = secfilt[i].Nused ; 495 Mmin [i] = secfilt[i].Mmin ; 496 Mmax [i] = secfilt[i].Mmax ; 475 497 } 476 498 477 499 // add the columns to the output array 478 500 gfits_set_bintable_column (&theader, &ftable, "MAG", M , Nsec); 501 gfits_set_bintable_column (&theader, &ftable, "MAG_KRON", Mkron , Nsec); 479 502 gfits_set_bintable_column (&theader, &ftable, "MAG_ERR", dM , Nsec); 480 503 gfits_set_bintable_column (&theader, &ftable, "MAG_CHI", Mchisq, Nsec); … … 486 509 487 510 free (M ); 511 free (Mkron ); 488 512 free (dM ); 489 513 free (Mchisq ); -
trunk/Ohana/src/relphot/src/GridOps.c
r39632 r40291 401 401 402 402 // skip images marked as BAD 403 Mcal = getMcal (m, c, flatcorr, catalog);403 Mcal = getMcal (m, c, MAG_CLASS_PSF); 404 404 if (isnan(Mcal)) { 405 405 Ncal ++; … … 558 558 continue; 559 559 } 560 Mcal = getMcal (m, c, flatcorr, catalog);560 Mcal = getMcal (m, c, MAG_CLASS_PSF); 561 561 if (isnan(Mcal)) { 562 562 Ncal ++; … … 568 568 continue; 569 569 } 570 Mrel = getMrel (catalog, m, c );570 Mrel = getMrel (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); 571 571 if (isnan(Mrel)) { 572 572 Nrel ++; … … 645 645 continue; 646 646 } 647 Mcal = getMcal (m, c, flatcorr, catalog);647 Mcal = getMcal (m, c, MAG_CLASS_PSF); 648 648 if (isnan(Mcal)) continue; 649 649 Mmos = getMmos (m, c); 650 650 if (isnan(Mmos)) continue; 651 Mrel = getMrel (catalog, m, c );651 Mrel = getMrel (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); 652 652 if (isnan(Mrel)) continue; 653 653 -
trunk/Ohana/src/relphot/src/ImageMagIO.c
r37037 r40291 58 58 char type[16]; 59 59 60 GET_COLUMN (Mcal, "MCAL", float); 60 GET_COLUMN (McalPSF, "MCAL_PSF", float); 61 GET_COLUMN (McalAPER, "MCAL_APER", float); 61 62 GET_COLUMN (dMcal, "MCAL_ERR", float); 62 63 GET_COLUMN (dMagSys, "MCAL_SYSERR", float); 63 GET_COLUMN ( nFitPhotom, "NFIT", int);64 GET_COLUMN ( flags, "FLAGS",int);65 GET_COLUMN ( ubercalDist, "UDIST",int);66 GET_COLUMN ( imageID, "ID",int);67 GET_COLUMN ( Xm, "CHISQ", short);64 GET_COLUMN (McalChiSq, "MCAL_CHISQ", float); 65 GET_COLUMN (nFitPhotom, "NFIT", int); 66 GET_COLUMN (flags, "FLAGS", int); 67 GET_COLUMN (ubercalDist, "UDIST", int); 68 GET_COLUMN (imageID, "ID", int); 68 69 69 70 // free the memory associated with the FITS files … … 75 76 ALLOCATE (image_mags, ImageMag, Nrow); 76 77 for (i = 0; i < Nrow; i++) { 77 image_mags[i].Mcal = Mcal [i]; 78 image_mags[i].McalPSF = McalPSF [i]; 79 image_mags[i].McalAPER = McalAPER [i]; 78 80 image_mags[i].dMcal = dMcal [i]; 79 81 image_mags[i].dMagSys = dMagSys [i]; 80 image_mags[i]. Xm = Xm[i];82 image_mags[i].McalChiSq = McalChiSq [i]; 81 83 image_mags[i].nFitPhotom = nFitPhotom [i]; 82 84 image_mags[i].flags = flags [i]; … … 86 88 fprintf (stderr, "loaded data for %lld images\n", (long long) Nrow); 87 89 88 free (Mcal ); 90 free (McalPSF ); 91 free (McalAPER ); 89 92 free (dMcal ); 90 93 free (dMagSys ); 91 free ( Xm);94 free (McalChiSq ); 92 95 free (nFitPhotom ); 93 96 free (flags ); … … 121 124 gfits_create_table_header (&theader, "BINTABLE", "IMAGE_MAGS"); 122 125 123 gfits_define_bintable_column (&theader, "E", "MCAL", "cal offset", "magnitudes", 1.0, 0.0); 126 gfits_define_bintable_column (&theader, "E", "MCAL_PSF", "PSF cal offset", "magnitudes", 1.0, 0.0); 127 gfits_define_bintable_column (&theader, "E", "MCAL_APER", "APER cal offset", "magnitudes", 1.0, 0.0); 124 128 gfits_define_bintable_column (&theader, "E", "MCAL_ERR", "cal error", "magnitudes", 1.0, 0.0); 125 129 gfits_define_bintable_column (&theader, "E", "MCAL_SYSERR", "systematic error", "magnitudes", 1.0, 0.0); 130 gfits_define_bintable_column (&theader, "E", "MCAL_CHISQ", "cal chisq", "unitless", 1.0, 0.0); 126 131 gfits_define_bintable_column (&theader, "J", "NFIT", "number of fitted stars", "unitless", 1.0, 0.0); 127 132 gfits_define_bintable_column (&theader, "J", "FLAGS", "analysis flags", "unitless", 1.0, 0.0); 128 133 gfits_define_bintable_column (&theader, "J", "UDIST", "distance to ubercal images", "images", 1.0, 0.0); 129 134 gfits_define_bintable_column (&theader, "J", "ID", "image ID", "unitless", 1.0, 0.0); 130 gfits_define_bintable_column (&theader, "I", "CHISQ", "cal chisq", "unitless", 1.0, FT_BZERO_INT16);131 135 132 136 // generate the output array that carries the data 133 137 gfits_create_table (&theader, &ftable); 134 138 135 float *Mcal ; 139 float *McalPSF ; 140 float *McalAPER ; 136 141 float *dMcal ; 137 142 float *dMagSys ; 138 float * Xm;143 float *McalChiSq ; 139 144 int *nFitPhotom ; 140 145 int *flags ; … … 143 148 144 149 // create intermediate storage arrays 145 ALLOCATE (Mcal , float, Nimage_mags); 150 ALLOCATE (McalPSF , float, Nimage_mags); 151 ALLOCATE (McalAPER , float, Nimage_mags); 146 152 ALLOCATE (dMcal , float, Nimage_mags); 147 153 ALLOCATE (dMagSys , float, Nimage_mags); 148 ALLOCATE ( Xm, float, Nimage_mags);154 ALLOCATE (McalChiSq , float, Nimage_mags); 149 155 ALLOCATE (nFitPhotom , int, Nimage_mags); 150 156 ALLOCATE (flags , int, Nimage_mags); … … 154 160 // assign the storage arrays 155 161 for (i = 0; i < Nimage_mags; i++) { 156 Mcal [i] = image_mags[i].Mcal ; 162 McalPSF [i] = image_mags[i].McalPSF ; 163 McalAPER [i] = image_mags[i].McalAPER ; 157 164 dMcal [i] = image_mags[i].dMcal ; 158 165 dMagSys [i] = image_mags[i].dMagSys ; 159 Xm [i] = image_mags[i].Xm;166 McalChiSq [i] = image_mags[i].McalChiSq ; 160 167 nFitPhotom [i] = image_mags[i].nFitPhotom ; 161 168 flags [i] = image_mags[i].flags ; … … 165 172 166 173 // add the columns to the output array 167 gfits_set_bintable_column (&theader, &ftable, "MCAL", Mcal , Nimage_mags); 174 gfits_set_bintable_column (&theader, &ftable, "MCAL_PSF", McalPSF , Nimage_mags); 175 gfits_set_bintable_column (&theader, &ftable, "MCAL_APER", McalAPER , Nimage_mags); 168 176 gfits_set_bintable_column (&theader, &ftable, "MCAL_ERR", dMcal , Nimage_mags); 169 177 gfits_set_bintable_column (&theader, &ftable, "MCAL_SYSERR", dMagSys , Nimage_mags); 170 gfits_set_bintable_column (&theader, &ftable, " CHISQ", Xm, Nimage_mags);178 gfits_set_bintable_column (&theader, &ftable, "MCAL_CHISQ", McalChiSq , Nimage_mags); 171 179 gfits_set_bintable_column (&theader, &ftable, "NFIT", nFitPhotom , Nimage_mags); 172 180 gfits_set_bintable_column (&theader, &ftable, "FLAGS", flags , Nimage_mags); … … 174 182 gfits_set_bintable_column (&theader, &ftable, "ID", imageID , Nimage_mags); 175 183 176 free (Mcal ); 184 free (McalPSF ); 185 free (McalAPER ); 177 186 free (dMcal ); 178 187 free (dMagSys ); 179 free ( Xm);188 free (McalChiSq ); 180 189 free (nFitPhotom ); 181 190 free (flags ); -
trunk/Ohana/src/relphot/src/ImageOps.c
r39643 r40291 143 143 image[i].photom_map_id = input[i].photom_map_id; 144 144 image[i].flags = input[i].flags ; 145 image[i].Mcal = input[i].Mcal ; 145 image[i].McalPSF = input[i].McalPSF ; 146 image[i].McalAPER = input[i].McalAPER ; 146 147 image[i].dMcal = input[i].dMcal ; 147 148 image[i].tzero = input[i].tzero ; … … 179 180 subset[i].photom_map_id = image[i].photom_map_id; 180 181 subset[i].flags = image[i].flags ; 181 subset[i].Mcal = image[i].Mcal ; 182 subset[i].McalPSF = image[i].McalPSF ; 183 subset[i].McalAPER = image[i].McalAPER ; 182 184 subset[i].dMcal = image[i].dMcal ; 183 185 subset[i].tzero = image[i].tzero ; … … 430 432 } 431 433 432 // returns image.Mcal 434 // returns image.McalPSF or image.McalAPER 433 435 // NOTE: static flat-field component is included in measure.Mflat 434 float getMcal (off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog) { 435 OHANA_UNUSED_PARAM(flatcorr); 436 OHANA_UNUSED_PARAM(catalog); 437 438 off_t i; 439 float value; 436 float getMcal (off_t meas, int cat, dvoMagClassType class) { 437 438 off_t i; 440 439 441 440 i = MeasureToImage[cat][meas]; 442 if (i == -1) return (NAN); 443 444 if (image[i].flags & IMAGE_BAD) return (NAN); 445 value = image[i].Mcal; 446 447 // to do this, I need to pass in the catalog and flatcorr pointers 448 // int flat_id = image[i].photom_map_id; 449 // float offset = 0.0; 450 // if (flat_id) { 451 // offset = FlatCorrectionOffset (flatcorr, flat_id, catalog[cat].measureT[meas].Xccd, catalog[cat].measureT[meas].Yccd); 452 // } 453 // value -= offset; 454 455 return (value); 456 } 457 458 // returns image.Mcal - ff(x,y) 459 // NOTE: static flat-field component is included in measure.Mflat 460 float getMcal_alt (off_t meas, int cat, FlatCorrectionTable *flatcorr, float Xccd, float Yccd) { 461 OHANA_UNUSED_PARAM(flatcorr); 462 OHANA_UNUSED_PARAM(Xccd); 463 OHANA_UNUSED_PARAM(Yccd); 464 465 off_t i; 466 float value; 467 468 i = MeasureToImage[cat][meas]; 469 if (i == -1) return (NAN); 470 471 if (image[i].flags & IMAGE_BAD) return (NAN); 472 value = image[i].Mcal; 473 474 // to do this, I need to pass in the catalog and flatcorr pointers 475 // int flat_id = image[i].photom_map_id; 476 // float offset = 0.0; 477 // if (flat_id) { 478 // offset = FlatCorrectionOffset (flatcorr, flat_id, Xccd, Yccd); 479 // } 480 // value -= offset; 481 482 return (value); 483 } 484 485 // returns image.Mcal - ff(x,y) 441 if (i == -1) return NAN; 442 443 if (image[i].flags & IMAGE_BAD) return NAN; 444 445 switch (class) { 446 case MAG_CLASS_PSF: 447 return image[i].McalPSF; 448 case MAG_CLASS_APER: 449 case MAG_CLASS_KRON: 450 return image[i].McalAPER; 451 default: 452 return NAN; 453 } 454 return NAN; // should not be able to reach here 455 } 456 486 457 short getUbercalDist (off_t meas, int cat) { 487 458 … … 499 470 } 500 471 501 // returns image.Mcal - ff(x,y)502 472 float getCenterOffset (off_t meas, int cat, Measure *measure, unsigned int *myID) { 503 473 … … 519 489 } 520 490 521 // returns image.Mcal - ff(x,y)522 491 int MatchImageName (off_t meas, int cat, char *name) { 523 492 … … 542 511 } 543 512 544 // returns image.Mcal - ff(x,y)545 513 int MatchImageSkycellID (off_t meas, int cat, int myTessID, int myProjectionID, int mySkycellID) { 546 514 … … 563 531 } 564 532 565 // returns image.Mcal - ff(x,y)566 533 int FindImageSkycellID (off_t meas, int cat, int *myTessID, int *myProjectionID, int *mySkycellID) { 567 534 … … 618 585 void setMcal (Catalog *catalog, int PoorImages, FlatCorrectionTable *flatcorr) { 619 586 620 off_t i, j, m, c, n , Nmax;587 off_t i, j, m, c, n; 621 588 int mark, bad, Nfew, Nbad, Nmos, Nrel, Ngrid, Nsys; 622 float Msys, Mrel, Mmos, Mgrid, Mflat;623 // double *list, *dlist, *Mlist, *dMlist;624 589 625 590 StatType stats; … … 638 603 } 639 604 640 Nmax = 0;605 off_t Nmax = 0; 641 606 for (i = 0; i < Nimage; i++) { 642 607 Nmax = MAX (Nmax, N_onImage[i]); 643 608 } 644 StatDataSet *refStars = StatDataSetAlloc (1, Nmax); 609 610 StatDataSet *kronStars = StatDataSetAlloc (1, Nmax); 611 StatDataSet *psfStars = StatDataSetAlloc (1, Nmax); 645 612 StatDataSet *brightStars = StatDataSetAlloc (1, Nmax); 646 613 … … 676 643 int minUbercalDist = 1000; 677 644 678 off_t Nref = 0; // total number of reference stars on the image 679 int Nbright = 0; // number of stars to measure the bright-end scatter 645 off_t Nref = 0; // number of stars used to measure McalPSF 646 int Nkron = 0; // number of stars to measure McalAPER 647 int Nbright = 0; // number of stars to measure the bright-end scatter 680 648 681 649 if (N_onImage[i] == 0) { … … 693 661 continue; 694 662 } 695 Mmos = getMmos (m, c);663 float Mmos = getMmos (m, c); 696 664 if (isnan(Mmos)) { 697 665 Nmos ++; 698 666 continue; 699 667 } 700 Mgrid = getMgrid (m, c);668 float Mgrid = getMgrid (m, c); 701 669 if (isnan(Mgrid)) { 702 670 Ngrid++; 703 671 continue; 704 672 } 705 Mrel = getMrel (catalog, m, c); 706 if (isnan(Mrel)) { 673 674 // Mrel* is the average magnitude for this star. For PS1 stacks, we have too much 675 // PSF variability. We need to calibrate the PSF magnitudes separately from the 676 // Aperture-like magnitues. (We have an option to use the kron magnitudes or the 677 // other apertures here). I basically need to do this analysis separately for each 678 // magnitude type 679 680 float MrelPSF = getMrel (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); 681 if (isnan(MrelPSF)) { 707 682 Nrel ++; 708 683 continue; … … 714 689 // the flat-correction. NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat) 715 690 716 Mflat = getMflat (m, c, flatcorr, catalog);691 float Mflat = getMflat (m, c, flatcorr, catalog); 717 692 718 693 n = catalog[c].measureT[m].averef; 719 Msys= PhotSysTiny (&catalog[c].measureT[m], &catalog[c].averageT[n], &catalog[c].secfilt[n*Nsecfilt], MAG_CLASS_PSF);720 if (isnan(Msys )) {694 float MsysPSF = PhotSysTiny (&catalog[c].measureT[m], &catalog[c].averageT[n], &catalog[c].secfilt[n*Nsecfilt], MAG_CLASS_PSF); 695 if (isnan(MsysPSF)) { 721 696 Nsys++; 722 697 continue; … … 731 706 732 707 skip: 733 refStars->flxlist[Nref] = Msys - Mrel- Mmos - Mgrid + Mflat;734 refStars->errlist[Nref] = MAX (catalog[c].measureT[m].dM, MIN_ERROR);735 refStars->wgtlist[Nref] = 1;736 refStars->msklist[Nref] = 0;737 if (fabs( refStars->flxlist[Nref]) > 0.03) {708 psfStars->flxlist[Nref] = MsysPSF - MrelPSF - Mmos - Mgrid + Mflat; 709 psfStars->errlist[Nref] = MAX (catalog[c].measureT[m].dM, MIN_ERROR); 710 psfStars->wgtlist[Nref] = 1; 711 psfStars->msklist[Nref] = 0; 712 if (fabs(psfStars->flxlist[Nref]) > 0.03) { 738 713 // fprintf (stderr, "deviant\n"); 739 714 } 740 715 716 float MrelKron = getMrel (catalog, m, c, MAG_CLASS_KRON, MAG_SRC_CHP); 717 float MsysKron = PhotSysTiny (&catalog[c].measureT[m], &catalog[c].averageT[n], &catalog[c].secfilt[n*Nsecfilt], MAG_CLASS_KRON); 718 719 if (isfinite(MrelKron) && isfinite(MsysKron)) { 720 kronStars->flxlist[Nkron] = MsysKron - MrelKron - Mmos - Mgrid + Mflat; 721 kronStars->errlist[Nkron] = MAX (catalog[c].measureT[m].dM, MIN_ERROR); 722 kronStars->wgtlist[Nkron] = 1; 723 kronStars->msklist[Nkron] = 0; 724 Nkron ++; 725 } 726 741 727 if ((image[i].imageID == TEST_IMAGE1) || (image[i].imageID == TEST_IMAGE2)) { 742 fprintf (stderr, "%1d, %3d : %3d, %3d : %10.6f %10.6f : %6.3f %6.3f %6.3f %6.3f %6.3f : %6.3f\n", (int) i, (int) j, (int) c, (int) m, catalog[c].averageT[n].R, catalog[c].averageT[n].D, Msys , Mrel, Mmos, Mgrid, Mflat, refStars->flxlist[Nref]);728 fprintf (stderr, "%1d, %3d : %3d, %3d : %10.6f %10.6f : %6.3f %6.3f %6.3f %6.3f %6.3f : %6.3f\n", (int) i, (int) j, (int) c, (int) m, catalog[c].averageT[n].R, catalog[c].averageT[n].D, MsysKron, MrelKron, Mmos, Mgrid, Mflat, kronStars->flxlist[Nref]); 743 729 } 744 730 745 731 if (catalog[c].measureT[m].dM < IMFIT_SYS_SIGMA_LIM) { 746 brightStars->flxlist[Nbright] = refStars->flxlist[Nref];747 brightStars->errlist[Nbright] = refStars->errlist[Nref];732 brightStars->flxlist[Nbright] = psfStars->flxlist[Nref]; 733 brightStars->errlist[Nbright] = psfStars->errlist[Nref]; 748 734 brightStars->wgtlist[Nbright] = 1; 749 735 brightStars->msklist[Nbright] = 0; … … 770 756 // no additional weight modification (we treat all stars on an image equally -- note an image is either ubercal-tied or not) 771 757 # if (BASIC_STATS) 772 liststats ( refStars->flxlist, refStars->errlist, NULL, Nref, &stats);758 liststats (psfStars->flxlist, psfStars->errlist, NULL, Nref, &stats); 773 759 # else 774 liststats_irls ( refStars, Nref, &stats);760 liststats_irls (psfStars, Nref, &stats); 775 761 # endif 776 image[i].Mcal = stats.mean;762 image[i].McalPSF = stats.mean; 777 763 image[i].dMcal = stats.error; 778 764 image[i].nFitPhotom = Nref; 779 image[i]. Xm = 100.0*log10(stats.chisq);765 image[i].McalChiSq = stats.chisq; 780 766 Ncalibrated ++; 767 768 // no additional weight modification (we treat all stars on an image equally -- note an image is either ubercal-tied or not) 769 # if (BASIC_STATS) 770 liststats (kronStars->flxlist, kronStars->errlist, NULL, Nkron, &stats); 771 # else 772 liststats_irls (kronStars, Nref, &stats); 773 # endif 774 image[i].McalAPER = stats.mean; 781 775 782 776 if ((image[i].imageID == TEST_IMAGE1) || (image[i].imageID == TEST_IMAGE2)) { 783 777 for (j = 0; j < Nref; j++) { 784 fprintf (stderr, "%1d, %8d : %6.3f %6.3f %6.3f %d\n", (int) i, (int) image[i].imageID, refStars->flxlist[j], refStars->errlist[j], refStars->wgtlist[j], refStars->msklist[j]);778 fprintf (stderr, "%1d, %8d : %6.3f %6.3f %6.3f %d\n", (int) i, (int) image[i].imageID, kronStars->flxlist[j], kronStars->errlist[j], kronStars->wgtlist[j], kronStars->msklist[j]); 785 779 } 786 780 } 787 781 788 782 if ((image[i].imageID == TEST_IMAGE1) || (image[i].imageID == TEST_IMAGE2)) { 789 fprintf (stderr, "Mcal for : %s : %7.4f %7.4f\n", image[i].name, image[i].Mcal , image[i].dMcal);783 fprintf (stderr, "Mcal for : %s : %7.4f %7.4f\n", image[i].name, image[i].McalAPER, image[i].dMcal); 790 784 } 791 785 792 786 if (!mark && VERBOSE_IMAGE) { 793 fprintf (stderr, "Mcal for : %s : %7.4f %7.4f\n", image[i].name, image[i].Mcal , image[i].dMcal);787 fprintf (stderr, "Mcal for : %s : %7.4f %7.4f\n", image[i].name, image[i].McalAPER, image[i].dMcal); 794 788 } 795 789 796 790 if (PLOTSTUFF) { 797 fprintf (stderr, "Mcal for : %s : %7.4f %7.4f\n", image[i].name, image[i].Mcal , image[i].dMcal);798 plot_setMcal ( refStars->flxlist, Nref, &stats, CLOUD_TOLERANCE);791 fprintf (stderr, "Mcal for : %s : %7.4f %7.4f\n", image[i].name, image[i].McalAPER, image[i].dMcal); 792 plot_setMcal (psfStars->flxlist, Nref, &stats, CLOUD_TOLERANCE); 799 793 } 800 794 … … 803 797 image[i].dMagSys = stats.sigma; 804 798 805 if (image[i].Mcal < -CLOUD_TOLERANCE) {806 image[i].Mcal = 0.0;799 if (image[i].McalPSF < -CLOUD_TOLERANCE) { 800 image[i].McalPSF = 0.0; 807 801 } 808 802 … … 813 807 814 808 StatDataSetFree (brightStars, 1); 815 StatDataSetFree (refStars, 1); 809 StatDataSetFree (kronStars, 1); 810 StatDataSetFree (psfStars, 1); 816 811 817 812 fprintf (stderr, "%d images calibrated\n", Ncalibrated); … … 848 843 if (FREEZE_IMAGES && isGPC1chip(image[i].photcode)) continue; 849 844 850 mlist[N] = image[i].Mcal ;845 mlist[N] = image[i].McalPSF; 851 846 slist[N] = image[i].dMcal; 852 847 dlist[N] = 1; … … 873 868 mark = FALSE; 874 869 image[i].flags &= ~ID_IMAGE_PHOTOM_POOR; 875 mark = (image[i].dMcal > MaxScatter) || (fabs(image[i].Mcal - MedOffset) > MaxOffset);870 mark = (image[i].dMcal > MaxScatter) || (fabs(image[i].McalPSF - MedOffset) > MaxOffset); 876 871 if (mark) { 877 872 Nmark ++; … … 961 956 if (FREEZE_IMAGES && isGPC1chip(image[i].photcode)) continue; 962 957 963 Mlist[Nplot] = image[i].Mcal ;958 Mlist[Nplot] = image[i].McalPSF; 964 959 dlist[Nplot] = image[i].dMcal; 965 960 xlist[Nplot] = image[i].secz; 966 961 minAirmass = MIN (image[i].secz, minAirmass); 967 962 maxAirmass = MAX (image[i].secz, maxAirmass); 968 minMcal = MIN (image[i].Mcal , minMcal);969 maxMcal = MAX (image[i].Mcal , maxMcal);963 minMcal = MIN (image[i].McalPSF, minMcal); 964 maxMcal = MAX (image[i].McalPSF, maxMcal); 970 965 mindMcal = MIN (image[i].dMcal, mindMcal); 971 966 maxdMcal = MAX (image[i].dMcal, maxdMcal); … … 1051 1046 c = ImageToCatalog[i][j]; 1052 1047 1053 Mcal = getMcal (m, c, flatcorr, catalog);1048 Mcal = getMcal (m, c, MAG_CLASS_PSF); 1054 1049 if (isnan(Mcal)) continue; 1055 1050 Mmos = getMmos (m, c); … … 1092 1087 if (FREEZE_IMAGES && isGPC1chip(image[i].photcode)) continue; 1093 1088 1094 list[n] = pow (10.0, 0.01*image[i].Xm);1089 list[n] = image[i].McalChiSq; 1095 1090 dlist[n] = 1; 1096 1091 n++; … … 1125 1120 if (FREEZE_IMAGES && isGPC1chip(image[i].photcode)) continue; 1126 1121 1127 list[n] = image[i].Mcal ;1122 list[n] = image[i].McalPSF; 1128 1123 dlist[n] = 1; 1129 1124 n++; … … 1170 1165 return (stats); 1171 1166 } 1167 1168 void clearImages (void) { 1169 image = NULL; 1170 } 1171 1172 void checkImages (char *name) { 1173 1174 off_t i; 1175 fprintf (stderr, "--- %s ---\n", name); 1176 1177 OhanaMemblock *ref = (OhanaMemblock *) image - 1; 1178 fprintf (stderr, "file: %s\n", ref->file); 1179 1180 fprintf (stderr, "0x%08llx \n", (unsigned long long) image); 1181 1182 for (i = 0; i < Nimage; i++) { 1183 fprintf (stderr, "%s : 0x%08x : %6.3f %6.3f\n", image[i].name, image[i].flags, image[i].McalPSF, image[i].McalAPER); 1184 } 1185 } -
trunk/Ohana/src/relphot/src/ImageSubset.c
r39478 r40291 63 63 char type[16]; 64 64 65 GET_COLUMN (Mcal, "MCAL", float); 65 GET_COLUMN (McalPSF, "MCAL_PSF", float); 66 GET_COLUMN (McalAPER, "MCAL_APER", float); 66 67 GET_COLUMN (dMcal, "MCAL_ERR", float); 67 68 GET_COLUMN (imageID, "IMAGE_ID", int); … … 79 80 ALLOCATE (image, ImageSubset, Nrow); 80 81 for (i = 0; i < Nrow; i++) { 81 image[i].Mcal = Mcal[i]; 82 image[i].McalPSF = McalPSF[i]; 83 image[i].McalAPER = McalAPER[i]; 82 84 image[i].dMcal = dMcal[i]; 83 85 image[i].imageID = imageID[i]; … … 93 95 fprintf (stderr, "loaded data for %lld images\n", (long long) Nrow); 94 96 95 free (Mcal); 97 free (McalPSF); 98 free (McalAPER); 96 99 free (dMcal); 97 100 free (imageID); … … 136 139 gfits_create_table_header (&theader, "BINTABLE", "IMAGE_SUBSET"); 137 140 138 gfits_define_bintable_column (&theader, "E", "MCAL", "zero point offset", "magnitudes", 1.0, 0.0); 141 gfits_define_bintable_column (&theader, "E", "MCAL_PSF", "zero point offset", "magnitudes", 1.0, 0.0); 142 gfits_define_bintable_column (&theader, "E", "MCAL_APER", "zero point offset", "magnitudes", 1.0, 0.0); 139 143 gfits_define_bintable_column (&theader, "E", "MCAL_ERR", "zero point error", "magnitudes", 1.0, 0.0); 140 144 gfits_define_bintable_column (&theader, "J", "IMAGE_ID", "image ID", NULL, 1.0, FT_BZERO_INT32); … … 151 155 gfits_create_table (&theader, &ftable); 152 156 153 float *Mcal , *dMcal;157 float *McalPSF, *McalAPER, *dMcal; 154 158 unsigned int *imageID, *map, *flags, *tzero; 155 159 int *tessID, *projID, *skycellID; … … 158 162 159 163 // create intermediate storage arrays 160 ALLOCATE (Mcal, float, Nimage); 164 ALLOCATE (McalPSF, float, Nimage); 165 ALLOCATE (McalAPER, float, Nimage); 161 166 ALLOCATE (dMcal, float, Nimage); 162 167 ALLOCATE (imageID, unsigned int, Nimage); … … 172 177 // assign the storage arrays 173 178 for (i = 0; i < Nimage; i++) { 174 Mcal[i] = image[i].Mcal; 179 McalPSF[i] = image[i].McalPSF; 180 McalAPER[i] = image[i].McalAPER; 175 181 dMcal[i] = image[i].dMcal; 176 182 imageID[i] = image[i].imageID; … … 186 192 187 193 // add the columns to the output array 188 gfits_set_bintable_column (&theader, &ftable, "MCAL", Mcal, Nimage); 194 gfits_set_bintable_column (&theader, &ftable, "MCAL_PSF", McalPSF, Nimage); 195 gfits_set_bintable_column (&theader, &ftable, "MCAL_APER", McalAPER, Nimage); 189 196 gfits_set_bintable_column (&theader, &ftable, "MCAL_ERR", dMcal, Nimage); 190 197 gfits_set_bintable_column (&theader, &ftable, "IMAGE_ID", imageID, Nimage); … … 198 205 gfits_set_bintable_column (&theader, &ftable, "UBERCAL_DIST", ucdist, Nimage); 199 206 200 free (Mcal); 207 free (McalPSF); 208 free (McalAPER); 201 209 free (dMcal); 202 210 free (imageID); -
trunk/Ohana/src/relphot/src/MosaicOps.c
r39632 r40291 111 111 112 112 /* a new mosaic, define ranges -- preserve the original values incase this image is not used */ 113 mosaic[Nmosaic].start = start; 114 mosaic[Nmosaic].stop = stop; 115 mosaic[Nmosaic].Mcal = 0.0; // note : mosaic stores only offsets relative to the original image values 116 mosaic[Nmosaic].dMcal = 0.0; // note : at the end, mosaic.Mcal is added back to the input images 117 mosaic[Nmosaic].dMsys = 0.0; 118 mosaic[Nmosaic].Xm = 0.0; 119 mosaic[Nmosaic].flags = image[i].flags; 120 mosaic[Nmosaic].secz = image[i].secz; 121 mosaic[Nmosaic].photcode = GetPhotcodeEquivCodebyCode (image[i].photcode); 113 mosaic[Nmosaic].start = start; 114 mosaic[Nmosaic].stop = stop; 115 mosaic[Nmosaic].McalPSF = 0.0; // note : at the end, mosaic.Mcal is added back to the input images 116 mosaic[Nmosaic].McalAPER = 0.0; // note : mosaic stores only offsets relative to the original image values 117 mosaic[Nmosaic].dMcal = 0.0; // note : at the end, mosaic.Mcal is added back to the input images 118 mosaic[Nmosaic].dMsys = 0.0; 119 mosaic[Nmosaic].McalChiSq = 0.0;// NAN or 0.0? 120 mosaic[Nmosaic].flags = image[i].flags; 121 mosaic[Nmosaic].secz = image[i].secz; 122 mosaic[Nmosaic].photcode = GetPhotcodeEquivCodebyCode (image[i].photcode); 122 123 123 124 // XXX do we need to do something about flag consistency across a mosaic? … … 208 209 for (i = 0; i < Nmosaic; i++) { 209 210 /* a new mosaic, define ranges */ 210 mosaic[i].start = startTimesMosaic[i]; 211 mosaic[i].stop = 0; 212 mosaic[i].Mcal = 0.0; 213 mosaic[i].dMcal = 0.0; 214 mosaic[i].dMsys = 0.0; 215 mosaic[i].Xm = 0.0; 216 mosaic[i].flags = 0; 217 mosaic[i].secz = NAN; 218 mosaic[i].photcode = 0; 219 mosaic[i].skipCal = FALSE; 211 mosaic[i].start = startTimesMosaic[i]; 212 mosaic[i].stop = 0; 213 mosaic[i].McalPSF = 0.0; // note : at the end, mosaic.Mcal is added back to the input images 214 mosaic[i].McalAPER = 0.0; // note : mosaic stores only offsets relative to the original image values 215 mosaic[i].dMcal = 0.0; // note : at the end, mosaic.Mcal is added back to the input images 216 mosaic[i].dMsys = 0.0; 217 mosaic[i].McalChiSq = 0.0;// NAN or 0.0? 218 mosaic[i].flags = 0; 219 mosaic[i].secz = NAN; 220 mosaic[i].photcode = 0; 221 mosaic[i].skipCal = FALSE; 220 222 221 223 memset (&mosaic[i].coords, 0, sizeof(Coords)); … … 294 296 abort(); 295 297 } 296 mosaic[j].stop = stop; 297 mosaic[j].Mcal = 0.0; 298 mosaic[j].dMcal = 0.0; 299 mosaic[j].Xm = 0.0; 300 mosaic[j].dMsys = subset[i].flags; 301 mosaic[j].flags = subset[i].flags; 302 mosaic[j].secz = subset[i].secz; 303 mosaic[j].photcode = GetPhotcodeEquivCodebyCode (subset[i].photcode); 298 mosaic[j].stop = stop; 299 300 mosaic[j].McalPSF = 0.0; 301 mosaic[j].McalAPER = 0.0; 302 mosaic[j].dMcal = 0.0; 303 mosaic[j].McalChiSq = 0.0; 304 305 mosaic[j].dMsys = subset[i].flags; 306 mosaic[j].flags = subset[i].flags; 307 mosaic[j].secz = subset[i].secz; 308 mosaic[j].photcode = GetPhotcodeEquivCodebyCode (subset[i].photcode); 304 309 } 305 310 … … 377 382 // init the mosaic array values 378 383 for (i = 0; i < Nmosaic; i++) { 379 mosaic[i].start = startTimesMosaic[i]; 380 mosaic[i].stop = 0; 381 mosaic[i].Mcal = 0.0; 382 mosaic[i].dMcal = 0.0; 383 mosaic[i].dMsys = 0.0; 384 mosaic[i].Xm = 0.0; 385 mosaic[i].flags = 0; 386 mosaic[i].secz = NAN; 387 mosaic[i].photcode = 0; 388 mosaic[i].skipCal = FALSE; 384 mosaic[i].start = startTimesMosaic[i]; 385 mosaic[i].stop = 0; 386 mosaic[i].McalPSF = 0.0; // note : at the end, mosaic.Mcal is added back to the input images 387 mosaic[i].McalAPER = 0.0; // note : mosaic stores only offsets relative to the original image values 388 mosaic[i].dMcal = 0.0; // note : at the end, mosaic.Mcal is added back to the input images 389 mosaic[i].dMsys = 0.0; 390 mosaic[i].McalChiSq = 0.0;// NAN or 0.0? 391 mosaic[i].flags = 0; 392 mosaic[i].secz = NAN; 393 mosaic[i].photcode = 0; 394 mosaic[i].skipCal = FALSE; 389 395 390 396 memset (&mosaic[i].coords, 0, sizeof(Coords)); … … 438 444 } 439 445 mosaic[j].stop = stop; 440 mosaic[j].Mcal = 0.0; 441 mosaic[j].dMcal = 0.0; 442 mosaic[j].Xm = 0.0; 443 mosaic[j].dMsys = image[i].flags; 444 mosaic[j].flags = image[i].flags; 445 mosaic[j].secz = image[i].secz; 446 mosaic[j].photcode = GetPhotcodeEquivCodebyCode (image[i].photcode); 446 mosaic[j].McalPSF = 0.0; 447 mosaic[j].McalAPER = 0.0; 448 mosaic[j].dMcal = 0.0; 449 mosaic[j].McalChiSq = 0.0; 450 mosaic[j].dMsys = image[i].flags; 451 mosaic[j].flags = image[i].flags; 452 mosaic[j].secz = image[i].secz; 453 mosaic[j].photcode = GetPhotcodeEquivCodebyCode (image[i].photcode); 447 454 } 448 455 MARKTIME("assign images to mosaic: %f sec\n", dtime); … … 594 601 mosaic[i].coords.cdelt2 = 1.0 / 3600.0; 595 602 596 mosaic[i].Mcal = 0.0; 597 mosaic[i].dMcal = 0.0; 598 mosaic[i].Xm = 0.0; 603 mosaic[i].McalPSF = 0.0; 604 mosaic[i].McalAPER = 0.0; 605 mosaic[i].dMcal = 0.0; 606 mosaic[i].dMsys = 0.0; 607 mosaic[i].McalChiSq = 0.0; 599 608 } 600 609 return; … … 612 621 double dS, dX, dY; 613 622 double R, D, Rmin, Rmax, Dmin, Dmax; 614 double Mcal , dMcal, Xm;623 double McalPSF, McalAPER, dMcal, McalChiSq; 615 624 616 625 fprintf (stderr, "*** moving Mcal from image.Mcal to mosaic.Mcal ***\n"); … … 621 630 Dmax = Rmax = -360.0; 622 631 dS = 0.0; 623 Mcal = dMcal = Xm= 0;632 McalPSF = McalAPER = dMcal = McalChiSq = 0; 624 633 for (j = 0; j < MosaicN_Image[i]; j++) { 625 634 m = MosaicToImage[i][j]; … … 678 687 // if it helps, note that ubercal uses a single zp per exposure, so the mean of those values is the same as the value 679 688 680 Mcal += image[m].Mcal; 681 dMcal += image[m].dMcal; 682 Xm += image[m].Xm; 683 684 image[m].Mcal = 0.0; 685 image[m].dMcal = NAN; 686 image[m].Xm = NAN_S_SHORT; 689 McalPSF += image[m].McalPSF; 690 McalAPER += image[m].McalAPER; 691 dMcal += image[m].dMcal; 692 McalChiSq += image[m].McalChiSq; 693 694 image[m].McalPSF = 0.0; 695 image[m].McalAPER = 0.0; 696 image[m].dMcal = NAN; 697 image[m].McalChiSq = NAN; 687 698 } 688 699 dS /= MosaicN_Image[i]; … … 696 707 RD_to_XY (&dX, &dY, Rmax, Dmax, &mosaic[i].coords); 697 708 698 mosaic[i].Mcal = Mcal / MosaicN_Image[i]; 699 mosaic[i].dMcal = dMcal / MosaicN_Image[i]; 700 mosaic[i].Xm = Xm / MosaicN_Image[i]; 709 mosaic[i].McalPSF = McalPSF / MosaicN_Image[i]; 710 mosaic[i].McalAPER = McalAPER / MosaicN_Image[i]; 711 mosaic[i].dMcal = dMcal / MosaicN_Image[i]; 712 mosaic[i].McalChiSq = McalChiSq / MosaicN_Image[i]; 701 713 } 702 714 if (!USE_GRID) return; … … 724 736 for (j = 0; j < MosaicN_Image[i]; j++) { 725 737 im = MosaicToImage[i][j]; 726 image[im].Mcal += mosaic[i].Mcal; 727 image[im].dMcal = mosaic[i].dMcal; 728 image[im].Xm = mosaic[i].Xm; 738 image[im].McalPSF += mosaic[i].McalPSF; 739 image[im].McalAPER += mosaic[i].McalAPER; 740 image[im].dMcal = mosaic[i].dMcal; 741 image[im].McalChiSq = mosaic[i].McalChiSq; 729 742 image[im].ubercalDist = mosaic[i].ubercalDist; 730 image[im].dMagSys = mosaic[i].dMsys; 731 image[im].nFitPhotom = mosaic[i].nFitPhotom; 732 image[im].flags |= (mosaic[i].flags & ID_IMAGE_PHOTOM_FEW); 733 image[im].flags |= (mosaic[i].flags & ID_IMAGE_PHOTOM_POOR); 734 } 735 mosaic[i].Mcal = 0.0; 743 image[im].dMagSys = mosaic[i].dMsys; 744 image[im].nFitPhotom = mosaic[i].nFitPhotom; 745 image[im].flags |= (mosaic[i].flags & ID_IMAGE_PHOTOM_FEW); 746 image[im].flags |= (mosaic[i].flags & ID_IMAGE_PHOTOM_POOR); 747 } 748 mosaic[i].McalPSF = 0.0; 749 mosaic[i].McalAPER = 0.0; 736 750 } 737 751 } … … 886 900 887 901 if (mosaic[i].flags & IMAGE_BAD) return (NAN); 888 value = mosaic[i].Mcal ;902 value = mosaic[i].McalPSF; 889 903 return (value); 890 904 } … … 911 925 off_t Nmax; 912 926 int PoorImages; 913 double *list; 914 double *dlist; 915 double *Mlist; 916 double *dMlist; 927 double *psfMagList; 928 double *psfErrList; 929 double *brightMagList; 930 double *brightErrList; 931 double *kronMagList; 932 double *kronErrList; 917 933 } SetMmosInfo; 918 934 … … 945 961 946 962 if (allocLists) { 947 ALLOCATE (info->list, double, Nmax); 948 ALLOCATE (info->dlist, double, Nmax); 949 ALLOCATE (info->Mlist, double, Nmax); 950 ALLOCATE (info->dMlist, double, Nmax); 963 ALLOCATE (info->psfMagList, double, Nmax); 964 ALLOCATE (info->psfErrList, double, Nmax); 965 ALLOCATE (info->kronMagList, double, Nmax); 966 ALLOCATE (info->kronErrList, double, Nmax); 967 ALLOCATE (info->brightMagList, double, Nmax); 968 ALLOCATE (info->brightErrList, double, Nmax); 951 969 } 952 970 } 953 971 954 972 void SetMmosInfoFree (SetMmosInfo *info) { 955 free (info->list); 956 free (info->dlist); 957 free (info->Mlist); 958 free (info->dMlist); 973 free (info->psfMagList ); 974 free (info->psfErrList ); 975 free (info->kronMagList ); 976 free (info->kronErrList ); 977 free (info->brightMagList); 978 free (info->brightErrList); 959 979 } 960 980 … … 1057 1077 liststats_setmode (&stats, "INNER_WTMEAN"); 1058 1078 1059 double *list = info->list; 1060 double *dlist = info->dlist; 1061 double *Mlist = info->Mlist; 1062 double *dMlist = info->dMlist; 1079 double *psfMagList = info->psfMagList; 1080 double *psfErrList = info->psfErrList; 1081 double *kronMagList = info->kronMagList; 1082 double *kronErrList = info->kronErrList; 1083 double *brightMagList = info->brightMagList; 1084 double *brightErrList = info->brightErrList; 1063 1085 1064 1086 assert (Nmos >= 0); … … 1125 1147 int N = 0; 1126 1148 for (j = 0; j < N_onMosaic[Nmos]; j++) { 1127 float Msys, Mrel, Mcal, Mgrid, Mflat;1128 1149 1129 1150 off_t m = MosaicToMeasure[Nmos][j]; 1130 1151 off_t c = MosaicToCatalog[Nmos][j]; 1131 1152 1153 // NOTE : we are only using Mcal == McalPSF in this function; we set McalAPER to McalPSF 1132 1154 if (fout) { 1133 Mcal = getMcal (m, c, flatcorr, catalog);1134 Mgrid= getMgrid (m, c);1135 Mrel = getMrel (catalog, m, c);1136 Mflat= getMflat (m, c, flatcorr, catalog);1155 float Mcal = getMcal (m, c, MAG_CLASS_PSF); 1156 float Mgrid = getMgrid (m, c); 1157 float MrelPSF = getMrel (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); 1158 float Mflat = getMflat (m, c, flatcorr, catalog); 1137 1159 1138 1160 off_t n = catalog[c].measureT[m].averef; 1139 Msys= PhotSysTiny (&catalog[c].measureT[m], &catalog[c].averageT[n], &catalog[c].secfilt[n*Nsecfilt], MAG_CLASS_PSF);1140 1141 float delta = Msys - Mrel- Mcal - Mgrid + Mflat;1161 float MsysPSF = PhotSysTiny (&catalog[c].measureT[m], &catalog[c].averageT[n], &catalog[c].secfilt[n*Nsecfilt], MAG_CLASS_PSF); 1162 1163 float delta = MsysPSF - MrelPSF - Mcal - Mgrid + Mflat; 1142 1164 1143 1165 int isBad = (catalog[c].measureT[m].dbFlags & MEAS_BAD); 1144 1166 1145 fprintf (fout, "%f %f : %f %f %f %f %f : %f %d\n", catalog[c].averageT[n].R, catalog[c].averageT[n].D, Msys , Mrel, Mcal, Mgrid, Mflat, delta, isBad);1167 fprintf (fout, "%f %f : %f %f %f %f %f : %f %d\n", catalog[c].averageT[n].R, catalog[c].averageT[n].D, MsysPSF, MrelPSF, Mcal, Mgrid, Mflat, delta, isBad); 1146 1168 } 1147 1169 … … 1150 1172 continue; 1151 1173 } 1152 Mcal = getMcal (m, c, flatcorr, catalog);1174 float Mcal = getMcal (m, c, MAG_CLASS_PSF); 1153 1175 if (isnan(Mcal)) { 1154 1176 info->Ncal++; 1155 1177 continue; 1156 1178 } 1157 Mgrid = getMgrid (m, c);1179 float Mgrid = getMgrid (m, c); 1158 1180 if (isnan(Mgrid)) { 1159 1181 info->Ngrid ++; 1160 1182 continue; 1161 1183 } 1162 Mrel = getMrel (catalog, m, c); 1163 if (isnan(Mrel)) { 1184 1185 // Mrel* is the average magnitude for this star. For PS1 stacks, we have too much 1186 // PSF variability. We need to calibrate the PSF magnitudes separately from the 1187 // Aperture-like magnitues. (We have an option to use the kron magnitudes or the 1188 // other apertures here). I basically need to do this analysis separately for each 1189 // magnitude type 1190 1191 float MrelPSF = getMrel (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); 1192 if (isnan(MrelPSF)) { 1164 1193 info->Nrel ++; 1165 1194 continue; 1166 1195 } 1196 float MrelKron = getMrel (catalog, m, c, MAG_CLASS_KRON, MAG_SRC_CHP); 1167 1197 1168 1198 // image.Mcal is not supposed to include the flat-field correction, so we need to … … 1171 1201 // the flat-correction. NOTE the sign of Mflat (Image.Mcal = Measure.Mcal - Mflat) 1172 1202 1173 Mflat = getMflat (m, c, flatcorr, catalog);1203 float Mflat = getMflat (m, c, flatcorr, catalog); 1174 1204 1175 1205 off_t n = catalog[c].measureT[m].averef; 1176 Msys= PhotSysTiny (&catalog[c].measureT[m], &catalog[c].averageT[n], &catalog[c].secfilt[n*Nsecfilt], MAG_CLASS_PSF);1177 if (isnan(Msys )) {1206 float MsysPSF = PhotSysTiny (&catalog[c].measureT[m], &catalog[c].averageT[n], &catalog[c].secfilt[n*Nsecfilt], MAG_CLASS_PSF); 1207 if (isnan(MsysPSF)) { 1178 1208 info->Nsys++; 1179 1209 continue; 1180 1210 } 1211 float MsysKron = PhotSysTiny (&catalog[c].measureT[m], &catalog[c].averageT[n], &catalog[c].secfilt[n*Nsecfilt], MAG_CLASS_KRON); 1181 1212 1182 1213 PhotCode *code = GetPhotcodebyCode (catalog[c].measureT[m].photcode); … … 1193 1224 assert (Nbright >= 0); 1194 1225 1195 list[N] = Msys - Mrel - Mcal - Mgrid + Mflat; 1196 dlist[N] = MAX (catalog[c].measureT[m].dM, MIN_ERROR); 1226 psfMagList[N] = MsysPSF - MrelPSF - Mcal - Mgrid + Mflat; 1227 psfErrList[N] = MAX (catalog[c].measureT[m].dM, MIN_ERROR); 1228 kronMagList[N] = MsysKron - MrelKron - Mcal - Mgrid + Mflat; 1229 kronErrList[N] = psfErrList[N]; 1197 1230 if (catalog[c].measureT[m].dM < IMFIT_SYS_SIGMA_LIM) { 1198 Mlist[Nbright] = list[N];1199 dMlist[Nbright] = dlist[N];1231 brightMagList[Nbright] = psfMagList[N]; 1232 brightErrList[Nbright] = psfErrList[N]; 1200 1233 Nbright ++; 1201 1234 } … … 1223 1256 } 1224 1257 1225 liststats ( list, dlist, NULL, N, &stats);1258 liststats (psfMagList, psfErrList, NULL, N, &stats); 1226 1259 if (VERBOSE2 && info->PoorImages) fprintf (stderr, "Mmos: %f %f %d %d\n", stats.mean, stats.sigma, stats.Nmeas, N); 1227 1260 1228 myMosaic[0].Mcal = stats.mean; 1229 myMosaic[0].dMcal = stats.error; 1261 // for now, I have no reason to measure these separately for camera-level images 1262 myMosaic[0].McalPSF = stats.mean; 1263 myMosaic[0].dMcal = stats.error; 1264 myMosaic[0].McalChiSq = stats.chisq; 1230 1265 myMosaic[0].nFitPhotom = N; 1231 myMosaic[0].Xm = 100.0*log10(stats.chisq); 1266 1267 liststats (kronMagList, kronErrList, NULL, N, &stats); 1268 myMosaic[0].McalAPER = stats.mean; 1232 1269 1233 1270 if (testImage) { … … 1237 1274 if (PLOTSTUFF) { 1238 1275 fprintf (stderr, "Mmos: %6.3f %6.3f +/- %6.3f %5d %5d | %s\n", stats.mean, stats.median, stats.sigma, stats.Nmeas, N, image[MosaicToImage[Nmos][0]].name); 1239 plot_setMcal ( list, N, &stats, CLOUD_TOLERANCE);1276 plot_setMcal (psfMagList, N, &stats, CLOUD_TOLERANCE); 1240 1277 } 1241 1278 1242 1279 // bright end scatter 1243 liststats ( Mlist, dMlist, NULL, Nbright, &stats);1280 liststats (brightMagList, brightErrList, NULL, Nbright, &stats); 1244 1281 myMosaic[0].dMsys = stats.sigma; 1245 1282 1246 if (myMosaic[0].Mcal < -CLOUD_TOLERANCE) {1247 myMosaic[0].Mcal = 0.0;1283 if (myMosaic[0].McalPSF < -CLOUD_TOLERANCE) { 1284 myMosaic[0].McalPSF = 0.0; 1248 1285 } 1249 1286 1250 1287 if (testImage) { 1251 fprintf (stderr, "%f %f : %f\n", myMosaic[0].Mcal , myMosaic[0].dMsys, pow (10.0, 0.01*myMosaic[0].Xm));1288 fprintf (stderr, "%f %f : %f\n", myMosaic[0].McalPSF, myMosaic[0].dMsys, myMosaic[0].McalChiSq); 1252 1289 } 1253 1290 … … 1427 1464 imageOffset[i] = 0.0; 1428 1465 1429 if (VERBOSE2 && (fabs(mosaic[i].Mcal ) < CLOUD_TOLERANCE)) {1430 fprintf (stderr, "cloud-free: %s : %f\n", image[MosaicToImage[i][0]].name, mosaic[i].Mcal );1466 if (VERBOSE2 && (fabs(mosaic[i].McalPSF) < CLOUD_TOLERANCE)) { 1467 fprintf (stderr, "cloud-free: %s : %f\n", image[MosaicToImage[i][0]].name, mosaic[i].McalPSF); 1431 1468 } 1432 if (VERBOSE2 && (mosaic[i].Mcal < -CLOUD_TOLERANCE)) {1433 imageOffset[i] = -mosaic[i].Mcal ;1434 // NOTE the negative sign: down below, we are going to add in the negative of Mcal 1469 if (VERBOSE2 && (mosaic[i].McalPSF < -CLOUD_TOLERANCE)) { 1470 imageOffset[i] = -mosaic[i].McalPSF; 1471 // NOTE the negative sign: down below, we are going to add in the negative of McalPSF 1435 1472 // to this image, and the propagated mean values for other images 1436 fprintf (stderr, "anti-clouds: %s : %f\n", image[MosaicToImage[i][0]].name, mosaic[i].Mcal );1473 fprintf (stderr, "anti-clouds: %s : %f\n", image[MosaicToImage[i][0]].name, mosaic[i].McalPSF); 1437 1474 } 1438 if (VERBOSE2 && (mosaic[i].Mcal > CLOUD_TOLERANCE)) {1439 fprintf (stderr, "cloudy : %s : %f\n", image[MosaicToImage[i][0]].name, mosaic[i].Mcal );1475 if (VERBOSE2 && (mosaic[i].McalPSF > CLOUD_TOLERANCE)) { 1476 fprintf (stderr, "cloudy : %s : %f\n", image[MosaicToImage[i][0]].name, mosaic[i].McalPSF); 1440 1477 } 1441 1478 } … … 1540 1577 } 1541 1578 1542 // a negative cloud image (cloud: Mcal > 0; anti-clouds: Mcal < 0; imageOffset = -Mcal)1579 // a negative cloud image (cloud: McalPSF > 0; anti-clouds: McalPSF < 0; imageOffset = -McalPSF) 1543 1580 if (imageOffset[i] > 0.0) continue; 1544 1581 … … 1564 1601 // find the images / mosaics with negative clouds and save their offset 1565 1602 for (i = 0; i < Nmosaic; i++) { 1566 mosaic[i].Mcal += imageOffset[i];1603 mosaic[i].McalPSF += imageOffset[i]; 1567 1604 } 1568 1605 … … 1605 1642 if (KEEP_UBERCAL && (mosaic[i].flags & ID_IMAGE_PHOTOM_UBERCAL)) continue; 1606 1643 1607 list[n] = mosaic[i].Mcal ;1644 list[n] = mosaic[i].McalPSF; 1608 1645 dlist[n] = 1; 1609 1646 n++; … … 1677 1714 c = MosaicToCatalog[i][j]; 1678 1715 1679 Mcal = getMcal (m, c, flatcorr, catalog);1716 Mcal = getMcal (m, c, MAG_CLASS_PSF); 1680 1717 if (isnan(Mcal)) continue; 1681 1718 Mgrid = getMgrid (m, c); 1682 1719 if (isnan(Mgrid)) continue; 1683 Mrel = getMrel (catalog, m, c );1720 Mrel = getMrel (catalog, m, c, MAG_CLASS_PSF, MAG_SRC_CHP); 1684 1721 if (isnan(Mrel)) continue; 1685 1722 N++; … … 1719 1756 if (KEEP_UBERCAL && (mosaic[i].flags & ID_IMAGE_PHOTOM_UBERCAL)) continue; 1720 1757 1721 list[n] = pow (10.0, 0.01*mosaic[i].Xm);1758 list[n] = mosaic[i].McalChiSq; 1722 1759 dlist[n] = 1; 1723 1760 n++; … … 1751 1788 if (mosaic[i].flags & IMAGE_BAD) continue; 1752 1789 if (mosaic[i].skipCal) continue; 1753 mlist[N] = mosaic[i].Mcal ;1790 mlist[N] = mosaic[i].McalPSF; 1754 1791 slist[N] = mosaic[i].dMcal; 1755 1792 dlist[N] = 1; … … 1781 1818 Nscatter ++; 1782 1819 } 1783 if (fabs(mosaic[i].Mcal - MedOffset) > MaxOffset) {1820 if (fabs(mosaic[i].McalPSF - MedOffset) > MaxOffset) { 1784 1821 mark = TRUE; 1785 1822 Noffset ++; … … 1858 1895 1859 1896 for (i = 0; i < Nmosaic; i++) { 1860 Mlist[i] = mosaic[i].Mcal ;1897 Mlist[i] = mosaic[i].McalPSF; 1861 1898 dlist[i] = mosaic[i].dMcal; 1862 1899 xlist[i] = mosaic[i].secz; -
trunk/Ohana/src/relphot/src/StarOps.c
r40019 r40291 34 34 } 35 35 36 float getMrel (Catalog *catalog, off_t meas, int cat) { 37 38 int Nsec, Nsecfilt, photcode; 39 int ave; 40 float value; 41 42 ave = catalog[cat].measureT[meas].averef; 43 photcode = catalog[cat].measureT[meas].photcode; 36 // 37 float getMrel (Catalog *catalog, off_t meas, int cat, dvoMagClassType class, dvoMagSourceType source) { 38 39 int ave = catalog[cat].measureT[meas].averef; 40 int photcode = catalog[cat].measureT[meas].photcode; 44 41 45 42 int ecode = GetPhotcodeEquivCodebyCode (photcode); 46 Nsec = GetPhotcodeNsec(ecode); 47 Nsecfilt = GetPhotcodeNsecfilt (); 43 int Nsec = GetPhotcodeNsec(ecode); 44 int Nsecfilt = GetPhotcodeNsecfilt (); 45 46 int entry = Nsecfilt*ave+Nsec; 47 48 SecFilt *secfilt = &catalog[cat].secfilt[entry]; 48 49 49 50 // is this star OK? 50 if (catalog[cat].secfilt[Nsecfilt*ave+Nsec].flags & STAR_BAD) return (NAN); 51 52 value = catalog[cat].secfilt[Nsecfilt*ave+Nsec].M; 53 return (value); 51 if (secfilt->flags & STAR_BAD) return (NAN); 52 53 switch (class) { 54 case MAG_CLASS_PSF: 55 switch (source) { 56 case MAG_SRC_CHP: 57 return secfilt->MpsfChp; 58 case MAG_SRC_WRP: 59 return secfilt->MpsfWrp; 60 case MAG_SRC_STK: 61 return secfilt->MpsfStk; 62 default: 63 return NAN; 64 } 65 break; 66 case MAG_CLASS_KRON: 67 switch (source) { 68 case MAG_SRC_CHP: 69 return secfilt->MkronChp; 70 case MAG_SRC_WRP: 71 return secfilt->MkronWrp; 72 case MAG_SRC_STK: 73 return secfilt->MkronStk; 74 default: 75 return NAN; 76 } 77 break; 78 case MAG_CLASS_APER: 79 switch (source) { 80 case MAG_SRC_CHP: 81 return secfilt->MapChp; 82 case MAG_SRC_WRP: 83 return secfilt->MapWrp; 84 case MAG_SRC_STK: 85 return secfilt->MapStk; 86 default: 87 return NAN; 88 } 89 break; 90 case MAG_CLASS_NONE: 91 case MAG_CLASS_DEV: // DeVaucouleur Model (only for galphot) 92 case MAG_CLASS_EXP: // Exponential Model (only for galphot) 93 case MAG_CLASS_SER: // Sersic Model (only for galphot) 94 return NAN; 95 break; 96 } 97 return NAN; // should not be able to reach here 54 98 } 55 99 … … 429 473 int i; 430 474 off_t j, k, m; 431 float Mcal, Mmos, Mgrid;432 475 433 476 MEAS_BAD = ID_MEAS_NOCAL; … … 440 483 for (k = 0; k < catalog[i].averageT[j].Nmeasure; k++, m++) { 441 484 if (catalog[i].measureT[m].dbFlags & MEAS_BAD) continue; 442 Mcal = getMcal (m, i, flatcorr, catalog); 443 if (isnan(Mcal)) continue; 444 Mmos = getMmos (m, i); 485 float McalPSF = getMcal (m, i, MAG_CLASS_PSF); 486 float McalAPER = getMcal (m, i, MAG_CLASS_APER); 487 if (isnan(McalPSF)) continue; 488 float Mmos = getMmos (m, i); 445 489 if (isnan(Mmos)) continue; 446 Mgrid = getMgrid (m, i);490 float Mgrid = getMgrid (m, i); 447 491 if (isnan(Mgrid)) continue; 492 493 // Note that this operation is setting measure->McalAPER to image->McalAPER only 494 // for the stacks. Elsewhere (setMrelCatalog) we are using image->McalPSF for all 495 // types of measurements EXCEPT stacks. 496 497 // we need to use McalAPER for stacks (and only stacks) 498 int useStackAper = !USE_MCAL_PSF_FOR_STACK_APER && isGPC1stack(catalog[i].measureT[m].photcode); 448 499 449 500 // note that measurements for which the image is not selected will not be modified … … 451 502 452 503 // set the output calibration 453 catalog[i].measure[m].Mcal = Mcal + Mmos + Mgrid; 504 catalog[i].measure[m].McalPSF = McalPSF + Mmos + Mgrid; 505 catalog[i].measure[m].McalAPER = useStackAper ? McalAPER + Mmos + Mgrid : McalPSF + Mmos + Mgrid; 454 506 455 507 if (catalog[i].measureT[m].dbFlags & ID_MEAS_PHOTOM_UBERCAL) { 456 myAssert (isfinite(catalog[i].measure[m].Mcal ), "oops, broke an ubercal mag");508 myAssert (isfinite(catalog[i].measure[m].McalPSF), "oops, broke an ubercal mag"); 457 509 } 458 510 } … … 501 553 } 502 554 555 int dumpMags (FILE *fout, Catalog *catalog, int Ncatalog) { 556 557 int i, n; 558 off_t j; 559 560 int Nsecfilt = GetPhotcodeNsecfilt (); 561 562 for (i = 0; i < Ncatalog; i++) { 563 for (j = 0; (j < catalog[i].Naverage) && (j < 2); j++) { 564 fprintf (fout, "%08x %08x %10.6f %10.6f : \n", catalog[i].averageT[j].catID, catalog[i].averageT[j].objID, catalog[i].averageT[j].R, catalog[i].averageT[j].D); 565 for (n = 0; n < 5; n++) { 566 fprintf (fout, "secf %5d | %6.3f %6.3f | %6.3f %6.3f | %6.3f %6.3f\n", n, catalog[i].secfilt[j*Nsecfilt + n].MpsfChp, catalog[i].secfilt[j*Nsecfilt + n].MkronChp, catalog[i].secfilt[j*Nsecfilt + n].MpsfStk, catalog[i].secfilt[j*Nsecfilt + n].MkronStk, catalog[i].secfilt[j*Nsecfilt + n].MpsfWrp, catalog[i].secfilt[j*Nsecfilt + n].MkronWrp); 567 } 568 int m = catalog[i].averageT[j].measureOffset; 569 for (n = 0; n < catalog[i].averageT[j].Nmeasure; n++) { 570 fprintf (fout, "meas %5d %5d | %6.3f %6.3f | %6.3f %6.3f\n", m+n, catalog[i].measureT[m+n].photcode, catalog[i].measureT[m+n].M, catalog[i].measureT[m+n].Mkron, catalog[i].measureT[m+n].McalPSF, catalog[i].measureT[m+n].McalAPER); 571 } 572 } 573 } 574 return TRUE; 575 } 576 503 577 void clean_stars (Catalog *catalog, int Ncatalog) { 504 578 … … 513 587 if (VERBOSE) fprintf (stderr, "marking poor stars\n"); 514 588 515 /* find Xmmedian -> ChiSq lim must be > median */589 /* find Mchisq median -> ChiSq lim must be > median */ 516 590 for (i = Ntot = 0; i < Ncatalog; i++) { 517 591 Ntot += catalog[i].Naverage; … … 535 609 if (isnan(Mchisq)) continue; 536 610 xlist[Ntot] = Mchisq; 537 slist[Ntot] = catalog[i].secfilt[Nsecfilt*j+Nsec].dM ;611 slist[Ntot] = catalog[i].secfilt[Nsecfilt*j+Nsec].dMpsfChp; 538 612 dlist[Ntot] = 1; 539 613 Ntot ++; … … 551 625 for (i = 0; i < Ncatalog; i++) { 552 626 for (j = 0; j < catalog[i].Naverage; j++) { 553 dM = catalog[i].secfilt[Nsecfilt*j+Nsec].dM ;627 dM = catalog[i].secfilt[Nsecfilt*j+Nsec].dMpsfChp; 554 628 float Mchisq = catalog[i].secfilt[Nsecfilt*j+Nsec].Mchisq; 555 629 mark = (dM > MaxScatter) || (isnan(Mchisq)) || (Mchisq > MaxChisq); … … 578 652 // NSIGMA_REJECT (5) sigma of the mean 579 653 654 // this function only operations on the PSF magnitudes 655 580 656 # define NSIGMA_CLIP 3.0 581 657 # define NSIGMA_REJECT 5.0 … … 644 720 645 721 // NOTE: we do not skip MEAS_BAD because this measurement is just an internal assessment of the outliers 646 Mcal = getMcal (m, i, flatcorr, catalog);722 Mcal = getMcal (m, i, MAG_CLASS_PSF); 647 723 if (isnan(Mcal)) { Ncal ++; continue; } 648 724 Mmos = getMmos (m, i); … … 695 771 696 772 // NOTE: we do not skip MEAS_BAD because this measurement is just an internal assessment of the outliers 697 Mcal = getMcal (m, i, flatcorr, catalog);773 Mcal = getMcal (m, i, MAG_CLASS_PSF); 698 774 if (isnan(Mcal)) continue; 699 775 Mmos = getMmos (m, i); … … 776 852 int ecode = GetPhotcodeEquivCodebyCode (catalog[i].measureT[m].photcode); 777 853 if (ecode != seccode) { continue;} 778 Mcal = getMcal (m, i, flatcorr, catalog);854 Mcal = getMcal (m, i, MAG_CLASS_PSF); 779 855 if (isnan(Mcal)) { continue;} 780 856 Mmos = getMmos (m, i); … … 865 941 if (catalog[i].secfilt[Nsecfilt*j+Nsec].flags & STAR_BAD) continue; 866 942 867 dM = catalog[i].secfilt[Nsecfilt*j+Nsec].dM ;943 dM = catalog[i].secfilt[Nsecfilt*j+Nsec].dMpsfChp; 868 944 if (isnan(dM)) continue; 869 945 list[n] = dM; … … 906 982 for (j = 0; j < catalog[i].Naverage; j++) { 907 983 if (catalog[i].secfilt[Nsecfilt*j+Nsec].flags & STAR_BAD) continue; 908 dMrel = catalog[i].secfilt[Nsecfilt*j+Nsec].dM ;984 dMrel = catalog[i].secfilt[Nsecfilt*j+Nsec].dMpsfChp; 909 985 bin = dMrel / 0.00025; 910 986 bin = MAX (0, MIN (NBIN-1, bin)); … … 946 1022 for (j = 0; j < catalog[i].Naverage; j++) { 947 1023 if (catalog[i].secfilt[Nsecfilt*j+Nsec].flags & STAR_BAD) continue; 948 xlist[N] = catalog[i].secfilt[Nsecfilt*j+Nsec].M ;1024 xlist[N] = catalog[i].secfilt[Nsecfilt*j+Nsec].MpsfChp; 949 1025 value = catalog[i].secfilt[Nsecfilt*j+Nsec].Mchisq; 950 1026 if (isnan((double)(value))) continue; -
trunk/Ohana/src/relphot/src/args.c
r39926 r40291 325 325 remove_argument (N, &argc, argv); 326 326 CALIBRATE_STACKS_AND_WARPS = TRUE; 327 } 328 USE_MCAL_PSF_FOR_STACK_APER = FALSE; 329 if ((N = get_argument (argc, argv, "-use-mcal-psf-for-stack-aper"))) { 330 remove_argument (N, &argc, argv); 331 USE_MCAL_PSF_FOR_STACK_APER = TRUE; 327 332 } 328 333 … … 696 701 } 697 702 703 USE_MCAL_PSF_FOR_STACK_APER = FALSE; 704 if ((N = get_argument (argc, argv, "-use-mcal-psf-for-stack-aper"))) { 705 remove_argument (N, &argc, argv); 706 USE_MCAL_PSF_FOR_STACK_APER = TRUE; 707 } 708 698 709 /* define time */ 699 710 TimeSelect = FALSE; -
trunk/Ohana/src/relphot/src/bcatalog.c
r39641 r40291 153 153 if (subcatalog[0].measureT[Nmeasure].dbFlags & ID_MEAS_PHOTOM_UBERCAL) { 154 154 if (!KEEP_UBERCAL) { 155 subcatalog[0].measureT[Nmeasure].Mcal = 0.0; 155 subcatalog[0].measureT[Nmeasure].McalPSF = 0.0; 156 subcatalog[0].measureT[Nmeasure].McalAPER = 0.0; 156 157 subcatalog[0].measureT[Nmeasure].dbFlags &= ~ID_MEAS_PHOTOM_UBERCAL; 157 158 } 158 159 } else { 159 160 if (getImageEntry (Nmeasure, Ncat) >= 0) { 160 subcatalog[0].measureT[Nmeasure].Mcal = 0.0; 161 subcatalog[0].measureT[Nmeasure].McalPSF = 0.0; 162 subcatalog[0].measureT[Nmeasure].McalAPER = 0.0; 161 163 } 162 164 } -
trunk/Ohana/src/relphot/src/launch_region_hosts.c
r39511 r40291 58 58 strextend (&command, "-cloud-limit %f", CLOUD_TOLERANCE); 59 59 60 if (VERBOSE) strextend (&command, "-v");61 if (VERBOSE2) strextend (&command, "-vv");62 if (RESET) strextend (&command, "-reset");63 if (RESET_ZEROPTS) strextend (&command, "-reset-zpts");64 if (!KEEP_UBERCAL) strextend (&command, "-reset-ubercal");65 if (DophotSelect) strextend (&command, "-dophot %d", DophotValue);66 if (ImagSelect) strextend (&command, "-instmag %f %f", ImagMin, ImagMax);67 if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue);68 if (SyntheticPhotometry) strextend (&command, "-synthphot");69 if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search");60 if (VERBOSE) strextend (&command, "-v"); 61 if (VERBOSE2) strextend (&command, "-vv"); 62 if (RESET) strextend (&command, "-reset"); 63 if (RESET_ZEROPTS) strextend (&command, "-reset-zpts"); 64 if (!KEEP_UBERCAL) strextend (&command, "-reset-ubercal"); 65 if (DophotSelect) strextend (&command, "-dophot %d", DophotValue); 66 if (ImagSelect) strextend (&command, "-instmag %f %f", ImagMin, ImagMax); 67 if (MaxDensityUse) strextend (&command, "-max-density %f", MaxDensityValue); 68 if (SyntheticPhotometry) strextend (&command, "-synthphot"); 69 if (USE_BASIC_CHECK) strextend (&command, "-basic-image-search"); 70 70 71 if (UPDATE) strextend (&command, "-update"); 72 if (MOSAIC_ZEROPT) strextend (&command, "-mosaic"); 73 if (FREEZE_IMAGES) strextend (&command, "-imfreeze"); 74 if (FREEZE_MOSAICS) strextend (&command, "-mosfreeze"); 75 if (PARALLEL) strextend (&command, "-parallel"); 76 if (PARALLEL_MANUAL) strextend (&command, "-parallel-manual"); 77 if (PARALLEL_SERIAL) strextend (&command, "-parallel-serial"); 71 if (UPDATE) strextend (&command, "-update"); 72 if (MOSAIC_ZEROPT) strextend (&command, "-mosaic"); 73 if (FREEZE_IMAGES) strextend (&command, "-imfreeze"); 74 if (FREEZE_MOSAICS) strextend (&command, "-mosfreeze"); 75 if (CALIBRATE_STACKS_AND_WARPS) strextend (&command, "-only-stacks-and-warps"); 76 if (USE_MCAL_PSF_FOR_STACK_APER) { strextend (&command, "-use-mcal-psf-for-stack-aper"); } 77 78 if (PARALLEL) strextend (&command, "-parallel"); 79 if (PARALLEL_MANUAL) strextend (&command, "-parallel-manual"); 80 if (PARALLEL_SERIAL) strextend (&command, "-parallel-serial"); 78 81 79 82 // XXX deprecate this if we are happy with the new version -
trunk/Ohana/src/relphot/src/liststats.c
r39648 r40291 194 194 # define WEIGHT_THRESHOLD 0.3 195 195 196 int fit_least_squares (double *fit, double * y, double *dy, double *wgt, double *wt, int Npts);196 int fit_least_squares (double *fit, double *err, double *y, double *dy, double *wgt, double *wt, int Npts); 197 197 double VectorFractionInterpolate (double *values, float fraction, int Npts); 198 198 double weight_cauchy (double x); … … 253 253 254 254 double oldValue = value; 255 if (!fit_least_squares (&value, dataset->flxlist, dataset->errlist, dataset->wgtlist, dataset->wtvals, Npoints)) {255 if (!fit_least_squares (&value, NULL, dataset->flxlist, dataset->errlist, dataset->wgtlist, dataset->wtvals, Npoints)) { 256 256 value = oldValue; 257 257 break; … … 330 330 } 331 331 332 if (!fit_least_squares (&value, dataset->ysample, dataset->dysample, dataset->wtsample, NULL, Nkeep)) continue;332 if (!fit_least_squares (&value, NULL, dataset->ysample, dataset->dysample, dataset->wtsample, NULL, Nkeep)) continue; 333 333 334 334 dataset->bvalue[Nboot] = value; … … 342 342 stats->error = (Shi - Slo) / 2.0; 343 343 344 // bootstrap can sometimes yield an excessively-optimistic result for the error. Do not let 345 // the reported error be smaller than the formal error 346 double errvalue; 347 if (fit_least_squares (&value, &errvalue, dataset->ykeep, dataset->dykeep, dataset->wtkeep, NULL, Nkeep)) { 348 stats->error = MAX (stats->error, errvalue); 349 } 350 344 351 return TRUE; 345 352 } 346 353 347 354 // wgt is externally-supplied weight, wt is optional 348 int fit_least_squares (double *fit, double * y, double *dy, double *wgt, double *wt, int Npts) {355 int fit_least_squares (double *fit, double *err, double *y, double *dy, double *wgt, double *wt, int Npts) { 349 356 350 357 int i; … … 364 371 } 365 372 if (S0 == 0.0) return FALSE; 366 *fit = S1 / S0; 373 *fit = S1 / S0; 374 if (err) { *err = 1.0 / S0; } 367 375 return TRUE; 368 376 } -
trunk/Ohana/src/relphot/src/load_images.c
r39642 r40291 52 52 free (subset); 53 53 subset = image; 54 } 55 } 56 57 // reset image values as needed. always allow 'few' images to succeed, if possible (new 58 // images / detections may have been added 59 for (off_t i = 0; i < Nsubset; i++) { 60 if (subset[i].flags & ID_IMAGE_PHOTOM_FEW) { 61 subset[i].flags &= ~(ID_IMAGE_PHOTOM_FEW | ID_IMAGE_PHOTOM_POOR); 62 } 63 if (RESET) { 64 if (RESET_ZEROPTS) { 65 if (!KEEP_UBERCAL || !(subset[i].flags & ID_IMAGE_PHOTOM_UBERCAL)) { 66 subset[i].McalPSF = 0.0; 67 subset[i].McalAPER = 0.0; 68 subset[i].dMcal = NAN; 69 subset[i].flags &= ~ID_IMAGE_PHOTOM_UBERCAL; 70 } 71 } 72 subset[i].flags &= ~ID_IMAGE_PHOTOM_POOR; 73 subset[i].ubercalDist = 1000; 54 74 } 55 75 } -
trunk/Ohana/src/relphot/src/plot_scatter.c
r37037 r40291 40 40 41 41 if (catalog[i].measureT[m].dbFlags & MEAS_BAD) continue; 42 Mcal = getMcal (m, i, flatcorr, catalog);42 Mcal = getMcal (m, i, MAG_CLASS_PSF); 43 43 if (isnan(Mcal)) continue; 44 44 Mmos = getMmos (m, i); … … 47 47 if (isnan(Mgrid)) continue; 48 48 49 Mrel = catalog[i].secfilt[Nsecfilt*j+Nsec].M ;49 Mrel = catalog[i].secfilt[Nsecfilt*j+Nsec].MpsfChp; 50 50 if (isnan(Mrel)) continue; 51 51 -
trunk/Ohana/src/relphot/src/plotstuff.c
r39457 r40291 179 179 180 180 KapaInitGraph (graphdata); 181 graphdata[0].style = 2;181 graphdata[0].style = KAPA_PLOT_POINTS; /* points */ 182 182 graphdata[0].ptype = 2; 183 183 graphdata[0].ltype = 0; -
trunk/Ohana/src/relphot/src/reload_catalogs.c
r39926 r40291 247 247 if (SYNTH_ZERO_POINTS) { strextend (&command, "-synthphot-zpts %s", SYNTH_ZERO_POINTS); } 248 248 if (USE_BASIC_CHECK) { strextend (&command, "-basic-image-search"); } 249 if (USE_MCAL_PSF_FOR_STACK_APER) { strextend (&command, "-use-mcal-psf-for-stack-aper"); } 249 250 250 251 if (!(STAGES & STAGE_CHIP)) { strextend (&command, "-skip-chip"); } -
trunk/Ohana/src/relphot/src/relphot_images.c
r39643 r40291 42 42 MARKTIME("-- load images: %f sec\n", dtime); 43 43 44 // checkImages("load images"); 45 44 46 /* unlock, if we can (else, unlocked below) */ 45 47 if (!UPDATE) dvo_image_unlock (&db); 46 48 47 49 // load the flat correction table (if defined) 50 // we no longer need to do this: the flatcorrection is now saved in measure.Mflat 48 51 # if (0) 49 52 char flatcorrfile[256]; … … 60 63 /* add in a loop over the catalogs calling dvo_catalog_chipcoords */ 61 64 65 // checkImages("load catalog"); 66 62 67 /* match measurements with images, mosaics */ 63 68 initImageBins (catalog, Ncatalog, TRUE); … … 77 82 78 83 setExclusions (catalog, Ncatalog, TRUE); 84 // checkImages("set Exclu"); 79 85 80 86 global_stats (catalog, Ncatalog, flatcorr, 0); … … 108 114 plot_scatter (catalog, Ncatalog, flatcorr); 109 115 } 116 if (VERBOSE2) dumpMags (stderr, catalog, Ncatalog); 117 // checkImages("start loop"); 118 110 119 setMrel (catalog, Ncatalog, flatcorr); // threaded 120 if (VERBOSE2) dumpMags (stderr, catalog, Ncatalog); 121 // checkImages("set Mrel"); 122 111 123 if (PLOTSTUFF) { 112 124 plot_scatter (catalog, Ncatalog, flatcorr); 113 125 } 114 126 setMcal (catalog, FALSE, flatcorr); 127 // checkImages("set Mcal"); 128 if (VERBOSE2) dumpMags (stderr, catalog, Ncatalog); 129 115 130 setMmos (catalog, FALSE, flatcorr); 116 131 setMgrid (catalog, flatcorr); … … 213 228 // ensure the db format is updated 214 229 dbX.format = dvo_catalog_catformat (UPDATE_CATFORMAT); 230 gfits_modify (&dbX.header, "FORMAT", "%s", 1, UPDATE_CATFORMAT); 231 215 232 char photcodeFile[1024]; 216 233 sprintf (photcodeFile, "%s/Photcodes.dat", CATDIR); … … 257 274 // ensure the db format is updated 258 275 db.format = dvo_catalog_catformat (UPDATE_CATFORMAT); 276 gfits_modify (&db.header, "FORMAT", "%s", 1, UPDATE_CATFORMAT); 259 277 } 260 278 if (CALIBRATE_STACKS_AND_WARPS || (NLOOP > 0)) { -
trunk/Ohana/src/relphot/src/relphot_objects.c
r39926 r40291 251 251 if (USE_BASIC_CHECK) { strextend (&command, "-basic-image-search"); } 252 252 if (USE_ALL_IMAGES) { strextend (&command, "-use-all-images"); } 253 if (USE_MCAL_PSF_FOR_STACK_APER) { strextend (&command, "-use-mcal-psf-for-stack-aper"); } 253 254 254 255 if (!(STAGES & STAGE_CHIP)) { strextend (&command, "-skip-chip"); } -
trunk/Ohana/src/relphot/src/relphot_parallel_images.c
r39643 r40291 36 36 client_logger_message ("loaded images\n"); 37 37 38 // once we have read this table, we should remove it for repeat runs39 // unlink (IMAGE_TABLE); // XXX a bit risky, add some protection?40 41 38 makeMosaics (image, Nimage, TRUE); 42 39 … … 44 41 45 42 // load the flat correction table (if defined) 43 // we no longer need to do this: the flatcorrection is now saved in measure.Mflat 46 44 # if (0) 47 45 char flatcorrfile[256]; … … 150 148 client_logger_message ("all hosts are done the loops\n"); 151 149 152 /* set Mcal & Mmos for bad images */ 153 setMcal (catalog, TRUE, flatcorr); 154 setMmos (catalog, TRUE, flatcorr); 150 /* set Mcal & Mmos for bad images (for stack_and_warps, force images to be measured) */ 151 int onlyPoorImages = !CALIBRATE_STACKS_AND_WARPS; 152 setMcal (catalog, onlyPoorImages, flatcorr); 153 setMmos (catalog, onlyPoorImages, flatcorr); 155 154 MARKTIME("-- finalize Mcal values: %f sec\n", dtime); 156 155 … … 171 170 freeGridBins (Ncatalog); 172 171 freeImages((char *)image); 172 free (image); 173 173 174 174 SkyListFree(skylist); -
trunk/Ohana/src/relphot/src/relphot_parallel_regions.c
r39643 r40291 51 51 // ensure the db format is updated 52 52 db.format = dvo_catalog_catformat (UPDATE_CATFORMAT); 53 gfits_modify (&db.header, "FORMAT", "%s", 1, UPDATE_CATFORMAT); 53 54 } 54 55 … … 84 85 85 86 // save the changes to the image parameters 86 dvo_image_save (&db, VERBOSE); // this function modifies the db.ftable.buffer: do not free stored Image table 87 dvo_image_save (&db, VERBOSE); 88 89 // dvo_image_save frees db.ftable.buffer (== image) and replaces it: do not free stored Image table 90 clearImages (); 91 87 92 dvo_image_unlock (&db); 88 93 MARKTIME ("finished relphot -parallel-regions: %f sec total\n", dtime); -
trunk/Ohana/src/relphot/src/relphot_synthphot_catalog.c
r38062 r40291 92 92 float *value = (float *) zpts->matrix[Nsec].buffer; 93 93 float ZP = !isnan(value[Npix]) ? value[Npix] : 0.0; 94 secfilt[Nsec].M = measure[measSYN[i]].M + ZP;95 secfilt[Nsec].dM = 0.6;96 secfilt[Nsec].Mchisq = NAN;97 secfilt[Nsec].flags |= ID_SECF_USE_SYNTH;94 secfilt[Nsec].MpsfChp = measure[measSYN[i]].M + ZP; 95 secfilt[Nsec].dMpsfChp = 0.6; 96 secfilt[Nsec].Mchisq = NAN; 97 secfilt[Nsec].flags |= ID_SECF_USE_SYNTH; 98 98 } 99 99 } -
trunk/Ohana/src/relphot/src/select_images.c
r39648 r40291 251 251 image[nimage] = timage[i]; 252 252 inSubset[i] = TRUE; 253 /* always allow 'few' images to succeed, if possible (new images / detections may have254 * been added) */255 if (image[nimage].flags & ID_IMAGE_PHOTOM_FEW) {256 image[nimage].flags &= ~(ID_IMAGE_PHOTOM_FEW | ID_IMAGE_PHOTOM_POOR);257 }258 if (RESET) {259 if (RESET_ZEROPTS) {260 if (!KEEP_UBERCAL || !(image[nimage].flags & ID_IMAGE_PHOTOM_UBERCAL)) {261 image[nimage].Mcal = 0.0;262 image[nimage].dMcal = NAN;263 image[nimage].flags &= ~ID_IMAGE_PHOTOM_UBERCAL;264 }265 }266 image[nimage].flags &= ~ID_IMAGE_PHOTOM_POOR;267 image[nimage].ubercalDist = 1000;268 }269 253 line_number[nimage] = i; 270 254 nimage ++; -
trunk/Ohana/src/relphot/src/setMrelCatalog.c
r39926 r40291 2 2 3 3 # if (0) 4 # define TEST_OBJ_ID 0x0000 000e5 # define TEST_CAT_ID 0x0000 76ee4 # define TEST_OBJ_ID 0x000098f9 5 # define TEST_CAT_ID 0x00005ad3 6 6 # else 7 7 # define TEST_OBJ_ID 0 … … 102 102 // 3) UBERCAL measurements can have their weight increased by a big factor to help tie down the averages 103 103 // 4) some reference photcode of some kind can be specified as fixed and have a high weight 104 105 // Although I calculate McalAPER for exposures, I am only using McalPSF for chips. Note 106 // in StarOps.c:setMcalOutput I am setting measure->McalAPER to image->McalPSF for chips 107 // and warps, but not stacks 104 108 105 109 // set mean of chip measurements (selected by photcode range for now): … … 224 228 // overlaps). Msys + measure.Mcal is our best guess of the true magnitude 225 229 Mmos = Mgrid = 0; 226 Mcal = measureT[k].Mcal ; // check that this is zero for loaded REF value230 Mcal = measureT[k].McalPSF; // check that this is zero for loaded REF value 227 231 } else { 228 // getMcal_alt returns image[].Mcal modified by flatcorr(image.photom_map_id,x,y) 229 // NOTE: getMcal_alt does not include measure.Mflat 230 Mcal = getMcal_alt (meas, cat, flatcorr, measureT[k].Xccd, measureT[k].Yccd); 232 // getMcal returns image[].Mcal; note the flat-field correction is stored in measure.Mflat 233 Mcal = getMcal (meas, cat, MAG_CLASS_PSF); 231 234 if (isnan(Mcal)) SKIP_THIS_MEAS(Ncal); 232 235 Mmos = getMmos (meas, cat); … … 268 271 } 269 272 270 float Mkron, dMkron; 273 // NOTE: we need to calculate the averge chip Kron on each pass to be able to calibrate the stacks 274 float Mkron = PhotCatTiny (&measureT[k], MAG_CLASS_KRON); 275 float dMkron; 271 276 if (isSetMrelFinal) { 272 Mkron = PhotCat (&measure[k], MAG_CLASS_KRON);273 277 dMkron = MAX (hypot(measure[k].dMkron, code->photomErrSys), MIN_ERROR); 274 if (CHECK_VALID_MAG(Mkron, dMkron)) { 275 int Nkron = results->kronData[Nsec].Nlist; 276 results->kronData[Nsec].flxlist[Nkron] = Mkron - Mflat - Mcal - Mmos - Mgrid; // this is consistent with PhotRel 277 results->kronData[Nsec].errlist[Nkron] = dMkron; 278 results->kronData[Nsec].wgtlist[Nkron] = isUbercal ? UBERCAL_WEIGHT : 1.0; 279 results->kronData[Nsec].ranking[Nkron] = measureRank[k]; 280 results->kronData[Nsec].measSeq[Nkron] = k; 281 results->kronData[Nsec].msklist[Nkron] = 0; 282 results->kronData[Nsec].Nlist ++; 283 } 278 } else { 279 dMkron = MAX (hypot(measureT[k].dM, code->photomErrSys), MIN_ERROR); 280 } 281 if (CHECK_VALID_MAG(Mkron, dMkron)) { 282 int Nkron = results->kronData[Nsec].Nlist; 283 results->kronData[Nsec].flxlist[Nkron] = Mkron - Mflat - Mcal - Mmos - Mgrid; // this is consistent with PhotRel 284 results->kronData[Nsec].errlist[Nkron] = dMkron; 285 results->kronData[Nsec].wgtlist[Nkron] = isUbercal ? UBERCAL_WEIGHT : 1.0; 286 results->kronData[Nsec].ranking[Nkron] = measureRank ? measureRank[k] : 0; 287 results->kronData[Nsec].measSeq[Nkron] = k; 288 results->kronData[Nsec].msklist[Nkron] = 0; 289 results->kronData[Nsec].Nlist ++; 284 290 } 285 291 … … 377 383 } 378 384 } 379 secfilt[Nsec].M = Mpsf + ZP;380 secfilt[Nsec].dM = 0.6;381 secfilt[Nsec].Mchisq = 0.0;382 secfilt[Nsec].flags |= ID_SECF_USE_SYNTH;385 secfilt[Nsec].MpsfChp = Mpsf + ZP; 386 secfilt[Nsec].dMpsfChp = 0.6; 387 secfilt[Nsec].Mchisq = 0.0; 388 secfilt[Nsec].flags |= ID_SECF_USE_SYNTH; 383 389 continue; 384 390 } … … 386 392 // if too few valid measurements meet the minimum criteria, go to the next entry 387 393 StatType *psfstats = &results->psfstats; 388 int Nranking = MAG_STATS_BY_RANKING (&results->psfData[Nsec], psfstats);389 if (Nranking < Nminmeas) {394 int NrankingPSF = MAG_STATS_BY_RANKING (&results->psfData[Nsec], psfstats); 395 if (NrankingPSF < Nminmeas) { 390 396 secfilt[Nsec].flags |= ID_OBJ_FEW; 391 397 } else { 392 secfilt[Nsec].M = psfstats->mean; 393 secfilt[Nsec].dM = psfstats->error; 394 secfilt[Nsec].Mchisq = (psfstats->Nmeas > 1) ? psfstats->chisq : NAN; 395 } 396 int minRankPSF = (Nranking > 0) ? results->psfData[Nsec].ranking[0] : 10; 398 secfilt[Nsec].MpsfChp = psfstats->mean; 399 secfilt[Nsec].dMpsfChp = psfstats->error; 400 secfilt[Nsec].Mchisq = (psfstats->Nmeas > 1) ? psfstats->chisq : NAN; 401 } 397 402 398 403 // when running -averages, we have no information about the images, so we cannot set this … … 401 406 } 402 407 408 StatType *kronstats = &results->kronstats; 409 int NrankingKRON = MAG_STATS_BY_RANKING (&results->kronData[Nsec], kronstats); 410 if (NrankingKRON) { 411 secfilt[Nsec].MkronChp = kronstats->mean; 412 secfilt[Nsec].dMkronChp = kronstats->error; 413 secfilt[Nsec].sMkronChp = kronstats->sigma; 414 secfilt[Nsec].NusedKron = NrankingKRON; 415 } 416 403 417 if (isSetMrelFinal) { 404 418 if ((average[0].objID == TEST_OBJ_ID) && (average[0].catID == TEST_CAT_ID)) { … … 406 420 } 407 421 408 // mark the measurements matching this ranking 409 markMeasureByRanking (&results->psfData[Nsec], measure, minRankPSF, ID_MEAS_PHOTOM_PSF, ID_MEAS_MASKED_PSF); 410 411 if (Nranking) { 412 secfilt[Nsec].Mstdev = psfstats->sigma; 413 secfilt[Nsec].Nused = psfstats->Nmeas; 414 secfilt[Nsec].Mmax = psfstats->max; 415 secfilt[Nsec].Mmin = psfstats->min; 422 if (NrankingPSF) { 423 secfilt[Nsec].sMpsfChp = psfstats->sigma; 424 secfilt[Nsec].Nused = psfstats->Nmeas; 425 secfilt[Nsec].Mmax = psfstats->max; 426 secfilt[Nsec].Mmin = psfstats->min; 416 427 } 417 428 secfilt[Nsec].psfQfMax = results->psfQfMax[Nsec]; … … 421 432 MAX_NOT_NAN (psfQfPerfMax, secfilt[Nsec].psfQfPerfMax); 422 433 434 // mark the measurements matching this ranking 435 int minRankPSF = (NrankingPSF > 0) ? results->psfData[Nsec].ranking[0] : 10; 436 markMeasureByRanking (&results->psfData[Nsec], measure, minRankPSF, ID_MEAS_PHOTOM_PSF, ID_MEAS_MASKED_PSF); 437 438 int minRankKron = (NrankingKRON > 0) ? results->kronData[Nsec].ranking[0] : 10; 439 markMeasureByRanking (&results->kronData[Nsec], measure, minRankKron, ID_MEAS_PHOTOM_KRON, ID_MEAS_MASKED_KRON); 440 423 441 StatType *apstats = &results->apstats; 424 Nranking= MAG_STATS_BY_RANKING (&results->aperData[Nsec], apstats);425 if (Nranking ) {426 secfilt[Nsec].Map = apstats->mean;427 secfilt[Nsec].dMap = apstats->error;428 secfilt[Nsec].sMap = apstats->sigma;429 secfilt[Nsec].NusedAp = Nranking ;430 } 431 int minRankAper = (Nranking > 0) ? results->aperData[Nsec].ranking[0] : 10;442 int NrankingAPER = MAG_STATS_BY_RANKING (&results->aperData[Nsec], apstats); 443 if (NrankingAPER) { 444 secfilt[Nsec].MapChp = apstats->mean; 445 secfilt[Nsec].dMapChp = apstats->error; 446 secfilt[Nsec].sMapChp = apstats->sigma; 447 secfilt[Nsec].NusedAp = NrankingAPER; 448 } 449 int minRankAper = (NrankingAPER > 0) ? results->aperData[Nsec].ranking[0] : 10; 432 450 markMeasureByRanking (&results->aperData[Nsec], measure, minRankAper, ID_MEAS_PHOTOM_APER, ID_MEAS_MASKED_APER); 433 434 StatType *kronstats = &results->kronstats;435 Nranking = MAG_STATS_BY_RANKING (&results->kronData[Nsec], kronstats);436 if (Nranking) {437 secfilt[Nsec].Mkron = kronstats->mean;438 secfilt[Nsec].dMkron = kronstats->error;439 secfilt[Nsec].sMkron = kronstats->sigma;440 secfilt[Nsec].NusedKron = Nranking;441 }442 int minRankKron = (Nranking > 0) ? results->kronData[Nsec].ranking[0] : 10;443 markMeasureByRanking (&results->kronData[Nsec], measure, minRankKron, ID_MEAS_PHOTOM_KRON, ID_MEAS_MASKED_KRON);444 451 445 452 // does this object appear extended in > 50% of measurements? … … 518 525 // 2) select the BEST detections per filter (regardless of PRIMARY) 519 526 // 3) apply the zero point and AB->Jy transformations 527 528 // I calculate McalAPER and McalPSF independently for stacks. I use McalAPER for Mkron 529 // and Map, and McalPSF for Mpsf. Note in StarOps.c:setMcalOutput I am setting 530 // measure->McalAPER to image->McalPSF for chips and warps, but not stacks 531 520 532 int setMrelAverageStack (Catalog *catalog, int cat, off_t ave, int Nsecfilt, FlatCorrectionTable *flatcorr) { 521 533 … … 528 540 SecFilt *secfilt = &catalog[0].secfilt[ave*Nsecfilt]; 529 541 530 off_t k; 531 532 float Mcal = 0, Mmos = 0, Mgrid = 0, Finst = 0; 542 float McalPSF = 0, McalAPER = 0, Mmos = 0, Mgrid = 0; 533 543 534 544 // set the primary projection cell and skycell for this coordinate … … 546 556 int haveStackObject = FALSE; 547 557 548 int Ns; 549 for (Ns = 0; Ns < Nphotcodes; Ns++) { 558 for (int Ns = 0; Ns < Nphotcodes; Ns++) { 550 559 551 560 int thisCode = photcodes[Ns][0].code; … … 556 565 int haveStack = FALSE; 557 566 558 float psfQFbest = 0.0;559 560 off_t stackBestMeasure = -1;561 off_t stackPrimaryMeasure = -1;562 563 567 int isBad = FALSE; 564 568 int isSuspect = FALSE; 565 569 566 int Nstack = 0; // number for this photcode 567 int NstackDet = 0; // number for this photcode 568 570 int NstackMeas = 0; // number of stack measurements for this photcode 571 int NstackDet = 0; // number of stack detections for this photcode (not forced) 572 573 int primaryLevelMax = 0; 574 off_t primaryEntryMax = -1; 575 float primaryValueMax = 0.0; 576 577 int bestLevelMax = 0; 578 off_t bestEntryMax = -1; 579 float bestValueMax = 0.0; 580 581 int Nprimary = 0; 582 583 // reset all stack-related values for this secfilt: 569 584 secfilt[Nsec].stackBestOff = -1; 570 585 secfilt[Nsec].stackPrmryOff = -1; 571 572 off_t meas = measureOffset; 573 for (k = 0; k < Nmeasure; k++, meas++) { 586 secfilt[Nsec].FpsfStk = NAN; 587 secfilt[Nsec].dFpsfStk = NAN; 588 secfilt[Nsec].FkronStk = NAN; 589 secfilt[Nsec].dFkronStk = NAN; 590 secfilt[Nsec].FapStk = NAN; 591 secfilt[Nsec].dFapStk = NAN; 592 secfilt[Nsec].MpsfStk = NAN; 593 secfilt[Nsec].MkronStk = NAN; 594 secfilt[Nsec].MapStk = NAN; 595 secfilt[Nsec].Nstack = 0; 596 secfilt[Nsec].NstackDet = 0; 597 secfilt[Nsec].flags &= ~ID_SECF_STACK_FLAGS; // reset the stack flags 598 599 for (off_t k = 0; k < Nmeasure; k++) { 574 600 575 601 // only examine gpc1 stack data … … 581 607 if (code->equiv != thisCode) { continue; } 582 608 583 Nstack ++;584 if ((measure[k].photFlags2 & 0x00000004) == 0) NstackDet ++; 609 NstackMeas ++; 610 if ((measure[k].photFlags2 & 0x00000004) == 0) NstackDet ++; // 0x04 = PM_SOURCE_MODE2_MATCHED 585 611 586 612 // clear this bit for all measurements … … 590 616 haveStack = TRUE; 591 617 haveStackObject = TRUE; 618 619 // if (measure[k].dbFlags & MEAS_BAD) SKIP_THIS_MEAS_STACK(Nbad); 620 621 int isPrimary = FALSE; 592 622 593 // ** find the PRIMARY measurement594 595 // if we request the primary (USE_TREE_FOR_PRIMARY), this is true if the measurement is from the596 // primary skycell for this position597 if (MatchImageSkycellID (meas, cat, tessID, projectID, skycellID)) {598 stackPrimaryMeasure = k; 623 // ** is this a PRIMARY measurement? (there may be more than one) 624 625 // if we request the primary (USE_TREE_FOR_PRIMARY), this is true if the measurement 626 // is from the primary skycell for this position. (note that MatchImageSkycellID 627 // requires the entry in the full Measure table, not just this object) 628 if (MatchImageSkycellID (measureOffset + k, cat, tessID, projectID, skycellID)) { 599 629 measure[k].dbFlags |= ID_MEAS_STACK_PRIMARY; 600 secfilt[Nsec].stackPrmryOff = meas; 601 myAssert (secfilt[Nsec].stackPrmryOff <= catalog[0].Nmeasure, "stackPrmryOff out of range"); 602 } 603 604 // ** now choose the BEST measurements (may also be PRIMARY) 605 606 // ensure that we at least have a single best measure 607 if (stackBestMeasure == -1) stackBestMeasure = k; 608 609 // choose the best psfQFperf value for the BEST measurement 610 if (isfinite(measure[k].psfQFperf) && (measure[k].psfQFperf > psfQFbest)) { 611 psfQFbest = measure[k].psfQFperf; 612 stackBestMeasure = k; 613 } 614 // ... UNLESS psfQFperf > 0.98 for the primary, in which case just use the primary. 615 if ((measure[k].dbFlags & ID_MEAS_STACK_PRIMARY) && isfinite(measure[k].psfQFperf) && (measure[k].psfQFperf > 0.98)) { 616 psfQFbest = 1000; // force this to be the best entry 617 stackBestMeasure = k; 618 } 619 620 if (measure[k].dbFlags & MEAS_BAD) SKIP_THIS_MEAS_STACK(Nbad); 621 630 isPrimary = TRUE; 631 Nprimary ++; 632 } 633 634 // soften the error floor (can dM be 0.0?) 635 int SNvalue = isfinite(measure[k].dM) ? 1.0 / hypot (measure[k].dM, MIN_ERROR) : NAN; 636 int psfQFperfAboveLimit = isfinite(SNvalue) && isfinite(measure[k].psfQFperf) && (measure[k].psfQFperf > 0.95); 637 638 // ** determine the BEST level 639 int bestLevel = 0; 640 if (!isPrimary && !psfQFperfAboveLimit) bestLevel = 1; 641 if ( isPrimary && !psfQFperfAboveLimit) bestLevel = 2; 642 if (!isPrimary && psfQFperfAboveLimit) bestLevel = 3; 643 if ( isPrimary && psfQFperfAboveLimit) bestLevel = 4; 644 645 // here is the rule for choosing the best value: 646 float bestValue = (bestLevel > 2) ? SNvalue : measure[k].psfQFperf; 647 648 // if we have not reached this level before, set the new level 649 if (bestLevelMax < bestLevel) { 650 bestValueMax = bestValue; 651 bestLevelMax = bestLevel; 652 bestEntryMax = k; 653 } 654 // if we have reached this level before, set the new value if we beat the old one 655 if ((bestLevelMax == bestLevel) && (bestValueMax < bestValue)) { 656 bestValueMax = bestValue; 657 bestEntryMax = k; 658 } 659 myAssert (bestEntryMax > -1, "this should not happen"); 660 661 // ** determine the PRIMARY level 662 int primaryLevel = 0; 663 if ( isPrimary && !psfQFperfAboveLimit) primaryLevel = 1; 664 if ( isPrimary && psfQFperfAboveLimit) primaryLevel = 2; 665 666 // here is the rule for choosing the PRIMARY value: 667 float primaryValue = 0.0; 668 if (primaryLevel == 1) { primaryValue = measure[k].psfQFperf; } 669 if (primaryLevel == 2) { primaryValue = SNvalue; } 670 671 // if we have not reached this level before, set the new level 672 if (isPrimary && (primaryLevelMax < primaryLevel)) { 673 primaryValueMax = primaryValue; 674 primaryLevelMax = primaryLevel; 675 primaryEntryMax = k; 676 } 677 // if we have reached this level before, set the new value if we beat the old one 678 if (isPrimary && (primaryLevelMax == primaryLevel) && (primaryValueMax < primaryValue)) { 679 primaryValueMax = primaryValue; 680 primaryEntryMax = k; 681 } 682 } 683 684 // if we do not have a stack measurement for this photcode, skip everything below 685 if (!haveStack) continue; 686 687 // now we have a BEST and a PRIMARY entry (may be the same entry) 688 689 off_t meas = bestEntryMax; 690 off_t measSeq = meas + measureOffset; 691 692 myAssert (meas >= 0, "this should not happen"); 693 694 // measurements without an image are either external reference photometry or 695 // data for which the associated image has not been loaded (probably because of 696 // overlaps). we only want measurements associated with stack images in this loop 697 698 // match measurement to its image (this is just a check, right?) 699 if (getImageEntry (measSeq, cat) < 0) { 622 700 // measurements without an image are either external reference photometry or 623 701 // data for which the associated image has not been loaded (probably because of 624 // overlaps). we only want measurements associated with stack images in this loop 625 626 // match measurement to its image (this is just a check, right?) 627 if (getImageEntry (meas, cat) < 0) { 628 // measurements without an image are either external reference photometry or 629 // data for which the associated image has not been loaded (probably because of 630 // overlaps). Msys + measure.Mcal is our best guess of the true magnitude 631 Mmos = Mgrid = 0; 632 Mcal = measure[k].Mcal; // check that this is zero for loaded REF value 633 } else { 634 Mcal = getMcal_alt (meas, cat, flatcorr, measure[k].Xccd, measure[k].Yccd); 635 if (isnan(Mcal)) SKIP_THIS_MEAS_STACK(Ncal); 636 Mmos = getMmos (meas, cat); 637 if (isnan(Mmos)) SKIP_THIS_MEAS_STACK(Nmos); 638 Mgrid = getMgrid (meas, cat); 639 if (isnan(Mgrid)) SKIP_THIS_MEAS_STACK(Ngrid); 640 } 641 642 // NOTE: negative and insignificant flux values are allowed, but not NAN flux values 643 Finst = PhotFluxInst (&measure[k], MAG_CLASS_PSF); 644 if (isnan(Finst)) SKIP_THIS_MEAS_STACK(Ninst); 645 646 // data quality assessment 647 isBad |= (measure[k].photFlags & code->photomBadMask); 648 isBad |= (measure[k].psfQF < 0.85); 649 isBad |= isnan(measure[k].psfQF); 650 isBad |= measure[k].dM > 0.2; // S/N < 5.0 651 652 isSuspect |= (measure[k].photFlags & code->photomPoorMask); 653 isSuspect |= (measure[k].psfQFperf < 0.85); 654 } 655 656 if (!haveStack) continue; 657 658 if (!isSuspect && !isBad) { 659 NstackGood ++; 660 } 661 if (isSuspect && !isBad) { 662 NstackSuspect ++; 663 } 664 665 // measurements which are bad will not have a valid stack entry and are skipped 666 k = (stackBestMeasure >= 0) ? stackBestMeasure : stackPrimaryMeasure; 667 if (k < 0) continue; 668 669 // we are now populating stackDetectID not stack Image ID in secfilt 670 // ID = (stackPrimaryMeasureMin >= 0) ? stackPrimaryIDmin : stackCenterIDmin; 671 // ID = measure[k].extID; // for the stack, this is the stackDetectID 672 673 // get the zero point for the selected image 674 float zp = PhotZeroPoint (&measure[k], &average[0], &secfilt[0]) - (Mcal + Mmos + Mgrid); 702 // overlaps). Msys + measure.Mcal is our best guess of the true magnitude 703 McalPSF = measure[meas].McalPSF; // check that this is zero for loaded REF value 704 McalAPER = McalPSF; // check that this is zero for loaded REF value 705 Mmos = 0.0; 706 Mgrid = 0.0; 707 } else { 708 McalPSF = getMcal (measSeq, cat, MAG_CLASS_PSF); 709 McalAPER = USE_MCAL_PSF_FOR_STACK_APER ? getMcal (measSeq, cat, MAG_CLASS_PSF) : getMcal (measSeq, cat, MAG_CLASS_KRON); 710 Mmos = getMmos (measSeq, cat); 711 Mgrid = getMgrid (measSeq, cat); 712 } 713 714 // ** Here is the math to relate mag,zp to flux 675 715 676 716 // flux_cgs : erg sec^1 cm^-2 Hz^-1 … … 703 743 // flux_Jy = flux_inst * ten(-0.4*ZP + 3.56) 704 744 745 // get the zero point for the selected image 746 // Use a different zero point for the PSF-like and APERTURE-like magnitudes 747 float zpPSF = PhotZeroPoint (&measure[meas], &average[0], &secfilt[0]) - (McalPSF + Mmos + Mgrid); 748 float zpAPER = PhotZeroPoint (&measure[meas], &average[0], &secfilt[0]) - (McalAPER + Mmos + Mgrid); 749 705 750 // zpFactor to go from instrumental flux to Janskies 706 float zpFactor = pow(10.0, -0.4*zp + 3.56); 751 float zpFactorPSF = pow(10.0, -0.4*zpPSF + 3.56); 752 float zpFactorAPER = pow(10.0, -0.4*zpAPER + 3.56); 707 753 708 754 // need to put in AB mag factor to get to Janskies (or uJy?) 709 secfilt[Nsec].FpsfStk = zpFactor * measure[k].FluxPSF;710 secfilt[Nsec].dFpsfStk = zpFactor * measure[k].dFluxPSF;711 secfilt[Nsec].FkronStk = zpFactor * measure[k].FluxKron;712 secfilt[Nsec].dFkronStk = zpFactor * measure[k].dFluxKron;713 secfilt[Nsec].FapStk = zpFactor * measure[k].FluxAp;755 secfilt[Nsec].FpsfStk = zpFactorPSF * measure[meas].FluxPSF; 756 secfilt[Nsec].dFpsfStk = zpFactorPSF * measure[meas].dFluxPSF; 757 secfilt[Nsec].FkronStk = zpFactorAPER * measure[meas].FluxKron; 758 secfilt[Nsec].dFkronStk = zpFactorAPER * measure[meas].dFluxKron; 759 secfilt[Nsec].FapStk = zpFactorAPER * measure[meas].FluxAp; 714 760 715 761 // NOTE: for PV3, apFluxErr is broken (see pmSourcePhotometry.c:245). we are going to 716 762 // use PSF flux error instead here: 717 // secfilt[Nsec].dFapStk = zpFactor * measure[k].dFluxAp;718 secfilt[Nsec].dFapStk = zpFactor * measure[k].dFluxPSF;763 // secfilt[Nsec].dFapStk = zpFactorAPER * measure[meas].dFluxAp; 764 secfilt[Nsec].dFapStk = zpFactorAPER * measure[meas].dFluxPSF; 719 765 720 766 // Jy to AB mags 721 secfilt[Nsec].MpsfStk = (measure[k].FluxPSF > 0.0) ? 8.9 - 2.5*log10(secfilt[Nsec].FpsfStk) : NAN; 722 secfilt[Nsec].MkronStk = (measure[k].FluxKron > 0.0) ? 8.9 - 2.5*log10(secfilt[Nsec].FkronStk) : NAN; 723 secfilt[Nsec].MapStk = (measure[k].FluxAp > 0.0) ? 8.9 - 2.5*log10(secfilt[Nsec].FapStk) : NAN; 724 725 secfilt[Nsec].stackBestOff = k + measureOffset; 767 secfilt[Nsec].MpsfStk = (measure[meas].FluxPSF > 0.0) ? 8.9 - 2.5*log10(secfilt[Nsec].FpsfStk) : NAN; 768 secfilt[Nsec].MkronStk = (measure[meas].FluxKron > 0.0) ? 8.9 - 2.5*log10(secfilt[Nsec].FkronStk) : NAN; 769 secfilt[Nsec].MapStk = (measure[meas].FluxAp > 0.0) ? 8.9 - 2.5*log10(secfilt[Nsec].FapStk) : NAN; 770 771 // record the measurement which gave the best value 772 secfilt[Nsec].stackBestOff = (bestEntryMax == -1) ? -1 : bestEntryMax + measureOffset; 726 773 myAssert (secfilt[Nsec].stackBestOff <= catalog[0].Nmeasure, "stackBestOff out of range"); 727 774 728 secfilt[Nsec].Nstack = Nstack; 775 // record the selected primary measurement 776 secfilt[Nsec].stackPrmryOff = (primaryEntryMax == -1) ? -1 : primaryEntryMax + measureOffset; 777 myAssert (secfilt[Nsec].stackPrmryOff <= catalog[0].Nmeasure, "stackPrmryOff out of range"); 778 779 // this is the selected measurement used by secfilt[] 780 measure[meas].dbFlags |= ID_MEAS_STACK_PHOT_SRC; 781 if (Nprimary) { 782 secfilt[Nsec].flags |= ID_SECF_STACK_PRIMARY; 783 if (Nprimary > 1) { 784 secfilt[Nsec].flags |= ID_SECF_STACK_PRIMARY_MULTIPLE; 785 } 786 } 787 788 // stack measurement used for 'best' was a detection (not forced from the other bands) 789 if ((measure[bestEntryMax].photFlags2 & 0x00000004) == 0) { 790 secfilt[Nsec].flags |= ID_SECF_STACK_BESTDET; 791 } 792 793 // stack measurement used for 'primary' was a detection (not forced from the other bands) 794 if ((primaryEntryMax >= 0) && ((measure[primaryEntryMax].photFlags2 & 0x00000004) == 0)) { 795 secfilt[Nsec].flags |= ID_SECF_STACK_PRIMDET; 796 } 797 798 secfilt[Nsec].flags |= ID_SECF_HAS_PS1_STACK; 799 800 // NOTE: negative and insignificant flux values are allowed, but not NAN flux values 801 // float Finst = PhotFluxInst (&measure[meas], MAG_CLASS_PSF); 802 803 // data quality assessment 804 isBad |= (measure[meas].photFlags & photcodes[Ns][0].photomBadMask); 805 isBad |= (measure[meas].psfQF < 0.85); 806 isBad |= isnan(measure[meas].psfQF); 807 isBad |= measure[meas].dM > 0.2; // S/N < 5.0 808 809 isSuspect |= (measure[meas].photFlags & photcodes[Ns][0].photomPoorMask); 810 isSuspect |= (measure[meas].psfQFperf < 0.85); 811 812 if (!isSuspect && !isBad) { 813 NstackGood ++; 814 } 815 if (isSuspect && !isBad) { 816 NstackSuspect ++; 817 } 818 819 secfilt[Nsec].Nstack = NstackMeas; 729 820 secfilt[Nsec].NstackDet = NstackDet; 730 821 731 // this is the measurement used by secfilt[]732 measure[k].dbFlags |= ID_MEAS_STACK_PHOT_SRC;733 if (k == stackPrimaryMeasure) {734 secfilt[Nsec].flags |= ID_SECF_STACK_PRIMARY;735 }736 737 // stack measurement used for 'best' was a detection (not forced from the other bands)738 if ((measure[k].photFlags2 & 0x00000004) == 0) {739 secfilt[Nsec].flags |= ID_SECF_STACK_BESTDET;740 }741 // stack measurement used for 'primary' was a detection (not forced from the other bands)742 if ((stackPrimaryMeasure >= 0) && ((measure[stackPrimaryMeasure].photFlags2 & 0x00000004) == 0)) {743 secfilt[Nsec].flags |= ID_SECF_STACK_PRIMDET;744 }745 746 secfilt[Nsec].flags |= ID_SECF_HAS_PS1_STACK;747 822 } // Nsecfilt loop 748 823 … … 755 830 756 831 int PrimaryIsBest = TRUE; 757 for ( Ns = 0; Ns < Nphotcodes; Ns++) {832 for (int Ns = 0; Ns < Nphotcodes; Ns++) { 758 833 if (!(secfilt[Ns].flags & ID_SECF_HAS_PS1_STACK)) continue; // no stack detection in PS1, nothing is best 759 834 if (secfilt[Ns].flags & ID_SECF_STACK_PRIMARY) continue; // primary stack detection is best … … 780 855 // * no grid, no mosaic, no 2MASS, no SYNTH, no Ubercal, no flatcorr 781 856 // analysis is done on flux, not mags (as the faintest objects will be nearly insignificant) 857 858 // Although I calculate McalAPER for exposures, I am only using McalPSF for warps.. 859 // Note in StarOps.c:setMcalOutput I am setting measure->McalAPER to image->McalPSF for 860 // chips and warps, but not stacks 861 782 862 int setMrelAverageForcedWarp (Catalog *catalog, int cat, off_t ave, int Nsecfilt, FlatCorrectionTable *flatcorr, SetMrelInfo *results) { 783 863 OHANA_UNUSED_PARAM(flatcorr); … … 857 937 // data for which the associated image has not been loaded (probably because of 858 938 // overlaps). Msys + measure.Mcal is our best guess of the true magnitude 859 Mcal = measure[k].Mcal ; // check that this is zero for loaded REF value939 Mcal = measure[k].McalPSF; // check that this is zero for loaded REF value 860 940 } else { 861 // use getMcal not getMcal_alt? 862 Mcal = getMcal_alt (meas, cat, NULL, measure[k].Xccd, measure[k].Yccd); 863 // Mcal = getMcal (meas, cat); 941 Mcal = getMcal (meas, cat, MAG_CLASS_PSF); 864 942 if (isnan(Mcal)) SKIP_THIS_MEAS(Ncal); 865 943 } -
trunk/Ohana/src/relphot/src/setMrelFinal.c
r39632 r40291 65 65 if (catalog[0].measure[m].dbFlags & ID_MEAS_PHOTOM_UBERCAL) { 66 66 if (!KEEP_UBERCAL) { 67 catalog[0].measure[m].Mcal = 0.0; 67 catalog[0].measure[m].McalPSF = 0.0; 68 catalog[0].measure[m].McalAPER = 0.0; 68 69 catalog[0].measure[m].dbFlags &= ~ID_MEAS_PHOTOM_UBERCAL; 69 70 } 70 71 } else { 71 72 if (RESET_ZEROPTS && (getImageEntry (m, 0) >= 0)) { 72 catalog[0].measure[m].Mcal = 0.0; 73 catalog[0].measure[m].McalPSF = 0.0; 74 catalog[0].measure[m].McalAPER = 0.0; 73 75 } 74 76 } … … 105 107 ALLOCATE (catalog[0].measureRank, char, catalog[0].Nmeasure); 106 108 setMeasureRank (catalog); 107 setMrelOutput (catalog, 1, flatcorr); // sets the values secfilt.M = <measure.M + measure.Mflat - image.Mcal>109 setMrelOutput (catalog, 1, flatcorr); // sets the values secfilt.MpsfChp = <measure.M + measure.Mflat - image.Mcal> 108 110 setMcalOutput (catalog, 1, flatcorr); // sets measure.Mcal = image.Mcal 109 111 … … 226 228 off_t Nim = getImageEntry (m, 0); 227 229 if (Nim > -1) { 228 if (isnan(getMcal (m, 0, flatcorr, catalog))) goto skip;230 if (isnan(getMcal (m, 0, MAG_CLASS_PSF))) goto skip; 229 231 if (isnan(getMmos (m, 0))) goto skip; 230 232 } -
trunk/Ohana/src/relphot/src/share_image_mags.c
r36630 r40291 74 74 continue; 75 75 } 76 images[seq].Mcal = image_mags[i].Mcal; 76 images[seq].McalPSF = image_mags[i].McalPSF; 77 images[seq].McalAPER = image_mags[i].McalAPER; 77 78 images[seq].dMcal = image_mags[i].dMcal; 78 79 images[seq].dMagSys = image_mags[i].dMagSys; 79 images[seq]. Xm = image_mags[i].Xm;80 images[seq].McalChiSq = image_mags[i].McalChiSq; 80 81 images[seq].nFitPhotom = image_mags[i].nFitPhotom; 81 82 images[seq].flags = image_mags[i].flags; … … 91 92 int set_image_mags (ImageMag *image_mags, Image *image) { 92 93 93 image_mags->Mcal = image->Mcal; 94 image_mags->McalPSF = image->McalPSF; 95 image_mags->McalAPER = image->McalAPER; 94 96 image_mags->dMcal = image->dMcal; 95 97 image_mags->dMagSys = image->dMagSys; 96 image_mags-> Xm = image->Xm;98 image_mags->McalChiSq = image->McalChiSq; 97 99 image_mags->nFitPhotom = image->nFitPhotom; 98 100 image_mags->flags = image->flags; -
trunk/Ohana/src/relphot/src/share_mean_mags.c
r39457 r40291 111 111 if (Nsec < 0) continue; 112 112 113 catalog[catSeq].secfilt[objSeq*Nsecfilt + Nsec].M = meanmags[i].M;113 catalog[catSeq].secfilt[objSeq*Nsecfilt + Nsec].MpsfChp = meanmags[i].M; 114 114 } 115 115 free (meanmags); … … 122 122 int set_mean_mags (MeanMag *meanmags, AverageTiny *average, SecFilt *secfilt, int Nsec) { 123 123 124 meanmags->M = secfilt->M ;125 meanmags->dM = secfilt->dM ;124 meanmags->M = secfilt->MpsfChp; 125 meanmags->dM = secfilt->dMpsfChp; 126 126 meanmags->Mchisq = secfilt->Mchisq; 127 127 meanmags->Nsec = Nsec; // key to secfilt entry -
trunk/Ohana/src/relphot/src/synthetic_mags.c
r39457 r40291 37 37 // (r - i > 0.5) : w = r + 0.268 - 0.435 (r-i) - 0.078(r-i)^2 38 38 39 float Mr = secfilt[NSr].M ;40 float Mi = secfilt[NSi].M ;39 float Mr = secfilt[NSr].MpsfChp; 40 float Mi = secfilt[NSi].MpsfChp; 41 41 42 42 if (!isfinite(Mr)) return FALSE; -
trunk/Ohana/src/uniphot/include/setphot.h
r39926 r40291 11 11 12 12 typedef struct { 13 float Mcal; 13 float McalPSF; 14 float McalAPER; 14 15 float dMcal; 15 16 unsigned int imageID; -
trunk/Ohana/src/uniphot/src/ImageSubset.c
r37043 r40291 56 56 char type[16]; 57 57 58 GET_COLUMN (Mcal, "MCAL", float); 59 GET_COLUMN (dMcal, "MCAL_ERR", float); 60 GET_COLUMN (imageID, "IMAGE_ID", int); 61 GET_COLUMN (map, "PHOTOM_MAP", int); 62 GET_COLUMN (flags, "FLAGS", int); 58 GET_COLUMN (McalPSF, "MCAL_PSF", float); 59 GET_COLUMN (McalAPER, "MCAL_APER", float); 60 GET_COLUMN (dMcal, "MCAL_ERR", float); 61 GET_COLUMN (imageID, "IMAGE_ID", int); 62 GET_COLUMN (map, "PHOTOM_MAP", int); 63 GET_COLUMN (flags, "FLAGS", int); 63 64 64 65 // XXX free the fits table data here … … 69 70 image[i].photom_map_id = map[i]; 70 71 image[i].flags = flags[i]; 71 image[i].Mcal = Mcal[i]; 72 image[i].McalPSF = McalPSF[i]; 73 image[i].McalAPER = McalAPER[i]; 72 74 image[i].dMcal = dMcal[i]; 73 75 } 74 76 fprintf (stderr, "loaded data for %lld images\n", (long long) Nrow); 75 77 76 free (Mcal); 78 free (McalPSF); 79 free (McalAPER); 77 80 free (dMcal); 78 81 free (imageID); … … 108 111 gfits_create_table (&theader, &ftable); 109 112 110 float *Mcal, *dMcal;111 unsigned int *imageID, *map, *flags;112 113 113 // create intermediate storage arrays 114 ALLOCATE (Mcal, float, Nimage); 115 ALLOCATE (dMcal, float, Nimage); 116 ALLOCATE (imageID, unsigned int, Nimage); 117 ALLOCATE (map, unsigned int, Nimage); 118 ALLOCATE (flags, unsigned int, Nimage); 114 ALLOCATE_PTR (McalPSF, float, Nimage); 115 ALLOCATE_PTR (McalAPER, float, Nimage); 116 ALLOCATE_PTR (dMcal, float, Nimage); 117 ALLOCATE_PTR (imageID, unsigned int, Nimage); 118 ALLOCATE_PTR (map, unsigned int, Nimage); 119 ALLOCATE_PTR (flags, unsigned int, Nimage); 119 120 120 121 // assign the storage arrays 121 122 for (i = 0; i < Nimage; i++) { 122 imageID[i] = image[i].imageID; 123 map[i] = image[i].photom_map_id; 124 flags[i] = image[i].flags; 125 Mcal[i] = image[i].Mcal; 126 dMcal[i] = image[i].dMcal; 123 imageID[i] = image[i].imageID; 124 map[i] = image[i].photom_map_id; 125 flags[i] = image[i].flags; 126 McalPSF[i] = image[i].McalPSF; 127 McalAPER[i] = image[i].McalAPER; 128 dMcal[i] = image[i].dMcal; 127 129 } 128 130 129 131 // add the columns to the output array 130 gfits_set_bintable_column (&theader, &ftable, "MCAL", Mcal, Nimage); 131 gfits_set_bintable_column (&theader, &ftable, "MCAL_ERR", dMcal, Nimage); 132 gfits_set_bintable_column (&theader, &ftable, "IMAGE_ID", imageID, Nimage); 133 gfits_set_bintable_column (&theader, &ftable, "PHOTOM_MAP", map, Nimage); 134 gfits_set_bintable_column (&theader, &ftable, "FLAGS", flags, Nimage); 132 gfits_set_bintable_column (&theader, &ftable, "MCAL_PSF", McalPSF, Nimage); 133 gfits_set_bintable_column (&theader, &ftable, "MCAL_APER", McalAPER, Nimage); 134 gfits_set_bintable_column (&theader, &ftable, "MCAL_ERR", dMcal, Nimage); 135 gfits_set_bintable_column (&theader, &ftable, "IMAGE_ID", imageID, Nimage); 136 gfits_set_bintable_column (&theader, &ftable, "PHOTOM_MAP", map, Nimage); 137 gfits_set_bintable_column (&theader, &ftable, "FLAGS", flags, Nimage); 135 138 136 free (Mcal); 139 free (McalPSF); 140 free (McalAPER); 137 141 free (dMcal); 138 142 free (imageID); … … 174 178 image[i].photom_map_id = subset[i].photom_map_id; 175 179 image[i].flags = subset[i].flags ; 176 image[i].Mcal = subset[i].Mcal ; 180 image[i].McalPSF = subset[i].McalPSF ; 181 image[i].McalAPER = subset[i].McalAPER ; 177 182 image[i].dMcal = subset[i].dMcal ; 178 183 } -
trunk/Ohana/src/uniphot/src/dumpresult.c
r31160 r40291 2 2 3 3 void dumpresult () { 4 short Mcal, Mgrp, Mset;4 float Mcal, Mgrp, Mset; 5 5 FILE *f; 6 6 char outfile[64]; … … 13 13 if (sgroup[i].image[j][0].code & IMAGE_BAD) continue; 14 14 tgrp = (Group *) sgroup[i].imlink[j][0].tgroup; 15 Mcal = sgroup[i].image[j][0].Mcal ;15 Mcal = sgroup[i].image[j][0].McalPSF; 16 16 Mset = sgroup[i].M; 17 17 Mgrp = tgrp[0].M; -
trunk/Ohana/src/uniphot/src/fit_groups.c
r31160 r40291 18 18 if (tgroup[i].image[j][0].flags & IMAGE_BAD) continue; 19 19 sgroup = (Group *) tgroup[i].imlink[j][0].sgroup; 20 Mcal = tgroup[i].image[j][0].Mcal ;20 Mcal = tgroup[i].image[j][0].McalPSF; 21 21 Mgrp = sgroup[0].M; 22 22 mlist[Nlist] = (Mcal - Mgrp); … … 58 58 if (sgroup[i].image[j][0].flags & IMAGE_BAD) continue; 59 59 tgroup = (Group *) sgroup[i].imlink[j][0].tgroup; 60 Mcal = sgroup[i].image[j][0].Mcal ;60 Mcal = sgroup[i].image[j][0].McalPSF; 61 61 Mgrp = tgroup[0].M; 62 62 mlist[Nlist] = (Mcal - Mgrp); -
trunk/Ohana/src/uniphot/src/match_zpts_to_images.c
r37807 r40291 41 41 if (RESET) { 42 42 for (i = 0; i < Nimage; i++) { 43 image[i].Mcal = 0.0; 44 image[i].dMcal = NAN; 45 image[i].flags &= ~ID_IMAGE_PHOTOM_NOCAL; // clear the NOCAL flag 43 image[i].McalPSF = 0.0; 44 image[i].McalAPER = 0.0; 45 image[i].dMcal = NAN; 46 image[i].flags &= ~ID_IMAGE_PHOTOM_NOCAL; // clear the NOCAL flag 46 47 if (UBERCAL) { 47 48 image[i].flags &= ~ID_IMAGE_PHOTOM_UBERCAL; // clear the UBERCAL flag … … 107 108 // UBERCAL includes 2.5log(exptime) + K*airmass in the zero point 108 109 if (UBERCAL) { 109 image[Ni].Mcal = SCALE*code[0].C - zpts[Nz].zpt + 2.5*log10(image[Ni].exptime) + code[0].K*(image[Ni].secz - 1.000); 110 myAssert (isfinite(image[Ni].Mcal), "oops, ubercal made a nan image"); 110 image[Ni].McalPSF = SCALE*code[0].C - zpts[Nz].zpt + 2.5*log10(image[Ni].exptime) + code[0].K*(image[Ni].secz - 1.000); 111 image[Ni].McalAPER = SCALE*code[0].C - zpts[Nz].zpt + 2.5*log10(image[Ni].exptime) + code[0].K*(image[Ni].secz - 1.000); 112 myAssert (isfinite(image[Ni].McalPSF), "oops, ubercal made a nan image"); 111 113 } else { 112 image[Ni].Mcal = SCALE*code[0].C - zpts[Nz].zpt; 114 image[Ni].McalPSF = SCALE*code[0].C - zpts[Nz].zpt; 115 image[Ni].McalAPER = SCALE*code[0].C - zpts[Nz].zpt; 113 116 } 114 117 … … 116 119 float offset = apply_zpt_offset (code[0].equiv); 117 120 assert (isfinite(offset)); 118 image[Ni].Mcal += offset; 121 image[Ni].McalPSF += offset; 122 image[Ni].McalAPER += offset; 119 123 120 124 image[Ni].dMcal = zpts[Nz].zpt_err; -
trunk/Ohana/src/uniphot/src/update_catalog_setastrom.c
r39288 r40291 153 153 case 101: 154 154 case 102: { 155 float gmag = secfilt[Nsec_g].M ;156 float imag = secfilt[Nsec_i].M ;155 float gmag = secfilt[Nsec_g].MpsfChp; 156 float imag = secfilt[Nsec_i].MpsfChp; 157 157 dColor = average->refColorBlue - (gmag - imag); 158 158 break; … … 160 160 case 103: 161 161 case 104: { 162 float zmag = secfilt[Nsec_z].M ;163 float ymag = secfilt[Nsec_y].M ;162 float zmag = secfilt[Nsec_z].MpsfChp; 163 float ymag = secfilt[Nsec_y].MpsfChp; 164 164 dColor = average->refColorRed - (zmag - ymag); 165 165 break; -
trunk/Ohana/src/uniphot/src/update_catalog_setphot.c
r39926 r40291 39 39 if (id < 0) continue; 40 40 41 float Mcal = image[id].Mcal;41 float Mcal = image[id].McalPSF; 42 42 float dMcal = image[id].dMcal; 43 43 float Mflat = 0.0; … … 61 61 # endif 62 62 63 measure[0].Mcal = Mcal; 63 myAssert(isfinite(Mcal), "oops: ubercal made a nan"); 64 65 measure[0].McalPSF = Mcal; 66 measure[0].McalAPER = Mcal; 64 67 measure[0].Mflat = Mflat; // in the previous version, Mcal_offset (which is added to Mflat) had a negative sign here 65 68 measure[0].dMcal = dMcal; 66 myAssert(isfinite(measure[0].Mcal), "oops: ubercal made a nan");67 69 68 70 if (RESET) { -
trunk/Ohana/src/uniphot/src/update_catalog_uniphot.c
r33654 r40291 14 14 for (i = 0; i < catalog[0].Naverage; i++) { 15 15 16 if (!isnan(catalog[0].secfilt[i*Nsecfilt+Nsec].M )) {17 catalog[0].secfilt[i*Nsecfilt+Nsec].M += sgroup[0].M;16 if (!isnan(catalog[0].secfilt[i*Nsecfilt+Nsec].MpsfChp)) { 17 catalog[0].secfilt[i*Nsecfilt+Nsec].MpsfChp += sgroup[0].M; 18 18 } 19 19 … … 24 24 if (code[0].type != PHOT_DEP) continue; 25 25 if (code[0].equiv != photcode[0].code) continue; 26 catalog[0].measure[m].Mcal -= sgroup[0].M; 26 catalog[0].measure[m].McalPSF -= sgroup[0].M; 27 catalog[0].measure[m].McalAPER -= sgroup[0].M; 27 28 found ++; 28 29 } -
trunk/Ohana/src/uniphot/src/update_dvo_uniphot.c
r38986 r40291 37 37 for (i = 0; i < Nsgroup; i++) { 38 38 for (j = 0; j < sgroup[i].Nimage; j++) { 39 sgroup[i].image[j][0].Mcal -= sgroup[i].M; 39 sgroup[i].image[j][0].McalPSF -= sgroup[i].M; 40 sgroup[i].image[j][0].McalAPER -= sgroup[i].M; 40 41 } 41 42 }
Note:
See TracChangeset
for help on using the changeset viewer.
