Skip to content

Commit ed08590

Browse files
committed
Also handle multiple skip at start. Small simplification.
1 parent e544026 commit ed08590

1 file changed

Lines changed: 7 additions & 15 deletions

File tree

mne/io/fiff/raw.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ def _read_raw_file(
231231
nchan = int(info["nchan"])
232232
first = 0
233233
first_samp = 0
234-
first_skip = 0
235234

236235
# Get first sample tag if it is there
237236
if directory[first].kind == FIFF.FIFF_FIRST_SAMPLE:
@@ -240,14 +239,6 @@ def _read_raw_file(
240239
first += 1
241240
_check_entry(first, nent)
242241

243-
# Omit initial skip
244-
if directory[first].kind == FIFF.FIFF_DATA_SKIP:
245-
# This first skip can be applied only after we know the bufsize
246-
tag = read_tag(fid, directory[first].pos)
247-
first_skip = int(tag.data.item())
248-
first += 1
249-
_check_entry(first, nent)
250-
251242
raw = _RawShell()
252243
raw.first_samp = first_samp
253244
if info["meas_date"] is None and annotations is not None:
@@ -283,6 +274,7 @@ def _read_raw_file(
283274

284275
nskip = 0
285276
nskip_in_samples = 0
277+
first_data_buffer = True
286278
for k in range(first, nent):
287279
ent = directory[k]
288280
# There can be skips in the data (e.g., if the user unclicked)
@@ -299,12 +291,6 @@ def _read_raw_file(
299291
if orig_format is None:
300292
orig_format = _orig_format_dict[ent.type]
301293

302-
# Do we have an initial skip pending?
303-
if first_skip > 0:
304-
first_samp += nsamp * first_skip
305-
raw.first_samp = first_samp
306-
first_skip = 0
307-
308294
# Do we have a skip pending?
309295
if nskip > 0:
310296
nskip_in_samples += nskip * nsamp
@@ -322,6 +308,12 @@ def _read_raw_file(
322308
first_samp += nskip_in_samples
323309
nskip_in_samples = 0
324310

311+
# Handle an initial skip.
312+
313+
if first_data_buffer:
314+
raw.first_samp = first_samp
315+
first_data_buffer = False
316+
325317
# Add a data buffer
326318
raw_extras.append(
327319
dict(

0 commit comments

Comments
 (0)