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

Replace with appropriate .loc or .iloc method. #2969

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

Conversation

rohit2p
Copy link

@rohit2p rohit2p commented Feb 13, 2025

📝 Description

Type: 🪲 `bugfix``

Replace with appropriate .loc or .iloc method in analysis.py

closes: #2004

🚦 Testing

How did you test these changes?

  • Testing pipeline

☑️ Checklist

  • I requested two reviewers for this pull request

@tardis-bot
Copy link
Contributor

*beep* *bop*

Hi, human.

I'm the @tardis-bot and couldn't find your records in my database. I think we don't know each other, or you changed your credentials recently.

Please add your name and email to .mailmap in your current branch and push the changes to this pull request.

In case you need to map an existing alias, follow this example.

@tardis-bot
Copy link
Contributor

tardis-bot commented Feb 13, 2025

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

4	E722  	[ ] Do not use bare `except`
3	RET505	[ ] Unnecessary `else` after `return` statement
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/analysis.py:96:9: E722 Do not use bare `except`
tardis/analysis.py:110:9: E722 Do not use bare `except`
tardis/analysis.py:121:9: E722 Do not use bare `except`
tardis/analysis.py:136:9: E722 Do not use bare `except`
tardis/analysis.py:374:9: RET505 Unnecessary `else` after `return` statement
tardis/analysis.py:396:9: RET505 Unnecessary `else` after `return` statement
tardis/analysis.py:421:9: RET505 Unnecessary `else` after `return` statement
Found 9 errors.
[*] 1 fixable with the `--fix` option.

@rohit2p
Copy link
Author

rohit2p commented Feb 13, 2025

@wkerzendorf @andrewfullard can you take a look

@tardis-bot
Copy link
Contributor

*beep* *bop*
Hi human,
I ran benchmarks as you asked comparing master (13c9a31) and the latest commit (015a85a).
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 [13c9a314] <master>   | After [015a85a0]    | Ratio   | Benchmark (Parameter)                                                                                                               |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
|          | 63.7±20μs                    | 44.4±20μs           | ~0.70   | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission                                         |
|          | 31.2±9μs                     | 20.4±5μs            | ~0.66   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
|          | 521±100ns                    | 571±200ns           | 1.10    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation                                |
|          | 1.51±0.3μs                   | 1.64±0.4μs          | 1.09    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line                    |
|          | 2.84±0.03ms                  | 2.93±0.01ms         | 1.03    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter')                                     |
|          | 2.68±0.5ms                   | 2.72±0.5ms          | 1.02    | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop                        |
|          | 205±0.1ns                    | 207±0.03ns          | 1.01    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body                                       |
|          | 1.70±0.1ms                   | 1.72±0.01ms         | 1.01    | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop                             |
|          | 7.88±2μs                     | 7.97±2μs            | 1.01    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley                                    |
|          | 551±100ns                    | 551±100ns           | 1.00    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation                                      |
|          | 3.75±0.02ms                  | 3.74±0.01ms         | 1.00    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom')                                   |
|          | 39.1±0.1s                    | 39.0±0.03s          | 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.09±0m                      | 2.08±0m             | 1.00    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions                                 |
|          | 45.6±40μs                    | 45.5±30μs           | 1.00    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter                                          |
|          | 66.9±0.02ms                  | 67.2±0.04ms         | 1.00    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe                  |
|          | 40.3±0.09μs                  | 39.7±0.01μs         | 0.99    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list                  |
|          | 1.22±0μs                     | 1.20±0μs            | 0.98    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary                |
|          | 621±200ns                    | 581±200ns           | 0.94    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation                              |
|          | 768±1ns                      | 719±0.7ns           | 0.94    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter                                       |
|          | 3.26±0.7μs                   | 3.02±0.9μs          | 0.93    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket                                       |
|          | 3.78±0.6μs                   | 3.51±0.5μs          | 0.93    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell                              |
|          | 2.15±2μs                     | 1.97±1μs            | 0.92    | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators       |
|          | 7.25±1μs                     | 6.68±1μs            | 0.92    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket                                           |

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

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.

tardis/analysis.py uses Pandas's deprecated .ix method
2 participants