The Kwik format was designed to be used with the suite of spike-sorting and analysis tools based around KlustaKwik.
The complete specification (created by Ken Harris' lab at UCL) can be found here. Open Ephys uses a variation on this specification for two reasons:
- The KWIK file is overwritten by KlustaKwik, so we save our event-related metadata in a separate file (the KWE file)
- It's possible to save data from multiple processors simultaneously, so we create a separate KWD (continuous) file for each processor
Each recording will generate 3 or more files:
- experiment1_XXX.raw.kwd contains the continuous data for a given processor (#XXX) in the /recordings/#/data dataset, where # is the recording number, starting at 0
- experiment1.kwx contains the spike waveforms
- experiment1.kwe contains the event data (this is an Open Ephys-specific file)
Some simple Python functions for loading Kwik datasets can be found in the analysis-tools repository on GitHub.
- load(kwd_filename) – imports a continuous dataset into a Python dictionary
- get_rising_edge_times(kwe_filename, TTLchan) – extracts the rising edge ("ON") events for a given TTL channel
- get_falling_edge_times(kwe_filename, TTLchan) – extracts the falling edge ("OFF") events for a given TTL channel
- get_experiment_start_time(kwe_filename) – extracts the offset between the event times and the timestamps loaded from the KWD file