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

from simulation test for rpacket plot #2945

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

Conversation

karthik11135
Copy link

📝 Description

The from simulation method of rpacket plot did not have a test before.

🚦 Testing

How did you test these changes?

  • Testing pipeline
  • Other method (describe)
  • My changes can't be tested (explain why)

☑️ Checklist

  • I requested two reviewers for this pull request
  • I updated the documentation according to my changes
  • I built the documentation by applying the build_docs label

Note: If you are not allowed to perform any of these actions, ping (@) a contributor.

@tardis-bot
Copy link
Contributor

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

1	I001	[*] Import block is un-sorted or un-formatted
1	E999	[ ] SyntaxError: Expected an expression
1	W292	[*] No newline at end of file

Complete output(might be large):

.mailmap:1:38: E999 SyntaxError: Expected an expression
.mailmap:294:39: W292 [*] No newline at end of file
tardis/visualization/tools/tests/test_rpacket_plot.py:3:1: I001 [*] Import block is un-sorted or un-formatted
Found 3 errors.
[*] 2 fixable with the `--fix` option.

@tardis-bot
Copy link
Contributor

tardis-bot commented Jan 12, 2025

*beep* *bop*
Hi human,
I ran benchmarks as you asked comparing master (0fc2c76) and the latest commit (6d40395).
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 [6d40395f]    | Ratio   | Benchmark (Parameter)                                                                                                               |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
|          | 40.0±20μs                    | 63.6±20μs           | ~1.59   | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission                                         |
|          | 1.94±1μs                     | 2.33±1μs            | ~1.20   | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators       |
|          | 1.38±0.4μs                   | 1.53±0.4μs          | ~1.11   | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line                    |
|          | 3.11±0.5μs                   | 2.80±0.7μs          | ~0.90   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket                                       |
|          | 4.54±6μs                     | 3.42±0.6μs          | ~0.75   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell                              |
|          | 9.58±0.4μs                   | 7.04±2μs            | ~0.74   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley                                    |
|          | 732±1ns                      | 781±0.5ns           | 1.07    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter                                       |
|          | 20.0±5μs                     | 21.3±5μs            | 1.06    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
|          | 49.9±20μs                    | 51.5±30μs           | 1.03    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter                                          |
|          | 1.65±0ms                     | 1.70±0.01ms         | 1.03    | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop                             |
|          | 203±0.3ns                    | 207±0.07ns          | 1.02    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body                                       |
|          | 63.5±0ms                     | 64.7±0.3ms          | 1.02    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe                  |
|          | 3.78±0.04ms                  | 3.83±0.01ms         | 1.01    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom')                                   |
|          | 2.76±0.01ms                  | 2.77±0.01ms         | 1.01    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter')                                     |
|          | 1.03±0m                      | 1.04±0m             | 1.01    | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking                                                                      |
|          | 1.22±0μs                     | 1.23±0μs            | 1.01    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary                |
|          | 38.3±0.01s                   | 38.1±0.09s          | 0.99    | run_tardis.BenchmarkRunTardis.time_run_tardis                                                                                       |
|          | 2.10±0m                      | 2.08±0m             | 0.99    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions                                 |
|          | 561±100ns                    | 551±200ns           | 0.98    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation                                      |
|          | 611±100ns                    | 601±200ns           | 0.98    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation                              |
|          | 2.66±0.4ms                   | 2.59±0.4ms          | 0.97    | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop                        |
|          | 39.2±0.06μs                  | 36.9±0.05μs         | 0.94    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list                  |
|          | 7.01±1μs                     | 6.51±0.5μs          | 0.93    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket                                           |
|          | 642±100ns                    | 591±200ns           | 0.92    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation                                |

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

Comment on lines +37 to +41
temp_store = simulation_rpacket_tracking.transport.transport_state.rpacket_tracker_df
del simulation_rpacket_tracking.transport.transport_state.rpacket_tracker_df
with pytest.raises(AttributeError):
RPacketPlotter.from_simulation(simulation_rpacket_tracking)
simulation_rpacket_tracking.transport.transport_state.rpacket_tracker_df = temp_store
Copy link
Member

Choose a reason for hiding this comment

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

what does this mean?

Copy link
Author

Choose a reason for hiding this comment

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

When sim.transport.transport_state do not contain the attribute rpackettrackerdf, the attributeerror must be raised. I'm testing that case also. For that, I'm storing the value of that (rpackettrackerdf) and deleting it to test the error. After that, I'm assigning it back.

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

Successfully merging this pull request may close these issues.

4 participants