msobral commited on
Commit
2e1823f
·
1 Parent(s): e6d2697

started implementing filtering (to debug and optimize)

Browse files
Files changed (3) hide show
  1. portiloop/capture.py +88 -19
  2. portiloop/notebooks/tests.ipynb +22 -4
  3. setup.py +3 -2
portiloop/capture.py CHANGED
@@ -9,6 +9,7 @@ import multiprocessing as mp
9
  import warnings
10
  import shutil
11
  from threading import Thread, Lock
 
12
 
13
  import matplotlib.pyplot as plt
14
  from EDFlib.edfwriter import EDFwriter
@@ -137,6 +138,7 @@ def mod_config(config, datarate, channel_modes):
137
  print(f"DEBUG: new config[3]:{hex(config[3])}")
138
  return config
139
 
 
140
  def filter_24(value):
141
  return (value * 4.5) / (2**23 - 1) # 23 because 1 bit is lost for sign
142
 
@@ -146,6 +148,77 @@ def filter_2scomplement_np(value):
146
  def filter_np(value):
147
  return filter_24(filter_2scomplement_np(value))
148
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  class LiveDisplay():
150
  def __init__(self, channel_names, window_len=100):
151
  self.datapoint_dim = len(channel_names)
@@ -260,8 +333,8 @@ def _capture_process(p_data_o, p_msg_io, duration, frequency, python_clock, time
260
  leds.aquisition(False)
261
 
262
  finally:
263
- frontend.close()
264
  leds.close()
 
265
  p_msg_io.send('STOP')
266
  p_msg_io.close()
267
  p_data_o.close()
@@ -508,11 +581,6 @@ class Capture:
508
  self._t_capture = Thread(target=self.start_capture,
509
  args=(self.record, self.display, 500, self.python_clock))
510
  self._t_capture.start()
511
- # self.start_capture(
512
- # record=self.record,
513
- # viz=self.display,
514
- # width=500,
515
- # python_clock=self.python_clock)
516
  elif val == 'Stop':
517
  with self._lock_msg_out:
518
  self._msg_out = 'STOP'
@@ -597,16 +665,15 @@ class Capture:
597
  viz,
598
  width,
599
  python_clock):
600
-
601
- p_msg_io, p_msg_io_2 = mp.Pipe()
602
- p_data_i, p_data_o = mp.Pipe(duplex=False)
603
-
604
  if self.__capture_on:
605
  warnings.warn("Capture is already ongoing, ignoring command.")
606
  return
607
  else:
608
  self.__capture_on = True
 
 
609
  SAMPLE_TIME = 1 / self.frequency
 
610
  self._p_capture = mp.Process(target=_capture_process,
611
  args=(p_data_o,
612
  p_msg_io_2,
@@ -624,8 +691,7 @@ class Capture:
624
  if record:
625
  self.open_recording_file()
626
 
627
- cc = True
628
- while cc:
629
  with self._lock_msg_out:
630
  if self._msg_out is not None:
631
  p_msg_io.send(self._msg_out)
@@ -633,7 +699,7 @@ class Capture:
633
  if p_msg_io.poll():
634
  mess = p_msg_io.recv()
635
  if mess == 'STOP':
636
- cc = False
637
  elif mess[0] == 'PRT':
638
  print(mess[1])
639
 
@@ -651,23 +717,27 @@ class Capture:
651
 
652
  n_array = np.array(res)
653
  n_array = filter_np(n_array)
 
 
 
 
 
654
 
655
  to_add = n_array.tolist()
656
-
657
  if viz:
658
  live_disp.add_datapoints(to_add)
659
  if record:
660
  self.add_recording_data(to_add)
661
 
662
  # empty pipes
663
- cc = True
664
- while cc:
665
  if p_data_i.poll():
666
  _ = p_data_i.recv()
667
  elif p_msg_io.poll():
668
  _ = p_msg_io.recv()
669
  else:
670
- cc = False
671
 
672
  p_data_i.close()
673
  p_msg_io.close()
@@ -680,5 +750,4 @@ class Capture:
680
 
681
 
682
  if __name__ == "__main__":
683
- # TODO: Argparse this
684
- pass
 
9
  import warnings
10
  import shutil
11
  from threading import Thread, Lock
12
+ from scipy import signal
13
 
14
  import matplotlib.pyplot as plt
15
  from EDFlib.edfwriter import EDFwriter
 
138
  print(f"DEBUG: new config[3]:{hex(config[3])}")
139
  return config
140
 
141
+
142
  def filter_24(value):
143
  return (value * 4.5) / (2**23 - 1) # 23 because 1 bit is lost for sign
144
 
 
148
  def filter_np(value):
149
  return filter_24(filter_2scomplement_np(value))
150
 
151
+
152
+ class FilterPipeline:
153
+ def __init__(self, power_line_fq=60):
154
+ assert power_line_fq in [50, 60], f"The only supported power line frequencies are 50Hz and 60Hz"
155
+ if power_line_fq == 60:
156
+ self.notch_coeff1 = -0.12478308884588535
157
+ self.notch_coeff2 = 0.98729186796473023
158
+ self.notch_coeff3 = 0.99364593398236511
159
+ self.notch_coeff4 = -0.12478308884588535
160
+ self.notch_coeff5 = 0.99364593398236511
161
+ else:
162
+ self.notch_coeff1 = -0.61410695998423581
163
+ self.notch_coeff2 = 0.98729186796473023
164
+ self.notch_coeff3 = 0.99364593398236511
165
+ self.notch_coeff4 = -0.61410695998423581
166
+ self.notch_coeff5 = 0.99364593398236511
167
+ self.dfs = [0, 0]
168
+
169
+ self.moving_average = None
170
+ self.moving_variance = 0
171
+ self.ALPHA_AVG = 0.1
172
+ self.ALPHA_STD = 0.001
173
+ self.EPSILON = 0.000001
174
+
175
+ self.fir_30_coef = [
176
+ 0.001623780150148094927192721215192250384,
177
+ 0.014988684599373741992978104065059596905,
178
+ 0.021287595318265635502275046064823982306,
179
+ 0.007349500393709578957568417933998716762,
180
+ -0.025127515717112181709014251396183681209,
181
+ -0.052210507359822452833064687638398027048,
182
+ -0.039273839505489904766477593511808663607,
183
+ 0.033021568427940004020193498490698402748,
184
+ 0.147606943281569008563636202779889572412,
185
+ 0.254000252034505602516389899392379447818,
186
+ 0.297330876398883392486283128164359368384,
187
+ 0.254000252034505602516389899392379447818,
188
+ 0.147606943281569008563636202779889572412,
189
+ 0.033021568427940004020193498490698402748,
190
+ -0.039273839505489904766477593511808663607,
191
+ -0.052210507359822452833064687638398027048,
192
+ -0.025127515717112181709014251396183681209,
193
+ 0.007349500393709578957568417933998716762,
194
+ 0.021287595318265635502275046064823982306,
195
+ 0.014988684599373741992978104065059596905,
196
+ 0.001623780150148094927192721215192250384]
197
+ self.z = signal.lfilter_zi(self.fir_30_coef, 1)
198
+
199
+ def filter(self, value):
200
+ result = np.zeros(value.size)
201
+ for i, x in enumerate(value):
202
+ # FIR:
203
+ x, self.z = signal.lfilter(self.fir_30_coef, 1, [x], zi=self.z)
204
+ # notch:
205
+ denAccum = (x - self.notch_coeff1 * self.dfs[0]) - self.notch_coeff2 * self.dfs[1]
206
+ x = (self.notch_coeff3 * denAccum + self.notch_coeff4 * self.dfs[0]) + self.notch_coeff5 * self.dfs[1]
207
+ self.dfs[1] = self.dfs[0]
208
+ self.dfs[0] = denAccum
209
+ # standardization:
210
+ if self.moving_average is not None:
211
+ delta = x - self.moving_average
212
+ self.moving_average = self.moving_average + self.ALPHA_AVG * delta
213
+ self.moving_variance = (1 - self.ALPHA_STD) * (self.moving_variance + self.ALPHA_STD * delta**2)
214
+ moving_std = np.sqrt(self.moving_variance)
215
+ x = (x - self.moving_average) / (moving_std + self.EPSILON)
216
+ else:
217
+ self.moving_average = x
218
+ result[i] = x
219
+ return result
220
+
221
+
222
  class LiveDisplay():
223
  def __init__(self, channel_names, window_len=100):
224
  self.datapoint_dim = len(channel_names)
 
333
  leds.aquisition(False)
334
 
335
  finally:
 
336
  leds.close()
337
+ frontend.close()
338
  p_msg_io.send('STOP')
339
  p_msg_io.close()
340
  p_data_o.close()
 
581
  self._t_capture = Thread(target=self.start_capture,
582
  args=(self.record, self.display, 500, self.python_clock))
583
  self._t_capture.start()
 
 
 
 
 
584
  elif val == 'Stop':
585
  with self._lock_msg_out:
586
  self._msg_out = 'STOP'
 
665
  viz,
666
  width,
667
  python_clock):
 
 
 
 
668
  if self.__capture_on:
669
  warnings.warn("Capture is already ongoing, ignoring command.")
670
  return
671
  else:
672
  self.__capture_on = True
673
+ p_msg_io, p_msg_io_2 = mp.Pipe()
674
+ p_data_i, p_data_o = mp.Pipe(duplex=False)
675
  SAMPLE_TIME = 1 / self.frequency
676
+ fp_vec = [FilterPipeline() for _ in range(8)]
677
  self._p_capture = mp.Process(target=_capture_process,
678
  args=(p_data_o,
679
  p_msg_io_2,
 
691
  if record:
692
  self.open_recording_file()
693
 
694
+ while True:
 
695
  with self._lock_msg_out:
696
  if self._msg_out is not None:
697
  p_msg_io.send(self._msg_out)
 
699
  if p_msg_io.poll():
700
  mess = p_msg_io.recv()
701
  if mess == 'STOP':
702
+ break
703
  elif mess[0] == 'PRT':
704
  print(mess[1])
705
 
 
717
 
718
  n_array = np.array(res)
719
  n_array = filter_np(n_array)
720
+
721
+ if True:
722
+ n_array = np.swapaxes(n_array, 0, 1)
723
+ n_array = np.array([fp_vec[i].filter(a) for i, a in enumerate(n_array)])
724
+ n_array = np.swapaxes(n_array, 0, 1)
725
 
726
  to_add = n_array.tolist()
727
+
728
  if viz:
729
  live_disp.add_datapoints(to_add)
730
  if record:
731
  self.add_recording_data(to_add)
732
 
733
  # empty pipes
734
+ while True:
 
735
  if p_data_i.poll():
736
  _ = p_data_i.recv()
737
  elif p_msg_io.poll():
738
  _ = p_msg_io.recv()
739
  else:
740
+ break
741
 
742
  p_data_i.close()
743
  p_msg_io.close()
 
750
 
751
 
752
  if __name__ == "__main__":
753
+ pass
 
portiloop/notebooks/tests.ipynb CHANGED
@@ -11,7 +11,7 @@
11
  {
12
  "data": {
13
  "application/vnd.jupyter.widget-view+json": {
14
- "model_id": "93964096f2f144cd84cacc5a487c74b4",
15
  "version_major": 2,
16
  "version_minor": 0
17
  },
@@ -9870,7 +9870,7 @@
9870
  " };\n",
9871
  " };\n",
9872
  "})();\n",
9873
- "</script><svg id=\"425ebc5e-c3c2-4c33-a0b3-d9476bf53630\" class=\"learning-curve\"></svg><script> window.setupLearningCurve({\"id\": \"425ebc5e-c3c2-4c33-a0b3-d9476bf53630\", \"width\": 600, \"height\": 1690, \"lineConfig\": {\"line-1\": {\"name\": \"line-1\", \"color\": \"#1f77b4\"}}, \"facetConfig\": {\"ch1\": {\"name\": \"ch1\", \"limit\": [null, null]}, \"ch2\": {\"name\": \"ch2\", \"limit\": [null, null]}, \"ch3\": {\"name\": \"ch3\", \"limit\": [null, null]}, \"ch4\": {\"name\": \"ch4\", \"limit\": [null, null]}, \"ch5\": {\"name\": \"ch5\", \"limit\": [null, null]}, \"ch6\": {\"name\": \"ch6\", \"limit\": [null, null]}, \"ch7\": {\"name\": \"ch7\", \"limit\": [null, null]}, \"ch8\": {\"name\": \"ch8\", \"limit\": [null, null]}}, \"xAxisConfig\": {\"name\": \"iteration\", \"limit\": [null, null]}, \"max_window_len\": 500});</script>"
9874
  ],
9875
  "text/plain": [
9876
  "<IPython.core.display.HTML object>"
@@ -9882,7 +9882,7 @@
9882
  {
9883
  "data": {
9884
  "application/javascript": [
9885
- "window.appendLearningCurve([{\"x\": 6712.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.37083743463008817}, \"ch3\": {\"line-1\": -4.500000536441867}, \"ch4\": {\"line-1\": 0.0}, \"ch5\": {\"line-1\": 0.0}, \"ch6\": {\"line-1\": 0.0}, \"ch7\": {\"line-1\": 0.0}, \"ch8\": {\"line-1\": 0.0}}}, {\"x\": 6713.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.19814338661949474}, \"ch3\": {\"line-1\": -4.500000536441867}, \"ch4\": {\"line-1\": 0.0}, \"ch5\": {\"line-1\": 0.0}, \"ch6\": {\"line-1\": 0.0}, \"ch7\": {\"line-1\": 0.0}, \"ch8\": {\"line-1\": 0.0}}}, {\"x\": 6714.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.20779719445671968}, \"ch3\": {\"line-1\": -4.500000536441867}, \"ch4\": {\"line-1\": 0.0}, \"ch5\": {\"line-1\": 0.0}, \"ch6\": {\"line-1\": 0.0}, \"ch7\": {\"line-1\": 0.0}, \"ch8\": {\"line-1\": 0.0}}}, {\"x\": 6715.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.40018241407661603}, \"ch3\": {\"line-1\": -4.500000536441867}, \"ch4\": {\"line-1\": 0.0}, \"ch5\": {\"line-1\": 0.0}, \"ch6\": {\"line-1\": 0.0}, \"ch7\": {\"line-1\": 0.0}, \"ch8\": {\"line-1\": 0.0}}}, {\"x\": 6716.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.4082268963130589}, \"ch3\": {\"line-1\": -4.500000536441867}, \"ch4\": {\"line-1\": 0.0}, \"ch5\": {\"line-1\": 0.0}, \"ch6\": {\"line-1\": 0.0}, \"ch7\": {\"line-1\": 0.0}, \"ch8\": {\"line-1\": 0.0}}}, {\"x\": 6717.0, \"y\": {\"ch1\": {\"line-1\": 0.0}, \"ch2\": {\"line-1\": -0.2183457873279795}, \"ch3\": {\"line-1\": -4.500000536441867}, \"ch4\": {\"line-1\": 0.0}, \"ch5\": {\"line-1\": 0.0}, \"ch6\": {\"line-1\": 0.0}, \"ch7\": {\"line-1\": 0.0}, \"ch8\": {\"line-1\": 0.0}}}]);"
9886
  ],
9887
  "text/plain": [
9888
  "<IPython.core.display.Javascript object>"
@@ -9890,6 +9890,24 @@
9890
  },
9891
  "metadata": {},
9892
  "output_type": "display_data"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9893
  }
9894
  ],
9895
  "source": [
@@ -9901,7 +9919,7 @@
9901
  {
9902
  "cell_type": "code",
9903
  "execution_count": null,
9904
- "id": "4209ba44",
9905
  "metadata": {},
9906
  "outputs": [],
9907
  "source": []
 
11
  {
12
  "data": {
13
  "application/vnd.jupyter.widget-view+json": {
14
+ "model_id": "f5324e9b9a7747e78970e0a68907730a",
15
  "version_major": 2,
16
  "version_minor": 0
17
  },
 
9870
  " };\n",
9871
  " };\n",
9872
  "})();\n",
9873
+ "</script><svg id=\"091b229a-633c-436e-b8c0-2f7f5258828c\" class=\"learning-curve\"></svg><script> window.setupLearningCurve({\"id\": \"091b229a-633c-436e-b8c0-2f7f5258828c\", \"width\": 600, \"height\": 1690, \"lineConfig\": {\"line-1\": {\"name\": \"line-1\", \"color\": \"#1f77b4\"}}, \"facetConfig\": {\"ch1\": {\"name\": \"ch1\", \"limit\": [null, null]}, \"ch2\": {\"name\": \"ch2\", \"limit\": [null, null]}, \"ch3\": {\"name\": \"ch3\", \"limit\": [null, null]}, \"ch4\": {\"name\": \"ch4\", \"limit\": [null, null]}, \"ch5\": {\"name\": \"ch5\", \"limit\": [null, null]}, \"ch6\": {\"name\": \"ch6\", \"limit\": [null, null]}, \"ch7\": {\"name\": \"ch7\", \"limit\": [null, null]}, \"ch8\": {\"name\": \"ch8\", \"limit\": [null, null]}}, \"xAxisConfig\": {\"name\": \"iteration\", \"limit\": [null, null]}, \"max_window_len\": 500});</script>"
9874
  ],
9875
  "text/plain": [
9876
  "<IPython.core.display.HTML object>"
 
9882
  {
9883
  "data": {
9884
  "application/javascript": [
9885
+ "window.appendLearningCurve([{\"x\": 20450.0, \"y\": {\"ch1\": {\"line-1\": -2.9030259938012565e-54}, \"ch2\": {\"line-1\": -0.07546732733714091}, \"ch3\": {\"line-1\": -0.20643199954404914}, \"ch4\": {\"line-1\": -2.9030259938012565e-54}, \"ch5\": {\"line-1\": -2.9030259938012565e-54}, \"ch6\": {\"line-1\": -2.9030259938012565e-54}, \"ch7\": {\"line-1\": -2.9030259938012565e-54}, \"ch8\": {\"line-1\": -2.9030259938012565e-54}}}, {\"x\": 20451.0, \"y\": {\"ch1\": {\"line-1\": -3.0594321512716503e-54}, \"ch2\": {\"line-1\": -0.059337661809921734}, \"ch3\": {\"line-1\": -0.23552121171216808}, \"ch4\": {\"line-1\": -3.0594321512716503e-54}, \"ch5\": {\"line-1\": -3.0594321512716503e-54}, \"ch6\": {\"line-1\": -3.0594321512716503e-54}, \"ch7\": {\"line-1\": -3.0594321512716503e-54}, \"ch8\": {\"line-1\": -3.0594321512716503e-54}}}, {\"x\": 20452.0, \"y\": {\"ch1\": {\"line-1\": 2.4862914700592893e-54}, \"ch2\": {\"line-1\": -0.043598015860031564}, \"ch3\": {\"line-1\": -0.2652718918870426}, \"ch4\": {\"line-1\": 2.4862914700592893e-54}, \"ch5\": {\"line-1\": 2.4862914700592893e-54}, \"ch6\": {\"line-1\": 2.4862914700592893e-54}, \"ch7\": {\"line-1\": 2.4862914700592893e-54}, \"ch8\": {\"line-1\": 2.4862914700592893e-54}}}, {\"x\": 20453.0, \"y\": {\"ch1\": {\"line-1\": 3.333081823775676e-54}, \"ch2\": {\"line-1\": -0.030811794304587956}, \"ch3\": {\"line-1\": -0.2834467295243876}, \"ch4\": {\"line-1\": 3.333081823775676e-54}, \"ch5\": {\"line-1\": 3.333081823775676e-54}, \"ch6\": {\"line-1\": 3.333081823775676e-54}, \"ch7\": {\"line-1\": 3.333081823775676e-54}, \"ch8\": {\"line-1\": 3.333081823775676e-54}}}, {\"x\": 20454.0, \"y\": {\"ch1\": {\"line-1\": -2.0403975607833408e-54}, \"ch2\": {\"line-1\": -0.021667958732314238}, \"ch3\": {\"line-1\": -0.2792884454497189}, \"ch4\": {\"line-1\": -2.0403975607833408e-54}, \"ch5\": {\"line-1\": -2.0403975607833408e-54}, \"ch6\": {\"line-1\": -2.0403975607833408e-54}, \"ch7\": {\"line-1\": -2.0403975607833408e-54}, \"ch8\": {\"line-1\": -2.0403975607833408e-54}}}, {\"x\": 20455.0, \"y\": {\"ch1\": {\"line-1\": -3.5477873817898297e-54}, \"ch2\": {\"line-1\": -0.01649391050712547}, \"ch3\": {\"line-1\": -0.24854112980561227}, \"ch4\": {\"line-1\": -3.5477873817898297e-54}, \"ch5\": {\"line-1\": -3.5477873817898297e-54}, \"ch6\": {\"line-1\": -3.5477873817898297e-54}, \"ch7\": {\"line-1\": -3.5477873817898297e-54}, \"ch8\": {\"line-1\": -3.5477873817898297e-54}}}, {\"x\": 20456.0, \"y\": {\"ch1\": {\"line-1\": 1.5730521901165702e-54}, \"ch2\": {\"line-1\": -0.015494579533302476}, \"ch3\": {\"line-1\": -0.19568680913326472}, \"ch4\": {\"line-1\": 1.5730521901165702e-54}, \"ch5\": {\"line-1\": 1.5730521901165702e-54}, \"ch6\": {\"line-1\": 1.5730521901165702e-54}, \"ch7\": {\"line-1\": 1.5730521901165702e-54}, \"ch8\": {\"line-1\": 1.5730521901165702e-54}}}, {\"x\": 20457.0, \"y\": {\"ch1\": {\"line-1\": 3.701578256605015e-54}, \"ch2\": {\"line-1\": -0.018850869041644992}, \"ch3\": {\"line-1\": -0.13547278912385383}, \"ch4\": {\"line-1\": 3.701578256605015e-54}, \"ch5\": {\"line-1\": 3.701578256605015e-54}, \"ch6\": {\"line-1\": 3.701578256605015e-54}, \"ch7\": {\"line-1\": 3.701578256605015e-54}, \"ch8\": {\"line-1\": 3.701578256605015e-54}}}, {\"x\": 20458.0, \"y\": {\"ch1\": {\"line-1\": -1.092116791352032e-54}, \"ch2\": {\"line-1\": -0.02634619623054456}, \"ch3\": {\"line-1\": -0.08466356091762652}, \"ch4\": {\"line-1\": -1.092116791352032e-54}, \"ch5\": {\"line-1\": -1.092116791352032e-54}, \"ch6\": {\"line-1\": -1.092116791352032e-54}, \"ch7\": {\"line-1\": -1.092116791352032e-54}, \"ch8\": {\"line-1\": -1.092116791352032e-54}}}, {\"x\": 20459.0, \"y\": {\"ch1\": {\"line-1\": -3.793488887000529e-54}, \"ch2\": {\"line-1\": -0.036764943344715306}, \"ch3\": {\"line-1\": -0.049267798734819}, \"ch4\": {\"line-1\": -3.793488887000529e-54}, \"ch5\": {\"line-1\": -3.793488887000529e-54}, \"ch6\": {\"line-1\": -3.793488887000529e-54}, \"ch7\": {\"line-1\": -3.793488887000529e-54}, \"ch8\": {\"line-1\": -3.793488887000529e-54}}}, {\"x\": 20460.0, \"y\": {\"ch1\": {\"line-1\": 6.0547900571557636e-55}, \"ch2\": {\"line-1\": -0.04773144629015497}, \"ch3\": {\"line-1\": -0.023831293460410706}, \"ch4\": {\"line-1\": 6.0547900571557636e-55}, \"ch5\": {\"line-1\": 6.0547900571557636e-55}, \"ch6\": {\"line-1\": 6.0547900571557636e-55}, \"ch7\": {\"line-1\": 6.0547900571557636e-55}, \"ch8\": {\"line-1\": 6.0547900571557636e-55}}}, {\"x\": 20461.0, \"y\": {\"ch1\": {\"line-1\": 3.823549932446837e-54}, \"ch2\": {\"line-1\": -0.05582508048810795}, \"ch3\": {\"line-1\": -0.001580731856460332}, \"ch4\": {\"line-1\": 3.823549932446837e-54}, \"ch5\": {\"line-1\": 3.823549932446837e-54}, \"ch6\": {\"line-1\": 3.823549932446837e-54}, \"ch7\": {\"line-1\": 3.823549932446837e-54}, \"ch8\": {\"line-1\": 3.823549932446837e-54}}}, {\"x\": 20462.0, \"y\": {\"ch1\": {\"line-1\": -1.2092800544078251e-55}, \"ch2\": {\"line-1\": -0.05850332973295831}, \"ch3\": {\"line-1\": 0.023040990857497844}, \"ch4\": {\"line-1\": -1.2092800544078251e-55}, \"ch5\": {\"line-1\": -1.2092800544078251e-55}, \"ch6\": {\"line-1\": -1.2092800544078251e-55}, \"ch7\": {\"line-1\": -1.2092800544078251e-55}, \"ch8\": {\"line-1\": -1.2092800544078251e-55}}}, {\"x\": 20463.0, \"y\": {\"ch1\": {\"line-1\": -3.792764027585526e-54}, \"ch2\": {\"line-1\": -0.055370370862297756}, \"ch3\": {\"line-1\": 0.05143300626063556}, \"ch4\": {\"line-1\": -3.792764027585526e-54}, \"ch5\": {\"line-1\": -3.792764027585526e-54}, \"ch6\": {\"line-1\": -3.792764027585526e-54}, \"ch7\": {\"line-1\": -3.792764027585526e-54}, \"ch8\": {\"line-1\": -3.792764027585526e-54}}}, {\"x\": 20464.0, \"y\": {\"ch1\": {\"line-1\": -3.5396566052428596e-55}, \"ch2\": {\"line-1\": -0.04909711021194583}, \"ch3\": {\"line-1\": 0.08587255896127739}, \"ch4\": {\"line-1\": -3.5396566052428596e-55}, \"ch5\": {\"line-1\": -3.5396566052428596e-55}, \"ch6\": {\"line-1\": -3.5396566052428596e-55}, \"ch7\": {\"line-1\": -3.5396566052428596e-55}, \"ch8\": {\"line-1\": -3.5396566052428596e-55}}}, {\"x\": 20465.0, \"y\": {\"ch1\": {\"line-1\": 3.7030668280567774e-54}, \"ch2\": {\"line-1\": -0.04348575088168184}, \"ch3\": {\"line-1\": 0.12681423220537255}, \"ch4\": {\"line-1\": 3.7030668280567774e-54}, \"ch5\": {\"line-1\": 3.7030668280567774e-54}, \"ch6\": {\"line-1\": 3.7030668280567774e-54}, \"ch7\": {\"line-1\": 3.7030668280567774e-54}, \"ch8\": {\"line-1\": 3.7030668280567774e-54}}}, {\"x\": 20466.0, \"y\": {\"ch1\": {\"line-1\": 8.119639162511563e-55}, \"ch2\": {\"line-1\": -0.041471623439056755}, \"ch3\": {\"line-1\": 0.174243204231642}, \"ch4\": {\"line-1\": 8.119639162511563e-55}, \"ch5\": {\"line-1\": 8.119639162511563e-55}, \"ch6\": {\"line-1\": 8.119639162511563e-55}, \"ch7\": {\"line-1\": 8.119639162511563e-55}, \"ch8\": {\"line-1\": 8.119639162511563e-55}}}, {\"x\": 20467.0, \"y\": {\"ch1\": {\"line-1\": -3.557274311199477e-54}, \"ch2\": {\"line-1\": -0.04374181494813723}, \"ch3\": {\"line-1\": 0.22713322135855238}, \"ch4\": {\"line-1\": -3.557274311199477e-54}, \"ch5\": {\"line-1\": -3.557274311199477e-54}, \"ch6\": {\"line-1\": -3.557274311199477e-54}, \"ch7\": {\"line-1\": -3.557274311199477e-54}, \"ch8\": {\"line-1\": -3.557274311199477e-54}}}, {\"x\": 20468.0, \"y\": {\"ch1\": {\"line-1\": -1.2462670637455462e-54}, \"ch2\": {\"line-1\": -0.04854366760169986}, \"ch3\": {\"line-1\": 0.2797300803803333}, \"ch4\": {\"line-1\": -1.2462670637455462e-54}, \"ch5\": {\"line-1\": -1.2462670637455462e-54}, \"ch6\": {\"line-1\": -1.2462670637455462e-54}, \"ch7\": {\"line-1\": -1.2462670637455462e-54}, \"ch8\": {\"line-1\": -1.2462670637455462e-54}}}, {\"x\": 20469.0, \"y\": {\"ch1\": {\"line-1\": 3.359017488357386e-54}, \"ch2\": {\"line-1\": -0.052647057653908154}, \"ch3\": {\"line-1\": 0.32122013204378913}, \"ch4\": {\"line-1\": 3.359017488357386e-54}, \"ch5\": {\"line-1\": 3.359017488357386e-54}, \"ch6\": {\"line-1\": 3.359017488357386e-54}, \"ch7\": {\"line-1\": 3.359017488357386e-54}, \"ch8\": {\"line-1\": 3.359017488357386e-54}}}, {\"x\": 20470.0, \"y\": {\"ch1\": {\"line-1\": 1.6506102668671952e-54}, \"ch2\": {\"line-1\": -0.05393528204440073}, \"ch3\": {\"line-1\": 0.34178628244856407}, \"ch4\": {\"line-1\": 1.6506102668671952e-54}, \"ch5\": {\"line-1\": 1.6506102668671952e-54}, \"ch6\": {\"line-1\": 1.6506102668671952e-54}, \"ch7\": {\"line-1\": 1.6506102668671952e-54}, \"ch8\": {\"line-1\": 1.6506102668671952e-54}}}, {\"x\": 20471.0, \"y\": {\"ch1\": {\"line-1\": -3.112665855930424e-54}, \"ch2\": {\"line-1\": -0.05240968199827695}, \"ch3\": {\"line-1\": 0.3371282033021274}, \"ch4\": {\"line-1\": -3.112665855930424e-54}, \"ch5\": {\"line-1\": -3.112665855930424e-54}, \"ch6\": {\"line-1\": -3.112665855930424e-54}, \"ch7\": {\"line-1\": -3.112665855930424e-54}, \"ch8\": {\"line-1\": -3.112665855930424e-54}}}, {\"x\": 20472.0, \"y\": {\"ch1\": {\"line-1\": -2.0193493214706155e-54}, \"ch2\": {\"line-1\": -0.04874780665718919}, \"ch3\": {\"line-1\": 0.30898591597646524}, \"ch4\": {\"line-1\": -2.0193493214706155e-54}, \"ch5\": {\"line-1\": -2.0193493214706155e-54}, \"ch6\": {\"line-1\": -2.0193493214706155e-54}, \"ch7\": {\"line-1\": -2.0193493214706155e-54}, \"ch8\": {\"line-1\": -2.0193493214706155e-54}}}, {\"x\": 20473.0, \"y\": {\"ch1\": {\"line-1\": 2.8232410577735503e-54}, \"ch2\": {\"line-1\": -0.04399075463817047}, \"ch3\": {\"line-1\": 0.2656729539678422}, \"ch4\": {\"line-1\": 2.8232410577735503e-54}, \"ch5\": {\"line-1\": 2.8232410577735503e-54}, \"ch6\": {\"line-1\": 2.8232410577735503e-54}, \"ch7\": {\"line-1\": 2.8232410577735503e-54}, \"ch8\": {\"line-1\": 2.8232410577735503e-54}}}, {\"x\": 20474.0, \"y\": {\"ch1\": {\"line-1\": 2.3475346183333615e-54}, \"ch2\": {\"line-1\": -0.038297713525963596}, \"ch3\": {\"line-1\": 0.2154778770439008}, \"ch4\": {\"line-1\": 2.3475346183333615e-54}, \"ch5\": {\"line-1\": 2.3475346183333615e-54}, \"ch6\": {\"line-1\": 2.3475346183333615e-54}, \"ch7\": {\"line-1\": 2.3475346183333615e-54}, \"ch8\": {\"line-1\": 2.3475346183333615e-54}}}]);"
9886
  ],
9887
  "text/plain": [
9888
  "<IPython.core.display.Javascript object>"
 
9890
  },
9891
  "metadata": {},
9892
  "output_type": "display_data"
9893
+ },
9894
+ {
9895
+ "name": "stdout",
9896
+ "output_type": "stream",
9897
+ "text": [
9898
+ "DEBUG: new config[5]:0xe1\n",
9899
+ "DEBUG: new config[6]:0x60\n",
9900
+ "DEBUG: new config[7]:0x66\n",
9901
+ "DEBUG: new config[8]:0xe1\n",
9902
+ "DEBUG: new config[9]:0xe1\n",
9903
+ "DEBUG: new config[10]:0xe1\n",
9904
+ "DEBUG: new config[11]:0xe1\n",
9905
+ "DEBUG: new config[12]:0xe1\n",
9906
+ "DEBUG: new config[13]:0x2\n",
9907
+ "DEBUG: new config[14]:0x2\n",
9908
+ "DEBUG: new config[3]:0xec\n",
9909
+ "Average frequency: 221.78869316178705 Hz for 22231 samples\n"
9910
+ ]
9911
  }
9912
  ],
9913
  "source": [
 
9919
  {
9920
  "cell_type": "code",
9921
  "execution_count": null,
9922
+ "id": "343f096b",
9923
  "metadata": {},
9924
  "outputs": [],
9925
  "source": []
setup.py CHANGED
@@ -4,7 +4,7 @@ setup(
4
  name='portiloop',
5
  version='0.0.1',
6
  packages=[package for package in find_packages()],
7
- description='Library for portiloop',
8
  install_requires=['wheel',
9
  'EDFlib-Python',
10
  'numpy',
@@ -12,6 +12,7 @@ setup(
12
  'portilooplot',
13
  'ipywidgets',
14
  'python-periphery',
15
- 'spidev'
 
16
  ]
17
  )
 
4
  name='portiloop',
5
  version='0.0.1',
6
  packages=[package for package in find_packages()],
7
+ description='Portiloop software library',
8
  install_requires=['wheel',
9
  'EDFlib-Python',
10
  'numpy',
 
12
  'portilooplot',
13
  'ipywidgets',
14
  'python-periphery',
15
+ 'spidev',
16
+ 'scipy'
17
  ]
18
  )