From 0a2eb9a1a266c9acbbd516aa5ecf56e1a508fb33 Mon Sep 17 00:00:00 2001 From: Cameron Van Eck Date: Tue, 14 Nov 2023 09:42:19 +1100 Subject: [PATCH] Fixed crashes when trying to plot with negative Stokes I value. --- RMtools_1D/do_RMsynth_1D.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/RMtools_1D/do_RMsynth_1D.py b/RMtools_1D/do_RMsynth_1D.py index 41f8571..3b3bf2e 100755 --- a/RMtools_1D/do_RMsynth_1D.py +++ b/RMtools_1D/do_RMsynth_1D.py @@ -170,7 +170,7 @@ def run_rmsynth(data, polyOrd=2, phiMax_radm2=None, dPhi_radm2=None, modStokesI = modStokesI, ) - dquArr = (dqArr + duArr)/2.0 + dquArr = np.abs(dqArr + duArr)/2.0 dquArr= np.where(np.isfinite(dquArr),dquArr,np.nan) @@ -188,9 +188,9 @@ def run_rmsynth(data, polyOrd=2, phiMax_radm2=None, dPhi_radm2=None, IArr = IArr, qArr = qArr, uArr = uArr, - dIArr = dIArr, - dqArr = dqArr, - duArr = duArr, + dIArr = np.abs(dIArr), + dqArr = np.abs(dqArr), + duArr = np.abs(duArr), freqHirArr_Hz = freqHirArr_Hz, IModArr = IModHirArr, fig = specFig, @@ -327,7 +327,7 @@ def run_rmsynth(data, polyOrd=2, phiMax_radm2=None, dPhi_radm2=None, # Calculate the theoretical noise in the FDF !!Old formula only works for wariance weights! weightArr = np.where(np.isnan(weightArr), 0.0, weightArr) - dFDFth = Ifreq0*np.sqrt( np.nansum(weightArr**2 * np.nan_to_num(dquArr)**2) / (np.sum(weightArr))**2 ) + dFDFth = np.abs(Ifreq0)*np.sqrt( np.nansum(weightArr**2 * np.nan_to_num(dquArr)**2) / (np.sum(weightArr))**2 ) # Measure the parameters of the dirty FDF