diff --git a/pyerrors/input/openQCD.py b/pyerrors/input/openQCD.py index 2483baa9..f11fb4e6 100644 --- a/pyerrors/input/openQCD.py +++ b/pyerrors/input/openQCD.py @@ -345,27 +345,71 @@ def _read_array_openQCD2(fp): return {'d': d, 'n': n, 'size': size, 'arr': arr} -def read_qtop(path, prefix, version = "1.2",**kwargs): +def read_qtop(path, prefix,c, dtr_cnfg = 1,**kwargs): """Read qtop format from given folder structure. Parameters ---------- - target -- specifies the topological sector to be reweighted to (default 0) - full -- if true read the charge instead of the reweighting factor. + path: + 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. + version: str + version string of the openQCD (sfqcd) version used to create the ensemble + steps: int + step size of measurements + L: int + spatial length of the lattice in L/a. HAS to be set if version != sfqcd, since openQCD does not provide this in the header + 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 + r_meas_start: list + offset of the first measured ensemble, if there is any + files: list + specify the exact files that need to be read from path, pratical if e.g. only one replicum is needed + names: list + Alternative labeling for replicas/ensembles. Has to have the appropriate length """ - dtr_cnfg = 4 - L = 20 - c = 0.35 + #dtr_cnfg = 4# was ist das denn hier? + #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.") target = 0 full = False - + if "steps" in kwargs: + steps = kwargs.get("steps") + else: + steps = 1 if 'target' in kwargs: target = kwargs.get('target') - - + if version == "sfqcd": + if "L" in kwargs: + supposed_L = kwargs.get("L") + else: + if not "L" in 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: + r_meas_start = kwargs.get("r_meas_start") if "r_start" in kwargs: r_start = kwargs.get("r_start") if "r_stop" in kwargs: @@ -392,41 +436,62 @@ def read_qtop(path, prefix, version = "1.2",**kwargs): for rep,file in enumerate(files): with open(path+"/"+file, "rb") as fp: - #this, for now, is only for version 1.2 + #this, for now, is for version 1.2,1.4,1.6 and 2.0, but needs to be tested for the last 3, isncethe doc says its the same #header t = fp.read(12) - header = struct.unpack('iii', t) - dn = header[0] - nn = header[1] - tmax = header[2] - print('dn:', dn) + header = struct.unpack('