Skip to content

Bugs on the quickstart page #341

@steveschulze

Description

@steveschulze

Hi,

While upgrading from Prospector 1.1 to 1.4, I realised some syntax has changed. To get an idea of how to update my script, I followed the demo on https://prospect.readthedocs.io/en/latest/quickstart.html. When I copy the different code blocks into a Jupyter Notebook, I encounter various errors, e.g.,

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Cell In[45], line 11
      7 magerr = np.hypot(magerr, 0.05)
      9 pdat = Photometry(filters=filters, flux=maggies, uncertainty=magerr*maggies[/1.086](http://localhost:8889/1.086),
     10                   name=f'sdss_phot_specobjID{cat[0]["specObjID"]}')
---> 11 sdat = Spectrum(wavelength=None, flux=None, uncertainty=None)
     12 observations = [pdat]
     13 for obs in observations:

File [~/prospector/prospector-1.4/prospect/observation/observation.py:334](http://localhost:8889/lab/tree/~/prospector/prospector-1.4/prospect/observation/observation.py#line=333), 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 [~/prospector/prospector-1.4/prospect/observation/observation.py:345](http://localhost:8889/lab/tree/~/prospector/prospector-1.4/prospect/observation/observation.py#line=344), 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 [~/prospector/prospector-1.4/prospect/observation/observation.py:354](http://localhost:8889/lab/tree/~/prospector/prospector-1.4/prospect/observation/observation.py#line=353), 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

Or the sampler is not defined.

Could you check all instructions on this page? (The demo Jupyter Notebook in the repo is also out of date.)

Cheers,

Steve

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions