Refactor .apply_to() in electronic effects - #1006
Open
teutoburg wants to merge 2 commits into
Open
Conversation
See #1002 for details and explanation. - Add `Detector.data` property setter to eleminate external access of `Detector._hdu` attribute. - Turn various effect attributes which need currsys/meta resolving into properties. This allows to encapsulate the resolving and make calls to the attributes much cleaner. **If we ever make effects dataclasses with explicit attribute fields rather than kwargs, this will make that process much smoother, because accessing a dataclass field looks identical to accessing a property, we just remove the property definitions then**. - Anything that the `.__call__()` needs, which is taken from the `obj` (in this case usually `Detector`), is resolved before and passed to `.__call__()` as an argument. That means the latter doesn't need to know about `obj`, which is cleaner and matches the PSF case. - I think there are now a few new `np.random.default_rng` cases. This was taken from a branch I started several months ago and forgot about in the much more recent discussion about those. Might not be final. This isn't completely exhaustive for all the effects here, but I tried to cover the "standard" ones...
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1006 +/- ##
==========================================
+ Coverage 76.30% 76.47% +0.17%
==========================================
Files 69 69
Lines 9057 9111 +54
==========================================
+ Hits 6911 6968 +57
+ Misses 2146 2143 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
Additional note: This reverts some of the "in-place modifications" of |
teutoburg
marked this pull request as ready for review
August 31, 2026 21:30
Somehow forgotten in the previous commit...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #1002 for details and explanation.
Detector.dataproperty setter to eleminate external access ofDetector._hduattribute..__call__()needs, which is taken from theobj(in this case usuallyDetector), is resolved before and passed to.__call__()as an argument. That means the latter doesn't need to know aboutobj, which is cleaner and matches the PSF case.np.random.default_rngcases. This was taken from a branch I started several months ago and forgot about in the much more recent discussion about those. Might not be final.This isn't completely exhaustive for all the effects here, but I tried to cover the "standard" ones...