Closed moustakas closed 8 years ago
How did you check that your wavelengths are monotonically increasing? This test indicates that they are not:
flux, wave, meta = read_basis_templates(objtype='ELG')
np.any(np.diff(wave) <= 0)
On closer inspection, there are 12 bins with zero size (shown in red below) and the dynamic range of your bin sizes is impressive (> 10 orders of magnitude !):
def plot_dwave(wave):
dwave = np.diff(wave)
ok = dwave > 0
plt.plot(wave[1:][ok], dwave[ok], 'b.')
bad = np.where(dwave <= 0)[0]
for w in wave[1:][bad]:
plt.axvline(w, color='r')
plt.xscale('log')
plt.yscale('log')
plt.xlim(wave[0], wave[-1])
plt.xlabel('Wavelength [A]')
plt.ylabel('Bin Size [A]')
plt.grid()
I was using np.flop in Python and my own 'monotonic' function in IDL to check this, neither of which considered repeated values...argh! In any case, indeed there were a handful of repeated wavelengths which took some time to track down. Remaking the ELG and BGS templates now, ensuring both sorted and unique wavelengths...
np.flop?? (the top search result from google takes me to the Tuscarawas County Public Library, so I am intrigued!)
Oops, I meant np.roll() Although the selection of Betamax videos at the Tuscarawas Library is awesome.
I've double- and triple-checked that the wavelength array for the ELG basis spectra is monotonically increasing, and yet speclite.filters is still throwing an error: