KWIK format

The Kwik format was designed to be used with the suite of spike-sorting and analysis tools based around KlustaKwik. It is also based on HDF5. It has since been abandoned by the developers of KlustaKwik, for the reasons outlined here. We'll continue to support the KWIK format for Open Ephys data, but we'd recommend moving away from it if you can.

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:

  1. The KWIK file is overwritten by KlustaKwik, so we save our event-related metadata in a separate file (the KWE file)
  2. 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