-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartpointdetector.py
More file actions
40 lines (32 loc) · 1.01 KB
/
startpointdetector.py
File metadata and controls
40 lines (32 loc) · 1.01 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
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Basilius Sauter
#
# Created: 19.05.2015
# Copyright: (c) Basilius Sauter 2015
# Licence: <your licence>
#-------------------------------------------------------------------------------
import numpy as np
import matplotlib.pyplot as plt
class StartpointDetector:
fromPIL = 1
deviationList = []
def __init__(self):
pass
def append(self, data, sourcetype = None):
if sourcetype == self.fromPIL:
listOfPoints = np.array(data)
# Flatten the array
listOfPoints.reshape(-1)
else:
raise AttributeError("Sourcetype cannot be None or an unsupported type")
# Calculate standard derivation
derv = np.std(listOfPoints)
self.deviationList.append(derv)
def plot(self):
plt.plot(self.deviationList)
plt.ylabel("Standard Deviation")
def show(self):
plt.show()