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,514 @@
|
|
|
1
|
+
import glob
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
import matplotlib.pyplot as plt
|
|
5
|
+
import numpy as np
|
|
6
|
+
import pandas as pd
|
|
7
|
+
|
|
8
|
+
import rubin_sim.maf.db as db
|
|
9
|
+
import rubin_sim.maf.metric_bundles as metricBundles
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def microlensing_fom(
|
|
13
|
+
save_folder,
|
|
14
|
+
result_db_path,
|
|
15
|
+
metric_data_path,
|
|
16
|
+
figsize=None,
|
|
17
|
+
figure_name="microlensing_fom",
|
|
18
|
+
):
|
|
19
|
+
"""
|
|
20
|
+
Processes a folder, puts together results for
|
|
21
|
+
discovery/detect metric, Npts metric, and Fisher metric,
|
|
22
|
+
and plots them in the four tE bins of 1 - 10 days,
|
|
23
|
+
10 - 30 days, 30 - 100 days, and 100 - 1000 days.
|
|
24
|
+
|
|
25
|
+
Parameters
|
|
26
|
+
----------
|
|
27
|
+
result_db_path : `str`
|
|
28
|
+
Path to the directory storing the result databases
|
|
29
|
+
generated by MAF.
|
|
30
|
+
metric_data_path : `str`
|
|
31
|
+
Path to the directory storing the npz files
|
|
32
|
+
generated by MAF.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
# get a dictionary of resultDb from given directory
|
|
36
|
+
result_dbs = get_results_dbs(result_db_path)
|
|
37
|
+
|
|
38
|
+
# the following line will be useful if you did not run MAF on all opsims
|
|
39
|
+
run_names = list(result_dbs.keys())
|
|
40
|
+
|
|
41
|
+
# retrieve metricBundles for each opsim run and store them in a dictionary
|
|
42
|
+
bundle_dicts = {}
|
|
43
|
+
|
|
44
|
+
for run_name in result_dbs:
|
|
45
|
+
bundle_dicts[run_name] = bundle_dict_from_disk(result_dbs[run_name], run_name, metric_data_path)
|
|
46
|
+
|
|
47
|
+
# generates results and metric info from default name of file
|
|
48
|
+
results = np.zeros(len(list(bundle_dicts.keys())))
|
|
49
|
+
results_compare = []
|
|
50
|
+
run_names = []
|
|
51
|
+
metric_types = []
|
|
52
|
+
min_t_es = np.zeros(len(list(bundle_dicts.keys())))
|
|
53
|
+
max_t_es = np.zeros(len(list(bundle_dicts.keys())))
|
|
54
|
+
for run in range(len(list(bundle_dicts.keys()))):
|
|
55
|
+
npz = np.load(
|
|
56
|
+
result_db_path + "/" + list(bundle_dicts.keys())[run] + ".npz",
|
|
57
|
+
allow_pickle=True,
|
|
58
|
+
)
|
|
59
|
+
relevant_columns = ["metric_values", "mask"]
|
|
60
|
+
df = pd.DataFrame.from_dict({item: npz[item] for item in relevant_columns})
|
|
61
|
+
run_name, metric_type, min_t_e, max_t_e = parse_t_e_run_types(list(bundle_dicts.keys())[run])
|
|
62
|
+
run_names.append(run_name)
|
|
63
|
+
metric_types.append(metric_type)
|
|
64
|
+
min_t_es[run] = min_t_e
|
|
65
|
+
max_t_es[run] = max_t_e
|
|
66
|
+
results[run] = get_results(df, metric_type)
|
|
67
|
+
if metric_type == "Npts":
|
|
68
|
+
nan_to_be = np.where(df["metric_values"] >= 10e10)[0]
|
|
69
|
+
df["metric_values"][nan_to_be] = np.nan
|
|
70
|
+
results_compare.append(df["metric_values"])
|
|
71
|
+
run_names = np.array(run_names)
|
|
72
|
+
metric_types = np.array(metric_types)
|
|
73
|
+
results_compare = np.array(results_compare)
|
|
74
|
+
|
|
75
|
+
plot_fom(
|
|
76
|
+
results,
|
|
77
|
+
run_names,
|
|
78
|
+
metric_types,
|
|
79
|
+
min_t_es,
|
|
80
|
+
max_t_es,
|
|
81
|
+
save_folder,
|
|
82
|
+
figure_name,
|
|
83
|
+
figsize=figsize,
|
|
84
|
+
)
|
|
85
|
+
plot_compare(results_compare, run_names, metric_types, min_t_es, max_t_es, save_folder)
|
|
86
|
+
|
|
87
|
+
return
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def parse_t_e_run_types(name):
|
|
91
|
+
"""
|
|
92
|
+
Parses names of MicrolensingMetric file names
|
|
93
|
+
|
|
94
|
+
Parameters
|
|
95
|
+
----------
|
|
96
|
+
name : `str`
|
|
97
|
+
A MicrolensingMetric file name
|
|
98
|
+
"""
|
|
99
|
+
split_name = name.split("MicrolensingMetric")
|
|
100
|
+
run_name = split_name[0][:-1]
|
|
101
|
+
metric_type = split_name[1].split("_")[1]
|
|
102
|
+
min_t_e = split_name[1].split("_")[3]
|
|
103
|
+
max_t_e = split_name[1].split("_")[4]
|
|
104
|
+
|
|
105
|
+
return run_name, metric_type, min_t_e, max_t_e
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def get_results(df, run_type, fisher_sigmat_e_t_e_cutoff=0.1):
|
|
109
|
+
"""
|
|
110
|
+
Plots the results from the discovery/detect metric, Npts metric,
|
|
111
|
+
and Fisher metric in three sub plots
|
|
112
|
+
|
|
113
|
+
Parameters
|
|
114
|
+
----------
|
|
115
|
+
df : `pandas.Dataframe`
|
|
116
|
+
Pandas dataframe of the results npz file
|
|
117
|
+
run_types : `np.ndarray`, (N,)
|
|
118
|
+
Array of strings describing microlensing metric type:
|
|
119
|
+
either 'detect', 'Npts', or 'Fisher' as parsed by the file name
|
|
120
|
+
fisher_sigmat_e_t_e_cutoff : `float`
|
|
121
|
+
Maximum normalized uncertainty in tE (sigmatE/tE) as determined by
|
|
122
|
+
3sigma values of pubished planet microlensing candidates
|
|
123
|
+
"""
|
|
124
|
+
total = len(df)
|
|
125
|
+
if run_type == "detect":
|
|
126
|
+
# Fraction of discovered/detected events
|
|
127
|
+
result = len(np.where(df["metric_values"] == 1)[0]) / total
|
|
128
|
+
elif run_type == "Npts":
|
|
129
|
+
# Average number of points per lightcurve
|
|
130
|
+
result = (
|
|
131
|
+
sum(
|
|
132
|
+
df["metric_values"][~np.isnan(df["metric_values"])][df["metric_values"] >= 0][
|
|
133
|
+
df["metric_values"] <= 10e10
|
|
134
|
+
]
|
|
135
|
+
)
|
|
136
|
+
/ total
|
|
137
|
+
)
|
|
138
|
+
elif run_type == "Fisher":
|
|
139
|
+
# Fraction of events with sigmatE/tE below the cutoff of 0.1
|
|
140
|
+
result = len(np.where(df["metric_values"] < fisher_sigmat_e_t_e_cutoff)[0]) / total
|
|
141
|
+
|
|
142
|
+
return result
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def plot_fom(results, run_names, run_types, min_t_e, max_t_e, save_folder, figure_name, figsize):
|
|
146
|
+
"""
|
|
147
|
+
Plots the results from the discovery/detect metric, Npts metric,
|
|
148
|
+
and Fisher metric in three sub plots
|
|
149
|
+
|
|
150
|
+
Parameters
|
|
151
|
+
----------
|
|
152
|
+
results : `np.ndarray`, (N,)
|
|
153
|
+
Results from the MicrolensingMetric from get_results() from the
|
|
154
|
+
respective microlensing metric type
|
|
155
|
+
run_names : `np.ndarray`, (N,)
|
|
156
|
+
Array of names of the OpSim run that was used in the metric
|
|
157
|
+
run_types : `np.ndarray`, (N,)
|
|
158
|
+
Array of strings describing microlensing metric type:
|
|
159
|
+
either 'detect', 'Npts', or 'Fisher' as parsed by the file name
|
|
160
|
+
min_t_e : `np.ndarray`, (N,)
|
|
161
|
+
Array of values describing the minium einstein crossing time (tE)
|
|
162
|
+
as parsed by the file name
|
|
163
|
+
max_t_e : `np.ndarray`, (N,)
|
|
164
|
+
Array of values describing the maximum einstein crossing time (tE)
|
|
165
|
+
as parsed by the file name
|
|
166
|
+
save_folder : `str`
|
|
167
|
+
String of folder name to save figure
|
|
168
|
+
figure_name : `str`
|
|
169
|
+
String of figure name
|
|
170
|
+
figsize : (`int`, `int`)
|
|
171
|
+
Tuple of figure size in inches.
|
|
172
|
+
Default is None, which sets figsize = (25, 30)
|
|
173
|
+
"""
|
|
174
|
+
if figsize is None:
|
|
175
|
+
figsize = (25, 30)
|
|
176
|
+
fig, (ax1, ax2, ax3) = plt.subplots(1, 3, sharey=True, figsize=figsize)
|
|
177
|
+
plt.tight_layout()
|
|
178
|
+
plt.subplots_adjust(wspace=0, hspace=0)
|
|
179
|
+
subfig_list = [ax1, ax2, ax3]
|
|
180
|
+
|
|
181
|
+
plt.rcdefaults()
|
|
182
|
+
font = {"weight": "heavy", "size": 30}
|
|
183
|
+
|
|
184
|
+
plt.rc("font", **font)
|
|
185
|
+
|
|
186
|
+
t_e_range_list = []
|
|
187
|
+
time_run_names = []
|
|
188
|
+
for i, j in zip(np.unique(min_t_e), np.unique(max_t_e)):
|
|
189
|
+
idx_in_range = np.where((min_t_e >= i) & (max_t_e <= j))
|
|
190
|
+
t_e_range_list.append(idx_in_range)
|
|
191
|
+
time_run_names.append("tE {}-{} days".format(int(i), int(j)))
|
|
192
|
+
|
|
193
|
+
detect_runs_idx = np.where(run_types == "detect")
|
|
194
|
+
npts_runs_idx = np.where(run_types == "Npts")
|
|
195
|
+
fisher_runs_idx = np.where(run_types == "Fisher")
|
|
196
|
+
run_type_list = [detect_runs_idx, npts_runs_idx, fisher_runs_idx]
|
|
197
|
+
|
|
198
|
+
for t_e_range in range(len(t_e_range_list)):
|
|
199
|
+
for run_type in range(len(run_type_list)):
|
|
200
|
+
# sorted alphabetically according to name of run
|
|
201
|
+
idx_list = list(
|
|
202
|
+
zip(
|
|
203
|
+
np.intersect1d(t_e_range_list[t_e_range], run_type_list[run_type]),
|
|
204
|
+
run_names[np.intersect1d(t_e_range_list[t_e_range], run_type_list[run_type])],
|
|
205
|
+
)
|
|
206
|
+
)
|
|
207
|
+
idx_list.sort(key=lambda x: x[1])
|
|
208
|
+
sorted_idxs = np.array([x[0] for x in idx_list])
|
|
209
|
+
subfig_list[run_type].plot(
|
|
210
|
+
results[sorted_idxs],
|
|
211
|
+
run_names[sorted_idxs],
|
|
212
|
+
label=time_run_names[t_e_range],
|
|
213
|
+
marker=".",
|
|
214
|
+
markersize=15,
|
|
215
|
+
linewidth=2.5,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
ax3.legend(bbox_to_anchor=(1, 1), fontsize=20)
|
|
219
|
+
|
|
220
|
+
plt.tight_layout()
|
|
221
|
+
plt.subplots_adjust(bottom=0.05)
|
|
222
|
+
ax1.set_xlabel("Discovery Efficiency")
|
|
223
|
+
ax2.set_xlabel("Avg Number of Points")
|
|
224
|
+
|
|
225
|
+
ax2.set_xscale("log")
|
|
226
|
+
ax3.set_xlabel("Characaterization Efficiency \n ($\\sigma_{t_E}/t_E$ < 0.1)")
|
|
227
|
+
plt.savefig(save_folder + "/" + figure_name + ".png", bbox_inches="tight")
|
|
228
|
+
|
|
229
|
+
return
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def plot_compare(results, run_names, run_types, min_t_e, max_t_e, save_folder, npts_required=10):
|
|
233
|
+
"""
|
|
234
|
+
Plots confusion matrix type plots comparing fraction detected,
|
|
235
|
+
characterized (via Fisher),
|
|
236
|
+
and fraction of events with at least npts_required points within 2 tE
|
|
237
|
+
|
|
238
|
+
Parameters
|
|
239
|
+
----------
|
|
240
|
+
results : `np.ndarray`, (N,)
|
|
241
|
+
Results from the MicrolensingMetric from get_results() from the
|
|
242
|
+
respective microlensing metric type
|
|
243
|
+
run_names : `np.ndarray`, (N,)
|
|
244
|
+
Array of names of the OpSim run that was used in the metric
|
|
245
|
+
run_types : `np.ndarray`, (N,)
|
|
246
|
+
Array of strings describing microlensing metric type:
|
|
247
|
+
either 'detect', 'Npts', or 'Fisher' as parsed by the file name
|
|
248
|
+
min_t_e : `np.ndarray`, (N,)
|
|
249
|
+
Array of values describing the minium einstein crossing time (tE)
|
|
250
|
+
as parsed by the file name
|
|
251
|
+
max_t_e : `np.ndarray`, (N,)
|
|
252
|
+
Array of values describing the maximum einstein crossing time (tE)
|
|
253
|
+
as parsed by the file name
|
|
254
|
+
save_folder : `str`
|
|
255
|
+
String of folder name to save figures
|
|
256
|
+
npts_required : `int`
|
|
257
|
+
Number of poitns within 2tE required for the number of points fraction.
|
|
258
|
+
"""
|
|
259
|
+
|
|
260
|
+
plt.rcdefaults()
|
|
261
|
+
font = {"weight": "heavy", "size": 20}
|
|
262
|
+
|
|
263
|
+
plt.rc("font", **font)
|
|
264
|
+
|
|
265
|
+
t_e_range_list = []
|
|
266
|
+
time_run_names = []
|
|
267
|
+
for i, j in zip(np.unique(min_t_e), np.unique(max_t_e)):
|
|
268
|
+
idx_in_range = np.where((min_t_e >= i) & (max_t_e <= j))
|
|
269
|
+
t_e_range_list.append(idx_in_range)
|
|
270
|
+
time_run_names.append("tE {}-{} days".format(int(i), int(j)))
|
|
271
|
+
|
|
272
|
+
detect_runs_idx = np.where(run_types == "detect")
|
|
273
|
+
npts_runs_idx = np.where(run_types == "Npts")
|
|
274
|
+
fisher_runs_idx = np.where(run_types == "Fisher")
|
|
275
|
+
|
|
276
|
+
run_name_list = np.unique(run_names)
|
|
277
|
+
|
|
278
|
+
for t_e_range in range(len(t_e_range_list)):
|
|
279
|
+
for run_name in run_name_list:
|
|
280
|
+
run_name_idxs = np.where(run_names == run_name)
|
|
281
|
+
t_e_run_name_interesct = np.intersect1d(t_e_range_list[t_e_range], run_name_idxs)
|
|
282
|
+
detect_results = results[np.intersect1d(t_e_run_name_interesct, detect_runs_idx)]
|
|
283
|
+
npts_results = results[np.intersect1d(t_e_run_name_interesct, npts_runs_idx)]
|
|
284
|
+
fisher_results = results[np.intersect1d(t_e_run_name_interesct, fisher_runs_idx)]
|
|
285
|
+
|
|
286
|
+
detected_fisher_comparison_matrix = detected_fisher_comparison(fisher_results, detect_results)
|
|
287
|
+
fisher_npts_comparison_matrix = fisher_npts_comparison(fisher_results, npts_results)
|
|
288
|
+
detected_npts_comparison_matrix = detected_npts_comparison(detect_results, npts_results)
|
|
289
|
+
|
|
290
|
+
confusion_matrix_plot(
|
|
291
|
+
detected_fisher_comparison_matrix,
|
|
292
|
+
"Discovered",
|
|
293
|
+
"Characterized",
|
|
294
|
+
run_name,
|
|
295
|
+
time_run_names[t_e_range],
|
|
296
|
+
save_folder,
|
|
297
|
+
)
|
|
298
|
+
confusion_matrix_plot(
|
|
299
|
+
fisher_npts_comparison_matrix,
|
|
300
|
+
"More than {} Points".format(npts_required),
|
|
301
|
+
"Characterized",
|
|
302
|
+
run_name,
|
|
303
|
+
time_run_names[t_e_range],
|
|
304
|
+
save_folder,
|
|
305
|
+
)
|
|
306
|
+
confusion_matrix_plot(
|
|
307
|
+
detected_npts_comparison_matrix,
|
|
308
|
+
"More than {} Points".format(npts_required),
|
|
309
|
+
"Detected",
|
|
310
|
+
run_name,
|
|
311
|
+
time_run_names[t_e_range],
|
|
312
|
+
save_folder,
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
return
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def confusion_matrix_plot(comparison_matrix, xlabel, ylabel, run_name, t_e_range, save_folder):
|
|
319
|
+
"""
|
|
320
|
+
Plots a confusion matrix type plot comparing two metric types.
|
|
321
|
+
|
|
322
|
+
Parameters
|
|
323
|
+
----------
|
|
324
|
+
comparison_matrix : `np.ndarray`, (N,)`
|
|
325
|
+
Array comparing two metric types (A and B) with the following shape:
|
|
326
|
+
[[(Yes A and Yes B), (Yes A and No B)], [(No A and Yes B),
|
|
327
|
+
(No A and No B)]]
|
|
328
|
+
where Yes A and Yes B are the number of events that pass both
|
|
329
|
+
the A and B criteria.
|
|
330
|
+
xlabel : `str`
|
|
331
|
+
Sring of xlabel (also used in file name of figure)
|
|
332
|
+
ylabel : `str`
|
|
333
|
+
Sring of ylabel (also used in file name of figure)
|
|
334
|
+
run_name : `str`
|
|
335
|
+
Name of the OpSim run that was used in the metric
|
|
336
|
+
(used in labels and file name)
|
|
337
|
+
t_e_range : `str`
|
|
338
|
+
String of the range of the tE (used in labels and file name)
|
|
339
|
+
save_folder : `str`
|
|
340
|
+
String of folder name to save figures
|
|
341
|
+
"""
|
|
342
|
+
|
|
343
|
+
fig, ax = plt.subplots(figsize=(5, 5))
|
|
344
|
+
|
|
345
|
+
ax.matshow(comparison_matrix, cmap=plt.cm.Blues, alpha=0.3)
|
|
346
|
+
for i in range(len(comparison_matrix[0])):
|
|
347
|
+
for j in range(len(comparison_matrix[1])):
|
|
348
|
+
ax.text(
|
|
349
|
+
x=j,
|
|
350
|
+
y=i,
|
|
351
|
+
s="{}".format(comparison_matrix[i, j]),
|
|
352
|
+
va="center",
|
|
353
|
+
ha="center",
|
|
354
|
+
size="medium",
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
ax.set(ylabel=ylabel, xlabel=xlabel, title=run_name + "\n" + t_e_range + "\n")
|
|
358
|
+
ax.set_xticklabels([np.nan, "Yes", "No"])
|
|
359
|
+
ax.set_yticklabels([np.nan, "Yes", "No"])
|
|
360
|
+
plt.tight_layout()
|
|
361
|
+
plt.savefig(save_folder + "/{}_{}_{}_{}.png".format(run_name, t_e_range, ylabel, xlabel))
|
|
362
|
+
plt.show()
|
|
363
|
+
plt.close()
|
|
364
|
+
return
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
def detected_fisher_comparison(fisher_results, detect_results, fisher_sigmat_e_t_e_cutoff=0.1):
|
|
368
|
+
"""
|
|
369
|
+
Returns an array of the following form where
|
|
370
|
+
A = fisher criteria and B = detection criteria:
|
|
371
|
+
[[(Yes A and Yes B), (Yes A and No B)], [(No A and Yes B),
|
|
372
|
+
(No A and No B)]]
|
|
373
|
+
where Yes A and Yes B are the number of events that pass both the
|
|
374
|
+
A and B criteria.
|
|
375
|
+
|
|
376
|
+
Parameters
|
|
377
|
+
----------
|
|
378
|
+
fisher_results : `np.ndarray`, (N,)
|
|
379
|
+
Array of results from running the Fisher metric of the
|
|
380
|
+
microlensing metric
|
|
381
|
+
detect_results : `np.ndarray`, (N,)
|
|
382
|
+
Array of results from running the detect metric of the
|
|
383
|
+
microlensing metric
|
|
384
|
+
fisher_sigmat_e_t_e_cutoff : `float`
|
|
385
|
+
Maximum normalized uncertainty in tE (sigmatE/tE) as determined by
|
|
386
|
+
3sigma values of pubished planet microlensing candidates
|
|
387
|
+
"""
|
|
388
|
+
char_detect = np.where((fisher_results < fisher_sigmat_e_t_e_cutoff) & (detect_results == 1))[0]
|
|
389
|
+
char_ndetect = np.where((fisher_results < fisher_sigmat_e_t_e_cutoff) & (detect_results == 0))[0]
|
|
390
|
+
nchar_detect = np.where((fisher_results > fisher_sigmat_e_t_e_cutoff) & (detect_results == 1))[0]
|
|
391
|
+
nchar_ndetect = np.where((fisher_results > fisher_sigmat_e_t_e_cutoff) & (detect_results == 0))[0]
|
|
392
|
+
return np.array([[len(char_detect), len(char_ndetect)], [len(nchar_detect), len(nchar_ndetect)]])
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
def fisher_npts_comparison(fisher_results, npts_results, npts_required=10, fisher_sigmat_e_t_e_cutoff=0.1):
|
|
396
|
+
"""
|
|
397
|
+
Returns an array of the following form where
|
|
398
|
+
A = fisher criteria and B = npts criteria:
|
|
399
|
+
[[(Yes A and Yes B), (Yes A and No B)], [(No A and Yes B),
|
|
400
|
+
(No A and No B)]]
|
|
401
|
+
where Yes A and Yes B are the number of events that pass both the
|
|
402
|
+
A and B criteria.
|
|
403
|
+
|
|
404
|
+
Parameters
|
|
405
|
+
----------
|
|
406
|
+
fisher_results : `np.ndarray`, (N,)
|
|
407
|
+
Array of results from running the Fisher metric of the
|
|
408
|
+
microlensing metric
|
|
409
|
+
npts_results : `np.ndarray`, (N,)
|
|
410
|
+
Array of results from running the Npts metric of the
|
|
411
|
+
microlensing metric
|
|
412
|
+
npts_required : `int`
|
|
413
|
+
Number of poitns within 2tE required for the number of points fraction.
|
|
414
|
+
fisher_sigmat_e_t_e_cutoff : `float`
|
|
415
|
+
Maximum normalized uncertainty in tE (sigmatE/tE) as determined by
|
|
416
|
+
3sigma values of pubished planet microlensing candidates
|
|
417
|
+
"""
|
|
418
|
+
char_npts = np.where((fisher_results < fisher_sigmat_e_t_e_cutoff) & (npts_results > npts_required))[0]
|
|
419
|
+
char_nnpts = np.where((fisher_results < fisher_sigmat_e_t_e_cutoff) & (npts_results < npts_required))[0]
|
|
420
|
+
nchar_npts = np.where((fisher_results > fisher_sigmat_e_t_e_cutoff) & (npts_results > npts_required))[0]
|
|
421
|
+
nchar_nnpts = np.where((fisher_results > fisher_sigmat_e_t_e_cutoff) & (npts_results < npts_required))[0]
|
|
422
|
+
return np.array([[len(char_npts), len(char_nnpts)], [len(nchar_npts), len(nchar_nnpts)]])
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
def detected_npts_comparison(detect_results, npts_results, npts_required=10):
|
|
426
|
+
"""
|
|
427
|
+
Returns an array of the following form where
|
|
428
|
+
A = detect criteria and B = npts criteria:
|
|
429
|
+
[[(Yes A and Yes B), (Yes A and No B)], [(No A and Yes B),
|
|
430
|
+
(No A and No B)]]
|
|
431
|
+
where Yes A and Yes B are the number of events that pass both the
|
|
432
|
+
A and B criteria.
|
|
433
|
+
|
|
434
|
+
Parameters
|
|
435
|
+
----------
|
|
436
|
+
detect_results : `np.ndarray`, (N,)
|
|
437
|
+
Array of results from running the detect metric of the
|
|
438
|
+
microlensing metric
|
|
439
|
+
npts_results : `np.ndarray`, (N,)
|
|
440
|
+
Array of results from running the Npts metric of the
|
|
441
|
+
microlensing metric
|
|
442
|
+
npts_required : `int`
|
|
443
|
+
Number of poitns within 2tE required for the number of points fraction.
|
|
444
|
+
"""
|
|
445
|
+
detect_npts = np.where((detect_results == 1) & (npts_results > npts_required))[0]
|
|
446
|
+
detect_nnpts = np.where((detect_results == 1) & (npts_results < npts_required))[0]
|
|
447
|
+
ndetect_npts = np.where((detect_results == 0) & (npts_results > npts_required))[0]
|
|
448
|
+
ndetect_nnpts = np.where((detect_results == 0) & (npts_results < npts_required))[0]
|
|
449
|
+
return np.array([[len(detect_npts), len(detect_nnpts)], [len(ndetect_npts), len(ndetect_nnpts)]])
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
def get_results_dbs(result_db_path):
|
|
453
|
+
"""
|
|
454
|
+
Create a dictionary of result_db from result_db files
|
|
455
|
+
via PCW Hackathan 2020 Resources
|
|
456
|
+
|
|
457
|
+
Parameters
|
|
458
|
+
----------
|
|
459
|
+
result_db_path : `str`
|
|
460
|
+
Path to the directory storing the result databases
|
|
461
|
+
generated by MAF.
|
|
462
|
+
|
|
463
|
+
Returns
|
|
464
|
+
-------
|
|
465
|
+
result_dbs : `dict`
|
|
466
|
+
A dictionary containing the ResultDb objects
|
|
467
|
+
reconstructed from result databases in the provided directory.
|
|
468
|
+
"""
|
|
469
|
+
|
|
470
|
+
result_dbs = {}
|
|
471
|
+
result_db_list = glob.glob(os.path.join(result_db_path, "*_result.db"))
|
|
472
|
+
for result_db in result_db_list:
|
|
473
|
+
run_name = os.path.basename(result_db).rsplit("_", 1)[0]
|
|
474
|
+
result_db = db.ResultsDb(database=result_db)
|
|
475
|
+
|
|
476
|
+
# Don't add empty results.db file,
|
|
477
|
+
if len(result_db.getAllMetricIds()) > 0:
|
|
478
|
+
result_dbs[run_name] = result_db
|
|
479
|
+
|
|
480
|
+
return result_dbs
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
def bundle_dict_from_disk(result_db, run_name, metric_data_path):
|
|
484
|
+
"""
|
|
485
|
+
Load metric data from disk and import them into metricBundles.
|
|
486
|
+
via PCW Hackathan 2020 Resources
|
|
487
|
+
|
|
488
|
+
Parameters
|
|
489
|
+
----------
|
|
490
|
+
results_db : `dict`
|
|
491
|
+
A ResultsDb object
|
|
492
|
+
run_name : `str`
|
|
493
|
+
The name of the opsim database for the metrics in results_db
|
|
494
|
+
metric_data_path : `str`
|
|
495
|
+
The path to the directory where the metric datafiles are stored.
|
|
496
|
+
|
|
497
|
+
Returns
|
|
498
|
+
-------
|
|
499
|
+
bundle_dict : `dict`
|
|
500
|
+
A dictionary of metricBundles reconstructed from the data
|
|
501
|
+
stored on disk.
|
|
502
|
+
"""
|
|
503
|
+
|
|
504
|
+
bundle_dict = {}
|
|
505
|
+
display_info = result_db.getMetricDisplayInfo()
|
|
506
|
+
for item in display_info:
|
|
507
|
+
metric_name = item["metric_name"]
|
|
508
|
+
metric_file_name = item["metricDataFile"]
|
|
509
|
+
metric_id = item["metric_id"]
|
|
510
|
+
newbundle = metricBundles.create_empty_metric_bundle()
|
|
511
|
+
newbundle.read(os.path.join(metric_data_path, metric_file_name))
|
|
512
|
+
newbundle.set_run_name(run_name)
|
|
513
|
+
bundle_dict[metric_id, metric_name] = newbundle
|
|
514
|
+
return bundle_dict
|