Skip to content

Commit 77d58ce

Browse files
committed
Fix formatting with black version 24
1 parent 3744a63 commit 77d58ce

2 files changed

Lines changed: 30 additions & 12 deletions

File tree

package/MDAnalysis/analysis/hydrogenbonds/hbond_autocorrel.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,16 +321,20 @@ def __init__(
321321

322322
if exclusions is not None:
323323
if len(exclusions[0]) != len(exclusions[1]):
324-
raise ValueError("'exclusion' must be two arrays of identical length")
325-
self.exclusions = np.column_stack((exclusions[0], exclusions[1])).astype(
326-
np.intp
327-
)
324+
raise ValueError(
325+
"'exclusion' must be two arrays of identical length"
326+
)
327+
self.exclusions = np.column_stack(
328+
(exclusions[0], exclusions[1])
329+
).astype(np.intp)
328330
else:
329331
self.exclusions = None
330332

331333
self.bond_type = bond_type
332334
if self.bond_type not in ["continuous", "intermittent"]:
333-
raise ValueError("bond_type must be either 'continuous' or 'intermittent'")
335+
raise ValueError(
336+
"bond_type must be either 'continuous' or 'intermittent'"
337+
)
334338

335339
self.a_crit = np.deg2rad(angle_crit)
336340
self.d_crit = dist_crit
@@ -366,7 +370,9 @@ def _slice_traj(self, sample_time):
366370
if req_frames > n_frames:
367371
warnings.warn(
368372
"Number of required frames ({}) greater than the"
369-
" number of frames in trajectory ({})".format(req_frames, n_frames),
373+
" number of frames in trajectory ({})".format(
374+
req_frames, n_frames
375+
),
370376
RuntimeWarning,
371377
)
372378

@@ -477,7 +483,9 @@ def _single_run(self, start, stop):
477483
aidx = aidx[idx2]
478484

479485
nbonds = len(hidx) # number of hbonds at t=0
480-
results = np.zeros_like(np.arange(start, stop, self._skip), dtype=np.float32)
486+
results = np.zeros_like(
487+
np.arange(start, stop, self._skip), dtype=np.float32
488+
)
481489

482490
if self.time_cut:
483491
# counter for time criteria
@@ -486,7 +494,9 @@ def _single_run(self, start, stop):
486494
for i, ts in enumerate(self.u.trajectory[start : stop : self._skip]):
487495
box = self.u.dimensions if self.pbc else None
488496

489-
d = calc_bonds(self.h.positions[hidx], self.a.positions[aidx], box=box)
497+
d = calc_bonds(
498+
self.h.positions[hidx], self.a.positions[aidx], box=box
499+
)
490500
a = calc_angles(
491501
self.d.positions[hidx],
492502
self.h.positions[hidx],
@@ -611,7 +621,9 @@ def triple(x, A1, A2, tau1, tau2, tau3):
611621
"""Sum of three exponential functions"""
612622
A3 = 1 - (A1 + A2)
613623
return (
614-
A1 * np.exp(-x / tau1) + A2 * np.exp(-x / tau2) + A3 * np.exp(-x / tau3)
624+
A1 * np.exp(-x / tau1)
625+
+ A2 * np.exp(-x / tau2)
626+
+ A3 * np.exp(-x / tau3)
615627
)
616628

617629
if self.bond_type == "continuous":
@@ -652,7 +664,9 @@ def triple(x, A1, A2, tau1, tau2, tau3):
652664
self.solution["ier"] = ier
653665

654666
if ier in [1, 2, 3, 4]: # solution found if ier is one of these values
655-
self.solution["estimate"] = self._my_solve(self.solution["time"], *p)
667+
self.solution["estimate"] = self._my_solve(
668+
self.solution["time"], *p
669+
)
656670
else:
657671
warnings.warn("Solution to results not found", RuntimeWarning)
658672

testsuite/MDAnalysisTests/analysis/test_hydrogenbondautocorrel.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,9 @@ def actual_function_int(t):
249249
tau2 = 1
250250
tau3 = 0.1
251251
return (
252-
A1 * np.exp(-t / tau1) + A2 * np.exp(-t / tau2) + A3 * np.exp(-t / tau3)
252+
A1 * np.exp(-t / tau1)
253+
+ A2 * np.exp(-t / tau2)
254+
+ A3 * np.exp(-t / tau3)
253255
)
254256

255257
hbond.solution["time"] = time = np.arange(0, 6.0, 0.01)
@@ -323,7 +325,9 @@ def test_solve_before_run_VE(self, u, hydrogens, oxygens, nitrogens):
323325
hbond.solve()
324326

325327
@mock.patch("MDAnalysis.coordinates.TRZ.TRZReader._read_frame")
326-
def test_unslicable_traj_VE(self, mock_read, u, hydrogens, oxygens, nitrogens):
328+
def test_unslicable_traj_VE(
329+
self, mock_read, u, hydrogens, oxygens, nitrogens
330+
):
327331
mock_read.side_effect = TypeError
328332

329333
with pytest.raises(ValueError):

0 commit comments

Comments
 (0)