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,216 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
import warnings
|
|
3
|
+
|
|
4
|
+
import numpy as np
|
|
5
|
+
|
|
6
|
+
from rubin_sim.maf.slicers import MovieSlicer, UniSlicer
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def make_times(size=100, min=0.0, max=10.0, random=-1):
|
|
10
|
+
"""Generate a simple array of numbers, evenly arranged between min/max."""
|
|
11
|
+
datavalues = np.arange(0, size, dtype="float")
|
|
12
|
+
datavalues *= (float(max) - float(min)) / (datavalues.max() - datavalues.min())
|
|
13
|
+
datavalues += min
|
|
14
|
+
if random > 0:
|
|
15
|
+
rng = np.random.RandomState(random)
|
|
16
|
+
randorder = rng.rand(size)
|
|
17
|
+
randind = np.argsort(randorder)
|
|
18
|
+
datavalues = datavalues[randind]
|
|
19
|
+
datavalues = np.array(list(zip(datavalues)), dtype=[("times", "float")])
|
|
20
|
+
return datavalues
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class TestMovieSlicerSetup(unittest.TestCase):
|
|
24
|
+
def setUp(self):
|
|
25
|
+
self.testslicer = MovieSlicer(slice_col_name="times", cumulative=False, force_no_ffmpeg=True)
|
|
26
|
+
|
|
27
|
+
def tearDown(self):
|
|
28
|
+
del self.testslicer
|
|
29
|
+
self.testslicer = None
|
|
30
|
+
|
|
31
|
+
def test_slicertype(self):
|
|
32
|
+
"""Test instantiation of slicer sets slicer type as expected."""
|
|
33
|
+
self.assertEqual(self.testslicer.slicer_name, self.testslicer.__class__.__name__)
|
|
34
|
+
self.assertEqual(self.testslicer.slicer_name, "MovieSlicer")
|
|
35
|
+
|
|
36
|
+
def test_setup_slicer_bins(self):
|
|
37
|
+
"""Test setting up slicer using defined bins."""
|
|
38
|
+
dvmin = 0
|
|
39
|
+
dvmax = 1
|
|
40
|
+
nvalues = 1000
|
|
41
|
+
bins = np.arange(dvmin, dvmax, 0.1)
|
|
42
|
+
dv = make_times(nvalues, dvmin, dvmax, random=987)
|
|
43
|
+
# Used right bins?
|
|
44
|
+
self.testslicer = MovieSlicer(
|
|
45
|
+
slice_col_name="times", bins=bins, cumulative=False, force_no_ffmpeg=True
|
|
46
|
+
)
|
|
47
|
+
self.testslicer.setup_slicer(dv)
|
|
48
|
+
np.testing.assert_equal(self.testslicer.bins, bins)
|
|
49
|
+
self.assertEqual(self.testslicer.nslice, len(bins) - 1)
|
|
50
|
+
|
|
51
|
+
def test_setup_slicer_binsize(self):
|
|
52
|
+
"""Test setting up slicer using bin_size."""
|
|
53
|
+
dvmin = 0
|
|
54
|
+
dvmax = 1
|
|
55
|
+
dv = make_times(1000, dvmin, dvmax, random=1992)
|
|
56
|
+
bin_size = 0.1
|
|
57
|
+
for cumulative in [True, False]:
|
|
58
|
+
self.testslicer = MovieSlicer(
|
|
59
|
+
slice_col_name="times",
|
|
60
|
+
bin_size=bin_size,
|
|
61
|
+
cumulative=cumulative,
|
|
62
|
+
force_no_ffmpeg=True,
|
|
63
|
+
)
|
|
64
|
+
self.testslicer.setup_slicer(dv)
|
|
65
|
+
# Bins of the right size?
|
|
66
|
+
bindiff = np.diff(self.testslicer.bins)
|
|
67
|
+
self.assertAlmostEqual(bindiff.max(), bin_size)
|
|
68
|
+
self.assertAlmostEqual(bindiff.min(), bin_size)
|
|
69
|
+
# Test that warning works.
|
|
70
|
+
with warnings.catch_warnings(record=True) as w:
|
|
71
|
+
warnings.simplefilter("always")
|
|
72
|
+
self.testslicer = MovieSlicer(
|
|
73
|
+
slice_col_name="times",
|
|
74
|
+
bins=200,
|
|
75
|
+
bin_size=bin_size,
|
|
76
|
+
cumulative=False,
|
|
77
|
+
force_no_ffmpeg=True,
|
|
78
|
+
)
|
|
79
|
+
self.testslicer.setup_slicer(dv)
|
|
80
|
+
# Verify some things
|
|
81
|
+
self.assertIn("bin_size", str(w[-1].message))
|
|
82
|
+
|
|
83
|
+
def test_setup_slicer_nbins_zeros(self):
|
|
84
|
+
"""Test what happens if give slicer test data that is all
|
|
85
|
+
single-value."""
|
|
86
|
+
dv = np.zeros(100, float)
|
|
87
|
+
dv = np.array(list(zip(dv)), dtype=[("times", "float")])
|
|
88
|
+
nbins = 10
|
|
89
|
+
self.testslicer = MovieSlicer(
|
|
90
|
+
slice_col_name="times", bins=nbins, cumulative=False, force_no_ffmpeg=True
|
|
91
|
+
)
|
|
92
|
+
with warnings.catch_warnings(record=True) as w:
|
|
93
|
+
warnings.simplefilter("always")
|
|
94
|
+
self.testslicer.setup_slicer(dv)
|
|
95
|
+
self.assertIn("creasing bin_max", str(w[-1].message))
|
|
96
|
+
self.assertEqual(self.testslicer.nslice, nbins)
|
|
97
|
+
|
|
98
|
+
def test_setup_slicer_limits(self):
|
|
99
|
+
"""Test setting up slicer using bin_min/Max."""
|
|
100
|
+
bin_min = 0
|
|
101
|
+
bin_max = 1
|
|
102
|
+
nbins = 10
|
|
103
|
+
dvmin = -0.5
|
|
104
|
+
dvmax = 1.5
|
|
105
|
+
dv = make_times(1000, dvmin, dvmax, random=1772)
|
|
106
|
+
self.testslicer = MovieSlicer(
|
|
107
|
+
slice_col_name="times",
|
|
108
|
+
bin_min=bin_min,
|
|
109
|
+
bin_max=bin_max,
|
|
110
|
+
bins=nbins,
|
|
111
|
+
cumulative=False,
|
|
112
|
+
force_no_ffmpeg=True,
|
|
113
|
+
)
|
|
114
|
+
self.testslicer.setup_slicer(dv)
|
|
115
|
+
self.assertAlmostEqual(self.testslicer.bins.min(), bin_min)
|
|
116
|
+
self.assertAlmostEqual(self.testslicer.bins.max(), bin_max)
|
|
117
|
+
|
|
118
|
+
def test_indexing(self):
|
|
119
|
+
"""Test iteration and indexing."""
|
|
120
|
+
dvmin = 0
|
|
121
|
+
dvmax = 1
|
|
122
|
+
bins = np.arange(dvmin, dvmax + 0.05, 0.05)
|
|
123
|
+
self.testslicer = MovieSlicer(
|
|
124
|
+
slice_col_name="times", bins=bins, cumulative=False, force_no_ffmpeg=True
|
|
125
|
+
)
|
|
126
|
+
dv = make_times(1000, dvmin, dvmax, random=908223)
|
|
127
|
+
self.testslicer.setup_slicer(dv)
|
|
128
|
+
for i, (s, b) in enumerate(zip(self.testslicer, bins)):
|
|
129
|
+
self.assertEqual(s["slice_point"]["sid"], i)
|
|
130
|
+
self.assertEqual(s["slice_point"]["bin_left"], b)
|
|
131
|
+
self.assertLessEqual(s["slice_point"]["bin_right"], bins[i + 1])
|
|
132
|
+
for i in [0, len(self.testslicer) // 2, len(self.testslicer) - 1]:
|
|
133
|
+
self.assertEqual(self.testslicer[i]["slice_point"]["sid"], i)
|
|
134
|
+
self.assertEqual(self.testslicer[i]["slice_point"]["bin_left"], bins[i])
|
|
135
|
+
|
|
136
|
+
def test_equivalence(self):
|
|
137
|
+
"""Test equals method."""
|
|
138
|
+
# Note that two Movie slicers will be considered equal
|
|
139
|
+
# if they are both the same kind of
|
|
140
|
+
# slicer AND have the same bins.
|
|
141
|
+
# Set up self..
|
|
142
|
+
dvmin = 0
|
|
143
|
+
dvmax = 1
|
|
144
|
+
nvalues = 1000
|
|
145
|
+
bins = np.arange(dvmin, dvmax, 0.01)
|
|
146
|
+
dv = make_times(nvalues, dvmin, dvmax, random=72031)
|
|
147
|
+
self.testslicer = MovieSlicer(
|
|
148
|
+
slice_col_name="times", bins=bins, cumulative=False, force_no_ffmpeg=True
|
|
149
|
+
)
|
|
150
|
+
self.testslicer.setup_slicer(dv)
|
|
151
|
+
# Set up another slicer to match
|
|
152
|
+
# (same bins, although not the same data).
|
|
153
|
+
dv2 = make_times(nvalues + 100, dvmin, dvmax, random=56221)
|
|
154
|
+
testslicer2 = MovieSlicer(slice_col_name="times", bins=bins, cumulative=False, force_no_ffmpeg=True)
|
|
155
|
+
testslicer2.setup_slicer(dv2)
|
|
156
|
+
self.assertEqual(self.testslicer, testslicer2)
|
|
157
|
+
# Set up another slicer that should not match (different bins)
|
|
158
|
+
dv2 = make_times(nvalues, dvmin + 1, dvmax + 1, random=542093)
|
|
159
|
+
testslicer2 = MovieSlicer(
|
|
160
|
+
slice_col_name="times",
|
|
161
|
+
bins=len(bins),
|
|
162
|
+
cumulative=False,
|
|
163
|
+
force_no_ffmpeg=True,
|
|
164
|
+
)
|
|
165
|
+
testslicer2.setup_slicer(dv2)
|
|
166
|
+
self.assertNotEqual(self.testslicer, testslicer2)
|
|
167
|
+
# Set up a different kind of slicer that should not match.
|
|
168
|
+
dv2 = make_times(100, 0, 1, random=16)
|
|
169
|
+
testslicer2 = UniSlicer()
|
|
170
|
+
testslicer2.setup_slicer(dv2)
|
|
171
|
+
self.assertNotEqual(self.testslicer, testslicer2)
|
|
172
|
+
|
|
173
|
+
def test_slicing(self):
|
|
174
|
+
"""Test slicing."""
|
|
175
|
+
dvmin = 0
|
|
176
|
+
dvmax = 1
|
|
177
|
+
nbins = 100
|
|
178
|
+
# Test that testbinner raises appropriate error before it's set up
|
|
179
|
+
# (first time)
|
|
180
|
+
self.assertRaises(NotImplementedError, self.testslicer._slice_sim_data, 0)
|
|
181
|
+
for nvalues in (100, 1000):
|
|
182
|
+
dv = make_times(nvalues, dvmin, dvmax, random=82)
|
|
183
|
+
# Test differential case.
|
|
184
|
+
self.testslicer = MovieSlicer(
|
|
185
|
+
slice_col_name="times",
|
|
186
|
+
bins=nbins,
|
|
187
|
+
cumulative=False,
|
|
188
|
+
force_no_ffmpeg=True,
|
|
189
|
+
)
|
|
190
|
+
self.testslicer.setup_slicer(dv)
|
|
191
|
+
sum = 0
|
|
192
|
+
for i, s in enumerate(self.testslicer):
|
|
193
|
+
idxs = s["idxs"]
|
|
194
|
+
data_slice = dv["times"][idxs]
|
|
195
|
+
sum += len(idxs)
|
|
196
|
+
if len(data_slice) > 0:
|
|
197
|
+
self.assertEqual(len(data_slice), nvalues / float(nbins))
|
|
198
|
+
else:
|
|
199
|
+
raise ValueError("Data in test case expected to always be > 0 len after slicing")
|
|
200
|
+
self.assertEqual(sum, nvalues)
|
|
201
|
+
# And cumulative case.
|
|
202
|
+
self.testslicer = MovieSlicer(
|
|
203
|
+
slice_col_name="times",
|
|
204
|
+
bins=nbins,
|
|
205
|
+
cumulative=True,
|
|
206
|
+
force_no_ffmpeg=True,
|
|
207
|
+
)
|
|
208
|
+
self.testslicer.setup_slicer(dv)
|
|
209
|
+
for i, s in enumerate(self.testslicer):
|
|
210
|
+
idxs = s["idxs"]
|
|
211
|
+
data_slice = dv["times"][idxs]
|
|
212
|
+
self.assertGreater(len(data_slice), 0)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
if __name__ == "__main__":
|
|
216
|
+
unittest.main()
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import itertools
|
|
2
|
+
import unittest
|
|
3
|
+
import warnings
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
import numpy.lib.recfunctions as rfn
|
|
7
|
+
|
|
8
|
+
from rubin_sim.maf.slicers import NDSlicer, UniSlicer
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def make_data_values(size=100, min=0.0, max=1.0, nd=3, random=-1):
|
|
12
|
+
"""Generate a simple array of numbers, evenly arranged between min/max,
|
|
13
|
+
in nd dimensions, but (optional) random order.
|
|
14
|
+
"""
|
|
15
|
+
data = []
|
|
16
|
+
for d in range(nd):
|
|
17
|
+
datavalues = np.arange(0, size, dtype="float")
|
|
18
|
+
datavalues *= (float(max) - float(min)) / (datavalues.max() - datavalues.min())
|
|
19
|
+
datavalues += min
|
|
20
|
+
if random > 0:
|
|
21
|
+
rng = np.random.RandomState(random)
|
|
22
|
+
randorder = rng.rand(size)
|
|
23
|
+
randind = np.argsort(randorder)
|
|
24
|
+
datavalues = datavalues[randind]
|
|
25
|
+
datavalues = np.array(list(zip(datavalues)), dtype=[("testdata" + "%d" % (d), "float")])
|
|
26
|
+
data.append(datavalues)
|
|
27
|
+
data = rfn.merge_arrays(data, flatten=True, usemask=False)
|
|
28
|
+
return data
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class TestNDSlicerSetup(unittest.TestCase):
|
|
32
|
+
def setUp(self):
|
|
33
|
+
self.dvmin = 0
|
|
34
|
+
self.dvmax = 1
|
|
35
|
+
nvalues = 1000
|
|
36
|
+
self.nd = 3
|
|
37
|
+
self.dv = make_data_values(nvalues, self.dvmin, self.dvmax, self.nd, random=608)
|
|
38
|
+
self.dvlist = self.dv.dtype.names
|
|
39
|
+
|
|
40
|
+
def test_slicertype(self):
|
|
41
|
+
"""Test instantiation of slicer sets slicer type as expected."""
|
|
42
|
+
testslicer = NDSlicer(self.dvlist)
|
|
43
|
+
self.assertEqual(testslicer.slicer_name, testslicer.__class__.__name__)
|
|
44
|
+
self.assertEqual(testslicer.slicer_name, "NDSlicer")
|
|
45
|
+
|
|
46
|
+
def test_setup_slicer_bins(self):
|
|
47
|
+
"""Test setting up slicer using defined bins."""
|
|
48
|
+
# Used right bins?
|
|
49
|
+
bins = np.arange(self.dvmin, self.dvmax, 0.1)
|
|
50
|
+
binlist = []
|
|
51
|
+
for d in range(self.nd):
|
|
52
|
+
binlist.append(bins)
|
|
53
|
+
testslicer = NDSlicer(self.dvlist, bins_list=binlist)
|
|
54
|
+
testslicer.setup_slicer(self.dv)
|
|
55
|
+
for d in range(self.nd):
|
|
56
|
+
np.testing.assert_equal(testslicer.bins[d], bins)
|
|
57
|
+
self.assertEqual(testslicer.nslice, (len(bins) - 1) ** self.nd)
|
|
58
|
+
|
|
59
|
+
def test_setup_slicer_nbins(self):
|
|
60
|
+
"""Test setting up slicer using nbins."""
|
|
61
|
+
for nvalues in (100, 1000):
|
|
62
|
+
for nbins in (5, 25, 74):
|
|
63
|
+
dv = make_data_values(nvalues, self.dvmin, self.dvmax, self.nd, random=-1)
|
|
64
|
+
# Right number of bins?
|
|
65
|
+
# expect one more 'bin' to accomodate last right edge,
|
|
66
|
+
# but nbins accounts for this
|
|
67
|
+
testslicer = NDSlicer(self.dvlist, bins_list=nbins)
|
|
68
|
+
testslicer.setup_slicer(dv)
|
|
69
|
+
self.assertEqual(testslicer.nslice, nbins**self.nd)
|
|
70
|
+
# Bins of the right size?
|
|
71
|
+
for i in range(self.nd):
|
|
72
|
+
bindiff = np.diff(testslicer.bins[i])
|
|
73
|
+
expectedbindiff = (self.dvmax - self.dvmin) / float(nbins)
|
|
74
|
+
np.testing.assert_allclose(bindiff, expectedbindiff)
|
|
75
|
+
# Can we use a list of nbins too and get the
|
|
76
|
+
# right number of bins?
|
|
77
|
+
nbins_list = []
|
|
78
|
+
expectednbins = 1
|
|
79
|
+
for d in range(self.nd):
|
|
80
|
+
nbins_list.append(nbins + d)
|
|
81
|
+
expectednbins *= nbins + d
|
|
82
|
+
testslicer = NDSlicer(self.dvlist, bins_list=nbins_list)
|
|
83
|
+
testslicer.setup_slicer(dv)
|
|
84
|
+
self.assertEqual(testslicer.nslice, expectednbins)
|
|
85
|
+
|
|
86
|
+
def test_setup_slicer_nbins_zeros(self):
|
|
87
|
+
"""Test handling case of data being single values."""
|
|
88
|
+
dv = make_data_values(100, 0, 0, self.nd, random=-1)
|
|
89
|
+
nbins = 10
|
|
90
|
+
testslicer = NDSlicer(self.dvlist, bins_list=nbins)
|
|
91
|
+
with warnings.catch_warnings(record=True) as w:
|
|
92
|
+
warnings.simplefilter("always")
|
|
93
|
+
testslicer.setup_slicer(dv)
|
|
94
|
+
self.assertIn("creasing bin_max", str(w[-1].message))
|
|
95
|
+
expectednbins = nbins**self.nd
|
|
96
|
+
self.assertEqual(testslicer.nslice, expectednbins)
|
|
97
|
+
|
|
98
|
+
def test_setup_slicer_equivalent(self):
|
|
99
|
+
"""Test setting up slicer using defined bins and nbins is
|
|
100
|
+
equal where expected.
|
|
101
|
+
"""
|
|
102
|
+
for nbins in (20, 105):
|
|
103
|
+
testslicer = NDSlicer(self.dvlist, bins_list=nbins)
|
|
104
|
+
bins = make_data_values(nbins + 1, self.dvmin, self.dvmax, self.nd, random=-1)
|
|
105
|
+
bins_list = []
|
|
106
|
+
for i in bins.dtype.names:
|
|
107
|
+
bins_list.append(bins[i])
|
|
108
|
+
for nvalues in (100, 10000):
|
|
109
|
+
dv = make_data_values(nvalues, self.dvmin, self.dvmax, self.nd, random=64432)
|
|
110
|
+
testslicer.setup_slicer(dv)
|
|
111
|
+
for i in range(self.nd):
|
|
112
|
+
np.testing.assert_allclose(testslicer.bins[i], bins_list[i])
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class TestNDSlicerEqual(unittest.TestCase):
|
|
116
|
+
def setUp(self):
|
|
117
|
+
self.dvmin = 0
|
|
118
|
+
self.dvmax = 1
|
|
119
|
+
nvalues = 1000
|
|
120
|
+
self.nd = 3
|
|
121
|
+
self.dv = make_data_values(nvalues, self.dvmin, self.dvmax, self.nd, random=20367)
|
|
122
|
+
self.dvlist = self.dv.dtype.names
|
|
123
|
+
self.testslicer = NDSlicer(self.dvlist, bins_list=100)
|
|
124
|
+
self.testslicer.setup_slicer(self.dv)
|
|
125
|
+
|
|
126
|
+
def tearDown(self):
|
|
127
|
+
del self.testslicer
|
|
128
|
+
self.testslicer = None
|
|
129
|
+
|
|
130
|
+
def test_equivalence(self):
|
|
131
|
+
"""Test equals method."""
|
|
132
|
+
# Note that two ND slicers will be considered equal if
|
|
133
|
+
# they are both the same kind of slicer AND have the same bins in
|
|
134
|
+
# all dimensions.
|
|
135
|
+
# Set up another slicer to match
|
|
136
|
+
# (same bins, although not the same data).
|
|
137
|
+
dv2 = make_data_values(100, self.dvmin, self.dvmax, self.nd, random=10029)
|
|
138
|
+
dvlist = dv2.dtype.names
|
|
139
|
+
testslicer2 = NDSlicer(slice_col_list=dvlist, bins_list=self.testslicer.bins)
|
|
140
|
+
testslicer2.setup_slicer(dv2)
|
|
141
|
+
self.assertEqual(self.testslicer, testslicer2)
|
|
142
|
+
# Set up another slicer that should not match (different bins)
|
|
143
|
+
dv2 = make_data_values(1000, self.dvmin + 1, self.dvmax + 1, self.nd, random=209837)
|
|
144
|
+
testslicer2 = NDSlicer(slice_col_list=dvlist, bins_list=100)
|
|
145
|
+
testslicer2.setup_slicer(dv2)
|
|
146
|
+
self.assertNotEqual(self.testslicer, testslicer2)
|
|
147
|
+
# Set up another slicer that should not match (different dimensions)
|
|
148
|
+
dv2 = make_data_values(1000, self.dvmin, self.dvmax, self.nd - 1, random=50623)
|
|
149
|
+
testslicer2 = NDSlicer(dv2.dtype.names, bins_list=100)
|
|
150
|
+
testslicer2.setup_slicer(dv2)
|
|
151
|
+
self.assertNotEqual(self.testslicer, testslicer2)
|
|
152
|
+
# Set up a different kind of slicer that should not match.
|
|
153
|
+
testslicer2 = UniSlicer()
|
|
154
|
+
dv2 = make_data_values(100, 0, 1, random=22310098)
|
|
155
|
+
testslicer2.setup_slicer(dv2)
|
|
156
|
+
self.assertNotEqual(self.testslicer, testslicer2)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class TestNDSlicerIteration(unittest.TestCase):
|
|
160
|
+
def setUp(self):
|
|
161
|
+
self.dvmin = 0
|
|
162
|
+
self.dvmax = 1
|
|
163
|
+
nvalues = 1000
|
|
164
|
+
self.nd = 3
|
|
165
|
+
self.dv = make_data_values(nvalues, self.dvmin, self.dvmax, self.nd, random=11081)
|
|
166
|
+
self.dvlist = self.dv.dtype.names
|
|
167
|
+
nvalues = 1000
|
|
168
|
+
bins = np.arange(self.dvmin, self.dvmax, 0.1)
|
|
169
|
+
bins_list = []
|
|
170
|
+
self.iterlist = []
|
|
171
|
+
for i in range(self.nd):
|
|
172
|
+
bins_list.append(bins)
|
|
173
|
+
# (remember iteration doesn't use the very last bin in 'bins')
|
|
174
|
+
self.iterlist.append(bins[:-1])
|
|
175
|
+
dv = make_data_values(nvalues, self.dvmin, self.dvmax, self.nd, random=17)
|
|
176
|
+
self.testslicer = NDSlicer(self.dvlist, bins_list=bins_list)
|
|
177
|
+
self.testslicer.setup_slicer(dv)
|
|
178
|
+
|
|
179
|
+
def tearDown(self):
|
|
180
|
+
del self.testslicer
|
|
181
|
+
self.testslicer = None
|
|
182
|
+
|
|
183
|
+
def test_iteration(self):
|
|
184
|
+
"""Test iteration."""
|
|
185
|
+
for s, ib in zip(self.testslicer, itertools.product(*self.iterlist)):
|
|
186
|
+
self.assertEqual(s["slice_point"]["bin_left"], ib)
|
|
187
|
+
|
|
188
|
+
def test_get_item(self):
|
|
189
|
+
"""Test getting indexed binpoint."""
|
|
190
|
+
for i, s in enumerate(self.testslicer):
|
|
191
|
+
self.assertEqual(
|
|
192
|
+
self.testslicer[i]["slice_point"]["bin_left"],
|
|
193
|
+
s["slice_point"]["bin_left"],
|
|
194
|
+
)
|
|
195
|
+
self.assertEqual(self.testslicer[0]["slice_point"]["bin_left"], (0.0, 0.0, 0.0))
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
class TestNDSlicerSlicing(unittest.TestCase):
|
|
199
|
+
def setUp(self):
|
|
200
|
+
self.dvmin = 0
|
|
201
|
+
self.dvmax = 1
|
|
202
|
+
nvalues = 1000
|
|
203
|
+
self.nd = 3
|
|
204
|
+
self.dv = make_data_values(nvalues, self.dvmin, self.dvmax, self.nd, random=173)
|
|
205
|
+
self.dvlist = self.dv.dtype.names
|
|
206
|
+
self.testslicer = NDSlicer(self.dvlist)
|
|
207
|
+
|
|
208
|
+
def tearDown(self):
|
|
209
|
+
del self.testslicer
|
|
210
|
+
self.testslicer = None
|
|
211
|
+
|
|
212
|
+
def test_slicing(self):
|
|
213
|
+
"""Test slicing."""
|
|
214
|
+
# Test get error if try to slice before setup.
|
|
215
|
+
self.assertRaises(NotImplementedError, self.testslicer._slice_sim_data, 0)
|
|
216
|
+
nbins = 10
|
|
217
|
+
bin_size = (self.dvmax - self.dvmin) / (float(nbins))
|
|
218
|
+
self.testslicer = NDSlicer(self.dvlist, bins_list=nbins)
|
|
219
|
+
for nvalues in (1000, 10000):
|
|
220
|
+
dv = make_data_values(nvalues, self.dvmin, self.dvmax, self.nd, random=1735)
|
|
221
|
+
self.testslicer.setup_slicer(dv)
|
|
222
|
+
sum = 0
|
|
223
|
+
for i, s in enumerate(self.testslicer):
|
|
224
|
+
idxs = s["idxs"]
|
|
225
|
+
data_slice = dv[idxs]
|
|
226
|
+
sum += len(idxs)
|
|
227
|
+
if len(data_slice) > 0:
|
|
228
|
+
for i, dvname, b in zip(list(range(self.nd)), self.dvlist, s["slice_point"]["bin_left"]):
|
|
229
|
+
self.assertGreaterEqual((data_slice[dvname].min() - b), 0)
|
|
230
|
+
if i < self.testslicer.nslice - 1:
|
|
231
|
+
self.assertLessEqual((data_slice[dvname].max() - b), bin_size)
|
|
232
|
+
else:
|
|
233
|
+
self.assertAlmostEqual((data_slice[dvname].max() - b), bin_size)
|
|
234
|
+
self.assertEqual(len(data_slice), nvalues / float(nbins))
|
|
235
|
+
# and check that every data value was assigned somewhere.
|
|
236
|
+
self.assertEqual(sum, nvalues)
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
if __name__ == "__main__":
|
|
240
|
+
unittest.main()
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
import rubin_sim.maf.plots as plots
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TestNeoDistancePlotter(unittest.TestCase):
|
|
9
|
+
def setUp(self):
|
|
10
|
+
rng = np.random.RandomState(61723009)
|
|
11
|
+
names = [
|
|
12
|
+
"eclipLat",
|
|
13
|
+
"eclipLon",
|
|
14
|
+
"MaxGeoDist",
|
|
15
|
+
"NEOHelioX",
|
|
16
|
+
"NEOHelioY",
|
|
17
|
+
"filter",
|
|
18
|
+
]
|
|
19
|
+
types = [float] * 5
|
|
20
|
+
types.append("|S1")
|
|
21
|
+
npts = 100
|
|
22
|
+
self.metric_values = np.zeros(npts, list(zip(names, types)))
|
|
23
|
+
self.metric_values["MaxGeoDist"] = rng.rand(npts) * 2.0
|
|
24
|
+
self.metric_values["eclipLat"] = rng.rand(npts)
|
|
25
|
+
self.metric_values["NEOHelioX"] = rng.rand(npts) * 3 - 1.5
|
|
26
|
+
self.metric_values["NEOHelioY"] = rng.rand(npts) * 3 - 1.5 + 1
|
|
27
|
+
self.metric_values["filter"] = "g"
|
|
28
|
+
|
|
29
|
+
def test_plotter(self):
|
|
30
|
+
"""
|
|
31
|
+
Just test that it can make a figure without throwing an error.
|
|
32
|
+
"""
|
|
33
|
+
plotter = plots.NeoDistancePlotter()
|
|
34
|
+
# Need to wrap in a list because it will usually go through the
|
|
35
|
+
# UniSlicer, and will thus be an array inside a 1-element masked array
|
|
36
|
+
fig = plotter([self.metric_values], None, {})
|
|
37
|
+
self.assertNotEqual(fig, None)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
if __name__ == "__main__":
|
|
41
|
+
unittest.main()
|