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

[feature] The 'identity signal' is split into a 'division identity signal'

and a 'enlargement identity signal'.
parent 24194f30
......@@ -152,12 +152,13 @@ class CellFile(object):
zone_3 : 1-D ndarray of ints
Lists of the indices of the cells below the division threshold.
"""
id_conc = cell_conc[self.id_index]
zone_1 = np.where(id_conc >= self.division_threshold)[0]
div_id_conc = cell_conc[self.div_id_index]
enl_id_conc = cell_conc[self.enl_id_index]
zone_1 = np.where(div_id_conc >= self.division_threshold)[0]
zone_2 = np.where(
(id_conc >= self.enlargement_threshold)
& (id_conc < self.division_threshold))[0]
zone_3 = np.where(id_conc < self.enlargement_threshold)[0]
(enl_id_conc >= self.enlargement_threshold)
& (div_id_conc < self.division_threshold))[0]
zone_3 = np.where(enl_id_conc < self.enlargement_threshold)[0]
return zone_1, zone_2, zone_3
def get_cells_identities(self):
......@@ -392,7 +393,7 @@ class CellFile(object):
self.enlarging_cells, axis=1), axis=0)
def compute_cell_strains(self):
"""If strain rate control is the same for all cells."""
"""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),
......@@ -409,7 +410,7 @@ class CellFile(object):
self.cell_conc = self.get_cell_concentrations(u, self.conc_operator)
self.compute_cell_strains()
for i in self.growing_cells:
if self.cell_conc[self.id_index, i] < \
if self.cell_conc[self.enl_id_index, i] < \
self.enlargement_threshold:
self.growing_cells.remove(i)
if i in self.small_cells:
......@@ -423,7 +424,7 @@ class CellFile(object):
division = False
for i in self.small_cells[::-1]:
if self.D_real[i] > self.D_threshold:
if self.cell_conc[self.id_index, i] > \
if self.cell_conc[self.div_id_index, i] > \
self.division_threshold:
u, PIN, self.nodes_per_cell, self.conc_operator = \
self.cell_division(i, u, PIN, self.nodes_per_cell)
......@@ -446,7 +447,7 @@ class CellFile(object):
self.nb_nodes = self.nodes_per_cell.sum()
if division:
self.growing_cells = [i for i in range(self.nb_cells) if
self.cell_conc[self.id_index, i] >
self.cell_conc[self.enl_id_index, i] >
self.enlargement_threshold and i not in
self.non_growing_cells]
self.small_cells = [i for i in self.growing_cells if
......@@ -719,7 +720,8 @@ class CellFile(object):
growth_time_step=3600,
snapshot_time_step=3600,
nodes_per_cell=3,
identity_signal=None,
division_identity_signal=None,
enlargement_identity_signal=None,
control_signals=None,
check_conservation=False):
"""Make a radial file grow.
......@@ -743,13 +745,12 @@ class CellFile(object):
Time step between snapshots saved, in seconds.
nodes_per_cell : int, optional
Initial number of mesh nodes in cells (the default is 3).
signals : list or tuple of DiffusiveSignal objects
Signals that will diffuse in the radial file.
rate_control_scheme : tuple or list of strings
Each string determinates which rates a signal controls.
For instance, rate_control_scheme = ("de", "d") means that the
first signal controls both division and enlargement rates and
the second one only controls enlargement rates.
division_identity_signal : Morphogen object
Signal which sets division identity to cells.
enlargement_identity_signal : Morphogen object
Signal which sets enlargement identity to cells.
contral_signals : list or tuple of Morphogen objects
Signals which set growth rate.
check_conservation : bool, optional
If True, the program will monitor the conservation of the total
quantity of signals the file (the default is False).
......@@ -772,16 +773,17 @@ class CellFile(object):
self.nb_nodes = self.nodes_per_cell.sum()
self.conc_operator = self.compute_concentration_operator(
self.nodes_per_cell)
if identity_signal in control_signals:
self.nb_signals = len(control_signals)
self.signals = control_signals
self.id_index = self.signals.index(identity_signal)
self.control_indices = slice(self.nb_signals)
else:
self.nb_signals = len(control_signals) + 1
self.signals = [identity_signal] + control_signals
self.id_index = 0
self.control_indices = slice(1, self.nb_signals)
# Construct the list of signals
signals = [division_identity_signal] + [enlargement_identity_signal] \
+ list(control_signals)
self.signals = list(set(signals)) # remove duplicates with 'set()'
self.nb_signals = len(self.signals)
# Find the indices of the signals setting the division identity, the
# enlargement identity, and the growth rates (control signals).
self.div_id_index = self.signals.index(division_identity_signal)
self.enl_id_index = self.signals.index(enlargement_identity_signal)
self.control_indices = [i for i, sig in enumerate(self.signals)
if sig in control_signals]
# length of the reference domaine Omega_0
self.L0 = self.nb_cells * self.initial_CRD
# mesh internode in each cell
......@@ -913,7 +915,7 @@ class CellFile(object):
else:
inactive = False
self.growing_cells = [i for i in range(self.nb_cells) if
self.cell_conc[self.id_index, i]
self.cell_conc[self.enl_id_index, i]
>= self.enlargement_threshold]
self.non_growing_cells = [i for i in range(self.nb_cells) if
i not in self.growing_cells]
......@@ -1023,7 +1025,7 @@ class CellFile(object):
self.cell_conc = self.get_cell_concentrations(
u, self.conc_operator)
self.growing_cells = [i for i in range(self.nb_cells) if
self.cell_conc[self.id_index, i]
self.cell_conc[self.enl_id_index, i]
>= self.enlargement_threshold]
self.non_growing_cells = [i for i in range(self.nb_cells) if
i not in self.growing_cells]
......
......@@ -189,7 +189,10 @@ def growth(simu):
growth_prefactor=simu.growth_prefactor,
data_time_unit=time_units["day"]
)
identity_signal = signal_from_name(simu.identity_signal, signals)
division_identity_signal = signal_from_name(
simu.division_identity_signal, signals)
enlargement_identity_signal = signal_from_name(
simu.enlargement_identity_signal, signals)
growth_control_signals = [signal_from_name(name, signals)
for name in simu.growth_control_signals]
simu.cell_file.grow(
......@@ -200,7 +203,8 @@ def growth(simu):
growth_time_step=simu.growth_time_step,
snapshot_time_step=simu.snapshot_time_step,
nodes_per_cell=simu.nodes_per_cell,
identity_signal=identity_signal,
division_identity_signal=division_identity_signal,
enlargement_identity_signal=enlargement_identity_signal,
control_signals=growth_control_signals
)
......@@ -324,6 +328,12 @@ class ControlPanel(HasTraits):
traits_dict[key] = "non-equilibrium"
for key in keys_to_remove:
del traits_dict[key]
# The following if-block is for backward compatibility.
if "identity_signal" in traits_dict:
identity_signal = traits_dict["identity_signal"]
traits_dict["division_identity_signal"] = identity_signal
traits_dict["enlargement_identity_signal"] = identity_signal
del traits_dict["identity_signal"]
self.set(**traits_dict)
def save_to_file(self, file_name):
......@@ -387,12 +397,23 @@ class ControlPanel(HasTraits):
threshold_list = [division_threshold, enlargement_threshold]
identity_signal = Str(
label="Identity signal",
desc="the signal which determines the identities of cells."
division_identity_signal = Str(
label="Division identity signal",
desc="the signal which determines which cells have a division identity."
)
def _identity_signal_default(self):
def _division_identity_signal_default(self):
if len(self.signals) > 0:
return self.signals[0].name
else:
return None
enlargement_identity_signal = Str(
label="Enlargement identity signal",
desc="the signal which determines which cells have a enlargement identity."
)
def _enlargement_identity_signal_default(self):
if len(self.signals) > 0:
return self.signals[0].name
else:
......@@ -415,18 +436,23 @@ class ControlPanel(HasTraits):
Any signal removed from the 'signals' List must be also removed from
the 'growth_control_signals' List if needed. If the removed signal is
the 'identity_signal', tnen the 'identity_signal' must be changed.
an identity_signal, tnen the 'division_identity_signal' or the
'enlargement_identity_signal' must be changed.
"""
if self.identity_signal is None and len(new.added) > 0:
self.identity_signal = self.signals[0].number
if self.division_identity_signal is None and len(new.added) > 0:
self.division_identity_signal = self.signals[0].number
if self.enlargement_identity_signal is None and len(new.added) > 0:
self.enlargement_identity_signal = self.signals[0].number
if len(new.removed) > 0:
if not self.signals:
self.division_identity_signal = None
self.enlargement_identity_signal = None
for signal in new.removed:
if self.identity_signal is signal.number:
if len(self.signals) > 0:
self.identity_signal = self.signals[0].number
else:
self.identity_signal = None
if self.division_identity_signal is signal.number:
self.division_identity_signal = self.signals[0].number
if self.enlargement_identity_signal is signal.number:
self.enlargement_identity_signal = self.signals[0].number
for growth_control_signal in self.growth_control_signals:
if growth_control_signal is signal.number:
self.growth_control_signals.remove(
......@@ -515,11 +541,14 @@ class ControlPanel(HasTraits):
Item('division_threshold'),
Item('enlargement_threshold'),
Item('growth_prefactor'),
Item('identity_signal',
editor=EnumEditor(name='signal_names', cols=2),
style="custom"),
Item('division_identity_signal',
editor=EnumEditor(name='signal_names'),
style="simple"),
Item('enlargement_identity_signal',
editor=EnumEditor(name='signal_names'),
style="simple"),
Item('growth_control_signals',
editor=CheckListEditor(name='signal_names', cols=2),
editor=CheckListEditor(name='signal_names', cols=4),
style="custom"),
Item('add_signal', show_label=False),
label="Model",
......
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