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

Update line_interaction_in_r after moving the packet #2811

Merged
merged 3 commits into from
Sep 11, 2024

Conversation

Sumit112192
Copy link
Contributor

📝 Description

Type: 🪲 bugfix

The line_interaction_in_r was being updated before the r_packet was moved.

@tardis-bot
Copy link
Contributor

tardis-bot commented Aug 27, 2024

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

2	I001  	[*] Import block is un-sorted or un-formatted
1	RET508	[ ] Unnecessary `elif` after `break` statement

Complete output(might be large):

tardis/transport/montecarlo/interaction.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/transport/montecarlo/r_packet_transport.py:115:13: RET508 Unnecessary `elif` after `break` statement
tardis/transport/montecarlo/tests/test_rpacket_last_interaction_tracker.py:1:1: I001 [*] Import block is un-sorted or un-formatted
Found 3 errors.
[*] 2 fixable with the `--fix` option.

@Sumit112192
Copy link
Contributor Author

Sumit112192 commented Aug 29, 2024

Just a minor change. PR tardis-sn/tardis-regression-data#23 for the regression data update.

@Sumit112192 Sumit112192 marked this pull request as ready for review August 29, 2024 11:10
@Sumit112192
Copy link
Contributor Author

@andrewfullard @wkerzendorf Please review.

@tardis-bot
Copy link
Contributor

tardis-bot commented Aug 29, 2024

*beep* *bop*
Hi human,
I ran benchmarks as you asked comparing master (260207c) and the latest commit (5568ff0).
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 [260207cb] <master>   | After [5568ff05]    | Ratio   | Benchmark (Parameter)                                                                                                               |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
|          | 2.62±0.7μs                   | 2.99±0.3μs          | ~1.14   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket                                       |
|          | 5.77±0.7μs                   | 6.50±1μs            | ~1.13   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket                                           |
|          | 51.6±20μs                    | 43.9±20μs           | ~0.85   | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission                                         |
|          | 53.6±20μs                    | 43.8±20μs           | ~0.82   | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter                                          |
|          | 25.0±7μs                     | 26.7±7μs            | 1.07    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
|          | 601±100ns                    | 621±200ns           | 1.03    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation                              |
|          | 3.37±0.02ms                  | 3.48±0.01ms         | 1.03    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom')                                   |
|          | 2.53±0.01ms                  | 2.61±0.01ms         | 1.03    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter')                                     |
|          | 2.49±0.4ms                   | 2.56±0.4ms          | 1.03    | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop                        |
|          | 1.43±0.4μs                   | 1.46±0.4μs          | 1.02    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line                    |
|          | 521±100ns                    | 521±200ns           | 1.00    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation                                      |
|          | 39.4±0.02s                   | 39.5±0.07s          | 1.00    | run_tardis.BenchmarkRunTardis.time_run_tardis                                                                                       |
|          | 2.07±0m                      | 2.07±0m             | 1.00    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions                                 |
|          | 208±0.04ns                   | 207±0.2ns           | 1.00    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body                                       |
|          | 1.66±0ms                     | 1.67±0.01ms         | 1.00    | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop                             |
|          | 1.05±0m                      | 1.04±0m             | 0.99    | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking                                                                      |
|          | 743±5ns                      | 735±0.1ns           | 0.99    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter                                       |
|          | 571±100ns                    | 561±100ns           | 0.98    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation                                |
|          | 31.4±0.08μs                  | 30.7±0.04μs         | 0.98    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list                  |
|          | 65.4±0.1ms                   | 62.0±0.01ms         | 0.95    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe                  |
|          | 1.26±0μs                     | 1.18±0.01μs         | 0.94    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary                |
|          | 7.88±2μs                     | 7.38±2μs            | 0.94    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley                                    |
|          | 3.50±0.4μs                   | 3.25±0.5μs          | 0.93    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell                              |
|          | 2.21±3μs                     | 2.01±2μs            | 0.91    | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators       |

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

andrewfullard
andrewfullard previously approved these changes Aug 29, 2024
@@ -140,7 +140,6 @@ def trace_packet(
if tau_trace_combined > tau_event and not disable_line_scattering:
interaction_type = InteractionType.LINE # Line
r_packet.last_interaction_in_nu = r_packet.nu
r_packet.last_interaction_in_r = r_packet.r
r_packet.last_line_interaction_in_id = cur_line_id
r_packet.last_line_interaction_shell_id = r_packet.current_shell_id
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I remove line 144, since it might give the incorrect impression that the location is updated here? Although the shell_id doesn't change when we encounter a line interaction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, it would be best to have all the interaction information update at the same code location as the radius.

@andrewfullard
Copy link
Contributor

Test failures are now the "expected" ones related to #2808

@Sumit112192
Copy link
Contributor Author

Since liv plot data is merged. Other PRs tests would fail now.

@wkerzendorf wkerzendorf merged commit 62395d3 into tardis-sn:master Sep 11, 2024
13 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants