1
1
import numpy as np
2
2
import re
3
3
import os
4
+ import posixpath
4
5
import sys
5
6
import requests
6
7
from IPython .display import display
9
10
def streamheader (recordname , pbdir ):
10
11
11
12
# Full url of header location
12
- url = os . path .join (dbindexurl , pbdir , recordname + '.hea' )
13
+ url = posixpath .join (dbindexurl , pbdir , recordname + '.hea' )
13
14
r = requests .get (url )
14
15
15
16
# Raise HTTPError if invalid url
@@ -44,7 +45,7 @@ def streamheader(recordname, pbdir):
44
45
def streamdat (filename , pbdir , fmt , bytecount , startbyte , datatypes ):
45
46
46
47
# Full url of dat file
47
- url = os . path .join (dbindexurl , pbdir , filename )
48
+ url = posixpath .join (dbindexurl , pbdir , filename )
48
49
49
50
# Specify the byte range
50
51
endbyte = startbyte + bytecount - 1
@@ -72,7 +73,7 @@ def streamdat(filename, pbdir, fmt, bytecount, startbyte, datatypes):
72
73
def streamannotation (filename , pbdir ):
73
74
74
75
# Full url of annotation file
75
- url = os . path .join (dbindexurl , pbdir , filename )
76
+ url = posixpath .join (dbindexurl , pbdir , filename )
76
77
77
78
# Get the content
78
79
r = requests .get (url )
@@ -94,7 +95,7 @@ def getdblist():
94
95
Usage:
95
96
dblist = getdblist()
96
97
"""
97
- url = os . path .join (dbindexurl , 'DBS' )
98
+ url = posixpath .join (dbindexurl , 'DBS' )
98
99
r = requests .get (url )
99
100
100
101
dblist = r .content .decode ('ascii' ).splitlines ()
@@ -109,7 +110,7 @@ def getdblist():
109
110
def getrecordlist (dburl , records ):
110
111
# Check for a RECORDS file
111
112
if records == 'all' :
112
- r = requests .get (os . path .join (dburl , 'RECORDS' ))
113
+ r = requests .get (posixpath .join (dburl , 'RECORDS' ))
113
114
if r .status_code == 404 :
114
115
sys .exit ('The database ' + dburl + ' has no WFDB files to download' )
115
116
@@ -125,7 +126,7 @@ def getannotators(dburl, annotators):
125
126
126
127
if annotators is not None :
127
128
# Check for an ANNOTATORS file
128
- r = requests .get (os . path .join (dburl , 'ANNOTATORS' ))
129
+ r = requests .get (posixpath .join (dburl , 'ANNOTATORS' ))
129
130
if r .status_code == 404 :
130
131
if annotators == 'all' :
131
132
return
@@ -175,7 +176,7 @@ def dlpbfile(inputs):
175
176
basefile , subdir , pbdb , dlbasedir , keepsubdirs , overwrite = inputs
176
177
177
178
# Full url of file
178
- url = os . path .join (dbindexurl , pbdb , subdir , basefile )
179
+ url = posixpath .join (dbindexurl , pbdb , subdir , basefile )
179
180
180
181
# Get the request header
181
182
rh = requests .head (url , headers = {'Accept-Encoding' : 'identity' })
0 commit comments