-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathtemplate.pyx
More file actions
61 lines (47 loc) · 2.04 KB
/
Copy pathtemplate.pyx
File metadata and controls
61 lines (47 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import sys
import numpy as np
cimport numpy as np
from cython cimport view
isDebug = False
class EXAMPLE(object):
def __init__(self):
"""initialize object data"""
self.Enabled = 1
self.samplingRate = 0.
self.chan_enabled = []
def startup(self, nchans, srate, states):
"""to be run upon startup"""
self.update_settings(nchans, srate)
for chan in range(nchans):
if not states[chan]:
self.channel_changed(chan, False)
def plugin_name(self):
"""tells OE the name of the program"""
return "EXAMPLE"
def is_ready(self):
"""tells OE everything ran smoothly"""
return self.Enabled
def param_config(self):
"""return button, sliders, etc to be present in the editor OE side"""
return []
def update_settings(self, nchans, srate):
"""handle changing number of channels and sample rates"""
self.samplingRate = srate
old_nchans = len(self.chan_enabled)
if old_nchans > nchans:
del self.chan_enabled[nchans:]
elif len(self.chan_enabled) < nchans:
self.chan_enabled.extend([True] * (nchans - old_nchans))
def channel_changed(self, chan, state):
"""do something when channels are turned on or off in PARAMS tab"""
self.chan_enabled[chan] = state
def bufferfunction(self, n_arr):
"""Access to voltage data buffer. Returns events"""
events = []
return events
def handleEvents(self, eventType,sourceID,subProcessorIdx,timestamp,sourceIndex):
"""handle events passed from OE"""
def handleSpike(self, electrode, sortedID, n_arr):
"""handle spikes passed from OE"""
pluginOp = EXAMPLE()
include '../plugin.pyx'