def get_template(redmonster_file, n_template): # n_template puede ser 1,2 o 3 o 4 o 5
hdulist = fits.open(redmonster_file)
templates = hdulist[2]
table = hdulist[1].data
Z = 'Z' + str(n_template)
Z_ERR = 'Z_ERR' + str(n_template)
MINRCHI2 = 'MINRCHI2' + str(n_template)
CLASS = 'CLASS' + str(n_template)
z_template = table[Z][0]
z_err_template = table[Z_ERR][0]
class_template = table[CLASS][0]
minchi_template = table[MINRCHI2][0]
index_template = n_template - 1
template = hdulist[2].data[0][index_template]
n = len(template)
COEFF0 = hdulist[0].header['COEFF0']
COEFF1 = hdulist[0].header['COEFF1']
NAXIS1 = n
WAVE_END = COEFF0 + (NAXIS1 - 1) * COEFF1
wave_log = np.linspace(COEFF0, WAVE_END, n)
wave = 10 ** wave_log
return wave, template, z_template, class_template, minchi_template, z_err_template
评论列表
文章目录