mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-15 20:13:41 +02:00
feat: introduced cfg_separator parameter to read_sfcf which allows to
use custom cfg separators different from "n"
This commit is contained in:
parent
abc1691bc9
commit
a8d9846fbb
1 changed files with 5 additions and 3 deletions
|
@ -6,7 +6,7 @@ from ..obs import Obs
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
|
|
||||||
def read_sfcf(path, prefix, name, quarks='.*', corr_type='bi', noffset=0, wf=0, wf2=0, version="1.0c", **kwargs):
|
def read_sfcf(path, prefix, name, quarks='.*', corr_type='bi', noffset=0, wf=0, wf2=0, version="1.0c", cfg_separator="n", **kwargs):
|
||||||
"""Read sfcf c format from given folder structure.
|
"""Read sfcf c format from given folder structure.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
|
@ -40,6 +40,8 @@ def read_sfcf(path, prefix, name, quarks='.*', corr_type='bi', noffset=0, wf=0,
|
||||||
append a "c" to the version (e.g. "1.0c")
|
append a "c" to the version (e.g. "1.0c")
|
||||||
if the append output option (-a) was specified,
|
if the append output option (-a) was specified,
|
||||||
append an "a" to the version
|
append an "a" to the version
|
||||||
|
cfg_separator : str
|
||||||
|
String that separates the ensemble identifier from the configuration number (default 'n').
|
||||||
replica: list
|
replica: list
|
||||||
list of replica to be read, default is all
|
list of replica to be read, default is all
|
||||||
files: list
|
files: list
|
||||||
|
@ -177,7 +179,7 @@ def read_sfcf(path, prefix, name, quarks='.*', corr_type='bi', noffset=0, wf=0,
|
||||||
for cfg in sub_ls:
|
for cfg in sub_ls:
|
||||||
try:
|
try:
|
||||||
if compact:
|
if compact:
|
||||||
rep_idl.append(int(cfg.split("n")[-1]))
|
rep_idl.append(int(cfg.split(cfg_separator)[-1]))
|
||||||
else:
|
else:
|
||||||
rep_idl.append(int(cfg[3:]))
|
rep_idl.append(int(cfg[3:]))
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -323,7 +325,7 @@ def read_sfcf(path, prefix, name, quarks='.*', corr_type='bi', noffset=0, wf=0,
|
||||||
stop = start + data_starts[1]
|
stop = start + data_starts[1]
|
||||||
chunk = content[start:stop]
|
chunk = content[start:stop]
|
||||||
try:
|
try:
|
||||||
rep_idl.append(int(chunk[gauge_line].split("n")[-1]))
|
rep_idl.append(int(chunk[gauge_line].split(cfg_separator)[-1]))
|
||||||
except Exception:
|
except Exception:
|
||||||
raise Exception("Couldn't parse idl from directory, problem with chunk around line ", gauge_line)
|
raise Exception("Couldn't parse idl from directory, problem with chunk around line ", gauge_line)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue