SyMBac.simulation
- class SyMBac.simulation.Simulation(trench_length, trench_width, cell_max_length, max_length_var, cell_width, width_var, lysis_p, sim_length, pix_mic_conv, gravity, phys_iters, resize_amount, save_dir)[source]
Class for instantiating Simulation objects. These are the basic objects used to run all SyMBac simulations. This class is used to parameterise simulations, run them, draw optical path length images, and then visualise them.
Example:
>>> from SyMBac.simulation import Simulation >>> my_simulation = Simulation( trench_length=15, trench_width=1.3, cell_max_length=6.65, #6, long cells # 1.65 short cells cell_width= 1, #1 long cells # 0.95 short cells sim_length = 100, pix_mic_conv = 0.065, gravity=0, phys_iters=15, max_length_var = 0., width_var = 0., lysis_p = 0., save_dir="/tmp/", resize_amount = 3 ) >>> my_simulation.run_simulation(show_window=False) >>> my_simulation.draw_simulation_OPL(do_transformation=True, label_masks=True) >>> my_simulation.visualise_in_napari()
- __init__(trench_length, trench_width, cell_max_length, max_length_var, cell_width, width_var, lysis_p, sim_length, pix_mic_conv, gravity, phys_iters, resize_amount, save_dir)[source]
Initialising a Simulation object
- Parameters
trench_length (float) – Length of a mother machine trench (micron)
trench_width (float) – Width of a mother machine trench (micron)
cell_max_length (float) – Maximum length a cell can reach before dividing (micron)
cell_width (float) – the average cell width in the simulation (micron)
pix_mic_conv (float) – The micron/pixel size of the image
gravity (float) – Pressure forcing cells into the trench. Typically left at zero, but can be varied if cells start to fall into each other or if the simulation behaves strangely.
phys_iters (int) – Number of physics iterations per simulation frame. Increase to resolve collisions if cells are falling into one another, but decrease if cells begin to repel one another too much (too high a value causes cells to bounce off each other very hard). 20 is a good starting point
max_length_var (float) – Variance of the maximum cell length
width_var (float) – Variance of the maximum cell width
save_dir (str) – Location to save simulation output
lysis_p (float) – probability of cell lysis
sim_length (int) – number of frames to simulate (where each one is dt). Start with 200-1000, and grow your simulation from there.
resize_amount (int) – This is the “upscaling” factor for the simulation and the entire image generation process. Must be kept constant across the image generation pipeline. Starting value of 3 recommended.