@@ -3021,44 +3021,6 @@ def test_equalize_epoch_counts_random():
30213021 assert len (epochs_1 ) == len (epochs_2 )
30223022
30233023
3024- @pytest .mark .parametrize (
3025- "api, legacy, want" ,
3026- (
3027- ("counts" , True , ([], [3 , 4 ], [0 , 3 , 4 ])),
3028- ("counts" , False , ([], [1 , 2 ], [0 , 1 , 2 ])),
3029- ("events" , True , [6 , 7 , 8 , 11 , 12 ]),
3030- ("events" , False , [4 , 5 , 8 , 9 , 10 ]),
3031- ),
3032- )
3033- def test_equalize_epoch_counts_rng_streams (api , legacy , want ):
3034- """Test legacy integers re-seed while new RNG streams advance."""
3035- info = create_info (["EEG 001" ], 100.0 , "eeg" )
3036- epochs = [
3037- EpochsArray (
3038- np .zeros ((length , 1 , 1 )),
3039- info ,
3040- events = np .column_stack (
3041- (np .arange (length ), np .zeros (length , int ), np .full (length , code ))
3042- ),
3043- event_id = {str (code ): code },
3044- verbose = False ,
3045- )
3046- for code , length in enumerate ((3 , 5 , 6 ), 1 )
3047- ]
3048- kwargs = {"random_state" if legacy else "rng" : 0 }
3049- if api == "counts" :
3050- equalize_epoch_counts (epochs , method = "random" , ** kwargs )
3051- got = [
3052- np .flatnonzero ([entry == ("EQUALIZED_COUNT" ,) for entry in epoch .drop_log ])
3053- for epoch in epochs
3054- ]
3055- else :
3056- epochs = concatenate_epochs (epochs )
3057- _ , got = epochs .equalize_event_counts (method = "random" , ** kwargs )
3058- for this_got , expected in zip (got , want , strict = True ):
3059- assert_array_equal (this_got , expected )
3060-
3061-
30623024def test_access_by_name (tmp_path ):
30633025 """Test accessing epochs by event name and on_missing for rare events."""
30643026 raw , events , picks = _get_data ()
0 commit comments