Confirm big-endian binary data format for JPK files.
authorW. Trevor King <wking@drexel.edu>
Tue, 17 Aug 2010 01:20:42 +0000 (21:20 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 17 Aug 2010 01:20:42 +0000 (21:20 -0400)
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.

hooke/driver/jpk.py

index 31d98104e0d22e6ba91085e894de3139e7a9db3d..ed7f6c4b4dae57bb62a1fe6641965530c53f23fe 100644 (file)
@@ -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