Skip to content

Commit

Permalink
Allow different funcs for posterior
Browse files Browse the repository at this point in the history
  • Loading branch information
achiefa authored and RoyStegeman committed Feb 14, 2025
1 parent 53e25bd commit ab92347
Show file tree
Hide file tree
Showing 2 changed files with 192 additions and 50 deletions.
13 changes: 11 additions & 2 deletions validphys2/src/validphys/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1776,8 +1776,11 @@ def produce_total_phi_data(self, fitthcovmat):
return validphys.results.total_phi_data_from_experiments
return validphys.results.dataset_inputs_phi_data

def produce_pc_func_type(self, theorycovmatconfig=None):
return theorycovmatconfig.get('func_type', 'step')

# @configparser.explicit_node
def produce_power_corr_dict(self, pc_parameters=None):
def produce_power_corr_dict(self, pc_parameters=None, pc_func_type=None):
"""The parameters for the power corrections are given as a list.
This function converts this list into a dictionary with the keys
being the names of the types of power corrections (e.g. `H2p`, `H2d`,...).
Expand All @@ -1789,7 +1792,12 @@ def produce_power_corr_dict(self, pc_parameters=None):
# Loop over the parameterization for the power corrections in the runcard
for par in pc_parameters:
# Check that the length of shifts is one less than the length of nodes.
if len(par['yshift']) != len(par['nodes']) - 1:
if (len(par['yshift']) != len(par['nodes']) - 1) and pc_func_type != 'cubic':
raise ValueError(
f"The length of nodes does not match that of the list in {par['ht']}."
f"Check the runcard. Got {len(par['yshift'])} != {len(par['nodes'])}"
)
elif (len(par['yshift']) != len(par['nodes'])) and pc_func_type == 'cubic':
raise ValueError(
f"The length of nodes does not match that of the list in {par['ht']}."
f"Check the runcard. Got {len(par['yshift'])} != {len(par['nodes'])}"
Expand All @@ -1798,6 +1806,7 @@ def produce_power_corr_dict(self, pc_parameters=None):
# Store parameters for each power correction
pc_parameters_by_type[par['ht']] = {'yshift': par['yshift'], 'nodes': par['nodes']}

pc_parameters_by_type['func_type'] = pc_func_type
return pc_parameters_by_type

@configparser.explicit_node
Expand Down
Loading

0 comments on commit ab92347

Please sign in to comment.