Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.db.hci_tagging
Commits
83cb8b5f
Commit
83cb8b5f
authored
Nov 09, 2015
by
André Anjos
💬
Browse files
[test] Test meta data creation
parent
c4b4f171
Changes
2
Hide whitespace changes
Inline
Side-by-side
bob/db/hci_tagging/test.py
View file @
83cb8b5f
...
...
@@ -8,6 +8,7 @@
import
os
,
sys
import
unittest
import
nose.tools
import
pkg_resources
from
.
import
Database
...
...
@@ -102,6 +103,27 @@ class HCITaggingTest(unittest.TestCase):
assert
hr
@
nose
.
tools
.
nottest
@
db_available
def
test05_can_write_meta
(
self
):
import
matplotlib.pyplot
as
plt
from
.utils
import
bdf_load_signal
,
plot_signal
for
obj
in
self
.
db
.
objects
()[:
1
]:
#if obj.stem.find('Part_1_') < 0: continue
estimates
=
[]
for
i
,
channel
in
enumerate
((
'EXG1'
,
'EXG2'
,
'EXG3'
)):
plt
.
subplot
(
3
,
1
,
i
+
1
)
signal_file
=
obj
.
make_path
(
DATABASE_LOCATION
)
signal
,
freq
=
bdf_load_signal
(
signal_file
,
channel
)
avg_hr
,
peaks
=
plot_signal
(
signal
,
freq
,
channel
)
estimates
.
append
(
avg_hr
)
plt
.
tight_layout
()
plt
.
show
()
class
CmdLineTest
(
unittest
.
TestCase
):
"""Makes sure our command-line is working properly."""
...
...
bob/db/hci_tagging/utils.py
View file @
83cb8b5f
...
...
@@ -166,6 +166,7 @@ def plot_signal(s, sampling_frequency, channel_name):
float: The estimated average heart-rate in beats-per-minute
'''
import
matplotlib.pyplot
as
plt
avg
,
peaks
=
estimate_average_heartrate
(
s
,
sampling_frequency
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment