|
28 | 28 | _block_r, |
29 | 29 | _get_blocks, |
30 | 30 | _get_ep_info, |
31 | | - _get_gains, |
32 | 31 | _get_signalfname, |
33 | 32 | ) |
34 | 33 |
|
35 | 34 | REFERENCE_NAMES = ("VREF", "Vertex Reference") |
| 35 | +CAL_SCALES = {"uV": 1e-6, "V": 1} |
36 | 36 |
|
37 | 37 |
|
38 | 38 | def _get_mff_reader(input_fname): |
39 | | - """Open an mffpy.Reader for the MFF directory, with raw (uncalibrated) EEG. |
40 | | -
|
41 | | - mffpy applies its own GCAL scaling by default, but MNE's ``cals`` already |
42 | | - incorporate that gain (see ``_get_eeg_calibration_info``), so it is |
43 | | - disabled here to avoid applying it twice. |
44 | | - """ |
| 39 | + """Open an mffpy.Reader for the MFF directory.""" |
45 | 40 | mffpy = _import_mffpy("read EGI MFF data") |
46 | | - mff_reader = mffpy.Reader(input_fname) |
47 | | - mff_reader.set_calibration("EEG", None) |
48 | | - return mff_reader |
| 41 | + return mffpy.Reader(input_fname) |
49 | 42 |
|
50 | 43 |
|
51 | 44 | def _disk_range_to_epochs(egi_info, disk_start, disk_stop): |
@@ -287,21 +280,6 @@ def _read_header(input_fname): |
287 | 280 | return info |
288 | 281 |
|
289 | 282 |
|
290 | | -def _get_eeg_calibration_info(filepath, egi_info): |
291 | | - """Calculate calibration info for EEG channels.""" |
292 | | - gains = _get_gains(op.join(filepath, egi_info["info_fname"])) |
293 | | - if egi_info["value_range"] != 0 and egi_info["bits"] != 0: |
294 | | - cals = [egi_info["value_range"] / 2 ** egi_info["bits"]] * len( |
295 | | - egi_info["chan_type"] |
296 | | - ) |
297 | | - else: |
298 | | - cal_scales = {"uV": 1e-6, "V": 1} |
299 | | - cals = [cal_scales[t] for t in egi_info["chan_unit"]] |
300 | | - if "gcal" in gains: |
301 | | - cals *= gains["gcal"] |
302 | | - return cals |
303 | | - |
304 | | - |
305 | 283 | def _read_locs(filepath, egi_info, channel_naming): |
306 | 284 | """Read channel locations.""" |
307 | 285 | _soft_import("mffpy", "reading EGI MFF data") |
@@ -441,7 +419,7 @@ def __init__( |
441 | 419 |
|
442 | 420 | logger.info(" Reading events ...") |
443 | 421 | egi_events, egi_info, mff_events = _read_events(input_fname, egi_info) |
444 | | - cals = _get_eeg_calibration_info(input_fname, egi_info) |
| 422 | + cals = np.array([CAL_SCALES[t] for t in egi_info["chan_unit"]]) |
445 | 423 | logger.info(" Assembling measurement info ...") |
446 | 424 | event_codes = egi_info["event_codes"] |
447 | 425 | include = _triage_include_exclude(include, exclude, egi_events, egi_info) |
@@ -884,9 +862,7 @@ def _read_evoked_mff(fname, condition, channel_naming="E%d", verbose=None): |
884 | 862 | info["nchan"] = sum(mff.num_channels.values()) |
885 | 863 |
|
886 | 864 | # Add individual channel info |
887 | | - # Get calibration info for EEG channels |
888 | | - cals = _get_eeg_calibration_info(fname, egi_info) |
889 | | - # Initialize calibration for PNS channels, will be updated later |
| 865 | + cals = np.array([CAL_SCALES[t] for t in egi_info["chan_unit"]]) |
890 | 866 | cals = np.concatenate([cals, np.repeat(1, len(egi_info["pns_names"]))]) |
891 | 867 | ch_coil = FIFF.FIFFV_COIL_EEG |
892 | 868 | ch_kind = FIFF.FIFFV_EEG_CH |
|
0 commit comments