In [1]:
import jpkfile
In [2]:
jpk = jpkfile.JPKFile("../examples/force-save-2016.06.15-13.17.08.jpk-force")
In [3]:
jpk.segments
Out[3]:
In [4]:
print(jpk.get_info('segments'))
JPKSegment.data is a dictionary, where keys are different channels and values are data arrays and parameters on how to convert the raw data to physical values.
To figure out what the names of valid channels are, print JPKSegment.data.keys().
In [5]:
s0 = jpk.segments[0]
print(s0.data.keys())
Use the function get_array() to get the physical data of channels.
Let's say you want data of channel 'height' and 'vDeflection' (which makes sense for the example file, it looks like all the other channels are not relevant, since there are no parameters on conversion to physical values defined; jpk appears to always store all channels that could be used for the method of recording) you need to provide these channel names as first parameter in a list.
In [6]:
s0_data, s0_units = s0.get_array(['height','vDeflection'])
In [7]:
print(s0_data)
The function returns a tuple with a labeled numpy array as first item, a dictionary specifying the physical units for each channel.
In [8]:
print(s0_units)
In [10]:
data,units = jpk.get_array(['height','vDeflection'])
In [16]:
s1_data = jpk.segments[1].get_array(['height','vDeflection'])[0]
s2_data = jpk.segments[2].get_array(['height','vDeflection'])[0]
# I actually don't know what the last segment is, it contains only 2 data points
In [17]:
import matplotlib.pyplot as plt
%matplotlib notebook
In [19]:
f,ax = plt.subplots(1,1)
ax.plot(s0_data['height'],s0_data['vDeflection'], label = jpk.segments[0].get_info('type'))
ax.plot(s1_data['height'],s1_data['vDeflection'], label = jpk.segments[1].get_info('type'))
ax.plot(s2_data['height'],s2_data['vDeflection'], label = jpk.segments[2].get_info('type'))
ax.legend()
Out[19]:
In [ ]: