ecoli.library.lattice_utils
Utilities for Lattice Environments
- ecoli.library.lattice_utils.apply_exchanges(agents, fields, exchanges_path, location_path, n_bins, bounds, bin_volume)[source]
- ecoli.library.lattice_utils.count_to_concentration(count, bin_volume)[source]
Convert a molecule count into a concentration.
Parameters should all have units. Returned value will have units.
- ecoli.library.lattice_utils.get_bin_site(location, n_bins, bounds)[source]
Get a bin’s indices in the lattice
- Parameters:
location (list) – A list of 2 floats that specify the x and y coordinates of a point inside the desired bin.
n_bins (list) – A list of 2 ints that specify the number of bins along the x and y axes, respectively.
bounds (list) – A list of 2 floats that define the dimensions of the lattice environment along the x and y axes, respectively.
- Returns:
A 2-tuple of the x and y indices of the bin in the lattice.
- Return type:
- ecoli.library.lattice_utils.get_bin_volume(n_bins, bounds, depth)[source]
Get a bin’s volume
- Parameters:
n_bins (list) – A list of 2 ints that specify the number of bins along the x and y axes, respectively.
bounds (list) – A list of 2 floats that specify the lengths of the environment’s sides in the x and y directions, respectively. In units of microns.
depth (float) – The depth of the environment, in microns.
- Returns:
The volume of each bin in the lattice, in Liters.
- Return type:
- ecoli.library.lattice_utils.make_diffusion_schema(exchanges_path, external_path, location_path, bounds, n_bins, depth, molecule_ids, default_field)[source]
- ecoli.library.lattice_utils.make_gradient(gradient, n_bins, size)[source]
Create a gradient from a configuration
Random A random gradient fills the field randomly with each molecule, with values between 0 and the concentrations specified.
Example configuration:
'gradient': { 'type': 'random', 'molecules': { 'mol_id1': 1.0, 'mol_id2': 2.0 }},
Uniform
A uniform gradient fills the field evenly with each molecule, at the concentrations specified.
Example configuration:
'gradient': { 'type': 'uniform', 'molecules': { 'mol_id1': 1.0, 'mol_id2': 2.0 }},
Gaussian
A gaussian gradient multiplies the base concentration of the given molecule by a gaussian function of distance from center and deviation. Distance is scaled by 1/1000 from microns to millimeters.
Example configuration:
'gradient': { 'type': 'gaussian', 'molecules': { 'mol_id1':{ 'center': [0.25, 0.5], 'deviation': 30}, 'mol_id2': { 'center': [0.75, 0.5], 'deviation': 30} }},
Linear
A linear gradient sets a site’s concentration (c) of the given molecule as a function of distance (d) from center and slope (b), and base concentration (a). Distance is scaled by 1/1000 from microns to millimeters.
\[c = a + b * d\]Example configuration:
'gradient': { 'type': 'linear', 'molecules': { 'mol_id1':{ 'center': [0.0, 0.0], 'base': 0.1, 'slope': -10}, 'mol_id2': { 'center': [1.0, 1.0], 'base': 0.1, 'slope': -5} }},
Exponential
An exponential gradient sets a site’s concentration (c) of the given molecule as a function of distance (d) from center, with parameters base (b) and scale (a). Distance is scaled by 1/1000 from microns to millimeters. Note: base > 1 makes concentrations increase from the center.
\[c=a*b^d.\]Example configuration:
'gradient': { 'type': 'exponential', 'molecules': { 'mol_id1':{ 'center': [0.0, 0.0], 'base': 1+2e-4, 'scale': 1.0}, 'mol_id2': { 'center': [1.0, 1.0], 'base': 1+2e-4, 'scale' : 0.1} }},
- Parameters:
gradient – Configuration dictionary that includes the
type
key to specify the type of gradient to make.n_bins – A list of two elements that specify the number of bins to have along each axis.
size – A list of two elements that specifies the size of the environment.