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

[MRG] Too large windows #304

Merged
merged 7 commits into from
Jul 29, 2021
Merged

Conversation

gemeinl
Copy link
Collaborator

@gemeinl gemeinl commented Jul 14, 2021

No description provided.

@gemeinl gemeinl linked an issue Jul 14, 2021 that may be closed by this pull request
@gemeinl gemeinl changed the title Large windows [MRG] Large windows Jul 14, 2021
@codecov
Copy link

codecov bot commented Jul 14, 2021

Codecov Report

Merging #304 (97b7687) into master (b65a1dc) will increase coverage by 0.02%.
The diff coverage is 85.71%.

@@            Coverage Diff             @@
##           master     #304      +/-   ##
==========================================
+ Coverage   80.19%   80.22%   +0.02%     
==========================================
  Files          49       49              
  Lines        2944     2948       +4     
==========================================
+ Hits         2361     2365       +4     
  Misses        583      583              

@gemeinl
Copy link
Collaborator Author

gemeinl commented Jul 15, 2021

# check if recordings are of different lengths
lengths = np.array([ds.raw.n_times for ds in concat_ds.datasets])
if (np.diff(lengths) != 0).any():
warnings.warn('Recordings have different lengths, they will not be batch-able!')
were wrong and actually are still wrong. It does not matter if recordings/trials are of different length, unless the user wants to extract a single window per recording/trial. So the check is incomplete

@gemeinl
Copy link
Collaborator Author

gemeinl commented Jul 15, 2021

if window_size_samples is not None and window_stride_samples is not None and \
drop_last_window is None:
raise ValueError('drop_last_window must be set if window_size_samples &'
' window_stride_samples are not set')
is also incorrect. Error message does not match check above.

@gemeinl gemeinl changed the title [MRG] Large windows [MRG] Too large windows Jul 15, 2021
@gemeinl
Copy link
Collaborator Author

gemeinl commented Jul 15, 2021

@dcwil could you have another look at these checks?

@dcwil
Copy link
Collaborator

dcwil commented Jul 16, 2021

# check if recordings are of different lengths
lengths = np.array([ds.raw.n_times for ds in concat_ds.datasets])
if (np.diff(lengths) != 0).any():
warnings.warn('Recordings have different lengths, they will not be batch-able!')

were wrong and actually are still wrong. It does not matter if recordings/trials are of different length, unless the user wants to extract a single window per recording/trial. So the check is incomplete

Should this block should also be checking if the user wants to extract a single window per trial, ie window_stride_samples and window_size_samples are None?

@gemeinl
Copy link
Collaborator Author

gemeinl commented Jul 16, 2021

@dcwil Yes, correct. The warning only has to be raised if user attempts to extract one window per trial (in this case recording) and they are of different lengths. (Stride should not matter at all.) Usually, if window size is specified, or if trials are of the same length, all windows will always be of same length and therefore batch-able.

For the other check I don't know. I just saw that the error message does not match the check. But since the check is in an if else, I don't know whether something else has to be changed.

@robintibor
Copy link
Contributor

Great that we caught this bug

@robintibor robintibor merged commit 96d9536 into braindecode:master Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Catch too large window sizes
3 participants