Skip to content

Commit

Permalink
Added an sg module to collect spectrographic analyses. (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
byrdie authored Sep 12, 2024
1 parent 5b854bc commit 64e0279
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 31 deletions.
20 changes: 3 additions & 17 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,11 @@ and display as a false-color movie.
import iris

# Download a 320-step raster sequence
obs = iris.SpectrographObservation.from_time_range(
time_start=astropy.time.Time("2021-09-23T02:00"),
time_stop=astropy.time.Time("2021-09-23T03:00"),
obs = iris.sg.SpectrographObservation.from_time_range(
time_start=astropy.time.Time("2017-02-11T04:50"),
time_stop=astropy.time.Time("2017-02-11T05:00"),
)

# Crop the observation so readthedocs doesn't run out of memory.
# This is probably unnecessary on your machine
index = {obs.axis_wavelength: slice(75, 150)}
obs = dataclasses.replace(
obs,
inputs=na.TemporalSpectralPositionalVectorArray(
time=obs.inputs.time,
wavelength=obs.inputs.wavelength[index],
position=obs.inputs.position[index],
),
outputs=obs.outputs[index],
)


# Calculate the mean rest wavelength of the
# brightest spectral line
wavelength_center = obs.wavelength_center.ndarray.mean()
Expand Down
4 changes: 2 additions & 2 deletions iris/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

from . import planning
from . import data
from ._spectrograph import SpectrographObservation
from . import sg

__all__ = [
"planning",
"data",
"SpectrographObservation",
"sg",
]
16 changes: 10 additions & 6 deletions iris/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,21 @@ def urls_hek(
for group in event["groups"]:

url = group["comp_data_url"]
url = urlpath.URL(url)
url = urlpath.URL(*["data" if p == "data_lmsal" else p for p in url.parts])

url_str = str(url)

if spectrograph:
if "raster" in url:
result.append(urlpath.URL(url))
if "raster" in url_str:
result.append(url)
if sji:
if "SJI" in url:
if "deconvolved" in url:
if "SJI" in url_str:
if "deconvolved" in url_str:
if deconvolved:
result.append(urlpath.URL(url))
result.append(url)
else:
result.append(urlpath.URL(url))
result.append(url)

return result

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class SpectrographObservation(
import iris
# Load a 320-step raster
obs = iris.SpectrographObservation.from_time_range(
obs = iris.sg.SpectrographObservation.from_time_range(
time_start=astropy.time.Time("2021-09-23T06:00"),
time_stop=astropy.time.Time("2021-09-23T07:00"),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
@pytest.mark.parametrize(
argnames="array",
argvalues=[
iris.SpectrographObservation.from_time_range(
iris.sg.SpectrographObservation.from_time_range(
time_start=astropy.time.Time("2021-09-23T06:00"),
time_stop=astropy.time.Time("2021-09-23T07:00"),
)
],
)
class TestSpectrographObservation:

def test_axis_time(self, array: iris.SpectrographObservation):
def test_axis_time(self, array: iris.sg.SpectrographObservation):
assert isinstance(array.axis_time, str)

def test_axis_wavelength(self, array: iris.SpectrographObservation):
def test_axis_wavelength(self, array: iris.sg.SpectrographObservation):
assert isinstance(array.axis_wavelength, str)

def test_axis_detector_x(self, array: iris.SpectrographObservation):
def test_axis_detector_x(self, array: iris.sg.SpectrographObservation):
assert isinstance(array.axis_detector_x, str)

def test_axis_detector_y(self, array: iris.SpectrographObservation):
def test_axis_detector_y(self, array: iris.sg.SpectrographObservation):
assert isinstance(array.axis_detector_y, str)

0 comments on commit 64e0279

Please sign in to comment.