diff --git a/bluepymm/prepare_combos/create_mm_sqlite.py b/bluepymm/prepare_combos/create_mm_sqlite.py
index ebdf8e2f70781aeabe4a1d3a3ab46e1cbcdb3ae3..c5cbd10a8e363d69f1abec3ca896b0be479613a9 100644
--- a/bluepymm/prepare_combos/create_mm_sqlite.py
+++ b/bluepymm/prepare_combos/create_mm_sqlite.py
@@ -187,6 +187,7 @@ def create_mm_sqlite(
output_filename,
recipe_filename,
morph_dir,
+ rep_morph_dir,
original_emodel_etype_map,
final_dict,
emodel_dirs,
@@ -270,7 +271,7 @@ def create_mm_sqlite(
fullmtype_morph_map,
original_emodel_etype_map,
emodel_dirs,
- morph_dir,
+ rep_morph_dir,
skip_repaired_exemplar=skip_repaired_exemplar)
# Prepend exemplar rows to full_map
diff --git a/bluepymm/prepare_combos/main.py b/bluepymm/prepare_combos/main.py
index 48030d9df5c6951c9eb376233b668b189eaaeef6..f57e8b6ce9d7b73fe1ebf256ba2f8f0a5aab5ff9 100644
--- a/bluepymm/prepare_combos/main.py
+++ b/bluepymm/prepare_combos/main.py
@@ -59,12 +59,15 @@ def prepare_emodels(conf_dict, continu, scores_db_path):
skip_repaired_exemplar = conf_dict.get('skip_repaired_exemplar', False)
recipe_filename = conf_dict['recipe_path']
morph_dir = conf_dict['morph_path']
+ rep_morph_dir = conf_dict['rep_morph_path']
+ print('Using repaired exemplar morph path: %s' % rep_morph_dir)
# Create a sqlite3 db with all the combos
create_mm_sqlite.create_mm_sqlite(
scores_db_path,
recipe_filename,
morph_dir,
+ rep_morph_dir,
emodel_etype_map,
final_dict,
emodel_dirs,
diff --git a/bluepymm/select_combos/table_processing.py b/bluepymm/select_combos/table_processing.py
index a1382cc5c4861464605ba187ee1cac588198f05c..b715fc7c61000c78253ff79b72410c474e577e66 100644
--- a/bluepymm/select_combos/table_processing.py
+++ b/bluepymm/select_combos/table_processing.py
@@ -34,16 +34,19 @@ def _row_transform(row, exemplar_row, to_skip_patterns,
feature did not exceed the corresponding feature threshold, or can be
ignored.
"""
+
for column in row.index[1:]:
# set all values that can be ignored to True
for pattern in to_skip_patterns:
if pattern.match(column):
row[column] = True
+ continue
# find the appropriate threshold
for megate_feature_threshold in row['megate_feature_threshold']:
if megate_feature_threshold['features'].match(column):
- megate_threshold = megate_feature_threshold['megate_threshold']
+ megate_threshold = megate_feature_threshold[
+ 'megate_threshold']
# transform score
if skip_repaired_exemplar:
@@ -149,14 +152,13 @@ def check_opt_scores(emodel, scores):
def _apply_megating(emodel_mtype_etype_thresholds, emodel_score_values,
exemplar_row, to_skip_patterns, skip_repaired_exemplar):
"""Compare score values to applicable feature thresholds."""
+
megate_scores = pandas.concat(
[emodel_mtype_etype_thresholds['megate_feature_threshold'],
- emodel_score_values],
- axis=1).apply(lambda row: _row_transform(row,
- exemplar_row,
- to_skip_patterns,
- skip_repaired_exemplar),
- axis=1)
+ emodel_score_values], axis=1).apply(
+ lambda row:
+ _row_transform(row, exemplar_row, to_skip_patterns,
+ skip_repaired_exemplar), axis=1)
del megate_scores['megate_feature_threshold']
megate_scores['Passed all'] = megate_scores.all(axis=1)
return megate_scores
@@ -251,7 +253,7 @@ def process_emodel(emodel,
print('Skipping e-model %s: no repaired exemplars' % emodel)
return
- exemplar_row = exemplar_score_values.iloc[0]
+ exemplar_row = exemplar_score_values.iloc[0].to_dict()
# identify relevant me-gate feature thresholds for each row
emodel_mtype_etypes = scores[(scores.emodel == emodel) &
@@ -264,6 +266,7 @@ def process_emodel(emodel,
emodel_mtype_etype_thresholds = emodel_mtype_etypes.loc[
:, ['emodel', 'fullmtype', 'etype']]
emodel_mtype_etype_thresholds['megate_feature_threshold'] = None
+
emodel_mtype_etype_thresholds.apply(
lambda row: row_threshold_transform(row, megate_patterns),
axis=1)
@@ -281,6 +284,7 @@ def process_emodel(emodel,
# identify combinations that passed the me-gating step
emodel_scores = scores[(scores.emodel == emodel) &
(scores.is_exemplar == 0)].copy()
+
passed_combos = emodel_scores[megate_scores['Passed all']]
if len(passed_combos[passed_combos['emodel'] != emodel]) > 0:
raise Exception('Something went wrong during row indexing in megating')