-
-
Notifications
You must be signed in to change notification settings - Fork 426
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/gamma rays code1 #2976
base: master
Are you sure you want to change the base?
Restructure/gamma rays code1 #2976
Conversation
- Remove raw_isotope_abundance from Composition class - Update mass fraction parsing to conditionally apply isotope decay - Modify default model_isotope_time_0 to -1 s to allow skipping decay - Update test fixtures to explicitly set model_isotope_time_0 - Simplify mass fraction parsing functions by removing redundant returns
- Implement `get_radioactive_isotopes()` in energy_source.py to track decay chains - Add `get_decay_radiation_data()` in gamma_ray_transport.py to process radiation data - Enhance `IsotopicMassFraction` in decay.py with `calculate_decayed_mass_fractions()` and `calculate_number_of_decays()` - Refactor decay-related methods to improve clarity and functionality
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
*beep* *bop* 38 W291 [*] Trailing whitespace
15 E999 [ ] SyntaxError: Expected a statement
15 W293 [*] Blank line contains whitespace
7 I001 [*] Import block is un-sorted or un-formatted
6 E902 [ ] stream did not contain valid UTF-8
4 G004 [ ] Logging statement uses f-string
4 RET505 [ ] Unnecessary `elif` after `return` statement
4 F401 [*] `radioactivedecay.converters` imported but unused
2 W292 [*] No newline at end of file
1 B020 [ ] Loop control variable `isotope_dict` overrides iterable it iterates
1 C416 [*] Unnecessary `list` comprehension (rewrite using `list()`)
1 FA100 [ ] Add `from __future__ import annotations` to simplify `typing.Tuple`
1 G001 [ ] Logging statement uses `str.format`
1 PTH117 [ ] `os.path.isabs()` should be replaced by `Path.is_absolute()`
1 NPY201 [ ] `np.recfromtxt` will be removed in NumPy 2.0. Use `np.genfromtxt` instead.
1 PERF102 [*] When using only the values of a dict use the `values()` method
1 E722 [ ] Do not use bare `except`
1 D202 [*] No blank lines allowed after function docstring (found 1)
Complete output(might be large): .github/actions/setup_lfs/action.yml:5:8: E999 SyntaxError: Expected an expression
.github/actions/setup_lfs/action.yml:37:1: W293 [*] Blank line contains whitespace
.github/workflows/benchmarks.yml:3:4: E999 SyntaxError: Expected an expression
.github/workflows/benchmarks.yml:20:5: W291 [*] Trailing whitespace
.github/workflows/benchmarks.yml:91:49: W291 [*] Trailing whitespace
.github/workflows/benchmarks.yml:121:81: W291 [*] Trailing whitespace
.github/workflows/benchmarks.yml:122:54: W291 [*] Trailing whitespace
.github/workflows/benchmarks.yml:209:1: W293 [*] Blank line contains whitespace
.github/workflows/benchmarks.yml:228:22: W291 [*] Trailing whitespace
.github/workflows/benchmarks.yml:229:170: W291 [*] Trailing whitespace
.github/workflows/benchmarks.yml:231:84: W291 [*] Trailing whitespace
.github/workflows/benchmarks.yml:248:1: W293 [*] Blank line contains whitespace
.github/workflows/build-docs.yml:7:4: E999 SyntaxError: Expected an expression
.github/workflows/lfs-cache.yml:1:12: E999 SyntaxError: Simple statements must be separated by newlines or semicolons
.github/workflows/lfs-cache.yml:38:1: W293 [*] Blank line contains whitespace
.github/workflows/lfs-cache.yml:50:1: W293 [*] Blank line contains whitespace
.github/workflows/lfs-cache.yml:58:1: W293 [*] Blank line contains whitespace
.github/workflows/lfs-cache.yml:63:1: W293 [*] Blank line contains whitespace
.github/workflows/lfs-cache.yml:68:1: W293 [*] Blank line contains whitespace
.github/workflows/lfs-cache.yml:78:1: W293 [*] Blank line contains whitespace
.github/workflows/tests.yml:7:4: E999 SyntaxError: Expected an expression
conda-linux-64.lock:5:1: E999 SyntaxError: Expected class, function definition or async function definition after decorator
conda-lock.yml:14:10: E999 SyntaxError: Expected an expression
conda-osx-arm64.lock:5:1: E999 SyntaxError: Expected class, function definition or async function definition after decorator
docs/how_to_guides.rst:1:8: E999 SyntaxError: Simple statements must be separated by newlines or semicolons
docs/how_to_guides.rst:18:43: W292 [*] No newline at end of file
docs/index.rst:1:1: E999 SyntaxError: Expected a statement
docs/index.rst:21:51: W291 [*] Trailing whitespace
docs/index.rst:43:76: W291 [*] Trailing whitespace
docs/index.rst:44:64: W291 [*] Trailing whitespace
docs/index.rst:45:71: W291 [*] Trailing whitespace
docs/index.rst:46:69: W291 [*] Trailing whitespace
docs/index.rst:47:68: W291 [*] Trailing whitespace
docs/index.rst:66:1: W293 [*] Blank line contains whitespace
docs/index.rst:79:1: W293 [*] Blank line contains whitespace
docs/index.rst:103:1: W293 [*] Blank line contains whitespace
docs/io/images/custom_abundance_widget.png:1:1: E902 stream did not contain valid UTF-8
docs/io/images/energy_level_widget_options.gif:1:1: E902 stream did not contain valid UTF-8
docs/io/images/line_info_widget_demo.gif:1:1: E902 stream did not contain valid UTF-8
docs/io/images/packet_diagram.jpg:1:1: E902 stream did not contain valid UTF-8
docs/io/images/sdec_ply_interaction.gif:1:1: E902 stream did not contain valid UTF-8
docs/io/images/shell_info_widget_demo.gif:1:1: E902 stream did not contain valid UTF-8
docs/io/visualization/demo_observed_spectrum.dat:1:26: E999 SyntaxError: Simple statements must be separated by newlines or semicolons
docs/io/visualization/how_to_generating_widgets.ipynb:cell 5:1:1: I001 [*] Import block is un-sorted or un-formatted
docs/io/visualization/how_to_generating_widgets.ipynb:cell 5:3:5: F401 [*] `tardis.visualization.shell_info_from_hdf` imported but unused
docs/io/visualization/how_to_sdec_plot.ipynb:cell 2:2:1: I001 [*] Import block is un-sorted or un-formatted
docs/io/visualization/how_to_sdec_plot.ipynb:cell 29:1:1: I001 [*] Import block is un-sorted or un-formatted
docs/io/visualization/index.rst:1:1: E999 SyntaxError: Expected a statement
docs/io/visualization/index.rst:33:68: W292 [*] No newline at end of file
docs/io/visualization/tardis_example.yml:2:26: E999 SyntaxError: Simple statements must be separated by newlines or semicolons
docs/io/visualization/tutorial_convergence_plot.ipynb:cell 9:4:28: W291 [*] Trailing whitespace
docs/io/visualization/tutorial_convergence_plot.ipynb:cell 12:29:1: W293 [*] Blank line contains whitespace
docs/io/visualization/tutorial_convergence_plot.ipynb:cell 13:1:1: I001 [*] Import block is un-sorted or un-formatted
docs/io/visualization/tutorial_montecarlo_packet_visualization.ipynb:cell 5:1:1: I001 [*] Import block is un-sorted or un-formatted
docs/io/visualization/using_widgets.rst:1:1: E999 SyntaxError: Expected an expression
docs/io/visualization/using_widgets.rst:7:83: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:15:69: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:23:76: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:24:41: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:26:77: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:29:79: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:39:75: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:40:80: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:41:78: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:42:75: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:43:75: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:51:77: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:52:79: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:53:73: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:54:71: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:62:74: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:63:76: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:71:80: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:72:79: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:80:78: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:81:77: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:82:77: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:109:48: W291 [*] Trailing whitespace
docs/io/visualization/using_widgets.rst:161:77: W291 [*] Trailing whitespace
tardis/energy_input/energy_source.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/energy_input/energy_source.py:113:16: C416 Unnecessary `list` comprehension (rewrite using `list()`)
tardis/energy_input/energy_source.py:256:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/energy_input/gamma_ray_packet_source.py:14:5: F401 [*] `tardis.energy_input.util.get_index` imported but unused
tardis/energy_input/gamma_ray_transport.py:457:39: PERF102 When using only the values of a dict use the `values()` method
tardis/energy_input/tests/test_gamma_ray_channel.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/energy_input/tests/test_gamma_ray_channel.py:8:30: F401 [*] `radioactivedecay.converters` imported but unused
tardis/energy_input/tests/test_gamma_ray_channel.py:13:5: F401 [*] `tardis.energy_input.energy_source.get_nuclear_lines_database` imported but unused
tardis/energy_input/tests/test_gamma_ray_channel.py:118:9: B020 Loop control variable `isotope_dict` overrides iterable it iterates
tardis/io/atom_data/base.py:197:34: G004 Logging statement uses f-string
tardis/io/atom_data/base.py:259:17: G004 Logging statement uses f-string
tardis/io/atom_data/base.py:263:21: G001 Logging statement uses `str.format`
tardis/io/atom_data/base.py:702:17: G004 Logging statement uses f-string
tardis/io/configuration/schemas/model_definitions.yml:2:13: E999 SyntaxError: Expected an expression
tardis/io/configuration/schemas/model_definitions.yml:164:1: W293 [*] Blank line contains whitespace
tardis/io/configuration/schemas/model_definitions.yml:210:1: W293 [*] Blank line contains whitespace
tardis/io/model/parse_mass_fraction_configuration.py:62:12: PTH117 `os.path.isabs()` should be replaced by `Path.is_absolute()`
tardis/io/model/readers/generic_readers.py:20:6: FA100 Add `from __future__ import annotations` to simplify `typing.Tuple`
tardis/io/model/readers/generic_readers.py:47:12: NPY201 `np.recfromtxt` will be removed in NumPy 2.0. Use `np.genfromtxt` instead.
tardis/model/matter/composition.py:204:9: RET505 Unnecessary `else` after `return` statement
tardis/model/matter/decay.py:101:21: G004 Logging statement uses f-string
tardis/transport/montecarlo/packet_source.py:246:9: RET505 Unnecessary `else` after `return` statement
tardis/util/base.py:337:5: RET505 Unnecessary `else` after `return` statement
tardis/util/base.py:511:5: E722 Do not use bare `except`
tardis/util/base.py:619:5: RET505 Unnecessary `elif` after `return` statement
Found 104 errors.
[*] 67 fixable with the `--fix` option (2 hidden fixes can be enabled with the `--unsafe-fixes` option).
|
*beep* *bop* Hi, human. The Click here to see the build log. |
@@ -0,0 +1,18 @@ | |||
How-To Guides |
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.
Is this a rebasing issue? Doesn't seem like part of the PR
@@ -0,0 +1,601 @@ | |||
{ |
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.
Line #6. decayed_mass_fractions = model.composition.isotopic_mass_fraction.calculate_decayed_mass_fractions(time_interval.to(u.s).value)
The issue might be double converting day to seconds here? The alculate_decayed_mass_fractions
function takes in time_decay assuming units of days.
Reply via ReviewNB
*beep* *bop* Significantly changed benchmarks: All benchmarks: Benchmarks that have stayed the same:
| Change | Before [b53686a4] <master> | After [41e02b01] | Ratio | Benchmark (Parameter) |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
| | 21.7±5μs | 28.8±8μs | ~1.33 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
| | 44.5±30μs | 54.6±30μs | ~1.23 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter |
| | 3.75±0ms | 4.30±0.04ms | ~1.15 | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom') |
| | 41.6±20μs | 46.6±20μs | ~1.12 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission |
| | 561±100ns | 500±100ns | ~0.89 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation |
| | 1.76±0.3μs | 1.57±0.3μs | ~0.89 | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line |
| | 601±100ns | 501±100ns | ~0.83 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation |
| | 9.42±2μs | 7.57±2μs | ~0.80 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley |
| | 4.29±0.5μs | 3.28±0.6μs | ~0.76 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell |
| | 1.91±1μs | 2.06±2μs | 1.08 | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators |
| | 582±200ns | 611±200ns | 1.05 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation |
| | 2.62±0ms | 2.67±0.03ms | 1.02 | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter') |
| | 206±0.3ns | 211±0.3ns | 1.02 | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body |
| | 38.5±0.02s | 38.7±0.06s | 1.00 | run_tardis.BenchmarkRunTardis.time_run_tardis |
| | 1.05±0m | 1.05±0m | 1.00 | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking |
| | 2.08±0m | 2.08±0m | 1.00 | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions |
| | 1.74±0ms | 1.74±0.02ms | 1.00 | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop |
| | 3.01±0.5μs | 2.98±0.2μs | 0.99 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket |
| | 740±1ns | 726±1ns | 0.98 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter |
| | 38.1±0μs | 36.9±0.01μs | 0.97 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list |
| | 2.96±0.5ms | 2.86±0.5ms | 0.96 | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop |
| | 6.43±0.9μs | 6.18±1μs | 0.96 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket |
| | 67.0±0.02ms | 63.9±0.3ms | 0.95 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe |
| | 1.29±0μs | 1.20±0μs | 0.93 | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary |
If you want to see the graph of the results, you can check it here |
- Update docstring for `create_inventories_dict_old()` in gamma_ray_transport.py - Increment notebook execution count in decay_radiation.ipynb e
…ys and beta particles
…ay radiation data extraction function
There is already an existing PR #2793 |
📝 Description
Type: 🪲
bugfix
| 🚀feature
| ☣️breaking change
| 🚦testing
| 📝documentation
| 🎢infrastructure
Write a complete description of your changes, including the necessary context or any piece of information required to understand your work.
Also, link issues affected by this pull request by using the keywords:
close
,closes
,closed
,fix
,fixes
,fixed
,resolve
,resolves
orresolved
.📌 Resources
Examples, notebooks, and links to useful references.
🚦 Testing
How did you test these changes?
☑️ Checklist
build_docs
label