Skip to content

Comments

[GSoC] Rename MonteCarloTransportState.opacity_state to opacity_state_numba#3412

Open
Manivenkat3612 wants to merge 2 commits intotardis-sn:masterfrom
Manivenkat3612:rename-opacity-state-numba
Open

[GSoC] Rename MonteCarloTransportState.opacity_state to opacity_state_numba#3412
Manivenkat3612 wants to merge 2 commits intotardis-sn:masterfrom
Manivenkat3612:rename-opacity-state-numba

Conversation

@Manivenkat3612
Copy link

@Manivenkat3612 Manivenkat3612 commented Feb 8, 2026

Closes #3206

📝 Description

Type: 📝 codestyle

Renames the opacity_state attribute in MonteCarloTransportState to opacity_state_numba to clearly distinguish it from the non-numba OpacityState DataFrame version (sim.opacity_state) added in PR #3205.

Context:

  • PR Add the non-numba opacity_state as a attribute of the simulation object #3205 added sim.opacity_state (non-numba DataFrame version) to the Simulation class for use with functions like get_tau_integ() that require DataFrame indexing
  • However, transport_state.opacity_state also existed but stored the numba-compatible version
  • This naming overlap caused confusion about which version is which

Changes:

  • Renamed parameter and attribute in MonteCarloTransportState.__init__: opacity_stateopacity_state_numba
  • Updated all usages in:
    • base.py
    • base.py
    • simple_tardis_workflow.py
    • standard_tardis_workflow.py
    • transport_montecarlo_main_loop.py

After this PR:

  • sim.opacity_state → non-numba DataFrame version (for get_tau_integ, formal integral, etc.)
  • transport_state.opacity_state_numba → numba-compatible version (for Monte Carlo transport)

📌 Resources

🚦 Testing

How did you test these changes?

  • Testing pipeline
  • Other method (describe)
    • Verified all imports work correctly
    • Ran transport tests (20 passed)
    • Ran spectrum tests (46 passed)
    • Verified no remaining references to old attribute name
  • 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
  • My changes can't be tested

Closes tardis-sn#3206

Renames the opacity_state attribute in MonteCarloTransportState to
opacity_state_numba to clearly distinguish it from the non-numba
OpacityState DataFrame version (sim.opacity_state) added in PR tardis-sn#3205.
@tardis-bot
Copy link
Contributor

*beep* *bop*

Hi, human.

I'm the @tardis-bot and couldn't find your records in my database. I think we don't know each other, or you changed your credentials recently.

Please add your name and email to .mailmap in your current branch and push the changes to this pull request.

In case you need to map an existing alias, follow this example.

@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
your.email@example.com,0000-0000-0000-0000

@tardis-bot
Copy link
Contributor

tardis-bot commented Feb 8, 2026

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

Details
538	      	[ ] syntax-error
10	G004  	[ ] logging-f-string
1	W291  	[ ] trailing-whitespace
1	B019  	[ ] cached-instance-method
1	F401  	[*] unused-import
1	I001  	[*] unsorted-imports
1	TRY300	[ ] try-consider-else
Found 553 errors.
[*] 2 fixable with the `--fix` option.

Complete output(might be large):

Details
benchmarks/transport_montecarlo_main_loop.py:20:5: B019 Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
tardis/simulation/base.py:264:17: G004 Logging statement uses f-string
tardis/simulation/base.py:447:13: G004 Logging statement uses f-string
tardis/simulation/base.py:564:13: G004 Logging statement uses f-string
tardis/simulation/base.py:657:13: G004 Logging statement uses f-string
tardis/simulation/base.py:662:13: G004 Logging statement uses f-string
tardis/simulation/base.py:713:13: TRY300 Consider moving this statement to an `else` block
tardis/simulation/base.py:715:26: G004 Logging statement uses f-string
tardis/transport/montecarlo/base.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/transport/montecarlo/base.py:31:5: F401 [*] `tardis.transport.montecarlo.packets.trackers.tracker_last_interaction.TrackerLastInteraction` imported but unused
tardis/workflows/simple_tardis_workflow.py:269:17: G004 Logging statement uses f-string
tardis/workflows/simple_tardis_workflow.py:525:17: G004 Logging statement uses f-string
tardis/workflows/standard_tardis_workflow.py:170:13: G004 Logging statement uses f-string
tardis/workflows/standard_tardis_workflow.py:210:17: G004 Logging statement uses f-string
Found 14 errors.
[*] 2 fixable with the `--fix` option.

@Manivenkat3612
Copy link
Author

Manivenkat3612 commented Feb 8, 2026

I have addressed the bot's feedback regarding mailmap, and ORCID. The benchmarks seem to be failing on the master branch as well. Ready for review @andrewfullard @atharva-2001.

@Manivenkat3612
Copy link
Author

Is there anything more to be done in this issue?@andrewfullard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename simulation.transport.transport_state.opacity_state

3 participants