astropy / astropy/specutils

Spectrum1D WCS has wrong number of dimensions as an NDCube

Open
#1,108 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
204
Forks
134
Avg merge
12h 55m
Merged PRs (30d)
1

Description

As per title, it looks like that the dimensions of the WCS of Spectrum1D objects are not parsed correctly into the NDCube data class, as shown by the following snippet:

```python
import numpy as np
import astropy.units as u
from specutils import Spectrum1D
from astropy.modeling import models

wl = np.linspace(4000,12000,128)*u.angstrom
flux_1 = models.BlackBody(temperature=5800*u.K)(wl)
flux_2 = models.BlackBody(temperature=4800*u.K)(wl)
flux_3 = models.BlackBody(temperature=6800*u.K)(wl)
flux = np.array([flux_1, flux_2, flux_3])*flux_1.unit

spec = Spectrum1D(spectral_axis=wl, flux=flux)
print(spec.wcs.pixel_n_dim)
```

which returns

```
1
```

while it should be 3.

Contributor guide

Open the contributing guide

Research direction

Run the supplied Python example and inspect how Spectrum1D constructs its WCS before it is exposed through the NDCube data class. Trace the reported pixel_n_dim value for the three-row flux array, then verify that the corrected result is 3 and add a regression check for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.