-
-
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
v_inner_solver store plasma state fxn #2981
base: master
Are you sure you want to change the base?
Conversation
*beep* *bop* 40 W291 [*] Trailing whitespace
15 W293 [*] Blank line contains whitespace
9 E999 [ ] SyntaxError: Expected a statement
5 I001 [*] Import block is un-sorted or un-formatted
3 G004 [ ] Logging statement uses f-string
1 TD005 [ ] Missing issue description after `TODO`
1 W292 [*] No newline at end of file
1 D202 [*] No blank lines allowed after function docstring (found 1)
1 D210 [*] No whitespaces allowed surrounding docstring text
1 F401 [*] `tardis.visualization.shell_info_from_hdf` imported but unused
Complete output(might be large): .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
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/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/workflows/v_inner_solver.py:16:3: TD005 Missing issue description after `TODO`
tardis/workflows/v_inner_solver.py:56:9: D210 [*] No whitespaces allowed surrounding docstring text
tardis/workflows/v_inner_solver.py:56:45: W291 Trailing whitespace
tardis/workflows/v_inner_solver.py:57:53: W291 Trailing whitespace
tardis/workflows/v_inner_solver.py:84:1: W293 [*] Blank line contains whitespace
tardis/workflows/v_inner_solver.py:88:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/workflows/v_inner_solver.py:103:1: W293 [*] Blank line contains whitespace
tardis/workflows/v_inner_solver.py:220:17: G004 Logging statement uses f-string
tardis/workflows/v_inner_solver.py:247:17: G004 Logging statement uses f-string
tardis/workflows/v_inner_solver.py:355:17: G004 Logging statement uses f-string
tardis/workflows/v_inner_solver.py:415:1: W293 [*] Blank line contains whitespace
Found 77 errors.
[*] 62 fixable with the `--fix` option (2 hidden fixes can be enabled with the `--unsafe-fixes` option).
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2981 +/- ##
==========================================
- Coverage 69.54% 69.10% -0.44%
==========================================
Files 228 228
Lines 16429 16444 +15
==========================================
- Hits 11425 11364 -61
- Misses 5004 5080 +76 ☔ View full report in Codecov by Sentry. |
*beep* *bop* Significantly changed benchmarks: All benchmarks: Benchmarks that have stayed the same:
| Change | Before [cec8b531] <master> | After [a6aa288f] | Ratio | Benchmark (Parameter) |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
| | 37.7±0.08μs | 48.9±0.7μs | ~1.30 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list |
| | 1.37±0.4μs | 1.76±0.3μs | ~1.29 | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line |
| | 43.4±30μs | 55.4±30μs | ~1.28 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter |
| | 3.15±0.5μs | 3.59±0.5μs | ~1.14 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket |
| | 652±200ns | 722±100ns | ~1.11 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation |
| | 591±200ns | 531±100ns | ~0.90 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation |
| | 3.28±0.02ms | 2.94±0.04ms | ~0.90 | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter') |
| | 2.24±1μs | 1.98±1μs | ~0.88 | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators |
| | 561±200ns | 591±100ns | 1.05 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation |
| | 7.00±0.8μs | 7.27±1μs | 1.04 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket |
| | 7.45±2μs | 7.72±1μs | 1.04 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley |
| | 45.8±20μs | 46.7±20μs | 1.02 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission |
| | 1.74±0.02ms | 1.75±0.02ms | 1.01 | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop |
| | 3.91±0.04ms | 3.91±0.02ms | 1.00 | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom') |
| | 39.1±0.03s | 39.1±0.01s | 1.00 | run_tardis.BenchmarkRunTardis.time_run_tardis |
| | 1.07±0m | 1.07±0m | 1.00 | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking |
| | 2.08±0m | 2.09±0m | 1.00 | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions |
| | 205±0.1ns | 205±0.1ns | 1.00 | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body |
| | 1.20±0μs | 1.21±0μs | 1.00 | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary |
| | 743±1ns | 740±0.4ns | 1.00 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter |
| | 2.76±0.5ms | 2.75±0.5ms | 1.00 | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop |
| | 27.9±8μs | 27.4±8μs | 0.98 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
| | 67.1±0.1ms | 65.7±0.2ms | 0.98 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe |
| | 4.30±0.5μs | 4.06±0.7μs | 0.94 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell |
If you want to see the graph of the results, you can check it here |
@@ -38,13 +38,52 @@ def __init__(self, configuration, mean_optical_depth="rosseland", tau=None): | |||
if tau is not None: | |||
self.TAU_TARGET = np.log(tau) | |||
|
|||
self.iterations_w = np.full((self.total_iterations, self.simulation_state.no_of_shells), np.nan) |
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.
Look at
tardis/tardis/simulation/base.py
Line 80 in cec8b53
def reshape_plasma_state_store(self, executed_iterations): |
If this converges before max iterations, then all of these attributes will just be left with their default values, lots of nans. When it converges, probably you want to chop off these arrays after that point.
|
||
self.iterations_v_inner_boundary[i] = v_inner_boundary | ||
|
||
self.iterations_mean_optical_depth[i,-len(tau_integ):] = tau_integ |
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.
inconsistent spacing. Are you using ruff?
tau_integ : np.ndarray | ||
Rosseland mean optical depth | ||
""" | ||
self.iterations_t_rad[i, -len(t_radiative):] = t_radiative |
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.
Shouldn't all of these lengths be the same things? (i.e., the number of shells for this run)
Maybe better to just define a variable called num_of_active_shells or something and just use it for all of them.
📝 Description
Type: 🚀
feature
Based on the function in the PlasmaStateStorerMixin class, I added a store_plasma_state method to the v_inner_solver workflow, with the additional features of the computed optical depth at each iteration and the v_inner_boundary value at each iteration.
For this, I initialized these new lists in init, updated tau_integ to be a self variable, and then called the new function at the beginning and end of run().
This allows you to then extract the plasma state at each iteration and plot them and their convergence.
🚦 Testing
How did you test these changes?
☑️ Checklist
build_docs
label