Module dadi.Polyploidy.PolyIntegration

Functions

def implicit_1Dx(phi, xx, nu, s, dt, use_delj_trick, ploidy)

Implicit 1D integration function for 1D diffusion equation.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) xx: numpy array (float64) discrete numerical grid for spatial dimension nu: Population size s: vector of selection parameters dt: Time step use_delj_trick: Whether to use delj optimization (0 or 1) ploidy: Vector of ploidy Booleans (0 or 1) [dip, auto, alloa, allob, autohex, hex_tetra, hex_dip, hexa, hexb, hexc]

Returns:

phi: Modified phi array

def implicit_2Dx(phi, xx, yy, nu1, m12, s1, dt, use_delj_trick, ploidy1)

Implicit 2D integration function for x direction of 2D diffusion equation.

Parameters:

phi: numpy array (float64) Population frequency array (modified in-place) xx, yy: numpy arrays (float64) discrete numerical grids for spatial dimensions nu1: Population size for pop1 m12: Migration rate to pop1 from pop2 s1: vector of selection parameters for pop1 dt: Time step use_delj_trick: Whether to use delj optimization (0 or 1) ploidy1: Vector of ploidy Booleans (0 or 1) [dip, auto, alloa, allob, autohex, hex_tetra, hex_dip, hexa, hexb, hexc]

Returns:

phi : modified phi after integration in x direction

def implicit_2Dy(phi, xx, yy, nu2, m21, s2, dt, use_delj_trick, ploidy2)

Implicit 2D integration function for y direction of 2D diffusion equation.

Parameters:

phi: numpy array (float64) Population frequency array (modified in-place) xx, yy: numpy arrays (float64) discrete numerical grids for spatial dimensions nu2: Population size for pop2 m21: Migration rate to pop2 from pop1 s2: vector of selection parameters for pop2 dt: Time step use_delj_trick: Whether to use delj optimization (0 or 1) ploidy2: Vector of ploidy Booleans (0 or 1) [dip, auto, alloa, allob, autohex, hex_tetra, hex_dip, hexa, hexb, hexc]

Returns:

phi: modified phi after integration in y direction

def implicit_3Dx(phi, xx, yy, zz, nu1, m12, m13, s1, dt, use_delj_trick, ploidy1)

Implicit 3D integration function for x direction of 3D diffusion equation.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) xx, yy, zz: numpy arrays (float64) discrete numerical grids for spatial dimensions nu1: Population size for pop1 m12: Migration rate to pop1 from pop2 m13: Migration rate to pop1 from pop3 s1: vector of selection parameters for pop1 dt: Time step use_delj_trick: Whether to use delj trick (0 or 1) ploidy1: Vector of ploidy Booleans (0 or 1) [dip, auto, alloa, allob, autohex, hex_tetra, hex_dip, hexa, hexb, hexc]

Returns:

phi : modified phi after integration in x direction

def implicit_3Dy(phi, xx, yy, zz, nu2, m21, m23, s2, dt, use_delj_trick, ploidy2)

Implicit 3D integration function for y direction of 3D diffusion equation.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) xx, yy, zz: numpy arrays (float64) discrete numerical grids for spatial dimensions nu2: Population size for pop2 m21: Migration rate to pop2 from pop1 m23: Migration rate to pop2 from pop3 s2: vector of selection parameters for pop2 dt: Time step use_delj_trick: Whether to use delj trick (0 or 1) ploidy2: Vector of ploidy Booleans (0 or 1) [dip, auto, alloa, allob, autohex, hex_tetra, hex_dip, hexa, hexb, hexc]

Returns:

phi : modified phi after integration in x direction

def implicit_3Dz(phi, xx, yy, zz, nu3, m31, m32, s3, dt, use_delj_trick, ploidy3)

Implicit 3D integration function for z direction of 3D diffusion equation.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) xx, yy, zz: numpy arrays (float64) discrete numerical grids for spatial dimensions nu3: Population size for pop3 m31: Migration rate to pop3 from pop1 m32: Migration rate to pop3 from pop2 s3: vector of selection parameters for pop3 dt: Time step use_delj_trick: Whether to use delj trick (0 or 1) ploidy3: Vector of ploidy Booleans (0 or 1) [dip, auto, alloa, allob, autohex, hex_tetra, hex_dip, hexa, hexb, hexc]

Returns:

phi : modified phi after integration in x direction

def implicit_4Da(phi, xx, yy, zz, aa, nu4, m41, m42, m43, s4, dt, use_delj_trick, ploidy4)

Implicit 4D integration function for a direction of 4D diffusion equation.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) xx, yy, zz, aa: numpy arrays (float64) discrete numerical grids for spatial dimensions nu4: Population size for pop4 m41: Migration rate to pop4 from pop1 m42: Migration rate to pop4 from pop2 m43: Migration rate to pop4 from pop3 s4: vector of selection parameters for pop4 dt: Time step use_delj_trick: Whether to use delj trick (0 or 1) ploidy4: Vector of ploidy Booleans (0 or 1) [dip, auto, alloa, allob, autohex, hex_tetra, hex_dip, hexa, hexb, hexc]

Returns:

phi : modified phi after integration in a direction

def implicit_4Dx(phi, xx, yy, zz, aa, nu1, m12, m13, m14, s1, dt, use_delj_trick, ploidy1)

Implicit 4D integration function for x direction of 4D diffusion equation.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) xx, yy, zz, aa: numpy arrays (float64) discrete numerical grids for spatial dimensions nu1: Population size for pop1 m12: Migration rate to pop1 from pop2 m13: Migration rate to pop1 from pop3 m14: Migration rate to pop1 from pop4 s1: vector of selection parameters for pop1 dt: Time step use_delj_trick: Whether to use delj trick (0 or 1) ploidy: Vector of ploidy Booleans (0 or 1) [dip, auto, alloa, allob, autohex, hex_tetra, hex_dip, hexa, hexb, hexc]

Returns:

phi : modified phi after integration in x direction

def implicit_4Dy(phi, xx, yy, zz, aa, nu2, m21, m23, m24, s2, dt, use_delj_trick, ploidy2)

Implicit 4D integration function for y direction of 4D diffusion equation.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) xx, yy, zz, aa: numpy arrays (float64) discrete numerical grids for spatial dimensions nu2: Population size for pop2 m21: Migration rate to pop2 from pop1 m23: Migration rate to pop2 from pop3 m24: Migration rate to pop2 from pop4 s2: vector of selection parameters for pop2 dt: Time step use_delj_trick: Whether to use delj trick (0 or 1) ploidy2: Vector of ploidy Booleans (0 or 1) [dip, auto, alloa, allob, autohex, hex_tetra, hex_dip, hexa, hexb, hexc]

Returns:

phi : modified phi after integration in y direction

def implicit_4Dz(phi, xx, yy, zz, aa, nu3, m31, m32, m34, s3, dt, use_delj_trick, ploidy3)

Implicit 4D integration function for z direction of 4D diffusion equation.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) xx, yy, zz, aa: numpy arrays (float64) discrete numerical grids for spatial dimensions nu3: Population size for pop3 m31: Migration rate to pop3 from pop1 m32: Migration rate to pop3 from pop2 m34: Migration rate to pop3 from pop4 s3: vector of selection parameters for pop3 dt: Time step use_delj_trick: Whether to use delj trick (0 or 1) ploidy3: Vector of ploidy Booleans (0 or 1) [dip, auto, alloa, allob, autohex, hex_tetra, hex_dip, hexa, hexb, hexc]

Returns:

phi : modified phi after integration in z direction

def implicit_5Da(phi, xx, yy, zz, aa, bb, nu4, m41, m42, m43, m45, s4, dt, use_delj_trick, ploidy4)

Implicit 5D integration function for a direction of 5D diffusion equation.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) xx, yy, zz, aa, bb: numpy arrays (float64) discrete numerical grids for spatial dimensions nu4: Population size for pop4 m41: Migration rate to pop4 from pop1 m42: Migration rate to pop4 from pop2 m43: Migration rate to pop4 from pop3 m45: Migration rate to pop4 from pop5 s4: vector of selection parameters for pop4 dt: Time step use_delj_trick: Whether to use delj trick (0 or 1) ploidy4: Vector of ploidy Booleans (0 or 1) [dip, auto, alloa, allob, autohex, hex_tetra, hex_dip, hexa, hexb, hexc]

Returns:

phi : modified phi after integration in a direction

def implicit_5Db(phi, xx, yy, zz, aa, bb, nu5, m51, m52, m53, m54, s5, dt, use_delj_trick, ploidy5)

Implicit 5D integration function for b direction of 5D diffusion equation.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) xx, yy, zz, aa, bb: numpy arrays (float64) discrete numerical grids for spatial dimensions nu5: Population size for pop5 m51: Migration rate to pop5 from pop1 m52: Migration rate to pop5 from pop2 m53: Migration rate to pop5 from pop3 m54: Migration rate to pop5 from pop4 s5: vector of selection parameters for pop5 dt: Time step use_delj_trick: Whether to use delj trick (0 or 1) ploidy5: Vector of ploidy Booleans (0 or 1) [dip, auto, alloa, allob, autohex, hex_tetra, hex_dip, hexa, hexb, hexc]

Returns:

phi : modified phi after integration in a direction

def implicit_5Dx(phi, xx, yy, zz, aa, bb, nu1, m12, m13, m14, m15, s1, dt, use_delj_trick, ploidy1)

Implicit 5D integration function for x direction of 5D diffusion equation.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) xx, yy, zz, aa, bb: numpy arrays (float64) discrete numerical grids for spatial dimensions nu1: Population size for pop1 m12: Migration rate to pop1 from pop2 m13: Migration rate to pop1 from pop3 m14: Migration rate to pop1 from pop4 m15: Migration rate to pop1 from pop5 s1: vector of selection parameters for pop1 dt: Time step use_delj_trick: Whether to use delj trick (0 or 1) ploidy: Vector of ploidy Booleans (0 or 1) [dip, auto, alloa, allob, autohex, hex_tetra, hex_dip, hexa, hexb, hexc]

Returns:

phi : modified phi after integration in x direction

def implicit_5Dy(phi, xx, yy, zz, aa, bb, nu2, m21, m23, m24, m25, s2, dt, use_delj_trick, ploidy2)

Implicit 5D integration function for y direction of 5D diffusion equation.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) xx, yy, zz, aa, bb: numpy arrays (float64) discrete numerical grids for spatial dimensions nu2: Population size for pop2 m21: Migration rate to pop2 from pop1 m23: Migration rate to pop2 from pop3 m24: Migration rate to pop2 from pop4 m25: Migration rate to pop2 from pop5
s2: vector of selection parameters for pop2 dt: Time step use_delj_trick: Whether to use delj trick (0 or 1) ploidy2: Vector of ploidy Booleans (0 or 1) [dip, auto, alloa, allob, autohex, hex_tetra, hex_dip, hexa, hexb, hexc]

Returns:

phi : modified phi after integration in y direction

def implicit_5Dz(phi, xx, yy, zz, aa, bb, nu3, m31, m32, m34, m35, s3, dt, use_delj_trick, ploidy3)

Implicit 5D integration function for z direction of 5D diffusion equation.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) xx, yy, zz, aa, bb: numpy arrays (float64) discrete numerical grids for spatial dimensions nu3: Population size for pop3 m31: Migration rate to pop3 from pop1 m32: Migration rate to pop3 from pop2 m34: Migration rate to pop3 from pop4 m35: Migration rate to pop3 from pop5 s3: vector of selection parameters for pop3 dt: Time step use_delj_trick: Whether to use delj trick (0 or 1) ploidy3: Vector of ploidy Booleans (0 or 1) [dip, auto, alloa, allob, autohex, hex_tetra, hex_dip, hexa, hexb, hexc]

Returns:

phi : modified phi after integration in z direction

def implicit_precalc_2Dx(phi, ax, bx, cx, dt)

Implicit 2D integration function for x direction of 2D diffusion equation. Uses arrays pre-computed in Python for a, b, c.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) ax : numpy array (float64) a, b, c, arrays are for tridiagonal matrix solver bx : numpy array (float64) cx : numpy array (float64) dt : float Time step

Returns:

phi : modified phi after integration in x direction

def implicit_precalc_2Dy(phi, ay, by, cy, dt)

Implicit 2D integration function for y direction of 2D diffusion equation. Uses arrays pre-computed in Python for a, b, c.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) ay : numpy array (float64) a, b, c, arrays are for tridiagonal matrix solver by : numpy array (float64) cy : numpy array (float64) dt : float Time step

Returns:

phi : modified phi after integration in y direction

def implicit_precalc_3Dx(phi, ax, bx, cx, dt)

Implicit 3D integration function for x direction of 3D diffusion equation. Uses arrays pre-computed in Python for a, b, c.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) ax : numpy array (float64) a, b, c, arrays are for tridiagonal matrix solver bx : numpy array (float64) cx : numpy array (float64) dt : Time step

Returns:

phi : modified phi after integration in x direction

def implicit_precalc_3Dy(phi, ay, by, cy, dt)

Implicit 3D integration function for y direction of 3D diffusion equation. Uses arrays pre-computed in Python for a, b, c.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) ay : numpy array (float64) a, b, c, arrays are for tridiagonal matrix solver by : numpy array (float64) cy : numpy array (float64) dt : Time step

Returns:

phi : modified phi after integration in y direction

def implicit_precalc_3Dz(phi, az, bz, cz, dt)

Implicit 3D integration function for z direction of 3D diffusion equation. Uses arrays pre-computed in Python for a, b, c.

Parameters:

phi : numpy array (float64) Population frequency array (modified in-place) az : numpy array (float64) a, b, c, arrays are for tridiagonal matrix solver bz : numpy array (float64) cz : numpy array (float64) dt : Time step

Returns:

phi : modified phi after integration in z direction