示例#1
0
def expsfh(tq, tau, time):
    """ This function when given a single combination of [tq, tau] values will calcualte the SFR at all times. First calculate the sSFR at all times as defined by Peng et al. (2010) - then the SFR at the specified time of quenching, tq and set the SFR at this value  at all times before tq. Beyond this time the SFR is an exponentially declining function with timescale tau. 
        
        INPUT:
        :tau:
        The exponential timescale decay rate of the star formation history in Gyr. Allowed range from the rest of the functions is 0 < tau [Gyr] < 5. 
        
        :tq: 
        The time at which the onset of quenching begins in Gyr. Allowed ranges from the beginning to the end of known cosmic time.
        :time:
        An array of time values at which the SFR is calcualted at each step. 
        
        RETURNS:
        :sfr:
        Array of the same dimensions of time containing the sfr at each timestep.
        """
    ssfr = 2.5*(((10**10.27)/1E10)**(-0.1))*(time/3.5)**(-2.2)
    c = time.searchsorted(3.0)
    ssfr[:c] = N.interp(3.0, time, ssfr)
    c_sfr = N.interp(tq, time, ssfr)*(1E10)/(1E9)
    ### definition is for 10^10 M_solar galaxies and per gyr - convert to M_solar/year ###
    a = time.searchsorted(tq)
    sfr = N.ones(len(time))*c_sfr
    sfr[a:] = c_sfr*N.exp(-(time[a:]-tq)/tau)
    return sfr
示例#2
0
def expsfh(tq, tau, time):
    """ This function when given a single combination of [tq, tau] values will calcualte the SFR at all times. First calculate the sSFR at all times as defined by Peng et al. (2010) - then the SFR at the specified tq of quenching and set the SFR as constant at this value before this time. Beyond this time the SFR is an exponentially declining function with timescale tau. 
        
        INPUT:
        :tau:
        The exponential timescale decay rate of the star formation history in Gyr. Allowed range from the rest of the functions is 0 < tau [Gyr] < 5. 
        
        :tq: 
        The time at which the onset of quenching begins in Gyr. Allowed ranges from the beginning to the end of known cosmic time.
        :time:
        An array of time values at which the SFR is calcualted at each step. 
        
        RETURNS:
        :sfr:
        Array of the same dimensions of time containing the sfr at each timestep.
        """
    ssfr = 2.5*(((10**10.27)/1E10)**(-0.1))*(time/3.5)**(-2.2)
    c = time.searchsorted(3.0)
    ssfr[:c] = N.interp(3.0, time, ssfr)
    c_sfr = N.interp(tq, time, ssfr)*(1E10)/(1E9)
    ### definition is for 10^10 M_solar galaxies and per gyr - convert to M_solar/year ###
    a = time.searchsorted(tq)
    sfr = N.ones(len(time))*c_sfr
    sfr[a:] = c_sfr*N.exp(-(time[a:]-tq)/tau)
    return sfr
示例#3
0
def expsfh(tau, tq, time):
    ssfr = 2.5*(((10**10.27)/1E10)**(-0.1))*(time/3.5)**(-2.2) #ssfr as defined by Peng et al (2010)
    c_sfr = N.interp(tq, time, ssfr)*(1E10)/(1E9) # definition is for 10^10 M_solar galaxies and per gyr - convert to M_solar/year
    a = time.searchsorted(tq)
    sfr = N.ones(len(time))*c_sfr
    sfr[a:] = c_sfr*N.exp(-(time[a:]-tq)/tau)
    return sfr
示例#4
0
def expsfh(tau, tq, time):
    ssfr = 2.5*(((10**10.27)/1E10)**(-0.1))*(time/3.5)**(-2.2) #ssfr as defined by Peng et al (2010)
    for n in range(len(time)):
        if time[n] < 3.0:
            ssfr[n] = N.interp(3.0, time, ssfr)
    c_sfr = N.interp(tq, time, ssfr)*(1E10)/(1E9) # definition is for 10^10 M_solar galaxies and per gyr - convert to M_solar/year
    a = time.searchsorted(tq)
    sfr = N.ones(len(time))*c_sfr
    sfr[a:] = c_sfr*N.exp(-(time[a:]-tq)/tau)
    m_array = (sfr.T)*(N.append(1, N.diff(time*1E9)))
    mass_array = S.linalg.toeplitz(m_array, N.zeros_like(sfr/sfr[0])).T
    mass = N.sum(mass_array, axis=0)
    return sfr, mass
示例#5
0
def expsfh_mass(ur, Mr, age, tq, tau, time):
    """
    Calculate exponential decline star formation rates at each time step input by matching to the mass of the observed galaxy at the observed time. 
    This is calculated from the mass-to-light ratio that is a function of one color band u-r as in Bladry et al. (2006; see Figure 5) 
    who fit to data from Glazebrrok et al (2004) and Kauffmann et al (2003).
       
    INPUT:

    :ur:
    u-r optical colour, needed to calculate the mass of the observed galaxy

    :Mr:
    Absolute r-band magnitude, needed to calculate the mass of the observed galaxy 

    :age:
    Observed age of a galaxy, often calculated from the redshift i.e. at z=0.1 the age ~ 12.5. Must be in units of Gyr.

    :tq: 
    The time at which the onset of quenching begins in Gyr. Allowed ranges from the beginning to the end of known cosmic time.

    :tau:
    The exponential timescale decay rate of the star formation history in Gyr. Allowed range from the rest of the functions is 0 < tau [Gyr] < 5. 

    :time:
    An array of time values at which the SFR is calcualted at each step. 
    
    RETURNS:
    :sfr:
    Array of the same dimensions of time containing the sfr at each timestep.
    """ 

    t_end = age # time at which to integrate under the exponential curve until to gain the final mass 
    
    if (ur <= 2.1):
        log_m_l = -0.95 + 0.56 * ur
    else:
        log_m_l = -0.16 + 0.18 * ur
    
    m_msun = 10**(((4.62 - Mr)/2.5) + log_m_l)

    print "Mass [M_solar]" + str(m_msun)

    c_sfr = (m_msun/(tq + tau * (1 - N.exp((tq - t_end) / tau)))) / 1E9
    a = time.searchsorted(tq)
    sfr = N.ones(len(time)) * c_sfr
    sfr[a:] = c_sfr * N.exp(-(time[a:] - tq) / tau)

    return sfr 
示例#6
0
def expsfh_mass(ur, Mr, age, tq, tau, time):
    """Calculate exponential decline star formation rates at each time step input by matching to the mass of the observed galaxy at the observed time. This is calculated from the mass-to-light ratio that is a function of one color band u-r as in Bladry et al. (2006; see Figure 5) who fit to data from Glazebrrok et al (2004) and Kauffmann et al (2003).
       
       INPUT:

        :ur:
        u-r optical colour, needed to calculate the mass of the observed galaxy

        :Mr:
        Absolute r-band magnitude, needed to calculate the mass of the observed galaxy 

        :age:
        Observed age of a galaxy, often calculated from the redshift i.e. at z=0.1 the age ~ 12.5. Must be in units of Gyr.

        :tq: 
        The time at which the onset of quenching begins in Gyr. Allowed ranges from the beginning to the end of known cosmic time.

        :tau:
        The exponential timescale decay rate of the star formation history in Gyr. Allowed range from the rest of the functions is 0 < tau [Gyr] < 5. 

        :time:
        An array of time values at which the SFR is calcualted at each step. 
        
        RETURNS:
        :sfr:
        Array of the same dimensions of time containing the sfr at each timestep.
        """

    t_end = age  # time at which to integrate under the exponential curve until to gain the final mass
    if ur <= 2.1:
        log_m_l = -0.95 + 0.56 * ur
    else:
        log_m_l = -0.16 + 0.18 * ur
    m_msun = 10**(((4.62 - Mr) / 2.5) + log_m_l)
    print 'Mass [M_solar]', m_msun
    c_sfr = (m_msun / (tq + tau * (1 - N.exp((tq - t_end) / tau)))) / 1E9
    a = time.searchsorted(tq)
    sfr = N.ones(len(time)) * c_sfr
    sfr[a:] = c_sfr * N.exp(-(time[a:] - tq) / tau)
    return sfr
示例#7
0
def expsfh(tau, tq, time):
    a = time.searchsorted(tq)
    sfr = N.ones(len(time))*100
    sfr[a:] = 100*N.exp(-(time[a:]-tq)/tau)
    return sfr