template_lsq

eazy.photoz.template_lsq(fnu_i, efnu_i, Ain, TEFz, zp, ndraws, fitter, renorm_t, hess_threshold)[source]

This is the main least-squares function for fitting templates to photometry at a given redshift

Parameters:
fnu_iarray (NFILT)

Flux densities, including extinction and zeropoint corrections

efnu_iarray (NFILT)

Uncertainties, including extinction and zeropoint corrections

Ainarray (NTEMP, NFILT)

Design matrix of templates integrated through filter bandpasses at a particular redshift, z (not specified but implicit)

TEFzarray (NFILT)

TemplateError evaluated at same redshift as A.

zparray (NFILT)

Multiplicative zeropoint corrections needed to back out from efnu_i and test for valid data

ndrawsint

If > 0, take ndraws random coefficient draws from fit covariance matrix

fitterstr

Template fitting method. The only stable option so far is ‘nnls’ for non-negative least squares with scipy.optimize.nnls, other options under development (e.g, ‘bounded’, ‘regularized’).

renorm_tbool

Normalize template arrays

hess_thresholdfloat

Calculate Hessian of the design matrix A.T.dot(A) and remove templates where the cross term is greater than this value to reduce some fitting degeneracies. The cross terms of the error-weighted, normalized template vectors will be equal to 1 when they are perfectly degenerate and zero when they are strictly orthogonal. Ignored if hess_threshold >= 1.

Returns:
chi2_ifloat

Chi-squared of the fit

coeffsarray (NTEMP)

Template coefficients

fmodelarray (NFILT)

Flux densities of the best-fit model

coeffs_drawarray (ndraws, NTEMP)

Random draws from covariance matrix, if ndraws > 0