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,480 @@
|
|
|
1
|
+
# This code is a short-term modification to let older versions of rubin_sim
|
|
2
|
+
# read pre-night simulations made using the vsarch code on the tickets/SP-2167
|
|
3
|
+
# branch, before that branch is actually merged.
|
|
4
|
+
|
|
5
|
+
# It consists of a minimial set of functions from that branch needed
|
|
6
|
+
# to support fetch_obsloctap_visits, collected into one file.
|
|
7
|
+
|
|
8
|
+
__all__ = ["_fetch_obsloctap_visits"]
|
|
9
|
+
|
|
10
|
+
import logging
|
|
11
|
+
from datetime import date, datetime, timedelta, timezone
|
|
12
|
+
from tempfile import TemporaryDirectory
|
|
13
|
+
from typing import Sequence
|
|
14
|
+
from zoneinfo import ZoneInfo
|
|
15
|
+
|
|
16
|
+
import numpy as np
|
|
17
|
+
import pandas as pd
|
|
18
|
+
from astropy.time import Time
|
|
19
|
+
from lsst.resources import ResourcePath
|
|
20
|
+
from rubin_scheduler.site_models.almanac import Almanac
|
|
21
|
+
|
|
22
|
+
from rubin_sim import maf
|
|
23
|
+
from rubin_sim.maf.stackers import BaseStacker
|
|
24
|
+
from rubin_sim.maf.utils.opsim_utils import get_sim_data
|
|
25
|
+
|
|
26
|
+
LOGGER = logging.getLogger(__name__)
|
|
27
|
+
PRENIGHT_INDEX_URL = "s3://rubin:rubin-scheduler-prenight/opsim/prenight_index/"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _get_visits(
|
|
31
|
+
visits_url: str | ResourcePath,
|
|
32
|
+
query: str = "",
|
|
33
|
+
stackers: Sequence[BaseStacker] = (),
|
|
34
|
+
) -> pd.DataFrame:
|
|
35
|
+
"""Retrieve visits for a visit sequence.
|
|
36
|
+
|
|
37
|
+
Parameters
|
|
38
|
+
----------
|
|
39
|
+
visits_url : `str`
|
|
40
|
+
The origin of the visits.
|
|
41
|
+
query : `str`
|
|
42
|
+
A query in `pandas.DataFrame.query` syntax to select visits
|
|
43
|
+
from the returned sequence. Applied before stackers are run.
|
|
44
|
+
stackers : `Sequence` [`BaseStacker`]
|
|
45
|
+
A sequence of maf stackers to apply.
|
|
46
|
+
|
|
47
|
+
Returns
|
|
48
|
+
-------
|
|
49
|
+
visits: `pd.DataFrame`
|
|
50
|
+
The visits in the sequence.
|
|
51
|
+
"""
|
|
52
|
+
origin_rp = ResourcePath(visits_url)
|
|
53
|
+
|
|
54
|
+
with TemporaryDirectory() as temp_dir:
|
|
55
|
+
h5_destination = ResourcePath(temp_dir).join("visits.h5")
|
|
56
|
+
h5_destination.transfer_from(origin_rp, "copy")
|
|
57
|
+
visits = pd.read_hdf(h5_destination.ospath, key="observations")
|
|
58
|
+
|
|
59
|
+
assert isinstance(visits, pd.DataFrame)
|
|
60
|
+
|
|
61
|
+
if len(query) > 0:
|
|
62
|
+
visits.query(query, inplace=True)
|
|
63
|
+
|
|
64
|
+
if len(stackers) > 0:
|
|
65
|
+
visit_records = visits.to_records()
|
|
66
|
+
for stacker in stackers:
|
|
67
|
+
visit_records = stacker.run(visit_records)
|
|
68
|
+
visits = pd.DataFrame(visit_records)
|
|
69
|
+
|
|
70
|
+
return visits
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _dayobs_to_date(dayobs: str | date | int | Time) -> date:
|
|
74
|
+
"""Convert dayobs in as a str, date, int, or astropyTime
|
|
75
|
+
to a python datetime.date.
|
|
76
|
+
|
|
77
|
+
Parameters
|
|
78
|
+
----------
|
|
79
|
+
dayobs: `str` or `datetime.date` or `int` or `astropy.time.Time`
|
|
80
|
+
The date of observation an flexible format.
|
|
81
|
+
|
|
82
|
+
Return
|
|
83
|
+
------
|
|
84
|
+
dayobs_date : `datetime.date`
|
|
85
|
+
The date of observation as a ``datetime.date``.
|
|
86
|
+
"""
|
|
87
|
+
match dayobs:
|
|
88
|
+
case int():
|
|
89
|
+
year = dayobs // 10000
|
|
90
|
+
month = (dayobs // 100) % 100
|
|
91
|
+
day = dayobs % 100
|
|
92
|
+
dayobs = date(year, month, day)
|
|
93
|
+
case str():
|
|
94
|
+
dayobs = datetime.fromisoformat(dayobs).date()
|
|
95
|
+
case Time():
|
|
96
|
+
# Pacify type checkers
|
|
97
|
+
assert isinstance(dayobs, Time)
|
|
98
|
+
dayobs_dt = dayobs.to_datetime(timezone=timezone(timedelta(hours=-12)))
|
|
99
|
+
if isinstance(dayobs_dt, datetime):
|
|
100
|
+
dayobs = dayobs_dt.date()
|
|
101
|
+
else:
|
|
102
|
+
assert isinstance(dayobs_dt, np.ndarray)
|
|
103
|
+
assert len(dayobs_dt) == 1
|
|
104
|
+
dayobs = dayobs_dt.item().date()
|
|
105
|
+
assert isinstance(dayobs, date)
|
|
106
|
+
case datetime():
|
|
107
|
+
dayobs = dayobs.date()
|
|
108
|
+
case _:
|
|
109
|
+
assert isinstance(dayobs, date)
|
|
110
|
+
|
|
111
|
+
assert isinstance(dayobs, date)
|
|
112
|
+
return dayobs
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _get_prenight_index_from_bucket(
|
|
116
|
+
day_obs: str | int | date,
|
|
117
|
+
telescope: str = "simonyi",
|
|
118
|
+
prenight_index_path: str | ResourcePath = PRENIGHT_INDEX_URL,
|
|
119
|
+
) -> pd.DataFrame:
|
|
120
|
+
"""
|
|
121
|
+
Load the pre‑night observation index for a given night from a remote
|
|
122
|
+
bucket.
|
|
123
|
+
|
|
124
|
+
Parameters
|
|
125
|
+
----------
|
|
126
|
+
day_obs : `str` or `int` or `date`
|
|
127
|
+
The night for which to fetch the index. Accepts a date string,
|
|
128
|
+
YYYYMMDD encoded into an integer, a ``datetime.date``
|
|
129
|
+
telescope : `str`, optional
|
|
130
|
+
Telescope name (default ``"simonyi"``).
|
|
131
|
+
prenight_index_path : `str` or `ResourcePath`, optional
|
|
132
|
+
The root path where the pre‑night index
|
|
133
|
+
JSON files are stored. It can be a string URL or a
|
|
134
|
+
``ResourcePath`` instance.
|
|
135
|
+
|
|
136
|
+
Returns
|
|
137
|
+
-------
|
|
138
|
+
prenights : `pandas.DataFrame`
|
|
139
|
+
A DataFrame indexed by the JSON key (``visitseq_uuid``) containing
|
|
140
|
+
all pre‑night entries for the requested night. The columns match
|
|
141
|
+
those stored in the JSON file.
|
|
142
|
+
"""
|
|
143
|
+
day_obs_date = _dayobs_to_date(day_obs)
|
|
144
|
+
assert isinstance(day_obs_date, date)
|
|
145
|
+
|
|
146
|
+
prenight_index_path = ResourcePath(prenight_index_path, forceDirectory=True)
|
|
147
|
+
assert isinstance(prenight_index_path, ResourcePath)
|
|
148
|
+
|
|
149
|
+
year = day_obs_date.year
|
|
150
|
+
month = day_obs_date.month
|
|
151
|
+
isodate = day_obs_date.isoformat()
|
|
152
|
+
|
|
153
|
+
prenight_index_resource_path = (
|
|
154
|
+
prenight_index_path.join(telescope)
|
|
155
|
+
.join(str(year))
|
|
156
|
+
.join(str(month))
|
|
157
|
+
.join(f"{telescope}_prenights_for_{isodate}.json")
|
|
158
|
+
)
|
|
159
|
+
with prenight_index_resource_path.as_local() as local_resource_path:
|
|
160
|
+
prenights = pd.read_json(local_resource_path.ospath, orient="index")
|
|
161
|
+
|
|
162
|
+
return prenights
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def _get_prenight_index(
|
|
166
|
+
day_obs: str | int | date,
|
|
167
|
+
telescope: str = "simonyi",
|
|
168
|
+
prenight_index_path: str | ResourcePath | None = None,
|
|
169
|
+
) -> pd.DataFrame:
|
|
170
|
+
"""Retrieve the pre‑night observation index for a given night.
|
|
171
|
+
|
|
172
|
+
Parameters
|
|
173
|
+
----------
|
|
174
|
+
day_obs : `str` or `int` or `date`
|
|
175
|
+
Night for which to fetch the index.
|
|
176
|
+
telescope : `str`
|
|
177
|
+
Telescope name (default ``simonyi``).
|
|
178
|
+
prenight_index_path : `str` or `ResourcePath`, optional
|
|
179
|
+
Root path to the bucket files (used only if the database call fails).
|
|
180
|
+
|
|
181
|
+
Returns
|
|
182
|
+
-------
|
|
183
|
+
prenights: `pd.DataFrame`
|
|
184
|
+
Pre‑night index indexed by ``visitseq_uuid``.
|
|
185
|
+
"""
|
|
186
|
+
if prenight_index_path is None:
|
|
187
|
+
prenight_index_path = PRENIGHT_INDEX_URL
|
|
188
|
+
try:
|
|
189
|
+
prenights = _get_prenight_index_from_bucket(day_obs, telescope, prenight_index_path)
|
|
190
|
+
except FileNotFoundError:
|
|
191
|
+
prenights = pd.DataFrame()
|
|
192
|
+
|
|
193
|
+
return prenights
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def _select_latest_prenight_sim(
|
|
197
|
+
prenights: pd.DataFrame,
|
|
198
|
+
tags: tuple[str, ...] = ("ideal", "nominal"),
|
|
199
|
+
max_simulation_age: int = 2,
|
|
200
|
+
) -> dict | None:
|
|
201
|
+
"""Select the best prenight simulation from a DataFrame.
|
|
202
|
+
|
|
203
|
+
Parameters
|
|
204
|
+
----------
|
|
205
|
+
prenights: `pd.DataFrame`
|
|
206
|
+
The table of prenights from which to select.
|
|
207
|
+
tags : `tuple` [`str`]
|
|
208
|
+
A tuple of tags to filter simulations by.
|
|
209
|
+
Defaults to ``('ideal', 'nominal')``.
|
|
210
|
+
max_simulation_age : `int`
|
|
211
|
+
The maximum age of simulations to consider, in days.
|
|
212
|
+
Simulations older than ``max_simulation_age`` will not be considered.
|
|
213
|
+
Defaults to 2.
|
|
214
|
+
|
|
215
|
+
Returns
|
|
216
|
+
-------
|
|
217
|
+
best_sim : `dict` or `None`
|
|
218
|
+
A dictionary with metadata for the simulation.
|
|
219
|
+
"""
|
|
220
|
+
best_sim = None
|
|
221
|
+
for _, sim in prenights.reset_index().iterrows():
|
|
222
|
+
if not set(tags).issubset(sim["tags"]):
|
|
223
|
+
continue
|
|
224
|
+
if best_sim is not None:
|
|
225
|
+
if sim["creation_time"] < best_sim["creation_time"]:
|
|
226
|
+
continue
|
|
227
|
+
|
|
228
|
+
age = (pd.Timestamp.now(tz="UTC") - sim["creation_time"]).days
|
|
229
|
+
if age > max_simulation_age:
|
|
230
|
+
continue
|
|
231
|
+
|
|
232
|
+
best_sim = sim
|
|
233
|
+
|
|
234
|
+
if best_sim is not None:
|
|
235
|
+
LOGGER.info(f"Most recent simulation meeting requested criteria is {best_sim['visitseq_url']}.")
|
|
236
|
+
else:
|
|
237
|
+
LOGGER.debug("No simulations met the requested criteria.")
|
|
238
|
+
|
|
239
|
+
return best_sim
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
def _find_latest_prenight_sim_for_nights(
|
|
243
|
+
first_day_obs: str | None = None,
|
|
244
|
+
last_day_obs: str | None = None,
|
|
245
|
+
tags: tuple[str, ...] = ("ideal", "nominal"),
|
|
246
|
+
telescope: str = "simonyi",
|
|
247
|
+
max_simulation_age: int = 2,
|
|
248
|
+
get_prenight_index_kwargs: dict | None = None,
|
|
249
|
+
) -> dict:
|
|
250
|
+
"""Find the most recent prenight simulation that covers a night.
|
|
251
|
+
|
|
252
|
+
Parameters
|
|
253
|
+
----------
|
|
254
|
+
first_day_obs : `str` or `None`
|
|
255
|
+
The date of the evening for the first night for which to get
|
|
256
|
+
a simulation. If `None`, then the current date will be used.
|
|
257
|
+
last_day_obs : `str` or `None`
|
|
258
|
+
The date of the evening for the last night for which to get
|
|
259
|
+
a simulation. If `None`, then the current date will be used.
|
|
260
|
+
tags : `tuple[str]`
|
|
261
|
+
A tuple of tags to filter simulations by.
|
|
262
|
+
Defaults to ``('ideal', 'nominal')``.
|
|
263
|
+
telescope : `str`
|
|
264
|
+
The telescope to search for (simonyi or auxtel).
|
|
265
|
+
Defaults to simonyi.
|
|
266
|
+
max_simulation_age : `int`
|
|
267
|
+
The maximum age of simulations to consider, in days.
|
|
268
|
+
Simulations older than ``max_simulation_age`` will not be considered.
|
|
269
|
+
Defaults to 2.
|
|
270
|
+
|
|
271
|
+
Returns
|
|
272
|
+
-------
|
|
273
|
+
sim_metadata : `dict`
|
|
274
|
+
A dictionary with metadata for the simulation.
|
|
275
|
+
"""
|
|
276
|
+
if first_day_obs is None:
|
|
277
|
+
first_day_obs = datetime.now(ZoneInfo("Etc/GMT+12")).date().isoformat()
|
|
278
|
+
if last_day_obs is None:
|
|
279
|
+
last_day_obs = first_day_obs
|
|
280
|
+
|
|
281
|
+
if get_prenight_index_kwargs is None:
|
|
282
|
+
get_prenight_index_kwargs = {}
|
|
283
|
+
assert isinstance(get_prenight_index_kwargs, dict)
|
|
284
|
+
|
|
285
|
+
sims_for_first_night = _get_prenight_index(first_day_obs, telescope, **get_prenight_index_kwargs)
|
|
286
|
+
if first_day_obs != last_day_obs:
|
|
287
|
+
sims_for_last_night = _get_prenight_index(last_day_obs, telescope, **get_prenight_index_kwargs)
|
|
288
|
+
full_range_sims = set(sims_for_first_night.index) & set(sims_for_last_night.index)
|
|
289
|
+
else:
|
|
290
|
+
full_range_sims = set(sims_for_first_night.index)
|
|
291
|
+
|
|
292
|
+
result: dict = {}
|
|
293
|
+
if full_range_sims:
|
|
294
|
+
candidate_sims = sims_for_first_night.loc[tuple(full_range_sims), :]
|
|
295
|
+
maybe_result = _select_latest_prenight_sim(candidate_sims, tags, max_simulation_age)
|
|
296
|
+
if maybe_result is not None:
|
|
297
|
+
assert isinstance(maybe_result, pd.Series)
|
|
298
|
+
result = maybe_result.to_dict()
|
|
299
|
+
|
|
300
|
+
return result
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def _fetch_sim_for_nights(
|
|
304
|
+
first_day_obs: str | None = None,
|
|
305
|
+
last_day_obs: str | None = None,
|
|
306
|
+
which_sim: ResourcePath | str | dict | None = None,
|
|
307
|
+
stackers: Sequence[BaseStacker] = (),
|
|
308
|
+
get_sim_data_kwargs: dict | None = None,
|
|
309
|
+
) -> pd.DataFrame | None:
|
|
310
|
+
"""Fetches visit metadata from an opsim database for specified nights.
|
|
311
|
+
|
|
312
|
+
Parameters
|
|
313
|
+
----------
|
|
314
|
+
first_day_obs : `str` or `None`
|
|
315
|
+
The date of the evening for the first night for which to get
|
|
316
|
+
a simulation. If `None`, then the current date will be used.
|
|
317
|
+
last_day_obs : `str` or `None`
|
|
318
|
+
The date of the evening for the last night for which to get
|
|
319
|
+
a simulation. If `None`, then the current date will be used.
|
|
320
|
+
which_sim : `ResourcePath` or `str` or `dict` on `None`
|
|
321
|
+
The ``resourcePath`` or URL of the opsim file from which to
|
|
322
|
+
load visits, or the arguments to
|
|
323
|
+
``find_latest_prenight_sim_for_nights``
|
|
324
|
+
to use to determine which simulation to load. ``None`` uses
|
|
325
|
+
default arguments to ``find_latest_prenight_sim_for_nights``.
|
|
326
|
+
Defaults to ``None``.
|
|
327
|
+
stackers : `Sequence[BaseStacker]`
|
|
328
|
+
A sequence of maf stackers to apply.
|
|
329
|
+
get_sim_data_kwargs : `dict`
|
|
330
|
+
Additional arguments to ``get_sim_data`` to use to load
|
|
331
|
+
the visits.
|
|
332
|
+
|
|
333
|
+
Returns
|
|
334
|
+
-------
|
|
335
|
+
visits : `pd.DataFrame`
|
|
336
|
+
A pandas DataFrame containing visit parameters.
|
|
337
|
+
"""
|
|
338
|
+
if first_day_obs is None:
|
|
339
|
+
first_day_obs = datetime.now(ZoneInfo("Etc/GMT+12")).date().isoformat()
|
|
340
|
+
if last_day_obs is None:
|
|
341
|
+
last_day_obs = first_day_obs
|
|
342
|
+
|
|
343
|
+
opsim_rp: ResourcePath | None = None
|
|
344
|
+
match which_sim:
|
|
345
|
+
case ResourcePath():
|
|
346
|
+
opsim_rp = which_sim
|
|
347
|
+
case str():
|
|
348
|
+
opsim_rp = ResourcePath(which_sim)
|
|
349
|
+
case dict():
|
|
350
|
+
this_sim = _find_latest_prenight_sim_for_nights(first_day_obs, last_day_obs, **which_sim)
|
|
351
|
+
if len(this_sim) == 0:
|
|
352
|
+
raise ValueError("No matching simulations found")
|
|
353
|
+
visitseq_url = this_sim["visitseq_url"]
|
|
354
|
+
if visitseq_url is not None:
|
|
355
|
+
opsim_rp = ResourcePath(visitseq_url)
|
|
356
|
+
elif "opsim" in this_sim["files"]:
|
|
357
|
+
opsim_rp = ResourcePath(this_sim["files"]["opsim"])
|
|
358
|
+
else:
|
|
359
|
+
raise ValueError("No visits found")
|
|
360
|
+
case None:
|
|
361
|
+
this_sim = _find_latest_prenight_sim_for_nights(first_day_obs, last_day_obs)
|
|
362
|
+
if len(this_sim) == 0:
|
|
363
|
+
raise ValueError("No matching simulations found")
|
|
364
|
+
visitseq_url = this_sim["visitseq_url"]
|
|
365
|
+
if visitseq_url is not None:
|
|
366
|
+
opsim_rp = ResourcePath(visitseq_url)
|
|
367
|
+
elif "opsim" in this_sim["files"]:
|
|
368
|
+
opsim_rp = ResourcePath(this_sim["files"]["opsim"])
|
|
369
|
+
else:
|
|
370
|
+
raise ValueError("Ne visits found")
|
|
371
|
+
case _:
|
|
372
|
+
raise NotImplementedError()
|
|
373
|
+
|
|
374
|
+
assert isinstance(opsim_rp, ResourcePath)
|
|
375
|
+
|
|
376
|
+
if len(stackers) == 0:
|
|
377
|
+
if isinstance(get_sim_data_kwargs, dict) and "stackers" in get_sim_data_kwargs:
|
|
378
|
+
stackers = get_sim_data_kwargs["stackers"]
|
|
379
|
+
else:
|
|
380
|
+
stackers = []
|
|
381
|
+
assert isinstance(stackers, list)
|
|
382
|
+
|
|
383
|
+
dayobsiso_requested = maf.DayObsISOStacker in [s.__class__ for s in stackers]
|
|
384
|
+
if not dayobsiso_requested:
|
|
385
|
+
# We want it to filter out dates that were not requested,
|
|
386
|
+
# so add it to the stacker even if it was not requested.
|
|
387
|
+
stackers.append(maf.DayObsISOStacker())
|
|
388
|
+
|
|
389
|
+
if opsim_rp.getExtension() in (".db", ".sqlite3"):
|
|
390
|
+
if get_sim_data_kwargs is None:
|
|
391
|
+
get_sim_data_kwargs = {}
|
|
392
|
+
assert isinstance(get_sim_data_kwargs, dict)
|
|
393
|
+
get_sim_data_kwargs["stackers"] = stackers
|
|
394
|
+
visits_recarray = get_sim_data(opsim_rp, **get_sim_data_kwargs)
|
|
395
|
+
visits = pd.DataFrame(visits_recarray)
|
|
396
|
+
else:
|
|
397
|
+
visits = _get_visits(opsim_rp, stackers=stackers)
|
|
398
|
+
|
|
399
|
+
LOGGER.debug(f"Loaded {len(visits)} from {opsim_rp}")
|
|
400
|
+
on_requested_dates = (first_day_obs <= visits["day_obs_iso8601"]) & (
|
|
401
|
+
visits["day_obs_iso8601"] <= last_day_obs
|
|
402
|
+
)
|
|
403
|
+
visits = visits.loc[on_requested_dates, :]
|
|
404
|
+
# If it dayobsiso was not requested, do not return it.
|
|
405
|
+
if not dayobsiso_requested:
|
|
406
|
+
visits.drop(columns="day_obs_iso8601", inplace=True)
|
|
407
|
+
|
|
408
|
+
return visits
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
def _fetch_obsloctap_visits(
|
|
412
|
+
day_obs: str | None = None,
|
|
413
|
+
nights: int = 2,
|
|
414
|
+
telescope: str = "simonyi",
|
|
415
|
+
columns: Sequence[str] = (
|
|
416
|
+
"observationStartMJD",
|
|
417
|
+
"fieldRA",
|
|
418
|
+
"fieldDec",
|
|
419
|
+
"rotSkyPos",
|
|
420
|
+
"band",
|
|
421
|
+
"visitExposureTime",
|
|
422
|
+
"night",
|
|
423
|
+
"target_name",
|
|
424
|
+
),
|
|
425
|
+
) -> pd.DataFrame | None:
|
|
426
|
+
"""Return visits from latest nominal prenight briefing simulation.
|
|
427
|
+
|
|
428
|
+
Parameters
|
|
429
|
+
----------
|
|
430
|
+
day_obs : `str`
|
|
431
|
+
The day_obs of the night, in YYYY-MM-DD format (e.g. 2025-03-26).
|
|
432
|
+
Default None will use the date of the next sunset.
|
|
433
|
+
nights : `int`
|
|
434
|
+
The number of nights of observations to return.
|
|
435
|
+
Defaults to 2.
|
|
436
|
+
telescope : `str`
|
|
437
|
+
The telescope to get visits for: "simonyi" or "auxtel".
|
|
438
|
+
Defaults to "simonyi".
|
|
439
|
+
colums : `Sequence`
|
|
440
|
+
A sequence of columns from the simulation to include.
|
|
441
|
+
|
|
442
|
+
Returns
|
|
443
|
+
-------
|
|
444
|
+
visits : `pd.DataFrame`
|
|
445
|
+
The visits from the prenight simulation.
|
|
446
|
+
"""
|
|
447
|
+
# Start with the first night that starts after the reference time,
|
|
448
|
+
# which is the current time by default.
|
|
449
|
+
# So, if the reference time is during a night, it starts with the
|
|
450
|
+
# following night.
|
|
451
|
+
night_bounds = pd.DataFrame(Almanac().sunsets)
|
|
452
|
+
current_mjd = Time.now().mjd
|
|
453
|
+
assert isinstance(current_mjd, float)
|
|
454
|
+
reference_mjd = (Time.now() if day_obs is None else Time(day_obs, format="iso", scale="utc")).mjd
|
|
455
|
+
assert isinstance(reference_mjd, float)
|
|
456
|
+
first_night = night_bounds.query(f"sunset > {reference_mjd}").night.min()
|
|
457
|
+
last_night = first_night + nights - 1
|
|
458
|
+
|
|
459
|
+
night_bounds.set_index("night", inplace=True)
|
|
460
|
+
start_mjd = night_bounds.loc[first_night, "sunset"]
|
|
461
|
+
assert isinstance(start_mjd, float)
|
|
462
|
+
end_mjd = night_bounds.loc[last_night, "sunrise"]
|
|
463
|
+
assert isinstance(end_mjd, float)
|
|
464
|
+
|
|
465
|
+
first_day_obs = Time(start_mjd - 0.5, format="mjd").iso[:10]
|
|
466
|
+
assert isinstance(first_day_obs, str)
|
|
467
|
+
last_day_obs = Time(end_mjd - 0.5, format="mjd").iso[:10]
|
|
468
|
+
assert isinstance(last_day_obs, str)
|
|
469
|
+
|
|
470
|
+
which_sim = {
|
|
471
|
+
"tags": ("ideal", "nominal"),
|
|
472
|
+
"telescope": telescope,
|
|
473
|
+
"max_simulation_age": int(np.ceil(current_mjd - reference_mjd)) + 1,
|
|
474
|
+
}
|
|
475
|
+
visits = _fetch_sim_for_nights(first_day_obs, last_day_obs, which_sim=which_sim)
|
|
476
|
+
if visits is not None:
|
|
477
|
+
assert isinstance(visits, pd.DataFrame)
|
|
478
|
+
visits = visits.loc[:, list(columns)]
|
|
479
|
+
|
|
480
|
+
return visits
|