-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbbev.py
More file actions
45 lines (41 loc) · 1.42 KB
/
Copy pathbbev.py
File metadata and controls
45 lines (41 loc) · 1.42 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
import logging
import evdev
from .bbdefault import calculate_weight
if __name__ == '__main__':
logger = logging.getLogger(__name__)
handler = logging.StreamHandler() # or RotatingFileHandler
handler.setFormatter(logging.Formatter('[%(asctime)s][%(name)s][%(levelname)s] %(message)s'))
logger.addHandler(handler)
logger.setLevel(logging.DEBUG)
devices = [evdev.InputDevice(path) for path in evdev.list_devices()]
device_path = (device.path for device in devices if device.name == 'Nintendo Wii Remote Balance Board').__next__()
balance_board: evdev.InputDevice = evdev.InputDevice(
device_path,
)
print(calculate_weight(
balance_board,
100,
10,
logger
))
# trimmed_stats = responseData.trimmed_statistics(30)
# trimmed_samples = responseData.trimmed_samples(30)
# stats = responseData.statistics()
#
# print(trimmed_samples)
#
# print(f"""
# Trimmed Stats:
# Mean: {trimmed_stats.mean}
# Median: {trimmed_stats.median}
# STDEV: {trimmed_stats.stdev}
# Median_grouped: {statistics.median_grouped(trimmed_samples)}
# Median: {statistics.median(trimmed_samples)}
# Stdev: {statistics.stdev(trimmed_samples)}
# Mean: {statistics.mean(trimmed_samples)}
#
# Untrimmed Stats:
# Mean: {stats.mean}
# Median: {stats.median}
# STDEV: {stats.stdev}
# """)