Skip to content

Commit

Permalink
added despiking
Browse files Browse the repository at this point in the history
  • Loading branch information
byrdie committed Nov 5, 2024
1 parent 90fd287 commit c68c5b8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions iris/sg/_spectrograph.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def from_time_range(
axis_wavelength: str = "wavelength",
axis_detector_x: str = "detector_x",
axis_detector_y: str = "detector_y",
despike: bool = True,
limit: int = 200,
num_retry: int = 5,
) -> "SpectrographObservation":
Expand Down Expand Up @@ -160,6 +161,9 @@ def from_time_range(
The logical axis corresponding to changes in detector :math:`x`-coordinate.
axis_detector_y
The logical axis corresponding to changes in detector :math:`y`-coordinate.
despike
Whether to remove cosmic ray spikes from the images using
:func:`named_arrays.despike`.
limit
The maximum number of observations returned by the query.
Note that this is not the same as the number of files since there
Expand Down Expand Up @@ -191,6 +195,7 @@ def from_time_range(
axis_wavelength=axis_wavelength,
axis_detector_x=axis_detector_x,
axis_detector_y=axis_detector_y,
despike=despike,
)

@classmethod
Expand All @@ -202,6 +207,7 @@ def from_fits(
axis_wavelength: str = "wavelength",
axis_detector_x: str = "detector_x",
axis_detector_y: str = "detector_y",
despike: bool = True,
) -> "SpectrographObservation":
"""
Given a single FITS file or an array of FITS files with the same OBSID,
Expand All @@ -221,6 +227,9 @@ def from_fits(
The logical axis corresponding to changes in detector :math:`x`-coordinate.
axis_detector_y
The logical axis corresponding to changes in detector :math:`y`-coordinate.
despike
Whether to remove cosmic ray spikes from the images using
:func:`named_arrays.despike`.
"""

path = na.asarray(path)
Expand Down Expand Up @@ -284,6 +293,12 @@ def from_fits(
)
data[data == -200 * u.DN] = np.nan

if despike:
data = na.despike(
array=data,
axis=(axis_wavelength, axis_detector_y),
)

self.outputs[index] = data / timedelta

time = astropy.time.Time(hdul[0].header["DATE_OBS"]).jd
Expand Down

0 comments on commit c68c5b8

Please sign in to comment.