Skip to content

Commit ae021fb

Browse files
committed
chore: ran black
1 parent c0a3750 commit ae021fb

File tree

5 files changed

+30
-16
lines changed

5 files changed

+30
-16
lines changed

ephyspy/allen_sdk/ephys_features.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -531,9 +531,11 @@ def find_widths(v, t, spike_indexes, peak_indexes, trough_indexes, clipped=None)
531531
width_starts = np.zeros_like(trough_indexes) * np.nan
532532
width_starts[use_indexes] = np.array(
533533
[
534-
pk - np.flatnonzero(v[pk:spk:-1] <= wl)[0]
535-
if np.flatnonzero(v[pk:spk:-1] <= wl).size > 0
536-
else np.nan
534+
(
535+
pk - np.flatnonzero(v[pk:spk:-1] <= wl)[0]
536+
if np.flatnonzero(v[pk:spk:-1] <= wl).size > 0
537+
else np.nan
538+
)
537539
for pk, spk, wl in zip(
538540
peak_indexes[use_indexes],
539541
spike_indexes[use_indexes],
@@ -545,9 +547,11 @@ def find_widths(v, t, spike_indexes, peak_indexes, trough_indexes, clipped=None)
545547

546548
width_ends[use_indexes] = np.array(
547549
[
548-
pk + np.flatnonzero(v[pk:tr] <= wl)[0]
549-
if np.flatnonzero(v[pk:tr] <= wl).size > 0
550-
else np.nan
550+
(
551+
pk + np.flatnonzero(v[pk:tr] <= wl)[0]
552+
if np.flatnonzero(v[pk:tr] <= wl).size > 0
553+
else np.nan
554+
)
551555
for pk, tr, wl in zip(
552556
peak_indexes[use_indexes],
553557
trough_indexes[use_indexes].astype(int),

ephyspy/features/spike_features.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,11 @@ def _plot(self, ax: Optional[Axes] = None, selected_idxs=None, **kwargs) -> Axes
590590

591591
width_idx = np.array(
592592
[
593-
pk - np.flatnonzero(v[pk:spk:-1] <= wl)[0]
594-
if np.flatnonzero(v[pk:spk:-1] <= wl).size > 0
595-
else np.nan
593+
(
594+
pk - np.flatnonzero(v[pk:spk:-1] <= wl)[0]
595+
if np.flatnonzero(v[pk:spk:-1] <= wl).size > 0
596+
else np.nan
597+
)
596598
for pk, spk, wl in zip(
597599
peak_idxs,
598600
spike_idxs,

ephyspy/features/sweepset_features.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,11 @@ def _aggregate(self, fts):
285285
"selected_idx": hyperpol_idx[median_idx(fts)],
286286
}
287287
)
288-
med = float("nan") if len(fts) == 0 or np.all(np.isnan(fts)) else np.nanmedian(fts).item()
288+
med = (
289+
float("nan")
290+
if len(fts) == 0 or np.all(np.isnan(fts))
291+
else np.nanmedian(fts).item()
292+
)
289293
return med
290294

291295

ephyspy/features/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def sag_period(sweep: EphysSweep, where_sag: ndarray) -> float:
266266
def where_stimulus(data: Union[EphysSweep, EphysSweepSet]) -> Union[bool, ndarray]:
267267
"""Checks where the stimulus is unequal to current at t=0.
268268
269-
Checks where stimulus is unequal to current at t=0 for a single sweep or each
269+
Checks where stimulus is unequal to current at t=0 for a single sweep or each
270270
sweep in a sweepset.
271271
272272
Args:
@@ -326,7 +326,7 @@ def has_stimulus(data: Union[EphysSweep, EphysSweepSet]) -> Union[bool, ndarray]
326326
327327
Returns:
328328
bool: True if sweep has stimulus."""
329-
return np.any(data.i.T*where_stimulus(data) != 0, axis=0)
329+
return np.any(data.i.T * where_stimulus(data) != 0, axis=0)
330330

331331

332332
def is_hyperpol(data: Union[EphysSweep, EphysSweepSet]) -> Union[bool, ndarray]:
@@ -338,7 +338,7 @@ def is_hyperpol(data: Union[EphysSweep, EphysSweepSet]) -> Union[bool, ndarray]:
338338
339339
Returns:
340340
bool: True if sweep is hyperpolarizing."""
341-
return np.any(data.i.T*where_stimulus(data) < 0, axis=0)
341+
return np.any(data.i.T * where_stimulus(data) < 0, axis=0)
342342

343343

344344
def is_depol(data: Union[EphysSweep, EphysSweepSet]) -> Union[bool, ndarray]:
@@ -350,7 +350,7 @@ def is_depol(data: Union[EphysSweep, EphysSweepSet]) -> Union[bool, ndarray]:
350350
351351
Returns:
352352
bool: True if sweep is depolarizing."""
353-
return np.any(data.i.T*where_stimulus(data) > 0, axis=0)
353+
return np.any(data.i.T * where_stimulus(data) > 0, axis=0)
354354

355355

356356
def has_rebound(feature: Any, T_rebound: float = 0.3) -> bool:

ephyspy/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,12 @@ def stimulus_type(sweep_or_sweepset: Union[EphysSweep, EphysSweepSet]) -> str:
169169
if np.all(slope == 0):
170170
return "long_square"
171171

172-
rel_slope_change = np.abs(slope - slope[0]) / slope[0] if np.all(slope > 0) else np.nan
173-
if np.all(rel_slope_change < 0.001) and not np.isnan(rel_slope_change): # same slope
172+
rel_slope_change = (
173+
np.abs(slope - slope[0]) / slope[0] if np.all(slope > 0) else np.nan
174+
)
175+
if np.all(rel_slope_change < 0.001) and not np.isnan(
176+
rel_slope_change
177+
): # same slope
174178
return "ramp"
175179
else:
176180
return "unknown"

0 commit comments

Comments
 (0)