This page was created by the IDL library routine
make_html_help. For more information on
this routine, refer to the IDL Online Help Navigator
or type:
? make_html_help
at the IDL command line prompt.
Last modified: Wed Sep 21 18:27:43 2005.
NAME:
deep_kcorrect
PURPOSE:
calculate K-corrections for standard DEEP input (from BRI to NUB)
CALLING SEQUENCE:
kcorrect= deep_kcorrect(redshift [, nmgy=, ivar=, mag=, err=, $
zcat=, /sdss, band_shift=, chi2=, rmaggies=, $
omaggies=, vname=, oivar=, mass=, mtol=, $
absmag=, amivar=, omega0=, omegal0= ])
INPUTS:
redshift - [N] redshifts
zcat - [N] DEEP zcat-style structure, containing:
.MAGB
.MAGR
.MAGI
.SFD_EBV
nmgy, ivar - [3, N] nanomaggies, Galactic-reddening corrected, and inverse
variance of same
mag, err - [3, N] Pogson magnitudes, Galactic-reddening corrected and
errors of same
OPTIONAL INPUTS:
band_shift - blueshift of output bandpasses (to get ^{z}b
type bands) [default 0.]
vname - name of fit to use (defaults to 'default')
omega0, omegal0 - cosmological parameters for calculating distance
moduli [default 0.3, 0.7]
OPTIONAL KEYWORDS:
/closest - use closest bands for K-corrections
OUTPUTS:
kcorrect - [3, N] K-corrections from BRI to NUV, U, and B (or NUV,
u, g if /sdss is set) satisfying
m_R = M_Q + DM(z) + K_QR(z)
based on the best fit sum of templates. All magnitudes
are AB.
mtol - [3, N] mass-to-light ratios from model in each output band
mass - [N] total current stellar mass from model in each band
absmag - [3, N] absolute magnitude (for missing data, substitutes
model fit) in each output band
amivar - [3, N] inverse variance of absolute magnitude (for
missing data = 0) in each output band
OPTIONAL OUTPUTS:
coeffs - coefficients of fit
chi2 - chi^2 of fit
rmaggies - [3, N] reconstructed maggies from the fit (BRI)
omaggies, oivar - [3, N] maggies and inverse variances used for fit
(after extinction, AB correction, etc)
(BRI)
obands - [3, N] which input bands the K-corrections refer to
COMMENTS:
This is a simple wrapper on kcorrect.pro. It keeps a version of
rmatrix and zvals in memory to save time, recalculating them each
time you change band_shift.
You must specify nmgy,ivar OR mag,err OR zcat. If
nmgy or mag, make sure they are AB calibrated and Galactic
extinction corrected.
Uses deep_to_maggies to convert zcat structure to Galactic
extinction corrected maggies with errors.
For v4_0b templates and later, coefficients are in units of:
1 solar mass / (D/10pc)^2
That is, sum the coefficients and multiply by (D/10pc)^2 to get
TOTAL INTEGRATED STAR FORMATION. (In fact, for Omega0=0.3 and
OmegaL0=0.7, this is what the "mass" keyword returns). Note that
the total integrated star formation DIFFERS from the current
stellar mass --- which is returned in the mass and mtol variables.
REVISION HISTORY:
07-Apr-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/deep_kcorrect.pro)
NAME:
deep_to_maggies
PURPOSE:
convert DEEP zcat input to Galactic-extinction corrected AB maggies
CALLING SEQUENCE:
deep_to_maggies, zcat, maggies, ivar
INPUTS:
zcat - [N] DEEP style input, with:
.MAGB
.MAGR
.MAGI
OUTPUTS:
maggies - [3, N] output in AB maggies in BRI
ivar - [3, N] inverse variance of maggies
COMMENTS:
Calculates an approximate error based on the flux.
It ALWAYS applies a minimum error of [0.02, 0.02, 0.02] in
BRI.
The v4_0 version incorrectly applied SFD extinction, which is
already applied to the DEEP magnitudes.
REVISION HISTORY:
07-Apr-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/deep_to_maggies.pro)
NAME:
fit_sdss_fiber
PURPOSE:
fit an sdss fiber spectro to a nonnegative sum of templates
CALLING SEQUENCE:
fit_sdss_fiber [, plate, fiberid, mjd=, slist=, model=, coeffs=, $
vname=, cmodel, /usevdisp ]
INPUTS:
plate, fiberid, mjd - SDSS id numbers
OR
slist - structure containing above id numbers in .PLATE, .FIBERID,
and .MJD
OPTIONAL INPUTS:
vname - name of fit to use (default 'default')
omega0, omegal0 - cosmological parameters for calculating distance
moduli [default 0.3, 0.7]
range - [2] range of fit in wavelength
OPTIONAL KEYWORDS:
usevdisp - use correct vdisp for fit
nolines - output model without lines
plot - splot the results
OUTPUTS:
coeffs - coefficients fit to each template
model - model spectrum
cmodel - model of continuum (no lines, and with large scale
differences median smoothed out with 200 Angstrom box)
mass, metallicity - properties of template fit;
mass is in units of solar masses and is the
currently remaining stellar mass
b300 - star-formation within last 300Myrs relative to average
star-formation rate
b1000 - star-formation within last 1Gyrs relative to average
star-formation rate
EXAMPLE:
To get a believable galaxy continuum, use the following, and it
will return the galaxy flux in "flux", the weighting in "ivar", and
the best fit continuum model in "cmodel."
fit_sdss_fiber, 401, 35, mjd=51788, loglam=loglam, flux=flux, $
ivar=ivar, cmodel=cmodel, /usevdisp
REVISION HISTORY:
21-Apr-2005 MRB, NYU
(See /home/users/mb144/kcorrect/pro/fit/fit_sdss_fiber.pro)
NAME:
galex_kcorrect
PURPOSE:
calculate K-corrections for GALEX+SDSS input
CALLING SEQUENCE:
kcorrect= galex_kcorrect(redshift [, nmgy=, ivar=, mag=, err=, $
galex=, calibobj=, tsobj=, flux=, band_shift=, $
chi2=, rmaggies=, omaggies=, oivar=, $
mass=, mtol=, absmag=, amivar=, omega0=, $
omegal0= ])
INPUTS:
redshift - [N] redshifts
galex - [N] GALEX "mcat" style input, with:
.ALPHA_J2000
.DEC_J2000
.NUV_MAG
.NUV_MAGERR
.FUV_MAG
.FUV_MAGERR
calibobj - [N] photoop-style SDSS structure, containing:
.PETROFLUX[5]
.PETROFLUX_IVAR[5]
.MODELFLUX[5]
.MODELFLUX_IVAR[5]
.PSFFLUX[5]
.PSFFLUX_IVAR[5]
.EXTINCTION[5]
tsobj - [N] opdb-style SDSS structure, containing:
.PETROCOUNTS[5]
.PETROCOUNTSERR[5]
.COUNTS_MODEL[5]
.COUNTS_MODELERR[5]
.PSFCOUNTS[5]
.PSFCOUNTSERR[5]
.REDDENINg[5]
nmgy, ivar - [7, N] nanomaggies, Galactic-reddening corrected, and inverse
variance of same
mag, err - [7, N] standard Pogson magnitudes, Galactic-reddening
corrected, and errors of same
OPTIONAL INPUTS:
flux - use this version of the SDSS fluxes ('PETRO', 'MODEL', or 'PSF')
[defaults to 'PETRO'] if tsobj or calibobj keywords are
used
band_shift - blueshift of bandpasses to apply (to get ^{z}b
type bands) [default 0.]
vname - name of fit to use (defaults to 'default')
omega0, omegal0 - cosmological parameters for calculating distance
moduli [default 0.3, 0.7]
OUTPUTS:
kcorrect - [7, N] K-corrections in FNugriz satisfying
m = M + DM(z) + K(z)
based on the best fit sum of templates
mtol - [5, ngals] mass-to-light ratios from model in each band
mass - [ngals] total mass from model in each band
absmag - [5, ngals] absolute magnitude (for missing data, substitutes
model fit)
amivar - [5, ngals] inverse variance of absolute magnitude (for
missing data = 0)
OPTIONAL OUTPUTS:
coeffs - coefficients of fit
chi2 - chi^2 of fit
rmaggies - [7, N] reconstructed maggies from the fit (FNugriz)
omaggies, oivar - [7, N] maggies and inverse variances used for fit
(after extinction, AB correction, etc) (FNugriz)
COMMENTS:
This is a simple wrapper on kcorrect.pro which is designed for
users with GALEX data matched to SDSS data. It will deal
appropriately if you leave out the SDSS or GALEX data (but not
both!).
Uses galex_to_maggies to convert a GALEX-style catalog to maggies
and inverse variances.
Uses sdss_to_maggies to convert tsobj or calibobj structure to
AB, Galactic extinction corrected maggies. Passes optional
argument "flux" to sdss_to_maggies.
You must specify nmgy,ivar OR mag,err OR calibobj OR tsobj OR
galex. If nmgy or mag, make sure they are Galactic extinction
corrected and AB calibrated.
For v4_0b templates and later, coefficients are in units of:
1 solar mass / (D/10pc)^2
That is, sum the coefficients and multiply by (D/10pc)^2 to get
TOTAL INTEGRATED STAR FORMATION. (In fact, for Omega0=0.3 and
OmegaL0=0.7, this is what the "mass" keyword returns). Note that
the total integrated star formation DIFFERS from the current
stellar mass --- which is returned in the mass and mtol variables.
REVISION HISTORY:
07-Apr-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/galex_kcorrect.pro)
NAME:
galex_to_maggies
PURPOSE:
convert GALEX catalog input to Galactic-extinction corrected AB maggies
CALLING SEQUENCE:
galex_to_maggies,galex,maggies,ivar
INPUTS:
galex - [N] GALEX "mcat" style input, with:
.ALPHA_J2000
.DELTA_J2000
.NUV_A_IMAGE
.NUV_B_IMAGE
.NUV_KRON_RADIUS
.NUV_FLUX_AUTO
.NUV_SKYBG
.NUV_WEIGHT
.NUV_MAG_AUTO
.NUV_ZERO_POINT
.NUV_EXTINCTION
.NUV_FLUX_APER_N [in ORDER!]
.FUV_A_IMAGE
.FUV_B_IMAGE
.FUV_KRON_RADIUS
.FUV_FLUX_AUTO
.FUV_SKYBG
.FUV_WEIGHT
.FUV_MAG_AUTO
.FUV_ZERO_POINT
.FUV_EXTINCTION
.FUV_FLUX_APER_N [in ORDER!]
OUTPUTS:
maggies - [2, N] output in AB maggies in FUV and NUV filters
ivar - [2, N] inverse variance of maggies
OPTIONAL INPUTS:
aper - set to 1-7 to use GALEX aperture magnitudes
(diameters 2, 3, 5, 8, 12, 17, 23 pixels)
apcor - [2] set for FUV, NUV to apply an aperture correction (x).
Default 1.0
zero_point - [2] set to pass different zero point FUV, NUV
Default: FUV 18.82, NUV: 20.08
galext - Use the galex default ratio for afuv/ebv and anuv/ebv
COMMENTS:
It also ALWAYS applies a minimum error of [0.02, 0.02] in [FUV, NUV]
If the GALEX structure has a .E_BV entry, we use that for the
GALEX extinction, but we call dust_getval() to read the SFD maps
otherwise.
REVISION HISTORY:
07-Apr-2005 Mike Blanton, NYU
23-June-2005 David Schiminovich, Columbia
added some fixes for errors, etc
20-July-2005 David Schiminovich, Columbia
added aperture photometry
(See /home/users/mb144/kcorrect/pro/utils/galex_to_maggies.pro)
NAME: get_d4000n PURPOSE: get "narrow" D4000 measure from a spectrum CALLING SEQUENCE: d4000n= get_d4000n(loglam, flux, flux_ivar, ivar= ) INPUTS: loglam - log base 10 rest-frame wavelength (angstroms) flux - flux in flambda units flux_ivar - inverse variance of flux OUTPUTS: d4000n - ratio of red to blue continuum ivar - inverse variance of d4000n REVISION HISTORY: 05-May-2005 Written by M. Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/get_d4000n.pro)
NAME:
get_line
PURPOSE:
measures a line flux and equivalent width
CALLING SEQUENCE:
lstruct= get_line(loglam, flux, flux_ivar [, blim=, rlim=, llim=, lname=]
INPUTS:
loglam - log base 10 rest-frame wavelength (angstroms)
flux - flux in flambda units
flux_ivar - inverse variance of flux
OPTIONAL INPUTS
lname - name of line (default to 'LINE')
blim - [2] limits in Angstroms of blue continuum defn
rlim - [2] limits in Angstroms of red continuum defn
llim - [2] limits to integrate line over
OUTPUTS:
lstruct - structure with the elements:
.[LNAME]_FLUX - flux in line (units are flambda*Angstroms)
.[LNAME]_FLUX_IVAR - flux in line (units are flambda*Angstroms)
.[LNAME]_CONTINUUM - flux density in continuum
.[LNAME]_EQW - equivalent widths
COMMENTS:
If "lname" is known, uses a standard set of rlim, blim, and
llmin. Otherwise those must be set.
Known lnames are:
HDELTA
Only *really* makes sense to measure absorption lines with such a
crude measure of the continnum.
REVISION HISTORY:
05-May-2005 Written by M. Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/get_line.pro)
NAME:
goods_kcorrect
PURPOSE:
calculate K-corrections for GOODS catalog (BVizJHK)
CALLING SEQUENCE:
kcorrect= goods_kcorrect(redshift [, nmgy=, ivar=, mag=, err=, $
goods=, /sdss, band_shift=, chi2=, rmaggies=, $
omaggies=, vname=, oivar=, mass=, mtol=, $
absmag=, amivar=, omega0=, omegal0= ])
INPUTS:
redshift - [N] redshifts
goods - [N] GOODS-style structure, containing:
.RA (J2000 degrees)
.DEC (J2000 degrees)
.BMAG_MAGAUTO
.BMAGERR_MAGAUTO
.VMAG_MAGAUTO
.VMAGERR_MAGAUTO
.IMAG_MAGAUTO
.IMAGERR_MAGAUTO
.ZMAG_MAGAUTO
.ZMAGERR_MAGAUTO
.JMAG_MAGAUTO
.JMAGERR_MAGAUTO
.HMAG_MAGAUTO
.HMAGERR_MAGAUTO
.KMAG_MAGAUTO
.KMAGERR_MAGAUTO
nmgy, ivar - [7, N] nanomaggies, Galactic-reddening corrected, and inverse
variance of same
mag, err - [7, N] Pogson magnitudes, Galactic-reddening corrected and
errors of same
OPTIONAL INPUTS:
band_shift - blueshift of output bandpasses (to get ^{z}b
type bands) [default 0.]
vname - name of fit to use [defaults to 'default']
omega0, omegal0 - cosmological parameters for calculating distance
moduli [default 0.3, 0.7]
filterlist - [Nf] output filter list; default is:
['galex_NUV.par', $
'bessell_U.par', $
'bessell_B.par', $
'bessell_V.par', $
'bessell_R.par', $
'bessell_I.par']
unless /sdss is set, in which case:
['galex_NUV.par', $
'sdss_u0.par', $
'sdss_g0.par', $
'sdss_r0.par', $
'sdss_i0.par', $
'sdss_z0.par']
OUTPUTS:
kcorrect - [Nf, N] K-corrections from BVizJHK to NUBVRI (or Nugriz
/sdss is set). The closest input band is used for each
output band (which ones are decided upon is output in
"obands"). K-corrections satisfy
m_R = M_Q + DM(z) + K_QR(z)
based on the best fit sum of templates. All magnitudes
are AB.
mtol - [Nf, N] mass-to-light ratios from model in each output band
mass - [N] total mass from model in each band
absmag - [Nf, N] absolute magnitude (for missing data, substitutes
model fit) in each output band
amivar - [Nf, N] inverse variance of absolute magnitude (for
missing data = 0) in each output band
OPTIONAL OUTPUTS:
coeffs - coefficients of fit
chi2 - chi^2 of fit
rmaggies - [7, N] reconstructed maggies from the fit (BVizJHK)
omaggies, oivar - [7, N] maggies and inverse variances used for fit
(after extinction correction, etc)
(BVizJHK)
obands - [Nf, N] which input bands the K-corrections refer to
appm - [Nf, N] apparent magnitudes in output bands
COMMENTS:
This is a simple wrapper on kcorrect.pro. It keeps a version of
rmatrix and zvals in memory to save time, recalculating them each
time you change band_shift.
You must specify nmgy,ivar OR mag,err OR goods. If
nmgy or mag, make sure they are AB calibrated and Galactic
extinction corrected.
Uses goods_to_maggies to convert goods structure to Galactic
extinction corrected maggies with errors. This ignores the H band,
which we think is crap.
For v4_0b templates and later, coefficients are in units of:
1 solar mass / (D/10pc)^2
That is, sum the coefficients and multiply by (D/10pc)^2 to get
TOTAL INTEGRATED STAR FORMATION. (In fact, for Omega0=0.3 and
OmegaL0=0.7, this is what the "mass" keyword returns). Note that
the total integrated star formation DIFFERS from the current
stellar mass --- which is returned in the mass and mtol variables.
REVISION HISTORY:
07-Apr-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/goods_kcorrect.pro)
NAME:
goods_to_maggies
PURPOSE:
convert GOODS catalog input to Galactic-extcintion corrected AB maggies
CALLING SEQUENCE:
goods_to_maggies,goods,maggies,ivar
INPUTS:
goods - [N] GOODS style input
.RA (J2000 degrees)
.DEC (J2000 degrees)
.BMAG_MAGAUTO
.BMAGERR_MAGAUTO
.VMAG_MAGAUTO
.VMAGERR_MAGAUTO
.IMAG_MAGAUTO
.IMAGERR_MAGAUTO
.ZMAG_MAGAUTO
.ZMAGERR_MAGAUTO
.JMAG_MAGAUTO
.JMAGERR_MAGAUTO
.HMAG_MAGAUTO
.HMAGERR_MAGAUTO
.KMAG_MAGAUTO
.KMAGERR_MAGAUTO
OUTPUTS:
maggies - [7, N] output in AB maggies in BVizJHK
ivar - [7, N] inverse variance of maggies
COMMENTS:
It ALWAYS applies a minimum error of 0.02 in all
bandpasses. Except in H band it ALWAYS sets the inverse variance
to zero since I don't believe the H band calibration.
Requires you to have the dust maps so that dust_getval can find
them. (If somebody wants me to set "default" columns in the
goods structure that this code looks for, let me know).
REVISION HISTORY:
07-Apr-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/goods_to_maggies.pro)
NAME:
gst_kcorrect
PURPOSE:
calculate K-corrections for GALEX+SDSS+2MASS input
CALLING SEQUENCE:
kcorrect= gst_kcorrect(redshift [, nmgy=, ivar=, mag=, err=, $
galex=, twomass=, calibobj=, tsobj=, flux=, $
band_shift=, chi2=, rmaggies=, omaggies=, $
oivar=, mass=, mtol=, absmag=, amivar=, $
omega0=, omegal0= ])
INPUTS:
redshift - [N] redshifts
galex - [N] GALEX "mcat" style input, with:
.ALPHA_J2000
.DEC_J2000
.NUV_MAG
.NUV_MAGERR
.FUV_MAG
.FUV_MAGERR
twomass - [N] 2MASS "mcat" style input, with:
.RA
.DECL
.J_M_EXT
.J_MSIG_EXT
.J_FLG_EXT
.H_M_EXT
.H_MSIG_EXT
.H_FLG_EXT
.K_M_EXT
.K_MSIG_EXT
.K_FLG_EXT
calibobj - [N] photoop-style SDSS structure, containing:
.PETROFLUX[5]
.PETROFLUX_IVAR[5]
.MODELFLUX[5]
.MODELFLUX_IVAR[5]
.PSFFLUX[5]
.PSFFLUX_IVAR[5]
.EXTINCTION[5]
tsobj - [N] opdb-style SDSS structure, containing:
.PETROCOUNTS[5]
.PETROCOUNTSERR[5]
.COUNTS_MODEL[5]
.COUNTS_MODELERR[5]
.PSFCOUNTS[5]
.PSFCOUNTSERR[5]
.REDDENINg[5]
nmgy, ivar - [10, N] nanomaggies, Galactic-reddening corrected, and inverse
variance of same (in FNugrizJHK)
mag, err - [10, N] standard Pogson magnitudes, Galactic-reddening
corrected, and errors of same (in FNugrizJHK)
OPTIONAL INPUTS:
flux - use this version of the SDSS fluxes ('PETRO', 'MODEL', or 'PSF')
[defaults to 'PETRO'] if tsobj or calibobj keywords are
used
band_shift - blueshift of bandpasses to apply (to get ^{z}b
type bands) [default 0.]
vname - name of fit to use (defaults to 'default')
omega0, omegal0 - cosmological parameters for calculating distance
moduli [default 0.3, 0.7]
OUTPUTS:
kcorrect - [10, N] K-corrections in FNugrizJHK satisfying
m = M + DM(z) + K(z)
based on the best fit sum of templates
mtol - [5, ngals] mass-to-light ratios from model in each band
mass - [ngals] total current stellar mass from model in each band
absmag - [5, ngals] absolute magnitude (for missing data, substitutes
model fit)
amivar - [5, ngals] inverse variance of absolute magnitude (for
missing data = 0)
OPTIONAL OUTPUTS:
coeffs - coefficients of fit
chi2 - chi^2 of fit
rmaggies - [10, N] reconstructed maggies from the fit (FNugrizJHK)
omaggies, oivar - [10, N] maggies and inverse variances used for fit
(after extinction, AB correction, etc) (FNugrizJHK)
COMMENTS:
This is a simple wrapper on kcorrect.pro which is designed for
users with GALEX and 2MASS data matched to SDSS data. It will deal
appropriately if you leave out the SDSS or GALEX or 2MASS data (but not
all three!).
Uses galex_to_maggies to convert a GALEX-style catalog to maggies
and inverse variances.
Uses sdss_to_maggies to convert tsobj or calibobj structure to
AB, Galactic extinction corrected maggies. Passes optional
argument "flux" to sdss_to_maggies.
Uses twomass_to_maggies to convert a 2MASS-style catalog to maggies
and inverse variances.
You must specify nmgy,ivar OR mag,err OR calibobj OR tsobj OR
galex. If nmgy or mag, make sure they are Galactic extinction
corrected and AB calibrated.
For v4_0b templates and later, coefficients are in units of:
1 solar mass / (D/10pc)^2
That is, sum the coefficients and multiply by (D/10pc)^2 to get
TOTAL INTEGRATED STAR FORMATION. (In fact, for Omega0=0.3 and
OmegaL0=0.7, this is what the "mass" keyword returns). Note that
the total integrated star formation DIFFERS from the current
stellar mass --- which is returned in the mass and mtol variables.
REVISION HISTORY:
07-Apr-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/gst_kcorrect.pro)
NAME:
kcorrect
PURPOSE:
Given a set of AB maggies, returns the K-correction for each band.
CALLING SEQUENCE:
kcorrect, maggies, maggies_ivar, redshift, kcorrect [ , $
band_shift=, /magnitude, /stddev, lfile=, absmag=, $
vfile=, vpath=, filterlist=, filterpath=, rmatrix=, $
zvals=, lambda=, vmatrix=, /sdssfix, /abfix, minerrors=, $
coeffs=, chi2=, maxiter=, zmin=, zmax=, nz=, /verbose ]
INPUTS:
maggies - [nk, ngals] AB maggies of galaxies (magnitudes if
/magnitude set, asinh magnitudes if /sdssfix set)
maggies_ivar - [nk, ngals] inverse variance in maggies (magnitudes if
/magnitude set, std. dev. if /stddev set; if
/sdssfix set, is std. dev. of asinh magnitudes)
redshift - [ngals] redshifts of galaxies
OPTIONAL INPUTS:
band_shift - blueshift of bandpasses to apply (to get ^{z}b
type bands) [default 0]
magnitude - set if input and output in -2.5 log_10(maggies)
stddev - maggies_ivar actual contains standard dev.
minerrors - [nk] add this set of errors (in magnitude units)
in quadrature to all uncertainties
vname - name of fit to us (default 'default')
lfile - wavelength file for vmatrix [default
lambda.[vname].dat]
vfile - vmatrix file [default vmatrix.[vname].dat]
vpath - path to templates [default $KCORRECT_DIR/data/templates]
filterlist - [nk] list of filters [default
['sdss_u0.par', 'sdss_g0.par',
'sdss_r0.par', 'sdss_i0.par',
'sdss_z0.par']]
filterpath - path to filters [default $KCORRECT_DIR/data/filters]
/verbose - call k_fit_nonneg verbosely
maxiter - maximum number of iterations for fit [default 3000]
omega0, omegal0 - cosmological parameters for calculating distance
moduli [default 0.3, 0.7]
DEPRECATED INPUTS:
/abfix - uses k_abfix to fix input SDSS maggies to AB
(better to just call with 'sdss_kcorrect')
/sdssfix - uses k_sdssfix to "fix" input SDSS asinh magnitudes and
standard deviations; treats as if /abfix, and
minerrors=[0.05,0.02,0.02,0.02,0.03] are all set
(better to just call with 'sdss_kcorrect')
OUTPUTS:
kcorrect - [nk, ngals] K-corrections satisfying
m = M + DM(z) + K(z)
based on the best fit sum of templates
chi2 - chi^2 of fit
rmaggies - reconstructed maggies from the fit
OPTIONAL INPUT/OUTPUTS:
rmaggies - [nk, ngals] reconstructed maggies in each bands
coeffs - [nt, ngals] coefficients fit to each template (if maggies
input are nonexistent, just use these input
coeffs)
mass - [ngals] model mass derived from the coeffs (current
surviving stellar mass)
intsfh - [ngals] total integrated star-formation history (number of
stars formed total)
mets - [ngals] average metallicity of currently surviving stars
absmag - [nk, ngals] absolute magnitude (for missing data,
substitutes model fit)
amivar - [nk, ngals] absolute magnitude invvar (for missing
data = 0)
mtol - [nk, ngals] model mass-to-light in each *final*
bandpass (the bandpass you are kcorrecting *to*)
in SOLAR UNITS!
lambda - [nl+1] wavelengths for templates (to use)/(which were used)
(pixel edges)
vmatrix - [nl, nv] templates (to use)/(which were used)
rmatrix - [nz, nv, nk] look up table for bmatrix and filter
information
zvals - [nz] look up redshift table for rmatrix [N_z]
zmin,zmax - minimum and maximum redshifts for lookup table
(default 0., 2.)
nz - number of redshifts in lookup table (default 1000)
b300 - star-formation within last 300Myrs relative to
average star-formation rate
b1000 - star-formation within last 1Gyrs relative to
average star-formation rate
COMMENTS:
For v4_0b templates and later, coefficients are in units of:
1 solar mass / (D/10pc)^2
That is, sum the coefficients and multiply by (D/10pc)^2 to get
TOTAL INTEGRATED STAR FORMATION. (In fact, for Omega0=0.3 and
OmegaL0=0.7, this is what the "mass" keyword returns). Note that
the total integrated star formation DIFFERS from the current
stellar mass --- which is returned in the mass and mtol variables.
If you just want to do SDSS kcorrections, it is better to use the
wrapper 'sdss_kcorrect'.
If you want to do GALEX kcorrections (perhaps including matched
SDSS data) use the wrapper 'galex_kcorrect'.
If you want to do 2MASS kcorrections (perhaps including matched
SDSS data) use the wrapper 'twomass_kcorrect'.
If you want to do DEEP kcorrections use the wrapper 'deep_kcorrect'.
Allows the user to shift the bandpasses by a factor band_shift.
If no band_shift is specified, the K-correction is to z=0.
Defaults to SDSS filters.
REVISION HISTORY:
24-Jan-2002 Translated to IDL by Mike Blanton, NYU
19-Jul-2002 Major bug fix (pointed out by I. Baldry) MRB, NYU
02-Jun-2003 Updated to new v3_0 standards MRB, NYU
(See /home/users/mb144/kcorrect/pro/fit/kcorrect.pro)
NAME: kcorrect_so_ext PURPOSE: returns appropriate dynamic library extension given arch CALLING SEQUENCE: so_ext= kcorrect_so_ext() COMMENTS: necessary to deal with non-standard .dylib extension on darwin REVISION HISTORY: 20-Feb-2004 Written by M. Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/kcorrect_so_ext.pro)
NAME: keynote_plots PURPOSE: make presentation plots CALLING SEQUENCE: keynote_plots REVISION HISTORY: 2005-06-23 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/keynote_plots.pro)
NAME:
klog
PURPOSE:
Logging routine for writing to standard output and/or a log file.
CALLING SEQUENCE:
klog, v1, v2 ..., [, _EXTRA=extra, /noname, prelog=, filename=, $
/append, /close ]
INPUTS:
v1, v2 ... - The expressions to be passed to PRINT or PRINTF
OPTIONAL KEYWORDS:
_EXTRA - Any keywords for PRINT or PRINTF, such as FORMAT
noname - If set, then suppress printing name of calling routine
prelog - If set, then print this string immediately after the
name of the calling routine on each line, i.e. 'b1'
filename - If specified, then open this file for text output
append - If set at the same time as FILENAME, then append to this file;
default is to overwrite file
close - If set, then close the output file
OUTPUTS:
OPTIONAL OUTPUTS:
COMMENTS:
The output is formatted just like with the IDL PRINT command, except
that extraneous whitespace is removed from non-STRING elements unless
a FORMAT keyword is used.
EXAMPLES:
Open a file for text output, write to it, then close it:
klog, filename='test.log'
klog, 'This is a test', 123.4, format='(a,f8.2)'
klog, /close
Alternatively, this can all be done on one line
klog, filename='test.log', /close, $
'This is a test', 123.4, format='(a,f8.2)'
BUGS:
PROCEDURES CALLED:
REVISION HISTORY:
17-Nov-1999 Written by D. Schlegel, Princeton
23-Jan-2002 Branched from idlutils to eliminate dependency by MB, NYU
(See /home/users/mb144/kcorrect/pro/utils/klog.pro)
NAME:
kphotoz
PURPOSE:
Given AB maggies estimate the redshift of a galaxy
CALLING SEQUENCE:
kphotoz, maggies, maggies_ivar, photoz [ , $
/magnitude, /stddev, lfile=, $
vfile=, vpath=, filterlist=, filterpath=, rmatrix=, $
zvals=, lambda=, vmatrix=, /sdssfix, coeffs=, chi2=, $
maxiter=, zmin=, zmax=, nz=, /verbose ]
INPUTS:
maggies - AB maggies of galaxies [N_band, N_gal] (magnitudes if
/magnitude set)
maggies_ivar - inverse variance in maggies (magnitudes if
/magnitude set, std. dev. if /stddev set)
OPTIONAL INPUTS:
vname - name of fit to us (default 'default')
lfile - wavelength file for vmatrix [default lambda.default.dat]
vfile - vmatrix file [default vmatrix.default.dat]
vpath - path to templates [default $KCORRECT_DIR/data/templates]
maxiter - maximum number of iterations for fit [default
3000]
filterlist - list of filters [default
['sdss_u0.par', 'sdss_g0.par',
'sdss_r0.par', 'sdss_i0.par',
'sdss_z0.par']]
filterpath - path to filters [default $KCORRECT_DIR/data/filters]
/magnitude - set if input and output in -2.5 log_10(maggies)
/stddev - maggies_ivar actual contains standard dev.
/verbose - call k_fit_nonneg verbosely
/noprior - don't use any prior (by default uses a prior which
slightly discourages low redshifts). overridden by
lprior and zprior
zprior/lprior - grid of redshift and -2ln(prior) values to apply
/sdssfix - uses k_sdssfix to "fix" input SDSS magnitudes and
standard deviations (treats as if /magnitude and
/stddev are also set) DEPRECATED: use
SDSS_KPHOTOZ() instead.
OUTPUTS:
photoz - photometric redshift
coeffs - coefficients fit to each template
chi2 - chi^2 of fit
OPTIONAL INPUT/OUTPUTS:
lambda - wavelengths for templates (to use)/(which were used)
vmatrix - templates (to use)/(which were used)
rmatrix - look up table for bmatrix and filter information
[N_z, N_dim, N_band]
zvals - look up redshift table for rmatrix [N_z]
zmin,zmax - minimum and maximum redshifts for lookup table
(default 0., 2.)
nz - number of redshifts in lookup table (default 1000)
COMMENTS:
When /sdssfix is set, deals with SDSS database-style input,
including wacky values for magnitgude errors, adding zeropoint
uncertainties, and dealing with asinh magnitudes. Uses k_sdssfix
for this.
REVISION HISTORY:
04-Jun-2003 converted from kcorrect MRB, NYU
(See /home/users/mb144/kcorrect/pro/fit/kphotoz.pro)
NAME:
k_abfix
PURPOSE:
Take SDSS pipeline maggies and return AB maggies
CALLING SEQUENCE:
k_abfix, maggies, maggies_ivar [ aboff=]
INPUTS/OUTPUTS:
maggies - input maggies (changed on output)
maggies_ivar - input inverse variances (changed on output)
OPTIONAL KEYWORDS:
/ab02 - use 2002 version of AB corrections (overrides aboff keyword)
OPTIONAL INPUTS:
aboff - [5] AB offsets (defaults to list below)
COMMENTS:
Uses the AB conversions posted by D. Eisenstein (sdss-calib/???)
u(AB,2.5m) = u(database, 2.5m) - 0.036
g(AB,2.5m) = g(database, 2.5m) + 0.012
r(AB,2.5m) = r(database, 2.5m) + 0.010
i(AB,2.5m) = i(database, 2.5m) + 0.028
z(AB,2.5m) = z(database, 2.5m) + 0.040
You can specify your own with the "aboff" input.
Note that older ("2002") versions (v3_2 and previous) used a different set
of corrections:
u(AB,2.5m) = u(database, 2.5m) - 0.042 (NOT WHAT WE DO HERE)
g(AB,2.5m) = g(database, 2.5m) + 0.036 (NOT WHAT WE DO HERE)
r(AB,2.5m) = r(database, 2.5m) + 0.015 (NOT WHAT WE DO HERE)
i(AB,2.5m) = i(database, 2.5m) + 0.013 (NOT WHAT WE DO HERE)
z(AB,2.5m) = z(database, 2.5m) - 0.002 (NOT WHAT WE DO HERE)
You can use these if you set the /ab02 flag
REVISION HISTORY:
05-Apr-2005 Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_abfix.pro)
NAME:
k_add_stack
PURPOSE:
adds stack of observations for multiple bands/objects
CALLING SEQUENCE:
k_add_stack, stack, stack_ivar, stacked, stacked_ivar
INPUTS:
stack - [Nbands, Ngalaxies, Nobs] maggies in each band for each
galaxy for each observation
stack_ivar - [Nbands, Ngalaxies, Nobs] inverse variance for each
observation
OUTPUTS:
stacked - [Nbands, Ngalaxies] average maggies
stacked_ivar - [Nbands, Ngalaxies] inverse variance of average
COMMENTS:
Weights average by inverse variance.
REVISION HISTORY:
18-Jan-2003 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/samples/k_add_stack.pro)
NAME: k_binspec PURPOSE: bins spectrum by integrating over pixels to convert flux density to flux CALLING SEQUENCE: newspec= k_rebin(lambda, spec, newlambda) INPUTS: lambda - [N] wavelength spec - [N] flux density (in same units as wavelength) newlambda - [Nout] centers of new pixels OUTPUTS: newspec - [Nout] total flux in each pixel COMMENTS: Uses k_lambda_to_edges to infer pixel edges from centers. REVISION HISTORY: 21-Sept-2005 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_binspec.pro)
NAME: k_binspec PURPOSE: bins spectrum just by integrating over pixels CALLING SEQUENCE: newspec= k_rebin(lambda, spec, newlambda) INPUTS: lambda - [N] wavelength spec - [N] flux density (in same units as wavelength) newlambda - [N] centers of new pixels REVISION HISTORY: 21-Sept-2005 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_rebin.pro)
NAME: k_bspline2 PURPOSE: return value of a second-order B-spline basis function centered at zero CALLING SEQUENCE: vals= k_bspline2(x) INPUTS: x - [N] positions OUTPUTS: vals - [N] value of basis function at positions COMMENTS: A very specialized function. REVISION HISTORY: 26-Feb-2003 Written by M. Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_bspline2.pro)
NAME: k_deep_tests PURPOSE: runs tests on DEEP data CALLING SEQUENCE: k_deep_tests REVISION HISTORY: 2005-04-07 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_deep_tests.pro)
NAME:
k_derived
PURPOSE:
create derived quantities file
CALLING SEQUENCE:
k_derived [, vname= ]
OPTIONAL INPUTS:
vname - name of set of templates to use (default 'default')
COMMENTS:
Create k_nmf_derived.vname.fits file, with the HDUs:
HDU0: [nbasis, nt] coefficients of each template
HDU1: [nspec, nt] spectrum of each template
HDU2: [nspec, nt] spectrum of each template (no lines)
HDU3: [nspec, nt] spectrum of each template (no dust)
HDU4: [nspec, nt] spectrum of each template (no lines or dust)
HDU5: [nspec, nt] spectrum of each template (unsmoothed)
HDU6: [nspec, nt] spectrum of each template (no lines; unsmoothed)
HDU7: [nspec, nt] spectrum of each template (no dust; unsmoothed)
HDU8: [nspec, nt] spectrum of each template (no lines or dust;
unsmoothed)
HDU9: [nspec, nt] emission line spectrum of each template
HDU10: [nspec, nt] dust extinction factor of each template
HDU11: [nspec] wavelengths for each spectrum
HDU12: [nage, nt] SFR for each template
HDU13: [nage, nt] metallicity for each template
HDU14: [nage] ages at which SFR given
HDU15: [nage] age differential (multiply SFR to get number of stars)
HDU16: [nt] total mass formed in each template
HDU17: [nt] total current mass in each template
HDU18: [nt] metallicity of current stars in each template
HDU19: [nt] total mass formed in each template in past 300 Myrs
HDU20: [nt] total mass formed in each template in past 1 Gyrs
HDU21: ages of each basis vector [Nages, Nmets, Ndust]
HDU22: metallicities of each basis vector [Nages, Nmets, Ndust]
HDU23: dust properties of each basis vector [Nages, Nmets, Ndust]
HDU24: fraction of original stellar mass surviving at age
of this basis vector [Nages, Nmets, Ndust]
REVISION HISTORY:
2005-08-15 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_derived.pro)
NAME: k_end_print PURPOSE: end a postscript file and return plotting device to X CALLING SEQUENCE: k_end_print [, pold=, xold=, yold= ] OPTIONAL INPUTS: pold, xold, yold - if these exist, resets !P, !X, !Y to these values COMMENTS: A very specialized function. REVISION HISTORY: 26-Feb-2003 Written by M. Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_end_print.pro)
NAME:
k_evolve
PURPOSE:
returns "evolved" absolute magnitude using simple evolution model
CALLING SEQUENCE:
absm_evolved= k_evolve(absm, z, q0, q1, qz0)
INPUTS:
absm - absolute magnitude
z - redshift
q0, q1, qz0 - parameters in formula:
absm_evolved = absm+(q0*(1.+q1*(z-qz0)))*(z-qz0)
REVISION HISTORY:
2005-3-17 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/k_evolve.pro)
NAME: k_fit_image PURPOSE: fit a lowz sample image pixel-by-pixel COMMENTS: currently experimental REVISION HISTORY: 06-Jul-2005 MRB, NYU
(See /home/users/mb144/kcorrect/pro/fit/k_fit_image.pro)
NAME:
k_fit_nonneg
PURPOSE:
Fit nonnegative sum of given templates to given set of maggies
CALLING SEQUENCE:
coeffs= k_fit_nonneg(maggies, maggies_ivar, vmatrix, lambda, redshift=, $
filterlist= [, chi2=, rmatrix=, zvals=, maxiter=, filterpath=, $
zmin=, zmax=, nz=, band_shift=, /verbose])
INPUTS:
maggies - fluxes in each band for each galaxy
maggies_var - inverse variance in each band for each galaxy
vmatrix - templates
lambda - pixel edges for all templates
redshift - redshift of galaxies
filterlist - list of filternames
OPTIONAL INPUTS:
filterpath - path to look for filters on
maxiter - maximum number of iterations in fit
z[min|max] - limits for redshift to use in making lookup table
nz - number of redshift rows in lookup table
band_shift - shifted bands if desired
/verbose - verbose output
OUTPUTS:
coeffs - best-fit coefficients
rmatrix - projection table used
zvals - redshift list for projection table used
chi2 - chi^2 value for each fit
niter - number of iterations used
EXAMPLE:
maggies=[1.,2.,3.,4.,5]
maggies_fracerr=[0.2, 0.2, 0.2, 0.2, 0.2]
maggies_ivar=1./(maggies*maggies_fracerr)^2
filterlist= 'sdss_'+['u', 'g', 'r', 'i', 'z']+'0.par'
k_load_vmatrix, vmatrix, lambda
redshift=0.1
coeffs= k_fit_nonneg(maggies, maggies_ivar, vmatrix, lambda, $
redshift=redshift, filterlist=filterlist)
REVISION HISTORY:
01-May-2003 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/k_fit_nonneg.pro)
NAME:
k_fit_photoz
PURPOSE:
Fit photometric redshift using nonnegative sum of templates
CALLING SEQUENCE:
photoz= k_fit_photoz(maggies, maggies_ivar, vmatrix, lambda, $
filterlist= [, chi2=, rmatrix=, zvals=, maxiter=, filterpath=, $
zmin=, zmax=, nz=, band_shift=, /verbose])
INPUTS:
maggies - fluxes in each band for each galaxy
maggies_var - inverse variance in each band for each galaxy
vmatrix - templates
lambda - pixel edges for all templates
filterlist - list of filternames
OPTIONAL INPUTS:
filterpath - path to look for filters on
maxiter - maximum number of iterations in fit
z[min|max] - limits for redshift to use in making lookup table
nz - number of redshift rows in lookup table
band_shift - shifted bands if desired
zprior/lprior - grid of redshift and -2ln(prior) values to apply
/verbose - verbose output
OUTPUTS:
photoz - estimated redshift
chi2 - chi^2 value for each fit
coeffs - coeffs for each fit
rmatrix - projection table used
zvals - redshift list for projection table used
niter - number of iterations for last fit
REVISION HISTORY:
01-May-2003 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/k_fit_photoz.pro)
NAME: k_fit_spec PURPOSE: fit a spectrum to the sum of templates CALLING SEQUENCE: k_fit_spec, lambda, flux, ivar, coeffs [, vname=, vdisp= ] INPUTS: flux - [nl] fluxes (aligned with wavelength grid of models) ivar - [nl] inverse variances (aligned with wavelength grid of models) OPTIONAL INPUTS: lambda - [nl] wavelenths (if flux not aligned) oflux - [nm] aligned version of flux oivar - [nm] aligned version of ivar olambda - [nm] model wavelength grid vname - name of fit to use (default 'default') vdisp - velocity dispersion to smooth fit to OUTPUTS: coeffs - [nt] coefficients fit to each template templates - [nl, nt] template fluxes REVISION HISTORY: 21-Apr-2005 MRB, NYU
(See /home/users/mb144/kcorrect/pro/fit/k_fit_spec.pro)
NAME: k_fit_templates PURPOSE: run the template fitting code, with priming CALLING SEQUENCE: k_fit_templates [, nt= ] OPTIONAL INPUTS: nt - maximum number of templates to fit for (default 4) REVISION HISTORY: 09-Apr-2005 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/fit/k_fit_templates.pro)
NAME: k_galex_tests PURPOSE: runs tests on GALEX+SDSS test data CALLING SEQUENCE: k_galex_tests DATA DEPENDENCIES: $KCORRECT_DIR/data/test/galex_tests.fits (builds if not there) REVISION HISTORY: 2005-04-07 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_galex_tests.pro)
NAME: k_goods_tests PURPOSE: runs tests on GOODS test data CALLING SEQUENCE: k_goods_tests DATA DEPENDENCIES: $KCORRECT_DIR/data/test/goods_tests.fits (builds if not there) REVISION HISTORY: 2005-04-07 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_goods_tests.pro)
NAME: k_gst_tests PURPOSE: runs tests on GALEX+SDSS+2MASS test data CALLING SEQUENCE: k_gst_tests DATA DEPENDENCIES: $KCORRECT_DIR/data/test/gst_tests.fits (builds if not there) REVISION HISTORY: 2005-04-07 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_gst_tests.pro)
NAME:
K_IM_READ_BC03()
PURPOSE:
Read the Bruzual & Charlot (2003) binary format population
synthesis models into a convenient data structure.
CALLING SEQUENCE:
bc03 = k_im_read_bc03(isedfile=,isedpath,metallicity=,$
age=,minwave=,maxwave=,bc03_extras=,/salpeter,/lr,$
/silent)
INPUTS:
None required. By default this routine reads the high
resolution (hr), solar metallicity (m62), Chabrier SSP
models.
OPTIONAL INPUTS:
isedfile - read this binary SED rather than the default SSP
models
isedpath - full data path (with trailing slash) to ISEDFILE
metallicity - SSP metallicity
0 - Z=0.0001 (m22)
1 - Z=0.0004 (m32)
2 - Z=0.004 (m42)
3 - Z=0.008 (m52)
4 - Z=0.02 (m62) (Solar, default)
5 - Z=0.05 (m72)
age - return the SSP(s) corresponding to this scalar or vector
age(s) [Gyr]
minwave - crop the SSP spectra to this minimum wavelength (Angstrom)
maxwave - crop the SSP spectra to this maximum wavelength (Angstrom)
isolib - Isochrone library to use (default 'Padova1994')
KEYWORD PARAMETERS:
salpeter - read the Salpeter IMF models (default is to read
the Chabrier models)
lr - read the low resolution models (default is to read
the high resolution models)
silent - do not print any messages to STDOUT
vac - translate wavelengths to vacuum
OUTPUTS:
bc03 - data structure with the following fields:
age - vector of SSP ages [NAGE] (yr)
wave - wavelength array [NPIX] (Angstrom)
flux - SSP models [NPIX,NAGE] (L_sun/M_sun/A)
OPTIONAL OUTPUTS:
bc03_extras - data structure containing the extra parameters
associated with each SSP (see the BC03
documentation)
COMMENTS:
N.B. The environment variable ${bc03_dir} must be defined in
your '.cshrc' indicating the *root* directory of the BC03
models. For example, in my '.cshrc' I have
setenv bc03_dir ${HOME}/synthesis/bc03
Note that this routine works with the Padova (1994) binary
isochrones by default. Use ISOLIB input to use others. Using
the ISEDFILE and ISEDPATH optional inputs you can read in an
arbitrary BC03 SED in binary format.
BUGS:
It does not appear that this routine works with BC03 models
*other* than the instantaneous burst models. For example, if
you use 'csp_galexev.f' to generate SFH-convolved models then
those outputted models cannot be read with IM_READ_BC03(). I
think the reason is that the time steps and spacing are
modified, which changes the format of the binary file.
If you solve this please let me know!
INTERNAL SUPPORT ROUTINES:
READ_EXTRAS(), GET_ELEMENT
PROCEDURES USED:
READFAST, STRUCT_TRIMTAGS(), STRUCT_ADDTAGS(), MATCH
EXAMPLES:
[1] Read the high-resolution, Salpeter IMF, Solar metallicity
(Z=0.02) SSP models:
IDL> bc03 = k_im_read_bc03()
IDL> help, bc03, /str
[2] Read the low-resolution, Salpeter IMF, LMC metallicity
(Z=0.004) SSP models:
IDL> bc03 = k_im_read_bc03(metallicity=2,/lr,/salpeter)
[3] Read the high-resolution, Chabrier IMF, twice-solar
metallicity (Z=0.05) SSP models and plot the 10 Gyr model:
IDL> bc03 = k_im_read_bc03(metallicity=5)
IDL> indx = where(bc03.age eq 1E10)
IDL> plot, bc03.wave, bc03.flux[*,indx], /xlog, /ylog
[4] Read the high-resolution, Chabrier IMF, solar metallicity
(Z=0.02) SSP models and extras and plot D4000 versus
H-delta_A:
IDL> bc03 = k_im_read_bc03(bc03_extras=bce)
IDL> plot, bce.d_4000_, bce.h_delta_a, xsty=3, ysty=3
[5] Read a non-SSP SED in my temp subdirectory:
IDL> bc03 = k_im_read_bc03(isedfile='mysed.ised',isedpath='temp/')
[6] Retrieve the 12 Gyr Salpeter IMF, high-resolution SSP
between 3000 and 10000 Angstroms.
IDL> bc03 = k_im_read_bc03(/salpeter,age=12.0,minwave=3000,maxwave=1E4)
MODIFICATION HISTORY:
J. Moustakas, 2003 October 29, U of A, based in some part on
IDL code originally written by C. Papovich
jm03nov12uofa - added ISEDFILE and ISEDPATH optional inputs
and various bug fixes
jm04mar01uofa - added AGE, MINWAVE, and MAXWAVE optional
inputs; changed wave, flux, and age to double
precision
(See /home/users/mb144/kcorrect/pro/seds/k_im_read_bc03.pro)
NAME:
k_interp_pegase
PURPOSE:
interpolate a set of PEGASE spectra to a specific time
CALLING SEQUENCE:
k_interp_pegase, peg, time [,nl=, lmin=, lmax=, /nolines, $
/nocontinuum]
INPUTS:
peg - structure returned by read_peg
time - desired time (in Myrs)
OPTIONAL INPUTS:
nl, lmin, lmax - structure of output spectrum
KEYWORDS:
/nolines - leave out the lines
/nocontinuum - leave out the continuum
REVISION HISTORY:
25-Jul-2002 Translated to IDL by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/seds/k_interp_pegase.pro)
NAME:
k_lambda_eff
PURPOSE:
Get effective wavelengths of filters in Angstroms
CALLING SEQUENCE:
efflam=k_lambda_eff([filterlist=, filterpath=, band_shift=])
OPTIONAL INPUTS:
filterlist - list of filter names (default
['sdss_u0.par','sdss_g0.par', 'sdss_r0.par',
'sdss_i0.par', 'sdss_z0.par'])
filterpath - path for filter files; default to kcorrect repository
band_shift - blueshift to apply to bandpass; default to 0.0
COMMENTS:
Calculates the effective wavelength using the Schneider et al 1983
defn (as quoted in Fukugita et al 1996). Returns results in
Angstroms.
PROCEDURES CALLED:
k_load_filters
REVISION HISTORY:
17-Jan-2002 Translated to IDL by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_lambda_eff.pro)
NAME: k_lambda_to_centers PURPOSE: convert set of pixel edges to equivalent pixels centers CALLING SEQUENCE: lambda_centers=k_lambda_to_centers(lambda_edges) INPUTS: lambda_edges - [N+1] pixel edges OUPUTS: lambda_centers - [N] pixel centers REVISION HISTORY: 05-Apr-2005 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_lambda_to_centers.pro)
NAME: k_lambda_to_edges PURPOSE: convert set of pixel centers to equivalent pixels edges CALLING SEQUENCE: lambda_edges=k_lambda_to_edges(lambda_centers) INPUTS: lambda_centers - [N] pixel centers OUPUTS: lambda_edges - [N+1] pixel edges REVISION HISTORY: 30-Apr-2003 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_lambda_to_edges.pro)
NAME: k_linear_transforms PURPOSE: calculate transformations between filter systems CALLING SEQUENCE: k_linear_tranforms COMMENTS: Creates plots in k_linear_transforms.ps Prints lineareqs.tex format linear equations to screen for input into REVISION HISTORY: 10-Feb-2004 Translated to IDL by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_linear_transforms.pro)
NAME:
k_load_filters
PURPOSE:
Load the filter information from a list of files
CALLING SEQUENCE:
k_load_filters, filterlist, filter_nlambda, filter_lambda, filter_pass [, $
filterpath=filterpath
INPUTS:
filterlist - list of files with filter information
OPTIONAL INPUTS:
filterpath - path to use for filters if the filterlist files
do not exist (if this has more than one element
they are checked in order)
OUTPUTS:
filter_nlambda - number of elements in each filter specification
filter_lambda - wavelength for each element
filter_pass - value for each element
OPTIONAL INPUT/OUTPUTS:
COMMENTS:
Filters should be in the Yanny parameter format with columns:
lambda
pass
This code caches the filters it reads in.
PROCEDURES CALLED:
yanny_readone (idlutils)
REVISION HISTORY:
04-Jan-2002 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_load_filters.pro)
NAME:
k_load_vmatrix
PURPOSE:
Load the template information
CALLING SEQUENCE:
k_load_vmatrix, vmatrix, lambda [, vfile=, vpath=, lfile=, vname= ]
OPTIONAL INPUTS:
vname - name of fit (default 'default')
vfile - ascii format file with vmatrix in it (default
vmatrix.[vname].dat)
lfile - ascii format file with wavelengths in it (in Angstroms)
(default lambda.[vname].dat)
vpath - path to use for vfile if it does not exist
(if this has more than one element they are checked in order)
[default $KCORRECT_DIR/data/templates]
OUTPUTS:
vmatrix - [nl,nv] template
lambda - [nl+1] pixel edges of template
COMMENTS:
Use lambda=k_lambda_to_centers(lambda) to get [nl] pixel centers
from [nl+1] pixel edges.
REVISION HISTORY:
04-Jun-2003 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_load_vmatrix.pro)
NAME:
k_lups2maggies
PURPOSE:
Convert SDSS luptitudes ("asinh" magnitudes) to maggies
CALLING_SEQUENCE:
maggies= k_lups2maggies(lups [, lups_err, maggies_err=, bvalues=])
INPUTS:
lups - [Nb, N] luptitudes (the "asinh" magnitudes from the
SDSS databases). Unless you set bvalues yourself, Nb=5
OUTPUTS:
maggies - [Nb,N] maggies (10.^(-0.4*magnitude))
OPTIONAL INPUTS:
lups_err - [Nb, N] 1 sigma errors in luptitudes
bvalues - "b" value for luptitude definition for each band
(default [1.4D-10, 0.9D-10, 1.2D-10, 1.8D-10, 7.4D-10])
OPTIONAL OUTPUTS:
maggies_err - [Nb, N] 1 sigma errors in maggies
(fails if lups_err not set)
COMMENTS:
Conversion from luptitudes to maggies is:
maggies = 2 b sinh( - ln(b) - 0.4 ln(10) lups)
This is linear when maggies ~ b, identical to maggies
for maggies >> b
Conversion of the errors is:
maggies_err = 2 b cosh( -ln(b) - 0.4 ln(10) lups) (0.4 ln 10) lups_err
If you set bvalues yourself, the code assumes Nb=n_elements(bvalues)
for the purposes of intepreting the "lups" input.
REVISION HISTORY:
28-Mar-2002 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_lups2maggies.pro)
NAME:
k_maggies2lups
PURPOSE:
Convert maggies to SDSS luptitudes ("asinh" magnitudes)
CALLING_SEQUENCE:
lups= k_maggies2lups(maggies [, maggies_err, lups_err=, bvalues=])
INPUTS:
maggies - [Nb,N] maggies (10.^(-0.4*magnitude)). Unless you set
bvalues yourself, Nb=5
OUTPUTS:
lups - [Nb, N] luptitudes (the "asinh" magnitudes used by the
SDSS databases).
OPTIONAL INPUTS:
bvalues - "b" value for luptitude definition for each band
(default [1.4D-10, 0.9D-10, 1.2D-10, 1.8D-10, 7.4D-10])
maggies_err - [Nb, N] 1 sigma errors in maggies
OPTIONAL OUTPUTS:
lups_err - [Nb, N] 1 sigma errors in luptitudes
(fails if maggies_err not set)
COMMENTS:
Conversion from maggies to lups is:
lups = - 2.5 ln(b) / ln(10) - 2.5 asinh( 0.5 maggies/b) / ln(10)
This is linear when maggies ~ b, identical to maggies
for maggies >> b
Conversion of the errors is:
lups_err = 2.5 maggies_err / ( 2 b ln(10) sqrt(1 + (m/2b)^2))
If you set bvalues yourself, the code assumes Nb=n_elements(bvalues)
for the purposes of intepreting the "lups" input.
REVISION HISTORY:
28-Mar-2002 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_maggies2lups.pro)
NAME:
k_minerror
PURPOSE:
apply a minimum magnitude to error to a set of inverse variances
CALLING SEQUENCE:
k_minerror, maggies, maggies_ivar [, minerrors]
INPUTS:
maggies - [nk, n] maggies
INPUTS/OUTPUTS:
maggies_ivar - [nk, n] inverse variances (changed on output)
OPTIONAL INPUTS:
minerrors - [nk] minimum errors to apply (default [0.05, 0.02,
0.02, 0.02, 0.03] to represent calibration
uncertainties in SDSS ugriz bands)
COMMENTS:
Adds minerror in quadrature to each band.
BUGS:
check "factor"
REVISION HISTORY:
07-Feb-2002 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_minerror.pro)
NAME:
k_mkspec_pegase
PURPOSE:
read in PEGASE.2 models, add dust, convolve with SFH
CALLING SEQUENCE:
k_mkspec_pegase, vmatrix, lambda, metallicity, dust, sfhpars [, $
pegasepath=, attime=, maxage=, minage=, lmin=, lmax=, nl=, /nolines]
INPUTS:
metallicity - string with metallicity name
dust - witt dust name
sfhpars - structure describing SFH
OPTIONAL INPUTS:
pegasepath - directory with PEGASE results (default
$DATA/specmodels/PEGASE.2)
attime - observe at look back time of this (default 0.)
[min|max]age - minimum and maximum ages of populations (default none)
l[min|max] - wavelength limits (default 1250., 33333.)
nl - number of pixels (default 5000)
pversion - prefix for spectra names (default 'mrb')
KEYWORDS:
/nolines - don't use the lines
OUTPUTS:
vmatrix - [nl, n_spectra] output spectra
lambda - [nl+1] pixel edges
COMMENTS:
Requires you have created PEGASE.2 models in the files:
$DATA/specmodels/PEGASE.2/[pversion]_spectra.0.[metallicity].dat
PROCEDURES CALLED:
k_load_ascii_table
k_read_peg
REVISION HISTORY:
25-Jul-2002 Translated to IDL by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/seds/k_mkspec_pegase.pro)
NAME:
k_nmf_mmatrix
PURPOSE:
make grid of BC03 model spectra for fitting
CALLING SEQUENCE:
k_nmf_mmatrix [, prefix=, back=, lmin=, lmax=, dusts= ]
OPTIONAL INPUTS:
prefix - prefix to use for output files (default 'k_nmf')
back - # of Gyrs in the past to use for 'early' file and in future
for 'late' file
lmin, lmax - limits of spectrum output (Angstroms; default 600, 30000)
navloglam - number of wavelengths in final output
nagesmax - maximum number of instantantaneous burst ages to use
vdisp - smooth models to this velocity dispersion, in km/s (default 300)
minzf, maxzf - minimum and maximum redshifts of observation
(default 0., 1.)
nzf - number of redshifts of observations
dusts - dust models (Witt & Gordon) to use for
extinction. Structure with elements:
.GEOMETRY - geometry from WG (default 'dusty', 'dusty', 'dusty')
.DUST - type of dust from WG (default 'MW', 'MW', 'MW')
.STRUCTURE - structure of dust from WG (default 'c', 'c', 'c')
.TAUV - optical depth at V (default 0., 1., 3.)
COMMENTS:
makes [Nobs, Nsfh] matrix where
Nobs = nlambda + nz*nfilters
units are absolute maggies per solar mass
BUGS:
needs to output *unsmoothed* spectra
should have better constrained emission lines
make sure DEEP filters are fixed
include Draine & Li templates
REVISION HISTORY:
29-Jul-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/seds/k_nmf_mmatrix.pro)
NAME:
k_nmf_mmatrix_lrg
PURPOSE:
make grid of BC03 model spectra for fitting
CALLING SEQUENCE:
k_nmf_mmatrix [, prefix=, back=, lmin=, lmax=, dusts= ]
OPTIONAL INPUTS:
prefix - prefix to use for output files (default 'k_nmf')
back - # of Gyrs in the past to use for 'early' file
lmin, lmax - limits of spectrum output (Angstroms; default 600, 30000)
navloglam - number of wavelengths in final output
nagesmax - maximum number of instantantaneous burst ages to use
vdisp - smooth models to this velocity dispersion, in km/s (default 300)
minzf, maxzf - minimum and maximum redshifts of observation
(default 0., 1.)
nzf - number of redshifts of observations
dusts - dust models (Witt & Gordon) to use for
extinction. Structure with elements:
.GEOMETRY - geometry from WG (default 'dusty', 'dusty', 'dusty')
.DUST - type of dust from WG (default 'MW', 'MW', 'MW')
.STRUCTURE - structure of dust from WG (default 'c', 'c', 'c')
.TAUV - optical depth at V (default 0., 1., 3.)
COMMENTS:
makes [Nobs, Nsfh] matrix where
Nobs = nlambda + nz*nfilters
units are absolute maggies per solar mass
BUGS:
needs to output *unsmoothed* spectra
should have better constrained emission lines
make sure DEEP filters are fixed
include Draine & Li templates
REVISION HISTORY:
29-Jul-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/seds/k_nmf_mmatrix_lrg.pro)
NAME:
k_nmf_mmatrix_photoz
PURPOSE:
make grid of BC03 model spectra for fitting
CALLING SEQUENCE:
k_nmf_mmatrix [, prefix=, back=, lmin=, lmax=, dusts= ]
OPTIONAL INPUTS:
prefix - prefix to use for output files (default 'k_nmf')
back - # of Gyrs in the past to use for 'early' file
lmin, lmax - limits of spectrum output (Angstroms; default 600, 30000)
navloglam - number of wavelengths in final output
nagesmax - maximum number of instantantaneous burst ages to use
vdisp - smooth models to this velocity dispersion, in km/s (default 300)
minzf, maxzf - minimum and maximum redshifts of observation
(default 0., 1.)
nzf - number of redshifts of observations
dusts - dust models (Witt & Gordon) to use for
extinction. Structure with elements:
.GEOMETRY - geometry from WG (default 'dusty', 'dusty', 'dusty')
.DUST - type of dust from WG (default 'MW', 'MW', 'MW')
.STRUCTURE - structure of dust from WG (default 'c', 'c', 'c')
.TAUV - optical depth at V (default 0., 1., 3.)
COMMENTS:
makes [Nobs, Nsfh] matrix where
Nobs = nlambda + nz*nfilters
units are absolute maggies per solar mass
BUGS:
needs to output *unsmoothed* spectra
should have better constrained emission lines
make sure DEEP filters are fixed
include Draine & Li templates
REVISION HISTORY:
29-Jul-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/seds/k_nmf_mmatrix_photoz.pro)
NAME:
k_nmf_spdata
PURPOSE:
put together sparse data for nmf fitting
CALLING SEQUENCE:
k_nmf_spdata
COMMENTS:
Assumes k_nmf_mmatrix has been run.
Takes data from sources:
1. SDSS photometric survey
ugrizJHK magnitudes
2. SDSS spectroscopic survey
optical spectrum smoothed to 300 km/s resolution
3. GALEX-SDSS matrix
FNugriz magnitudes
4. DEEP data
5. GOODS redshift sample data
Creates a file k_nmf_spdata.fits of the following form:
HDU0: NULL
HDU1: single-element structure of the form:
.NX - number of possible observations for each galaxy
.NY - number of galaxies
.ROWSTART[NY] - starting position in data block for
each galaxy
.NXROW[NY] - number of observations for each galaxy
HDU2: [NVAL] data block of floating-point values in absolute
maggies. If you constructed this sparse-sampling into a
[NX, NY] matrix it would look like (ROWSTART and NXROW
tell you how to do so):
NY=Ngals
NX=Ndata= nlambda+nfilter*nz
[0:nlambda-1L, *] is the spectral information
[nlambda:Ndata-1, *] is through the filters at each redshift
HDU3: [NVAL] data block of floating-point inverse variances
HDU4: [NVAL] block of column positions for each row (ie. which
observations exist for each galaxy (ROWSTART and NXROW
tell you to index this list)
HDU5: [Ndata]; effective central wavelength for each data point
HDU6: [Ngals]; distance (in redshift units) to each object
HDU7: [Ngals]; heliocentric redshift of each object
This file is readable by k_nmf_run.pro
REVISION HISTORY:
23-Nov-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/samples/k_nmf_spdata_goods.pro)
NAME:
k_nmf_spdata
PURPOSE:
put together sparse data for nmf fitting
CALLING SEQUENCE:
k_nmf_spdata
COMMENTS:
Assumes k_nmf_mmatrix has been run.
Takes data from sources:
1. SDSS photometric survey
ugrizJHK magnitudes
2. SDSS spectroscopic survey
optical spectrum smoothed to 300 km/s resolution
3. GALEX-SDSS matrix
FNugriz magnitudes
4. DEEP data
5. GOODS redshift sample data
Creates a file k_nmf_spdata.fits of the following form:
HDU0: NULL
HDU1: single-element structure of the form:
.NX - number of possible observations for each galaxy
.NY - number of galaxies
.ROWSTART[NY] - starting position in data block for
each galaxy
.NXROW[NY] - number of observations for each galaxy
HDU2: [NVAL] data block of floating-point values in absolute
maggies. If you constructed this sparse-sampling into a
[NX, NY] matrix it would look like (ROWSTART and NXROW
tell you how to do so):
NY=Ngals
NX=Ndata= nlambda+nfilter*nz
[0:nlambda-1L, *] is the spectral information
[nlambda:Ndata-1, *] is through the filters at each redshift
HDU3: [NVAL] data block of floating-point inverse variances
HDU4: [NVAL] block of column positions for each row (ie. which
observations exist for each galaxy (ROWSTART and NXROW
tell you to index this list)
HDU5: [Ndata]; effective central wavelength for each data point
HDU6: [Ngals]; distance (in redshift units) to each object
HDU7: [Ngals]; heliocentric redshift of each object
This file is readable by k_nmf_run.pro
REVISION HISTORY:
23-Nov-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/samples/k_nmf_spdata_lrg.pro)
NAME:
k_nmf_spdata
PURPOSE:
put together sparse data for nmf fitting
CALLING SEQUENCE:
k_nmf_spdata
COMMENTS:
Assumes k_nmf_mmatrix has been run.
Takes data from sources:
1. SDSS photometric survey
ugrizJHK magnitudes
2. SDSS spectroscopic survey
optical spectrum smoothed to 300 km/s resolution
3. GALEX-SDSS matrix
FNugriz magnitudes
4. DEEP data
5. GOODS redshift sample data
Creates a file k_nmf_spdata.fits of the following form:
HDU0: NULL
HDU1: single-element structure of the form:
.NX - number of possible observations for each galaxy
.NY - number of galaxies
.ROWSTART[NY] - starting position in data block for
each galaxy
.NXROW[NY] - number of observations for each galaxy
HDU2: [NVAL] data block of floating-point values in absolute
maggies. If you constructed this sparse-sampling into a
[NX, NY] matrix it would look like (ROWSTART and NXROW
tell you how to do so):
NY=Ngals
NX=Ndata= nlambda+nfilter*nz
[0:nlambda-1L, *] is the spectral information
[nlambda:Ndata-1, *] is through the filters at each redshift
HDU3: [NVAL] data block of floating-point inverse variances
HDU4: [NVAL] block of column positions for each row (ie. which
observations exist for each galaxy (ROWSTART and NXROW
tell you to index this list)
HDU5: [Ndata]; effective central wavelength for each data point
HDU6: [Ngals]; distance (in redshift units) to each object
HDU7: [Ngals]; heliocentric redshift of each object
This file is readable by k_nmf_run.pro
REVISION HISTORY:
23-Nov-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/samples/k_nmf_spdata_photoz.pro)
NAME:
k_nmf_spdata
PURPOSE:
put together sparse data for nmf fitting
CALLING SEQUENCE:
k_nmf_spdata
COMMENTS:
Assumes k_nmf_mmatrix has been run.
Takes data from sources:
1. SDSS photometric survey
ugrizJHK magnitudes
2. SDSS spectroscopic survey
optical spectrum smoothed to 300 km/s resolution
3. GALEX-SDSS matrix
FNugriz magnitudes
4. DEEP data
5. GOODS redshift sample data
Creates a file k_nmf_spdata.fits of the following form:
HDU0: NULL
HDU1: single-element structure of the form:
.NX - number of possible observations for each galaxy
.NY - number of galaxies
.ROWSTART[NY] - starting position in data block for
each galaxy
.NXROW[NY] - number of observations for each galaxy
HDU2: [NVAL] data block of floating-point values in absolute
maggies. If you constructed this sparse-sampling into a
[NX, NY] matrix it would look like (ROWSTART and NXROW
tell you how to do so):
NY=Ngals
NX=Ndata= nlambda+nfilter*nz
[0:nlambda-1L, *] is the spectral information
[nlambda:Ndata-1, *] is through the filters at each redshift
HDU3: [NVAL] data block of floating-point inverse variances
HDU4: [NVAL] block of column positions for each row (ie. which
observations exist for each galaxy (ROWSTART and NXROW
tell you to index this list)
HDU5: [Ndata]; effective central wavelength for each data point
HDU6: [Ngals]; distance (in redshift units) to each object
HDU7: [Ngals]; heliocentric redshift of each object
This file is readable by k_nmf_run.pro
REVISION HISTORY:
23-Nov-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/samples/k_nmf_spdata.pro)
NAME:
k_nmf_spdata
PURPOSE:
put together sparse data for nmf fitting
CALLING SEQUENCE:
k_nmf_spdata
COMMENTS:
Assumes k_nmf_mmatrix has been run.
Takes data from sources:
1. SDSS photometric survey
ugrizJHK magnitudes
2. SDSS spectroscopic survey
optical spectrum smoothed to 300 km/s resolution
3. GALEX-SDSS matrix
FNugriz magnitudes
4. DEEP data
5. GOODS redshift sample data
Creates a file k_nmf_spdata.fits of the following form:
HDU0: NULL
HDU1: single-element structure of the form:
.NX - number of possible observations for each galaxy
.NY - number of galaxies
.ROWSTART[NY] - starting position in data block for
each galaxy
.NXROW[NY] - number of observations for each galaxy
HDU2: [NVAL] data block of floating-point values in absolute
maggies. If you constructed this sparse-sampling into a
[NX, NY] matrix it would look like (ROWSTART and NXROW
tell you how to do so):
NY=Ngals
NX=Ndata= nlambda+nfilter*nz
[0:nlambda-1L, *] is the spectral information
[nlambda:Ndata-1, *] is through the filters at each redshift
HDU3: [NVAL] data block of floating-point inverse variances
HDU4: [NVAL] block of column positions for each row (ie. which
observations exist for each galaxy (ROWSTART and NXROW
tell you to index this list)
HDU5: [Ndata]; effective central wavelength for each data point
HDU6: [Ngals]; distance (in redshift units) to each object
HDU7: [Ngals]; heliocentric redshift of each object
This file is readable by k_nmf_run.pro
REVISION HISTORY:
23-Nov-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/samples/k_nmf_spdata_save.pro)
NAME:
k_nmf_spdata_spec
PURPOSE:
put together spectroscopic data for nmf fitting
CALLING SEQUENCE:
k_nmf_spdata_spec
COMMENTS:
Assumes k_nmf_mmatrix has been run.
Takes data from sources:
1. SDSS spectroscopic survey
optical spectrum smoothed to 300 km/s resolution
Creates a file k_nmf_spdata.fits of the following form:
HDU0: NULL
HDU1: single-element structure of the form:
.NX - number of possible observations for each galaxy
.NY - number of galaxies
.ROWSTART[NY] - starting position in data block for
each galaxy
.NXROW[NY] - number of observations for each galaxy
HDU2: [NVAL] data block of floating-point values in absolute
maggies. If you constructed this sparse-sampling into a
[NX, NY] matrix it would look like (ROWSTART and NXROW
tell you how to do so):
NY=Ngals
NX=Ndata= nlambda+nfilter*nz
[0:nlambda-1L, *] is the spectral information
[nlambda:Ndata-1, *] is through the filters at each redshift
HDU3: [NVAL] data block of floating-point inverse variances
HDU4: [NVAL] block of column positions for each row (ie. which
observations exist for each galaxy (ROWSTART and NXROW
tell you to index this list)
HDU5: [Ndata]; effective central wavelength for each data point
HDU6: [Ngals]; distance (in redshift units) to each object
HDU7: [Ngals]; heliocentric redshift of each object
This file is readable by k_nmf_run.pro
REVISION HISTORY:
23-Nov-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/samples/k_nmf_spdata_spec.pro)
NAME:
k_nmf_spdata_swire_blue
PURPOSE:
put together blue SWIRE catalog to fit
CALLING SEQUENCE:
k_nmf_spdata_swire_blue
COMMENTS:
Assumes k_nmf_mmatrix has been run.
Creates a file k_nmf_spdata.fits of the following form:
HDU0: NULL
HDU1: single-element structure of the form:
.NX - number of possible observations for each galaxy
.NY - number of galaxies
.ROWSTART[NY] - starting position in data block for
each galaxy
.NXROW[NY] - number of observations for each galaxy
HDU2: [NVAL] data block of floating-point values in absolute
maggies. If you constructed this sparse-sampling into a
[NX, NY] matrix it would look like (ROWSTART and NXROW
tell you how to do so):
NY=Ngals
NX=Ndata= nlambda+nfilter*nz
[0:nlambda-1L, *] is the spectral information
[nlambda:Ndata-1, *] is through the filters at each redshift
HDU3: [NVAL] data block of floating-point inverse variances
HDU4: [NVAL] block of column positions for each row (ie. which
observations exist for each galaxy (ROWSTART and NXROW
tell you to index this list)
HDU5: [Ndata]; effective central wavelength for each data point
HDU6: [Ngals]; distance (in redshift units) to each object
HDU7: [Ngals]; heliocentric redshift of each object
This file is readable by k_nmf_run.pro
REVISION HISTORY:
23-Nov-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/samples/k_nmf_spdata_swire_blue.pro)
NAME:
k_nmf_spdata_swire_red
PURPOSE:
put together red SWIRE catalog to fit
CALLING SEQUENCE:
k_nmf_spdata_swire_red
COMMENTS:
Assumes k_nmf_mmatrix has been run.
Creates a file k_nmf_spdata.fits of the following form:
HDU0: NULL
HDU1: single-element structure of the form:
.NX - number of possible observations for each galaxy
.NY - number of galaxies
.ROWSTART[NY] - starting position in data block for
each galaxy
.NXROW[NY] - number of observations for each galaxy
HDU2: [NVAL] data block of floating-point values in absolute
maggies. If you constructed this sparse-sampling into a
[NX, NY] matrix it would look like (ROWSTART and NXROW
tell you how to do so):
NY=Ngals
NX=Ndata= nlambda+nfilter*nz
[0:nlambda-1L, *] is the spectral information
[nlambda:Ndata-1, *] is through the filters at each redshift
HDU3: [NVAL] data block of floating-point inverse variances
HDU4: [NVAL] block of column positions for each row (ie. which
observations exist for each galaxy (ROWSTART and NXROW
tell you to index this list)
HDU5: [Ndata]; effective central wavelength for each data point
HDU6: [Ngals]; distance (in redshift units) to each object
HDU7: [Ngals]; heliocentric redshift of each object
This file is readable by k_nmf_run.pro
REVISION HISTORY:
23-Nov-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/samples/k_nmf_spdata_swire.pro)
NAME:
k_nmf_spdata_swire_red
PURPOSE:
put together red SWIRE catalog to fit
CALLING SEQUENCE:
k_nmf_spdata_swire_red
COMMENTS:
Assumes k_nmf_mmatrix has been run.
Creates a file k_nmf_spdata.fits of the following form:
HDU0: NULL
HDU1: single-element structure of the form:
.NX - number of possible observations for each galaxy
.NY - number of galaxies
.ROWSTART[NY] - starting position in data block for
each galaxy
.NXROW[NY] - number of observations for each galaxy
HDU2: [NVAL] data block of floating-point values in absolute
maggies. If you constructed this sparse-sampling into a
[NX, NY] matrix it would look like (ROWSTART and NXROW
tell you how to do so):
NY=Ngals
NX=Ndata= nlambda+nfilter*nz
[0:nlambda-1L, *] is the spectral information
[nlambda:Ndata-1, *] is through the filters at each redshift
HDU3: [NVAL] data block of floating-point inverse variances
HDU4: [NVAL] block of column positions for each row (ie. which
observations exist for each galaxy (ROWSTART and NXROW
tell you to index this list)
HDU5: [Ndata]; effective central wavelength for each data point
HDU6: [Ngals]; distance (in redshift units) to each object
HDU7: [Ngals]; heliocentric redshift of each object
This file is readable by k_nmf_run.pro
REVISION HISTORY:
23-Nov-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/samples/k_nmf_spdata_swire_red.pro)
NAME: k_photoz_test PURPOSE: test photometric redshifts on SDSS data CALLING SEQUENCE: k_photoz_test REVISION HISTORY: June 22, 2005 MRB
(See /home/users/mb144/kcorrect/pro/utils/k_photoz_test.pro)
NAME: k_plot_bc_colors PURPOSE: plot colors vs time for various models CALLING SEQUENCE: k_plot_bc_colors REVISION HISTORY: 02-May-2005 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_plot_bc_colors.pro)
NAME: k_plot_fits COMMENTS: Selects some representative galaxies and plots their fit SFH. REVISION HISTORY: 30-Nov-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/utils/k_plot_fits.pro)
NAME:
k_plot_templates
COMMENTS:
Creates:
templates_spec.ps - summary plot of the spectra of each template
templates_sfh.ps - summary plot of SFH of each template
REVISION HISTORY:
30-Nov-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/utils/k_plot_templates.pro)
NAME:
k_print
PURPOSE:
set up a postscript file output
CALLING SEQUENCE:
k_print, filename= [, tiny=, axis_char_scale=, pold=, xold=, $
yold=, colorname=, xsize=, ysize= ]
INPUTS:
filename - postscript file name for output
OPTIONAL INPUTS:
xsize, ysize - size (inches) of output file
OPTIONAL INPUT/OUTPUTS:
axis_char_scale - scaling of fonts
tiny - value for tiny numbers
OPTIONAL OUTPUTS:
colorname - names of available colors
pold, xold, yold - if these exist, sets to old values of !P, !X, !Y
(for input into k_end_print)
REVISION HISTORY:
26-Feb-2003 Written by M. Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_print.pro)
NAME:
k_projection_table
PURPOSE:
Create lookup table for calculating maggies corresponding to spectra
CALLING SEQUENCE:
k_projection_table, rmatrix, vmatrix, lambda, zvals, filterlist, $
[zmax=, zmin=, nz=, filterpath=, band_shift= ]
INPUTS:
vmatrix - templates spanning SED space [N_lambda, N_dim]
lambda - wavelengths for orthogonal templates [N_lambda]
filterlist - list of files with filter information [N_band]
OPTIONAL INPUTS:
filterpath - path for filters (default '$KCORRECT_DIR/data/filters')
band_shift - shift the bands blueward by factor (1+band_shift)
KEYWORDS:
silent - shut up
OUTPUTS:
rmatrix - look up table for vmatrix and filter information
[N_z, N_dim, N_band]
zvals - look up table for rmatrix [N_z]
OPTIONAL INPUT/OUTPUTS:
zmin, zmax, nz - settings for setting zvals (default 0., 2., 1000)
COMMENTS:
This tabulates the projection of each basis element v onto each
filter k, as a function of redshift. You only have to perform this
projection once, since every spectrum we will deal with will be a
linear combination of the basis elements b. To get a particular
redshift, you interpolate the rmatrix in the z direction. Keep in
mind that this only creates the r matrix for a specific redshift
range; e.g. you have to change the defaults in order to consider
redshifts greater than unity.
PROCEDURES CALLED:
k_load_filters
Dynamic link to idl_k_projection_table.c in libkcorrect.so
REVISION HISTORY:
05-Jan-2002 Translated to IDL by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/k_projection_table.pro)
NAME:
k_project_filters
PURPOSE:
project a flux onto a bandpass or set of bandpasses
CALLING SEQUENCE:
maggies=k_project_filters(lambda, flux [, filterlist=, $
filterpath=, band_shift=])
INPUTS:
lambda - [N+1] wavelength in angstroms at pixel edges
flux - [N] flux in ergs/cm^2/s/A at pixel centers
OPTIONAL INPUTS:
filterlist - list of filters (default to sdss set)
filterpath - paths to look for filters in
band_shift - blueward shift of bandpasses
COMMENTS:
More or less a wrapper on k_projection_table.
Outputs are in maggies (10.^(-0.4*magnitude)).
REVISION HISTORY:
17-Jan-2002 Translated to IDL by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_project_filters.pro)
NAME:
k_qa_nmf
COMMENTS:
Creates k_qa_nmf.ps, which has a number of QA plots on the NMF
fitting results, including colors as a function of redshift,
color-color plots, spectra vs. model spectra, star-formation
histories, etc.
Also determines:
mass-weighted metallicity of each template
mass-weighted age of each template
passive evolution estimates for each template, assuming constant
SFR into the future, based on looking 0.5 Gyr younger
makes standard vmatrix/lambda files
REVISION HISTORY:
30-Nov-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/seds/k_qa_nmf.pro)
NAME:
k_read_ascii_table
PURPOSE:
Read an ascii file in my standard format, which is:
<ndim> <size_{0}> ... <size_{ndim-1}>
<entry_0>
<entry_1>
...
<entry_n>
...
<entry_{size_0*size_1*..*size_{ndim-1}-1>
where the table element [k,j,i] (for ndim==3) would be the
entry element n, where n=i*size_2*size1+j*size2+k
CALLING SEQUENCE:
k_read_ascii_table,table,filename
INPUTS:
filename - file containing table
OPTIONAL INPUTS:
OUTPUTS:
table - table to read
OPTIONAL INPUT/OUTPUTS:
COMMENTS:
Only reads floating point tables.
EXAMPLES:
Here is an example of reading a [500,10] array from a file:
IDL> $wc bmatrix.default.dat
5001 5003 130037 bmatrix.default.dat
IDL> $head bmatrix.default.dat
2 10 500
4.1921895303265806e-04
4.1921245277927205e-04
4.1920432703966440e-04
4.1919374271866136e-04
4.1918060198276090e-04
4.1916390305939648e-04
4.1914261546946777e-04
4.1911632959028446e-04
4.1908366349717002e-04
IDL> k_read_ascii_table,bmatrix,'bmatrix.default.dat'
% Compiled module: K_READ_ASCII_TABLE.
IDL> help,bmatrix
BMATRIX DOUBLE = Array[500, 10]
REVISION HISTORY:
17-Jan-2002 Translated to IDL by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_read_ascii_table.pro)
NAME: k_read_basel PURPOSE: read in spectrum from a Basel spectrum file CALLING SEQUENCE: k_read_basel, lambda, flux, filename [, teff=, logg=, mh=, vturb=, xh= ] INPUTS: filename - file containing Basel format spectrum OUTPUTS: lambda - wavelengths at pixel centers flux - flux at each pixel teff, logg, mh, vturb, xh - basel parameters in file COMMENTS: 1221 elements *hard-coded* REVISION HISTORY: 17-Jan-2002 Translated to IDL by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/seds/k_read_basel.pro)
NAME:
k_read_dale.pro
PURPOSE:
reads the Dale SEDs
CALLING SEQUENCE:
dale=k_read_dale()
OUTPUTS:
dale - structure with
.LAMBDA - wavelength in angstroms
.FLUX - flux
BUGS:
What units are fluxes in?
Untested?
REVISION HISTORY:
2004-Dec-20 started by Hogg
_
(See /home/users/mb144/kcorrect/pro/seds/k_read_dale.pro)
NAME: k_read_tbl PURPOSE: Read 2MASS style table into IDL structure CALLING SEQUENCE: tbl= k_read_tbl(filename) INPUTS: filename - file name BUGS: not well commented REVISION HISTORY: Spring 2003, Written Malcolm Britton
(See /home/users/mb144/kcorrect/pro/utils/k_read_tbl.pro)
NAME:
k_reconstruct_maggies
PURPOSE:
Reconstruct AB galaxy maggies given an observed redshift
CALLING SEQUENCE:
k_reconstruct_maggies,coeffs,redshift,reconstruct_maggies [, $
band_shift=, zvals=, rmatrix=, vmatrix=, lambda=, $
filterpath=, filterlist=, zmin=, zmax=, nz= ]
INPUTS:
coeffs - [nv, ngals] coefficients
redshift - [ngals] redshift for each galaxy (where you want to
calculate maggies in model)
KEYWORDS:
silent - shut up
OUTPUTS:
reconstruct_maggies - [nk, ngals] maggies of each
OPTIONAL INPUT/OUTPUTS:
filterlist - [nk] list of files with filter information
filterpath - path for filterlist (default $KCORRECT_DIR/data/filters)
vmatrix - [nl,nk] templates spanning SED space
lambda - [nl+1] wavelengths for templates
rmatrix - [nz, nv, nk] look up table for bmatrix and filter
information
zvals - [nz] look up table for rmatrix
zmin, zmax - redshifts limits of lookup table (default 0., 2)
nz - number of redshifts in lookup table (default 1000)
band_shift - shift to apply to bandpasses (default 0.)
COMMENTS:
Reconstruct AB galaxy maggies given an observed redshift and a
shift to apply to the bandpasses (band_shift) under the assumption
that the bolometric flux is conserved. To reconstruct the
observed galaxy maggies:
k_reconstruct_maggies,coeffs,redshift,reconstruct_maggies
To construct what would be observed if the galaxies were observed
at z=0. through a bandpass blueshifted by z=0.1:
k_reconstruct_maggies,coeffs,replicate(0.,ngals),reconstruct_maggies, $
band_shift=replicate(0.1,ngals)
EXAMPLES:
Given coeffs from a call to k_fit_coeff or kcorrect, create
reconstructed maggies for each galaxy using default templates
IDL> k_reconstruct_maggies,coeffs,redshift,reconstruct_maggies
To K-correct all the maggies to the same redshift (0.1):
IDL> k_reconstruct_maggies, coeffs,replicate(0.1,n_elements(redshift)), $
reconstruct_maggies
REVISION HISTORY:
05-Jan-2002 Translated to IDL by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/k_reconstruct_maggies.pro)
NAME:
k_reconstruct_spec
PURPOSE:
Reconstruct galaxy rest-frame spectrum given a fit
CALLING SEQUENCE:
k_reconstruct_spec, coeffs, loglam, flux [, vname=, vdisp=, $
/nolines, /noextinct, /init, nt=, mass=, metallicity=, $
b300=, b1000=]
INPUTS:
coeffs - [NT, NGALS] coefficients
OUTPUTS:
loglam - [NL, NGALS] wavelengths
flux - [NL, NGALS] fluxes (ergs cm-2 s-1 A-1)
OPTIONAL KEYWORDS
/nolines - do not include lines
/noextinct - show unextincted spectra
/init - don't make a spectrum, just initialize
/reset - create the k_nmf_tspec.fits file if it doesn't exist
OPTIONAL INPUTS:
vname - name of fit to use (default 'default')
vdisp - smooth with this velocity dispersion
OPTIONAL OUTPUTS:
nt - total number of templates
mass, metallicity - properties of template fit;
mass is current stellar mass and is in units of
1 solar mass / (D/10pc)^2
b300 - star-formation within last 300Myrs relative to average
star-formation rate
b1000 - star-formation within last 1Gyrs relative to average
star-formation rate
COMMENTS:
If coeffs are standard, returns units of erg/cm^2/s/A
If vdisp, /nolines, and /noextinct
If lines are included, they are always smoothed at 300 km/s vdisp
Bases fit on file:
$KCORRECT_DIR/data/templates/k_nmf_derived.[vname].fits
REVISION HISTORY:
21-Apr-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/k_reconstruct_spec.pro)
NAME: k_run_nmf PURPOSE: run the nmf fitting code to get basis spectra CALLING SEQUENCE: k_run_nmf [, nt=, niter= ] OPTIONAL INPUTS: nt - number of templates to fit for (default 6) niter - number of iterations of fit (default 1000) OPTIONAL KEYWORDS: /qa - make qa plots at end /reset - ignore k_nmf_soln file if it exists COMMENTS: Requires k_nmf_mmatrix and k_nmf_spdata to have been run. Uses nmf_sparse for fitting. Puts results in k_nmf_soln.fits. Checks for existing k_nmf_soln.fits to use as starting point. Otherwise nmf_sparse chooses random starting point. REVISION HISTORY: 29-Nov-2004 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/fit/k_run_nmf.pro)
NAME: k_run_tests PURPOSE: runs tests on test data CALLING SEQUENCE: k_run_tests REVISION HISTORY: 2005-04-07 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_run_tests.pro)
NAME:
k_sdssfix
PURPOSE:
Take SDSS database asinh magnitudes and errors and "fixes" them
CALLING SEQUENCE:
k_sdssfix, mags, mags_err, maggies, maggies_ivar [, /standard, aboff=]
INPUTS:
mags - input asinh magnitudes (luptitudes)
mags_err - input uncertainties in mags
OUTPUTS:
maggies - best AB maggies to use
maggies_ivar - best inverse variance to use
KEYWORDS:
/standard - assume standard magnitudes, not luptitudes
COMMENTS:
This converts from SDSS database asinh magnitudes to AB maggies.
It "fixes" errors in the sense that for "bad" measurements or
errors you assign values which are not absurd. Not necessary for
Princeton-style input (which sets ivar to zero as
appropriate).
Also adds errors in quadrature:
sigma(ugriz) = [0.05, 0.02, 0.02, 0.02, 0.03]
to account for calibration uncertainties.
BUGS:
Needs better tracking of Eisenstein numbers
REVISION HISTORY:
07-Feb-2002 Written by Mike Blanton, NYU
03-Jun-2003 Updated to v3_0 by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_sdssfix.pro)
NAME: k_sdss_bell PURPOSE: Bell and de Jong stellar masses given SDSS absolute magnitudes CALLING SEQUENCE: smass= k_sdss_bell(absmag) INPUTS: absmag - [5, N] SDSS ugriz absolute magnitudes OUTPUTS: smass - stellar mass in solar masses REVISION HISTORY: 2005-04-07 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_sdss_bell.pro)
NAME: k_sdss_err2ivar PURPOSE: convert SDSS database magnitude error values to inverse variances CALLING SEQUENCE: k_sdss_err2ivar, err [, /verbose] INPUTS: err - [5, N] error values KEYWORDS: /verbose - loud about possible mistakes COMMENTS: This "fixes" errors in the sense that for "bad" measurements or errors you assign values which are not absurd. Not necessary for Princeton-style input (which sets ivar to zero as appropriate). REVISION HISTORY: 07-Feb-2002 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_sdss_err2ivar.pro)
NAME: k_sdss_tests PURPOSE: runs tests on SDSS test data CALLING SEQUENCE: k_sdss_tests REVISION HISTORY: 2005-04-07 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_sdss_tests.pro)
NAME:
k_sdss_tests_generic
PURPOSE:
runs tests on SDSS test data
CALLING SEQUENCE:
k_sdss_tests
COMMENTS:
Reads in spobj_test.fits and runs:
sdss_kcorrect to get corrections, evaluates chi2
does own corrections, runs kcorrect, evaluates chi2
compares these two
Reads in obj_test.fits and runs:
sdss_kcorrect to get corrections, evaluates chi2
does own corrections, runs kcorrect, evaluates chi2
compares these two
Compares all four of the above results.
DATA DEPENDENCIES:
$KCORRECT_DIR/data/test/obj_test.fits (calibObj version)
$KCORRECT_DIR/data/test/spobj_test.fits (tsObj version)
REVISION HISTORY:
2005-04-07 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_sdss_tests_generic.pro)
NAME: k_sdss_tests_lrg PURPOSE: runs tests on SDSS test data CALLING SEQUENCE: k_sdss_tests_main DATA DEPENDENCIES: $KCORRECT_DIR/data/test/sdss_tests_lrg.fits (builds if not there) REVISION HISTORY: 2005-04-07 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_sdss_tests_lrg.pro)
NAME: k_sdss_tests_main PURPOSE: runs tests on SDSS test data CALLING SEQUENCE: k_sdss_tests_main DATA DEPENDENCIES: $KCORRECT_DIR/data/test/sdss_tests_main.fits (builds if not there) REVISION HISTORY: 2005-04-07 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_sdss_tests_main.pro)
NAME:
k_smooth
PURPOSE:
gaussian smooth a spectrum
CALLING SEQUENCE:
outflux= k_smooth(loglam, flux, vdisp)
INPUTS:
loglam - log_{10} of the wavelength in Angstroms
flux - input flux
vdisp - gaussian velocity width in km/s (ignores if < 10 km/s)
OUTPUTS:
outflux - smoothed flux
WARNINGS:
Does NOTHING if vdisp < 10 km/s
REVISION HISTORY:
05-May-2005 Michael Blanton (NYU)
(See /home/users/mb144/kcorrect/pro/utils/k_smooth.pro)
NAME:
k_solar_magnitudes
PURPOSE:
calculate the solar magnitudes for bandpasses
CALLING SEQUENCE:
solar_magnitudes= k_solar_magnitudes([band_shift=, filterlist=, $
filterpath=, solarname=])
OPTIONAL INPUTS:
filterlist - list of filters (default
['sdss_u0.par','sdss_g0.par','sdss_r0.par','sdss_i0.par', $
'sdss_z0.par'])
filterpath - path in which to look for filters
band_shift - shift to apply to band passes
solarname - name of solar model
OUTPUTS:
solar_magnitudes - absolute magnitude of sun in specified bands
EXAMPLES:
IDL> print,k_solar_magnitudes()
K_READ_BASEL: 1 block(s) of spectra
K_PROJECTION_TABLE: Creating rmatrix ...
K_PROJECTION_TABLE: Done.
6.3800855 5.1210220 4.6432452 4.5322263 4.5107040
IDL> print,k_solar_magnitudes(band_shift=0.1)
K_READ_BASEL: 1 block(s) of spectra
K_PROJECTION_TABLE: Creating rmatrix ...
K_PROJECTION_TABLE: Done.
6.7792312 5.4336204 4.7553857 4.5749466 4.5155073
REVISION HISTORY:
17-Jan-2002 Translated to IDL by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_solar_magnitudes.pro)
NAME:
k_spec_pegase
PURPOSE:
interpolate pegase results onto a wavelength grid
CALLING SEQUENCE:
k_spec_pegase, peg, spec, lambda [, nl=, lmin=, lmax=, linewidth=, $
/nocontinuum ]
INPUTS:
peg - pegase structure
OPTIONAL INPUTS:
nl - number of wavelengths (default 5000)
l[min|max] - wavelength limits (defaults minmax(peg.cont))
linewidth - width of gaussian to use to put in lines (default 10)
KEYWORDS:
/nocontinuum - leave out continuum
OUTPUTS:
spec - [nl] output spectrum
lambda - [nl+1] pixel edges
REVISION HISTORY:
25-Jul-2002 Translated to IDL by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/seds/k_spec_pegase.pro)
NAME: k_swire_tests PURPOSE: runs tests on SWIRE data CALLING SEQUENCE: k_swire_tests DATA DEPENDENCIES: $KCORRECT_DIR/data/test/swire_tests.fits (builds if not there) REVISION HISTORY: 2005-04-07 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_swire_tests.pro)
NAME:
k_test_data
PURPOSE:
gather test data and put into $KCORRECT_DIR/data/test
CALLING SEQUENCE:
k_test_data [, /sdss, /deep, /galex, /twomass, /synth]
KEYWORDS:
/sdss - gather data from spAll.fits and from Fermi spSpec files
/deep - gather some DEEP data
/galex - gather some GALEX data, and match to SDSS
/twomass - gather some TWOMASS data, and match to SDSS
/synth - synthesize some data
/all - do all of above
COMMENTS:
Creates in $KCORRECT_DIR/data/test:
spall_test.fits
spobj_test.fits
galex_test.fits
deep_test.fits
twomass_test.fits
synth_test.fits
BUGS:
Not finished yet.
REVISION HISTORY:
07-Apr-2005 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/samples/k_test_data.pro)
NAME: k_tweak_photoz PURPOSE: Read in data and use it to tweak the photo-z templates CALLING SEQUENCE: k_tweak_photoz, vname=vname COMMENTS: currently experimental REVISION HISTORY: 01-May-2003 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/k_tweak_photoz.pro)
NAME:
k_tweak_templates
PURPOSE:
Given a set of templates, tweak em to better fit
CALLING SEQUENCE:
k_tweak_templates, maggies, maggies_ivar, coeffs, vmatrix,
lambda, filterlist=filterlist
INPUTS:
maggies - maggies for each galaxy
maggies_ivar - inverse variance of maggie values
coeffs - coefficients
vmatrix - array of template spectra
lambda - lambda pixel boundaries
OPTIONAL INPUTS:
filterlist - list of filters to use
COMMENTS:
Minimizes chi^2 of the difference between the maggies and the
reconstructed maggies by multiplying the template spectra by
a low-order polynomial and running with that.
REVISION HISTORY:
24-Apr-2003 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/k_tweak_templates.pro)
NAME: k_twomass_tests PURPOSE: runs tests on 2MASS+SDSS test data CALLING SEQUENCE: k_twomass_tests DATA DEPENDENCIES: $KCORRECT_DIR/data/test/twomass_tests.fits (builds if not there) REVISION HISTORY: 2005-04-07 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_twomass_tests.pro)
NAME:
k_vega2ab
PURPOSE:
Calculate conversion such that m_AB = m_Vega + k_vega2ab()
CALLING SEQUENCE:
vega2ab=k_vega2ab([ filterlist=, filterpath=, band_shift=, $
/kurucz, /hayes])
INPUTS:
OPTIONAL INPUTS:
filterlist - list of .par files with filters ([default:
['sdss_u0.par', 'sdss_g0.par', 'sdss_r0.par',
'sdss_i0.par', 'sdss_z0.par'])
filterpath - path where to find them
band_shift - blueward shift of bandpass (factor 1.+band_shift)
/kurucz - use the Kurucz 1991 model spectrum
/hayes - use the Hayes spectrophotometry
OUTPUTS:
vega2ab - term to add to a Vega magnitude in given band to convert
to an AB magnitude
COMMENTS:
We can compare the results of this conversion with the results of
Bessell (1993) in IAU Colloq. 136: Stellar Photometry - Current
Techniques and Future Developments for the Bessell bandpasses:
IDL> print,3631.*10.^(-0.4*k_vega2ab(filterlist=['bessell_B.par','bessell_V.par','bessell_R.par','bessell_I.par'],/kurucz))/[4000.,3600.,3060.,2420.]
K_READ_BASEL: 1 block(s) of spectra
K_PROJECTION_TABLE: Creating rmatrix ...
K_PROJECTION_TABLE: Done.
0.98735007 0.98666174 0.97275494 0.98666968
IDL> print,3631.*10.^(-0.4*k_vega2ab(filterlist=['bessell_B.par','bessell_V.par','bessell_R.par','bessell_I.par'],/hayes))/[4000.,3600.,3060.,2420.]
K_PROJECTION_TABLE: Creating rmatrix ...
K_PROJECTION_TABLE: Done.
1.0158529 0.98916833 0.97277257 0.98920956
IDL> $date
Tue Apr 29 20:31:21 EDT 2003
The first version uses the Kurucz 1991 models from the BaSeL
distribution (ADC: J/A+AS/125/229); the second the Hayes
spectrophotometry, as transcribed by Hogg (see details in the
data/filters/hoggraw/hayes directory).
PROCEDURES CALLED:
k_load_filters
k_project_filters
readcol (idlutils)
REVISION HISTORY:
17-Jan-2002 Translated to IDL by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_vega2ab.pro)
NAME: k_version PURPOSE: Return the version name for the product kcorrect CALLING SEQUENCE: vers = k_version() OUTPUTS: vers - Version name for the product kcorrect COMMENTS: If this version is not tagged by CVS, then we return 'NOCVS:TOPLEVEL' where TOPLEVEL is the last directory in the environment variable $KCORRECT_DIR. For example, if you are using a version of the code in the directory '/u/schlegel/kcorrect/v0_0', then this returns 'NOCVS:v0_0'. REVISION HISTORY: 01-Dec-1999 Written by D. Schlegel, Princeton.
(See /home/users/mb144/kcorrect/pro/utils/k_version.pro)
NAME:
k_write_ascii_table
PURPOSE:
Write an ascii file in my standard format
<ndim> <size_{0}> ... <size_{ndim-1}>
<entry_0>
<entry_1>
...
<entry_n>
...
<entry_{size_0*size_1*..*size_{ndim-1}-1>
where the table element [k,j,i] (for ndim==3) would be the
entry element n, where n=i*size_2*size1+j*size2+k
CALLING SEQUENCE:
k_write_ascii_table,table,filename
INPUTS:
filename - file containing table
table - table to write
OPTIONAL INPUTS:
OUTPUTS:
OPTIONAL INPUT/OUTPUTS:
COMMENTS:
Only writes floating point tables.
EXAMPLES:
Writing a [500,10] array:
IDL> help,bmatrix
BMATRIX DOUBLE = Array[500, 10]
IDL> k_write_ascii_table,bmatrix,'bmatrix.default.dat'
% Compiled module: K_WRITE_ASCII_TABLE.
IDL> $head bmatrix.default.dat
2 10 500
4.1921895303265806e-04
4.1921245277927205e-04
4.1920432703966440e-04
4.1919374271866136e-04
4.1918060198276090e-04
4.1916390305939648e-04
4.1914261546946777e-04
4.1911632959028446e-04
4.1908366349717002e-04
IDL> $wc bmatrix.default.dat
5001 5003 130037 bmatrix.default.dat
REVISION HISTORY:
17-Jan-2002 Translated to IDL by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/k_write_ascii_table.pro)
NAME:
lf_amdist_plot
PURPOSE:
plot distribution of absmag in bins of distance, along with model
CALLING_SEQUENCe:
lf_amdist_plot,zz_data,am_data,zz_model,am_model, filename= [ ,fadjust=, $
zlimits=, sample_absmmin=, sample_absmmax=, nbins=, $
band=band, ylog=ylog ]
INPUTS:
zz_data - redshifts of data
am_data - absmags of data
zz_model - redshifts of model
am_model - absmags of model
filename - output postscript file name
OPTIONAL INPUTS:
fadjust - adjust for sampling fraction (default 1.)
zlimits - [2] limiting redshifts of plot
sample_absmmin, sample_absmmax - absmag limits to use
nbins - number of redshift bins
band - 0-4 corresponds to ugriz
KEYWORDS:
/ylog - plot on log scale
REVISION HISTORY:
2002-5-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_amdist_plot.pro)
NAME:
lf_calc_vmax
PURPOSE:
calculate vmax for an object, given the flux and redshift limits
USAGE:
lf_calc_vmax,appm,
absm,coeffs,filtername,marea,mmin,mmax,sample_zmin, $
sample_zmax, [, band_shift=, im=, omega0=, omegal0=, vmax= ]
INPUTS:
absm [N] absolute magnitudes
coeffs [NT, N] K-correction coeffs for each galaxy
filtername name of filter to use
marea [NA] area of mag limit region
mmin [NA] minimum apparent mag for each mag limit region
mmax [NA] maximum apparent mag for each mag limit region
sample_zmin minimum redshift of sample
sample_zmax maximum redshift of sample
OPTIONAL INPUTS:
band_shift shift in defn of absm
im [N] index of magnitude limit region (default 0)
omega0 omega_matter to use (default: 0.3)
omegal0 omega_lambda to use (default: 0.7)
OUTPUTS:
zmin [N] local zmin of each
zmax [N] local zmax of each
vmax [N] vmax of each integrated over all mag limit regions
COMMENTS:
vmax is returned in h^{-3} Mpc^3 comoving
DEPENDENCIES:
idlutils
kcorrect (in kcorrect product)
REVISION HISTORY:
2002-11-17 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_calc_vmax.pro)
NAME: lf_comvol PURPOSE: Calculate the comoving volume out to a certain redshift CALLING SEQUENCE: comvol=lf_comvol(z [, omega0=, omegal0= ]) INPUTS: z - redshift OPTIONAL INPUTS: omega0 - matter density (default 0.3) omegal0 - vacuum energy density (default 0.7) COMMENTS: Uses the ztransform routines returns R^3 in equation V=4*PI*R^3/3. REVISION HISTORY: 2002-5-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_comvol.pro)
NAME: lf_distmod PURPOSE: Calculate distance modulus USAGE: dm=lf_distmod(z [, omega0=, omegal0=]) INPUTS: z [N] redshifts OPTIONAL INPUTS: omega0 omega_matter to use (default: 0.3) omegal0 omega_lambda to use (default: 0.7) OUTPUTS: dm - distance modulus REVISION HISTORY: 2002-11-17 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_distmod.pro)
NAME:
lf_eep
PURPOSE:
calculate EEP luminosity function
USAGE:
lf_eep,zz,absmag,kcorrect,mmin,mmax,sample_absmmin,sample_absmmax,
absmk, phi, phi_err, [ nbin=, q0=, q1=, qz0=, $
omega0=, omegal0=, /calc_err ]
INPUTS:
zz [N] redshifts
absmag [N] absolute magnitudes (kcorrected, unevolved)
kcorrect [N] K-correction for each galaxy
mmin [N] minimum apparent mag for each galaxy
mmax [N] maximum apparent mag for each galaxy
sample_absmmin observed absolute magnitude minimum of sample
sample_absmmax observed absolute magnitude maximum of sample
OPTIONAL INPUTS:
q0, q1, qz0 evolution model (pass to k_evolve())
omega0 omega_matter to use (default: 0.3)
omegal0 omega_lambda to use (default: 0.7)
KEYWORDS:
/calc_err if set, calculate the error bars
OUTPUTS:
absmk center of each bin
phi amplitude of each bin
phi_err error in each bin
REVISION HISTORY:
2003-10-20 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_eep.pro)
NAME: lf_erf PURPOSE: calculate error function USAGE: y= lf_erf(x) INPUTS: x - input value OUTPUTS: y - erf(x) COMMENTS: Calculates as 1.-lf_erfc() REVISION HISTORY: 2003-10-20 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_erf.pro)
NAME: lf_erfc PURPOSE: calculate complementary error function USAGE: y= lf_erfc(x) INPUTS: x - input value OUTPUTS: y - erfc(x) COMMENTS: Calculates using approximation from Press et al. (1992) REVISION HISTORY: 2003-10-20 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_erfc.pro)
NAME:
lf_fit_schechter
PURPOSE:
fit schechter function to set of points
USAGE:
lf_fit_schechter, absmag, phi, phierr, schechter [, mden=]
INPUTS:
absmag - absolute magnitude at center of each bin
phi - luminosity function at each bin
phierr - error in l.f. at each bin
OUTPUTS:
schechter - structure with
.PHISTAR
.MSTAR
.ALPHA
.PHISTAR_ERR
.MSTAR_ERR
.ALPHA_ERR
OPTIONAL OUTPUTS:
mden - total luminosity density in magnitudes of fit
REVISION HISTORY:
2002-7-04 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_fit_schechter.pro)
NAME:
lf_fit_schechter_plus
PURPOSE:
fit "double" schechter function to set of points
USAGE:
lf_fit_schechter_plus, absmag, phi, phierr, schechter_plus [, mden=]
INPUTS:
absmag - absolute magnitude at center of each bin
phi - luminosity function at each bin
phierr - error in l.f. at each bin
OUTPUTS:
schechter - structure with
.MSTAR
.PHISTAR
.ALPHA
.PHIPLUS
.ALPHAPLUS
.MSTAR_ERR
.PHISTAR_ERR
.ALPHA_ERR
.PHIPLUS_ERR
.ALPHAPLUS_ERR
OPTIONAL OUTPUTS:
mden - total luminosity density in magnitudes of fit
COMMENTS:
The version of the double schechter function we use here is the
sum of two Schecter functions with the same exponential cutoff but
different normalizations and faint-end slopes. Returns the steeper
faint end slope term in PHIPLUS and ALPHAPLUS.
REVISION HISTORY:
2002-7-04 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_fit_schechter_plus.pro)
NAME:
lf_md_eep
PURPOSE:
calculate normalization of EEP fit from lf_eep
USAGE:
lf_md_eep, marea, zz, sel, zvals, selfunc, fraclimits, n1, n1err [, $
j3=, /simple, weight=, omega0=, omegal0=]
INPUTS:
marea - [Nm] completeness-weight area of each region with a
constant flux limit
zz - [Ngals] redshift of each galaxy
sel - [Ngals] selection function for each galaxy
zvals - [Nz] redshift grid
selfunc - [Nz, Nm] selection function grid in each region
fraclimits - fraction of area in each region
OPTIONAL INPUTS:
j3 - J_3 value of Davis&Huchra (1983) for optimal weighting scheme
(default to 10000.)
weight - weight to apply to each galaxy (default to 1.)
omega0 - matter density (default 0.3)
omegal0 - vacuum energy density (default 0.7)
OPTIONAL KEYWORDS:
/simple - don't do optimal weighting, do simple weighting
OUTPUTS:
n1 - normalization of EEP fit
n1err - uncertainty in normalization
REVISION HISTORY:
2002-5-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_md_eep.pro)
NAME:
lf_mean_density
PURPOSE:
calculate mean density given npgauss luminosity function
USAGE:
lf_mean_density, zz, sf, fraclimits, iabsmerr, immin, immax, $
ikcorrect, uniqabsmerr, uniqmmin, uniqmmax, uniqkcorrect, $
sample_absmmin, sample_absmmax, model_absmmin, model_absmmax, $
sample_zmin, sample_zmax, phi, absmk, sigabsmag, q, p, n1, n1err $
[, zzero=, nzvals=, omega0=, omegal0=, j3=, /simple, rhozpars=, $
rhozfunc=, zvals= ]
INPUTS:
zz - [N] redshifts
sf - [N] selection function for each galaxy
fraclimits - [Nm] fraction of area in each region with constant
flux limit
iabsmerr - [N] index indicating which discrete value of error to
use from uniqabsmerr
immin - [N] index indicating which discrete value of bright flux
limit to use from uniqmmin
immax - [N] index indicating which discrete value of faint flux
limit to use from uniqmmax
ikcorrect - [N] index indicating which kcorrect template to
use from uniqkcorrect
uniqabsmerr - [Nerr] discrete values of error
uniqmmin - [Nmin] discrete values of bright flux limit
uniqmmax - [Nmin] discrete values of faint flux limit
uniqkcorrect - [nzvals, Nk] kcorrections as a function of
redshiift for each template
sample_absmmin, sample_absmmax - sample limits on absolute mag
sample_zmin, sample_zmax - sample limits on redshift
phi, absmk, sigabsmag, q, p - description of l.f.
OPTIONAL INPUTS:
nzvals - number of redshift in kcorrect templates (default 50)
zzero - reference redshift for q and p evolution (default 0.1)
omega0 - matter density (default 0.3)
omegal0 - vacuum energy density (default 0.7)
rhozpars, rhozfunc - if we have fit out the radial density function
OPTIONAL KEYWORDS:
/simple - do simple weighting
OUTPUTS:
n1, n1err - mean density and error
OPTIONAL OUTPUTS:
zvals - redshift steps
BUGS:
DEPENDENCIES:
REVISION HISTORY:
2002-5-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_mean_density.pro)
NAME:
lf_mock_npgauss
PURPOSE:
create mock catalog given npgauss luminosity function
USAGE:
lf_mock_npgauss, ntotal, mmin, mmax, fgot, area, absmk, phi, p, q, $
sigabsmag, sample_absmmin, sample_absmmax, model_absmmin, $
model_absmmax, sample_zmin,sample_zmax, ikcorrect, $
uniqkcorrect, absmerr [, absmout=, zzout=, appmout=, absmerrout=, $
ikcorrectout=, kcorrectout=, fadjust=, omega0=, omegal0=, $
nzvals=, zzero=, rhozpars=, rhozfunc=,zvals=,sample_nzvals= ]
INPUTS:
ntotal - total number of galaxies in volume (not total output!)
mmin, mmax - [ntotal] flux limits of each galaxy
fgot - [ntotal] chances of observing each galaxy
area - total area of sample
absmk, phi, sigabsmag, p, q - description of npgauss l.f.
sample_absmmin, sample_absmmax - abs. mag. limits of sample
model_absmmin, model_absmmax - abs. mag. limits to model
sample_zmin, sample_zmax - redshift limits of sample
ikcorrect - [ngals] available kcorrections to choose from
uniqkcorrect - [nzvals, nk] available k-correction functions
absmerr - [ngals] available uncertainties to choose from
OPTIONAL INPUTS:
nzvals - number of redshift in kcorrect templates (default 50)
zvals - [nzvals] redshift grid
zzero - reference redshift for q and p evolution (default 0.1)
omega0 - matter density (default 0.3)
omegal0 - vacuum energy density (default 0.7)
rhozpars, rhozfunc - if we have fit out the radial density function
OPTIONAL OUPUTS:
absmout - [nout] abs. mag. of final galaxies
zzout - [nout] redshifts of final galaxies
appmout - [nout] apparent mag of final galaxies
absmerrout - [nout] uncertainties on abs. mag. of final galaxies
ikcorrectout - [nout] which kcorrection functions for final galaxies
kcorrectout - [nout] actual kcorrections for final galaxies
fadjust - ratio of number in actual universion to from number
gotten in mock to number in actual (to compare redshift
histograms, say)
REVISION HISTORY:
2002-5-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_mock_npgauss.pro)
NAME:
lf_mock_schechter
PURPOSE:
create mock catalog given schechter luminosity function
USAGE:
lf_mock_npgauss, ntotal, mmin, mmax, fgot, area, schechter, p, q, $
sigabsmag, sample_absmmin, sample_absmmax, model_absmmin, $
model_absmmax, sample_zmin,sample_zmax, ikcorrect, $
uniqkcorrect, absmerr [, absmout=, zzout=, appmout=, absmerrout=, $
ikcorrectout=, kcorrectout=, fadjust=, omega0=, omegal0=, $
nzvals=, zzero=, rhozpars=, rhozfunc=,zvals=,sample_nzvals= ]
INPUTS:
ntotal - total number of galaxies in volume (not total output!)
mmin, mmax - [ntotal] flux limits of each galaxy
fgot - [ntotal] chances of observing each galaxy
area - total area of sample
schechter, p, q - description of schechter l.f. + evolution
sample_absmmin, sample_absmmax - abs. mag. limits of sample
model_absmmin, model_absmmax - abs. mag. limits to model
sample_zmin, sample_zmax - redshift limits of sample
ikcorrect - [ngals] available kcorrections to choose from
uniqkcorrect - [nzvals, nk] available k-correction functions
absmerr - [ngals] available uncertainties to choose from
OPTIONAL INPUTS:
nzvals - number of redshift in kcorrect templates (default 50)
zvals - [nzvals] redshift grid
zzero - reference redshift for q and p evolution (default 0.1)
omega0 - matter density (default 0.3)
omegal0 - vacuum energy density (default 0.7)
rhozpars, rhozfunc - if we have fit out the radial density function
OPTIONAL OUPUTS:
absmout - [nout] abs. mag. of final galaxies
zzout - [nout] redshifts of final galaxies
appmout - [nout] apparent mag of final galaxies
absmerrout - [nout] uncertainties on abs. mag. of final galaxies
ikcorrectout - [nout] which kcorrection functions for final galaxies
kcorrectout - [nout] actual kcorrections for final galaxies
fadjust - ratio of number in actual universion to from number
gotten in mock to number in actual (to compare redshift
histograms, say)
REVISION HISTORY:
2002-5-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_mock_schechter.pro)
NAME:
lf_normalize
PURPOSE:
normalize npgauss function so integral is unity
INPUTS:
absmk - centers of gaussians
phi - heights of gaussians (changed on output)
sample_absmmin, sample_absmmax - abs. mag. limits
sigabsmag - width of gaussian (recommended to be
0.7*(sample_absmmax-sample_absmmin)/nphi)
COMMENTS:
Changes phi to make integral unity.
REVISION HISTORY:
2002-5-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_normalize.pro)
NAME:
lf_npgauss
PURPOSE:
calculate luminosity function in presence of uncertainties and
errors, plus evolution and large scale structure
USAGE:
lf_npgauss,zz,absmag,absmerr,kcorrect,ikcorrect,uniqkcorrect, $
nzvals,mmin,mmax,sigabsmag,mkspacing, $
sample_absmmin,sample_absmmax,sample_zmin,sample_zmax, $
absmk,phi,q,p [,rhozpars, omega0=, omegal0=, zzero=, $
limit_precision=, error_precision=, error_min=, $
error_max=, iabsmerr=, immin=, immax=, uniqabsmerr=, $
uniqmmin=, uniqmmax=, maxiter=, fixp=, fixq=, $
nborder=, qaplot=, qaschechter=, rhozfunc=, rhozcovar=, $
lssfix=, lnlike=, init_power= ]
INPUTS:
zz [N] redshifts
absmag [N] absolute magnitudes
absmerr [N] absolute magnitude errors
kcorrect [N] K-correction for each galaxy
ikcorrect [N] index of K-correction function for each gal
uniqkcorrect [nzvals,N_k] K(z) for each K-correction function
nzvals number of redshift slices in each K-correction fn
mmin [N] minimum apparent mag for each galaxy
mmax [N] maximum apparent mag for each galaxy
sigabsmag width of each gaussian in fit
mkspacing distance btw each gaussian in fit (approximate)
sample_absmmin observed absolute magnitude minimum of sample
sample_absmmax observed absolute magnitude maximum of sample
sample_zmin minimum redshift of sample
sample_zmax maximum redshift of sample
OPTIONAL KEYWORDS:
/lssfix fit for rhoz functions
OPTIONAL INPUTS:
omega0 omega_matter to use (default: 0.3)
omegal0 omega_lambda to use (default: 0.7)
zzero redshift to center fit on (default: 0.1)
limit_precision limit t
rhozfunc, rhozcovar - radial density functions
OUTPUTS:
absmk peak of each gaussian
phi amplitude of each gaussian
q evolution of lum
p evolution of num
rhozpars parameters multiplying the radial density functions
lnlike output likelihood
REVISION HISTORY:
2002-5-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_npgauss.pro)
NAME:
lf_plotps
PURPOSE:
plot a luminosity function
INPUTS:
absmk, phi, sigabsmag - description of npgauss l.f.
sample_absmmin - minimum abs mag for the sample
sample_absmmax - maximum abs mag for the sample
OPTIONAL INPUTS:
subsample - sample the function at this sampling (default 10)
filename - output file name (default 'npgauss_lf.ps')
schecter - structure with .PHISTAR, .MSTAR, .ALPHA to show for
comparison (default none)
OPTIONAL KEYWORDS:
/noclose - do not close file
OPTIONAL OUTPUTS:
pold, xold, yold - saved !P, !X, !Y before any changes
phivals, amvals - l.f. values at the output abs. mags.
REVISION HISTORY:
2002-5-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_plotps.pro)
NAME:
lf_sample_npgauss
PURPOSE:
create a sampling in redshift and absolute magnitude based on npgauss lf
USAGE:
lf_sample_npgauss, ndesired, absmk, phi, p, q, sigabsmag, model_absmmin, $
model_absmmax, sample_zmin, sample_zmax [ , absmout=, zzout=, $
fpadjust=, omega0=, omegal0=, zzero=, nzvals=, rhozpars=, $
rhozfunc=, zvals=, sample_nzvals=]
INPUTS:
ndesired - number of samples wanted
absmk, phi, p, q, sigabsmag - description of npgauss lf
model_absmmin, model_absmmax - abs. mag. limits of model
sample_zmin, sample_zmax - redshift limits for sampling
OPTIONAL INPUTS:
nzvals - number of redshift in kcorrect templates (default 50)
zvals - [nzvals] redshift grid
zzero - reference redshift for q and p evolution (default 0.1)
omega0 - matter density (default 0.3)
omegal0 - vacuum energy density (default 0.7)
rhozpars, rhozfunc - if we have fit out the radial density function
OPTIONAL OUTPUTS:
absmout - [nout] abs. mag. of final galaxies
zzout - [nout] redshifts of final galaxies
fadjust - ratio of number in actual universion to from number
gotten in mock to number in actual (to compare redshift
histograms, say)
REVISION HISTORY:
2002-5-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_sample_npgauss.pro)
NAME:
lf_sample_schechter
PURPOSE:
create a sampling in redshift and absolute magnitude based on schechter lf
USAGE:
lf_sample_schechter, ndesired, schechter, p, q, model_absmmin, $
model_absmmax, sample_zmin, sample_zmax [ , absmout=, zzout=, $
fpadjust=, omega0=, omegal0=, zzero=, nzvals=, rhozpars=, $
rhozfunc=, zvals=, sample_nzvals=]
INPUTS:
ndesired - number of samples wanted
schechter, p, q - description of schechter lf
model_absmmin, model_absmmax - abs. mag. limits of model
sample_zmin, sample_zmax - redshift limits for sampling
OPTIONAL INPUTS:
nzvals - number of redshift in kcorrect templates (default 50)
zvals - [nzvals] redshift grid
zzero - reference redshift for q and p evolution (default 0.1)
omega0 - matter density (default 0.3)
omegal0 - vacuum energy density (default 0.7)
rhozpars, rhozfunc - if we have fit out the radial density function
OPTIONAL OUTPUTS:
absmout - [nout] abs. mag. of final galaxies
zzout - [nout] redshifts of final galaxies
fadjust - ratio of number in actual universion to from number
gotten in mock to number in actual (to compare redshift
histograms, say)
REVISION HISTORY:
2002-5-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_sample_schechter.pro)
NAME:
lf_schechter
PURPOSE:
given schechter parameters and absolute mags, return vals
CALLING SEQUENCE:
vals= lf_schechter(absmag, phistar, mstar, alpha)
OR
vals= lf_schechter(absmag, schechter)
INPUTS:
absmag - [N] set of absolute magnitudes
AND:
phistar - phi* parameter in schechter defn
mstar - M* parameter in schechter defn
alpha - alpha parameter ('faint end slope') in schechter defn
OR:
schechter - structure with phistar, mstar, alpha entries
REVISION HISTORY:
20-Oct-2003 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/lf/lf_schechter.pro)
NAME:
lf_schechter_counts
PURPOSE:
Predicts magnitude counts from Schechter fn.
USAGE:
counts=lf_schechter_counts(mmin, mmax, schechter, q, p, kcorrect, $
zvals [, omega0=, omegal0=, zzero=, integrand= ]
INPUTS:
mmin, mmax - flux range to consider
schechter, q, p - description of evolving schechter function
kcorrect, zvals - grid of typical K-corrections
OPTIONAL INPUTS:
zzero - reference redshift for q and p evolution (default 0.1)
omega0 - matter density (default 0.3)
omegal0 - vacuum energy density (default 0.7)
OPTIONAL OUTPUTS:
integrand - redshift counts
REVISION HISTORY:
2002-8-25 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_schechter_counts.pro)
NAME:
lf_schechter_mden
PURPOSE:
calculate total luminosity density from schechter function
USAGE:
mden= lf_schechter_mden(schechter [, limits=, bin=])
INPUTS:
schechter - structure containing schechter pars
(.PHISTAR, .MSTAR, .ALPHA)
OPTIONAL INPUTS:
limits - [2] limits of integration (default to [MSTAR-5., MSTAR+10.])
bin - binning of integration (default to 0.02)
OUTPUTS:
mden - total luminosity density in magnitude units
REVISION HISTORY:
2002-7-04 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_schechter_mden.pro)
NAME:
lf_schechter_mden_plus
PURPOSE:
calculate total luminosity density from schechter function
USAGE:
mden= lf_schechter_mden_plus(schechter_plus [, limits=, bin=])
INPUTS:
schechter_plus - structure containing double schechter pars
(.PHISTAR, .MSTAR, .ALPHA, .PHISTAR_PLUS, .ALPHA_PLUS)
OPTIONAL INPUTS:
limits - [2] limits of integration (default to [MSTAR-5., MSTAR+10.])
bin - binning of integration (default to 0.02)
OUTPUTS:
mden - total luminosity density in magnitude units
COMMENTS:
The double Schechter function is the sum of two Schechter
functions with the same MSTAR but different PHISTAR and ALPHA
values.
REVISION HISTORY:
2002-7-04 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_schechter_mden_plus.pro)
NAME:
lf_schechter_nden
PURPOSE:
calculate total number density from schechter function
USAGE:
mden= lf_schechter_nden(schechter [, limits=, bin=])
INPUTS:
schechter - structure containing schechter pars
(.PHISTAR, .MSTAR, .ALPHA)
OPTIONAL INPUTS:
limits - [2] limits of integration (default to [MSTAR-5., MSTAR+10.])
bin - binning of integration (default to 0.02)
OUTPUTS:
nden - total number density
REVISION HISTORY:
2002-7-04 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_schechter_nden.pro)
NAME:
lf_schechter_plus
PURPOSE:
given schechter parameters and absolute mags, return vals
CALLING SEQUENCE:
vals= lf_schechter(absmag, phistar, mstar, alpha, phiplus, alphaplus)
OR
vals= lf_schechter(absmag, schechter)
INPUTS:
absmag - [N] set of absolute magnitudes
AND:
phistar - phi* parameter in 1st schechter fn
mstar - M* parameter in both schechter fns
alpha - alpha parameter ('faint end slope') in 1st schechter fn
phiplus - phi* parameter in 2nd schechter defn
alphaplus - alpha parameter ('faint end slope') in 2nd schechter fn
OR:
schechter_plus - structure containing double schechter pars
(.PHISTAR, .MSTAR, .ALPHA, .PHIPLUS, .ALPHA_PLUS)
COMMENTS:
The double Schechter function is the sum of two Schechter
functions with the same MSTAR but different PHISTAR and ALPHA
values.
REVISION HISTORY:
20-Oct-2003 Written by Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/lf/lf_schechter_plus.pro)
NAME:
lf_select_eep
PURPOSE:
calculate EEP selection function from luminosity function
USAGE:
lf_select_eep,zz,absmag,kcorrect,mmin,mmax,sample_absmmin,sample_absmmax,
sample_zmin,sample_zmax, absmk, phi, sel [, q0=, $
omega0=, omegal0=, q1=, qz0=]
INPUTS:
zz [N] redshifts
absmag [N] absolute magnitudes
kcorrect [N] K-correction for each galaxy
mmin [N] minimum apparent mag for each galaxy
mmax [N] maximum apparent mag for each galaxy
sample_absmmin observed absolute magnitude minimum of sample
sample_absmmax observed absolute magnitude maximum of sample
absmk [nbin] center of each bin
phi [nbin] amplitude of each bin
OPTIONAL INPUTS:
omega0 omega_matter to use (default: 0.3)
omegal0 omega_lambda to use (default: 0.7)
q0,q1 evolution (default 0.)
qz0 pivot for redshift evolution (default 0.)
OUTPUTS:
sel [N] selection function
REVISION HISTORY:
2003-10-20 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_select_eep.pro)
NAME:
lf_selfunc_npgauss
PURPOSE:
calculate selection function at given redshift with npgauss lf
USAGE:
sel= lf_selfunc_npgauss(zz, kcorrect, mmin, mmax, sample_absmmin, $
sample_absmmax, model_absmmin, model_absmmax, $
phi, absmk, sigabsmag, q, p [, $
zzero=, omega0=, omegal0=, rhozpars=, $
rhozfunc=, zvals=, sample_zmin=, $
sample_zmax=, absmmin=, absmmax=])
INPUTS:
zz - [N] redshifts
kcorrect - [N] kcorrections at each redshift
mmin, mmax - [N] bright and faint flux limits for each object
sample_absmmin - minimum abs mag for the sample
sample_absmmax - maximum abs mag for the sample
model_absmmin - minimum abs mag for the model
model_absmmax - maximum abs mag for the model
phi, absmk, sigabsmag, q, p - description of npgauss lf model
OPTIONAL INPUTS:
zzero - zeropoint in redshift (default 0.1)
omega0 omega_matter to use (default: 0.3)
omegal0 omega_lambda to use (default: 0.7)
rhospars, rhosfunc, zvals,
sample_zmin, sample_zmax - radial density field description
OUTPUTS:
sel - [N] selection function
OPTIONAL OUTPUTS:
absmmin, absmmax - [N] limits used on absolute mags
REVISION HISTORY:
2002-5-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_selfunc_npgauss.pro)
NAME:
lf_t2z
PURPOSE:
transform to redshift from age of universe
CALLING SEQUENCE:
z=lf_t2z(t [, omega0=, omegal0= ])
INPUTS:
t - age of universe (h^{-1} Gyrs)
OPTIONAL INPUTS:
omega0 - matter density (default 0.3)
omegal0 - cosmological constant (default 0.7)
OUTPUTS:
z - redshift
REVISION HISTORY:
2005-7-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_t2z.pro)
NAME: lf_test PURPOSE: test luminosity function fit REVISION HISTORY: 2002-5-23 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_test.pro)
NAME:
lf_vmax
PURPOSE:
calculate luminosity function using the simple vmax method
USAGE:
lf_vmax,absmag,kcorrect,ikcorrect,uniqkcorrect, $
nzvals,mmin,mmax,sample_absmmin,sample_absmmax, $
sample_zmin,sample_zmax, absmk, phi, phierr [, omega0=, $
omegal0=, vmax=, imeankcorrect= ]
INPUTS:
absmag [N] absolute magnitudes
kcorrect [N] K-correction for each galaxy
ikcorrect [N] index of K-correction function for each gal
uniqkcorrect [nzvals,N_k] K(z) for each K-correction function
nzvals number of redshift slices in each K-correction fn
mmin [N] minimum apparent mag for each galaxy
mmax [N] maximum apparent mag for each galaxy
sample_absmmin observed absolute magnitude minimum of sample
sample_absmmax observed absolute magnitude maximum of sample
sample_zmin minimum redshift of sample
sample_zmax maximum redshift of sample
OPTIONAL INPUTS:
omega0 omega_matter to use (default: 0.3)
omegal0 omega_lambda to use (default: 0.7)
imeankcorrect mean index for K-correction to use for
uncertainties in 0-bins (default mean of given
ikcorrect)
OUTPUTS:
absmk center of each abs mag bin
phi density in each abs mag bin, in # per cubic Mpc per mag
phierr error in phi
OPTIONAL INPUTS/OUTPUTS:
vmax vmax used for each object
REVISION HISTORY:
2002-11-17 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_vmax.pro)
NAME: lf_vtoz PURPOSE: transform volume to redshift CALLING SEQUENCE: z=lf_vtoz(comvol [, omega0=, omegal0= ]) INPUTS: comvol - R^3 in equation V=4*PI*R^3/3. OPTIONAL INPUTS: omega0 - matter density (default 0.3) omegal0 - cosmological constant (default 0.7) OUTPUTS: z - redshift REVISION HISTORY: 2002-5-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_vtoz.pro)
NAME:
lf_z2t
PURPOSE:
transform redshift to age of universe
CALLING SEQUENCE:
t=lf_z2t(z [, omega0=, omegal0= ])
INPUTS:
z - redshiift
OPTIONAL INPUTS:
omega0 - matter density (default 0.3)
omegal0 - cosmological constant (default 0.7)
OUTPUTS:
t - age of universe (h^{-1} Gyrs)
REVISION HISTORY:
2005-7-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_z2t.pro)
NAME:
lf_zdist_plot
PURPOSE:
plot distribution of distance in bins of absmag, along with model
CALLING_SEQUENCe:
lf_zdist_plot,zz_data,am_data,zz_model,am_model, filename= [ ,fadjust=, $
amlimits=, sample_zmin=, sample_zmax=, nbins=, $
band=, /ylog ]
INPUTS:
zz_data - redshifts of data
am_data - absmags of data
zz_model - redshifts of model
am_model - absmags of model
filename - output postscript file name
OPTIONAL INPUTS:
fadjust - adjust for sampling fraction (default 1.)
amlimits - [2] limiting abs, mag. limits of plot
sample_zmin, sample_zmax - z limits to use
nbins - number of redshift bins
band - 0-4 corresponds to ugriz
KEYWORDS:
/ylog - plot on log scale
REVISION HISTORY:
2002-5-22 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/lf_zdist_plot.pro)
NAME: m2vmax USAGE: vmax= m2vmax(mass) INPUTS: mass - mass of halo (in Msolar/h) OUTPUTS: vmax - maximum circular velocity (in km/s) COMMENTS: Formulae from Bullock et al. (1999) astro-ph/9908159 Only implemented for z=0; input mass is mass/h REVISION HISTORY: 2002-11-01 written - Blanton
(See /home/users/mb144/kcorrect/pro/lf/m2vmax.pro)
NAME: paper_plots PURPOSE: create plots for kcorrect.tex paper CALLING SEQUENCE: paper_plots REVISION HISTORY: 15-Aug-2003 Written by M. Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/paper_plots.pro)
NAME:
READFAST
PURPOSE:
Routine to read in column-formated data very quickly.
INPUTS:
filename - name of the file to be read
OPTIONAL INPUTS:
skipline - number of lines to skip at the top of the file
KEYWORD PARAMETERS:
double - optionally read the data in as double precision
OUTPUTS:
data - floating point 2D array containing the columns and rows
in the data file
OPTIONAL OUTPUTS:
header - string array containing the lines skipped at the
beginning of the file
ncols - number of columns read
nlines - number of lines read
COMMON BLOCKS:
None.
COMMENTS:
This program will only read floating (or double) precision
data, and the file must be column-formated. It will read in
hundreds of thousands of lines in a matter of seconds after
determining how many lines and columns there are in the file.
Note that the program will not skip blank lines nor comment
lines unless explicitly told to do so with the skipline
option. The idea is speed over flexibility.
MODIFICATION HISTORY:
John Moustakas, 2000 May 24, UC Berkeley
jm01jan16uofa - added nlines keyword to optionally return the
number of lines in the file; added error
checking
jm01jan25uofa - routine figures out how many columns there are
in the file; added double keyword; documented,
cleaned up, and optimized
(See /home/users/mb144/kcorrect/pro/seds/readfast.pro)
NAME:
read_draine
PURPOSE:
Read one of Bruce Draine's dust spectrum files
CALLING SEQUENCE:
model= read_draine(filename)
INPUTS:
filename - name of file
OUTPUTS:
model - structure containing descriptions of dust model:
.LAMBDA[N] - wavelengths (angstroms)
.FLUX[N] - ergs cm^{-2} s^{-1} A^{-1} at 10pc
.GRAIN_MODEL
.A01
.SIGMA_1
.B_C1
.A02
.SIGMA_2
.B_C2
.UMIN
.UMAX
.BETA
.AVGU
.RADFIELD
COMMENTS:
I don't know the meaning of the model parameters.
REVISION HISTORY:
06-May-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/read_draine.pro)
NAME:
read_mappings
PURPOSE:
Read a MAPPINGS III file
CALLING SEQUENCE:
model= read_mappings(filename [, /vac, /nolya] )
INPUTS:
filename - name of file
/vac - convert to vacuum wavelengths
/nolya - omit lyman alpha
OUTPUTS:
model - structure containing descriptions of model:
.RUN - name of run
.LAMBDA[N] - wavelengths (angstroms)
.FLUX[N] - fluxs (erg s^{-1} ?)
.NAMES[N] - names of lines
COMMENTS:
I don't know the meaning of the model parameters.
REVISION HISTORY:
06-May-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/read_mappings.pro)
NAME: read_peg.pro PURPOSE: reads the output document of the pegase program CALLING SEQUENCE: read_peg, peg_file INTPUTS: peg_file - output file of the pegase program OUTPUTS: peg - an array of structures (one for each timestep) REVISION HISTORY: 2002-Aug-28 written by Quintero _
(See /home/users/mb144/kcorrect/pro/seds/k_read_peg.pro)
NAME:
sdss2bessell
PURPOSE:
take SDSS data and return rest-frame UBVRI data
CALLING SEQUENCE:
kcorrect= sdss2bessell(redshift [, nmgy=, ivar=, mag=, err=, $
calibobj=, tsobj=, flux=, chi2=, rmaggies=, $
omaggies=, vname=, oivar=, mass=, mtol=, $
absmag=, amivar=, band_shift=, /vega, $
omega0=, omegal0= ])
INPUTS:
redshift - [N] redshifts
calibobj - [N] photoop-style structure, containing:
.PETROFLUX[5]
.PETROFLUX_IVAR[5]
.MODELFLUX[5]
.MODELFLUX_IVAR[5]
.PSFFLUX[5]
.PSFFLUX_IVAR[5]
.EXTINCTION[5]
tsobj - [N] opdb-style structure, containing:
.PETROCOUNTS[5]
.PETROCOUNTSERR[5]
.COUNTS_MODEL[5]
.COUNTS_MODELERR[5]
.PSFCOUNTS[5]
.PSFCOUNTSERR[5]
.REDDENING[5]
nmgy, ivar - [5, N] nanomaggies, Galactic-reddening corrected, and inverse
variance of same
mag, err - [5, N] asinh magnitudes, Galactic-reddening corrected and
errors of same
OPTIONAL INPUTS:
flux - use this version of the fluxes ('PETRO', 'MODEL', or 'PSF')
[defaults to 'PETRO'] if tsobj or calibobj keywords are
used
vname - name of fit to use (defaults to 'default')
band_shift - evaluate UBVRI shifted blue by 1+band_shift
omega0, omegal0 - cosmological parameters for calculating distance
moduli [default 0.3, 0.7]
OPTIONAL KEYWORDS:
/vega - output Vega magnitudes, fluxes (STILL TAKES AB INPUTS!)
OUTPUTS:
kcorrect - [5, N] K-corrections from ugriz to UBVRI; e.g.:
M_U = m_u - DM(z) - K_{uU}(z)
mtol - [5, N] current stellar mass-to-light ratios from model in each band
mass - [N] total current stellar mass from model
intsfh - [N] total integrated star formation history
mets - [ngals] average metallicity in current stars
absmag - [5, N] absolute magnitude (for missing data, substitutes
model fit) in UBVRI
amivar - [5, N] inverse variance of absolute magnitude (for
missing data = 0) in UBVRI
b300 - [N] star-formation within last 300Myrs relative to average
star-formation rate
b1000 - [N] star-formation within last 1Gyrs relative to average
star-formation rate
OPTIONAL OUTPUTS:
coeffs - coefficients of fit
chi2 - chi^2 of fit
rmaggies - [5, N] reconstructed maggies from the fit (ugriz)
omaggies, oivar - [5, N] maggies and inverse variances used for fit
(after extinction, AB correction, etc) (ugriz)
COMMENTS:
This is a simple wrapper on kcorrect.pro. It keeps a version of
rmatrix and zvals in memory to save time.
You must specify nmgy,ivar OR mag,err OR calibobj OR tsobj. If
nmgy or mag, make sure they are AB calibrated and Galactic
extinction corrected.
Uses sdss_to_maggies to convert tsobj or calibobj structure to
AB, Galactic extinction corrected maggies. Passes optional
argument "flux" to sdss_to_maggies.
For v4_0b templates and later, coefficients are in units of:
1 solar mass / (D/10pc)^2
That is, sum the coefficients and multiply by (D/10pc)^2 to get
TOTAL INTEGRATED STAR FORMATION. (In fact, for Omega0=0.3 and
OmegaL0=0.7, this is what the "mass" keyword returns). Note that
the total integrated star formation DIFFERS from the current
stellar mass --- which is returned in the mass and mtol variables.
REVISION HISTORY:
07-Apr-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/sdss2bessell.pro)
NAME:
sdss2deep
PURPOSE:
take SDSS data and return DEEP BRI at some redshift
CALLING SEQUENCE:
bri= sdss2deep(sdss_redshift, deep_redshift, [, nmgy=, ivar=, mag=, err=, $
calibobj=, tsobj=, flux=, chi2=, rmaggies=, $
omaggies=, vname=, oivar=, mass=, mtol= ]
INPUTS:
sdss_redshift - [N] redshifts of input
deep_redshift - [N] redshifts of desired output
calibobj - [N] photoop-style structure, containing:
.PETROFLUX[5]
.PETROFLUX_IVAR[5]
.MODELFLUX[5]
.MODELFLUX_IVAR[5]
.PSFFLUX[5]
.PSFFLUX_IVAR[5]
.EXTINCTION[5]
tsobj - [N] opdb-style structure, containing:
.PETROCOUNTS[5]
.PETROCOUNTSERR[5]
.COUNTS_MODEL[5]
.COUNTS_MODELERR[5]
.PSFCOUNTS[5]
.PSFCOUNTSERR[5]
.REDDENING[5]
nmgy, ivar - [5, N] nanomaggies, Galactic-reddening corrected, and inverse
variance of same
mag, err - [5, N] asinh magnitudes, Galactic-reddening corrected and
errors of same
OPTIONAL INPUTS:
flux - use this version of the fluxes ('PETRO', 'MODEL', or 'PSF')
[defaults to 'PETRO'] if tsobj or calibobj keywords are
used
vname - name of fit to use (defaults to 'default')
OUTPUTS:
bri - [3, N] apparent magnitudes in BRI (AB)
mtol - [5, N] mass-to-light ratios from model in each band
mass - [N] total mass from model in each band
OPTIONAL OUTPUTS:
coeffs - coefficients of fit
chi2 - chi^2 of fit
rmaggies - [5, N] reconstructed maggies from the fit (ugriz)
omaggies, oivar - [5, N] maggies and inverse variances used for fit
(after extinction, AB correction, etc) (ugriz)
COMMENTS:
This is a simple wrapper on kcorrect.pro. It keeps a version of
rmatrix and zvals in memory to save time.
You must specify nmgy,ivar OR mag,err OR calibobj OR tsobj. If
nmgy or mag, make sure they are AB calibrated and Galactic
extinction corrected.
Uses sdss_to_maggies to convert tsobj or calibobj structure to
AB, Galactic extinction corrected maggies. Passes optional
argument "flux" to sdss_to_maggies.
For v4_0b templates and later, coefficients are in units of:
1 solar mass / (D/10pc)^2
That is, sum the coefficients and multiply by (D/10pc)^2 to get
TOTAL INTEGRATED STAR FORMATION. (In fact, for Omega0=0.3 and
OmegaL0=0.7, this is what the "mass" keyword returns). Note that
the total integrated star formation DIFFERS from the current
stellar mass --- which is returned in the mass and mtol variables.
REVISION HISTORY:
07-Apr-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/sdss2deep.pro)
NAME:
sdss2goods
PURPOSE:
take SDSS data and return GOODS BVizJHK at some redshift
CALLING SEQUENCE:
mag= sdss2goods(sdss_redshift, goods_redshift, [, nmgy=, ivar=, $
mag=, err=, calibobj=, tsobj=, flux=, chi2=, $
rmaggies=, omaggies=, vname=, oivar=, mass=, mtol= ]
INPUTS:
sdss_redshift - [N] redshifts of input
goods_redshift - [N] redshifts of desired output
calibobj - [N] photoop-style structure, containing:
.PETROFLUX[5]
.PETROFLUX_IVAR[5]
.MODELFLUX[5]
.MODELFLUX_IVAR[5]
.PSFFLUX[5]
.PSFFLUX_IVAR[5]
.EXTINCTION[5]
tsobj - [N] opdb-style structure, containing:
.PETROCOUNTS[5]
.PETROCOUNTSERR[5]
.COUNTS_MODEL[5]
.COUNTS_MODELERR[5]
.PSFCOUNTS[5]
.PSFCOUNTSERR[5]
.REDDENING[5]
nmgy, ivar - [5, N] nanomaggies, Galactic-reddening corrected, and inverse
variance of same
mag, err - [5, N] asinh magnitudes, Galactic-reddening corrected and
errors of same
OPTIONAL INPUTS:
flux - use this version of the fluxes ('PETRO', 'MODEL', or 'PSF')
[defaults to 'PETRO'] if tsobj or calibobj keywords are
used
vname - name of fit to use (defaults to 'default')
OUTPUTS:
mag - [7, N] apparent magnitudes in BVizJHK (AB)
mass - [N] total current stellar mass from model in each band
OPTIONAL OUTPUTS:
coeffs - coefficients of fit
chi2 - chi^2 of fit
rmaggies - [5, N] reconstructed maggies from the fit (ugriz)
omaggies, oivar - [5, N] maggies and inverse variances used for fit
(after extinction, AB correction, etc) (ugriz)
COMMENTS:
This is a simple wrapper on kcorrect.pro. It keeps a version of
rmatrix and zvals in memory to save time.
You must specify nmgy,ivar OR mag,err OR calibobj OR tsobj. If
nmgy or mag, make sure they are AB calibrated and Galactic
extinction corrected.
Uses sdss_to_maggies to convert tsobj or calibobj structure to
AB, Galactic extinction corrected maggies. Passes optional
argument "flux" to sdss_to_maggies.
For v4_0b templates and later, coefficients are in units of:
1 solar mass / (D/10pc)^2
That is, sum the coefficients and multiply by (D/10pc)^2 to get
TOTAL INTEGRATED STAR FORMATION. (In fact, for Omega0=0.3 and
OmegaL0=0.7, this is what the "mass" keyword returns). Note that
the total integrated star formation DIFFERS from the current
stellar mass --- which is returned in the mass and mtol variables.
REVISION HISTORY:
07-Apr-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/sdss2goods.pro)
NAME:
sdss_kcorrect
PURPOSE:
calculate K-corrections for standard SDSS input
CALLING SEQUENCE:
kcorrect= sdss_kcorrect(redshift [, nmgy=, ivar=, mag=, err=, $
calibobj=, tsobj=, flux=, band_shift=,$
chi2=, rmaggies=, omaggies=, vname=, $
oivar=, mass=, mtol=, absmag=, amivar=, $
omega0=, omegal0= ])
INPUTS:
redshift - [N] redshifts
calibobj - [N] photoop-style structure, containing:
.PETROFLUX[5]
.PETROFLUX_IVAR[5]
.MODELFLUX[5]
.MODELFLUX_IVAR[5]
.PSFFLUX[5]
.PSFFLUX_IVAR[5]
.EXTINCTION[5]
tsobj - [N] opdb-style structure, containing:
.PETROCOUNTS[5]
.PETROCOUNTSERR[5]
.COUNTS_MODEL[5]
.COUNTS_MODELERR[5]
.PSFCOUNTS[5]
.PSFCOUNTSERR[5]
.REDDENING[5]
nmgy, ivar - [5, N] nanomaggies, Galactic-reddening corrected, and inverse
variance of same
mag, err - [5, N] asinh magnitudes, Galactic-reddening corrected and
errors of same
OPTIONAL INPUTS:
flux - use this version of the fluxes ('PETRO', 'MODEL', or 'PSF')
[defaults to 'PETRO'] if tsobj or calibobj keywords are
used
band_shift - blueshift of bandpasses to apply (to get ^{z}b
type bands) [default 0.]
vname - name of fit to use (defaults to 'default')
omega0, omegal0 - cosmological parameters for calculating distance
moduli [default 0.3, 0.7]
OPTIONAL KEYWORDS:
lrg - do "luminous red galaxy" fit; this means changing vname to
'lrg1', using "model" fluxes, and ignoring the u-band
(setting ivar[0,*]=0); this uses a single template
appropriate for the SDSS Luminous Red Galaxy sample
OUTPUTS:
kcorrect - [5, ngals] K-corrections in ugriz satisfying
m = M + DM(z) + K(z)
based on the best fit sum of templates
mtol - [5, ngals] current stellar mass-to-light ratios from model
in each band
mass - [ngals] total current stellar mass from model
mets - [ngals] average metallicity in current stars
intsfh - [ngals] total integrated star formation history
absmag - [5, ngals] absolute magnitude (for missing data, substitutes
model fit). (evolution correction *not* applied)
amivar - [5, ngals] inverse variance of absolute magnitude (for
missing data = 0)
OPTIONAL OUTPUTS:
coeffs - [Nt, ngals] coefficients of fit
chi2 - chi^2 of fit
rmaggies - [5, ngals] reconstructed maggies from the fit (ugriz)
omaggies, oivar - [5, ngals] maggies and inverse variances used for fit
(after extinction, AB correction, etc) (ugriz)
b300 - [ngals] star-formation within last 300Myrs relative to average
star-formation rate
b1000 - [ngals] star-formation within last 1Gyrs relative to average
star-formation rate
COMMENTS:
This is a simple wrapper on kcorrect.pro which is almost always
just what you want. It keeps a version of rmatrix and zvals in
memory to save time, recalculating them each time you change
band_shift.
You must specify nmgy,ivar OR mag,err OR calibobj OR tsobj. If
nmgy or mag, make sure they are AB calibrated and Galactic
extinction corrected.
Uses sdss_to_maggies to convert tsobj or calibobj structure to
AB, Galactic extinction corrected maggies. Passes optional
argument "flux" to sdss_to_maggies to indicate which type of flux
to use. Note that if you get magnitudes like petroMag or modelMag
from the Catalog Archive Servers, these numbers are exactly like
the petroCounts and counts_model numbers in the tsObj structures.
For v4_0b templates and later, coefficients are in units of:
1 solar mass / (D/10pc)^2
That is, sum the coefficients and multiply by (D/10pc)^2 to get
masses. (In fact, for Omega0=0.3 and OmegaL0=0.7, this is what the
"mass" keyword returns).
EXAMPLE:
For using with photoop system:
ra=136.
dec=20.
obj= sdss_findobj(ra, dec, rerun=137, childobj=calibobj)
findspec, ra, dec, slist=slist
readspec, slist.plate, slist.fiberid, mjd=slist.mjd, zans=zans
kc= sdss_kcorrect(zans.z, calibobj=calibobj)
For reading tsobj structures:
tsobj=mrdfits('tsObj-01336-3-0456.fit',1,row=100)
findspec, tsobj.ra, tsobj.dec, slist=slist
readspec, slist.plate, slist.fiberid, mjd=slist.mjd, zans=zans
kc= sdss_kcorrect(zans.z, tsobj=tsobj)
REVISION HISTORY:
07-Apr-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/sdss_kcorrect.pro)
NAME:
sdss_kphotoz
PURPOSE:
calculate photometric redshifts from SDSS input (v4 use ONLY for LRGs)
CALLING SEQUENCE:
photoz= sdss_kphotoz([nmgy=, ivar=, mag=, err=, $
calibobj=, tsobj=, flux=, band_shift=,$
chi2=, rmaggies=, omaggies=, vname=, $
oivar=, mass=, mtol=, absmag=, amivar=, $
omega0=, omegal0=, kcorrect= ])
INPUTS:
calibobj - [N] photoop-style structure, containing:
.PETROFLUX[5]
.PETROFLUX_IVAR[5]
.MODELFLUX[5]
.MODELFLUX_IVAR[5]
.PSFFLUX[5]
.PSFFLUX_IVAR[5]
.EXTINCTION[5]
tsobj - [N] opdb-style structure, containing:
.PETROCOUNTS[5]
.PETROCOUNTSERR[5]
.COUNTS_MODEL[5]
.COUNTS_MODELERR[5]
.PSFCOUNTS[5]
.PSFCOUNTSERR[5]
.REDDENING[5]
nmgy, ivar - [5, N] nanomaggies, Galactic-reddening corrected, and inverse
variance of same
mag, err - [5, N] asinh magnitudes, Galactic-reddening corrected and
errors of same
OPTIONAL INPUTS:
flux - use this version of the fluxes ('PETRO', 'MODEL', or 'PSF')
[defaults to 'MODEL'] if tsobj or calibobj keywords are
used
band_shift - blueshift of bandpasses to apply for K-corrections
returned (to get ^{z}b type bands) [default 0.]
vname - name of fit to use (defaults to 'default')
omega0, omegal0 - cosmological parameters for calculating distance
moduli [default 0.3, 0.7]
OPTIONAL KEYWORDS:
lrg - do "luminous red galaxy" fit; this means changing vname to
'lrg1' and ignoring the u-band (setting ivar[0,*]=0);
this is the right way to get photometric redshifts for red
galaxies; if you take things with good chi2 values from
this fit, they will have good photo-z's
OUTPUTS:
photoz - [N] photometric redshifts
kcorrect - [5, ngals] K-corrections in ugriz satisfying
m = M + DM(z) + K(z)
based on the best fit sum of templates
mtol - [5, ngals] mass-to-light ratios from model in each band
mass - [ngals] total current stellar mass from model in each band
absmag - [5, ngals] absolute magnitude (for missing data, substitutes
model fit)
amivar - [5, ngals] inverse variance of absolute magnitude (for
missing data = 0)
OPTIONAL OUTPUTS:
coeffs - coefficients of fit
chi2 - chi^2 of fit
rmaggies - [5, N] reconstructed maggies from the fit (ugriz)
omaggies, oivar - [5, N] maggies and inverse variances used for fit
(after extinction, AB correction, etc) (ugriz)
COMMENTS:
For the v4 templates, this has not be sufficiently well-tested.
Use it ONLY with the /lrg flag described above (for which the
template is known to be good).
This is a simple wrapper on kphotoz.pro which is almost always
just what you want. It keeps a version of rmatrix and zvals in
memory to save time, recalculating them each time you change
band_shift.
You must specify nmgy,ivar OR mag,err OR calibobj OR tsobj. If
nmgy or mag, make sure they are AB calibrated and Galactic
extinction corrected.
Uses sdss_to_maggies to convert tsobj or calibobj structure to
AB, Galactic extinction corrected maggies. Passes optional
argument "flux" to sdss_to_maggies to indicate which type of flux
to use. Note that if you get magnitudes like petroMag or modelMag
from the Catalog Archive Servers, these numbers are exactly like
the petroCounts and counts_model numbers in the tsObj structures.
For v4_0b templates and later, coefficients are in units of:
1 solar mass / (D/10pc)^2
That is, sum the coefficients and multiply by (D/10pc)^2 to get
TOTAL INTEGRATED STAR FORMATION. (In fact, for Omega0=0.3 and
OmegaL0=0.7, this is what the "mass" keyword returns). Note that
the total integrated star formation DIFFERS from the current
stellar mass --- which is returned in the mass and mtol variables.
REVISION HISTORY:
07-June-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/sdss_kphotoz.pro)
NAME:
sdss_to_maggies
PURPOSE:
convert SDSS data to AB, Galactic extinction corrected maggies
CALLING SEQUENCE:
sdss_to_maggies, maggies, ivar [, tsobj=, calibobj=, flux= ]
INPUTS:
calibobj - [N] photoop-style SDSS structure, containing:
.PETROFLUX[5]
.PETROFLUX_IVAR[5]
.MODELFLUX[5]
.MODELFLUX_IVAR[5]
.PSFFLUX[5]
.PSFFLUX_IVAR[5]
.EXTINCTION[5]
tsobj - [N] opdb-style SDSS structure, containing:
.PETROCOUNTS[5]
.PETROCOUNTSERR[5]
.COUNTS_MODEL[5]
.COUNTS_MODELERR[5]
.PSFCOUNTS[5]
.PSFCOUNTSERR[5]
.REDDENINg[5]
OPTIONAL INPUTS:
flux - use this version of the SDSS fluxes ('PETRO', 'MODEL', or 'PSF')
[defaults to 'PETRO'] if tsobj or calibobj keywords are
used
OUTPUTS:
maggies - [5, N] output in AB maggies in ugriz
ivar - [5, N] inverse variance of maggies
COMMENTS:
You must specify calibobj OR tsobj.
This code ALWAYS assumes you are inputting pipeline SDSS quantities and
converts them to AB quantities!
It ALWAYS applies a minimum error of [0.05, 0.02, 0.02, 0.02, 0.03]
in ugriz respectively.
calibobj will be interpreted as a photoop-style SDSS structure.
tsobj will be interpreted as a opdb-style SDSS structure.
In either the case of calibobj or tsobj, the Petrosian flux will
be used by default --- or you can specify flux="model" or
flux="psf".
In addition, in the case of calibobj or tsobj, this code uses the
Galactic extinction values in those structures to correct the
fluxes.
REVISION HISTORY:
07-Apr-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/sdss_to_maggies.pro)
NAME: sfh_reconstruct PURPOSE: get SFH parameters given coefficients CALLING SEQUENCE: sfh_reconstruct, coeffs [, vname=, sfr=, dage=, metallicity=, age= ] INPUTS: coeffs - [Nt, Ngals] coefficients for the galaxy in question OPTIONAL INPUTS: vname - name of set of templates to use (default 'default') OUTPUTS: age - [Nage] ages of bursts in model (yrs) dage - [Nage] width of age bin (yrs) sfr - [Nage, Ngals] rate of star formation in bin (M_solar/yr) metallicity - [Nage, Ngals] metallicity in each bin REVISION HISTORY: 2005-08-15 MRB, NYU
(See /home/users/mb144/kcorrect/pro/utils/sfh_reconstruct.pro)
NAME:
STR_SEP
PURPOSE:
This routine cuts a string into pieces which are separated by the
separator string.
CATEGORY:
String processing.
CALLING SEQUENCE:
arr = STR_SEP(str, separator)
INPUTS:
str - The string to be separated.
separator - The separator.
KEYWORDS:
ESC = escape character. Only valid if separator is a single character.
Characters following the escape character are treated
literally and not interpreted as separators.
For example, if the separator is a comma,
and the escape character is a backslash, the character
sequence 'a\,b' is a single field containing the characters
'a,b'.
REMOVE_ALL = if set, remove all blanks from fields.
TRIM = if set, remove only leading and trailing blanks from fields.
OUTPUT:
An array of strings as function value.
COMMON BLOCKS:
None
SIDE EFFECTS:
No known side effects.
RESTRICTIONS:
None.
EXAMPLE:
array = STR_SEP ("ulib.usca.test", ".")
MODIFICATION HISTORY:
July 1992, AH, CreaSo Created.
December, 1994, DMS, RSI Added TRIM and REMOVE_ALL.
March, 2002, MRB, add to kcorrect to remove idlutils dependency
(See /home/users/mb144/kcorrect/pro/utils/k_str_sep.pro)
NAME:
swire_to_maggies
PURPOSE:
convert SWIRE input to Galactic-extinction corrected AB maggies
CALLING SEQUENCE:
swire_to_maggies, swire, maggies, ivar
INPUTS:
swire - [N] SWIRE style input, with:
.RA
.DEC
.FLUX_AP_36
.UNCF_AP_36
.FLUX_AP_45
.UNCF_AP_45
.FLUX_AP_58
.UNCF_AP_58
.FLUX_AP_80
.UNCF_AP_80
.FLUX_AP_24
.UNCF_AP_24
.AP_M_U
.MSIG_U
.AP_M_G
.MSIG_G
.AP_M_R
.MSIG_R
.AP_M_I
.MSIG_I
.AP_M_Z
.MSIG_Z
OUTPUTS:
maggies - [10, N] output in AB maggies in
ugriz[3.6][4.5][5.8][8.0][24] bands
ivar - [10, N] inverse variance of maggies
COMMENTS:
It ALWAYS applies a minimum error of 0.02 (in magnitude) in all bands
REVISION HISTORY:
07-Apr-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/swire_to_maggies.pro)
NAME:
twomass_kcorrect
PURPOSE:
calculate K-corrections for 2MASS+SDSS input
CALLING SEQUENCE:
kcorrect= twomass_kcorrect(redshift [, nmgy=, ivar=, mag=, err=, $
twomass=, calibobj=, tsobj=, flux=, band_shift=,
chi2=, rmaggies=, omaggies=, oivar=, $
mass=, mtol=, absmag=, amivar=, $
omega0=, omegal0=])
INPUTS:
redshift - [N] redshifts
twomass - [N] 2MASS "mcat" style input, with:
.RA
.DECL
.J_M_EXT
.J_MSIG_EXT
.J_FLG_EXT
.H_M_EXT
.H_MSIG_EXT
.H_FLG_EXT
.K_M_EXT
.K_MSIG_EXT
.K_FLG_EXT
calibobj - [N] photoop-style SDSS structure, containing:
.PETROFLUX[5]
.PETROFLUX_IVAR[5]
.MODELFLUX[5]
.MODELFLUX_IVAR[5]
.PSFFLUX[5]
.PSFFLUX_IVAR[5]
.EXTINCTION[5]
tsobj - [N] opdb-style SDSS structure, containing:
.PETROCOUNTS[5]
.PETROCOUNTSERR[5]
.COUNTS_MODEL[5]
.COUNTS_MODELERR[5]
.PSFCOUNTS[5]
.PSFCOUNTSERR[5]
.REDDENINg[5]
nmgy, ivar - [8, N] nanomaggies, Galactic-reddening corrected, and inverse
variance of same
mag, err - [8, N] standard Pogson magnitudes, Galactic-reddening
corrected, and errors of same
OPTIONAL INPUTS:
flux - use this version of the SDSS fluxes ('PETRO', 'MODEL', or 'PSF')
[defaults to 'PETRO'] if tsobj or calibobj keywords are
used
band_shift - blueshift of bandpasses to apply (to get ^{z}b
type bands) [default 0.]
vname - name of fit to use (defaults to 'default')
omega0, omegal0 - cosmological parameters for calculating distance
moduli [default 0.3, 0.7]
OUTPUTS:
kcorrect - [8, N] K-corrections in ugrizJHK satisfying
m = M + DM(z) + K(z)
based on the best fit sum of templates
mtol - [8, ngals] mass-to-light ratios from model in each band
mass - [ngals] total mass from model in each band
absmag - [8, ngals] absolute magnitude (for missing data, substitutes
model fit)
amivar - [8, ngals] inverse variance of absolute magnitude (for
missing data = 0)
OPTIONAL OUTPUTS:
coeffs - coefficients of fit
chi2 - chi^2 of fit
rmaggies - [8, N] reconstructed maggies from the fit (ugrizJHK)
omaggies, oivar - [8, N] maggies and inverse variances used for fit
(after extinction, AB correction, etc) (ugrizJHK)
COMMENTS:
This is a simple wrapper on kcorrect.pro which is designed for
users with 2MASS data matched to SDSS data. It will deal
appropriately if you leave out the SDSS or 2MASS data (but not
both!).
Uses twomass_to_maggies to convert a 2MASS-style catalog to maggies
and inverse variances.
Uses sdss_to_maggies to convert tsobj or calibobj structure to
AB, Galactic extinction corrected maggies. Passes optional
argument "flux" to sdss_to_maggies.
You must specify nmgy,ivar OR mag,err OR calibobj OR tsobj OR
twomass. If nmgy or mag, make sure they are Galactic extinction
corrected and AB calibrated.
For v4_0b templates and later, coefficients are in units of:
1 solar mass / (D/10pc)^2
That is, sum the coefficients and multiply by (D/10pc)^2 to get
TOTAL INTEGRATED STAR FORMATION. (In fact, for Omega0=0.3 and
OmegaL0=0.7, this is what the "mass" keyword returns). Note that
the total integrated star formation DIFFERS from the current
stellar mass --- which is returned in the mass and mtol variables.
REVISION HISTORY:
07-Apr-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/fit/twomass_kcorrect.pro)
NAME:
twomass_to_maggies
PURPOSE:
convert 2MASS catalog input to Galactic-extcintion corrected AB maggies
CALLING SEQUENCE:
twomass_to_maggies,twomass,maggies,ivar
INPUTS:
twomass - [N] 2MASS style input, with:
.RA (J2000 degrees)
.DECL (J2000 degrees)
.J_M_EXT
.J_MSIG_EXT
.J_FLG_EXT
.H_M_EXT
.H_MSIG_EXT
.H_FLG_EXT
.K_M_EXT
.K_MSIG_EXT
.K_FLG_EXT
OUTPUTS:
maggies - [2, N] output in AB maggies in FUV and NUV filters
ivar - [2, N] inverse variance of maggies
COMMENTS:
Uses k_vega2ab() to get correction from 2MASS Vega magnitudes to
2MASS AB magnitudes. As of 2005-04-18, this yields [0.91, 1.39,
1.85] for AB-Vega in JHKs respectively.
It ALWAYS applies a minimum error of [0.03, 0.03, 0.03] in
JHKs
Requires you to have the dust maps so that dust_getval can find
them. (If somebody wants me to set "default" columns in the
twomass structure that this code looks for, let me know).
REVISION HISTORY:
07-Apr-2005 Mike Blanton, NYU
(See /home/users/mb144/kcorrect/pro/utils/twomass_to_maggies.pro)
NAME:
witt_ext
PURPOSE:
Calculate optical depth from the Witt theoretical results in kcorrect/data
CALLING SEQUENCE:
att=witt_ext(dust_str, tauv, lambda)
INPUTS:
dust_str - structure with string elements:
geometry - 'dusty', 'cloudy' or 'shell'
dust - 'SMC' or 'MW'
structure - 'c' (clumpy) or 'h' (homogeneous)
tauv - optical depth in V
lambda - wavelengths (in Angstroms) where A is desired
OUTPUTS:
att - extinction at each lambda
EXAMPLES:
A spectrum spec should have att applied as follows:
dusty_spec = spec * exp(-att)
REVISION HISTORY:
04-Jan-2002 Translated to IDL by Mike Blanton, NYU
29-Apr-2003 Common block added for speed
(See /home/users/mb144/kcorrect/pro/seds/witt_ext.pro)