forked from USNavalResearchLaboratory/eispac
-
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.
Merge pull request USNavalResearchLaboratory#97 from wtbarnes/ccd-off…
…set-units Use units in `ccd_offset` function
- Loading branch information
Showing
3 changed files
with
28 additions
and
16 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
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
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 |
---|---|---|
@@ -1,18 +1,19 @@ | ||
import pytest | ||
|
||
import astropy.units as u | ||
import numpy as np | ||
|
||
from eispac.instr import ccd_offset | ||
|
||
|
||
@pytest.mark.parametrize('wavelength, idl_offset',[ | ||
(185.21, 16.992825), | ||
([185.21], 16.992825), | ||
(np.array([185.21]), 16.992825), | ||
(np.array([185.21, 195.119, 256.317, 258.375, 284.160]), | ||
[16.992825, 16.208033, 0.000239, -0.162755, -2.204928]) | ||
(185.21*u.Angstrom, 16.992825*u.pixel), | ||
([185.21]*u.Angstrom, 16.992825*u.pixel), | ||
(np.array([185.21])*u.Angstrom, 16.992825*u.pixel), | ||
(np.array([185.21, 195.119, 256.317, 258.375, 284.160])*u.Angstrom, | ||
[16.992825, 16.208033, 0.000239, -0.162755, -2.204928]*u.pixel) | ||
]) | ||
def test_ccd_offset(wavelength, idl_offset): | ||
offset = ccd_offset(wavelength) | ||
idl_offset = np.atleast_1d(idl_offset) | ||
assert np.allclose(offset, idl_offset, atol=1e-5, rtol=0) | ||
assert u.allclose(offset, idl_offset, atol=1e-5*u.pixel, rtol=0) |