From 567d6f1153f3641436e534af52e59c2c20f5a9a5 Mon Sep 17 00:00:00 2001 From: Justus Kuhlmann Date: Mon, 31 Mar 2025 20:12:14 +0000 Subject: [PATCH] add doc strings, no more tuples --- corrlib/input/sfcf.py | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/corrlib/input/sfcf.py b/corrlib/input/sfcf.py index 896ba44..173a1d3 100644 --- a/corrlib/input/sfcf.py +++ b/corrlib/input/sfcf.py @@ -185,13 +185,24 @@ def _map_params(params, spec_list): """ Map the extracted parameters to the extracted data. + Parameters + ---------- + param: dict + The parameters extracted from the parameter (input) file. in the dict form given by read_param. + spec_list: list + The list of specifications that belongs to the dorrelator in question. + + Return + ------ + new_specs: dict + Dict with keys replaced by parameters. """ # quarks/offset/wf/wf2 new_specs = {} # quarks quarks = spec_list[0].split(" ") - new_specs['quarks'] = (params['qr'][quarks[0]], params['qr'][quarks[1]]) + new_specs['quarks'] = [params['qr'][quarks[0]], params['qr'][quarks[1]]] # offset new_specs['offset'] = (params['wf_offsets'][int(spec_list[1])]) @@ -199,7 +210,7 @@ def _map_params(params, spec_list): contribs = [] for i, coeff in enumerate(params['wf_coeff'][int(spec_list[2])]): if not coeff == 0: - contrib = (coeff, params['wf_basis'][i]) + contrib = [coeff, params['wf_basis'][i]] contribs.append(contrib) new_specs['wf1'] = contribs @@ -208,7 +219,7 @@ def _map_params(params, spec_list): contribs = [] for i, coeff in enumerate(params['wf_coeff'][int(spec_list[3])]): if not coeff == 0: - contrib = (coeff, params['wf_basis'][i]) + contrib = [coeff, params['wf_basis'][i]] contribs.append(contrib) new_specs['wf2'] = contribs return new_specs @@ -229,9 +240,26 @@ def read_data(path, project, dir_in_project, prefix, param, version='1.0c', cfg_ """ Extract the data from the sfcf file. + Parameters + ---------- + path: str + The path of the backlogger. + project: str + The Projects uuid. + dir_in_project:s str + The output directory in the project. + param: dict + The parameter dictionary, as given by read_param. + version: str + Version of sfcf. + cfg_seperator: str + Separator of the configuration number. Needed for reading. default: "n" + sep: str + Seperator for the key in return dict. (default: "/) + Returns ------- - dict + sorted_data: dict The data from the sfcf file. """