sotodlib 0.6.9.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sotodlib-0.6.9.1/LICENSE +21 -0
- sotodlib-0.6.9.1/MANIFEST.in +4 -0
- sotodlib-0.6.9.1/PKG-INFO +60 -0
- sotodlib-0.6.9.1/README.md +13 -0
- sotodlib-0.6.9.1/pyproject.toml +88 -0
- sotodlib-0.6.9.1/setup.cfg +4 -0
- sotodlib-0.6.9.1/setup.py +77 -0
- sotodlib-0.6.9.1/sotodlib/__init__.py +30 -0
- sotodlib-0.6.9.1/sotodlib/_version.py +21 -0
- sotodlib-0.6.9.1/sotodlib/coords/__init__.py +11 -0
- sotodlib-0.6.9.1/sotodlib/coords/demod.py +238 -0
- sotodlib-0.6.9.1/sotodlib/coords/det_match.py +1014 -0
- sotodlib-0.6.9.1/sotodlib/coords/fp_containers.py +836 -0
- sotodlib-0.6.9.1/sotodlib/coords/healpix_utils.py +152 -0
- sotodlib-0.6.9.1/sotodlib/coords/helpers.py +704 -0
- sotodlib-0.6.9.1/sotodlib/coords/local.py +501 -0
- sotodlib-0.6.9.1/sotodlib/coords/optics.py +712 -0
- sotodlib-0.6.9.1/sotodlib/coords/planets.py +849 -0
- sotodlib-0.6.9.1/sotodlib/coords/plotting.py +175 -0
- sotodlib-0.6.9.1/sotodlib/coords/pmat.py +745 -0
- sotodlib-0.6.9.1/sotodlib/coords/pointing_model.py +366 -0
- sotodlib-0.6.9.1/sotodlib/core/__init__.py +20 -0
- sotodlib-0.6.9.1/sotodlib/core/axisman.py +1065 -0
- sotodlib-0.6.9.1/sotodlib/core/axisman_io.py +377 -0
- sotodlib-0.6.9.1/sotodlib/core/axisman_util.py +48 -0
- sotodlib-0.6.9.1/sotodlib/core/context.py +610 -0
- sotodlib-0.6.9.1/sotodlib/core/flagman.py +376 -0
- sotodlib-0.6.9.1/sotodlib/core/g3_core.py +109 -0
- sotodlib-0.6.9.1/sotodlib/core/hardware.py +347 -0
- sotodlib-0.6.9.1/sotodlib/core/metadata/__init__.py +22 -0
- sotodlib-0.6.9.1/sotodlib/core/metadata/cli.py +212 -0
- sotodlib-0.6.9.1/sotodlib/core/metadata/common.py +78 -0
- sotodlib-0.6.9.1/sotodlib/core/metadata/detdb.py +593 -0
- sotodlib-0.6.9.1/sotodlib/core/metadata/loader.py +1166 -0
- sotodlib-0.6.9.1/sotodlib/core/metadata/manifest.py +960 -0
- sotodlib-0.6.9.1/sotodlib/core/metadata/obsdb.py +521 -0
- sotodlib-0.6.9.1/sotodlib/core/metadata/obsfiledb.py +911 -0
- sotodlib-0.6.9.1/sotodlib/core/metadata/resultset.py +363 -0
- sotodlib-0.6.9.1/sotodlib/core/resources.py +101 -0
- sotodlib-0.6.9.1/sotodlib/core/util.py +101 -0
- sotodlib-0.6.9.1/sotodlib/flag_utils.py +245 -0
- sotodlib-0.6.9.1/sotodlib/g3_condition.py +127 -0
- sotodlib-0.6.9.1/sotodlib/g3_filter.py +66 -0
- sotodlib-0.6.9.1/sotodlib/g3_sim.py +204 -0
- sotodlib-0.6.9.1/sotodlib/hwp/__init__.py +12 -0
- sotodlib-0.6.9.1/sotodlib/hwp/g3thwp.py +2044 -0
- sotodlib-0.6.9.1/sotodlib/hwp/hwp.py +697 -0
- sotodlib-0.6.9.1/sotodlib/hwp/hwp_angle_model.py +108 -0
- sotodlib-0.6.9.1/sotodlib/hwp/sim_hwp.py +182 -0
- sotodlib-0.6.9.1/sotodlib/io/__init__.py +7 -0
- sotodlib-0.6.9.1/sotodlib/io/bookbinder.py +1680 -0
- sotodlib-0.6.9.1/sotodlib/io/check_book.py +402 -0
- sotodlib-0.6.9.1/sotodlib/io/datapkg_completion.py +725 -0
- sotodlib-0.6.9.1/sotodlib/io/datapkg_utils.py +97 -0
- sotodlib-0.6.9.1/sotodlib/io/g3thk_db.py +624 -0
- sotodlib-0.6.9.1/sotodlib/io/g3thk_utils.py +138 -0
- sotodlib-0.6.9.1/sotodlib/io/g3tsmurf_db.py +565 -0
- sotodlib-0.6.9.1/sotodlib/io/g3tsmurf_utils.py +627 -0
- sotodlib-0.6.9.1/sotodlib/io/hk_utils.py +468 -0
- sotodlib-0.6.9.1/sotodlib/io/hkdb.py +738 -0
- sotodlib-0.6.9.1/sotodlib/io/imprinter.py +2158 -0
- sotodlib-0.6.9.1/sotodlib/io/imprinter_cli.py +372 -0
- sotodlib-0.6.9.1/sotodlib/io/imprinter_utils.py +361 -0
- sotodlib-0.6.9.1/sotodlib/io/load.py +605 -0
- sotodlib-0.6.9.1/sotodlib/io/load_book.py +1013 -0
- sotodlib-0.6.9.1/sotodlib/io/load_smurf.py +3179 -0
- sotodlib-0.6.9.1/sotodlib/io/load_toast_h5.py +207 -0
- sotodlib-0.6.9.1/sotodlib/io/metadata.py +304 -0
- sotodlib-0.6.9.1/sotodlib/io/so_ufm.py +265 -0
- sotodlib-0.6.9.1/sotodlib/mapmaking/__init__.py +8 -0
- sotodlib-0.6.9.1/sotodlib/mapmaking/bench.py +141 -0
- sotodlib-0.6.9.1/sotodlib/mapmaking/demod_mapmaker.py +746 -0
- sotodlib-0.6.9.1/sotodlib/mapmaking/log.py +91 -0
- sotodlib-0.6.9.1/sotodlib/mapmaking/ml_mapmaker.py +792 -0
- sotodlib-0.6.9.1/sotodlib/mapmaking/noise_model.py +398 -0
- sotodlib-0.6.9.1/sotodlib/mapmaking/obs_grouping.py +234 -0
- sotodlib-0.6.9.1/sotodlib/mapmaking/pointing_matrix.py +23 -0
- sotodlib-0.6.9.1/sotodlib/mapmaking/utils.py +800 -0
- sotodlib-0.6.9.1/sotodlib/obs_ops/__init__.py +3 -0
- sotodlib-0.6.9.1/sotodlib/obs_ops/sources.py +70 -0
- sotodlib-0.6.9.1/sotodlib/obs_ops/splits.py +177 -0
- sotodlib-0.6.9.1/sotodlib/obs_ops/utils.py +84 -0
- sotodlib-0.6.9.1/sotodlib/preprocess/__init__.py +3 -0
- sotodlib-0.6.9.1/sotodlib/preprocess/pcore.py +622 -0
- sotodlib-0.6.9.1/sotodlib/preprocess/preprocess_plot.py +597 -0
- sotodlib-0.6.9.1/sotodlib/preprocess/preprocess_util.py +1224 -0
- sotodlib-0.6.9.1/sotodlib/preprocess/processes.py +2550 -0
- sotodlib-0.6.9.1/sotodlib/qa/__init__.py +1 -0
- sotodlib-0.6.9.1/sotodlib/qa/metrics.py +600 -0
- sotodlib-0.6.9.1/sotodlib/qa/quality_reports/__init__.py +1 -0
- sotodlib-0.6.9.1/sotodlib/qa/quality_reports/plots.py +409 -0
- sotodlib-0.6.9.1/sotodlib/qa/quality_reports/report_data.py +538 -0
- sotodlib-0.6.9.1/sotodlib/scripts/__init__.py +8 -0
- sotodlib-0.6.9.1/sotodlib/scripts/hardware_info.py +31 -0
- sotodlib-0.6.9.1/sotodlib/scripts/hardware_plot.py +104 -0
- sotodlib-0.6.9.1/sotodlib/scripts/hardware_sim.py +53 -0
- sotodlib-0.6.9.1/sotodlib/scripts/hardware_trim.py +112 -0
- sotodlib-0.6.9.1/sotodlib/scripts/so_batch_control.py +230 -0
- sotodlib-0.6.9.1/sotodlib/sim_flags.py +185 -0
- sotodlib-0.6.9.1/sotodlib/sim_hardware.py +604 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/__init__.py +2 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/analyze_bright_ptsrc.py +1299 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/calibration/__init__.py +0 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/calibration/wiregrid.py +445 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/check_book.py +194 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/cleanup_level2.py +224 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/cli.py +122 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/finalize_focal_plane.py +1077 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/generate_reports.py +213 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/jobdb.py +552 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/make_atomic_filterbin_map.py +509 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/make_book.py +118 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/make_cosamp_hk.py +289 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/make_det_info_wafer.py +117 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/make_hwp_solutions.py +363 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/make_ml_map.py +327 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/make_read_det_match.py +163 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/make_source_flags.py +132 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/make_uncal_beam_map.py +396 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/monitor.py +235 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/multilayer_preprocess_tod.py +421 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/preprocess_obs.py +289 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/preprocess_tod.py +437 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/record_qa.py +133 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/update_book_plan.py +248 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/update_det_cal.py +900 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/update_det_match.py +450 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/update_g3thk_database.py +58 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/update_g3tsmurf_db.py +154 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/update_hkdb.py +115 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/update_hwp_angle.py +139 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/update_librarian.py +59 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/update_obsdb.py +365 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/update_preprocess_plots.py +241 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/update_smurf_caldbs.py +557 -0
- sotodlib-0.6.9.1/sotodlib/site_pipeline/util.py +414 -0
- sotodlib-0.6.9.1/sotodlib/toast/__init__.py +35 -0
- sotodlib-0.6.9.1/sotodlib/toast/instrument.py +507 -0
- sotodlib-0.6.9.1/sotodlib/toast/io/__init__.py +16 -0
- sotodlib-0.6.9.1/sotodlib/toast/io/load_book.py +684 -0
- sotodlib-0.6.9.1/sotodlib/toast/io/save_book.py +711 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/__init__.py +26 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/act_sign.py +63 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/corotator.py +180 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/data/hwpss_per_chi.pck +0 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/data/planet_data.h5 +0 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/h_n.py +332 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/load_books.py +317 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/load_context.py +1439 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/load_context_utils.py +826 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/mlmapmaker.py +782 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/mumux_crosstalk_util.py +227 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/readout_filter.py +130 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/save_books.py +297 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/sim_catalog.py +488 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/sim_hwpss.py +372 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/sim_mumux_crosstalk.py +341 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/sim_readout.py +687 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/sim_source.py +1316 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/sim_sso.py +641 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/sim_stimulator.py +324 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/sim_wiregrid.py +279 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/splits.py +643 -0
- sotodlib-0.6.9.1/sotodlib/toast/ops/utils.py +68 -0
- sotodlib-0.6.9.1/sotodlib/toast/scripts/__init__.py +5 -0
- sotodlib-0.6.9.1/sotodlib/toast/scripts/get_wafer_offset.py +193 -0
- sotodlib-0.6.9.1/sotodlib/toast/scripts/make_hardware_maps.py +105 -0
- sotodlib-0.6.9.1/sotodlib/toast/scripts/mapmaker_test.py +339 -0
- sotodlib-0.6.9.1/sotodlib/toast/scripts/so_convert.py +153 -0
- sotodlib-0.6.9.1/sotodlib/toast/scripts/so_map.py +245 -0
- sotodlib-0.6.9.1/sotodlib/toast/scripts/so_sim.py +306 -0
- sotodlib-0.6.9.1/sotodlib/toast/scripts/so_transfer.py +412 -0
- sotodlib-0.6.9.1/sotodlib/toast/sim_focalplane.py +764 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/__init__.py +142 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/data.py +211 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/job.py +200 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/pointing.py +178 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/proc_act.py +46 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/proc_characterize.py +196 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/proc_demodulation.py +136 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/proc_filters.py +300 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/proc_flagging.py +347 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/proc_intervals.py +53 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/proc_mapmaker.py +382 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/proc_mapmaker_filterbin.py +84 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/proc_mapmaker_madam.py +51 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/proc_mapmaker_ml.py +54 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/proc_noise_est.py +260 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/scripting.py +125 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/sim_atm.py +175 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/sim_calibrator.py +82 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/sim_detector_readout.py +199 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/sim_gain_error.py +49 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/sim_noise_model.py +83 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/sim_observe.py +244 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/sim_optical_pickup.py +88 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/sim_sky.py +226 -0
- sotodlib-0.6.9.1/sotodlib/toast/workflows/sim_sources.py +127 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/__init__.py +14 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/apodize.py +115 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/azss.py +453 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/binning.py +116 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/demodulation.py +276 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/deproject.py +122 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/detrend.py +95 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/fft_ops.py +1190 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/filters.py +690 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/flags.py +1163 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/gapfill.py +463 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/jumps.py +800 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/pca.py +369 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/sub_polyf.py +208 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/t2pleakage.py +331 -0
- sotodlib-0.6.9.1/sotodlib/tod_ops/utils.py +73 -0
- sotodlib-0.6.9.1/sotodlib/utils/__init__.py +5 -0
- sotodlib-0.6.9.1/sotodlib/utils/procs_pool.py +142 -0
- sotodlib-0.6.9.1/sotodlib/vis_hardware.py +509 -0
- sotodlib-0.6.9.1/sotodlib.egg-info/PKG-INFO +60 -0
- sotodlib-0.6.9.1/sotodlib.egg-info/SOURCES.txt +261 -0
- sotodlib-0.6.9.1/sotodlib.egg-info/dependency_links.txt +1 -0
- sotodlib-0.6.9.1/sotodlib.egg-info/entry_points.txt +14 -0
- sotodlib-0.6.9.1/sotodlib.egg-info/requires.txt +27 -0
- sotodlib-0.6.9.1/sotodlib.egg-info/top_level.txt +2 -0
- sotodlib-0.6.9.1/tests/__init__.py +7 -0
- sotodlib-0.6.9.1/tests/_helpers.py +435 -0
- sotodlib-0.6.9.1/tests/test_azss.py +113 -0
- sotodlib-0.6.9.1/tests/test_bookbinder.py +100 -0
- sotodlib-0.6.9.1/tests/test_context.py +853 -0
- sotodlib-0.6.9.1/tests/test_coords.py +255 -0
- sotodlib-0.6.9.1/tests/test_core.py +721 -0
- sotodlib-0.6.9.1/tests/test_core_resources.py +36 -0
- sotodlib-0.6.9.1/tests/test_data.py +84 -0
- sotodlib-0.6.9.1/tests/test_demod_map.py +128 -0
- sotodlib-0.6.9.1/tests/test_demod_mapmaker.py +90 -0
- sotodlib-0.6.9.1/tests/test_detdb.py +112 -0
- sotodlib-0.6.9.1/tests/test_flags.py +63 -0
- sotodlib-0.6.9.1/tests/test_hardware.py +136 -0
- sotodlib-0.6.9.1/tests/test_hkdb.py +120 -0
- sotodlib-0.6.9.1/tests/test_hwp.py +108 -0
- sotodlib-0.6.9.1/tests/test_hwp_solution.py +71 -0
- sotodlib-0.6.9.1/tests/test_imprinter.py +153 -0
- sotodlib-0.6.9.1/tests/test_jobdb.py +126 -0
- sotodlib-0.6.9.1/tests/test_mapmaker_pointing.py +246 -0
- sotodlib-0.6.9.1/tests/test_metadata.py +280 -0
- sotodlib-0.6.9.1/tests/test_obsdb.py +105 -0
- sotodlib-0.6.9.1/tests/test_obsfiledb.py +162 -0
- sotodlib-0.6.9.1/tests/test_pmat.py +81 -0
- sotodlib-0.6.9.1/tests/test_pointing_model.py +149 -0
- sotodlib-0.6.9.1/tests/test_preprocess.py +110 -0
- sotodlib-0.6.9.1/tests/test_proddb.py +49 -0
- sotodlib-0.6.9.1/tests/test_psd.py +117 -0
- sotodlib-0.6.9.1/tests/test_sim_hwpss.py +198 -0
- sotodlib-0.6.9.1/tests/test_sim_mumux_crosstalk.py +119 -0
- sotodlib-0.6.9.1/tests/test_sim_readout.py +56 -0
- sotodlib-0.6.9.1/tests/test_sim_stimulator.py +47 -0
- sotodlib-0.6.9.1/tests/test_sim_wiregrid.py +66 -0
- sotodlib-0.6.9.1/tests/test_subpolyf.py +108 -0
- sotodlib-0.6.9.1/tests/test_t2pleakage.py +86 -0
- sotodlib-0.6.9.1/tests/test_toast_books.py +158 -0
- sotodlib-0.6.9.1/tests/test_toast_context.py +61 -0
- sotodlib-0.6.9.1/tests/test_toast_splits.py +129 -0
- sotodlib-0.6.9.1/tests/test_toast_workflow.py +68 -0
- sotodlib-0.6.9.1/tests/test_tod_ops.py +319 -0
sotodlib-0.6.9.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018-2025 Simons Observatory, and individual contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sotodlib
|
|
3
|
+
Version: 0.6.9.1
|
|
4
|
+
Summary: Simons Observatory TOD Simulation and Processing
|
|
5
|
+
Maintainer: Simons Observatory Collaboration
|
|
6
|
+
Maintainer-email: so_software@simonsobservatory.org
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Source, https://github.com/simonsobs/sotodlib
|
|
9
|
+
Project-URL: Issue Tracker, https://github.com/simonsobs/sotodlib/issues
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Requires-Python: <3.13,>=3.9
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: numpy
|
|
22
|
+
Requires-Dist: scipy
|
|
23
|
+
Requires-Dist: matplotlib
|
|
24
|
+
Requires-Dist: quaternionarray
|
|
25
|
+
Requires-Dist: PyYAML
|
|
26
|
+
Requires-Dist: toml
|
|
27
|
+
Requires-Dist: skyfield
|
|
28
|
+
Requires-Dist: so3g
|
|
29
|
+
Requires-Dist: pixell>=0.23.0
|
|
30
|
+
Requires-Dist: pytest
|
|
31
|
+
Requires-Dist: scikit-image
|
|
32
|
+
Requires-Dist: pyfftw
|
|
33
|
+
Requires-Dist: numdifftools
|
|
34
|
+
Requires-Dist: psycopg2-binary
|
|
35
|
+
Requires-Dist: lmfit
|
|
36
|
+
Requires-Dist: flacarray>=0.3
|
|
37
|
+
Provides-Extra: site-pipeline
|
|
38
|
+
Requires-Dist: influxdb; extra == "site-pipeline"
|
|
39
|
+
Requires-Dist: venn; extra == "site-pipeline"
|
|
40
|
+
Requires-Dist: let-me-scroll-it; extra == "site-pipeline"
|
|
41
|
+
Requires-Dist: plotly; extra == "site-pipeline"
|
|
42
|
+
Requires-Dist: pandas; extra == "site-pipeline"
|
|
43
|
+
Requires-Dist: alphashape; extra == "site-pipeline"
|
|
44
|
+
Provides-Extra: tests
|
|
45
|
+
Requires-Dist: socs; extra == "tests"
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# SO TOD Library
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
[](https://sotodlib.readthedocs.io/en/latest/?badge=latest)
|
|
53
|
+
[](https://pypi.org/project/sotodlib)
|
|
54
|
+
[](https://pypi.org/project/sotodlib)
|
|
55
|
+
|
|
56
|
+
Tools for working with real and simulated time ordered data.
|
|
57
|
+
|
|
58
|
+
Full documentation here:
|
|
59
|
+
|
|
60
|
+
https://sotodlib.readthedocs.io/en/latest/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
# SO TOD Library
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+
[](https://sotodlib.readthedocs.io/en/latest/?badge=latest)
|
|
6
|
+
[](https://pypi.org/project/sotodlib)
|
|
7
|
+
[](https://pypi.org/project/sotodlib)
|
|
8
|
+
|
|
9
|
+
Tools for working with real and simulated time ordered data.
|
|
10
|
+
|
|
11
|
+
Full documentation here:
|
|
12
|
+
|
|
13
|
+
https://sotodlib.readthedocs.io/en/latest/
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools", "versioneer[toml]==0.29", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sotodlib"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
description = "Simons Observatory TOD Simulation and Processing"
|
|
9
|
+
license = "MIT"
|
|
10
|
+
maintainers = [
|
|
11
|
+
{name = "Simons Observatory Collaboration"},
|
|
12
|
+
{email = "so_software@simonsobservatory.org"},
|
|
13
|
+
]
|
|
14
|
+
requires-python = ">=3.9, <3.13"
|
|
15
|
+
dependencies = [
|
|
16
|
+
"numpy",
|
|
17
|
+
"scipy",
|
|
18
|
+
"matplotlib",
|
|
19
|
+
"quaternionarray",
|
|
20
|
+
"PyYAML",
|
|
21
|
+
"toml",
|
|
22
|
+
"skyfield",
|
|
23
|
+
"so3g",
|
|
24
|
+
"pixell>=0.23.0",
|
|
25
|
+
"pytest",
|
|
26
|
+
"scikit-image",
|
|
27
|
+
"pyfftw",
|
|
28
|
+
"numdifftools",
|
|
29
|
+
"psycopg2-binary",
|
|
30
|
+
"lmfit",
|
|
31
|
+
"flacarray>=0.3",
|
|
32
|
+
]
|
|
33
|
+
dynamic=["version"]
|
|
34
|
+
classifiers = [
|
|
35
|
+
"Development Status :: 4 - Beta",
|
|
36
|
+
"Environment :: Console",
|
|
37
|
+
"Intended Audience :: Science/Research",
|
|
38
|
+
"Topic :: Scientific/Engineering :: Astronomy",
|
|
39
|
+
"Programming Language :: Python :: 3.9",
|
|
40
|
+
"Programming Language :: Python :: 3.10",
|
|
41
|
+
"Programming Language :: Python :: 3.11",
|
|
42
|
+
"Programming Language :: Python :: 3.12",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[project.urls]
|
|
46
|
+
"Source" = "https://github.com/simonsobs/sotodlib"
|
|
47
|
+
"Issue Tracker" = "https://github.com/simonsobs/sotodlib/issues"
|
|
48
|
+
|
|
49
|
+
[project.optional-dependencies]
|
|
50
|
+
site_pipeline = [
|
|
51
|
+
"influxdb",
|
|
52
|
+
"venn",
|
|
53
|
+
"let-me-scroll-it",
|
|
54
|
+
"plotly",
|
|
55
|
+
"pandas",
|
|
56
|
+
"alphashape",
|
|
57
|
+
]
|
|
58
|
+
tests = [
|
|
59
|
+
"socs",
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
[project.scripts]
|
|
63
|
+
so_hardware_sim = "sotodlib.scripts.hardware_sim:main"
|
|
64
|
+
so_hardware_plot = "sotodlib.scripts.hardware_plot:main"
|
|
65
|
+
so_hardware_trim = "sotodlib.scripts.hardware_trim:main"
|
|
66
|
+
so_hardware_info = "sotodlib.scripts.hardware_info:main"
|
|
67
|
+
so_batch_control = "sotodlib.scripts.so_batch_control:main"
|
|
68
|
+
so-metadata = "sotodlib.core.metadata.cli:main"
|
|
69
|
+
so-site-pipeline = "sotodlib.site_pipeline.cli:main"
|
|
70
|
+
so-data-package = "sotodlib.io.imprinter_cli:main"
|
|
71
|
+
toast_so_sim = "sotodlib.toast.scripts.so_sim:cli"
|
|
72
|
+
toast_so_map = "sotodlib.toast.scripts.so_map:cli"
|
|
73
|
+
toast_so_transfer = "sotodlib.toast.scripts.so_transfer:cli"
|
|
74
|
+
toast_so_convert = "sotodlib.toast.scripts.so_convert:cli"
|
|
75
|
+
get_wafer_offset = "sotodlib.toast.scripts.get_wafer_offset:main"
|
|
76
|
+
|
|
77
|
+
[tool.versioneer]
|
|
78
|
+
VCS = "git"
|
|
79
|
+
style = "pep440"
|
|
80
|
+
versionfile_source = "sotodlib/_version.py"
|
|
81
|
+
versionfile_build = "sotodlib/_version.py"
|
|
82
|
+
tag_prefix = "v"
|
|
83
|
+
parentdir_prefix = "sotodlib-"
|
|
84
|
+
|
|
85
|
+
[tool.pytest.ini_options]
|
|
86
|
+
addopts = [
|
|
87
|
+
"--import-mode=importlib",
|
|
88
|
+
]
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
import unittest
|
|
6
|
+
|
|
7
|
+
from setuptools import find_packages, setup, Command
|
|
8
|
+
import versioneer
|
|
9
|
+
|
|
10
|
+
# The setup options
|
|
11
|
+
setup_opts = dict()
|
|
12
|
+
|
|
13
|
+
setup_opts["version"] = versioneer.get_version()
|
|
14
|
+
setup_opts["packages"] = find_packages(where=".", exclude="tests")
|
|
15
|
+
|
|
16
|
+
setup_opts["package_data"] = {
|
|
17
|
+
"sotodlib": [
|
|
18
|
+
"toast/ops/data/*"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
setup_opts["include_package_data"] = True
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# Command Class dictionary.
|
|
25
|
+
# Begin with the versioneer command class dictionary.
|
|
26
|
+
cmdcls = versioneer.get_cmdclass()
|
|
27
|
+
|
|
28
|
+
# Class to run unit tests
|
|
29
|
+
|
|
30
|
+
class SOTestCommand(Command):
|
|
31
|
+
|
|
32
|
+
def __init__(self, *args, **kwargs):
|
|
33
|
+
super(SOTestCommand, self).__init__(*args, **kwargs)
|
|
34
|
+
|
|
35
|
+
def initialize_options(self):
|
|
36
|
+
Command.initialize_options(self)
|
|
37
|
+
|
|
38
|
+
def finalize_options(self):
|
|
39
|
+
Command.finalize_options(self)
|
|
40
|
+
self.test_suite = True
|
|
41
|
+
|
|
42
|
+
def mpi_world(self):
|
|
43
|
+
# We could avoid putting this here by defining a custom TextTestRunner
|
|
44
|
+
# that checked the per-process value "under-the-hood" and returned a
|
|
45
|
+
# False value from wasSuccessful() if any process failed.
|
|
46
|
+
comm = None
|
|
47
|
+
if "MPI_DISABLE" not in os.environ:
|
|
48
|
+
try:
|
|
49
|
+
from mpi4py import MPI
|
|
50
|
+
|
|
51
|
+
comm = MPI.COMM_WORLD
|
|
52
|
+
except Exception:
|
|
53
|
+
pass
|
|
54
|
+
return comm
|
|
55
|
+
|
|
56
|
+
def run(self):
|
|
57
|
+
loader = unittest.TestLoader()
|
|
58
|
+
runner = unittest.TextTestRunner(verbosity=2)
|
|
59
|
+
suite = loader.discover("tests", pattern="test_*.py",
|
|
60
|
+
top_level_dir=".")
|
|
61
|
+
ret = 0
|
|
62
|
+
local_ret = runner.run(suite)
|
|
63
|
+
if not local_ret.wasSuccessful():
|
|
64
|
+
ret = 1
|
|
65
|
+
comm = self.mpi_world()
|
|
66
|
+
if comm is not None:
|
|
67
|
+
ret = comm.allreduce(ret)
|
|
68
|
+
sys.exit(ret)
|
|
69
|
+
|
|
70
|
+
# Add our custom test runner
|
|
71
|
+
cmdcls["test"] = SOTestCommand
|
|
72
|
+
|
|
73
|
+
# Add command class to setup options
|
|
74
|
+
setup_opts["cmdclass"] = cmdcls
|
|
75
|
+
|
|
76
|
+
# Do the setup.
|
|
77
|
+
setup(**setup_opts)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Copyright (c) 2018-2021 Simons Observatory.
|
|
2
|
+
# Full license can be found in the top level "LICENSE" file.
|
|
3
|
+
|
|
4
|
+
"""Simons Observatory TOD Simulation and Processing.
|
|
5
|
+
|
|
6
|
+
This package contains tools for simulating and analyzing data from the
|
|
7
|
+
Simons Observatory. It uses multiple external dependencies (some optional).
|
|
8
|
+
See documentation of the various sub-modules for more details.
|
|
9
|
+
|
|
10
|
+
Contents:
|
|
11
|
+
|
|
12
|
+
* core: Container classes for data, metadata, etc.
|
|
13
|
+
* io: Code for reading / writing data.
|
|
14
|
+
* utils: General utility functions and data helper functions.
|
|
15
|
+
* scripts: Commandline entry points.
|
|
16
|
+
* Top level packages for actual data processing.
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from . import _version
|
|
21
|
+
__version__ = _version.get_versions()['version']
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
import logging
|
|
25
|
+
logger = logging.getLogger(__name__)
|
|
26
|
+
_log_fmt = '%(levelname)s: %(name)s: %(message)s'
|
|
27
|
+
_ch = logging.StreamHandler()
|
|
28
|
+
_ch.setLevel(logging.INFO)
|
|
29
|
+
_ch.setFormatter(logging.Formatter(_log_fmt))
|
|
30
|
+
logger.addHandler(_ch)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
# This file was generated by 'versioneer.py' (0.29) from
|
|
3
|
+
# revision-control system data, or from the parent directory name of an
|
|
4
|
+
# unpacked source archive. Distribution tarballs contain a pre-generated copy
|
|
5
|
+
# of this file.
|
|
6
|
+
|
|
7
|
+
import json
|
|
8
|
+
|
|
9
|
+
version_json = '''
|
|
10
|
+
{
|
|
11
|
+
"date": "2025-08-20T17:31:40-0400",
|
|
12
|
+
"dirty": false,
|
|
13
|
+
"error": null,
|
|
14
|
+
"full-revisionid": "1de526e011503cc9e78ec85ac7b0e64209b7a30b",
|
|
15
|
+
"version": "0.6.9.1"
|
|
16
|
+
}
|
|
17
|
+
''' # END VERSION_JSON
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def get_versions():
|
|
21
|
+
return json.loads(version_json)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from .pmat import P
|
|
2
|
+
from .helpers import (
|
|
3
|
+
get_radec, get_horiz, get_footprint, get_wcs_kernel, get_supergeom,
|
|
4
|
+
Timer, DEG, ScalarLastQuat
|
|
5
|
+
)
|
|
6
|
+
from . import planets
|
|
7
|
+
from . import local
|
|
8
|
+
from .plotting import *
|
|
9
|
+
from . import demod
|
|
10
|
+
from . import pointing_model
|
|
11
|
+
from . import healpix_utils
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import so3g
|
|
3
|
+
from pixell import enmap
|
|
4
|
+
|
|
5
|
+
from .. import core, tod_ops, coords
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def make_map(tod,
|
|
9
|
+
P=None, wcs_kernel=None,
|
|
10
|
+
res=0.1 * coords.DEG,
|
|
11
|
+
dsT=None, demodQ=None, demodU=None,
|
|
12
|
+
cuts=None,
|
|
13
|
+
det_weights=None, det_weights_demod=None,
|
|
14
|
+
center_on=None, flip_gamma=True):
|
|
15
|
+
"""Generates maps of temperature and polarization from demodulated HWP
|
|
16
|
+
data. It is assumed that each detector contributes a T signal
|
|
17
|
+
(which has been low-pass filtered to avoid the modulated signal)
|
|
18
|
+
stored in dsT, as well as separate Q and U timestreams,
|
|
19
|
+
corresponding to the cosine-phase (demodQ = Q cos 4 chi) and
|
|
20
|
+
sine-phase (demodU = U sin 4 chi) response of the HWP.
|
|
21
|
+
|
|
22
|
+
The demodQ and demodU signals are assumed to have been computed
|
|
23
|
+
without regard for the polarization angle of the detector, nor the
|
|
24
|
+
on-sky parallactic angle. The impact of these is handled by the
|
|
25
|
+
projection routines in this function.
|
|
26
|
+
|
|
27
|
+
Parameters
|
|
28
|
+
----------
|
|
29
|
+
tod : sotodlib.core.AxisManager
|
|
30
|
+
An AxisManager object
|
|
31
|
+
P : sotodlib.coords.pmat
|
|
32
|
+
Projection Matrix to be used for mapmaking. If None, it is
|
|
33
|
+
generated from `wcs_kernel` or `center_on`.
|
|
34
|
+
wcs_kernel : enlib.wcs.WCS or None, optional
|
|
35
|
+
The WCS object used to generate the output map.
|
|
36
|
+
If None, a new WCS object with a Cartesian projection and a resolution of `res` will be created.
|
|
37
|
+
center_on: None or str
|
|
38
|
+
Name of point source. If specified, Source-centered map with a tangent projection will be made.
|
|
39
|
+
If None, wcs_kernel will be used to generate a projection matrix.
|
|
40
|
+
size: float or None
|
|
41
|
+
If specified, trim source-centored map to a local square with `size`, in radian.
|
|
42
|
+
If None, not trimming will be applied. Only valid when `centor_on` is specified.
|
|
43
|
+
res : float, optional
|
|
44
|
+
The resolution of the output map, in radian.
|
|
45
|
+
dsT : array-like or None, optional
|
|
46
|
+
The input dsT timestream data. If None, the 'dsT' field of `tod` will be used.
|
|
47
|
+
demodQ : array-like or None, optional
|
|
48
|
+
The input demodulated Q timestream data. If None, the 'demodQ' field of `tod` will be used.
|
|
49
|
+
demodU : array-like or None, optional
|
|
50
|
+
The input demodulated U timestream data. If None, the 'demodU' field of `tod` will be used.
|
|
51
|
+
cuts : RangesMatrix or None, optional
|
|
52
|
+
A RangesMatrix that identifies samples that should be excluded from projection operations.
|
|
53
|
+
If None, no cuts will be applied.
|
|
54
|
+
det_weights : array-like or None, optional
|
|
55
|
+
The detector weights to use in the map-making for the dsT timestream.
|
|
56
|
+
det_weights_demod : array-like or None, optional
|
|
57
|
+
The detector weights to use in the map-making for the demodulated Q and U timestreams.
|
|
58
|
+
If both of `det_weights` and `det_weights_demod` are None, uniform detector weights will be used.
|
|
59
|
+
If only one of two are provided, the other weight is provided by `det_weights` = 2 * `det_weights_demod`.
|
|
60
|
+
flip_gamma : bool or None
|
|
61
|
+
Defaults to True. When constructing the pointing matrix,
|
|
62
|
+
reflect the nominal focal plane polarization angles about zero
|
|
63
|
+
(gamma -> -gamma). If you pass in your own P, make sure it
|
|
64
|
+
was constructed with hwp=True.
|
|
65
|
+
|
|
66
|
+
Returns
|
|
67
|
+
-------
|
|
68
|
+
A dictionary which contains:
|
|
69
|
+
'map' : enmap.ndmap
|
|
70
|
+
map of temperature and polarization
|
|
71
|
+
'weighted_map' : enmap.ndmap
|
|
72
|
+
The inverse variance weighted map of temperature and polarization
|
|
73
|
+
'weight' : enmap.ndmap
|
|
74
|
+
The map of inverse variance weights used in the map-making process.
|
|
75
|
+
|
|
76
|
+
"""
|
|
77
|
+
if dsT is None:
|
|
78
|
+
dsT = tod['dsT']
|
|
79
|
+
if demodQ is None:
|
|
80
|
+
demodQ = tod['demodQ']
|
|
81
|
+
if demodU is None:
|
|
82
|
+
demodU = tod['demodU']
|
|
83
|
+
|
|
84
|
+
if flip_gamma is None:
|
|
85
|
+
flip_gamma = True
|
|
86
|
+
|
|
87
|
+
if P is None:
|
|
88
|
+
if center_on is None:
|
|
89
|
+
if wcs_kernel is None:
|
|
90
|
+
wcs_kernel = coords.get_wcs_kernel('car', 0, 0, res)
|
|
91
|
+
P = coords.P.for_tod(
|
|
92
|
+
tod=tod, wcs_kernel=wcs_kernel, cuts=cuts, comps='QU', hwp=flip_gamma)
|
|
93
|
+
else:
|
|
94
|
+
P, X = coords.planets.get_scan_P(tod, planet=center_on, res=res, hwp=flip_gamma)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
if det_weights is None:
|
|
98
|
+
if det_weights_demod is None:
|
|
99
|
+
det_weights_demod = np.ones(tod.dets.count, dtype='float32')
|
|
100
|
+
det_weights = det_weights_demod * 2.
|
|
101
|
+
else:
|
|
102
|
+
if det_weights_demod is None:
|
|
103
|
+
det_weights_demod = det_weights / 2.
|
|
104
|
+
|
|
105
|
+
# T map and weight
|
|
106
|
+
mT_weighted = P.to_map(
|
|
107
|
+
tod=tod, signal=dsT, comps='T', det_weights=det_weights)
|
|
108
|
+
wT = P.to_weights(tod, signal=dsT, comps='T', det_weights=det_weights)
|
|
109
|
+
|
|
110
|
+
# Q/U maps and weights
|
|
111
|
+
mQ_weighted = P.to_map(tod=tod, signal=demodQ, comps='QU',
|
|
112
|
+
det_weights=det_weights_demod)
|
|
113
|
+
mU_weighted = P.to_map(tod=tod, signal=demodU, comps='QU',
|
|
114
|
+
det_weights=det_weights_demod)
|
|
115
|
+
|
|
116
|
+
mQU_weighted = P.zeros()
|
|
117
|
+
mQU_weighted[0][:] = mQ_weighted[0] - mU_weighted[1]
|
|
118
|
+
mQU_weighted[1][:] = mQ_weighted[1] + mU_weighted[0]
|
|
119
|
+
del mQ_weighted, mU_weighted
|
|
120
|
+
|
|
121
|
+
wQU = P.to_weights(tod, signal=demodQ, comps='T',
|
|
122
|
+
det_weights=det_weights_demod)
|
|
123
|
+
|
|
124
|
+
# combine mT_weighted and mQU_weighted into mTQU_weighted
|
|
125
|
+
mTQU_weighted = P.zeros(super_shape=3)
|
|
126
|
+
mTQU_weighted[0] = mT_weighted
|
|
127
|
+
mTQU_weighted[1] = mQU_weighted[0]
|
|
128
|
+
mTQU_weighted[2] = mQU_weighted[1]
|
|
129
|
+
|
|
130
|
+
# combine wT and wQU into wTQU
|
|
131
|
+
wTQU = enmap.zeros((3, 3) + P.geom.shape, wcs=P.geom.wcs)
|
|
132
|
+
wTQU[0][0] = wT
|
|
133
|
+
wTQU[1][1] = wQU
|
|
134
|
+
wTQU[2][2] = wQU
|
|
135
|
+
|
|
136
|
+
# remove weights
|
|
137
|
+
mTQU = P.remove_weights(signal_map=mTQU_weighted,
|
|
138
|
+
weights_map=wTQU, comps='TQU')
|
|
139
|
+
|
|
140
|
+
output = {'map': mTQU,
|
|
141
|
+
'weighted_map': mTQU_weighted,
|
|
142
|
+
'weight': wTQU}
|
|
143
|
+
return output
|
|
144
|
+
|
|
145
|
+
def from_map(tod, signal_map, cuts=None, flip_gamma=True, wrap=False, modulated=False):
|
|
146
|
+
"""
|
|
147
|
+
Generate simulated TOD with HWP from a given signal map.
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
tod : an axisManager object
|
|
151
|
+
signal_map: pixell.enmap.ndmap containing (Tmap, Qmap, Umap) representing the signal.
|
|
152
|
+
cuts (RangesMatrix, optional): Cuts to apply to the data. Default is None.
|
|
153
|
+
flip_gamma (bool, optional): Whether to flip detector coordinate. If you use the HWP, keep it `True`. Default is True.
|
|
154
|
+
wrap (bool, optional): Whether to wrap the simulated data. Default is False.
|
|
155
|
+
modulated (bool, optional): If True, return modulated signal. If False, return the demodulated signal
|
|
156
|
+
(`dsT`, `demodQ`, and `demodU`). Default is False.
|
|
157
|
+
|
|
158
|
+
Returns:
|
|
159
|
+
`modulate==False`: A tuple containing the TOD (np.array) of dsT, demodQ and demodU.
|
|
160
|
+
`modulate==True` : The modulated TOD (np.array)
|
|
161
|
+
|
|
162
|
+
"""
|
|
163
|
+
Tmap, Qmap, Umap = signal_map
|
|
164
|
+
|
|
165
|
+
P = coords.P.for_tod(tod=tod, geom=signal_map.geometry, cuts=cuts,
|
|
166
|
+
comps='QU', hwp=flip_gamma)
|
|
167
|
+
dsT_sim = P.from_map(Tmap, comps='T')
|
|
168
|
+
demodQ_sim = P.from_map(enmap.enmap([Qmap, Umap]), comps='QU')
|
|
169
|
+
demodU_sim = P.from_map(enmap.enmap([Umap, -Qmap]), comps='QU')
|
|
170
|
+
|
|
171
|
+
if modulated is False:
|
|
172
|
+
if wrap:
|
|
173
|
+
tod.wrap('dsT', dsT_sim, [(0, 'dets'), (1, 'samps')])
|
|
174
|
+
tod.wrap('demodQ', demodQ_sim, [(0, 'dets'), (1, 'samps')])
|
|
175
|
+
tod.wrap('demodU', demodU_sim, [(0, 'dets'), (1, 'samps')])
|
|
176
|
+
return dsT_sim, demodQ_sim, demodU_sim
|
|
177
|
+
else:
|
|
178
|
+
assert 'hwp_angle' in tod._fields
|
|
179
|
+
signal_sim = dsT_sim + demodQ_sim*np.cos(4*tod.hwp_angle) + demodU_sim*np.sin(4*tod.hwp_angle)
|
|
180
|
+
if wrap:
|
|
181
|
+
tod.wrap('signal', signal_sim, [(0, 'dets'), (1, 'samps')])
|
|
182
|
+
return signal_sim
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def rotate_focal_plane(tod, hwp=True):
|
|
186
|
+
""" Interpret the boresight rotation effect as a focal plane rotation and update them accordingly.
|
|
187
|
+
This applies constant rotation to focal plane. If hwp=True, rotations of gamma are reflected.
|
|
188
|
+
This updates tod.boresight.roll and tod.focal_plane, in place.
|
|
189
|
+
"""
|
|
190
|
+
sign = -1. if hwp else 1.
|
|
191
|
+
avg_roll = np.average(tod.boresight.roll)
|
|
192
|
+
tod.boresight.roll -= avg_roll
|
|
193
|
+
fp = so3g.proj.quat.rotation_xieta(tod.focal_plane.xi, tod.focal_plane.eta, sign * tod.focal_plane.gamma)
|
|
194
|
+
fp = so3g.proj.quat.euler(2, avg_roll) * fp
|
|
195
|
+
xi, eta, gamma = so3g.proj.quat.decompose_xieta(fp)
|
|
196
|
+
# boresight is float64 but signal and focal_plane are float32
|
|
197
|
+
tod.focal_plane.xi = np.float32(xi)
|
|
198
|
+
tod.focal_plane.eta = np.float32(eta)
|
|
199
|
+
tod.focal_plane.gamma = sign * np.float32(gamma)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def rotate_demodQU(tod, sign=1, offset=0, radial=False, update_focal_plane=True):
|
|
203
|
+
"""
|
|
204
|
+
Apply detectors' polarization angle calibration to the HWP demodulated Q and U timestreams to
|
|
205
|
+
place all detectors' Q and U timestreams in a common telescope frame. This updates tod.demodQ
|
|
206
|
+
and tod.demodU, in place.
|
|
207
|
+
To get Qr Ur timestreams, run `rotate_demodQU(tod)` and then `rotate_demodQU(tod, radial=True)`.
|
|
208
|
+
To restore the Q U timestreams, run `rotate_demodQU(tod, sign=-1, radial=True)`.
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
Args:
|
|
212
|
+
tod : an axisManager object
|
|
213
|
+
update_focal_plane (bool, optional): Whether to update focal_plane.gamma angles consistent with new coordinate reference.
|
|
214
|
+
Make this True for polarization mapmaking using make_map.
|
|
215
|
+
offset : float, optional
|
|
216
|
+
The rotation angle in degrees to apply (default is 0).
|
|
217
|
+
sign : int, optional
|
|
218
|
+
A sign factor to control the direction of the rotation (default is +1).
|
|
219
|
+
radial : bool, optional
|
|
220
|
+
If True and the Q U timestreams in tod are in a common telescope flame, this function turns Q U
|
|
221
|
+
into Qr Ur.
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
"""
|
|
225
|
+
if radial:
|
|
226
|
+
theta_fp = np.arctan2(tod.focal_plane.xi, tod.focal_plane.eta)
|
|
227
|
+
demodC = ((tod.demodQ + 1j*tod.demodU).T * np.exp( sign*(-2j*theta_fp) )).T
|
|
228
|
+
if update_focal_plane:
|
|
229
|
+
tod.focal_plane.gamma -= sign * theta_fp
|
|
230
|
+
|
|
231
|
+
else:
|
|
232
|
+
demodC = ((tod.demodQ + 1j*tod.demodU).T * np.exp( sign*(-2j*tod.focal_plane.gamma + 1j*np.deg2rad(offset)) )).T
|
|
233
|
+
if update_focal_plane:
|
|
234
|
+
tod.focal_plane.gamma *= 0
|
|
235
|
+
tod.demodQ = demodC.real
|
|
236
|
+
tod.demodU = demodC.imag
|
|
237
|
+
del demodC
|
|
238
|
+
|