forked from simbamford/AedatTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestAPM.py
70 lines (58 loc) · 1.73 KB
/
testAPM.py
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
import sys
import numpy as np
from PyAedatTools import ImportAedat
from PyAedatTools import EventPlayback
# 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 = "Davis346red-2020-06-12T12-15-01-0700-00000195-0_Test_3_NIWC_Boat_and_SailBoat.aedat"
filename = "Davis346red-2020-06-26T12-26-42-0700-00000195-0_Test_2.aedat"
aedat['importParams']['filePath'] = "../../AEDATA_11-12-20/"+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': filename,
'maxBufferSize': 10000,
'APMEnable': True,
'APMSampleFraction': 0.5,
'APMRadius': 5,
'attentionThreshold': 0.05,
'width': 350,
'height': 265,
'filename': filename,
'playbackSpeed': 100,
'blendRate': 10,
'frameStep': 30
}
cornerTrackingArgs = {
'passArray': [
{'radius':3,'arcMin':3,'arcMax':5},
{'radius':4,'arcMin':4,'arcMax':6}
],
'SAEThreshold':50
}
featureTrackingArgs = {
'enable':True,
'maxBufferSize':10000,
'trackRange':10,
'noiseThreshold':3
}
clusterTrackingArgs = {
'enable':False,
'maxBufferSize':100,
'newEventWeight':0.9,
'clusteringThreshold':5,
'numClusteringSamples':50
}
# playback the event data
EventPlayback.playEventData(eventData, eventPlaybackArgs, featureTrackingArgs, clusterTrackingArgs, cornerTrackingArgs)