Ensure reproducibility of tests/resources directory#2211
Draft
GernotMaier wants to merge 49 commits into
Draft
Conversation
Remove 11 files from tests/resources that are not referenced
in any unit or integration test (confirmed by grep across all
.py, .yml, .yaml, .json files excluding __pycache__):
- CTA-North-LSTN-01-Released_test-telescope-model.cfg
- derive_mirror_rnda_psf_{mean,measurement,no_tuning,random_flen}.ecsv
- flasher_full_simulation_lst_north/{simulate_*.yml,*.simtel.log}
- gamma_run000007_za40deg.../{corsika_config_*.input,simulate_prod_*.yml}
- log_sub_corsika_run000001_gamma_North_test_layout_test-production.out
- production_grid_generation_axes_definition_ra_dec.yml
Addresses #1600
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove redundant FileNotFoundError from except clause (S5713): FileNotFoundError is a subclass of OSError, making it redundant - Reduce cognitive complexity of _copy_collection_files (S3776): Extract _collect_source_directories and _find_collection_file helpers to bring complexity from 18 down to within the allowed 15 - Update camera efficiency reference file for MSTx-FlashCam South: nsb field now reflects Benn_LaPalma_sky_converted.lis spectrum used in the integration test configuration Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add workflow configs to fetch the following test resource files from the simulation model database instead of storing them in the repository: - pm_photoelectron_spectrum.config.yml: spe_LST_2022-04-27_AP2.0e-4.dat (pm_photoelectron_spectrum v2.0.0, LSTN-design) - mirror_list.config.yml: mirror_list-2.0.0.json (mirror_list v2.0.0, LSTN-01, JSON metadata) - mirror_list_simtel_dat.config.yml: mirror_list_CTA-N-LST1_v2019-03-31_rotated_simtel.dat (mirror_list v2.0.0, LSTN-01, physical file) - array_element_position_ground.config.yml: array_element_position_ground-2.0.0.json (array_element_position_ground v2.0.0, MSTN-09) - array_element_position_utm.config.yml: array_element_position_utm-2.0.0.json (array_element_position_utm v2.0.0, MSTN-09) Part of issue #1600. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace derive_mirror_rnda_psf_random_flen.ecsv (deleted in previous commit) with the existing ray_tracing_North_LSTN-01_d10.0km_za20.0deg_validate_optics.ecsv in the developer testing guide example. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Move mirror .dat resource to tests/resources/model_parameters/ using canonical DB filename (mirror_CTA-N-LST1_v2019-03-31_rotated.dat) - Merge mirror_list_simtel_dat.config.yml into mirror_list.config.yml (both files now share the same collection output_path) - Update test_mirrors.py fixture to use the new path Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove unreferenced test resource files
…lotting routines)
- Mock HTTP requests globally (urlretrieve) to serve local repo files - Cache pyproj Transformer construction with lru_cache (layout/telescope_position.py) - Write stub PNG bytes instead of real matplotlib renders for file saves - Patch Figure.tight_layout to no-op (eliminates text-extent rendering) - Patch Figure.colorbar to MagicMock (eliminates quad-mesh rendering) - Add session-scoped ERFA warm-up fixture to pre-initialise astropy coordinate transforms before any test measures them Typical improvements on slow test hardware (original -> new): test_plot_writes_per_type_comparison_figures: 1.96s -> ~0.25s test_plot_incident_angles_debug_plots_true: 1.73s -> ~0.25s test_generate_simulation_grid (ERFA): 1.12s -> ~0.30s test_build_layout (pyproj): 1.56s -> ~0.10s test_read_table_from_file_and_validate: 1.24s -> ~0.25s Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




work in progress
Ensure reproducibility of files used in tests:
Resource file generation
Add a
resources_generationwith all necessary config file to generate or retrieve tests files. All config files can be executed using thesimtools-run-applicationfunctionality:tests/resources_generation/model_parameters)tests/resources_generation/application_configAddresses #1600