neuroinformatics-unit / spikewrap

A tool to streamline extracellular electrophysiology analysis using SpikeInterface
BSD 3-Clause "New" or "Revised" License
13 stars 0 forks source link

[BUG]Handle bad channels #18

Closed JoeZiminski closed 1 year ago

JoeZiminski commented 1 year ago

Currently bad channels can be detected if selected as part of the pipeline but it might be nice to always detect these and give a warning they exist. This could prompt people to exclude these. something like

def handle_bad_channels(data: Data):
    """
    Placeholder function to begin handling bad channel detection. Even if not
    requested, it will always be useful to highlight the bad channels.

    However, it is not clear whether to print these / log these / provide simple
    API argument to remove bad channels.

    TODO
    ----
    Need to determine when best to run this detection. Definately after
    filtering, need to ask on Slack
    see https://spikeinterface.readthedocs.io/en/latest/api.html
    https://github.com/int-brain-lab/ibl-neuropixel/blob/d913ede52117bc79d \
    e77f8dc9cdb407807ab8a8c/src/neurodsp/voltage.py#L445
    """
    bad_channels = spre.detect_bad_channels(data["0-raw"])

    utils.message_user(
        f"\nThe following channels were detected as dead / noise: {bad_channels[0]}\n"
        f"TODO: DO SOMETHING BETTER WITH THIS INFORMATION. SAVE IT SOMEHWERE\n"
        f"You may like to automatically remove bad channels "
        f"by setting [TO IMPLEMENT]] as a preprocessing option\n"
        f"TODO: check how this is handled in SI\n"
    )
JoeZiminski commented 1 year ago

Closed as subsumed by #49