Changeset 40477
- Timestamp:
- Jun 27, 2018, 3:20:35 PM (8 years ago)
- Location:
- branches/czw_branch/20170908/Ohana
- Files:
-
- 1 deleted
- 250 edited
- 35 copied
-
. (modified) (1 prop)
-
Makefile.in (modified) (2 diffs)
-
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/loadgalphot_readstars.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 trunk/Ohana/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/include/dvomerge.h (modified) (1 diff)
-
src/dvomerge/src/args.c (modified) (2 diffs)
-
src/dvomerge/src/build_links.c (modified) (1 diff)
-
src/dvomerge/src/dvomergeUpdate_catalogs.c (modified) (1 diff)
-
src/dvomerge/src/dvosecfilt_catalogs.c (modified) (1 diff)
-
src/dvomerge/src/merge_catalogs_old.c (modified) (4 diffs)
-
src/dvopsps/include/dvopsps.h (modified) (4 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) (12 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/include/constants.h (modified) (1 diff)
-
src/kapa2/include/prototypes.h (modified) (2 diffs)
-
src/kapa2/include/structures.h (modified) (1 diff)
-
src/kapa2/src/DrawObjects.c (modified) (10 diffs)
-
src/kapa2/src/DrawTextlines.c (modified) (1 diff)
-
src/kapa2/src/LoadObject.c (modified) (1 diff)
-
src/kapa2/src/LoadTextlines.c (modified) (3 diffs)
-
src/kapa2/src/PSObjects.c (modified) (8 diffs)
-
src/kapa2/src/PSTextlines.c (modified) (1 diff)
-
src/kapa2/src/bDrawLabels.c (modified) (1 diff)
-
src/kapa2/src/bDrawObjects.c (modified) (8 diffs)
-
src/kapa2/test/textline.sh (copied) (copied from trunk/Ohana/src/kapa2/test/textline.sh )
-
src/libautocode/Makefile.Targets (modified) (14 diffs)
-
src/libautocode/def/average-ps1-v6.d (copied) (copied from trunk/Ohana/src/libautocode/def/average-ps1-v6.d )
-
src/libautocode/def/convert.sh (copied) (copied from trunk/Ohana/src/libautocode/def/convert.sh )
-
src/libautocode/def/galphot-ps1-v6.d (copied) (copied from trunk/Ohana/src/libautocode/def/galphot-ps1-v6.d )
-
src/libautocode/def/image-ps1-v6.d (copied) (copied from trunk/Ohana/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 trunk/Ohana/src/libautocode/def/lensing-ps1-v6.d )
-
src/libautocode/def/lensobj-ps1-v6.d (copied) (copied from trunk/Ohana/src/libautocode/def/lensobj-ps1-v6.d )
-
src/libautocode/def/measure-ps1-v6.d (copied) (copied from trunk/Ohana/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 trunk/Ohana/src/libautocode/def/photcode-ps1-v6.d )
-
src/libautocode/def/secfilt-ps1-v6.d (copied) (copied from trunk/Ohana/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 trunk/Ohana/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) (5 diffs)
-
src/libdvo/include/dvodb.h (modified) (6 diffs)
-
src/libdvo/include/libdvo_astro.h (modified) (1 diff)
-
src/libdvo/include/ps1_v6_defs.h (copied) (copied from trunk/Ohana/src/libdvo/include/ps1_v6_defs.h )
-
src/libdvo/src/HostTable.c (modified) (1 diff)
-
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/dbExtractAverages.c (modified) (1 diff)
-
src/libdvo/src/dbExtractImages.c (modified) (3 diffs)
-
src/libdvo/src/dbExtractMeasures.c (modified) (3 diffs)
-
src/libdvo/src/dbFields.c (modified) (3 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 trunk/Ohana/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) (34 diffs)
-
src/libdvo/src/dvo_tiny_values.c (modified) (1 diff)
-
src/libdvo/src/dvosorts.c (modified) (4 diffs)
-
src/libdvo/src/skyregion_ops.c (modified) (1 diff)
-
src/libkapa/include/kapa.h (modified) (2 diffs)
-
src/libkapa/src/DrawRotString.c (modified) (1 diff)
-
src/libkapa/src/KapaWindow.c (modified) (2 diffs)
-
src/libkapa/src/PSRotFont.c (modified) (4 diffs)
-
src/libkapa/src/bDrawFuncs.c (modified) (2 diffs)
-
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/errors.c (modified) (3 diffs)
-
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/Makefile (modified) (1 diff)
-
src/opihi/cmd.astro/cdot.c (modified) (1 diff)
-
src/opihi/cmd.astro/cgrid.c (modified) (7 diffs)
-
src/opihi/cmd.astro/cline.c (modified) (1 diff)
-
src/opihi/cmd.astro/czplot.c (modified) (2 diffs)
-
src/opihi/cmd.astro/fitplx.c (modified) (4 diffs)
-
src/opihi/cmd.astro/fitplx_irls.c (modified) (8 diffs)
-
src/opihi/cmd.astro/fitpm.c (modified) (1 diff)
-
src/opihi/cmd.astro/fitpm_irls.c (modified) (1 diff)
-
src/opihi/cmd.astro/init.c (modified) (2 diffs)
-
src/opihi/cmd.astro/jdtolst.c (copied) (copied from trunk/Ohana/src/opihi/cmd.astro/jdtolst.c )
-
src/opihi/cmd.astro/star.c (modified) (4 diffs)
-
src/opihi/cmd.data/Makefile (modified) (6 diffs)
-
src/opihi/cmd.data/dot.c (modified) (1 diff)
-
src/opihi/cmd.data/grid.c (modified) (1 diff)
-
src/opihi/cmd.data/idxread.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/idxread.c )
-
src/opihi/cmd.data/impeaks.c (modified) (1 diff)
-
src/opihi/cmd.data/init.c (modified) (8 diffs)
-
src/opihi/cmd.data/limits.c (modified) (4 diffs)
-
src/opihi/cmd.data/line.c (modified) (1 diff)
-
src/opihi/cmd.data/mslice.c (modified) (2 diffs)
-
src/opihi/cmd.data/nnet.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/nnet.c )
-
src/opihi/cmd.data/nnet_apply.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/nnet_apply.c )
-
src/opihi/cmd.data/nnet_commands.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/nnet_commands.c )
-
src/opihi/cmd.data/nnet_train.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/nnet_train.c )
-
src/opihi/cmd.data/nnet_train.save.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/nnet_train.save.c )
-
src/opihi/cmd.data/periodogram-fm.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/periodogram-fm.c )
-
src/opihi/cmd.data/print_vectors.c (modified) (3 diffs)
-
src/opihi/cmd.data/read_vectors.c (modified) (1 diff)
-
src/opihi/cmd.data/reindex.c (modified) (2 diffs)
-
src/opihi/cmd.data/sort.c (modified) (2 diffs)
-
src/opihi/cmd.data/test/mslice.sh (copied) (copied from trunk/Ohana/src/opihi/cmd.data/test/mslice.sh )
-
src/opihi/cmd.data/test/nnet.sh (copied) (copied from trunk/Ohana/src/opihi/cmd.data/test/nnet.sh )
-
src/opihi/cmd.data/test/periodogram-fm.sh (copied) (copied from trunk/Ohana/src/opihi/cmd.data/test/periodogram-fm.sh )
-
src/opihi/cmd.data/test/periodogram.sh (modified) (3 diffs)
-
src/opihi/cmd.data/test/uniqpair.sh (copied) (copied from trunk/Ohana/src/opihi/cmd.data/test/uniqpair.sh )
-
src/opihi/cmd.data/test/vlorentz.sh (copied) (copied from trunk/Ohana/src/opihi/cmd.data/test/vlorentz.sh )
-
src/opihi/cmd.data/textline.c (modified) (3 diffs)
-
src/opihi/cmd.data/uniq.c (modified) (1 diff)
-
src/opihi/cmd.data/uniqpair.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/uniqpair.c )
-
src/opihi/cmd.data/vlorentz.c (copied) (copied from trunk/Ohana/src/opihi/cmd.data/vlorentz.c )
-
src/opihi/cmd.data/write_vectors.c (modified) (1 diff)
-
src/opihi/cmd.data/zplot.c (modified) (2 diffs)
-
src/opihi/dvo/Makefile (modified) (2 diffs)
-
src/opihi/dvo/PeriodogramOps.c (copied) (copied from trunk/Ohana/src/opihi/dvo/PeriodogramOps.c )
-
src/opihi/dvo/avperiodogram.c (copied) (copied from trunk/Ohana/src/opihi/dvo/avperiodogram.c )
-
src/opihi/dvo/avperiodomatch.c (copied) (copied from trunk/Ohana/src/opihi/dvo/avperiodomatch.c )
-
src/opihi/dvo/catalog.c (modified) (1 diff)
-
src/opihi/dvo/dmt.c (modified) (1 diff)
-
src/opihi/dvo/dvo_host_utils.c (modified) (4 diffs)
-
src/opihi/dvo/fitcolors.c (modified) (5 diffs)
-
src/opihi/dvo/fitsed.c (modified) (1 diff)
-
src/opihi/dvo/gimages.c (modified) (1 diff)
-
src/opihi/dvo/gstar.c (modified) (12 diffs)
-
src/opihi/dvo/images.c (modified) (1 diff)
-
src/opihi/dvo/imbox.c (modified) (1 diff)
-
src/opihi/dvo/imdata.c (modified) (1 diff)
-
src/opihi/dvo/imdense.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/init.c (modified) (2 diffs)
-
src/opihi/dvo/objectcoverage.c (modified) (1 diff)
-
src/opihi/dvo/paverage.c (modified) (2 diffs)
-
src/opihi/dvo/pmeasure.c (modified) (1 diff)
-
src/opihi/dvo/procks.c (modified) (2 diffs)
-
src/opihi/dvo/region_list.c (modified) (2 diffs)
-
src/opihi/dvo/remote.c (modified) (1 diff)
-
src/opihi/dvo/showtile.c (modified) (1 diff)
-
src/opihi/dvo/simage.c (modified) (1 diff)
-
src/opihi/dvo/skycat.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) (3 diffs)
-
src/opihi/include/dvoshell.h (modified) (1 diff)
-
src/opihi/include/pantasks.h (modified) (5 diffs)
-
src/opihi/lib.data/Makefile (modified) (2 diffs)
-
src/opihi/lib.data/gaussian.c (modified) (1 diff)
-
src/opihi/lib.data/graphtools.c (modified) (2 diffs)
-
src/opihi/lib.data/nnet.c (copied) (copied from trunk/Ohana/src/opihi/lib.data/nnet.c )
-
src/opihi/lib.data/starfuncs.c (modified) (6 diffs)
-
src/opihi/lib.shell/VectorIO.c (modified) (4 diffs)
-
src/opihi/lib.shell/check_stack.c (modified) (1 diff)
-
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) (6 diffs)
-
src/opihi/lib.shell/parse.c (modified) (2 diffs)
-
src/opihi/lib.shell/stack_math.c (modified) (8 diffs)
-
src/opihi/mana/findrowpeaks.c (modified) (1 diff)
-
src/opihi/pantasks/CheckController.c (modified) (1 diff)
-
src/opihi/pantasks/JobIDOps.c (modified) (1 diff)
-
src/opihi/pantasks/JobOps.c (modified) (5 diffs)
-
src/opihi/pantasks/delete.c (modified) (1 diff)
-
src/opihi/pantasks/kill.c (modified) (2 diffs)
-
src/opihi/pantasks/test/nice_remote.sh (modified) (2 diffs)
-
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/Makefile (modified) (3 diffs)
-
src/relastro/include/relastro.h (modified) (5 diffs)
-
src/relastro/src (modified) (1 prop)
-
src/relastro/src/BrightCatalog.c (modified) (10 diffs)
-
src/relastro/src/ImageOps.c (modified) (2 diffs)
-
src/relastro/src/MosaicOps.c (modified) (1 diff)
-
src/relastro/src/UpdateChips.c (modified) (4 diffs)
-
src/relastro/src/UpdateMeasures.c (modified) (2 diffs)
-
src/relastro/src/UpdateObjectOffsets.c (modified) (2 diffs)
-
src/relastro/src/UpdateObjects.c (modified) (4 diffs)
-
src/relastro/src/UpdateStacks.c (modified) (2 diffs)
-
src/relastro/src/UpdateStacksWithFit.c (copied) (copied from trunk/Ohana/src/relastro/src/UpdateStacksWithFit.c )
-
src/relastro/src/args.c (modified) (9 diffs)
-
src/relastro/src/fitexample.c (copied) (copied from trunk/Ohana/src/relastro/src/fitexample.c )
-
src/relastro/src/fitpm.c (deleted)
-
src/relastro/src/launch_region_hosts.c (modified) (2 diffs)
-
src/relastro/src/relastro_images.c (modified) (1 diff)
-
src/relastro/src/relastro_parallel_images.c (modified) (2 diffs)
-
src/relastro/src/select_images.c (modified) (1 diff)
-
src/relphot/include/relphot.h (modified) (7 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) (4 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) (2 diffs)
-
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/tools/src/fields.c (modified) (2 diffs)
-
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
-
branches/czw_branch/20170908/Ohana
- Property svn:mergeinfo changed
-
branches/czw_branch/20170908/Ohana/Makefile.in
r40019 r40477 51 51 relphot \ 52 52 relastro \ 53 skycalc \ 53 54 shell \ 54 55 tools \ … … 61 62 fixcat \ 62 63 gophot \ 63 skycalc \64 64 getusno \ 65 65 lightcurve \ -
branches/czw_branch/20170908/Ohana/src/addstar/src/FilterStars.c
r39473 r40477 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; -
branches/czw_branch/20170908/Ohana/src/addstar/src/LoadDataPMM.c
r38553 r40477 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; -
branches/czw_branch/20170908/Ohana/src/addstar/src/ReadImageHeader.c
r39457 r40477 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 */ -
branches/czw_branch/20170908/Ohana/src/addstar/src/ReadSDSSHeader.c
r16810 r40477 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)); -
branches/czw_branch/20170908/Ohana/src/addstar/src/ReadStarsSDSS.c
r39161 r40477 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; -
branches/czw_branch/20170908/Ohana/src/addstar/src/ReadStarsUKIRT.c
r39161 r40477 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; -
branches/czw_branch/20170908/Ohana/src/addstar/src/SEDfit.c
r38467 r40477 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; -
branches/czw_branch/20170908/Ohana/src/addstar/src/calibrate.c
r39457 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/addstar/src/fakeimage.c
r37807 r40477 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 -
branches/czw_branch/20170908/Ohana/src/addstar/src/find_matches.c
r38986 r40477 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 -
branches/czw_branch/20170908/Ohana/src/addstar/src/find_matches_closest.c
r38986 r40477 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 -
branches/czw_branch/20170908/Ohana/src/addstar/src/find_matches_gaia.c
r39926 r40477 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 -
branches/czw_branch/20170908/Ohana/src/addstar/src/find_proper.c
r15036 r40477 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 */ -
branches/czw_branch/20170908/Ohana/src/addstar/src/loadgalphot_readstars.c
r39542 r40477 241 241 242 242 int ifit = idx_gal[i]; 243 if (ifit < 0) { Nbad ++; continue; } // skip galaxy models with bad IDs 243 if (ifit < 0) { 244 fprintf (stderr, "%d %f %f %d\n", i, X_FIT[i], Y_FIT[i], MODEL_TYPE_gal[i]); 245 Nbad ++; 246 continue; 247 } // skip galaxy models with bad IDs 244 248 245 249 double R, D; -
branches/czw_branch/20170908/Ohana/src/addstar/src/loadsupercos_plates.c
r37807 r40477 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]; -
branches/czw_branch/20170908/Ohana/src/addstar/src/loadsupercos_rawdata.c
r39457 r40477 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 -
branches/czw_branch/20170908/Ohana/src/addstar/src/mkcmf.c
r39457 r40477 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; -
branches/czw_branch/20170908/Ohana/src/checkastro/src/BrightCatalog.c
r37043 r40477 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 -
branches/czw_branch/20170908/Ohana/src/delstar/Makefile
r39692 r40477 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 \ -
branches/czw_branch/20170908/Ohana/src/delstar/include/delstar.h
r39926 r40477 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 -
branches/czw_branch/20170908/Ohana/src/delstar/src/args.c
r39926 r40477 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 -
branches/czw_branch/20170908/Ohana/src/delstar/src/delstar.c
r39692 r40477 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); -
branches/czw_branch/20170908/Ohana/src/delstar/src/delstar_client.c
r39692 r40477 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); -
branches/czw_branch/20170908/Ohana/src/delstar/src/gimages.c
r39457 r40477 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); -
branches/czw_branch/20170908/Ohana/src/dvolens/src/update_objects_catalog.c
r39611 r40477 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 -
branches/czw_branch/20170908/Ohana/src/dvomerge/include/dvomerge.h
r39926 r40477 55 55 int MATCH_BY_EXTERN_ID; 56 56 57 int ONLY_MATCHES; 58 57 59 int MATCHED_TABLES; 58 60 int RESET_STARPAR; -
branches/czw_branch/20170908/Ohana/src/dvomerge/src/args.c
r39926 r40477 86 86 } 87 87 88 /* extra error messages*/88 /* match images in the src and tgt database tables by their externID values (otherwise by time and photcode) */ 89 89 MATCH_BY_EXTERN_ID = FALSE; 90 90 if ((N = get_argument (*argc, argv, "-match-by-extern-id"))) { 91 91 MATCH_BY_EXTERN_ID = TRUE; 92 remove_argument (N, argc, argv); 93 } 94 /* add objects from input to output database only if they match an existing object */ 95 ONLY_MATCHES = FALSE; 96 if ((N = get_argument (*argc, argv, "-only-matches"))) { 97 ONLY_MATCHES = TRUE; 92 98 remove_argument (N, argc, argv); 93 99 } … … 373 379 } 374 380 375 /* extra error messages*/381 /* match images in the src and tgt database tables by their externID values (otherwise by time and photcode) */ 376 382 MATCH_BY_EXTERN_ID = FALSE; 377 383 if ((N = get_argument (*argc, argv, "-match-by-extern-id"))) { 378 384 MATCH_BY_EXTERN_ID = TRUE; 385 remove_argument (N, argc, argv); 386 } 387 /* add objects from input to output database only if they match an existing object */ 388 ONLY_MATCHES = FALSE; 389 if ((N = get_argument (*argc, argv, "-only-matches"))) { 390 ONLY_MATCHES = TRUE; 379 391 remove_argument (N, argc, argv); 380 392 } -
branches/czw_branch/20170908/Ohana/src/dvomerge/src/build_links.c
r40127 r40477 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 -
branches/czw_branch/20170908/Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c
r39926 r40477 330 330 if (MATCHED_TABLES) { strextend (&command, "-matched-tables"); } 331 331 if (MATCH_BY_EXTERN_ID) { strextend (&command, "-match-by-extern-id"); } 332 if (ONLY_MATCHES) { strextend (&command, "-only-matches"); } 332 333 if (UPDATE_CATFORMAT) { strextend (&command, "-update-catformat %s", UPDATE_CATFORMAT); } 333 334 if (UPDATE_CATCOMPRESS) { strextend (&command, "-update-catcompress %s", UPDATE_CATCOMPRESS); } -
branches/czw_branch/20170908/Ohana/src/dvomerge/src/dvosecfilt_catalogs.c
r38986 r40477 41 41 // always load all of the data (if any exists) 42 42 catalog.Nsecfilt = 0; 43 catalog.catflags = DVO_LOAD_ SECFILT; // XXX this will fail for MEF version43 catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT; // XXX this will fail for MEF version 44 44 catalog.catformat = dvo_catalog_catformat (CATFORMAT); // set the default catformat from config data 45 45 catalog.catmode = dvo_catalog_catmode (CATMODE); // set the default catmode from config data -
branches/czw_branch/20170908/Ohana/src/dvomerge/src/merge_catalogs_old.c
r39926 r40477 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 } … … 406 406 /** incorporate unmatched image stars, if this star is in field of this catalog **/ 407 407 /* these new entries are all written out in UPDATE mode */ 408 for (i = 0; i < Nstars; i++) {408 for (i = 0; (i < Nstars) && !ONLY_MATCHES; i++) { 409 409 off_t N = N1[i]; 410 410 … … 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 } -
branches/czw_branch/20170908/Ohana/src/dvopsps/include/dvopsps.h
r39112 r40477 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; … … 34 36 unsigned int flags; 35 37 unsigned int objflags; 38 unsigned int filtflags; 36 39 } Detections; 37 40 … … 45 48 46 49 int SAVE_REMOTE; 50 int TEST_MODE; 47 51 48 52 int PARALLEL; … … 96 100 int insert_detections_mysql_array PROTO((MYSQL *mysql, Detections *detections, int Ndetections)); 97 101 int insert_detections_mysql_detvalue PROTO((IOBuffer *buffer, Detections *detection)); 98 int assign_detection_values PROTO((Detections *detection, Measure *measure, Average *average ));102 int assign_detection_values PROTO((Detections *detection, Measure *measure, Average *average, SecFilt *secfilt)); 99 103 100 104 int init_detections PROTO((void)); -
branches/czw_branch/20170908/Ohana/src/dvopsps/src/DetectionOps.c
r39547 r40477 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 ); -
branches/czw_branch/20170908/Ohana/src/dvopsps/src/initialize_dvopsps.c
r38674 r40477 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"))) { -
branches/czw_branch/20170908/Ohana/src/dvopsps/src/insert_FWobjects_dvopsps.c
r38471 r40477 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); -
branches/czw_branch/20170908/Ohana/src/dvopsps/src/insert_FWobjects_dvopsps_catalog.c
r39593 r40477 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; -
branches/czw_branch/20170908/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c
r39645 r40477 19 19 20 20 ZeroPoint = GetZeroPoint(); 21 int Nsecfilt = GetPhotcodeNsecfilt (); 21 22 22 23 int missingID = 0; … … 51 52 if (measure->photcode >= PHOTCODE_END) continue; 52 53 53 assign_detection_values (&detections[Ndetections], measure, average); 54 int equivCode = GetPhotcodeEquivCodebyCode (measure->photcode); 55 int Nsec = GetPhotcodeNsec (equivCode); 56 57 SecFilt *secfilt = (Nsec >= 0) ? &catalog->secfilt[Nsecfilt*i + Nsec] : NULL; 58 59 assign_detection_values (&detections[Ndetections], measure, average, secfilt); 54 60 Ndetections ++; 55 61 … … 97 103 98 104 ZeroPoint = GetZeroPoint(); 105 int Nsecfilt = GetPhotcodeNsecfilt (); 99 106 100 107 INITTIME; … … 127 134 if (measure[Nmeas].photcode >= PHOTCODE_END) continue; 128 135 136 int equivCode = GetPhotcodeEquivCodebyCode (measure[Nmeas].photcode); 137 int Nsec = GetPhotcodeNsec (equivCode); 138 139 SecFilt *secfilt = (Nsec > -1) ? &catalog->secfilt[Nsecfilt*i + Nsec] : NULL; 140 129 141 // XXX check return status 130 142 Detections detection; 131 assign_detection_values (&detection, &measure[Nmeas], &average[i] );143 assign_detection_values (&detection, &measure[Nmeas], &average[i], secfilt); 132 144 133 145 if (!insert_detections_mysql_detvalue (&buffer, &detection)) { … … 183 195 184 196 PrintIOBuffer (buffer, "INSERT INTO dvoDetectionFull (objID, detectID, ippObjID, ippDetectID, imageID, catID, "); 185 PrintIOBuffer (buffer, "ra, dec_, raErr, decErr, zp , zpFactor, telluricExt, airmass, expTime, ");186 PrintIOBuffer (buffer, "Mpsf, dMpsf, Mkron, dMkron, Map, dMap, flags, objflags ) VALUES \n");197 PrintIOBuffer (buffer, "ra, dec_, raErr, decErr, zpPSF, zpFactorPSF, zpAPER, zpFactorAPER, telluricExt, airmass, expTime, "); 198 PrintIOBuffer (buffer, "Mpsf, dMpsf, Mkron, dMkron, Map, dMap, flags, objflags, filtflags) VALUES \n"); 187 199 188 200 return TRUE; … … 254 266 PRINT_FLOAT(buffer, detection->raErr, "%.6f, "); 255 267 PRINT_FLOAT(buffer, detection->decErr, "%.6f, "); 256 PRINT_FLOAT(buffer, detection->zp, "%.6f, "); 257 PRINT_FLOAT(buffer, detection->zpFactor, "%.6e, "); 268 PRINT_FLOAT(buffer, detection->zpPSF, "%.6f, "); 269 PRINT_FLOAT(buffer, detection->zpFactorPSF, "%.6e, "); 270 PRINT_FLOAT(buffer, detection->zpAPER, "%.6f, "); 271 PRINT_FLOAT(buffer, detection->zpFactorAPER,"%.6e, "); 258 272 PRINT_FLOAT(buffer, detection->telluricExt, "%.6f, "); 259 273 PRINT_FLOAT(buffer, detection->airmass, "%.6f, "); … … 268 282 269 283 PrintIOBuffer (buffer, "%u, ", detection->flags); // measure.flags 270 PrintIOBuffer (buffer, "%u),\n", detection->objflags); // average.flags 284 PrintIOBuffer (buffer, "%u, ", detection->objflags); // average.flags 285 PrintIOBuffer (buffer, "%u),\n", detection->filtflags); // secfilt.flags 271 286 return TRUE; 272 287 } … … 303 318 } 304 319 305 int assign_detection_values (Detections *detection, Measure *measure, Average *average) { 320 int assign_detection_values (Detections *detection, Measure *measure, Average *average, SecFilt *secfilt) { 321 322 // myAbort ("check on measure->McalPSF vs McalAPER"); 306 323 307 324 PhotCode *code = GetPhotcodebyCode(measure->photcode); … … 311 328 float Mflat = isfinite(measure->Mflat) ? measure->Mflat : 0.0; 312 329 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; 330 float zpPSF = nominalZP - measure->McalPSF - Mflat; 331 float zpFactorPSF = pow(10.0, -0.4*zpPSF + 3.56); 332 float zpAPER = nominalZP - measure->McalAPER - Mflat; 333 float zpFactorAPER= pow(10.0, -0.4*zpAPER + 3.56); 334 float telluricExt = - measure->McalPSF; 316 335 float expTime = pow(10.0, 0.4 * measure->dt); 317 336 float airmass = measure->airmass; … … 329 348 detection->decErr = measure->dYccd * 0.01 * fabs(measure->pltscale); // estimate of decErr 330 349 331 detection->zp = zp; 332 detection->zpFactor = zpFactor; 350 detection->zpPSF = zpPSF; 351 detection->zpFactorPSF = zpFactorPSF; 352 detection->zpAPER = zpAPER; 353 detection->zpFactorAPER = zpFactorAPER; 333 354 detection->telluricExt = telluricExt; 334 355 detection->airmass = airmass; … … 337 358 // XXX clean this up with dvo_photcode_ops calls: 338 359 // 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 );360 detection->Mpsf = getMagFromValueOrFlux (measure->FluxPSF, measure->M, zpPSF); 361 detection->Mkron = getMagFromValueOrFlux (measure->FluxKron, measure->Mkron, zpAPER); 362 detection->Map = getMagFromValueOrFlux (measure->FluxAp, measure->Map, zpAPER); 342 363 343 364 detection->dMpsf = getdMagFromValueOrFlux (measure->FluxPSF, measure->dFluxPSF, measure->dM); … … 347 368 detection->flags = measure->dbFlags; // flags 348 369 detection->objflags = average->flags; // flags 349 350 return TRUE; 351 } 352 370 detection->filtflags = secfilt ? secfilt->flags : 0; // flags 371 372 return TRUE; 373 } 374 -
branches/czw_branch/20170908/Ohana/src/dvopsps/src/insert_objects_dvopsps_catalog.c
r39650 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/fakeastro/src/insert_fakestar.c
r38469 r40477 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; -
branches/czw_branch/20170908/Ohana/src/fakeastro/src/load_template_images.c
r38441 r40477 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; -
branches/czw_branch/20170908/Ohana/src/fakeastro/src/make_2mass_measures.c
r39248 r40477 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; -
branches/czw_branch/20170908/Ohana/src/fakeastro/src/make_fake_stars_catalog.c
r39926 r40477 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; -
branches/czw_branch/20170908/Ohana/src/fakeastro/src/make_gaia_measures.c
r39926 r40477 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; -
branches/czw_branch/20170908/Ohana/src/getstar/src/ReadImageHeader.c
r39998 r40477 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 -
branches/czw_branch/20170908/Ohana/src/getstar/src/select_by_region.c
r38441 r40477 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; -
branches/czw_branch/20170908/Ohana/src/getstar/src/write_getstar_ps1_dev_0.c
r38441 r40477 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; -
branches/czw_branch/20170908/Ohana/src/getstar/src/write_getstar_ps1_dev_1.c
r38441 r40477 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; -
branches/czw_branch/20170908/Ohana/src/getstar/src/write_getstar_ps1_dev_2.c
r38441 r40477 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; -
branches/czw_branch/20170908/Ohana/src/imregister/imphot/dumpfits.c
r38441 r40477 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); -
branches/czw_branch/20170908/Ohana/src/imregister/imphot/output.c
r34088 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/kapa2/include/constants.h
r39225 r40477 27 27 # define MIN_WIDTH 50 28 28 # define MIN_HEIGHT 50 29 # define LABEL_MAXLEN 12829 # define LABEL_MAXLEN 512 30 30 31 31 typedef enum { -
branches/czw_branch/20170908/Ohana/src/kapa2/include/prototypes.h
r39926 r40477 36 36 int DrawObjectN PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 37 37 void DrawPoints PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); 38 void DrawBars PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *object, int mode)); 38 39 void ClipLine PROTO((Graphic *graphic, double x0, double y0, double x1, double y1, double X0, double Y0, double X1, double Y1)); 39 40 void DrawXErrors PROTO((Graphic *graphic, KapaGraphWidget *graph, Gobjects *objects)); … … 139 140 void bDrawConnect PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 140 141 void bDrawHistogram PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 142 void bDrawBars PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object, int mode)); 141 143 void bDrawPoints PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); 142 144 void bDrawXErrors PROTO((bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object)); -
branches/czw_branch/20170908/Ohana/src/kapa2/include/structures.h
r39457 r40477 115 115 typedef struct { 116 116 int x, y; 117 int dx, dy; 117 int dx, dy; // unused? 118 118 double angle; 119 119 int size; 120 int justify; 121 int color; 120 122 char font[64]; 121 123 char text[LABEL_MAXLEN]; -
branches/czw_branch/20170908/Ohana/src/kapa2/src/DrawObjects.c
r40116 r40477 1 1 # include "Ximage.h" 2 2 3 void DrawBars (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object, int mode); 3 /* DrawRectangle & FillRectangle : take rectangle lower-left corner and widths 4 DrawCircle & FillCircle : take circle center and radius 5 */ 4 6 5 7 # define DrawLine(X1,Y1,X2,Y2) (XDrawLine (graphic->display, graphic->window, graphic->gc, (int)(X1), (int)(Y1), (int)(X2), (int)(Y2))) 6 # define DrawRectangle(X1,Y1,X2,Y2) (XDrawRectangle (graphic->display, graphic->window, graphic->gc, (int)(X1), (int)(Y1), (int)(X2), (int)(Y2))) 7 # define FillRectangle(X1,Y1,X2,Y2) (XFillRectangle (graphic->display, graphic->window, graphic->gc, (int)(X1), (int)(Y1), (int)(X2), (int)(Y2))) 8 // # define FillRectangle(X1,Y1,X2,Y2) ; 8 # define DrawRectangle(X,Y,dX,dY) (XDrawRectangle (graphic->display, graphic->window, graphic->gc, (int)(X), (int)(Y), (int)(dX), (int)(dY))) 9 # define FillRectangle(X,Y,dX,dY) (XFillRectangle (graphic->display, graphic->window, graphic->gc, (int)(X), (int)(Y), (int)(dX), (int)(dY))) 9 10 # define DrawCircle(X,Y,R) (XDrawArc (graphic->display, graphic->window, graphic->gc, (int)(X-R), (int)(Y-R), abs(2*R), abs(2*R), 0, 23040)) 10 11 # define FillCircle(X,Y,R) (XFillArc (graphic->display, graphic->window, graphic->gc, (int)(X-R), (int)(Y-R), abs(2*R), abs(2*R), 0, 23040)) … … 96 97 switch (object[0].style) { 97 98 case KAPA_PLOT_CONNECT: 99 // fprintf (stderr, "plot KAPA_PLOT_CONNECT: \n"); 98 100 DrawConnect (graphic, graph, object); 99 101 break; 100 102 case KAPA_PLOT_HISTOGRAM: 103 // fprintf (stderr, "plot KAPA_PLOT_HISTOGRAM:\n"); 101 104 DrawHistogram (graphic, graph, object); 102 105 break; 103 106 case KAPA_PLOT_BARS_SOLID: 107 // fprintf (stderr, "plot KAPA_PLOT_BARS_SOLID:\n"); 104 108 DrawBars (graphic, graph, object, KAPA_PLOT_BARS_SOLID); 105 109 break; 106 110 case KAPA_PLOT_BARS_OUTLINE: 111 // fprintf (stderr, "plot KAPA_PLOT_BARS_OUTLINE:\n"); 107 112 DrawBars (graphic, graph, object, KAPA_PLOT_BARS_OUTLINE); 108 113 break; 109 114 case KAPA_PLOT_BARS_OUTFILL: 115 // fprintf (stderr, "plot KAPA_PLOT_BARS_OUTFILL:\n"); 110 116 DrawBars (graphic, graph, object, KAPA_PLOT_BARS_OUTFILL); 111 117 break; 112 118 case KAPA_PLOT_POINTS: 113 119 default: 120 // fprintf (stderr, "plot KAPA_PLOT_POINTS:\n"); 114 121 DrawPoints (graphic, graph, object); 115 122 break; … … 162 169 sx1 = x[i]*mxi + y[i]*mxj + bx + XCENTER; 163 170 sy1 = x[i]*myi + y[i]*myj + by + YCENTER; 164 165 171 ClipLine (graphic, sx0, sy0, sx1, sy1, X0, Y0, X1, Y1); 166 /* DrawLine (sx0, sy0, sx1, sy1); */167 172 sx0 = sx1; sy0 = sy1; 168 173 } … … 225 230 /******/ 226 231 /* simplify the code abit by finding triplets, watch out for a histogram of 2 points */ 227 # if (1)228 232 void DrawHistogram (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) { 229 233 … … 309 313 DrawLine (sxa, sy1, sxa, sya); 310 314 } 311 312 # else313 314 void DrawHistogram (Graphic *graphic, KapaGraphWidget *graph, Gobjects *object) {315 316 int i;317 float *x, *y;318 double mxi, mxj, myi, myj, bxi, bxj, byi, byj, bx, by;319 double sx0, sy0, sx1, sy1, sxa, sya, sxo, syo;320 double X0, X1, Y0, Y1;321 322 mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0);323 mxj = graph[0].axis[1].dfx / (object[0].y1 - object[0].y0);324 myi = graph[0].axis[0].dfy / (object[0].x1 - object[0].x0);325 myj = graph[0].axis[1].dfy / (object[0].y1 - object[0].y0);326 327 bxi = graph[0].axis[0].fx - object[0].x0*graph[0].axis[0].dfx/(object[0].x1 - object[0].x0);328 bxj = -object[0].y0*graph[0].axis[1].dfx/(object[0].y1 - object[0].y0);329 byi = -object[0].x0*graph[0].axis[0].dfy/(object[0].x1 - object[0].x0);330 byj = graph[0].axis[1].fy - object[0].y0*graph[0].axis[1].dfy/(object[0].y1 - object[0].y0);331 332 bx = bxi + bxj;333 by = byi + byj;334 335 X0 = graph[0].axis[0].fx;336 X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx;337 Y0 = graph[0].axis[1].fy;338 Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy;339 340 /* find the first valid datapoint */341 x = object[0].x; y = object[0].y;342 343 /* we only worry about pairs of points of which one is on the screen. for each such344 pair, we draw the connecting lines from sx0,sy0 to sx1,sy1, passing through the point345 halfway between.346 347 if, for a given point, there was no valid x0,y0, then we call this the first point348 save both the current and previous points.349 */350 351 int firstPair = TRUE;352 sx0r = sy0r = NAN;353 sxPr = syPr = NAN;354 for (i = 0; i < object[0].Npts; i++) {355 if (!(finite(x[i]) && finite(y[i]))) continue;356 sx1r = x[i]*mxi + y[i]*mxj + bx + XCENTER;357 sy1r = x[i]*myi + y[i]*myj + by + YCENTER;358 359 // we have hit the first valid point, but not yet the second one360 if (!isfinite (sx0r)) {361 sx0r = sx1r; sy0r = sy1r;362 continue;363 }364 365 if ((sx1r < X0) && (sx0r < X0)) {366 // both points to left, skip the pair367 sxPr = sx0r; syPr = sy0r;368 sx0r = sx1r; sy0r = sy1r;369 continue;370 }371 if ((sx1r > X0) && (sx0r > X0)) {372 // both points to right, skip the pair373 sxPr = sx0r; syPr = sy0r;374 sx0r = sx1r; sy0r = sy1r;375 continue;376 }377 378 // saturated values for sx0,sy0379 sx0 = MIN (MAX (sx0r, X0), X1);380 sy0 = MAX (MIN (sy0r, Y0), Y1);381 382 // saturated values for sx1,sy1383 sx1 = MIN (MAX (sx1r, X0), X1);384 sy1 = MAX (MIN (sy1r, Y0), Y1);385 386 if (firstPair) {387 /* draw segment equal distance behind first point and down to x-axis */388 sxar = sx0r - 0.5*(sx1r - sx0r);389 sxa = MIN (MAX (sxar, X0), X1);390 sya = MAX (sy0r, Y0);391 XSetForeground (graphic->display, graphic->gc, graphic->fore);392 DrawLine (sx0, sy0, sxa, sy0);393 DrawLine (sxa, sy0, sxa, sya);394 XSetForeground (graphic->display, graphic->gc, graphic->color[object[0].color]);395 FillRectangle (sxa + 3, sy0 + 3, sx0 - sxa - 6, sya - sy0 - 6);396 firstPair = FALSE;397 }398 399 // midpoint & saturated version400 sxar = 0.5*(sx0r + sx1r);401 sxa = MIN (MAX (sxar, X0), X1);402 403 XSetForeground (graphic->display, graphic->gc, graphic->fore);404 DrawLine (sx0, sy0, sxa, sy0);405 DrawLine (sxa, sy0, sxa, sy1);406 DrawLine (sxa, sy1, sx1, sy1);407 XSetForeground (graphic->display, graphic->gc, graphic->color[object[0].color]);408 FillRectangle (sx0 + 3, sy0 + 3, sxa - sx0 - 6, Y0 - sy0 - 6);409 FillRectangle (sxa + 3, sy1 + 3, sx1 - sxa - 6, Y0 - sy1 - 6);410 sxPr = sx0r; syPr = sy0r;411 sx0r = sx1r; sy0r = sy1r;412 }413 414 /* draw segment equal distance after last point and down to x-axis */415 sxa = MIN (MAX (sx1 + 0.5*(sx1 - sxo), X0), X1);416 sya = MAX (sy1, Y0);417 DrawLine (sx1, sy1, sxa, sy1);418 DrawLine (sxa, sy1, sxa, sya);419 }420 # endif421 315 422 316 // uses object->color … … 498 392 /* we are drawing bars which are filled rectangles of height y[i] and width 0.5*dx 499 393 one point at a time 394 395 I need to know the distance to the next and prev points to calculate dx 396 for the first point, dx is x[1] - x[0] 397 for the last point, dx is x[-1] - x[-2] (x[-1] is the last point) 398 for the rest, dx is 0.5*(x[i+1] - x[i-1]) 399 400 rather than working out complex on-the-fly logic, I want to find the first and last 401 valid point in an initial pass, then calculate the above for the remainder. 402 TBD: make an index vector of only valid points? 500 403 */ 501 502 // I need to know the distance to the next and prev points to calculate dx503 // for the first point, dx is x[1] - x[0]504 // for the last point, dx is x[-1] - x[-2] (x[-1] is the last point)505 // for the rest, dx is 0.5*(x[i+1] - x[i-1])506 507 // rather than working out complex on-the-fly logic, I want to find the first and last508 // valid point in an initial pass, the calculate the above for the remainder.509 // or make an index vector of only valid points?510 404 511 405 int Ngood = 0; … … 522 416 // coordinate on the screen of the point: 523 417 double sx1r = x[i]*mxi + y[i]*mxj + bx + XCENTER; 524 // double sy1r = x[i]*myi + y[i]*myj + by + YCENTER;525 418 526 419 if (sx1r < X0) { … … 576 469 n = goodPoint[1]; 577 470 double sx1r = x[n]*mxi + y[n]*mxj + bx + XCENTER; 578 // double sy1r = x[n]*myi + y[n]*myj + by + YCENTER;579 471 580 472 n = goodPoint[0]; … … 605 497 n = goodPoint[i + 1]; 606 498 double sx2r = x[n]*mxi + y[n]*mxj + bx + XCENTER; 607 // double sy2r = x[n]*myi + y[n]*myj + by + YCENTER;608 499 609 500 n = goodPoint[i - 1]; 610 501 double sx0r = x[n]*mxi + y[n]*mxj + bx + XCENTER; 611 // double sy0r = x[n]*myi + y[n]*myj + by + YCENTER; 612 613 double dx = 0.5*0.5*object->size*(sx2r - sx0r); // 2 factors of 0.5 (we want half of the average spacing)502 503 // below we have 2 factors of 0.5 (we want half of the average spacing) 504 double dx = 0.5*0.5*object->size*(sx2r - sx0r); 614 505 615 506 n = goodPoint[i]; … … 642 533 n = goodPoint[Ngood - 2]; 643 534 double sx0r = x[n]*mxi + y[n]*mxj + bx + XCENTER; 644 // double sy0r = x[n]*myi + y[n]*myj + by + YCENTER;645 535 646 536 double dx = 0.5*object->size*(sx1r - sx0r); -
branches/czw_branch/20170908/Ohana/src/kapa2/src/DrawTextlines.c
r13320 r40477 12 12 fontname = GetRotFont (&size); 13 13 XSetForeground (graphic->display, graphic->gc, graphic->fore); 14 DrawRotTextInit (graphic->display, graphic->window, graphic->gc, graphic->fore, graphic->back);15 14 16 15 for (i = 0; i < graph[0].Ntextline; i++) { 17 16 if (strcmp (graph[0].textline[i].text, "")) { 17 DrawRotTextInit (graphic->display, graphic->window, graphic->gc, graphic->color[graph[0].textline[i].color], graphic->back); 18 18 angle = graph[0].textline[i].angle; 19 19 x = graph[0].textline[i].x; 20 20 y = graph[0].textline[i].y; 21 21 SetRotFont (graph[0].textline[i].font, graph[0].textline[i].size); 22 DrawRotText (x, y, graph[0].textline[i].text, 5, angle);22 DrawRotText (x, y, graph[0].textline[i].text, graph[0].textline[i].justify, angle); 23 23 } 24 24 } -
branches/czw_branch/20170908/Ohana/src/kapa2/src/LoadObject.c
r39926 r40477 42 42 graph[0].objects[N].color = KapaColormapSize() - 1; 43 43 } 44 if ((graph[0].objects[N].style != 2) && (graph[0].objects[N].color < 0)) {44 if ((graph[0].objects[N].style != KAPA_PLOT_POINTS) && (graph[0].objects[N].color < 0)) { 45 45 graph[0].objects[N].color = 0; 46 46 } -
branches/czw_branch/20170908/Ohana/src/kapa2/src/LoadTextlines.c
r39626 r40477 4 4 5 5 char *string; 6 int N, size ;6 int N, size, justify, color; 7 7 double tX, tY, tT, L; 8 8 Section *section; … … 23 23 REALLOCATE (graph[0].textline, Label, graph[0].Ntextline); 24 24 25 KiiScanMessage (sock, "%lf %lf %lf ", &tX, &tY, &tT);25 KiiScanMessage (sock, "%lf %lf %lf %d %d", &tX, &tY, &tT, &justify, &color); 26 26 27 27 L = graph[0].axis[0].dfx; … … 52 52 graph[0].textline[N].size = size; 53 53 strcpy (graph[0].textline[N].font, string); 54 graph[0].textline[N].justify = justify; 55 graph[0].textline[N].color = color; 54 56 55 57 if (USE_XWINDOW) DrawTextlines (graph); -
branches/czw_branch/20170908/Ohana/src/kapa2/src/PSObjects.c
r39926 r40477 1 1 # include "Ximage.h" 2 2 3 void PSBars (KapaGraphWidget *graph, Gobjects *object, FILE *f, int mode); 4 5 /* DrawRectangle & FillRectangle : take rectangle lower-left corner and widths 6 DrawCircle & FillCircle : take circle center and radius 7 */ 8 3 9 # define DrawLine(X1,Y1,X2,Y2) (fprintf (f, " %6.2f %6.2f %6.2f %6.2f L\n", X1, graphic->dy - Y1, X2, graphic->dy - Y2)) 4 # define DrawRectangle(X,Y,dX,dY) (fprintf (f, " %6.2f %6.2f %6.2f %6.2f B\n", (dX), (dY), (X -0.5*dX), (graphic->dy-Y-0.5*dY)))5 # define FillRectangle(X,Y,dX,dY) (fprintf (f, " %6.2f %6.2f %6.2f %6.2f F\n", (dX), (dY), (X -0.5*dX), (graphic->dy-Y-0.5*dY)))10 # define DrawRectangle(X,Y,dX,dY) (fprintf (f, " %6.2f %6.2f %6.2f %6.2f B\n", (dX), (dY), (X), (graphic->dy-Y))) 11 # define FillRectangle(X,Y,dX,dY) (fprintf (f, " %6.2f %6.2f %6.2f %6.2f F\n", (dX), (dY), (X), (graphic->dy-Y))) 6 12 # define DrawCircle(X1,Y1,R) (fprintf (f, " %6.2f %6.2f %6.2f C\n", (X1), (graphic->dy - Y1), (R))) 7 13 # define FillCircle(X1,Y1,R) (fprintf (f, " %6.2f %6.2f %6.2f FC\n", (X1), (graphic->dy - Y1), (R))) … … 32 38 } 33 39 34 int PSObjectsN(KapaGraphWidget *graph, Gobjects *object, FILE *f) {35 40 void PSLineStyle (KapaGraphWidget *graph, Gobjects *object, FILE *f) { 41 36 42 static char short_dash[] = "4 4"; 37 43 static char long_dash[] = "8 8"; … … 64 70 fprintf (f, "%s setrgbcolor\n", KapaColorRGBString(object->color)); 65 71 } 72 } 73 74 int PSObjectsN (KapaGraphWidget *graph, Gobjects *object, FILE *f) { 75 76 PSLineStyle (graph, object, f); 66 77 67 78 switch (object->style) { … … 71 82 case KAPA_PLOT_HISTOGRAM: 72 83 PSHistogram (graph, object, f); 84 break; 85 case KAPA_PLOT_BARS_SOLID: 86 PSBars (graph, object, f, KAPA_PLOT_BARS_SOLID); 87 break; 88 case KAPA_PLOT_BARS_OUTLINE: 89 PSBars (graph, object, f, KAPA_PLOT_BARS_OUTLINE); 90 break; 91 case KAPA_PLOT_BARS_OUTFILL: 92 PSBars (graph, object, f, KAPA_PLOT_BARS_OUTFILL); 73 93 break; 74 94 case KAPA_PLOT_POINTS: … … 265 285 DrawLine (sx1, sy1, sxa, sy1); 266 286 DrawLine (sxa, sy1, sxa, sya); 267 268 # if (0) 269 sx0 = x[i]*mxi + y[i]*mxj + bx; 270 sy0 = x[i]*myi + y[i]*myj + by; 271 sx0 = MIN (MAX (sx0, X0), X1); 272 sy0 = MAX (MIN (sy0, Y0), Y1); 273 274 /* continue with rest of points */ 275 for (i++; i < object[0].Npts; i++) { 287 } 288 289 // uses object->color 290 # define HISTOGRAM_SOLID(X_VALUE, Y_VALUE, DX_VAL) { \ 291 /* histogram bar corners */ \ 292 double sxmin = (X_VALUE) - 0.5*(DX_VAL); \ 293 double sxmax = (X_VALUE) + 0.5*(DX_VAL); \ 294 double symin = Xaxis; \ 295 double symax = (Y_VALUE); \ 296 /* saturated values for corner coords: */ \ 297 sxmin = MIN (MAX (sxmin, X0), X1); \ 298 sxmax = MIN (MAX (sxmax, X0), X1); \ 299 symin = MAX (MIN (symin, Y0), Y1); \ 300 symax = MAX (MIN (symax, Y0), Y1); \ 301 double dy = fabs(symax - symin); \ 302 double ylow = MAX(symin, symax); \ 303 FillRectangle (sxmin, ylow, (DX_VAL), dy); } 304 305 // uses object->color 306 # define HISTOGRAM_OUTLINE(X_VALUE, Y_VALUE, DX_VAL) { \ 307 /* histogram bar corners */ \ 308 double sxmin = (X_VALUE) - 0.5*(DX_VAL); \ 309 double sxmax = (X_VALUE) + 0.5*(DX_VAL); \ 310 double symin = Xaxis; \ 311 double symax = (Y_VALUE); \ 312 /* saturated values for corner coords: */ \ 313 sxmin = MIN (MAX (sxmin, X0), X1); \ 314 sxmax = MIN (MAX (sxmax, X0), X1); \ 315 symin = MAX (MIN (symin, Y0), Y1); \ 316 symax = MAX (MIN (symax, Y0), Y1); \ 317 double dy = fabs(symax - symin); \ 318 double ylow = MAX(symin, symax); \ 319 DrawRectangle (sxmin, ylow, (DX_VAL), dy); } 320 321 # define HISTOGRAM_OUTFILL(X_VALUE, Y_VALUE, DX_VAL) { \ 322 /* histogram bar corners */ \ 323 double sxmin = (X_VALUE) - 0.5*(DX_VAL); \ 324 double sxmax = (X_VALUE) + 0.5*(DX_VAL); \ 325 double symin = Xaxis; \ 326 double symax = (Y_VALUE); \ 327 /* saturated values for corner coords: */ \ 328 sxmin = MIN (MAX (sxmin, X0), X1); \ 329 sxmax = MIN (MAX (sxmax, X0), X1); \ 330 symin = MAX (MIN (symin, Y0), Y1); \ 331 symax = MAX (MIN (symax, Y0), Y1); \ 332 double dy = fabs(symax - symin); \ 333 double ylow = MAX(symin, symax); \ 334 FillRectangle (sxmin, ylow, (DX_VAL), dy); \ 335 fprintf (f, "0.00 0.00 0.00 setrgbcolor\n"); \ 336 DrawRectangle (sxmin, ylow, (DX_VAL), dy); \ 337 fprintf (f, "%s setrgbcolor\n", KapaColorRGBString(object->color)); } 338 339 void PSBars (KapaGraphWidget *graph, Gobjects *object, FILE *f, int mode) { 340 341 double mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); // slope of the x-axis in x-pixels 342 double mxj = graph[0].axis[1].dfx / (object[0].y1 - object[0].y0); // slope of the x-axis in y-pixels (always 0 for now) 343 double myi = graph[0].axis[0].dfy / (object[0].x1 - object[0].x0); // slope of the x-axis in x-pixels (always 0 for now) 344 double myj = graph[0].axis[1].dfy / (object[0].y1 - object[0].y0); // slope of the x-axis in x-pixels 345 346 // intercepts of axes 347 double bxi = graph[0].axis[0].fx - object[0].x0*graph[0].axis[0].dfx/(object[0].x1 - object[0].x0); 348 double bxj = -object[0].y0*graph[0].axis[1].dfx/(object[0].y1 - object[0].y0); 349 double byi = -object[0].x0*graph[0].axis[0].dfy/(object[0].x1 - object[0].x0); 350 double byj = graph[0].axis[1].fy - object[0].y0*graph[0].axis[1].dfy/(object[0].y1 - object[0].y0); 351 352 double bx = bxi + bxj; 353 double by = byi + byj; 354 355 // corner coords 356 double X0 = graph[0].axis[0].fx; 357 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 358 double Y0 = graph[0].axis[1].fy; 359 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 360 // NOTE: Y0 > Y1 (dfy is negative) 361 362 /* find the first valid datapoint */ 363 float *x = object[0].x; 364 float *y = object[0].y; 365 366 /* we are drawing bars which are filled rectangles of height y[i] and width 0.5*dx 367 one point at a time 368 369 I need to know the distance to the next and prev points to calculate dx 370 for the first point, dx is x[1] - x[0] 371 for the last point, dx is x[-1] - x[-2] (x[-1] is the last point) 372 for the rest, dx is 0.5*(x[i+1] - x[i-1]) 373 374 rather than working out complex on-the-fly logic, I want to find the first and last 375 valid point in an initial pass, then calculate the above for the remainder. 376 TBD: make an index vector of only valid points? 377 */ 378 379 int Ngood = 0; 380 ALLOCATE_PTR (goodPoint, int, object[0].Npts); 381 382 // x = ??, y = 0: this assumes the xaxis is parallel to the plot window (myi = 0) 383 // note: Y0 > Y1 : y runs from large on bottom to small on top 384 float Xaxis = by; 385 Xaxis = MAX (Y1, MIN (Xaxis, Y0)); 386 387 for (int i = 0; i < object[0].Npts; i++) { 276 388 if (!(finite(x[i]) && finite(y[i]))) continue; 277 sx1 = x[i]*mxi + y[i]*mxj + bx; 278 sy1 = x[i]*myi + y[i]*myj + by; 279 sx1 = MIN (MAX (sx1, X0), X1); 280 sy1 = MAX (MIN (sy1, Y0), Y1); 281 sxa = 0.5*(sx0 + sx1); 282 DrawLine (sx0, sy0, sxa, sy0); 283 DrawLine (sxa, sy0, sxa, sy1); 284 DrawLine (sxa, sy1, sx1, sy1); 285 sx0 = sx1; sy0 = sy1; 286 } 287 # endif 389 390 // coordinate on the screen of the point: 391 double sx1r = x[i]*mxi + y[i]*mxj + bx; 392 393 if (sx1r < X0) { 394 // point to the left, skip it 395 continue; 396 } 397 if (sx1r > X1) { 398 // point to the right, skip it 399 continue; 400 } 401 402 goodPoint[Ngood] = i; 403 Ngood ++; 404 } 405 406 if (Ngood == 0) { 407 free (goodPoint); 408 return; 409 } 410 411 // if we only have 1 point, draw bar half the width of the screen 412 // this works fine, but the auto limits for 1 value are somewhat silly 413 if (Ngood == 1) { 414 // coordinate on the screen of the point: 415 int n = goodPoint[0]; 416 double sx1r = x[n]*mxi + y[n]*mxj + bx; 417 double sy1r = x[n]*myi + y[n]*myj + by; 418 419 float dx = 0.5*object->size*(X1 - X0); 420 421 switch (mode) { 422 case KAPA_PLOT_BARS_SOLID: 423 HISTOGRAM_SOLID(sx1r, sy1r, dx); 424 break; 425 case KAPA_PLOT_BARS_OUTLINE: 426 HISTOGRAM_OUTLINE(sx1r, sy1r, dx); 427 break; 428 case KAPA_PLOT_BARS_OUTFILL: 429 HISTOGRAM_OUTFILL(sx1r, sy1r, dx); 430 break; 431 default: 432 HISTOGRAM_SOLID(sx1r, sy1r, dx); 433 break; 434 } 435 436 free (goodPoint); 437 return; 438 } 439 440 // first point: 441 { 442 int n; 443 n = goodPoint[1]; 444 double sx1r = x[n]*mxi + y[n]*mxj + bx; 445 446 n = goodPoint[0]; 447 double sx0r = x[n]*mxi + y[n]*mxj + bx; 448 double sy0r = x[n]*myi + y[n]*myj + by; 449 450 double dx = 0.5*object->size*(sx1r - sx0r); 451 452 switch (mode) { 453 case KAPA_PLOT_BARS_SOLID: 454 HISTOGRAM_SOLID(sx0r, sy0r, dx); 455 break; 456 case KAPA_PLOT_BARS_OUTLINE: 457 HISTOGRAM_OUTLINE(sx0r, sy0r, dx); 458 break; 459 case KAPA_PLOT_BARS_OUTFILL: 460 HISTOGRAM_OUTFILL(sx0r, sy0r, dx); 461 break; 462 default: 463 HISTOGRAM_SOLID(sx0r, sy0r, dx); 464 break; 465 } 466 } 467 468 for (int i = 1; i < Ngood - 1; i++) { 469 470 int n; 471 n = goodPoint[i + 1]; 472 double sx2r = x[n]*mxi + y[n]*mxj + bx; 473 474 n = goodPoint[i - 1]; 475 double sx0r = x[n]*mxi + y[n]*mxj + bx; 476 477 // below we have 2 factors of 0.5 (we want half of the average spacing) 478 double dx = 0.5*0.5*object->size*(sx2r - sx0r); 479 480 n = goodPoint[i]; 481 double sx1r = x[n]*mxi + y[n]*mxj + bx; 482 double sy1r = x[n]*myi + y[n]*myj + by; 483 484 switch (mode) { 485 case KAPA_PLOT_BARS_SOLID: 486 HISTOGRAM_SOLID(sx1r, sy1r, dx); 487 break; 488 case KAPA_PLOT_BARS_OUTLINE: 489 HISTOGRAM_OUTLINE(sx1r, sy1r, dx); 490 break; 491 case KAPA_PLOT_BARS_OUTFILL: 492 HISTOGRAM_OUTFILL(sx1r, sy1r, dx); 493 break; 494 default: 495 HISTOGRAM_SOLID(sx1r, sy1r, dx); 496 break; 497 } 498 } 499 500 // last point: 501 { 502 int n; 503 n = goodPoint[Ngood - 1]; 504 double sx1r = x[n]*mxi + y[n]*mxj + bx; 505 double sy1r = x[n]*myi + y[n]*myj + by; 506 507 n = goodPoint[Ngood - 2]; 508 double sx0r = x[n]*mxi + y[n]*mxj + bx; 509 510 double dx = 0.5*object->size*(sx1r - sx0r); 511 512 switch (mode) { 513 case KAPA_PLOT_BARS_SOLID: 514 HISTOGRAM_SOLID(sx1r, sy1r, dx); 515 break; 516 case KAPA_PLOT_BARS_OUTLINE: 517 HISTOGRAM_OUTLINE(sx1r, sy1r, dx); 518 break; 519 case KAPA_PLOT_BARS_OUTFILL: 520 HISTOGRAM_OUTFILL(sx1r, sy1r, dx); 521 break; 522 default: 523 HISTOGRAM_SOLID(sx1r, sy1r, dx); 524 break; 525 } 526 } 527 free (goodPoint); 528 return; 288 529 } 289 530 … … 310 551 by = byi + byj; 311 552 312 Graphic *graphic = GetGraphic(); 313 553 // scaled colors use the colormap defined for the graphic 314 554 ALLOCATE (pixel1, float, graphic[0].Npixels); 315 555 ALLOCATE (pixel2, float, graphic[0].Npixels); … … 347 587 } 348 588 D = scaleSize ? dz*z[i] : ds; 349 DrawRectangle (sx , sy, 2*D, 2*D);589 DrawRectangle (sx - D, sy - D, 2*D, 2*D); 350 590 } 351 591 } … … 605 845 } 606 846 D = scaleSize ? dz*z[i] : ds; 607 FillRectangle (sx , sy, 2*D, 2*D);847 FillRectangle (sx - D, sy - D, 2*D, 2*D); 608 848 } 609 849 } -
branches/czw_branch/20170908/Ohana/src/kapa2/src/PSTextlines.c
r13320 r40477 16 16 x = graph[0].textline[i].x; 17 17 y = graphic->dy - graph[0].textline[i].y; 18 if (graph[0].textline[i].color >= 0) { 19 fprintf (f, "%s setrgbcolor\n", KapaColorRGBString(graph[0].textline[i].color)); 20 } 18 21 SetRotFont (graph[0].textline[i].font, graph[0].textline[i].size); 19 PSRotText (f, x, y, graph[0].textline[i].text, 5, angle);22 PSRotText (f, x, y, graph[0].textline[i].text, graph[0].textline[i].justify, angle); 20 23 } 21 24 } -
branches/czw_branch/20170908/Ohana/src/kapa2/src/bDrawLabels.c
r29938 r40477 40 40 for (i = 0; i < graph[0].Ntextline; i++) { 41 41 if (strcmp (graph[0].textline[i].text, "")) { 42 bDrawSetColor (buffer, graph[0].textline[i].color); 42 43 angle = graph[0].textline[i].angle; 43 44 x = graph[0].textline[i].x; 44 45 y = graph[0].textline[i].y; 45 46 SetRotFont (graph[0].textline[i].font, graph[0].textline[i].size); 46 bDrawRotText (buffer, x, y, graph[0].textline[i].text, 5, angle);47 bDrawRotText (buffer, x, y, graph[0].textline[i].text, graph[0].textline[i].justify, angle); 47 48 } 48 49 } -
branches/czw_branch/20170908/Ohana/src/kapa2/src/bDrawObjects.c
r39926 r40477 2 2 3 3 # define DrawLine(BUF,X1,Y1,X2,Y2) (bDrawLine (BUF, (X1), (Y1), (X2), (Y2))) 4 # define DrawRectangle(BUF,X,Y,dX,dY) (bDrawRectOpen (BUF, (X -0.5*dX), (Y-0.5*dY), (X+0.5*dX), (Y+0.5*dY)))5 # define FillRectangle(BUF,X,Y,dX,dY) (bDrawRectFill (BUF, (X -0.5*dX), (Y-0.5*dY), (X+0.5*dX+1), (Y+0.5*dY+1)))4 # define DrawRectangle(BUF,X,Y,dX,dY) (bDrawRectOpen (BUF, (X), (Y), (X+dX), (Y+dY))) 5 # define FillRectangle(BUF,X,Y,dX,dY) (bDrawRectFill (BUF, (X), (Y), (X+dX+1), (Y+dY+1))) 6 6 # define DrawCircle(BUF,X1,Y1,R) (bDrawCircle (BUF, (X1), (Y1), (R))) 7 7 # define FillCircle(BUF,X1,Y1,R) (bDrawCircleFill (BUF, (X1), (Y1), (R))) … … 9 9 # define OpenTriangle(BUF,X1,Y1,X2,Y2,X3,Y3) (bDrawTriOpen (BUF, (X1), (Y1), (X2), (Y2), (X3), (Y3))) 10 10 11 # define CONNECT 012 # define HISTOGRAM 113 # define POINTS 214 15 11 static Graphic *graphic; 16 12 … … 42 38 case KAPA_PLOT_HISTOGRAM: 43 39 bDrawHistogram (buffer, graph, object); 40 break; 41 case KAPA_PLOT_BARS_SOLID: 42 bDrawBars (buffer, graph, object, KAPA_PLOT_BARS_SOLID); 43 break; 44 case KAPA_PLOT_BARS_OUTLINE: 45 bDrawBars (buffer, graph, object, KAPA_PLOT_BARS_OUTLINE); 46 break; 47 case KAPA_PLOT_BARS_OUTFILL: 48 bDrawBars (buffer, graph, object, KAPA_PLOT_BARS_OUTFILL); 44 49 break; 45 50 case KAPA_PLOT_POINTS: … … 235 240 DrawLine (buffer, sx1, sy1, sxa, sy1); 236 241 DrawLine (buffer, sxa, sy1, sxa, sya); 237 238 # if (0) 239 sx0 = x[i]*mxi + y[i]*mxj + bx; 240 sy0 = x[i]*myi + y[i]*myj + by; 241 sx0 = MIN (MAX (sx0, X0), X1); 242 sy0 = MAX (MIN (sy0, Y0), Y1); 243 244 /* continue with rest of points */ 245 for (i++; i < object[0].Npts; i++) { 242 } 243 244 // uses object->color 245 # define HISTOGRAM_SOLID(X_VALUE, Y_VALUE, DX_VAL) { \ 246 /* histogram bar corners */ \ 247 double sxmin = (X_VALUE) - 0.5*(DX_VAL); \ 248 double sxmax = (X_VALUE) + 0.5*(DX_VAL); \ 249 double symin = Xaxis; \ 250 double symax = (Y_VALUE); \ 251 /* saturated values for corner coords: */ \ 252 sxmin = MIN (MAX (sxmin, X0), X1); \ 253 sxmax = MIN (MAX (sxmax, X0), X1); \ 254 symin = MAX (MIN (symin, Y0), Y1); \ 255 symax = MAX (MIN (symax, Y0), Y1); \ 256 double dy = fabs(symax - symin); \ 257 double ylow = MIN(symin, symax); \ 258 FillRectangle (buffer, sxmin, ylow, (DX_VAL), dy); } 259 260 // uses object->color 261 # define HISTOGRAM_OUTLINE(X_VALUE, Y_VALUE, DX_VAL) { \ 262 /* histogram bar corners */ \ 263 double sxmin = (X_VALUE) - 0.5*(DX_VAL); \ 264 double sxmax = (X_VALUE) + 0.5*(DX_VAL); \ 265 double symin = Xaxis; \ 266 double symax = (Y_VALUE); \ 267 /* saturated values for corner coords: */ \ 268 sxmin = MIN (MAX (sxmin, X0), X1); \ 269 sxmax = MIN (MAX (sxmax, X0), X1); \ 270 symin = MAX (MIN (symin, Y0), Y1); \ 271 symax = MAX (MIN (symax, Y0), Y1); \ 272 double dy = fabs(symax - symin); \ 273 double ylow = MIN(symin, symax); \ 274 DrawRectangle (buffer, sxmin, ylow, (DX_VAL), dy); } 275 276 # define HISTOGRAM_OUTFILL(X_VALUE, Y_VALUE, DX_VAL) { \ 277 /* histogram bar corners */ \ 278 double sxmin = (X_VALUE) - 0.5*(DX_VAL); \ 279 double sxmax = (X_VALUE) + 0.5*(DX_VAL); \ 280 double symin = Xaxis; \ 281 double symax = (Y_VALUE); \ 282 /* saturated values for corner coords: */ \ 283 sxmin = MIN (MAX (sxmin, X0), X1); \ 284 sxmax = MIN (MAX (sxmax, X0), X1); \ 285 symin = MAX (MIN (symin, Y0), Y1); \ 286 symax = MAX (MIN (symax, Y0), Y1); \ 287 double dy = fabs(symax - symin); \ 288 double ylow = MIN(symin, symax); \ 289 FillRectangle (buffer, sxmin, ylow, (DX_VAL), dy); \ 290 bDrawSetColor (buffer, graphic->fore); \ 291 DrawRectangle (buffer, sxmin, ylow, (DX_VAL), dy); \ 292 bDrawSetColor (buffer, object[0].color); } 293 294 void bDrawBars (bDrawBuffer *buffer, KapaGraphWidget *graph, Gobjects *object, int mode) { 295 296 double mxi = graph[0].axis[0].dfx / (object[0].x1 - object[0].x0); // slope of the x-axis in x-pixels 297 double mxj = graph[0].axis[1].dfx / (object[0].y1 - object[0].y0); // slope of the x-axis in y-pixels (always 0 for now) 298 double myi = graph[0].axis[0].dfy / (object[0].x1 - object[0].x0); // slope of the x-axis in x-pixels (always 0 for now) 299 double myj = graph[0].axis[1].dfy / (object[0].y1 - object[0].y0); // slope of the x-axis in x-pixels 300 301 // intercepts of axes 302 double bxi = graph[0].axis[0].fx - object[0].x0*graph[0].axis[0].dfx/(object[0].x1 - object[0].x0); 303 double bxj = -object[0].y0*graph[0].axis[1].dfx/(object[0].y1 - object[0].y0); 304 double byi = -object[0].x0*graph[0].axis[0].dfy/(object[0].x1 - object[0].x0); 305 double byj = graph[0].axis[1].fy - object[0].y0*graph[0].axis[1].dfy/(object[0].y1 - object[0].y0); 306 307 double bx = bxi + bxj; 308 double by = byi + byj; 309 310 // corner coords 311 double X0 = graph[0].axis[0].fx; 312 double X1 = graph[0].axis[0].fx + graph[0].axis[0].dfx; 313 double Y0 = graph[0].axis[1].fy; 314 double Y1 = graph[0].axis[1].fy + graph[0].axis[1].dfy; 315 316 /* find the first valid datapoint */ 317 float *x = object[0].x; 318 float *y = object[0].y; 319 320 /* we are drawing bars which are filled rectangles of height y[i] and width 0.5*dx 321 one point at a time 322 323 I need to know the distance to the next and prev points to calculate dx 324 for the first point, dx is x[1] - x[0] 325 for the last point, dx is x[-1] - x[-2] (x[-1] is the last point) 326 for the rest, dx is 0.5*(x[i+1] - x[i-1]) 327 328 rather than working out complex on-the-fly logic, I want to draw the first and last 329 valid points in an initial pass, then calculate the above for the remainder. 330 331 First, make an index vector of only valid points 332 */ 333 334 int Ngood = 0; 335 ALLOCATE_PTR (goodPoint, int, object[0].Npts); 336 337 // x = ??, y = 0: this assumes the xaxis is parallel to the plot window (myi = 0) 338 // since y runs from large on bottom to small on top, this is slightly backwards 339 float Xaxis = by; 340 Xaxis = MAX (Y1, MIN (Xaxis, Y0)); // MIN & MAX reversed for neg y dir 341 342 for (int i = 0; i < object[0].Npts; i++) { 246 343 if (!(finite(x[i]) && finite(y[i]))) continue; 247 sx1 = x[i]*mxi + y[i]*mxj + bx; 248 sy1 = x[i]*myi + y[i]*myj + by; 249 sx1 = MIN (MAX (sx1, X0), X1); 250 sy1 = MAX (MIN (sy1, Y0), Y1); 251 sxa = 0.5*(sx0 + sx1); 252 DrawLine (buffer, sx0, sy0, sxa, sy0); 253 DrawLine (buffer, sxa, sy0, sxa, sy1); 254 DrawLine (buffer, sxa, sy1, sx1, sy1); 255 sx0 = sx1; sy0 = sy1; 256 } 257 # endif 344 345 // coordinate on the screen of the point: 346 double sx1r = x[i]*mxi + y[i]*mxj + bx; 347 348 if (sx1r < X0) { 349 // point to the left, skip it 350 continue; 351 } 352 if (sx1r > X1) { 353 // point to the right, skip it 354 continue; 355 } 356 357 goodPoint[Ngood] = i; 358 Ngood ++; 359 } 360 361 if (Ngood == 0) { 362 free (goodPoint); 363 return; 364 } 365 366 // if we only have 1 point, draw bar half the width of the screen 367 // this works fine, but the auto limits for 1 value are somewhat silly 368 if (Ngood == 1) { 369 // coordinate on the screen of the point: 370 int n = goodPoint[0]; 371 double sx1r = x[n]*mxi + y[n]*mxj + bx; 372 double sy1r = x[n]*myi + y[n]*myj + by; 373 374 float dx = 0.5*object->size*(X1 - X0); 375 376 switch (mode) { 377 case KAPA_PLOT_BARS_SOLID: 378 HISTOGRAM_SOLID(sx1r, sy1r, dx); 379 break; 380 case KAPA_PLOT_BARS_OUTLINE: 381 HISTOGRAM_OUTLINE(sx1r, sy1r, dx); 382 break; 383 case KAPA_PLOT_BARS_OUTFILL: 384 HISTOGRAM_OUTFILL(sx1r, sy1r, dx); 385 break; 386 default: 387 HISTOGRAM_SOLID(sx1r, sy1r, dx); 388 break; 389 } 390 391 free (goodPoint); 392 return; 393 } 394 395 // first point: 396 { 397 int n; 398 n = goodPoint[1]; 399 double sx1r = x[n]*mxi + y[n]*mxj + bx; 400 401 n = goodPoint[0]; 402 double sx0r = x[n]*mxi + y[n]*mxj + bx; 403 double sy0r = x[n]*myi + y[n]*myj + by; 404 405 double dx = 0.5*object->size*(sx1r - sx0r); 406 407 switch (mode) { 408 case KAPA_PLOT_BARS_SOLID: 409 HISTOGRAM_SOLID(sx0r, sy0r, dx); 410 break; 411 case KAPA_PLOT_BARS_OUTLINE: 412 HISTOGRAM_OUTLINE(sx0r, sy0r, dx); 413 break; 414 case KAPA_PLOT_BARS_OUTFILL: 415 HISTOGRAM_OUTFILL(sx0r, sy0r, dx); 416 break; 417 default: 418 HISTOGRAM_SOLID(sx0r, sy0r, dx); 419 break; 420 } 421 } 422 423 for (int i = 1; i < Ngood - 1; i++) { 424 425 int n; 426 n = goodPoint[i + 1]; 427 double sx2r = x[n]*mxi + y[n]*mxj + bx; 428 429 n = goodPoint[i - 1]; 430 double sx0r = x[n]*mxi + y[n]*mxj + bx; 431 432 // below we have 2 factors of 0.5 (we want half of the average spacing) 433 double dx = 0.5*0.5*object->size*(sx2r - sx0r); 434 435 n = goodPoint[i]; 436 double sx1r = x[n]*mxi + y[n]*mxj + bx; 437 double sy1r = x[n]*myi + y[n]*myj + by; 438 439 switch (mode) { 440 case KAPA_PLOT_BARS_SOLID: 441 HISTOGRAM_SOLID(sx1r, sy1r, dx); 442 break; 443 case KAPA_PLOT_BARS_OUTLINE: 444 HISTOGRAM_OUTLINE(sx1r, sy1r, dx); 445 break; 446 case KAPA_PLOT_BARS_OUTFILL: 447 HISTOGRAM_OUTFILL(sx1r, sy1r, dx); 448 break; 449 default: 450 HISTOGRAM_SOLID(sx1r, sy1r, dx); 451 break; 452 } 453 } 454 455 // last point: 456 { 457 int n; 458 n = goodPoint[Ngood - 1]; 459 double sx1r = x[n]*mxi + y[n]*mxj + bx; 460 double sy1r = x[n]*myi + y[n]*myj + by; 461 462 n = goodPoint[Ngood - 2]; 463 double sx0r = x[n]*mxi + y[n]*mxj + bx; 464 465 double dx = 0.5*object->size*(sx1r - sx0r); 466 467 switch (mode) { 468 case KAPA_PLOT_BARS_SOLID: 469 HISTOGRAM_SOLID(sx1r, sy1r, dx); 470 break; 471 case KAPA_PLOT_BARS_OUTLINE: 472 HISTOGRAM_OUTLINE(sx1r, sy1r, dx); 473 break; 474 case KAPA_PLOT_BARS_OUTFILL: 475 HISTOGRAM_OUTFILL(sx1r, sy1r, dx); 476 break; 477 default: 478 HISTOGRAM_SOLID(sx1r, sy1r, dx); 479 break; 480 } 481 } 482 free (goodPoint); 483 return; 258 484 } 259 485 … … 280 506 by = byi + byj; 281 507 282 Graphic *graphic = GetGraphic(); 283 508 // scaled colors use the colormap defined for the graphic 284 509 ALLOCATE (pixel1, unsigned char, graphic[0].Npixels); 285 510 ALLOCATE (pixel2, unsigned char, graphic[0].Npixels); … … 293 518 } 294 519 295 /**** point s are scaled by object.z***/520 /**** point sizes are scaled by object.size, colors by object.color ***/ 296 521 int scaleSize = (object[0].size < 0); 297 522 int scaleColor = (object[0].color < 0); … … 317 542 } 318 543 D = scaleSize ? dz*z[i] : ds; 319 DrawRectangle (buffer, sx , sy, 2*D, 2*D);544 DrawRectangle (buffer, sx - D, sy - D, 2*D, 2*D); // DrawRectangle takes corner point 320 545 // plot range saturated by bDrawRectOpen 321 546 } … … 611 836 } 612 837 D = scaleSize ? dz*z[i] : ds; 613 FillRectangle (buffer, sx , sy, 2*D, 2*D);838 FillRectangle (buffer, sx - D, sy - D, 2*D, 2*D); 614 839 // plot range saturated by bDrawRectFill 615 840 } -
branches/czw_branch/20170908/Ohana/src/libautocode/Makefile.Targets
r40062 r40477 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 \ -
branches/czw_branch/20170908/Ohana/src/libautocode/def/image.d
r37807 r40477 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 -
branches/czw_branch/20170908/Ohana/src/libautocode/def/measure.d
r39262 r40477 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 -
branches/czw_branch/20170908/Ohana/src/libautocode/def/secfilt.d
r37246 r40477 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 -
branches/czw_branch/20170908/Ohana/src/libdvo/Makefile
r40063 r40477 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 \ -
branches/czw_branch/20170908/Ohana/src/libdvo/doc/notes.txt
r34749 r40477 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 -
branches/czw_branch/20170908/Ohana/src/libdvo/include/dvo.h
r40063 r40477 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" … … 1267 1272 # undef LENSFIELD 1268 1273 1269 # define GALPHOT_FIELD(NAME, VALUE) float GalphotValue_##NAME (PhotCode *code, dvoMagClassType class, GalPhot *galphot, int Ngalphot) 1270 1271 GALPHOT_FIELD(GAL_MAG, mag); 1272 GALPHOT_FIELD(GAL_MAG_ERR, magErr); 1273 GALPHOT_FIELD(GAL_MAJ, majorAxis); 1274 GALPHOT_FIELD(GAL_MAJ_ERR, majorAxisErr); 1275 GALPHOT_FIELD(GAL_MIN, minorAxis); 1276 GALPHOT_FIELD(GAL_MIN_ERR, minorAxisErr); 1277 GALPHOT_FIELD(GAL_THETA, theta); 1278 GALPHOT_FIELD(GAL_THETA_ERR, thetaErr); 1279 GALPHOT_FIELD(GAL_INDEX, index); 1280 GALPHOT_FIELD(GAL_CHISQ, chisq); 1281 GALPHOT_FIELD(GAL_NPIX, Npix); 1282 GALPHOT_FIELD(GAL_FLAGS, flags); 1283 GALPHOT_FIELD(GAL_TYPE, modelType); 1274 # define GALPHOT_FIELD(NAME, VALUE, TYPE, DEFAULT) TYPE GalphotValue_##NAME (PhotCode *code, dvoMagClassType class, GalPhot *galphot, int Ngalphot); 1275 1276 //GALPHOT_FIELD(GAL_MAG, mag); 1277 //GALPHOT_FIELD(GAL_MAG_ERR, magErr); 1278 //GALPHOT_FIELD(GAL_MAJ, majorAxis); 1279 //GALPHOT_FIELD(GAL_MAJ_ERR, majorAxisErr); 1280 //GALPHOT_FIELD(GAL_MIN, minorAxis); 1281 //GALPHOT_FIELD(GAL_MIN_ERR, minorAxisErr); 1282 //GALPHOT_FIELD(GAL_THETA, theta); 1283 //GALPHOT_FIELD(GAL_THETA_ERR, thetaErr); 1284 //GALPHOT_FIELD(GAL_INDEX, index); 1285 //GALPHOT_FIELD(GAL_CHISQ, chisq); 1286 //GALPHOT_FIELD(GAL_NPIX, Npix); 1287 //GALPHOT_FIELD(GAL_FLAGS, flags); 1288 //GALPHOT_FIELD(GAL_TYPE, modelType); 1289 1290 GALPHOT_FIELD(GAL_MAG, mag, float, NAN) 1291 GALPHOT_FIELD(GAL_MAG_ERR, magErr, float, NAN) 1292 GALPHOT_FIELD(GAL_MAJ, majorAxis, float, NAN) 1293 GALPHOT_FIELD(GAL_MAJ_ERR, majorAxisErr, float, NAN) 1294 GALPHOT_FIELD(GAL_MIN, minorAxis, float, NAN) 1295 GALPHOT_FIELD(GAL_MIN_ERR, minorAxisErr, float, NAN) 1296 GALPHOT_FIELD(GAL_THETA, theta, float, NAN) 1297 GALPHOT_FIELD(GAL_THETA_ERR, thetaErr, float, NAN) 1298 GALPHOT_FIELD(GAL_INDEX, index, float, NAN) 1299 GALPHOT_FIELD(GAL_CHISQ, chisq, float, NAN) 1300 GALPHOT_FIELD(GAL_NPIX, Npix, float, NAN) 1301 1302 GALPHOT_FIELD(GAL_TYPE, modelType, short, 0) 1303 1304 GALPHOT_FIELD(GAL_FLAGS, flags, unsigned int, 0) 1305 GALPHOT_FIELD(GAL_OBJ_ID, objID, unsigned int, 0) 1306 GALPHOT_FIELD(GAL_CAT_ID, catID, unsigned int, 0) 1307 GALPHOT_FIELD(GAL_DET_ID, detID, unsigned int, 0) 1308 GALPHOT_FIELD(GAL_IMAGE_ID, imageID, unsigned int, 0) 1284 1309 1285 1310 # undef GALPHOT_FIELD -
branches/czw_branch/20170908/Ohana/src/libdvo/include/dvodb.h
r39633 r40477 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 { … … 120 127 MAG_OPTION_GAL_FLAGS, 121 128 MAG_OPTION_GAL_TYPE, 129 130 MAG_OPTION_GAL_OBJ_ID, 131 MAG_OPTION_GAL_CAT_ID, 132 MAG_OPTION_GAL_DET_ID, 133 MAG_OPTION_GAL_IMAGE_ID, 122 134 } dvoMagOptionType; 123 135 … … 236 248 MEAS_EXTERN_ID, 237 249 MEAS_EXPNAME_AS_INT, 238 MEAS_MCAL_OFFSET, // make this a dvoMagOption? 250 MEAS_MCAL_OFFSET_PSF, // make this a dvoMagOption? 251 MEAS_MCAL_OFFSET_APER, // make this a dvoMagOption? 239 252 MEAS_FLAT, 240 253 MEAS_CENTER_OFFSET, … … 369 382 IMAGE_XM, 370 383 IMAGE_AIRMASS, 371 IMAGE_MCAL, 384 IMAGE_MCAL_PSF, 385 IMAGE_MCAL_APER, 372 386 IMAGE_dMCAL, 373 387 IMAGE_PHOTCODE, … … 471 485 char type; 472 486 int field; 473 //opihi_flt FltValue;474 //opihi_int IntValue;475 double FltValue;476 int IntValue;487 opihi_flt FltValue; 488 opihi_int IntValue; 489 // double FltValue; 490 // int IntValue; 477 491 } dbStack; 478 492 479 493 typedef struct { 480 //opihi_flt Flt;481 //opihi_int Int;482 double Flt;483 int Int;494 opihi_flt Flt; 495 opihi_int Int; 496 // double Flt; 497 // int Int; 484 498 } dbValue; 485 499 … … 562 576 int dbExtractImagesReset (void); 563 577 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 578 #include "get_graphdata.h" 570 579 -
branches/czw_branch/20170908/Ohana/src/libdvo/include/libdvo_astro.h
r39457 r40477 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) -
branches/czw_branch/20170908/Ohana/src/libdvo/src/HostTable.c
r39475 r40477 11 11 host->stdio[HOST_STDERR] = -1; 12 12 host->pid = 0; 13 host->status = 1024; 13 14 return; 14 15 } -
branches/czw_branch/20170908/Ohana/src/libdvo/src/ImageMetadata.c
r37807 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/LoadPhotcodesFITS.c
r40063 r40477 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 -
branches/czw_branch/20170908/Ohana/src/libdvo/src/SavePhotcodesFITS.c
r38553 r40477 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); -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dbCheckStack.c
r39578 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dbExtractAverages.c
r39633 r40477 466 466 break; 467 467 468 case MAG_OPTION_GAL_MAG: { value.Flt = GalphotValue_GAL_MAG (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 469 case MAG_OPTION_GAL_MAG_ERR: { value.Flt = GalphotValue_GAL_MAG_ERR (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 470 case MAG_OPTION_GAL_MAJ: { value.Flt = GalphotValue_GAL_MAJ (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 471 case MAG_OPTION_GAL_MAJ_ERR: { value.Flt = GalphotValue_GAL_MAJ_ERR (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 472 case MAG_OPTION_GAL_MIN: { value.Flt = GalphotValue_GAL_MIN (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 473 case MAG_OPTION_GAL_MIN_ERR: { value.Flt = GalphotValue_GAL_MIN_ERR (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 474 case MAG_OPTION_GAL_THETA: { value.Flt = GalphotValue_GAL_THETA (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 475 case MAG_OPTION_GAL_THETA_ERR: { value.Flt = GalphotValue_GAL_THETA_ERR(field->photcode, field->magClass, galphot, average->Ngalphot); break; } 476 case MAG_OPTION_GAL_INDEX: { value.Flt = GalphotValue_GAL_INDEX (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 477 case MAG_OPTION_GAL_CHISQ: { value.Flt = GalphotValue_GAL_CHISQ (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 478 case MAG_OPTION_GAL_NPIX: { value.Flt = GalphotValue_GAL_NPIX (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 479 case MAG_OPTION_GAL_TYPE: { value.Flt = GalphotValue_GAL_TYPE (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 480 case MAG_OPTION_GAL_FLAGS: { value.Flt = GalphotValue_GAL_FLAGS (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 468 case MAG_OPTION_GAL_MAG: { value.Flt = GalphotValue_GAL_MAG (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 469 case MAG_OPTION_GAL_MAG_ERR: { value.Flt = GalphotValue_GAL_MAG_ERR (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 470 case MAG_OPTION_GAL_MAJ: { value.Flt = GalphotValue_GAL_MAJ (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 471 case MAG_OPTION_GAL_MAJ_ERR: { value.Flt = GalphotValue_GAL_MAJ_ERR (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 472 case MAG_OPTION_GAL_MIN: { value.Flt = GalphotValue_GAL_MIN (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 473 case MAG_OPTION_GAL_MIN_ERR: { value.Flt = GalphotValue_GAL_MIN_ERR (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 474 case MAG_OPTION_GAL_THETA: { value.Flt = GalphotValue_GAL_THETA (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 475 case MAG_OPTION_GAL_THETA_ERR:{ value.Flt = GalphotValue_GAL_THETA_ERR(field->photcode, field->magClass, galphot, average->Ngalphot); break; } 476 case MAG_OPTION_GAL_INDEX: { value.Flt = GalphotValue_GAL_INDEX (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 477 case MAG_OPTION_GAL_CHISQ: { value.Flt = GalphotValue_GAL_CHISQ (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 478 case MAG_OPTION_GAL_NPIX: { value.Flt = GalphotValue_GAL_NPIX (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 479 case MAG_OPTION_GAL_TYPE: { value.Flt = GalphotValue_GAL_TYPE (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 480 case MAG_OPTION_GAL_FLAGS: { value.Flt = GalphotValue_GAL_FLAGS (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 481 482 case MAG_OPTION_GAL_OBJ_ID: { value.Flt = GalphotValue_GAL_OBJ_ID (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 483 case MAG_OPTION_GAL_CAT_ID: { value.Flt = GalphotValue_GAL_CAT_ID (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 484 case MAG_OPTION_GAL_DET_ID: { value.Flt = GalphotValue_GAL_DET_ID (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 485 case MAG_OPTION_GAL_IMAGE_ID: { value.Flt = GalphotValue_GAL_IMAGE_ID (field->photcode, field->magClass, galphot, average->Ngalphot); break; } 481 486 482 487 default: -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dbExtractImages.c
r39457 r40477 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: … … 374 377 break; 375 378 case IMAGE_Y_ERR_SYS: 376 value.Flt = image[N].d XpixSys;379 value.Flt = image[N].dYpixSys; 377 380 break; 378 381 case IMAGE_MAG_ERR_SYS: -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dbExtractMeasures.c
r39926 r40477 316 316 case MAG_OPTION_GAL_FLAGS: 317 317 case MAG_OPTION_GAL_TYPE: 318 case MAG_OPTION_GAL_OBJ_ID: 319 case MAG_OPTION_GAL_CAT_ID: 320 case MAG_OPTION_GAL_DET_ID: 321 case MAG_OPTION_GAL_IMAGE_ID: 318 322 319 323 case MAG_OPTION_NONE: … … 696 700 break; 697 701 case MEAS_PSF_QF_PERFECT: /* OK */ 698 value.Flt = NAN;702 value.Flt = measure[0].psfQFperf; 699 703 break; 700 704 case MEAS_PSF_CHISQ: /* OK */ … … 740 744 break; 741 745 742 case MEAS_MCAL_OFFSET: { value.Flt = measure[0].Mcal; break; } 746 case MEAS_MCAL_OFFSET_PSF: { value.Flt = measure[0].McalPSF; break; } 747 case MEAS_MCAL_OFFSET_APER: { value.Flt = measure[0].McalAPER; break; } 743 748 case MEAS_FLAT: { value.Flt = measure[0].Mflat; break; } 744 749 -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dbFields.c
r40206 r40477 181 181 if (magOption == MAG_OPTION_GAL_FLAGS ) return TRUE; 182 182 if (magOption == MAG_OPTION_GAL_TYPE ) return TRUE; 183 184 if (magOption == MAG_OPTION_GAL_OBJ_ID ) return TRUE; 185 if (magOption == MAG_OPTION_GAL_CAT_ID ) return TRUE; 186 if (magOption == MAG_OPTION_GAL_DET_ID ) return TRUE; 187 if (magOption == MAG_OPTION_GAL_IMAGE_ID ) return TRUE; 183 188 return FALSE; 184 189 } … … 609 614 if (!strcasecmp (fieldName, "SKY")) ESCAPE (MEAS_SKY, OPIHI_FLT); 610 615 if (!strcasecmp (fieldName, "SKY_ERR")) ESCAPE (MEAS_dSKY, OPIHI_FLT); 611 if (!strcasecmp (fieldName, "MCAL_OFFSET")) ESCAPE (MEAS_MCAL_OFFSET, OPIHI_FLT); 616 if (!strcasecmp (fieldName, "MCAL_OFFSET")) ESCAPE (MEAS_MCAL_OFFSET_PSF, OPIHI_FLT); 617 if (!strcasecmp (fieldName, "MCAL_OFFSET_PSF")) ESCAPE (MEAS_MCAL_OFFSET_PSF, OPIHI_FLT); 618 if (!strcasecmp (fieldName, "MCAL_OFFSET_APER")) ESCAPE (MEAS_MCAL_OFFSET_APER, OPIHI_FLT); 612 619 if (!strcasecmp (fieldName, "FLAT")) ESCAPE (MEAS_FLAT, OPIHI_FLT); 613 620 if (!strcasecmp (fieldName, "CENTER_OFFSET")) ESCAPE (MEAS_CENTER_OFFSET, OPIHI_FLT); … … 845 852 if (!strcasecmp (fieldName, "dapresid" )) ESCAPE (IMAGE_DAPRESID, OPIHI_FLT); 846 853 847 if (!strcasecmp (fieldName, "Mcal" )) ESCAPE (IMAGE_MCAL, OPIHI_FLT); 848 if (!strcasecmp (fieldName, "dMcal" )) ESCAPE (IMAGE_dMCAL, OPIHI_FLT); 849 if (!strcasecmp (fieldName, "Xm" )) ESCAPE (IMAGE_XM, OPIHI_FLT); 850 if (!strcasecmp (fieldName, "photcode" )) ESCAPE (IMAGE_PHOTCODE, OPIHI_INT); 851 if (!strcasecmp (fieldName, "exptime" )) ESCAPE (IMAGE_EXPTIME, OPIHI_FLT); 852 if (!strcasecmp (fieldName, "expname" )) ESCAPE (IMAGE_EXPNAME_AS_INT, OPIHI_INT); 853 if (!strcasecmp (fieldName, "sidtime" )) ESCAPE (IMAGE_SIDTIME, OPIHI_FLT); 854 if (!strcasecmp (fieldName, "Mcal" )) ESCAPE (IMAGE_MCAL_PSF, OPIHI_FLT); 855 if (!strcasecmp (fieldName, "McalPSF" )) ESCAPE (IMAGE_MCAL_PSF, OPIHI_FLT); 856 if (!strcasecmp (fieldName, "McalAPER" )) ESCAPE (IMAGE_MCAL_APER, OPIHI_FLT); 857 if (!strcasecmp (fieldName, "McalAPERTURE")) ESCAPE (IMAGE_MCAL_APER, OPIHI_FLT); 858 if (!strcasecmp (fieldName, "dMcal" )) ESCAPE (IMAGE_dMCAL, OPIHI_FLT); 859 if (!strcasecmp (fieldName, "Xm" )) ESCAPE (IMAGE_XM, OPIHI_FLT); 860 if (!strcasecmp (fieldName, "photcode" )) ESCAPE (IMAGE_PHOTCODE, OPIHI_INT); 861 if (!strcasecmp (fieldName, "exptime" )) ESCAPE (IMAGE_EXPTIME, OPIHI_FLT); 862 if (!strcasecmp (fieldName, "expname" )) ESCAPE (IMAGE_EXPNAME_AS_INT, OPIHI_INT); 863 if (!strcasecmp (fieldName, "sidtime" )) ESCAPE (IMAGE_SIDTIME, OPIHI_FLT); 854 864 855 865 if (!strcasecmp (fieldName, "latitude" )) ESCAPE (IMAGE_LATITUDE, OPIHI_FLT); -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_catalog.c
r40063 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_catalog_raw.c
r40063 r40477 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); -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_catalog_split.c
r39395 r40477 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 -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert.c
r40063 r40477 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); -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c
r39457 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c
r39457 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_3.c
r37807 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c
r39457 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert_PS1_SIM.c
r39457 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c
r39457 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c
r39457 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert_PS1_V3.c
r39457 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c
r39457 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c
r39486 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert_PS1_V5_LOAD.c
r40063 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert_elixir.c
r38462 r40477 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 -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert_loneos.c
r38462 r40477 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 -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c
r39457 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c
r39457 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_image.c
r40063 r40477 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); -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_image_raw.c
r40063 r40477 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); -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_photcode_ops.c
r39670 r40477 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 … … 2122 2137 LENSFIELD(E2) 2123 2138 2124 # if ( 1)2139 # if (0) 2125 2140 float GalphotValue_GAL_MAG (PhotCode *code, dvoMagClassType class, GalPhot *galphot, int Ngalphot) { 2126 2141 int n; … … 2150 2165 # endif 2151 2166 2152 # define GALPHOT_FIELD(NAME, VALUE) \ 2153 float GalphotValue_##NAME (PhotCode *code, dvoMagClassType class, GalPhot *galphot, int Ngalphot) { \ 2167 // the block above is an example of the generic version below 2168 2169 # define GALPHOT_FIELD(NAME, VALUE, TYPE, DEFAULT) \ 2170 TYPE GalphotValue_##NAME (PhotCode *code, dvoMagClassType class, GalPhot *galphot, int Ngalphot) { \ 2154 2171 int n; \ 2155 if (code == NULL) return NAN; \2172 if (code == NULL) return DEFAULT; \ 2156 2173 for (n = 0; n < Ngalphot; n++) { \ 2157 2174 short equivCode = GetPhotcodeEquivCodebyCode (galphot[n].photcode); \ … … 2169 2186 break; \ 2170 2187 default: \ 2171 return NAN;\2188 return DEFAULT; \ 2172 2189 } \ 2173 floatvalue = galphot[n].VALUE; \2190 TYPE value = galphot[n].VALUE; \ 2174 2191 return (value); \ 2175 2192 } \ 2176 return NAN; \ 2177 } 2178 2179 // GALPHOT_FIELD(GAL_MAG, mag) 2180 GALPHOT_FIELD(GAL_MAG_ERR, magErr) 2181 GALPHOT_FIELD(GAL_MAJ, majorAxis) 2182 GALPHOT_FIELD(GAL_MAJ_ERR, majorAxisErr) 2183 GALPHOT_FIELD(GAL_MIN, minorAxis) 2184 GALPHOT_FIELD(GAL_MIN_ERR, minorAxisErr) 2185 GALPHOT_FIELD(GAL_THETA, theta) 2186 GALPHOT_FIELD(GAL_THETA_ERR, thetaErr) 2187 GALPHOT_FIELD(GAL_INDEX, index) 2188 GALPHOT_FIELD(GAL_CHISQ, chisq) 2189 GALPHOT_FIELD(GAL_NPIX, Npix) 2190 GALPHOT_FIELD(GAL_FLAGS, flags) 2191 GALPHOT_FIELD(GAL_TYPE, modelType) 2193 return DEFAULT; \ 2194 } 2195 2196 GALPHOT_FIELD(GAL_MAG, mag, float, NAN) 2197 GALPHOT_FIELD(GAL_MAG_ERR, magErr, float, NAN) 2198 GALPHOT_FIELD(GAL_MAJ, majorAxis, float, NAN) 2199 GALPHOT_FIELD(GAL_MAJ_ERR, majorAxisErr, float, NAN) 2200 GALPHOT_FIELD(GAL_MIN, minorAxis, float, NAN) 2201 GALPHOT_FIELD(GAL_MIN_ERR, minorAxisErr, float, NAN) 2202 GALPHOT_FIELD(GAL_THETA, theta, float, NAN) 2203 GALPHOT_FIELD(GAL_THETA_ERR, thetaErr, float, NAN) 2204 GALPHOT_FIELD(GAL_INDEX, index, float, NAN) 2205 GALPHOT_FIELD(GAL_CHISQ, chisq, float, NAN) 2206 GALPHOT_FIELD(GAL_NPIX, Npix, float, NAN) 2207 2208 GALPHOT_FIELD(GAL_TYPE, modelType, short, 0) 2209 2210 GALPHOT_FIELD(GAL_FLAGS, flags, unsigned int, 0) 2211 GALPHOT_FIELD(GAL_OBJ_ID, objID, unsigned int, 0) 2212 GALPHOT_FIELD(GAL_CAT_ID, catID, unsigned int, 0) 2213 GALPHOT_FIELD(GAL_DET_ID, detID, unsigned int, 0) 2214 GALPHOT_FIELD(GAL_IMAGE_ID, imageID, unsigned int, 0) -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvo_tiny_values.c
r39457 r40477 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; -
branches/czw_branch/20170908/Ohana/src/libdvo/src/dvosorts.c
r39457 r40477 7 7 8 8 # define SWAPFUNC(A,B){ Average tmp; tmp = ave[A]; ave[A] = ave[B]; ave[B] = tmp; } 9 # define COMPARE(A,B)(ave[A].R < ave[B].R) 9 # define COMPARE(A,B)((!isfinite(ave[A].R) && isfinite(ave[B].R)) || (ave[A].R < ave[B].R)) 10 // # define COMPARE(A,B) (ave[A].R < ave[B].R) 10 11 11 12 OHANA_SORT (N, COMPARE, SWAPFUNC); … … 50 51 itmp = S[A]; S[A] = S[B]; S[B] = itmp; \ 51 52 } 52 # define COMPARE(A,B)(X[A] < X[B]) 53 // # define COMPARE(A,B) (X[A] < X[B]) 54 # define COMPARE(A,B)((!isfinite(X[A]) && isfinite(X[B])) || (X[A] < X[B])) 53 55 54 56 OHANA_SORT (N, COMPARE, SWAPFUNC); … … 81 83 itmp = S[A]; S[A] = S[B]; S[B] = itmp; \ 82 84 } 83 # define COMPARE(A,B)( X[S[A]] < X[S[B]])85 # define COMPARE(A,B)((!isfinite(X[S[A]]) && isfinite(X[S[B]])) || (X[S[A]] < X[S[B]])) 84 86 85 87 OHANA_SORT (N, COMPARE, SWAPFUNC); … … 93 95 94 96 # define SWAPFUNC(A,B){ SkyRegion tmp; tmp = region[A]; region[A] = region[B]; region[B] = tmp; } 95 # define COMPARE(A,B)(region[A].Dmin < region[B].Dmin) 97 // # define COMPARE(A,B)(region[A].Dmin < region[B].Dmin) 98 # define COMPARE(A,B)((!isfinite(region[A].Dmin) && isfinite(region[B].Dmin)) || (region[A].Dmin < region[B].Dmin)) 96 99 97 100 OHANA_SORT (N, COMPARE, SWAPFUNC); -
branches/czw_branch/20170908/Ohana/src/libdvo/src/skyregion_ops.c
r39301 r40477 319 319 320 320 // a region like -10 10 0 20 will become 350 10 0 20 and return all regions on both sides of 0,360 321 // a region like -10 370 should NOT become 350 10, but should instead become 0 360 321 322 SkyList *SkyListByBounds (SkyTable *table, int depth, double Rmin, double Rmax, double Dmin, double Dmax) { 322 323 323 324 int i, j, Ns; 324 325 SkyList *list, *extra; 326 327 if (Rmax - Rmin > 360.0) { 328 Rmin = 0.0; 329 Rmax = 360.0; 330 } 325 331 326 332 Rmin = ohana_normalize_angle (Rmin); -
branches/czw_branch/20170908/Ohana/src/libkapa/include/kapa.h
r40106 r40477 239 239 int KapaSetFont (int fd, char *name, int size); 240 240 int KapaSendLabel (int fd, char *string, int mode); 241 int KapaSendTextline (int fd, char *string, float x, float y, float angle );241 int KapaSendTextline (int fd, char *string, float x, float y, float angle, int justify, int color); 242 242 int KapaSetLimits (int fd, Graphdata *graphmode); 243 243 int KapaGetLimits (int fd, float *dx, float *dy); … … 292 292 void bDrawBufferFree (bDrawBuffer *buffer); 293 293 void bDrawSetBuffer (bDrawBuffer *buffer); 294 void bDrawSetColor (bDrawBuffer *buffer, bDrawColor color); 294 295 void bDrawSetStyle (bDrawBuffer *buffer, bDrawColor color, int lw, int lt); 295 296 void bDrawPoint (bDrawBuffer *buffer, int x, int y); -
branches/czw_branch/20170908/Ohana/src/libkapa/src/DrawRotString.c
r39626 r40477 12 12 static unsigned long RotBackground; 13 13 14 // fore and back are X colors 14 15 int DrawRotTextInit (Display *display, Window window, GC gc, unsigned long fore, unsigned long back) { 15 16 -
branches/czw_branch/20170908/Ohana/src/libkapa/src/KapaWindow.c
r39926 r40477 94 94 graphdata[0].xmax = graphdata[0].ymax = 1.0; 95 95 96 graphdata[0].style = graphdata[0].ptype = 2; 96 graphdata[0].style = KAPA_PLOT_POINTS; 97 graphdata[0].ptype = KAPA_POINT_BOX_SOLID; 97 98 graphdata[0].ltype = graphdata[0].color = 0; 98 99 graphdata[0].etype = graphdata[0].ebar = 0; … … 357 358 } 358 359 359 int KapaSendTextline (int fd, char *string, float x, float y, float angle) { 360 360 int KapaSendTextline (int fd, char *string, float x, float y, float angle, int justify, int color) { 361 362 // must be in range 0 - 8 363 justify = MIN(MAX(justify, 0), 8); 364 361 365 KiiSendCommand (fd, 4, "PTXT"); 362 KiiSendMessage (fd, "%f %f %f ", x, y, angle);366 KiiSendMessage (fd, "%f %f %f %d %d", x, y, angle, justify, color); 363 367 KiiSendData (fd, string, strlen(string)); 364 368 KiiWaitAnswer (fd, "DONE"); -
branches/czw_branch/20170908/Ohana/src/libkapa/src/PSRotFont.c
r39457 r40477 90 90 /* check for special characters */ 91 91 if (!code && !protect) { 92 /* su perscript character (^) */92 /* subscript character (_) */ 93 93 if (N == 94) { 94 94 PSDumpRotSegment (f, segment, &Nseg); 95 SetRotFont (currentname, (int)(0.8*currentsize));95 PSSetFont (f, currentname, (int)(0.8*currentsize)); 96 96 currentfont = GetRotFontData (¤tscale); 97 97 Yoff = 0.75*currentscale*dY; 98 98 fprintf (f, "0 %d rmoveto\n", Yoff); 99 99 YoffBase += Yoff; 100 PSSetFont (f, currentname, currentsize);101 continue; 102 } 103 /* su bscript character (_) */100 // PSSetFont (f, currentname, currentsize); 101 continue; 102 } 103 /* superscript character (^) */ 104 104 if (N == 95) { 105 105 PSDumpRotSegment (f, segment, &Nseg); 106 SetRotFont (currentname, (int)(0.8*currentsize));106 PSSetFont (f, currentname, (int)(0.8*currentsize)); 107 107 currentfont = GetRotFontData (¤tscale); 108 108 Yoff = -0.5*currentscale*dY; 109 109 fprintf (f, "0 %d rmoveto\n", Yoff); 110 110 YoffBase += Yoff; 111 PSSetFont (f, currentname, currentsize);111 // PSSetFont (f, currentname, currentsize); 112 112 continue; 113 113 } … … 115 115 if (N == 124) { 116 116 PSDumpRotSegment (f, segment, &Nseg); 117 SetRotFont (currentname, basesize);117 PSSetFont (f, currentname, basesize); 118 118 currentfont = GetRotFontData (¤tscale); 119 119 fprintf (f, "0 %d rmoveto\n", -YoffBase); 120 120 YoffBase = 0; 121 PSSetFont (f, currentname, currentsize);121 // PSSetFont (f, currentname, currentsize); 122 122 continue; 123 123 } … … 145 145 PSDumpRotSegment (f, segment, &Nseg); 146 146 if (string[i+1] == 'h') { 147 SetRotFont ("helvetica", currentsize);148 currentfont = GetRotFontData (¤tscale); 149 PSSetFont (f, currentname, currentsize);147 PSSetFont (f, "helvetica", currentsize); 148 currentfont = GetRotFontData (¤tscale); 149 // PSSetFont (f, currentname, currentsize); 150 150 } 151 151 if (string[i+1] == 't') { 152 SetRotFont ("times", currentsize);153 currentfont = GetRotFontData (¤tscale); 154 PSSetFont (f, currentname, currentsize);152 PSSetFont (f, "times", currentsize); 153 currentfont = GetRotFontData (¤tscale); 154 // PSSetFont (f, currentname, currentsize); 155 155 } 156 156 if (string[i+1] == 'c') { 157 SetRotFont ("courier", currentsize);158 currentfont = GetRotFontData (¤tscale); 159 PSSetFont (f, currentname, currentsize);157 PSSetFont (f, "courier", currentsize); 158 currentfont = GetRotFontData (¤tscale); 159 // PSSetFont (f, currentname, currentsize); 160 160 } 161 161 if (string[i+1] == 's') { 162 SetRotFont ("symbol", currentsize);163 currentfont = GetRotFontData (¤tscale); 164 PSSetFont (f, currentname, currentsize);162 PSSetFont (f, "symbol", currentsize); 163 currentfont = GetRotFontData (¤tscale); 164 // PSSetFont (f, currentname, currentsize); 165 165 } 166 166 i++; … … 176 176 fprintf (f, "stroke grestore\n"); 177 177 free (segment); 178 SetRotFont (basename, basesize);178 PSSetFont (f, basename, basesize); 179 179 } 180 180 -
branches/czw_branch/20170908/Ohana/src/libkapa/src/bDrawFuncs.c
r39926 r40477 76 76 // } 77 77 78 void bDrawSetStyle (bDrawBuffer *buffer, bDrawColor color, int lw, int lt) { 78 // "bDrawColor color" is one of the hardwired colors in KapaColors.c 79 void bDrawSetColor (bDrawBuffer *buffer, bDrawColor color) { 79 80 buffer->bColor = color; 80 81 buffer->bColor_R = buffer->palette[color].red; 81 82 buffer->bColor_G = buffer->palette[color].green; 82 83 buffer->bColor_B = buffer->palette[color].blue; 84 85 return; 86 } 87 88 void bDrawSetStyle (bDrawBuffer *buffer, bDrawColor color, int lw, int lt) { 89 bDrawSetColor (buffer, color); 83 90 84 91 buffer->bWeight = lw; … … 121 128 } 122 129 130 // x1,y1 is lower-left corner, x2,y2 is upper-right corner 123 131 void bDrawRectOpen (bDrawBuffer *buffer, double x1, double y1, double x2, double y2) { 124 132 -
branches/czw_branch/20170908/Ohana/src/libohana/include/ohana.h
r39457 r40477 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); -
branches/czw_branch/20170908/Ohana/src/libohana/include/ohana_sort.h
r38986 r40477 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); -
branches/czw_branch/20170908/Ohana/src/libohana/src/bisection.c
r38459 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/libohana/src/errors.c
r31635 r40477 1 1 # include "ohana.h" 2 2 3 static char errorline[1024]; 3 int Nline = 0; 4 int NLINE = 0; 5 char **errorlines = NULL; 4 6 5 7 int init_error () { 6 8 7 bzero (errorline, 1024); 9 if (!errorlines) { 10 NLINE = 10; 11 ALLOCATE (errorlines, char *, NLINE); 12 for (int i = 0; i < NLINE; i++) { 13 errorlines[i] = NULL; 14 } 15 } 16 17 for (int i = 0; i < NLINE; i++) { 18 FREE (errorlines[i]); 19 errorlines[i] = NULL; 20 } 21 22 Nline = 0; 23 8 24 return (TRUE); 9 25 } … … 11 27 int push_error (char *line) { 12 28 13 bzero (errorline, 1024); 14 strncpy (errorline, line, 1023); 29 errorlines[Nline] = strcreate (line); 30 Nline ++; 31 32 if (Nline >= NLINE) { 33 NLINE += 10; 34 REALLOCATE (errorlines, char *, NLINE); 35 for (int i = Nline; i < NLINE; i++) { 36 errorlines[i] = NULL; 37 } 38 } 39 15 40 return (TRUE); 16 41 } … … 18 43 int print_error () { 19 44 20 gprint (GP_ERR, "%s\n", errorline); 45 for (int i = 0; i < Nline; i++) { 46 gprint (GP_ERR, "%s\n", errorlines[i]); 47 } 48 49 init_error(); 50 21 51 return (TRUE); 22 52 } -
branches/czw_branch/20170908/Ohana/src/libohana/src/isolate_elements.c
r40205 r40477 171 171 // order matches convert_to_RPN.c 172 172 if (!strncmp (c, "?", 1)) return (TRUE); 173 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); -
branches/czw_branch/20170908/Ohana/src/libohana/src/sorts.c
r38986 r40477 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 -
branches/czw_branch/20170908/Ohana/src/markrock/src/find_slow_rocks.c
r2490 r40477 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; -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.astro/Makefile
r39591 r40477 82 82 $(SRC)/wcs.$(ARCH).o \ 83 83 $(SRC)/imsub.$(ARCH).o \ 84 $(SRC)/jdtolst.$(ARCH).o \ 84 85 $(SRC)/imfit.$(ARCH).o \ 85 86 $(SRC)/imfit-fgauss.$(ARCH).o \ -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.astro/cdot.c
r34088 r40477 22 22 23 23 /* set point style and errorbar mode (these are NOT sticky) */ 24 graphmode.style = 2;24 graphmode.style = KAPA_PLOT_POINTS; /* points */ 25 25 graphmode.etype = 0; 26 26 -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.astro/cgrid.c
r34584 r40477 95 95 } 96 96 97 int JustifyRA = 5; 98 double JustifyDEC = 5; 99 if ((N = get_argument (argc, argv, "-justify-ra"))) { 100 remove_argument (N, &argc, argv); 101 JustifyRA = atoi (argv[N]); 102 remove_argument (N, &argc, argv); 103 } 104 if ((N = get_argument (argc, argv, "-justify-dec"))) { 105 remove_argument (N, &argc, argv); 106 JustifyDEC = atoi (argv[N]); 107 remove_argument (N, &argc, argv); 108 } 109 110 double LabelRA = NAN; 111 double LabelDEC = NAN; 112 if ((N = get_argument (argc, argv, "-label-ra"))) { 113 remove_argument (N, &argc, argv); 114 LabelRA = atof (argv[N]); 115 remove_argument (N, &argc, argv); 116 } 117 if ((N = get_argument (argc, argv, "-label-dec"))) { 118 remove_argument (N, &argc, argv); 119 LabelDEC = atof (argv[N]); 120 remove_argument (N, &argc, argv); 121 } 122 123 int LabelColor = KapaColorByName ("black"); 124 if ((N = get_argument (argc, argv, "-label-color"))) { 125 remove_argument (N, &argc, argv); 126 LabelColor = KapaColorByName (argv[N]); 127 if (LabelColor == -1) return (FALSE); 128 remove_argument (N, &argc, argv); 129 } 130 97 131 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 98 132 … … 196 230 if (Labels) { 197 231 char line[16], format[8]; 198 double xt, yt, dx, dy, frac; 199 dx = +0.01 * (graphmode.xmax - graphmode.xmin); 200 dy = -0.02 * (graphmode.ymax - graphmode.ymin); 201 232 double xt, yt, frac; 233 // dx = +0.01 * (graphmode.xmax - graphmode.xmin); 234 // dy = -0.02 * (graphmode.ymax - graphmode.ymin); 235 236 if (isnan(LabelRA)) LabelRA = graphmode.coords.crval1; 237 if (isnan(LabelDEC)) LabelDEC = graphmode.coords.crval2; 202 238 for (r = firstRA; r <= graphmode.coords.crval1 + 180.0; r += minorRA) { 203 status = RD_to_XY (&xt, &yt, r, graphmode.coords.crval2, &graphmode.coords);239 status = RD_to_XY (&xt, &yt, r, LabelDEC, &graphmode.coords); 204 240 if (!status) continue; 205 241 if (xt < graphmode.xmin) continue; … … 212 248 } 213 249 if (frac <= 0.0) frac = 0.0; 214 snprintf (format, 8, "%%.%df", (int) frac);215 250 if (RAbyHour) { 251 snprintf (format, 8, "%%.%df^h", (int) frac); 216 252 snprintf (line, 16, format, r / 15.0); 217 253 } else { 254 snprintf (format, 8, "%%.%df^o", (int) frac); 218 255 snprintf (line, 16, format, r); 219 256 } 220 KapaSendTextline (kapa, line, xt + dx, yt + dy, 0.0);257 KapaSendTextline (kapa, line, xt, yt, 0.0, JustifyRA, LabelColor); 221 258 } 222 259 for (r = firstRA; r >= graphmode.coords.crval1 - 180.0; r -= minorRA) { 223 status = RD_to_XY (&xt, &yt, r, graphmode.coords.crval2, &graphmode.coords);260 status = RD_to_XY (&xt, &yt, r, LabelDEC, &graphmode.coords); 224 261 if (!status) continue; 225 262 if (xt < graphmode.xmin) continue; … … 232 269 } 233 270 if (frac <= 0.0) frac = 0.0; 234 snprintf (format, 8, "%%.%df", (int) frac);235 271 if (RAbyHour) { 272 snprintf (format, 8, "%%.%df^h", (int) frac); 236 273 snprintf (line, 16, format, r / 15.0); 237 274 } else { 275 snprintf (format, 8, "%%.%df^o", (int) frac); 238 276 snprintf (line, 16, format, r); 239 277 } 240 KapaSendTextline (kapa, line, xt + dx, yt + dy, 0.0);278 KapaSendTextline (kapa, line, xt, yt, 0.0, JustifyRA, LabelColor); 241 279 } 242 280 for (d = firstDEC; d <= graphmode.coords.crval2 + 90.0; d += minorDEC) { 243 status = RD_to_XY (&xt, &yt, graphmode.coords.crval1, d, &graphmode.coords);281 status = RD_to_XY (&xt, &yt, LabelRA, d, &graphmode.coords); 244 282 if (!status) continue; 245 283 if (xt < graphmode.xmin) continue; … … 252 290 } 253 291 if (frac <= 0.0) frac = 0.0; 254 snprintf (format, 8, "%%.%df ", (int) frac);292 snprintf (format, 8, "%%.%df^o", (int) frac); 255 293 snprintf (line, 16, format, d); 256 KapaSendTextline (kapa, line, xt + dx, yt + dy, 0.0);294 KapaSendTextline (kapa, line, xt, yt, 0.0, JustifyDEC, LabelColor); 257 295 } 258 296 for (d = firstDEC; d >= graphmode.coords.crval2 - 90.0; d -= minorDEC) { 259 status = RD_to_XY (&xt, &yt, graphmode.coords.crval1, d, &graphmode.coords);297 status = RD_to_XY (&xt, &yt, LabelRA, d, &graphmode.coords); 260 298 if (!status) continue; 261 299 if (xt < graphmode.xmin) continue; … … 268 306 } 269 307 if (frac <= 0.0) frac = 0.0; 270 snprintf (format, 8, "%%.%df ", (int) frac);308 snprintf (format, 8, "%%.%df^o", (int) frac); 271 309 snprintf (line, 16, format, d); 272 KapaSendTextline (kapa, line, xt + dx, yt + dy, 0.0);310 KapaSendTextline (kapa, line, xt, yt, 0.0, JustifyDEC, LabelColor); 273 311 } 274 312 } … … 276 314 /* send the line segments as connect-points */ 277 315 Xvec.Nelements = Yvec.Nelements = N; 278 graphmode.style = 2; /* points */279 graphmode.ptype = 100; /* connect a pair*/316 graphmode.style = KAPA_PLOT_POINTS; /* points */ 317 graphmode.ptype = KAPA_POINT_PAIR_CONNECT; /* connect pairs of points */ 280 318 graphmode.etype = 0; 281 319 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.astro/cline.c
r34088 r40477 20 20 21 21 /* set point style and errorbar mode (these are NOT sticky) */ 22 graphmode.style = 0;22 graphmode.style = KAPA_PLOT_CONNECT; 23 23 graphmode.etype = 0; 24 24 -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.astro/czplot.c
r35757 r40477 111 111 Zvec.Nelements = Npts; 112 112 113 graphmode.style = 2;113 graphmode.style = KAPA_PLOT_POINTS; /* points */ 114 114 graphmode.size = -1; /* point size determined by Zvec */ 115 115 graphmode.etype = 0; … … 236 236 Zvec.Nelements = Npts; 237 237 238 graphmode.style = 2;238 graphmode.style = KAPA_PLOT_POINTS; 239 239 graphmode.color = -1; /* point color determined by Zvec */ 240 240 graphmode.etype = 0; -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.astro/fitplx.c
r39610 r40477 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; -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.astro/fitplx_irls.c
r39926 r40477 12 12 if ((mvec = SelectVector (argv[N], ANYVECTOR, TRUE)) == NULL) return (FALSE); 13 13 remove_argument (N, &argc, argv); 14 CastVector (mvec, OPIHI_INT);15 14 } 16 15 … … 81 80 double *dD = dDvec->elements.Flt; 82 81 83 int *mask = NULL;84 if (mvec) {85 mask = mvec->elements.Int;86 }87 88 82 // Ntotal : all points supplied by user 89 83 // Nsubset : unmasked points 90 84 int Ntotal = tvec->Nelements; // XXX check other lengths 91 85 86 if (rvec->Nelements != Ntotal) ESCAPE ("mis-match in vector lengths (mjd vs ra) = (%d vs %d)\n", rvec->Nelements, Ntotal); 87 if (dvec->Nelements != Ntotal) ESCAPE ("mis-match in vector lengths (mjd vs dec) = (%d vs %d)\n", dvec->Nelements, Ntotal); 88 if (dRvec->Nelements != Ntotal) ESCAPE ("mis-match in vector lengths (mjd vs dR) = (%d vs %d)\n", dRvec->Nelements, Ntotal); 89 if (dDvec->Nelements != Ntotal) ESCAPE ("mis-match in vector lengths (mjd vs dD) = (%d vs %d)\n", dDvec->Nelements, Ntotal); 90 91 opihi_int *mask = NULL; 92 if (mvec) { 93 ResetVector (mvec, OPIHI_INT, Ntotal); 94 mask = mvec->elements.Int; 95 for (i = 0; i < Ntotal; i++) { mask[i] = 1; } 96 } 97 98 92 99 double Rmean, Dmean, Tmean; 93 100 PlxSetMeanEpoch (R, D, T, &Rmean, &Dmean, &Tmean, mask, Ntotal); … … 109 116 for (i = 0; (VERBOSE == 2) && (i < fitdata.Npts); i++) { 110 117 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]);118 opihi_int maskValue = mask ? mask[n] : 1; 119 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 120 } 114 121 … … 135 142 136 143 // update the mask based on the input mask and the outlier limits. 137 double Sum_Wx = 0; 138 double Sum_Wy = 0; 139 mask = mvec->elements.Int; 140 for (i = 0; i < fitdata.Npts; i++) { 141 Sum_Wx += fitdata.Wx[i]; 142 Sum_Wy += fitdata.Wy[i]; 143 } 144 for (i = 0; i < fitdata.Npts; i++) { 145 // fitdata only includes the previously unmasked points 146 if ((fitdata.Wx[i] < outlier_limit * Sum_Wx / (1.0 * fitdata.Npts))|| 147 (fitdata.Wy[i] < outlier_limit * Sum_Wy / (1.0 * fitdata.Npts))) { 148 int n = fitdata.index[i]; 149 mask[n] = 0; 144 if (mask) { 145 double Sum_Wx = 0; 146 double Sum_Wy = 0; 147 148 // calculate the total weight 149 for (i = 0; i < fitdata.Npts; i++) { 150 Sum_Wx += fitdata.Wx[i]; 151 Sum_Wy += fitdata.Wy[i]; 152 } 153 for (i = 0; i < fitdata.Npts; i++) { 154 // fitdata only includes the previously unmasked points 155 if ((fitdata.Wx[i] < outlier_limit * Sum_Wx / (1.0 * fitdata.Npts))|| 156 (fitdata.Wy[i] < outlier_limit * Sum_Wy / (1.0 * fitdata.Npts))) { 157 int n = fitdata.index[i]; 158 mask[n] = 0; 150 159 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); 153 } 154 } 155 } 156 157 if (Nresample){ 158 // now that the mask has been updated, we need to recalculate mean epoch and positions 159 // XXX make this conditional on actually masking unmasked points above 160 // PlxSetMeanEpoch (R, D, T, &Rmean, &Dmean, &Tmean, mask, Ntotal); 161 // PlxSetEpochPosition (&fitdata, R, D, dR, dD, T, mask, Ntotal, &coords, Tmean); 160 if (VERBOSE == 2) { 161 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); 162 } 163 } 164 } 165 } 166 167 if (Nresample) { 168 // if the mask has been updated, we need to recalculate mean epoch and positions 169 if (mask) { 170 PlxSetMeanEpoch (R, D, T, &Rmean, &Dmean, &Tmean, mask, Ntotal); 171 PlxSetEpochPosition (&fitdata, R, D, dR, dD, T, mask, Ntotal, &coords, Tmean); 172 } 162 173 163 174 PlxFitData sample; … … 218 229 // fprintf (stderr, "%f +/- %f | %f %f\n", fit.p, fit.dp, fit.uR, fit.uD); 219 230 220 Vector *dRresP MP, *dDresPMP, *dRresPLX, *dDresPLX;231 Vector *dRresPOS, *dDresPOS, *dRresPMP, *dDresPMP, *dRresPLX, *dDresPLX; 221 232 222 233 // save fit residuals (with only pm removed, and pm and plx removed) 234 if ((dRresPOS = SelectVector ("dRresPOS", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dRresPOS"); 235 if ((dDresPOS = SelectVector ("dDresPOS", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dDresPOS"); 223 236 if ((dRresPMP = SelectVector ("dRresPMP", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dRresPMP"); 224 237 if ((dDresPMP = SelectVector ("dDresPMP", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dDresPMP"); … … 226 239 if ((dDresPLX = SelectVector ("dDresPLX", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dDresPLX"); 227 240 241 ResetVector (dRresPOS, OPIHI_FLT, Ntotal); 242 ResetVector (dDresPOS, OPIHI_FLT, Ntotal); 228 243 ResetVector (dRresPMP, OPIHI_FLT, Ntotal); 229 244 ResetVector (dDresPMP, OPIHI_FLT, Ntotal); … … 246 261 double Yplx = fit.Do + fit.uD*t0; 247 262 263 dRresPOS->elements.Flt[i] = x0; 264 dDresPOS->elements.Flt[i] = y0; 248 265 dRresPMP->elements.Flt[i] = x0 - Xpmp; 249 266 dDresPMP->elements.Flt[i] = y0 - Ypmp; … … 538 555 539 556 double wx,wy; 557 double lim_Wx = outlier_limit * Sum_Wx / (1.0 * Npts); 558 double lim_Wy = outlier_limit * Sum_Wy / (1.0 * Npts); 540 559 for (i = 0; i < Npts; i++) { 541 if ((Wx[i] > outlier_limit * Sum_Wx / (1.0 * Npts))|| 542 (Wy[i] > outlier_limit * Sum_Wy / (1.0 * Npts))) { 543 560 int skip = (Wx[i] < lim_Wx) || (Wy[i] < lim_Wy); 561 if (!skip) { 544 562 Xf = fit[0].Ro + fit[0].uR*T[i] + fit[0].p*pR[i]; 545 563 Yf = fit[0].Do + fit[0].uD*T[i] + fit[0].p*pD[i]; -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.astro/fitpm.c
r39228 r40477 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; -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.astro/fitpm_irls.c
r39596 r40477 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; -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.astro/init.c
r39591 r40477 33 33 int imfit PROTO((int, char **)); 34 34 int imsub PROTO((int, char **)); 35 int jdtolst PROTO((int, char **)); 35 36 int medianmap PROTO((int, char **)); 36 37 int galsectors PROTO((int, char **)); … … 103 104 {1, "imfit", imfit, "fit function"}, 104 105 {1, "imsub", imsub, "subtract function"}, 106 {1, "jdtolst", jdtolst, "JD to LST conversion"}, 105 107 {1, "medianmap", medianmap, "small median image"}, 106 108 {1, "mkgauss", mkgauss, "generate a 2-D gaussian centered in image"}, -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.astro/star.c
r36679 r40477 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); -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/Makefile
r40007 r40477 66 66 $(SRC)/hermitian1d.$(ARCH).o \ 67 67 $(SRC)/hermitian2d.$(ARCH).o \ 68 $(SRC)/idxread.$(ARCH).o \ 68 69 $(SRC)/imcut.$(ARCH).o \ 69 70 $(SRC)/imhist.$(ARCH).o \ … … 99 100 $(SRC)/medimage_commands.$(ARCH).o \ 100 101 $(SRC)/mset.$(ARCH).o \ 101 $(SRC)/needles.$(ARCH).o \ 102 $(SRC)/needles.$(ARCH).o \ 103 $(SRC)/nnet.$(ARCH).o \ 104 $(SRC)/nnet_commands.$(ARCH).o \ 105 $(SRC)/nnet_train.$(ARCH).o \ 106 $(SRC)/nnet_apply.$(ARCH).o \ 102 107 $(SRC)/peak.$(ARCH).o \ 103 108 $(SRC)/periodogram.$(ARCH).o \ 109 $(SRC)/periodogram-fm.$(ARCH).o \ 104 110 $(SRC)/plot.$(ARCH).o \ 105 111 $(SRC)/dot.$(ARCH).o \ … … 154 160 $(SRC)/type.$(ARCH).o \ 155 161 $(SRC)/uniq.$(ARCH).o \ 162 $(SRC)/uniqpair.$(ARCH).o \ 156 163 $(SRC)/unsign.$(ARCH).o \ 157 164 $(SRC)/vbin.$(ARCH).o \ … … 159 166 $(SRC)/vclip.$(ARCH).o \ 160 167 $(SRC)/vgauss.$(ARCH).o \ 168 $(SRC)/vlorentz.$(ARCH).o \ 161 169 $(SRC)/vellipse.$(ARCH).o \ 162 170 $(SRC)/vmaxwell.$(ARCH).o \ … … 171 179 $(SRC)/vstats.$(ARCH).o \ 172 180 $(SRC)/xsection.$(ARCH).o \ 173 $(SRC)/vsh.$(ARCH).o \181 $(SRC)/vsh.$(ARCH).o \ 174 182 $(SRC)/vshfit.$(ARCH).o \ 175 183 $(SRC)/shterms.$(ARCH).o \ … … 187 195 $(INC)/external.h \ 188 196 $(INC)/shell.h \ 197 $(INC)/data.h \ 189 198 $(INC)/dvomath.h \ 190 199 $(INC)/display.h -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/dot.c
r33963 r40477 29 29 30 30 /* set point style and errorbar mode (these are NOT sticky) */ 31 graphmode.style = 2;31 graphmode.style = KAPA_PLOT_POINTS; 32 32 graphmode.etype = 0; 33 33 -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/grid.c
r34584 r40477 175 175 176 176 Xvec.Nelements = Yvec.Nelements = N; 177 graphmode.style = 2; /* points */178 graphmode.ptype = 100; /* connect a pair*/177 graphmode.style = KAPA_PLOT_POINTS; /* points */ 178 graphmode.ptype = KAPA_POINT_PAIR_CONNECT; /* connect pairs of points */ 179 179 graphmode.etype = 0; 180 180 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/impeaks.c
r36679 r40477 100 100 int Npeaks = 0; 101 101 for (ix = 1; ix < Nx - 1; ix++) { 102 if (!isfinite(row[ix])) continue; // ignore NAN values 102 103 if (row[ix] < threshold) continue; // only accept pixels above threshold 103 104 if (row[ix] < row[ix - 1]) continue; // peak pixel must be at least preceeding pixel -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/init.c
r40007 r40477 55 55 int hermitian1d PROTO((int, char **)); 56 56 int hermitian2d PROTO((int, char **)); 57 int idxread PROTO((int, char **)); 57 58 int imcut PROTO((int, char **)); 58 59 int imhist PROTO((int, char **)); … … 89 90 int mset PROTO((int, char **)); 90 91 int needles PROTO((int, char **)); 92 int nnet_command PROTO((int, char **)); 91 93 int peak PROTO((int, char **)); 92 94 int periodogram PROTO((int, char **)); 95 int periodogram_fm PROTO((int, char **)); 93 96 int plot PROTO((int, char **)); 94 97 int dot PROTO((int, char **)); … … 140 143 int tvcontour PROTO((int, char **)); 141 144 int tvgrid PROTO((int, char **)); 142 int opihi_type PROTO((int, char **));145 int opihi_type PROTO((int, char **)); 143 146 int uniq PROTO((int, char **)); 147 int uniqpair PROTO((int, char **)); 144 148 int unsign PROTO((int, char **)); 145 149 int vbin PROTO((int, char **)); … … 149 153 int vgrid PROTO((int, char **)); 150 154 int vgauss PROTO((int, char **)); 155 int vlorentz PROTO((int, char **)); 151 156 int vellipse PROTO((int, char **)); 152 157 int vmaxwell PROTO((int, char **)); … … 232 237 {1, "hermitian1d", hermitian1d, "generate 1-D Hermitian Polynomial"}, 233 238 {1, "hermitian2d", hermitian2d, "generate 2-D Hermitian Polynomial"}, 239 {1, "idxread", idxread, "read vector or image data from an IDX file"}, 234 240 {1, "imbin", rebin, "rebin image data by factor of N"}, 235 241 {1, "imclip", imclip, "clip values in an image to be within a range"}, … … 268 274 {1, "imset", mset, "insert a vector in an image"}, 269 275 {1, "needles", needles, "plot vectors needles"}, 276 {1, "nnet", nnet_command, "Neural Network commands"}, 270 277 {1, "parity", parity, "set image parity"}, 271 278 {1, "peak", peak, "find vector peak in range"}, 272 {1, "periodogram", periodogram, "measure periods in unevenly sampled data"}, 279 {1, "periodogram", periodogram, "measure periods in unevenly sampled data (Lomb-Scargle)"}, 280 {1, "periodogram_fm", periodogram_fm, "measure periods in unevenly sampled data (generalized Lomb-Scargle; floating mean)"}, 273 281 {1, "plot", plot, "plot a pair of vectors"}, 274 282 {1, "png", jpeg, "convert display graphic to PNG"}, … … 323 331 {1, "ungridify", ungridify, "convert image region to vector triplet"}, 324 332 {1, "uniq", uniq, "create a uniq vector subset from a vector"}, 333 {1, "uniqpair", uniqpair, "create a uniq vector subset from a pair of vectors, saving duplicates if desired"}, 325 334 {1, "unsign", unsign, "toggle the UNSIGN status"}, 326 335 {1, "vbin", vbin, "rebin vector data by a factor of N"}, … … 330 339 {1, "vtype", vtype, "return the vector type (FLT or INT)"}, 331 340 {1, "vgauss", vgauss, "fit a Gaussian to a vector"}, 341 {1, "vlorentz", vlorentz, "fit a Lorentzian to a vector"}, 332 342 {1, "vellipse", vellipse, "fit a Ellipse to a vector pair"}, 333 343 {1, "vgrid", vgrid, "generate an image from a triplet of vectors"}, -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/limits.c
r31160 r40477 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); -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/line.c
r33662 r40477 33 33 34 34 /* set point style and errorbar mode (these are NOT sticky) */ 35 graphmode.style = 0;35 graphmode.style = KAPA_PLOT_CONNECT; 36 36 graphmode.etype = 0; 37 37 -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/mslice.c
r39233 r40477 3 3 int mslice (int argc, char **argv) { 4 4 5 int i;5 int N; 6 6 Buffer *in, *out; 7 7 8 int Dir = 0; 9 if ((N = get_argument (argc, argv, "-x"))) { 10 remove_argument (N, &argc, argv); 11 Dir = 1; 12 } 13 if ((N = get_argument (argc, argv, "-y"))) { 14 remove_argument (N, &argc, argv); 15 if (Dir) { 16 gprint (GP_ERR, "ERROR: multiple -x,-y,-z options are not allowed\n"); 17 return FALSE; 18 } 19 Dir = 2; 20 } 21 if ((N = get_argument (argc, argv, "-z"))) { 22 remove_argument (N, &argc, argv); 23 if (Dir) { 24 gprint (GP_ERR, "ERROR: multiple -x,-y,-z options are not allowed\n"); 25 return FALSE; 26 } 27 Dir = 3; 28 } 29 if (!Dir) Dir = 3; 30 8 31 if (argc != 4) { 9 gprint (GP_ERR, "USAGE: mget <input> <output> plane\n"); 32 gprint (GP_ERR, "USAGE: mslice <input> <output> plane [-x,-y,-z]\n"); 33 gprint (GP_ERR, " -z is default\n"); 10 34 return (FALSE); 11 35 } … … 24 48 int Nz = in[0].matrix.Naxis[2]; 25 49 50 int NplaneMax = 0; 51 int Nout1 = 0; 52 int Nout2 = 0; 53 switch (Dir) { 54 case 1: NplaneMax = Nx; Nout1 = Ny; Nout2 = Nz; break; 55 case 2: NplaneMax = Ny; Nout1 = Nx; Nout2 = Nz; break; 56 case 3: NplaneMax = Nz; Nout1 = Nx; Nout2 = Ny; break; 57 default: myAbort ("impossible"); 58 } 59 26 60 int invalid = FALSE; 27 61 invalid = invalid || (plane < 0); 28 invalid = invalid || (plane >= N z);62 invalid = invalid || (plane >= NplaneMax); 29 63 if (invalid) { 30 gprint (GP_ERR, "plane %d out of range \n", plane);64 gprint (GP_ERR, "plane %d out of range (max = %d)\n", plane, NplaneMax); 31 65 return (FALSE); 32 66 } 33 67 34 68 /* I should encapsulate this in a create_default_buffer */ 69 35 70 gfits_free_matrix (&out[0].matrix); 36 71 gfits_free_header (&out[0].header); 37 if (!CreateBuffer (out, N x, Ny, -32, 1.0, 0.0)) return FALSE;72 if (!CreateBuffer (out, Nout1, Nout2, -32, 1.0, 0.0)) return FALSE; 38 73 39 float *inF = (float *) in[0].matrix.buffer + plane*Nx*Ny; 40 float *outF = (float *) out[0].matrix.buffer; 74 // pixel (ix, iy, iz) : in[0].matrix.buffer + ix + iy*Nx + iz*Nx*Ny 41 75 42 for (i = 0; i < Nx*Ny; i++, inF ++, outF++) { 43 *outF = *inF; 76 switch (Dir) { 77 case 1: { 78 float *outF = (float *) out[0].matrix.buffer; 79 80 // pixel (ix, iy, iz) : in[0].matrix.buffer + ix + iy*Nx + iz*Nx*Ny 81 82 for (int iz = 0; iz < Nz; iz++) { 83 float *inF = (float *) in[0].matrix.buffer + plane + iz*Nx*Ny; 84 for (int iy = 0; iy < Ny; iy++, inF += Nx, outF++) { 85 *outF = *inF; 86 } 87 } 88 break; 89 } 90 case 2: { 91 92 float *outF = (float *) out[0].matrix.buffer; 93 94 for (int iz = 0; iz < Nz; iz++) { 95 float *inF = (float *) in[0].matrix.buffer + plane*Nx + iz*Nx*Ny; 96 for (int ix = 0; ix < Nx; ix++, inF++, outF++) { 97 *outF = *inF; 98 } 99 } 100 break; 101 } 102 case 3: { 103 float *inF = (float *) in[0].matrix.buffer + plane*Nx*Ny; 104 float *outF = (float *) out[0].matrix.buffer; 105 106 for (int i = 0; i < Nx*Ny; i++, inF ++, outF++) { 107 *outF = *inF; 108 } 109 break; 110 } 111 default: myAbort ("impossible"); 44 112 } 45 113 return (TRUE); -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/print_vectors.c
r37049 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/read_vectors.c
r40012 r40477 19 19 } 20 20 21 if (strlen(argv[1]) >= 2048) { 22 gprint (GP_ERR, "filename %s is too long\n", argv[1]); 23 return (FALSE); 24 } 25 21 26 strcpy (filename, argv[1]); 22 27 if (f != (FILE *) NULL) { fclose (f); } 23 28 f = fopen (filename, "r"); 24 29 if (f == (FILE *) NULL) { 25 gprint (GP_ERR, "failed to open file %s\n", argv[1]);30 gprint (GP_ERR, "failed to open file %s\n", filename); 26 31 return (FALSE); 27 32 } -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/reindex.c
r39227 r40477 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++; -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/sort.c
r20936 r40477 7 7 itmp = IDX[A]; IDX[A] = IDX[B]; IDX[B] = itmp; \ 8 8 } 9 # define COMPARE(A,B)(X[A] < X[B]) 9 10 // # define COMPARE(A,B)(X[A] < X[B]) 11 # define COMPARE(A,B)((!isfinite(X[A]) && isfinite(X[B])) || (X[A] < X[B])) 10 12 11 13 OHANA_SORT (N, COMPARE, SWAPFUNC); … … 22 24 itmp = IDX[A]; IDX[A] = IDX[B]; IDX[B] = itmp; \ 23 25 } 26 24 27 # define COMPARE(A,B)(X[A] < X[B]) 28 // # define COMPARE(A,B)((!isfinite(X[A]) && isfinite(X[B])) || (X[A] < X[B])) 25 29 26 30 OHANA_SORT (N, COMPARE, SWAPFUNC); -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/test/periodogram.sh
r27435 r40477 1 2 if (not($?PLOT)) set PLOT = 0 1 3 2 4 list tests … … 28 30 echo "OFFSET: {$peakpos - $P}" 29 31 end 32 33 if ($PLOT) 34 lim period power; clear; box; line -c red70 -lw 3 $P 0 to $P $peakval; plot period power -x line 35 end 30 36 end 31 37 … … 107 113 if (abs ($peakpos - $P) > 0.05) 108 114 $PASS = 0 115 end 116 end 117 118 # test using random samples, offset start, non-zero DC 119 macro test5 120 $PASS = 1 121 break -auto off 122 123 local P PI 124 $PI = 3.14159265359 125 $P = 15.0 126 127 delete -q x t f period power 128 129 create x 500 800 130 set t = 300 * rnd(x) + 500 131 set f = sin(2*$PI*t/$P) + 0.5 132 133 periodogram t f 2 30 period power 134 135 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f 136 # lim -n 1 period power; clear; box; plot period power 137 138 peak -q period power 139 140 if (abs ($peakpos - $P) > 0.05) 141 $PASS = 0 142 end 143 end 144 145 # test using random samples, offset start, non-zero DC, some noise 146 macro test6 147 $PASS = 1 148 break -auto off 149 150 local P PI 151 $PI = 3.14159265359 152 $P = 15.0 153 154 delete -q x t f period power 155 156 create x 500 800 157 set t = 300 * rnd(x) + 500 158 set fraw = sin(2*$PI*t/$P) + 0.5 159 160 # 0.05 : peakpos = 14.95 161 # 0.10 : peakpos = 15.04 ( 162 gaussdev df t[] 0.0 0.25 163 set f = fraw + df 164 165 periodogram t f 2 30 period power 166 167 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f 168 # lim -n 1 period power; clear; box; plot period power 169 170 peak -q period power 171 172 if (abs ($peakpos - $P) > 0.05) 173 $PASS = 0 174 end 175 end 176 177 # test using fewer random samples, offset start, non-zero DC, some noise 178 macro test7 179 $PASS = 1 180 break -auto off 181 182 local P PI 183 $PI = 3.14159265359 184 $P = 15.0 185 186 delete -q x t f period power 187 188 create x 0 100 189 set t = 100 * rnd(x) 190 set fraw = sin(2*$PI*t/$P) + 0.5 191 192 # 0.05 : peakpos = 14.95 193 # 0.10 : peakpos = 15.04 ( 194 gaussdev df t[] 0.0 0.25 195 set f = fraw + df 196 197 periodogram t f 2 30 period power 198 199 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f 200 # lim -n 1 period power; clear; box; plot period power 201 202 peak -q period power 203 204 if (abs ($peakpos - $P) > 0.05) 205 $PASS = 0 206 end 207 end 208 209 # test using fewer random samples, high frequency, non-zero DC, some noise 210 macro test8 211 if ($0 != 4) 212 echo "USAGE: test8: Period Ndays df" 213 break 214 end 215 216 local Ndays 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 226 $trueP = $P 227 228 delete -q x t f period power 229 230 create x 0 $Ndays 231 232 # t is a time in days, but we always have 4 within 1 hour: 233 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 236 237 set dt1 = (15.0 / 1440) * rnd(x) + ( 0 + 7.5) / 1440 238 set dt2 = (15.0 / 1440) * rnd(x) + (15 + 7.5) / 1440 239 set dt3 = (15.0 / 1440) * rnd(x) + (30 + 7.5) / 1440 240 241 delete -q t 242 concat t0 t 243 set tmp = t0 + dt1; concat tmp t 244 set tmp = t0 + dt2; concat tmp t 245 set tmp = t0 + dt3; concat tmp t 246 247 set fraw = 0.75*sin(2*$PI*t/$P) 248 249 # 0.05 : peakpos = 14.95 250 # 0.10 : peakpos = 15.04 ( 251 gaussdev df t[] 0.0 $dM 252 set f = fraw + df 253 254 periodogram t f 0.1 2.0 period power 255 256 # lim -n 0 t f; clear; box; plot -x 2 -pt 2 t f 257 # lim -n 1 period power; clear; box; plot period power 258 259 peak -q period power 260 261 if (abs ($peakpos - $P) > 0.05) 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 109 266 end 110 267 end -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/textline.c
r13479 r40477 6 6 char name[64]; 7 7 double x, y, angle; 8 int kapa;9 8 Graphdata graphmode; 10 9 11 if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE); 10 // if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE); 11 12 // Using only these style_args options 13 char *kapaName = NULL; 14 int kapa = -1; 15 if ((N = get_argument (argc, argv, "-n"))) { 16 remove_argument (N, &argc, argv); 17 kapaName = strcreate (argv[N]); 18 remove_argument (N, &argc, argv); 19 } 20 if (!GetGraph (&graphmode, &kapa, kapaName)) return (FALSE); 21 FREE (kapaName); 22 23 int color = KapaColorByName ("black"); 24 if ((N = get_argument (argc, argv, "-c"))) { 25 remove_argument (N, &argc, argv); 26 color = KapaColorByName (argv[N]); 27 if (color == -1) return (FALSE); 28 remove_argument (N, &argc, argv); 29 } 12 30 13 31 if ((N = get_argument (argc, argv, "-fn"))) { … … 34 52 } 35 53 54 int justify = 5; // default 55 if ((N = get_argument (argc, argv, "-justify"))) { 56 remove_argument (N, &argc, argv); 57 justify = atoi (argv[N]); 58 remove_argument (N, &argc, argv); 59 } 60 36 61 if (argc != 4) { 37 gprint (GP_ERR, "USAGE: text x y (line) [-fn (font) size] [-rot angle] \n");62 gprint (GP_ERR, "USAGE: text x y (line) [-fn (font) size] [-rot angle] [-justify N]\n"); 38 63 return (FALSE); 39 64 } … … 52 77 } 53 78 54 KapaSendTextline (kapa, argv[3], x, y, angle );79 KapaSendTextline (kapa, argv[3], x, y, angle, justify, color); 55 80 return (TRUE); 56 81 } -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/uniq.c
r39457 r40477 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; -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/write_vectors.c
r39360 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/opihi/cmd.data/zplot.c
r38062 r40477 117 117 118 118 /* point size determined by Zvec */ 119 graphmode.style = 2; /* plotpoints */119 graphmode.style = KAPA_PLOT_POINTS; /* points */ 120 120 graphmode.size = -1; /* point size determined by Zvec */ 121 121 PlotVectorTriplet (kapa, xvec, yvec, &Zvec, mask, &graphmode); … … 226 226 227 227 /* point size determined by Zvec */ 228 graphmode.style = 2; /* plot points */228 graphmode.style = KAPA_PLOT_POINTS; /* plot points */ 229 229 graphmode.color = -1; /* point color determined by Zvec */ 230 230 graphmode.etype = 0; /* no errorbars */ -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/Makefile
r39602 r40477 27 27 $(SRC)/mySequence.$(ARCH).o \ 28 28 $(SRC)/photcode_ops.$(ARCH).o \ 29 $(SRC)/PeriodogramOps.$(ARCH).o \ 29 30 $(SRC)/find_matches.$(ARCH).o 30 31 … … 45 46 $(SRC)/avextract.$(ARCH).o \ 46 47 $(SRC)/avmatch.$(ARCH).o \ 48 $(SRC)/avperiodogram.$(ARCH).o \ 49 $(SRC)/avperiodomatch.$(ARCH).o \ 47 50 $(SRC)/badimages.$(ARCH).o \ 48 51 $(SRC)/catdir.$(ARCH).o \ -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/catalog.c
r38471 r40477 390 390 REALLOCATE (Zvec.elements, float, MAX (Zvec.Nelements, 1)); 391 391 392 graphmode.style = 2; /* set style topoints */392 graphmode.style = KAPA_PLOT_POINTS; /* points */ 393 393 graphmode.size = -1; /* point size determined by Zvec */ 394 394 graphmode.etype = 0; /* no errorbars */ -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/dmt.c
r39457 r40477 150 150 vec5[0].Nelements = Dvec.Nelements; 151 151 } else { 152 graphmode.style = 2; /* set style topoints */152 graphmode.style = KAPA_PLOT_POINTS; /* points */ 153 153 PlotVector (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 154 154 -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/dvo_host_utils.c
r39524 r40477 212 212 continue; 213 213 } 214 free (table->hosts[i].results);215 table->hosts[i].results = NULL;214 // free (table->hosts[i].results); 215 // table->hosts[i].results = NULL; 216 216 set_int_variable (name, 1); // result file has been read 217 217 … … 225 225 FreeVectorArray (invec, Ninvec); 226 226 } 227 } else { 228 // free (table->hosts[i].results); 229 // table->hosts[i].results = NULL; 227 230 } 228 231 } … … 242 245 free (vec); 243 246 244 free (table);247 FreeHostTable (table); 245 248 return TRUE; 246 249 } … … 284 287 // XXX a bit of a waste (but only 1024 * 60 bytes or so 285 288 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);289 snprintf (table->hosts[i].results, DVO_MAX_PATH, "%s/dvo.results.%s.%04d.fits", table->hosts[i].pathname, uniquer, table->hosts[i].hostID); 287 290 288 291 int Ninvec = 0; -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/fitcolors.c
r39457 r40477 48 48 if (!SetPhotSelections (&argc, argv, 4)) goto usage; 49 49 50 int textcolor = KapaColorByName ("black"); 51 50 52 // range for valid data points (exclude extreme outliers) 51 53 minDelta = -0.2; … … 92 94 graphdata.ymin = minDelta; 93 95 graphdata.ymax = maxDelta; 94 graph data.style = 2;95 graph data.ptype = 2;96 graphmode.style = KAPA_PLOT_POINTS; /* points */ 97 graphmode.ptype = KAPA_POINT_CIRCLE_SOLID; /* connect pairs of points */ 96 98 KapaClearSections (kapa); 97 99 KapaSetFont (kapa, "helvetica", 14); … … 192 194 graphdata.ymin = minDelta; 193 195 graphdata.ymax = maxDelta; 194 graph data.style = 2;195 graph data.ptype = 2;196 graphmode.style = KAPA_PLOT_POINTS; /* points */ 197 graphmode.ptype = KAPA_POINT_CIRCLE_SOLID; /* connect pairs of points */ 196 198 } 197 199 … … 315 317 deltaFit[i] = C0 + C1*colorFit[i]; 316 318 } 317 graph data.style = 0;319 graphmode.style = KAPA_PLOT_CONNECT; /* lines */ 318 320 graphdata.color = KapaColorByName ("red"); 319 321 … … 324 326 KapaSetFont (kapa, "helvetica", 8); 325 327 sprintf (label, "%s", code[0][0].name); 326 KapaSendTextline (kapa, label, 0.2*maxColor + 0.8*minColor, 0.8*maxDelta + 0.2*minDelta, 0.0 );328 KapaSendTextline (kapa, label, 0.2*maxColor + 0.8*minColor, 0.8*maxDelta + 0.2*minDelta, 0.0, textcolor); 327 329 sprintf (label, "%s", code[1][0].name); 328 KapaSendTextline (kapa, label, 0.2*maxColor + 0.8*minColor, 0.2*maxDelta + 0.8*minDelta, 0.0 );330 KapaSendTextline (kapa, label, 0.2*maxColor + 0.8*minColor, 0.2*maxDelta + 0.8*minDelta, 0.0, textcolor); 329 331 KapaSetFont (kapa, "helvetica", 14); 330 332 331 graph data.style = 2;333 graphmode.style = KAPA_PLOT_POINTS; /* points */ 332 334 graphdata.color = KapaColorByName ("black"); 333 335 -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/fitsed.c
r39457 r40477 157 157 if (!GetGraph (&graphdata, &kapa, NULL)) return (FALSE); 158 158 SetLimitsRaw (wavecode, NULL, Nfilter, &graphdata); 159 graphdata.style = 2;160 graphdata.ptype = 2;159 graphdata.style = KAPA_PLOT_POINTS; /* points */ 160 graphdata.ptype = KAPA_POINT_CIRCLE_SOLID; 161 161 KapaClearSections (kapa); 162 162 magSection.name = strcreate ("mag"); -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/gimages.c
r39347 r40477 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); -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/gstar.c
r39634 r40477 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; -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/images.c
r37807 r40477 352 352 Xvec.Nelements = Yvec.Nelements = N; 353 353 if (N > 0) { 354 graphmode.style = 2; /* points */355 graphmode.ptype = 100; /* connect pairs of points */354 graphmode.style = KAPA_PLOT_POINTS; /* points */ 355 graphmode.ptype = KAPA_POINT_PAIR_CONNECT; /* connect pairs of points */ 356 356 graphmode.etype = 0; 357 357 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/imbox.c
r39926 r40477 156 156 Xvec.Nelements = Yvec.Nelements = Npts; 157 157 if (Npts > 0) { 158 graphmode.style = 2; /* points */159 graphmode.ptype = 100; /* connect pairs of points */158 graphmode.style = KAPA_PLOT_POINTS; /* points */ 159 graphmode.ptype = KAPA_POINT_PAIR_CONNECT; /* connect pairs of points */ 160 160 graphmode.etype = 0; 161 161 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/imdata.c
r39457 r40477 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); -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/imdense.c
r39926 r40477 59 59 Xvec.Nelements = Yvec.Nelements = N; 60 60 if (N > 0) { 61 graphmode.style = 2; /* points */61 graphmode.style = KAPA_PLOT_POINTS; /* points */ 62 62 graphmode.etype = 0; 63 63 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/imlist.c
r39310 r40477 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) { -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/imphot.c
r39233 r40477 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); -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/imstats.c
r37807 r40477 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); 52 52 53 graphmode.style = 2;53 graphmode.style = KAPA_PLOT_POINTS; /* points */ 54 54 graphmode.etype = 0; 55 55 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/init.c
r39602 r40477 3 3 int avextract PROTO((int, char **)); 4 4 int avmatch PROTO((int, char **)); 5 int avperiodogram PROTO((int, char **)); 6 int avperiodomatch PROTO((int, char **)); 5 7 int badimages PROTO((int, char **)); 6 8 int calextract PROTO((int, char **)); … … 67 69 {1, "avextract", avextract, "extract average data values"}, 68 70 {1, "avmatch", avmatch, "extract average data values matched to RA,DEC points"}, 71 {1, "avperiodogram", avperiodogram, "perform periodogram on objects based on restrictions"}, 72 {1, "avperiodomatch", avperiodomatch, "perform periodogram on objects based on ra,dec list"}, 69 73 {1, "badimages", badimages, "look for images with anomalous astrometry"}, 70 74 // {1, "calextract", calextract, "extract photometry calibration"}, -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/objectcoverage.c
r39457 r40477 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 -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/paverage.c
r39457 r40477 81 81 return (FALSE); 82 82 } 83 graphmode.style = 2; /* set style topoints */83 graphmode.style = KAPA_PLOT_POINTS; /* points */ 84 84 graphmode.size = -1; /* point size determined by Zvec */ 85 85 graphmode.etype = 0; /* no errorbars */ … … 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; -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/pmeasure.c
r39457 r40477 154 154 return (FALSE); 155 155 } 156 graphmode.style = 2; /* set style topoints */156 graphmode.style = KAPA_PLOT_POINTS; /* points */ 157 157 graphmode.size = -1; /* point size determined by Zvec */ 158 158 graphmode.etype = 0; /* no errorbars */ -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/procks.c
r39457 r40477 111 111 Yvec.Nelements = Xvec.Nelements = N; 112 112 113 graphmode.style = 2; /* set style topoints */113 graphmode.style = KAPA_PLOT_POINTS; /* points */ 114 114 graphmode.etype = 0; /* no errorbars */ 115 115 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); … … 142 142 Yvec.Nelements = Xvec.Nelements = N; 143 143 144 graphmode.style = 2; /* set style topoints */145 graphmode.ptype = 100; /* connect pairs */144 graphmode.style = KAPA_PLOT_POINTS; /* points */ 145 graphmode.ptype = KAPA_POINT_PAIR_CONNECT; /* connect pairs of points */ 146 146 graphmode.etype = 0; /* no errorbars */ 147 147 -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/region_list.c
r33662 r40477 181 181 SkyList *skylist; 182 182 183 // the list of regions comes directly from a file 184 if (selection->list != NULL) { 185 skylist = SkyListLoadFile (selection->list); 186 return (skylist); 187 } 188 189 // all other options require sky to be set 190 if (!sky) { 191 gprint (GP_ERR, "CATDIR not set\n"); 192 return NULL; 193 } 194 183 195 /* determine region-file names */ 184 196 if (selection->name != NULL) { … … 186 198 return (skylist); 187 199 } 188 189 if (selection->list != NULL) {190 skylist = SkyListLoadFile (selection->list);191 return (skylist);192 }193 200 194 201 if (selection->useDisplay) { -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/remote.c
r39283 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/showtile.c
r39457 r40477 78 78 Xvec.Nelements = Yvec.Nelements = N; 79 79 if (N > 0) { 80 graphmode.style = 2; /* points */81 graphmode.ptype = 100; /* connect pairs of points */80 graphmode.style = KAPA_PLOT_POINTS; /* points */ 81 graphmode.ptype = KAPA_POINT_PAIR_CONNECT; /* connect pairs of points */ 82 82 graphmode.etype = 0; 83 83 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/simage.c
r37807 r40477 118 118 } 119 119 120 graphmode.style = 2;120 graphmode.style = KAPA_PLOT_POINTS; 121 121 graphmode.size = -1; 122 122 graphmode.etype = 0; -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/skycat.c
r39926 r40477 121 121 Xvec.Nelements = Yvec.Nelements = Npts; 122 122 if (Npts > 0) { 123 graphmode.style = 2; /* points */124 graphmode.ptype = 100; /* connect pairs of points */123 graphmode.style = KAPA_PLOT_POINTS; /* points */ 124 graphmode.ptype = KAPA_POINT_PAIR_CONNECT; /* connect pairs of points */ 125 125 graphmode.etype = 0; 126 126 PlotVectorPair (kapa, &Xvec, &Yvec, NULL, &graphmode); -
branches/czw_branch/20170908/Ohana/src/opihi/dvo/skycoverage.c
r39233 r40477 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: { -
branches/czw_branch/20170908/Ohana/src/opihi/include/astro.h
r39610 r40477 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); -
branches/czw_branch/20170908/Ohana/src/opihi/include/data.h
r37807 r40477 50 50 float **buffers; 51 51 } MedImageType; 52 53 /*** typedef structs used by the Neural Network functions (nnet_*) ***/ 54 typedef struct { 55 char *name; 56 int Nlayer; // Nlayers = input layer + output layer + hidden layers 57 int *Nnodes; // number of nodes per layer 58 float **weight; // a matrix between each layer 59 float **biases; // a vector for each layer 60 61 float **zvalue; // a vector of z values for each layer (= w*input + b) 62 float **svalue; // a vector of s values for each layer (= sigmoid(z)) 63 float **sprime; // 64 float **delta; // 65 66 float ** Nabla_b; // a vector of Nabla_b values for each layer 67 float **dNabla_b; // a vector of Nabla_b values for each layer 68 69 float ** Nabla_w; // a matrix of Nabla_w values for each layer 70 float **dNabla_w; // a matrix of Nabla_w values for each layer 71 } Nnet; 52 72 53 73 void InitData (void); … … 162 182 /* starfuncs.c */ 163 183 double get_aperture_stats (Matrix *matrix, int X, int Y, int Npix, int Nborder, double max, int VERBOSE); 184 double get_box_stats (Matrix *matrix, int X, int Y, int dX, int dY, int Nborder, double max, int VERBOSE); 185 164 186 int set_rough_radii (double Ra, double Ri, double Ro); 165 187 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); … … 227 249 int GetKapaChannelFromString (char *string); 228 250 251 /*** Neural Network functions (nnet_*) ***/ 252 253 // in lib.data/nnet.c: 254 void InitNnets (); 255 void InitNnetData (Nnet *nnet, char *name, int Nlayer); 256 257 void FreeNnets (); 258 void FreeNnetData (Nnet *nnet); 259 260 Nnet *GetNnet (int where); 261 Nnet *FindNnet (char *name); 262 Nnet *CreateNnet (char *name, int Nlayer); 263 void CreateNnetData (Nnet *nnet, int LargeWeightInit); 264 265 void PrintNnet (Nnet *nnet); 266 int DeleteNnet (Nnet *nnet); 267 void ListNnets (); 268 269 // in cmd.data/nnet.c: 270 int nnet_command (int argc, char **argv); 271 272 // in cmd.data/nnet_commands.c: 273 int nnet_init (int argc, char **argv); 274 int nnet_list (int argc, char **argv); 275 int nnet_delete (int argc, char **argv); 276 int nnet_create (int argc, char **argv); 277 int nnet_set (int argc, char **argv); 278 int nnet_get (int argc, char **argv); 279 int nnet_read (int argc, char **argv); 280 int nnet_write (int argc, char **argv); 281 int nnet_print (int argc, char **argv); 282 283 // in cmd.data/nnet_train.c: 284 int nnet_train (int argc, char **argv); 285 void nnet_feedforward (Nnet *nnet); 286 287 // in cmd.data/nnet_apply.c: 288 int nnet_apply (int argc, char **argv); 289 229 290 # endif -
branches/czw_branch/20170908/Ohana/src/opihi/include/dvoshell.h
r39569 r40477 41 41 char *HOSTDIR; 42 42 char *RESULT_FILE; 43 44 typedef struct { 45 int Nmeasure; 46 int Nperiods; 47 opihi_flt *period; 48 opihi_flt *power; 49 double P50; 50 double R50; 51 double R90; 52 } PeriodogramResult; 53 54 /*** Periodogram functions (avperiodogram and avperiodomatch) ***/ 55 void PeriodogramResultFree (PeriodogramResult *result); 56 void PeriodogramResultSave (PeriodogramResult *result, char *extname, FILE *foutput, Average *average); 57 void PeriodogramSetOptions (float minimumPeriod, float maximumPeriod); 58 PeriodogramResult *PeriodogramRawFloatingMean (opihi_flt *time, opihi_flt *flux, opihi_flt *dflux, int Npts); 43 59 44 60 /*** dvo prototypes ***/ -
branches/czw_branch/20170908/Ohana/src/opihi/include/pantasks.h
r36623 r40477 8 8 9 9 # define DEBUG 0 10 11 typedef int IDtype; 10 12 11 13 typedef enum { … … 133 135 134 136 typedef struct { 135 intJobID; /* internal ID for job */137 IDtype JobID; /* internal ID for job */ 136 138 int pid; /* external ID for job */ 137 139 … … 204 206 void UpdateTaskTimerStats (Task *task, int mode, double dtime); 205 207 206 intNextJobID (void);208 IDtype NextJobID (void); 207 209 void InitJobIDs (void); 208 210 void FreeJobIDs (void); 209 int FreeJobID (int ID);210 211 211 212 void InitJobs (void); … … 213 214 214 215 Job *NextJob (void); 215 Job *FindJob ( intJobID);216 Job *FindJob (IDtype JobID); 216 217 void ListJobs (void); 217 218 Job *CreateJob (Task *task); … … 234 235 int SubmitControllerJob (Job *job); 235 236 int DeleteControllerJob (Job *job); 236 Job *FindControllerJob ( intJobID);237 Job *FindControllerJob (IDtype JobID); 237 238 int StartController (void); 238 239 int ControllerCommand (char *command, char *response, IOBuffer *buffer); -
branches/czw_branch/20170908/Ohana/src/opihi/lib.data/Makefile
r39242 r40477 20 20 $(SDIR)/fft.$(ARCH).o \ 21 21 $(SDIR)/svdcmp.$(ARCH).o \ 22 $(SDIR)/svdcmp_bond_new.$(ARCH).o \22 $(SDIR)/svdcmp_bond_new.$(ARCH).o \ 23 23 $(SDIR)/bracket.$(ARCH).o \ 24 24 $(SDIR)/spline.$(ARCH).o \ … … 27 27 $(SDIR)/mrqmin.$(ARCH).o \ 28 28 $(SDIR)/mrq2dmin.$(ARCH).o \ 29 $(SDIR)/nnet.$(ARCH).o \ 29 30 $(SDIR)/precess.$(ARCH).o \ 30 31 $(SDIR)/starfuncs.$(ARCH).o \ -
branches/czw_branch/20170908/Ohana/src/opihi/lib.data/gaussian.c
r38986 r40477 26 26 if (Ngaussint == Nbin) return; 27 27 28 long A = time(NULL);29 srand48(A);28 // long A = time(NULL); 29 // srand48() is called by startup 30 30 31 31 Ngaussint = Nbin; -
branches/czw_branch/20170908/Ohana/src/opihi/lib.data/graphtools.c
r38153 r40477 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++) { -
branches/czw_branch/20170908/Ohana/src/opihi/lib.data/starfuncs.c
r36679 r40477 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; … … 171 285 off = j*Nx; 172 286 for (i = Xs; i < Xe; i++) { 287 if (!isfinite(data[i+off])) continue; 173 288 sky[Nsky] = data[i+off]; 174 289 Nsky ++; … … 180 295 off = j*Nx; 181 296 for (i = Xs; i < Xe; i++) { 297 if (!isfinite(data[i+off])) continue; 182 298 sky[Nsky] = data[i+off]; 183 299 Nsky ++; … … 191 307 off = j*Nx; 192 308 for (i = Xs; i < Xe; i++) { 309 if (!isfinite(data[i+off])) continue; 193 310 sky[Nsky] = data[i+off]; 194 311 Nsky ++; … … 200 317 off = j*Nx; 201 318 for (i = Xs; i < Xe; i++) { 319 if (!isfinite(data[i+off])) continue; 202 320 sky[Nsky] = data[i+off]; 203 321 Nsky ++; … … 227 345 rad2 = SQ(Xc) + SQ(Yc); 228 346 if (rad2 > Ro2) continue; 347 // if (!isfinite(data[i+off])) continue; 229 348 value = data[i+off] - fsky; 230 349 Sx += Xc*value; -
branches/czw_branch/20170908/Ohana/src/opihi/lib.shell/VectorIO.c
r39457 r40477 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); -
branches/czw_branch/20170908/Ohana/src/opihi/lib.shell/check_stack.c
r38062 r40477 48 48 Nz = stack[i].buffer[0].matrix.Naxis[2]; 49 49 } 50 if ((Nx != stack[i].buffer[0].matrix.Naxis[0]) &&51 (Ny != stack[i].buffer[0].matrix.Naxis[1]) &&50 if ((Nx != stack[i].buffer[0].matrix.Naxis[0]) || 51 (Ny != stack[i].buffer[0].matrix.Naxis[1]) | 52 52 (Nz != stack[i].buffer[0].matrix.Naxis[2])) { 53 53 push_error ("dimensions don't match"); -
branches/czw_branch/20170908/Ohana/src/opihi/lib.shell/convert_to_RPN.c
r39558 r40477 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 */ -
branches/czw_branch/20170908/Ohana/src/opihi/lib.shell/dvomath.c
r39457 r40477 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); -
branches/czw_branch/20170908/Ohana/src/opihi/lib.shell/evaluate_stack.c
r40207 r40477 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); … … 186 186 got_two_op: 187 187 if (!status) { 188 snprintf (line, 512, "syntax error: invalid operand for binary operation: %s or %s\n", stack[i-1].name, stack[i-2].name); 188 // we are guaranteed to have stack[i-1] and stack[i-2] since i >= 2 (above) 189 char tmpvector[] = "Temporary Vector"; 190 char tmpmatrix[] = "Temporary Matrix"; 191 192 char *name1 = NULL; 193 if (stack[i-1].name) { 194 name1 = stack[i-1].name; 195 } else { 196 if (stack[i-1].type == ST_VECTOR_TMP) name1 = tmpvector; 197 if (stack[i-1].type == ST_MATRIX_TMP) name1 = tmpmatrix; 198 } 199 char *name2 = NULL; 200 if (stack[i-2].name) { 201 name2 = stack[i-2].name; 202 } else { 203 if (stack[i-2].type == ST_VECTOR_TMP) name2 = tmpvector; 204 if (stack[i-2].type == ST_MATRIX_TMP) name2 = tmpmatrix; 205 } 206 207 snprintf (line, 512, "syntax error: invalid operand for binary operation: %s or %s\n", name1, name2); 189 208 push_error (line); 209 190 210 int isTrinary = TRUE; 191 211 isTrinary = isTrinary && (i >= 2); … … 199 219 push_error (line); 200 220 } 221 201 222 clear_stack (&tmp_stack); 202 223 return (FALSE); -
branches/czw_branch/20170908/Ohana/src/opihi/lib.shell/parse.c
r33662 r40477 145 145 /* simple variable assignment */ 146 146 /* dvomath returns a new string, or NULL, with the result of the expression */ 147 /* if dvomath returns NULL, the expression was not a math operation: treat as a string */ 147 148 val = dvomath (1, &V1, &size, 0); 148 149 if (val == NULL) { 149 150 while (OHANA_WHITESPACE (*V1)) V1++; 150 151 val = strcreate (V1); 152 init_error (); 151 153 } 152 154 // save the result … … 245 247 vec[0].elements.Flt[Nx] = atof (val); 246 248 } else { 247 vec[0].elements.Int[Nx] = atol (val);249 vec[0].elements.Int[Nx] = atoll (val); 248 250 } 249 251 } -
branches/czw_branch/20170908/Ohana/src/opihi/lib.shell/stack_math.c
r40019 r40477 599 599 } 600 600 601 // the vector is applied to each column (currently only valid for 2D matrix)601 // the vector is applied to each ROW (currently only valid for 2D matrix), e.g.: M[20,10] * X[20] -> M'[20,10] where M'[2,1] = M[2,1] * X[2] 602 602 int MV_binary (StackVar *OUT, StackVar *V1, StackVar *V2, char *op) { 603 603 … … 607 607 Nx = V1[0].buffer[0].matrix.Naxis[0]; 608 608 Ny = V1[0].buffer[0].matrix.Naxis[1]; 609 if (Ny != V2[0].vector[0].Nelements) { 610 push_error ("dimension mismatch"); 609 if (Nx != V2[0].vector[0].Nelements) { 610 snprintf (line, 512, "error: matrix OP vector matrix dimensions do not match: (%d x %d) OP %d", Nx, Ny, V2[0].vector[0].Nelements); 611 push_error (line); 611 612 return (FALSE); 612 613 } … … 628 629 # define MV_FUNC(OP) { \ 629 630 if (V2->vector->type == OPIHI_FLT) { \ 630 opihi_flt *M2 = V2[0].vector[0].elements.Flt;\631 for (i = 0; i < Ny; i++, M2++) {\632 for (j = 0; j < Nx; j++, out++, M1++ ) {\631 for (i = 0; i < Ny; i++) { \ 632 opihi_flt *M2 = V2[0].vector[0].elements.Flt; \ 633 for (j = 0; j < Nx; j++, out++, M1++, M2++) { \ 633 634 *out = OP; \ 634 635 } \ … … 637 638 } \ 638 639 if (V2->vector->type != OPIHI_FLT) { \ 639 opihi_int *M2 = V2[0].vector[0].elements.Int;\640 for (i = 0; i < Ny; i++, M2++) {\641 for (j = 0; j < Nx; j++, out++, M1++ ) {\640 for (i = 0; i < Ny; i++) { \ 641 opihi_int *M2 = V2[0].vector[0].elements.Int; \ 642 for (j = 0; j < Nx; j++, out++, M1++, M2++) { \ 642 643 *out = OP; \ 643 644 } \ … … 695 696 } 696 697 697 // the vector is applied to each row (currently only valid for 2D matrix) 698 // the vector is applied to each COLUMN (currently only valid for 2D matrix) 699 // e.g.: X[10] * M[20,10] -> M'[20,10] where M'[2,1] = X[1] * M[2,1] 698 700 int VM_binary (StackVar *OUT, StackVar *V1, StackVar *V2, char *op) { 699 701 … … 703 705 Nx = V2[0].buffer[0].matrix.Naxis[0]; 704 706 Ny = V2[0].buffer[0].matrix.Naxis[1]; 705 if (Nx != V1[0].vector[0].Nelements) { 707 if (Ny != V1[0].vector[0].Nelements) { 708 snprintf (line, 512, "error: vector OP matrix dimensions do not match: %d OP (%d x %d)", V1[0].vector[0].Nelements, Nx, Ny); 709 push_error (line); 706 710 return (FALSE); 707 711 } … … 722 726 # define VM_FUNC(OP) { \ 723 727 if (V1->vector->type == OPIHI_FLT) { \ 724 for (i = 0; i < Ny; i++) {\725 opihi_flt *M1 = V1[0].vector[0].elements.Flt;\726 for (j = 0; j < Nx; j++, out++, M 1++, M2++) { \728 opihi_flt *M1 = V1[0].vector[0].elements.Flt; \ 729 for (i = 0; i < Ny; i++, M1++) { \ 730 for (j = 0; j < Nx; j++, out++, M2++) { \ 727 731 *out = OP; \ 728 732 } \ … … 731 735 } \ 732 736 if (V1->vector->type != OPIHI_FLT) { \ 733 for (i = 0; i < Ny; i++) {\734 opihi_int *M1 = V1[0].vector[0].elements.Int;\735 for (j = 0; j < Nx; j++, out++, M 1++, M2++) { \737 opihi_int *M1 = V1[0].vector[0].elements.Int; \ 738 for (i = 0; i < Ny; i++, M1++) { \ 739 for (j = 0; j < Nx; j++, out++, M2++) { \ 736 740 *out = OP; \ 737 741 } \ -
branches/czw_branch/20170908/Ohana/src/opihi/mana/findrowpeaks.c
r2938 r40477 23 23 24 24 for (i = 1; i < Nrow - 1; i++) { 25 if (!isfinite(row[i])) continue; // ignore NAN values 25 26 if (row[i] < threshold) continue; 26 27 if (row[i] < row[i-1]) continue; -
branches/czw_branch/20170908/Ohana/src/opihi/pantasks/CheckController.c
r39476 r40477 7 7 8 8 char *p, *q; 9 int i, Njobs, status, JobID; 9 int i, Njobs, status; 10 IDtype JobID; 10 11 Job *job; 11 12 IOBuffer buffer; -
branches/czw_branch/20170908/Ohana/src/opihi/pantasks/JobIDOps.c
r23557 r40477 1 1 # include "pantasks.h" 2 2 3 # define MAX_N_JOBS 100004 static char *JobIDList; 5 static int JobIDPtr;3 # define MAX_N_JOBS 0x80000000 4 5 static IDtype JobIDMax = 0; 6 6 7 7 void InitJobIDs () { 8 9 JobIDPtr = 0; 10 ALLOCATE (JobIDList, char, MAX_N_JOBS); 11 bzero (JobIDList, MAX_N_JOBS*sizeof(char)); 8 JobIDMax = 0; 12 9 } 13 10 14 void FreeJobIDs () { 15 free (JobIDList); 11 void FreeJobIDs () { } 12 13 /* return next unique ID, recycle every MAX_N_JOBS */ 14 IDtype NextJobID () { 15 16 JobIDMax ++; 17 if (JobIDMax >= MAX_N_JOBS) { 18 gprint (GP_ERR, "ERROR: too many jobs spawned: %d, aborting\n", JobIDMax); 19 abort(); 20 } 21 22 return (JobIDMax); 16 23 } 17 24 18 /* return next unique ID, recycle every MAX_N_JOBS */ 19 int NextJobID () { 20 21 int Ntry; 22 23 JobIDPtr ++; 24 if (JobIDPtr >= MAX_N_JOBS) JobIDPtr = 0; 25 26 Ntry = 0; 27 while (JobIDList[JobIDPtr]) { 28 Ntry ++; 29 JobIDPtr ++; 30 if (JobIDPtr >= MAX_N_JOBS) JobIDPtr = 0; 31 if (Ntry == MAX_N_JOBS) return (-1); 32 } 33 JobIDList[JobIDPtr] = TRUE; 34 return (JobIDPtr); 35 } 36 37 int FreeJobID (int JobID) { 38 39 if (JobID < 0) return (FALSE); 40 if (JobID >= MAX_N_JOBS) return (FALSE); 41 42 JobIDList[JobID] = FALSE; 43 return (TRUE); 44 } 25 /* I am going to rework the jobID so that it just grows. no need to ever free them 26 as an int, that allows 2^31 jobs (2e9 jobs) */ -
branches/czw_branch/20170908/Ohana/src/opihi/pantasks/JobOps.c
r38559 r40477 41 41 42 42 /* return job with given ID */ 43 Job *FindJob ( intJobID) {43 Job *FindJob (IDtype JobID) { 44 44 45 45 int i; … … 55 55 56 56 /* return job with given controller Job ID */ 57 Job *FindControllerJob ( intJobID) {57 Job *FindControllerJob (IDtype JobID) { 58 58 59 59 int i; … … 82 82 gprint (GP_LOG, " Jobs in Pantasks Queue\n"); 83 83 for (i = 0; i < Njobs; i++) { 84 gprint (GP_LOG, " %4d % 6d: %-25s %10s %20s\n", Njobs, jobs[i][0].JobID, jobs[i][0].task[0].name, JobStateToString(jobs[i][0].state), jobs[i][0].argv[0]);84 gprint (GP_LOG, " %4d %8d: %-25s %10s %20s\n", Njobs, jobs[i][0].JobID, jobs[i][0].task[0].name, JobStateToString(jobs[i][0].state), jobs[i][0].argv[0]); 85 85 } 86 86 … … 97 97 98 98 job[0].JobID = NextJobID (); 99 100 // this should not happen; abort? 99 101 if (job[0].JobID < 0) { 100 102 free (job); … … 165 167 if (job == NULL) return; 166 168 167 FreeJobID (job[0].JobID);168 169 169 for (i = 0; i < job[0].argc; i++) { 170 170 free (job[0].argv[i]); -
branches/czw_branch/20170908/Ohana/src/opihi/pantasks/delete.c
r23530 r40477 4 4 5 5 Job *job; 6 intJobID;6 IDtype JobID; 7 7 8 8 if (argc != 3) goto usage; -
branches/czw_branch/20170908/Ohana/src/opihi/pantasks/kill.c
r23530 r40477 4 4 5 5 Job *job; 6 intJobID;6 IDtype JobID; 7 7 8 8 if (argc < 2) { … … 10 10 return (FALSE); 11 11 } 12 JobID = ato i(argv[1]);12 JobID = atoll (argv[1]); 13 13 14 14 JobTaskLock(); -
branches/czw_branch/20170908/Ohana/src/opihi/pantasks/test/nice_remote.sh
r32632 r40477 10 10 periods -timeout 20 11 11 active true 12 npending 5 12 npending 50 13 13 14 14 stdout tmp.txt … … 44 44 periods -timeout 20 45 45 active true 46 npending 5 46 npending 50 47 47 48 48 stdout tmp.txt -
branches/czw_branch/20170908/Ohana/src/photdbc/src/get_mags.c
r37045 r40477 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; -
branches/czw_branch/20170908/Ohana/src/photdbc/src/join_stars.c
r38441 r40477 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; -
branches/czw_branch/20170908/Ohana/src/photdbc/src/make_subcatalog.c
r39926 r40477 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; -
branches/czw_branch/20170908/Ohana/src/relastro/Makefile
r39693 r40477 1 default: relastro relastro_client fitobj fitobj2 fitobj3 fit pm1 default: relastro relastro_client fitobj fitobj2 fitobj3 fitexample 2 2 help: 3 3 @echo "make options: relastro (default)" … … 109 109 $(SRC)/relastroVisual.$(ARCH).o 110 110 111 #$(SRC)/write_coords.$(ARCH).o \ 111 #$(SRC)/write_coords.$(ARCH).o 112 #$(SRC)/UpdateStacksWithFit.$(ARCH).o 112 113 113 114 $(RELASTRO): $(INC)/relastro.h … … 187 188 $(BIN)/testparallax.$(ARCH): $(TESTPAR) 188 189 189 fit pm: $(BIN)/fitpm.$(ARCH)190 191 FIT PM= \192 $(SRC)/fit pm.$(ARCH).o \193 $(SRC)/ParFactor.$(ARCH).o \ 194 $(SRC)/FitAstromOps.$(ARCH).o \ 195 $(SRC)/FitPosPMfixed.$(ARCH).o \ 196 $(SRC)/FitPM.$(ARCH).o \ 197 $(SRC)/FitPMandPar.$(ARCH).o \ 198 $(SRC)/FitPosStack.$(ARCH).o \ 199 $(SRC)/BootstrapOps.$(ARCH).o \ 200 $(SRC)/mkpolyterm.$(ARCH).o \ 201 $(SRC)/fitpoly.$(ARCH).o 202 203 $(FIT PM): $(INC)/relastro.h204 $(BIN)/fit pm.$(ARCH): $(FITPM)190 fitexample: $(BIN)/fitexample.$(ARCH) 191 192 FITEXAMPLE = \ 193 $(SRC)/fitexample.$(ARCH).o \ 194 $(SRC)/ParFactor.$(ARCH).o \ 195 $(SRC)/FitAstromOps.$(ARCH).o \ 196 $(SRC)/FitPosPMfixed.$(ARCH).o \ 197 $(SRC)/FitPM.$(ARCH).o \ 198 $(SRC)/FitPMandPar.$(ARCH).o \ 199 $(SRC)/FitPosStack.$(ARCH).o \ 200 $(SRC)/BootstrapOps.$(ARCH).o \ 201 $(SRC)/mkpolyterm.$(ARCH).o \ 202 $(SRC)/fitpoly.$(ARCH).o 203 204 $(FITEXAMPLE): $(INC)/relastro.h 205 $(BIN)/fitexample.$(ARCH): $(FITEXAMPLE) 205 206 206 207 fitobj: $(BIN)/fitobj.$(ARCH) -
branches/czw_branch/20170908/Ohana/src/relastro/include/relastro.h
r39926 r40477 33 33 typedef enum {OP_NONE, OP_IMAGES, OP_HIGH_SPEED, OP_MERGE_SOURCE, OP_UPDATE_OBJECTS, OP_UPDATE_OFFSETS, OP_LOAD_OBJECTS, OP_HPM, OP_PARALLEL_REGIONS, OP_PARALLEL_IMAGES, OP_REPAIR_STACKS, OP_REPAIR_WARPS, OP_REPAIR_OBJECT_ID} RelastroOp; 34 34 35 typedef enum {TARGET_NONE, TARGET_SIMPLE, TARGET_CHIPS, SET_CHIPS, TARGET_MOSAICS} FitTarget;35 typedef enum {TARGET_NONE, TARGET_SIMPLE, TARGET_CHIPS, SET_CHIPS, SET_STACKS, TARGET_MOSAICS} FitTarget; 36 36 37 37 typedef enum { … … 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; … … 366 367 int USE_ICRF_POLE; 367 368 369 int FIT_STACKS; 370 int IMSTATS_ONLY; 368 371 int REPAIR_STACKS; 369 372 int USE_IMAGE_COORDS_FOR_REPAIR; … … 377 380 int SKIP_CFH; 378 381 382 int UPDATE_ALL_MEASURE; 379 383 int UPDATE_PS1_STACK_MEASURE; 380 384 int UPDATE_PS1_CHIP_MEASURE; … … 621 625 int UpdateChips (Catalog *catalog, int Ncatalog, int Nloop); 622 626 int UpdateStacks (Catalog *catalog, int Ncatalog); 627 int UpdateStacksWithFit (Catalog *catalog, int Ncatalog); 623 628 int UpdateMosaic (Catalog *catalog, int Ncatalog); 624 629 int UpdateMeasures (Catalog *catalog, int Ncatalog); -
branches/czw_branch/20170908/Ohana/src/relastro/src
- Property svn:mergeinfo changed
/branches/eam_branches/ohana.20170822/src/relastro/src (added) merged: 40212,40220,40223,40244 /trunk/Ohana/src/relastro/src (added) merged: 40291,40382,40405,40414-40415,40464
- Property svn:mergeinfo changed
-
branches/czw_branch/20170908/Ohana/src/relastro/src/BrightCatalog.c
r39995 r40477 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); … … 361 364 gfits_define_bintable_column (&theader, "D", "DEC", "dec", "degrees", 1.0, 0.0); 362 365 gfits_define_bintable_column (&theader, "E", "MAG_SYS", "magnitude (sys)", NULL, 1.0, 0.0); 363 gfits_define_bintable_column (&theader, "E", "MAG_CAL", "magnitude (cal)", NULL, 1.0, 0.0); 366 gfits_define_bintable_column (&theader, "E", "MCAL_PSF", "magnitude (cal)", NULL, 1.0, 0.0); 367 gfits_define_bintable_column (&theader, "E", "MCAL_APER","magnitude (cal)", NULL, 1.0, 0.0); 364 368 gfits_define_bintable_column (&theader, "E", "MAG_ERR", "magnitude (err)", NULL, 1.0, 0.0); 365 369 gfits_define_bintable_column (&theader, "E", "AIRMASS", "airmass", NULL, 1.0, 0.0); … … 385 389 double *D ; ALLOCATE (D , double, catalog->Nmeasure); 386 390 float *M ; ALLOCATE (M , float, catalog->Nmeasure); 387 float *Mcal ; ALLOCATE (Mcal , float, catalog->Nmeasure); 391 float *McalPSF ; ALLOCATE (McalPSF , float, catalog->Nmeasure); 392 float *McalAPER ; ALLOCATE (McalAPER , float, catalog->Nmeasure); 388 393 float *dM ; ALLOCATE (dM , float, catalog->Nmeasure); 389 394 float *airmass ; ALLOCATE (airmass , float, catalog->Nmeasure); … … 408 413 D[i] = measure[i].D ; 409 414 M[i] = measure[i].M ; 410 Mcal[i] = measure[i].Mcal ; 415 McalPSF[i] = measure[i].McalPSF ; 416 McalAPER[i] = measure[i].McalAPER ; 411 417 dM[i] = measure[i].dM ; 412 418 airmass[i] = measure[i].airmass ; … … 434 440 gfits_set_bintable_column (&theader, &ftable, "DEC", D, catalog->Nmeasure); 435 441 gfits_set_bintable_column (&theader, &ftable, "MAG_SYS", M, catalog->Nmeasure); 436 gfits_set_bintable_column (&theader, &ftable, "MAG_CAL", Mcal, catalog->Nmeasure); 442 gfits_set_bintable_column (&theader, &ftable, "MCAL_PSF", McalPSF, catalog->Nmeasure); 443 gfits_set_bintable_column (&theader, &ftable, "MCAL_APER", McalAPER, catalog->Nmeasure); 437 444 gfits_set_bintable_column (&theader, &ftable, "MAG_ERR", dM, catalog->Nmeasure); 438 445 gfits_set_bintable_column (&theader, &ftable, "AIRMASS", airmass, catalog->Nmeasure); … … 454 461 free (D ); 455 462 free (M ); 456 free (Mcal ); 463 free (McalPSF ); 464 free (McalAPER); 457 465 free (dM ); 458 466 free (airmass ); … … 694 702 SecFilt *secfilt = catalog->secfilt; 695 703 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 ;704 M [i] = secfilt[i].MpsfChp ; 705 dM [i] = secfilt[i].dMpsfChp; 706 Mchisq[i] = secfilt[i].Mchisq ; 707 flags [i] = secfilt[i].flags ; 708 Ncode [i] = secfilt[i].Ncode ; 709 Nused [i] = secfilt[i].Nused ; 710 Mmin [i] = secfilt[i].Mmin ; 711 Mmax [i] = secfilt[i].Mmax ; 704 712 } 705 713 -
branches/czw_branch/20170908/Ohana/src/relastro/src/ImageOps.c
r39926 r40477 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 -
branches/czw_branch/20170908/Ohana/src/relastro/src/MosaicOps.c
r39457 r40477 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 -
branches/czw_branch/20170908/Ohana/src/relastro/src/UpdateChips.c
r39926 r40477 88 88 raw = getImageRaw (catalog, Ncatalog, i, &Nraw, MODE_MOSAIC); 89 89 if (!raw) { 90 // fprintf (stderr, "skip 1 %s\n", image[i].name); 90 91 Nskip ++; 91 92 mode[i] = 0; … … 93 94 } 94 95 if (Nraw <= IMFIT_TOO_FEW) { 96 // fprintf (stderr, "skip 2 %s\n", image[i].name); 95 97 Nskip ++; 96 98 mode[i] = 0; … … 102 104 ref = getImageRef (catalog, Ncatalog, i, &Nref, MODE_MOSAIC); 103 105 if (!ref) { 106 // fprintf (stderr, "skip 3 %s\n", image[i].name); 104 107 Nskip ++; 105 108 mode[i] = 0; … … 116 119 // note that Nraw & Nref must be equal: if not, we made a programming error in one of these two functions. 117 120 assert (Nraw == Nref); 121 122 if (IMSTATS_ONLY) { 123 int Nstat; 124 float dLsig, dMsig, dRsig; 125 GetScatterRawRef(&dLsig, &dMsig, &dRsig, &Nstat, raw, ref, Nraw, IMFIT_SYS_SIGMA_LIM); 126 127 // XXX: I need to convert dLsig, dMsig from degrees to pixels 128 dLsig *= 3600.0; 129 dMsig *= 3600.0; 130 131 image[i].dXpixSys = dLsig; 132 image[i].dYpixSys = dMsig; 133 image[i].nFitAstrom = Nstat; 134 continue; 135 } 118 136 119 137 // save these in case of failure -
branches/czw_branch/20170908/Ohana/src/relastro/src/UpdateMeasures.c
r39926 r40477 47 47 } 48 48 49 off_t im = getImageByID (measureT->imageID); 49 Average *average = &catalog[i].average[measureB->averef]; 50 int FOUND_TEST = FALSE; 51 FOUND_TEST |= (average[0].objID == OBJ_ID_SRC) && (average[0].catID == CAT_ID_SRC); 52 FOUND_TEST |= (average[0].objID == OBJ_ID_DST) && (average[0].catID == CAT_ID_DST); 53 if (FOUND_TEST) { 54 fprintf (stderr, "found test object\n"); 55 } 56 57 // we need this below but cannot declare it after the label update_this_measure: 58 off_t im; 59 60 // we have a few options to include/exclude specific types of measurements 61 if (UPDATE_ALL_MEASURE) goto update_this_measure; 62 if (isGPC1chip (measureT->photcode) && UPDATE_PS1_CHIP_MEASURE) goto update_this_measure; 63 if (isGPC1stack (measureT->photcode) && UPDATE_PS1_STACK_MEASURE) goto update_this_measure; 64 if (isHSCchip (measureT->photcode) && UPDATE_HSC_MEASURE) goto update_this_measure; 65 if (isCFHchip (measureT->photcode) && UPDATE_CFH_MEASURE) goto update_this_measure; 66 continue; // skip all others 67 68 update_this_measure: 69 im = getImageByID (measureT->imageID); 50 70 if (im < 0) continue; // detections without imageIDs are not associated with a known image (eg, refs) 51 71 … … 114 134 } 115 135 116 // only modify the chip coordinates 117 if (UPDATE_PS1_STACK_MEASURE && isGPC1stack (measureT->photcode)) { 118 measureT->R = R; 119 measureT->D = D; 120 if (measureB) { 121 measureB->R = R; 122 measureB->D = D; 123 } 124 } 125 // only modify the chip coordinates 126 if (UPDATE_PS1_CHIP_MEASURE && isGPC1chip (measureT->photcode)) { 127 measureT->R = R; 128 measureT->D = D; 129 if (measureB) { 130 measureB->R = R; 131 measureB->D = D; 132 } 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 } 136 // modify the measure coordinates 137 measureT->R = R; 138 measureT->D = D; 139 if (measureB) { 140 measureB->R = R; 141 measureB->D = D; 151 142 } 152 143 } -
branches/czw_branch/20170908/Ohana/src/relastro/src/UpdateObjectOffsets.c
r39926 r40477 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"); -
branches/czw_branch/20170908/Ohana/src/relastro/src/UpdateObjects.c
r39926 r40477 127 127 int k; 128 128 129 // we need to chose to do something here... 130 int valid = UPDATE_ALL_MEASURE; 131 valid |= UPDATE_PS1_CHIP_MEASURE; 132 valid |= UPDATE_HSC_MEASURE; 133 valid |= UPDATE_CFH_MEASURE; 134 if (!valid) return FALSE; 135 129 136 /* calculate the average value of R,D for a single star */ 130 131 137 FitAstromResult fitPos, fitPM, fitPar; 132 138 FitAstromResultInit (&fitPos); … … 583 589 int status; 584 590 591 // we need to chose to do something here... 592 if (!UPDATE_PS1_STACK_MEASURE) return FALSE; 593 585 594 // set the default values 586 595 average[0].Rstk = NAN; // RA in degrees … … 794 803 Npoints++; 795 804 805 // NOTE: if 'isStack' is true, we will never see these photcode values 796 806 hasGAIA = (measure[k].photcode == 1030); 797 807 has2MASS = ((measure[k].photcode >= 2011) && (measure[k].photcode <= 2013)); … … 808 818 } 809 819 810 // XXX flag measurements from stars with 2MASS 811 for (k = 0; k < average[0].Nmeasure; k++) { 812 // reset the bit to note that a detection was used (or not) 820 // flag measurements from stars with 2MASS, GAIA, TYCHO 821 // NOTE: if 'isStack' is TRUE, these will not be correctly set. 822 // ONLY do this loop if not(isStack) 823 for (k = 0; !isStack && (k < average[0].Nmeasure); k++) { 824 // reset the bit to note that an object does or does not have the value 813 825 if (has2MASS) { 814 826 measure[k].dbFlags |= ID_MEAS_OBJECT_HAS_2MASS; -
branches/czw_branch/20170908/Ohana/src/relastro/src/UpdateStacks.c
r39926 r40477 11 11 off_t Nskip = 0; 12 12 off_t Nmeas = 0; 13 off_t NnewFit = 0; 14 off_t NoldFit = 0; 13 15 14 16 // measure the scatter for each stack … … 43 45 assert (Nraw == Nref); 44 46 45 int Nstat; 46 float dLsig, dMsig, dRsig; 47 GetScatterRawRef(&dLsig, &dMsig, &dRsig, &Nstat, raw, ref, Nraw, IMFIT_SYS_SIGMA_LIM); 47 // the natural default for stacks is to NOT re-fit 48 if (FIT_STACKS == FALSE) { 49 int Nstat; 50 float dLsig, dMsig, dRsig; 51 GetScatterRawRef(&dLsig, &dMsig, &dRsig, &Nstat, raw, ref, Nraw, IMFIT_SYS_SIGMA_LIM); 48 52 49 // XXX: I need to convert dLsig, dMsig from degrees to pixels50 dLsig *= 3600.0;51 dMsig *= 3600.0;53 // XXX: I need to convert dLsig, dMsig from degrees to pixels 54 dLsig *= 3600.0; 55 dMsig *= 3600.0; 52 56 53 image[i].dXpixSys = dLsig; 54 image[i].dYpixSys = dMsig; 55 image[i].nFitAstrom = Nstat; 57 image[i].dXpixSys = dLsig; 58 image[i].dYpixSys = dMsig; 59 image[i].nFitAstrom = Nstat; 60 continue; 61 } 62 63 // save these in case of failure 64 Coords oldCoords; 65 SaveCoords (&oldCoords, &image[i].coords); 66 67 float dXpixSys = image[i].dXpixSys; 68 float dYpixSys = image[i].dYpixSys; 69 int nFitAstr = image[i].nFitAstrom; 70 71 // FitChip does iterative, clipped fitting 72 if (!FitChip (raw, ref, Nraw, &image[i])) { 73 if (VERBOSE) fprintf (stderr, "reject fit for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT", Nused %d of %d\n", image[i].name, i, Nraw, image[i].nFitAstrom, image[i].nstar); 74 75 // restore status quo ante (replace truMap with tmpMap) 76 RestoreCoords (&image[i].coords, &oldCoords, &image[i]); 77 image[i].dXpixSys = dXpixSys; 78 image[i].dYpixSys = dYpixSys; 79 image[i].nFitAstrom = nFitAstr; 80 81 NoldFit ++; 82 free (raw); 83 free (ref); 84 continue; 85 } 86 87 AstromOffsetMapFree (oldCoords.offsetMap); 88 89 // Apply the modified coords back to the measure.R,D. Note that raw.R,D, ref.L,M, etc 90 // are all automatically updated in this block because they are re-generated from 91 // image.coords on each pass. 92 setImageRaw (catalog, Ncatalog, i, raw, Nraw, MODE_MOSAIC); 93 94 NnewFit ++; 95 free (raw); 96 free (ref); 56 97 } 57 98 -
branches/czw_branch/20170908/Ohana/src/relastro/src/args.c
r39926 r40477 68 68 } 69 69 70 // the default is to only measure the scatter for the stacks, not to perform a new fit 71 FIT_STACKS = FALSE; 72 if ((N = get_argument (argc, argv, "-fit-stacks"))) { 73 remove_argument (N, &argc, argv); 74 FIT_STACKS = TRUE; 75 } 76 70 77 REPAIR_STACKS = FALSE; 71 78 if ((N = get_argument (argc, argv, "-repair-stacks-on-update"))) { … … 86 93 } 87 94 95 // only update the fit statistics (systematic floor) 96 IMSTATS_ONLY = FALSE; 97 if ((N = get_argument (argc, argv, "-imstats-only"))) { 98 remove_argument (N, &argc, argv); 99 IMSTATS_ONLY = TRUE; 100 } 101 88 102 // elements needed for parallel regions / parallel images 89 103 MANUAL_UNIQUER = NULL; … … 158 172 } 159 173 174 UPDATE_ALL_MEASURE = FALSE; 175 if ((N = get_argument (argc, argv, "-update-all-cameras"))) { 176 remove_argument (N, &argc, argv); 177 UPDATE_ALL_MEASURE = TRUE; 178 } 160 179 UPDATE_PS1_STACK_MEASURE = FALSE; 161 180 if ((N = get_argument (argc, argv, "-update-ps1-stack"))) { … … 179 198 } 180 199 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");200 if (!UPDATE_ALL_MEASURE && !UPDATE_PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) { 201 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 202 exit (2); 184 203 } 185 204 } 186 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) { 205 if (RELASTRO_OP == OP_UPDATE_OBJECTS) { 206 if (!UPDATE_ALL_MEASURE && !UPDATE_PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) { 207 fprintf (stderr, "for -update-objects, need to select at least one of -update-all-cameras, -update-ps1-stack, -update-ps1-chip, -update-hsc, -update-cfh\n"); 208 exit (2); 209 } 210 } 211 if ((RELASTRO_OP == OP_PARALLEL_REGIONS) || (RELASTRO_OP == OP_PARALLEL_IMAGES) || (RELASTRO_OP == OP_IMAGES)) { 212 if (APPLY_OFFSETS && !UPDATE_ALL_MEASURE && !UPDATE_PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) { 188 213 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 214 exit (2); … … 300 325 remove_argument (N, &argc, argv); 301 326 FIT_TARGET = SET_CHIPS; 327 } 328 if ((N = get_argument (argc, argv, "-set-stacks"))) { 329 remove_argument (N, &argc, argv); 330 FIT_TARGET = SET_STACKS; 302 331 } 303 332 … … 858 887 } 859 888 889 // the default is to only measure the scatter for the stacks, not to perform a new fit 890 FIT_STACKS = FALSE; 891 if ((N = get_argument (argc, argv, "-fit-stacks"))) { 892 remove_argument (N, &argc, argv); 893 FIT_STACKS = TRUE; 894 } 895 860 896 REPAIR_STACKS = FALSE; 861 897 if ((N = get_argument (argc, argv, "-repair-stacks-on-update"))) { … … 869 905 } 870 906 907 // only update the fit statistics (systematic floor) 908 IMSTATS_ONLY = FALSE; 909 if ((N = get_argument (argc, argv, "-imstats-only"))) { 910 remove_argument (N, &argc, argv); 911 IMSTATS_ONLY = TRUE; 912 } 913 871 914 SKIP_PS1_CHIP = FALSE; 872 915 if ((N = get_argument (argc, argv, "-skip-ps1-chip"))) { … … 890 933 } 891 934 935 UPDATE_ALL_MEASURE = FALSE; 936 if ((N = get_argument (argc, argv, "-update-all-cameras"))) { 937 remove_argument (N, &argc, argv); 938 UPDATE_ALL_MEASURE = TRUE; 939 } 892 940 UPDATE_PS1_STACK_MEASURE = FALSE; 893 941 if ((N = get_argument (argc, argv, "-update-ps1-stack"))) { … … 911 959 } 912 960 if (RELASTRO_OP == OP_UPDATE_OFFSETS) { 913 if (!UPDATE_ PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) {961 if (!UPDATE_ALL_MEASURE && !UPDATE_PS1_STACK_MEASURE && !UPDATE_PS1_CHIP_MEASURE && !UPDATE_HSC_MEASURE && !UPDATE_CFH_MEASURE) { 914 962 fprintf (stderr, "for -update-offsets, need to select at least one of -update-ps1-stack, -update-ps1-chip, -update-hsc, -update-cfh\n"); 915 963 exit (2); -
branches/czw_branch/20170908/Ohana/src/relastro/src/launch_region_hosts.c
r39926 r40477 117 117 strextend (&command, "-set-chips"); 118 118 break; 119 case SET_STACKS: 120 strextend (&command, "-set-stacks"); 121 break; 119 122 case TARGET_NONE: 120 123 abort(); … … 151 154 if (SKIP_CFH) strextend (&command, "-skip-cfh"); 152 155 156 if (FIT_STACKS) strextend (&command, "-fit-stacks"); 157 if (IMSTATS_ONLY) strextend (&command, "-imstats-only"); 158 153 159 strextend (&command, "-nloop %d", NLOOP); 154 160 strextend (&command, "-threads %d", NTHREADS); -
branches/czw_branch/20170908/Ohana/src/relastro/src/relastro_images.c
r39926 r40477 99 99 UpdateChips (catalog, Ncatalog, 0); // measure.X,Y -> R,D, fit image.coords 100 100 MARKTIME("update chips: %f sec\n", dtime); 101 break; 101 102 103 case SET_STACKS: 104 // we just want to fit the selected stacks to the mean positions 105 UpdateStacks (catalog, Ncatalog); 106 MARKTIME("update stacks : %f sec\n", dtime); 102 107 break; 103 108 -
branches/czw_branch/20170908/Ohana/src/relastro/src/relastro_parallel_images.c
r39926 r40477 150 150 } 151 151 152 // measure scatterfor stacks152 // measure astrometry or scatter [default] for stacks 153 153 UpdateStacks (catalog, Ncatalog); 154 154 LOGRTIME("UpdateStacks on %s, host %d: %f sec\n", myHostName, REGION_HOST_ID, dtime); … … 156 156 // create summary plots of the process 157 157 // relastroVisualSummaryChips(); 158 break; 159 160 case SET_STACKS: 161 // we just want to fit the selected stacks to the mean positions 162 share_mean_pos (catalog, Ncatalog, regionHosts, 0); 163 slurp_mean_pos (catalog, Ncatalog, regionHosts, 0); 164 UpdateStacks (catalog, Ncatalog); 165 share_image_pos (regionHosts, 0); 166 slurp_image_pos (catalog, Ncatalog, regionHosts, 0); 167 MARKTIME("update stacks : %f sec\n", dtime); 158 168 break; 159 169 -
branches/czw_branch/20170908/Ohana/src/relastro/src/select_images.c
r39926 r40477 114 114 } 115 115 if (FALSE && !strncmp(timage[i].name, "o6227g0311o", 10)) { 116 fprintf (stderr, "test image 2\n"); 117 } 118 119 // RINGS.V3.skycell.2634.034.stk.3411510.skycal.3811673.cmf[SkyChip.hdr] 120 if (!strncmp(timage[i].name, "RINGS.V3.skycell.2634.034.stk.3411510", strlen("RINGS.V3.skycell.2634.034.stk.3411510"))) { 116 121 fprintf (stderr, "test image 2\n"); 117 122 } -
branches/czw_branch/20170908/Ohana/src/relphot/include/relphot.h
r39926 r40477 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; … … 291 294 int PARALLEL_SERIAL; 292 295 char *MANUAL_UNIQUER; 296 297 int SKIP_PARALLEL_GROUPS; 293 298 294 299 int PARALLEL_REGIONS_MANUAL; … … 336 341 int SyntheticPhotometry; 337 342 343 int USE_MCAL_PSF_FOR_STACK_APER; 344 338 345 char *PhotcodeList; 339 346 … … 404 411 int findMosaics PROTO((Catalog *catalog, int Ncatalog, int doMosaicList)); 405 412 413 void clearImages (void); 414 void checkImages (char *name); 415 int dumpMags (FILE *fout, Catalog *catalog, int Ncatalog); 416 406 417 void makeMosaics (Image *image, off_t Nimage, int mergeMcal); 407 418 Mosaic *getMosaicForImage (off_t im); … … 422 433 off_t getImageEntry PROTO((off_t meas, int cat)); 423 434 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)); 435 float getMcal PROTO((off_t meas, int cat, dvoMagClassType class)); 426 436 float getMflat PROTO((off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog)); 427 437 float getMgrid PROTO((off_t meas, int cat)); 428 438 float getMmos PROTO((off_t meas, int cat)); 429 float getMrel PROTO((Catalog *catalog, off_t meas, int cat ));439 float getMrel PROTO((Catalog *catalog, off_t meas, int cat, dvoMagClassType class, dvoMagSourceType source)); 430 440 short getUbercalDist PROTO((off_t meas, int cat)); 431 441 float getCenterOffset PROTO((off_t meas, int cat, Measure *measure, unsigned int *myID)); -
branches/czw_branch/20170908/Ohana/src/relphot/src/BrightCatalog.c
r39478 r40477 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 ); -
branches/czw_branch/20170908/Ohana/src/relphot/src/GridOps.c
r39632 r40477 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 -
branches/czw_branch/20170908/Ohana/src/relphot/src/ImageMagIO.c
r37037 r40477 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 ); -
branches/czw_branch/20170908/Ohana/src/relphot/src/ImageOps.c
r39643 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/relphot/src/ImageSubset.c
r39478 r40477 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); -
branches/czw_branch/20170908/Ohana/src/relphot/src/MosaicOps.c
r39632 r40477 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; -
branches/czw_branch/20170908/Ohana/src/relphot/src/StarOps.c
r40019 r40477 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; -
branches/czw_branch/20170908/Ohana/src/relphot/src/args.c
r39926 r40477 136 136 remove_argument (N, &argc, argv); 137 137 } 138 SKIP_PARALLEL_GROUPS = 0; 139 if ((N = get_argument (argc, argv, "-skip-parallel-groups"))) { 140 remove_argument (N, &argc, argv); 141 SKIP_PARALLEL_GROUPS = atoi(argv[N]); 142 remove_argument (N, &argc, argv); 143 } 138 144 139 145 // elements needed for parallel regions / parallel images … … 325 331 remove_argument (N, &argc, argv); 326 332 CALIBRATE_STACKS_AND_WARPS = TRUE; 333 } 334 USE_MCAL_PSF_FOR_STACK_APER = FALSE; 335 if ((N = get_argument (argc, argv, "-use-mcal-psf-for-stack-aper"))) { 336 remove_argument (N, &argc, argv); 337 USE_MCAL_PSF_FOR_STACK_APER = TRUE; 327 338 } 328 339 … … 544 555 PARALLEL_MANUAL = FALSE; 545 556 PARALLEL_SERIAL = FALSE; 557 SKIP_PARALLEL_GROUPS = 0; 546 558 547 559 HOST_ID = 0; … … 694 706 remove_argument (N, &argc, argv); 695 707 KEEP_UBERCAL = FALSE; 708 } 709 710 USE_MCAL_PSF_FOR_STACK_APER = FALSE; 711 if ((N = get_argument (argc, argv, "-use-mcal-psf-for-stack-aper"))) { 712 remove_argument (N, &argc, argv); 713 USE_MCAL_PSF_FOR_STACK_APER = TRUE; 696 714 } 697 715 -
branches/czw_branch/20170908/Ohana/src/relphot/src/bcatalog.c
r39641 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/relphot/src/launch_region_hosts.c
r39511 r40477 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 -
branches/czw_branch/20170908/Ohana/src/relphot/src/liststats.c
r39648 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/relphot/src/load_images.c
r39642 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/relphot/src/plot_scatter.c
r37037 r40477 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 -
branches/czw_branch/20170908/Ohana/src/relphot/src/plotstuff.c
r39457 r40477 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; -
branches/czw_branch/20170908/Ohana/src/relphot/src/reload_catalogs.c
r39926 r40477 180 180 for (i = 0; i < Ngroups; i++) { 181 181 // update only a group of unique machines at a time 182 if (i < SKIP_PARALLEL_GROUPS) continue; 182 183 reload_catalog_parallel_group (&groups[i], sky, imageFile); 183 184 } … … 247 248 if (SYNTH_ZERO_POINTS) { strextend (&command, "-synthphot-zpts %s", SYNTH_ZERO_POINTS); } 248 249 if (USE_BASIC_CHECK) { strextend (&command, "-basic-image-search"); } 250 if (USE_MCAL_PSF_FOR_STACK_APER) { strextend (&command, "-use-mcal-psf-for-stack-aper"); } 249 251 250 252 if (!(STAGES & STAGE_CHIP)) { strextend (&command, "-skip-chip"); } -
branches/czw_branch/20170908/Ohana/src/relphot/src/relphot_images.c
r39643 r40477 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)) { -
branches/czw_branch/20170908/Ohana/src/relphot/src/relphot_objects.c
r39926 r40477 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"); } -
branches/czw_branch/20170908/Ohana/src/relphot/src/relphot_parallel_images.c
r39643 r40477 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); -
branches/czw_branch/20170908/Ohana/src/relphot/src/relphot_parallel_regions.c
r39643 r40477 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); -
branches/czw_branch/20170908/Ohana/src/relphot/src/relphot_synthphot_catalog.c
r38062 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/relphot/src/select_images.c
r39648 r40477 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 ++; -
branches/czw_branch/20170908/Ohana/src/relphot/src/setMrelCatalog.c
r39926 r40477 2 2 3 3 # if (0) 4 # define TEST_OBJ_ID 0x000 0000e5 # define TEST_CAT_ID 0x0000 76ee4 # define TEST_OBJ_ID 0x000149b0 5 # define TEST_CAT_ID 0x00000001 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 // XXX EAM : this was int SNvalue -- isfinite(SNvalue) would always be finite 636 float SNvalue = isfinite(measure[k].dM) ? 1.0 / hypot (measure[k].dM, MIN_ERROR) : NAN; 637 int psfQFperfAboveLimit = isfinite(SNvalue) && isfinite(measure[k].psfQFperf) && (measure[k].psfQFperf > 0.95); 638 639 // ** determine the BEST level 640 int bestLevel = 0; 641 if (!isPrimary && !psfQFperfAboveLimit) bestLevel = 1; 642 if ( isPrimary && !psfQFperfAboveLimit) bestLevel = 2; 643 if (!isPrimary && psfQFperfAboveLimit) bestLevel = 3; 644 if ( isPrimary && psfQFperfAboveLimit) bestLevel = 4; 645 646 // here is the rule for choosing the best value: 647 float bestValue = (bestLevel > 2) ? SNvalue : measure[k].psfQFperf; 648 649 // if we have not reached this level before, set the new level 650 if (bestLevelMax < bestLevel) { 651 bestValueMax = bestValue; 652 bestLevelMax = bestLevel; 653 bestEntryMax = k; 654 } 655 // if we have reached this level before, set the new value if we beat the old one 656 if ((bestLevelMax == bestLevel) && (bestValueMax < bestValue)) { 657 bestValueMax = bestValue; 658 bestEntryMax = k; 659 } 660 myAssert (bestEntryMax > -1, "this should not happen"); 661 662 // ** determine the PRIMARY level 663 int primaryLevel = 0; 664 if ( isPrimary && !psfQFperfAboveLimit) primaryLevel = 1; 665 if ( isPrimary && psfQFperfAboveLimit) primaryLevel = 2; 666 667 // here is the rule for choosing the PRIMARY value: 668 float primaryValue = 0.0; 669 if (primaryLevel == 1) { primaryValue = measure[k].psfQFperf; } 670 if (primaryLevel == 2) { primaryValue = SNvalue; } 671 672 // if we have not reached this level before, set the new level 673 if (isPrimary && (primaryLevelMax < primaryLevel)) { 674 primaryValueMax = primaryValue; 675 primaryLevelMax = primaryLevel; 676 primaryEntryMax = k; 677 } 678 // if we have reached this level before, set the new value if we beat the old one 679 if (isPrimary && (primaryLevelMax == primaryLevel) && (primaryValueMax < primaryValue)) { 680 primaryValueMax = primaryValue; 681 primaryEntryMax = k; 682 } 683 } 684 685 // if we do not have a stack measurement for this photcode, skip everything below 686 if (!haveStack) continue; 687 688 // now we have a BEST and a PRIMARY entry (may be the same entry) 689 690 off_t meas = bestEntryMax; 691 off_t measSeq = meas + measureOffset; 692 693 myAssert (meas >= 0, "this should not happen"); 694 695 // measurements without an image are either external reference photometry or 696 // data for which the associated image has not been loaded (probably because of 697 // overlaps). we only want measurements associated with stack images in this loop 698 699 // match measurement to its image (this is just a check, right?) 700 if (getImageEntry (measSeq, cat) < 0) { 622 701 // measurements without an image are either external reference photometry or 623 702 // 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); 703 // overlaps). Msys + measure.Mcal is our best guess of the true magnitude 704 McalPSF = measure[meas].McalPSF; // check that this is zero for loaded REF value 705 McalAPER = McalPSF; // check that this is zero for loaded REF value 706 Mmos = 0.0; 707 Mgrid = 0.0; 708 } else { 709 McalPSF = getMcal (measSeq, cat, MAG_CLASS_PSF); 710 McalAPER = USE_MCAL_PSF_FOR_STACK_APER ? getMcal (measSeq, cat, MAG_CLASS_PSF) : getMcal (measSeq, cat, MAG_CLASS_KRON); 711 Mmos = getMmos (measSeq, cat); 712 Mgrid = getMgrid (measSeq, cat); 713 } 714 715 // ** Here is the math to relate mag,zp to flux 675 716 676 717 // flux_cgs : erg sec^1 cm^-2 Hz^-1 … … 703 744 // flux_Jy = flux_inst * ten(-0.4*ZP + 3.56) 704 745 746 // get the zero point for the selected image 747 // Use a different zero point for the PSF-like and APERTURE-like magnitudes 748 float zpPSF = PhotZeroPoint (&measure[meas], &average[0], &secfilt[0]) - (McalPSF + Mmos + Mgrid); 749 float zpAPER = PhotZeroPoint (&measure[meas], &average[0], &secfilt[0]) - (McalAPER + Mmos + Mgrid); 750 705 751 // zpFactor to go from instrumental flux to Janskies 706 float zpFactor = pow(10.0, -0.4*zp + 3.56); 752 float zpFactorPSF = pow(10.0, -0.4*zpPSF + 3.56); 753 float zpFactorAPER = pow(10.0, -0.4*zpAPER + 3.56); 707 754 708 755 // 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;756 secfilt[Nsec].FpsfStk = zpFactorPSF * measure[meas].FluxPSF; 757 secfilt[Nsec].dFpsfStk = zpFactorPSF * measure[meas].dFluxPSF; 758 secfilt[Nsec].FkronStk = zpFactorAPER * measure[meas].FluxKron; 759 secfilt[Nsec].dFkronStk = zpFactorAPER * measure[meas].dFluxKron; 760 secfilt[Nsec].FapStk = zpFactorAPER * measure[meas].FluxAp; 714 761 715 762 // NOTE: for PV3, apFluxErr is broken (see pmSourcePhotometry.c:245). we are going to 716 763 // use PSF flux error instead here: 717 // secfilt[Nsec].dFapStk = zpFactor * measure[k].dFluxAp;718 secfilt[Nsec].dFapStk = zpFactor * measure[k].dFluxPSF;764 // secfilt[Nsec].dFapStk = zpFactorAPER * measure[meas].dFluxAp; 765 secfilt[Nsec].dFapStk = zpFactorAPER * measure[meas].dFluxPSF; 719 766 720 767 // 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; 768 secfilt[Nsec].MpsfStk = (measure[meas].FluxPSF > 0.0) ? 8.9 - 2.5*log10(secfilt[Nsec].FpsfStk) : NAN; 769 secfilt[Nsec].MkronStk = (measure[meas].FluxKron > 0.0) ? 8.9 - 2.5*log10(secfilt[Nsec].FkronStk) : NAN; 770 secfilt[Nsec].MapStk = (measure[meas].FluxAp > 0.0) ? 8.9 - 2.5*log10(secfilt[Nsec].FapStk) : NAN; 771 772 // record the measurement which gave the best value 773 secfilt[Nsec].stackBestOff = (bestEntryMax == -1) ? -1 : bestEntryMax + measureOffset; 726 774 myAssert (secfilt[Nsec].stackBestOff <= catalog[0].Nmeasure, "stackBestOff out of range"); 727 775 728 secfilt[Nsec].Nstack = Nstack; 776 // record the selected primary measurement 777 secfilt[Nsec].stackPrmryOff = (primaryEntryMax == -1) ? -1 : primaryEntryMax + measureOffset; 778 myAssert (secfilt[Nsec].stackPrmryOff <= catalog[0].Nmeasure, "stackPrmryOff out of range"); 779 780 // this is the selected measurement used by secfilt[] 781 measure[meas].dbFlags |= ID_MEAS_STACK_PHOT_SRC; 782 if (Nprimary) { 783 secfilt[Nsec].flags |= ID_SECF_STACK_PRIMARY; 784 if (Nprimary > 1) { 785 secfilt[Nsec].flags |= ID_SECF_STACK_PRIMARY_MULTIPLE; 786 } 787 } 788 789 // stack measurement used for 'best' was a detection (not forced from the other bands) 790 if ((measure[bestEntryMax].photFlags2 & 0x00000004) == 0) { 791 secfilt[Nsec].flags |= ID_SECF_STACK_BESTDET; 792 } 793 794 // stack measurement used for 'primary' was a detection (not forced from the other bands) 795 if ((primaryEntryMax >= 0) && ((measure[primaryEntryMax].photFlags2 & 0x00000004) == 0)) { 796 secfilt[Nsec].flags |= ID_SECF_STACK_PRIMDET; 797 } 798 799 secfilt[Nsec].flags |= ID_SECF_HAS_PS1_STACK; 800 801 // NOTE: negative and insignificant flux values are allowed, but not NAN flux values 802 // float Finst = PhotFluxInst (&measure[meas], MAG_CLASS_PSF); 803 804 // data quality assessment 805 isBad |= (measure[meas].photFlags & photcodes[Ns][0].photomBadMask); 806 isBad |= (measure[meas].psfQF < 0.85); 807 isBad |= isnan(measure[meas].psfQF); 808 isBad |= measure[meas].dM > 0.2; // S/N < 5.0 809 810 isSuspect |= (measure[meas].photFlags & photcodes[Ns][0].photomPoorMask); 811 isSuspect |= (measure[meas].psfQFperf < 0.85); 812 813 if (!isSuspect && !isBad) { 814 NstackGood ++; 815 } 816 if (isSuspect && !isBad) { 817 NstackSuspect ++; 818 } 819 820 secfilt[Nsec].Nstack = NstackMeas; 729 821 secfilt[Nsec].NstackDet = NstackDet; 730 822 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 823 } // Nsecfilt loop 748 824 … … 755 831 756 832 int PrimaryIsBest = TRUE; 757 for ( Ns = 0; Ns < Nphotcodes; Ns++) {833 for (int Ns = 0; Ns < Nphotcodes; Ns++) { 758 834 if (!(secfilt[Ns].flags & ID_SECF_HAS_PS1_STACK)) continue; // no stack detection in PS1, nothing is best 759 835 if (secfilt[Ns].flags & ID_SECF_STACK_PRIMARY) continue; // primary stack detection is best … … 780 856 // * no grid, no mosaic, no 2MASS, no SYNTH, no Ubercal, no flatcorr 781 857 // analysis is done on flux, not mags (as the faintest objects will be nearly insignificant) 858 859 // Although I calculate McalAPER for exposures, I am only using McalPSF for warps.. 860 // Note in StarOps.c:setMcalOutput I am setting measure->McalAPER to image->McalPSF for 861 // chips and warps, but not stacks 862 782 863 int setMrelAverageForcedWarp (Catalog *catalog, int cat, off_t ave, int Nsecfilt, FlatCorrectionTable *flatcorr, SetMrelInfo *results) { 783 864 OHANA_UNUSED_PARAM(flatcorr); … … 857 938 // data for which the associated image has not been loaded (probably because of 858 939 // 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 value940 Mcal = measure[k].McalPSF; // check that this is zero for loaded REF value 860 941 } 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); 942 Mcal = getMcal (meas, cat, MAG_CLASS_PSF); 864 943 if (isnan(Mcal)) SKIP_THIS_MEAS(Ncal); 865 944 } -
branches/czw_branch/20170908/Ohana/src/relphot/src/setMrelFinal.c
r39632 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/relphot/src/share_image_mags.c
r36630 r40477 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; -
branches/czw_branch/20170908/Ohana/src/relphot/src/share_mean_mags.c
r39457 r40477 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 -
branches/czw_branch/20170908/Ohana/src/relphot/src/synthetic_mags.c
r39457 r40477 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; -
branches/czw_branch/20170908/Ohana/src/tools/src/fields.c
r38441 r40477 96 96 } 97 97 } 98 // we are checking each extension to see if it matches the regex. 98 99 if (!regexec (&preg, extname, 0, NULL, 0)) { 99 100 GotField &= print_fields (filename, extname, &header, argc, argv); … … 105 106 Nextend ++; 106 107 108 // this implementation is very inefficient! 109 // since we are checking each header for a regex, we should 110 // loop over all extensions once. the function below reads the 111 // entire file a second time 107 112 GotFile &= gfits_read_Xheader (filename, &header, Nextend); 108 113 continue; -
branches/czw_branch/20170908/Ohana/src/uniphot/include/setphot.h
r39926 r40477 11 11 12 12 typedef struct { 13 float Mcal; 13 float McalPSF; 14 float McalAPER; 14 15 float dMcal; 15 16 unsigned int imageID; -
branches/czw_branch/20170908/Ohana/src/uniphot/src/ImageSubset.c
r37043 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/uniphot/src/dumpresult.c
r31160 r40477 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; -
branches/czw_branch/20170908/Ohana/src/uniphot/src/fit_groups.c
r31160 r40477 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); -
branches/czw_branch/20170908/Ohana/src/uniphot/src/match_zpts_to_images.c
r37807 r40477 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; -
branches/czw_branch/20170908/Ohana/src/uniphot/src/update_catalog_setastrom.c
r39288 r40477 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; -
branches/czw_branch/20170908/Ohana/src/uniphot/src/update_catalog_setphot.c
r39926 r40477 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) { -
branches/czw_branch/20170908/Ohana/src/uniphot/src/update_catalog_uniphot.c
r33654 r40477 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 } -
branches/czw_branch/20170908/Ohana/src/uniphot/src/update_dvo_uniphot.c
r38986 r40477 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.
