From 73a3f93a086b3a8ec5230d241d1716f11b6b92ce Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Thu, 11 Jun 2020 22:05:07 +0100 Subject: [PATCH] Added divide by zero ignore for s11, s21, zin, yin --- tools/plot_antenna_params.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/plot_antenna_params.py b/tools/plot_antenna_params.py index 053d4a51..2f4ad993 100644 --- a/tools/plot_antenna_params.py +++ b/tools/plot_antenna_params.py @@ -101,15 +101,19 @@ def calculate_antenna_params(filename, tltxnumber=1, tlrxnumber=None, rxnumber=N delaycorrection = np.exp(1j * 2 * np.pi * freqs * (dt / 2)) # Calculate s11 and (optionally) s21 - s11 = np.abs(np.fft.fft(Vref) / np.fft.fft(Vinc)) + with np.errstate(divide='ignore'): + s11 = np.abs(np.fft.fft(Vref) / np.fft.fft(Vinc)) if tlrxnumber or rxnumber: - s21 = np.abs(np.fft.fft(Vrec) / np.fft.fft(Vinc)) + with np.errstate(divide='ignore'): + s21 = np.abs(np.fft.fft(Vrec) / np.fft.fft(Vinc)) # Calculate input impedance - zin = (np.fft.fft(Vtotal) * delaycorrection) / np.fft.fft(Itotal) + with np.errstate(divide='ignore'): + zin = (np.fft.fft(Vtotal) * delaycorrection) / np.fft.fft(Itotal) # Calculate input admittance - yin = np.fft.fft(Itotal) / (np.fft.fft(Vtotal) * delaycorrection) + with np.errstate(divide='ignore'): + yin = np.fft.fft(Itotal) / (np.fft.fft(Vtotal) * delaycorrection) # Convert to decibels (ignore warning from taking a log of any zero values) with np.errstate(divide='ignore'):