added comments, validated code to pep8

This commit is contained in:
Ray Slakinski 2010-09-14 13:21:09 -04:00
parent f8ab552f3e
commit 28d92c0574

View File

@ -14,12 +14,14 @@ import re
def read_edf_file(fileobj): def read_edf_file(fileobj):
data = fileobj.read() data = fileobj.read()
header = {} header = {}
header['version'] = data[0:7].strip() # 8 # Parse header information based on the EDF/EDF+ specs
header['patient_id'] = data[7:88].strip() # 80 # http://www.edfplus.info/specs/index.html
header['rec_id'] = data[88:168].strip() # 80 header['version'] = data[0:7].strip()
header['startdate'] = data[168:176].strip() # 8 header['patient_id'] = data[7:88].strip()
header['starttime'] = data[176:184].strip() # 8 header['rec_id'] = data[88:168].strip()
header['header_bytes'] = int(data[184:192].strip()) # 8 header['startdate'] = data[168:176].strip()
header['starttime'] = data[176:184].strip()
header['header_bytes'] = int(data[184:192].strip())
header['num_items'] = int(data[236:244].strip()) header['num_items'] = int(data[236:244].strip())
header['data_duration'] = float(data[244:252].strip()) header['data_duration'] = float(data[244:252].strip())
header['num_signals'] = int(data[252:256].strip()) header['num_signals'] = int(data[252:256].strip())