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

[refactor] Function 'signal_from_name' becomes method of ControlPanel

class.
parent 43d90785
......@@ -160,15 +160,6 @@ class TextDisplay(HasTraits):
style='custom'))
def signal_from_name(name, signals):
"""From a name, return the corresponding signal."""
L = [signal for signal in signals if signal.name == name]
if L:
return L[0]
else:
return None
def growth(simu):
"""Simulation run.
......@@ -197,11 +188,11 @@ def growth(simu):
size_dependent_strains=simu.size_dependent_strains,
data_time_unit=time_units["day"]
)
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)
division_identity_signal = simu.signal_from_name(
simu.division_identity_signal)
enlargement_identity_signal = simu.signal_from_name(
simu.enlargement_identity_signal)
growth_control_signals = [simu.signal_from_name(name)
for name in simu.growth_control_signals]
simu.cell_file.grow(
start_time,
......@@ -256,6 +247,14 @@ class ControlPanel(HasTraits):
self.signals = signals
self.signal_names = [signal.name for signal in self.signals]
def signal_from_name(self, name):
"""From a name, return the corresponding signal."""
L = [signal for signal in self.signals if signal.name == name]
if L:
return L[0]
else:
return None
##################
# Simulation 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