def redshift_to_distance(<EOL>self,<EOL>z,<EOL>WM=<NUM_LIT>,<EOL>WV=<NUM_LIT>,<EOL>H0=<NUM_LIT>):
self.log.info('<STR_LIT>')<EOL>h = H0 / <NUM_LIT><EOL>WR = <NUM_LIT> / (h * h)     <EOL>WK = <NUM_LIT:1.0> - WM - WV - WR       <EOL>c = <NUM_LIT>          <EOL>DCMR = <NUM_LIT:0.0>             <EOL>DCMR_Mpc = <NUM_LIT:0.0>          <EOL>DA = <NUM_LIT:0.0>                <EOL>DA_Mpc = <NUM_LIT:0.0>            <EOL>DA_scale = <NUM_LIT:0.0><EOL>DL = <NUM_LIT:0.0>                <EOL>DL_Mpc = <NUM_LIT:0.0>            <EOL>DMOD = <NUM_LIT:0.0><EOL>a = <NUM_LIT:0.0>                 <EOL>az = <NUM_LIT:1.0> / (<NUM_LIT:1.0> + z)        <EOL>n = <NUM_LIT:1000><EOL>for i in range(n):<EOL><INDENT>a = az + (<NUM_LIT:1.0> - az) * (i + <NUM_LIT:0.5>) / n<EOL>adot = math.sqrt(WK + (WM / a) + (WR / (math.pow(a, <NUM_LIT:2>)))<EOL>+ (WV * math.pow(a, <NUM_LIT:2>)))<EOL>DCMR = DCMR + <NUM_LIT:1.0> / (a * adot)<EOL><DEDENT>DCMR = (<NUM_LIT:1.0> - az) * DCMR / n<EOL>DCMR_Mpc = (c / H0) * DCMR<EOL>x = math.sqrt(abs(WK)) * DCMR<EOL>if x > <NUM_LIT:0.1>:<EOL><INDENT>if WK > <NUM_LIT:0.0>:<EOL><INDENT>ratio = <NUM_LIT:0.5> * (math.exp(x) - math.exp(-x)) / x<EOL><DEDENT>else:<EOL><INDENT>ratio = math.sin(x) / x<EOL><DEDENT><DEDENT>else:<EOL><INDENT>y = math.pow(x, <NUM_LIT:2>)<EOL>if WK < <NUM_LIT:0.0>:<EOL><INDENT>y = -y<EOL><DEDENT>ratio = <NUM_LIT:1> + y / <NUM_LIT> + math.pow(y, <NUM_LIT:2>) / <NUM_LIT><EOL><DEDENT>DA = az * ratio * DCMR  <EOL>DA_Mpc = (c / H0) * DA  <EOL>DA_scale = DA_Mpc / <NUM_LIT><EOL>DL = DA / math.pow(az, <NUM_LIT:2>)  <EOL>DL_Mpc = (c / H0) * DL  <EOL>DMOD = <NUM_LIT:5> * math.log10(DL_Mpc * <NUM_LIT>) - <NUM_LIT:5><EOL>precision = len(repr(z).split("<STR_LIT:.>")[-<NUM_LIT:1>])<EOL>DCMR_Mpc = "<STR_LIT>" % (precision, DCMR_Mpc)<EOL>DA_Mpc = "<STR_LIT>" % (precision, DA_Mpc)<EOL>DA_scale = "<STR_LIT>" % (precision, DA_scale)<EOL>DL_Mpc = "<STR_LIT>" % (precision, DL_Mpc)<EOL>DMOD = "<STR_LIT>" % (precision, DMOD)<EOL>z = "<STR_LIT>" % (precision, z)<EOL>results ={<EOL>"<STR_LIT>": float(DCMR_Mpc),<EOL>"<STR_LIT>": float(DA_Mpc),<EOL>"<STR_LIT>": float(DA_scale),<EOL>"<STR_LIT>": float(DL_Mpc),<EOL>"<STR_LIT>": float(DMOD),<EOL>"<STR_LIT:z>": float(z)<EOL>}<EOL>self.log.info('<STR_LIT>')<EOL>return results<EOL>
*convert redshift to various distance measurements*

        **Key Arguments:**
            - ``z`` -- redshift measurement.
            - ``WM`` -- Omega_matter. Default *0.3*
            - ``WV`` -- Omega_vacuum. Default *0.7*
            - ``H0`` -- Hubble constant. (km s-1 Mpc-1) Default *70.0*

        **Return:**
            - ``results`` -- result dictionary including
                - ``dcmr_mpc`` -- co-moving radius distance
                - ``da_mpc`` -- angular distance
                - ``da_scale`` -- angular distance scale
                - ``dl_mpc`` -- luminosity distance (usually use this one)
                - ``dmod`` -- distance modulus (determined from luminosity distance)

        ..  todo::

                - replace convert_redshift_to_distance in all other code

        **Usage:**

            .. code-block:: python

                from astrocalc.distances import converter
                c = converter(log=log)
                dists = c.redshift_to_distance(
                    z=0.343
                )

                print "Distance Modulus: " + str(dists["dmod"]) + " mag"
                print "Luminousity Distance: " + str(dists["dl_mpc"]) + " Mpc"
                print "Angular Size Scale: " + str(dists["da_scale"]) + " kpc/arcsec"
                print "Angular Size Distance: " + str(dists["da_mpc"]) + " Mpc"
                print "Comoving Radial Distance: " + str(dists["dcmr_mpc"]) + " Mpc"

                # OUTPUT :
                # Distance Modulus: 41.27 mag
                # Luminousity Distance: 1795.16 Mpc
                # Angular Size Scale: 4.85 kpc/arcsec
                # Angular Size Distance: 999.76 Mpc
                # Comoving Radial Distance: 1339.68 Mpc

                from astrocalc.distances import converter
                c = converter(log=log)
                dists = c.redshift_to_distance(
                    z=0.343,
                    WM=0.286,
                    WV=0.714,
                    H0=69.6
                )

                print "Distance Modulus: " + str(dists["dmod"]) + " mag"
                print "Luminousity Distance: " + str(dists["dl_mpc"]) + " Mpc"
                print "Angular Size Scale: " + str(dists["da_scale"]) + " kpc/arcsec"
                print "Angular Size Distance: " + str(dists["da_mpc"]) + " Mpc"
                print "Comoving Radial Distance: " + str(dists["dcmr_mpc"]) + " Mpc"

                # OUTPUT :
                # Distance Modulus: 41.29 mag
                # Luminousity Distance: 1811.71 Mpc
                # Angular Size Scale: 4.89 kpc/arcsec
                # Angular Size Distance: 1008.97 Mpc
                # Comoving Radial Distance: 1352.03 Mpc