Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron-Van-Eck committed Dec 6, 2024
2 parents c05c5e4 + da63f79 commit 80801eb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
8 changes: 2 additions & 6 deletions RMtools_1D/do_RMsynth_1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,12 +491,8 @@ def run_rmsynth(
log("FDF Noise (Corrected MAD) = %.4g %s" % (mDict["dFDFcorMAD"], units))
log("FDF SNR = %.4g " % (mDict["snrPIfit"]))
log(
"sigma_add(q) = %.4g (+%.4g, -%.4g)"
% (mDict["sigmaAddQ"], mDict["dSigmaAddPlusQ"], mDict["dSigmaAddMinusQ"])
)
log(
"sigma_add(u) = %.4g (+%.4g, -%.4g)"
% (mDict["sigmaAddU"], mDict["dSigmaAddPlusU"], mDict["dSigmaAddMinusU"])
"sigma_add (combined) = %.4g (+%.4g, -%.4g)"
% (mDict["sigmaAddC"], mDict["dSigmaAddPlusC"], mDict["dSigmaAddMinusC"])
)
log("Fitted polynomial order = {} ".format(mDict["polyOrd"]))
log()
Expand Down
8 changes: 2 additions & 6 deletions RMtools_1D/rmtools_bwdepol.py
Original file line number Diff line number Diff line change
Expand Up @@ -1336,12 +1336,8 @@ def run_adjoint_rmsynth(
log("FDF Noise (Corrected MAD) = %.4g %s" % (mDict["dFDFcorMAD"], units))
log("FDF SNR = %.4g " % (mDict["snrPIfit"]))
log(
"sigma_add(q) = %.4g (+%.4g, -%.4g)"
% (mDict["sigmaAddQ"], mDict["dSigmaAddPlusQ"], mDict["dSigmaAddMinusQ"])
)
log(
"sigma_add(u) = %.4g (+%.4g, -%.4g)"
% (mDict["sigmaAddU"], mDict["dSigmaAddPlusU"], mDict["dSigmaAddMinusU"])
"sigma_add (combined) = %.4g (+%.4g, -%.4g)"
% (mDict["sigmaAddC"], mDict["dSigmaAddPlusC"], mDict["dSigmaAddMinusC"])
)
log()
log("-" * 80)
Expand Down
24 changes: 17 additions & 7 deletions RMutils/util_RM.py
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,6 @@ def measure_qu_complexity(
RMArr_radm2=[RM_radm2],
)
lamSqArr_m2 = np.power(speed_of_light.value / freqArr_Hz, 2.0)
ndata = len(lamSqArr_m2)

# Subtract the RM-thin model to create a residual q & u
qResidArr = qArr - qModArr
Expand All @@ -1371,26 +1370,37 @@ def measure_qu_complexity(
mDict = {}
pDict = {}
m1D, p1D = calc_sigma_add(
xArr=lamSqArr_m2[: int(ndata / specF)],
yArr=(qResidArr / dqArr)[: int(ndata / specF)],
dyArr=(dqArr / dqArr)[: int(ndata / specF)],
xArr=lamSqArr_m2,
yArr=(qResidArr / dqArr),
dyArr=(dqArr / dqArr),
yMed=0.0,
noise=1.0,
suffix="Q",
)
mDict.update(m1D)
pDict.update(p1D)
m2D, p2D = calc_sigma_add(
xArr=lamSqArr_m2[: int(ndata / specF)],
yArr=(uResidArr / duArr)[: int(ndata / specF)],
dyArr=(duArr / duArr)[: int(ndata / specF)],
xArr=lamSqArr_m2,
yArr=(uResidArr / duArr),
dyArr=(duArr / duArr),
yMed=0.0,
noise=1.0,
suffix="U",
)
mDict.update(m2D)
pDict.update(p2D)

m3D, p3D = calc_sigma_add(
xArr=lamSqArr_m2,
yArr=np.concatenate((qResidArr / dqArr, uResidArr / duArr)),
dyArr=np.concatenate((dqArr / dqArr, duArr / duArr)),
yMed=0.0,
noise=1.0,
suffix="C",
)
mDict.update(m3D)
pDict.update(p3D)

# Calculate the deviations statistics
# Done as a test for the paper, not usually offered to user.
# mDict.update( calc_normal_tests(qResidArr/dqArr, suffix="Q") )
Expand Down
2 changes: 1 addition & 1 deletion tests/RMsynth1D_referencevalues.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"dFDFcorMAD": 0.01995876058936119, "phiPeakPIfit_rm2": 200.29003676576465, "dPhiPeakPIfit_rm2": 0.24806386441280062, "ampPeakPIfit": 0.6996739296667636, "ampPeakPIfitEff": 0.6996168571002304, "dAmpPeakPIfit": 0.005892556709695188, "snrPIfit": 118.73859924259541, "indxPeakPIfit": 266.7633455885882, "peakFDFimagFit": -0.5593258116763724, "peakFDFrealFit": 0.41904044934377743, "polAngleFit_deg": 153.42006391662085, "dPolAngleFit_deg": 0.2412685507432214, "polAngle0Fit_deg": 48.26126698321059, "dPolAngle0Fit_deg": 1.37271752326252, "Ifreq0": 1.0, "polyCoeffs": "0.0,0.0,0.0,0.0,0.0,1.0", "polyCoefferr": "0.0,0.0,0.0,19.157488,0.66518927,0.088204324", "polyOrd": 2, "IfitStat": 4, "IfitChiSqRed": 0.0, "fit_function": "log", "lam0Sq_m2": 0.10327484831236765, "freq0_Hz": 932874912.6426204, "fwhmRMSF": 58.90951156616211, "dQU": 0.10000000149011612, "dFDFth": 0.005892556709695188, "units": "Jy/beam", "min_freq": 800000000.0, "max_freq": 1088000000.0, "N_channels": 288, "median_channel_width": 1003456.0, "fracPol": 0.6996168571002304, "sigmaAddQ": 0.3932188246076685, "dSigmaAddMinusQ": 0.2858783770995449, "dSigmaAddPlusQ": 0.13642421257417375, "sigmaAddU": 0.22665457086880808, "dSigmaAddMinusU": 0.20935913039582774, "dSigmaAddPlusU": 0.20587796377894235}
{"dFDFcorMAD": 0.01995876058936119, "phiPeakPIfit_rm2": 200.29003676576465, "dPhiPeakPIfit_rm2": 0.24806386441280062, "ampPeakPIfit": 0.6996739296667636, "ampPeakPIfitEff": 0.6996168571002304, "dAmpPeakPIfit": 0.005892556709695188, "snrPIfit": 118.73859924259541, "indxPeakPIfit": 266.7633455885882, "peakFDFimagFit": -0.5593258116763724, "peakFDFrealFit": 0.41904044934377743, "polAngleFit_deg": 153.42006391662085, "dPolAngleFit_deg": 0.2412685507432214, "polAngle0Fit_deg": 48.26126698321059, "dPolAngle0Fit_deg": 1.37271752326252, "Ifreq0": 1.0, "polyCoeffs": "0.0,0.0,0.0,0.0,0.0,1.0", "polyCoefferr": "0.0,0.0,0.0,19.157488,0.66518927,0.088204324", "polyOrd": 2, "IfitStat": 4, "IfitChiSqRed": 0.0, "fit_function": "log", "lam0Sq_m2": 0.10327484831236765, "freq0_Hz": 932874912.6426204, "fwhmRMSF": 58.90951156616211, "dQU": 0.10000000149011612, "dFDFth": 0.005892556709695188, "units": "Jy/beam", "min_freq": 800000000.0, "max_freq": 1088000000.0, "N_channels": 288, "median_channel_width": 1003456.0, "fracPol": 0.6996168571002304, "sigmaAddQ": 0.3932188246076685, "dSigmaAddMinusQ": 0.2858783770995449, "dSigmaAddPlusQ": 0.13642421257417375, "sigmaAddU": 0.22665457086880808, "dSigmaAddMinusU": 0.20935913039582774, "dSigmaAddPlusU": 0.20587796377894235, "sigmaAddC": 0.41018026613255093, "dSigmaAddMinusC": 0.1133475584572689, "dSigmaAddPlusC": 0.08594851594895281}

0 comments on commit 80801eb

Please sign in to comment.