Mspikes recipes - melizalab/mspikes GitHub Wiki
Predefined toolchains should handle most common use cases, but for some less common tasks you may need to define your own toolchains. See Toolchain DSL for a tutorial on the toolchain definition syntax.
Copy structure from one file to another
This command creates a new ARF file with the same entries as the source file (and their associated metadata), but none of the data.
mspikes -T "input=arf_reader(); output=arf_writer((input,_structure))" source.arf target.arf
Alternatively, you can use the --channels option with a pattern that doesn't match any channels. Using the channels option also allows you to copy specific datasets.
mspikes -T "input=arf_reader(); output=arf_writer(input)" --input-channels _nosuchchannel source.arf target.arf
Exclude entries in post-processing (in progress)
Usually you exclude entries based on noise characteristics during spike extraction, but if you need to do this after the fact, modifying a file in place:
mspikes -T "input=arf_reader(writable=True); scaled=zscale(input); \
output=arf_writer((scaled, _exclusions), append_events=True)" \
--scaled-exclude file.arf file.arf
Note that the same file is given as the source and target argument, and that arf_reader
takes an extra option to enable writing back to the source. Note also that arf_writer
only writes data tagged exclusions
. Set append_events
to True
in the toolchain def if you want to add to existing exclusions; otherwise use the --output-overwrite
argument to overwrite those datasets.