Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions emodelrunner/GUI_utils/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,6 @@ def load_synapse_display_data(self):

def instantiate(self):
"""Instantiate cell, simulation & protocol."""
self.cell.freeze(self.release_params)
self.cell.instantiate(sim=self.sim)
self.protocol.instantiate(sim=self.sim, cell_model=self.cell)
self.sim.neuron.h.tstop = self.protocol.total_duration
Expand All @@ -501,7 +500,6 @@ def destroy(self):
"""Destroy cell & protocol."""
self.protocol.destroy(sim=self.sim)
self.cell.destroy(sim=self.sim)
self.cell.unfreeze(self.release_params.keys())

def get_voltage(self):
"""Returns voltage response.
Expand Down
22 changes: 0 additions & 22 deletions emodelrunner/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,6 @@ def get_replace_axon(self):

return replace_axon

def freeze_params(self, param_values):
"""Freeze params and return list of params to unfreze afterwards.

Args:
param_values (dict): contains values of the optimized parameters

Returns:
list: names of the newly frozen parameters
"""
to_unfreeze = []
for param in self.params.values():
if not param.frozen:
param.freeze(param_values[param.name])
to_unfreeze.append(param.name)

return to_unfreeze

def remove_point_process_mechs(self):
"""Return mechanisms without point process mechanisms.

Expand Down Expand Up @@ -157,8 +140,6 @@ def create_custom_hoc(
str: hoc script describing this cell model
"""
# pylint: disable=too-many-arguments
to_unfreeze = self.freeze_params(param_values)

replace_axon = self.get_replace_axon()

mechs = self.remove_point_process_mechs()
Expand All @@ -176,9 +157,6 @@ def create_custom_hoc(
syn_hoc_filename=syn_hoc_filename,
syn_dir=syn_dir,
)

self.unfreeze(to_unfreeze)

return ret

@staticmethod
Expand Down
14 changes: 0 additions & 14 deletions emodelrunner/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,20 +205,14 @@ def load_unoptimized_parameters(params_path, v_init, celsius):
is_global = False
is_dist = False

bounds = None
value = None
for param_config in params:
param_name = param_config["name"]

if isinstance(param_config["val"], (list, tuple)):
is_frozen = False
bounds = param_config["val"]
value = None

else:
is_frozen = True
value = param_config["val"]
bounds = None

if is_global:
# force v_init to the given value
Expand All @@ -230,8 +224,6 @@ def load_unoptimized_parameters(params_path, v_init, celsius):
ephys.parameters.NrnGlobalParameter(
name=param_name,
param_name=param_name,
frozen=is_frozen,
bounds=bounds,
value=value,
)
)
Expand All @@ -241,8 +233,6 @@ def load_unoptimized_parameters(params_path, v_init, celsius):
name=f"{param_name}.{sectionlist}",
obj=dist,
attr_name=param_name,
frozen=is_frozen,
bounds=bounds,
value=value,
)
)
Expand All @@ -262,8 +252,6 @@ def load_unoptimized_parameters(params_path, v_init, celsius):
param_name=param_name,
value_scaler=dist,
value=value,
bounds=bounds,
frozen=is_frozen,
locations=seclist_locs,
)
)
Expand All @@ -274,8 +262,6 @@ def load_unoptimized_parameters(params_path, v_init, celsius):
param_name=param_name,
value_scaler=dist,
value=value,
bounds=bounds,
frozen=is_frozen,
locations=seclist_locs,
)
)
Expand Down
4 changes: 0 additions & 4 deletions emodelrunner/protocols/sscx_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ def run(self, cell_model, param_values, sim=None, isolate=None):
# pylint: disable=unused-argument
responses = collections.OrderedDict()

cell_model.freeze(param_values)

# Find resting membrane potential
rmp_response = self.rmp_protocol.run(cell_model, {}, sim=sim)
responses.update(rmp_response)
Expand All @@ -194,8 +192,6 @@ def run(self, cell_model, param_values, sim=None, isolate=None):
self.run_pre_protocols(responses, cell_model, sim)
self.run_other_protocols(responses, cell_model, sim)

cell_model.unfreeze(param_values.keys())

return responses

def generate_current(self, threshold_current=None, holding_current=None, dt=0.1):
Expand Down
8 changes: 0 additions & 8 deletions emodelrunner/protocols/synplas_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def _run_func(self, cell_model, param_values, sim=None):
"""
# pylint: disable=raise-missing-from
try:
cell_model.freeze(param_values)
cell_model.instantiate(sim=sim)

self.instantiate(sim=sim, cell_model=cell_model)
Expand Down Expand Up @@ -135,8 +134,6 @@ def _run_func(self, cell_model, param_values, sim=None):

cell_model.destroy(sim=sim)

cell_model.unfreeze(param_values.keys())

return responses
except BaseException:
raise RuntimeError("".join(traceback.format_exception(*sys.exc_info())))
Expand Down Expand Up @@ -252,10 +249,8 @@ def _run_func(
"""
# pylint: disable=raise-missing-from
try:
precell_model.freeze(pre_param_values)
precell_model.instantiate(sim=sim)

postcell_model.freeze(post_param_values)
postcell_model.instantiate(sim=sim)

self.instantiate(
Expand Down Expand Up @@ -293,9 +288,6 @@ def _run_func(
precell_model.destroy(sim=sim)
postcell_model.destroy(sim=sim)

precell_model.unfreeze(pre_param_values.keys())
postcell_model.unfreeze(post_param_values.keys())

return responses
except BaseException:
raise RuntimeError("".join(traceback.format_exception(*sys.exc_info())))
Expand Down
4 changes: 0 additions & 4 deletions emodelrunner/protocols/thalamus_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ def run(self, cell_model, param_values, sim=None, isolate=None):
# pylint: disable=unused-argument
responses = collections.OrderedDict()

cell_model.freeze(param_values)

# Find resting membrane potential
logger.info("Running RMP protocol")
rmp_response = self.rmp_protocol.run(cell_model, {}, sim=sim)
Expand Down Expand Up @@ -181,8 +179,6 @@ def run(self, cell_model, param_values, sim=None, isolate=None):
self._run_pre_protocols(cell_model, sim, responses)
self._run_other_protocols(cell_model, sim, responses)

cell_model.unfreeze(param_values.keys())

return responses

def _run_pre_protocols(self, cell_model, sim, responses):
Expand Down
2 changes: 0 additions & 2 deletions tests/unit_tests/test_GUI_simulator_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def test_load_synapse_display_data(self):
with cwd(example_dir):
self.simulator.load_cell_sim()
self.simulator.sim.mechanisms_directory = "./"
self.simulator.cell.freeze(self.simulator.release_params)
self.simulator.cell.instantiate(sim=self.simulator.sim)

assert self.simulator.syn_display_data is None
Expand All @@ -114,4 +113,3 @@ def test_load_synapse_display_data(self):

# destroy cell
self.simulator.cell.destroy(sim=self.simulator.sim)
self.simulator.cell.unfreeze(self.simulator.release_params.keys())