Skip to content

Commit d621aa1

Browse files
committed
Update snr_kurtosis.py
lint
1 parent bd483af commit d621aa1

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/aind_dynamic_foraging_basic_analysis/metrics/snr_kurtosis.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
__all__ = ["estimate_snr", "estimate_kurtosis"]
4343

4444

45-
def estimate_snr(trace: NDArray[np.floating], fps: float = 20.0) -> Tuple[float, float, NDArray[np.intp]]:
45+
def estimate_snr(
46+
trace: NDArray[np.floating], fps: float = 20.0
47+
) -> Tuple[float, float, NDArray[np.intp]]:
4648
"""
4749
Estimate the signal-to-noise ratio (SNR) of a 1D trace.
4850
@@ -77,7 +79,9 @@ def estimate_snr(trace: NDArray[np.floating], fps: float = 20.0) -> Tuple[float,
7779

7880
# Noise estimation based on derivative, assuming random noise
7981
dfdt = np.diff(trace)
80-
noise = float(np.std(dfdt) / np.sqrt(2))
82+
noise = float(
83+
np.std(dfdt) / np.sqrt(2)
84+
)
8185

8286
# Peak detection
8387
peaks, _ = find_peaks(
@@ -127,4 +131,5 @@ def estimate_kurtosis(trace: NDArray[np.floating]) -> float:
127131
trace = np.nan_to_num(trace, nan=np.nanmedian(trace))
128132

129133
# Excess kurtosis (normal distribution = 0)
130-
return float(kurtosis(trace, fisher=True, bias=False))
134+
return float(kurtosis(trace, fisher=True, bias=False))
135+

0 commit comments

Comments
 (0)