Skip to content

Commit 97397a7

Browse files
committed
update EMG TODO comments
1 parent acdcc18 commit 97397a7

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

mne_bids/utils.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,6 @@ def _get_mrk_meas_date(mrk):
294294
return meas_datetime
295295

296296

297-
def _infer_emg_placement_scheme(raw):
298-
# TODO EMG: just a placeholder, may not even need to exist in the end
299-
pass
300-
301-
302297
def _infer_eeg_placement_scheme(raw):
303298
"""Based on the channel names, try to infer an EEG placement scheme.
304299

mne_bids/write.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
_handle_datatype,
8080
_import_nibabel,
8181
_infer_eeg_placement_scheme,
82-
_infer_emg_placement_scheme,
8382
_stamp_to_dt,
8483
_write_json,
8584
_write_text,
@@ -1009,8 +1008,9 @@ def _sidecar_json(
10091008
ch_info_json_emg = [
10101009
("EMGReference", "n/a"),
10111010
("EMGGround", "n/a"),
1012-
# TODO EMG: must be one of Measured, ChannelSpecific, Other
1013-
("EMGPlacementScheme", _infer_emg_placement_scheme(raw)),
1011+
# TODO EMG: must be one of Measured, ChannelSpecific, or Other, so writing `n/a`
1012+
# will lead to a dataset that doesn't validate.
1013+
("EMGPlacementScheme", "n/a"),
10141014
("Manufacturer", manufacturer),
10151015
]
10161016

@@ -2047,15 +2047,21 @@ def write_raw_bids(
20472047
datatype=bids_path.datatype,
20482048
overwrite=overwrite,
20492049
)
2050-
elif bids_path.datatype in ["eeg", "ieeg", "nirs"]:
2050+
elif bids_path.datatype in ["eeg", "emg", "ieeg", "nirs"]:
20512051
# We only write electrodes.tsv and accompanying coordsystem.json
20522052
# if we have an available DigMontage
2053-
if montage is not None or (raw.info["dig"] is not None and raw.info["dig"]):
2053+
if montage is not None or raw.info["dig"]:
20542054
_write_dig_bids(bids_path, raw, montage, acpc_aligned, overwrite)
2055-
elif bids_path.datatype == "emg":
2056-
# TODO EMG: this is where to handle EMG coordsystem. We're not going to have a
2057-
# DigMontage (probably) so need another way to intake the info
2058-
pass
2055+
elif bids_path.datatype == "emg":
2056+
# TODO EMG: Handle EMG coordsystem if it's not in `raw.info["dig"]`.
2057+
# In theory we could make a helper func for creating a `DigMontage` from
2058+
# EMG electrode location info, and users could pass that into
2059+
# `write_raw_bids`...
2060+
warn(
2061+
"No electrode location info found in raw file, so not writing "
2062+
"coordinate system info for EMG data. Please add `coordsystem.json` "
2063+
"file manually."
2064+
)
20592065
else:
20602066
logger.info(
20612067
f"Writing of electrodes.tsv is not supported "
@@ -2213,8 +2219,8 @@ def write_raw_bids(
22132219
bids_path.update(extension=".edf")
22142220
_write_raw_edf(raw, bids_path.fpath, overwrite=overwrite)
22152221
elif bids_path.datatype in ["emg"] and format == "BDF":
2216-
# TODO EMG
2217-
raise NotImplementedError("Conversion to BDF not yet supported.")
2222+
# TODO EMG cf: https://github.com/the-siesta-group/edfio/issues/62
2223+
raise NotImplementedError("Conversion to BDF is not yet supported.")
22182224
elif bids_path.datatype in ["eeg", "ieeg"] and format == "EEGLAB":
22192225
warn("Converting data files to EEGLAB format")
22202226
_write_raw_eeglab(raw, bids_path.fpath, overwrite=overwrite)

0 commit comments

Comments
 (0)