Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an sg module to collect spectrographic analyses. #7

Merged
merged 7 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading