Skip to content

Commit 640708e

Browse files
authored
Added iris.sg.background module for FUV background subtraction. (#9)
1 parent 0e79dda commit 640708e

File tree

7 files changed

+881
-4
lines changed

7 files changed

+881
-4
lines changed

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ and display as a false-color movie.
7474
velocity_max = +100 * u.km / u.s
7575

7676
# Define the spectral normalization curve
77-
spd_max = np.percentile(
77+
spd_max = np.nanpercentile(
7878
a=obs.outputs,
7979
q=99.5,
8080
axis=axis_txy,

iris/sg/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
Represent and manipulate data captured using the IRIS spectrograph
33
"""
44

5+
from . import background
56
from ._spectrograph import SpectrographObservation
67

78
__all__ = [
9+
"background",
810
"SpectrographObservation",
911
]

iris/sg/_spectrograph.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class SpectrographObservation(
6060
wavelength=obs.inputs.wavelength.mean(("detector_x", "detector_y")),
6161
axis=obs.axis_wavelength,
6262
spd_min=0 * u.DN,
63-
spd_max=np.percentile(
63+
spd_max=np.nanpercentile(
6464
a=obs.outputs,
6565
q=99,
6666
axis=(obs.axis_time, obs.axis_detector_x, obs.axis_detector_y),
@@ -316,7 +316,10 @@ def from_fits(
316316
self.inputs.time.ndarray = astropy.time.Time(
317317
val=self.inputs.time.ndarray,
318318
format="jd",
319-
).isot
319+
)
320+
321+
where_invalid = self.outputs < -10 * u.DN
322+
self.outputs[where_invalid] = np.nan
320323

321324
return self
322325

iris/sg/background/__init__.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""
2+
Utilities for estimating the stray light background of FUV spectrograph images.
3+
"""
4+
5+
from ._background import (
6+
model_background,
7+
model_spectral_line,
8+
model_total,
9+
fit,
10+
average,
11+
subtract_spectral_line,
12+
smooth,
13+
estimate,
14+
)
15+
16+
__all__ = [
17+
"model_background",
18+
"model_spectral_line",
19+
"model_total",
20+
"fit",
21+
"average",
22+
"subtract_spectral_line",
23+
"smooth",
24+
"estimate",
25+
]

0 commit comments

Comments
 (0)