mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-11-30 04:56:52 +01:00
simplify r_start and r_stop in read_pbp
This commit is contained in:
parent
4f8567a172
commit
fb7ba0cbc3
1 changed files with 10 additions and 16 deletions
|
|
@ -136,21 +136,15 @@ def read_pbp(path: str, prefix: str, **kwargs):
|
|||
ls.sort(key=lambda x: int(re.findall(r'\d+', x[len(prefix):])[0]))
|
||||
replica = len(ls)
|
||||
|
||||
if 'r_start' in kwargs:
|
||||
r_start = kwargs.get('r_start')
|
||||
r_start = kwargs.get('r_start', [1] * replica)
|
||||
if len(r_start) != replica:
|
||||
raise Exception('r_start does not match number of replicas')
|
||||
# Adjust Configuration numbering to python index
|
||||
r_start = [o - 1 if o else None for o in r_start]
|
||||
else:
|
||||
r_start = [None] * replica
|
||||
|
||||
if 'r_stop' in kwargs:
|
||||
r_stop = kwargs.get('r_stop')
|
||||
r_stop = kwargs.get('r_stop', [-1] * replica)
|
||||
if len(r_stop) != replica:
|
||||
raise Exception('r_stop does not match number of replicas')
|
||||
else:
|
||||
r_stop = [None] * replica
|
||||
|
||||
print(r'Read <bar{psi}\psi> from', prefix[:-1], ',', replica, 'replica', end='')
|
||||
|
||||
|
|
@ -159,10 +153,10 @@ def read_pbp(path: str, prefix: str, **kwargs):
|
|||
print_err = 1
|
||||
print()
|
||||
|
||||
deltas = []
|
||||
deltas: list[list[float]] = []
|
||||
|
||||
for rep in range(replica):
|
||||
tmp_array = []
|
||||
tmp_array: list[list[float]] = []
|
||||
with open(path + '/' + ls[rep], 'rb') as fp:
|
||||
|
||||
t = fp.read(4) # number of reweighting factors
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue