klusta-team / spikedetekt2

10 stars 8 forks source link

Add support for debug module #8

Closed rossant closed 9 years ago

rossant commented 9 years ago

This PR adds a new diagnostics_script_path option in the PRM file. Put the full path to a Python script and it will be executed after every chunk has been processed. Here are the available global and local variables when the script is executed:

# globals():
['connected_components', 'register', 'close_file_logger', 'read_raw',
 'get_threshold', 'apply_filter', 'project_pcs', 'FileLogger', 
 'create_file_logger', 'add_waveform', 'bandpass_filter', 'compute_pcs',
  'display_params', '__package__', 'convert_dtype', 'run', 'np', 
  'ProgressReporter', 'tb', '__doc__', 'BaseRawDataReader', 
  'ExperimentRawDataReader', 'excerpt_step', 'KwdRawDataReader', 
  '__warningregistry__', '__builtins__', '__file__', 'to_contiguous', 
  'DoubleThreshold', 'warn', 'apply_threshold', '__name__', 'iterkeys', 
  'info', 'exception', 'extract_waveform', 'logging', 'unregister', 'Probe', 
  'decimate', 'save_features', 'debug', 'extract_waveforms']

# locals():
['s_end', 'prm', 'chunk', 'probe', 'dead', 'waveforms', 'threshold', 
'diagnostics_script_path', 'nspikes', '_debug', 'progress_bar', 'experiment', 
'chunk_threshold', 'chunk_detect', 'rec', 'chunk_low_keep', 'chunk_low', 
'LOGGER_FILE', 'nchannels', 'chunk_fil', 'chunk_size', 'chunk_raw', 
'nsamples', 'nrecs', 'chunk_overlap', 'i', 'raw_data', 'j', 'filter', 
'components']

Need to merge https://github.com/klusta-team/kwiklib/pull/14 too.

This allows us (and users) to write custom diagnostics scripts without putting them in the spikedetekt repository.

cc @shabnamkadir