Skip to content

Commit

Permalink
Fixed crashes when trying to plot with negative Stokes I value.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron-Van-Eck committed Nov 13, 2023
1 parent 2bcf080 commit 0a2eb9a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions RMtools_1D/do_RMsynth_1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0a2eb9a

Please sign in to comment.