Hendrik van Rooyen schrieb:
[...]
What is it digitising - if its an Analogue to Digital converter, then the
24 bits may not be floats at all, but simple integer counts.
Personally I would expect simple counts (since other seismic formats don't
even think of using floats because most digitizers deliver counts). But I
was told that there are floats inside.
But if I assume counts I get some reasonable numbers out of the file.
import struct
def convert(sample):
s0 = ord(sample[0])
s1 = ord(sample[1])
s2 = ord(sample[2])
sign = (s0 >> 7) & 1
if sign:
s = struct.unpack('>i','%c%c%c%c' % (s0,s1,chr(0xFF),s2))[0]
else:
s = struct.unpack('>i','%c%c%c%c' % (s0,s1,chr(0x00),s2))[0]
return s
f=open('test.bin', 'rb')
data=f.read()
f.close()
data_len = len(data)
sample_count = data_len/3
samples = []
for i in range(0,data_len,3):
samples.append(data[i:i+3])
for sample in samples:
print convert(sample)
But I'm experiencing some strange jumps in the data (seismic data is mostly
quite smooth at 40 Hz sampling rate). I think I did some mistake in the
byte order...
I uploaded a short sample data file under
http://www.FastShare.org/download/test.bin - maybe one can give me another
hint... In a full data example max value is 1179760 (in case one looks only
at the eye-cathing "65535"+- values).
Is there no Fine Manual documenting the output format?
No, that's the challenge.
Mario
PS: It seems that we are going straightly to off-topic, but whereto switch?