mmtf utils module.
Methods
-
<static> decodeDelta(dataArray)
-
perform delta decoding of the input array by iterativly adding the ith element's value to the i+1th example: dataArray: [ 0, 2, 1, 2, 1, 1, -4, -2, 9 ] return: [ 0, 2, 3, 5, 6, 7, 3, 1, 10 ]
Parameters:
Name Type Description dataArrayTypedArray | Array delta encoded input array Returns:
decoded array- Type
- TypedArray | Array
-
<static> decodeFloatRunLength(array, divisor, dataArray)
-
perform run-length decoding followed (@see decodeRunLength) by decoding integers into floats using given divisor (@see decodeIntegerToFloat) example: array: [ 320, 3, 100, 2 ] divisor: 100 return: [ 3.20, 3.20, 3.20, 1.00, 1.00 ]
Parameters:
Name Type Description arrayUint8Array run-length encoded int32 array as bytes in big endian format divisorInteger number to devide the integers to obtain floats dataArrayFloat32Array pre-allocated output array Returns:
decoded array- Type
- Float32Array
-
<static> decodeFloatSplitListDelta(bigArray, smallArray, divisor, dataArray)
-
perform split-list delta decoding followed (@see decodeSplitListDelta) by decoding integers into floats using given divisor (@see decodeIntegerToFloat) example: bigArray: [ 100, 3, -200, 2 ] smallArray: [ 0, 2, -1, -3, 5 ] divisor: 100 return: [ 1.00, 1.00, 1.02, 1.01, -0.99, -1.02, -0.97 ]
Parameters:
Name Type Description bigArrayUint8Array int32 array as bytes in big endian format, pairs of large delta values and number of following small delta values to be read from smallArray smallArrayUint8Array int16 array as bytes in big endian format, small delta values divisorInteger number to devide the integers to obtain floats dataArrayFloat32Array pre-allocated output array Returns:
decoded array- Type
- Float32Array
-
<static> decodeIntegerToFloat(intArray, divisor, dataArray)
-
decode integers into floats using given divisor example: intArray: [ 12, 34, 543, 687, 2, 0, 4689 ] divisor: 100 return: [ 0.12, 0.34, 5.43, 6.87, 0.02, 0.00, 46.89 ]
Parameters:
Name Type Argument Description intArrayTypedArray | Array input array containing integers divisorNumber number to devide the integers to obtain floats dataArrayFloat32Array <optional>
pre-allocated output array Returns:
decoded array- Type
- Float32Array
-
<static> decodeRunLength(array, dataArray)
-
perform run-length decoding of input array example: array: [ 0, 2, 3, 5 ] // pairs of values and length of a run return: [ 0, 0, 3, 3, 3, 3, 3 ]
Parameters:
Name Type Argument Description arrayTypedArray | Array run-length encoded input array dataArrayTypedArray | Array <optional>
pre-allocated output array Returns:
decoded array- Type
- TypedArray | Array
-
<static> decodeSplitListDelta(bigArray, smallArray, dataArray)
-
perform split-list delta decoding i.e. the delta values are split between two lists example: bigArray: [ 200, 3, 100, 2 ] smallArray: [ 0, 2, -1, -3, 5 ] return: [ 200, 200, 202, 201, 301, 298, 303 ]
Parameters:
Name Type Description bigArrayUint8Array int32 array as bytes in big endian format, pairs of large delta values and number of following small delta values to be read from smallArray smallArrayUint8Array int16 array as bytes in big endian format, small delta values dataArrayInt32Array pre-allocated output array Returns:
decoded array- Type
- Int32Array
-
<static> getInt8View(dataArray)
-
get an Int8Array view on the input array memory
Parameters:
Name Type Description dataArrayTypedArray input array Returns:
new view on the input array memory- Type
- Int8Array
-
<static> getInt16(view, dataArray)
-
get an Int16Array copy of the the input array data
Parameters:
Name Type Argument Description viewTypedArray input data in big endian format dataArrayInt16Array <optional>
pre-allocated output array Returns:
copy of the input array data- Type
- Int16Array
-
<static> getInt32(view, dataArray)
-
get an Int32Array copy of the the input array data
Parameters:
Name Type Argument Description viewTypedArray input data in big endian format dataArrayInt32Array <optional>
pre-allocated output array Returns:
copy of the input array data- Type
- Int32Array
-
<static> getInt32View(dataArray)
-
get an Int32Array view on the input array memory
Parameters:
Name Type Description dataArrayTypedArray input array Returns:
new view on the input array memory- Type
- Int32Array
-
<static> getUint8View(dataArray)
-
get an Uint8Array view on the input array memory
Parameters:
Name Type Description dataArrayTypedArray input array Returns:
new view on the input array memory- Type
- Uint8Array
-
<static> makeInt16Buffer(array)
-
make big endian buffer of an int16 array
Parameters:
Name Type Description arrayArray | TypedArray array of int16 values Returns:
big endian buffer- Type
- ArrayBuffer
-
<static> makeInt32Buffer(array)
-
make big endian buffer of an int32 array
Parameters:
Name Type Description arrayArray | TypedArray array of int32 values Returns:
big endian buffer- Type
- ArrayBuffer