Skip to content

Commit e79ac01

Browse files
committed
Allow different funcs for posterior
1 parent ef59af1 commit e79ac01

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
@@ -1769,8 +1769,11 @@ def produce_total_phi_data(self, fitthcovmat):
17691769
return validphys.results.total_phi_data_from_experiments
17701770
return validphys.results.dataset_inputs_phi_data
17711771

1772+
def produce_pc_func_type(self, theorycovmatconfig=None):
1773+
return theorycovmatconfig.get('func_type', 'step')
1774+
17721775
# @configparser.explicit_node
1773-
def produce_power_corr_dict(self, pc_parameters=None):
1776+
def produce_power_corr_dict(self, pc_parameters=None, pc_func_type=None):
17741777
"""The parameters for the power corrections are given as a list.
17751778
This function converts this list into a dictionary with the keys
17761779
being the names of the types of power corrections (e.g. `H2p`, `H2d`,...).
@@ -1782,7 +1785,12 @@ def produce_power_corr_dict(self, pc_parameters=None):
17821785
# Loop over the parameterization for the power corrections in the runcard
17831786
for par in pc_parameters:
17841787
# Check that the length of shifts is one less than the length of nodes.
1785-
if len(par['yshift']) != len(par['nodes']) - 1:
1788+
if (len(par['yshift']) != len(par['nodes']) - 1) and pc_func_type != 'cubic':
1789+
raise ValueError(
1790+
f"The length of nodes does not match that of the list in {par['ht']}."
1791+
f"Check the runcard. Got {len(par['yshift'])} != {len(par['nodes'])}"
1792+
)
1793+
elif (len(par['yshift']) != len(par['nodes'])) and pc_func_type == 'cubic':
17861794
raise ValueError(
17871795
f"The length of nodes does not match that of the list in {par['ht']}."
17881796
f"Check the runcard. Got {len(par['yshift'])} != {len(par['nodes'])}"
@@ -1791,6 +1799,7 @@ def produce_power_corr_dict(self, pc_parameters=None):
17911799
# Store parameters for each power correction
17921800
pc_parameters_by_type[par['ht']] = {'yshift': par['yshift'], 'nodes': par['nodes']}
17931801

1802+
pc_parameters_by_type['func_type'] = pc_func_type
17941803
return pc_parameters_by_type
17951804

17961805
@configparser.explicit_node

0 commit comments

Comments
 (0)