Skip to content

Commit ae79d0c

Browse files
committed
remove unneeded mne<1.1 checks, leftover from #1108
1 parent 43e46f0 commit ae79d0c

File tree

4 files changed

+17
-107
lines changed

4 files changed

+17
-107
lines changed

mne_bids/dig.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -558,14 +558,6 @@ def _read_dig_bids(electrodes_fpath, coordsystem_fpath,
558558
d['coord_frame'] = MNE_STR_TO_FRAME['unknown']
559559

560560

561-
# Remove once we depend on MNE-Python 1.0+
562-
def _get_montage(info):
563-
if hasattr(info, 'get_montage'):
564-
return info.get_montage()
565-
# workaround
566-
return mne.io.RawArray(np.zeros((info['nchan'], 1)), info).get_montage()
567-
568-
569561
@verbose
570562
def template_to_head(info, space, coord_frame='auto', unit='auto',
571563
verbose=None):
@@ -613,9 +605,7 @@ def template_to_head(info, space, coord_frame='auto', unit='auto',
613605
_check_option('coord_frame', coord_frame,
614606
('auto', 'mri', 'mri_voxel', 'ras'))
615607
_check_option('unit', unit, ('auto', 'm', 'mm'))
616-
# XXX: change to after 0.11 release
617-
# montage = info.get_montage()
618-
montage = _get_montage(info)
608+
montage = info.get_montage()
619609
if montage is None:
620610
raise RuntimeError('No montage found in the `raw` object')
621611
montage.remove_fiducials() # we will add fiducials so remove any

mne_bids/tests/test_write.py

Lines changed: 10 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,15 +1256,7 @@ def test_eegieeg(dir_name, fname, reader, _bids_validate, tmp_path):
12561256
'Converting to float32.'):
12571257
bids_output_path = write_raw_bids(**kwargs)
12581258
elif dir_name == 'EGI':
1259-
if check_version("mne", "1.1"):
1260-
bids_output_path = write_raw_bids(**kwargs)
1261-
else:
1262-
with pytest.warns(
1263-
RuntimeWarning,
1264-
match=r'Encountered data in "float" format. '
1265-
r'Converting to float32.'
1266-
):
1267-
bids_output_path = write_raw_bids(**kwargs)
1259+
bids_output_path = write_raw_bids(**kwargs)
12681260
else:
12691261
with pytest.warns(RuntimeWarning,
12701262
match='Encountered data in "double" format'):
@@ -1312,15 +1304,7 @@ def test_eegieeg(dir_name, fname, reader, _bids_validate, tmp_path):
13121304
'Converting to float32.'):
13131305
write_raw_bids(**kwargs)
13141306
elif dir_name == 'EGI':
1315-
if check_version("mne", "1.1"):
1316-
write_raw_bids(**kwargs)
1317-
else:
1318-
with pytest.warns(
1319-
RuntimeWarning,
1320-
match=r'Encountered data in "float" format. '
1321-
r'Converting to float32.'
1322-
):
1323-
write_raw_bids(**kwargs)
1307+
write_raw_bids(**kwargs)
13241308
else:
13251309
with pytest.warns(RuntimeWarning,
13261310
match='Encountered data in "double" format'):
@@ -1356,15 +1340,7 @@ def test_eegieeg(dir_name, fname, reader, _bids_validate, tmp_path):
13561340
'Converting to float32.'):
13571341
write_raw_bids(**kwargs)
13581342
elif dir_name == 'EGI':
1359-
if check_version("mne", "1.1"):
1360-
write_raw_bids(**kwargs)
1361-
else:
1362-
with pytest.warns(
1363-
RuntimeWarning,
1364-
match=r'Encountered data in "float" format. '
1365-
r'Converting to float32.'
1366-
):
1367-
write_raw_bids(**kwargs)
1343+
write_raw_bids(**kwargs)
13681344
else:
13691345
with pytest.warns(RuntimeWarning,
13701346
match='Encountered data in "double" format'):
@@ -1437,15 +1413,7 @@ def test_eegieeg(dir_name, fname, reader, _bids_validate, tmp_path):
14371413
'Converting to float32.'):
14381414
write_raw_bids(**kwargs)
14391415
elif dir_name == 'EGI':
1440-
if check_version("mne", "1.1"):
1441-
write_raw_bids(**kwargs)
1442-
else:
1443-
with pytest.warns(
1444-
RuntimeWarning,
1445-
match=r'Encountered data in "float" format. '
1446-
r'Converting to float32.'
1447-
):
1448-
write_raw_bids(**kwargs)
1416+
write_raw_bids(**kwargs)
14491417
else:
14501418
with pytest.warns(RuntimeWarning,
14511419
match='Encountered data in "double" format'):
@@ -1503,15 +1471,7 @@ def test_eegieeg(dir_name, fname, reader, _bids_validate, tmp_path):
15031471
'Converting to float32.'):
15041472
write_raw_bids(**kwargs)
15051473
elif dir_name == 'EGI':
1506-
if check_version("mne", "1.1"):
1507-
write_raw_bids(**kwargs)
1508-
else:
1509-
with pytest.warns(
1510-
RuntimeWarning,
1511-
match=r'Encountered data in "float" format. '
1512-
r'Converting to float32.'
1513-
):
1514-
write_raw_bids(**kwargs)
1474+
write_raw_bids(**kwargs)
15151475
else:
15161476
with pytest.warns(RuntimeWarning,
15171477
match='Encountered data in "short" format'):
@@ -1555,15 +1515,7 @@ def test_eegieeg(dir_name, fname, reader, _bids_validate, tmp_path):
15551515
'Converting to float32.'):
15561516
write_raw_bids(**kwargs)
15571517
elif dir_name == 'EGI':
1558-
if check_version("mne", "1.1"):
1559-
write_raw_bids(**kwargs)
1560-
else:
1561-
with pytest.warns(
1562-
RuntimeWarning,
1563-
match=r'Encountered data in "float" format. '
1564-
r'Converting to float32.'
1565-
):
1566-
write_raw_bids(**kwargs)
1518+
write_raw_bids(**kwargs)
15671519
else:
15681520
with pytest.warns(RuntimeWarning,
15691521
match='Encountered data in "double" format'):
@@ -1612,15 +1564,7 @@ def test_eegieeg(dir_name, fname, reader, _bids_validate, tmp_path):
16121564
'Converting to float32.'):
16131565
write_raw_bids(**kwargs)
16141566
elif dir_name == 'EGI':
1615-
if check_version("mne", "1.1"):
1616-
write_raw_bids(**kwargs)
1617-
else:
1618-
with pytest.warns(
1619-
RuntimeWarning,
1620-
match=r'Encountered data in "float" format. '
1621-
r'Converting to float32.'
1622-
):
1623-
write_raw_bids(**kwargs)
1567+
write_raw_bids(**kwargs)
16241568
else:
16251569
with pytest.warns(RuntimeWarning,
16261570
match='Encountered data in "double" format'):
@@ -1680,15 +1624,7 @@ def test_eegieeg(dir_name, fname, reader, _bids_validate, tmp_path):
16801624
'Converting to float32.'):
16811625
write_raw_bids(**kwargs)
16821626
elif dir_name == 'EGI':
1683-
if check_version("mne", "1.1"):
1684-
write_raw_bids(**kwargs)
1685-
else:
1686-
with pytest.warns(
1687-
RuntimeWarning,
1688-
match=r'Encountered data in "float" format. '
1689-
r'Converting to float32.'
1690-
):
1691-
write_raw_bids(**kwargs)
1627+
write_raw_bids(**kwargs)
16921628
else:
16931629
with pytest.warns(RuntimeWarning,
16941630
match='Encountered data in "double" format'):
@@ -1748,19 +1684,8 @@ def test_eegieeg(dir_name, fname, reader, _bids_validate, tmp_path):
17481684
write_raw_bids(**kwargs)
17491685
output_path = _test_anonymize(tmp_path / 'c', raw, bids_path)
17501686
elif dir_name == 'EGI':
1751-
if check_version("mne", "1.1"):
1752-
write_raw_bids(**kwargs)
1753-
output_path = _test_anonymize(tmp_path / 'd', raw, bids_path)
1754-
else:
1755-
with pytest.warns(
1756-
RuntimeWarning,
1757-
match=r'Encountered data in "float" format. '
1758-
r'Converting to float32.'
1759-
):
1760-
write_raw_bids(**kwargs)
1761-
output_path = _test_anonymize(
1762-
tmp_path / 'd', raw, bids_path
1763-
)
1687+
write_raw_bids(**kwargs)
1688+
output_path = _test_anonymize(tmp_path / 'd', raw, bids_path)
17641689
elif dir_name == 'curry':
17651690
with pytest.warns(RuntimeWarning,
17661691
match='Encountered data in "int" format. '

mne_bids/write.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -846,16 +846,12 @@ def _sidecar_json(raw, task, manufacturer, fname, datatype,
846846
chpi = False
847847
logger.info('Could not find cHPI information in raw data.')
848848
elif system in ['122m', '306m']:
849-
# XXX: Remove this version check when support for mne <1.2
850-
# is dropped
851-
if parse_version(mne.__version__) > parse_version('1.1'):
852-
n_active_hpi = mne.chpi.get_active_chpi(raw,
853-
on_missing='ignore')
854-
chpi = bool(n_active_hpi.sum() > 0)
855-
if chpi:
856-
hpi_freqs, _, _ = get_chpi_info(info=raw.info,
857-
on_missing='ignore')
858-
hpi_freqs = list(hpi_freqs)
849+
n_active_hpi = mne.chpi.get_active_chpi(raw, on_missing='ignore')
850+
chpi = bool(n_active_hpi.sum() > 0)
851+
if chpi:
852+
hpi_freqs, _, _ = get_chpi_info(info=raw.info,
853+
on_missing='ignore')
854+
hpi_freqs = list(hpi_freqs)
859855

860856
elif datatype == 'meg':
861857
logger.info('Cannot check for & write continuous head localization '

test_requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,3 @@ pytest-sugar
1414
check-manifest
1515
pydocstyle
1616
flake8
17-
jinja2

0 commit comments

Comments
 (0)