Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@atharva-2001
Copy link
Member

@atharva-2001 atharva-2001 commented Sep 1, 2025

πŸ“ Description

Type: πŸͺ² bugfix | πŸš€ feature | ☣️ breaking change | 🚦 testing | πŸ“ documentation | 🎒 infrastructure

Tests the from_workflow method in the SDEC plot and the liv plot using the existing regression data.

πŸ“Œ 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

*beep* *bop*

Hi, human.

I'm the @tardis-bot and I noticed that your email is not associated with an ORCID ID in our database.

Please add your email and ORCID ID to the .orcid.csv file in your current branch and push the changes to this pull request.

If you don't have an ORCID ID yet, you can create one for free at orcid.org. ORCID IDs help ensure you get proper credit for your scientific contributions.

The format should be:

email,orcid
[email protected],0000-0000-0000-0000

@tardis-bot
Copy link
Contributor

tardis-bot commented Sep 1, 2025

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

7622	      	[ ] syntax-error
40	W293  	[ ] blank-line-with-whitespace
17	F401  	[ ] unused-import
17	I001  	[*] unsorted-imports
 8	G004  	[ ] logging-f-string
 6	W291  	[ ] trailing-whitespace
 5	RET505	[*] superfluous-else-return
 3	E701  	[ ] multiple-statements-on-one-line-colon
 3	D202  	[*] blank-line-after-function
 3	RET506	[*] superfluous-else-raise
 2	E402  	[ ] module-import-not-at-top-of-file
 2	E902  	[ ] io-error
 2	W292  	[ ] missing-newline-at-end-of-file
 2	ISC003	[*] explicit-string-concatenation
 2	NPY201	[ ] numpy2-deprecation
 1	ANN204	[ ] missing-return-type-special-method
 1	B018  	[ ] useless-expression
 1	D406  	[*] missing-new-line-after-section-name
 1	D407  	[*] missing-dashed-underline-after-section
 1	F403  	[ ] undefined-local-with-import-star
 1	F811  	[ ] redefined-while-unused
 1	F821  	[ ] undefined-name
 1	PGH004	[ ] blanket-noqa
 1	TRY300	[ ] try-consider-else
Found 7743 errors.
[*] 86 fixable with the `--fix` option (3 hidden fixes can be enabled with the `--unsafe-fixes` option).

Complete output(might be large):

tardis/conftest.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/conftest.py:13:1: F403 `from tardis.tests.fixtures.atom_data import *` used; unable to detect undefined names
tardis/conftest.py:18:36: F401 [*] `tardis.tests.test_util.monkeysession` imported but unused
tardis/conftest.py:21:12: F401 `tardisbase` imported but unused; consider using `importlib.util.find_spec` to test for availability
tardis/conftest.py:42:49: PGH004 Use specific rule codes when using `noqa`
tardis/conftest.py:44:9: F821 Undefined name `pytest_report_header`
tardis/conftest.py:314:1: W293 [*] Blank line contains whitespace
tardis/opacities/macro_atom/macroatom_transitions.py:18:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/opacities/opacity_state.py:110:9: ANN204 Missing return type annotation for special method `__getitem__`
tardis/opacities/opacity_state.py:116:9: D407 [*] Missing dashed underline after section ("Returns")
tardis/opacities/opacity_state.py:116:9: D406 [*] Section name should end with a newline ("Returns")
tardis/opacities/opacity_state.py:245:9: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/opacities/tests/test_opacity_state_numba.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/opacities/tests/test_opacity_state_numba.py:2:44: F401 [*] `tardis.opacities.opacity_state.OpacityState` imported but unused
tardis/plasma/equilibrium/tests/test_ion_populations.py:5:8: F401 [*] `pytest` imported but unused
tardis/simulation/base.py:262:17: G004 Logging statement uses f-string
tardis/simulation/base.py:445:13: G004 Logging statement uses f-string
tardis/simulation/base.py:552:13: G004 Logging statement uses f-string
tardis/simulation/base.py:645:13: G004 Logging statement uses f-string
tardis/simulation/base.py:650:13: G004 Logging statement uses f-string
tardis/simulation/base.py:701:13: TRY300 Consider moving this statement to an `else` block
tardis/simulation/base.py:703:26: G004 Logging statement uses f-string
tardis/spectrum/formal_integral/base.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/spectrum/formal_integral/base.py:3:24: F401 [*] `scipy.sparse` imported but unused
tardis/spectrum/formal_integral/base.py:4:31: F401 [*] `scipy.sparse.linalg` imported but unused
tardis/spectrum/formal_integral/base.py:8:33: F401 [*] `tardis.constants` imported but unused
tardis/spectrum/formal_integral/base.py:38:9: RET506 [*] Unnecessary `else` after `raise` statement
tardis/spectrum/formal_integral/base.py:115:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/spectrum/formal_integral/formal_integral_cuda.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/spectrum/formal_integral/formal_integral_cuda.py:85:5: RET505 [*] Unnecessary `else` after `return` statement
tardis/spectrum/formal_integral/formal_integral_cuda.py:124:5: RET505 [*] Unnecessary `else` after `return` statement
tardis/spectrum/formal_integral/formal_integral_numba.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/spectrum/formal_integral/formal_integral_numba.py:29:5: RET505 [*] Unnecessary `else` after `return` statement
tardis/spectrum/formal_integral/formal_integral_numba.py:59:5: RET505 [*] Unnecessary `else` after `return` statement
tardis/spectrum/formal_integral/formal_integral_numba.py:134:12: NPY201 `np.trapz` will be removed in NumPy 2.0. Use `numpy.trapezoid` on NumPy 2.0, or ignore this warning on earlier versions.
tardis/spectrum/formal_integral/tests/test_cuda_formal_integral.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/spectrum/formal_integral/tests/test_cuda_formal_integral.py:9:5: F401 [*] `tardis.spectrum.formal_integral.base.interpolate_integrator_quantities` imported but unused
tardis/spectrum/formal_integral/tests/test_cuda_formal_integral.py:15:61: F401 [*] `tardis.spectrum.formal_integral.source_function.SourceFunctionSolver` imported but unused
tardis/spectrum/formal_integral/tests/test_formal_integral.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/spectrum/formal_integral/tests/test_formal_integral.py:7:55: F401 [*] `tardis.transport.montecarlo.configuration.montecarlo_globals` imported but unused
tardis/spectrum/formal_integral/tests/test_formal_integral.py:13:27: F401 [*] `tardis.spectrum.formal_integral.formal_integral_cuda.calculate_p_values` imported but unused
tardis/spectrum/formal_integral/tests/test_formal_integral.py:14:5: F401 [*] `tardis.spectrum.formal_integral.formal_integral_cuda.intensity_black_body_cuda` imported but unused
tardis/spectrum/formal_integral/tests/test_numba_formal_integral.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/spectrum/formal_integral/tests/test_numba_formal_integral.py:46:16: NPY201 `np.trapz` will be removed in NumPy 2.0. Use `numpy.trapezoid` on NumPy 2.0, or ignore this warning on earlier versions.
tardis/spectrum/formal_integral/tests/test_source_function.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/tests/test_tardis_full_formal_integral.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/tests/test_tardis_full_formal_integral.py:3:17: F401 [*] `numpy` imported but unused
tardis/transport/montecarlo/packets/packet_collections.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/transport/montecarlo/packets/packet_trackers.py:250:1: W293 Blank line contains whitespace
tardis/transport/montecarlo/packets/radiative_packet.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/transport/montecarlo/packets/tests/test_packet.py:21:1: E402 Module level import not at top of file
tardis/transport/montecarlo/single_packet_loop.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/visualization/plot_util.py:54:5: RET505 [*] Unnecessary `else` after `return` statement
tardis/visualization/sdec/util.py:115:9: RET506 [*] Unnecessary `else` after `raise` statement
tardis/visualization/sdec/util.py:273:9: RET506 [*] Unnecessary `else` after `raise` statement
tardis/visualization/tests/test_plot_util.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/visualization/tools/sdec_plot.py:8:1: I001 [*] Import block is un-sorted or un-formatted
tardis/visualization/tools/tests/test_liv_plot.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/visualization/tools/tests/test_liv_plot.py:2:18: F401 [*] `copy.deepcopy` imported but unused
tardis/visualization/tools/tests/test_liv_plot.py:14:55: F401 [*] `tardis.workflows.standard_tardis_workflow.StandardTARDISWorkflow` imported but unused
tardis/visualization/tools/tests/test_liv_plot.py:301:29: ISC003 [*] Explicitly concatenated string should be implicitly concatenated
tardis/visualization/tools/tests/test_liv_plot.py:504:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_liv_plot.py:509:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_liv_plot.py:514:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_liv_plot.py:519:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_liv_plot.py:522:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_liv_plot.py:555:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_liv_plot.py:561:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_liv_plot.py:563:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_liv_plot.py:566:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_liv_plot.py:580:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_liv_plot.py:583:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_liv_plot.py:595:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_liv_plot.py:599:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_liv_plot.py:602:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:2:1: I001 [*] Import block is un-sorted or un-formatted
tardis/visualization/tools/tests/test_sdec_plot.py:3:18: F401 [*] `copy.deepcopy` imported but unused
tardis/visualization/tools/tests/test_sdec_plot.py:16:55: F401 [*] `tardis.workflows.standard_tardis_workflow.StandardTARDISWorkflow` imported but unused
tardis/visualization/tools/tests/test_sdec_plot.py:282:29: ISC003 [*] Explicitly concatenated string should be implicitly concatenated
tardis/visualization/tools/tests/test_sdec_plot.py:338:9: F811 Redefinition of unused `test_generate_plot_mpl` from line 247
tardis/visualization/tools/tests/test_sdec_plot.py:415:85: W291 [*] Trailing whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:430:46: W291 [*] Trailing whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:431:60: W291 [*] Trailing whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:434:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:447:49: W291 [*] Trailing whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:451:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:457:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:485:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:532:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:536:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:538:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:550:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:553:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:556:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:563:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:564:53: W291 [*] Trailing whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:574:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:578:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:581:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:591:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:595:1: W293 [*] Blank line contains whitespace
tardis/visualization/tools/tests/test_sdec_plot.py:597:1: W293 [*] Blank line contains whitespace
tardis/visualization/widgets/tests/test_line_info.py:9:1: E402 Module level import not at top of file
tardis/workflows/simple_tardis_workflow.py:252:17: G004 Logging statement uses f-string
tardis/workflows/simple_tardis_workflow.py:480:17: G004 Logging statement uses f-string
Found 105 errors.
[*] 85 fixable with the `--fix` option (3 hidden fixes can be enabled with the `--unsafe-fixes` option).

@codecov
Copy link

codecov bot commented Sep 2, 2025

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 68.51%. Comparing base (f8a5efd) to head (083d089).
⚠️ Report is 12 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3277      +/-   ##
==========================================
+ Coverage   68.25%   68.51%   +0.26%     
==========================================
  Files         175      175              
  Lines       13337    13385      +48     
==========================================
+ Hits         9103     9171      +68     
+ Misses       4234     4214      -20     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@atharva-2001 atharva-2001 linked an issue Sep 8, 2025 that may be closed by this pull request
@atharva-2001 atharva-2001 marked this pull request as ready for review September 8, 2025 13:25
@atharva-2001 atharva-2001 changed the title Viz modules from_workflow tests Viz modules from_workflow tests Sep 8, 2025
@tardis-bot
Copy link
Contributor

tardis-bot commented Sep 8, 2025

*beep* *bop*
Hi human,
I ran benchmarks as you asked comparing master (f8a5efd) and the latest commit (083d089).
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 [6802bfaf] <master>   | After [083d089e]    | Ratio   | Benchmark (Parameter)                                                                                                               |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
|          | 25.9Β±7ΞΌs                     | 35.2Β±10ΞΌs           | ~1.36   | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
|          | 48.1Β±30ΞΌs                    | 62.1Β±30ΞΌs           | ~1.29   | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter                                          |
|          | 1.38Β±0.3ΞΌs                   | 1.75Β±0.5ΞΌs          | ~1.27   | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line                    |
|          | 2.67Β±0.4ms                   | 3.14Β±0.4ms          | ~1.18   | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop                        |
|          | 5.72Β±1ΞΌs                     | 6.49Β±1ΞΌs            | ~1.13   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket                                           |
|          | 491Β±200ns                    | 551Β±200ns           | ~1.12   | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation                              |
|          | 40.3Β±0.3s                    | 36.5Β±0.05s          | ~0.91   | run_tardis.BenchmarkRunTardis.time_run_tardis                                                                                       |
|          | 3.60Β±0.4ΞΌs                   | 3.13Β±0.5ΞΌs          | ~0.87   | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell                              |
|          | 1.12Β±0m                      | 57.6Β±0.05s          | ~0.86   | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking                                                                      |
|          | 3.57Β±0.01ms                  | 2.99Β±0.01ms         | ~0.84   | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter')                                     |
|          | 451Β±200ns                    | 481Β±200ns           | 1.07    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation                                      |
|          | 659Β±0.5ns                    | 704Β±0.8ns           | 1.07    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter                                       |
|          | 2.26Β±2ΞΌs                     | 2.34Β±2ΞΌs            | 1.04    | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators       |
|          | 37.2Β±0.03ΞΌs                  | 38.7Β±0.02ΞΌs         | 1.04    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list                  |
|          | 1.12Β±0ΞΌs                     | 1.16Β±0.01ΞΌs         | 1.03    | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary                |
|          | 4.25Β±0.02ms                  | 4.32Β±0.04ms         | 1.02    | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom')                                   |
|          | 2.55Β±0.02ms                  | 2.59Β±0.01ms         | 1.02    | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop                             |
|          | 58.2Β±0.5ms                   | 59.7Β±0.2ms          | 1.02    | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe                  |
|          | 3.51Β±0.6ΞΌs                   | 3.58Β±0.3ΞΌs          | 1.02    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket                                       |
|          | 1.06Β±0m                      | 1.05Β±0m             | 1.00    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions                                 |
|          | 1.17Β±0ΞΌs                     | 1.13Β±0ΞΌs            | 0.96    | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body                                       |
|          | 7.60Β±3ΞΌs                     | 7.29Β±2ΞΌs            | 0.96    | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley                                    |
|          | 510Β±200ns                    | 481Β±200ns           | 0.94    | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation                                |
|          | 42.7Β±20ΞΌs                    | 39.3Β±20ΞΌs           | 0.92    | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission                                         |

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

Copy link
Contributor

@andrewfullard andrewfullard left a comment

Choose a reason for hiding this comment

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

One minor change, add global RTOL to each test file set to 1e-12 and apply to tests

andrewfullard
andrewfullard previously approved these changes Sep 15, 2025
@andrewfullard andrewfullard enabled auto-merge (squash) September 15, 2025 14:26
self, plotter_calculate_plotting_data_from_workflow, sdec_regression_data
):
param_idx = plotter_calculate_plotting_data_from_workflow._param_idx
regression_file = sdec_regression_data / f"test_calculate_plotting_data__plotter_calculate_plotting_data{param_idx}__.h5"
Copy link
Contributor

Choose a reason for hiding this comment

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

I am very slightly worried about this because it seems like something we would have to manually update and wouldn't be generated by the normal regression data thing we do. Is that true? And if so would it be possible to stick it on to one of our sync methods somehow?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right now it compares to the existing saved regression data so that generating new one is not needed. Adding regression data would mostly mean duplicating the items already saved. Using the sync method will mean generating new data.I don't think we would want new data for a very similar functionality, would we? The workflows will always produce the same data the simulation produced with the same configuration right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see now. Yes, piggybacking off existing non-workflow regression data is fine and good and I'm happy with that. I will instead just request you add a comment at the top of the test that points this out explicitly because we will run into problems generating regression data if this test ever runs before that one. Currently that shouldn't happen since the workflow tests are run last, but we've moved tests around before and it'd be nice to know more easily if something breaks as a result.

@andrewfullard andrewfullard merged commit 2c37e97 into tardis-sn:master Sep 22, 2025
25 of 26 checks passed
@github-project-automation github-project-automation bot moved this from waiting for review to Done in DevOps Sep 22, 2025
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.

Make sure all visualizations work with Workflows (if possible)

5 participants