MSNumpressCoder

class pyopenms.MSNumpressCoder

Bases: object

Cython implementation of _MSNumpressCoder

Original C++ documentation is available here

__init__()

Overload:

__init__(self) None

Overload:

__init__(self, in_0: MSNumpressCoder) None

Methods

__init__

Overload:

decodeNP(self, in_, out, zlib_compression, ...)

Decodes a Base64 string to a vector of floating point numbers using numpress

decodeNPRaw(self, in_, out, config)

Decode the raw byte array "in" to the result vector "out"

encodeNP(self, in_, result, ...)

Encodes a vector of floating point numbers into a Base64 string using numpress

encodeNPRaw(self, in_, result, config)

Encode the data vector "in" to a raw byte array

NumpressCompression

alias of pyopenms._pyopenms_5.__NumpressCompression

decodeNP(self, in_: Union[bytes, str, String], out: List[float], zlib_compression: bool, config: NumpressConfig) None

Decodes a Base64 string to a vector of floating point numbers using numpress

This code is obtained from the proteowizard implementation ./pwiz/pwiz/data/msdata/BinaryDataEncoder.cpp (adapted by Hannes Roest)

This function will first decode the input base64 string (with optional zlib decompression after decoding) and then apply numpress decoding to the data

Parameters
  • in – The base64 encoded string

  • out – The resulting vector of doubles

  • zlib_compression – Whether to apply zlib de-compression before numpress de-compression

  • config – The numpress configuration defining the compression strategy

Raises

Exception: ConversionError if the string cannot be converted

decodeNPRaw(self, in_: Union[bytes, str, String], out: List[float], config: NumpressConfig) None

Decode the raw byte array “in” to the result vector “out”

:note The string in should only contain the data and _no_ extra null terminating byte

This performs the raw numpress decoding on a raw byte array (not Base64 encoded). Therefore the input string is likely unsafe to handle and is basically a byte container

Please use the safe versions above unless you need access to the raw byte arrays

Parameters
  • in – The base64 encoded string

  • out – The resulting vector of doubles

  • config – The numpress configuration defining the compression strategy

encodeNP(self, in_: List[float], result: String, zlib_compression: bool, config: NumpressConfig) None

Encodes a vector of floating point numbers into a Base64 string using numpress

This code is obtained from the proteowizard implementation ./pwiz/pwiz/data/msdata/BinaryDataEncoder.cpp (adapted by Hannes Roest)

This function will first apply the numpress encoding to the data, then encode the result in base64 (with optional zlib compression before base64 encoding)

:note In case of error, result string is empty

Parameters
  • in – The vector of floating point numbers to be encoded

  • result – The resulting string

  • zlib_compression – Whether to apply zlib compression after numpress compression

  • config – The numpress configuration defining the compression strategy

encodeNPRaw(self, in_: List[float], result: String, config: NumpressConfig) None

Encode the data vector “in” to a raw byte array

:note In case of error, “result” is given back unmodified :note The result is not a string but a raw byte array and may contain zero bytes

This performs the raw numpress encoding on a set of data and does no Base64 encoding on the result. Therefore the result string is likely unsafe to handle and is a raw byte array.

Please use the safe versions above unless you need access to the raw byte arrays

Parameters
  • in – The vector of floating point numbers to be encoded

  • result – The resulting string

  • config – The numpress configuration defining the compression strategy