-
-
Notifications
You must be signed in to change notification settings - Fork 453
Restructure/io/snec_cleanup #3358
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
Restructure/io/snec_cleanup #3358
Conversation
Reorganizes ARTIS-related code by moving it from a single reader file into a dedicated module with separate data and reader components. Extracts the ArtisModelData class into a standalone data module and renames it to ArtisData for consistency. Improves code organization and maintainability by separating data structures from reading functionality.
Moves ARTIS-related functionality into a dedicated module structure and updates import paths accordingly. Reorganizes imports in the ARTIS data module for better readability and fixes docstring reference to use correct class name. Adds missing newline at end of file to follow Python conventions.
… signatures, and restructuring test fixtures for clarity and maintainability.
Consolidates scattered how-to documentation from multiple locations into a unified structure under docs/how_to/. Moves guides from docs/io/ subdirectories and docs/how-to/ into organized categories including read_external_models, output, grid, custom_source, and code_comparison. Removes automatic generation of how-to guides page in favor of manual organization with proper table of contents structure. Updates import paths in notebooks to reflect new module organization and fixes circular import issue in artis readers.
Removes example configuration and cleans notebook outputs Deletes unused TARDIS configuration file from plasma comparison documentation and clears executed cell outputs in ARTIS model reading notebook for cleaner repository state
Reorganizes the SNEC module structure by moving it from the readers subdirectory to the model directory. This refactoring improves the module organization by placing SNEC functionality at the appropriate hierarchical level within the codebase architecture.
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
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 reorganizes the SNEC module from tardis/io/model/readers/snec/ to tardis/io/model/snec/ to improve the module hierarchy. The changes also include restructuring the ARTIS module similarly and updating documentation paths.
Key changes:
- SNEC module moved from readers subdirectory to model directory
- ARTIS module reorganized with separate
readers.pyanddata.pyfiles - Documentation reorganized with new "How-To Guides" structure
- Test fixtures centralized in
tardis/io/model/conftest.py
Reviewed changes
Copilot reviewed 19 out of 56 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
tardis/io/model/snec/*.py |
New SNEC module files with functionality for reading SNEC input/output data |
tardis/io/model/snec/tests/*.py |
Test files for SNEC module with incorrect import paths |
tardis/io/model/artis/*.py |
Refactored ARTIS module with separated concerns |
tardis/io/model/conftest.py |
Centralized test fixtures |
tardis/io/atom_data/parse_atom_data.py |
New atom data parsing utility |
docs/**/*.ipynb |
Reorganized documentation files |
Comments suppressed due to low confidence (1)
tardis/io/model/artis/tests/test_artis_readers.py:11
- Import of 'Path' is not used.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
*beep* *bop* Details334 [ ] syntax-error
3 W292 [ ] missing-newline-at-end-of-file
3 F401 [ ] unused-import
3 INP001 [ ] implicit-namespace-package
1 E902 [ ] io-error
1 W293 [*] blank-line-with-whitespace
1 I001 [*] unsorted-imports
1 TC002 [ ] typing-only-third-party-import
Found 347 errors.
[*] 3 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option).
Complete output(might be large): Detailstardis/io/model/readers/snec/__init__.py:1:1: E902 No such file or directory (os error 2)
tardis/io/model/snec/__init__.py:1:45: F401 `tardis.io.model.snec.snec_input.read_snec_isotope_profile` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/io/model/snec/__init__.py:2:46: F401 `tardis.io.model.snec.snec_output.read_snec_output` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/io/model/snec/snec_output.py:9:18: TC002 Move third-party import `xarray` into a type-checking block
tardis/io/model/snec/tests/test_input_profiles.py:1:1: INP001 File `tardis/io/model/snec/tests/test_input_profiles.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/model/snec/tests/test_read_snec_output.py:1:1: INP001 File `tardis/io/model/snec/tests/test_read_snec_output.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/model/snec/tests/test_xg_files.py:1:1: INP001 File `tardis/io/model/snec/tests/test_xg_files.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/model/snec/tests/test_xg_files.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/io/model/snec/tests/test_xg_files.py:4:21: F401 [*] `pathlib.Path` imported but unused
tardis/io/model/snec/tests/test_xg_files.py:20:1: W293 [*] Blank line contains whitespace
Found 10 errors.
[*] 3 fixable with the `--fix` option (1 hidden fix can be enabled with the `--unsafe-fixes` option).
|
|
*beep* *bop* Hi, human. The Click here to see your results. |
Moves ARTIS-specific test configuration files to the appropriate module directory structure to improve organization and maintainability. Creates a dedicated fixture for accessing ARTIS test data directory, replacing hardcoded paths in test classes. Adds missing import formatting for better code style consistency.
Moves import statement to avoid circular dependency between base reader and ARTIS module. Updates type annotation to use direct class reference instead of string literal for better type checking.
Moves parse_atom_data import from model module to dedicated atom_data module and removes unused legacy macro atom imports. Improves code organization by consolidating atom data parsing functionality under a more appropriate module structure.
|
*beep* *bop* Significantly changed benchmarks: DetailsAll benchmarks: DetailsBenchmarks that have stayed the same:
| Change | Before [f7012aa8] <master> | After [bd1c4460] | Ratio | Benchmark (Parameter) |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
| | 8.10±1μs | 6.92±0.6μs | ~0.86 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley |
| | 3.26±1μs | 2.60±1μs | ~0.80 | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators |
| | 45.0±10μs | 26.3±7μs | ~0.58 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
| | 703±0.4ns | 772±2ns | 1.10 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter |
| | 1.96±0.4μs | 2.10±0.2μs | 1.07 | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line |
| | 1.64±0μs | 1.72±0μs | 1.05 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell |
| | 1.23±0.01μs | 1.27±0.01μs | 1.04 | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary |
| | 3.98±0.01ms | 4.08±0.1ms | 1.03 | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom') |
| | 1.54±0μs | 1.58±0μs | 1.03 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket |
| | 3.45±0μs | 3.49±0μs | 1.01 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket |
| | 521±200ns | 521±100ns | 1.00 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation |
| | 2.95±0.05ms | 2.95±0.02ms | 1.00 | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter') |
| | 39.2±0.04s | 39.1±0.03s | 1.00 | run_tardis.BenchmarkRunTardis.time_run_tardis |
| | 2.67±1ms | 2.66±0.8ms | 1.00 | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop |
| | 37.3±0.2μs | 36.9±0.04μs | 0.99 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list |
| | 551±200ns | 541±200ns | 0.98 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation |
| | 1.14±0m | 1.12±0m | 0.98 | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking |
| | 59.9±0.1s | 58.9±0.02s | 0.98 | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions |
| | 54.5±30μs | 53.5±30μs | 0.98 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission |
| | 1.11±0.02μs | 1.07±0μs | 0.96 | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body |
| | 1.84±0.08ms | 1.75±0.05ms | 0.95 | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop |
| | 48.9±20μs | 46.1±30μs | 0.94 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter |
| | 70.7±0.1ms | 65.8±0.5ms | 0.93 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe |
| | 501±200ns | 461±200ns | 0.92 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation |
If you want to see the graph of the results, you can check it here |
Updates import statements to reflect the correct module structure by removing the intermediate "readers" directory from the path hierarchy. Ensures all SNEC-related imports point to the proper location within the model package structure.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3358 +/- ##
==========================================
- Coverage 68.46% 68.21% -0.25%
==========================================
Files 179 179
Lines 13623 13623
==========================================
- Hits 9327 9293 -34
- Misses 4296 4330 +34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Based on previous IO PRs
Reorganizes the SNEC module structure by moving it from the readers subdirectory to the model directory. This refactoring improves the module organization by placing SNEC functionality at the appropriate hierarchical level within the codebase architecture.