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,212 @@
|
|
|
1
|
+
__all__ = (
|
|
2
|
+
"optimal_bins",
|
|
3
|
+
"percentile_clipping",
|
|
4
|
+
"radec2pix",
|
|
5
|
+
"coadd_m5",
|
|
6
|
+
"collapse_night",
|
|
7
|
+
"load_inst_zeropoints",
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
import warnings
|
|
12
|
+
|
|
13
|
+
import healpy as hp
|
|
14
|
+
import numpy as np
|
|
15
|
+
from rubin_scheduler.data import get_data_dir
|
|
16
|
+
from rubin_scheduler.utils import SysEngVals, int_binned_stat
|
|
17
|
+
from scipy.stats import binned_statistic
|
|
18
|
+
|
|
19
|
+
from rubin_sim.phot_utils import Bandpass, PhotometricParameters
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def load_inst_zeropoints():
|
|
23
|
+
"""Load up and return instrumental zeropoints and atmospheric
|
|
24
|
+
extinctions.
|
|
25
|
+
"""
|
|
26
|
+
zp_inst = {}
|
|
27
|
+
datadir = get_data_dir()
|
|
28
|
+
for filtername in "ugrizy":
|
|
29
|
+
# set gain and exptime to 1 so the instrumental zeropoint will be in
|
|
30
|
+
# photoelectrons and per second
|
|
31
|
+
phot_params = PhotometricParameters(nexp=1, gain=1, exptime=1, bandpass=filtername)
|
|
32
|
+
bp = Bandpass()
|
|
33
|
+
bp.read_throughput(os.path.join(datadir, "throughputs/baseline/", "total_%s.dat" % filtername))
|
|
34
|
+
zp_inst[filtername] = bp.calc_zp_t(phot_params)
|
|
35
|
+
|
|
36
|
+
syseng = SysEngVals()
|
|
37
|
+
k_atm = syseng.k_atm
|
|
38
|
+
|
|
39
|
+
return zp_inst, k_atm
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def coadd_m5(mags):
|
|
43
|
+
"""Coadded depth, assuming Gaussian noise."""
|
|
44
|
+
return 1.25 * np.log10(np.sum(10.0 ** (0.8 * np.array(mags))))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def collapse_night(
|
|
48
|
+
data_slice,
|
|
49
|
+
night_col="night",
|
|
50
|
+
filter_col="filter",
|
|
51
|
+
m5_col="fiveSigmaDepth",
|
|
52
|
+
mjd_col="observationStartMJD",
|
|
53
|
+
):
|
|
54
|
+
"""Collapse a data_slice into per-filter, per-night values for
|
|
55
|
+
the 'night', 'filter', 'median observationStartMJD', and 'fiveSigmaDepth'.
|
|
56
|
+
"""
|
|
57
|
+
filters = np.unique(data_slice[filter_col])
|
|
58
|
+
# Find the per-night, per-filter values
|
|
59
|
+
night_slice = {}
|
|
60
|
+
for filtername in filters:
|
|
61
|
+
infilt = np.where(data_slice[filter_col] == filtername)[0]
|
|
62
|
+
unight = np.unique(data_slice[night_col][infilt])
|
|
63
|
+
right = unight + 0.5
|
|
64
|
+
bins = [unight[0] - 0.5] + right.tolist()
|
|
65
|
+
coadds, be, bn = binned_statistic(
|
|
66
|
+
data_slice[night_col][infilt],
|
|
67
|
+
data_slice[m5_col][infilt],
|
|
68
|
+
bins=bins,
|
|
69
|
+
statistic=coadd_m5,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
unights, median_mjd_per_night = int_binned_stat(
|
|
73
|
+
data_slice[night_col][infilt],
|
|
74
|
+
data_slice[mjd_col][infilt],
|
|
75
|
+
statistic=np.median,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
night_slice[filtername] = np.array(
|
|
79
|
+
list(zip(unight, median_mjd_per_night, coadds, filtername * len(unight))),
|
|
80
|
+
dtype=[
|
|
81
|
+
(night_col, int),
|
|
82
|
+
(mjd_col, float),
|
|
83
|
+
(m5_col, float),
|
|
84
|
+
(filter_col, "U1"),
|
|
85
|
+
],
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
night_slice = np.concatenate([night_slice[f] for f in night_slice])
|
|
89
|
+
night_slice.sort(order=["observationStartMJD"])
|
|
90
|
+
|
|
91
|
+
return night_slice
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def optimal_bins(datain, binmin=None, binmax=None, nbin_max=200, nbin_min=1, verbose=False):
|
|
95
|
+
"""
|
|
96
|
+
Set an 'optimal' number of bins using the Freedman-Diaconis rule.
|
|
97
|
+
|
|
98
|
+
Parameters
|
|
99
|
+
----------
|
|
100
|
+
datain : `numpy.ndarray` or `numpy.ma.MaskedArray`
|
|
101
|
+
The data for which we want to set the bin_size.
|
|
102
|
+
binmin : `float`
|
|
103
|
+
The minimum bin value to consider (if None, uses minimum data value).
|
|
104
|
+
binmax : `float`
|
|
105
|
+
The maximum bin value to consider (if None, uses maximum data value).
|
|
106
|
+
nbin_max : `int`
|
|
107
|
+
The maximum number of bins to create.
|
|
108
|
+
Sometimes the 'optimal bin_size' implies an unreasonably large number
|
|
109
|
+
of bins, if the data distribution is unusual.
|
|
110
|
+
nbin_min : `int`
|
|
111
|
+
The minimum number of bins to create. Default is 1.
|
|
112
|
+
verbose : `bool`
|
|
113
|
+
Turn off warning messages. This utility very often raises warnings
|
|
114
|
+
and these should likely be logging messages at a lower logging level,
|
|
115
|
+
but for now - just use the verbose flag to turn these off or on.
|
|
116
|
+
|
|
117
|
+
Returns
|
|
118
|
+
-------
|
|
119
|
+
nbins : `int`
|
|
120
|
+
The number of bins.
|
|
121
|
+
"""
|
|
122
|
+
# if it's a masked array, only use unmasked values
|
|
123
|
+
if hasattr(datain, "compressed"):
|
|
124
|
+
data = datain.compressed()
|
|
125
|
+
else:
|
|
126
|
+
data = datain
|
|
127
|
+
# Check that any good data values remain.
|
|
128
|
+
if data.size == 0:
|
|
129
|
+
nbins = nbin_max
|
|
130
|
+
if verbose:
|
|
131
|
+
warnings.warn(
|
|
132
|
+
f"No unmasked data available for calculating optimal bin size: returning {nbins} bins"
|
|
133
|
+
)
|
|
134
|
+
# Else proceed.
|
|
135
|
+
else:
|
|
136
|
+
if binmin is None:
|
|
137
|
+
binmin = np.nanmin(data)
|
|
138
|
+
if binmax is None:
|
|
139
|
+
binmax = np.nanmax(data)
|
|
140
|
+
cond = np.where((data >= binmin) & (data <= binmax))[0]
|
|
141
|
+
# Check if any data points remain within binmin/binmax.
|
|
142
|
+
if np.size(data[cond]) == 0:
|
|
143
|
+
nbins = nbin_max
|
|
144
|
+
warnings.warn(
|
|
145
|
+
"No data available for calculating optimal bin size within range of %f, %f" % (binmin, binmax)
|
|
146
|
+
+ ": returning %i bins" % (nbins)
|
|
147
|
+
)
|
|
148
|
+
else:
|
|
149
|
+
iqr = np.percentile(data[cond], 75) - np.percentile(data[cond], 25)
|
|
150
|
+
binwidth = 2 * iqr * (np.size(data[cond]) ** (-1.0 / 3.0))
|
|
151
|
+
nbins = (binmax - binmin) / binwidth
|
|
152
|
+
if nbins > nbin_max:
|
|
153
|
+
warnings.warn(
|
|
154
|
+
"Optimal bin calculation tried to make %.0f bins, returning %i" % (nbins, nbin_max)
|
|
155
|
+
)
|
|
156
|
+
nbins = nbin_max
|
|
157
|
+
if nbins < nbin_min:
|
|
158
|
+
warnings.warn(
|
|
159
|
+
"Optimal bin calculation tried to make %.0f bins, returning %i" % (nbins, nbin_min)
|
|
160
|
+
)
|
|
161
|
+
nbins = nbin_min
|
|
162
|
+
if np.isnan(nbins):
|
|
163
|
+
warnings.warn("Optimal bin calculation calculated NaN: returning %i" % (nbin_max))
|
|
164
|
+
nbins = nbin_max
|
|
165
|
+
return int(nbins)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def percentile_clipping(data, percentile=95.0):
|
|
169
|
+
"""Calculate the minimum and maximum values of a distribution of points,
|
|
170
|
+
after discarding data more than 'percentile' from the median.
|
|
171
|
+
This is useful for determining useful data ranges for plots.
|
|
172
|
+
Note that 'percentile' percent of the data is retained.
|
|
173
|
+
|
|
174
|
+
Parameters
|
|
175
|
+
----------
|
|
176
|
+
data : `numpy.ndarray`
|
|
177
|
+
The data to clip.
|
|
178
|
+
percentile : `float`
|
|
179
|
+
Retain values within percentile of the median.
|
|
180
|
+
|
|
181
|
+
Returns
|
|
182
|
+
-------
|
|
183
|
+
minimum, maximum : `float`, `float`
|
|
184
|
+
The minimum and maximum values of the clipped data.
|
|
185
|
+
"""
|
|
186
|
+
lower_percentile = (100 - percentile) / 2.0
|
|
187
|
+
upper_percentile = 100 - lower_percentile
|
|
188
|
+
min_value = np.percentile(data, lower_percentile)
|
|
189
|
+
max_value = np.percentile(data, upper_percentile)
|
|
190
|
+
return min_value, max_value
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def radec2pix(nside, ra, dec):
|
|
194
|
+
"""Calculate the nearest healpixel ID of an RA/Dec array, assuming nside.
|
|
195
|
+
|
|
196
|
+
Parameters
|
|
197
|
+
----------
|
|
198
|
+
nside : `int`
|
|
199
|
+
The nside value of the healpix grid.
|
|
200
|
+
ra : `numpy.ndarray`, (N,)
|
|
201
|
+
The RA values to be converted to healpix ids, in radians.
|
|
202
|
+
dec : `numpy.ndarray`, (N,)
|
|
203
|
+
The Dec values to be converted to healpix ids, in radians.
|
|
204
|
+
|
|
205
|
+
Returns
|
|
206
|
+
-------
|
|
207
|
+
hpid : `numpy.ndarray`, (N,)
|
|
208
|
+
The healpix ids.
|
|
209
|
+
"""
|
|
210
|
+
lat = np.pi / 2.0 - dec
|
|
211
|
+
hpid = hp.ang2pix(nside, lat, ra)
|
|
212
|
+
return hpid
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
__all__ = (
|
|
2
|
+
"get_sim_data",
|
|
3
|
+
"scale_benchmarks",
|
|
4
|
+
"calc_coadded_depth",
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
import sqlite3
|
|
9
|
+
import urllib
|
|
10
|
+
from contextlib import closing
|
|
11
|
+
|
|
12
|
+
import numpy as np
|
|
13
|
+
import pandas as pd
|
|
14
|
+
from sqlalchemy import create_engine, inspect
|
|
15
|
+
from sqlalchemy.engine import make_url
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def get_sim_data(
|
|
19
|
+
db_con,
|
|
20
|
+
sqlconstraint=None,
|
|
21
|
+
dbcols=None,
|
|
22
|
+
stackers=None,
|
|
23
|
+
table_name=None,
|
|
24
|
+
full_sql_query=None,
|
|
25
|
+
):
|
|
26
|
+
"""Query an opsim database for the needed data columns
|
|
27
|
+
and run any required stackers.
|
|
28
|
+
|
|
29
|
+
Parameters
|
|
30
|
+
----------
|
|
31
|
+
db_con : `str` or SQLAlchemy connectable, or sqlite3 connection
|
|
32
|
+
Filename to a sqlite3 file, or a connection object that
|
|
33
|
+
can be used by pandas.read_sql
|
|
34
|
+
sqlconstraint : `str` or None
|
|
35
|
+
SQL constraint to apply to query for observations.
|
|
36
|
+
Ignored if full_sql_query is set.
|
|
37
|
+
dbcols : `list` [`str`]
|
|
38
|
+
Columns required from the database. Ignored if full_sql_query is set.
|
|
39
|
+
stackers : `list` [`rubin_sim.maf.stackers`], optional
|
|
40
|
+
Stackers to be used to generate additional columns. Default None.
|
|
41
|
+
table_name : `str` (None)
|
|
42
|
+
Name of the table to query.
|
|
43
|
+
Default None will try "observations".
|
|
44
|
+
Ignored if full_sql_query is set.
|
|
45
|
+
full_sql_query : `str`
|
|
46
|
+
The full SQL query to use. Overrides sqlconstraint, dbcols, tablename.
|
|
47
|
+
|
|
48
|
+
Returns
|
|
49
|
+
-------
|
|
50
|
+
sim_data : `np.ndarray`
|
|
51
|
+
A numpy structured array with columns resulting from dbcols + stackers,
|
|
52
|
+
for observations matching the SQLconstraint.
|
|
53
|
+
"""
|
|
54
|
+
if sqlconstraint is None:
|
|
55
|
+
sqlconstraint = ""
|
|
56
|
+
|
|
57
|
+
# Check that file exists
|
|
58
|
+
if isinstance(db_con, str):
|
|
59
|
+
if os.path.isfile(db_con) is False:
|
|
60
|
+
raise FileNotFoundError("No file %s" % db_con)
|
|
61
|
+
|
|
62
|
+
# Check if table is "observations" or "SummaryAllProps"
|
|
63
|
+
if (table_name is None) & (full_sql_query is None) & (isinstance(db_con, str)):
|
|
64
|
+
url = make_url("sqlite:///" + db_con)
|
|
65
|
+
eng = create_engine(url)
|
|
66
|
+
inspector = inspect(eng)
|
|
67
|
+
tables = [inspector.get_table_names(schema=schema) for schema in inspector.get_schema_names()]
|
|
68
|
+
if "observations" in tables[0]:
|
|
69
|
+
table_name = "observations"
|
|
70
|
+
elif "SummaryAllProps" in tables[0]:
|
|
71
|
+
table_name = "SummaryAllProps"
|
|
72
|
+
elif "summary" in tables[0]:
|
|
73
|
+
table_name = "summary"
|
|
74
|
+
else:
|
|
75
|
+
raise ValueError("Could not guess table_name, set with table_name or full_sql_query kwargs")
|
|
76
|
+
elif (table_name is None) & (full_sql_query is None):
|
|
77
|
+
# If someone passes in a connection object with an old table_name
|
|
78
|
+
# things will fail
|
|
79
|
+
# that's probably fine, keep people from getting fancy with old sims
|
|
80
|
+
table_name = "observations"
|
|
81
|
+
|
|
82
|
+
if full_sql_query is None:
|
|
83
|
+
col_str = "*" if dbcols is None else ", ".join(dbcols)
|
|
84
|
+
|
|
85
|
+
query = "SELECT %s FROM %s" % (col_str, table_name)
|
|
86
|
+
if len(sqlconstraint) > 0:
|
|
87
|
+
query += " WHERE %s" % (sqlconstraint)
|
|
88
|
+
query += ";"
|
|
89
|
+
else:
|
|
90
|
+
query = full_sql_query
|
|
91
|
+
|
|
92
|
+
if isinstance(db_con, sqlite3.Connection):
|
|
93
|
+
sim_data = pd.read_sql(query, db_con).to_records(index=False)
|
|
94
|
+
elif isinstance(db_con, str) and os.path.isfile(db_con):
|
|
95
|
+
with closing(sqlite3.connect(db_con)) as con:
|
|
96
|
+
sim_data = pd.read_sql(query, con).to_records(index=False)
|
|
97
|
+
elif (not isinstance(db_con, str)) or urllib.parse.urlparse(db_con).scheme != "":
|
|
98
|
+
try:
|
|
99
|
+
from lsst.resources import ResourcePath
|
|
100
|
+
|
|
101
|
+
with ResourcePath(db_con).as_local() as local_db_path:
|
|
102
|
+
with closing(sqlite3.connect(local_db_path.ospath)) as con:
|
|
103
|
+
sim_data = pd.read_sql(query, con).to_records(index=False)
|
|
104
|
+
except ModuleNotFoundError:
|
|
105
|
+
raise RuntimeError(
|
|
106
|
+
f"Cannot read visits from {db_con}."
|
|
107
|
+
"Maybe it does not exist, or maybe you need to install lsst.resources."
|
|
108
|
+
)
|
|
109
|
+
else:
|
|
110
|
+
raise RuntimeError("Cannot find {db_con}.")
|
|
111
|
+
|
|
112
|
+
if len(sim_data) == 0:
|
|
113
|
+
raise UserWarning("No data found matching sqlconstraint %s" % (sqlconstraint))
|
|
114
|
+
# Now add the stacker columns.
|
|
115
|
+
if stackers is not None:
|
|
116
|
+
for s in stackers:
|
|
117
|
+
sim_data = s.run(sim_data)
|
|
118
|
+
return sim_data
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def scale_benchmarks(run_length, benchmark="design"):
|
|
122
|
+
"""Set design and stretch values of the number of visits or
|
|
123
|
+
area of the footprint or seeing/Fwhmeff/skybrightness and single visit
|
|
124
|
+
depth (based on SRD values).
|
|
125
|
+
Scales number of visits for the length of the run, relative to 10 years.
|
|
126
|
+
|
|
127
|
+
Parameters
|
|
128
|
+
----------
|
|
129
|
+
run_length : `float`
|
|
130
|
+
The length (in years) of the run.
|
|
131
|
+
benchmark : `str`
|
|
132
|
+
design or stretch - which version of the SRD values to return.
|
|
133
|
+
|
|
134
|
+
Returns
|
|
135
|
+
-------
|
|
136
|
+
benchmarks: `dict` of floats
|
|
137
|
+
A dictionary containing the number of visits, area of footprint,
|
|
138
|
+
seeing and FWHMeff values, skybrightness and single visit depth
|
|
139
|
+
for either the design or stretch SRD values.
|
|
140
|
+
"""
|
|
141
|
+
# Set baseline (default) numbers for the baseline survey length (10 years).
|
|
142
|
+
baseline = 10.0
|
|
143
|
+
|
|
144
|
+
design = {}
|
|
145
|
+
stretch = {}
|
|
146
|
+
|
|
147
|
+
design["nvisitsTotal"] = 825
|
|
148
|
+
stretch["nvisitsTotal"] = 1000
|
|
149
|
+
design["Area"] = 18000
|
|
150
|
+
stretch["Area"] = 20000
|
|
151
|
+
|
|
152
|
+
design["nvisits"] = {"u": 56, "g": 80, "r": 184, "i": 184, "z": 160, "y": 160}
|
|
153
|
+
stretch["nvisits"] = {"u": 70, "g": 100, "r": 230, "i": 230, "z": 200, "y": 200}
|
|
154
|
+
|
|
155
|
+
# mag/sq arcsec
|
|
156
|
+
design["skybrightness"] = {
|
|
157
|
+
"u": 21.8,
|
|
158
|
+
"g": 22.0,
|
|
159
|
+
"r": 21.3,
|
|
160
|
+
"i": 20.0,
|
|
161
|
+
"z": 19.1,
|
|
162
|
+
"y": 17.5,
|
|
163
|
+
}
|
|
164
|
+
stretch["skybrightness"] = {
|
|
165
|
+
"u": 21.8,
|
|
166
|
+
"g": 22.0,
|
|
167
|
+
"r": 21.3,
|
|
168
|
+
"i": 20.0,
|
|
169
|
+
"z": 19.1,
|
|
170
|
+
"y": 17.5,
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
# arcsec - old seeing values
|
|
174
|
+
design["seeing"] = {"u": 0.77, "g": 0.73, "r": 0.7, "i": 0.67, "z": 0.65, "y": 0.63}
|
|
175
|
+
stretch["seeing"] = {
|
|
176
|
+
"u": 0.77,
|
|
177
|
+
"g": 0.73,
|
|
178
|
+
"r": 0.7,
|
|
179
|
+
"i": 0.67,
|
|
180
|
+
"z": 0.65,
|
|
181
|
+
"y": 0.63,
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
# arcsec - new FWHMeff values (scaled from old seeing)
|
|
185
|
+
design["FWHMeff"] = {
|
|
186
|
+
"u": 0.92,
|
|
187
|
+
"g": 0.87,
|
|
188
|
+
"r": 0.83,
|
|
189
|
+
"i": 0.80,
|
|
190
|
+
"z": 0.78,
|
|
191
|
+
"y": 0.76,
|
|
192
|
+
}
|
|
193
|
+
stretch["FWHMeff"] = {
|
|
194
|
+
"u": 0.92,
|
|
195
|
+
"g": 0.87,
|
|
196
|
+
"r": 0.83,
|
|
197
|
+
"i": 0.80,
|
|
198
|
+
"z": 0.78,
|
|
199
|
+
"y": 0.76,
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
design["singleVisitDepth"] = {
|
|
203
|
+
"u": 23.9,
|
|
204
|
+
"g": 25.0,
|
|
205
|
+
"r": 24.7,
|
|
206
|
+
"i": 24.0,
|
|
207
|
+
"z": 23.3,
|
|
208
|
+
"y": 22.1,
|
|
209
|
+
}
|
|
210
|
+
stretch["singleVisitDepth"] = {
|
|
211
|
+
"u": 24.0,
|
|
212
|
+
"g": 25.1,
|
|
213
|
+
"r": 24.8,
|
|
214
|
+
"i": 24.1,
|
|
215
|
+
"z": 23.4,
|
|
216
|
+
"y": 22.2,
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
# Scale the number of visits.
|
|
220
|
+
if run_length != baseline:
|
|
221
|
+
scalefactor = float(run_length) / float(baseline)
|
|
222
|
+
# Calculate scaled value for design and stretch values of nvisits,
|
|
223
|
+
# per filter.
|
|
224
|
+
for f in design["nvisits"]:
|
|
225
|
+
design["nvisits"][f] = int(np.floor(design["nvisits"][f] * scalefactor))
|
|
226
|
+
stretch["nvisits"][f] = int(np.floor(stretch["nvisits"][f] * scalefactor))
|
|
227
|
+
|
|
228
|
+
if benchmark == "design":
|
|
229
|
+
return design
|
|
230
|
+
elif benchmark == "stretch":
|
|
231
|
+
return stretch
|
|
232
|
+
else:
|
|
233
|
+
raise ValueError("Benchmark value %s not understood: use 'design' or 'stretch'" % (benchmark))
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def calc_coadded_depth(nvisits, single_visit_depth):
|
|
237
|
+
"""Calculate the coadded depth expected for a given number of visits
|
|
238
|
+
and single visit depth.
|
|
239
|
+
|
|
240
|
+
Parameters
|
|
241
|
+
----------
|
|
242
|
+
nvisits : `dict` of `int` or `float`
|
|
243
|
+
Dictionary (per filter) of number of visits
|
|
244
|
+
single_visit_depth : `dict` of `float`
|
|
245
|
+
Dictionary (per filter) of the single visit depth
|
|
246
|
+
|
|
247
|
+
Returns
|
|
248
|
+
-------
|
|
249
|
+
coadded_depth : `dict` of `float`
|
|
250
|
+
Dictionary of coadded depths per filter.
|
|
251
|
+
"""
|
|
252
|
+
coadded_depth = {}
|
|
253
|
+
for f in nvisits:
|
|
254
|
+
if f not in single_visit_depth:
|
|
255
|
+
raise ValueError("Filter keys in nvisits and single_visit_depth must match")
|
|
256
|
+
coadded_depth[f] = float(1.25 * np.log10(nvisits[f] * 10 ** (0.8 * single_visit_depth[f])))
|
|
257
|
+
if not np.isfinite(coadded_depth[f]):
|
|
258
|
+
coadded_depth[f] = single_visit_depth[f]
|
|
259
|
+
return coadded_depth
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
__all__ = ("name_sanitize",)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def name_sanitize(in_string):
|
|
5
|
+
"""
|
|
6
|
+
Convert a string to a more file name (and web) friendly format.
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
----------
|
|
10
|
+
in_string : `str`
|
|
11
|
+
The input string to be sanitized.
|
|
12
|
+
Typically these are combinations of metric names and metadata.
|
|
13
|
+
|
|
14
|
+
Returns
|
|
15
|
+
-------
|
|
16
|
+
out_string : `str`
|
|
17
|
+
The string after removal/replacement of non-friendly characters.
|
|
18
|
+
"""
|
|
19
|
+
# Replace <, > and = signs.
|
|
20
|
+
out_string = in_string.replace(">", "gt").replace("<", "lt").replace("=", "eq")
|
|
21
|
+
# Remove single-spaces, strip '.'s and ','s
|
|
22
|
+
out_string = out_string.replace(" ", "_").replace(".", "_").replace(",", "")
|
|
23
|
+
# and remove / and \
|
|
24
|
+
out_string = out_string.replace("/", "_").replace("\\", "_")
|
|
25
|
+
# and remove parentheses
|
|
26
|
+
out_string = out_string.replace("(", "").replace(")", "")
|
|
27
|
+
# Remove ':' and ';"
|
|
28
|
+
out_string = out_string.replace(":", "_").replace(";", "_")
|
|
29
|
+
# Replace '%' and #
|
|
30
|
+
out_string = out_string.replace("%", "_").replace("#", "_")
|
|
31
|
+
# Remove '__'
|
|
32
|
+
while "__" in out_string:
|
|
33
|
+
out_string = out_string.replace("__", "_")
|
|
34
|
+
return out_string
|