Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 26, 2024
1 parent f070617 commit 878026c
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions RMtools_1D/models_ns/m12.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
#
#=============================================================================#
import numpy as np
# =============================================================================#
import bilby
import numpy as np


#-----------------------------------------------------------------------------#
# -----------------------------------------------------------------------------#
# Function defining the model. #
# #
# pDict = Dictionary of parameters, created by parsing inParms, below. #
# lamSqArr_m2 = Array of lambda-squared values #
# quArr = Complex array containing the Re and Im spectra. #
#-----------------------------------------------------------------------------#
# -----------------------------------------------------------------------------#
def model(pDict, lamSqArr_m2):
"""
Single Faraday component with internal Faraday dispersion and
Single Faraday component with internal Faraday dispersion and
an foreground external dispersion screen
Ref:
Sokoloff et al. (1998) Eq 34
O'Sullivan et al. (2012) Eq 10
Expand All @@ -23,24 +24,31 @@ def model(pDict, lamSqArr_m2):

# Calculate the complex fractional q and u spectra
pArr = pDict["fracPol"] * np.ones_like(lamSqArr_m2)
para_S = (2. * lamSqArr_m2**2 * pDict["sigmaRM_radm2"]**2 - 2j * lamSqArr_m2 * pDict["deltaRM_radm2"])
para_S = (
2.0 * lamSqArr_m2**2 * pDict["sigmaRM_radm2"] ** 2
- 2j * lamSqArr_m2 * pDict["deltaRM_radm2"]
)

quArr = (pArr * np.exp(2j * (np.radians(pDict["psi0_deg"]) + pDict["RM_screen"] * lamSqArr_m2)) * ((1 - np.exp(-1.*para_S)) / para_S) * np.exp(-2.0 * pDict["sigmaRM_radm2_FG"]**2.0 * lamSqArr_m2**2.0))
quArr = (
pArr
* np.exp(
2j * (np.radians(pDict["psi0_deg"]) + pDict["RM_screen"] * lamSqArr_m2)
)
* ((1 - np.exp(-1.0 * para_S)) / para_S)
* np.exp(-2.0 * pDict["sigmaRM_radm2_FG"] ** 2.0 * lamSqArr_m2**2.0)
)

return quArr


#-----------------------------------------------------------------------------#
# -----------------------------------------------------------------------------#
# Priors for the above model. #
# See https://lscsoft.docs.ligo.org/bilby/prior.html for details. #
# #
#-----------------------------------------------------------------------------#
# -----------------------------------------------------------------------------#
priors = {
"fracPol": bilby.prior.Uniform(
minimum=0.0,
maximum=0.6,
name="fracPol",
latex_label="$p$"
minimum=0.0, maximum=0.6, name="fracPol", latex_label="$p$"
),
"psi0_deg": bilby.prior.Uniform(
minimum=0,
Expand Down

0 comments on commit 878026c

Please sign in to comment.