Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Technical Audit: Spectral #202

Merged
merged 20 commits into from
Jul 7, 2020
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
49c0b24
Fix bug which averages wavelet coefficients across time, rather than …
elybrand Jun 29, 2020
be38804
Add a check which ensures noverlap is strictly less than nperseg.
elybrand Jun 29, 2020
2f25393
Remove redundant type casting
elybrand Jun 29, 2020
b65a8f8
Remove exception when nperseg < noverlap. Scipy catches it.
elybrand Jun 29, 2020
cecded3
Change what axis frequency mask is applied. This reflects changes mad…
elybrand Jun 30, 2020
ad6dd14
Actually sample with replacement when using bootstrap.
elybrand Jun 30, 2020
f75a7f0
Remove transposes to reflect that time-frequency power spectra are pl…
elybrand Jun 30, 2020
d810fae
Update wavelet transform as in issue193_tf PR but I need it here too …
elybrand Jul 2, 2020
135868f
Add a check which ensures noverlap is strictly less than nperseg.
elybrand Jun 29, 2020
28fbc4f
Remove redundant type casting
elybrand Jun 29, 2020
0162c12
Remove exception when nperseg < noverlap. Scipy catches it.
elybrand Jun 29, 2020
b6b3368
Change what axis frequency mask is applied. This reflects changes mad…
elybrand Jun 30, 2020
a66c489
Actually sample with replacement when using bootstrap.
elybrand Jun 30, 2020
2ce0837
Remove transposes to reflect that time-frequency power spectra are pl…
elybrand Jun 30, 2020
59a7cf4
Update wavelet transform as in issue193_tf PR but I need it here too …
elybrand Jul 2, 2020
33a495b
Merge branch 'issue193_spectral' of github.com:elybrand/neurodsp into…
elybrand Jul 7, 2020
90d1944
Revert spectral utils back to master. Remove redundant docstring for …
elybrand Jul 7, 2020
9e8de03
Remove redudnant wavelet docstring
elybrand Jul 7, 2020
002fe7f
Add code explaining power calculation for wavelet spectrum'
elybrand Jul 7, 2020
55b14a9
Revert erroneous transposes back to master.
elybrand Jul 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions neurodsp/spectral/power.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ def compute_spectrum_wavelet(sig, fs, freqs, avg_type='mean', **kwargs):
freqs = create_freqs(*freqs)

mwt = compute_wavelet_transform(sig, fs, freqs, **kwargs)
spectrum = get_avg_func(avg_type)(abs(mwt)**2, axis=1)
# Convert the wavelet coefficient outputs to power
mwt_power = abs(mwt)**2
# Create the power spectrum by averaging across the time dimension
spectrum = get_avg_func(avg_type)(mwt_power, axis=1)

return freqs, spectrum

Expand Down Expand Up @@ -214,7 +217,7 @@ def compute_spectrum_medfilt(sig, fs, filt_len=1., f_range=None):
freqs = np.fft.fftfreq(len(sig), 1. / fs)[:int(np.ceil(len(sig) / 2.))]

# Convert median filter length from Hz to samples, and make sure it is odd
filt_len_samp = int(int(filt_len / (freqs[1] - freqs[0])))
filt_len_samp = int(filt_len / (freqs[1] - freqs[0]))
if filt_len_samp % 2 == 0:
filt_len_samp += 1

Expand Down