forked from simbamford/AedatTools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestCorrelativeFilter.py
More file actions
84 lines (73 loc) · 2.23 KB
/
testCorrelativeFilter.py
File metadata and controls
84 lines (73 loc) · 2.23 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import sys
import numpy as np
from PyAedatTools import ImportAedat
from PyAedatTools import CorrelativeFilter
from PyAedatTools import SimpleEventPlayback
# Create a dict with which to pass in the input parameters.
aedat = {}
aedat['importParams'] = {}
# Put the filename, including full path, in the 'filePath' field.
filename = './example_data/Davis346red-2020-06-12T12-31-10-0700-0_Test_7.aedat'
# kinda works
# correlativeFilterArgs = {
# 'dt': 100000,
# 'minCorrelated': 4
# }
# regionFinderArgs = {
# 'regionLifespan': 100000,
# 'SAEThreshold': 50000
# }
# filename = "C:/Users/steph/OneDrive/Documents/NIWC/NeuroComp/AEDATA_11-12-20/Davis346red-2020-06-12T12-15-01-0700-00000195-0_Test_3_NIWC_Boat_and_SailBoat.aedat"
# also works pretty decently
# correlativeFilterArgs = {
# 'dt': 100000,
# 'minCorrelated': 3
# }
# regionFinderArgs = {
# 'regionLifespan': 100000,
# 'SAEThreshold': 50000
# }
# filename = "C:/Users/steph/OneDrive/Documents/NIWC/NeuroComp/AEDATA_11-12-20/Davis346red-2020-06-12T12-24-03-0700-0_Test_5.aedat"
# really needs localized filter
# correlativeFilterArgs = {
# 'dt': 50000,
# 'minCorrelated': 3
# }
# regionFinderArgs = {
# 'regionLifespan': 50000,
# 'SAEThreshold': 50000
# }
# filename = "C:/Users/steph/OneDrive/Documents/NIWC/NeuroComp/AEDATA_11-12-20/Davis346red-2020-06-26T12-26-42-0700-00000195-0_Test_2.aedat"
aedat['importParams']['filePath'] = filename
# Invoke the function
aedat = ImportAedat.ImportAedat(aedat)
# create data structure to give to eventPlayback module
polarityData = aedat['data']['polarity']
eventData = {
'timeStamp': polarityData['timeStamp'],
'x': polarityData['x'],
'y': polarityData['y'],
'polarity': polarityData['polarity'],
'numEvents': polarityData['numEvents']
}
eventPlaybackArgs = {
'caption': 'Boat detection',
'width': 346,
'height': 260,
'playbackSpeed': 1,
'fadeAlpha': 1,
'frameStep': 30,
'saveFrames': False
}
correlativeFilterArgs = {
'dt': 100000,
'n': 4
}
SAEArgs = {
'noiseFilter': 50000
}
regionFinderArgs = {
'regionLifespan': 100000
}
# playback the event data
SimpleEventPlayback.beginPlayback(eventData, eventPlaybackArgs, SAEArgs, correlativeFilterArgs, regionFinderArgs)