Skip to content
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

(TODO) disentangle if statements for readability #2939

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

karthik11135
Copy link

📝 Description

Helium treatment is refactored by separating into different reusable components. Fixes a TODO

@tardis-bot
Copy link
Contributor

*beep* *bop*
Hi human,
I ran ruff on the latest commit (f6ab9e8).
Here are the outputs produced.
Results can also be downloaded as artifacts here.
Summarised output:

5	W293	[*] Blank line contains whitespace
3	W291	[*] Trailing whitespace
1	E999	[ ] SyntaxError: Expected an expression
1	W292	[*] No newline at end of file
1	D202	[*] No blank lines allowed after function docstring (found 1)

Complete output(might be large):

.mailmap:1:38: E999 SyntaxError: Expected an expression
.mailmap:294:39: W292 [*] No newline at end of file
tardis/plasma/assembly/base.py:192:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/plasma/assembly/base.py:215:1: W293 [*] Blank line contains whitespace
tardis/plasma/assembly/base.py:216:71: W291 [*] Trailing whitespace
tardis/plasma/assembly/base.py:217:70: W291 [*] Trailing whitespace
tardis/plasma/assembly/base.py:218:49: W291 [*] Trailing whitespace
tardis/plasma/assembly/base.py:243:1: W293 [*] Blank line contains whitespace
tardis/plasma/assembly/base.py:247:1: W293 [*] Blank line contains whitespace
tardis/plasma/assembly/base.py:253:1: W293 [*] Blank line contains whitespace
tardis/plasma/assembly/base.py:262:1: W293 [*] Blank line contains whitespace
Found 11 errors.
[*] 10 fixable with the `--fix` option.

@tardis-bot
Copy link
Contributor

tardis-bot commented Jan 10, 2025

*beep* *bop*
Hi human,
I ran benchmarks as you asked comparing master (0fc2c76) and the latest commit (f6ab9e8).
Here are the logs produced by ASV.
Results can also be downloaded as artifacts here.

Significantly changed benchmarks:

All benchmarks:

Benchmarks that have stayed the same:

| Change   | Before [5e2d0bb3] <master>   | After [f6ab9e8b]    | Ratio   | Benchmark (Parameter)                                                                                                               |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
|          | 7.15±2μs                     | 8.15±2μs            | ~1.14   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley                                    |
|          | 45.3±30μs                    | 51.3±20μs           | ~1.13   | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission                                         |
|          | 2.62±1μs                     | 2.35±1μs            | ~0.90   | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators       |
|          | 61.9±30μs                    | 52.3±30μs           | ~0.84   | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter                                          |
|          | 530±100ns                    | 582±100ns           | 1.10    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation                              |
|          | 4.07±0.03ms                  | 4.31±0ms            | 1.06    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom')                                   |
|          | 3.00±0.01ms                  | 3.19±0.02ms         | 1.06    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter')                                     |
|          | 713±0.9ns                    | 759±0.9ns           | 1.06    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter                                       |
|          | 6.19±0.8μs                   | 6.57±0.9μs          | 1.06    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket                                           |
|          | 531±100ns                    | 551±100ns           | 1.04    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation                                |
|          | 1.53±0.4μs                   | 1.59±0.5μs          | 1.04    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line                    |
|          | 2.64±0.4ms                   | 2.73±0.4ms          | 1.04    | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop                        |
|          | 3.43±0.4μs                   | 3.54±0.7μs          | 1.03    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell                              |
|          | 39.3±0.04s                   | 39.7±0.02s          | 1.01    | run_tardis.BenchmarkRunTardis.time_run_tardis                                                                                       |
|          | 1.05±0m                      | 1.06±0m             | 1.01    | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking                                                                      |
|          | 65.7±0.07ms                  | 66.1±0.1ms          | 1.01    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe                  |
|          | 2.09±0m                      | 2.09±0m             | 1.00    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions                                 |
|          | 204±0.1ns                    | 205±0.1ns           | 1.00    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body                                       |
|          | 3.10±0.6μs                   | 3.07±0.3μs          | 0.99    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket                                       |
|          | 1.22±0μs                     | 1.19±0μs            | 0.98    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary                |
|          | 40.2±0.03μs                  | 38.9±0.04μs         | 0.97    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list                  |
|          | 541±100ns                    | 521±200ns           | 0.96    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation                                      |
|          | 24.5±6μs                     | 23.4±6μs            | 0.95    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
|          | 1.81±0.03ms                  | 1.70±0ms            | 0.94    | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop                             |

If you want to see the graph of the results, you can check it here

@karthik11135
Copy link
Author

karthik11135 commented Jan 10, 2025

if this looks good, i'll refactor the code in assemble method and write tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants