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

Ruff Autofixes (tardis/analysis) #2826

Merged
merged 5 commits into from
Sep 25, 2024

Conversation

atharva-2001
Copy link
Member

📝 Description

Type: 🪲 bugfix | 🚀 feature | ☣️ breaking change | 🚦 testing | 📝 documentation | 🎢 infrastructure

Write a complete description of your changes, including the necessary context or any piece of information required to understand your work.

Also, link issues affected by this pull request by using the keywords: close, closes, closed, fix, fixes, fixed, resolve, resolves or resolved.

📌 Resources

Examples, notebooks, and links to useful references.

🚦 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

tardis-bot commented Sep 24, 2024

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

3	INP001	File `tardis/analysis/opacities.py` is part of an implicit namespace package. Add an `__init__.py`.
2	RET505	Unnecessary `elif` after `return` statement
1	E722  	Do not use bare `except`
1	F403  	`from tardis.grid.base import *` used; unable to detect undefined names

Complete output(might be large):

tardis/analysis/opacities.py:1:1: INP001 File `tardis/analysis/opacities.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/grid/__init__.py:7:1: F403 `from tardis.grid.base import *` used; unable to detect undefined names
tardis/grid/tests/test_grid.py:1:1: INP001 File `tardis/grid/tests/test_grid.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/radiation_field/base.py:1:1: INP001 File `tardis/radiation_field/base.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/util/base.py:341:5: RET505 Unnecessary `else` after `return` statement
tardis/util/base.py:515:5: E722 Do not use bare `except`
tardis/util/base.py:623:5: RET505 Unnecessary `elif` after `return` statement
Found 7 errors.

Copy link

codecov bot commented Sep 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.81%. Comparing base (71aad19) to head (728269f).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2826      +/-   ##
==========================================
- Coverage   70.98%   70.81%   -0.18%     
==========================================
  Files         209      209              
  Lines       15654    15648       -6     
==========================================
- Hits        11112    11081      -31     
- Misses       4542     4567      +25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andrewfullard andrewfullard marked this pull request as ready for review September 25, 2024 15:48
@tardis-bot
Copy link
Contributor

*beep* *bop*
Hi human,
I ran benchmarks as you asked comparing master (71aad19) and the latest commit (728269f).
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 [71aad198] <master>   | After [728269f2]    | Ratio   | Benchmark (Parameter)                                                                                                               |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
|          | 2.84±0.5μs                   | 3.81±0.4μs          | ~1.34   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket                                       |
|          | 6.73±0.7μs                   | 7.65±0.9μs          | ~1.14   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket                                           |
|          | 1.51±0.4μs                   | 1.68±0.4μs          | ~1.11   | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line                    |
|          | 3.69±0.6μs                   | 3.18±0.5μs          | ~0.86   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell                              |
|          | 2.61±2μs                     | 2.20±1μs            | ~0.84   | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators       |
|          | 50.2±30μs                    | 42.0±20μs           | ~0.84   | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission                                         |
|          | 29.0±8μs                     | 22.1±5μs            | ~0.76   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
|          | 4.15±0.01ms                  | 2.79±0.01ms         | ~0.67   | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter')                                     |
|          | 208±0.04ns                   | 220±0.06ns          | 1.06    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body                                       |
|          | 724±0.6ns                    | 765±0.5ns           | 1.06    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter                                       |
|          | 1.66±0.02ms                  | 1.72±0.01ms         | 1.03    | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop                             |
|          | 4.08±0.03ms                  | 4.15±0.03ms         | 1.02    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom')                                   |
|          | 7.50±2μs                     | 7.60±2μs            | 1.01    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley                                    |
|          | 591±200ns                    | 591±200ns           | 1.00    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation                              |
|          | 2.09±0m                      | 2.09±0m             | 1.00    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions                                 |
|          | 1.19±0μs                     | 1.19±0μs            | 1.00    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary                |
|          | 2.66±0.4ms                   | 2.65±0.4ms          | 0.99    | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop                        |
|          | 1.06±0m                      | 1.03±0m             | 0.97    | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking                                                                      |
|          | 32.5±0.1μs                   | 31.6±0μs            | 0.97    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list                  |
|          | 66.5±0.1ms                   | 64.3±0.5ms          | 0.97    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe                  |
|          | 521±100ns                    | 501±200ns           | 0.96    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation                                      |
|          | 39.0±0.1s                    | 37.5±0.06s          | 0.96    | run_tardis.BenchmarkRunTardis.time_run_tardis                                                                                       |
|          | 552±100ns                    | 521±100ns           | 0.94    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation                                |
|          | 48.1±40μs                    | 44.7±30μs           | 0.93    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter                                          |

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

@andrewfullard andrewfullard merged commit e038291 into tardis-sn:master Sep 25, 2024
28 of 32 checks passed
CePowers pushed a commit to CePowers/tardis that referenced this pull request Oct 1, 2024
* ruff autofix analysios

* ruff autofix tardis/grid

* ruff autofix tardis/radiation_field

* ruff autofix tardis/util

* black tardis/grid/base.py
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