LRT Fortran-77 Functions

Here is a description of all functions included with the LRT libraries. For all cases, the following definitions apply:

  • nchan = Total number of filters used.
  • ispec = AGN SED template to use. 1: standard template. 2: Modified Richards et al. (2006) one.

  • real*8 function bol_lum(comp)

    • Parameters
    • real*8 comp(4) INPUT. Specific luminosities of each template component. This is vector is typically an output of the kca subroutine.
    • Description
    • Given the output vector of KCA with the specific bolometric luminosities, returns the bolometric luminosity of the galaxy in units of 1010 solar luminosities. In practice, it just adds the components of vector comp.

    • Requisites
      • call kcinit
      • call kca   (Recommended)



  • subroutine get_mags(comp,ebv,igm,z,jymodtot)

    • Parameters
    • real*8 comp(4) INPUT. Specific luminosities of each template component. This is vector is typically an output of the kca subroutine.
      real*8 ebv INPUT. Value of E(B-V) applied to the AGN SED.
      real*8 igm INPUT. Value of the IGM absorption strength.
      real*8 z INPUT. Redshift of the object.
      real*8 jymodtot(nchan) OUTPUT. Vector that holds the expected fluxes in each filter.

    • Description
    • Subroutine that given specific luminosities for each component and a redshift, returns the associated fluxes in the set of filters of the Photometry Description File.

    • Requisites
      • call kcinit or call pzinit



  • real*8 function DL(z)

    • Parameters
    • real*8 z INPUT. Redshift of the object.

    • Description
    • Returns the luminosity distance to redshift z.

    • Requisites
      • call kcinit or pzinit



  • subroutine fitzero(filename, niter, chifrac, corr, op)

    • Parameters
    • character*100 filename INPUT. Name of the training set file. See below for the description of the file format.
      integer niter INPUT. Number of iterations for estimating the corrections. Convergence is somewhat slow, but 10 or 15 iterations are usually good enough.
      real*8 chifrac INPUT.Fraction of objects to use, arranged by chi-squared.
      real*8 corr(nchan) OUTPUT. Array of size nchan with the zero point corrections, such that zeropoint/corr is the corrected zero point.
      integer op INPUT. 0 if input is in fluxes (in Jy) and 1 if in magnitudes.

    • Description
    • Subroutine that estimates corrections to the input photometric zero points using a user-supplied training set. This corrections can significantly improve photometric redshifts and K-corrections. The format of the training set file must be: redshift, flux (Jy) or magnitude in each band, flux (Jy) or magnitude error in each band, and flags for each band (1 if its to be used and 0 if not). Lines starting with # are considered comments. Click here for an example. Once the corrections have been estimated, they are automatically incorporated to the pza and kca functions. To apply them at later executions of your program without needing to calculate them again, print the contents of vector corr in a file called channel.zpc (one element per line) and put the file in the same folder on which the program will be executed.

    • Requisites
      • call kcinit or pzinit



  • subroutine kca(mag,emag,maguse,z,z0,magmod,magcorr,comp,cov,ebv,igm,chi2,op)

    • Parameters
    • real*8 mag(nchan) INPUT. Array of size nchan with the Magnitudes or Fluxes (in Jy) in each band arranged in the same order as in the photometry description file.
      real*8 emag(nchan) INPUT. Array of size nchan with the magnitude or fluxes (in Jy) errors in each band
      integer maguse(nchan) INPUT. Array of size nchan with the use flags. If maguse(j)=1, the j-th band will be used for estimating photometric redshifts. If maguse(j)=0, it will not. Still, a modeled magnitude or flux will be returned for this filter.
      real*8 z INPUT. Redshift of the object.
      real*8 z0 INPUT. Redshift of the K-correction (typically 0.d0).
      real*8 magmod(nchan) OUTPUT. Array of size nchan in which the best fit model fluxes or magnitudes are returned.
      real*8 magcorr(nchan) OUTPUT. Array of size nchan in which the K-corrections will be returned. mag - magcorr = K-corrected magnitude. Flux/Flux_corr= K-corrected flux.
      real*8 comp(4) OUTPUT. Array in which the best fit specific luminosities of each component are returned
      real*8 cov(4,4) OUTPUT. Covariance matrix of the vector comp.
      real*8 ebv OUTPUT. Best fit value of E(B-V) applied to the AGN SED.
      real*8 igm OUTPUT. Best fit value of the IGM absorption strength.
      real*8 chi2 OUTPUT. χ2 of the best fit.
      integer op INPUT. 0 if input is in Fluxes (in Jy) and 1 if in magnitudes.

    • Description
    • Subroutine that calculates K-Corrections. For a thorough explanation of how this is done, please refer to Assef et al. (2008).

    • Requisites
      • call kcinit



  • subroutine kcinit(filtname,ispec,ired,iigm,verbose)

    • Parameters
    • string filtname INPUT. The name of the photometry description file ('bandmag.dat' in the test programs for example.)
      integer ired INPUT. If 1, AGN reddenning will be variable. If 0, it will be fixed to E(B-V)=0.
      integer iigm INPUT. If 1, IGM strength will be variable. If 0, it will be fixed to 1.0.
      integer verbose INPUT. If 1, information will be print to the STDOUT. If 0, nothing will be printed except for possible errors.

    • Description
    • Function that initializes the K-Correction subroutine kca and most other functions.

    • Requisites
      • None.



  • subroutine pza(mag,emag,maguse,zphot,chigal,chinop,op,chi2zop)

    • Parameters
    • real*8 mag(nchan) INPUT. Array of size nchan with the Magnitudes or Fluxes (in Jy) in each band arranged in the same order as in the photometry description file.
      real*8 emag(nchan) INPUT. Array of size nchan with the magnitude or fluxes (in Jy) errors in each band
      integer maguse(nchan) INPUT. Array of size nchan with the use flags. If maguse(j)=1, the band will be used for estimating photometric redshifts. If maguse(j) = 0, it will not. Still, a modeled magnitude or flux will be returned for this filter.
      real*8 zphot OUTPUT. Photometric redshift output variable.
      real*8 chigal OUTPUT. χ2 + Prior of the best fit
      real*8 chinop OUTPUT. χ2 of the best fit.
      integer op INPUT. 0 if input is in Fluxes (in Jy) and 1 if in magnitudes.
      integer chi2zop INPUT. If >0, the χ2 distribution of the object for which a photometric redshift is calculated will be written to the fort.90 file. The first line has two columns, the chi2zop flag value (should be the galaxy ID for easier recognition) and the number of lines in the redshift grid, N. The following N lines show the distribution and have three columns: redshift, χ2, χ2+prior. Following objects on the same run are appended to the file.

    • Description
    • Subroutine that calculates Photometric Redshifts. For a thorough explanation of how this is done, please refer to Assef et al. (2008).

    • Requisites
      • call pzinit



  • subroutine pzinit(filtname,ispec,ired,iigm,zmin,zmax,dz,verbose)

    • Parameters
    • string filtname INPUT. The name of the photometry description file ('bandmag.dat' in the test programs for example.)
      integer ired INPUT. If 1, AGN reddenning will be variable. If 0, it will be fixed to E(B-V)=0.
      integer iigm INPUT. If 1, IGM strength will be variable. If 0, it will be fixed to 1.0.
      real*8 zmin INPUT. Lower limit to search for best fit photometric redshift.
      real*8 zmax INPUT. Upper limit to search for best fit photometric redshift.
      real*8 dz INPUT. Redshift grid separation.
      integer verbose INPUT. If 1, information will be print to the STDOUT. If 0, nothing will be printed except for possible errors.

    • Description
    • Function that initializes the photometric redshift subroutine pza and most other functions. This function will create the photoz_grid.dat file. This file is used internally by the pza function.

    • Requisites
      • None.



  • real*8 function vc(z)

    • Parameters
    • real*8 z INPUT. Redshift.

    • Description
    • Returns the co-moving volume from redshift 0 to redshift z.

    • Requisites
      • call kcinit or pzinit



  • real*8 function vmax(comp,ebv,igm,jchan,mlim,zlim,area)

    • Parameters
    • real*8 comp(4) INPUT. Specific luminosities of each template component. This vector is an output of kca.
      real*8 ebv INPUT. Value of E(B-V) applied to the AGN SED.
      real*8 igm INPUT. Value of the IGM absorption strength.
      integer jchan INPUT .Band in which the magnitude limits applies.
      real*8 mlim INPUT. Faint apparent magnitude limit.
      real*8 zlim OUTPUT. Maximum redshift to which galaxy can be found.
      real*8 area INPUT. Area of the survey in square degrees.

    • Description
    • Function that returns the co-moving volume on which a galaxy could have been detected given the magnitude limit of the survey and the area in square degrees. This function will also return the maximum redshift to which the galaxy could have been observed.

    • Requisites
      • call kcinit
      • call kca   (Recommended)