Skip to content

Commit

Permalink
Merge branch 'master' of github.com:INM-6/mesocircuit-model
Browse files Browse the repository at this point in the history
  • Loading branch information
espenhgn committed Sep 24, 2023
2 parents bb03da3 + 51b3b61 commit e2c0cc3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
19 changes: 13 additions & 6 deletions mesocircuit/mesocircuit_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class MesocircuitExperiment():
Parameters
----------
name_exp : str
name_exp
Name of the experiment. All corresponding data and scripts will be
written to a folder with this name.
custom_params : dict, optional
Dictionary with new parameters or parameter ranges to overwrite the
default ones.
data_dir : str, optional
data_dir
Absolute path to write data to.
load : bool , optional
load
If True, parameters are not newly evaluated and the earlier saved
parameterview and Mesocircuit(s) are loaded.
"""
Expand All @@ -63,9 +63,14 @@ def __init__(self, name_exp='base', custom_params=None, data_dir=None,
else:
self.data_dir = data_dir
self.data_dir_exp = os.path.join(self.data_dir, self.name_exp)

# check if data directory exists
if not os.path.isdir(self.data_dir_exp):
raise Exception(
f'Data directory does not exist: {self.data_dir_exp}')

print(f'Data directory: {self.data_dir_exp}')

# TODO add check if data exists
if not load:
self.parameterview, self.circuits = \
self._evaluate_parameters(custom_params)
Expand Down Expand Up @@ -155,7 +160,7 @@ def _evaluate_parameters(self, custom_params={}):
for sub_paramset in sub_paramspace.iter_inner():
ps_id = helpers.get_unique_id(sub_paramset)

# readd ana_dict and plot_dict to get full paramset
# add ana_dict and plot_dict to get full paramset
# (deep copy of sub_paramset is needed)
paramset = {
**copy.deepcopy(sub_paramset),
Expand Down Expand Up @@ -315,7 +320,7 @@ class Mesocircuit():
Name of the MesocircuitExperiment.
ps_id
Unique parameter set id.
load_parameters : bool
load_parameters
If True, load parameters from file. Sets class attributes for each
dictionary.
"""
Expand Down Expand Up @@ -571,6 +576,8 @@ def _write_jobscripts(self, paramset, path):
"""

if name == 'network':
# the allocator jemalloc is here used for improved
# performance (see Ippen et al., 2017):
# get path to jemalloc
# "which jemalloc" executed on the command line returns
# something like
Expand Down
2 changes: 2 additions & 0 deletions tests/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ def mean_distance_sampled(radius, beta, num_nodes, num_distances):
mean_delay_sampled = delay_offset_matrix[i, j] \
+ mean_distance / prop_speed_matrix[i, j]

# for manually comparing the analytical and sampled delays,
# uncomment the following line:
# print(delay_lin_eff_mean_matrix[i, j], mean_delay_sampled)
self.assertAlmostEqual(delay_lin_eff_mean_matrix[i, j] /
mean_delay_sampled,
Expand Down

0 comments on commit e2c0cc3

Please sign in to comment.