Skip to content

Commit

Permalink
Force evaluation for built-in map()
Browse files Browse the repository at this point in the history
  • Loading branch information
ilkilic committed Oct 9, 2023
1 parent b4aaba0 commit 35d16c9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bluepyefe/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 35d16c9

Please sign in to comment.