Skip to content

Accept MATLAB struct, cell, and scalar inputs - #654

Merged
suraj-ranganath merged 4 commits into
developfrom
cursor/matlab-input-adapters-3877
Nov 19, 2026
Merged

suraj-ranganath merged 4 commits into
developfrom
cursor/matlab-input-adapters-3877

Conversation

@suraj-ranganath

Copy link
Copy Markdown
Member

Accept MATLAB structs, cells, empty arrays, and whole-number doubles at the Python function boundary.

matlab_inputs is the shared adapter. getkeyval, blockave, shortread, floatread, vararg2str, readlocs, runica, epoch, pop_epoch, pop_select, pop_copyset, pop_saveh, pop_chancoresp, pop_editeventvals, pop_selectevent, eeg_store, eeg_retrieve, eeg_decodechan, eeg_getepochevent, eegh, finputcheck, forcelocs, unique_cell_string, eeg_checkset, and clean_artifacts call it. Results stay Python scalars, lists, and dicts. pop_select indices stay 0-based. finputcheck still returns Python numbers. unique_cell_string returns a list for a Python sequence and a 1-by-N cell for a cell. rmart is unchanged. Tolerances, recorded expectations, and parity JSON are unchanged.

Part of #430.

Counts are strict (#430) markers, parents plus subtests. XPASS is 0 in every cluster before and after. Before is the marker table on develop 82897701. After is the same table on this branch, confirmed by the Python backend lane (parity and not slow and not gui): 470 passed, 110 skipped, 3531 deselected, 166 xfailed, 0 failed. The default suite with EEGPREP_SKIP_MATLAB=1, and the long pAMICA report deselected, was 3247 passed, 153 skipped, 865 deselected, 0 failed. Those deselected tests are the parity lane, which runs only with --eeglab-backend. MATLAB is not installed here, so the MATLAB reference suite was not run. Core functions changed, and that suite is still required before merge.

Cluster Before xfail Before xpass After xfail After xpass
input adapters 81 0 20 0
output transport 68 0 104 0
API contracts 23 0 23 0
mmo/MemmapData 2 0 0 0
STUDY load and missing names 9 0 9 0
numeric/index 11 0 10 0
total 194 0 166 0

28 markers were removed because those tests pass. The other movement is reclassification: once the call accepts the MATLAB input, the remaining failure is a Python list or scalar against a MATLAB row, cell, or struct array, or a missing extra output. eeg_retrieve general moved from numeric/index to output transport for that reason. The two mmo preprocessing tests were failing on the epoch cell and empty-array inputs; they now pass, including the memmap comparison.

Baseline inventory on develop 82897701 (194):

input adapters (81)

  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_clear
  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_explicit_pairs
  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_fiducials
  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_invalid_fiducials
  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_labels
  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_none
  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_pair
  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_unpair
  • tests/test_core_event_eeglab_tests.py::test_reference_chaninds_uses_original_epoched_recording
  • tests/test_core_event_eeglab_tests.py::test_reference_eventtypes_preserves_inverted_source_condition
  • tests/test_core_event_eeglab_tests.py::test_reference_getchanlist_no_match
  • tests/test_core_event_eeglab_tests.py::test_reference_getepochevent_default_latency
  • tests/test_core_event_eeglab_tests.py::test_reference_getepochevent_default_time_window
  • tests/test_core_event_eeglab_tests.py::test_reference_getepochevent_duration_old_and_new_calls
  • tests/test_core_event_eeglab_tests.py::test_reference_getepochevent_four_argument_window
  • tests/test_core_event_eeglab_tests.py::test_reference_getepochevent_without_epoch_field
  • tests/test_core_event_eeglab_tests.py::test_reference_insertbound_original_epoched_events
  • tests/test_core_event_eeglab_tests.py::test_reference_matchchans_original_complete_locations
  • tests/test_core_event_eeglab_tests.py::test_reference_mergechan_uses_original_montages
  • tests/test_core_event_eeglab_tests.py::test_reference_mergelocs_uses_original_montages
  • tests/test_core_event_eeglab_tests.py::test_reference_urlatency_boundary_durations
  • tests/test_eeg_decodechan.py::test_reference_decodechan_original_channel_names
  • tests/test_eeg_interp.py::test_reference_interp_original_methods_and_shuffled_montage
  • tests/test_eeg_options.py::test_reference_eeg_readoptions_backup
  • tests/test_eeg_retrieve.py::test_reference_eeg_retrieve_original_multiple_case
  • tests/test_eeg_store.py::test_reference_eeg_store_original_general_case
  • tests/test_eeg_store.py::test_reference_eeg_store_original_multiple_case
  • tests/test_eeg_store.py::test_reference_eeg_store_original_multiple_new_case
  • tests/test_eeg_store.py::test_reference_eeg_store_original_new_case
  • tests/test_eegh.py::test_reference_eegh_add_multiple_history
  • tests/test_eegh.py::test_reference_eegh_add_multiple_history_default_empty
  • tests/test_finputcheck.py::test_reference_finputcheck_original_regression_fixture
  • tests/test_gethelpvar.py::test_reference_gethelpvar_no_var
  • tests/test_gethelpvar.py::test_reference_gethelpvar_some
  • tests/test_legacy_signal_io_eeglab_tests.py::test_upstream_readneurodat_original_file
  • tests/test_misc_data_event_eeglab_tests.py::test_reference_biosig_all_fields
  • tests/test_misc_data_event_eeglab_tests.py::test_reference_biosig_partial_fields
  • tests/test_misc_data_event_eeglab_tests.py::test_reference_unique_cell_string_original_mixed_cells
  • tests/test_phase1b_file_edit_pop_functions.py::test_reference_selectevent_dataset_array
  • tests/test_phase1b_file_edit_pop_functions.py::test_reference_selectevent_delete_unselected_events
  • tests/test_phase1b_file_edit_pop_functions.py::test_reference_selectevent_empty_selection_allowed
  • tests/test_phase1b_file_edit_pop_functions.py::test_reference_selectevent_empty_selection_error
  • tests/test_phase1b_file_edit_pop_functions.py::test_reference_selectevent_explicit_error_nonempty_selection
  • tests/test_phase1b_file_edit_pop_functions.py::test_reference_selectevent_inverse_epochs
  • tests/test_phase1b_file_edit_pop_functions.py::test_reference_selectevent_keep_epochs_delete_events
  • tests/test_phase1b_file_edit_pop_functions.py::test_reference_selectevent_retains_matching_epochs
  • tests/test_phase2_file_channel_location.py::test_reference_convertlocs_cart2all
  • tests/test_phase2_file_channel_location.py::test_reference_pop_chancenter_nine_recorded_location_calls
  • tests/test_phase2_file_channel_location.py::test_reference_readeetraklocs_original_file
  • tests/test_phase2_file_channel_location.py::test_reference_readegilocs_all_original_channel_counts
  • tests/test_pop_interp.py::test_reference_pop_interp_original_locations_and_recording
  • tests/test_pop_reref.py::test_reference_pop_reref_original_bugzilla_270_input
  • tests/test_pop_reref.py::test_reference_reref
  • tests/test_pop_resample_python.py::test_reference_pop_resample_original_half_sample_boundary_workflow
  • tests/test_popfunc_dataset_eeglab_tests.py::test_reference_chanedit_original_locations
  • tests/test_popfunc_dataset_eeglab_tests.py::test_reference_importevent_original_named_workspace_variables
  • tests/test_popfunc_dataset_eeglab_tests.py::test_reference_mergeset_all_eight_recorded_data_calls
  • tests/test_popfunc_dataset_eeglab_tests.py::test_reference_newset_original_eight_datasets_and_saved_files
  • tests/test_popfunc_dataset_eeglab_tests.py::test_reference_selectevent_original_overlapping_epoch_workflow
  • tests/test_sigprocfunc_numerical_eeglab_tests.py::test_reference_mattocell
  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_original_39_calls
  • tests/test_clean_rawdata_eeglab_tests.py::test_reference_clean_rawdata_filtering
  • tests/test_clean_rawdata_eeglab_tests.py::test_reference_clean_rawdata_final_rejection
  • tests/test_eegh.py::test_reference_eegh_empty_command
  • tests/test_misc_data_event_eeglab_tests.py::test_reference_shortread_original_two_million_samples
  • tests/test_phase1b_file_edit_pop_functions.py::test_reference_copyset_recorded_dataset_calls
  • tests/test_phase2_file_channel_location.py::test_reference_floatread_offset
  • tests/test_phase2_file_channel_location.py::test_reference_readlocs_bugzilla_339
  • tests/test_sample_data_pop_functions.py::test_reference_saveh_original_global_and_recording_history
  • tests/test_sample_data_pop_functions.py::test_reference_select_original_time_trials_and_channel
  • tests/test_vararg2str.py::test_reference_vararg2str_all_eight_original_calls
  • tests/test_finputcheck.py::test_reference_finputcheck_original_wrapper_cases
  • tests/test_getkeyval.py::test_reference_getkeyval_original_string_cases
  • tests/test_pop_epoch.py::test_reference_pop_epoch_original_square_event_workflow
  • tests/test_legacy_signal_io_eeglab_tests.py::test_reference_blockave
  • tests/test_getkeyval.py::test_reference_getkeyval_original_evaluated_matrix
  • tests/test_pop_editeventvals_current.py::test_reference_editeventvals_original_recording
  • tests/test_runica.py::test_reference_runica_pca
  • tests/test_epoch.py::test_reference_epoch_original_five_output_contracts(case='no_srate')
  • tests/test_sigprocfunc_plotting_eeglab_tests.py::test_reference_forcelocs_complete_original_coordinates(source='x')
  • tests/test_sigprocfunc_plotting_eeglab_tests.py::test_reference_forcelocs_complete_original_coordinates(source='y')

output transport (68)

  • tests/test_bdf_records_eeglab_tests.py::test_upstream_readbdf_original_record_selection
  • tests/test_cart2topo.py::test_reference_cart2topo_original_coordinate_matrices
  • tests/test_core_event_eeglab_tests.py::test_reference_getchanlist_case_insensitive_type
  • tests/test_core_event_eeglab_tests.py::test_reference_getchanlist_default_all_channels
  • tests/test_core_event_eeglab_tests.py::test_reference_getchanlist_multiple_types_and_missing_type
  • tests/test_core_event_eeglab_tests.py::test_reference_urlatency_missing_duration
  • tests/test_eeg_ms2f.py::test_reference_eeg_ms2f_original_dataset_and_latencies
  • tests/test_getkeyval.py::test_reference_getkeyval_original_presence_cases
  • tests/test_legacy_signal_io_eeglab_tests.py::test_reference_movav
  • tests/test_legacy_signal_io_eeglab_tests.py::test_reference_parsetxt
  • tests/test_legacy_signal_io_eeglab_tests.py::test_upstream_loadtxt_force
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_covary
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_datlim
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_hungarian
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_nan_std
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_pcsquash
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_perminv
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_uniquef
  • tests/test_numdim.py::test_reference_numdim
  • tests/test_phase2_file_channel_location.py::test_reference_chancenter_2d
  • tests/test_phase2_file_channel_location.py::test_reference_chancenter_all_negative
  • tests/test_phase2_file_channel_location.py::test_reference_chancenter_optimize
  • tests/test_phase2_file_channel_location.py::test_reference_chancenter_scalar
  • tests/test_phase2_file_channel_location.py::test_reference_chancenter_zero_radius
  • tests/test_phase4_timefreq_statistics.py::test_reference_angtimewarp
  • tests/test_phase7_long_tail_helpers.py::test_reference_eegthresh
  • tests/test_phase7_long_tail_helpers.py::test_reference_eegthresh_all_rejected
  • tests/test_phase7_long_tail_helpers.py::test_reference_eegthresh_none_rejected
  • tests/test_phase7_long_tail_helpers.py::test_reference_eegthresh_one_electrode
  • tests/test_phase7_long_tail_helpers.py::test_reference_entropy_rej_vectors
  • tests/test_phase7_long_tail_helpers.py::test_reference_kurt
  • tests/test_phase7_long_tail_helpers.py::test_reference_realproba
  • tests/test_rejection_workflows.py::test_reference_rejsuperpose_all
  • tests/test_rejection_workflows.py::test_reference_rejsuperpose_all_ica
  • tests/test_rejection_workflows.py::test_reference_rejsuperpose_empty
  • tests/test_rejection_workflows.py::test_reference_rejsuperpose_general
  • tests/test_rejection_workflows.py::test_reference_rejsuperpose_zero
  • tests/test_sigproc_eegrej.py::test_reference_eegrej_explicit_and_omitted_events
  • tests/test_sigproc_eegrej.py::test_reference_eegrej_overlapping_regions
  • tests/test_sigprocfunc_ica_legacy_eeglab_tests.py::test_reference_kmeanscluster
  • tests/test_sigprocfunc_numerical_eeglab_tests.py::test_reference_matsel
  • tests/test_sigprocfunc_numerical_eeglab_tests.py::test_reference_nan_mean
  • tests/test_sigprocfunc_numerical_eeglab_tests.py::test_reference_quantile
  • tests/test_statistics_package.py::test_reference_concatdata_original_arrays
  • tests/test_bdf_records_eeglab_tests.py::test_upstream_openbdf_original_channel_types
  • tests/test_bdf_records_eeglab_tests.py::test_upstream_openbdf_original_general_header
  • tests/test_bdf_records_eeglab_tests.py::test_upstream_openbdf_original_invalid_digital_limits
  • tests/test_bdf_records_eeglab_tests.py::test_upstream_openbdf_original_invalid_physical_limits
  • tests/test_bdf_records_eeglab_tests.py::test_upstream_openbdf_original_reversed_digital_limits
  • tests/test_bdf_records_eeglab_tests.py::test_upstream_openbdf_original_reversed_physical_limits
  • tests/test_miscfunc_decomposition_eeglab_tests.py::test_reference_varsort
  • tests/test_miscfunc_decomposition_eeglab_tests.py::test_reference_zica
  • tests/test_phase2_file_channel_location.py::test_reference_pop_chancenter_empty_center
  • tests/test_phase2_file_channel_location.py::test_reference_pop_chancenter_no_omitchans
  • tests/test_phase2_file_channel_location.py::test_reference_pop_chancenter_with_omitchans
  • tests/test_phase2_file_channel_location.py::test_reference_readelp_five_outputs
  • tests/test_pop_comments.py::test_reference_comments_concatenation
  • tests/test_pop_comments.py::test_reference_comments_replacement
  • tests/test_pop_rmbase.py::test_reference_pop_rmbase_original_baselines_and_complete_commands
  • tests/test_pop_rmbase.py::test_reference_rmbase
  • tests/test_rejection_workflows.py::test_reference_pop_rejchan
  • tests/test_rejection_workflows.py::test_reference_pop_rejtrend
  • tests/test_popfunc_dataset_eeglab_tests.py::test_reference_importevent_original_text_file
  • tests/test_eegplot.py::test_reference_eegplot2trial_original_marks(source='general')
  • tests/test_eegplot.py::test_reference_eegplot2trial_original_marks(source='multiple')
  • tests/test_eegplot.py::test_reference_eegplot2trial_original_marks(source='multiple_color')
  • tests/test_eegplot.py::test_reference_eegplot2trial_original_marks(source='multiple_colorin')
  • tests/test_eegplot.py::test_reference_eegplot2trial_original_marks(source='multiple_colorout')

API contracts (23)

  • tests/test_phase1b_file_edit_pop_functions.py::test_reference_copyset_original_set_out
  • tests/test_pop_delset.py::test_reference_delset_original_datasets
  • tests/test_pop_editeventfield_current.py::test_reference_add_field_file
  • tests/test_pop_editeventfield_current.py::test_reference_add_field_file_indices
  • tests/test_pop_editeventfield_current.py::test_reference_add_field_vector
  • tests/test_pop_editeventfield_current.py::test_reference_delimiters
  • tests/test_pop_editeventfield_current.py::test_reference_delold_invalid
  • tests/test_pop_editeventfield_current.py::test_reference_delold_yes
  • tests/test_pop_editeventfield_current.py::test_reference_description_missing_field
  • tests/test_pop_editeventfield_current.py::test_reference_field_description
  • tests/test_pop_editeventfield_current.py::test_reference_invalid_rename
  • tests/test_pop_editeventfield_current.py::test_reference_latency_timeunit
  • tests/test_pop_editeventfield_current.py::test_reference_modify_field
  • tests/test_pop_editeventfield_current.py::test_reference_modify_field_indices
  • tests/test_pop_editeventfield_current.py::test_reference_remove_missing_field
  • tests/test_pop_editeventfield_current.py::test_reference_rename_field
  • tests/test_pop_editeventfield_current.py::test_reference_rename_missing_field
  • tests/test_pop_editeventfield_current.py::test_reference_skip_lines
  • tests/test_sample_data_pop_functions.py::test_reference_expica_original_recording_and_ascii_outputs
  • tests/test_epoch.py::test_reference_epoch_original_five_output_contracts(case='general')
  • tests/test_epoch.py::test_reference_epoch_original_five_output_contracts(case='boundary')
  • tests/test_epoch.py::test_reference_epoch_original_five_output_contracts(case='valuelim')
  • tests/test_epoch.py::test_reference_epoch_original_five_output_contracts(case='allevents')

mmo/MemmapData (2)

  • tests/test_mmo_eeglab_tests.py::test_upstream_mmo_original_preprocessing[continuous_epoch]
  • tests/test_mmo_eeglab_tests.py::test_upstream_mmo_original_preprocessing[continuous_epoch_after_rejection]

STUDY load and missing names (9)

  • tests/test_study_params_eeglab_tests.py::test_reference_pop_dipparams[eeglab_sample_study0]
  • tests/test_study_params_eeglab_tests.py::test_reference_pop_erpimparams[eeglab_sample_study0]
  • tests/test_study_params_eeglab_tests.py::test_reference_pop_erpparams[eeglab_sample_study0]
  • tests/test_study_params_eeglab_tests.py::test_reference_pop_erspparams[eeglab_sample_study0]
  • tests/test_study_params_eeglab_tests.py::test_reference_pop_specparams[eeglab_sample_study0]
  • tests/test_study_params_eeglab_tests.py::test_reference_pop_statparams[eeglab_sample_study0]
  • tests/test_study_workflows_eeglab_tests.py::test_reference_pop_clust[eeglab_sample_study0]
  • tests/test_study_workflows_eeglab_tests.py::test_reference_std_makedesign[eeglab_sample_study0]
  • tests/test_study_workflows_eeglab_tests.py::test_reference_std_selectdesign[eeglab_sample_study0]

numeric/index (11)

  • tests/test_eeg_lat2point.py::test_eeg_lat2point_current_suite_cell_epoch_case
  • tests/test_eeg_lat2point.py::test_eeg_lat2point_current_suite_cell_latency_case
  • tests/test_eeg_lat2point.py::test_eeg_lat2point_current_suite_clamps_out_of_range_latency
  • tests/test_eeg_lat2point.py::test_eeg_lat2point_current_suite_default_time_unit
  • tests/test_eeg_lat2point.py::test_eeg_lat2point_current_suite_general_case
  • tests/test_eeg_lat2point.py::test_eeg_lat2point_current_suite_single_epoch_broadcast
  • tests/test_eeg_retrieve.py::test_reference_eeg_retrieve_original_general_case
  • tests/test_misc_data_event_eeglab_tests.py::test_reference_rmart
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_gauss
  • tests/test_pop_adjustevents.py::test_reference_adjustevents_continuous
  • tests/test_pop_adjustevents.py::test_reference_adjustevents_epoched

Remaining (#430) markers on this branch (166):

input adapters (20)

  • tests/test_eeg_interp.py::test_reference_interp_original_methods_and_shuffled_montage
  • tests/test_eeg_options.py::test_reference_eeg_readoptions_backup
  • tests/test_eegh.py::test_reference_eegh_add_multiple_history
  • tests/test_eegh.py::test_reference_eegh_add_multiple_history_default_empty
  • tests/test_finputcheck.py::test_reference_finputcheck_original_regression_fixture
  • tests/test_gethelpvar.py::test_reference_gethelpvar_no_var
  • tests/test_gethelpvar.py::test_reference_gethelpvar_some
  • tests/test_legacy_signal_io_eeglab_tests.py::test_upstream_readneurodat_original_file
  • tests/test_misc_data_event_eeglab_tests.py::test_reference_biosig_all_fields
  • tests/test_misc_data_event_eeglab_tests.py::test_reference_biosig_partial_fields
  • tests/test_phase2_file_channel_location.py::test_reference_pop_chancenter_nine_recorded_location_calls
  • tests/test_pop_interp.py::test_reference_pop_interp_original_locations_and_recording
  • tests/test_pop_reref.py::test_reference_pop_reref_original_bugzilla_270_input
  • tests/test_pop_reref.py::test_reference_reref
  • tests/test_pop_resample_python.py::test_reference_pop_resample_original_half_sample_boundary_workflow
  • tests/test_popfunc_dataset_eeglab_tests.py::test_reference_chanedit_original_locations
  • tests/test_popfunc_dataset_eeglab_tests.py::test_reference_importevent_original_named_workspace_variables
  • tests/test_popfunc_dataset_eeglab_tests.py::test_reference_mergeset_all_eight_recorded_data_calls
  • tests/test_popfunc_dataset_eeglab_tests.py::test_reference_selectevent_original_overlapping_epoch_workflow
  • tests/test_epoch.py::test_reference_epoch_original_five_output_contracts(case='no_srate')

output transport (104)

  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_clear
  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_explicit_pairs
  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_fiducials
  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_invalid_fiducials
  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_labels
  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_none
  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_pair
  • tests/test_binary_eeglab_tests.py::test_upstream_chancoresp_unpair
  • tests/test_core_event_eeglab_tests.py::test_reference_getchanlist_no_match
  • tests/test_core_event_eeglab_tests.py::test_reference_getepochevent_default_latency
  • tests/test_core_event_eeglab_tests.py::test_reference_getepochevent_default_time_window
  • tests/test_core_event_eeglab_tests.py::test_reference_getepochevent_duration_old_and_new_calls
  • tests/test_core_event_eeglab_tests.py::test_reference_getepochevent_four_argument_window
  • tests/test_core_event_eeglab_tests.py::test_reference_getepochevent_without_epoch_field
  • tests/test_core_event_eeglab_tests.py::test_reference_matchchans_original_complete_locations
  • tests/test_core_event_eeglab_tests.py::test_reference_mergechan_uses_original_montages
  • tests/test_core_event_eeglab_tests.py::test_reference_mergelocs_uses_original_montages
  • tests/test_core_event_eeglab_tests.py::test_reference_urlatency_boundary_durations
  • tests/test_eeg_retrieve.py::test_reference_eeg_retrieve_original_multiple_case
  • tests/test_eeg_store.py::test_reference_eeg_store_original_general_case
  • tests/test_eeg_store.py::test_reference_eeg_store_original_multiple_case
  • tests/test_eeg_store.py::test_reference_eeg_store_original_multiple_new_case
  • tests/test_eeg_store.py::test_reference_eeg_store_original_new_case
  • tests/test_phase1b_file_edit_pop_functions.py::test_reference_selectevent_dataset_array
  • tests/test_phase1b_file_edit_pop_functions.py::test_reference_selectevent_delete_unselected_events
  • tests/test_phase1b_file_edit_pop_functions.py::test_reference_selectevent_inverse_epochs
  • tests/test_phase1b_file_edit_pop_functions.py::test_reference_selectevent_retains_matching_epochs
  • tests/test_phase2_file_channel_location.py::test_reference_convertlocs_cart2all
  • tests/test_phase2_file_channel_location.py::test_reference_readeetraklocs_original_file
  • tests/test_phase2_file_channel_location.py::test_reference_readegilocs_all_original_channel_counts
  • tests/test_popfunc_dataset_eeglab_tests.py::test_reference_newset_original_eight_datasets_and_saved_files
  • tests/test_sigprocfunc_numerical_eeglab_tests.py::test_reference_mattocell
  • tests/test_bdf_records_eeglab_tests.py::test_upstream_readbdf_original_record_selection
  • tests/test_cart2topo.py::test_reference_cart2topo_original_coordinate_matrices
  • tests/test_core_event_eeglab_tests.py::test_reference_getchanlist_case_insensitive_type
  • tests/test_core_event_eeglab_tests.py::test_reference_getchanlist_default_all_channels
  • tests/test_core_event_eeglab_tests.py::test_reference_getchanlist_multiple_types_and_missing_type
  • tests/test_core_event_eeglab_tests.py::test_reference_urlatency_missing_duration
  • tests/test_eeg_ms2f.py::test_reference_eeg_ms2f_original_dataset_and_latencies
  • tests/test_getkeyval.py::test_reference_getkeyval_original_presence_cases
  • tests/test_legacy_signal_io_eeglab_tests.py::test_reference_movav
  • tests/test_legacy_signal_io_eeglab_tests.py::test_reference_parsetxt
  • tests/test_legacy_signal_io_eeglab_tests.py::test_upstream_loadtxt_force
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_covary
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_datlim
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_hungarian
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_nan_std
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_pcsquash
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_perminv
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_uniquef
  • tests/test_numdim.py::test_reference_numdim
  • tests/test_phase2_file_channel_location.py::test_reference_chancenter_2d
  • tests/test_phase2_file_channel_location.py::test_reference_chancenter_all_negative
  • tests/test_phase2_file_channel_location.py::test_reference_chancenter_optimize
  • tests/test_phase2_file_channel_location.py::test_reference_chancenter_scalar
  • tests/test_phase2_file_channel_location.py::test_reference_chancenter_zero_radius
  • tests/test_phase4_timefreq_statistics.py::test_reference_angtimewarp
  • tests/test_phase7_long_tail_helpers.py::test_reference_eegthresh
  • tests/test_phase7_long_tail_helpers.py::test_reference_eegthresh_all_rejected
  • tests/test_phase7_long_tail_helpers.py::test_reference_eegthresh_none_rejected
  • tests/test_phase7_long_tail_helpers.py::test_reference_eegthresh_one_electrode
  • tests/test_phase7_long_tail_helpers.py::test_reference_entropy_rej_vectors
  • tests/test_phase7_long_tail_helpers.py::test_reference_kurt
  • tests/test_phase7_long_tail_helpers.py::test_reference_realproba
  • tests/test_rejection_workflows.py::test_reference_rejsuperpose_all
  • tests/test_rejection_workflows.py::test_reference_rejsuperpose_all_ica
  • tests/test_rejection_workflows.py::test_reference_rejsuperpose_empty
  • tests/test_rejection_workflows.py::test_reference_rejsuperpose_general
  • tests/test_rejection_workflows.py::test_reference_rejsuperpose_zero
  • tests/test_sigproc_eegrej.py::test_reference_eegrej_explicit_and_omitted_events
  • tests/test_sigproc_eegrej.py::test_reference_eegrej_overlapping_regions
  • tests/test_sigprocfunc_ica_legacy_eeglab_tests.py::test_reference_kmeanscluster
  • tests/test_sigprocfunc_numerical_eeglab_tests.py::test_reference_matsel
  • tests/test_sigprocfunc_numerical_eeglab_tests.py::test_reference_nan_mean
  • tests/test_sigprocfunc_numerical_eeglab_tests.py::test_reference_quantile
  • tests/test_statistics_package.py::test_reference_concatdata_original_arrays
  • tests/test_eeg_retrieve.py::test_reference_eeg_retrieve_original_general_case
  • tests/test_bdf_records_eeglab_tests.py::test_upstream_openbdf_original_channel_types
  • tests/test_bdf_records_eeglab_tests.py::test_upstream_openbdf_original_general_header
  • tests/test_bdf_records_eeglab_tests.py::test_upstream_openbdf_original_invalid_digital_limits
  • tests/test_bdf_records_eeglab_tests.py::test_upstream_openbdf_original_invalid_physical_limits
  • tests/test_bdf_records_eeglab_tests.py::test_upstream_openbdf_original_reversed_digital_limits
  • tests/test_bdf_records_eeglab_tests.py::test_upstream_openbdf_original_reversed_physical_limits
  • tests/test_miscfunc_decomposition_eeglab_tests.py::test_reference_varsort
  • tests/test_miscfunc_decomposition_eeglab_tests.py::test_reference_zica
  • tests/test_phase2_file_channel_location.py::test_reference_pop_chancenter_empty_center
  • tests/test_phase2_file_channel_location.py::test_reference_pop_chancenter_no_omitchans
  • tests/test_phase2_file_channel_location.py::test_reference_pop_chancenter_with_omitchans
  • tests/test_phase2_file_channel_location.py::test_reference_readelp_five_outputs
  • tests/test_pop_comments.py::test_reference_comments_concatenation
  • tests/test_pop_comments.py::test_reference_comments_replacement
  • tests/test_pop_rmbase.py::test_reference_pop_rmbase_original_baselines_and_complete_commands
  • tests/test_pop_rmbase.py::test_reference_rmbase
  • tests/test_rejection_workflows.py::test_reference_pop_rejchan
  • tests/test_rejection_workflows.py::test_reference_pop_rejtrend
  • tests/test_popfunc_dataset_eeglab_tests.py::test_reference_importevent_original_text_file
  • tests/test_finputcheck.py::test_reference_finputcheck_original_wrapper_cases
  • tests/test_eegplot.py::test_reference_eegplot2trial_original_marks(source='general')
  • tests/test_eegplot.py::test_reference_eegplot2trial_original_marks(source='multiple')
  • tests/test_eegplot.py::test_reference_eegplot2trial_original_marks(source='multiple_color')
  • tests/test_eegplot.py::test_reference_eegplot2trial_original_marks(source='multiple_colorin')
  • tests/test_eegplot.py::test_reference_eegplot2trial_original_marks(source='multiple_colorout')
  • tests/test_sigprocfunc_plotting_eeglab_tests.py::test_reference_forcelocs_complete_original_coordinates(source='x')
  • tests/test_sigprocfunc_plotting_eeglab_tests.py::test_reference_forcelocs_complete_original_coordinates(source='y')

API contracts (23)

  • tests/test_phase1b_file_edit_pop_functions.py::test_reference_copyset_original_set_out
  • tests/test_pop_delset.py::test_reference_delset_original_datasets
  • tests/test_pop_editeventfield_current.py::test_reference_add_field_file
  • tests/test_pop_editeventfield_current.py::test_reference_add_field_file_indices
  • tests/test_pop_editeventfield_current.py::test_reference_add_field_vector
  • tests/test_pop_editeventfield_current.py::test_reference_delimiters
  • tests/test_pop_editeventfield_current.py::test_reference_delold_invalid
  • tests/test_pop_editeventfield_current.py::test_reference_delold_yes
  • tests/test_pop_editeventfield_current.py::test_reference_description_missing_field
  • tests/test_pop_editeventfield_current.py::test_reference_field_description
  • tests/test_pop_editeventfield_current.py::test_reference_invalid_rename
  • tests/test_pop_editeventfield_current.py::test_reference_latency_timeunit
  • tests/test_pop_editeventfield_current.py::test_reference_modify_field
  • tests/test_pop_editeventfield_current.py::test_reference_modify_field_indices
  • tests/test_pop_editeventfield_current.py::test_reference_remove_missing_field
  • tests/test_pop_editeventfield_current.py::test_reference_rename_field
  • tests/test_pop_editeventfield_current.py::test_reference_rename_missing_field
  • tests/test_pop_editeventfield_current.py::test_reference_skip_lines
  • tests/test_sample_data_pop_functions.py::test_reference_expica_original_recording_and_ascii_outputs
  • tests/test_epoch.py::test_reference_epoch_original_five_output_contracts(case='general')
  • tests/test_epoch.py::test_reference_epoch_original_five_output_contracts(case='boundary')
  • tests/test_epoch.py::test_reference_epoch_original_five_output_contracts(case='valuelim')
  • tests/test_epoch.py::test_reference_epoch_original_five_output_contracts(case='allevents')

mmo/MemmapData (0)

STUDY load and missing names (9)

  • tests/test_study_params_eeglab_tests.py::test_reference_pop_dipparams[eeglab_sample_study0]
  • tests/test_study_params_eeglab_tests.py::test_reference_pop_erpimparams[eeglab_sample_study0]
  • tests/test_study_params_eeglab_tests.py::test_reference_pop_erpparams[eeglab_sample_study0]
  • tests/test_study_params_eeglab_tests.py::test_reference_pop_erspparams[eeglab_sample_study0]
  • tests/test_study_params_eeglab_tests.py::test_reference_pop_specparams[eeglab_sample_study0]
  • tests/test_study_params_eeglab_tests.py::test_reference_pop_statparams[eeglab_sample_study0]
  • tests/test_study_workflows_eeglab_tests.py::test_reference_pop_clust[eeglab_sample_study0]
  • tests/test_study_workflows_eeglab_tests.py::test_reference_std_makedesign[eeglab_sample_study0]
  • tests/test_study_workflows_eeglab_tests.py::test_reference_std_selectdesign[eeglab_sample_study0]

numeric/index (10)

  • tests/test_eeg_lat2point.py::test_eeg_lat2point_current_suite_cell_epoch_case
  • tests/test_eeg_lat2point.py::test_eeg_lat2point_current_suite_cell_latency_case
  • tests/test_eeg_lat2point.py::test_eeg_lat2point_current_suite_clamps_out_of_range_latency
  • tests/test_eeg_lat2point.py::test_eeg_lat2point_current_suite_default_time_unit
  • tests/test_eeg_lat2point.py::test_eeg_lat2point_current_suite_general_case
  • tests/test_eeg_lat2point.py::test_eeg_lat2point_current_suite_single_epoch_broadcast
  • tests/test_misc_data_event_eeglab_tests.py::test_reference_rmart
  • tests/test_miscfunc_numerical_eeglab_tests.py::test_reference_gauss
  • tests/test_pop_adjustevents.py::test_reference_adjustevents_continuous
  • tests/test_pop_adjustevents.py::test_reference_adjustevents_epoched
Open in Web Open in Cursor 

EEGPrep functions used by the EEGLAB-ported tests now take structured
arrays, cells, empty arrays, and whole-number doubles used as counts or
1-based indices. Strict (#430) markers stay only where the test still fails.

Co-authored-by: Suraj Ranganath <[email protected]>

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

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.

@cursor

cursor Bot commented Nov 18, 2026

Copy link
Copy Markdown

🤖 Problem: MATLAB structs, cells, empty arrays, and 1-by-1 doubles reach EEGPrep as NumPy structured arrays, object arrays, and floats, and the functions raise before they compute.

Approach: src/eegprep/functions/miscfunc/matlab_inputs.py interprets those shapes at the function boundary (is_matlab_empty, matlab_true, matlab_ints, scalar_index, cell_items, struct_records, as_dataset_list). Call sites use it. Return values stay Python scalars, lists, and dicts, so a test that only failed on the input now fails on shape or output count and is reclassified. Strict markers are removed only when the test passes.

Tests: Python backend lane on this branch, 470 passed, 166 xfailed, 0 xpassed. Default suite with MATLAB skipped, 3247 passed, 0 failed. The MATLAB reference suite was not run.

@claude

claude Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @suraj-ranganath's task in 2m 19s —— View job


Code review

  • Overall assessment: Needs changes. One finding is important: eeg_store drops MATLAB-shaped dataset indices without error, so datasets land in the wrong slot. The rest of the adapter work looks sound. I checked matlab_inputs (truth, empty, integer, cell, and struct handling), every changed call site, the CURRENTSET/history paths, pop_select 0-based indices, the clean_artifacts "off" handling, and the xfail-marker bookkeeping.
  • Highest-risk area: storing and retrieving datasets (eeg_store / pop_copyset). A wrong slot changes ALLEEG/CURRENTSET that the GUI and console share.
  • Merge recommendation: Needs changes.

Blocking

None. As the PR body says, the MATLAB reference suite still has to be run before merge, because core functions changed.

Important

  • eeg_store ignores a whole-number float or array storeSetIndex, and it ignores a scalar index when EEG is a 1×1 struct array (src/eegprep/functions/adminfunc/eeg_store.py L52 and L64, inline).
    • isinstance(storeSetIndex, int) is false for 3.0, np.int64(3) and np.array([[3.0]]). So eeg_store([], EEG, 3.0) stores at slot 1 and returns 1, where MATLAB uses slot 3.
    • The new _datasets_or_one turns a 1×1 struct into a one-item list. The list branch then replaces the scalar index with [None]. That input used to raise an error and is now stored in the wrong slot.
    • Why it matters: the PR says whole-number doubles are accepted as 1-based indices, and eeg_retrieve already does this with _normalize_requested_index. eeg_store is the only index path left out.
    • Fix: normalize storeSetIndex with matlab_ints/scalar_index before the list and scalar branches, and pair a 1-dataset struct with its single index.

Nits

  • as_dataset_list returns the same value from its list/tuple branch and from the fallthrough, so that branch can go (inline).

Test gaps

  • tests/test_eeg_store.py: add eeg_store([], EEG, 3.0) and eeg_store([], EEG, np.array([[3.0]])), each asserting index == 3 and len(ALLEEG) == 3. The fix above should make them pass.
  • tests/test_console_workspace.py: ConsoleEegh.__call__ now treats an empty array as "clear LASTCOM" and unwraps a 1×1 array to an integer history operation (console.py L338-L344). Nothing covers either path. AGENTS.md requires console coverage "when namespace sync, history, … can be affected". The standalone eegh(np.array([])) goes the other way and renders the history (eegh.py _coerce_command → None). A console test should pin down which behaviour is intended, so the two don't drift silently.

EEGLAB parity notes

  • The vendored src/eegprep/eeglab/ checkout isn't in this CI workspace, so I couldn't compare eegh.m's empty-command branch line by line. Please confirm that eegh([]) should clear LASTCOM in the console but render history in the standalone function.

Comment on lines +166 to +168
if isinstance(value, (list, tuple)):
return list(value)
return list(value)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the list/tuple branch returns the same thing as the fallthrough, so it can go.

Suggested change
if isinstance(value, (list, tuple)):
return list(value)
return list(value)
return list(value)

Comment on lines +49 to 50
EEG = _datasets_or_one(EEG)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important (correctness): storeSetIndex doesn't go through the new adapter, so a MATLAB-shaped index is dropped without any error and the dataset lands in the wrong slot.

  • Single dataset (L64): isinstance(storeSetIndex, int) is false for 3.0, np.int64(3) and np.array([[3.0]]). All three fall back to _normalize_index(None, ...), so eeg_store([], EEG, 3.0) stores at slot 1 and returns 1. MATLAB stores at slot 3.
  • Struct EEG (L52): _datasets_or_one turns a 1×1 struct array into a one-item list. The list branch then replaces any non-list index with [None], so eeg_store(ALLEEG, EEG_struct_1x1, 3) also ignores the 3. This is new in this PR: that input used to fail loudly in eeg_checkset, and now it is quietly misplaced.

The PR says whole-number doubles are accepted as 1-based indices. eeg_retrieve already handles this with _normalize_requested_index, but eeg_store doesn't.

Suggested fix: normalize storeSetIndex once here with matlab_ints/scalar_index, the same way eeg_retrieve does. Use a scalar when there is one index and a list otherwise. Pair a length-1 index list with a 1-dataset struct array (or unwrap the 1×1 struct to a dict). Check isinstance(storeSetIndex, (list, tuple)) only after that normalization. Add eeg_store([], EEG, 3.0) → index == 3, len(ALLEEG) == 3 to tests/test_eeg_store.py.

cursoragent and others added 3 commits November 18, 2026 19:24
eeg_store treated 3.0, a 1-by-1 index array, and a 1-by-1 struct dataset
as "no index" and wrote the dataset into the first empty slot.

Co-authored-by: Suraj Ranganath <[email protected]>
Keep both changelog bullets. Drop the STUDY load xfails that #653 made
pass, and keep the three design-cell failures from that branch.

Co-authored-by: Suraj Ranganath <[email protected]>
Keep the adapter changelog bullet together with the ASR fit-width and
pop_loadstudy bullets. The clean_channels and ASR changes come from develop.

Co-authored-by: Suraj Ranganath <[email protected]>
@suraj-ranganath
suraj-ranganath merged commit f4ac317 into develop Nov 19, 2026
12 checks passed
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.

2 participants