Repository navigation
Match EEGLAB calling conventions and index shapes - #656
Conversation
epoch, gauss, and eeg_lat2point now follow MATLAB rows and 1-based indices. pop_loadset, pop_expica, pop_copyset, and pop_delset accept the EEGLAB argument and dataset-list contracts. Co-authored-by: Suraj Ranganath <[email protected]>
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
|
Claude finished @suraj-ranganath's task in 1m 48s —— View job Code review
BlockingNone. Important
NitsNone. Test gaps
EEGLAB parity notes
I could not run tests in this environment: running commands needed approval. |
| eeg_out = {field: deepcopy(stored[field][position]) for field in stored.dtype.names} | ||
| else: | ||
| eeg_out = deepcopy(copied) | ||
| current = np.float64(set_out) |
There was a problem hiding this comment.
Important: CURRENTSET is now np.float64 for plain-list ALLEEG too
current = np.float64(set_out) applies to every caller, not only the MATLAB struct-array path. In standalone Python, the documented pattern breaks:
ALLEEG, EEG, CURRENTSET = pop_copyset(ALLEEG, 1, 2)
ALLEEG[CURRENTSET - 1] # TypeError: list indices must be integers or slices, not numpy.float64docs/source/examples/plot_dataset_management.py:87 will also print CURRENTSET: 3.0 now. The GUI path is fine only because normalize_dataset_indices in session.py accepts whole-number floats.
MATLAB doubles are a backend-marshalling concern. Keep int here and convert in tests/eeglab_tests/backend.py (or return np.float64 only when ALLEEG is a structured array, like restore_dataset_container does).
| current = np.float64(set_out) | |
| current = np.float64(set_out) if isinstance(stored, np.ndarray) else set_out |
| - ``epoch`` accepts positional name/value pairs and returns 1-based column | ||
| indices, a ``newtime`` row, and event cells. ``gauss`` returns a row. |
There was a problem hiding this comment.
Important: the changelog does not say that eegprep.epoch changed what it does
Before this PR, eegprep.epoch (redefine_functions.epoch) was a wrapper for pop_epoch, so it epoched an EEG dataset. Now it runs the data-matrix epoch.m port. That matches EEGLAB, but any epoch(EEG, ...) call now fails or returns the wrong result, and this entry only says "accepts positional name/value pairs". AGENTS.md says: "Update … migration notes where relevant."
Suggested fix: add a sentence such as "epoch now extracts epochs from a data matrix, as epoch.m does; use pop_epoch to epoch a dataset." The docs/source/api/epoching_and_selection.rst entry picks up the new docstring automatically.
pop_copyset returns a float current index only for a structure-array ALLEEG. epoch now says it extracts epochs from a data matrix. Co-authored-by: Suraj Ranganath <[email protected]>
Match EEGLAB argument order, 1-based epoch indices, and row-shaped gauss and eeg_lat2point results, and keep structure-array dataset lists. Sixteen Python-backend expected failures now pass. MATLAB Engine is not installed, so the MATLAB reference suite was not run.
Refs #430