Skip to content

Handling bad marker coils when reading KIT data #8981

@JD-Zhu

Description

@JD-Zhu

Hello,

We are attempting to read .con files from KIT system, and mne.io.read_raw_kit() runs into an error when there are missing marker coils. This seems to be caused by retrieving coordinates for markers (e.g. 'hpi_1') when they don't exist (line 716 in mne/io/kit/kit.py).

We propose the following solution, which checks whether a marker coil exists before retrieving its values:

# nasion, lpa, rpa, HPI in native space
#elp = [dig.pop(key) for key in (
#    'fidnz', 'fidt9', 'fidt10',
#    'hpi_1', 'hpi_2', 'hpi_3', 'hpi_4')]
elp = []
for key in (
    'fidnz', 'fidt9', 'fidt10',
    'hpi_1', 'hpi_2', 'hpi_3', 'hpi_4'):
    if key in dig:
        elp.append(dig.pop(key))

@JD-Zhu @paulsowman

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions