-
Notifications
You must be signed in to change notification settings - Fork 3
Fix model data writer and avoid overwrite of general output path #2000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where ModelDataWriter was changing the global output path for all modules by modifying the IOHandler singleton's output_path. The fix introduces a label-based dictionary approach in IOHandler to manage multiple output paths independently, and simplifies the ModelDataWriter API.
Changes:
- Modified IOHandler to use a dictionary for output_path with label-based access instead of a single path
- Simplified ModelDataWriter API by removing args_dict parameter and renaming product_data_file/product_data_format to output_file/output_file_format
- Updated all callers to pass individual parameters (output_file, output_file_format) instead of args_dict
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/simtools/io/io_handler.py | Changed output_path from single value to dictionary with label-based access; added output_path_label parameter to set_paths, get_output_directory, and get_output_file methods |
| src/simtools/data_model/model_data_writer.py | Simplified init signature; renamed product_data_* to output_file_*; removed args_dict parameter from dump(); added settings.config usage; enhanced _astropy_data_format to derive format from file suffix |
| tests/unit_tests/io/test_io_handler.py | Updated test to access output_path as dictionary |
| tests/unit_tests/data_model/test_model_data_writer.py | Updated tests for renamed attributes; added settings.config.load() calls; added tests for _astropy_data_format with None; removed one test case for explicit output_file |
| tests/unit_tests/configuration/test_configurator.py | Updated test to access output_path as dictionary |
| src/simtools/ray_tracing/mirror_panel_psf.py | Updated dump() call to pass individual parameters instead of args_dict |
| src/simtools/ray_tracing/incident_angles.py | Simplified ModelDataWriter instantiation to only pass output_file |
| src/simtools/camera/single_photon_electron_spectrum.py | Updated dump() call to pass individual parameters |
| src/simtools/applications/submit_data_from_external.py | Updated dump() call to pass individual parameters |
| src/simtools/applications/generate_regular_arrays.py | Updated ModelDataWriter instantiation with renamed parameters |
| src/simtools/applications/db_get_array_layouts_from_db.py | Updated dump() call to pass individual parameters |
| src/simtools/applications/convert_geo_coordinates_of_array_elements.py | Updated dump() call to pass individual parameters with default for format |
| docs/changes/2000.maintenance.md | Added changelog entry |
|




Closes #1997
ModelDataWriter changes the general output path (the one retrieved with
IoHandler::get_output_directory). This should not happen.Fix this with this PR:
Remove also temporary statement mentioned here.