Package fabio :: Module compression
[hide private]
[frames] | no frames]

Module compression

source code


Authors: Jérôme Kieffer, ESRF
         email:jerome.kieffer@esrf.fr

FabIO library containing compression and decompression algorithm for various


Author: J\xc3\xa9r\xc3\xb4me Kieffer

Contact: jerome.kieffer@esrf.eu

Copyright: European Synchrotron Radiation Facility, Grenoble, France

License: GPLv3+

Classes [hide private]
  str
str(object) -> string
Functions [hide private]
 
md5sum(blob)
returns the md5sum of an object...
source code
 
endianness()
Return the native endianness of the system
source code
 
decGzip(stream)
Decompress a chunk of data using the gzip algorithm from Python or alternatives if possible
source code
 
decBzip2(stream)
Decompress a chunk of data using the bzip2 algorithm from Python
source code
 
decZlib(stream)
Decompress a chunk of data using the zlib algorithm from Python
source code
 
decByteOffet_python(stream, size)
Analyze a stream of char with any length of exception (2,4, or 8 bytes integers)
source code
 
decByteOffet_weave(stream, size)
Analyze a stream of char with any length of exception (2,4, or 8 bytes integers)
source code
 
decByteOffet_numpy(stream, size=None)
Analyze a stream of char with any length of exception: 2, 4, or 8 bytes integers
source code
 
decByteOffet_cython(stream, size=None)
Analyze a stream of char with any length of exception: 2, 4, or 8 bytes integers
source code
 
compByteOffet_numpy(data)
Compress a dataset into a string using the byte_offet algorithm
source code
 
decTY1(raw_8, raw_16=None, raw_32=None)
Modified byte offset decompressor used in Oxford Diffraction images
source code
 
decKM4CCD(raw_8, raw_16=None, raw_32=None)
Modified byte offset decompressor used in Oxford Diffraction images
source code
 
compTY1(data)
Modified byte offset compressor used in Oxford Diffraction images
source code
 
decPCK(stream, dim1=None, dim2=None, overflowPix=None)
Modified CCP4 pck decompressor used in MAR345 images
source code
 
compPCK(data)
Modified CCP4 pck compressor used in MAR345 images
source code
Variables [hide private]
  logger = logging.getLogger("compression")
  __package__ = 'fabio'
Function Details [hide private]

decByteOffet_python(stream, size)

source code 

Analyze a stream of char with any length of exception (2,4, or 8 bytes integers)

Parameters:
  • stream - string representing the compressed data
  • size - the size of the output array (of longInts)
Returns:
1D-ndarray

decByteOffet_weave(stream, size)

source code 

Analyze a stream of char with any length of exception (2,4, or 8 bytes integers)

Parameters:
  • stream - string representing the compressed data
  • size - the size of the output array (of longInts)
Returns:
1D-ndarray

decByteOffet_numpy(stream, size=None)

source code 

Analyze a stream of char with any length of exception:
            2, 4, or 8 bytes integers

@param stream: string representing the compressed data
@param size: the size of the output array (of longInts)
@return: 1D-ndarray

decByteOffet_cython(stream, size=None)

source code 

Analyze a stream of char with any length of exception:
            2, 4, or 8 bytes integers

@param stream: string representing the compressed data
@param size: the size of the output array (of longInts)
@return: 1D-ndarray

compByteOffet_numpy(data)

source code 

Compress a dataset into a string using the byte_offet algorithm

Parameters:
  • data - ndarray
Returns:
string/bytes with compressed data

test = numpy.array([0,1,2,127,0,1,2,128,0,1,2,32767,0,1,2,32768,0,1,2,2147483647,0,1,2,2147483648,0,1,2,128,129,130,32767,32768,128,129,130,32768,2147483647,2147483648])

decTY1(raw_8, raw_16=None, raw_32=None)

source code 

Modified byte offset decompressor used in Oxford Diffraction images

Parameters:
  • raw_8 - strings containing raw data with integer 8 bits
  • raw_16 - strings containing raw data with integer 16 bits
  • raw_32 - strings containing raw data with integer 32 bits
Returns:
numpy.ndarray

decKM4CCD(raw_8, raw_16=None, raw_32=None)

source code 

Modified byte offset decompressor used in Oxford Diffraction images

Parameters:
  • raw_8 - strings containing raw data with integer 8 bits
  • raw_16 - strings containing raw data with integer 16 bits
  • raw_32 - strings containing raw data with integer 32 bits
Returns:
numpy.ndarray

compTY1(data)

source code 

Modified byte offset compressor used in Oxford Diffraction images

Parameters:
  • data - numpy.ndarray with the input data (integers!)
Returns:
3-tuple of strings: raw_8,raw_16,raw_32 containing raw data with integer of the given size

decPCK(stream, dim1=None, dim2=None, overflowPix=None)

source code 

Modified CCP4 pck decompressor used in MAR345 images

Parameters:
  • stream - string or file
Returns:
numpy.ndarray (square array)

compPCK(data)

source code 

Modified CCP4 pck compressor used in MAR345 images

Parameters:
  • data - numpy.ndarray (square array)
Returns:
compressed stream