How to Edit the Sync Channel#

Note

This is a quick how-to on working with the sync channel. See here for a long-form tutorial.

Warning

Currently, the only supported sync channel is from Neuropixels Imec stream (in which it is the 385th channel). Please get in contact to see other cases supported.

import spikewrap as sw

session = sw.Session(
    subject_path=sw.get_example_data_path("openephys") / "rawdata" / "sub-001",
    session_name="ses-001",
    file_format="openephys",
    run_names="all"
)

session.load_raw_data()

session.get_raw_run_names()

# get the sync channel data as a numpy array
run_1_sync_channel = session.get_sync_channel(run_idx= 0)

# or plot the sync channel
session.plot_sync_channel(run_idx=0, show=True)

# edit the sync channel
session.silence_sync_channel(
    run_idx=0,
    periods_to_silence=[(0, 250), (500, 750)]
)

# refresh the sync channel
session.load_raw_data(overwrite=True)

session.save_sync_channel(overwrite=True, slurm=False)
05 sync channel
Loading data from path: /home/runner/work/spikewrap/spikewrap/spikewrap/examples/example_tiny_data/openephys/rawdata/sub-001/ses-001/ephys/Record Node 104/experiment1/recording1

Loading data from path: /home/runner/work/spikewrap/spikewrap/spikewrap/examples/example_tiny_data/openephys/rawdata/sub-001/ses-001/ephys/Record Node 104/experiment1/recording2

Loading data from path: /home/runner/work/spikewrap/spikewrap/spikewrap/examples/example_tiny_data/openephys/rawdata/sub-001/ses-001/ephys/Record Node 104/experiment1/recording1

Loading data from path: /home/runner/work/spikewrap/spikewrap/spikewrap/examples/example_tiny_data/openephys/rawdata/sub-001/ses-001/ephys/Record Node 104/experiment1/recording2

Saving sync channel for: recording1...

Saving sync channel for: recording2...

Total running time of the script: (0 minutes 0.157 seconds)

Gallery generated by Sphinx-Gallery