Skip to content

Commit ab92347

Browse files
achiefaRoyStegeman
authored andcommitted
Allow different funcs for posterior
1 parent 53e25bd commit ab92347

File tree

2 files changed

+192
-50
lines changed

2 files changed

+192
-50
lines changed

validphys2/src/validphys/config.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,8 +1776,11 @@ def produce_total_phi_data(self, fitthcovmat):
17761776
return validphys.results.total_phi_data_from_experiments
17771777
return validphys.results.dataset_inputs_phi_data
17781778

1779+
def produce_pc_func_type(self, theorycovmatconfig=None):
1780+
return theorycovmatconfig.get('func_type', 'step')
1781+
17791782
# @configparser.explicit_node
1780-
def produce_power_corr_dict(self, pc_parameters=None):
1783+
def produce_power_corr_dict(self, pc_parameters=None, pc_func_type=None):
17811784
"""The parameters for the power corrections are given as a list.
17821785
This function converts this list into a dictionary with the keys
17831786
being the names of the types of power corrections (e.g. `H2p`, `H2d`,...).
@@ -1789,7 +1792,12 @@ def produce_power_corr_dict(self, pc_parameters=None):
17891792
# Loop over the parameterization for the power corrections in the runcard
17901793
for par in pc_parameters:
17911794
# Check that the length of shifts is one less than the length of nodes.
1792-
if len(par['yshift']) != len(par['nodes']) - 1:
1795+
if (len(par['yshift']) != len(par['nodes']) - 1) and pc_func_type != 'cubic':
1796+
raise ValueError(
1797+
f"The length of nodes does not match that of the list in {par['ht']}."
1798+
f"Check the runcard. Got {len(par['yshift'])} != {len(par['nodes'])}"
1799+
)
1800+
elif (len(par['yshift']) != len(par['nodes'])) and pc_func_type == 'cubic':
17931801
raise ValueError(
17941802
f"The length of nodes does not match that of the list in {par['ht']}."
17951803
f"Check the runcard. Got {len(par['yshift'])} != {len(par['nodes'])}"
@@ -1798,6 +1806,7 @@ def produce_power_corr_dict(self, pc_parameters=None):
17981806
# Store parameters for each power correction
17991807
pc_parameters_by_type[par['ht']] = {'yshift': par['yshift'], 'nodes': par['nodes']}
18001808

1809+
pc_parameters_by_type['func_type'] = pc_func_type
18011810
return pc_parameters_by_type
18021811

18031812
@configparser.explicit_node

0 commit comments

Comments
 (0)