ProteoWizard
Functions
pwiz::msdata::MSNumpress Namespace Reference

Functions

double PWIZ_API_DECL optimalLinearFixedPoint (const double *data, size_t dataSize)
 
size_t PWIZ_API_DECL encodeLinear (const double *data, const size_t dataSize, unsigned char *result, double fixedPoint)
 Encodes the doubles in data by first using a. More...
 
void PWIZ_API_DECL encodeLinear (const std::vector< double > &data, std::vector< unsigned char > &result, double fixedPoint)
 Calls lower level encodeLinear while handling vector sizes appropriately. More...
 
size_t PWIZ_API_DECL decodeLinear (const unsigned char *data, const size_t dataSize, double *result)
 Decodes data encoded by encodeLinear. More...
 
void PWIZ_API_DECL decodeLinear (const std::vector< unsigned char > &data, std::vector< double > &result)
 Calls lower level decodeLinear while handling vector sizes appropriately. More...
 
size_t PWIZ_API_DECL encodePic (const double *data, const size_t dataSize, unsigned char *result)
 Encodes ion counts by simply rounding to the nearest 4 byte integer, and compressing each integer with encodeInt. More...
 
void PWIZ_API_DECL encodePic (const std::vector< double > &data, std::vector< unsigned char > &result)
 Calls lower level encodePic while handling vector sizes appropriately. More...
 
void PWIZ_API_DECL decodePic (const std::vector< unsigned char > &data, std::vector< double > &result)
 Decodes data encoded by encodePic. More...
 
size_t PWIZ_API_DECL decodePic (const unsigned char *data, const size_t dataSize, double *result)
 Calls lower level decodePic while handling vector sizes appropriately. More...
 
double PWIZ_API_DECL optimalSlofFixedPoint (const double *data, size_t dataSize)
 
size_t PWIZ_API_DECL encodeSlof (const double *data, const size_t dataSize, unsigned char *result, double fixedPoint)
 Encodes ion counts by taking the natural logarithm, and storing a fixed point representation of this. More...
 
void PWIZ_API_DECL encodeSlof (const std::vector< double > &data, std::vector< unsigned char > &result, double fixedPoint)
 Calls lower level encodeSlof while handling vector sizes appropriately. More...
 
size_t PWIZ_API_DECL decodeSlof (const unsigned char *data, const size_t dataSize, double *result)
 Decodes data encoded by encodeSlof. More...
 
void PWIZ_API_DECL decodeSlof (const std::vector< unsigned char > &data, std::vector< double > &result)
 Calls lower level decodeSlof while handling vector sizes appropriately. More...
 

Function Documentation

§ optimalLinearFixedPoint()

double PWIZ_API_DECL pwiz::msdata::MSNumpress::optimalLinearFixedPoint ( const double *  data,
size_t  dataSize 
)

§ encodeLinear() [1/2]

size_t PWIZ_API_DECL pwiz::msdata::MSNumpress::encodeLinear ( const double *  data,
const size_t  dataSize,
unsigned char *  result,
double  fixedPoint 
)

Encodes the doubles in data by first using a.

  • lossy conversion to a 4 byte 5 decimal fixed point repressentation
  • storing the residuals from a linear prediction after first to values
  • encoding by encodeInt (see above)

The resulting binary is maximally dataSize * 5 bytes, but much less if the data is reasonably smooth on the first order.

This encoding is suitable for typical m/z or retention time binary arrays. For masses above 100 m/z the encoding is accurate to at least 0.1 ppm.

pointer to array of double to be encoded (need memorycont. repr.) number of doubles from *data to encode

Returns
pointer to were resulting bytes should be stored the scaling factor used for getting the fixed point repr. This is stored in the binary and automatically extracted on decoding. Automatically (and maybe slowly) determined if 0.
the number of encoded bytes

§ encodeLinear() [2/2]

void PWIZ_API_DECL pwiz::msdata::MSNumpress::encodeLinear ( const std::vector< double > &  data,
std::vector< unsigned char > &  result,
double  fixedPoint 
)

Calls lower level encodeLinear while handling vector sizes appropriately.

vector of doubles to be encoded

Returns
vector of resulting bytes (will be resized to the number of bytes)

§ decodeLinear() [1/2]

size_t PWIZ_API_DECL pwiz::msdata::MSNumpress::decodeLinear ( const unsigned char *  data,
const size_t  dataSize,
double *  result 
)

Decodes data encoded by encodeLinear.

Note that the compression discard any information < 1e-5, so data is only guaranteed to be within +- 5e-6 of the original value.

Further, values > ~42000 will also be truncated because of the fixed point representation, so this scheme is stronly discouraged if values above might be above this size.

result vector guaranteedly shorter than twice the data length (in nbr of values)

pointer to array of bytes to be decoded (need memorycont. repr.) number of bytes from *data to decode

Returns
pointer to were resulting doubles should be stored
the number of decoded doubles, or -1 if dataSize < 4 or 4 < dataSize < 8

§ decodeLinear() [2/2]

void PWIZ_API_DECL pwiz::msdata::MSNumpress::decodeLinear ( const std::vector< unsigned char > &  data,
std::vector< double > &  result 
)

Calls lower level decodeLinear while handling vector sizes appropriately.

vector of bytes to be decoded

Returns
vector of resulting double (will be resized to the number of doubles)

§ encodePic() [1/2]

size_t PWIZ_API_DECL pwiz::msdata::MSNumpress::encodePic ( const double *  data,
const size_t  dataSize,
unsigned char *  result 
)

Encodes ion counts by simply rounding to the nearest 4 byte integer, and compressing each integer with encodeInt.

The handleable range is therefore 0 -> 4294967294. The resulting binary is maximally dataSize * 5 bytes, but much less if the data is close to 0 on average.

pointer to array of double to be encoded (need memorycont. repr.) number of doubles from *data to encode

Returns
pointer to were resulting bytes should be stored
the number of encoded bytes

§ encodePic() [2/2]

void PWIZ_API_DECL pwiz::msdata::MSNumpress::encodePic ( const std::vector< double > &  data,
std::vector< unsigned char > &  result 
)

Calls lower level encodePic while handling vector sizes appropriately.

vector of doubles to be encoded

Returns
vector of resulting bytes (will be resized to the number of bytes)

§ decodePic() [1/2]

void PWIZ_API_DECL pwiz::msdata::MSNumpress::decodePic ( const std::vector< unsigned char > &  data,
std::vector< double > &  result 
)

Decodes data encoded by encodePic.

result vector guaranteedly shorter than twice the data length (in nbr of values)

pointer to array of bytes to be decoded (need memorycont. repr.) number of bytes from *data to decode

Returns
pointer to were resulting doubles should be stored
the number of decoded doubles

§ decodePic() [2/2]

size_t PWIZ_API_DECL pwiz::msdata::MSNumpress::decodePic ( const unsigned char *  data,
const size_t  dataSize,
double *  result 
)

Calls lower level decodePic while handling vector sizes appropriately.

vector of bytes to be decoded

Returns
vector of resulting double (will be resized to the number of doubles)

§ optimalSlofFixedPoint()

double PWIZ_API_DECL pwiz::msdata::MSNumpress::optimalSlofFixedPoint ( const double *  data,
size_t  dataSize 
)

§ encodeSlof() [1/2]

size_t PWIZ_API_DECL pwiz::msdata::MSNumpress::encodeSlof ( const double *  data,
const size_t  dataSize,
unsigned char *  result,
double  fixedPoint 
)

Encodes ion counts by taking the natural logarithm, and storing a fixed point representation of this.

This is calculated as

unsigned short fp = log(d + 1) * 3000.0 + 0.5

Note that this fixed point will mean any d < 0.00016667 will be stored as a zero and mapped back to a zero.

result vector is exactly twice the data length (in nbr of values)

pointer to array of double to be encoded (need memorycont. repr.) number of doubles from *data to encode

Returns
pointer to were resulting bytes should be stored &fixedPoint automatically (and maybe slowly) determined if 0.
the number of encoded bytes

§ encodeSlof() [2/2]

void PWIZ_API_DECL pwiz::msdata::MSNumpress::encodeSlof ( const std::vector< double > &  data,
std::vector< unsigned char > &  result,
double  fixedPoint 
)

Calls lower level encodeSlof while handling vector sizes appropriately.

vector of doubles to be encoded

Returns
vector of resulting bytes (will be resized to the number of bytes)

§ decodeSlof() [1/2]

size_t PWIZ_API_DECL pwiz::msdata::MSNumpress::decodeSlof ( const unsigned char *  data,
const size_t  dataSize,
double *  result 
)

Decodes data encoded by encodeSlof.

pointer to array of bytes to be decoded (need memorycont. repr.) number of bytes from *data to decode

Returns
pointer to were resulting doubles should be stored
the number of decoded doubles

§ decodeSlof() [2/2]

void PWIZ_API_DECL pwiz::msdata::MSNumpress::decodeSlof ( const std::vector< unsigned char > &  data,
std::vector< double > &  result 
)

Calls lower level decodeSlof while handling vector sizes appropriately.

vector of bytes to be decoded

Returns
vector of resulting double (will be resized to the number of doubles)