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

development version error when creating empty Spectrum object #352

Open
kevinhainline opened this issue Oct 18, 2024 · 1 comment
Open

Comments

@kevinhainline
Copy link

When using the development version, running this:
% sdat = Spectrum(wavelength=None, flux=None, uncertainty=None)

results in an error:

File ~/miniconda3/envs/prospector/lib/python3.10/site-packages/prospect/observation/observation.py:334, in Spectrum.__init__(self, wavelength, resolution, response, name, lambda_pad, **kwargs)
    332 self.response = response
    333 self.instrument_smoothing_parameters = dict(smoothtype="vel", fftsmooth=True)
--> 334 self.wavelength = np.atleast_1d(wavelength)

File ~/miniconda3/envs/prospector/lib/python3.10/site-packages/prospect/observation/observation.py:345, in Spectrum.wavelength(self, wave)
    343 if self._wavelength is not None:
    344     assert np.all(np.diff(self._wavelength) > 0)
--> 345     self.pad_wavelength_array()

File ~/miniconda3/envs/prospector/lib/python3.10/site-packages/prospect/observation/observation.py:354, in Spectrum.pad_wavelength_array(self)
    351 if self.wavelength is None:
    352     return
--> 354 low_pad = np.arange(self.lambda_pad, 1, (self.wavelength[0]-self.wavelength[1]))
    355 hi_pad = np.arange(1, self.lambda_pad, (self.wavelength[-1]-self.wavelength[-2]))
    356 wave_min = self.wave_min - low_pad

IndexError: index 1 is out of bounds for axis 0 with size 1

This will also effect using from_oldstyle on observations that only have photometry.

@bd-j
Copy link
Owner

bd-j commented Oct 18, 2024

I think this is related to #341 and tests needs to be added/improved for a likelihood calculation, prediction, and .rectify() in the case of no data.

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

No branches or pull requests

2 participants