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 tardis/plasma #2845

Merged
merged 3 commits into from
Oct 8, 2024
Merged

Conversation

atharva-2001
Copy link
Member

📝 Description

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

Ruff on plasma

📌 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 Oct 8, 2024

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

11	G004  	[ ] Logging statement uses f-string
6	RET505	[ ] Unnecessary `elif` after `return` statement
6	F401  	[*] `pygraphviz` imported but unused
5	E722  	[ ] Do not use bare `except`
3	F405  	[ ] `HiddenPlasmaProperty` may be undefined, or defined from star imports
2	RET506	[ ] Unnecessary `else` after `raise` statement
2	F403  	[ ] `from tardis.plasma.properties.base import *` used; unable to detect undefined names
1	S605  	[ ] Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
1	F821  	[ ] Undefined name `s1`

Complete output(might be large):

tardis/plasma/__init__.py:5:32: F401 `tardis.plasma.base.BasePlasma` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/plasma/base.py:11:1: F403 `from tardis.plasma.properties.base import *` used; unable to detect undefined names
tardis/plasma/base.py:45:9: RET505 Unnecessary `else` after `return` statement
tardis/plasma/base.py:53:9: RET506 Unnecessary `else` after `raise` statement
tardis/plasma/base.py:111:17: E722 Do not use bare `except`
tardis/plasma/base.py:144:44: F405 `PreviousIterationProperty` may be undefined, or defined from star imports
tardis/plasma/base.py:153:46: F405 `Input` may be undefined, or defined from star imports
tardis/plasma/base.py:273:13: G004 Logging statement uses f-string
tardis/plasma/base.py:296:20: F401 [*] `pygraphviz` imported but unused
tardis/plasma/base.py:297:9: E722 Do not use bare `except`
tardis/plasma/base.py:383:9: E722 Do not use bare `except`
tardis/plasma/base.py:429:35: F405 `HiddenPlasmaProperty` may be undefined, or defined from star imports
tardis/plasma/base.py:447:29: E722 Do not use bare `except`
tardis/plasma/properties/atomic.py:554:9: RET505 Unnecessary `else` after `return` statement
tardis/plasma/properties/atomic.py:585:9: RET505 Unnecessary `else` after `return` statement
tardis/plasma/properties/atomic.py:598:17: G004 Logging statement uses f-string
tardis/plasma/properties/atomic.py:639:9: RET505 Unnecessary `else` after `return` statement
tardis/plasma/properties/base.py:117:25: G004 Logging statement uses f-string
tardis/plasma/properties/base.py:178:9: RET505 Unnecessary `else` after `return` statement
tardis/plasma/properties/continuum_processes/__init__.py:2:5: F401 `tardis.plasma.properties.continuum_processes.photo_ion_rate_coeff.PhotoIonRateCoeff` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/plasma/properties/continuum_processes/__init__.py:4:1: F403 `from tardis.plasma.properties.continuum_processes.rates import *` used; unable to detect undefined names
tardis/plasma/properties/continuum_processes/__init__.py:6:5: F401 `tardis.plasma.properties.continuum_processes.recomb_rate_coeff.SpontRecombRateCoeff` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/plasma/properties/continuum_processes/__init__.py:7:5: F401 `tardis.plasma.properties.continuum_processes.recomb_rate_coeff.StimRecombRateCoeff` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/plasma/properties/continuum_processes/__init__.py:8:5: F401 `tardis.plasma.properties.continuum_processes.recomb_rate_coeff.StimRecombRateFactor` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/plasma/properties/helium_nlte.py:182:21: E722 Do not use bare `except`
tardis/plasma/properties/helium_nlte.py:185:29: G004 Logging statement uses f-string
tardis/plasma/properties/helium_nlte.py:218:23: S605 Starting a process with a shell: seems safe, but may be changed in the future; consider rewriting without `shell`
tardis/plasma/properties/helium_nlte.py:259:69: F821 Undefined name `s1`
tardis/plasma/properties/ion_population.py:370:25: G004 Logging statement uses f-string
tardis/plasma/properties/ion_population.py:495:25: G004 Logging statement uses f-string
tardis/plasma/properties/nlte_rate_equation_solver.py:302:25: G004 Logging statement uses f-string
tardis/plasma/properties/nlte_rate_equation_solver.py:309:25: G004 Logging statement uses f-string
tardis/plasma/properties/partition_function.py:145:9: RET505 Unnecessary `elif` after `return` statement
tardis/plasma/properties/partition_function.py:181:25: G004 Logging statement uses f-string
tardis/plasma/properties/partition_function.py:192:21: G004 Logging statement uses f-string
tardis/plasma/properties/partition_function.py:199:21: G004 Logging statement uses f-string
tardis/plasma/properties/partition_function.py:252:21: RET506 Unnecessary `else` after `raise` statement
Found 37 errors.
[*] 1 fixable with the `--fix` option.

Copy link

codecov bot commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 70.49%. Comparing base (4341331) to head (c2834d2).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
tardis/plasma/base.py 40.00% 3 Missing ⚠️
tardis/plasma/properties/helium_nlte.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2845      +/-   ##
==========================================
- Coverage   70.87%   70.49%   -0.39%     
==========================================
  Files         209      209              
  Lines       15589    15580       -9     
==========================================
- Hits        11049    10983      -66     
- Misses       4540     4597      +57     

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

@tardis-bot
Copy link
Contributor

*beep* *bop*
Hi human,
I ran benchmarks as you asked comparing master (4341331) and the latest commit (c2834d2).
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 [43413319] <master>   | After [c2834d28]    | Ratio   | Benchmark (Parameter)                                                                                                               |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
|          | 2.02±1μs                     | 2.33±1μs            | ~1.15   | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators       |
|          | 561±200ns                    | 631±100ns           | ~1.12   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation                                |
|          | 1.50±0.4μs                   | 1.66±0.5μs          | ~1.11   | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line                    |
|          | 2.59±0.5ms                   | 2.88±0.5ms          | ~1.11   | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop                        |
|          | 3.68±0.01ms                  | 3.97±0.02ms         | 1.08    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom')                                   |
|          | 209±0.2ns                    | 224±0.7ns           | 1.07    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body                                       |
|          | 2.95±0.5μs                   | 3.15±0.7μs          | 1.07    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket                                       |
|          | 2.62±0.01ms                  | 2.69±0.02ms         | 1.03    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter')                                     |
|          | 1.68±0.01ms                  | 1.74±0.01ms         | 1.03    | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop                             |
|          | 521±200ns                    | 531±200ns           | 1.02    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation                                      |
|          | 1.23±0μs                     | 1.26±0μs            | 1.02    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary                |
|          | 7.21±1μs                     | 7.33±1μs            | 1.02    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley                                    |
|          | 2.08±0m                      | 2.08±0m             | 1.00    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions                                 |
|          | 44.3±30μs                    | 44.1±20μs           | 1.00    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter                                          |
|          | 31.3±0.05μs                  | 31.4±0μs            | 1.00    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list                  |
|          | 1.03±0m                      | 1.02±0m             | 0.99    | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking                                                                      |
|          | 42.1±20μs                    | 41.8±20μs           | 0.99    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission                                         |
|          | 6.76±1μs                     | 6.66±1μs            | 0.99    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket                                           |
|          | 38.0±0.02s                   | 37.1±0.02s          | 0.98    | run_tardis.BenchmarkRunTardis.time_run_tardis                                                                                       |
|          | 65.6±0.2ms                   | 63.6±0.2ms          | 0.97    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe                  |
|          | 641±100ns                    | 601±100ns           | 0.94    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation                              |
|          | 766±0.08ns                   | 711±0.2ns           | 0.93    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter                                       |
|          | 3.91±0.7μs                   | 3.62±0.5μs          | 0.93    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell                              |
|          | 25.9±7μs                     | 23.7±6μs            | 0.91    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |

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

@andrewfullard andrewfullard merged commit 478604d into tardis-sn:master Oct 8, 2024
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants