cylammarco / ASPIRED

Automated SpectroPhotometric Image REDuction (ASPIRED)
https://aspired.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
30 stars 4 forks source link

compute_sencurve(), spectres() limit bound error #1

Closed rjs3273 closed 5 years ago

rjs3273 commented 5 years ago

Just in order to get an idea of how a basic reduction would flow, I have been running the included Jupyter notebooks. They seem to work fine for me up to compute_sencurve() where they generate an exception in spectres.

Python v3.7.4 ASPIRED version: git cloned today 2019-09-13 spectres v2.0.0


ValueError Traceback (most recent call last)

in 2 lhs6328_reduced = aspired.OneDSpec(lhs6328, wavecal, standard=hilt102, wave_cal_std=wavecal, flux_cal=fluxcal) 3 lhs6328_reduced.apply_wavelength_calibration('all') ----> 4 lhs6328_reduced.compute_sencurve(kind='cubic') 5 lhs6328_reduced.inspect_sencurve() /data/LT/Commissioning/SPRAT/Aspired/ASPIRED/aspired/aspired.py in compute_sencurve(self, kind, smooth, slength, sorder, display) 1414 # resampling both the observed and the database standard spectra 1415 # in unit of flux per second -> 1416 flux_std = spectres(self.wave_std_true, self.wave_std, self.adu_std / self.exptime_std) 1417 flux_std_true = self.fluxmag_std_true 1418 else: ~/miniconda2/envs/astroconda/lib/python3.7/site-packages/spectres/spectral_resampling.py in spectres(new_spec_wavs, old_spec_wavs, spec_fluxes, spec_errs) 70 # Check that the range of wavelengths to be resampled_fluxes onto falls within the initial sampling region 71 if filter_lhs[0] < spec_lhs[0] or filter_lhs[-1] > spec_lhs[-1]: ---> 72 raise ValueError("spectres: The new wavelengths specified must fall within the range of the old wavelength values.") 73 74 #Generate output arrays to be populated ValueError: spectres: The new wavelengths specified must fall within the range of the old wavelength values.
cylammarco commented 5 years ago

This is due to a minor bug in defining the wavelength range in the master branch of the spectres package. I have my own forked version to make it work:

https://github.com/cylammarco/SpectRes

I have made a pull request to ACCarnall and waiting.

cylammarco commented 5 years ago

I have set up the dependencies properly in the setup.py now, this should fix the problem when installing with pip.

cylammarco commented 4 years ago

Dependency is switched to the official distribution: spectres~=2.1.1