Skip to content
Draft
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
1 change: 1 addition & 0 deletions changelog/232.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`~sunkit_instruments.response.SourceSpectra.temperature_response` now gives the same result whatever the wavelength unit of the spectra; spectra in units other than Angstrom gave a zero response.
9 changes: 9 additions & 0 deletions sunkit_instruments/response/tests/test_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ def test_spectra_repr(fake_spectra):
assert isinstance(fake_spectra.__repr__(), str)


def test_temperature_response_wavelength_unit(fake_channel, fake_spectra):
spectra_nm = SourceSpectra(
fake_spectra.temperature,
fake_spectra.wavelength.to("nm"),
fake_spectra.data.to("photon cm3 s-1 sr-1 nm-1"),
)
assert u.allclose(spectra_nm.temperature_response(fake_channel), fake_spectra.temperature_response(fake_channel))


@pytest.mark.parametrize('obstime', [None, '2020-01-01'])
def test_temperature_response(fake_channel, fake_spectra, obstime):
temp_response = fake_spectra.temperature_response(fake_channel, obstime=obstime)
Expand Down
4 changes: 2 additions & 2 deletions sunkit_instruments/response/thermal.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ def temperature_response(
wave_response.to_value(wave_response.unit),
dims=['wavelength'],
coords=[xarray.Variable('wavelength',
channel.wavelength.to_value('Angstrom'),
attrs={'unit': 'Angstrom'}),],
channel.wavelength.to_value(self._da.wavelength.unit),
attrs={'unit': self._da.wavelength.unit}),],
attrs={'unit': wave_response.unit.to_string()}
)
spec_interp = self._da.interp(
Expand Down
Loading