-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added
optika.metrology.SlopeErrorParameters
class.
- Loading branch information
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from ._slope_error import * |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import abc | ||
import dataclasses | ||
import astropy.units as u | ||
import named_arrays as na | ||
import optika.mixins | ||
|
||
__all__ = [ | ||
"AbstractSlopeErrorParameters", | ||
"SlopeErrorParameters", | ||
] | ||
|
||
|
||
@dataclasses.dataclass(eq=False, repr=False) | ||
class AbstractSlopeErrorParameters( | ||
optika.mixins.Printable, | ||
): | ||
"""collection of parameters used to compute the slope error""" | ||
|
||
@property | ||
@abc.abstractmethod | ||
def kernel_size(self) -> na.ScalarLike: | ||
""" | ||
size of the boxcar kernel that is convolved with the wavefront error | ||
before measuring the slope | ||
""" | ||
|
||
@property | ||
@abc.abstractmethod | ||
def step_size(self) -> na.ScalarLike: | ||
"""the horizontal distance to use when measuring the slope""" | ||
|
||
|
||
@dataclasses.dataclass(eq=False, repr=False) | ||
class SlopeErrorParameters( | ||
AbstractSlopeErrorParameters, | ||
): | ||
kernel_size: na.ScalarLike = 0 * u.mm | ||
step_size: na.ScalarLike = 0 * u.mm |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pytest | ||
import abc | ||
import numpy as np | ||
import astropy.units as u | ||
import named_arrays as na | ||
import optika | ||
|
||
|
||
class AbstractTestAbstractSlopeErrorParameters(abc.ABC): | ||
def test_kernel_size(self, a: optika.metrology.AbstractSlopeErrorParameters): | ||
assert np.issubdtype(na.get_dtype(a.kernel_size), float) | ||
assert na.unit_normalized(a.kernel_size).is_equivalent(u.mm) | ||
|
||
def test_step_size(self, a: optika.metrology.AbstractSlopeErrorParameters): | ||
assert np.issubdtype(na.get_dtype(a.step_size), float) | ||
assert na.unit_normalized(a.step_size).is_equivalent(u.mm) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
argnames="a", | ||
argvalues=[ | ||
optika.metrology.SlopeErrorParameters( | ||
kernel_size=2 * u.mm, | ||
step_size=4 * u.mm, | ||
) | ||
], | ||
) | ||
class TestSlopeErrorParameters( | ||
AbstractTestAbstractSlopeErrorParameters, | ||
): | ||
pass |