Skip to content

Commit

Permalink
Added iris.sg.background module for FUV background subtraction. (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
byrdie authored Sep 12, 2024
1 parent 0e79dda commit 640708e
Show file tree
Hide file tree
Showing 7 changed files with 881 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ and display as a false-color movie.
velocity_max = +100 * u.km / u.s

# Define the spectral normalization curve
spd_max = np.percentile(
spd_max = np.nanpercentile(
a=obs.outputs,
q=99.5,
axis=axis_txy,
Expand Down
2 changes: 2 additions & 0 deletions iris/sg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
Represent and manipulate data captured using the IRIS spectrograph
"""

from . import background
from ._spectrograph import SpectrographObservation

__all__ = [
"background",
"SpectrographObservation",
]
7 changes: 5 additions & 2 deletions iris/sg/_spectrograph.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class SpectrographObservation(
wavelength=obs.inputs.wavelength.mean(("detector_x", "detector_y")),
axis=obs.axis_wavelength,
spd_min=0 * u.DN,
spd_max=np.percentile(
spd_max=np.nanpercentile(
a=obs.outputs,
q=99,
axis=(obs.axis_time, obs.axis_detector_x, obs.axis_detector_y),
Expand Down Expand Up @@ -316,7 +316,10 @@ def from_fits(
self.inputs.time.ndarray = astropy.time.Time(
val=self.inputs.time.ndarray,
format="jd",
).isot
)

where_invalid = self.outputs < -10 * u.DN
self.outputs[where_invalid] = np.nan

return self

Expand Down
25 changes: 25 additions & 0 deletions iris/sg/background/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
Utilities for estimating the stray light background of FUV spectrograph images.
"""

from ._background import (
model_background,
model_spectral_line,
model_total,
fit,
average,
subtract_spectral_line,
smooth,
estimate,
)

__all__ = [
"model_background",
"model_spectral_line",
"model_total",
"fit",
"average",
"subtract_spectral_line",
"smooth",
"estimate",
]
Loading

0 comments on commit 640708e

Please sign in to comment.