From: W. Trevor King Date: Tue, 17 Aug 2010 01:20:42 +0000 (-0400) Subject: Confirm big-endian binary data format for JPK files. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0005c71d87ee5e64e088a628153367d928eb178b;p=hooke.git Confirm big-endian binary data format for JPK files. Michael Haggerty, JPK's head of software development, sent me their file specs. I'll add the specs themselves to our version control if I get permission from them. --- diff --git a/hooke/driver/jpk.py b/hooke/driver/jpk.py index 31d9810..ed7f6c4 100644 --- a/hooke/driver/jpk.py +++ b/hooke/driver/jpk.py @@ -121,14 +121,16 @@ class JPKDriver (Driver): 'Non-float data format:\n%s' % pprint.pformat(chan_info) data = numpy.frombuffer( buffer(f.read()), - dtype=numpy.dtype(numpy.float32).newbyteorder('>'), - # Is JPK data always big endian? I can't find a config - # setting. The ForceRobot brochure - # http://www.jpk.com/forcerobot300-1.download.6d694150f14773dc76bc0c3a8a6dd0e8.pdf - # lists a PowerPC chip on page 4, under Control - # electronics, and PPCs are usually big endian. - # http://en.wikipedia.org/wiki/PowerPC#Endian_modes - ) + dtype=numpy.dtype(numpy.float32).newbyteorder('>')) + # '>' (big endian) byte order. + # From version 0.3 of JPKForceSpec.txt in the "Binary data" section: + # All forms of raw data are stored in chronological order + # (the order in which they were collected), and the + # individual values are stored in network byte order + # (big-endian). The data type used to store the data is + # specified by the "channel.*.data.type" property, and is + # either short (2 bytes per value), integer (4 bytes), or + # float (4 bytes, IEEE format). f.close() return data