Skip to content

Commit

Permalink
nrpypn/PN_p_r.py: Also test alternative approach for computing P_r
Browse files Browse the repository at this point in the history
  • Loading branch information
zachetienne committed Sep 30, 2023
1 parent a512b01 commit 175d490
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 24 deletions.
50 changes: 26 additions & 24 deletions nrpypn/PN_p_r.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,27 +295,29 @@ def f_p_r(
in_p1U: List[sp.Expr] = cast(List[sp.Expr], ixp.declarerank1("p1U"))
in_p2U: List[sp.Expr] = cast(List[sp.Expr], ixp.declarerank1("p2U"))
in_nU: List[sp.Expr] = cast(List[sp.Expr], ixp.declarerank1("nU"))
p_r = PN_p_r(
in_m1,
in_m2,
in_n12U,
in_n21U,
in_chi1U,
in_chi2U,
in_S1U,
in_S2U,
in_p1U,
in_p2U,
in_r12,
)
results_dict = ve.process_dictionary_of_expressions(
p_r.__dict__, fixed_mpfs_for_free_symbols=True
)
ve.compare_or_generate_trusted_results(
os.path.abspath(__file__),
os.getcwd(),
# File basename. If this is set to "trusted_module_test1", then
# trusted results_dict will be stored in tests/trusted_module_test1.py
f"{os.path.splitext(os.path.basename(__file__))[0]}",
results_dict,
)
for Alternative in [False, True]:
p_r = PN_p_r(
in_m1,
in_m2,
in_n12U,
in_n21U,
in_chi1U,
in_chi2U,
in_S1U,
in_S2U,
in_p1U,
in_p2U,
in_r12,
use_alternative_approach_for_p_r=Alternative,
)
results_dict = ve.process_dictionary_of_expressions(
p_r.__dict__, fixed_mpfs_for_free_symbols=True
)
ve.compare_or_generate_trusted_results(
os.path.abspath(__file__),
os.getcwd(),
# File basename. If this is set to "trusted_module_test1", then
# trusted results_dict will be stored in tests/trusted_module_test1.py
f"{os.path.splitext(os.path.basename(__file__))[0]}_Alternative{Alternative}",
results_dict,
)
File renamed without changes.
13 changes: 13 additions & 0 deletions nrpypn/tests/PN_p_r_AlternativeTrue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from mpmath import mpc # type: ignore

trusted_dict = {
"Htot_xyplane_binary": mpc(real="34.3246183582895289098123690031488", imag="0.0"),
"dr_dt": mpc(
real="-186971493.425943392178665219836809",
imag="169624446.398018278703267691599858",
),
"p_r": mpc(
real="3173456.22633299297826350862165735",
imag="-2879025.64931096048450287201403591",
),
}

0 comments on commit 175d490

Please sign in to comment.