@@ -75,46 +75,25 @@ def test_with_location(self):
7575 assert any (have_location )
7676
7777 def test_sync (self ):
78- rawio_with_sync = SpikeGLXRawIO (self .get_local_path ("spikeglx/NP2_with_sync" ), load_sync_channel = True )
79- rawio_with_sync .parse_header ()
80- stream_index = list (rawio_with_sync .header ["signal_streams" ]["name" ]).index ("imec0.ap" )
81-
82- # AP stream has 385 channels
83- chunk = rawio_with_sync .get_analogsignal_chunk (
84- block_index = 0 , seg_index = 0 , i_start = 0 , i_stop = 100 , stream_index = stream_index
85- )
86- assert chunk .shape [1 ] == 385
87-
88- rawio_no_sync = SpikeGLXRawIO (self .get_local_path ("spikeglx/NP2_with_sync" ), load_sync_channel = False )
89- rawio_no_sync .parse_header ()
78+ # The sync trace is always split off into its own -SYNC stream; the parent
79+ # AP stream has 384 channels (384 neural channels, SY0 excluded).
80+ rawio = SpikeGLXRawIO (self .get_local_path ("spikeglx/NP2_with_sync" ))
81+ rawio .parse_header ()
82+ stream_index = list (rawio .header ["signal_streams" ]["name" ]).index ("imec0.ap" )
9083
91- # AP stream has 384 channels
92- chunk = rawio_no_sync .get_analogsignal_chunk (
84+ chunk = rawio .get_analogsignal_chunk (
9385 block_index = 0 , seg_index = 0 , i_start = 0 , i_stop = 100 , stream_index = stream_index
9486 )
9587 assert chunk .shape [1 ] == 384
9688
97- def test_no_sync (self ):
98- # requesting sync channel when there is none raises an error
99- with self .assertRaises (ValueError ):
100- rawio_no_sync = SpikeGLXRawIO (self .get_local_path ("spikeglx/NP2_no_sync" ), load_sync_channel = True )
101- rawio_no_sync .parse_header ()
102-
10389 def test_subset_with_sync (self ):
104- rawio_sub = SpikeGLXRawIO (self .get_local_path ("spikeglx/NP2_subset_with_sync" ), load_sync_channel = True )
105- rawio_sub .parse_header ()
106- stream_index = list (rawio_sub .header ["signal_streams" ]["name" ]).index ("imec0.ap" )
107-
108- # AP stream has 121 channels
109- chunk = rawio_sub .get_analogsignal_chunk (
110- block_index = 0 , seg_index = 0 , i_start = 0 , i_stop = 100 , stream_index = stream_index
111- )
112- assert chunk .shape [1 ] == 121
90+ # Channel-subset recording with SY: 121 saved channels total, 120 neural plus
91+ # one SY that is split into the -SYNC stream, leaving 120 in the parent.
92+ rawio = SpikeGLXRawIO (self .get_local_path ("spikeglx/NP2_subset_with_sync" ))
93+ rawio .parse_header ()
94+ stream_index = list (rawio .header ["signal_streams" ]["name" ]).index ("imec0.ap" )
11395
114- rawio_sub_no_sync = SpikeGLXRawIO (self .get_local_path ("spikeglx/NP2_subset_with_sync" ), load_sync_channel = False )
115- rawio_sub_no_sync .parse_header ()
116- # AP stream has 120 channels
117- chunk = rawio_sub_no_sync .get_analogsignal_chunk (
96+ chunk = rawio .get_analogsignal_chunk (
11897 block_index = 0 , seg_index = 0 , i_start = 0 , i_stop = 100 , stream_index = stream_index
11998 )
12099 assert chunk .shape [1 ] == 120
@@ -135,32 +114,13 @@ def test_nidq_digital_channel(self):
135114 assert np .allclose (on_diff , 1 , atol = atol )
136115
137116 def test_sync_channel_as_separate_stream (self ):
138- """Test that sync channel is added as its own stream when load_sync_channel=False."""
139- import warnings
140-
141- # Test with load_sync_channel=False (default)
142- rawio_no_sync = SpikeGLXRawIO (self .get_local_path ("spikeglx/NP2_with_sync" ), load_sync_channel = False )
143- rawio_no_sync .parse_header ()
144-
145- # Get stream names
146- stream_names = rawio_no_sync .header ["signal_streams" ]["name" ].tolist ()
147-
148- # Check if there's a sync channel stream (should contain "SY0" or "SYNC" in the name)
149- sync_streams = [name for name in stream_names if "SY0" in name or "SYNC" in name ]
150- assert len (sync_streams ) > 0 , "No sync channel stream found when load_sync_channel=False"
151-
152- # Test deprecation warning when load_sync_channel=True
153- with warnings .catch_warnings (record = True ) as w :
154- warnings .simplefilter ("always" )
155- rawio_with_sync = SpikeGLXRawIO (self .get_local_path ("spikeglx/NP2_with_sync" ), load_sync_channel = True )
156-
157- # Check if deprecation warning was raised
158- assert any (
159- issubclass (warning .category , DeprecationWarning ) for warning in w
160- ), "No deprecation warning raised"
161- assert any (
162- "will be removed in version 0.15" in str (warning .message ) for warning in w
163- ), "Deprecation warning message is incorrect"
117+ """Sync trace is always exposed as its own -SYNC stream."""
118+ rawio = SpikeGLXRawIO (self .get_local_path ("spikeglx/NP2_with_sync" ))
119+ rawio .parse_header ()
120+
121+ stream_names = rawio .header ["signal_streams" ]["name" ].tolist ()
122+ sync_streams = [name for name in stream_names if "SYNC" in name ]
123+ assert len (sync_streams ) > 0 , "No -SYNC stream found"
164124
165125 def test_t_start_reading (self ):
166126 """Test that t_start values are correctly read for all streams and segments."""
0 commit comments