Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if self.dimension != 1:
raise ValueError("Data dimension is not 1")
self.chunk_size = types.Uint64.read(f, endianness)
# size of vector of format changing scalers
scaler_vector_length = types.Uint32.read(f, endianness)
self.scalers = [
DaqMxScaler(f, endianness, scaler_type)
for _ in range(scaler_vector_length)]
# Read raw data widths.
# This is an array of widths in bytes, which should be the same
# for all channels that have DAQmx data in a segment.
# There is one element per acquisition card, as data is interleaved
# separately for each card.
raw_data_widths_length = types.Uint32.read(f, endianness)
self.raw_data_widths = np.zeros(raw_data_widths_length, dtype=np.int32)
for width_idx in range(raw_data_widths_length):
self.raw_data_widths[width_idx] = types.Uint32.read(f, endianness)
def __init__(self, open_file, endianness, scaler_type):
data_type_code = types.Uint32.read(open_file, endianness)
self.data_type = DAQMX_TYPES[data_type_code]
# more info for format changing scaler
self.raw_buffer_index = types.Uint32.read(open_file, endianness)
self.raw_byte_offset = types.Uint32.read(open_file, endianness)
if scaler_type == DIGITAL_LINE_SCALER:
self.sample_format_bitmap = types.Uint8.read(open_file, endianness)
else:
self.sample_format_bitmap = types.Uint32.read(open_file, endianness)
self.scale_id = types.Uint32.read(open_file, endianness)
def __init__(self, open_file, endianness, scaler_type):
data_type_code = types.Uint32.read(open_file, endianness)
self.data_type = DAQMX_TYPES[data_type_code]
# more info for format changing scaler
self.raw_buffer_index = types.Uint32.read(open_file, endianness)
self.raw_byte_offset = types.Uint32.read(open_file, endianness)
if scaler_type == DIGITAL_LINE_SCALER:
self.sample_format_bitmap = types.Uint8.read(open_file, endianness)
else:
self.sample_format_bitmap = types.Uint32.read(open_file, endianness)
self.scale_id = types.Uint32.read(open_file, endianness)
def __init__(self, f, endianness, scaler_type):
"""
Read the metadata for a DAQmx raw segment. This is the raw
DAQmx-specific portion of the raw data index.
"""
self.scaler_type = scaler_type
self.data_type = types.tds_data_types[0xFFFFFFFF]
self.dimension = types.Uint32.read(f, endianness)
# In TDMS format version 2.0, 1 is the only valid value for dimension
if self.dimension != 1:
raise ValueError("Data dimension is not 1")
self.chunk_size = types.Uint64.read(f, endianness)
# size of vector of format changing scalers
scaler_vector_length = types.Uint32.read(f, endianness)
self.scalers = [
DaqMxScaler(f, endianness, scaler_type)
for _ in range(scaler_vector_length)]
# Read raw data widths.
# This is an array of widths in bytes, which should be the same
# for all channels that have DAQmx data in a segment.
# There is one element per acquisition card, as data is interleaved
# separately for each card.
def __init__(self, open_file, endianness, scaler_type):
data_type_code = types.Uint32.read(open_file, endianness)
self.data_type = DAQMX_TYPES[data_type_code]
# more info for format changing scaler
self.raw_buffer_index = types.Uint32.read(open_file, endianness)
self.raw_byte_offset = types.Uint32.read(open_file, endianness)
if scaler_type == DIGITAL_LINE_SCALER:
self.sample_format_bitmap = types.Uint8.read(open_file, endianness)
else:
self.sample_format_bitmap = types.Uint32.read(open_file, endianness)
self.scale_id = types.Uint32.read(open_file, endianness)
def __init__(self, open_file, endianness, scaler_type):
data_type_code = types.Uint32.read(open_file, endianness)
self.data_type = DAQMX_TYPES[data_type_code]
# more info for format changing scaler
self.raw_buffer_index = types.Uint32.read(open_file, endianness)
self.raw_byte_offset = types.Uint32.read(open_file, endianness)
if scaler_type == DIGITAL_LINE_SCALER:
self.sample_format_bitmap = types.Uint8.read(open_file, endianness)
else:
self.sample_format_bitmap = types.Uint32.read(open_file, endianness)
self.scale_id = types.Uint32.read(open_file, endianness)