tardis-sn / tardis

TARDIS - Temperature And Radiative Diffusion In Supernovae
https://tardis-sn.github.io/tardis
204 stars 406 forks source link

Ruff root files #2849

Closed atharva-2001 closed 1 month ago

atharva-2001 commented 1 month ago

:pencil: Description

Type: :beetle: bugfix | :rocket: feature | :biohazard: breaking change | :vertical_traffic_light: testing | :memo: documentation | :roller_coaster: infrastructure

Run ruff on root level files

:pushpin: Resources

Examples, notebooks, and links to useful references.

:vertical_traffic_light: Testing

How did you test these changes?

:ballot_box_with_check: Checklist

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

tardis-bot commented 1 month ago

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

```diff 3 F821 [ ] Undefined name `atomic_dataset` 2 F401 [ ] `tardis.base.run_tardis` imported but unused; consider removing, adding to `__all__`, or using a redundant alias 1 ICN001 [*] `matplotlib` should be imported as `mpl` 1 RET505 [ ] Unnecessary `else` after `return` statement 1 PGH004 [ ] Use specific rule codes when using `noqa` 1 PLW0127 [ ] Self-assignment of variable `atom_data` ```

Complete output(might be large):

```diff tardis/__init__.py:6:31: PGH004 Use specific rule codes when using `noqa` tardis/__init__.py:32:25: F401 `tardis.base.run_tardis` imported but unused; consider removing, adding to `__all__`, or using a redundant alias tardis/__init__.py:33:46: F401 `tardis.io.util.yaml_load_file` imported but unused; consider removing, adding to `__all__`, or using a redundant alias tardis/base.py:100:13: PLW0127 Self-assignment of variable `atom_data` tardis/scripts/cmfgen2tardis.py:13:27: F821 Undefined name `atomic_dataset` tardis/scripts/cmfgen2tardis.py:68:34: F821 Undefined name `atomic_dataset` tardis/tests/integration_tests/conftest.py:43:13: F821 Undefined name `tardis_githash` tardis/tests/integration_tests/conftest.py:88:5: RET505 Unnecessary `else` after `return` statement tardis/tests/integration_tests/test_integration.py:3:8: ICN001 `matplotlib` should be imported as `mpl` Found 9 errors. No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option). ```
codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 75.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 70.71%. Comparing base (81ec6e8) to head (9a3c268). Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
tardis/scripts/cmfgen2tardis.py 0.00% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2849 +/- ## ========================================== - Coverage 71.08% 70.71% -0.38% ========================================== Files 213 213 Lines 15823 15819 -4 ========================================== - Hits 11248 11186 -62 - Misses 4575 4633 +58 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

andrewfullard commented 1 month ago

Benchmarks are failing, please investigate

tardis-bot commented 1 month ago

*beep* *bop* Hi human, I ran benchmarks as you asked comparing master (81ec6e8eccfacc831c386a2061ffd2d0c570e739) and the latest commit (9a3c26895ae96ffba4265f77b73f49c64244fbf4). Here are the logs produced by ASV. Results can also be downloaded as artifacts here.

Significantly changed benchmarks:

```diff ```

All benchmarks:

```diff Benchmarks that have stayed the same: | Change | Before [81ec6e8e] | After [9a3c2689] | Ratio | Benchmark (Parameter) | |----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------| | | 1.50±0.4μs | 2.03±0.4μs | ~1.35 | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line | | | 2.08±2μs | 2.51±1μs | ~1.20 | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators | | | 3.10±0.01ms | 3.48±0ms | ~1.12 | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter') | | | 662±200ns | 590±100ns | ~0.89 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation | | | 4.35±0.5μs | 3.50±0.5μs | ~0.80 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell | | | 58.9±30μs | 44.5±30μs | ~0.76 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter | | | 4.30±0.02ms | 4.67±0.01ms | 1.09 | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom') | | | 3.04±0.4μs | 3.28±0.4μs | 1.08 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket | | | 7.13±2μs | 7.58±2μs | 1.06 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley | | | 727±0.5ns | 753±2ns | 1.04 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter | | | 32.3±0.01μs | 33.7±0.3μs | 1.04 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list | | | 561±100ns | 571±100ns | 1.02 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation | | | 38.2±0.2s | 38.4±0.2s | 1.01 | run_tardis.BenchmarkRunTardis.time_run_tardis | | | 1.04±0m | 1.05±0m | 1.01 | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking | | | 1.82±0.01ms | 1.84±0.02ms | 1.01 | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop | | | 2.10±0m | 2.10±0.01m | 1.00 | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions | | | 1.22±0μs | 1.19±0μs | 0.98 | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary | | | 43.6±30μs | 41.9±20μs | 0.96 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission | | | 67.1±0.03ms | 63.9±0.1ms | 0.95 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe | | | 228±1ns | 215±0.1ns | 0.94 | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body | | | 652±100ns | 601±200ns | 0.92 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation | | | 2.86±0.5ms | 2.62±0.4ms | 0.92 | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop | | | 6.58±0.8μs | 6.04±0.8μs | 0.92 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket | | | 25.5±7μs | 23.2±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