From 35d16c9f4443f8ee3c3f205f76f83f6d88a989f5 Mon Sep 17 00:00:00 2001 From: ilkilic Date: Mon, 9 Oct 2023 11:51:57 +0200 Subject: [PATCH 1/2] Force evaluation for built-in map() --- bluepyefe/plotting.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bluepyefe/plotting.py b/bluepyefe/plotting.py index 516fbf0..575710e 100644 --- a/bluepyefe/plotting.py +++ b/bluepyefe/plotting.py @@ -116,6 +116,12 @@ def _plot(cell, output_dir, show=False): def plot_all_recordings(cells, output_dir, show=False, mapper=map): """Plot recordings for all cells and all protocols""" mapper(partial(_plot, output_dir=output_dir, show=show), cells) + if mapper == map: + # For the built-in map(), ensure immediate evaluation as it returns a lazy iterator + # which won't execute the function until iterated over. Converting to a list forces this iteration. + list(mapper(partial(_plot, output_dir=output_dir, show=show), cells)) + else: + mapper(partial(_plot, output_dir=output_dir, show=show), cells) def plot_efeature( From 4a94a0aef08d1fd2fda802efc8451c863c11f793 Mon Sep 17 00:00:00 2001 From: ilkilic Date: Mon, 9 Oct 2023 12:37:12 +0200 Subject: [PATCH 2/2] fix duplicate call --- bluepyefe/plotting.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bluepyefe/plotting.py b/bluepyefe/plotting.py index 575710e..e98d21f 100644 --- a/bluepyefe/plotting.py +++ b/bluepyefe/plotting.py @@ -115,7 +115,6 @@ def _plot(cell, output_dir, show=False): def plot_all_recordings(cells, output_dir, show=False, mapper=map): """Plot recordings for all cells and all protocols""" - mapper(partial(_plot, output_dir=output_dir, show=show), cells) if mapper == map: # For the built-in map(), ensure immediate evaluation as it returns a lazy iterator # which won't execute the function until iterated over. Converting to a list forces this iteration.