rubin-sim 2.6.1.dev2__py3-none-any.whl
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.
- batch/compile_prenight_metadata_cache.sh +34 -0
- batch/run_auxtel_prenight_sims.sh +163 -0
- batch/run_prenight_sims.sh +239 -0
- docs/.gitignore +3 -0
- docs/Makefile +32 -0
- docs/api.rst +25 -0
- docs/conf.py +8 -0
- docs/data-api.rst +12 -0
- docs/data-download.rst +70 -0
- docs/developer.rst +14 -0
- docs/documenteer.toml +11 -0
- docs/index.rst +22 -0
- docs/installation.rst +76 -0
- docs/introduction.rst +37 -0
- docs/maf-api-batches.rst +12 -0
- docs/maf-api-db.rst +12 -0
- docs/maf-api-maf-contrib.rst +12 -0
- docs/maf-api-maps.rst +12 -0
- docs/maf-api-metricbundles.rst +12 -0
- docs/maf-api-metrics.rst +12 -0
- docs/maf-api-plots.rst +12 -0
- docs/maf-api-run-comparison.rst +12 -0
- docs/maf-api-slicers.rst +12 -0
- docs/maf-api-stackers.rst +12 -0
- docs/maf-api-utils.rst +12 -0
- docs/maf-api.rst +22 -0
- docs/maf.rst +60 -0
- docs/metric_list.py +49 -0
- docs/moving-objects-api.rst +12 -0
- docs/moving-objects.rst +22 -0
- docs/phot-utils-api.rst +12 -0
- docs/phot-utils.rst +11 -0
- docs/prenight.rst +117 -0
- docs/protoarchive.rst +276 -0
- docs/satellite-constellations-api.rst +12 -0
- docs/satellite-constellations.rst +13 -0
- docs/selfcal-api.rst +12 -0
- docs/selfcal.rst +15 -0
- docs/sim-archive-api.rst +12 -0
- docs/skybrightness-api.rst +12 -0
- docs/skybrightness.rst +23 -0
- docs/user-guide.rst +28 -0
- docs/vseqarchive-architecture.rst +438 -0
- docs/vseqarchive-setup.rst +238 -0
- docs/vseqarchive.rst +225 -0
- rubin_sim/__init__.py +7 -0
- rubin_sim/data/__init__.py +1 -0
- rubin_sim/data/rs_download_data.py +155 -0
- rubin_sim/maf/__init__.py +34 -0
- rubin_sim/maf/batches/__init__.py +18 -0
- rubin_sim/maf/batches/altaz_batch.py +161 -0
- rubin_sim/maf/batches/col_map_dict.py +274 -0
- rubin_sim/maf/batches/common.py +388 -0
- rubin_sim/maf/batches/ddf_batch.py +728 -0
- rubin_sim/maf/batches/filterchange_batch.py +182 -0
- rubin_sim/maf/batches/glance_batch.py +591 -0
- rubin_sim/maf/batches/hourglass_batch.py +79 -0
- rubin_sim/maf/batches/info_batch.py +114 -0
- rubin_sim/maf/batches/metadata_batch.py +558 -0
- rubin_sim/maf/batches/moving_objects_batch.py +1587 -0
- rubin_sim/maf/batches/openshutter_batch.py +100 -0
- rubin_sim/maf/batches/radar_limited.py +1100 -0
- rubin_sim/maf/batches/science_radar_batch.py +1910 -0
- rubin_sim/maf/batches/skycoverage.py +155 -0
- rubin_sim/maf/batches/slew_batch.py +146 -0
- rubin_sim/maf/batches/srd_batch.py +637 -0
- rubin_sim/maf/batches/time_batch.py +757 -0
- rubin_sim/maf/batches/time_sci_batch.py +105 -0
- rubin_sim/maf/batches/visitdepth_batch.py +485 -0
- rubin_sim/maf/db/__init__.py +2 -0
- rubin_sim/maf/db/add_run.py +34 -0
- rubin_sim/maf/db/results_db.py +1074 -0
- rubin_sim/maf/db/tracking_db.py +332 -0
- rubin_sim/maf/ddf_dir.py +53 -0
- rubin_sim/maf/generate_ss.py +218 -0
- rubin_sim/maf/glance_dir.py +58 -0
- rubin_sim/maf/maf_contrib/__init__.py +25 -0
- rubin_sim/maf/maf_contrib/calculate_lsst_field_visibility_astropy.py +170 -0
- rubin_sim/maf/maf_contrib/depth_limited_num_gal_metric.py +109 -0
- rubin_sim/maf/maf_contrib/example_new_metrics.py +40 -0
- rubin_sim/maf/maf_contrib/filter_pair_t_gaps_metric.py +208 -0
- rubin_sim/maf/maf_contrib/grb_transient_metric.py +249 -0
- rubin_sim/maf/maf_contrib/gw170817_det_metric.py +72 -0
- rubin_sim/maf/maf_contrib/intervals_between_obs_metric.py +68 -0
- rubin_sim/maf/maf_contrib/kne_metrics.py +473 -0
- rubin_sim/maf/maf_contrib/lss_metrics.py +45 -0
- rubin_sim/maf/maf_contrib/lss_obs_strategy/__init__.py +3 -0
- rubin_sim/maf/maf_contrib/lss_obs_strategy/constants_for_pipeline.py +73 -0
- rubin_sim/maf/maf_contrib/lss_obs_strategy/galaxy_counts_metric_extended.py +205 -0
- rubin_sim/maf/maf_contrib/lss_obs_strategy/galaxy_counts_with_pixel_calibration.py +171 -0
- rubin_sim/maf/maf_contrib/lv_dwarfs/__init__.py +1 -0
- rubin_sim/maf/maf_contrib/lv_dwarfs/lv_dwarfs_metrics.py +388 -0
- rubin_sim/maf/maf_contrib/microlensing_metric.py +593 -0
- rubin_sim/maf/maf_contrib/num_obs_in_survey_time_overlap_metric.py +43 -0
- rubin_sim/maf/maf_contrib/periodic_metric.py +51 -0
- rubin_sim/maf/maf_contrib/periodic_star_metric.py +186 -0
- rubin_sim/maf/maf_contrib/periodic_star_modulation_metric.py +236 -0
- rubin_sim/maf/maf_contrib/presto_color_kne_pop_metric.py +441 -0
- rubin_sim/maf/maf_contrib/selfcal_uniformity_metric.py +171 -0
- rubin_sim/maf/maf_contrib/star_count_mass_metric.py +64 -0
- rubin_sim/maf/maf_contrib/star_count_metric.py +56 -0
- rubin_sim/maf/maf_contrib/star_counts/__init__.py +8 -0
- rubin_sim/maf/maf_contrib/star_counts/abs_mag.py +324 -0
- rubin_sim/maf/maf_contrib/star_counts/coords.py +99 -0
- rubin_sim/maf/maf_contrib/star_counts/readme.txt +1 -0
- rubin_sim/maf/maf_contrib/star_counts/spec_type.py +91 -0
- rubin_sim/maf/maf_contrib/star_counts/starcount.py +30 -0
- rubin_sim/maf/maf_contrib/star_counts/starcount_bymass.py +93 -0
- rubin_sim/maf/maf_contrib/star_counts/stellardensity.py +59 -0
- rubin_sim/maf/maf_contrib/static_probes_fom_summary_metric.py +386 -0
- rubin_sim/maf/maf_contrib/tdes_pop_metric.py +362 -0
- rubin_sim/maf/maf_contrib/transient_ascii_sed_metric.py +652 -0
- rubin_sim/maf/maf_contrib/triplet_metric.py +156 -0
- rubin_sim/maf/maf_contrib/var_depth_metric.py +157 -0
- rubin_sim/maf/maf_contrib/xrb_metrics.py +523 -0
- rubin_sim/maf/maf_contrib/young_stellar_objects_metric.py +200 -0
- rubin_sim/maf/maf_night_report.py +200 -0
- rubin_sim/maf/make_fbs_tracking_db.py +90 -0
- rubin_sim/maf/maps/__init__.py +8 -0
- rubin_sim/maf/maps/base_map.py +72 -0
- rubin_sim/maf/maps/create_gaia_density_map.py +158 -0
- rubin_sim/maf/maps/dust_map.py +66 -0
- rubin_sim/maf/maps/dust_map_3d.py +190 -0
- rubin_sim/maf/maps/ebv_3d_hp.py +170 -0
- rubin_sim/maf/maps/ebv_hp.py +64 -0
- rubin_sim/maf/maps/gal_coords_map.py +22 -0
- rubin_sim/maf/maps/galactic_plane_priority_maps.py +210 -0
- rubin_sim/maf/maps/stellar_density_map.py +73 -0
- rubin_sim/maf/maps/trilegal_map.py +82 -0
- rubin_sim/maf/metadata_dir.py +90 -0
- rubin_sim/maf/metric_bundles/__init__.py +3 -0
- rubin_sim/maf/metric_bundles/metric_bundle.py +816 -0
- rubin_sim/maf/metric_bundles/metric_bundle_group.py +834 -0
- rubin_sim/maf/metric_bundles/mo_metric_bundle.py +646 -0
- rubin_sim/maf/metrics/__init__.py +52 -0
- rubin_sim/maf/metrics/agn_time_lag_metric.py +118 -0
- rubin_sim/maf/metrics/agnstructure.py +141 -0
- rubin_sim/maf/metrics/area_summary_metrics.py +120 -0
- rubin_sim/maf/metrics/base_metric.py +215 -0
- rubin_sim/maf/metrics/brown_dwarf_metric.py +162 -0
- rubin_sim/maf/metrics/cadence_metrics.py +400 -0
- rubin_sim/maf/metrics/calibration_metrics.py +618 -0
- rubin_sim/maf/metrics/chip_vendor_metric.py +43 -0
- rubin_sim/maf/metrics/color_slope_metrics.py +189 -0
- rubin_sim/maf/metrics/cosmology_summary_metrics.py +1212 -0
- rubin_sim/maf/metrics/coverage_metric.py +48 -0
- rubin_sim/maf/metrics/crowding_metric.py +255 -0
- rubin_sim/maf/metrics/cumulative_metric.py +46 -0
- rubin_sim/maf/metrics/dcr_metric.py +93 -0
- rubin_sim/maf/metrics/exgal_m5.py +57 -0
- rubin_sim/maf/metrics/fft_metric.py +27 -0
- rubin_sim/maf/metrics/galactic_plane_metrics.py +375 -0
- rubin_sim/maf/metrics/galplane_time_sampling_metrics.py +236 -0
- rubin_sim/maf/metrics/hourglass_metric.py +130 -0
- rubin_sim/maf/metrics/incremental_template_metric.py +255 -0
- rubin_sim/maf/metrics/kuiper_metrics.py +26 -0
- rubin_sim/maf/metrics/mo_metrics.py +1496 -0
- rubin_sim/maf/metrics/mo_summary_metrics.py +464 -0
- rubin_sim/maf/metrics/night_pointing_metric.py +70 -0
- rubin_sim/maf/metrics/optimal_m5_metric.py +94 -0
- rubin_sim/maf/metrics/pair_metric.py +69 -0
- rubin_sim/maf/metrics/periodic_detect_metric.py +133 -0
- rubin_sim/maf/metrics/phase_gap_metric.py +172 -0
- rubin_sim/maf/metrics/qso_number_counts_metric.py +138 -0
- rubin_sim/maf/metrics/scaling_metrics.py +148 -0
- rubin_sim/maf/metrics/schedview_metrics.py +39 -0
- rubin_sim/maf/metrics/season_metrics.py +344 -0
- rubin_sim/maf/metrics/simple_metrics.py +546 -0
- rubin_sim/maf/metrics/sky_sat_metric.py +18 -0
- rubin_sim/maf/metrics/sn_cadence_metric.py +104 -0
- rubin_sim/maf/metrics/sn_n_sn_metric.py +1364 -0
- rubin_sim/maf/metrics/sn_sl_metric.py +216 -0
- rubin_sim/maf/metrics/sn_snr_metric.py +715 -0
- rubin_sim/maf/metrics/snr_weight.py +24 -0
- rubin_sim/maf/metrics/star_density.py +77 -0
- rubin_sim/maf/metrics/string_count_metric.py +95 -0
- rubin_sim/maf/metrics/summary_metrics.py +201 -0
- rubin_sim/maf/metrics/surfb_metric.py +175 -0
- rubin_sim/maf/metrics/technical_metrics.py +271 -0
- rubin_sim/maf/metrics/tgaps.py +412 -0
- rubin_sim/maf/metrics/tomography_models.py +2034 -0
- rubin_sim/maf/metrics/transient_metrics.py +268 -0
- rubin_sim/maf/metrics/uniformity_metrics.py +418 -0
- rubin_sim/maf/metrics/use_metrics.py +55 -0
- rubin_sim/maf/metrics/vector_metrics.py +190 -0
- rubin_sim/maf/metrics/visit_groups_metric.py +341 -0
- rubin_sim/maf/metrics/weak_lensing_systematics_metric.py +210 -0
- rubin_sim/maf/plots/__init__.py +14 -0
- rubin_sim/maf/plots/hg_plotters.py +1117 -0
- rubin_sim/maf/plots/hourglass_plotters.py +120 -0
- rubin_sim/maf/plots/mo_plotters.py +358 -0
- rubin_sim/maf/plots/nd_plotters.py +220 -0
- rubin_sim/maf/plots/neo_distance_plotter.py +140 -0
- rubin_sim/maf/plots/night_pointing_plotter.py +96 -0
- rubin_sim/maf/plots/oned_plotters.py +114 -0
- rubin_sim/maf/plots/perceptual_rainbow.py +30 -0
- rubin_sim/maf/plots/plot_handler.py +766 -0
- rubin_sim/maf/plots/skyproj_plotters.py +540 -0
- rubin_sim/maf/plots/spatial_plotters.py +1029 -0
- rubin_sim/maf/plots/special_plotters.py +256 -0
- rubin_sim/maf/plots/two_d_plotters.py +177 -0
- rubin_sim/maf/plots/xyplotter.py +37 -0
- rubin_sim/maf/run_comparison/__init__.py +5 -0
- rubin_sim/maf/run_comparison/archive.py +584 -0
- rubin_sim/maf/run_comparison/gather_summaries.py +125 -0
- rubin_sim/maf/run_comparison/microlensing_compare.py +514 -0
- rubin_sim/maf/run_comparison/radar_plot.py +202 -0
- rubin_sim/maf/run_comparison/summary_plots.py +710 -0
- rubin_sim/maf/run_moving_calc.py +239 -0
- rubin_sim/maf/run_moving_fractions.py +128 -0
- rubin_sim/maf/run_moving_join.py +103 -0
- rubin_sim/maf/run_selfcal_metric.py +92 -0
- rubin_sim/maf/scimaf_dir.py +87 -0
- rubin_sim/maf/show_maf.py +227 -0
- rubin_sim/maf/slicers/__init__.py +13 -0
- rubin_sim/maf/slicers/base_slicer.py +513 -0
- rubin_sim/maf/slicers/base_spatial_slicer.py +202 -0
- rubin_sim/maf/slicers/healpix_sdss_slicer.py +118 -0
- rubin_sim/maf/slicers/healpix_slicer.py +189 -0
- rubin_sim/maf/slicers/healpix_subset_slicer.py +293 -0
- rubin_sim/maf/slicers/hourglass_slicer.py +37 -0
- rubin_sim/maf/slicers/mo_slicer.py +171 -0
- rubin_sim/maf/slicers/movie_slicer.py +288 -0
- rubin_sim/maf/slicers/nd_slicer.py +147 -0
- rubin_sim/maf/slicers/one_d_slicer.py +210 -0
- rubin_sim/maf/slicers/time_interval_slicers.py +283 -0
- rubin_sim/maf/slicers/uni_slicer.py +57 -0
- rubin_sim/maf/slicers/user_points_slicer.py +141 -0
- rubin_sim/maf/stackers/__init__.py +13 -0
- rubin_sim/maf/stackers/base_stacker.py +221 -0
- rubin_sim/maf/stackers/coord_stackers.py +224 -0
- rubin_sim/maf/stackers/date_stackers.py +192 -0
- rubin_sim/maf/stackers/general_stackers.py +683 -0
- rubin_sim/maf/stackers/get_col_info.py +104 -0
- rubin_sim/maf/stackers/label_stackers.py +114 -0
- rubin_sim/maf/stackers/m5_optimal_stacker.py +126 -0
- rubin_sim/maf/stackers/mo_phase.py +265 -0
- rubin_sim/maf/stackers/mo_stackers.py +486 -0
- rubin_sim/maf/stackers/n_follow_stacker.py +187 -0
- rubin_sim/maf/stackers/neo_dist_stacker.py +126 -0
- rubin_sim/maf/stackers/sdss_stackers.py +30 -0
- rubin_sim/maf/stackers/sn_stacker.py +152 -0
- rubin_sim/maf/stackers/teff_stacker.py +154 -0
- rubin_sim/maf/utils/__init__.py +6 -0
- rubin_sim/maf/utils/astrometry_utils.py +93 -0
- rubin_sim/maf/utils/generate_fov_map.py +58 -0
- rubin_sim/maf/utils/get_date_version.py +28 -0
- rubin_sim/maf/utils/maf_utils.py +212 -0
- rubin_sim/maf/utils/opsim_utils.py +259 -0
- rubin_sim/maf/utils/output_utils.py +34 -0
- rubin_sim/maf/utils/sn_n_sn_utils.py +894 -0
- rubin_sim/maf/utils/sn_utils.py +369 -0
- rubin_sim/maf/utils/stellar_mags.py +197 -0
- rubin_sim/maf/web/__init__.py +2 -0
- rubin_sim/maf/web/favicon.ico +0 -0
- rubin_sim/maf/web/maf_run_results.py +645 -0
- rubin_sim/maf/web/maf_tracking.py +139 -0
- rubin_sim/maf/web/sorttable.js +496 -0
- rubin_sim/maf/web/templates/allmetricresults.html +72 -0
- rubin_sim/maf/web/templates/configs.html +28 -0
- rubin_sim/maf/web/templates/macros.html +243 -0
- rubin_sim/maf/web/templates/master.html +294 -0
- rubin_sim/maf/web/templates/metricselect.html +91 -0
- rubin_sim/maf/web/templates/multicolor.html +147 -0
- rubin_sim/maf/web/templates/results.html +82 -0
- rubin_sim/maf/web/templates/runselect.html +58 -0
- rubin_sim/maf/web/templates/stats.html +50 -0
- rubin_sim/moving_objects/__init__.py +8 -0
- rubin_sim/moving_objects/base_obs.py +468 -0
- rubin_sim/moving_objects/cheby_fits.py +689 -0
- rubin_sim/moving_objects/cheby_values.py +231 -0
- rubin_sim/moving_objects/chebyshev_utils.py +365 -0
- rubin_sim/moving_objects/direct_obs.py +376 -0
- rubin_sim/moving_objects/make_lsst_obs.py +282 -0
- rubin_sim/moving_objects/ooephemerides.py +643 -0
- rubin_sim/moving_objects/orbits.py +507 -0
- rubin_sim/moving_objects/pre_generate.py +37 -0
- rubin_sim/moving_objects/utils.py +61 -0
- rubin_sim/phot_utils/__init__.py +7 -0
- rubin_sim/phot_utils/bandpass.py +425 -0
- rubin_sim/phot_utils/photometric_parameters.py +449 -0
- rubin_sim/phot_utils/physical_parameters.py +50 -0
- rubin_sim/phot_utils/predicted_zeropoints.py +245 -0
- rubin_sim/phot_utils/sed.py +1773 -0
- rubin_sim/phot_utils/sed_utils.py +52 -0
- rubin_sim/phot_utils/signaltonoise.py +695 -0
- rubin_sim/phot_utils/spectral_resampling.py +161 -0
- rubin_sim/satellite_constellations/__init__.py +3 -0
- rubin_sim/satellite_constellations/basis_function.py +40 -0
- rubin_sim/satellite_constellations/model_observatory.py +157 -0
- rubin_sim/satellite_constellations/sat_utils.py +488 -0
- rubin_sim/selfcal/__init__.py +4 -0
- rubin_sim/selfcal/generate_catalog.py +188 -0
- rubin_sim/selfcal/offsets.py +119 -0
- rubin_sim/selfcal/solver.py +143 -0
- rubin_sim/selfcal/star_tools.py +42 -0
- rubin_sim/sim_archive/__init__.py +14 -0
- rubin_sim/sim_archive/conda_packages.py +65 -0
- rubin_sim/sim_archive/future_vsarch.py +480 -0
- rubin_sim/sim_archive/make_snapshot.py +255 -0
- rubin_sim/sim_archive/prenight.py +216 -0
- rubin_sim/sim_archive/prenightindex.py +229 -0
- rubin_sim/sim_archive/prototype.py +1029 -0
- rubin_sim/sim_archive/sim_archive.py +680 -0
- rubin_sim/sim_archive/tempdb.py +56 -0
- rubin_sim/sim_archive/util.py +146 -0
- rubin_sim/sim_archive/vseqarchive.py +965 -0
- rubin_sim/sim_archive/vseqmetadata.py +1721 -0
- rubin_sim/skybrightness/__init__.py +5 -0
- rubin_sim/skybrightness/allsky_db.py +93 -0
- rubin_sim/skybrightness/data/ESO_Spectra/eso_tools.py +505 -0
- rubin_sim/skybrightness/data/solarSpec/package.py +22 -0
- rubin_sim/skybrightness/generate_hdf5.py +243 -0
- rubin_sim/skybrightness/interp_components.py +798 -0
- rubin_sim/skybrightness/sky_model.py +771 -0
- rubin_sim/skybrightness/twilight_func.py +83 -0
- rubin_sim/skybrightness/utils.py +91 -0
- rubin_sim-2.6.1.dev2.dist-info/METADATA +95 -0
- rubin_sim-2.6.1.dev2.dist-info/RECORD +387 -0
- rubin_sim-2.6.1.dev2.dist-info/WHEEL +5 -0
- rubin_sim-2.6.1.dev2.dist-info/entry_points.txt +24 -0
- rubin_sim-2.6.1.dev2.dist-info/licenses/LICENSE +674 -0
- rubin_sim-2.6.1.dev2.dist-info/top_level.txt +5 -0
- sql/make_vseqmeta.sql +251 -0
- tests/data/test_data.py +26 -0
- tests/data/test_ddf_grid.py +17 -0
- tests/maf/test_3x2fom.py +68 -0
- tests/maf/test_archive.py +162 -0
- tests/maf/test_basemetrics.py +99 -0
- tests/maf/test_batchcommon.py +36 -0
- tests/maf/test_batches.py +159 -0
- tests/maf/test_cadencemetrics.py +388 -0
- tests/maf/test_calibrationmetrics.py +242 -0
- tests/maf/test_color_slopes.py +71 -0
- tests/maf/test_cosmology_summaries.py +20 -0
- tests/maf/test_gathersummaries.py +48 -0
- tests/maf/test_healpixslicer.py +439 -0
- tests/maf/test_healpixsubsetslicer.py +273 -0
- tests/maf/test_hgplotters.py +145 -0
- tests/maf/test_hourglassmetric.py +33 -0
- tests/maf/test_io.py +187 -0
- tests/maf/test_json.py +169 -0
- tests/maf/test_maps.py +199 -0
- tests/maf/test_metricbundle.py +69 -0
- tests/maf/test_mometrics.py +422 -0
- tests/maf/test_movieslicer.py +216 -0
- tests/maf/test_ndslicer.py +240 -0
- tests/maf/test_neodistanceplotter.py +41 -0
- tests/maf/test_onedslicer.py +245 -0
- tests/maf/test_opsimutils.py +80 -0
- tests/maf/test_plotters.py +134 -0
- tests/maf/test_resultsdb.py +145 -0
- tests/maf/test_schedviewmetrics.py +14 -0
- tests/maf/test_simplemetrics.py +200 -0
- tests/maf/test_snmetrics.py +335 -0
- tests/maf/test_snmetrics_nsn.py +123 -0
- tests/maf/test_stackers.py +423 -0
- tests/maf/test_stellarmags.py +50 -0
- tests/maf/test_stringcount.py +26 -0
- tests/maf/test_summary_plots.py +197 -0
- tests/maf/test_summarymetrics.py +82 -0
- tests/maf/test_technicalmetrics.py +267 -0
- tests/maf/test_templatemetrics.py +86 -0
- tests/maf/test_timeintervalslicers.py +97 -0
- tests/maf/test_trackingdb.py +88 -0
- tests/maf/test_unislicer.py +116 -0
- tests/maf/test_vectormetrics.py +225 -0
- tests/maf/test_visitgroupsmetric.py +181 -0
- tests/moving_objects/test_camera.py +39 -0
- tests/moving_objects/test_chebyfits.py +188 -0
- tests/moving_objects/test_chebyshevutils.py +76 -0
- tests/moving_objects/test_chebyvalues.py +245 -0
- tests/moving_objects/test_ephemerides.py +219 -0
- tests/moving_objects/test_orbits.py +170 -0
- tests/moving_objects/test_sed_data.py +61 -0
- tests/phot_utils/test_approximatebandpasses.py +91 -0
- tests/phot_utils/test_photometricparameters.py +268 -0
- tests/phot_utils/test_photometry.py +61 -0
- tests/phot_utils/test_predicted_zeropoints.py +53 -0
- tests/phot_utils/test_read_bandpasses.py +29 -0
- tests/phot_utils/test_sed.py +368 -0
- tests/phot_utils/test_snr.py +370 -0
- tests/satellite_constellations/test_satellites.py +36 -0
- tests/sim_archive/test_make_snapshot.py +24 -0
- tests/sim_archive/test_prototype_sim_archive.py +204 -0
- tests/sim_archive/test_vseqarchive.py +947 -0
- tests/skybrightness/test_skymodel.py +359 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
__all__ = ("HourglassPlot",)
|
|
2
|
+
|
|
3
|
+
import matplotlib.pyplot as plt
|
|
4
|
+
import numpy as np
|
|
5
|
+
|
|
6
|
+
from .plot_handler import BasePlotter
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class HourglassPlot(BasePlotter):
|
|
10
|
+
def __init__(self):
|
|
11
|
+
self.plot_type = "Hourglass"
|
|
12
|
+
self.object_plotter = True
|
|
13
|
+
self.default_plot_dict = {
|
|
14
|
+
"title": None,
|
|
15
|
+
"xlabel": "Night - min(Night)",
|
|
16
|
+
"ylabel": "Hours from local midnight",
|
|
17
|
+
"figsize": None,
|
|
18
|
+
}
|
|
19
|
+
self.filter2color = {
|
|
20
|
+
"u": "purple",
|
|
21
|
+
"g": "blue",
|
|
22
|
+
"r": "green",
|
|
23
|
+
"i": "cyan",
|
|
24
|
+
"z": "orange",
|
|
25
|
+
"y": "red",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
def __call__(self, metric_value, slicer, user_plot_dict, fig=None):
|
|
29
|
+
"""
|
|
30
|
+
Generate the hourglass plot
|
|
31
|
+
"""
|
|
32
|
+
if slicer.slicer_name != "HourglassSlicer":
|
|
33
|
+
raise ValueError("HourglassPlot is for use with hourglass slicers")
|
|
34
|
+
|
|
35
|
+
plot_dict = {}
|
|
36
|
+
plot_dict.update(self.default_plot_dict)
|
|
37
|
+
plot_dict.update(user_plot_dict)
|
|
38
|
+
|
|
39
|
+
if fig is None:
|
|
40
|
+
fig = plt.figure(figsize=plot_dict["figsize"])
|
|
41
|
+
ax = fig.add_subplot(111)
|
|
42
|
+
pernight = metric_value[0]["pernight"]
|
|
43
|
+
perfilter = metric_value[0]["perfilter"]
|
|
44
|
+
|
|
45
|
+
y = (perfilter["mjd"] - perfilter["midnight"]) * 24.0
|
|
46
|
+
dmin = np.floor(np.min(perfilter["mjd"]))
|
|
47
|
+
for i in np.arange(0, perfilter.size, 2):
|
|
48
|
+
ax.plot(
|
|
49
|
+
[perfilter["mjd"][i] - dmin, perfilter["mjd"][i + 1] - dmin],
|
|
50
|
+
[y[i], y[i + 1]],
|
|
51
|
+
self.filter2color[perfilter["filter"][i]],
|
|
52
|
+
)
|
|
53
|
+
for i, key in enumerate(["u", "g", "r", "i", "z", "y"]):
|
|
54
|
+
ax.text(
|
|
55
|
+
1.05,
|
|
56
|
+
0.9 - i * 0.07,
|
|
57
|
+
key,
|
|
58
|
+
color=self.filter2color[key],
|
|
59
|
+
transform=ax.transAxes,
|
|
60
|
+
)
|
|
61
|
+
# ax.plot(pernight['mjd'] - dmin,
|
|
62
|
+
# (pernight['twi6_rise'] - pernight['midnight']) * 24.,
|
|
63
|
+
# 'blue', label=r'6$^\circ$ twilight')
|
|
64
|
+
# ax.plot(pernight['mjd'] - dmin,
|
|
65
|
+
# (pernight['twi6_set'] - pernight['midnight']) * 24.,
|
|
66
|
+
# 'blue')
|
|
67
|
+
ax.plot(
|
|
68
|
+
pernight["mjd"] - dmin,
|
|
69
|
+
(pernight["twi12_rise"] - pernight["midnight"]) * 24.0,
|
|
70
|
+
"yellow",
|
|
71
|
+
label=r"12$^\circ$ twilight",
|
|
72
|
+
)
|
|
73
|
+
ax.plot(
|
|
74
|
+
pernight["mjd"] - dmin,
|
|
75
|
+
(pernight["twi12_set"] - pernight["midnight"]) * 24.0,
|
|
76
|
+
"yellow",
|
|
77
|
+
)
|
|
78
|
+
ax.plot(
|
|
79
|
+
pernight["mjd"] - dmin,
|
|
80
|
+
(pernight["twi18_rise"] - pernight["midnight"]) * 24.0,
|
|
81
|
+
"red",
|
|
82
|
+
label=r"18$^\circ$ twilight",
|
|
83
|
+
)
|
|
84
|
+
ax.plot(
|
|
85
|
+
pernight["mjd"] - dmin,
|
|
86
|
+
(pernight["twi18_set"] - pernight["midnight"]) * 24.0,
|
|
87
|
+
"red",
|
|
88
|
+
)
|
|
89
|
+
ax.plot(
|
|
90
|
+
pernight["mjd"] - dmin,
|
|
91
|
+
pernight["moonPer"] / 100.0 - 7,
|
|
92
|
+
"black",
|
|
93
|
+
label="Moon",
|
|
94
|
+
)
|
|
95
|
+
ax.set_xlabel(plot_dict["xlabel"])
|
|
96
|
+
ax.set_ylabel(plot_dict["ylabel"])
|
|
97
|
+
ax.set_title(plot_dict["title"])
|
|
98
|
+
|
|
99
|
+
# draw things in with lines if we are only plotting one night
|
|
100
|
+
if len(pernight["mjd"]) == 1:
|
|
101
|
+
ax.axhline(
|
|
102
|
+
(pernight["twi6_rise"] - pernight["midnight"]) * 24.0,
|
|
103
|
+
color="blue",
|
|
104
|
+
label=r"6$^\circ$ twilight",
|
|
105
|
+
)
|
|
106
|
+
ax.axhline((pernight["twi6_set"] - pernight["midnight"]) * 24.0, color="blue")
|
|
107
|
+
ax.axhline(
|
|
108
|
+
(pernight["twi12_rise"] - pernight["midnight"]) * 24.0,
|
|
109
|
+
color="yellow",
|
|
110
|
+
label=r"12$^\circ$ twilight",
|
|
111
|
+
)
|
|
112
|
+
ax.axhline((pernight["twi12_set"] - pernight["midnight"]) * 24.0, color="yellow")
|
|
113
|
+
ax.axhline(
|
|
114
|
+
(pernight["twi18_rise"] - pernight["midnight"]) * 24.0,
|
|
115
|
+
color="red",
|
|
116
|
+
label=r"18$^\circ$ twilight",
|
|
117
|
+
)
|
|
118
|
+
ax.axhline((pernight["twi18_set"] - pernight["midnight"]) * 24.0, color="red")
|
|
119
|
+
|
|
120
|
+
return fig
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
__all__ = ("MetricVsH", "MetricVsOrbit", "MetricVsOrbitPoints")
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import matplotlib.cm as cm
|
|
5
|
+
import matplotlib.pyplot as plt
|
|
6
|
+
import numpy as np
|
|
7
|
+
|
|
8
|
+
from .plot_handler import BasePlotter
|
|
9
|
+
|
|
10
|
+
# mag_sun = -27.1
|
|
11
|
+
# apparent r band magnitude of the sun.
|
|
12
|
+
# this sets the band for the magnitude limit.
|
|
13
|
+
# see http://www.ucolick.org/~cnaw/sun.html for apparent mags in other bands.
|
|
14
|
+
mag_sun = -26.74
|
|
15
|
+
# apparent V band magnitude of the Sun (our H mags translate to V band)
|
|
16
|
+
km_per_au = 1.496e8
|
|
17
|
+
m_per_km = 1000
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class MetricVsH(BasePlotter):
|
|
21
|
+
"""
|
|
22
|
+
Plot metric values versus H.
|
|
23
|
+
Marginalize over metric values in each H bin using 'np_reduce'.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
def __init__(self):
|
|
27
|
+
self.plot_type = "MetricVsH"
|
|
28
|
+
self.object_plotter = False
|
|
29
|
+
self.default_plot_dict = {
|
|
30
|
+
"title": None,
|
|
31
|
+
"xlabel": "H (mag)",
|
|
32
|
+
"ylabel": None,
|
|
33
|
+
"label": None,
|
|
34
|
+
"np_reduce": None,
|
|
35
|
+
"nbins": None,
|
|
36
|
+
"albedo": None,
|
|
37
|
+
"Hmark": None,
|
|
38
|
+
"HmarkLinestyle": ":",
|
|
39
|
+
"figsize": None,
|
|
40
|
+
}
|
|
41
|
+
self.min_hrange = 1.0
|
|
42
|
+
|
|
43
|
+
def __call__(self, metric_value, slicer, user_plot_dict, fig=None):
|
|
44
|
+
if "linestyle" not in user_plot_dict:
|
|
45
|
+
user_plot_dict["linestyle"] = "-"
|
|
46
|
+
plot_dict = {}
|
|
47
|
+
plot_dict.update(self.default_plot_dict)
|
|
48
|
+
plot_dict.update(user_plot_dict)
|
|
49
|
+
hvals = slicer.slice_points["H"]
|
|
50
|
+
reduce_func = plot_dict["np_reduce"]
|
|
51
|
+
if reduce_func is None:
|
|
52
|
+
reduce_func = np.mean
|
|
53
|
+
if hvals.shape[0] == 1:
|
|
54
|
+
# We have a simple set of values to plot against H.
|
|
55
|
+
# This may be due to running a summary metric,
|
|
56
|
+
# such as completeness.
|
|
57
|
+
m_vals = metric_value[0].filled()
|
|
58
|
+
elif len(hvals) == slicer.shape[1]:
|
|
59
|
+
# Using cloned H distribution.
|
|
60
|
+
# Apply 'np_reduce' method directly to metric values,
|
|
61
|
+
# and plot at matching H values.
|
|
62
|
+
m_vals = reduce_func(metric_value.filled(), axis=0)
|
|
63
|
+
else:
|
|
64
|
+
# Probably each object has its own H value.
|
|
65
|
+
hrange = hvals.max() - hvals.min()
|
|
66
|
+
min_h = hvals.min()
|
|
67
|
+
if hrange < self.min_hrange:
|
|
68
|
+
hrange = self.min_hrange
|
|
69
|
+
min_h = hvals.min() - hrange / 2.0
|
|
70
|
+
nbins = plot_dict["nbins"]
|
|
71
|
+
if nbins is None:
|
|
72
|
+
nbins = 30
|
|
73
|
+
stepsize = hrange / float(nbins)
|
|
74
|
+
bins = np.arange(min_h, min_h + hrange + stepsize / 2.0, stepsize)
|
|
75
|
+
# In each bin of H, calculate the 'np_reduce' value of the
|
|
76
|
+
# corresponding metric_values.
|
|
77
|
+
inds = np.digitize(hvals, bins)
|
|
78
|
+
inds = inds - 1
|
|
79
|
+
m_vals = np.zeros(len(bins), float)
|
|
80
|
+
for i in range(len(bins)):
|
|
81
|
+
match = metric_value[inds == i]
|
|
82
|
+
if len(match) == 0:
|
|
83
|
+
m_vals[i] = slicer.badval
|
|
84
|
+
else:
|
|
85
|
+
m_vals[i] = reduce_func(match.filled())
|
|
86
|
+
hvals = bins
|
|
87
|
+
# Plot the values.
|
|
88
|
+
if fig is None:
|
|
89
|
+
fig = plt.figure(figsize=plot_dict["figsize"])
|
|
90
|
+
ax = plt.gca()
|
|
91
|
+
ax.plot(
|
|
92
|
+
hvals,
|
|
93
|
+
m_vals,
|
|
94
|
+
color=plot_dict["color"],
|
|
95
|
+
linestyle=plot_dict["linestyle"],
|
|
96
|
+
label=plot_dict["label"],
|
|
97
|
+
)
|
|
98
|
+
if "x_min" in plot_dict:
|
|
99
|
+
ax.set_xlim(left=plot_dict["x_min"])
|
|
100
|
+
if "x_max" in plot_dict:
|
|
101
|
+
ax.set_xlim(right=plot_dict["x_max"])
|
|
102
|
+
if "y_min" in plot_dict:
|
|
103
|
+
ax.set_ylim(bottom=plot_dict["y_min"])
|
|
104
|
+
if "y_max" in plot_dict:
|
|
105
|
+
ax.set_ylim(top=plot_dict["y_max"])
|
|
106
|
+
# Convert hvals to diameter, using 'albedo' - add these upper xticks
|
|
107
|
+
albedo = plot_dict["albedo"]
|
|
108
|
+
y = 1.0
|
|
109
|
+
if albedo is not None:
|
|
110
|
+
ax2 = ax.twiny()
|
|
111
|
+
hmin, hmax = ax.get_xlim()
|
|
112
|
+
dmax = 2.0 * np.sqrt(10 ** ((mag_sun - hmin - 2.5 * np.log10(albedo)) / 2.5))
|
|
113
|
+
dmin = 2.0 * np.sqrt(10 ** ((mag_sun - hmax - 2.5 * np.log10(albedo)) / 2.5))
|
|
114
|
+
dmax = dmax * km_per_au * m_per_km
|
|
115
|
+
dmin = dmin * km_per_au * m_per_km
|
|
116
|
+
ax2.set_xlim(dmax, dmin)
|
|
117
|
+
ax2.set_xscale("log")
|
|
118
|
+
dmid = (dmax - dmin) / 2 + dmin
|
|
119
|
+
dmid = np.power(10, round(np.log10(dmid)))
|
|
120
|
+
dmin = np.power(10, round(np.log10(dmin)))
|
|
121
|
+
dmax = np.power(10, round(np.log10(dmax)))
|
|
122
|
+
dticks = np.array([dmin, dmid, dmax])
|
|
123
|
+
ax2.set_xticks(dticks)
|
|
124
|
+
ax2.set_xlabel("D (m)", labelpad=-5, horizontalalignment="right")
|
|
125
|
+
ax2.grid(False)
|
|
126
|
+
plt.sca(ax)
|
|
127
|
+
y = 1.1
|
|
128
|
+
plt.grid(True)
|
|
129
|
+
if plot_dict["Hmark"] is not None:
|
|
130
|
+
plt.axvline(
|
|
131
|
+
x=plot_dict["Hmark"],
|
|
132
|
+
color="r",
|
|
133
|
+
linestyle=plot_dict["HmarkLinestyle"],
|
|
134
|
+
alpha=0.3,
|
|
135
|
+
)
|
|
136
|
+
plt.title(plot_dict["title"], y=y)
|
|
137
|
+
plt.xlabel(plot_dict["xlabel"])
|
|
138
|
+
plt.ylabel(plot_dict["ylabel"])
|
|
139
|
+
plt.tight_layout()
|
|
140
|
+
return fig
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class MetricVsOrbit(BasePlotter):
|
|
144
|
+
"""
|
|
145
|
+
Plot metric values (at a particular H value) vs. orbital parameters.
|
|
146
|
+
Marginalize over metric values in each orbital bin using 'np_reduce'.
|
|
147
|
+
"""
|
|
148
|
+
|
|
149
|
+
def __init__(self, xaxis="q", yaxis="e"):
|
|
150
|
+
self.plot_type = "MetricVsOrbit_%s%s" % (xaxis, yaxis)
|
|
151
|
+
self.object_plotter = False
|
|
152
|
+
self.default_plot_dict = {
|
|
153
|
+
"title": None,
|
|
154
|
+
"xlabel": xaxis,
|
|
155
|
+
"ylabel": yaxis,
|
|
156
|
+
"xaxis": xaxis,
|
|
157
|
+
"yaxis": yaxis,
|
|
158
|
+
"label": None,
|
|
159
|
+
"cmap": cm.viridis,
|
|
160
|
+
"np_reduce": None,
|
|
161
|
+
"nxbins": None,
|
|
162
|
+
"nybins": None,
|
|
163
|
+
"levels": None,
|
|
164
|
+
"h_val": None,
|
|
165
|
+
"Hwidth": None,
|
|
166
|
+
"figsize": None,
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
def __call__(self, metric_value, slicer, user_plot_dict, fig=None):
|
|
170
|
+
plot_dict = {}
|
|
171
|
+
plot_dict.update(self.default_plot_dict)
|
|
172
|
+
plot_dict.update(user_plot_dict)
|
|
173
|
+
if fig is None:
|
|
174
|
+
fig = plt.figure(figsize=plot_dict["figsize"])
|
|
175
|
+
xvals = slicer.slice_points["orbits"][plot_dict["xaxis"]]
|
|
176
|
+
yvals = slicer.slice_points["orbits"][plot_dict["yaxis"]]
|
|
177
|
+
# Set x/y bins.
|
|
178
|
+
nxbins = plot_dict["nxbins"]
|
|
179
|
+
nybins = plot_dict["nybins"]
|
|
180
|
+
if nxbins is None:
|
|
181
|
+
nxbins = 100
|
|
182
|
+
if nybins is None:
|
|
183
|
+
nybins = 100
|
|
184
|
+
if "xbins" in plot_dict:
|
|
185
|
+
xbins = plot_dict["xbins"]
|
|
186
|
+
else:
|
|
187
|
+
xbinsize = (xvals.max() - xvals.min()) / float(nxbins)
|
|
188
|
+
xbins = np.arange(xvals.min(), xvals.max() + xbinsize / 2.0, xbinsize)
|
|
189
|
+
if "ybins" in plot_dict:
|
|
190
|
+
ybins = plot_dict["ybins"]
|
|
191
|
+
else:
|
|
192
|
+
ybinsize = (yvals.max() - yvals.min()) / float(nybins)
|
|
193
|
+
ybins = np.arange(yvals.min(), yvals.max() + ybinsize / 2.0, ybinsize)
|
|
194
|
+
nxbins = len(xbins)
|
|
195
|
+
nybins = len(ybins)
|
|
196
|
+
# Identify the relevant metric_values for the Hvalue we want to plot.
|
|
197
|
+
hvals = slicer.slice_points["H"]
|
|
198
|
+
hwidth = plot_dict["hwidth"]
|
|
199
|
+
if hwidth is None:
|
|
200
|
+
hwidth = 1.0
|
|
201
|
+
if len(hvals) == slicer.shape[1]:
|
|
202
|
+
if plot_dict["hval"] is None:
|
|
203
|
+
hidx = int(len(hvals) / 2)
|
|
204
|
+
hval = hvals[hidx]
|
|
205
|
+
else:
|
|
206
|
+
hval = plot_dict["hval"]
|
|
207
|
+
hidx = np.where(np.abs(hvals - hval) == np.abs(hvals - hval).min())[0]
|
|
208
|
+
hidx = hidx[0]
|
|
209
|
+
else:
|
|
210
|
+
if plot_dict["hval"] is None:
|
|
211
|
+
hval = np.median(hvals)
|
|
212
|
+
hidx = np.where(np.abs(hvals - hval) <= hwidth / 2.0)[0]
|
|
213
|
+
else:
|
|
214
|
+
hval = plot_dict["hvals"]
|
|
215
|
+
hidx = np.where(np.abs(hvals - hval) <= hwidth / 2.0)[0]
|
|
216
|
+
if len(hvals) == slicer.shape[1]:
|
|
217
|
+
m_vals = np.swapaxes(metric_value, 1, 0)[hidx].filled()
|
|
218
|
+
else:
|
|
219
|
+
m_vals = metric_value[hidx].filled()
|
|
220
|
+
# Calculate the np_reduce'd metric values at each x/y bin.
|
|
221
|
+
if "color_min" in plot_dict:
|
|
222
|
+
badval = plot_dict["color_min"] - 1
|
|
223
|
+
else:
|
|
224
|
+
badval = slicer.badval
|
|
225
|
+
binvals = np.zeros((nybins, nxbins), dtype="float") + badval
|
|
226
|
+
xidxs = np.digitize(xvals, xbins) - 1
|
|
227
|
+
yidxs = np.digitize(yvals, ybins) - 1
|
|
228
|
+
reduce_func = plot_dict["np_reduce"]
|
|
229
|
+
if reduce_func is None:
|
|
230
|
+
reduce_func = np.mean
|
|
231
|
+
for iy in range(nybins):
|
|
232
|
+
ymatch = np.where(yidxs == iy)[0]
|
|
233
|
+
for ix in range(nxbins):
|
|
234
|
+
xmatch = np.where(xidxs[ymatch] == ix)[0]
|
|
235
|
+
match_vals = m_vals[ymatch][xmatch]
|
|
236
|
+
if len(match_vals) > 0:
|
|
237
|
+
binvals[iy][ix] = reduce_func(match_vals)
|
|
238
|
+
xi, yi = np.meshgrid(xbins, ybins)
|
|
239
|
+
if "color_min" in plot_dict:
|
|
240
|
+
v_min = plot_dict["color_min"]
|
|
241
|
+
else:
|
|
242
|
+
v_min = binvals.min()
|
|
243
|
+
if "color_max" in plot_dict:
|
|
244
|
+
v_max = plot_dict["color_max"]
|
|
245
|
+
else:
|
|
246
|
+
v_max = binvals.max()
|
|
247
|
+
nlevels = plot_dict["levels"]
|
|
248
|
+
if nlevels is None:
|
|
249
|
+
nlevels = 200
|
|
250
|
+
levels = np.arange(v_min, v_max, (v_max - v_min) / float(nlevels))
|
|
251
|
+
plt.contourf(xi, yi, binvals, levels, extend="max", zorder=0, cmap=plot_dict["cmap"])
|
|
252
|
+
cbar = plt.colorbar()
|
|
253
|
+
label = plot_dict["label"]
|
|
254
|
+
if label is None:
|
|
255
|
+
label = ""
|
|
256
|
+
cbar.set_label(label + " @ H=%.1f" % (hval))
|
|
257
|
+
plt.title(plot_dict["title"])
|
|
258
|
+
plt.xlabel(plot_dict["xlabel"])
|
|
259
|
+
plt.ylabel(plot_dict["ylabel"])
|
|
260
|
+
return fig
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
class MetricVsOrbitPoints(BasePlotter):
|
|
264
|
+
"""
|
|
265
|
+
Plot metric values (at a particular H value) as function
|
|
266
|
+
of orbital parameters, using points for each metric value.
|
|
267
|
+
"""
|
|
268
|
+
|
|
269
|
+
def __init__(self, xaxis="q", yaxis="e"):
|
|
270
|
+
self.plot_type = "MetricVsOrbit"
|
|
271
|
+
self.object_plotter = False
|
|
272
|
+
self.default_plot_dict = {
|
|
273
|
+
"title": None,
|
|
274
|
+
"xlabel": xaxis,
|
|
275
|
+
"ylabel": yaxis,
|
|
276
|
+
"label": None,
|
|
277
|
+
"cmap": cm.viridis,
|
|
278
|
+
"xaxis": xaxis,
|
|
279
|
+
"yaxis": yaxis,
|
|
280
|
+
"h_val": None,
|
|
281
|
+
"Hwidth": None,
|
|
282
|
+
"foregroundPoints": True,
|
|
283
|
+
"backgroundPoints": False,
|
|
284
|
+
"figsize": None,
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
def __call__(self, metric_value, slicer, user_plot_dict, fig=None):
|
|
288
|
+
plot_dict = {}
|
|
289
|
+
plot_dict.update(self.default_plot_dict)
|
|
290
|
+
plot_dict.update(user_plot_dict)
|
|
291
|
+
if fig is None:
|
|
292
|
+
fig = plt.figure(figsize=plot_dict["figsize"])
|
|
293
|
+
xvals = slicer.slice_points["orbits"][plot_dict["xaxis"]]
|
|
294
|
+
yvals = slicer.slice_points["orbits"][plot_dict["yaxis"]]
|
|
295
|
+
# Identify the relevant metric_values for the Hvalue we want to plot.
|
|
296
|
+
hvals = slicer.slice_points["H"]
|
|
297
|
+
hwidth = plot_dict["hwidth"]
|
|
298
|
+
if hwidth is None:
|
|
299
|
+
hwidth = 1.0
|
|
300
|
+
if len(hvals) == slicer.shape[1]:
|
|
301
|
+
if plot_dict["hval"] is None:
|
|
302
|
+
hidx = int(len(hvals) / 2)
|
|
303
|
+
hval = hvals[hidx]
|
|
304
|
+
else:
|
|
305
|
+
hval = plot_dict["hval"]
|
|
306
|
+
hidx = np.where(np.abs(hvals - hval) == np.abs(hvals - hval).min())[0]
|
|
307
|
+
hidx = hidx[0]
|
|
308
|
+
else:
|
|
309
|
+
if plot_dict["hval"] is None:
|
|
310
|
+
hval = np.median(hvals)
|
|
311
|
+
hidx = np.where(np.abs(hvals - hval) <= hwidth / 2.0)[0]
|
|
312
|
+
else:
|
|
313
|
+
hval = plot_dict["hvals"]
|
|
314
|
+
hidx = np.where(np.abs(hvals - hval) <= hwidth / 2.0)[0]
|
|
315
|
+
if len(hvals) == slicer.shape[1]:
|
|
316
|
+
m_vals = np.swapaxes(metric_value, 1, 0)[hidx]
|
|
317
|
+
else:
|
|
318
|
+
m_vals = metric_value[hidx]
|
|
319
|
+
if "color_min" in plot_dict:
|
|
320
|
+
v_min = plot_dict["color_min"]
|
|
321
|
+
else:
|
|
322
|
+
v_min = m_vals.min()
|
|
323
|
+
if "color_max" in plot_dict:
|
|
324
|
+
v_max = plot_dict["color_max"]
|
|
325
|
+
else:
|
|
326
|
+
v_max = m_vals.max()
|
|
327
|
+
if plot_dict["backgroundPoints"]:
|
|
328
|
+
# This isn't quite right for the condition .. but will do for now.
|
|
329
|
+
condition = np.where(m_vals == 0)
|
|
330
|
+
plt.plot(
|
|
331
|
+
xvals[condition],
|
|
332
|
+
yvals[condition],
|
|
333
|
+
"r.",
|
|
334
|
+
markersize=4,
|
|
335
|
+
alpha=0.5,
|
|
336
|
+
zorder=3,
|
|
337
|
+
)
|
|
338
|
+
if plot_dict["foregroundPoints"]:
|
|
339
|
+
plt.scatter(
|
|
340
|
+
xvals,
|
|
341
|
+
yvals,
|
|
342
|
+
c=m_vals,
|
|
343
|
+
vmin=v_min,
|
|
344
|
+
vmax=v_max,
|
|
345
|
+
cmap=plot_dict["cmap"],
|
|
346
|
+
s=15,
|
|
347
|
+
alpha=0.8,
|
|
348
|
+
zorder=0,
|
|
349
|
+
)
|
|
350
|
+
cbar = plt.colorbar()
|
|
351
|
+
label = plot_dict["label"]
|
|
352
|
+
if label is None:
|
|
353
|
+
label = ""
|
|
354
|
+
cbar.set_label(label + " @ H=%.1f" % (hval))
|
|
355
|
+
plt.title(plot_dict["title"])
|
|
356
|
+
plt.xlabel(plot_dict["xlabel"])
|
|
357
|
+
plt.ylabel(plot_dict["ylabel"])
|
|
358
|
+
return fig
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
__all__ = ("TwoDSubsetData", "OneDSubsetData")
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import matplotlib.pyplot as plt
|
|
5
|
+
import numpy as np
|
|
6
|
+
from matplotlib import colors
|
|
7
|
+
|
|
8
|
+
from .perceptual_rainbow import make_pr_cmap
|
|
9
|
+
from .plot_handler import BasePlotter
|
|
10
|
+
|
|
11
|
+
perceptual_rainbow = make_pr_cmap()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class TwoDSubsetData(BasePlotter):
|
|
15
|
+
"""
|
|
16
|
+
Plot 2 axes from the slicer.sliceColList, identified by
|
|
17
|
+
plot_dict['xaxis']/['yaxis'], given the metric_values at all
|
|
18
|
+
slicepoints [sums over non-visible axes].
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def __init__(self):
|
|
22
|
+
self.plot_type = "2DBinnedData"
|
|
23
|
+
self.object_plotter = False
|
|
24
|
+
self.default_plot_dict = {
|
|
25
|
+
"title": None,
|
|
26
|
+
"xlabel": None,
|
|
27
|
+
"ylable": None,
|
|
28
|
+
"units": None,
|
|
29
|
+
"log_scale": False,
|
|
30
|
+
"clims": None,
|
|
31
|
+
"cmap": perceptual_rainbow,
|
|
32
|
+
"cbar_format": None,
|
|
33
|
+
"figsize": None,
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
def __call__(self, metric_values, slicer, user_plot_dict, fig=None):
|
|
37
|
+
"""
|
|
38
|
+
Parameters
|
|
39
|
+
----------
|
|
40
|
+
metric_value : `numpy.ma.MaskedArray`
|
|
41
|
+
The metric values from the bundle.
|
|
42
|
+
slicer : `rubin_sim.maf.slicers.TwoDSlicer`
|
|
43
|
+
The slicer.
|
|
44
|
+
user_plot_dict: `dict`
|
|
45
|
+
Dictionary of plot parameters set by user
|
|
46
|
+
(overrides default values).
|
|
47
|
+
fig : `matplotlib.figure.Figure`
|
|
48
|
+
Matplotlib figure number to use. Default = None, starts new figure.
|
|
49
|
+
|
|
50
|
+
Returns
|
|
51
|
+
-------
|
|
52
|
+
fig : `matplotlib.figure.Figure`
|
|
53
|
+
Figure with the plot.
|
|
54
|
+
"""
|
|
55
|
+
if slicer.slicer_name != "NDSlicer":
|
|
56
|
+
raise ValueError("TwoDSubsetData plots ndSlicer metric values")
|
|
57
|
+
plot_dict = {}
|
|
58
|
+
plot_dict.update(self.default_plot_dict)
|
|
59
|
+
plot_dict.update(user_plot_dict)
|
|
60
|
+
if "xaxis" not in plot_dict or "yaxis" not in plot_dict:
|
|
61
|
+
raise ValueError("xaxis and yaxis must be specified in plot_dict")
|
|
62
|
+
xaxis = plot_dict["xaxis"]
|
|
63
|
+
yaxis = plot_dict["yaxis"]
|
|
64
|
+
|
|
65
|
+
if fig is None:
|
|
66
|
+
fig = plt.figure(figsize=plot_dict["figsize"])
|
|
67
|
+
# Reshape the metric data so we can isolate the values to plot
|
|
68
|
+
# (just new view of data, not copy).
|
|
69
|
+
newshape = []
|
|
70
|
+
for b in slicer.bins:
|
|
71
|
+
newshape.append(len(b) - 1)
|
|
72
|
+
newshape.reverse()
|
|
73
|
+
md = metric_values.reshape(newshape)
|
|
74
|
+
# Sum over other dimensions.
|
|
75
|
+
# Note that masked values are not included in sum.
|
|
76
|
+
sumaxes = list(range(slicer.nD))
|
|
77
|
+
sumaxes.remove(xaxis)
|
|
78
|
+
sumaxes.remove(yaxis)
|
|
79
|
+
sumaxes = tuple(sumaxes)
|
|
80
|
+
md = md.sum(sumaxes)
|
|
81
|
+
# Plot the histogrammed data.
|
|
82
|
+
# Plot data.
|
|
83
|
+
x, y = np.meshgrid(slicer.bins[xaxis][:-1], slicer.bins[yaxis][:-1])
|
|
84
|
+
if plot_dict["log_scale"]:
|
|
85
|
+
norm = colors.LogNorm()
|
|
86
|
+
else:
|
|
87
|
+
norm = None
|
|
88
|
+
if plot_dict["clims"] is None:
|
|
89
|
+
im = plt.contourf(x, y, md, 250, norm=norm, extend="both", cmap=plot_dict["cmap"])
|
|
90
|
+
else:
|
|
91
|
+
im = plt.contourf(
|
|
92
|
+
x,
|
|
93
|
+
y,
|
|
94
|
+
md,
|
|
95
|
+
250,
|
|
96
|
+
norm=norm,
|
|
97
|
+
extend="both",
|
|
98
|
+
cmap=plot_dict["cmap"],
|
|
99
|
+
vmin=plot_dict["clims"][0],
|
|
100
|
+
vmax=plot_dict["clims"][1],
|
|
101
|
+
)
|
|
102
|
+
xlabel = plot_dict["xlabel"]
|
|
103
|
+
if xlabel is None:
|
|
104
|
+
xlabel = slicer.sliceColList[xaxis]
|
|
105
|
+
plt.xlabel(xlabel)
|
|
106
|
+
ylabel = plot_dict["ylabel"]
|
|
107
|
+
if ylabel is None:
|
|
108
|
+
ylabel = slicer.sliceColList[yaxis]
|
|
109
|
+
plt.ylabel(ylabel)
|
|
110
|
+
cb = plt.colorbar(
|
|
111
|
+
im,
|
|
112
|
+
aspect=25,
|
|
113
|
+
extend="both",
|
|
114
|
+
orientation="horizontal",
|
|
115
|
+
format=plot_dict["cbar_format"],
|
|
116
|
+
)
|
|
117
|
+
cb.set_label(plot_dict["units"])
|
|
118
|
+
plt.title(plot_dict["title"])
|
|
119
|
+
return fig
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class OneDSubsetData(BasePlotter):
|
|
123
|
+
"""
|
|
124
|
+
Plot a single axes from the sliceColList, identified by plot_dict['axis'],
|
|
125
|
+
given the metric_values at all slicepoints [sums over non-visible axes].
|
|
126
|
+
"""
|
|
127
|
+
|
|
128
|
+
def __init__(self):
|
|
129
|
+
self.plot_type = "1DBinnedData"
|
|
130
|
+
self.object_plotter = False
|
|
131
|
+
self.default_plot_dict = {
|
|
132
|
+
"title": None,
|
|
133
|
+
"xlabel": None,
|
|
134
|
+
"ylabel": None,
|
|
135
|
+
"label": None,
|
|
136
|
+
"units": None,
|
|
137
|
+
"log_scale": False,
|
|
138
|
+
"histRange": None,
|
|
139
|
+
"filled": False,
|
|
140
|
+
"alpha": 0.5,
|
|
141
|
+
"cmap": perceptual_rainbow,
|
|
142
|
+
"cbar_format": None,
|
|
143
|
+
"figsize": None,
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
def __call__(self, metric_values, slicer, user_plot_dict, fig=None):
|
|
147
|
+
"""
|
|
148
|
+
Parameters
|
|
149
|
+
----------
|
|
150
|
+
metric_value : `numpy.ma.MaskedArray`
|
|
151
|
+
The metric values from the bundle.
|
|
152
|
+
slicer : `rubin_sim.maf.slicers.TwoDSlicer`
|
|
153
|
+
The slicer.
|
|
154
|
+
user_plot_dict: `dict`
|
|
155
|
+
Dictionary of plot parameters set by user
|
|
156
|
+
(overrides default values).
|
|
157
|
+
fig : `matplotlib.figure.Figure`
|
|
158
|
+
Matplotlib figure number to use. Default = None, starts new figure.
|
|
159
|
+
|
|
160
|
+
Returns
|
|
161
|
+
-------
|
|
162
|
+
fig : `matplotlib.figure.Figure`
|
|
163
|
+
Figure with the plot.
|
|
164
|
+
"""
|
|
165
|
+
if slicer.slicer_name != "NDSlicer":
|
|
166
|
+
raise ValueError("TwoDSubsetData plots ndSlicer metric values")
|
|
167
|
+
|
|
168
|
+
plot_dict = {}
|
|
169
|
+
plot_dict.update(self.default_plot_dict)
|
|
170
|
+
plot_dict.update(user_plot_dict)
|
|
171
|
+
if "axis" not in plot_dict:
|
|
172
|
+
raise ValueError("axis for 1-d plot must be specified in plot_dict")
|
|
173
|
+
|
|
174
|
+
if fig is None:
|
|
175
|
+
fig = plt.Figure(figsize=plot_dict["figsize"])
|
|
176
|
+
# Reshape the metric data so we can isolate the values to plot
|
|
177
|
+
# (just new view of data, not copy).
|
|
178
|
+
axis = plot_dict["axis"]
|
|
179
|
+
newshape = []
|
|
180
|
+
for b in slicer.bins:
|
|
181
|
+
newshape.append(len(b) - 1)
|
|
182
|
+
newshape.reverse()
|
|
183
|
+
md = metric_values.reshape(newshape)
|
|
184
|
+
# Sum over other dimensions.
|
|
185
|
+
# Note that masked values are not included in sum.
|
|
186
|
+
sumaxes = list(range(slicer.nD))
|
|
187
|
+
sumaxes.remove(axis)
|
|
188
|
+
sumaxes = tuple(sumaxes)
|
|
189
|
+
md = md.sum(sumaxes)
|
|
190
|
+
# Plot the histogrammed data.
|
|
191
|
+
leftedge = slicer.bins[axis][:-1]
|
|
192
|
+
width = np.diff(slicer.bins[axis])
|
|
193
|
+
if plot_dict["filled"]:
|
|
194
|
+
plt.bar(
|
|
195
|
+
leftedge,
|
|
196
|
+
md,
|
|
197
|
+
width,
|
|
198
|
+
label=plot_dict["label"],
|
|
199
|
+
linewidth=0,
|
|
200
|
+
alpha=plot_dict["alpha"],
|
|
201
|
+
log=plot_dict["log_scale"],
|
|
202
|
+
)
|
|
203
|
+
else:
|
|
204
|
+
x = np.ravel(list(zip(leftedge, leftedge + width)))
|
|
205
|
+
y = np.ravel(list(zip(md, md)))
|
|
206
|
+
if plot_dict["log_scale"]:
|
|
207
|
+
plt.semilogy(x, y, label=plot_dict["label"])
|
|
208
|
+
else:
|
|
209
|
+
plt.plot(x, y, label=plot_dict["label"])
|
|
210
|
+
plt.ylabel(plot_dict["ylabel"])
|
|
211
|
+
xlabel = plot_dict["xlabel"]
|
|
212
|
+
if xlabel is None:
|
|
213
|
+
xlabel = slicer.sliceColName[axis]
|
|
214
|
+
if plot_dict["units"] is not None:
|
|
215
|
+
xlabel += " (" + plot_dict["units"] + ")"
|
|
216
|
+
plt.xlabel(xlabel)
|
|
217
|
+
if plot_dict["histRange"] is not None:
|
|
218
|
+
plt.xlim(plot_dict["histRange"])
|
|
219
|
+
plt.title(plot_dict["title"])
|
|
220
|
+
return fig
|