Commit 8b92cddb authored by Félix Hartmann's avatar Félix Hartmann
Browse files

[feature] Size-dependent strains.

parent 021a6d92
......@@ -40,6 +40,7 @@ class CellFile(object):
division_threshold=2,
enlargement_threshold=1,
growth_prefactor=.03,
size_dependent_strains=False,
data_time_unit=60*60*24,
date=None):
"""
......@@ -58,6 +59,8 @@ class CellFile(object):
division
growth_prefactor : float
factor for converting signal concentrations into a growth rate
size_dependent_strains : Boolean (default: False)
If True, strains are inversely proportional to cell diameters.
data_time_unit : int
time unit of data, in seconds, including signals (but not
diffusion constant)
......@@ -92,6 +95,8 @@ class CellFile(object):
self.growth_prefactor = growth_prefactor / self.data_time_unit
self.size_dependent_strains = size_dependent_strains
# how the cell zones are defined
self.identity_definition = "anatomy"
......@@ -378,26 +383,18 @@ class CellFile(object):
# update the cumulated time evolution
self.cum_u_evol += u_evolution
def compute_cambial_cells_strains(self):
"""Compute the strains of the cambial cells."""
self.S[self.cambial_cells] = self.division_prefactor \
* np.prod(np.take(
np.take(self.cell_conc, self.division_signals, axis=0),
self.cambial_cells, axis=1), axis=0)
def compute_enlarging_cells_strains(self):
"""Compute the strains of the enlarging cells."""
self.S[self.enlarging_cells] = self.enlargement_prefactor \
* np.prod(np.take(
np.take(self.cell_conc, self.enlargement_signals, axis=0),
self.enlarging_cells, axis=1), axis=0)
def compute_cell_strains(self):
"""If strain control is the same for all cells."""
self.S[self.growing_cells] = self.growth_prefactor \
* np.prod(np.take(self.cell_conc[self.control_indices],
self.growing_cells, axis=1),
axis=0)
control_conc = self.cell_conc[self.control_indices]
control_conc_in_growing_cells = np.take(control_conc,
self.growing_cells, axis=1)
conc_product = np.prod(control_conc_in_growing_cells, axis=0)
D_growing_cells = self.D_real[self.growing_cells]
if self.size_dependent_strains:
self.S[self.growing_cells] = self.growth_prefactor * conc_product \
* self.initial_CRD / D_growing_cells
else:
self.S[self.growing_cells] = self.growth_prefactor * conc_product
def grow_by_one_step_and_check_for_division(self, u, PIN):
"""
......
......@@ -24,8 +24,8 @@ from transport import (UniformDiffusion, SimpleUnidirectionalActiveTransport,
SmithModel2006, ImposedCellConcentrations)
from plottingcontrol import PlottingControl
from traits.api import (HasTraits, Instance, Str, Int, Float, List, Enum, File,
Button)
from traits.api import (HasTraits, Instance, Str, Int, Float, Bool, List, Enum,
File, Button)
from traitsui.api import (View, Item, Group, HGroup, TextEditor, FileEditor,
ListEditor, CheckListEditor, EnumEditor, OKButton,
CancelButton)
......@@ -171,7 +171,7 @@ def growth(simu):
total_time = (stop_time - start_time).total_seconds()
nb_input_samples = int((total_time + simu.snapshot_time_step)
/ simu.input_time_step) + 2
# precomputation of time-dependant values
# precomputation of time-dependent values
signals = simu.signals
for signal in signals:
signal.set_time_dependant_values(
......@@ -187,6 +187,7 @@ def growth(simu):
division_threshold=simu.division_threshold,
enlargement_threshold=simu.enlargement_threshold,
growth_prefactor=simu.growth_prefactor,
size_dependent_strains=simu.size_dependent_strains,
data_time_unit=time_units["day"]
)
division_identity_signal = signal_from_name(
......@@ -481,6 +482,11 @@ class ControlPanel(HasTraits):
number = self.signals[-1].number + 1
self.signals.append(Morphogen(number=number))
size_dependent_strains = Bool(False,
label="Size-dependent strains",
desc="whether strains are inversely proportional to cell diameters."
)
################
# Advanced tab #
################
......@@ -551,6 +557,7 @@ class ControlPanel(HasTraits):
editor=CheckListEditor(name='signal_names', cols=4),
style="custom"),
Item('add_signal', show_label=False),
Item('size_dependent_strains'),
label="Model",
dock='tab'
),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment