rename functions, let write_measurement decide which file type is given
Some checks failed
Pytest / pytest (3.12) (push) Waiting to run
Pytest / pytest (3.13) (push) Waiting to run
Pytest / pytest (3.14) (push) Waiting to run
Ruff / ruff (push) Waiting to run
Mypy / mypy (push) Has been cancelled
Mypy / mypy (pull_request) Waiting to run
Pytest / pytest (3.12) (pull_request) Waiting to run
Pytest / pytest (3.13) (pull_request) Waiting to run
Pytest / pytest (3.14) (pull_request) Waiting to run
Ruff / ruff (pull_request) Waiting to run
Some checks failed
Pytest / pytest (3.12) (push) Waiting to run
Pytest / pytest (3.13) (push) Waiting to run
Pytest / pytest (3.14) (push) Waiting to run
Ruff / ruff (push) Waiting to run
Mypy / mypy (push) Has been cancelled
Mypy / mypy (pull_request) Waiting to run
Pytest / pytest (3.12) (pull_request) Waiting to run
Pytest / pytest (3.13) (pull_request) Waiting to run
Pytest / pytest (3.14) (pull_request) Waiting to run
Ruff / ruff (pull_request) Waiting to run
This commit is contained in:
parent
9498c1dd73
commit
8394b1fdbd
3 changed files with 15 additions and 8 deletions
|
|
@ -9,7 +9,7 @@ from ..pars.openQCD import qcd2
|
|||
|
||||
|
||||
|
||||
def read_ms1_param(path: Path, project: str, file_in_project: str) -> dict[str, Any]:
|
||||
def load_ms1_infile(path: Path, project: str, file_in_project: str) -> dict[str, Any]:
|
||||
"""
|
||||
Read the parameters for ms1 measurements from a parameter file in the project.
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ def read_ms1_param(path: Path, project: str, file_in_project: str) -> dict[str,
|
|||
return param
|
||||
|
||||
|
||||
def read_ms3_param(path: Path, project: str, file_in_project: str) -> dict[str, Any]:
|
||||
def load_ms3_infile(path: Path, project: str, file_in_project: str) -> dict[str, Any]:
|
||||
"""
|
||||
Read the parameters for ms3 measurements from a parameter file in the project.
|
||||
|
||||
|
|
@ -333,7 +333,7 @@ def load_qcd2_pars(path: Path, project: str, file_in_project: str) -> dict[str,
|
|||
return qcd2.read_qcd2_par_file(fname)
|
||||
|
||||
|
||||
def load_ms1_pars(path: Path, project: str, file_in_project: str) -> dict[str, Any]:
|
||||
def load_ms1_parfile(path: Path, project: str, file_in_project: str) -> dict[str, Any]:
|
||||
"""
|
||||
Thin wrapper around read_qcd2_ms1_par_file, getting the file before reading.
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,10 @@ def write_measurement(path: Path, ensemble: str, measurement: dict[str, dict[str
|
|||
ms_type = list(measurement.keys())[0]
|
||||
if ms_type == 'ms1':
|
||||
if parameter_file is not None:
|
||||
parameters = openQCD.read_ms1_param(path, uuid, parameter_file)
|
||||
if parameter_file.endswith(".ms1.in"):
|
||||
parameters = openQCD.load_ms1_infile(path, uuid, parameter_file)
|
||||
elif parameter_file.endswith(".ms1.par"):
|
||||
parameters = openQCD.load_ms1_parfile(path, uuid, parameter_file)
|
||||
else:
|
||||
raise Exception("Need parameter file for this code!")
|
||||
pars = {}
|
||||
|
|
@ -88,7 +91,7 @@ def write_measurement(path: Path, ensemble: str, measurement: dict[str, dict[str
|
|||
pars[subkey] = json.dumps(parameters["rw_fcts"][i])
|
||||
elif ms_type in ['t0', 't1']:
|
||||
if parameter_file is not None:
|
||||
parameters = openQCD.read_ms3_param(path, uuid, parameter_file)
|
||||
parameters = openQCD.load_ms3_infile(path, uuid, parameter_file)
|
||||
else:
|
||||
parameters = {}
|
||||
for rwp in ["integrator", "eps", "ntot", "dnms"]:
|
||||
|
|
|
|||
|
|
@ -192,12 +192,16 @@ def import_toml(path: Path, file: str, copy_file: bool=True) -> None:
|
|||
|
||||
elif project['code'] == 'openQCD':
|
||||
if md['measurement'] == 'ms1':
|
||||
param = openQCD.read_ms1_param(path, uuid, md['param_file'])
|
||||
parameter_file = md['param_file']
|
||||
if parameter_file.endswith(".ms1.in"):
|
||||
param = openQCD.load_ms1_infile(path, uuid, parameter_file)
|
||||
elif parameter_file.endswith(".ms1.par"):
|
||||
param = openQCD.load_ms1_parfile(path, uuid, parameter_file)
|
||||
param['type'] = 'ms1'
|
||||
measurement = openQCD.read_rwms(path, uuid, md['path'], param, md["prefix"], version=md["version"], names=md['names'], files=md['files'])
|
||||
elif md['measurement'] == 't0':
|
||||
if 'param_file' in md:
|
||||
param = openQCD.read_ms3_param(path, uuid, md['param_file'])
|
||||
param = openQCD.load_ms3_infile(path, uuid, md['param_file'])
|
||||
else:
|
||||
param = {}
|
||||
for rwp in ["integrator", "eps", "ntot", "dnms"]:
|
||||
|
|
@ -207,7 +211,7 @@ def import_toml(path: Path, file: str, copy_file: bool=True) -> None:
|
|||
fit_range=int(md.get('fit_range', 5)), postfix=str(md.get('postfix', '')), names=md.get('names', []), files=md.get('files', []))
|
||||
elif md['measurement'] == 't1':
|
||||
if 'param_file' in md:
|
||||
param = openQCD.read_ms3_param(path, uuid, md['param_file'])
|
||||
param = openQCD.load_ms3_infile(path, uuid, md['param_file'])
|
||||
param['type'] = 't1'
|
||||
measurement = openQCD.extract_t1(path, uuid, md['path'], param, str(md["prefix"]), int(md["dtr_read"]), int(md["xmin"]), int(md["spatial_extent"]),
|
||||
fit_range=int(md.get('fit_range', 5)), postfix=str(md.get('postfix', '')), names=md.get('names', []), files=md.get('files', []))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue