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,239 @@
|
|
|
1
|
+
__all__ = ("run_moving_calc",)
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
from rubin_scheduler.utils import SURVEY_START_MJD
|
|
8
|
+
|
|
9
|
+
from rubin_sim.maf.slicers import MoObjSlicer
|
|
10
|
+
|
|
11
|
+
from . import batches as batches
|
|
12
|
+
from . import db as db
|
|
13
|
+
from . import metricBundles as mmB
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def run_moving_calc():
|
|
17
|
+
"""Calculate metric values for an input population. Can be used on either
|
|
18
|
+
a split or complete population. If running on a split population for later
|
|
19
|
+
re-combining, use the complete set of orbits as the 'orbit_file'. Assumes
|
|
20
|
+
you have already created the moving object observation files.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
parser = argparse.ArgumentParser(description="Run moving object metrics for a particular scheduler run.")
|
|
24
|
+
parser.add_argument("--orbit_file", type=str, help="File containing the moving object orbits.")
|
|
25
|
+
parser.add_argument(
|
|
26
|
+
"--objtype",
|
|
27
|
+
type=str,
|
|
28
|
+
default="",
|
|
29
|
+
help="Object type, to set up default characterization/H value parameters "
|
|
30
|
+
"(if they're not specified by flags) and to label outputs.",
|
|
31
|
+
)
|
|
32
|
+
parser.add_argument(
|
|
33
|
+
"--obs_file",
|
|
34
|
+
type=str,
|
|
35
|
+
help="File containing the observations of the moving objects.",
|
|
36
|
+
)
|
|
37
|
+
parser.add_argument(
|
|
38
|
+
"--out_dir",
|
|
39
|
+
type=str,
|
|
40
|
+
default=".",
|
|
41
|
+
help="Output directory for moving object metrics. Default '.'.",
|
|
42
|
+
)
|
|
43
|
+
parser.add_argument(
|
|
44
|
+
"--simulation_db",
|
|
45
|
+
type=str,
|
|
46
|
+
default=None,
|
|
47
|
+
help="Path and filename of opsim output sqlite file, to write config* files to output directory."
|
|
48
|
+
" Optional: if not provided, files won't have useful names.",
|
|
49
|
+
)
|
|
50
|
+
parser.add_argument(
|
|
51
|
+
"--h_min",
|
|
52
|
+
type=float,
|
|
53
|
+
help="Minimum H value. " "If not set, defaults from objtype will be used.",
|
|
54
|
+
)
|
|
55
|
+
parser.add_argument(
|
|
56
|
+
"--h_max",
|
|
57
|
+
type=float,
|
|
58
|
+
help="Maximum H value. " "If not set, defaults from objtype will be used.",
|
|
59
|
+
)
|
|
60
|
+
parser.add_argument(
|
|
61
|
+
"--h_step",
|
|
62
|
+
type=float,
|
|
63
|
+
help="Stepsizes in H values. " "If not set, defaults from objtype will be used.",
|
|
64
|
+
)
|
|
65
|
+
parser.add_argument(
|
|
66
|
+
"--h_mark",
|
|
67
|
+
type=float,
|
|
68
|
+
default=None,
|
|
69
|
+
help="Add vertical lines at H=h_mark on plots. Default None.",
|
|
70
|
+
)
|
|
71
|
+
parser.add_argument(
|
|
72
|
+
"--characterization",
|
|
73
|
+
type=str,
|
|
74
|
+
help="Inner/Outer solar system characterization. " "If unset, defaults from objtype will be used.",
|
|
75
|
+
)
|
|
76
|
+
parser.add_argument(
|
|
77
|
+
"--constraint_info_label",
|
|
78
|
+
type=str,
|
|
79
|
+
default="",
|
|
80
|
+
help="Metadata to add to the output files beyond objtype. Typically translation of "
|
|
81
|
+
"the sql constraint into something more readable.",
|
|
82
|
+
)
|
|
83
|
+
parser.add_argument(
|
|
84
|
+
"--constraint",
|
|
85
|
+
type=str,
|
|
86
|
+
default=None,
|
|
87
|
+
help="(sql-style) constraint to apply to the solar system observations.",
|
|
88
|
+
)
|
|
89
|
+
parser.add_argument(
|
|
90
|
+
"--albedo",
|
|
91
|
+
type=float,
|
|
92
|
+
default=None,
|
|
93
|
+
help="Albedo value, to add diameters to upper scales on plots. Default None.",
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
parser.add_argument(
|
|
97
|
+
"--n_years_max",
|
|
98
|
+
type=int,
|
|
99
|
+
default=10,
|
|
100
|
+
help="Maximum number of years out to which to evaluate completeness." "Default 10.",
|
|
101
|
+
)
|
|
102
|
+
parser.add_argument(
|
|
103
|
+
"--start_time",
|
|
104
|
+
type=float,
|
|
105
|
+
default=None,
|
|
106
|
+
help="Time at start of survey (to set time for summary metrics).",
|
|
107
|
+
)
|
|
108
|
+
args = parser.parse_args()
|
|
109
|
+
|
|
110
|
+
run_name = os.path.split(args.simulation_db)[-1].replace(".db", "")
|
|
111
|
+
|
|
112
|
+
if args.orbit_file is None or args.obs_file is None:
|
|
113
|
+
print("Must specify an orbit_file and an obs_file to calculate the metrics.")
|
|
114
|
+
exit()
|
|
115
|
+
|
|
116
|
+
# Get default H and other values:
|
|
117
|
+
defaults = batches.ss_population_defaults(args.objtype)
|
|
118
|
+
h_min = defaults["h_range"][0]
|
|
119
|
+
h_max = defaults["h_range"][1]
|
|
120
|
+
h_step = defaults["h_range"][2]
|
|
121
|
+
h_mark = defaults["h_mark"]
|
|
122
|
+
characterization = defaults["char"]
|
|
123
|
+
magtype = defaults["magtype"]
|
|
124
|
+
# If H info is specified from parser, use that
|
|
125
|
+
if args.h_min is not None:
|
|
126
|
+
h_min = args.h_min
|
|
127
|
+
if args.h_max is not None:
|
|
128
|
+
h_max = args.h_max
|
|
129
|
+
if args.h_step is not None:
|
|
130
|
+
h_step = args.h_step
|
|
131
|
+
if args.h_mark is not None:
|
|
132
|
+
h_mark = args.h_mark
|
|
133
|
+
if args.characterization is not None:
|
|
134
|
+
characterization = args.characterization
|
|
135
|
+
Hrange = np.arange(h_min, h_max + h_step, h_step)
|
|
136
|
+
|
|
137
|
+
# Default parameters for metric setup.
|
|
138
|
+
if args.start_time is None:
|
|
139
|
+
start_time = SURVEY_START_MJD
|
|
140
|
+
else:
|
|
141
|
+
start_time = args.start_time
|
|
142
|
+
|
|
143
|
+
stepsize = 365 / 2.0
|
|
144
|
+
times = np.arange(0, args.n_years_max * 365 + stepsize / 2, stepsize)
|
|
145
|
+
times += start_time
|
|
146
|
+
|
|
147
|
+
# Set up results_db.
|
|
148
|
+
if not (os.path.isdir(args.out_dir)):
|
|
149
|
+
try:
|
|
150
|
+
os.makedirs(args.out_dir)
|
|
151
|
+
except FileExistsError:
|
|
152
|
+
# This can happen if you are running these in parallel
|
|
153
|
+
# and two scripts try to make
|
|
154
|
+
# the same directory.
|
|
155
|
+
pass
|
|
156
|
+
results_db = db.ResultsDb(out_dir=args.out_dir)
|
|
157
|
+
|
|
158
|
+
colmap = batches.col_map_dict()
|
|
159
|
+
slicer = MoObjSlicer(h_range=Hrange)
|
|
160
|
+
slicer.setup_slicer(orbit_file=args.orbit_file, obs_file=args.obs_file)
|
|
161
|
+
# Run discovery metrics using 'trailing' losses
|
|
162
|
+
bdictT = batches.quick_discovery_batch(
|
|
163
|
+
slicer,
|
|
164
|
+
colmap=colmap,
|
|
165
|
+
run_name=run_name,
|
|
166
|
+
objtype=args.objtype,
|
|
167
|
+
constraint_info_label=args.constraint_info_label,
|
|
168
|
+
constraint=args.constraint,
|
|
169
|
+
detection_losses="trailing",
|
|
170
|
+
albedo=args.albedo,
|
|
171
|
+
h_mark=h_mark,
|
|
172
|
+
magtype=magtype,
|
|
173
|
+
)
|
|
174
|
+
# Run these discovery metrics
|
|
175
|
+
print("Calculating quick discovery metrics with simple trailing losses.")
|
|
176
|
+
bg = mmB.MoMetricBundleGroup(bdictT, out_dir=args.out_dir, results_db=results_db)
|
|
177
|
+
bg.run_all()
|
|
178
|
+
|
|
179
|
+
# Run all discovery metrics using 'detection' losses
|
|
180
|
+
bdictD = batches.quick_discovery_batch(
|
|
181
|
+
slicer,
|
|
182
|
+
colmap=colmap,
|
|
183
|
+
run_name=run_name,
|
|
184
|
+
objtype=args.objtype,
|
|
185
|
+
constraint_info_label=args.constraint_info_label,
|
|
186
|
+
constraint=args.constraint,
|
|
187
|
+
detection_losses="detection",
|
|
188
|
+
albedo=args.albedo,
|
|
189
|
+
h_mark=h_mark,
|
|
190
|
+
magtype=magtype,
|
|
191
|
+
)
|
|
192
|
+
bdict = batches.discovery_batch(
|
|
193
|
+
slicer,
|
|
194
|
+
colmap=colmap,
|
|
195
|
+
run_name=run_name,
|
|
196
|
+
objtype=args.objtype,
|
|
197
|
+
constraint_info_label=args.constraint_info_label,
|
|
198
|
+
constraint=args.constraint,
|
|
199
|
+
detection_losses="detection",
|
|
200
|
+
albedo=args.albedo,
|
|
201
|
+
h_mark=h_mark,
|
|
202
|
+
magtype=magtype,
|
|
203
|
+
)
|
|
204
|
+
bdictD.update(bdict)
|
|
205
|
+
|
|
206
|
+
# Run these discovery metrics
|
|
207
|
+
print("Calculating full discovery metrics with detection losses.")
|
|
208
|
+
bg = mmB.MoMetricBundleGroup(bdictD, out_dir=args.out_dir, results_db=results_db)
|
|
209
|
+
bg.run_all()
|
|
210
|
+
|
|
211
|
+
# Run all characterization metrics
|
|
212
|
+
if characterization.lower() == "inner":
|
|
213
|
+
bdictC = batches.characterization_inner_batch(
|
|
214
|
+
slicer,
|
|
215
|
+
colmap=colmap,
|
|
216
|
+
run_name=run_name,
|
|
217
|
+
objtype=args.objtype,
|
|
218
|
+
albedo=args.albedo,
|
|
219
|
+
constraint_info_label=args.constraint_info_label,
|
|
220
|
+
constraint=args.constraint,
|
|
221
|
+
h_mark=h_mark,
|
|
222
|
+
magtype=magtype,
|
|
223
|
+
)
|
|
224
|
+
elif characterization.lower() == "outer":
|
|
225
|
+
bdictC = batches.characterization_outer_batch(
|
|
226
|
+
slicer,
|
|
227
|
+
colmap=colmap,
|
|
228
|
+
run_name=run_name,
|
|
229
|
+
objtype=args.objtype,
|
|
230
|
+
albedo=args.albedo,
|
|
231
|
+
constraint_info_label=args.constraint_info_label,
|
|
232
|
+
constraint=args.constraint,
|
|
233
|
+
h_mark=h_mark,
|
|
234
|
+
magtype=magtype,
|
|
235
|
+
)
|
|
236
|
+
# Run these characterization metrics
|
|
237
|
+
print("Calculating characterization metrics.")
|
|
238
|
+
bg = mmB.MoMetricBundleGroup(bdictC, out_dir=args.out_dir, results_db=results_db)
|
|
239
|
+
bg.run_all()
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
__all__ = ("run_moving_fractions",)
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import glob
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
import numpy as np
|
|
8
|
+
from rubin_scheduler.utils import SURVEY_START_MJD
|
|
9
|
+
|
|
10
|
+
from . import batches as batches
|
|
11
|
+
from . import db as db
|
|
12
|
+
from . import metricBundles as mmB
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def run_moving_fractions():
|
|
16
|
+
"""Calculate completeness and fractions for moving object metrics."""
|
|
17
|
+
parser = argparse.ArgumentParser(description="Run moving object metrics for a particular opsim run.")
|
|
18
|
+
parser.add_argument(
|
|
19
|
+
"--work_dir",
|
|
20
|
+
type=str,
|
|
21
|
+
default=".",
|
|
22
|
+
help="Output (and input) directory for moving object metrics. Default '.'.",
|
|
23
|
+
)
|
|
24
|
+
parser.add_argument(
|
|
25
|
+
"--metadata",
|
|
26
|
+
type=str,
|
|
27
|
+
default=None,
|
|
28
|
+
help="Select only files matching this metadata string. Default None (all files).",
|
|
29
|
+
)
|
|
30
|
+
parser.add_argument(
|
|
31
|
+
"--h_mark",
|
|
32
|
+
type=float,
|
|
33
|
+
default=None,
|
|
34
|
+
help="H value at which to calculate cumulative/differential completeness, etc."
|
|
35
|
+
"Default (None) will be set to plot_dict value or median of H range.",
|
|
36
|
+
)
|
|
37
|
+
parser.add_argument(
|
|
38
|
+
"--n_years_max",
|
|
39
|
+
type=int,
|
|
40
|
+
default=10,
|
|
41
|
+
help="Maximum number of years out to which to evaluate completeness." "Default 10.",
|
|
42
|
+
)
|
|
43
|
+
parser.add_argument(
|
|
44
|
+
"--start_time",
|
|
45
|
+
type=float,
|
|
46
|
+
default=None,
|
|
47
|
+
help="Time at start of survey (to set time for summary metrics).",
|
|
48
|
+
)
|
|
49
|
+
args = parser.parse_args()
|
|
50
|
+
|
|
51
|
+
# Default parameters for metric setup.
|
|
52
|
+
if args.start_time is None:
|
|
53
|
+
start_time = SURVEY_START_MJD
|
|
54
|
+
else:
|
|
55
|
+
start_time = args.start_time
|
|
56
|
+
stepsize = 365 / 6.0
|
|
57
|
+
times = np.arange(0, args.n_years_max * 365 + stepsize / 2, stepsize)
|
|
58
|
+
times += start_time
|
|
59
|
+
|
|
60
|
+
# Create a results Db.
|
|
61
|
+
results_db = db.ResultsDb(out_dir=args.work_dir)
|
|
62
|
+
|
|
63
|
+
# Just read in all metrics in the (joint or single) directory,
|
|
64
|
+
# then run completeness and fraction
|
|
65
|
+
# summaries, using the methods in the batches.
|
|
66
|
+
if args.metadata is None:
|
|
67
|
+
matchstring = os.path.join(args.work_dir, "*MOOB.npz")
|
|
68
|
+
else:
|
|
69
|
+
matchstring = os.path.join(args.work_dir, f"*{args.metadata}*MOOB.npz")
|
|
70
|
+
metricfiles = glob.glob(matchstring)
|
|
71
|
+
metric_names = []
|
|
72
|
+
for m in metricfiles:
|
|
73
|
+
mname = os.path.split(m)[-1].replace("_MOOB.npz", "")
|
|
74
|
+
metric_names.append(mname)
|
|
75
|
+
|
|
76
|
+
bdict = {}
|
|
77
|
+
for mName, mFile in zip(metric_names, metricfiles):
|
|
78
|
+
bdict[mName] = mmB.create_empty_mo_metric_bundle()
|
|
79
|
+
bdict[mName].read(mFile)
|
|
80
|
+
|
|
81
|
+
first = bdict[metric_names[0]]
|
|
82
|
+
figroot = f"{first.run_name}"
|
|
83
|
+
# adding args.metadata to the figroot means that we can narrow
|
|
84
|
+
# down *which* subset of files to work on
|
|
85
|
+
# this lets us add different h_mark values to the output plots,
|
|
86
|
+
# if desired (leaving None/default is ok)
|
|
87
|
+
if args.metadata != ".":
|
|
88
|
+
figroot += f"_{args.metadata}"
|
|
89
|
+
|
|
90
|
+
# Calculate completeness. This utility writes these to disk.
|
|
91
|
+
bdict_completeness = batches.run_completeness_summary(
|
|
92
|
+
bdict, args.h_mark, times, args.work_dir, results_db
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
# Plot some of the completeness results.
|
|
96
|
+
batches.plot_completeness(
|
|
97
|
+
bdict_completeness,
|
|
98
|
+
figroot=figroot,
|
|
99
|
+
results_db=results_db,
|
|
100
|
+
out_dir=args.work_dir,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
# Calculate fractions of population for characterization.
|
|
104
|
+
# This utility writes these to disk.
|
|
105
|
+
bdict_fractions = batches.run_fraction_summary(bdict, args.h_mark, args.work_dir, results_db)
|
|
106
|
+
# Plot the fractions for colors and lightcurves.
|
|
107
|
+
batches.plot_fractions(bdict_fractions, figroot=figroot, results_db=results_db, out_dir=args.work_dir)
|
|
108
|
+
|
|
109
|
+
# Plot nObs and arcLength.
|
|
110
|
+
for k in bdict:
|
|
111
|
+
if "NObs" in k:
|
|
112
|
+
batches.plot_single(bdict[k], results_db=results_db, out_dir=args.work_dir)
|
|
113
|
+
if "ObsArc" in k:
|
|
114
|
+
batches.plot_single(bdict[k], results_db=results_db, out_dir=args.work_dir)
|
|
115
|
+
|
|
116
|
+
# Plot the number of chances of discovery metric -
|
|
117
|
+
# this is different than completeness
|
|
118
|
+
# As it plots the metric value directly
|
|
119
|
+
for k in bdict:
|
|
120
|
+
if "DiscoveryNChances" in k and "3_pairs_in_15_nights_detection_loss" in k:
|
|
121
|
+
batches.plot_single(bdict[k], results_db=results_db, out_dir=args.work_dir)
|
|
122
|
+
if "MagicDiscovery" in k:
|
|
123
|
+
batches.plot_single(bdict[k], results_db=results_db, out_dir=args.work_dir)
|
|
124
|
+
if "HighVelocity" in k:
|
|
125
|
+
batches.plot_single(bdict[k], results_db=results_db, out_dir=args.work_dir)
|
|
126
|
+
|
|
127
|
+
# Plot likelihood of detecting activity.
|
|
128
|
+
batches.plot_activity(bdict, figroot=figroot, results_db=results_db, out_dir=args.work_dir)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
from . import batches as batches
|
|
2
|
+
|
|
3
|
+
__all__ = ("run_moving_join",)
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import glob
|
|
7
|
+
import os
|
|
8
|
+
|
|
9
|
+
import matplotlib
|
|
10
|
+
import numpy as np
|
|
11
|
+
|
|
12
|
+
matplotlib.use("Agg")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def run_moving_join():
|
|
16
|
+
"""Join split metric outputs into a single metric output file."""
|
|
17
|
+
parser = argparse.ArgumentParser(
|
|
18
|
+
description="Join moving object metrics (from splits) for a particular "
|
|
19
|
+
"scheduler run. Assumes split metric files are in "
|
|
20
|
+
"<orbitRoot_split> subdirectories of base_dir. "
|
|
21
|
+
)
|
|
22
|
+
parser.add_argument("--orbit_file", type=str, help="File containing the moving object orbits.")
|
|
23
|
+
parser.add_argument(
|
|
24
|
+
"--base_dir",
|
|
25
|
+
type=str,
|
|
26
|
+
default=".",
|
|
27
|
+
help="Root directory containing split (or single) metric outputs.",
|
|
28
|
+
)
|
|
29
|
+
parser.add_argument(
|
|
30
|
+
"--out_dir",
|
|
31
|
+
type=str,
|
|
32
|
+
default=None,
|
|
33
|
+
help="Output directory for moving object metrics. Default [orbitRoot]",
|
|
34
|
+
)
|
|
35
|
+
args = parser.parse_args()
|
|
36
|
+
|
|
37
|
+
if args.orbit_file is None:
|
|
38
|
+
print("Must specify an orbit_file")
|
|
39
|
+
exit()
|
|
40
|
+
|
|
41
|
+
# Outputs from the metrics are generally like so:
|
|
42
|
+
# <base_dir>/<splitDir>/<metricFileName>
|
|
43
|
+
# - base_dir tends to be <opsimName_orbitRoot> (
|
|
44
|
+
# but is set by user when starting to generate obs.)
|
|
45
|
+
# - splitDir tends to be <orbitRoot_split#>
|
|
46
|
+
# (and is set by observation generation script)
|
|
47
|
+
# - metricFile is <opsimName_metricName_metadata
|
|
48
|
+
# (NEO/L7/etc + metadata from metric script)_MOOB.npz
|
|
49
|
+
# (the metricFileName is set by the metric generation script
|
|
50
|
+
# - run_moving_calc.py).
|
|
51
|
+
# (note that split# does not show up in the metricFileName,
|
|
52
|
+
# and is not used in run_moving_calc.py).
|
|
53
|
+
# ... this lets run_moving_calc.py easily run in parallel on
|
|
54
|
+
# multiple splits.
|
|
55
|
+
|
|
56
|
+
# Assume splits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
57
|
+
splits = np.arange(0, 10, 1)
|
|
58
|
+
orbit_root = args.orbit_file.replace(".txt", "").replace(".des", "").replace(".s3m", "")
|
|
59
|
+
|
|
60
|
+
if args.out_dir is not None:
|
|
61
|
+
out_dir = args.out_dir
|
|
62
|
+
else:
|
|
63
|
+
out_dir = f"{orbit_root}"
|
|
64
|
+
|
|
65
|
+
# Scan first splitDir for all metric files.
|
|
66
|
+
tempdir = os.path.join(args.base_dir, f"{orbit_root}_{splits[0]}")
|
|
67
|
+
print(f"# Joining files from {orbit_root}_[0-9]; will use {tempdir} to find metric names.")
|
|
68
|
+
|
|
69
|
+
metricfiles = glob.glob(os.path.join(tempdir, "*MOOB.npz"))
|
|
70
|
+
# Identify metric names that we want to join.
|
|
71
|
+
metricNames = []
|
|
72
|
+
for m in metricfiles:
|
|
73
|
+
mname = os.path.split(m)[-1]
|
|
74
|
+
# Hack out raw Discovery outputs.
|
|
75
|
+
# We don't want to join the raw discovery files.
|
|
76
|
+
# This is a hack because currently we're just pulling out
|
|
77
|
+
# _Time and _N_Chances to join but there are other options.
|
|
78
|
+
if "Discovery" in mname:
|
|
79
|
+
if "DiscoveryTime" in mname:
|
|
80
|
+
metricNames.append(mname)
|
|
81
|
+
elif "DiscoveryNChances" in mname:
|
|
82
|
+
metricNames.append(mname)
|
|
83
|
+
elif "Magic" in mname:
|
|
84
|
+
metricNames.append(mname)
|
|
85
|
+
elif "HighVelocity" in mname:
|
|
86
|
+
metricNames.append(mname)
|
|
87
|
+
else:
|
|
88
|
+
pass
|
|
89
|
+
else:
|
|
90
|
+
metricNames.append(mname)
|
|
91
|
+
|
|
92
|
+
if len(metricNames) == 0:
|
|
93
|
+
print(f"Could not read any metric files from {tempdir}")
|
|
94
|
+
exit()
|
|
95
|
+
|
|
96
|
+
# Create the output directory.
|
|
97
|
+
if not (os.path.isdir(out_dir)):
|
|
98
|
+
os.makedirs(out_dir)
|
|
99
|
+
|
|
100
|
+
# Read and combine the metric files.
|
|
101
|
+
for m in metricNames:
|
|
102
|
+
b = batches.read_and_combine(orbit_root, args.base_dir, splits, m)
|
|
103
|
+
b.write(out_dir=out_dir)
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
from .db import ResultsDb
|
|
2
|
+
from .maf_contrib import PhotometricSelfCalUniformityMetric
|
|
3
|
+
from .metric_bundles import MetricBundle, MetricBundleGroup
|
|
4
|
+
from .metrics import IdentityMetric
|
|
5
|
+
from .plots import HealpixHistogram, HealpixSkyMap, PlotHandler
|
|
6
|
+
from .slicers import HealpixSlicer, UniSlicer
|
|
7
|
+
|
|
8
|
+
__all__ = ("run_selfcal_metric",)
|
|
9
|
+
|
|
10
|
+
import argparse
|
|
11
|
+
import os
|
|
12
|
+
import shutil
|
|
13
|
+
|
|
14
|
+
import healpy as hp
|
|
15
|
+
import matplotlib
|
|
16
|
+
import numpy as np
|
|
17
|
+
|
|
18
|
+
matplotlib.use("Agg")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def run_selfcal_metric():
|
|
22
|
+
"""
|
|
23
|
+
Run the self-calibration metric on one database.
|
|
24
|
+
"""
|
|
25
|
+
parser = argparse.ArgumentParser()
|
|
26
|
+
parser.add_argument("--db", type=str, default=None)
|
|
27
|
+
parser.add_argument(
|
|
28
|
+
"--no_clobber",
|
|
29
|
+
dest="no_clobber",
|
|
30
|
+
default=False,
|
|
31
|
+
action="store_true",
|
|
32
|
+
help="Do not remove existing directory outputs",
|
|
33
|
+
)
|
|
34
|
+
parser.add_argument("--filter", type=str, default="r")
|
|
35
|
+
|
|
36
|
+
args = parser.parse_args()
|
|
37
|
+
|
|
38
|
+
opsdb = args.db
|
|
39
|
+
sim_name = os.path.basename(opsdb).replace(".db", "")
|
|
40
|
+
|
|
41
|
+
out_dir = sim_name + "_selfcal"
|
|
42
|
+
if not args.no_clobber:
|
|
43
|
+
if os.path.isdir(out_dir):
|
|
44
|
+
shutil.rmtree(out_dir)
|
|
45
|
+
|
|
46
|
+
# Set up the metric bundle.
|
|
47
|
+
map_nside = 128
|
|
48
|
+
selfcal_metric = PhotometricSelfCalUniformityMetric(
|
|
49
|
+
nside_residual=map_nside, filter_name=args.filter, metric_name="selfcal_uniformity-%s" % args.filter
|
|
50
|
+
)
|
|
51
|
+
slicer = UniSlicer()
|
|
52
|
+
# Exclude DDF visits
|
|
53
|
+
sql = "scheduler_note not like '%DD%'"
|
|
54
|
+
# And run on only year 1 (?)
|
|
55
|
+
sql += " and night < 366"
|
|
56
|
+
sql += " and filter='%s'" % args.filter
|
|
57
|
+
|
|
58
|
+
bundle = MetricBundle(
|
|
59
|
+
selfcal_metric, slicer, sql, run_name=sim_name, info_label="year 1 no-DD %s" % args.filter
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Set up the resultsDB
|
|
63
|
+
results_db = ResultsDb(out_dir=out_dir)
|
|
64
|
+
# Go and run it
|
|
65
|
+
group = MetricBundleGroup(
|
|
66
|
+
{"selfcal": bundle}, opsdb, out_dir=out_dir, results_db=results_db, save_early=True
|
|
67
|
+
)
|
|
68
|
+
group.run_all(clear_memory=False, plot_now=True)
|
|
69
|
+
|
|
70
|
+
# Make plots of the residuals map
|
|
71
|
+
map_bundle = MetricBundle(
|
|
72
|
+
IdentityMetric(metric_name="PhotoCal Uniformity %s" % args.filter),
|
|
73
|
+
HealpixSlicer(map_nside),
|
|
74
|
+
sql,
|
|
75
|
+
run_name=sim_name,
|
|
76
|
+
info_label="year 1 no-DD",
|
|
77
|
+
)
|
|
78
|
+
tmp_vals = bundle.metric_values[0]["uniformity_map"]
|
|
79
|
+
tmp_vals = np.where(tmp_vals == hp.UNSEEN, map_bundle.slicer.badval, tmp_vals)
|
|
80
|
+
map_bundle.metric_values = np.ma.MaskedArray(
|
|
81
|
+
data=tmp_vals,
|
|
82
|
+
mask=np.zeros(map_bundle.slicer.shape, "bool"),
|
|
83
|
+
fill_value=map_bundle.slicer.badval,
|
|
84
|
+
)
|
|
85
|
+
map_bundle.write(out_dir=out_dir, results_db=results_db)
|
|
86
|
+
|
|
87
|
+
ph = PlotHandler(results_db=results_db, out_dir=out_dir)
|
|
88
|
+
ph.set_metric_bundles([map_bundle])
|
|
89
|
+
_ = ph.plot(HealpixSkyMap(), plot_dicts={"color_min": -0.02, "color_max": 0.02})
|
|
90
|
+
_ = ph.plot(HealpixHistogram(), plot_dicts={"percentile_clip": 99})
|
|
91
|
+
|
|
92
|
+
results_db.close()
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
from . import batches as batches
|
|
2
|
+
from . import db as db
|
|
3
|
+
from . import metricBundles as mmB
|
|
4
|
+
|
|
5
|
+
__all__ = ("scimaf_dir",)
|
|
6
|
+
|
|
7
|
+
import argparse
|
|
8
|
+
import glob
|
|
9
|
+
import os
|
|
10
|
+
import shutil
|
|
11
|
+
import sqlite3
|
|
12
|
+
import warnings
|
|
13
|
+
|
|
14
|
+
import matplotlib
|
|
15
|
+
import pandas as pd
|
|
16
|
+
|
|
17
|
+
matplotlib.use("Agg")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def scimaf_dir():
|
|
21
|
+
"""Run the science batch on all .db files in a directory."""
|
|
22
|
+
|
|
23
|
+
parser = argparse.ArgumentParser()
|
|
24
|
+
parser.add_argument("--db", type=str, default=None)
|
|
25
|
+
parser.add_argument(
|
|
26
|
+
"--no_clobber",
|
|
27
|
+
dest="no_clobber",
|
|
28
|
+
action="store_true",
|
|
29
|
+
default=False,
|
|
30
|
+
help="Do not remove existing directory outputs",
|
|
31
|
+
)
|
|
32
|
+
parser.set_defaults(no_long_micro=False)
|
|
33
|
+
parser.add_argument("--limited", dest="limited", action="store_true")
|
|
34
|
+
parser.set_defaults(limited=False)
|
|
35
|
+
args = parser.parse_args()
|
|
36
|
+
|
|
37
|
+
if args.db is None:
|
|
38
|
+
db_files = glob.glob("*.db")
|
|
39
|
+
db_files = [filename for filename in db_files if "trackingDb" not in filename]
|
|
40
|
+
else:
|
|
41
|
+
db_files = [args.db]
|
|
42
|
+
run_names = [os.path.basename(name).replace(".db", "") for name in db_files]
|
|
43
|
+
|
|
44
|
+
for filename, name in zip(db_files, run_names):
|
|
45
|
+
out_dir = name + "_sci"
|
|
46
|
+
|
|
47
|
+
# Grab the starting date for the Presto KNe metric
|
|
48
|
+
try:
|
|
49
|
+
con = sqlite3.connect(filename)
|
|
50
|
+
mjd0_df = pd.read_sql("select min(observationStartMJD) from observations;", con)
|
|
51
|
+
con.close()
|
|
52
|
+
mjd0 = mjd0_df.values.min()
|
|
53
|
+
# If this fails for any reason (aka schema change)
|
|
54
|
+
except: # noqa E722
|
|
55
|
+
warnings.warn("Could not find survey start date for Presto KNe, setting mjd0=None.")
|
|
56
|
+
mjd0 = None
|
|
57
|
+
# Clobber output directory if it exists
|
|
58
|
+
if not args.no_clobber:
|
|
59
|
+
if os.path.isdir(out_dir):
|
|
60
|
+
shutil.rmtree(out_dir)
|
|
61
|
+
results_db = db.ResultsDb(out_dir=out_dir)
|
|
62
|
+
# Set up the metricBundles
|
|
63
|
+
if args.limited:
|
|
64
|
+
bdict = batches.radar_limited(
|
|
65
|
+
runName=name,
|
|
66
|
+
mjd0=mjd0,
|
|
67
|
+
)
|
|
68
|
+
else:
|
|
69
|
+
bdict = batches.science_radar_batch(
|
|
70
|
+
runName=name,
|
|
71
|
+
mjd0=mjd0,
|
|
72
|
+
)
|
|
73
|
+
# Run them, including generating plots
|
|
74
|
+
group = mmB.MetricBundleGroup(
|
|
75
|
+
bdict, filename, out_dir=out_dir, results_db=results_db, save_early=False
|
|
76
|
+
)
|
|
77
|
+
group.run_all(clear_memory=True, plot_now=True)
|
|
78
|
+
results_db.close()
|
|
79
|
+
db.add_run_to_database(
|
|
80
|
+
out_dir,
|
|
81
|
+
"trackingDb_sqlite.db",
|
|
82
|
+
run_group=None,
|
|
83
|
+
run_name=name,
|
|
84
|
+
run_comment=None,
|
|
85
|
+
maf_comment="ScienceRadar",
|
|
86
|
+
db_file=name + ".db",
|
|
87
|
+
)
|