From 01ada964b271d583e0e78f37157aacc5516616e9 Mon Sep 17 00:00:00 2001 From: jkuhl-uni Date: Mon, 3 Jan 2022 11:20:25 +0100 Subject: [PATCH] added read_qtop_sector method outsourcing funtionality of former 'full' key --- pyerrors/input/openQCD.py | 107 +++++++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 41 deletions(-) diff --git a/pyerrors/input/openQCD.py b/pyerrors/input/openQCD.py index 08bb0223..f0b3a3df 100644 --- a/pyerrors/input/openQCD.py +++ b/pyerrors/input/openQCD.py @@ -8,6 +8,7 @@ import struct import numpy as np # Thinly-wrapped numpy from ..obs import Obs from ..fits import fit_lin +from . import utils def read_rwms(path, prefix, version='2.0', names=None, **kwargs): @@ -347,7 +348,7 @@ def _read_array_openQCD2(fp): return {'d': d, 'n': n, 'size': size, 'arr': arr} -def read_qtop(path, prefix,c, dtr_cnfg = 1,**kwargs): +def read_qtop(path, prefix,c, dtr_cnfg = 1, version = "1.2",**kwargs): """Read qtop format from given folder structure. Parameters @@ -356,14 +357,12 @@ def read_qtop(path, prefix,c, dtr_cnfg = 1,**kwargs): path of the measurement files prefix: prefix of the measurement files, e.g. _id0_r0.ms.dat - c: - ??? - dtr_cnfg: - ??? - target: int - specifies the topological sector to be reweighted to (default 0) - full: bool - if true read the charge instead of the reweighting factor. + c: double + Smearing radius in units of the lattice extent, c = sqrt(8 t0) / L + dtr_cnfg: int + (optional) parameter that specifies the number of trajectories between two configs. + if it is not set, the distance between two measurements in the file is assumed to be + the distance between two configurations. version: str version string of the openQCD (sfqcd) version used to create the ensemble steps: int @@ -373,7 +372,7 @@ def read_qtop(path, prefix,c, dtr_cnfg = 1,**kwargs): r_start: list offset of the first ensemble, making it easier to match later on with other Obs r_stop: list - last ensemble that needs to be read + last configurations that need to be read (per replicum) r_meas_start: list offset of the first measured ensemble, if there is any files: list @@ -385,13 +384,10 @@ def read_qtop(path, prefix,c, dtr_cnfg = 1,**kwargs): #one could read L from the header in case of sfQCD #c = 0.35 known_versions = ["1.0","1.2","1.4","1.6","2.0", "sfqcd"] - version = "1.2" - if "version" in kwargs: - version = kwargs.get("version") - if not version in known_versions: - raise Exception("Unknown openQCD version.") + + if not version in known_versions: + raise Exception("Unknown openQCD version.") target = 0 - full = False if "steps" in kwargs: steps = kwargs.get("steps") else: @@ -406,8 +402,6 @@ def read_qtop(path, prefix,c, dtr_cnfg = 1,**kwargs): raise Exception("This version of openQCD needs you to provide the spatial length of the lattice as parameter 'L'.") else: L = kwargs.get("L") - if kwargs.get('full'): - full = True r_start = 1 r_meas_start = 1 if "r_meas_start" in kwargs: @@ -445,8 +439,6 @@ def read_qtop(path, prefix,c, dtr_cnfg = 1,**kwargs): dn = header[0] # step size in integration steps "dnms" nn = header[1] # number of measurements, so "ntot"/dn tmax = header[2]# lattice T/a - #hier fehlen die L/a Angaben im header von Simon - #also muss man L nur für den fall von Fabian setzen if version == "sfqcd": t = fp.read(12) Ls = struct.unpack('