-
-
Notifications
You must be signed in to change notification settings - Fork 41
Add error propagation estimates for BoxcarExtract and HorneExtract #286
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
base: main
Are you sure you want to change the base?
Conversation
Also currently working on issue #281 as well |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #286 +/- ##
==========================================
- Coverage 87.11% 86.68% -0.44%
==========================================
Files 15 15
Lines 1281 1419 +138
==========================================
+ Hits 1116 1230 +114
- Misses 165 189 +24 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Promising work @harry353! Here are a couple of initial comments. Can you ensure that the tests you've written run without errors and check also the code style (I'd recommend running your code through black).
@@ -194,6 +194,139 @@ class BoxcarExtract(SpecreduceOperation): | |||
def spectrum(self): | |||
return self.__call__() | |||
|
|||
def _variance2d_from_image(self, image): |
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.
You can simplify uncertainty parsing because the _ImageParser._parse_image
method always assures that the image.uncertainty
attribute always exists, and is a subclass of astropy.nddata.NDUncertainty
.
specreduce/extract.py
Outdated
@@ -673,6 +919,7 @@ def __call__( | |||
bkgrd_prof = models.Polynomial1D(2) | |||
|
|||
self.image = self._parse_image(image, variance, mask, unit, disp_axis) | |||
var2d_q = self._var2d_as_quantity() |
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.
var2d_q
is not used later in the code.
specreduce/extract.py
Outdated
@@ -565,6 +783,34 @@ def _fit_spatial_profile( | |||
|
|||
return RectBivariateSpline(x=bin_centers, y=np.arange(nrows), z=samples, kx=kx, ky=ky) | |||
|
|||
def _var2d_as_quantity(self) -> u.Quantity: |
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.
This utility method is not really needed. The HorneExtract._parse_image
method already ensures that the image.uncertainty
attribute exists and contains a VarianceUncertainty
uncertainty.
This changes how uncertainties are handled in:
BoxcarExtract.__call__
HorneExtract.__call__
HorneExtract._fit_gaussian_spatial_profile
as described in #282. Now they:
Also, I have added test scripts under the
tests
directory, as well as a .ipynb file for the Horne case with some examples.