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

Fix ruff comments issue #2762

Merged
merged 7 commits into from
Aug 2, 2024
Merged

Conversation

atharva-2001
Copy link
Member

@atharva-2001 atharva-2001 commented Jul 30, 2024

📝 Description

Type: 🪲 bugfix 🚦 testing | 🎢 infrastructure
Working output demonstration
(see comment)
atharva-2001#49

Ruff only works on files which were edited-
https://github.com/tardis-sn/tardis/actions/runs/10215044491/job/28263649725?pr=2762

📌 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 Jul 30, 2024

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

Complete output(might be large):

Copy link

codecov bot commented Jul 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.42%. Comparing base (c82dde5) to head (1536f79).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2762      +/-   ##
==========================================
- Coverage   69.98%   69.42%   -0.56%     
==========================================
  Files         196      196              
  Lines       15008    15008              
==========================================
- Hits        10503    10419      -84     
- Misses       4505     4589      +84     

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

@atharva-2001 atharva-2001 marked this pull request as ready for review July 30, 2024 13:36
andrewfullard
andrewfullard previously approved these changes Jul 30, 2024
@@ -7,7 +7,7 @@ name: codestyle
on:
push:
branches:
- "*"
- "master"
Copy link
Contributor

@KasukabeDefenceForce KasukabeDefenceForce Jul 30, 2024

Choose a reason for hiding this comment

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

I think we should remove the quotes for consistency.

@andrewfullard andrewfullard self-requested a review July 30, 2024 13:44
@atharva-2001 atharva-2001 marked this pull request as draft August 1, 2024 08:06
@atharva-2001 atharva-2001 marked this pull request as ready for review August 2, 2024 11:51
@tardis-bot
Copy link
Contributor

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

Significantly changed benchmarks:

All benchmarks:

All benchmarks:

| Change   | Before [c82dde5f] <master>   | After [1536f790]    | Ratio   | Benchmark (Parameter)                                                                                                                                                                                                                              |
|----------|------------------------------|---------------------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|          | 2.37±0.7μs                   | 3.52±1μs            | ~1.49   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation(100000.0, 255.5)                                                                                                                                    |
|          | 2.50±0.8μs                   | 2.73±0.9μs          | 1.09    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation(100000.0, 511.0)                                                                                                                                    |
|          | 2.40±0.8μs                   | 2.57±0.9μs          | 1.07    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation(100000.0, 5110000000.0)                                                                                                                             |
|          | 2.78±0.9μs                   | 2.53±0.8μs          | 0.91    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation(100000000000.0, 255.5)                                                                                                                              |
|          | 3.02±1μs                     | 2.68±0.9μs          | ~0.89   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation(100000000000.0, 511.0)                                                                                                                              |
|          | 2.51±0.8μs                   | 2.33±0.8μs          | 0.93    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation(100000000000.0, 5110000000.0)                                                                                                                       |
|          | 2.46±0.8μs                   | 2.59±0.9μs          | 1.05    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation(1000000000000000.0, 255.5)                                                                                                                          |
|          | 2.50±0.8μs                   | 2.62±0.9μs          | 1.05    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation(1000000000000000.0, 511.0)                                                                                                                          |
|          | 2.47±0.8μs                   | 3.03±1μs            | ~1.22   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation(1000000000000000.0, 5110000000.0)                                                                                                                   |
|          | 2.98±1μs                     | 4.47±2μs            | ~1.50   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation({'Ejecta_density': 0.01, 'Energy': 255.5, 'Iron_group_fraction': 0.0})                                                                        |
|          | 3.14±1μs                     | 4.18±2μs            | ~1.33   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation({'Ejecta_density': 0.01, 'Energy': 255.5, 'Iron_group_fraction': 0.5})                                                                        |
|          | 3.36±1μs                     | 4.30±2μs            | ~1.28   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation({'Ejecta_density': 0.01, 'Energy': 511.0, 'Iron_group_fraction': 0.5})                                                                        |
|          | 3.32±1μs                     | 4.22±2μs            | ~1.27   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation({'Ejecta_density': 0.01, 'Energy': 5110000000.0, 'Iron_group_fraction': 0.0})                                                                 |
|          | 2.97±1μs                     | 4.03±1μs            | ~1.36   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation({'Ejecta_density': 100000.0, 'Energy': 255.5, 'Iron_group_fraction': 1.0})                                                                    |
|          | 2.97±1μs                     | 4.21±2μs            | ~1.42   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation({'Ejecta_density': 0.01, 'Energy': 255.5, 'Iron_group_fraction': 0.0})                                                                      |
|          | 3.30±1μs                     | 4.34±2μs            | ~1.32   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation({'Ejecta_density': 0.01, 'Energy': 255.5, 'Iron_group_fraction': 0.5})                                                                      |
|          | 3.24±1μs                     | 4.29±2μs            | ~1.32   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation({'Ejecta_density': 0.01, 'Energy': 511.0, 'Iron_group_fraction': 0.5})                                                                      |
|          | 3.22±1μs                     | 4.14±2μs            | ~1.29   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation({'Ejecta_density': 0.01, 'Energy': 5110000000.0, 'Iron_group_fraction': 0.0})                                                               |
|          | 3.34±1μs                     | 4.40±2μs            | ~1.32   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation({'Ejecta_density': 100000.0, 'Energy': 255.5, 'Iron_group_fraction': 1.0})                                                                  |
|          | 1.48±0.01s                   | 1.45±0.01s          | 0.99    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom')                                                                                                                                                  |
|          | 1.48±0.01s                   | 1.50±0s             | 1.01    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter')                                                                                                                                                    |
|          | 39.8±0.01s                   | 39.6±0.05s          | 0.99    | run_tardis.BenchmarkRunTardis.time_run_tardis                                                                                                                                                                                                      |
|          | 1.03±0m                      | 1.03±0m             | 1.00    | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking                                                                                                                                                                                     |
|          | 2.13±0m                      | 2.13±0m             | 1.00    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions                                                                                                                                                |
|          | 3.47±1μs                     | 2.93±0.9μs          | ~0.84   | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body({'nu': 100000000000000.0, 'temperature': 10000.0})                                                                                                   |
|          | 66.5±20μs                    | 64.8±20μs           | 0.97    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary                                                                                                                               |
|          | 71.3±10μs                    | 72.5±10μs           | 1.02    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line({'packet': {'nu_line': 0.1, 'is_last_line': True}, 'enable_full_relativity': True})                                               |
|          | 72.3±10μs                    | 71.2±10μs           | 0.98    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line({'packet': {'nu_line': 0.2, 'is_last_line': False}, 'enable_full_relativity': True})                                              |
|          | 86.6±20μs                    | 82.5±20μs           | 0.95    | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators({'cur_line_id': 0, 'distance_trace': 0, 'time_explosion': 52000000.0, 'enable_full_relativity': True})               |
|          | 85.3±20μs                    | 88.6±20μs           | 1.04    | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators({'cur_line_id': 0, 'distance_trace': 1000000000000.0, 'time_explosion': 52000000.0, 'enable_full_relativity': True}) |
|          | 85.0±20μs                    | 83.0±20μs           | 0.98    | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators({'cur_line_id': 1, 'distance_trace': 100000.0, 'time_explosion': 10000000000.0, 'enable_full_relativity': False})    |
|          | 7.73±0.01s                   | 7.77±0.01s          | 1.00    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission({'mu': 0.8599443103322428, 'emission_line_id': 1000, 'energy': 0.9114437898710559})                                                                    |
|          | 7.80±0.03s                   | 7.84±0.01s          | 1.00    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter(<LineInteractionType.MACROATOM: 2>)                                                                                                                     |
|          | 7.84±0.01s                   | 7.75±0.02s          | 0.99    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter(<LineInteractionType.SCATTER: 0>)                                                                                                                       |
|          | 3.59±0.02s                   | 3.56±0.03s          | 0.99    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter                                                                                                                                                      |
|          | 5.16±0.02s                   | 4.99±0.04s          | 0.97    | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop                                                                                                                                            |
|          | 20.7±6μs                     | 21.4±6μs            | 1.03    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list(10)                                                                                                            |
|          | 31.2±7μs                     | 40.5±10μs           | ~1.30   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list(100)                                                                                                           |
|          | 123±10μs                     | 137±20μs            | ~1.11   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list(1000)                                                                                                          |
|          | 26.2±9μs                     | 27.4±9μs            | 1.05    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list(1, 1)                                                                                                                           |
|          | 25.2±8μs                     | 31.0±10μs           | ~1.23   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list(1, 10)                                                                                                                          |
|          | 24.6±8μs                     | 27.7±10μs           | ~1.12   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list(1, 50)                                                                                                                          |
|          | 43.7±10μs                    | 36.0±10μs           | ~0.82   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list(10, 1)                                                                                                                          |
|          | 48.7±20μs                    | 40.7±10μs           | ~0.83   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list(10, 10)                                                                                                                         |
|          | 38.2±10μs                    | 36.5±10μs           | 0.96    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list(10, 50)                                                                                                                         |
|          | 76.1±20μs                    | 76.0±20μs           | 1.00    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list(50, 1)                                                                                                                          |
|          | 104±30μs                     | 72.2±10μs           | ~0.70   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list(50, 10)                                                                                                                         |
|          | 98.1±8μs                     | 79.6±10μs           | ~0.81   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list(50, 50)                                                                                                                         |
|          | 1.45±0s                      | 1.44±0s             | 0.99    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe                                                                                                                                 |
|          | 6.38±0.01s                   | 6.33±0.02s          | 0.99    | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop                                                                                                                                       |
|          | 5.01±0.01s                   | 4.98±0.02s          | 0.99    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket                                                                                                                                                      |
|          | 5.03±0.03s                   | 5.00±0.01s          | 1.00    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket                                                                                                                                                          |
|          | 5.02±0.01s                   | 4.95±0.01s          | 0.99    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley({'tau_russian': 10.0, 'survival_possibility': 0.0})                                                                                               |
|          | 4.99±0.02s                   | 4.97±0.01s          | 1.00    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley({'tau_russian': 15.0, 'survival_possibility': 0.1})                                                                                               |
|          | 3.56±0.02s                   | 3.61±0.01s          | 1.01    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell                                                                                                                                             |

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

@Knights-Templars Knights-Templars merged commit d8da61e into tardis-sn:master Aug 2, 2024
19 of 21 checks passed
officialasishkumar added a commit to officialasishkumar/tardis that referenced this pull request Aug 2, 2024
* added setup function

Signed-off-by: Asish Kumar <[email protected]>

* refactor geometry calculate distances

Signed-off-by: Asish Kumar <[email protected]>

* Refactor montecarlo estimators in benchmark code

Signed-off-by: Asish Kumar <[email protected]>

* add cache and setup functions

Signed-off-by: Asish Kumar <[email protected]>

* add cache and setup functions

Signed-off-by: Asish Kumar <[email protected]>

* ran ruff linter

Signed-off-by: Asish Kumar <[email protected]>

* Thou hath vanquished the redundant variables and functions

Signed-off-by: Asish Kumar <[email protected]>

* fix bugs

Signed-off-by: Asish Kumar <[email protected]>

* change benchmark yml

Signed-off-by: Asish Kumar <[email protected]>

* repeat in class

Signed-off-by: Asish Kumar <[email protected]>

* Benchmark run_tardis with track_rpacket enabled (tardis-sn#2720)

* Benchmark run_tardis with track_rpacket enabled

* Update config to resemble time_run_tardis config

* Fix Benchmark error

* Cache Benchmark Property

* Remove Cached Property decorator

* rounds in benchmarks

Signed-off-by: Asish Kumar <[email protected]>

* fix

Signed-off-by: Asish Kumar <[email protected]>

* fix error in formal integral

Signed-off-by: Asish Kumar <[email protected]>

* more cache

Signed-off-by: Asish Kumar <[email protected]>

* sort by ratio

Signed-off-by: Asish Kumar <[email protected]>

* Donot run docs, benchmarks and stardis tests on draft PRs. (tardis-sn#2761)

* Add ready to review to run tests

* Add if condition to check PR status

* Running stardis tests only on push to master

* Removing osx-64 from workflows

* Add Extend Array Function (tardis-sn#2771)

* Add Extend Array Function

* Fix Typo and restructure

* Restructure

* Doc string update

* Was expecting numpy arrays to be passed by reference but it is not so updating it

* Add test for the extend array function

* Opacity state slice (tardis-sn#2758)

* Added basic sliing operation to opacitystate and set the transport solver to use the bounds of the gemoetry indices

* Reformatted the slicing index

* Added slicing operation with __getitem__

* Added docstring

* removed old slice method

* Ran black

* Added back the 'slice' method because __getitem__ is wacky

* added missing argument

* fixed missing argument

* ran black

* fixed the tests

* ran black

* Updated the slice to use __getitem__ again and modified the opacitystate object defined in the opacities module

* Removed old slice method and print statements

* removed print statement from the test

* added type annotation to OpacityState getitem

* updated numba interface

* Fixes black formatting

* Release Pipeline Fixes (tardis-sn#2767)

* Fix zenodo badge

* Pick from the website

* update badge in credits.rst

* Use the all versions DOI

* Inherit secrets

* Change triggers for testing

* Reset Triggers

* Fix ruff comments issue (tardis-sn#2762)

* Fix ruff comments issue

* Only check files changed

* Testing triggers

* Fix bash commands

* No pager

* fetch depth

* Reset all changes

* cache in setup function

Signed-off-by: Asish Kumar <[email protected]>

* change benchmark yml

Signed-off-by: Asish Kumar <[email protected]>

---------

Signed-off-by: Asish Kumar <[email protected]>
Co-authored-by: Sumit Gupta <[email protected]>
Co-authored-by: KasukabeDefenceForce <[email protected]>
Co-authored-by: Jack O'Brien <[email protected]>
Co-authored-by: Andrew Fullard <[email protected]>
Co-authored-by: Atharva Arya <[email protected]>
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.

5 participants