Commit 360af80
PERF: Batch spectrogram calls in Welch PSD computation
Replace np.apply_along_axis (which calls scipy.signal.spectrogram
once per row) with chunked 2D calls. scipy.signal.spectrogram
handles multi-row input efficiently via vectorized FFT, so
processing ~10 MB chunks instead of individual rows eliminates
per-call Python dispatch overhead.
On 320 epochs x 376 channels (120K rows), psd_array_welch goes
from ~5.0s to ~0.19s (~26x speedup).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 14d0916 commit 360af80
1 file changed
Lines changed: 15 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 65 | + | |
| 66 | + | |
70 | 67 | | |
71 | 68 | | |
72 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
73 | 82 | | |
74 | 83 | | |
75 | 84 | | |
| |||
0 commit comments