Esempio n. 1
0
def get_fixation_dominant_disease(S):
    sign_S = algopy.sign(S)
    H = algopy.zeros_like(S)
    for i in range(H.shape[0]):
        for j in range(H.shape[1]):
            H[i, j] = 1. / kimrecessive.denom_piecewise(
                    0.5*S[i, j], -sign_S[i, j])
    return H
Esempio n. 2
0
def get_fixation_unconstrained(S, d):
    sign_S = algopy.sign(S)
    D = d * sign_S
    H = algopy.zeros_like(S)
    for i in range(H.shape[0]):
        for j in range(H.shape[1]):
            H[i, j] = 1. / kimrecessive.denom_piecewise(0.5 * S[i, j], D[i, j])
    return H
Esempio n. 3
0
def get_fixation_dominant_disease(S):
    sign_S = algopy.sign(S)
    H = algopy.zeros_like(S)
    for i in range(H.shape[0]):
        for j in range(H.shape[1]):
            H[i, j] = 1. / kimrecessive.denom_piecewise(
                    0.5*S[i, j], -sign_S[i, j])
    return H
Esempio n. 4
0
def get_fixation_unconstrained(S, d, k):
    D = d * numpy.tanh(numpy.exp(k)*S)
    H = numpy.zeros_like(S)
    for i in range(H.shape[0]):
        for j in range(H.shape[1]):
            H[i, j] = 1. / kimrecessive.denom_piecewise(
                    0.5*S[i, j], D[i, j])
    return H
Esempio n. 5
0
def get_fixation_unconstrained(S, d):
    sign_S = algopy.sign(S)
    D = d * sign_S
    H = algopy.zeros_like(S)
    for i in range(H.shape[0]):
        for j in range(H.shape[1]):
            H[i, j] = 1. / kimrecessive.denom_piecewise(
                    0.5*S[i, j], D[i, j])
    return H
Esempio n. 6
0
def get_fixation_unconstrained_kb(S, d, log_kb):
    """
    This uses the Kacser and Burns effect instead of the sign function.
    """
    soft_sign_S = algopy.tanh(algopy.exp(log_kb) * S)
    D = d * soft_sign_S
    H = algopy.zeros_like(S)
    for i in range(H.shape[0]):
        for j in range(H.shape[1]):
            H[i, j] = 1. / kimrecessive.denom_piecewise(0.5 * S[i, j], D[i, j])
    return H
Esempio n. 7
0
def get_fixation_unconstrained_kb(S, d, log_kb):
    """
    This uses the Kacser and Burns effect instead of the sign function.
    """
    soft_sign_S = algopy.tanh(algopy.exp(log_kb)*S)
    D = d * soft_sign_S
    H = algopy.zeros_like(S)
    for i in range(H.shape[0]):
        for j in range(H.shape[1]):
            H[i, j] = 1. / kimrecessive.denom_piecewise(
                    0.5*S[i, j], D[i, j])
    return H
Esempio n. 8
0
def get_response_content(fs):
    # create the R table string and scripts
    headers = [
        'z',
        'c.neg2.0',
        'c.neg0.5',
        'c.0.5',
        'c.2.0',
        #'c.a',
        #'c.b',
        #'c.c',
        #'c.d',
    ]
    #C = numpy.array([-0.5, -0.2, 0.2, 0.5], dtype=float)
    #C = numpy.array([-1.0, -0.4, 0.4, 1.0], dtype=float)
    C = numpy.array([-2.0, -0.5, 0.5, 2.0], dtype=float)
    Z = numpy.linspace(-5, 5, 101)
    # get the data for the R table
    arr = []
    for z in Z:
        row = [z]
        for c in C:
            rate = 1.0 / kimrecessive.denom_piecewise(c, z * numpy.sign(c))
            row.append(rate)
        arr.append(row)
    # get the R table
    table_string = RUtil.get_table_string(arr, headers)
    # get the R script
    script = get_ggplot()
    # create the R plot image
    device_name = Form.g_imageformat_to_r_function[fs.imageformat]
    retcode, r_out, r_err, image_data = RUtil.run_plotter(
        table_string, script, device_name)
    if retcode:
        raise RUtil.RError(r_err)
    return image_data
Esempio n. 9
0
def get_response_content(fs):
    # create the R table string and scripts
    headers = [
            'z',
            'c.neg2.0',
            'c.neg0.5',
            'c.0.5',
            'c.2.0',
            #'c.a',
            #'c.b',
            #'c.c',
            #'c.d',
            ]
    #C = numpy.array([-0.5, -0.2, 0.2, 0.5], dtype=float)
    #C = numpy.array([-1.0, -0.4, 0.4, 1.0], dtype=float)
    C = numpy.array([-2.0, -0.5, 0.5, 2.0], dtype=float)
    Z = numpy.linspace(-5, 5, 101)
    # get the data for the R table
    arr = []
    for z in Z:
        row = [z]
        for c in C:
            rate = 1.0 / kimrecessive.denom_piecewise(c, z*numpy.sign(c))
            row.append(rate)
        arr.append(row)
    # get the R table
    table_string = RUtil.get_table_string(arr, headers)
    # get the R script
    script = get_ggplot()
    # create the R plot image
    device_name = Form.g_imageformat_to_r_function[fs.imageformat]
    retcode, r_out, r_err, image_data = RUtil.run_plotter(
            table_string, script, device_name)
    if retcode:
        raise RUtil.RError(r_err)
    return image_data
Esempio n. 10
0
def get_relative_error_c(c, d):
    x = kimrecessive.denom_quad(c, d)
    y = kimrecessive.denom_piecewise(c, d)
    z = (y-x) / x
    return refilter(z)