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,293 @@
|
|
|
1
|
+
__all__ = (
|
|
2
|
+
"make_circle_subset_slicer",
|
|
3
|
+
"make_wfd_subset_slicer",
|
|
4
|
+
"HealpixSubsetSlicer",
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
from functools import wraps
|
|
8
|
+
|
|
9
|
+
import healpy as hp
|
|
10
|
+
import numpy as np
|
|
11
|
+
import rubin_scheduler.utils as simsUtils
|
|
12
|
+
from rubin_scheduler.scheduler.utils import get_current_footprint
|
|
13
|
+
|
|
14
|
+
from .healpix_slicer import HealpixSlicer
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def make_circle_subset_slicer(ra_cen, dec_cen, radius=3.0, nside=512, use_cache=False):
|
|
18
|
+
"""Create a circular healpix subset slicer, centered on ra_cen/dec_cen.
|
|
19
|
+
|
|
20
|
+
Parameters
|
|
21
|
+
----------
|
|
22
|
+
ra_cen : `float`
|
|
23
|
+
RA of the center of the slicer (degrees).
|
|
24
|
+
dec_cen : `float`
|
|
25
|
+
Dec of the center of the slicer (degrees).
|
|
26
|
+
radius : `float`, optional
|
|
27
|
+
Radius of the circular slicer extent (degrees).
|
|
28
|
+
nside : `int`, optional
|
|
29
|
+
Nside resolution of the healpix subset slicer.
|
|
30
|
+
use_cache : `bool`, optional
|
|
31
|
+
Set up the slicer to `use_cache` or not.
|
|
32
|
+
|
|
33
|
+
Returns
|
|
34
|
+
-------
|
|
35
|
+
subsetslicer, plot_dict : `maf.HealpixSubsetSlicer`, `dict`
|
|
36
|
+
A healpix subset slicer, defined according to a circle centered
|
|
37
|
+
on `ra_cen`, `dec_cen`, with radius `radius`.
|
|
38
|
+
Also returns a minimal plot dict, with the visufunc and rotation
|
|
39
|
+
information to plot a small circular area with the HealpixSkyMap
|
|
40
|
+
plotter.
|
|
41
|
+
"""
|
|
42
|
+
ra, dec = simsUtils.hpid2_ra_dec(nside, np.arange(hp.nside2npix(nside)))
|
|
43
|
+
dist = simsUtils.angular_separation(ra_cen, dec_cen, ra, dec)
|
|
44
|
+
close = np.where(dist <= radius)[0]
|
|
45
|
+
subsetslicer = HealpixSubsetSlicer(nside, close, use_cache=use_cache)
|
|
46
|
+
plot_dict = {
|
|
47
|
+
"visufunc": hp.gnomview,
|
|
48
|
+
"rot": (ra_cen, dec_cen, 0),
|
|
49
|
+
"xsize": 500,
|
|
50
|
+
}
|
|
51
|
+
return subsetslicer, plot_dict
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def make_wfd_subset_slicer(nside=64, use_cache=True, wfd_labels=None):
|
|
55
|
+
"""Create a wfd-only healpix subset slicer.
|
|
56
|
+
|
|
57
|
+
Parameters
|
|
58
|
+
----------
|
|
59
|
+
nside : `int`, optional
|
|
60
|
+
Nside resolution of the healpix subset slicer.
|
|
61
|
+
use_cache : `bool`, optional
|
|
62
|
+
Set up the slicer to `use_cache` or not.
|
|
63
|
+
wfd_labels : `list` [`str`] or None
|
|
64
|
+
List of the labels from the footprint to use for the "WFD"
|
|
65
|
+
(or other) footprint. Default of None will use the current
|
|
66
|
+
WFD level areas, including the WFD-level galactic plane area.
|
|
67
|
+
|
|
68
|
+
Returns
|
|
69
|
+
-------
|
|
70
|
+
subsetslicer : `maf.HealpixSubsetSlicer`
|
|
71
|
+
A healpix subset slicer, defined according to the most current
|
|
72
|
+
version of the scheduler footprint using `get_current_footprint`.
|
|
73
|
+
"""
|
|
74
|
+
if wfd_labels is None:
|
|
75
|
+
wfd_labels = ["lowdust", "euclid_overlap", "virgo", "bulgy", "LMC_SMC"]
|
|
76
|
+
footprints, labels = get_current_footprint(nside=nside)
|
|
77
|
+
wfdpix = np.where(np.isin(labels, wfd_labels))[0]
|
|
78
|
+
slicer = HealpixSubsetSlicer(nside=nside, hpid=wfdpix, use_cache=use_cache)
|
|
79
|
+
return slicer
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class HealpixSubsetSlicer(HealpixSlicer):
|
|
83
|
+
"""A spatial slicer that evaluates pointings on a subset of a healpix grid.
|
|
84
|
+
|
|
85
|
+
The advantage of using this healpixSubsetSlicer (rather than just putting
|
|
86
|
+
the RA/Dec values into the UserPointsSlicer, which is another valid
|
|
87
|
+
approach) is that you preserve the full healpix array.
|
|
88
|
+
This means you could do things like calculate the power spectrum
|
|
89
|
+
and plot without remapping into healpixels first. The downside is that
|
|
90
|
+
you must first (externally) define the healpixels that you
|
|
91
|
+
wish to use.
|
|
92
|
+
|
|
93
|
+
When plotting with RA/Dec, the default HealpixSkyMap can be used,
|
|
94
|
+
corresponding to {'rot': (0, 0, 0), 'flip': 'astro'}.
|
|
95
|
+
|
|
96
|
+
Parameters
|
|
97
|
+
----------
|
|
98
|
+
nside : `int`
|
|
99
|
+
The nside parameter of the healpix grid. Must be a power of 2.
|
|
100
|
+
hpid : `np.ndarray`, (N,)
|
|
101
|
+
The subset of healpix id's to use to calculate the metric.
|
|
102
|
+
Because the hpid should be defined based on a particular nside,
|
|
103
|
+
these first two arguments are not optional for this slicer.
|
|
104
|
+
lon_col : `str`, optional
|
|
105
|
+
Name of the longitude (RA equivalent) column to use
|
|
106
|
+
from the input data. Default fieldRA
|
|
107
|
+
lat_col : `str`, optional
|
|
108
|
+
Name of the latitude (Dec equivalent) column to use from
|
|
109
|
+
the input data. Default fieldDec
|
|
110
|
+
lat_lon_deg : `bool`, optional
|
|
111
|
+
Flag indicating whether the lat and lon values in the input data
|
|
112
|
+
are in degrees (True) or radians (False).
|
|
113
|
+
Default True.
|
|
114
|
+
verbose : `bool`, optional
|
|
115
|
+
Flag to indicate whether to write additional information
|
|
116
|
+
to stdout during runtime. Default True.
|
|
117
|
+
badval : `float`, optional
|
|
118
|
+
Bad value flag, relevant for plotting.
|
|
119
|
+
Default the np.nan value (in order to properly flag bad data points
|
|
120
|
+
for plotting with the healpix plotting routines).
|
|
121
|
+
In general, this should not be changed.
|
|
122
|
+
use_cache : `bool`, optional
|
|
123
|
+
Flag allowing the user to indicate whether to cache (and reuse)
|
|
124
|
+
metric results calculated with the same set of simulated data
|
|
125
|
+
pointings. This can be safely set to True for slicers not using
|
|
126
|
+
maps and will result in increased speed.
|
|
127
|
+
When calculating metric results using maps, the map data at each
|
|
128
|
+
individual ra/dec point may influence the metric results and so
|
|
129
|
+
use_cache should be set to False.
|
|
130
|
+
Default True.
|
|
131
|
+
leafsize : `int`, optional
|
|
132
|
+
Leafsize value for kdtree. Default 100.
|
|
133
|
+
radius : `float`, optional
|
|
134
|
+
Radius for matching in the kdtree.
|
|
135
|
+
Equivalent to the radius of the FOV. Degrees.
|
|
136
|
+
Default 1.75.
|
|
137
|
+
use_camera : `bool`, optional
|
|
138
|
+
Flag to indicate whether to use the LSST camera footprint or not.
|
|
139
|
+
Default False.
|
|
140
|
+
camera_radius : `float`, optional
|
|
141
|
+
max_radius for the LsstCameraFootprint (degrees).
|
|
142
|
+
camera_footprint_file : `str`, optional
|
|
143
|
+
Name of the camera footprint map to use. Can be None, which will
|
|
144
|
+
use the default.
|
|
145
|
+
rot_sky_pos_col_name : `str`, optional
|
|
146
|
+
Name of the rotSkyPos column in the input data.
|
|
147
|
+
Only used if use_camera is True.
|
|
148
|
+
Describes the orientation of the camera orientation
|
|
149
|
+
compared to the sky. Default rotSkyPos.
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
def __init__(
|
|
153
|
+
self,
|
|
154
|
+
nside,
|
|
155
|
+
hpid,
|
|
156
|
+
lon_col="fieldRA",
|
|
157
|
+
lat_col="fieldDec",
|
|
158
|
+
lat_lon_deg=True,
|
|
159
|
+
verbose=True,
|
|
160
|
+
badval=np.nan,
|
|
161
|
+
use_cache=True,
|
|
162
|
+
leafsize=100,
|
|
163
|
+
radius=2.45,
|
|
164
|
+
use_camera=True,
|
|
165
|
+
camera_radius=1.94,
|
|
166
|
+
camera_footprint_file=None,
|
|
167
|
+
rot_sky_pos_col_name="rotSkyPos",
|
|
168
|
+
):
|
|
169
|
+
"""Instantiate and set up healpix slicer object."""
|
|
170
|
+
super().__init__(
|
|
171
|
+
nside=nside,
|
|
172
|
+
verbose=verbose,
|
|
173
|
+
lon_col=lon_col,
|
|
174
|
+
lat_col=lat_col,
|
|
175
|
+
badval=badval,
|
|
176
|
+
radius=radius,
|
|
177
|
+
leafsize=leafsize,
|
|
178
|
+
use_cache=use_cache,
|
|
179
|
+
camera_radius=camera_radius,
|
|
180
|
+
use_camera=use_camera,
|
|
181
|
+
rot_sky_pos_col_name=rot_sky_pos_col_name,
|
|
182
|
+
camera_footprint_file=camera_footprint_file,
|
|
183
|
+
lat_lon_deg=lat_lon_deg,
|
|
184
|
+
)
|
|
185
|
+
self.hpid = hpid
|
|
186
|
+
# add hpid to the slicer_init values
|
|
187
|
+
self.slicer_init["hpid"] = hpid
|
|
188
|
+
self.len_hpid = len(self.hpid)
|
|
189
|
+
# Set up a mask for the metric values to use
|
|
190
|
+
self.mask = np.ones(hp.nside2npix(self.nside), bool)
|
|
191
|
+
self.mask[self.hpid] = False
|
|
192
|
+
|
|
193
|
+
def __eq__(self, other_slicer):
|
|
194
|
+
"""Evaluate if two slicers are equivalent."""
|
|
195
|
+
# If the two slicers are both healpix slicers, check nsides value.
|
|
196
|
+
result = False
|
|
197
|
+
if isinstance(other_slicer, HealpixSubsetSlicer):
|
|
198
|
+
if other_slicer.nside == self.nside:
|
|
199
|
+
if np.array_equal(other_slicer.hpid, self.hpid):
|
|
200
|
+
if other_slicer.lon_col == self.lon_col and other_slicer.lat_col == self.lat_col:
|
|
201
|
+
if other_slicer.radius == self.radius:
|
|
202
|
+
if other_slicer.use_camera == self.use_camera:
|
|
203
|
+
if other_slicer.rotSkyPosColName == self.rotSkyPosColName:
|
|
204
|
+
if np.all(other_slicer.shape == self.shape):
|
|
205
|
+
result = True
|
|
206
|
+
return result
|
|
207
|
+
|
|
208
|
+
def __iter__(self):
|
|
209
|
+
"""Iterate over the slices."""
|
|
210
|
+
self.hpid_counter = 0
|
|
211
|
+
return self
|
|
212
|
+
|
|
213
|
+
def __next__(self):
|
|
214
|
+
"""Returns results of self._slice_sim_data when iterating over slicer.
|
|
215
|
+
|
|
216
|
+
Results of self._slice_sim_data should be dictionary of
|
|
217
|
+
{'idxs': the data indexes relevant for this slice of the slicer,
|
|
218
|
+
'slice_point': the metadata for the slice_point, which always
|
|
219
|
+
includes 'sid' key for ID of slice_point.}
|
|
220
|
+
"""
|
|
221
|
+
if self.hpid_counter >= self.len_hpid:
|
|
222
|
+
raise StopIteration
|
|
223
|
+
# Set up 'current'
|
|
224
|
+
islice = self.hpid[self.hpid_counter]
|
|
225
|
+
# Set up 'next'
|
|
226
|
+
self.hpid_counter += 1
|
|
227
|
+
# Return 'current'
|
|
228
|
+
return self._slice_sim_data(islice)
|
|
229
|
+
|
|
230
|
+
def setup_slicer(self, sim_data, maps=None):
|
|
231
|
+
"""Use sim_data[self.lon_col] and sim_data[self.lat_col]
|
|
232
|
+
(in radians) to set up KDTree.
|
|
233
|
+
|
|
234
|
+
Parameters
|
|
235
|
+
-----------
|
|
236
|
+
sim_data : `numpy.ndarray`, (N,)
|
|
237
|
+
The simulated data, including the location of each pointing.
|
|
238
|
+
maps : `list` of `rubin_sim.maf.maps` objects, optional
|
|
239
|
+
List of maps (such as dust extinction) that will run to build
|
|
240
|
+
up additional metadata at each slice_point.
|
|
241
|
+
This additional metadata is available to metrics via the
|
|
242
|
+
slice_point dictionary.
|
|
243
|
+
Default None.
|
|
244
|
+
"""
|
|
245
|
+
super().setup_slicer(sim_data=sim_data, maps=maps)
|
|
246
|
+
|
|
247
|
+
@wraps(self._slice_sim_data)
|
|
248
|
+
def _slice_sim_data(islice):
|
|
249
|
+
"""Return indexes for relevant opsim data at slice_point
|
|
250
|
+
(slice_point=lon_col/lat_col value .. usually ra/dec)."""
|
|
251
|
+
# Subclass this method, just to make sure we return
|
|
252
|
+
# no data for points not in self.hpid
|
|
253
|
+
slice_point = {"sid": islice, "nside": self.nside}
|
|
254
|
+
if islice not in self.hpid:
|
|
255
|
+
indices = []
|
|
256
|
+
else:
|
|
257
|
+
sx, sy, sz = simsUtils._xyz_from_ra_dec(
|
|
258
|
+
self.slice_points["ra"][islice], self.slice_points["dec"][islice]
|
|
259
|
+
)
|
|
260
|
+
# Query against tree.
|
|
261
|
+
indices = self.opsimtree.query_ball_point((sx, sy, sz), self.rad)
|
|
262
|
+
if (self.use_camera) & (len(indices) > 0):
|
|
263
|
+
# Find the indices *of those indices* which fall in
|
|
264
|
+
# the camera footprint
|
|
265
|
+
camera_idx = self.camera(
|
|
266
|
+
self.slice_points["ra"][islice],
|
|
267
|
+
self.slice_points["dec"][islice],
|
|
268
|
+
self.data_ra[indices],
|
|
269
|
+
self.data_dec[indices],
|
|
270
|
+
self.data_rot[indices],
|
|
271
|
+
)
|
|
272
|
+
indices = np.array(indices)[camera_idx]
|
|
273
|
+
# Loop through all the slice_point keys.
|
|
274
|
+
# If the first dimension of slice_point[key] has
|
|
275
|
+
# the same shape as the slicer, assume it is information
|
|
276
|
+
# per slice_point.
|
|
277
|
+
# Otherwise, pass the whole slice_point[key] information.
|
|
278
|
+
# Useful for stellar LF maps
|
|
279
|
+
# where we want to pass only the relevant LF and the bins
|
|
280
|
+
# that go with it.
|
|
281
|
+
for key in self.slice_points:
|
|
282
|
+
if len(np.shape(self.slice_points[key])) == 0:
|
|
283
|
+
keyShape = 0
|
|
284
|
+
else:
|
|
285
|
+
keyShape = np.shape(self.slice_points[key])[0]
|
|
286
|
+
if keyShape == self.nslice:
|
|
287
|
+
slice_point[key] = self.slice_points[key][islice]
|
|
288
|
+
else:
|
|
289
|
+
slice_point[key] = self.slice_points[key]
|
|
290
|
+
|
|
291
|
+
return {"idxs": indices, "slice_point": slice_point}
|
|
292
|
+
|
|
293
|
+
setattr(self, "_slice_sim_data", _slice_sim_data)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
__all__ = ("HourglassSlicer",)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from rubin_sim.maf.plots import HourglassPlot
|
|
5
|
+
|
|
6
|
+
from .uni_slicer import UniSlicer
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class HourglassSlicer(UniSlicer):
|
|
10
|
+
"""Slicer to make the filter hourglass plots"""
|
|
11
|
+
|
|
12
|
+
def __init__(self, verbose=True, badval=-666):
|
|
13
|
+
# Inherits from UniSlicer, so nslice=1 and only one 'slice'.
|
|
14
|
+
super(HourglassSlicer, self).__init__(verbose=verbose, badval=badval)
|
|
15
|
+
self.columns_needed = []
|
|
16
|
+
self.slicer_name = "HourglassSlicer"
|
|
17
|
+
self.plot_funcs = [
|
|
18
|
+
HourglassPlot,
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
def write_data(self, outfilename, metric_values, metric_name="", **kwargs):
|
|
22
|
+
"""
|
|
23
|
+
Override base write method: we don't want to save hourglass metric
|
|
24
|
+
data.
|
|
25
|
+
|
|
26
|
+
The data volume is too large.
|
|
27
|
+
"""
|
|
28
|
+
pass
|
|
29
|
+
|
|
30
|
+
def read_metric_data(self, infilename):
|
|
31
|
+
"""
|
|
32
|
+
Override base read method to 'pass':
|
|
33
|
+
we don't save or read hourglass metric data.
|
|
34
|
+
|
|
35
|
+
The data volume is too large.
|
|
36
|
+
"""
|
|
37
|
+
pass
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
__all__ = ("MoObjSlicer",)
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import pandas as pd
|
|
5
|
+
|
|
6
|
+
from rubin_sim.maf.plots.mo_plotters import MetricVsH, MetricVsOrbit
|
|
7
|
+
from rubin_sim.moving_objects.orbits import Orbits
|
|
8
|
+
|
|
9
|
+
from .base_slicer import BaseSlicer
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class MoObjSlicer(BaseSlicer):
|
|
13
|
+
"""Slice moving object _observations_, per object and optionally
|
|
14
|
+
clone/per H value.
|
|
15
|
+
|
|
16
|
+
Iteration over the MoObjSlicer will go as:
|
|
17
|
+
* iterate over each orbit;
|
|
18
|
+
* if Hrange is not None, for each orbit, iterate over Hrange.
|
|
19
|
+
|
|
20
|
+
Parameters
|
|
21
|
+
----------
|
|
22
|
+
h_range : numpy.ndarray or None
|
|
23
|
+
The H values to clone the orbital parameters over.
|
|
24
|
+
If Hrange is None, will not clone orbits.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
def __init__(self, h_range=None, verbose=True, badval=0):
|
|
28
|
+
super(MoObjSlicer, self).__init__(verbose=verbose, badval=badval)
|
|
29
|
+
self.Hrange = h_range
|
|
30
|
+
self.slicer_init = {"h_range": h_range, "badval": badval}
|
|
31
|
+
# Set default plot_funcs.
|
|
32
|
+
self.plot_funcs = [
|
|
33
|
+
MetricVsH(),
|
|
34
|
+
MetricVsOrbit(xaxis="q", yaxis="e"),
|
|
35
|
+
MetricVsOrbit(xaxis="q", yaxis="inc"),
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
def setup_slicer(self, orbit_file, delim=None, skiprows=None, obs_file=None):
|
|
39
|
+
"""Set up the slicer and read orbit_file and obs_file from disk.
|
|
40
|
+
|
|
41
|
+
Sets self.orbits (with orbit parameters), self.all_obs, and self.obs
|
|
42
|
+
self.orbit_file and self.obs_file
|
|
43
|
+
|
|
44
|
+
Parameters
|
|
45
|
+
----------
|
|
46
|
+
orbit_file : str
|
|
47
|
+
The file containing the orbit information.
|
|
48
|
+
This is necessary, in order to be able to generate plots.
|
|
49
|
+
obs_file : str, optional
|
|
50
|
+
The file containing the observations of each object, optional.
|
|
51
|
+
If not provided (default, None), then the slicer will not be
|
|
52
|
+
able to slice, but can still plot.
|
|
53
|
+
"""
|
|
54
|
+
self.read_orbits(orbit_file, delim=delim, skiprows=skiprows)
|
|
55
|
+
if obs_file is not None:
|
|
56
|
+
self.read_obs(obs_file)
|
|
57
|
+
else:
|
|
58
|
+
self.obs_file = None
|
|
59
|
+
self.all_obs = None
|
|
60
|
+
self.obs = None
|
|
61
|
+
# Add these filenames to the slicer init values,
|
|
62
|
+
# to preserve in output files.
|
|
63
|
+
self.slicer_init["orbit_file"] = self.orbit_file
|
|
64
|
+
self.slicer_init["obs_file"] = self.obs_file
|
|
65
|
+
|
|
66
|
+
def read_orbits(self, orbit_file, delim=None, skiprows=None):
|
|
67
|
+
# Use sims_movingObjects to read orbit files.
|
|
68
|
+
orb = Orbits()
|
|
69
|
+
orb.read_orbits(orbit_file, delim=delim, skiprows=skiprows)
|
|
70
|
+
self.orbit_file = orbit_file
|
|
71
|
+
self.orbits = orb.orbits
|
|
72
|
+
# Then go on as previously. Need to refactor this
|
|
73
|
+
# into 'setup_slicer' style.
|
|
74
|
+
self.nSso = len(self.orbits)
|
|
75
|
+
self.slice_points = {}
|
|
76
|
+
self.slice_points["orbits"] = self.orbits
|
|
77
|
+
# And set the slicer shape/size.
|
|
78
|
+
if self.Hrange is not None:
|
|
79
|
+
self.shape = [self.nSso, len(self.Hrange)]
|
|
80
|
+
self.slice_points["H"] = self.Hrange
|
|
81
|
+
else:
|
|
82
|
+
self.shape = [self.nSso, 1]
|
|
83
|
+
self.slice_points["H"] = self.orbits["H"]
|
|
84
|
+
# Set the rest of the slice_point information once
|
|
85
|
+
self.nslice = self.shape[0] * self.shape[1]
|
|
86
|
+
|
|
87
|
+
def read_obs(self, obs_file):
|
|
88
|
+
"""Read observations of the solar system objects
|
|
89
|
+
(such as created by sims_movingObjects).
|
|
90
|
+
|
|
91
|
+
Parameters
|
|
92
|
+
----------
|
|
93
|
+
obs_file: str
|
|
94
|
+
The file containing the observation information.
|
|
95
|
+
"""
|
|
96
|
+
# For now, just read all the observations
|
|
97
|
+
# (should be able to chunk this though).
|
|
98
|
+
restore_file = np.load(obs_file)
|
|
99
|
+
self.all_obs = restore_file["object_observations"].copy()
|
|
100
|
+
restore_file.close()
|
|
101
|
+
self.obs_file = obs_file
|
|
102
|
+
self.all_obs = pd.DataFrame(self.all_obs)
|
|
103
|
+
|
|
104
|
+
if "velocity" not in self.all_obs.columns:
|
|
105
|
+
self.all_obs["velocity"] = np.sqrt(self.all_obs["dradt"] ** 2 + self.all_obs["ddecdt"] ** 2)
|
|
106
|
+
|
|
107
|
+
def subset_obs(self, pandas_constraint=None):
|
|
108
|
+
"""Choose a subset of all the observations,
|
|
109
|
+
such as those in a particular time period.
|
|
110
|
+
"""
|
|
111
|
+
if pandas_constraint is None:
|
|
112
|
+
self.obs = self.all_obs
|
|
113
|
+
else:
|
|
114
|
+
self.obs = self.all_obs.query(pandas_constraint)
|
|
115
|
+
|
|
116
|
+
def _slice_obs(self, idx):
|
|
117
|
+
"""Return the observations of a given ssoId.
|
|
118
|
+
|
|
119
|
+
For now this works for any ssoId; in the future,
|
|
120
|
+
this might only work as ssoId is
|
|
121
|
+
progressively iterated through the series of ssoIds
|
|
122
|
+
(so we can chunk the reading).
|
|
123
|
+
|
|
124
|
+
Parameters
|
|
125
|
+
----------
|
|
126
|
+
idx : integer
|
|
127
|
+
The integer index of the particular SSO in the orbits dataframe.
|
|
128
|
+
"""
|
|
129
|
+
# Find the matching orbit.
|
|
130
|
+
orb = self.orbits.iloc[idx]
|
|
131
|
+
# Find the matching observations.
|
|
132
|
+
if self.obs["obj_id"].dtype == "object":
|
|
133
|
+
obs = self.obs.query('obj_id == "%s"' % (orb["obj_id"]))
|
|
134
|
+
else:
|
|
135
|
+
obs = self.obs.query("obj_id == %d" % (orb["obj_id"]))
|
|
136
|
+
# Return the values for H to consider for metric.
|
|
137
|
+
if self.Hrange is not None:
|
|
138
|
+
Hvals = self.Hrange
|
|
139
|
+
else:
|
|
140
|
+
Hvals = np.array([orb["H"]], float)
|
|
141
|
+
# Note that ssoObs / obs is a recarray not Dataframe!
|
|
142
|
+
# But that the orbit IS a Dataframe.
|
|
143
|
+
return {"obs": obs.to_records(), "orbit": orb, "Hvals": Hvals}
|
|
144
|
+
|
|
145
|
+
def __iter__(self):
|
|
146
|
+
"""Iterate through each of the ssoIds."""
|
|
147
|
+
self.idx = 0
|
|
148
|
+
return self
|
|
149
|
+
|
|
150
|
+
def __next__(self):
|
|
151
|
+
"""Returns result of self._getObs when iterating over moSlicer."""
|
|
152
|
+
if self.idx >= self.nSso:
|
|
153
|
+
raise StopIteration
|
|
154
|
+
idx = self.idx
|
|
155
|
+
self.idx += 1
|
|
156
|
+
return self._slice_obs(idx)
|
|
157
|
+
|
|
158
|
+
def __getitem__(self, idx):
|
|
159
|
+
# This may not be guaranteed to work if/when we
|
|
160
|
+
# implement chunking of the obs_file.
|
|
161
|
+
return self._slice_obs(idx)
|
|
162
|
+
|
|
163
|
+
def __eq__(self, other_slicer):
|
|
164
|
+
"""Evaluate if two slicers are equal."""
|
|
165
|
+
result = False
|
|
166
|
+
if isinstance(other_slicer, MoObjSlicer):
|
|
167
|
+
if other_slicer.orbit_file == self.orbit_file:
|
|
168
|
+
if other_slicer.obs_file == self.obs_file:
|
|
169
|
+
if np.array_equal(other_slicer.slice_points["H"], self.slice_points["H"]):
|
|
170
|
+
result = True
|
|
171
|
+
return result
|