Новоселов Даниил Евгеньевич
|
|
- Edwina Sharp
- 5 years ago
- Views:
Transcription
1 Работа победителя заключительного этапа командной инженерной олимпиады школьников Олимпиада Национальной технологической инициативы Профиль «Создание систем протезирования (Нейротехнологии)» Новоселов Даниил Евгеньевич Класс: 7 Школа: МБОУ "СОШ 5" Уникальный номер участника: Параллель: 9 класс Город: Нефтеюганск Регион: Ханты-Мансийский автономный округ - Югра Команда на заключительном этапе: НБК Результаты заключительного этапа:
2 Индивидуальная часть Персональный лист участника с номером
3 Решения задач по биологии:
4
5 Решения задач по информатике: Решения задач участника написаны на языке Python. Ниже представлены решения участника. Задача 1 count = int(input()) exs = [] for _ in range(count): exp = input().split(' ') exp[1] = int(exp[1]) start = exp[0].split(':') start = list(map(int, start)) start = (start[0] * 60) + start[1] exp[0] = start exs.append(exp) for idx in range(len(exs)): exs[idx] = sum(exs[idx]) exs.sort() for (idx, line) in enumerate(exs): hours = line // 60 minutes = line % 60 hours = hours % 24 hours = str(hours) minutes = str(minutes) hours = '0' * (2 - len(hours)) + hours minutes = '0' * (2 - len(minutes)) + minutes line = hours + ':' + minutes
6 exs[idx] = line for _ in range(len(exs)): exp = exs[_] start = exp.split(':') start = list(map(int, start)) start = (start[0] * 60) + start[1] exs[_] = start exs.sort() for (idx, line) in enumerate(exs): hours = line // 60 minutes = line % 60 hours = hours % 24 hours = str(hours) minutes = str(minutes) hours = '0' * (2 - len(hours)) + hours minutes = '0' * (2 - len(minutes)) + minutes line = hours + ':' + minutes exs[idx] = line for line in exs: print(line) Задача 2 count = int(input()) tree = {1: [0, []]} for num in range(count - 1): prednum = int(input())
7 pred = tree[prednum] history = pred[1].copy() history.append(prednum) tree[num + 2] = [pred[0] + 1, history] maxs = [] mx = max([len(tree[key][1]) for key in tree.keys()]) for key in tree.keys(): if len(tree[key][1]) == mx: maxs.append(key) print(mx) print(len(maxs)) print(' '.join(map(str, maxs))) Задача 3 count = int(input()) inp = list(map(int, input().split(' '))) for idx, value in enumerate(inp): inp[idx] = [value, idx] c = list(filter(lambda x: x[0] % 2 == 0, inp)) c = [e[0] for e in c] c.sort() nc = list(filter(lambda x: x[0] % 2 == 1, inp)) d = {} for line in nc: d[line[1]] = line[0] inp = []
8 i = 0 for idx in range(count): if idx in d: inp.append(d[idx]) else: inp.append(c[i]) i += 1 print(' '.join(map(str, inp))) Задача 4 s = input() t = input() if all(((c in s) for c in t)): res = [] for i in range(len(s)): ts = s[i:] temp = 'yes' for l in t: if l not in ts: temp = 'no' res.append(temp) for line in res: print(line) else: for _ in range(len(s)): print('no')
9 Задача 5 t = input() s = input() ls = len(s) lt = len(t) res = 0 if s.count(t) > 0: for i in range(ls): if ls - i < lt: continue temp = 1 for idx in range(lt): if s[i + idx]!= t[idx]: temp = 0 break res += temp print(res)
10 Командная часть Результаты были получены в рамках выступления команды: НБК. Личный состав команды: Новоселов Даниил Евгеньевич Бережная Ольга Михайловна Команда НБК показала лучший результат среди команд профиля. Командной была успешна реализована система управления макетом протеза с обратной связью как на основе механической части задачи (на основе датчиков изгиба ), так и на основе биосигналов человека (электромиограмма, электроэнцефалограмма). Команда успешно справилась со всеми заданиями на полный балл, кроме заданий 5.2 и 5.3. В задании 5.2 команде не удалось реализовать дополнительный бонусный жест так, чтобы его можно было стабильно воспроизвести. В задании 5.3 команде не хватило времени для демонстрации реализации обратной связи используя биосигналы человека (электромиограмма и электроэнцефалограмма). Стоит отметить, что после окончания стендовых испытаний у команды получилось продемонстрировать задание (баллы за это, конечно, не ставились). Даниил себя проявил как программист, однако у него возникали вопросы по физиологии человека: где лучше расположить электроды, почему сигнал принимает именно такую, а не иную форму и т.д. По физиологически вопросам Даниилу помогала его напарница - Ольга, в тандеме с Ольгой ему удалось успешно решить почти все задачи. Ниже представлены фотографии команды НБК во время выполнения заданий Олимпиады и код программ, который команда использовала при сдаче заданий. Отметим, что некоторые программы включают в себя решения нескольких задач из задания. Итоговые программы для Arduino Nano и Arduino Uno включает в себя решения нескольких задач (т.к. каждая последующая задача была связана с предыдущей), а именно: 1.2, 1.3, 1.4, , Прогресс команды по дням можно отследить по ссылке (решения команд в конце каждого дня):
11 На фото: команда НБК после выдачи оборудования На фото: Результаты работы команды НБК после первого дня работы
12 На фото: команда НБК при сдаче задания
13 На фото: команда НБК готовится к сдаче заданий из блока 5 Итоговая программа для Arduino Nano (перчатка): const int motors[] = {3, 6, 9}; void setup() { // put your setup code here, to run once: pinmode(a5, INPUT);//Channel 0 pinmode(a6, INPUT);//Channel 1
14 pinmode(a7, INPUT);//Channel 2 pinmode(3, OUTPUT);//Channel 0 pinmode(6, OUTPUT);//Channel 1 pinmode(9, OUTPUT);//Channel 2 Serial.begin(115200); } void loop() { // put your main code here, to run repeatedly: byte input[2]; if (Serial.available() >= 2) { Serial.readBytes(input, 2); byte channel = input[0]; byte value = input[1]; analogwrite(motors[channel], value); } byte data[6]; data[0] = map(analogread(a5), 0, 1023, 0, 255); data[1] = map(analogread(a6), 0, 1023, 0, 255); data[2] = map(analogread(a7), 0, 1023, 0, 255); data[3] = map(analogread(a1), 0, 1023, 0, 255); data[4] = map(analogread(a2), 0, 1023, 0, 255); data[5] = map(analogread(a0), 0, 1023, 0, 255);//EMG for (int idx = 0; idx < 6; idx++) { Serial.write(idx); Serial.write(data[idx]); }
15 } Итоговая программа для Arduino Uno (макет протеза руки) #include <Servo.h> Servo big, touch, middle, unknown, small; void setup() { // put your setup code here, to run once: pinmode(a5, INPUT);//Channel 0 pinmode(a3, INPUT);//Channel 1 pinmode(a4, INPUT);//Channel 2 pinmode(3, OUTPUT); small.attach(5); unknown.attach(6); middle.attach(9); touch.attach(10); big.attach(11); small.write(180); unknown.write(0); middle.write(25); touch.write(45); big.write(180); Serial.begin(115200); Serial.flush(); } void loop() { // put your main code here, to run repeatedly: byte input[2];
16 while (Serial.available() >= 2) { Serial.readBytes(input, 2); digitalwrite(3, HIGH); byte channel = input[0]; byte value = input[1]; switch (channel) { case 0: big.write(value); break; case 1: touch.write(value); break; case 2: middle.write(value); break; case 3: unknown.write(value); break; case 4: small.write(value); break; } digitalwrite(3, LOW); } byte data[3]; data[2] = map(analogread(a5), 0, 1023, 0, 255); data[0] = map(analogread(a3), 0, 1023, 0, 255);
17 data[1] = map(analogread(a4), 0, 1023, 0, 255); for (int idx = 0; idx < 3; idx++) { Serial.write(idx); Serial.write(data[idx]); } delay(250); } Далее представлены программы на Python. Программа к задаче 1.3 import serial, struct, time import psutil, os proc = psutil.process(os.getpid()) proc.nice(psutil.realtime_priority_class) glove = serial.serial('com5', , timeout=none) data = [] while len(data) < 5: if glove.in_waiting >= 2: data.append(glove.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo if not (data[0][0] < 9 and data[1][0] < 9 and data[2][0] < 9): glove.read(1)
18 data.clear() while True: while glove.in_waiting >= 2: data.append(glove.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo channels = {} for dat in data: channel, value = dat if channel in channels: channels[channel].append(value) else: channels[channel] = [value] buff = [] if len(channels) > 0: for idx in range(min([len(channels[key]) for key in channels.keys()])): buff.append([channels[key][idx] for key in channels.keys()]) for line in buff: line = map(str, line) print('\t'.join(line)) buff.clear() data.clear() channels.clear()
19 time.sleep(1) Решение к задаче 1.4 import serial import psutil, os, time proc = psutil.process(os.getpid()) proc.nice(psutil.realtime_priority_class) glove = serial.serial('com5', , timeout=none) channels = {0: False, 1: False, 2: False} while True: for key in channels.keys(): value = channels[key] if value: arr = bytearray([key, 0]) glove.write(arr) channels[key] = False else: arr = bytearray([key, 200]) glove.write(arr) channels[key] = True time.sleep(1) Решение к задаче 2.5 import psutil, os, struct, time proc = psutil.process(os.getpid()) proc.nice(psutil.realtime_priority_class) import serial hand = serial.serial('com6', , timeout=none)
20 data = [] hand.flushinput(); while len(data) < 5: if hand.in_waiting >= 2: data.append(hand.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo if not (data[0][0] < 9 and data[1][0] < 9 and data[2][0] < 9): hand.read(1) data.clear() def get_data(device: serial.serial): data = [] while device.in_waiting >= 2: data.append(device.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big'))
21 data[idx] = foo channels = {} for dat in data: channel, value = dat if channel in channels: channels[channel].append(value) else: channels[channel] = [value] return channels def send(channel, value, device: serial.serial): print('send on %d %d' % (channel, value)) arr = bytearray([channel, value]) device.write(arr) poss = [180, 45, 25, 0, 180] maxs = [5, 180, 180, 180, 20] mins = [180, 45, 25, 0, 180] st = 5 while True: data = get_data(hand) if len(data) > 0: if max([data[key][-1] for key in data.keys()]) > 20: print(data) import sys sys.exit(1) if poss[4] > maxs[4]: send(4, poss[4] - st, hand) poss[4] -= st
22 if poss[3] < maxs[3]: send(3, poss[3] + st, hand) poss[3] += st if poss[2] < maxs[2]: send(2, poss[2] + st, hand) poss[2] += st if poss[1] < maxs[1]: send(1, poss[1] + st, hand) poss[1] += st if poss[0] > maxs[0]: send(0, poss[0] - st, hand) poss[0] -= st time.sleep(0.05) Решение к задаче 3.3 import psutil, os, struct, time proc = psutil.process(os.getpid()) proc.nice(psutil.realtime_priority_class) import serial glove = serial.serial('com5', , timeout=none) data = [] glove.flushinput() while len(data) < 5: if glove.in_waiting >= 2: data.append(glove.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat)
23 foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo if not (data[0][0] < 9 and data[1][0] < 9 and data[2][0] < 9): glove.read(1) data.clear() def get_data(device: serial.serial): data = [] while device.in_waiting >= 2: data.append(device.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo channels = {} for dat in data: channel, value = dat if channel in channels: channels[channel].append(value) else: channels[channel] = [value] return channels while True:
24 data = get_data(glove) print(data) for key in range(len(data)): print(data[key][-1], end='\t') print() time.sleep(0.5) Решение к задаче 3.4 import psutil, os, struct import serial from matplotlib import pyplot as plt import matplotlib.animation as animation import numpy as np proc = psutil.process(os.getpid()) proc.nice(psutil.realtime_priority_class) glove = serial.serial('com5', , timeout=none) data = [] glove.flushinput() while len(data) < 5: if glove.in_waiting >= 2: data.append(glove.read(2))
25 for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo if not (data[0][0] < 9 and data[1][0] < 9 and data[2][0] < 9): glove.read(1) data.clear() def get_data(device: serial.serial): data = [] while device.in_waiting >= 2: data.append(device.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo channels = {} for dat in data: channel, value = dat if channel in channels: channels[channel].append(value) else: channels[channel] = [value]
26 return channels fig, axs = plt.subplots(3, 1) print(axs) for ax in axs: ax.set_ylim(0, 255) ax.set_xlim(0, 120) ax.grid() N = 120 line1, = axs[0].plot(np.arange(n), np.ones(n, dtype=np.float) * np.nan, animated=true, lw=2, label='emg1') line2, = axs[1].plot(np.arange(n), np.ones(n, dtype=np.float) * np.nan, animated=true, lw=2, label='emg2') line3, = axs[2].plot(np.arange(n), np.ones(n, dtype=np.float) * np.nan, animated=true, lw=2, label='eeg') line = [line1, line2, line3] def init(): return line def animate(in_data): data = get_data(glove) print(data) old = line1.get_ydata() new = np.r_[old[1:], data[3][-1]] line1.set_ydata(new) old = line2.get_ydata() new = np.r_[old[1:], data[4][-1]] line2.set_ydata(new) old = line3.get_ydata() new = np.r_[old[1:], data[5][-1]]
27 line3.set_ydata(new) return line for ax in axs: ax.legend() print('start') anim = animation.funcanimation(fig, animate, init_func=init, frames=n, interval=0, blit=true, repeat=true) plt.show() Решение к задаче 3.5 import psutil, os, struct import serial from matplotlib import pyplot as plt import matplotlib.animation as animation import numpy as np proc = psutil.process(os.getpid()) proc.nice(psutil.realtime_priority_class) glove = serial.serial('com5', , timeout=none) data = [] glove.flushinput() while len(data) < 5: if glove.in_waiting >= 2: data.append(glove.read(2))
28 for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo if not (data[0][0] < 9 and data[1][0] < 9 and data[2][0] < 9): glove.read(1) data.clear() def get_data(device: serial.serial): data = [] while device.in_waiting >= 2: data.append(device.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo channels = {} for dat in data: channel, value = dat if channel in channels: channels[channel].append(value) else:
29 channels[channel] = [value] return channels N = 120 fig, ax = plt.subplots(1, 1) ax.set_ylim(0, 255) ax.set_xlim(0, N) ax.grid() line1, = ax.plot(np.arange(n), np.ones(n, dtype=np.float) * np.nan, animated=true, lw=2, label='emg1') line = [line1] def init(): return line window_size = 20 def animate(in_data): data = get_data(glove) print(data) window = data[3][-window_size:] old = line1.get_ydata() new = np.r_[old[1:], (max(window) - min(window))] line1.set_ydata(new) return line ax.legend() print('start') anim = animation.funcanimation(fig, animate, init_func=init, frames=n, interval=0, blit=true, repeat=true) plt.show() Решение к задаче 3.6
30 import psutil, os, struct import serial from matplotlib import pyplot as plt import matplotlib.animation as animation import numpy as np proc = psutil.process(os.getpid()) proc.nice(psutil.realtime_priority_class) glove = serial.serial('com5', , timeout=none) data = [] glove.flushinput() while len(data) < 5: if glove.in_waiting >= 2: data.append(glove.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo if not (data[0][0] < 9 and data[1][0] < 9 and data[2][0] < 9): glove.read(1) data.clear() def get_data(device: serial.serial): data = [] while device.in_waiting >= 2: data.append(device.read(2))
31 for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo channels = {} for dat in data: channel, value = dat if channel in channels: else: channels[channel].append(value) channels[channel] = [value] return channels N = 120 fig, ax = plt.subplots(1, 1) ax.set_ylim(0, 255) ax.set_xlim(0, N) ax.grid() line1, = ax.plot(np.arange(n), np.ones(n, dtype=np.float) * np.nan, animated=true, lw=2, label='emg1') line = [line1] def init(): return line window_size = 20 def animate(in_data): data = get_data(glove) print(data)
32 window = data[3][-window_size:] old = line1.get_ydata() new = np.r_[old[1:], (max(window) - min(window))] line1.set_ydata(new) return line ax.legend() print('start') anim = animation.funcanimation(fig, animate, init_func=init, frames=n, interval=0, blit=true, repeat=true) plt.show() Решение к задаче 4.1 import serial, struct, time import psutil, os proc = psutil.process(os.getpid()) proc.nice(psutil.realtime_priority_class) glove = serial.serial('com5', , timeout=none) hand = serial.serial('com6', , timeout=none) data = [] glove.flushinput() hand.flushinput() while len(data) < 10: if glove.in_waiting >= 2: data.append(glove.read(2)) for idx, dat in enumerate(data):
33 dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo if not all([data[key][0] < 9 for key in range(len(data))]): glove.read(1) data.clear() def get_data(device: serial.serial): data = [] while device.in_waiting >= 2: data.append(device.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo channels = {} for dat in data: channel, value = dat if channel in channels: channels[channel].append(value) else: channels[channel] = [value] return channels
34 def send(channel, value, device: serial.serial): print('send on %d %d' % (channel, value)) arr = bytearray([channel, value]) device.write(arr) s = {0: 0, 1: 0, 2: 0} input() data = get_data(glove) print(data) for channel in range(3): s[channel] = data[channel][-1] data.clear() print(s) def calc(d): d[0] = s[0] - d[0][-1] d[1] = s[1] - d[1][-1] d[2] = s[2] - d[2][-1] return d poss = [180, 45, 25, 0, 180] while True: data = get_data(glove) if len(data) > 0: data = calc(data) print(data[0], ' ', data[1], ' ', data[2]) value = abs(data[1]) send(0, min(max(poss[0] - int(value * 4), 10), 180), hand)
35 value = abs(data[2]) if abs(value - 0) > 15: send(1, min(poss[1] + int(value * 2.25), 255), hand) send(2, min(poss[2] + int(value * 2), 255), hand) else: send(1, poss[1], hand) send(2, poss[2], hand) value = abs(data[0]) send(3, min(poss[3] + int(value * 3), 255), hand) send(4, max(poss[4] - int(value * 4), 15), hand) time.sleep(2) Решение к задаче 4.2 import serial, struct, time import psutil, os proc = psutil.process(os.getpid()) proc.nice(psutil.realtime_priority_class) glove = serial.serial('com5', , timeout=none) hand = serial.serial('com6', , timeout=none) data = [] while len(data) < 5: if hand.in_waiting >= 2: data.append(hand.read(2)) for idx, dat in enumerate(data):
36 dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo if not (data[0][0] < 9 and data[1][0] < 9 and data[2][0] < 9): hand.read(1) data.clear() def get_data(device: serial.serial): data = [] while device.in_waiting >= 2: data.append(device.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo channels = {} for dat in data: channel, value = dat if channel in channels: channels[channel].append(value) else: channels[channel] = [value]
37 return channels def send(channel, value, device: serial.serial): print('send on %d %d' % (channel, value)) arr = bytearray([channel, value]) device.write(arr) while True: data = get_data(hand) if len(data) > 2: for channel in range(3): send(channel, data[channel][-1], glove) Решение к задаче 4.3 import psutil import os import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation import serial import struct import time process = psutil.process(os.getpid()) process.nice(psutil.realtime_priority_class) glove = serial.serial('com5', , timeout=none) hand = serial.serial('com6', , timeout=none) data = []
38 glove.flushinput() hand.flushinput() while len(data) < 10: if glove.in_waiting >= 2: data.append(glove.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo if not all([data[key][0] < 9 for key in range(len(data))]): glove.read(1) data.clear() def get_data(device: serial.serial): data = [] while device.in_waiting >= 2: data.append(device.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo
39 channels = {} for dat in data: channel, value = dat if channel in channels: channels[channel].append(value) else: channels[channel] = [value] return channels def send(channel, value, device: serial.serial): print('send on %d %d' % (channel, value)) arr = bytearray([channel, value]) device.write(arr) n = 120 fig, axs = plt.subplots(2, 3) for ax in axs.flatten(): ax.grid() ax.set_ylim(0, 255) ax.set_xlim(0, 120) ax.legend() line1, = axs[0, 0].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='emg1') line2, = axs[0, 1].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='emg2') line3, = axs[0, 2].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='eeg') line4, = axs[1, 0].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='amplitude 1') line5, = axs[1, 1].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='amplitude 2')
40 line6, = axs[1, 2].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='alpha') line = [line1, line2, line3, line4, line5, line6] for ax in axs.flatten(): ax.grid() ax.set_ylim(0, 255) ax.set_xlim(0, 120) ax.legend() axs[1, 2].set_ylim(0, 3000) def amplitude(arr): return max(arr) - min(arr) def init(): return line old_time = [time.clock(), time.clock()] window_size = 20 poss = [45, 25, 0, 180] maxs = [180, 180, 180, 20] mins = [45, 25, 0, 180] def control(): global poss
41 ampl1 = np.array(line4.get_ydata()[-window_size//2:]) ampl2 = np.array(line5.get_ydata()[-window_size//2:]) alpha = np.array(line6.get_ydata()[-window_size:]) if any([x > 150 for x in ampl1]): print('up') poss = maxs if any([x > 150 for x in ampl2]): print('down') poss = mins if any([x > 800 for x in alpha]): send(0, 200, glove) send(1, 200, glove) send(2, 200, glove) else: send(0, 0, glove) send(1, 0, glove) send(2, 0, glove) for channel in range(len(poss)): send(channel + 1, poss[channel], hand) def animate(input_data): data = get_data(glove) if len(data) == 6: old_time[0] = old_time[1] old_time[1] = time.clock() t = old_time[1] - old_time[0]
42 old = line1.get_ydata() line1.set_ydata(np.r_[old[1:], data[4][-1]]) old = line2.get_ydata() line2.set_ydata(np.r_[old[1:], data[3][-1]]) old = line3.get_ydata() new = np.r_[old[1:], data[5][-1]] line3.set_ydata(new) old = line4.get_ydata() window = data[4][-window_size:] line4.set_ydata(np.r_[old[1:], amplitude(window)]) old = line5.get_ydata() window = data[3][-window_size:] line5.set_ydata(np.r_[old[1:], amplitude(window)]) signal = np.array(new, dtype=int) fft = np.fft.fft(signal) size = signal.size timestep = t / size freq = np.fft.fftfreq(size, d=timestep) fft = fft[:size//2] freq = freq[:size//2] amp = [] for i in fft: amp.append(pow(i.real*i.real+i.imag*i.imag, 1/2)) mx = 0 for idx, f in enumerate(freq): if 8 <= f <= 13: mx = max(mx, amp[idx])
43 if mx < 25: mx = 0 old = line6.get_ydata() line6.set_ydata(np.r_[old[1:], mx]) control() return line animation = animation.funcanimation(fig, animate, init_func=init, frames=n, interval=0, blit=true, repeat=true) plt.show() Решение к задаче 5.2 import psutil import os import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation import serial import struct import time process = psutil.process(os.getpid()) process.nice(psutil.realtime_priority_class) glove = serial.serial('com5', , timeout=none) hand = serial.serial('com6', , timeout=none) data = [] glove.flushinput() hand.flushinput() while len(data) < 10:
44 if glove.in_waiting >= 2: data.append(glove.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo if not all([data[key][0] < 9 for key in range(len(data))]): glove.read(1) data.clear() data = [] while len(data) < 10: if hand.in_waiting >= 2: data.append(hand.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo if not all([data[key][0] < 9 for key in range(len(data))]): hand.read(1)
45 data.clear() def get_data(device: serial.serial): data = [] while device.in_waiting >= 2: data.append(device.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo channels = {} for dat in data: channel, value = dat if channel in channels: channels[channel].append(value) else: channels[channel] = [value] return channels def send(channel, value, device: serial.serial): print('send on %d %d' % (channel, value)) arr = bytearray([channel, value]) device.write(arr) n = 1024 fig, axs = plt.subplots(2, 3) for ax in axs.flatten(): ax.grid()
46 ax.set_ylim(0, 255) ax.set_xlim(0, n) ax.legend() line1, = axs[0, 0].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='emg1') line2, = axs[0, 1].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='emg2') line3, = axs[0, 2].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='eeg') line4, = axs[1, 0].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='amplitude 1') line5, = axs[1, 1].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='amplitude 2') line6, = axs[1, 2].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='alpha') line = [line1, line2, line3, line4, line5, line6] for ax in axs.flatten(): ax.grid() ax.set_ylim(0, 255) ax.set_xlim(0, n) ax.legend() axs[1, 2].set_ylim(0, 32000) def amplitude(arr): return max(arr) - min(arr) def init(): return line old_time = [time.clock(), time.clock()] window_size = 40 poss = [180, 45, 25, 0, 180] maxs = [0, 180, 180, 180, 20] mins = [180, 45, 25, 0, 180] unknown, touch, middle = False, False, False
47 def control(): global poss, unknown, touch, middle, maxs, mins ampl1 = np.array(line4.get_ydata()[-window_size//4:]) ampl2 = np.array(line5.get_ydata()[-window_size//4:]) alpha = np.array(line6.get_ydata()[-window_size:]) if any([x > 70 for x in ampl1]): unknown = not unknown if any([x > 70 for x in ampl2]): touch = not touch if any([x > 70 for x in ampl1]) and any([x > 70 for x in ampl2]): middle = not middle if touch: poss[1] = maxs[1] else: poss[1] = mins[1] if unknown: poss[3] = maxs[3] poss[4] = maxs[4] else: poss[3] = mins[3] poss[4] = mins[4] if middle: poss[2] = maxs[2] else: poss[2] = mins[2] if any([x > for x in alpha]): poss[0] = maxs[0]
48 else: poss[0] = mins[0] for channel in range(len(poss)): send(channel, poss[channel], hand) def animate(input_data): control() data = get_data(glove) data_hand = get_data(hand) if len(data) == 6: old_time[0] = old_time[1] old_time[1] = time.clock() t = old_time[1] - old_time[0] print(len(data[5])) old = line1.get_ydata() line1.set_ydata(np.r_[old[5:], data[4][-5:]]) old = line2.get_ydata() line2.set_ydata(np.r_[old[5:], data[3][-5:]]) old = line3.get_ydata() l = len(data[5]) new = np.r_[old[min(n, l):], data[5][-min(n, l):]] line3.set_ydata(new) old = line4.get_ydata() signal = data[4][-window_size:] window = [] for idx in range(window_size // 5, window_size + 1, window_size // 5): window.append(signal[idx - window_size // 5:idx])
49 amp = [] for i in window: amp.append(amplitude(i)) line4.set_ydata(np.r_[old[len(amp):], amp]) old = line5.get_ydata() signal = data[3][-window_size:] window = [] for idx in range(window_size//5, window_size + 1, window_size // 5): window.append(signal[idx - window_size//5:idx]) amp = [] for i in window: amp.append(amplitude(i)) line5.set_ydata(np.r_[old[len(amp):], amp]) signal = np.array(new, dtype=int) fft = np.fft.fft(signal) size = signal.size timestep = t / l freq = np.fft.fftfreq(size, d=timestep) fft = fft[:size//2] freq = freq[:size//2] amp = [] for i in fft: amp.append(pow(i.real*i.real+i.imag*i.imag, 1/2)) mx = 0 for idx, f in enumerate(freq): if 8 <= f <= 14: print(amp[idx])
50 mx = max(mx, amp[idx]) if mx < 25: mx = 0 old = line6.get_ydata() line6.set_ydata(np.r_[old[1:], mx]) # line6.set_data(freq, amp) if len(data_hand) > 2: for channel in range(3): send(channel, data_hand[channel][-1], glove) return line animation = animation.funcanimation(fig, animate, init_func=init, frames=n, interval=0, blit=true, repeat=true) plt.show() Решение к задаче 5.3 import psutil import os import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation import serial import struct import time process = psutil.process(os.getpid()) process.nice(psutil.realtime_priority_class)
51 glove = serial.serial('com5', , timeout=none) hand = serial.serial('com6', , timeout=none) data = [] glove.flushinput() hand.flushinput() while len(data) < 10: if glove.in_waiting >= 2: data.append(glove.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo if not all([data[key][0] < 9 for key in range(len(data))]): glove.read(1) data.clear() data = [] while len(data) < 10: if hand.in_waiting >= 2: data.append(hand.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat:
52 foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo if not all([data[key][0] < 9 for key in range(len(data))]): hand.read(1) data.clear() def get_data(device: serial.serial): data = [] while device.in_waiting >= 2: data.append(device.read(2)) for idx, dat in enumerate(data): dat = struct.unpack('c' * 2, dat) foo = [] for bar in dat: foo.append(int.from_bytes(bar, byteorder='big')) data[idx] = foo channels = {} for dat in data: channel, value = dat if channel in channels: channels[channel].append(value) else: channels[channel] = [value] return channels def send(channel, value, device: serial.serial): print('send on %d %d' % (channel, value))
53 arr = bytearray([channel, value]) device.write(arr) n = 1024 fig, axs = plt.subplots(2, 3) for ax in axs.flatten(): ax.grid() ax.set_ylim(0, 255) ax.set_xlim(0, n) ax.legend() line1, = axs[0, 0].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='emg1') line2, = axs[0, 1].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='emg2') line3, = axs[0, 2].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='eeg') line4, = axs[1, 0].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='amplitude 1') line5, = axs[1, 1].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='amplitude 2') line6, = axs[1, 2].plot(np.arange(n), np.zeros(n), lw=2, animated=true, label='alpha') line = [line1, line2, line3, line4, line5, line6] for ax in axs.flatten(): ax.grid() ax.set_ylim(0, 255) ax.set_xlim(0, n) ax.legend() axs[1, 2].set_ylim(0, 32000) def amplitude(arr): return max(arr) - min(arr) def init():
54 return line old_time = [time.clock(), time.clock()] window_size = 20 poss = [180, 45, 25, 0, 180] maxs = [5, 180, 180, 180, 20] mins = [180, 45, 25, 0, 180] unknown, touch = False, False def control(): global poss, unknown, touch, maxs, mins ampl1 = np.array(line4.get_ydata()[-window_size//4:]) ampl2 = np.array(line5.get_ydata()[-window_size//4:]) alpha = np.array(line6.get_ydata()[-window_size:]) if any([x > 70 for x in ampl1]): unknown = not unknown if any([x > 70 for x in ampl2]): touch = not touch if touch: poss[1] = maxs[1] else: poss[1] = mins[1] if unknown: poss[3] = maxs[3] else: poss[3] = mins[3] if any([x > for x in alpha]): poss[0] = maxs[0] else:
55 poss[0] = mins[0] for channel in range(len(poss)): send(channel, poss[channel], hand) def animate(input_data): control() data = get_data(glove) data_hand = get_data(hand) if len(data) == 6: old_time[0] = old_time[1] old_time[1] = time.clock() t = old_time[1] - old_time[0] print(len(data[5])) old = line1.get_ydata() line1.set_ydata(np.r_[old[5:], data[4][-5:]]) old = line2.get_ydata() line2.set_ydata(np.r_[old[5:], data[3][-5:]]) old = line3.get_ydata() l = len(data[5]) new = np.r_[old[min(n, l):], data[5][-min(n, l):]] line3.set_ydata(new) old = line4.get_ydata() signal = data[4][-window_size:] window = [] for idx in range(window_size // 5, window_size + 1, window_size // 5): window.append(signal[idx - window_size // 5:idx]) amp = [] for i in window:
56 amp.append(amplitude(i)) line4.set_ydata(np.r_[old[len(amp):], amp]) old = line5.get_ydata() signal = data[3][-window_size:] window = [] for idx in range(window_size//5, window_size + 1, window_size // 5): window.append(signal[idx - window_size//5:idx]) amp = [] for i in window: amp.append(amplitude(i)) line5.set_ydata(np.r_[old[len(amp):], amp]) signal = np.array(new, dtype=int) fft = np.fft.fft(signal) size = signal.size timestep = t / l freq = np.fft.fftfreq(size, d=timestep) fft = fft[:size//2] freq = freq[:size//2] amp = [] for i in fft: amp.append(pow(i.real*i.real+i.imag*i.imag, 1/2)) mx = 0 for idx, f in enumerate(freq): if 8 <= f <= 14: print(amp[idx]) mx = max(mx, amp[idx]) if mx < 25:
57 mx = 0 old = line6.get_ydata() line6.set_ydata(np.r_[old[1:], mx]) # line6.set_data(freq, amp) if len(data_hand) > 2: for channel in range(3): send(channel, 200 if data_hand[channel][-1] > 10 else 0, glove) return line animation = animation.funcanimation(fig, animate, init_func=init, frames=n, interval=0, blit=true, repeat=true) plt.show()
Русинович Андрей Сергеевич
Работа победителя заключительного этапа командной инженерной олимпиады школьников Олимпиада Национальной технологической инициативы Профиль «Водные робототехнические системы» Русинович Андрей Сергеевич
More informationКойляк Евгений Андреевич
Работы победителя заключительного этапа командной инженерной олимпиады школьников Олимпиада Национальной технологической инициативы Профиль «Большие данные и машинное обучение» Койляк Евгений Андреевич
More informationБырков Аким Дмитриевич
Работа призера заключительного этапа командной инженерной олимпиады школьников Олимпиада Национальной технологической инициативы Профиль «Виртуальная и дополненная реальность» Бырков Аким Дмитриевич Класс:
More informationКовешников Арсений Александрович
Работа призера заключительного этапа командной инженерной олимпиады школьников Олимпиада Национальной технологической инициативы Профиль «Виртуальная и дополненная реальность» Ковешников Арсений Александрович
More informationMAS212 Scientific Computing and Simulation
MAS212 Scientific Computing and Simulation Dr. Sam Dolan School of Mathematics and Statistics, University of Sheffield Autumn 2017 http://sam-dolan.staff.shef.ac.uk/mas212/ G18 Hicks Building s.dolan@sheffield.ac.uk
More informationPython in Economics and Finance
Python in Economics and Finance Part 2 John Stachurski, ANU June 2014 Topics Data types OOP Iteration Functions NumPy / SciPy Matplotlib Data Types We have already met several native Python data types»>
More informationПодключение ультразвукового датчика HC-SR04
Подключение ультразвукового датчика HC-SR04 Датчик HC-SR-04 состоит из передатчика, приемника и схемы управления. Для наиболее оптимального режима поиска препятствий датчик устанавливается на сервомотор
More informationКарта «Кофейные регионы Эфиопии» Коллеги из Trabocca любезно предоставили нам карту кофейных регионов Эфиопии, за что
19 Февраля 2019 Карта «Кофейные регионы Эфиопии» Коллеги из Trabocca любезно предоставили нам карту кофейных регионов Эфиопии, за что большое им спасибо! Целью создания карты была ощутимая прослеживаемость
More informationIntroduction to Matplotlib: 3D Plotting and Animations
1 Introduction to Matplotlib: 3D Plotting and Animations Lab Objective: 3D plots and animations are useful in visualizing solutions to ODEs and PDEs found in many dynamics and control problems. In this
More informationПлевако Матвей Дмитриевич
Работа победителя/призера заключительного этапа командной инженерной олимпиады школьников Олимпиада Национальной технологической инициативы Профиль «Программная инженерия финансовых технологий» Плевако
More information#To import the whole library under a different name, so you can type "diff_name.f unc_name" import numpy as np import matplotlib.
In [1]: #Here I import the relevant function libraries #This can be done in many ways #To import an entire library (e.g. scipy) so that functions accessed by typing "l ib_name.func_name" import matplotlib
More informationlof April 23, Improving performance of Local outlier factor with KD-Trees
lof April 23, 2014 1 Improving performance of Local outlier factor with KD-Trees Local outlier factor (LOF) is an outlier detection algorithm, that detects outliers based on comparing local density of
More informationArduino Programming. Arduino UNO & Innoesys Educational Shield
Arduino Programming Arduino UNO & Innoesys Educational Shield www.devobox.com Electronic Components & Prototyping Tools 79 Leandrou, 10443, Athens +30 210 51 55 513, info@devobox.com ARDUINO UNO... 3 INNOESYS
More informationNina Popova, St.Petersburg Polytechnic University Liudmila Devel, St.Petersburg University of Culture.
Nina Popova, St.Petersburg Polytechnic University ninavaspo@mail.ru Liudmila Devel, St.Petersburg University of Culture miladevel@gmail.com Content and Language integrated learning is a dual-focused educational
More informationUNIVERSITETET I OSLO
UNIVERSITETET I OSLO Det matematisk-naturvitenskapelige fakultet Examination in: IN1900 Introduction to programming with scientific applications Day of examination: Tuesday, October 10, 2017 Examination
More informationSkills Quiz - Python Edition Solutions
'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ EGR 103L Fall 2017 Skills Quiz - Python Edition Solutions Michael R. Gustafson II Name (please print): NetID (please print): In keeping with the Community
More informationmaking connections general transit feed specification stop names and stop times storing the connections in a dictionary
making connections 1 CTA Tables general transit feed specification stop names and stop times storing the connections in a dictionary 2 CTA Schedules finding connections between stops sparse matrices in
More informationMaine-Quebec Data Generation
Maine-Quebec Data Generation October 4, 2016 1 Testing for a Generalized Conjecture on Sums of Coefficients of Cusp Forms Let f be a weight k cusp form with Fourier expansion f(z) = n 1 a(n)e(nz). Deligne
More informationОБЛАЧНЫЙ ДЕМОЗАЛ. Легко находите KIP Sales, Marketing и технические ресурсы по продукту.
LIKE US KIPAMERICA FOLLOW @KIPWIDEFORMAT SUBSCRIBE KIPAMERICANOVI FOLLOW KIPWIDEFORMAT ОБЛАЧНЫЙ ДЕМОЗАЛ Легко находите KIP Sales, Marketing и технические ресурсы по продукту. Просто нажмите любую ссылку.
More informationMATPLOTLIB. Python for computational science November 2012 CINECA.
MATPLOTLIB Python for computational science 19 21 November 2012 CINECA m.cestari@cineca.it Introduction (1) plotting the data gives us visual feedback in the working process Typical workflow: write a python
More informationFULL GUIDANCE AND TUTORIAL: HOW TO MAKE A DIY SELFIEBOT
FULL GUIDANCE AND TUTORIAL: HOW TO MAKE A DIY SELFIEBOT ENDURANCE 2016 Content Electronics assembling process... 3 Brief instruction for a DIY SelfieBot (SelfieBot Base) assembly process.... 3 Brief instruction
More information2014 МГУ/ВМК/СП. Лекция 7. 1 марта
Лекция 7 1 марта Оператор do-while int pcount_do(unsigned x) { int result = 0; do { result += x & 0x1; x >>= 1; while (x); return result; int pcount_do(unsigned x) { int result = 0; loop: result += x &
More informationfrom sklearn import tree from sklearn.ensemble import AdaBoostClassifier, GradientBoostingClassifier
1 av 7 2019-02-08 10:26 In [1]: import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt from sklearn import tree from sklearn.ensemble import AdaBoostClassifier, GradientBoostingClassifier
More informationБайков Аяз Ильдарович
Работа победителя/призера заключительного этапа командной инженерной олимпиады школьников Олимпиада Национальной технологической инициативы Профиль «Программная инженерия финансовых технологий» Байков
More informationProgramming with Python
Programming with Python EOAS Software Carpentry Workshop September 21st, 2016 https://xkcd.com/353 Getting started For our Python introduction we re going to pretend to be a researcher studying inflammation
More informationОБЪЕКТНО- ОРИЕНТИРОВАННОЕ ПРОГРАММИРОВАНИЕ. Лекция 1 / г.
ОБЪЕКТНО- ОРИЕНТИРОВАННОЕ ПРОГРАММИРОВАНИЕ Лекция 1 / 04 04.03.2019 г. VIRTUAL DESTRUCTOR class Shape{ int x, y; Shape(int x, int y); ~Shape(){ printf("dtor shape!\n"); class Circle: public Shape{ int
More informationБаум Виталий Sr. SharePoint Developer Conteq
Баум Виталий Sr. SharePoint Developer Conteq Office Applications Design Tools SharePoint Описывает схему внешних данных и правила взаимодействия с Office и SharePoint *так же известный как BDC Entity
More informationПроверочная работа. 7 класс. Образец. Инструкция по выполнению работы
Проверочная работа по АНГЛИЙСКОМУ ЯЗЫКУ 7 класс Образец Инструкция по выполнению работы На выполнение работы по английскому языку даётся 45 минут. Работа включает в себя 6 заданий. При необходимости можно
More informationFinal Exam, Version 3 CSci 127: Introduction to Computer Science Hunter College, City University of New York
Final Exam, Version 3 CSci 127: Introduction to Computer Science Hunter College, City University of New York 22 May 2018 1. (a) What will the following Python code print: i. a = "one+two+three+four+five+six"
More information4. BASIC PLOTTING. JHU Physics & Astronomy Python Workshop Lecturer: Mubdi Rahman
4. BASIC PLOTTING JHU Physics & Astronomy Python Workshop 2016 Lecturer: Mubdi Rahman INTRODUCING MATPLOTLIB! Very powerful plotting package. The Docs: http://matplotlib.org/api/pyplot_api.html GETTING
More informationLab 15 - Support Vector Machines in Python
Lab 15 - Support Vector Machines in Python November 29, 2016 This lab on Support Vector Machines is a Python adaptation of p. 359-366 of Introduction to Statistical Learning with Applications in R by Gareth
More informationThe SciPy Stack. Jay Summet
The SciPy Stack Jay Summet May 1, 2014 Outline Numpy - Arrays, Linear Algebra, Vector Ops MatPlotLib - Data Plotting SciPy - Optimization, Scientific functions TITLE OF PRESENTATION 2 What is Numpy? 3rd
More informationArduino Board Design. Nicholas Skadberg 4/30/09 EE290. Dr. Pushkin Kachroo
Arduino Board Design Nicholas Skadberg 4/30/09 EE290 Dr. Pushkin Kachroo Abstract In an effort to further understand the concept of digital control using a microprocessor, a simple serial output device
More informationОсновы Java для разработки приложений для Android. Версия 7 AND-404
Основы Java для разработки приложений для Android. Версия 7 AND-404 ДЕТАЛЬНАЯ ИНФОРМАЦИЯ О КУРСЕ Основы Java для разработки приложений для Android. Версия 7 Код курса: AND-404 Длительность 2 дня / 12 академических
More informationPS6-DCT-Soln-correction
PS6-DCT-Soln-correction Unknown Author March 18, 2014 Part I DCT: Discrete Cosine Transform DCT is a linear map A R N N such that the N real numbers x 0,..., x N 1 are transformed into the N real numbers
More informationBASIC ARDUINO WORKSHOP. Mr. Aldwin and Mr. Bernardo
BASIC ARDUINO WORKSHOP Mr. Aldwin and Mr. Bernardo 1 BASIC ARDUINO WORKSHOP Course Goals Introduce Arduino Hardware and Understand Input Software and Output Create simple project 2 Arduino Open-source
More informationОлимпиада по информатике
Олимпиада по информатике Синица Сергей Геннадьевич Председатель региональной предметно-методической комиссии Доцент кафедры информационных технологий КубГУ Язык программирования С++ или Java + Стандартная
More informationUsing the Matplotlib Library in Python 3
Using the Matplotlib Library in Python 3 Matplotlib is a Python 2D plotting library that produces publication-quality figures in a variety of hardcopy formats and interactive environments across platforms.
More informationSession 1 Use test driven development (i.e. write the tests first) to design functions to give the square, cube and an arbitary power N for a number a. In [1]: import unittest def square(a): return a**2
More informationData Science Essentials
Data Science Essentials Lab 2 Working with Summary Statistics Overview In this lab, you will learn how to use either R or Python to compute and understand the basics of descriptive statistics. Descriptive
More informationStation Automation --W3SZ
Station Automation --W3SZ Now Back to Previously Scheduled Program USB-Serial IF/Transverter Bandswitch Arduino-VHFLog Example I started with Ed Finn WA3DRC s excellent code that was written to give TS2000
More informationNumPy and SciPy. Lab Objective: Create and manipulate NumPy arrays and learn features available in NumPy and SciPy.
Lab 2 NumPy and SciPy Lab Objective: Create and manipulate NumPy arrays and learn features available in NumPy and SciPy. Introduction NumPy and SciPy 1 are the two Python libraries most used for scientific
More informationСеминар 4 (26) Программирование сопроцессора Intel Xeon Phi (MPI)
Семинар 4 (26) Программирование сопроцессора Intel Xeon Phi (MPI) Михаил Курносов E-mail: mkurnosov@gmail.com WWW: www.mkurnosov.net Цикл семинаров «Основы параллельного программирования» Институт физики
More informationPython Matplotlib. MACbioIDi February March 2018
Python Matplotlib MACbioIDi February March 2018 Introduction Matplotlib is a Python 2D plotting library Its origins was emulating the MATLAB graphics commands It makes heavy use of NumPy Objective: Create
More informationOracle Object-Relational Features. Пыхалов А.В. ЮГИНФО
Oracle Object-Relational Features Пыхалов А.В. ЮГИНФО Две грубейшие ошибки ORсистем Под классом объектов понимаем тип данных, имеющий поля и методы Две ошибки OR систем Класс объекта == Отношение Работа
More informationEuler s Method with Python
Euler s Method with Python Intro. to Differential Equations October 23, 2017 1 Euler s Method with Python 1.1 Euler s Method We first recall Euler s method for numerically approximating the solution of
More informationIris Example PyTorch Implementation
Iris Example PyTorch Implementation February, 28 Iris Example using Pytorch.nn Using SciKit s Learn s prebuilt datset of Iris Flowers (which is in a numpy data format), we build a linear classifier in
More informationlab9 task1 nets: Пажитных Иван Павлович 3 курс, 1 группа, МСС github lab link ip/mask /26 ip mask
lab9 Пажитных Иван Павлович 3 курс, 1 группа, МСС github lab link task1 nets: net1: name value ip/mask 176.141.64.0/26 ip 176.141.64.0 mask 255.255.255.192 net size 62 min addr 176.141.64.1 max addr 176.141.64.62
More informationPython Crash Course Numpy, Scipy, Matplotlib
Python Crash Course Numpy, Scipy, Matplotlib That is what learning is. You suddenly understand something you ve understood all your life, but in a new way. Doris Lessing Steffen Brinkmann Max-Planck-Institut
More informationMathematical Programming
Mathematical Programming Example #9-1. Minimize the following problem related to the linear programming. Minimize: f(x, y) = x + 4y Subject to: 3x + y 6 x + 2y 4 y 3 where x TA: Junhee Lee Python Code
More informationArduino 101 AN INTRODUCTION TO ARDUINO BY WOMEN IN ENGINEERING FT T I NA A ND AW E S O ME ME NTO R S
Arduino 101 AN INTRODUCTION TO ARDUINO BY WOMEN IN ENGINEERING FT T I NA A ND AW E S O ME ME NTO R S Overview Motivation Circuit Design and Arduino Architecture Projects Blink the LED Switch Night Lamp
More informationВсероссийская олимпиада школьников по английскому языку г. Школьный этап 7-8 класс Вариант Listening
Шифр Кол-во баллов Всероссийская олимпиада школьников по английскому языку 2015-2016 г. Школьный этап 7-8 класс Вариант 1 Task 1 1. Listening Listen to Nick talking to a shop assistant about two things
More information// Should be right for DVD steppers, but is not too important here const int stepsperrevolution = 48;
/* https://www.youtube.com/watch?v=opz9rgmoipc */ #include #include #define LINE_BUFFER_LENGTH 512 char STEP = MICROSTEP ; // Servo position for Up and Down const int penzup = 50;
More informationОбјектно ориентирано програмирање
Аудиториски вежби 7 Верзија 1.0, 03 април, 2017 Содржина 1. Наследување............................................................... 1 1.1. Задача.................................................................
More informationIntro to Research Computing with Python: Visualization
Intro to Research Computing with Python: Visualization Erik Spence SciNet HPC Consortium 20 November 2014 Erik Spence (SciNet HPC Consortium) Visualization 20 November 2014 1 / 29 Today s class Today we
More informationBi 1x Spring 2014: Plotting and linear regression
Bi 1x Spring 2014: Plotting and linear regression In this tutorial, we will learn some basics of how to plot experimental data. We will also learn how to perform linear regressions to get parameter estimates.
More informationLECTURE 22. Numerical and Scientific Computing Part 2
LECTURE 22 Numerical and Scientific Computing Part 2 MATPLOTLIB We re going to continue our discussion of scientific computing with matplotlib. Matplotlib is an incredibly powerful (and beautiful!) 2-D
More informationMACBIO Marine and Coastal Biodiversity Management in Pacific Island Countries
Marine and Coastal Biodiversity Management in Pacific Island Countries Python Geoprocessing Modules arcpy raster/vector/crs processing module ArcGIS (closed source software) gdal/ogr/osr raster/vector/crs
More information3.The circuit board is composed of 4 sets which are 16x2 LCD Shield, 3 pieces of Switch, 2
Part Number : Product Name : FK-FA1416 MULTI-FUNCTION 16x2 LCD SHIELD This is the experimental board of Multi-Function 16x2 LCD Shield as the fundamental programming about the digits, alphabets and symbols.
More informationIntroduction to Arduino
Introduction to Arduino Paco Abad May 20 th, 2011 WGM #21 Outline What is Arduino? Where to start Types Shields Alternatives Know your board Installing and using the IDE Digital output Serial communication
More informationARDUINO. By Kiran Tiwari BCT 2072 CoTS.
ARDUINO By Kiran Tiwari BCT 2072 CoTS www.kirantiwari.com.np SO What is an Arduino? WELL!! Arduino is an open-source prototyping platform based on easy-to-use hardware and software. Why Arduino? Simplifies
More informationExample of processing FT-ICR data
Example of processing FT-ICR data Marc-André Delsuc - Joensuu August 08 First load some libraries In []: 5 6 7 8 from future import print_function, division import array import os.path as op import numpy
More informationMath-Net.Ru All Russian mathematical portal
Math-Net.Ru All Russian mathematical portal A. Yu. Evnin, N. I. Yusova, An approximation algorithm for the maximum traveling salesman problem, J. Comp. Eng. Math., 2017, Volume 4, Issue 3, 49 54 DOI: https://doi.org/10.14529/jcem170306
More informationA. Python Crash Course
A. Python Crash Course Agenda A.1 Installing Python & Co A.2 Basics A.3 Data Types A.4 Conditions A.5 Loops A.6 Functions A.7 I/O A.8 OLS with Python 2 A.1 Installing Python & Co You can download and install
More informationТребования к оформлению статей, представляемых для опубликования в сборнике, который индексируется в международной системе «Scopus».
Требования к оформлению статей, представляемых для опубликования в сборнике, который индексируется в международной системе «Scopus». Рекомендации подготовлены по материалам сайта http://www.balkema.nl/
More informationPlatform Independent Implementation of High Speed Serial Communication Based on FPGA
Journal of Siberian Federal University. Engineering & Technologies, 2016, 9(2), 189-196 ~ ~ ~ УДК 621.391-026.51:004.4 2 Platform Independent Implementation of High Speed Serial Communication Based on
More informationManual_implementation_of_the_Mersenne_twister_PseudoRandom_N
Manual_implementation_of_the_Mersenne_twister_PseudoRandom_N May 4, 2017 1 Table of Contents 1 Manual implementation of the Mersenne twister PseudoRandom Number Generator (PRNG) 1.1 Common API for the
More informationHW0 v3. October 2, CSE 252A Computer Vision I Fall Assignment 0
HW0 v3 October 2, 2018 1 CSE 252A Computer Vision I Fall 2018 - Assignment 0 1.0.1 Instructor: David Kriegman 1.0.2 Assignment Published On: Tuesday, October 2, 2018 1.0.3 Due On: Tuesday, October 9, 2018
More information5 File I/O, Plotting with Matplotlib
5 File I/O, Plotting with Matplotlib Bálint Aradi Course: Scientific Programming / Wissenchaftliches Programmieren (Python) Installing some SciPy stack components We will need several Scipy components
More informationTypeScript. Часть II. Старков Дима
TypeScript Часть II Старков Дима 1 Сегодня Вывод типов Структурная типизация Более сложные типы Обобщенные типы Type Guards 2 TypeScript? Спасет от выстрелов себе в ногу ESNext прямо сейчас Средство против
More informationNote. The above image and many others are courtesy of - this is a wonderful resource for designing circuits.
Robotics and Electronics Unit 2. Arduino Objectives. Students will understand the basic characteristics of an Arduino Uno microcontroller. understand the basic structure of an Arduino program. know how
More informationPolygonMap Help. Contents
PolygonMap Help Contents Introduction 2 One poly mapping 3 Parameters Rollout 5 Link Rollout 10 Transform Rollout 13 Slice Rollout 14 Viewport Rollout 14 Junction point 15 Additional info 16 Mapping creation
More informationCSci 127: Introduction to Computer Science
CSci 127: Introduction to Computer Science hunter.cuny.edu/csci CSci 127 (Hunter) Lecture 11: tinyurl.com/yb8lcvl7 15 November 2017 1 / 48 Lecture Slip: tinyurl.com/yb8lcvl7 CSci 127 (Hunter) Lecture 11:
More informationFinal Exam, Version 1 CSci 127: Introduction to Computer Science Hunter College, City University of New York
Final Exam, Version 1 CSci 127: Introduction to Computer Science Hunter College, City University of New York 17 May 2018 1. (a) What will the following Python code print: i. a = "Jan&Feb&Mar&Apr&May&Jun"
More informationProgramming for Engineers in Python
Programming for Engineers in Python Autumn 2016-17 Lecture 11: NumPy & SciPy Introduction, Plotting and Data Analysis 1 Today s Plan Introduction to NumPy & SciPy Plotting Data Analysis 2 NumPy and SciPy
More information(2) Hypothesis Testing
(2) Hypothesis Testing March 1, 2016 In [4]: %matplotlib inline #python includes import sys #standard probability includes: import numpy as np #matrices and data structures import scipy.stats as ss #standard
More information2.1 Indefinite Loops. while <condition>: <body> rabbits = 3 while rabbits > 0: print rabbits rabbits -= 1
2.1 Indefinite Loops The final kind of control flow is Python s indefinite loop, the while loop. It functions much like the for loop in that it repeatedly executes some body of statements. The difference
More informationSpecification. 1.Power Supply direct from Microcontroller Board. 2.The circuit can be used with Microcontroller Board such as Arduino UNO R3.
Part Number : Product Name : FK-FA1410 12-LED AND 3-BOTTON SHIELD This is the experimental board for receiving and transmitting data from the port of microcontroller. The function of FK-FA1401 is fundamental
More informationSkills Quiz - Python Edition Solutions
'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ EGR 103L Fall 2016 Skills Quiz - Python Edition Solutions Rebecca A. Simmons and & Michael R. Gustafson II Name (please print): NetID (please print): In
More information(DRAFT) PYTHON FUNDAMENTALS II: NUMPY & MATPLOTLIB
(DRAFT) PYTHON FUNDAMENTALS II: NUMPY & MATPLOTLIB TROY P. KLING Contents 1. Importing Libraries 1 2. Introduction to numpy 2 3. Introduction to matplotlib 5 4. Image Processing 8 5. The Mandelbrot Set
More informationИнформатика и вычислительная техника
Информатика и вычислительная техника UDC 004.056.55 Symmetric Encryption on the Base of Splitting Method V. L. Stefanyuk *, A. H. Alhussain * Institute of Information Transmission Problems, Moscow, Russia
More informationHomework 11 - Debugging
1 of 7 5/28/2018, 1:21 PM Homework 11 - Debugging Instructions: Fix the errors in the following problems. Some of the problems are with the code syntax, causing an error message. Other errors are logical
More informationComputational Physics Programming Style and Practices & Visualizing Data via Plotting
Computational Physics Programming Style and Practices & Visualizing Data via Plotting Prof. Paul Eugenio Department of Physics Florida State University Jan 30, 2018 http://comphy.fsu.edu/~eugenio/comphy/
More informationОбјектно ориентирано програмирање
Аудиториски вежби 11 Верзија 1.0, 4 мај, 2017 Содржина 1. Генеричко програмирање и темплејти...................................... 1 1.1. Функциски темплејти..................................................
More informationRS485 Sensor Node V1.0 (SKU:DFR0233)
RS485 Sensor Node V1.0 (SKU:DFR0233) Contents 1 Introduction 2 Application 3 Specification 4 Pin Out 4.1 More details 5 Product Directive 6 Connecting Diagram 7 Sample Code Introduction This RS-485 Sensor
More informationUNIVERSITETET I OSLO
(Continued on page 2.) UNIVERSITETET I OSLO Det matematisk-naturvitenskapelige fakultet Examination in: INF1100 Introduction to programming with scientific applications Day of examination: Thursday, October
More informationActivity recognition and energy expenditure estimation
Activity recognition and energy expenditure estimation A practical approach with Python WebValley 2015 Bojan Milosevic Scope Goal: Use wearable sensors to estimate energy expenditure during everyday activities
More informationmpl Release latest May 17, 2017
mpl a nimationmanagerdocumentation Release latest May 17, 2017 Contents 1 NOTE: Documentation is curently in development!!! 1 1.1 Matplotlib animation manager (GUI) 1.0a1...............................
More informationInteractive Mode Python Pylab
Short Python Intro Gerald Schuller, Nov. 2016 Python can be very similar to Matlab, very easy to learn if you already know Matlab, it is Open Source (unlike Matlab), it is easy to install, and unlike Matlab
More informationEEG 101L INTRODUCTION TO ENGINEERING EXPERIENCE
EEG 101L INTRODUCTION TO ENGINEERING EXPERIENCE LABORATORY 1: INTRODUCTION TO ARDUINO IDE AND PROGRAMMING DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING UNIVERSITY OF NEVADA, LAS VEGAS 1. FYS KIT COMPONENTS
More informationArduino Programming Part 4: Flow Control
Arduino Programming Part 4: Flow Control EAS 199B, Winter 2010 Gerald Recktenwald Portland State University gerry@me.pdx.edu Goal Make choices based on conditions in the environment Logical expressions:
More information, «Ruby»..,
,.. 2018 44.03.01 44.03.01.09 «Ruby»..,..... 2018 ... 3 1.... 5 1.1.... 5 1.2.,... 21 1.3. Ruby... 30 e 1... 34 2. - «Ruby»... 37 2.1. «Ruby»,... 37 2.2. «Ruby»... 50 2.3. «Ruby»... 63 2... 67... 68...
More informationVisualization of states
Visualization of states February 15, 2017 1 Visualization of states Course on Quantum Information Scuola Galileiana di Studi Superiori Instructors: Paolo Villoresi and Giuseppe Vallone University of Padua
More informationSTATISTICAL THINKING IN PYTHON II. Generating bootstrap replicates
STATISTICAL THINKING IN PYTHON II Generating bootstrap replicates Michelson's speed of light measurements Data: Michelson, 1880 Resampling an array Data: [23.3, 27.1, 24.3, 25.3, 26.0] Mean = 25.2 Resampled
More informationCME 193: Introduction to Scientific Python Lecture 6: Numpy, Scipy, Matplotlib
CME 193: Introduction to Scientific Python Lecture 6: Numpy, Scipy, Matplotlib Nolan Skochdopole stanford.edu/class/cme193 6: Numpy, Scipy, Matplotlib 6-1 Contents Homeworks and Project Numpy Scipy Matplotlib
More informationVisualisation in python (with Matplotlib)
Visualisation in python (with Matplotlib) Thanks to all contributors: Ag Stephens, Stephen Pascoe. Introducing Matplotlib Matplotlib is a python 2D plotting library which produces publication quality figures
More informationPYTHON DATA VISUALIZATIONS
PYTHON DATA VISUALIZATIONS from Learning Python for Data Analysis and Visualization by Jose Portilla https://www.udemy.com/learning-python-for-data-analysis-and-visualization/ Notes by Michael Brothers
More information#include <Keypad.h> int datasens; #define pinsens 11. const byte ROWS = 4; //four rows const byte COLS = 3; //three columns
#include int datasens; #define pinsens 11 const byte ROWS = 4; //four rows const byte COLS = 3; //three columns char keys[rows][cols] = '1','2','3', '4','5','6', '7','8','9', '*','0','#' ; byte
More informationMath-Net.Ru All Russian mathematical portal
Math-Net.Ru All Russian mathematical portal Sergey Ivanov, Anna Kalenkova, Comparing process models in the BPMN 2.0 XML format, Proceedings of ISP RAS, 2015, Volume 27, Issue 3, 255 266 DOI: https://doi.org/10.15514/ispras-2015-27(3)-17
More informationSelf-configuring Nature Inspired Algorithms for Combinatorial Optimization Problems
Journal of Siberian Federal University. Mathematics & Physics 2017, 10(4), 463-473 УДК 519.87 Self-configuring Nature Inspired Algorithms for Combinatorial Optimization Problems Olga Ev. Semenkina Eugene
More information