tardis-sn / stardis

TARDIS stellar radiative transfer
https://tardis-sn.github.io/stardis/
11 stars 15 forks source link

Cleanup calculate broadening #174

Closed jvshields closed 9 months ago

jvshields commented 9 months ago

The broadening calculation needed a lot of cleaning. This is the beginning of that cleaning/speedup. A large portion of the PR is getting rid of things being saved to variables and then immediately used in functions, or things being returned by functions for no reason, or things being converted to numpy arrays from dataframes and then being accessed in odd ways that make far more sense to be located directly in the dataframes.

Another part of the pr is getting rid of the nested for loop inside the function. The calculations are now done with appropriate array broadcasting.

codecov[bot] commented 9 months ago

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (6ff02fe) 68.39% compared to head (a50b226) 67.72%.

Files Patch % Lines
...on_field/opacities/opacities_solvers/broadening.py 50.00% 7 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #174 +/- ## ========================================== - Coverage 68.39% 67.72% -0.68% ========================================== Files 31 31 Lines 1155 1131 -24 ========================================== - Hits 790 766 -24 Misses 365 365 ```

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

tardis-bot commented 9 months ago

*beep* *bop* Hi human, I ran benchmarks as you asked comparing main (6ff02fec7dc8e973420adc82e7df61518a4fef56) and the latest commit (a50b226a031f2ca3c713ebc83e98b5bcb58528a2). Here are the logs produced by ASV. Results can also be downloaded as artifacts here. Significantly changed benchmarks:

```diff ```

All benchmarks:

```diff All benchmarks: before after ratio [6ff02fec] [a50b226a] 1.49±0.04ms 1.44±0.02ms 0.96 run_stardis.BenchmarkStardis.time_calc_alpha_file 1.67±0.01s 1.61±0s 0.96 run_stardis.BenchmarkStardis.time_calc_alpha_line_at_nu 707±10ms 708±10ms 1.00 run_stardis.BenchmarkStardis.time_create_plasma 102±1ms 101±1ms 0.98 run_stardis.BenchmarkStardis.time_raytrace 3.86±0.01s 3.76±0.02s 0.97 run_stardis.BenchmarkStardis.time_run_stardis ```