From da33f17c556118292002674567d3397e172d26cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaquier=20Aur=C3=A9lien=20Tristan?= Date: Wed, 7 Aug 2024 13:53:48 +0200 Subject: [PATCH 1/2] fix freq indexing in impedance plotting --- bluepyefe/plotting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bluepyefe/plotting.py b/bluepyefe/plotting.py index 778f31e..e802540 100644 --- a/bluepyefe/plotting.py +++ b/bluepyefe/plotting.py @@ -383,7 +383,7 @@ def plot_impedance(cell, output_dir, efel_settings): fft_volt = numpy.fft.fft(normalized_voltage) fft_cur = numpy.fft.fft(normalized_current) if any(fft_cur) == 0: - return None + continue # convert dt from ms to s to have freq in Hz freq = numpy.fft.fftfreq(len(normalized_voltage), d=dt / 1000.) Z = fft_volt / fft_cur @@ -400,7 +400,7 @@ def plot_impedance(cell, output_dir, efel_settings): fig = plt.figure() ax = fig.add_subplot(1, 1, 1) - ax.plot(freq[:len(smooth_Z)], smooth_Z) + ax.plot(freq[select_idxs][:len(smooth_Z)], smooth_Z) ax.set_xlabel("Frequency (Hz)") ax.set_ylabel("normalized Z") fig .suptitle(f"Impedance for {rec.name}\nfor cell {cell.name}") From 3c9c1e160e778e1535b9f1efb908796290cd5664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaquier=20Aur=C3=A9lien=20Tristan?= Date: Wed, 7 Aug 2024 14:01:40 +0200 Subject: [PATCH 2/2] small fix --- bluepyefe/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluepyefe/plotting.py b/bluepyefe/plotting.py index e802540..0028a64 100644 --- a/bluepyefe/plotting.py +++ b/bluepyefe/plotting.py @@ -400,7 +400,7 @@ def plot_impedance(cell, output_dir, efel_settings): fig = plt.figure() ax = fig.add_subplot(1, 1, 1) - ax.plot(freq[select_idxs][:len(smooth_Z)], smooth_Z) + ax.plot(freq[select_idxs], smooth_Z) ax.set_xlabel("Frequency (Hz)") ax.set_ylabel("normalized Z") fig .suptitle(f"Impedance for {rec.name}\nfor cell {cell.name}")