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

Bump named-arrays to 0.14.2 #18

Merged
merged 7 commits into from
Nov 3, 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
17 changes: 11 additions & 6 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ and display as a false-color movie.

# Take the mean of the wavelength over the spatial
# and temporal axes since it is constant
wavelength = obs.inputs.wavelength.mean(axis_txy)
wavelength = obs.inputs.wavelength.mean(obs.axis_time)

# Convert to Doppler velocity
velocity = wavelength.to(
Expand Down Expand Up @@ -92,9 +92,6 @@ and display as a false-color movie.
wavelength_max=velocity_max,
)

# Isolate the angular position of each RGB point
position = obs.inputs.position.mean(obs.axis_wavelength)

# Display the result as an RGB movie
with astropy.visualization.quantity_support():
fig, ax = plt.subplots(
Expand All @@ -105,8 +102,8 @@ and display as a false-color movie.
)
ani = na.plt.pcolormovie(
obs.inputs.time,
position.x,
position.y,
obs.inputs.position.x,
obs.inputs.position.y,
C=rgb,
axis_time=obs.axis_time,
axis_rgb=obs.axis_wavelength,
Expand All @@ -131,6 +128,14 @@ and display as a false-color movie.
IPython.display.HTML(ani.to_jshtml())


References
==========

.. bibliography::

|


Indices and tables
==================

Expand Down
7 changes: 2 additions & 5 deletions iris/sg/_spectrograph.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class SpectrographObservation(
# red/green/blue channels
rgb, colorbar = na.colorsynth.rgb_and_colorbar(
spd=obs.outputs,
wavelength=obs.inputs.wavelength.mean(("detector_x", "detector_y")),
wavelength=obs.inputs.wavelength.mean(obs.axis_time),
axis=obs.axis_wavelength,
spd_min=0 * u.DN,
spd_max=np.nanpercentile(
Expand All @@ -70,9 +70,6 @@ class SpectrographObservation(
wavelength_max=wavelength_max,
)

# Isolate the angular position of each RGB point
position = obs.inputs.position.mean(obs.axis_wavelength)

# Isolate the first raster of the observation
index = {obs.axis_time: 0}

Expand All @@ -85,7 +82,7 @@ class SpectrographObservation(
constrained_layout=True,
)
na.plt.pcolormesh(
position[index],
obs.inputs.position[index],
C=rgb[index],
axis_rgb=obs.axis_wavelength,
ax=ax[0],
Expand Down
17 changes: 9 additions & 8 deletions iris/sg/background/_background.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ def average(
)
"""
obs = obs.copy_shallow()
shape = obs.shape
obs.inputs = na.TemporalSpectralPositionalVectorArray(
time=obs.inputs.time.ndarray.jd.mean(),
wavelength=obs.inputs.wavelength.mean(axis),
position=obs.inputs.position.mean(axis),
wavelength=obs.inputs.wavelength.broadcast_to(shape).mean(axis),
position=obs.inputs.position.broadcast_to(shape).mean(axis),
)
obs.outputs = np.nanmedian(obs.outputs, axis=axis)
return obs
Expand Down Expand Up @@ -740,17 +741,17 @@ def estimate(
)
ax[0].set_title("original")
na.plt.pcolormesh(
obs.inputs.position.x[index].mean(obs.axis_wavelength),
obs.inputs.position.y[index].mean(obs.axis_wavelength),
obs.inputs.position.x[index],
obs.inputs.position.y[index],
C=np.nanmean(obs.outputs.value[index], axis=obs.axis_wavelength),
ax=ax[0],
norm=mappable.norm,
cmap=mappable.cmap,
)
ax[1].set_title("corrected")
na.plt.pcolormesh(
obs_nobg.inputs.position.x[index].mean(obs.axis_wavelength),
obs_nobg.inputs.position.y[index].mean(obs.axis_wavelength),
obs_nobg.inputs.position.x[index],
obs_nobg.inputs.position.y[index],
C=np.nanmean(obs_nobg.outputs.value[index], axis=obs.axis_wavelength),
ax=ax[1],
norm=mappable.norm,
Expand Down Expand Up @@ -781,12 +782,12 @@ def estimate(
with astropy.visualization.quantity_support():
fig, ax = plt.subplots()
na.plt.plot(
obs.inputs.wavelength.mean(axis=axis_txy),
obs.inputs.wavelength.mean(obs.axis_time),
np.nanmedian(obs.outputs, axis=axis_txy),
label="original",
)
na.plt.plot(
obs_nobg.inputs.wavelength.mean(axis=axis_txy),
obs_nobg.inputs.wavelength.mean(obs.axis_time),
np.nanmedian(obs_nobg.outputs, axis=axis_txy),
label="corrected",
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ classifiers = [
dependencies = [
"astropy",
"requests",
"named-arrays==0.14.1",
"named-arrays==0.14.2",
]
dynamic = ["version"]

Expand Down
Loading