Quick Start

Loading SED and filters

SED fluxes and filter window functions are loaded from disk, and resampled to a common wavelength range.

>>> import pyraeus as pr
>>> w = arange (1e3,1e5,100)
>>> lst_sed  = pr.load_sed (['CWW_E_ext.sed', 'CWW_Sbc_ext.sed'],wrange=w)
>>> lst_filt = pr.load_filter (['up.res', 'gp.res', 'rp.res', 'ip.res', 'zp.res'], wrange=w)

File format is a simple 2 columns ascii files : wavenlength and associated flux or filter response.

Building an SED template library

The template library used for template fitting is built once for a given list of SEDs, filters, and redshift range. The corresponding magnitudes are stored in a record array.

>>> tpl_lib = pr.TemplateLibrary (lst_sed, lst_filt, zmin=0, zmax=2, zstep=0.1, set_mag=True)
>>> print tpl_lib.rec

Fitting photometric redshift from observational data

Observational data are loaded from a 2 dimensional ascii file, where columns for observed magnitudes and errors are given for each filter.

>>> cat = pr.Catalog.load ("some_cat.txt", mag_col=[2,3,4,5,6], err_col=[7,8,9,10,11])
>>> cat.fit_redshift (tpl_lib)
>>> print cat.zphot, cat.chi2

Fitted redhshifts with associated chi2 are stored as new attributes of the Catalog object. The input catalog can be replaced, with those two quantities added as first and second columns.

>>> cat.save("some_cat.txt")