Skip to content

Commit ec77e7c

Browse files
authored
remove some ._filenames uses in favor of .filenames (#12996)
1 parent 0e09163 commit ec77e7c

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

mne/io/ant/ant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def _read_segment_file(self, data, idx, fi, start, stop, cals, mult):
191191
i_start = max(start, first_samp)
192192
i_stop = min(stop, this_n_times + first_samp)
193193
# read and scale data array
194-
cnt = read_cnt(self._filenames[fi])
194+
cnt = read_cnt(self.filenames[fi])
195195
one = read_data(cnt, i_start, i_stop)
196196
_scale_data(one, ch_units)
197197
data_view = data[:, i_start - start : i_stop - start]

mne/io/kit/kit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def __init__(
404404
)
405405
kit_info.update(input_fname=input_fname)
406406
self._raw_extras = [kit_info]
407-
self._filenames = []
407+
self.filenames = []
408408
if len(events) != self._raw_extras[0]["n_epochs"]:
409409
raise ValueError("Event list does not match number of epochs.")
410410

mne/io/snirf/_snirf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ def _read_segment_file(self, data, idx, fi, start, stop, cals, mult):
492492
"""Read a segment of data from a file."""
493493
import h5py
494494

495-
with h5py.File(self._filenames[0], "r") as dat:
495+
with h5py.File(self.filenames[0], "r") as dat:
496496
one = dat["/nirs/data1/dataTimeSeries"][start:stop].T
497497

498498
_mult_cal_one(data, one, idx, cals, mult)

mne/io/tests/test_raw.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,12 +543,12 @@ def _test_raw_crop(reader, t_prop, kwargs):
543543
raw_2, raw_3 = raw_1.copy(), raw_1.copy()
544544
t_tot = raw_1.times[-1] * 3 + 2.0 / raw_1.info["sfreq"]
545545
raw_concat = concatenate_raws([raw_1, raw_2, raw_3])
546-
assert len(raw_concat._filenames) == 3
546+
assert len(raw_concat.filenames) == 3
547547
assert_allclose(raw_concat.times[-1], t_tot)
548548
assert_allclose(raw_concat.first_time, first_time)
549549
# keep all instances, but crop to t_start at the beginning
550550
raw_concat.crop(t_start, None)
551-
assert len(raw_concat._filenames) == 3
551+
assert len(raw_concat.filenames) == 3
552552
assert_allclose(raw_concat.times[-1], t_tot - t_start, atol=atol)
553553
assert_allclose(
554554
raw_concat.first_time,
@@ -558,7 +558,7 @@ def _test_raw_crop(reader, t_prop, kwargs):
558558
)
559559
# drop the first instance
560560
raw_concat.crop(crop_t, None)
561-
assert len(raw_concat._filenames) == 2
561+
assert len(raw_concat.filenames) == 2
562562
assert_allclose(raw_concat.times[-1], t_tot - t_start - crop_t, atol=atol)
563563
assert_allclose(
564564
raw_concat.first_time,
@@ -568,7 +568,7 @@ def _test_raw_crop(reader, t_prop, kwargs):
568568
)
569569
# drop the second instance, leaving just one
570570
raw_concat.crop(crop_t, None)
571-
assert len(raw_concat._filenames) == 1
571+
assert len(raw_concat.filenames) == 1
572572
assert_allclose(raw_concat.times[-1], t_tot - t_start - 2 * crop_t, atol=atol)
573573
assert_allclose(
574574
raw_concat.first_time,

mne/preprocessing/ica.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,7 @@ def _sources_as_raw(self, raw, add_channels, start, stop):
12971297
out._data = data_
12981298
out._first_samps = [out.first_samp]
12991299
out._last_samps = [out.last_samp]
1300-
out._filenames = [None]
1300+
out.filenames = [None]
13011301
out.preload = True
13021302
out._projector = None
13031303
self._export_info(out.info, raw, add_channels)

mne/preprocessing/tests/test_ica.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ def test_ica_core(method, n_components, noise_cov, n_pca_components, browser_bac
525525

526526
raw_sources = ica.get_sources(raw)
527527
# test for #3804
528-
assert_equal(raw_sources._filenames, [None])
528+
assert_equal(raw_sources.filenames, (None,))
529529
print(raw_sources)
530530

531531
# test for gh-6271 (scaling of ICA traces)
@@ -973,7 +973,7 @@ def f(x, y):
973973
assert ica_raw.n_times == 100
974974
assert ica_raw.last_samp - ica_raw.first_samp + 1 == 100
975975
assert ica_raw._data.shape[1] == 100
976-
assert_equal(len(ica_raw._filenames), 1) # API consistency
976+
assert_equal(len(ica_raw.filenames), 1) # API consistency
977977
ica_chans = [ch for ch in ica_raw.ch_names if "ICA" in ch]
978978
assert ica.n_components_ == len(ica_chans)
979979
test_ica_fname = Path.cwd() / "test-ica_raw.fif"

mne/viz/raw.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def plot_raw(
336336
# generate window title; allow instances without a filename (e.g., ICA)
337337
if title is None:
338338
title = "<unknown>"
339-
fnames = raw._filenames.copy() # use the private attribute to get a list
339+
fnames = list(tuple(raw.filenames)) # get a list of a copy of the filenames
340340
if len(fnames):
341341
title = fnames.pop(0)
342342
extra = f" ... (+ {len(fnames)} more)" if len(fnames) else ""

0 commit comments

Comments
 (0)