mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 06:40:24 +01:00
style: New flake8 E275 errors fixed.
This commit is contained in:
parent
a1d1c412ed
commit
f1636310a1
3 changed files with 28 additions and 28 deletions
|
@ -119,7 +119,7 @@ class Corr:
|
|||
def gamma_method(self, **kwargs):
|
||||
"""Apply the gamma method to the content of the Corr."""
|
||||
for item in self.content:
|
||||
if not(item is None):
|
||||
if not (item is None):
|
||||
if self.N == 1:
|
||||
item[0].gamma_method(**kwargs)
|
||||
else:
|
||||
|
@ -139,7 +139,7 @@ class Corr:
|
|||
|
||||
if vector_l is None:
|
||||
vector_l, vector_r = np.asarray([1.] + (self.N - 1) * [0.]), np.asarray([1.] + (self.N - 1) * [0.])
|
||||
elif(vector_r is None):
|
||||
elif (vector_r is None):
|
||||
vector_r = vector_l
|
||||
if isinstance(vector_l, list) and not isinstance(vector_r, list):
|
||||
if len(vector_l) != self.T:
|
||||
|
@ -178,7 +178,7 @@ class Corr:
|
|||
"""
|
||||
if self.N == 1:
|
||||
raise Exception("Trying to pick item from projected Corr")
|
||||
newcontent = [None if(item is None) else item[i, j] for item in self.content]
|
||||
newcontent = [None if (item is None) else item[i, j] for item in self.content]
|
||||
return Corr(newcontent)
|
||||
|
||||
def plottable(self):
|
||||
|
@ -211,7 +211,7 @@ class Corr:
|
|||
newcontent.append(None)
|
||||
else:
|
||||
newcontent.append(0.5 * (self.content[t] + self.content[self.T - t]))
|
||||
if(all([x is None for x in newcontent])):
|
||||
if (all([x is None for x in newcontent])):
|
||||
raise Exception("Corr could not be symmetrized: No redundant values")
|
||||
return Corr(newcontent, prange=self.prange)
|
||||
|
||||
|
@ -233,7 +233,7 @@ class Corr:
|
|||
newcontent.append(None)
|
||||
else:
|
||||
newcontent.append(0.5 * (self.content[t] - self.content[self.T - t]))
|
||||
if(all([x is None for x in newcontent])):
|
||||
if (all([x is None for x in newcontent])):
|
||||
raise Exception("Corr could not be symmetrized: No redundant values")
|
||||
return Corr(newcontent, prange=self.prange)
|
||||
|
||||
|
@ -534,7 +534,7 @@ class Corr:
|
|||
newcontent.append(None)
|
||||
else:
|
||||
newcontent.append(0.5 * (self.content[t + 1] - self.content[t - 1]))
|
||||
if(all([x is None for x in newcontent])):
|
||||
if (all([x is None for x in newcontent])):
|
||||
raise Exception('Derivative is undefined at all timeslices')
|
||||
return Corr(newcontent, padding=[1, 1])
|
||||
elif variant == "forward":
|
||||
|
@ -544,7 +544,7 @@ class Corr:
|
|||
newcontent.append(None)
|
||||
else:
|
||||
newcontent.append(self.content[t + 1] - self.content[t])
|
||||
if(all([x is None for x in newcontent])):
|
||||
if (all([x is None for x in newcontent])):
|
||||
raise Exception("Derivative is undefined at all timeslices")
|
||||
return Corr(newcontent, padding=[0, 1])
|
||||
elif variant == "backward":
|
||||
|
@ -554,7 +554,7 @@ class Corr:
|
|||
newcontent.append(None)
|
||||
else:
|
||||
newcontent.append(self.content[t] - self.content[t - 1])
|
||||
if(all([x is None for x in newcontent])):
|
||||
if (all([x is None for x in newcontent])):
|
||||
raise Exception("Derivative is undefined at all timeslices")
|
||||
return Corr(newcontent, padding=[1, 0])
|
||||
elif variant == "improved":
|
||||
|
@ -564,7 +564,7 @@ class Corr:
|
|||
newcontent.append(None)
|
||||
else:
|
||||
newcontent.append((1 / 12) * (self.content[t - 2] - 8 * self.content[t - 1] + 8 * self.content[t + 1] - self.content[t + 2]))
|
||||
if(all([x is None for x in newcontent])):
|
||||
if (all([x is None for x in newcontent])):
|
||||
raise Exception('Derivative is undefined at all timeslices')
|
||||
return Corr(newcontent, padding=[2, 2])
|
||||
else:
|
||||
|
@ -588,7 +588,7 @@ class Corr:
|
|||
newcontent.append(None)
|
||||
else:
|
||||
newcontent.append((self.content[t + 1] - 2 * self.content[t] + self.content[t - 1]))
|
||||
if(all([x is None for x in newcontent])):
|
||||
if (all([x is None for x in newcontent])):
|
||||
raise Exception("Derivative is undefined at all timeslices")
|
||||
return Corr(newcontent, padding=[1, 1])
|
||||
elif variant == "improved":
|
||||
|
@ -598,7 +598,7 @@ class Corr:
|
|||
newcontent.append(None)
|
||||
else:
|
||||
newcontent.append((1 / 12) * (-self.content[t + 2] + 16 * self.content[t + 1] - 30 * self.content[t] + 16 * self.content[t - 1] - self.content[t - 2]))
|
||||
if(all([x is None for x in newcontent])):
|
||||
if (all([x is None for x in newcontent])):
|
||||
raise Exception("Derivative is undefined at all timeslices")
|
||||
return Corr(newcontent, padding=[2, 2])
|
||||
else:
|
||||
|
@ -629,7 +629,7 @@ class Corr:
|
|||
newcontent.append(None)
|
||||
else:
|
||||
newcontent.append(self.content[t] / self.content[t + 1])
|
||||
if(all([x is None for x in newcontent])):
|
||||
if (all([x is None for x in newcontent])):
|
||||
raise Exception('m_eff is undefined at all timeslices')
|
||||
|
||||
return np.log(Corr(newcontent, padding=[0, 1]))
|
||||
|
@ -654,7 +654,7 @@ class Corr:
|
|||
newcontent.append(None)
|
||||
else:
|
||||
newcontent.append(np.abs(find_root(self.content[t][0] / self.content[t + 1][0], root_function, guess=guess)))
|
||||
if(all([x is None for x in newcontent])):
|
||||
if (all([x is None for x in newcontent])):
|
||||
raise Exception('m_eff is undefined at all timeslices')
|
||||
|
||||
return Corr(newcontent, padding=[0, 1])
|
||||
|
@ -666,7 +666,7 @@ class Corr:
|
|||
newcontent.append(None)
|
||||
else:
|
||||
newcontent.append((self.content[t + 1] + self.content[t - 1]) / (2 * self.content[t]))
|
||||
if(all([x is None for x in newcontent])):
|
||||
if (all([x is None for x in newcontent])):
|
||||
raise Exception("m_eff is undefined at all timeslices")
|
||||
return np.arccosh(Corr(newcontent, padding=[1, 1]))
|
||||
|
||||
|
@ -729,7 +729,7 @@ class Corr:
|
|||
raise Exception("no plateau range provided")
|
||||
if self.N != 1:
|
||||
raise Exception("Correlator must be projected before getting a plateau.")
|
||||
if(all([self.content[t] is None for t in range(plateau_range[0], plateau_range[1] + 1)])):
|
||||
if (all([self.content[t] is None for t in range(plateau_range[0], plateau_range[1] + 1)])):
|
||||
raise Exception("plateau is undefined at all timeslices in plateaurange.")
|
||||
if auto_gamma:
|
||||
self.gamma_method()
|
||||
|
@ -994,7 +994,7 @@ class Corr:
|
|||
|
||||
def __mul__(self, y):
|
||||
if isinstance(y, Corr):
|
||||
if not((self.N == 1 or y.N == 1 or self.N == y.N) and self.T == y.T):
|
||||
if not ((self.N == 1 or y.N == 1 or self.N == y.N) and self.T == y.T):
|
||||
raise Exception("Multiplication of Corr object requires N=N or N=1 and T=T")
|
||||
newcontent = []
|
||||
for t in range(self.T):
|
||||
|
@ -1022,7 +1022,7 @@ class Corr:
|
|||
|
||||
def __truediv__(self, y):
|
||||
if isinstance(y, Corr):
|
||||
if not((self.N == 1 or y.N == 1 or self.N == y.N) and self.T == y.T):
|
||||
if not ((self.N == 1 or y.N == 1 or self.N == y.N) and self.T == y.T):
|
||||
raise Exception("Multiplication of Corr object requires N=N or N=1 and T=T")
|
||||
newcontent = []
|
||||
for t in range(self.T):
|
||||
|
|
|
@ -157,7 +157,7 @@ def read_rwms(path, prefix, version='2.0', names=None, **kwargs):
|
|||
config_no = struct.unpack('i', t)[0]
|
||||
configlist[-1].append(config_no)
|
||||
for i in range(nrw):
|
||||
if(version == '2.0'):
|
||||
if (version == '2.0'):
|
||||
tmpd = _read_array_openQCD2(fp)
|
||||
tmpd = _read_array_openQCD2(fp)
|
||||
tmp_rw = tmpd['arr']
|
||||
|
@ -364,7 +364,7 @@ def extract_t0(path, prefix, dtr_read, xmin, spatial_extent, fit_range=5, **kwar
|
|||
configlist.append([])
|
||||
while True:
|
||||
t = fp.read(4)
|
||||
if(len(t) < 4):
|
||||
if (len(t) < 4):
|
||||
break
|
||||
nc = struct.unpack('i', t)[0]
|
||||
configlist[-1].append(nc)
|
||||
|
@ -754,7 +754,7 @@ def _read_flow_obs(path, prefix, c, dtr_cnfg=1, version="openQCD", obspos=0, sum
|
|||
|
||||
t = fp.read(12)
|
||||
Ls = struct.unpack('<iii', t)
|
||||
if(Ls[0] == Ls[1] and Ls[1] == Ls[2]):
|
||||
if (Ls[0] == Ls[1] and Ls[1] == Ls[2]):
|
||||
L = Ls[0]
|
||||
if not (supposed_L == L) and supposed_L:
|
||||
raise Exception("It seems the length given in the header and by you contradict each other")
|
||||
|
@ -769,7 +769,7 @@ def _read_flow_obs(path, prefix, c, dtr_cnfg=1, version="openQCD", obspos=0, sum
|
|||
if c > cmax:
|
||||
raise Exception('Flow has been determined between c=0 and c=%lf with tolerance %lf' % (cmax, tol))
|
||||
|
||||
if(zthfl == 2):
|
||||
if (zthfl == 2):
|
||||
nfl = 2 # number of flows
|
||||
else:
|
||||
nfl = 1
|
||||
|
@ -777,7 +777,7 @@ def _read_flow_obs(path, prefix, c, dtr_cnfg=1, version="openQCD", obspos=0, sum
|
|||
|
||||
while True:
|
||||
t = fp.read(4)
|
||||
if(len(t) < 4):
|
||||
if (len(t) < 4):
|
||||
break
|
||||
traj_list.append(struct.unpack('i', t)[0]) # trajectory number when measurement was done
|
||||
|
||||
|
@ -802,7 +802,7 @@ def _read_flow_obs(path, prefix, c, dtr_cnfg=1, version="openQCD", obspos=0, sum
|
|||
|
||||
while True:
|
||||
t = fp.read(4)
|
||||
if(len(t) < 4):
|
||||
if (len(t) < 4):
|
||||
break
|
||||
traj_list.append(struct.unpack('i', t)[0])
|
||||
# Wsl
|
||||
|
|
|
@ -74,11 +74,11 @@ def read_sfcf(path, prefix, name, quarks='.*', corr_type='bi', noffset=0, wf=0,
|
|||
|
||||
if version not in known_versions:
|
||||
raise Exception("This version is not known!")
|
||||
if(version[-1] == "c"):
|
||||
if (version[-1] == "c"):
|
||||
appended = False
|
||||
compact = True
|
||||
version = version[:-1]
|
||||
elif(version[-1] == "a"):
|
||||
elif (version[-1] == "a"):
|
||||
appended = True
|
||||
compact = False
|
||||
version = version[:-1]
|
||||
|
@ -252,7 +252,7 @@ def read_sfcf(path, prefix, name, quarks='.*', corr_type='bi', noffset=0, wf=0,
|
|||
lines = fp.readlines()
|
||||
# check, if the correlator is in fact
|
||||
# printed completely
|
||||
if(start_read + T > len(lines)):
|
||||
if (start_read + T > len(lines)):
|
||||
raise Exception("EOF before end of correlator data! Maybe " + path + '/' + item + '/' + sub_ls[cfg] + " is corrupted?")
|
||||
# and start to read the correlator.
|
||||
# the range here is chosen like this,
|
||||
|
@ -262,7 +262,7 @@ def read_sfcf(path, prefix, name, quarks='.*', corr_type='bi', noffset=0, wf=0,
|
|||
if k == start_read - 5 - b2b:
|
||||
if lines[k].strip() != 'name ' + name:
|
||||
raise Exception('Wrong format', sub_ls[cfg])
|
||||
if(k >= start_read and k < start_read + T):
|
||||
if (k >= start_read and k < start_read + T):
|
||||
floats = list(map(float, lines[k].split()))
|
||||
deltas[k - start_read][i][cfg] = floats[-2:][im]
|
||||
else:
|
||||
|
@ -273,7 +273,7 @@ def read_sfcf(path, prefix, name, quarks='.*', corr_type='bi', noffset=0, wf=0,
|
|||
# we can iterate over the whole file.
|
||||
# here one can also implement the chekc from above.
|
||||
for k, line in enumerate(fp):
|
||||
if(k >= start_read and k < start_read + T):
|
||||
if (k >= start_read and k < start_read + T):
|
||||
floats = list(map(float, line.split()))
|
||||
if version == "0.0":
|
||||
deltas[k - start][i][cnfg] = floats[im - single]
|
||||
|
|
Loading…
Add table
Reference in a new issue