Skip to content

SpectralGradient loses normalization wavelength #457

Open

Description

@mkelley

High-level problem description
Indexing an array of SpectralGraident values drops the normalization wavelength.

What did you do?

slopes = SpectralGradient(
    np.arange(-5, 21) * u.percent / sbu.hundred_nm,
    wave0=550 * u.nm,
)
print(slopes.wave0)
print(slopes[0].wave0)

What did you expect?

550.0 nm
550.0 nm

What did really happen?

550.0 nm
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[29], line 1
----> 1 print(slopes[0].wave0)

File ~/.venv/lib/python3.12/site-packages/astropy/units/quantity.py:1113, in Quantity.__getattr__(self, attr)
   1108 """
   1109 Quantities are able to directly convert to other units that
   1110 have the same physical type.
   1111 """
   1112 if not self._include_easy_conversion_members:
-> 1113     raise AttributeError(
   1114         f"'{self.__class__.__name__}' object has no '{attr}' member"
   1115     )
   1117 def get_virtual_unit_attribute():
   1118     registry = get_current_unit_registry().registry

AttributeError: 'SpectralGradient' object has no 'wave0' member

Provide information on your environment:
operating system and version: linux
sbpy version: 0.6.1.dev16
astropy version: 8.0.0
numpy version: 2.5.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    potential bugautomated label to indicate issue reports

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions