Repository navigation
Clear the last Python-backend xfails - #659
Conversation
eeg_store fills a slot whose data is empty. Missing gethelpvar text and eventdescription cells are shaped only at the MATLAB comparison boundary. importevent does not eval a caller workspace name. std_selectdesign keeps list-valued cluster indices, and the ported design test no longer treats the package version as EEGLAB <= 13. Part of #430 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 44s —— View job Code review
BlockingNone. Important
Nits
Test gapsNone. EEGLAB parity notes
Checked the following against
I did not run any tests or MATLAB here. The local vendored EEGLAB checkout was not present. |
| for event_index, item in zip(indices, values): | ||
| events[event_index][key_text] = _field_value(key_text, item, srate=srate, timeunit=timeunit) | ||
| _update_matching_urevent(output, events[event_index], key_text) | ||
| _ensure_description_slot(eventdescription, event_field_names(events, include_urevent=True), key_text) | ||
| _ensure_description_slot(eventdescription, event_field_names(events, include_urevent=True), key_text) | ||
| description_edited = True |
There was a problem hiding this comment.
Important (performance regression). _ensure_description_slot(...) moved from after this loop to inside it. It now calls event_field_names(events, include_urevent=True) once per event, and that function scans every event (_event_utils.py L32-L41). Setting one field on all events is now O(n_events²). On a continuous recording with a few thousand events, pop_editeventfield(EEG, 'type', ...) runs millions of dict iterations where it used to run one scan.
eegprep/src/eegprep/functions/popfunc/pop_editeventfield.py
Lines 246 to 252 in a3f380b
Suggested fix: keep the slot update outside the loop. Mark the description as edited only when an event was assigned:
for event_index, item in zip(indices, values):
events[event_index][key_text] = _field_value(key_text, item, srate=srate, timeunit=timeunit)
_update_matching_urevent(output, events[event_index], key_text)
if indices:
_ensure_description_slot(eventdescription, event_field_names(events, include_urevent=True), key_text)
description_edited = True| ) | ||
|
|
||
|
|
||
| def test_std_selectdesign_keeps_list_valued_cluster_indices(): |
There was a problem hiding this comment.
Nit (AGENTS.md §Testing: "Only add a test that would catch a real bug"). std_selectdesign never reads or writes allinds/setinds. It sets currentdesign and calls clear_study_data_fields:
eegprep/src/eegprep/functions/studyfunc/std_selectdesign.py
Lines 13 to 20 in a3f380b
The removed xfail was an AttributeError in the test harness, which called .size on lists. It was not a library defect, and the _flat/_count change to the reference test already covers it. This test cannot catch the regression this PR fixes, so consider dropping it.
Scanning field names once per event made a full-field edit quadratic. The list-valued cluster test did not exercise std_selectdesign. Co-authored-by: Suraj Ranganath <[email protected]>
eeg_store fills a free ALLEEG slot when data is empty, including a struct element created by assigning indices 1 and 3. eeg_store.m uses isempty(ALLEEG(i).data). Python only treated {} as empty, so the datasets were appended. The library still returns a list of dataset dicts. The comparison already presents that list as a struct row, and the stored result has no empty slot.
gethelpvar still returns an empty Python string for an unknown name. gethelpvar.m assigns '' inside the description cell, not an empty cell. The comparison adapter presents that string as the harness shape of '', a length-0 char vector.
importevent and pop_importdata do not resolve a variable name. importevent.m lines 199 and 228 call evalin('caller') when the event argument is a character name and no file of that name exists, and pop_importdata documents data as a base-workspace name. EEGPrep has no caller workspace. The reference test passes the same arrays on the Python path and checks latencies 1 and 50. The difference is in the migration guide.
pop_editeventfield leaves eventdescription unchanged when the named field is absent. pop_editeventfield.m assigns the cell only when strmatch finds the field. A real field description stays a Python list of strings. The comparison presents that list as the 1-by-N cell of char that eeg_checkset.m builds, so the first cell is the new comment. It is not reshaped into a character column of the whole field. The description slot is updated once per field, not once per event.
std_selectdesign.m does not call size on cluster fields such as allinds. The ported test did. EEGPrep's package version 0.5.0 was read as an EEGLAB release at most 13, so the test also ran the old cluster-membership check that current EEGLAB skips because eeg_getversion returns dev. The smoke loop accepts a list or a struct array. The membership check runs only for EEGLAB releases 9 through 13.
The Python-backend xfail registry is empty. Local unit tests: 3226 passed, 161 skipped, 3 failed on missing LIMO files in the suite checkout, pamica not installed. Python-backend lane (-m "parity and not slow and not gui"): 623 passed, 107 skipped. MATLAB is not installed here, so the MATLAB reference suite was not run.
Part of #430