|
79 | 79 | _handle_datatype, |
80 | 80 | _import_nibabel, |
81 | 81 | _infer_eeg_placement_scheme, |
82 | | - _infer_emg_placement_scheme, |
83 | 82 | _stamp_to_dt, |
84 | 83 | _write_json, |
85 | 84 | _write_text, |
@@ -1009,8 +1008,9 @@ def _sidecar_json( |
1009 | 1008 | ch_info_json_emg = [ |
1010 | 1009 | ("EMGReference", "n/a"), |
1011 | 1010 | ("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"), |
1014 | 1014 | ("Manufacturer", manufacturer), |
1015 | 1015 | ] |
1016 | 1016 |
|
@@ -2047,15 +2047,21 @@ def write_raw_bids( |
2047 | 2047 | datatype=bids_path.datatype, |
2048 | 2048 | overwrite=overwrite, |
2049 | 2049 | ) |
2050 | | - elif bids_path.datatype in ["eeg", "ieeg", "nirs"]: |
| 2050 | + elif bids_path.datatype in ["eeg", "emg", "ieeg", "nirs"]: |
2051 | 2051 | # We only write electrodes.tsv and accompanying coordsystem.json |
2052 | 2052 | # 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"]: |
2054 | 2054 | _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 | + ) |
2059 | 2065 | else: |
2060 | 2066 | logger.info( |
2061 | 2067 | f"Writing of electrodes.tsv is not supported " |
@@ -2213,8 +2219,8 @@ def write_raw_bids( |
2213 | 2219 | bids_path.update(extension=".edf") |
2214 | 2220 | _write_raw_edf(raw, bids_path.fpath, overwrite=overwrite) |
2215 | 2221 | 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.") |
2218 | 2224 | elif bids_path.datatype in ["eeg", "ieeg"] and format == "EEGLAB": |
2219 | 2225 | warn("Converting data files to EEGLAB format") |
2220 | 2226 | _write_raw_eeglab(raw, bids_path.fpath, overwrite=overwrite) |
|
0 commit comments