-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
32 lines (24 loc) · 780 Bytes
/
test.py
File metadata and controls
32 lines (24 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python
import array
import struct
import sys
inputfile = sys.argv[1]
with open(inputfile, 'rb') as data:
version, nchar = struct.unpack('<ch', data.read(3))
wavetext=data.read(nchar)
nbits,nbytes,polarity,=struct.unpack('<ccc', data.read(3))
userdata=struct.unpack('<6f',data.read(24))
samprate=struct.unpack('<L',data.read(4))[0]
adrange=struct.unpack('<f',data.read(4))[0]
npts=struct.unpack('<l',data.read(4))[0]
wave=struct.unpack('<1024h',data.read(2*npts))
print "version=",version,"\n"
print "nchar=",nchar,"\n"
print wavetext,"\n"
print "nbits=",nbits,"\n"
print "nbytes=",nbytes,"\n"
print "userdata=",userdata,"\n"
print "samprate=",samprate,"\n"
print "adrange=", adrange, "\n"
print "npts=", npts, "\n"
print "wave=",wave,"\n"