Skip to content

Commit d869d39

Browse files
committed
fixing whole bunch of errors
1 parent 7ae08ee commit d869d39

File tree

5 files changed

+426
-95
lines changed

5 files changed

+426
-95
lines changed

devtests.ipynb

Lines changed: 305 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@
287287
},
288288
{
289289
"cell_type": "code",
290-
"execution_count": 1,
290+
"execution_count": 2,
291291
"metadata": {
292292
"collapsed": false
293293
},
@@ -378,7 +378,7 @@
378378
"True"
379379
]
380380
},
381-
"execution_count": 1,
381+
"execution_count": 2,
382382
"metadata": {},
383383
"output_type": "execute_result"
384384
}
@@ -405,31 +405,66 @@
405405
},
406406
{
407407
"cell_type": "code",
408-
"execution_count": 4,
408+
"execution_count": 13,
409409
"metadata": {
410410
"collapsed": false
411411
},
412412
"outputs": [
413413
{
414-
"ename": "SystemExit",
415-
"evalue": "The plotted signal 'record.p_signals' must be a 2d numpy array",
416-
"output_type": "error",
417-
"traceback": [
418-
"An exception has occurred, use %tb to see the full traceback.\n",
419-
"\u001b[0;31mSystemExit\u001b[0m\u001b[0;31m:\u001b[0m The plotted signal 'record.p_signals' must be a 2d numpy array\n"
420-
]
421-
},
414+
"data": {
415+
"text/plain": [
416+
"array([[-6.],\n",
417+
" [ 0.],\n",
418+
" [-7.],\n",
419+
" ..., \n",
420+
" [ 7.],\n",
421+
" [-7.],\n",
422+
" [ 6.]])"
423+
]
424+
},
425+
"execution_count": 13,
426+
"metadata": {},
427+
"output_type": "execute_result"
428+
}
429+
],
430+
"source": [
431+
"targetsig = targetsig.reshape((-1, 1))\n",
432+
"\n",
433+
"targetsig.shape \n",
434+
"\n",
435+
"t = np.concatenate([targetsig, np.array([0]).reshape((1,1))])\n",
436+
"\n",
437+
"targetsig"
438+
]
439+
},
440+
{
441+
"cell_type": "code",
442+
"execution_count": 25,
443+
"metadata": {
444+
"collapsed": false
445+
},
446+
"outputs": [
422447
{
423-
"name": "stderr",
424-
"output_type": "stream",
425-
"text": [
426-
"/home/chen/Software/pythonenvs/python3.5/lib/python3.5/site-packages/IPython/core/interactiveshell.py:2889: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.\n",
427-
" warn(\"To exit: use 'exit', 'quit', or Ctrl-D.\", stacklevel=1)\n"
428-
]
448+
"data": {
449+
"text/plain": [
450+
"array([[2],\n",
451+
" [0],\n",
452+
" [0],\n",
453+
" ..., \n",
454+
" [0],\n",
455+
" [2],\n",
456+
" [0]], dtype=uint8)"
457+
]
458+
},
459+
"execution_count": 25,
460+
"metadata": {},
461+
"output_type": "execute_result"
429462
}
430463
],
431464
"source": [
432-
"wfdb.plotrec(record)"
465+
"s = t.astype('uint8')\n",
466+
"s\n",
467+
"s & 2"
433468
]
434469
},
435470
{
@@ -480,6 +515,146 @@
480515
"x = np.array([[1,2], [3,4]], dtype = 'uint')"
481516
]
482517
},
518+
{
519+
"cell_type": "code",
520+
"execution_count": 28,
521+
"metadata": {
522+
"collapsed": false
523+
},
524+
"outputs": [
525+
{
526+
"data": {
527+
"text/plain": [
528+
"3840"
529+
]
530+
},
531+
"execution_count": 28,
532+
"metadata": {},
533+
"output_type": "execute_result"
534+
}
535+
],
536+
"source": [
537+
"sum(2**np.array([8,9,10,11]))"
538+
]
539+
},
540+
{
541+
"cell_type": "code",
542+
"execution_count": 29,
543+
"metadata": {
544+
"collapsed": false
545+
},
546+
"outputs": [
547+
{
548+
"data": {
549+
"text/plain": [
550+
"0"
551+
]
552+
},
553+
"execution_count": 29,
554+
"metadata": {},
555+
"output_type": "execute_result"
556+
}
557+
],
558+
"source": [
559+
"1 >> 2"
560+
]
561+
},
562+
{
563+
"cell_type": "code",
564+
"execution_count": 1,
565+
"metadata": {
566+
"collapsed": false
567+
},
568+
"outputs": [
569+
{
570+
"name": "stdout",
571+
"output_type": "stream",
572+
"text": [
573+
"sampsperframe end of rdheader: [None, None]\n",
574+
"1\n",
575+
"[None, None]\n",
576+
"2\n",
577+
"[None, None]\n",
578+
"3\n",
579+
"[None, None]\n"
580+
]
581+
}
582+
],
583+
"source": [
584+
"import wfdb\n",
585+
"record = wfdb.rdsamp('sampledata/100', physical=False)\n",
586+
"record.recordname = '100copy'\n",
587+
"#record.wrsamp()"
588+
]
589+
},
590+
{
591+
"cell_type": "code",
592+
"execution_count": 2,
593+
"metadata": {
594+
"collapsed": false
595+
},
596+
"outputs": [
597+
{
598+
"data": {
599+
"text/plain": [
600+
"{'adcgain': [200.0, 200.0],\n",
601+
" 'adcres': [11, 11],\n",
602+
" 'adczero': [1024, 1024],\n",
603+
" 'basecounter': None,\n",
604+
" 'basedate': None,\n",
605+
" 'baseline': [1024, 1024],\n",
606+
" 'basetime': None,\n",
607+
" 'blocksize': [0, 0],\n",
608+
" 'byteoffset': [None, None],\n",
609+
" 'checksum': [-22131, 20052],\n",
610+
" 'comments': [' unnecessary comment',\n",
611+
" ' 69 M 1085 1629 x1',\n",
612+
" ' Aldomet, Inderal'],\n",
613+
" 'counterfreq': None,\n",
614+
" 'd_signals': array([[ 995., 1011.],\n",
615+
" [ 995., 1011.],\n",
616+
" [ 995., 1011.],\n",
617+
" ..., \n",
618+
" [ 889., 951.],\n",
619+
" [ 871., 957.],\n",
620+
" [ 768., 1024.]]),\n",
621+
" 'filename': ['100.dat', '100.dat'],\n",
622+
" 'fmt': ['212', '212'],\n",
623+
" 'fs': 360.0,\n",
624+
" 'initvalue': [995, 1011],\n",
625+
" 'nsig': 2,\n",
626+
" 'p_signals': None,\n",
627+
" 'recordname': '100copy',\n",
628+
" 'sampsperframe': [None, None],\n",
629+
" 'siglen': 650000,\n",
630+
" 'signame': ['MLII', 'V5'],\n",
631+
" 'skew': [None, None],\n",
632+
" 'units': ['mV', 'mV']}"
633+
]
634+
},
635+
"execution_count": 2,
636+
"metadata": {},
637+
"output_type": "execute_result"
638+
}
639+
],
640+
"source": [
641+
"record.__dict__"
642+
]
643+
},
644+
{
645+
"cell_type": "code",
646+
"execution_count": 3,
647+
"metadata": {
648+
"collapsed": false
649+
},
650+
"outputs": [],
651+
"source": [
652+
"def return100(fmt):\n",
653+
" \n",
654+
" fmt = 2\n",
655+
" "
656+
]
657+
},
483658
{
484659
"cell_type": "code",
485660
"execution_count": 4,
@@ -490,8 +665,7 @@
490665
{
491666
"data": {
492667
"text/plain": [
493-
"array([[1, 2],\n",
494-
" [3, 4]], dtype=uint64)"
668+
"3"
495669
]
496670
},
497671
"execution_count": 4,
@@ -500,7 +674,117 @@
500674
}
501675
],
502676
"source": [
503-
"x"
677+
"a = 3\n",
678+
"return100(a)\n",
679+
"a"
680+
]
681+
},
682+
{
683+
"cell_type": "code",
684+
"execution_count": 21,
685+
"metadata": {
686+
"collapsed": false
687+
},
688+
"outputs": [],
689+
"source": [
690+
"class truck():\n",
691+
" def __init__(self):\n",
692+
" self.wheel = 1"
693+
]
694+
},
695+
{
696+
"cell_type": "code",
697+
"execution_count": 22,
698+
"metadata": {
699+
"collapsed": true
700+
},
701+
"outputs": [],
702+
"source": [
703+
"x = truck()"
704+
]
705+
},
706+
{
707+
"cell_type": "code",
708+
"execution_count": 24,
709+
"metadata": {
710+
"collapsed": false
711+
},
712+
"outputs": [
713+
{
714+
"data": {
715+
"text/plain": [
716+
"1"
717+
]
718+
},
719+
"execution_count": 24,
720+
"metadata": {},
721+
"output_type": "execute_result"
722+
}
723+
],
724+
"source": [
725+
"x.wheel"
726+
]
727+
},
728+
{
729+
"cell_type": "code",
730+
"execution_count": 25,
731+
"metadata": {
732+
"collapsed": true
733+
},
734+
"outputs": [],
735+
"source": [
736+
"def pop(item):\n",
737+
" item.wheel = 0\n",
738+
" "
739+
]
740+
},
741+
{
742+
"cell_type": "code",
743+
"execution_count": 26,
744+
"metadata": {
745+
"collapsed": false
746+
},
747+
"outputs": [
748+
{
749+
"data": {
750+
"text/plain": [
751+
"0"
752+
]
753+
},
754+
"execution_count": 26,
755+
"metadata": {},
756+
"output_type": "execute_result"
757+
}
758+
],
759+
"source": [
760+
"pop(x)\n",
761+
"x.wheel"
762+
]
763+
},
764+
{
765+
"cell_type": "code",
766+
"execution_count": 28,
767+
"metadata": {
768+
"collapsed": false
769+
},
770+
"outputs": [
771+
{
772+
"data": {
773+
"text/plain": [
774+
"[1, 2, 3]"
775+
]
776+
},
777+
"execution_count": 28,
778+
"metadata": {},
779+
"output_type": "execute_result"
780+
}
781+
],
782+
"source": [
783+
"a = [1,2,3]\n",
784+
"b = a\n",
785+
"b = b.copy()\n",
786+
"b[0] = 10\n",
787+
"a"
504788
]
505789
},
506790
{

tests/test_records.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,7 @@ def test_14(self):
144144
targetsig = np.genfromtxt('tests/targetoutputdata/target14')
145145
targetsig = targetsig.reshape([977, 1])
146146
assert np.array_equal(sig, targetsig)
147+
148+
149+
def test_write1():
150+

0 commit comments

Comments
 (0)