-
-
Notifications
You must be signed in to change notification settings - Fork 453
Refactor opacity state handling and imports #3264
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
Refactor opacity state handling and imports #3264
Conversation
…ionType class in interaction.py
…date related tests
|
*beep* *bop* Details2 I001 [*] unsorted-imports
1 F401 [*] unused-import
1 RET506 [*] superfluous-else-raise
Found 4 errors.
[*] 4 fixable with the `--fix` option.
Complete output(might be large): Detailsbenchmarks/benchmark_base.py:1:1: I001 [*] Import block is un-sorted or un-formatted
benchmarks/benchmark_base.py:74:9: RET506 [*] Unnecessary `else` after `raise` statement
tardis/transport/montecarlo/tests/conftest.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/transport/montecarlo/tests/conftest.py:7:44: F401 [*] `tardis.opacities.opacity_state.opacity_state_initialize` imported but unused
Found 4 errors.
[*] 4 fixable with the `--fix` option.
|
…initialization and documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors opacity state handling by migrating the OpacityState class to a new numba-based implementation and reorganizes imports for better code organization. The changes improve performance through numba optimization while maintaining the same functionality.
- Migrates opacity state initialization from
numba_interfaceto a dedicatedopacity_state_numbamodule - Moves
LineInteractionTypeenum fromnumba_interfaceto theinteractionmodule - Updates all import statements and function calls to use the new module locations
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tardis/opacities/opacity_state_numba.py | Replaces old spec-based jitclass with modern type annotations and improves documentation |
| tardis/transport/montecarlo/interaction.py | Adds LineInteractionType enum definition and removes old import |
| tardis/transport/montecarlo/tests/test_interaction.py | Updates import to use LineInteractionType from new location |
| tardis/transport/montecarlo/tests/conftest.py | Updates import and function call to use new opacity state initialization |
| tardis/transport/montecarlo/configuration/base.py | Updates import to use LineInteractionType from new location |
| benchmarks/benchmark_base.py | Updates import and function call to use new opacity state initialization |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| ] | ||
| @jitclass | ||
| class OpacityStateNumba: | ||
| electron_density: nb.float64[:] # type: ignore[misc] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what those comments are for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to make sure the lint4er doesn't go nuts
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3264 +/- ##
==========================================
- Coverage 74.11% 73.92% -0.19%
==========================================
Files 259 259
Lines 17866 17886 +20
==========================================
- Hits 13241 13223 -18
- Misses 4625 4663 +38 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <[email protected]>
Refactor the opacity state initialization to utilize a numba implementation for improved performance and update related tests. Additionally, streamline imports and introduce a new
LineInteractionTypeclass for better organization.