'raw info':params,
#'time':self._time_from_TODO(raw_info[]),
}
- force_unit = self._zip_segment_conversion_unit(
- chan_info['channel']['vDeflection']['conversion-set']['conversion']['force'],
+ force_unit = self._zip_unit(
+ chan_info['channel']['vDeflection']['conversion-set']['conversion']['force']['scaling'],
version)
assert force_unit == 'N', force_unit
force_base = chan_info['channel']['vDeflection']['conversion-set']['conversion']['force']['base-calibration-slot']
assert force_base == 'distance', force_base
- dist_unit = self._zip_segment_conversion_unit(
- chan_info['channel']['vDeflection']['conversion-set']['conversion']['distance'],
+ dist_unit = self._zip_unit(
+ chan_info['channel']['vDeflection']['conversion-set']['conversion']['distance']['scaling'],
version)
assert dist_unit == 'm', dist_unit
distance_base = chan_info['channel']['vDeflection']['conversion-set']['conversion']['distance']['base-calibration-slot']
assert distance_base == 'volts', distance_base
- # Assume volts unit is V, but it is not specified in the JPK
- # file format.
+ base_conversion = chan_info['channel']['vDeflection']['conversion-set']['conversions']['base']
+ assert base_conversion == distance_base, base_conversion
+ distance_base_unit = self._zip_unit(
+ chan_info['channel']['vDeflection']['data'],
+ version)
+ assert distance_base_unit == 'V', distance_base_unit
force_mult = float(
chan_info['channel']['vDeflection']['conversion-set']['conversion']['force']['scaling']['multiplier'])
sens_mult = float(
if conversion == None:
conversion = conversion_set['conversions']['default']
if conversion == conversion_set['conversions']['base']:
- # Our conversion is the base data.
- if conversion != 'volts':
- raise NotImplementedError(
- 'unknown units for base channel: %s' % conversion)
segment.info['columns'][channel] = join_data_label(
- channel_name, 'V')
+ channel_name,
+ self._zip_unit(
+ segment.info['raw info']['channel'][channel_name]['data'],
+ version))
return segment
conversion_info = conversion_set['conversion'][conversion]
if conversion_info['base-calibration-slot'] \
conversion_info['scaling']['style']
multiplier = float(conversion_info['scaling']['multiplier'])
offset = float(conversion_info['scaling']['offset'])
- unit = self._zip_segment_conversion_unit(conversion_info, version)
+ unit = self._zip_unit(conversion_info['scaling'], version)
segment[:,channel] = segment[:,channel] * multiplier + offset
segment.info['columns'][channel] = join_data_label(channel_name, unit)
return segment
- def _zip_segment_conversion_unit(self, conversion_info, version):
+ def _zip_unit(self, conversion_info, version):
if version in ['0.%d' % i for i in range(3)]:
- return conversion_info['scaling']['unit']
+ return conversion_info['unit']
else:
- return conversion_info['scaling']['unit']['unit']
+ return conversion_info['unit']['unit']
def _parse_params(self, lines):
info = {}