Closed sbailey closed 6 years ago
Some background: stars with temperatures below 3500 K were drawn from a separate set of models (the BT-Settle grid, computed using the Phoenix code) and I incorrectly assumed that the wavelengths of all the models were "in air".
I'll regenerate the stellar templates to fix this.
I just generated a v2.2 set of stellar templates to address this bug, and bumped the version of the basis templates to v2.5. To get the latest set of templates (e.g., on your laptop) do
cd $DESI_ROOT/spectro/templates/basis_templates
svn export svn+ssh://portal-auth.nersc.gov/global/project/projectdirs/desi/spectro/calib/svn/basis_templates/tags/v2.5
and then be sure to update the corresponding environment variable
export DESI_BASIS_TEMPLATES=${DESI_ROOT}/spectro/templates/basis_templates/v2.5
For NERSC @sbailey or @weaverba137 should update the desisim.module
file -- I won't mess with this.
See below for the QA. @londumas please let me know if this doesn't fix https://github.com/desihub/redrock/issues/63, or if you find any other problems.
import numpy as np
import matplotlib.pyplot as plt
from desisim.io import read_basis_templates
flux, wave, meta = read_basis_templates(objtype='STAR')
isMstar = (2400 <= meta['TEFF']) & (meta['TEFF'] <= 3700)
isKstar = (3700 <= meta['TEFF']) & (meta['TEFF'] <= 5200)
flux = flux[isMstar | isKstar]
meta = meta[isMstar | isKstar]
isMstar = (2400 <= meta['TEFF']) & (meta['TEFF'] <= 3700)
isKstar = (3700 <= meta['TEFF']) & (meta['TEFF'] <= 5200)
#- Normalize flux to CaII region
ii = (8490 < wave) & (wave < 8560)
for i in range(flux.shape[0]):
flux[i] /= np.sum(flux[i,ii])
for i, teff in enumerate(sorted(set(meta['TEFF']))):
jj = meta['TEFF'] == teff
y = 0.001*i + flux[jj].mean(axis=0)[ii]
plt.plot(wave[ii], y, label='{:.0f}'.format(teff))
plt.text(8491, y[0], '{:.0f}'.format(teff), verticalalignment='center')
plt.xlim(8490, 8560)
plt.ylabel('Flux + offset')
plt.xlabel('Rest wavelength')
plt.savefig('stars-v2.2.png')
For the record: I updated desisim.modules in master to point to basis templates v2.5. Existing desisim tags will not be updated, but this will be included in the next desisim tag.
There is a sudden jump in the wavelength solution of stars between TEFF=3500 and TEFF=3400. Plot and code below. Originally from desihub/redrock#63.