[python-fabio] 01/31: Imported Upstream version 0.0.8

Frédéric-Emmanuel Picca picca at moszumanska.debian.org
Fri Dec 27 19:05:42 UTC 2013


This is an automated email from the git hooks/post-receive script.

picca pushed a commit to branch master
in repository python-fabio.

commit b45e3b45c50a1379586c921560c2d38d8230fe4c
Author: Jerome Kieffer <jerome.kieffer at esrf.fr>
Date:   Wed Aug 22 16:35:55 2012 +0200

    Imported Upstream version 0.0.8
---
 MANIFEST.in                       |   12 +
 README.TXT                        |  197 ++
 build-deb.sh                      |    5 +
 fabio/GEimage.py                  |  333 +++
 fabio/GEimage_old.py              |  501 ++++
 fabio/HiPiCimage.py               |  106 +
 fabio/OXDimage.py                 |  233 ++
 fabio/TiffIO.py                   | 1065 +++++++
 fabio/__init__.py                 |    9 +
 fabio/adscimage.py                |  137 +
 fabio/bruker100image.py           |   95 +
 fabio/brukerimage.py              |  195 ++
 fabio/cbfimage.py                 |  810 ++++++
 fabio/datIO.py                    |   59 +
 fabio/dm3image.py                 |  206 ++
 fabio/edfimage.py                 |  843 ++++++
 fabio/fabioimage.py               |  456 +++
 fabio/fabioutils.py               |  253 ++
 fabio/file_series.py              |  311 ++
 fabio/fit2dmaskimage.py           |   86 +
 fabio/fit2dspreadsheetimage.py    |   85 +
 fabio/kcdimage.py                 |  125 +
 fabio/mar345image.py              |  143 +
 fabio/marccdimage.py              |  309 ++
 fabio/openimage.py                |  150 +
 fabio/pilatusimage.py             |   82 +
 fabio/pnmimage.py                 |  141 +
 fabio/readbytestream.py           |   87 +
 fabio/tifimage.py                 |  266 ++
 fabio/xsdimage.py                 |  134 +
 setup.py                          |   49 +
 src/byte_offset.c                 | 5612 +++++++++++++++++++++++++++++++++++++
 src/byte_offset.pyx               |  119 +
 src/ccp4_pack.c                   |  320 +++
 src/cf_iomodule.c                 |   79 +
 src/columnfile.c                  |  226 ++
 src/columnfile.h                  |   55 +
 src/mar345_iomodule.c             |   45 +
 src/stdint.h                      |  247 ++
 stdeb.cfg                         |    8 +
 test/benchheader.py               |   21 +
 test/coral31_benchheaders         |   46 +
 test/coral31_benchmark            |   53 +
 test/eeepc-jonathanw_benchheaders |   46 +
 test/eeepc-jonathanw_benchmark    |   53 +
 test/esrflinux1-1a_benchheaders   |   46 +
 test/esrflinux1-1a_benchmark      | 3563 +++++++++++++++++++++++
 test/get_test_images.sh           |   36 +
 test/lapwright_benchheaders       |   47 +
 test/lapwright_benchmark          |   54 +
 test/lintaillefer_benchHeaders    |   95 +
 test/profile_compressed.py        |  131 +
 test/testGEimage.py               |   73 +
 test/testOXDimage.py              |   87 +
 test/testXSDimage.py              |   96 +
 test/test_all.bat                 |   26 +
 test/test_all.py                  |   87 +
 test/test_all.sh                  |   32 +
 test/test_all_images.py           |   96 +
 test/test_file_series.py          |  127 +
 test/test_filename_steps.py       |   67 +
 test/test_flat_binary.py          |   73 +
 test/testadscimage.py             |  105 +
 test/testbrukerimage.py           |  156 ++
 test/testcbfimage.py              |  112 +
 test/testedfimage.py              |  283 ++
 test/testfabioimage.py            |  227 ++
 test/testfilenames.py             |  120 +
 test/testfit2dmaskimage.py        |  112 +
 test/testheadernotsingleton.py    |   63 +
 test/testkcdimage.py              |   83 +
 test/testmar345image.py           |   75 +
 test/testmccdimage.py             |  109 +
 test/testopenheader.py            |   60 +
 test/testopenimage.py             |  234 ++
 test/testtifgz.py                 |   67 +
 test/testtifimage.py              |  134 +
 test/utilstest.py                 |  180 ++
 test/win32_benchheaders           |   46 +
 test/win32_benchmark              | 3285 ++++++++++++++++++++++
 80 files changed, 24600 insertions(+)

diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..087bb91
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,12 @@
+include README.TXT
+include stdeb.cfg
+recursive-exclude fabio.egg-info *
+recursive-include src *.c *.h *.pyx 
+recursive-include test *.py
+recursive-exclude pylint *
+recursive-exclude pydoc *
+recursive-exclude epydoc *
+recursive-exclude debian *
+recursive-exclude build *
+recursive-exclude dist *
+recursive-exclude test/tiftest *
diff --git a/README.TXT b/README.TXT
new file mode 100644
index 0000000..d374958
--- /dev/null
+++ b/README.TXT
@@ -0,0 +1,197 @@
+FabIO 
+=====
+FabIO is an I/O library for images produced by 2D X-ray detectors and written in python.
+FabIO support images detectors from a dozen of companies (including Mar, Dectris, ADSC, Hamamatsu, Oxford, ...), 
+for a total of 20 different file formats (like CBF, EDF, TIFF, ...) and offers an unified interface to their 
+headers (as a python dictionary) and datasets (as a numpy ndarray of integers or floats)
+  
+
+
+Changelog
+=========
+From FabIO-0.0.7 to FabIO-0.0.8:
+- Support for Tiff using TiffIO module from V.A.Solé
+- Clean-up of the code & bug fixes 
+
+From FabIO-0.0.6 to FabIO-0.0.7:
+- Support for multi-frames EDF files
+- Support for XML images/2D arrays used in EDNA 
+- new method: fabio.open(filename) that is an alias for fabio.openimage.openimage(filename)
+ 
+From FabIO-0.0.4 to FabIO-0.0.6:
+- Support for CBF files from Pilatus detectors
+- Support for KCD files from Nonius Kappa CCD images 
+- write EDF with their native data type (instead of uint16 by default)
+
+
+Installation
+============
+fabio can be downloaded from the fable download page on sourceforge.net. Presently the source code has been distributed as a zip package and a compressed tarball. Download either one and unpack it.
+http://sourceforge.net/projects/fable/files/fabio/
+
+e.g.
+tar xvzf fabio-0.0.8.tar.gz
+or
+unzip fabio-0.0.7.zip
+
+all files are unpacked into the directory fabio-0.0.8. To install these do
+
+cd fabio-0.0.8
+
+and install fabio with
+
+python setup.py install
+
+most likely you will need to do this with root privileges (e.g. put sudo in front of the command).
+The newest development version can be obtained by checking it out from the subversion (SVN) repository. Do
+
+svn checkout https://svn.sourceforge.net/svnroot/fable/ fabio
+cd fabio/trunk
+sudo python setup.py install
+
+If you are using MS Windows you also download a binary version packaged as executable installation files. Dependant on your python version open either
+
+fabio-0.0.8.win32-py2.6.exe
+
+or
+
+fabio-0.0.8.win32-py2.7.exe
+
+
+Dependencies
+============
+Python 2.5 or later (but not yet python 3.0)
+For full functionality of fabio the following modules need to be installed.
+
+* PIL (python imaging library) - http://www.pythonware.com
+* numpy - http://www.numpy.org 
+
+Ubuntu and Debian Like linux distributions:
+-------------------------------------------
+To use fabio on Ubuntu (a linux distribution based on Debian) the needed python modules can be installed either through the Synaptic Package Manager (found in System -> Administration) or using apt-get on from the command line in a terminal.
+The extra ubuntu packages needed are:
+
+* python-imaging
+* python-imaging-tk
+* python-numpy
+* python-dev
+
+using apt-get these can be installed as:
+
+sudo apt-get install python-imaging python-imaging-tk python-numpy
+
+
+using Synaptic Package Manager:
+
+**search** to find the specific ubuntu packages instead
+**mark** them for installation
+**Apply** to install
+
+Transparent handling of compressed files
+========================================
+Fabio is expected to handle gzip and bzip2 compressed files transparently. 
+Following a query about the performance of reading compressed data, some 
+benchmarking details have been collected at fabio_compressed_speed. 
+This means that when your python was configured and built you needed the 
+bzip and gzip modules to be present (eg libbz2-dev package for ubuntu)
+Using fabio in your own python programs 
+Example:
+
+>>> import fabio
+>>> obj = fabio.edfimage("mydata0000.edf")
+>>> obj.data.shape
+(2048, 2048)
+>>> obj.header["Omega"]
+23.5
+
+Adding new file formats 
+=======================
+We hope it will be relatively easy to add new file formats to fabio in the future. The basic idea is the following:
+   1. inherit from fabioimage overriding the methods _readheader, read and optionally write. Name your new module XXXimage where XXX means something (eg tifimage).
+   2. readheader fills in a dictionary of "name":"value" pairs in self.header. No one expects to find anything much in there.
+   3. read fills in self.data with a numpy array holding the image. Some redundant info which also appears are self.dim1 and self.dim2: the image dimensions, self.bpp is the bytes per pixel and self.bytecode is the numpy.dtype.type of the data.
+   4. The member variables "_need_a_seek_to_read" and "_need_a_real_file" are there in case you have trouble with the transparent handling of bz2 and gz files.
+   5. Register the file type (extension naming) in init__.py:FILETYPES
+   6. Add your new module as an import into fabio.openimage
+   7. Fill out the magic numbers for your format in fabio.openimage if you know them (the characteristic first few bytes in the file)
+   8. Upload a testimage to the file release system and create a unittest testcase which opens an example of your new format, confirming the image has actually been read in successfully (eg check the mean, max, min and esd are all correct, perhaps orientation too)
+   9. Run pylint on your code and then please go clean it up. Have a go at mine while you are at it.
+  10. Bask in the warm glow of appreciation when someone unexpectedly learns they don't need to convert their data into another format 
+
+
+Design Specifications
+=====================
+Name: Fabio = Fable Input/Output 
+
+Idea: 
+-----
+Have a base class for all our 2D diffraction greyscale images. This consists of a 2D array (numpy ndarray) 
+and a python dictionary of header information in (string key, string value) pairs.
+
+Class fabioimage  
+----------------
+Needs a name which will not to be confused with an RGB color image.
+
+Class attributes:
+* data   					-> 2D array
+* header 					-> dictionary
+* rows, columns, dim1, dim2 -> data.shape
+* header_keys               -> header.keys() used to retain the order of the header when writing an image to disk
+* bytecode                 	-> data.typecode()
+* m, minval, maxval, stddev	-> image statistics, could add others, eg roi[slice]
+
+Class methods (functions):
+--------------------------
+integrate_area()      -> return sum(self.data) within slice
+rebin(fact)           -> rebins data, adjusts dims
+toPIL16()             -> returns a PILimage
+getheader()           -> returns self.header
+resetvals()           -> resets the statistics
+getmean()             -> (computes) returns self.m
+getmin()              -> (computes) returns self.minval
+getmax()              -> (computes) returns self.maxval
+getstddev()           -> (computes) returns self.stddev
+read()        		  -> read image from file [or stream, or shared memory]
+write()       		  -> write image to file  [or stream, or shared memory]
+readheader()          -> read only the header [much faster for scanning files]
+
+Each individual file format would then inherit all the functionality of this class and just make new read and write methods.
+There are also fileseries related methods (next(), previous(), ...) which return a fabioimage instance of the next/previous frame in a fileserie 
+
+Other feature:
+    * possibility for using on-the-fly external compression - i.e. if files are stored as something as .gz, .bz2 etc could decompress them, using an external compression mechanism (if available). This is present in fabian but requires that images are edfs. 
+
+
+Known file formats
+===================
+* Bruker
+  o brukerimage
+  o bruker100image
+  o kcdimage: Nonius KappaCCD diffractometer
+* Mar Research
+  o marccd (fileformat derived from Tiff)
+  o mar345 imaging plate
+* Dectris 
+  o cbfimage (implements a fast byte offset decompression scheme in python/cython)
+  o pilatusimage (fileformat derived from Tiff)
+* ESRF
+  o edfimage: The ESRF data Format 
+  o xsdimage: XML serialized image from EDNA
+  o fit2dmaskimage: Fit2d Mask format
+  o fit2dspreadsheetimage: Fit2d ascii tables (spread-sheet)
+* ADSC
+  o adscimage 
+* GE detector at APS
+  o GEimage 
+* PNM
+  o pnmimage 
+* Tiff
+  o tifimage  
+* D3M
+  o d3mimage
+* Hamamatsu
+  o HiPiCimage 
+* Oxford Diffraction Sapphire 3 
+  o OXDimage
+ 
+  
diff --git a/build-deb.sh b/build-deb.sh
new file mode 100755
index 0000000..06be15c
--- /dev/null
+++ b/build-deb.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+rm -rf deb_dist
+python setup.py --command-packages=stdeb.command bdist_deb
+sudo dpkg -i deb_dist/python-fabio*.deb
+
diff --git a/fabio/GEimage.py b/fabio/GEimage.py
new file mode 100644
index 0000000..1ece909
--- /dev/null
+++ b/fabio/GEimage.py
@@ -0,0 +1,333 @@
+#!/usr/bin/env python
+
+#
+# Reads the header from a GE a-Si Angio Detector
+# Using version 8001 of the header from file:
+#     c:\adept\core\DefaultImageInfoConfig.csv
+#
+#  Antonino Miceli
+#  Thu Jan  4 13:46:31 CST 2007
+#
+
+# modifications by Jon Wright for style, pychecker and fabio
+# 
+
+import numpy
+import struct, logging
+logger = logging.getLogger("GEimage")
+from fabioimage import fabioimage
+from fabioutils import next_filename, previous_filename
+
+GE_HEADER_INFO = [
+    # Name, length in bytes, format for struct (None means string)
+    ('ImageFormat', 10, None),
+    ('VersionOfStandardHeader', 2, '=H'),
+    ('StandardHeaderSizeInBytes', 4, '=L'),
+    ('VersionOfUserHeader', 2, '=H'),
+    ('UserHeaderSizeInBytes', 4, '=L'),
+    ('NumberOfFrames', 2, '=H'),
+    ('NumberOfRowsInFrame', 2, '=H'),
+    ('NumberOfColsInFrame', 2, '=H'),
+    ('ImageDepthInBits', 2, '=H'),
+    ('AcquisitionDate', 20, None),
+    ('AcquisitionTime', 20, None),
+    ('DUTID', 20, None),
+    ('Operator', 50, None),
+    ('DetectorSignature', 20, None),
+    ('TestSystemName', 20, None),
+    ('TestStationRevision', 20, None),
+    ('CoreBundleRevision', 20, None),
+    ('AcquisitionName', 40, None),
+    ('AcquisitionParameterRevision', 20, None),
+    ('OriginalNumberOfRows', 2, '=H'),
+    ('OriginalNumberOfColumns', 2, '=H'),
+    ('RowNumberUpperLeftPointArchiveROI', 2, '=H'),
+    ('ColNumberUpperLeftPointArchiveROI', 2, '=H'),
+    ('Swapped', 2, '=H'),
+    ('Reordered', 2, '=H'),
+    ('HorizontalFlipped', 2, '=H'),
+    ('VerticalFlipped', 2, '=H'),
+    ('WindowValueDesired', 2, '=H'),
+    ('LevelValueDesired', 2, '=H'),
+    ('AcquisitionMode', 2, '=H'),
+    ('AcquisitionType', 2, '=H'),
+    ('UserAcquisitionCoffFileName1', 100, None),
+    ('UserAcquisitionCoffFileName2', 100, None),
+    ('FramesBeforeExpose', 2, '=H'),
+    ('FramesDuringExpose', 2, '=H'),
+    ('FramesAfterExpose', 2, '=H'),
+    ('IntervalBetweenFrames', 2, '=H'),
+    ('ExposeTimeDelayInMicrosecs', 8, '=d'),
+    ('TimeBetweenFramesInMicrosecs', 8, '=d'),
+    ('FramesToSkipExpose', 2, '=H'),
+    ('ExposureMode', 2, '=H'),
+    ('PrepPresetTimeInMicrosecs', 8, '=d'),
+    ('ExposePresetTimeInMicrosecs', 8, '=d'),
+    ('AcquisitionFrameRateInFps', 4, '=f'),
+    ('FOVSelect', 2, '=H'),
+    ('ExpertMode', 2, '=H'),
+    ('SetVCommon1', 8, '=d'),
+    ('SetVCommon2', 8, '=d'),
+    ('SetAREF', 8, '=d'),
+    ('SetAREFTrim', 4, '=L'),
+    ('SetSpareVoltageSource', 8, '=d'),
+    ('SetCompensationVoltageSource', 8, '=d'),
+    ('SetRowOffVoltage', 8, '=d'),
+    ('SetRowOnVoltage', 8, '=d'),
+    ('StoreCompensationVoltage', 4, '=L'),
+    ('RampSelection', 2, '=H'),
+    ('TimingMode', 2, '=H'),
+    ('Bandwidth', 2, '=H'),
+    ('ARCIntegrator', 2, '=H'),
+    ('ARCPostIntegrator', 2, '=H'),
+    ('NumberOfRows', 4, '=L'),
+    ('RowEnable', 2, '=H'),
+    ('EnableStretch', 2, '=H'),
+    ('CompEnable', 2, '=H'),
+    ('CompStretch', 2, '=H'),
+    ('LeftEvenTristate', 2, '=H'),
+    ('RightOddTristate', 2, '=H'),
+    ('TestModeSelect', 4, '=L'),
+    ('AnalogTestSource', 4, '=L'),
+    ('VCommonSelect', 4, '=L'),
+    ('DRCColumnSum', 4, '=L'),
+    ('TestPatternFrameDelta', 4, '=L'),
+    ('TestPatternRowDelta', 4, '=L'),
+    ('TestPatternColumnDelta', 4, '=L'),
+    ('DetectorHorizontalFlip', 2, '=H'),
+    ('DetectorVerticalFlip', 2, '=H'),
+    ('DFNAutoScrubOnOff', 2, '=H'),
+    ('FiberChannelTimeOutInMicrosecs', 4, '=L'),
+    ('DFNAutoScrubDelayInMicrosecs', 4, '=L'),
+    ('StoreAECROI', 2, '=H'),
+    ('TestPatternSaturationValue', 2, '=H'),
+    ('TestPatternSeed', 4, '=L'),
+    ('ExposureTimeInMillisecs', 4, '=f'),
+    ('FrameRateInFps', 4, '=f'),
+    ('kVp', 4, '=f'),
+    ('mA', 4, '=f'),
+    ('mAs', 4, '=f'),
+    ('FocalSpotInMM', 4, '=f'),
+    ('GeneratorType', 20, None),
+    ('StrobeIntensityInFtL', 4, '=f'),
+    ('NDFilterSelection', 2, '=H'),
+    ('RefRegTemp1', 8, '=d'),
+    ('RefRegTemp2', 8, '=d'),
+    ('RefRegTemp3', 8, '=d'),
+    ('Humidity1', 4, '=f'),
+    ('Humidity2', 4, '=f'),
+    ('DetectorControlTemp', 8, '=d'),
+    ('DoseValueInmR', 8, '=d'),
+    ('TargetLevelROIRow0', 2, '=H'),
+    ('TargetLevelROICol0', 2, '=H'),
+    ('TargetLevelROIRow1', 2, '=H'),
+    ('TargetLevelROICol1', 2, '=H'),
+    ('FrameNumberForTargetLevelROI', 2, '=H'),
+    ('PercentRangeForTargetLevel', 2, '=H'),
+    ('TargetValue', 2, '=H'),
+    ('ComputedMedianValue', 2, '=H'),
+    ('LoadZero', 2, '=H'),
+    ('MaxLUTOut', 2, '=H'),
+    ('MinLUTOut', 2, '=H'),
+    ('MaxLinear', 2, '=H'),
+    ('Reserved', 2, '=H'),
+    ('ElectronsPerCount', 2, '=H'),
+    ('ModeGain', 2, '=H'),
+    ('TemperatureInDegC', 8, '=d'),
+    ('LineRepaired', 2, '=H'),
+    ('LineRepairFileName', 100, None),
+    ('CurrentLongitudinalInMM', 4, '=f'),
+    ('CurrentTransverseInMM', 4, '=f'),
+    ('CurrentCircularInMM', 4, '=f'),
+    ('CurrentFilterSelection', 4, '=L'),
+    ('DisableScrubAck', 2, '=H'),
+    ('ScanModeSelect', 2, '=H'),
+    ('DetectorAppSwVersion', 20, None),
+    ('DetectorNIOSVersion', 20, None),
+    ('DetectorPeripheralSetVersion', 20, None),
+    ('DetectorPhysicalAddress', 20, None),
+    ('PowerDown', 2, '=H'),
+    ('InitialVoltageLevel_VCOMMON', 8, '=d'),
+    ('FinalVoltageLevel_VCOMMON', 8, '=d'),
+    ('DmrCollimatorSpotSize', 10, None),
+    ('DmrTrack', 5, None),
+    ('DmrFilter', 5, None),
+    ('FilterCarousel', 2, '=H'),
+    ('Phantom', 20, None),
+    ('SetEnableHighTime', 2, '=H'),
+    ('SetEnableLowTime', 2, '=H'),
+    ('SetCompHighTime', 2, '=H'),
+    ('SetCompLowTime', 2, '=H'),
+    ('SetSyncLowTime', 2, '=H'),
+    ('SetConvertLowTime', 2, '=H'),
+    ('SetSyncHighTime', 2, '=H'),
+    ('SetEOLTime', 2, '=H'),
+    ('SetRampOffsetTime', 2, '=H'),
+    ('FOVStartingValue', 2, '=H'),
+    ('ColumnBinning', 2, '=H'),
+    ('RowBinning', 2, '=H'),
+    ('BorderColumns64', 2, '=H'),
+    ('BorderRows64', 2, '=H'),
+    ('FETOffRows64', 2, '=H'),
+    ('FOVStartColumn128', 2, '=H'),
+    ('FOVStartRow128', 2, '=H'),
+    ('NumberOfColumns128', 2, '=H'),
+    ('NumberOfRows128', 2, '=H'),
+    ('VFPAquisition', 2000, None),
+    ('Comment', 200, None)
+    ]
+
+
+class GEimage(fabioimage):
+
+    _need_a_seek_to_read = True
+
+    def _readheader(self, infile):
+        """ Read a GE image header """
+
+        infile.seek(0)
+
+        self.header = {}
+        for name, nbytes, format in GE_HEADER_INFO:
+            if format is None:
+                self.header[ name ] = infile.read(nbytes)
+            else:
+                self.header[ name ] = struct.unpack(format,
+                                                     infile.read(nbytes))[0]
+
+    def read(self, fname, frame=0):
+        """
+        Read in header into self.header and
+        the data   into self.data
+        """
+        self.header = {}
+        self.resetvals()
+        infile = self._open(fname, "rb")
+        self.sequencefilename = fname
+        self._readheader(infile)
+        self.nframes = self.header['NumberOfFrames']
+        self._readframe(infile, frame)
+        infile.close()
+        return self
+
+    def _makeframename(self):
+        """ The thing to be printed for the user to represent a frame inside
+        a file """
+        self.filename = "%s$%04d" % (self.sequencefilename,
+                                   self.currentframe)
+
+    def _readframe(self, filepointer, img_num):
+        """
+        # Load only one image from the sequence
+        #    Note: the first image in the sequence 0
+        # raises an exception if you give an invalid image
+        # otherwise fills in self.data
+        """
+        if(img_num > self.nframes or img_num < 0):
+            raise Exception("Bad image number")
+        imgstart = self.header['StandardHeaderSizeInBytes'] + \
+                   self.header['UserHeaderSizeInBytes'] + \
+                   img_num * self.header['NumberOfRowsInFrame'] * \
+                   self.header['NumberOfColsInFrame'] * \
+                   self.header['ImageDepthInBits'] / 8
+        # whence = 0 means seek from start of file
+        filepointer.seek(imgstart, 0)
+
+        self.bpp = self.header['ImageDepthInBits'] / 8 # hopefully 2        
+        imglength = self.header['NumberOfRowsInFrame'] * \
+                    self.header['NumberOfColsInFrame'] * self.bpp
+        if self.bpp != 2:
+            logging.warning("Using uint16 for GE but seems to be wrong")
+
+        # Guessing it is always unsigned int?
+        self.data = numpy.fromstring(filepointer.read(imglength), numpy.uint16)
+        self.data.shape = (self.header['NumberOfRowsInFrame'],
+                            self.header['NumberOfColsInFrame'])
+        self.dim2 , self.dim1 = self.data.shape
+        self.currentframe = int(img_num)
+        self._makeframename()
+
+
+    def write(self, fname, force_type=numpy.uint16):
+        """ Not yet implemented"""
+        raise Exception("Write is not implemented")
+
+    def getframe(self, num):
+        """
+        Returns a frame as a new fabioimage object
+        """
+        if num < 0 or num > self.nframes:
+            raise Exception("Requested frame number is out of range")
+        # Do a deep copy of the header to make a new one
+        newheader = {}
+        for k in self.header.keys():
+            newheader[k] = self.header[k]
+        frame = GEimage(header=newheader)
+        frame.nframes = self.nframes
+        frame.sequencefilename = self.sequencefilename
+        infile = frame._open(self.sequencefilename, "rb")
+        frame._readframe(infile, num)
+        infile.close()
+        return frame
+
+    def next(self):
+        """
+        Get the next image in a series as a fabio image
+        """
+        if self.currentframe < (self.nframes - 1) and self.nframes > 1:
+            return self.getframe(self.currentframe + 1)
+        else:
+            newobj = GEimage()
+            newobj.read(next_filename(
+                self.sequencefilename))
+            return newobj
+
+    def previous(self):
+        """
+        Get the previous image in a series as a fabio image
+        """
+        if self.currentframe > 0:
+            return self.getframe(self.currentframe - 1)
+        else:
+            newobj = GEimage()
+            newobj.read(previous_filename(
+                self.sequencefilename))
+            return newobj
+
+
+def demo():
+    import sys, time
+
+    if len(sys.argv) < 2:
+        print "USAGE: GE_script.py <GEaSi_raw_image_file>"
+        sys.exit()
+
+    image_file = sys.argv[1]
+
+    print "init read_GEaSi_data class and load header.."
+    sequence1 = GEimage()
+    sequence1.read(image_file)
+
+    print "TimeBetweenFramesInMicrosecs = ",
+    print sequence1.header['TimeBetweenFramesInMicrosecs']
+    print "AcquisitionTime = ",
+    print sequence1.header['AcquisitionTime']
+
+
+    print "Mean = ", sequence1.data.ravel().mean()
+
+    while 1:
+        start = time.time()
+        try:
+            sequence1 = sequence1.next()
+            print sequence1.currentframe, sequence1.data.ravel().mean(), \
+                  time.time() - start
+        except:
+            raise
+            break
+
+
+
+
+if __name__ == '__main__':
+    demo()
diff --git a/fabio/GEimage_old.py b/fabio/GEimage_old.py
new file mode 100644
index 0000000..36b677a
--- /dev/null
+++ b/fabio/GEimage_old.py
@@ -0,0 +1,501 @@
+
+#!/usr/bin/env python
+
+"""
+Reads the header from a GE a-Si Angio Detector
+
+Authors: Henning O. Sorensen & Erik Knudsen
+         Center for Fundamental Research: Metal Structures in Four Dimensions
+         Risoe National Laboratory
+         Frederiksborgvej 399
+         DK-4000 Roskilde
+         email:erik.knudsen at risoe.dk
+
+        + Jon Wright, ESRF
+
+        The header information has been taken from the script read_GEaSi_data.py
+        by
+        Antonino Miceli
+        Thu Jan  4 13:46:31 CST 2007
+
+"""
+
+import numpy
+from fabioimage import fabioimage
+
+class GEimage(fabioimage):
+
+
+    def _readheader(self, infile):
+
+        infile.seek(0)
+
+        # ADEPT
+        self.ImageFormat = infile.read(10)
+
+        # USHORT --> "=H"
+        # ULONG  --> "=L"
+        #   = means byte order is native
+
+        self.header['HeaderVersion'] = numpy.fromstring(infile.read(2), numpy.uint16)[0]
+        self.header['HeaderSizeInBytes'] = int(numpy.fromstring(infile.read(4), numpy.uint32)[0])
+        self.header['UserHeaderVersion'] = numpy.fromstring(infile.read(2), numpy.uint16)[0]
+        self.header['UserHeaderSizeInBytes'] = int(numpy.fromstring(infile.read(4), numpy.uint32)[0])
+
+        self.header['NumberOfFrames'] = numpy.fromstring(infile.read(2), numpy.uint16)[0]
+        self.header['NumberOfRowsInFrame'] = numpy.fromstring(infile.read(2), numpy.uint16)[0]
+        self.header['NumberOfColsInFrame'] = numpy.fromstring(infile.read(2), numpy.uint16)[0]
+        self.header['BitsPerPixel'] = numpy.fromstring(infile.read(2), numpy.uint16)[0]
+
+        self.header['AcquisitionDate'] = infile.read(20)
+        self.header['AcquisitionTime'] = infile.read(20)
+
+        self.DUTID = infile.read(20)
+
+        self.header['Operator'] = infile.read(50)
+
+        self.header['DetectorSignature'] = infile.read(20)
+        self.header['TestSystemName'] = infile.read(20)
+        self.header['TestStationRevision'] = infile.read(20)
+        self.header['CoreBundleRevision'] = infile.read(20)
+        self.header['AcquisitionName'] = infile.read(40)
+        self.header['AcquisitionParameterRevision'] = infile.read(20)
+
+#         self.OriginalNumberOfRows = infile.read(2)
+#         self.OriginalNumberOfRows = struct.unpack("=H",self.OriginalNumberOfRows)[0]
+
+#         self.OriginalNumberOfColumns = infile.read(2)
+#         self.OriginalNumberOfColumns = struct.unpack("=H",self.OriginalNumberOfColumns)[0]
+
+#         self.RowNumberUpperLeftPointArchiveROI = infile.read(2)
+#         self.RowNumberUpperLeftPointArchiveROI = struct.unpack("=H",self.RowNumberUpperLeftPointArchiveROI)[0]
+
+#         self.ColNumberUpperLeftPointArchiveROI = infile.read(2)
+#         self.ColNumberUpperLeftPointArchiveROI = struct.unpack("=H",self.ColNumberUpperLeftPointArchiveROI)[0]
+
+#         self.Swapped = infile.read(2) 
+#         self.Swapped = struct.unpack("=H",self.Swapped)[0]
+
+#         self.Reordered = infile.read(2) 
+#         self.Reordered = struct.unpack("=H",self.Reordered)[0]
+
+#         self.HorizontalFlipped = infile.read(2) 
+#         self.HorizontalFlipped = struct.unpack("=H",self.HorizontalFlipped)[0]
+
+#         self.VerticalFlipped = infile.read(2) 
+#         self.VerticalFlipped = struct.unpack("=H",self.VerticalFlipped)[0]
+
+#         self.WindowValueDesired = infile.read(2) 
+#         self.WindowValueDesired = struct.unpack("=H",self.WindowValueDesired)[0]
+
+#         self.LevelValueDesired = infile.read(2) 
+#         self.LevelValueDesired = struct.unpack("=H",self.LevelValueDesired)[0]
+
+#         self.AcquisitionMode = infile.read(2) 
+#         self.AcquisitionMode = struct.unpack("=H",self.AcquisitionMode)[0]
+
+#         self.AcquisitionType = infile.read(2) 
+#         self.AcquisitionType = struct.unpack("=H",self.AcquisitionType)[0]
+
+#         self.UserAcquisitionCoffFileName1 = infile.read(100) 
+#         self.UserAcquisitionCoffFileName2 = infile.read(100) 
+
+#         self.FramesBeforeExpose = infile.read(2) 
+#         self.FramesBeforeExpose = struct.unpack("=H",self.FramesBeforeExpose)[0]
+
+#         self.FramesDuringExpose = infile.read(2)  
+#         self.FramesDuringExpose = struct.unpack("=H",self.FramesDuringExpose)[0]
+
+#         self.FramesAfterExpose = infile.read(2) 
+#         self.FramesAfterExpose = struct.unpack("=H",self.FramesAfterExpose)[0]
+
+#         self.IntervalBetweenFrames = infile.read(2) 
+#         self.IntervalBetweenFrames = struct.unpack("=H",self.IntervalBetweenFrames)[0]
+
+#         self.ExposeTimeDelayInMicrosecs = infile.read(8) 
+#         self.ExposeTimeDelayInMicrosecs = struct.unpack("=d",self.ExposeTimeDelayInMicrosecs)[0]
+
+#         self.TimeBetweenFramesInMicrosecs = infile.read(8) 
+#         self.TimeBetweenFramesInMicrosecs = struct.unpack("=d",self.TimeBetweenFramesInMicrosecs)[0]
+
+#         self.FramesToSkipExpose = infile.read(2) 
+#         self.FramesToSkipExpose = struct.unpack("=H",self.FramesToSkipExpose)[0]
+
+#         # Rad --> ExposureMode = 1
+#         self.ExposureMode = infile.read(2) 
+#         self.ExposureMode = struct.unpack("=H",self.ExposureMode)[0]
+
+#         self.PrepPresetTimeInMicrosecs = infile.read(8) 
+#         self.PrepPresetTimeInMicrosecs = struct.unpack("=d",self.PrepPresetTimeInMicrosecs)[0]
+
+#         self.ExposePresetTimeInMicrosecs = infile.read(8) 
+#         self.ExposePresetTimeInMicrosecs = struct.unpack("=d",self.ExposePresetTimeInMicrosecs)[0]
+
+#         self.AcquisitionFrameRateInFps = infile.read(4) 
+#         self.AcquisitionFrameRateInFps = struct.unpack("=f",self.AcquisitionFrameRateInFps)[0]
+
+#         self.FOVSelect = infile.read(2)
+#         self.FOVSelect = struct.unpack("=H",self.FOVSelect)[0]
+
+#         self.ExpertMode = infile.read(2)
+#         self.ExpertMode = struct.unpack("=H",self.ExpertMode)[0]
+
+#         self.SetVCommon1 = infile.read(8)
+#         self.SetVCommon1 = struct.unpack("=d",self.SetVCommon1)[0]
+
+#         self.SetVCommon2 = infile.read(8)
+#         self.SetVCommon2 = struct.unpack("=d",self.SetVCommon2)[0]
+
+#         self.SetAREF = infile.read(8)
+#         self.SetAREF = struct.unpack("=d",self.SetAREF)[0]
+
+#         self.SetAREFTrim = infile.read(4)
+#         self.SetAREFTrim = struct.unpack("=L",self.SetAREFTrim)[0]
+
+#         self.SetSpareVoltageSource = infile.read(8)
+#         self.SetSpareVoltageSource = struct.unpack("=d",self.SetSpareVoltageSource)[0]
+
+#         self.SetCompensationVoltageSource = infile.read(8)
+#         self.SetCompensationVoltageSource = struct.unpack("=d",self.SetCompensationVoltageSource)[0]
+
+#         self.SetRowOffVoltage = infile.read(8)
+#         self.SetRowOffVoltage = struct.unpack("=d",self.SetRowOffVoltage)[0]
+
+#         self.SetRowOnVoltage = infile.read(8)
+#         self.SetRowOnVoltage = struct.unpack("=d",self.SetRowOnVoltage)[0]
+
+#         self.StoreCompensationVoltage = infile.read(4)
+#         self.StoreCompensationVoltage = struct.unpack("=L",self.StoreCompensationVoltage)[0]
+
+#         self.RampSelection = infile.read(2)
+#         self.RampSelection = struct.unpack("=H",self.RampSelection)[0]
+
+#         self.TimingMode = infile.read(2)
+#         self.TimingMode = struct.unpack("=H",self.TimingMode)[0]
+
+#         self.Bandwidth = infile.read(2)
+#         self.Bandwidth = struct.unpack("=H",self.Bandwidth)[0]
+
+#         self.ARCIntegrator = infile.read(2)
+#         self.ARCIntegrator = struct.unpack("=H",self.ARCIntegrator)[0]
+
+#         self.ARCPostIntegrator = infile.read(2)
+#         self.ARCPostIntegrator = struct.unpack("=H",self.ARCPostIntegrator)[0]
+
+#         self.NumberOfRows = infile.read(4)
+#         self.NumberOfRows = struct.unpack("=L",self.NumberOfRows)[0]
+
+#         self.RowEnable = infile.read(2)
+#         self.RowEnable = struct.unpack("=H",self.RowEnable)[0]
+
+#         self.EnableStretch = infile.read(2)
+#         self.EnableStretch = struct.unpack("=H",self.EnableStretch)[0]
+
+#         self.CompEnable = infile.read(2)
+#         self.CompEnable = struct.unpack("=H",self.CompEnable)[0]
+
+#         self.CompStretch = infile.read(2)
+#         self.CompStretch = struct.unpack("=H",self.CompStretch)[0]
+
+#         self.LeftEvenTristate = infile.read(2)
+#         self.LeftEvenTristate = struct.unpack("=H",self.LeftEvenTristate)[0]
+
+#         self.RightOddTristate = infile.read(2)
+#         self.RightOddTristate = struct.unpack("=H",self.RightOddTristate)[0]
+
+#         self.TestModeSelect = infile.read(4)
+#         self.TestModeSelect = struct.unpack("=L",self.TestModeSelect)[0]
+
+#         self.AnalogTestSource = infile.read(4)
+#         self.AnalogTestSource = struct.unpack("=L",self.AnalogTestSource)[0]
+
+#         self.VCommonSelect = infile.read(4)
+#         self.VCommonSelect = struct.unpack("=L",self.VCommonSelect)[0]
+
+#         self.DRCColumnSum = infile.read(4)
+#         self.DRCColumnSum = struct.unpack("=L",self.DRCColumnSum)[0]
+
+#         self.TestPatternFrameDelta = infile.read(4)
+#         self.TestPatternFrameDelta = struct.unpack("=L",self.TestPatternFrameDelta)[0]
+
+#         self.TestPatternRowDelta = infile.read(4)
+#         self.TestPatternRowDelta = struct.unpack("=L",self.TestPatternRowDelta)[0]
+
+#         self.TestPatternColumnDelta = infile.read(4)
+#         self.TestPatternColumnDelta = struct.unpack("=L",self.TestPatternColumnDelta)[0]
+
+#         self.DetectorHorizontalFlip = infile.read(2)
+#         self.DetectorHorizontalFlip = struct.unpack("=H",self.DetectorHorizontalFlip)[0]
+
+#         self.DetectorVerticalFlip = infile.read(2)
+#         self.DetectorVerticalFlip = struct.unpack("=H",self.DetectorVerticalFlip)[0]
+
+#         self.DFNAutoScrubOnOff = infile.read(2)
+#         self.DFNAutoScrubOnOff = struct.unpack("=H",self.DFNAutoScrubOnOff)[0]
+
+#         self.FiberChannelTimeOutInMicrosecs = infile.read(4)
+#         self.FiberChannelTimeOutInMicrosecs = struct.unpack("=L",self.FiberChannelTimeOutInMicrosecs)[0]
+
+#         self.DFNAutoScrubDelayInMicrosecs = infile.read(4)
+#         self.DFNAutoScrubDelayInMicrosecs = struct.unpack("=L",self.DFNAutoScrubDelayInMicrosecs)[0]
+
+#         self.StoreAECROI = infile.read(2)
+#         self.StoreAECROI = struct.unpack("=H",self.StoreAECROI)[0]
+
+#         self.TestPatternSaturationValue = infile.read(2)
+#         self.TestPatternSaturationValue = struct.unpack("=H",self.TestPatternSaturationValue)[0]
+
+#         self.TestPatternSeed = infile.read(4)
+#         self.TestPatternSeed = struct.unpack("=L",self.TestPatternSeed)[0]
+
+#         self.ExposureTimeInMillisecs = infile.read(4) 
+#         self.ExposureTimeInMillisecs = struct.unpack("=f",self.ExposureTimeInMillisecs)[0]
+
+#         self.FrameRateInFps = infile.read(4) 
+#         self.FrameRateInFps = struct.unpack("=f",self.FrameRateInFps)[0]
+
+#         self.kVp = infile.read(4) 
+#         self.kVp = struct.unpack("=f",self.kVp)[0]
+
+#         self.mA = infile.read(4) 
+#         self.mA = struct.unpack("=f",self.mA)[0]
+
+#         self.mAs = infile.read(4) 
+#         self.mAs = struct.unpack("=f",self.mAs)[0]
+
+#         self.FocalSpotInMM = infile.read(4) 
+#         self.FocalSpotInMM = struct.unpack("=f",self.FocalSpotInMM)[0]
+
+#         self.GeneratorType = infile.read(20)
+
+#         self.StrobeIntensityInFtL = infile.read(4) 
+#         self.StrobeIntensityInFtL = struct.unpack("=f",self.StrobeIntensityInFtL)[0]
+
+#         self.NDFilterSelection = infile.read(2) 
+#         self.NDFilterSelection = struct.unpack("=H",self.NDFilterSelection)[0]
+
+#         self.RefRegTemp1 = infile.read(8) 
+#         self.RefRegTemp1 = struct.unpack("=d",self.RefRegTemp1)[0]
+
+#         self.RefRegTemp2 = infile.read(8) 
+#         self.RefRegTemp2 = struct.unpack("=d",self.RefRegTemp2)[0]
+
+#         self.RefRegTemp3 = infile.read(8) 
+#         self.RefRegTemp3 = struct.unpack("=d",self.RefRegTemp3)[0]
+
+#         self.Humidity1 = infile.read(4) 
+#         self.Humidity1 = struct.unpack("=f",self.Humidity1)[0]
+
+#         self.Humidity2 = infile.read(4) 
+#         self.Humidity2 = struct.unpack("=f",self.Humidity2)[0]
+
+#         self.DetectorControlTemp = infile.read(8) 
+#         self.DetectorControlTemp = struct.unpack("=d",self.DetectorControlTemp)[0]
+
+#         self.DoseValueInmR = infile.read(8) 
+#         self.DoseValueInmR = struct.unpack("=d",self.DoseValueInmR)[0]
+
+#         self.TargetLevelROIRow0 = infile.read(2)
+#         self.TargetLevelROIRow0 = struct.unpack("=H",self.TargetLevelROIRow0)[0]
+
+#         self.TargetLevelROICol0 = infile.read(2)
+#         self.TargetLevelROICol0 = struct.unpack("=H",self.TargetLevelROICol0)[0]
+
+#         self.TargetLevelROIRow1 = infile.read(2)
+#         self.TargetLevelROIRow1 = struct.unpack("=H",self.TargetLevelROIRow1)[0]
+
+#         self.TargetLevelROICol1 = infile.read(2)
+#         self.TargetLevelROICol1 = struct.unpack("=H",self.TargetLevelROICol1)[0]
+
+#         self.FrameNumberForTargetLevelROI = infile.read(2)
+#         self.FrameNumberForTargetLevelROI = struct.unpack("=H",self.FrameNumberForTargetLevelROI)[0]
+
+#         self.PercentRangeForTargetLevel = infile.read(2)
+#         self.PercentRangeForTargetLevel = struct.unpack("=H",self.PercentRangeForTargetLevel)[0]
+
+#         self.TargetValue = infile.read(2)
+#         self.TargetValue = struct.unpack("=H",self.TargetValue)[0]
+
+#         self.ComputedMedianValue = infile.read(2)
+#         self.ComputedMedianValue = struct.unpack("=H",self.ComputedMedianValue)[0]
+
+#         self.LoadZero = infile.read(2)
+#         self.LoadZero = struct.unpack("=H",self.LoadZero)[0]
+
+#         self.MaxLUTOut = infile.read(2)
+#         self.MaxLUTOut = struct.unpack("=H",self.MaxLUTOut)[0]
+
+#         self.MinLUTOut = infile.read(2)
+#         self.MinLUTOut = struct.unpack("=H",self.MinLUTOut)[0]
+
+#         self.MaxLinear = infile.read(2)
+#         self.MaxLinear = struct.unpack("=H",self.MaxLinear)[0]
+
+#         self.Reserved = infile.read(2)
+#         self.Reserved = struct.unpack("=H",self.Reserved)[0]
+
+#         self.ElectronsPerCount = infile.read(2)
+#         self.ElectronsPerCount = struct.unpack("=H",self.ElectronsPerCount)[0]
+
+#         self.ModeGain = infile.read(2)
+#         self.ModeGain = struct.unpack("=H",self.ModeGain)[0]
+
+#         self.TemperatureInDegC = infile.read(8)
+#         self.TemperatureInDegC = struct.unpack("=d",self.TemperatureInDegC)[0]
+
+#         self.LineRepaired = infile.read(2)
+#         self.LineRepaired = struct.unpack("=H",self.LineRepaired)[0]
+
+#         self.LineRepairFileName = infile.read(100)
+
+#         self.CurrentLongitudinalInMM = infile.read(4)
+#         self.CurrentLongitudinalInMM = struct.unpack("=f",self.CurrentLongitudinalInMM)[0]
+
+#         self.CurrentTransverseInMM = infile.read(4)
+#         self.CurrentTransverseInMM = struct.unpack("=f",self.CurrentTransverseInMM)[0]
+
+#         self.CurrentCircularInMM = infile.read(4)
+#         self.CurrentCircularInMM = struct.unpack("=f",self.CurrentCircularInMM)[0]
+
+#         self.CurrentFilterSelection = infile.read(4)
+#         self.CurrentFilterSelection = struct.unpack("=L",self.CurrentFilterSelection)[0]
+
+#         self.DisableScrubAck = infile.read(2)
+#         self.DisableScrubAck = struct.unpack("=H",self.DisableScrubAck)[0]
+
+#         self.ScanModeSelect = infile.read(2)
+#         self.ScanModeSelect = struct.unpack("=H",self.ScanModeSelect)[0]
+
+#         self.DetectorAppSwVersion = infile.read(20)	
+
+#         self.DetectorNIOSVersion = infile.read(20)	
+
+#         self.DetectorPeripheralSetVersion = infile.read(20)	
+
+#         self.DetectorPhysicalAddress	 = infile.read(20)
+
+#         self.PowerDown = infile.read(2)
+#         self.PowerDown = struct.unpack("=H",self.PowerDown)[0]
+
+#         self.InitialVoltageLevel_VCOMMON = infile.read(8)
+#         self.InitialVoltageLevel_VCOMMON = struct.unpack("=d",self.InitialVoltageLevel_VCOMMON)[0]
+
+#         self.FinalVoltageLevel_VCOMMON = infile.read(8)
+#         self.FinalVoltageLevel_VCOMMON = struct.unpack("=d",self.FinalVoltageLevel_VCOMMON)[0]
+
+#         self.DmrCollimatorSpotSize	 = infile.read(10)
+
+#         self.DmrTrack	 = infile.read(5)
+
+#         self.DmrFilter	 = infile.read(5)
+
+#         self.FilterCarousel = infile.read(2)
+#         self.FilterCarousel = struct.unpack("=H",self.FilterCarousel)[0]
+
+#         self.Phantom	 = infile.read(20)
+
+#         self.SetEnableHighTime = infile.read(2)
+#         self.SetEnableHighTime = struct.unpack("=H",self.SetEnableHighTime)[0]
+
+#         self.SetEnableLowTime = infile.read(2)
+#         self.SetEnableLowTime = struct.unpack("=H",self.SetEnableLowTime)[0]
+
+#         self.SetCompHighTime = infile.read(2)
+#         self.SetCompHighTime = struct.unpack("=H",self.SetCompHighTime)[0]
+
+#         self.SetCompLowTime = infile.read(2)
+#         self.SetCompLowTime = struct.unpack("=H",self.SetCompLowTime)[0]
+
+#         self.SetSyncLowTime = infile.read(2)
+#         self.SetSyncLowTime = struct.unpack("=H",self.SetSyncLowTime)[0]
+
+#         self.SetConvertLowTime = infile.read(2)
+#         self.SetConvertLowTime = struct.unpack("=H",self.SetConvertLowTime)[0]
+
+#         self.SetSyncHighTime = infile.read(2)
+#         self.SetSyncHighTime = struct.unpack("=H",self.SetSyncHighTime)[0]
+
+#         self.SetEOLTime = infile.read(2)
+#         self.SetEOLTime = struct.unpack("=H",self.SetEOLTime)[0]
+
+#         self.SetRampOffsetTime = infile.read(2)
+#         self.SetRampOffsetTime = struct.unpack("=H",self.SetRampOffsetTime)[0]
+
+#         self.FOVStartingValue = infile.read(2)
+#         self.FOVStartingValue = struct.unpack("=H",self.FOVStartingValue)[0]
+
+#         self.ColumnBinning = infile.read(2)
+#         self.ColumnBinning = struct.unpack("=H",self.ColumnBinning)[0]
+
+#         self.RowBinning = infile.read(2)
+#         self.RowBinning = struct.unpack("=H",self.RowBinning)[0]
+
+#         self.BorderColumns64 = infile.read(2)
+#         self.BorderColumns64 = struct.unpack("=H",self.BorderColumns64)[0]
+
+#         self.BorderRows64 = infile.read(2)
+#         self.BorderRows64 = struct.unpack("=H",self.BorderRows64)[0]
+
+#         self.FETOffRows64 = infile.read(2)
+#         self.FETOffRows64 = struct.unpack("=H",self.FETOffRows64)[0]
+
+#         self.FOVStartColumn128 = infile.read(2)
+#         self.FOVStartColumn128 = struct.unpack("=H",self.FOVStartColumn128)[0]
+
+#         self.FOVStartRow128 = infile.read(2)
+#         self.FOVStartRow128 = struct.unpack("=H",self.FOVStartRow128)[0]
+
+#         self.NumberOfColumns128 = infile.read(2)
+#         self.NumberOfColumns128 = struct.unpack("=H",self.NumberOfColumns128)[0]
+
+#         self.NumberOfRows128 = infile.read(2)
+#         self.NumberOfRows128 = struct.unpack("=H",self.NumberOfRows128)[0]
+
+#         self.VFPAquisition	 = infile.read(2000)
+
+#         self.Comment	 = infile.read(200)
+
+
+
+    def read(self, fname):
+        """
+        Read in header into self.header and
+            the data   into self.data
+        """
+        self.header = {}
+        self.resetvals()
+        infile = self._open(fname, "rb")
+        self._readheader(infile)
+        # Compute image size
+        try:
+            self.dim1 = int(self.header['NumberOfRowsInFrame'])
+            self.dim2 = int(self.header['NumberOfColsInFrame'])
+            self.bpp = int(self.header['BitsPerPixel'])
+        except:
+            raise Exception("GE  file", str(fname) + \
+                                "is corrupt, cannot read it")
+
+        # More than one image can be saved in a GE file
+        # Will only load the first one
+
+
+        # Go to the beginning of the file
+        infile.seek(0)
+        infile.seek(self.header['HeaderSizeInBytes'] + self.header['UserHeaderSizeInBytes'])
+
+        ReadBytes = self.dim1 * self.dim2 * (self.bpp / 8)
+        block = infile.read(ReadBytes)
+        block = numpy.fromstring(block, numpy.uint16)
+
+        infile.close()
+
+        try:
+            self.data = numpy.reshape(block, [self.dim2, self.dim1])
+        except:
+            print len(block), self.dim2, self.dim1
+            raise IOError, \
+              'Size spec in GE-header does not match size of image data field'
+
+        self.bytecode = self.data.dtype.type
+        self.pilimage = None
+        return self
diff --git a/fabio/HiPiCimage.py b/fabio/HiPiCimage.py
new file mode 100644
index 0000000..b184a61
--- /dev/null
+++ b/fabio/HiPiCimage.py
@@ -0,0 +1,106 @@
+
+#!/usr/bin/env python
+"""
+Authors: Henning O. Sorensen & Erik Knudsen
+         Center for Fundamental Research: Metal Structures in Four Dimensions
+         Risoe National Laboratory
+         Frederiksborgvej 399
+         DK-4000 Roskilde
+         email:erik.knudsen at risoe.dk
+
+        + Jon Wright, ESRF
+
+Information about the file format from Masakatzu Kobayashi is highly appreciated
+"""
+
+import numpy, logging
+logger = logging.getLogger("HiPiCimage")
+from fabioimage import fabioimage
+
+class HiPiCimage(fabioimage):
+    """ Read HiPic images e.g. collected with a Hamamatsu CCD camera"""
+
+
+    def _readheader(self, infile):
+        """
+        Read in a header from an already open file
+
+        """
+        Image_tag = infile.read(2)
+        print Image_tag
+        Comment_len = numpy.fromstring(infile.read(2), numpy.uint16)
+        Dim_1 = numpy.fromstring(infile.read(2), numpy.uint16)[0]
+        Dim_2 = numpy.fromstring(infile.read(2), numpy.uint16)[0]
+        Dim_1_offset = numpy.fromstring(infile.read(2), numpy.uint16)[0]
+        Dim_2_offset = numpy.fromstring(infile.read(2), numpy.uint16)[0]
+        HeaderType = numpy.fromstring(infile.read(2), numpy.uint16)[0]
+        Dump = infile.read(50)
+        Comment = infile.read(Comment_len)
+        self.header['Image_tag'] = Image_tag
+        self.header['Dim_1'] = Dim_1
+        self.header['Dim_2'] = Dim_2
+        self.header['Dim_1_offset'] = Dim_1_offset
+        self.header['Dim_2_offset'] = Dim_2_offset
+        #self.header['Comment'] = Comment
+        if Image_tag != 'IM' :
+            # This does not look like an HiPic file
+            logging.warning("no opening.  Corrupt header of HiPic file " + \
+                            str(infile.name))
+        Comment_split = Comment[:Comment.find('\x00')].split('\r\n')
+
+        for topcomment in Comment_split:
+            topsplit = topcomment.split(',')
+            for line in topsplit:
+                if '=' in line:
+                    key, val = line.split('=' , 1)
+                    # Users cannot type in significant whitespace
+                    key = key.rstrip().lstrip()
+                    self.header_keys.append(key)
+                    self.header[key] = val.lstrip().rstrip()
+                    self.header[key] = val.lstrip('"').rstrip('"')
+
+    def read(self, fname):
+        """
+        Read in header into self.header and
+            the data   into self.data
+        """
+        self.header = {}
+        self.resetvals()
+        infile = self._open(fname, "rb")
+        self._readheader(infile)
+        # Compute image size
+        try:
+            self.dim1 = int(self.header['Dim_1'])
+            self.dim2 = int(self.header['Dim_2'])
+        except:
+            raise Exception("HiPic file", str(fname) + \
+                                "is corrupt, cannot read it")
+        bytecode = numpy.uint16
+        self.bpp = len(numpy.array(0, bytecode).tostring())
+
+        # Read image data
+        block = infile.read(self.dim1 * self.dim2 * self.bpp)
+        infile.close()
+
+        #now read the data into the array
+        try:
+            self.data = numpy.reshape(
+                numpy.fromstring(block, bytecode),
+                [self.dim2, self.dim1])
+        except:
+            print len(block), bytecode, self.bpp, self.dim2, self.dim1
+            raise IOError, \
+              'Size spec in HiPic-header does not match size of image data field'
+        self.bytecode = self.data.dtype.type
+
+        # Sometimes these files are not saved as 12 bit,
+        # But as 16 bit after bg subtraction - which results 
+        # negative values saved as 16bit. Therefore values higher 
+        # 4095 is really negative values
+        if self.data.max() > 4095:
+            gt12bit = self.data > 4095
+            self.data = self.data - gt12bit * (2 ** 16 - 1)
+
+        # ensure the PIL image is reset
+        self.pilimage = None
+        return self
diff --git a/fabio/OXDimage.py b/fabio/OXDimage.py
new file mode 100644
index 0000000..b90e4f5
--- /dev/null
+++ b/fabio/OXDimage.py
@@ -0,0 +1,233 @@
+#!/usr/bin/env python
+
+"""
+Reads Oxford Diffraction Sapphire 3 images
+
+Authors: Henning O. Sorensen & Erik Knudsen
+         Center for Fundamental Research: Metal Structures in Four Dimensions
+         Risoe National Laboratory
+         Frederiksborgvej 399
+         DK-4000 Roskilde
+         email:erik.knudsen at risoe.dk
+
+        + Jon Wright, ESRF
+
+"""
+
+import numpy, logging
+logger = logging.getLogger("OXDimage")
+from fabioimage import fabioimage
+
+DETECTOR_TYPES = {0: 'Sapphire/KM4CCD (1x1: 0.06mm, 2x2: 0.12mm)',
+1: 'Sapphire2-Kodak (1x1: 0.06mm, 2x2: 0.12mm)',
+2: 'Sapphire3-Kodak (1x1: 0.03mm, 2x2: 0.06mm, 4x4: 0.12mm)',
+3: 'Onyx-Kodak (1x1: 0.06mm, 2x2: 0.12mm, 4x4: 0.24mm)',
+4: 'Unknown Oxford diffraction detector'}
+
+
+class OXDimage(fabioimage):
+    def _readheader(self, infile):
+
+        infile.seek(0)
+
+        # Ascii header part 512 byes long 
+        self.header['Header Version'] = infile.readline()[:-2]
+        block = infile.readline()
+        self.header['Compression'] = block[12:15]
+        block = infile.readline()
+        self.header['NX'] = int(block[3:7])
+        self.header['NY'] = int(block[11:15])
+        self.header['OI'] = int(block[19:26])
+        self.header['OL'] = int(block[30:37])
+        block = infile.readline()
+        self.header['Header Size In Bytes'] = int(block[8:15])
+        #self.header['NG'] = int(block[19:26])
+        #self.header['NK'] = int(block[30:37])
+        #self.header['NS'] = int(block[41:48])
+        #self.header['NH'] = int(block[52:59])
+        block = infile.readline()
+        #self.header['NSUPPLEMENT'] = int(block[12:19])
+        block = infile.readline()
+        self.header['Time'] = block[5:29]
+
+        # Skip to general section (NG) 512 byes long <<<<<<"
+        infile.seek(256)
+        block = infile.read(512)
+        self.header['Binning in x'] = numpy.fromstring(block[0:2], numpy.uint16)[0]
+        self.header['Binning in y'] = numpy.fromstring(block[2:4], numpy.uint16)[0]
+        self.header['Detector size x'] = numpy.fromstring(block[22:24], numpy.uint16)[0]
+        self.header['Detector size y'] = numpy.fromstring(block[24:26], numpy.uint16)[0]
+        self.header['Pixels in x'] = numpy.fromstring(block[26:28], numpy.uint16)[0]
+        self.header['Pixels in y'] = numpy.fromstring(block[28:30], numpy.uint16)[0]
+        self.header['No of pixels'] = numpy.fromstring(block[36:40], numpy.uint32)[0]
+
+        # Speciel section (NS) 768 bytes long
+        block = infile.read(768)
+        self.header['Gain'] = numpy.fromstring(block[56:64], numpy.float)[0]
+        self.header['Overflows flag'] = numpy.fromstring(block[464:466], numpy.int16)[0]
+        self.header['Overflow after remeasure flag'] = numpy.fromstring(block[466:468], numpy.int16)[0]
+        self.header['Overflow threshold'] = numpy.fromstring(block[472:476], numpy.int32)[0]
+        self.header['Exposure time in sec'] = numpy.fromstring(block[480:488], numpy.float)[0]
+        self.header['Overflow time in sec'] = numpy.fromstring(block[488:496], numpy.float)[0]
+        self.header['Monitor counts of raw image 1'] = numpy.fromstring(block[528:532], numpy.int32)[0]
+        self.header['Monitor counts of raw image 2'] = numpy.fromstring(block[532:536], numpy.int32)[0]
+        self.header['Monitor counts of overflow raw image 1'] = numpy.fromstring(block[536:540], numpy.int32)[0]
+        self.header['Monitor counts of overflow raw image 2'] = numpy.fromstring(block[540:544], numpy.int32)[0]
+        self.header['Unwarping'] = numpy.fromstring(block[544:548], numpy.int32)[0]
+        self.header['Detector type'] = DETECTOR_TYPES[numpy.fromstring(block[548:552], numpy.int32)[0]]
+        self.header['Real pixel size x (mm)'] = numpy.fromstring(block[568:576], numpy.float)[0]
+        self.header['Real pixel size y (mm)'] = numpy.fromstring(block[576:584], numpy.float)[0]
+
+        # KM4 goniometer section (NK) 1024 bytes long
+        block = infile.read(1024)
+        # Spatial correction file
+        self.header['Spatial correction file'] = block[26:272]
+        self.header['Spatial correction file date'] = block[0:26]
+        # Angles are in steps due to stepper motors - conversion factor RAD
+        # angle[0] = omega, angle[1] = theta, angle[2] = kappa, angle[3] = phi,   
+        start_angles_step = numpy.fromstring(block[284:304], numpy.int32)
+        end_angles_step = numpy.fromstring(block[324:344], numpy.int32)
+        step2rad = numpy.fromstring(block[368:408], numpy.float)
+        # calc angles
+        start_angles_deg = start_angles_step * step2rad * 180.0 / numpy.pi
+
+        end_angles_deg = end_angles_step * step2rad * 180.0 / numpy.pi
+        self.header['Omega start in deg'] = start_angles_deg[0]
+        self.header['Theta start in deg'] = start_angles_deg[1]
+        self.header['Kappa start in deg'] = start_angles_deg[2]
+        self.header['Phi start in deg'] = start_angles_deg[3]
+        self.header['Omega end in deg'] = end_angles_deg[0]
+        self.header['Theta end in deg'] = end_angles_deg[1]
+        self.header['Kappa end in deg'] = end_angles_deg[2]
+        self.header['Phi end in deg'] = end_angles_deg[3]
+
+        zero_correction_soft_step = numpy.fromstring(block[512:532], numpy.int32)
+        zero_correction_soft_deg = zero_correction_soft_step * step2rad * 180.0 / numpy.pi
+        self.header['Omega zero corr. in deg'] = zero_correction_soft_deg[0]
+        self.header['Theta zero corr. in deg'] = zero_correction_soft_deg[1]
+        self.header['Kappa zero corr. in deg'] = zero_correction_soft_deg[2]
+        self.header['Phi zero corr. in deg'] = zero_correction_soft_deg[3]
+        # Beam rotation about e2,e3
+        self.header['Beam rot in deg (e2)'] = numpy.fromstring(block[552:560], numpy.float)[0]
+        self.header['Beam rot in deg (e3)'] = numpy.fromstring(block[560:568], numpy.float)[0]
+        # Wavelenghts alpha1, alpha2, beta
+        self.header['Wavelength alpha1'] = numpy.fromstring(block[568:576], numpy.float)[0]
+        self.header['Wavelength alpha2'] = numpy.fromstring(block[576:584], numpy.float)[0]
+        self.header['Wavelength alpha'] = numpy.fromstring(block[584:592], numpy.float)[0]
+        self.header['Wavelength beta'] = numpy.fromstring(block[592:600], numpy.float)[0]
+
+        # Detector tilts around e1,e2,e3 in deg
+        self.header['Detector tilt e1 in deg'] = numpy.fromstring(block[640:648], numpy.float)[0]
+        self.header['Detector tilt e2 in deg'] = numpy.fromstring(block[648:656], numpy.float)[0]
+        self.header['Detector tilt e3 in deg'] = numpy.fromstring(block[656:664], numpy.float)[0]
+
+
+        # Beam center
+        self.header['Beam center x'] = numpy.fromstring(block[664:672], numpy.float)[0]
+        self.header['Beam center y'] = numpy.fromstring(block[672:680], numpy.float)[0]
+        # Angle (alpha) between kappa rotation axis and e3 (ideally 50 deg)
+        self.header['Alpha angle in deg'] = numpy.fromstring(block[672:680], numpy.float)[0]
+        # Angle (beta) between phi rotation axis and e3 (ideally 0 deg)
+        self.header['Beta angle in deg'] = numpy.fromstring(block[672:680], numpy.float)[0]
+
+        # Detector distance
+        self.header['Distance in mm'] = numpy.fromstring(block[712:720], numpy.float)[0]
+        # Statistics section (NS) 512 bytes long
+        block = infile.read(512)
+        self.header['Stat: Min '] = numpy.fromstring(block[0:4], numpy.int32)[0]
+        self.header['Stat: Max '] = numpy.fromstring(block[4:8], numpy.int32)[0]
+        self.header['Stat: Average '] = numpy.fromstring(block[24:32], numpy.float)[0]
+        self.header['Stat: Stddev '] = numpy.sqrt(numpy.fromstring(block[32:40], numpy.float)[0])
+        self.header['Stat: Skewness '] = numpy.fromstring(block[40:48], numpy.float)[0]
+
+        # History section (NH) 2048 bytes long - only reads first 256 bytes
+        block = infile.read(256)
+        self.header['Flood field image'] = block[99:126]
+
+    def read(self, fname):
+        """
+        Read in header into self.header and
+            the data   into self.data
+        """
+        self.header = {}
+        self.resetvals()
+        infile = self._open(fname)
+        self._readheader(infile)
+
+        infile.seek(self.header['Header Size In Bytes'])
+
+        # Compute image size
+        try:
+            self.dim1 = int(self.header['NX'])
+            self.dim2 = int(self.header['NY'])
+        except:
+            raise Exception("Oxford  file", str(fname) + \
+                                "is corrupt, cannot read it")
+        #
+        if self.header['Compression'] == 'TY1':
+            #Compressed with the KM4CCD compression
+            bytecode = numpy.uint8
+            self.bpp = len(numpy.array(0, bytecode).tostring())
+            ReadBytes = self.dim1 * self.dim2 * self.bpp
+            diffs = infile.read(ReadBytes)
+            diffs = numpy.fromstring(diffs, bytecode)
+            offset = -127
+            diffs = diffs.astype(numpy.int32) + offset
+
+            if self.header['OI'] > 0:
+                bytecode = numpy.int16
+                self.bpp = len(numpy.array(0, bytecode).tostring())
+                ReadBytes = self.header['OI'] * self.bpp
+                over_short = infile.read(ReadBytes)
+                over_short = numpy.fromstring(over_short, bytecode)
+            if self.header['OL'] > 0:
+                bytecode = numpy.int32
+                self.bpp = len(numpy.array(0, bytecode).tostring())
+                ReadBytes = self.header['OL'] * self.bpp
+                over_long = infile.read(ReadBytes)
+                over_long = numpy.fromstring(over_long, bytecode)
+            block = diffs.copy()
+            old_val = 0
+            js = 0
+            jl = 0
+            logger.warning('OVER_SHORT: %s', block.dtype)
+
+            for i in range(self.dim1 * self.dim2):
+                if diffs[i] < 127:
+                    #print 'DIFF < 127:' , diffs[i] 
+                    d = diffs[i]
+                elif diffs[i] == 127:
+                    #print 'DIFF == 127:' , diffs[i] 
+                    d = over_short[js]
+                    #print 'd ' , d
+                    js = js + 1
+                elif diffs[i] == 128:
+                    #print 'DIFF == 128:' , diffs[i] 
+                    d = over_long[jl]
+                    jl = jl + 1
+                old_val = old_val + d
+                block[i] = old_val
+        else:
+            bytecode = numpy.int32
+            self.bpp = len(numpy.array(0, bytecode).tostring())
+            ReadBytes = self.dim1 * self.dim2 * self.bpp
+            block = numpy.fromstring(infile.read(ReadBytes), bytecode)
+
+        logger.warning('OVER_SHORT2: %s', block.dtype)
+        logger.warning("%s" % (block < 0).sum())
+        #
+        infile.close()
+        logger.warning("BYTECODE: %s", bytecode)
+        try:
+            # avoid int64 for x86_64 with astype
+            bytecode = numpy.int32
+
+            self.data = numpy.reshape(block.astype(bytecode), [self.dim2, self.dim1])
+            #self.data = numpy.reshape(block,[self.dim2, self.dim1])
+        except:
+            print len(block), self.dim2, self.dim1
+            raise IOError('Size spec in OD-header does not match size of image data field')
+
+        self.bytecode = self.data.dtype.type
+        self.pilimage = None
+        return self
diff --git a/fabio/TiffIO.py b/fabio/TiffIO.py
new file mode 100644
index 0000000..7b08cda
--- /dev/null
+++ b/fabio/TiffIO.py
@@ -0,0 +1,1065 @@
+#/*##########################################################################
+# Copyright (C) 2011 European Synchrotron Radiation Facility
+#
+# This file is part of the PyMca X-ray Fluorescence Toolkit developed at
+# the ESRF by the Beamline Instrumentation Software Support (BLISS) group.
+#
+# This file is free software; you can redistribute it and/or modify it 
+# under the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) 
+# any later version.
+#
+# PyMca is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+#############################################################################*/
+__author__ = "V.A. Sole - ESRF Data Analysis"
+__revision__ = 1422
+
+import sys
+import os
+import struct
+import string
+import numpy
+import logging
+logger = logging.getLogger("TiffIO")
+#import time
+
+ALLOW_MULTIPLE_STRIPS = False
+
+TAG_ID = { 256:"NumberOfColumns", # S or L ImageWidth
+            257:"NumberOfRows", # S or L ImageHeight
+            258:"BitsPerSample", # S Number of bits per component
+            259:"Compression", # SHORT (1 - NoCompression, ... 
+            262:"PhotometricInterpretation", # SHORT (0 - WhiteIsZero, 1 -BlackIsZero, 2 - RGB, 3 - Palette color
+            270:"ImageDescription", # ASCII
+            273:"StripOffsets", # S or L, for each strip, the byte offset of the strip
+            278:"RowsPerStrip", # S or L, number of rows in each back may be not for the last
+            279:"StripByteCounts", # S or L, The number of bytes in the strip AFTER any compression
+            305:"Software", # ASCII
+            306:"Date", # ASCII
+            339:"SampleFormat", # SHORT Interpretation of data in each pixel
+            }
+
+#TILES ARE TO BE SUPPORTED TOO ...
+TAG_NUMBER_OF_COLUMNS = 256
+TAG_NUMBER_OF_ROWS = 257
+TAG_BITS_PER_SAMPLE = 258
+TAG_PHOTOMETRIC_INTERPRETATION = 262
+TAG_COMPRESSION = 259
+TAG_IMAGE_DESCRIPTION = 270
+TAG_STRIP_OFFSETS = 273
+TAG_ROWS_PER_STRIP = 278
+TAG_STRIP_BYTE_COUNTS = 279
+TAG_SOFTWARE = 305
+TAG_DATE = 306
+TAG_SAMPLE_FORMAT = 339
+
+FIELD_TYPE = {1:('BYTE', "B"),
+               2:('ASCII', "s"), #string ending with binary zero
+               3:('SHORT', "H"),
+               4:('LONG', "I"),
+               5:('RATIONAL', "II"),
+               6:('SBYTE', "b"),
+               7:('UNDEFINED', "B"),
+               8:('SSHORT', "h"),
+               9:('SLONG', "i"),
+               10:('SRATIONAL', "ii"),
+               11:('FLOAT', "f"),
+               12:('DOUBLE', "d")}
+
+FIELD_TYPE_OUT = { 'B':   1,
+                   's':   2,
+                   'H':   3,
+                   'I':   4,
+                   'II':  5,
+                   'b':   6,
+                   'h':   8,
+                   'i':   9,
+                   'ii': 10,
+                   'f':  11,
+                   'd':  12}
+
+#sample formats (http://www.awaresystems.be/imaging/tiff/tiffflags/sampleformat.html)
+SAMPLE_FORMAT_UINT = 1
+SAMPLE_FORMAT_INT = 2
+SAMPLE_FORMAT_FLOAT = 3   #floating point
+SAMPLE_FORMAT_VOID = 4   #undefined data, usually assumed UINT
+SAMPLE_FORMAT_COMPLEXINT = 5
+SAMPLE_FORMAT_COMPLEXIEEEFP = 6
+
+
+
+class TiffIO:
+    def __init__(self, filename, mode=None, cache_length=20):
+        if mode is None:
+            mode = 'rb'
+        if 'b' not in mode:
+            mode = mode + 'b'
+        if 'a' in mode.lower():
+            raise IOError("Mode %s makes no sense on TIFF files. Consider 'rb+'" % mode)
+        if ('w' in mode):
+            if '+' not in mode:
+                mode += '+'
+        #if isinstance(filename, file): #does not work in python 3
+        if hasattr(filename, "seek"):
+            fd = filename
+            self._access = None
+        else:
+            #the b is needed for windows and python 3
+            fd = open(filename, mode)
+            self._access = mode
+
+        self._initInternalVariables(fd)
+        self._maxImageCacheLength = cache_length
+
+    def _initInternalVariables(self, fd=None):
+        if fd is None:
+            fd = self.fd
+        else:
+            self.fd = fd
+        # read the order
+        fd.seek(0)
+        order = fd.read(2).decode()
+        if len(order):
+            if order == "II":
+                #intel, little endian
+                fileOrder = "little"
+                self._structChar = '<'
+            elif order == "MM":
+                #motorola, high endian
+                fileOrder = "big"
+                self._structChar = '>'
+            else:
+                raise IOError("File is not a Mar CCD file, nor a TIFF file")
+            a = fd.read(2)
+            fortyTwo = struct.unpack(self._structChar + "H", a)[0]
+            if fortyTwo != 42:
+                raise IOError("Invalid TIFF version %d" % fortyTwo)
+            else:
+                logger.debug("VALID TIFF VERSION")
+            if sys.byteorder != fileOrder:
+                swap = True
+            else:
+                swap = False
+        else:
+            if sys.byteorder == "little":
+                self._structChar = '<'
+            else:
+                self._structChar = '>'
+            swap = False
+        self._swap = swap
+        self._IFD = []
+        self._imageDataCacheIndex = []
+        self._imageDataCache = []
+        self._imageInfoCacheIndex = []
+        self._imageInfoCache = []
+        self.getImageFileDirectories(fd)
+
+    def __makeSureFileIsOpen(self):
+        if not self.fd.closed:
+            return
+        logger.debug("Reopening closed file")
+        fileName = self.fd.name
+        if self._access is None:
+            #we do not own the file
+            #open in read mode
+            newFile = open(fileName, 'rb')
+        else:
+            newFile = open(fileName, self._access)
+        self.fd = newFile
+
+    def __makeSureFileIsClosed(self):
+        if self._access is None:
+            #we do not own the file
+            logger.info("Not closing not owned file")
+            return
+
+        if not self.fd.closed:
+            self.fd.close()
+
+    def getNumberOfImages(self):
+        #update for the case someone has done anything?
+        self._updateIFD()
+        return len(self._IFD)
+
+    def _updateIFD(self):
+        self.__makeSureFileIsOpen()
+        self.getImageFileDirectories()
+        self.__makeSureFileIsClosed()
+
+    def getImageFileDirectories(self, fd=None):
+        if fd is None:
+            fd = self.fd
+        else:
+            self.fd = fd
+        st = self._structChar
+        fd.seek(4)
+        self._IFD = []
+        nImages = 0
+        fmt = st + 'I'
+        inStr = fd.read(struct.calcsize(fmt))
+        if not len(inStr):
+            offsetToIFD = 0
+        else:
+            offsetToIFD = struct.unpack(fmt, inStr)[0]
+        logger.debug("Offset to first IFD = %d" % offsetToIFD)
+        while offsetToIFD != 0:
+            self._IFD.append(offsetToIFD)
+            nImages += 1
+            fd.seek(offsetToIFD)
+            fmt = st + 'H'
+            numberOfDirectoryEntries = struct.unpack(fmt, fd.read(struct.calcsize(fmt)))[0]
+            logger.debug("Number of directory entries = %d" % numberOfDirectoryEntries)
+
+            fmt = st + 'I'
+            fd.seek(offsetToIFD + 2 + 12 * numberOfDirectoryEntries)
+            offsetToIFD = struct.unpack(fmt, fd.read(struct.calcsize(fmt)))[0]
+            logger.debug("Next Offset to IFD = %d" % offsetToIFD)
+            #offsetToIFD = 0 
+        logger.info("Number of images found = %d" % nImages)
+        return nImages
+
+    def _parseImageFileDirectory(self, nImage):
+        offsetToIFD = self._IFD[nImage]
+        st = self._structChar
+        fd = self.fd
+        fd.seek(offsetToIFD)
+        fmt = st + 'H'
+        numberOfDirectoryEntries = struct.unpack(fmt, fd.read(struct.calcsize(fmt)))[0]
+        logger.info("Number of directory entries = %d" % numberOfDirectoryEntries)
+
+        fmt = st + 'HHI4s'
+        tagIDList = []
+        fieldTypeList = []
+        nValuesList = []
+        valueOffsetList = []
+        for i in range(numberOfDirectoryEntries):
+            tagID, fieldType, nValues, valueOffset = struct.unpack(fmt, fd.read(12))
+            tagIDList.append(tagID)
+            fieldTypeList.append(fieldType)
+            nValuesList.append(nValues)
+            if nValues == 1:
+                ftype, vfmt = FIELD_TYPE[fieldType]
+                if ftype not in ['ASCII', 'RATIONAL', 'SRATIONAL']:
+                    vfmt = st + vfmt
+                    actualValue = struct.unpack(vfmt, valueOffset[0: struct.calcsize(vfmt)])[0]
+                    valueOffsetList.append(actualValue)
+                else:
+                    valueOffsetList.append(valueOffset)
+            elif (nValues < 5) and (fieldType == 2):
+                ftype, vfmt = FIELD_TYPE[fieldType]
+                vfmt = st + "%d%s" % (nValues, vfmt)
+                actualValue = struct.unpack(vfmt, valueOffset[0: struct.calcsize(vfmt)])[0]
+                valueOffsetList.append(actualValue)
+            else:
+                valueOffsetList.append(valueOffset)
+            if tagID in TAG_ID:
+                logger.debug("tagID = %s" % TAG_ID[tagID])
+            else:
+                logger.info("tagID        = %d" % tagID)
+            logger.info("fieldType    = %s" % FIELD_TYPE[fieldType][0])
+            logger.info("nValues      = %d" % nValues)
+                #if nValues == 1:
+                #    logger.info("valueOffset =  %s" % valueOffset)
+        return tagIDList, fieldTypeList, nValuesList, valueOffsetList
+
+
+
+    def _readIFDEntry(self, tag, tagIDList, fieldTypeList, nValuesList, valueOffsetList):
+        fd = self.fd
+        st = self._structChar
+        idx = tagIDList.index(tag)
+        nValues = nValuesList[idx]
+        output = []
+        ftype, vfmt = FIELD_TYPE[fieldTypeList[idx]]
+        vfmt = st + "%d%s" % (nValues, vfmt)
+        requestedBytes = struct.calcsize(vfmt)
+        if nValues == 1:
+            output.append(valueOffsetList[idx])
+        elif requestedBytes < 5:
+            output.append(valueOffsetList[idx])
+        else:
+            offset = fd.seek(struct.unpack(st + "I", valueOffsetList[idx])[0])
+            output = struct.unpack(vfmt, fd.read(requestedBytes))
+        return output
+
+    def getData(self, nImage, **kw):
+        if nImage >= len(self._IFD):
+            #update prior to raise an index error error
+            self._updateIFD()
+        return self._readImage(nImage, **kw)
+
+    def getImage(self, nImage):
+        return self.getData(nImage)
+
+    def getInfo(self, nImage, **kw):
+        if nImage >= len(self._IFD):
+            #update prior to raise an index error error
+            self._updateIFD()
+        current = self._IFD[nImage]
+        return self._readInfo(nImage)
+
+    def _readInfo(self, nImage, close=True):
+        if nImage in self._imageInfoCacheIndex:
+            logger.debug("Reading info from cache")
+            return self._imageInfoCache[self._imageInfoCacheIndex.index(nImage)]
+
+        #read the header
+        self.__makeSureFileIsOpen()
+        tagIDList, fieldTypeList, nValuesList, valueOffsetList = self._parseImageFileDirectory(nImage)
+
+        #rows and columns
+        nColumns = valueOffsetList[tagIDList.index(TAG_NUMBER_OF_COLUMNS)]
+        nRows = valueOffsetList[tagIDList.index(TAG_NUMBER_OF_ROWS)]
+
+        #bits per sample
+        idx = tagIDList.index(TAG_BITS_PER_SAMPLE)
+        nBits = valueOffsetList[idx]
+        if nValuesList[idx] != 1:
+            #this happens with RGB and friends, nBits is not a single value
+            nBits = self._readIFDEntry(TAG_BITS_PER_SAMPLE,
+                                          tagIDList, fieldTypeList, nValuesList, valueOffsetList)
+
+        #sample format
+        if TAG_SAMPLE_FORMAT in tagIDList:
+            sampleFormat = valueOffsetList[tagIDList.index(TAG_SAMPLE_FORMAT)]
+        else:
+            #set to unknown
+            sampleFormat = SAMPLE_FORMAT_VOID
+
+        # compression
+        compression = False
+        compression_type = 1
+        if TAG_COMPRESSION in tagIDList:
+            compression_type = valueOffsetList[tagIDList.index(TAG_COMPRESSION)]
+            if compression_type == 1:
+                compression = False
+            else:
+                compression = True
+
+        #photometric interpretation
+        interpretation = 1
+        if TAG_PHOTOMETRIC_INTERPRETATION in tagIDList:
+            interpretation = valueOffsetList[tagIDList.index(TAG_PHOTOMETRIC_INTERPRETATION)]
+        else:
+            logger.warning("Non standard TIFF. Photometric interpretation TAG missing")
+        helpString = ""
+        if sys.version > '2.6':
+            helpString = eval('b""')
+
+        if TAG_IMAGE_DESCRIPTION in tagIDList:
+            imageDescription = self._readIFDEntry(TAG_IMAGE_DESCRIPTION,
+                    tagIDList, fieldTypeList, nValuesList, valueOffsetList)
+            if type(imageDescription) in [type([1]), type((1,))]:
+                imageDescription = helpString.join(imageDescription)
+        else:
+            imageDescription = "%d/%d" % (nImage + 1, len(self._IFD))
+
+        if sys.version < '3.0':
+            defaultSoftware = "Unknown Software"
+        else:
+            defaultSoftware = bytes("Unknown Software",
+                                    encoding='utf-8')
+        if TAG_SOFTWARE in tagIDList:
+            software = self._readIFDEntry(TAG_SOFTWARE,
+                    tagIDList, fieldTypeList, nValuesList, valueOffsetList)
+            if type(software) in [type([1]), type((1,))]:
+                software = helpString.join(software)
+        else:
+            software = defaultSoftware
+
+        if software == defaultSoftware:
+            try:
+                if sys.version < '3.0':
+                    if imageDescription.upper().startswith("IMAGEJ"):
+                        software = imageDescription.split("=")[0]
+                else:
+                    tmpString = imageDescription.decode()
+                    if tmpString.upper().startswith("IMAGEJ"):
+                        software = bytes(tmpString.split("=")[0],
+                                         encoding='utf-8')
+            except:
+                pass
+
+        if TAG_DATE in tagIDList:
+            date = self._readIFDEntry(TAG_DATE,
+                    tagIDList, fieldTypeList, nValuesList, valueOffsetList)
+            if type(date) in [type([1]), type((1,))]:
+                date = helpString.join(date)
+        else:
+            date = "Unknown Date"
+
+        stripOffsets = self._readIFDEntry(TAG_STRIP_OFFSETS,
+                        tagIDList, fieldTypeList, nValuesList, valueOffsetList)
+        rowsPerStrip = nRows
+        if TAG_ROWS_PER_STRIP in tagIDList:
+            rowsPerStrip = self._readIFDEntry(TAG_ROWS_PER_STRIP,
+                        tagIDList, fieldTypeList, nValuesList, valueOffsetList)[0]
+        else:
+            logger.warning("Non standard TIFF. Rows per strip TAG missing")
+
+        stripByteCounts = [int(nRows * nColumns * nBits / 8)]
+        if TAG_STRIP_BYTE_COUNTS in tagIDList:
+            stripByteCounts = self._readIFDEntry(TAG_STRIP_BYTE_COUNTS,
+                        tagIDList, fieldTypeList, nValuesList, valueOffsetList)
+        else:
+            logger.warning("Non standard TIFF. Strip byte counts TAG missing")
+
+        if close:
+            self.__makeSureFileIsClosed()
+
+        info = {}
+        info["nRows"] = nRows
+        info["nColumns"] = nColumns
+        info["nBits"] = nBits
+        info["compression"] = compression
+        info["compression_type"] = compression_type
+        info["imageDescription"] = imageDescription
+        info["stripOffsets"] = stripOffsets #This contains the file offsets to the data positions
+        info["rowsPerStrip"] = rowsPerStrip
+        info["stripByteCounts"] = stripByteCounts #bytes in strip since I do not support compression
+        info["software"] = software
+        info["date"] = date
+        info["sampleFormat"] = sampleFormat
+        info["photometricInterpretation"] = interpretation
+        infoDict = {}
+        if sys.version < '3.0':
+            testString = 'PyMca'
+        else:
+            testString = eval('b"PyMca"')
+        if software.startswith(testString):
+            #str to make sure python 2.x sees it as string and not unicode
+            if sys.version < '3.0':
+                descriptionString = imageDescription
+            else:
+                descriptionString = str(imageDescription.decode())
+            #interpret the image description in terms of supplied
+            #information at writing time
+            items = descriptionString.split('=')
+            for i in range(int(len(items) / 2)):
+                key = "%s" % items[i * 2]
+                #get rid of the \n at the end of the value 
+                value = "%s" % items[i * 2 + 1][:-1]
+                infoDict[key] = value
+        info['info'] = infoDict
+
+        self._imageInfoCacheIndex.insert(0, nImage)
+        self._imageInfoCache.insert(0, info)
+        if len(self._imageInfoCacheIndex) > self._maxImageCacheLength:
+            self._imageInfoCacheIndex = self._imageInfoCacheIndex[:self._maxImageCacheLength]
+            self._imageInfoCache = self._imageInfoCache[:self._maxImageCacheLength]
+        return info
+
+    def _readImage(self, nImage, **kw):
+        logger.debug("Reading image %d" % nImage)
+        if 'close' in kw:
+            close = kw['close']
+        else:
+            close = True
+        rowMin = kw.get('rowMin', None)
+        rowMax = kw.get('rowMax', None)
+        if nImage in self._imageDataCacheIndex:
+            logger.debug("Reading image data from cache")
+            return self._imageDataCache[self._imageDataCacheIndex.index(nImage)]
+
+        self.__makeSureFileIsOpen()
+        info = self._readInfo(nImage, close=False)
+        compression = info['compression']
+        compression_type = info['compression_type']
+        if compression:
+            if compression_type != 32773:
+                raise IOError("Compressed TIFF images not supported except packbits")
+            else:
+                #PackBits compression
+                logger.debug("Using PackBits compression")
+
+        interpretation = info["photometricInterpretation"]
+        if interpretation > 2:
+            raise IOError("Only grey scale images supported")
+
+        nRows = info["nRows"]
+        nColumns = info["nColumns"]
+        nBits = info["nBits"]
+        sampleFormat = info["sampleFormat"]
+
+        if rowMin is None:
+            rowMin = 0
+
+        if rowMax is None:
+            rowMax = nRows - 1
+
+        if rowMin < 0:
+            rowMin = nRows - rowMin
+
+        if rowMax < 0:
+            rowMax = nRows - rowMax
+
+        if rowMax < rowMin:
+            txt = "Max Row smaller than Min Row. Reverse selection not supported"
+            raise NotImplemented(txt)
+
+        if rowMin >= nRows:
+            raise IndexError("Image only has %d rows" % nRows)
+
+        if rowMax >= nRows:
+            raise IndexError("Image only has %d rows" % nRows)
+
+        if sampleFormat == SAMPLE_FORMAT_FLOAT:
+            if nBits == 32:
+                dtype = numpy.float32
+            elif nBits == 64:
+                dtype = numpy.float64
+            else:
+                raise ValueError("Unsupported number of bits for a float: %d" % nBits)
+        elif sampleFormat in [SAMPLE_FORMAT_UINT, SAMPLE_FORMAT_VOID]:
+            if nBits == 8:
+                dtype = numpy.uint8
+            elif nBits == 16:
+                dtype = numpy.uint16
+            elif nBits == 32:
+                dtype = numpy.uint32
+            elif nBits == 64:
+                dtype = numpy.uint64
+            else:
+                raise ValueError("Unsupported number of bits for unsigned int: %d" % nBits)
+        elif sampleFormat == SAMPLE_FORMAT_INT:
+            if nBits == 8:
+                dtype = numpy.int8
+            elif nBits == 16:
+                dtype = numpy.int16
+            elif nBits == 32:
+                dtype = numpy.int32
+            elif nBits == 64:
+                dtype = numpy.int64
+            else:
+                raise ValueError("Unsupported number of bits for signed int: %d" % nBits)
+        else:
+            raise ValueError("Unsupported combination. Bits = %d  Format = %d" % (nBits, sampleFormat))
+        image = numpy.zeros((nRows, nColumns), dtype=dtype)
+
+        fd = self.fd
+        st = self._structChar
+        stripOffsets = info["stripOffsets"] #This contains the file offsets to the data positions
+        rowsPerStrip = info["rowsPerStrip"]
+        stripByteCounts = info["stripByteCounts"] #bytes in strip since I do not support compression
+
+        rowStart = 0
+        if len(stripOffsets) == 1:
+            bytesPerRow = int(stripByteCounts[0] / rowsPerStrip)
+            fd.seek(stripOffsets[0] + rowMin * bytesPerRow)
+            nBytes = (rowMax - rowMin + 1) * bytesPerRow
+            readout = numpy.fromstring(fd.read(nBytes), dtype)
+            readout.shape = -1, nColumns
+            if self._swap:
+                image[rowMin:rowMax + 1, :] = readout.byteswap()
+            else:
+                image[rowMin:rowMax + 1, :] = readout
+        else:
+            for i in range(len(stripOffsets)):
+                #the amount of rows
+                nRowsToRead = rowsPerStrip
+                rowEnd = int(min(rowStart + nRowsToRead, nRows))
+                if rowEnd < rowMin:
+                    rowStart += nRowsToRead
+                    continue
+                if (rowStart > rowMax):
+                    break
+                #we are in position
+                fd.seek(stripOffsets[i])
+                #the amount of bytes to read
+                nBytes = stripByteCounts[i]
+                if compression_type == 32773:
+                    try:
+                        bufferBytes = bytes()
+                    except:
+                        #python 2.5 ...
+                        bufferBytes = ""
+                    #packBits
+                    readBytes = 0
+                    #intermediate buffer
+                    tmpBuffer = fd.read(nBytes)
+                    while readBytes < nBytes:
+                        n = struct.unpack('b', tmpBuffer[readBytes:(readBytes + 1)])[0]
+                        readBytes += 1
+                        if n >= 0:
+                            #should I prevent reading more than the
+                            #length of the chain? Let's python raise
+                            #the exception...
+                            bufferBytes += tmpBuffer[readBytes:\
+                                                      readBytes + (n + 1)]
+                            readBytes += (n + 1)
+                        elif n > -128:
+                            readBytes += 1
+                            bufferBytes += (-n + 1) * tmpBuffer[readBytes:(readBytes + 1)]
+                        else:
+                            #if read -128 ignore the byte
+                            continue
+                    readout = numpy.fromstring(bufferBytes, dtype)
+                    readout.shape = -1, nColumns
+                    image[rowStart:rowEnd, :] = readout
+                else:
+                    if 1:
+                        #use numpy
+                        readout = numpy.fromstring(fd.read(nBytes), dtype)
+                        readout.shape = -1, nColumns
+                        if self._swap:
+                            image[rowStart:rowEnd, :] = readout.byteswap()
+                        else:
+                            image[rowStart:rowEnd, :] = readout
+                    else:
+                        #using struct
+                        readout = numpy.array(struct.unpack(st + "%df" % int(nBytes / 4), fd.read(nBytes)),
+                                              dtype=dtype)
+                        readout.shape = -1, nColumns
+                        image[rowStart:rowEnd, :] = readout
+                rowStart += nRowsToRead
+        if close:
+            self.__makeSureFileIsClosed()
+        if (rowMin == 0) and (rowMax == (nRows - 1)):
+            self._imageDataCacheIndex.insert(0, nImage)
+            self._imageDataCache.insert(0, image)
+            if len(self._imageDataCacheIndex) > self._maxImageCacheLength:
+                self._imageDataCacheIndex = self._imageDataCacheIndex[:self._maxImageCacheLength]
+                self._imageDataCache = self._imageDataCache[:self._maxImageCacheLength]
+        return image
+
+    def writeImage(self, image0, info=None, software=None, date=None):
+        if software is None:
+            software = 'PyMca.TiffIO'
+        #if date is None:
+        #    date = time.ctime()
+
+        self.__makeSureFileIsOpen()
+        fd = self.fd
+        #prior to do anything, perform some tests
+        if not len(image0.shape):
+            raise ValueError("Empty image")
+        if len(image0.shape) == 1:
+            #get a different view
+            image = image0[:]
+            image.shape = 1, -1
+        else:
+            image = image0
+
+        if image.dtype == numpy.float64:
+            image = image.astype(numpy.float32)
+        fd.seek(0)
+        mode = fd.mode
+        name = fd.name
+        if 'w' in mode:
+            #we have to overwrite the file
+            self.__makeSureFileIsClosed()
+            fd = None
+            if os.path.exists(name):
+                os.remove(name)
+            fd = open(name, mode='wb+')
+            self._initEmptyFile(fd)
+        self.fd = fd
+
+        #read the file size
+        self.__makeSureFileIsOpen()
+        fd = self.fd
+        fd.seek(0, os.SEEK_END)
+        endOfFile = fd.tell()
+        if fd.tell() == 0:
+            self._initEmptyFile(fd)
+            fd.seek(0, os.SEEK_END)
+            endOfFile = fd.tell()
+
+        #init internal variables
+        self._initInternalVariables(fd)
+        st = self._structChar
+
+        #get the image file directories
+        nImages = self.getImageFileDirectories()
+        logger.debug("File contains %d images" % nImages)
+        if nImages == 0:
+            fd.seek(4)
+            fmt = st + 'I'
+            fd.write(struct.pack(fmt, endOfFile))
+        else:
+            fd.seek(self._IFD[-1])
+            fmt = st + 'H'
+            numberOfDirectoryEntries = struct.unpack(fmt, fd.read(struct.calcsize(fmt)))[0]
+            fmt = st + 'I'
+            pos = self._IFD[-1] + 2 + 12 * numberOfDirectoryEntries
+            fd.seek(pos)
+            fmt = st + 'I'
+            fd.write(struct.pack(fmt, endOfFile))
+        fd.flush()
+
+        #and we can write at the end of the file, find out the file length
+        fd.seek(0, os.SEEK_END)
+
+        #get the description information from the input information
+        if info is None:
+            description = info
+        else:
+            description = "%s" % ""
+            for key in info.keys():
+                description += "%s=%s\n" % (key, info[key])
+
+        #get the image file directory
+        outputIFD = self._getOutputIFD(image, description=description,
+                                              software=software,
+                                              date=date)
+
+        #write the new IFD
+        fd.write(outputIFD)
+
+        #write the image
+        if self._swap:
+            fd.write(image.byteswap().tostring())
+        else:
+            fd.write(image.tostring())
+
+        fd.flush()
+        self.fd = fd
+        self.__makeSureFileIsClosed()
+
+    def _initEmptyFile(self, fd=None):
+        if fd is None:
+            fd = self.fd
+        if sys.byteorder == "little":
+            order = "II"
+            #intel, little endian
+            fileOrder = "little"
+            self._structChar = '<'
+        else:
+            order = "MM"
+            #motorola, high endian
+            fileOrder = "big"
+            self._structChar = '>'
+        st = self._structChar
+        if fileOrder == sys.byteorder:
+            self._swap = False
+        else:
+            self._swap = True
+        fd.seek(0)
+        if sys.version < '3.0':
+            fd.write(struct.pack(st + '2s', order))
+            fd.write(struct.pack(st + 'H', 42))
+            fd.write(struct.pack(st + 'I', 0))
+        else:
+            fd.write(struct.pack(st + '2s', bytes(order, 'utf-8')))
+            fd.write(struct.pack(st + 'H', 42))
+            fd.write(struct.pack(st + 'I', 0))
+        fd.flush()
+
+    def _getOutputIFD(self, image, description=None, software=None, date=None):
+        #the tags have to be in order
+        #the very minimum is
+        #256:"NumberOfColumns",           # S or L ImageWidth
+        #257:"NumberOfRows",              # S or L ImageHeight
+        #258:"BitsPerSample",             # S Number of bits per component
+        #259:"Compression",               # SHORT (1 - NoCompression, ... 
+        #262:"PhotometricInterpretation", # SHORT (0 - WhiteIsZero, 1 -BlackIsZero, 2 - RGB, 3 - Palette color
+        #270:"ImageDescription",          # ASCII
+        #273:"StripOffsets",              # S or L, for each strip, the byte offset of the strip
+        #278:"RowsPerStrip",              # S or L, number of rows in each back may be not for the last
+        #279:"StripByteCounts",           # S or L, The number of bytes in the strip AFTER any compression
+        #305:"Software",                  # ASCII
+        #306:"Date",                      # ASCII
+        #339:"SampleFormat",              # SHORT Interpretation of data in each pixel
+
+        nDirectoryEntries = 9
+        imageDescription = None
+        if description is not None:
+            descriptionLength = len(description)
+            while descriptionLength < 4:
+                description = description + " "
+                descriptionLength = len(description)
+            if sys.version >= '3.0':
+                description = bytes(description, 'utf-8')
+            imageDescription = struct.pack("%ds" % descriptionLength, description)
+            nDirectoryEntries += 1
+
+        #software
+        if software is not None:
+            softwareLength = len(software)
+            while softwareLength < 4:
+                software = software + " "
+                softwareLength = len(software)
+            if sys.version >= '3.0':
+                software = bytes(software, 'utf-8')
+            softwarePackedString = struct.pack("%ds" % softwareLength, software)
+            nDirectoryEntries += 1
+        else:
+            softwareLength = 0
+
+        if date is not None:
+            dateLength = len(date)
+            if sys.version >= '3.0':
+                date = bytes(date, 'utf-8')
+            datePackedString = struct.pack("%ds" % dateLength, date)
+            dateLength = len(datePackedString)
+            nDirectoryEntries += 1
+        else:
+            dateLength = 0
+
+        nRows, nColumns = image.shape
+        dtype = image.dtype
+        bitsPerSample = int(dtype.str[-1]) * 8
+
+        #only uncompressed data
+        compression = 1
+
+        #interpretation, black is zero
+        interpretation = 1
+
+        #image description
+        if imageDescription is not None:
+            descriptionLength = len(imageDescription)
+        else:
+            descriptionLength = 0
+
+        #strip offsets
+        #we are putting them after the directory and the directory is
+        #at the end of the file
+        self.fd.seek(0, os.SEEK_END)
+        endOfFile = self.fd.tell()
+        if endOfFile == 0:
+            #empty file
+            endOfFile = 8
+
+        #rows per strip
+        if ALLOW_MULTIPLE_STRIPS:
+            #try to segment the image in several pieces
+            if not (nRows % 4):
+                rowsPerStrip = int(nRows / 4)
+            elif not (nRows % 10):
+                rowsPerStrip = int(nRows / 10)
+            elif not (nRows % 8):
+                rowsPerStrip = int(nRows / 8)
+            elif not (nRows % 4):
+                rowsPerStrip = int(nRows / 4)
+            elif not (nRows % 2):
+                rowsPerStrip = int(nRows / 2)
+            else:
+                rowsPerStrip = nRows
+        else:
+            rowsPerStrip = nRows
+
+        #stripByteCounts
+        stripByteCounts = int(nColumns * rowsPerStrip * bitsPerSample / 8)
+
+        if descriptionLength > 4:
+            stripOffsets0 = endOfFile + dateLength + descriptionLength + \
+                        2 + 12 * nDirectoryEntries + 4
+        else:
+            stripOffsets0 = endOfFile + dateLength + \
+                        2 + 12 * nDirectoryEntries + 4
+
+        if softwareLength > 4:
+            stripOffsets0 += softwareLength
+
+        stripOffsets = [stripOffsets0]
+        stripOffsetsLength = 0
+        stripOffsetsString = None
+
+        st = self._structChar
+
+        if rowsPerStrip != nRows:
+            nStripOffsets = int(nRows / rowsPerStrip)
+            fmt = st + 'I'
+            stripOffsetsLength = struct.calcsize(fmt) * nStripOffsets
+            stripOffsets0 += stripOffsetsLength
+            #the length for the stripByteCounts will be the same
+            stripOffsets0 += stripOffsetsLength
+            stripOffsets = []
+            for i in range(nStripOffsets):
+                value = stripOffsets0 + i * stripByteCounts
+                stripOffsets.append(value)
+                if i == 0:
+                    stripOffsetsString = struct.pack(fmt, value)
+                    stripByteCountsString = struct.pack(fmt, stripByteCounts)
+                else:
+                    stripOffsetsString += struct.pack(fmt, value)
+                    stripByteCountsString += struct.pack(fmt, stripByteCounts)
+
+        logger.debug("IMAGE WILL START AT %d" % stripOffsets[0])
+
+        #sample format
+        if dtype in [numpy.float32, numpy.float64] or\
+           dtype.str[-2] == 'f':
+            sampleFormat = SAMPLE_FORMAT_FLOAT
+        elif dtype in [numpy.uint8, numpy.uint16, numpy.uint32, numpy.uint64]:
+            sampleFormat = SAMPLE_FORMAT_UINT
+        elif dtype in [numpy.int8, numpy.int16, numpy.int32, numpy.int64]:
+            sampleFormat = SAMPLE_FORMAT_INT
+        else:
+            raise ValueError("Unsupported data type %s" % dtype)
+
+        info = {}
+        info["nColumns"] = nColumns
+        info["nRows"] = nRows
+        info["nBits"] = bitsPerSample
+        info["compression"] = compression
+        info["photometricInterpretation"] = interpretation
+        info["stripOffsets"] = stripOffsets
+        info["rowsPerStrip"] = rowsPerStrip
+        info["stripByteCounts"] = stripByteCounts
+        info["date"] = date
+        info["sampleFormat"] = sampleFormat
+
+        outputIFD = ""
+        if sys.version > '2.6':
+            outputIFD = eval('b""')
+
+        fmt = st + "H"
+        outputIFD += struct.pack(fmt, nDirectoryEntries)
+
+        fmt = st + "HHII"
+        outputIFD += struct.pack(fmt, TAG_NUMBER_OF_COLUMNS,
+                                         FIELD_TYPE_OUT['I'],
+                                         1,
+                                         info["nColumns"])
+        outputIFD += struct.pack(fmt, TAG_NUMBER_OF_ROWS,
+                                         FIELD_TYPE_OUT['I'],
+                                         1,
+                                         info["nRows"])
+
+        fmt = st + 'HHIHH'
+        outputIFD += struct.pack(fmt, TAG_BITS_PER_SAMPLE,
+                                         FIELD_TYPE_OUT['H'],
+                                         1,
+                                         info["nBits"], 0)
+        fmt = st + 'HHIHH'
+        outputIFD += struct.pack(fmt, TAG_COMPRESSION,
+                                         FIELD_TYPE_OUT['H'],
+                                         1,
+                                         info["compression"], 0)
+        fmt = st + 'HHIHH'
+        outputIFD += struct.pack(fmt, TAG_PHOTOMETRIC_INTERPRETATION,
+                                         FIELD_TYPE_OUT['H'],
+                                         1,
+                                         info["photometricInterpretation"], 0)
+
+        if imageDescription is not None:
+            descriptionLength = len(imageDescription)
+            if descriptionLength > 4:
+                fmt = st + 'HHII'
+                outputIFD += struct.pack(fmt, TAG_IMAGE_DESCRIPTION,
+                                         FIELD_TYPE_OUT['s'],
+                                         descriptionLength,
+                                         info["stripOffsets"][0] - \
+                                         2 * stripOffsetsLength - \
+                                         descriptionLength)
+            else:
+                #it has to have length 4
+                fmt = st + 'HHI%ds' % descriptionLength
+                outputIFD += struct.pack(fmt, TAG_IMAGE_DESCRIPTION,
+                                         FIELD_TYPE_OUT['s'],
+                                         descriptionLength,
+                                         description)
+
+        if len(stripOffsets) == 1:
+            fmt = st + 'HHII'
+            outputIFD += struct.pack(fmt, TAG_STRIP_OFFSETS,
+                                             FIELD_TYPE_OUT['I'],
+                                             1,
+                                             info["stripOffsets"][0])
+        else:
+            fmt = st + 'HHII'
+            outputIFD += struct.pack(fmt, TAG_STRIP_OFFSETS,
+                                             FIELD_TYPE_OUT['I'],
+                                             len(stripOffsets),
+                    info["stripOffsets"][0] - 2 * stripOffsetsLength)
+
+        fmt = st + 'HHII'
+        outputIFD += struct.pack(fmt, TAG_ROWS_PER_STRIP,
+                                         FIELD_TYPE_OUT['I'],
+                                         1,
+                                         info["rowsPerStrip"])
+
+        if len(stripOffsets) == 1:
+            fmt = st + 'HHII'
+            outputIFD += struct.pack(fmt, TAG_STRIP_BYTE_COUNTS,
+                                             FIELD_TYPE_OUT['I'],
+                                             1,
+                                             info["stripByteCounts"])
+        else:
+            fmt = st + 'HHII'
+            outputIFD += struct.pack(fmt, TAG_STRIP_BYTE_COUNTS,
+                                             FIELD_TYPE_OUT['I'],
+                                             len(stripOffsets),
+                    info["stripOffsets"][0] - stripOffsetsLength)
+
+        if software is not None:
+            if softwareLength > 4:
+                fmt = st + 'HHII'
+                outputIFD += struct.pack(fmt, TAG_SOFTWARE,
+                                         FIELD_TYPE_OUT['s'],
+                                         softwareLength,
+                                         info["stripOffsets"][0] - \
+                                         2 * stripOffsetsLength - \
+                            descriptionLength - softwareLength - dateLength)
+            else:
+                #it has to have length 4
+                fmt = st + 'HHI%ds' % softwareLength
+                outputIFD += struct.pack(fmt, TAG_SOFTWARE,
+                                         FIELD_TYPE_OUT['s'],
+                                         softwareLength,
+                                         softwarePackedString)
+
+        if date is not None:
+            fmt = st + 'HHII'
+            outputIFD += struct.pack(fmt, TAG_DATE,
+                                      FIELD_TYPE_OUT['s'],
+                                      dateLength,
+                                      info["stripOffsets"][0] - \
+                                         2 * stripOffsetsLength - \
+                                      descriptionLength - dateLength)
+
+        fmt = st + 'HHIHH'
+        outputIFD += struct.pack(fmt, TAG_SAMPLE_FORMAT,
+                                         FIELD_TYPE_OUT['H'],
+                                         1,
+                                         info["sampleFormat"], 0)
+        fmt = st + 'I'
+        outputIFD += struct.pack(fmt, 0)
+
+        if softwareLength > 4:
+            outputIFD += softwarePackedString
+
+        if date is not None:
+            outputIFD += datePackedString
+
+        if imageDescription is not None:
+            if descriptionLength > 4:
+                outputIFD += imageDescription
+
+        if stripOffsetsString is not None:
+            outputIFD += stripOffsetsString
+            outputIFD += stripByteCountsString
+
+        return outputIFD
+
+
+if __name__ == "__main__":
+    filename = sys.argv[1]
+    dtype = numpy.uint16
+    if not os.path.exists(filename):
+        logger.info("Testing file creation")
+        tif = TiffIO(filename, mode='wb+')
+        data = numpy.arange(10000).astype(dtype)
+        data.shape = 100, 100
+        tif.writeImage(data, info={'Title':'1st'})
+        tif = None
+        if os.path.exists(filename):
+            logger.info("Testing image appending")
+            tif = TiffIO(filename, mode='rb+')
+            tif.writeImage((data * 2).astype(dtype), info={'Title':'2nd'})
+            tif = None
+    tif = TiffIO(filename)
+    logger.info("Number of images = %d" % tif.getNumberOfImages())
+    for i in range(tif.getNumberOfImages()):
+        info = tif.getInfo(i)
+        for key in info:
+            logger.info("%s = %s" % (key, info[key]))
+        data = tif.getImage(i)[0, 0:10]
+        print ("data [0, 0:10] = ", data)
+
diff --git a/fabio/__init__.py b/fabio/__init__.py
new file mode 100644
index 0000000..203a53d
--- /dev/null
+++ b/fabio/__init__.py
@@ -0,0 +1,9 @@
+version = "0.0.8"
+
+import fabioimage
+import openimage
+from fabioutils import filename_object, COMPRESSORS, jump_filename, \
+        previous_filename, next_filename, deconstruct_filename, \
+        extract_filenumber, getnum
+from openimage import openimage as open
+
diff --git a/fabio/adscimage.py b/fabio/adscimage.py
new file mode 100644
index 0000000..24bc564
--- /dev/null
+++ b/fabio/adscimage.py
@@ -0,0 +1,137 @@
+
+## Automatically adapted for numpy.oldnumeric Oct 05, 2007 by alter_code1.py
+
+#!/usr/bin/env python
+"""
+
+Authors: Henning O. Sorensen & Erik Knudsen
+         Center for Fundamental Research: Metal Structures in Four Dimensions
+         Risoe National Laboratory
+         Frederiksborgvej 399
+         DK-4000 Roskilde
+         email:erik.knudsen at risoe.dk
+
++ mods for fabio by JPW
+
+"""
+
+import numpy, logging
+from fabioimage import fabioimage
+logger = logging.getLogger("adscimage")
+
+class adscimage(fabioimage):
+    """ Read an image in ADSC format (quite similar to edf?) """
+
+    def read(self, fname):
+        """ read in the file """
+        infile = self._open(fname, "rb")
+        try:
+            self._readheader(infile)
+        except:
+            raise Exception("Error processing adsc header")
+        # banned by bzip/gzip???
+        try:
+            infile.seek(int(self.header['HEADER_BYTES']), 0)
+        except TypeError:
+            # Gzipped does not allow a seek and read header is not
+            # promising to stop in the right place
+            infile.close()
+            infile = self._open(fname, "rb")
+            infile.read(int(self.header['HEADER_BYTES']))
+        binary = infile.read()
+        infile.close()
+
+        #now read the data into the array
+        self.dim1 = int(self.header['SIZE1'])
+        self.dim2 = int(self.header['SIZE2'])
+        if 'little' in self.header['BYTE_ORDER']:
+            try:
+                self.data = numpy.reshape(
+                    numpy.fromstring(binary, numpy.uint16),
+                    (self.dim2, self.dim1))
+            except ValueError:
+                raise IOError, 'Size spec in ADSC-header does not match ' + \
+                    'size of image data field'
+            self.bytecode = numpy.uint16
+            logger.info("adscimage read in using low byte first (x386-order)")
+        else:
+            try:
+                self.data = numpy.reshape(
+                    numpy.fromstring(binary, numpy.uint16),
+                    (self.dim2, self.dim1)).byteswap()
+            except ValueError:
+                raise IOError, 'Size spec in ADSC-header does not match ' + \
+                    'size of image data field'
+            self.bytecode = numpy.uint16
+            logger.info('adscimage using high byte first (network order)')
+        self.resetvals()
+        return self
+
+
+    def _readheader(self, infile):
+        """ read an adsc header """
+        line = infile.readline()
+        bytesread = len(line)
+        while '}' not in line:
+            if '=' in line:
+                (key, val) = line.split('=')
+                self.header_keys.append(key.strip())
+                self.header[key.strip()] = val.strip(' ;\n')
+            line = infile.readline()
+            bytesread = bytesread + len(line)
+
+
+    def write(self, fname):
+        """
+        Write adsc format
+        """
+        out = '{\n'
+        for key in self.header_keys:
+            out += "%s = %s;\n" % (key, self.header[key])
+        # FIXME ??? - made padding match header bytes keyword            
+        #        the cbflib example image has exactly 512...
+        if self.header.has_key("HEADER_BYTES"):
+            pad = int(self.header["HEADER_BYTES"]) - len(out) - 2
+        else:
+            # integer division
+            # 1234567890123456789012
+            # HEADER_BYTES = 1234;\n
+            hsize = ((len(out) + 23) / 512 + 1) * 512
+            out += "HEADER_BYTES=%d;\n" % (hsize)
+            pad = hsize - len(out) - 2
+        out += pad * ' ' + "}\n"
+        assert len(out) % 512 == 0 , "Header is not multiple of 512"
+        outf = open(fname, "wb")
+        outf.write(out)
+        # it says "unsigned_short" ? ... jpw example has:
+        # BYTE_ORDER=big_endian;
+        # TYPE=unsigned_short;
+        if "little" in self.header["BYTE_ORDER"]:
+            outf.write(self.data.astype(numpy.uint16).tostring())
+        else:
+            outf.write(self.data.byteswap().astype(
+                    numpy.uint16).tostring())
+        outf.close()
+
+
+def test():
+    """ testcase """
+    import sys, time
+    img = adscimage()
+    begin = time.clock()
+    while (sys.argv[1:]):
+        img.read(sys.argv[1])
+#        rim = img.toPIL16()
+        img.rebin(2, 2)
+        img.write('jegErEnFil0000.img')
+        print sys.argv[1] + ": max=%d, min=%d, mean=%.2e, stddev=%.2e" % (\
+              img.getmax(), img.getmin(), img.getmean(), img.getstddev())
+        print 'integrated intensity (%d %d %d %d) =%.3f' % (\
+              10, 20, 20, 40, img.integrate_area((10, 20, 20, 40)))
+        sys.argv[1:] = sys.argv[2:]
+    end = time.clock()
+    print end - begin
+
+
+if __name__ == '__main__':
+    test()
diff --git a/fabio/bruker100image.py b/fabio/bruker100image.py
new file mode 100644
index 0000000..c8117cd
--- /dev/null
+++ b/fabio/bruker100image.py
@@ -0,0 +1,95 @@
+
+import numpy as N
+import math
+import Image
+from brukerimage import brukerimage
+import readbytestream
+
+class bruker100image(brukerimage):
+
+
+    def toPIL16(self, filename=None):
+        # FIXME - why is this different for bruker100images?
+        if filename:
+            self.read(filename)
+            PILimage = Image.frombuffer("F",
+                                        (self.dim1, self.dim2),
+                                        self.data,
+                                        "raw",
+                                        "F;16", 0, -1)
+            return PILimage
+        else:
+            PILimage = Image.frombuffer("F",
+                                        (self.dim1, self.dim2),
+                                        self.data,
+                                        "raw",
+                                        "F;16", 0, -1)
+            return PILimage
+
+    def read(self, fname):
+        f = open(fname, "rb")
+        try:
+            self._readheader(f)
+        except:
+            raise
+
+        rows = int(self.header['NROWS'])
+        cols = int(self.header['NCOLS'])
+        npixelb = int(self.header['NPIXELB'][0])
+        # you had to read the Bruker docs to know this!
+
+        # We are now at the start of the image - assuming 
+        #   readbrukerheader worked
+        # size = rows * cols * npixelb
+        self.data = readbytestream(f, f.tell(), rows, cols, npixelb,
+                                    datatype="int", signed='n', swap='n')
+
+        noverfl = self.header['NOVERFL'].split() # now process the overflows
+        #read the set of "underflow pixels" - these will be completely 
+        # disregarded for now
+        data = self.data
+        k = 0
+
+        while k < 2:#for the time being things - are done in 16 bits
+            datatype = {'1' : numpy.uint8,
+                        '2' : numpy.uint16,
+                        '4' : numpy.uint32 }[("%d" % 2 ** k)]
+            ar = numpy.array(numpy.fromstring(f.read(int(noverfl[k]) * (2 ** k)),
+                                        datatype), numpy.uint16)
+            #insert the the overflow pixels in the image array:
+            #this is probably a memory intensive way of doing this - 
+            # might be done in a more clever way
+            lim = 2 ** (8 * k) - 1
+            #generate an array comprising of the indices into data.ravel() 
+            # where its value equals lim.
+            M = numpy.compress(numpy.equal(data.ravel(), lim), numpy.arange(rows * cols))
+            #now put values from ar into those indices
+            numpy.put(data.ravel(), M, ar)
+            padding = 16 * int(math.ceil(int(noverfl[k]) * (2 ** k) / 16.)) - \
+                         int(noverfl[k]) * (2 ** k)
+            f.seek(padding, 1)
+            print noverfl[k] + " bytes read + %d bytes padding" % padding
+            k = k + 1
+
+        f.close()
+
+        (self.dim1, self.dim2) = (rows, cols)
+        print self.dim1, self.dim2
+        self.resetvals()
+        return self
+
+if __name__ == '__main__':
+    import sys, time
+    I = bruker100image()
+    b = time.clock()
+    while (sys.argv[1:]):
+        I.read(sys.argv[1])
+        r = I.toPIL16()
+        I.rebin(2, 2)
+        print sys.argv[1] + (": max=%d, min=%d, mean=%.2e, stddev=%.2e") % (
+            I.getmax(), I.getmin(), I.getmean(), I.getstddev())
+        print 'integrated intensity (%d %d %d %d) =%.3f' % (
+            10, 20, 20, 40, I.integrate_area((10, 20, 20, 40)))
+        sys.argv[1:] = sys.argv[2:]
+    e = time.clock()
+    print (e - b)
diff --git a/fabio/brukerimage.py b/fabio/brukerimage.py
new file mode 100644
index 0000000..156392e
--- /dev/null
+++ b/fabio/brukerimage.py
@@ -0,0 +1,195 @@
+#!/usr/bin/env python
+"""
+
+Authors: Henning O. Sorensen & Erik Knudsen
+         Center for Fundamental Research: Metal Structures in Four Dimensions
+         Risoe National Laboratory
+         Frederiksborgvej 399
+         DK-4000 Roskilde
+         email:erik.knudsen at risoe.dk
+
+Based on: openbruker,readbruker, readbrukerheader functions in the opendata
+         module of ImageD11 written by Jon Wright, ESRF, Grenoble, France
+
+"""
+
+import numpy, logging
+logger = logging.getLogger("brukerimage")
+from fabioimage import fabioimage
+from readbytestream import readbytestream
+
+
+class brukerimage(fabioimage):
+    """
+    Read and eventually write ID11 bruker (eg smart6500) images
+    """
+
+    # needed if you feel like writing - see ImageD11/scripts/edf2bruker.py
+
+    __headerstring__ = ""
+
+
+    def _readheader(self, infile):
+        """
+        the bruker format uses 80 char lines in key : value format
+        In the fisrt 512*5 bytes of the header there should be a 
+        HDRBLKS key, whose value denotes how many 512 byte blocks 
+        are in the total header. The header is always n*5*512 bytes,
+        otherwise it wont contain whole key: value pairs
+        """
+        lump = infile.read(512 * 5)
+        self.__headerstring__ += lump
+        i = 80
+        self.header = {}
+        while i < 512 * 5:
+            if lump[i - 80: i].find(":") > 0:
+                key, val = lump[i - 80: i].split(":", 1)
+                key = key.strip()         # remove the whitespace (why?)
+                val = val.strip()
+                if self.header.has_key(key):
+                    # append lines if key already there
+                    self.header[key] = self.header[key] + '\n' + val
+                else:
+                    self.header[key] = val
+                    self.header_keys.append(key)
+            i = i + 80                  # next 80 characters
+        # we must have read this in the first 512 bytes.
+        nhdrblks = int(self.header['HDRBLKS'])
+        # Now read in the rest of the header blocks, appending 
+        rest = infile.read(512 * (nhdrblks - 5))
+        self.__headerstring__ += rest
+        lump = lump[i - 80: 512] + rest
+        i = 80
+        j = 512 * nhdrblks
+        while i < j :
+            if lump[i - 80: i].find(":") > 0: # as for first 512 bytes of header
+                key, val = lump[i - 80: i].split(":", 1)
+                key = key.strip()
+                val = val.strip()
+                if self.header.has_key(key):
+                    self.header[key] = self.header[key] + '\n' + val
+                else:
+                    self.header[key] = val
+                    self.header_keys.append(key)
+            i = i + 80
+        # make a (new) header item called "datastart"
+        self.header['datastart'] = infile.tell()
+        #set the image dimensions
+        self.dim1 = int(self.header['NROWS'])
+        self.dim2 = int(self.header['NCOLS'])
+
+    def read(self, fname):
+        """
+        Read in and unpack the pixels (including overflow table
+        """
+        infile = self._open(fname, "rb")
+        try:
+            self._readheader(infile)
+        except:
+            raise
+
+        rows = self.dim1
+        cols = self.dim2
+
+        try:
+            # you had to read the Bruker docs to know this!
+            npixelb = int(self.header['NPIXELB'])
+        except:
+            errmsg = "length " + str(len(self.header['NPIXELB'])) + "\n"
+            for byt in self.header['NPIXELB']:
+                errmsg += "char: " + str(byt) + " " + str(ord(byt)) + "\n"
+            logger.warning(errmsg)
+            raise
+
+        self.data = readbytestream(infile, infile.tell(),
+                                   rows, cols, npixelb,
+                                   datatype="int",
+                                   signed='n',
+                                   swap='n')
+
+        #handle overflows
+        nov = int(self.header['NOVERFL'])
+        if nov > 0:   # Read in the overflows
+            # need at least int32 sized data I guess - can reach 2^21
+            self.data = self.data.astype(numpy.uint32)
+            # 16 character overflows:
+            #      9 characters of intensity
+            #      7 character position
+            for i in range(nov):
+                ovfl = infile.read(16)
+                intensity = int(ovfl[0: 9])
+                position = int(ovfl[9: 16])
+                # relies on python style modulo being always +
+                row = position % rows
+                # relies on truncation down
+                col = position / rows
+                #print "Overflow ", r, c, intensity, position,\
+                #    self.data[r,c],self.data[c,r]
+                self.data[col, row] = intensity
+        infile.close()
+
+        self.resetvals()
+        self.pilimage = None
+        return self
+
+
+    def write(self, fname):
+        """
+        Writes the image as EDF
+        FIXME - this should call edfimage.write if that is wanted?
+        eg:     obj = edfimage(data = self.data, header = self.header)
+                obj.write(fname)
+                or maybe something like: edfimage.write(self, fname)
+        """
+        logger.warning("***warning***: call to unifinished " + \
+                "brukerimage.write. This will write the file" + \
+                            fname + "as an edf-file")
+
+
+        outfile = self._open(fname, "wb")
+        outfile.write('{\n')
+        i = 4
+        for k in self.header_keys:
+            out = (("%s = %s;\n") % (k, self.header[k]))
+            i = i + len(out)
+            outfile.write(out)
+        out = (4096 - i) * ' '
+        outfile.write(out)
+        outfile.write('}\n')
+        # Assumes a short-circuiting if / or ...
+        if not self.header.has_key("ByteOrder") or \
+               self.header["ByteOrder"] == "LowByteFirst":
+            outfile.write(self.data.astype(numpy.uint16).tostring())
+        else:
+            outfile.write(self.data.byteswap().astype(
+                    numpy.uint16).tostring())
+        outfile.close()
+
+    def write2(self, fname):
+        """ FIXME: what is this? """
+        pass
+
+
+
+def test():
+    """ a testcase """
+    import sys, time
+    img = brukerimage()
+    start = time.clock()
+    for filename in sys.argv[1:]:
+        img.read(filename)
+        res = img.toPIL16()
+        img.rebin(2, 2)
+        print filename + (": max=%d, min=%d, mean=%.2e, stddev=%.2e") % (
+            img.getmax(), img.getmin(), img.getmean(), img.getstddev())
+        print 'integrated intensity (%d %d %d %d) =%.3f' % (
+            10, 20, 20, 40, img.integrate_area((10, 20, 20, 40)))
+    end = time.clock()
+    print (end - start)
+
+
+
+if __name__ == '__main__':
+    test()
+
+
diff --git a/fabio/cbfimage.py b/fabio/cbfimage.py
new file mode 100644
index 0000000..a81ea5f
--- /dev/null
+++ b/fabio/cbfimage.py
@@ -0,0 +1,810 @@
+#!/usr/bin/env python
+# coding: utf8
+"""
+Authors: Jérôme Kieffer, ESRF 
+         email:jerome.kieffer at esrf.fr
+
+Cif Binary Files images are 2D images written by the Pilatus detector and others.
+They use a modified (simplified) byte-offset algorithm.  
+
+CIF is a library for manipulating Crystallographic information files and tries 
+to conform to the specification of the IUCR  
+"""
+__author__ = "Jérôme Kieffer"
+__contact__ = "jerome.kieffer at esrf.eu"
+__license__ = "GPLv3+"
+__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
+__version__ = ["Generated by CIF.py: Jan 2005 - December 2010",
+              "Written by Jerome Kieffer: Jerome.Kieffer at esrf.eu",
+              "On-line data analysis / ISDD ", "ESRF Grenoble (France)"]
+
+
+import os, logging, struct
+logger = logging.getLogger("cbfimage")
+import numpy
+from fabioimage import fabioimage
+#import time
+
+DATA_TYPES = { "signed 8-bit integer"   : numpy.int8,
+               "signed 16-bit integer"  : numpy.int16,
+               "signed 32-bit integer"  : numpy.int32
+                }
+
+MINIMUM_KEYS = ["X-Binary-Size-Fastest-Dimension",
+                'ByteOrder',
+                'Data type',
+                'X dimension',
+                'Y dimension',
+                'Number of readouts']
+
+DEFAULT_VALUES = {
+                  "Data type": "signed 32-bit integer",
+                  "X-Binary-Size-Fastest-Dimension": 2463,
+                  "X-Binary-Element-Byte-Order": "LITTLE_ENDIAN"
+
+                  }
+
+
+
+
+class cbfimage(fabioimage):
+    """ 
+    Read the Cif Binary File data format 
+    """
+    def __init__(self, fname=None):
+        """
+        Constructor of the class CIF Binary File reader.
+
+        @param _strFilename: the name of the file to open
+        @type  _strFilename: string
+        """
+        fabioimage.__init__(self)
+        self.cif = CIF()
+        if fname is not None: #load the file)
+            self.read(fname)
+
+
+    def _readheader(self, inStream):
+        """
+        Read in a header in some CBF format from a string representing binary stuff
+        
+        @param inStream: file containing the Cif Binary part.
+        @type inStream: opened file.
+        """
+        self.cif.loadCIF(inStream, _bKeepComment=True)
+
+#        backport contents of the CIF data to the headers
+        for key in self.cif:
+            if key != "_array_data.data":
+                self.header_keys.append(key)
+                self.header[key] = self.cif[key].strip(" \"\n\r\t")
+
+        if not "_array_data.data" in self.cif:
+            raise Exception("cbfimage: CBF file %s is corrupt, cannot find data block with '_array_data.data' key" % self.fname)
+
+        inStream2 = self.cif["_array_data.data"]
+        sep = "\r\n"
+        iSepPos = inStream2.find(sep)
+        if iSepPos < 0 or iSepPos > 80:
+            sep = "\n" #switch back to unix representation
+
+        lines = inStream2.split(sep)
+        for oneLine in lines[1:]:
+            if len(oneLine) < 10:
+                break
+            try:
+                key, val = oneLine.split(':' , 1)
+            except ValueError:
+                key, val = oneLine.split('=' , 1)
+            key = key.strip()
+            self.header_keys.append(key)
+            self.header[key] = val.strip(" \"\n\r\t")
+        missing = []
+        for item in MINIMUM_KEYS:
+            if item not in self.header_keys:
+                missing.append(item)
+        if len(missing) > 0:
+            logger.debug("CBF file misses the keys " + " ".join(missing))
+
+
+    def read(self, fname):
+        """
+        Read in header into self.header and
+            the data   into self.data
+        """
+        self.filename = fname
+        self.header = {}
+        self.resetvals()
+
+        infile = self._open(fname, "rb")
+        self._readheader(infile)
+        # Compute image size
+        try:
+            self.dim1 = int(self.header['X-Binary-Size-Fastest-Dimension'])
+            self.dim2 = int(self.header['X-Binary-Size-Second-Dimension'])
+        except:
+            raise Exception(IOError, "CBF file %s is corrupt, no dimensions in it" % fname)
+        try:
+            bytecode = DATA_TYPES[self.header['X-Binary-Element-Type']]
+            self.bpp = len(numpy.array(0, bytecode).tostring())
+        except KeyError:
+            bytecode = numpy.int32
+            self.bpp = 32
+            logger.warning("Defaulting type to int32")
+        if self.header["conversions"] == "x-CBF_BYTE_OFFSET":
+            self.data = self._readbinary_byte_offset(self.cif["_array_data.data"]).astype(bytecode).reshape((self.dim2, self.dim1))
+        else:
+            raise Exception(IOError, "Compression scheme not yet supported, please contact FABIO development team")
+
+        self.bytecode = self.data.dtype.type
+        self.resetvals()
+#        # ensure the PIL image is reset
+        self.pilimage = None
+        return self
+
+
+
+    @staticmethod
+    def analysePython(stream, size):
+        """
+        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 :NParrays 
+        """
+#cimport numpy
+#import cython
+#        cdef int i,j 
+#        cdef char key = 0x80
+#        cdef  numpy.ndarray[double, ndim = 1] dataOut
+        logger.debug("CBF decompression using Python with Cython loops")
+        dataOut = numpy.zeros((size), dtype=numpy.int64)
+        i = 0
+        j = 0
+        last = 0
+        current = 0
+        while ((i < len(stream)) and (j < size)):
+            if (stream[i] == '\x80'):
+                if (stream[i + 1:i + 3] == "\x00\x80"):
+                    if (stream[i + 3:i + 7] == "\x00\x00\x00\x80"):
+                        current = struct.unpack("<q", stream[i + 7:i + 15])[0]
+                        i += 15
+                    else:
+                        current = struct.unpack("<i", stream[i + 3:i + 7])[0]
+                        i += 7
+                else:
+                    current = struct.unpack("<h", stream[i + 1:i + 3])[0]
+                    i += 3
+            else:
+                current = struct.unpack("<b", stream[i])[0]
+                i += 1
+            last += current
+            dataOut[j] = last
+            j += 1
+        return dataOut
+
+    @staticmethod
+    def analyseWeave(stream, size):
+        """
+        Analyze a stream of char with any length of exception (2,4, or 8 bytes integers)
+
+        @return list of NParrays
+        """
+        logger.debug("CBF decompression using Weave")
+        from scipy import weave
+        from scipy.weave import converters
+        dataIn = numpy.fromstring(stream, dtype="uint8")
+        n = dataIn.size
+        dataOut = numpy.zeros(size, dtype="int64")
+        codeC = """
+unsigned char key = 0x80;
+long   j = 0;
+long   last=0;
+long   current=0;
+for (int i=0; i< n; i++){
+    if (j>=size){
+    //printf("i= %i<%i, j=%i < size= %i %i\\n",i,n,j,size,dataIn(i));
+        break;
+   }
+   if (dataIn(i) == key){
+       if ( (dataIn(i+1)==0) and (dataIn(i+2)==key) ){
+           if ( (dataIn(i+3)==0) and (dataIn(i+4)==0) and (dataIn(i+5)==0) and (dataIn(i+6)==key) )  {
+                // 64 bits mode
+                char tmp = dataIn(i+14) ;
+                current = (long(tmp)<<56) | (long(dataIn(i+13))<<48) | (long(dataIn(i+12))<<40) | (long(dataIn(i+11))<<32) | (long(dataIn(i+10))<<24) | (long(dataIn(i+9))<<16) | (long(dataIn(i+8))<<8) | (long(dataIn(i+7)));
+//                printf("64 bit int at pos %i, %i, value=%ld \\n",i,j,current);
+                i+=14;
+            }else{
+                // 32 bits mode
+                char tmp = dataIn(i+6) ;
+                current = (long(tmp)<<24) | (long(dataIn(i+5))<<16) | (long(dataIn(i+4))<<8) | (long(dataIn(i+3)));
+//                printf("32 bit int at pos %i, %i, value=%ld was %i %i %i %i %i %i %i\\n",i,j,current,dataIn(i),dataIn(i+1),dataIn(i+2),dataIn(i+3),dataIn(i+4),dataIn(i+5),dataIn(i+6));
+//                printf("%ld %ld %ld %ld\\n",(long(tmp)<<24) , (long(dataIn(i+5))<<16) , (long(dataIn(i+4))<<8) ,long(dataIn(i+3)));
+                i+=6;
+            }
+       }else{
+            // 16 bit mode
+            char tmp = dataIn(i+2);
+            current = (long(tmp)<<8) | (long (dataIn(i+1)));
+ //           printf("16 bit int at pos %i, %i, value=%ld was %i %i %i\\n",i,j,current,dataIn(i),dataIn(i+1),dataIn(i+2));
+            i+=2;
+       }
+   }else{
+       // 8 bit mode
+       char tmp = dataIn(i) ;
+       current= long(tmp) ;
+   }
+   last+=current;
+   dataOut(j)=last;
+   j++ ;
+}
+return_val=0;
+      """
+        rc = weave.inline(codeC, ["dataIn", "dataOut", "n", "size" ], verbose=2, type_converters=converters.blitz)
+        return dataOut
+
+
+    @staticmethod
+    def analyseNumpy(stream, size=None):
+        """
+        Analyze a stream of char with any length of exception: 
+                    2, 4, or 8 bytes integers
+
+        @return list of NParrays
+        """
+        logger.debug("CBF decompression using Numpy")
+        listnpa = []
+        key16 = "\x80"
+        key32 = "\x00\x80"
+        key64 = "\x00\x00\x00\x80"
+        shift = 1
+        while True:
+            idx = stream.find(key16)
+            if idx == -1:
+                listnpa.append(numpy.fromstring(stream, dtype="int8"))
+                break
+            listnpa.append(numpy.fromstring(stream[:idx], dtype="int8"))
+
+            if stream[idx + 1:idx + 3] == key32:
+                if stream[idx + 3:idx + 7] == key64:
+#                        long int 64 bits
+                    listnpa.append(numpy.fromstring(stream[idx + 7:idx + 15],
+                                                 dtype="int64"))
+                    shift = 15
+                else: #32 bit int
+                    listnpa.append(numpy.fromstring(stream[idx + 3:idx + 7],
+                                                 dtype="int32"))
+                    shift = 7
+            else: #int16 
+                listnpa.append(numpy.fromstring(stream[idx + 1:idx + 3],
+                                             dtype="int16"))
+                shift = 3
+            stream = stream[idx + shift:]
+        return  (numpy.hstack(listnpa)).astype("int64").cumsum()
+
+
+    def _readbinary_byte_offset(self, inStream):
+        """
+        Read in a binary part of an x-CBF_BYTE_OFFSET compressed image 
+        
+        @param inStream: the binary image (without any CIF decorators)
+        @type inStream: python string.
+        @return: a linear numpy array without shape and dtype set
+        @rtype: numpy array
+        """
+
+        starter = "\x0c\x1a\x04\xd5"
+        startPos = inStream.find(starter) + 4
+        data = inStream[ startPos: startPos + int(self.header["X-Binary-Size"])]
+        try:
+            import byte_offset
+        except ImportError:
+            logger.warning("Error in byte_offset part: Falling back to Numpy implementation")
+            myData = cbfimage.analyseNumpy(data, size=self.dim1 * self.dim2)
+        else:
+            myData = byte_offset.analyseCython(data, size=self.dim1 * self.dim2)
+
+        assert len(myData) == self.dim1 * self.dim2
+        return myData
+
+
+
+
+
+
+class CIF(dict):
+    """
+    This is the CIF class, it represents the CIF dictionary; 
+    and as a a python dictionary thus inherits from the dict built in class.
+    """
+    EOL = ["\r", "\n", "\r\n", "\n\r"]
+    BLANK = [" ", "\t"] + EOL
+    START_COMMENT = ["\"", "\'"]
+    BINARY_MARKER = "--CIF-BINARY-FORMAT-SECTION--"
+
+    def __init__(self, _strFilename=None):
+        """
+        Constructor of the class.
+
+        @param _strFilename: the name of the file to open 
+        @type  _strFilename: filename (str) or file object
+        """
+        dict.__init__(self)
+        if _strFilename is not None: #load the file)
+            self.loadCIF(_strFilename)
+
+    def readCIF(self, _strFilename):
+        """
+        Just call loadCIF:
+        Load the CIF file and sets the CIF dictionnary into the object
+        
+        @param _strFilename: the name of the file to open
+        @type  _strFilename: string
+        """
+        self.loadCIF(_strFilename)
+
+    def loadCIF(self, _strFilename, _bKeepComment=False):
+        """Load the CIF file and returns the CIF dictionnary into the object
+        @param _strFilename: the name of the file to open
+        @type  _strFilename: string
+        @param _strFilename: the name of the file to open
+        @type  _strFilename: string
+        @return the 
+        """
+
+        if isinstance(_strFilename, (str, unicode)):
+            if os.path.isfile(_strFilename):
+                infile = open(_strFilename, "rb")
+            else:
+                raise RuntimeError("CIF.loadCIF: No such file to open: %s" % _strFilename)
+        #elif isinstance(_strFilename, file, bz2.BZ2File, ):
+        elif "read" in dir(_strFilename):
+            infile = _strFilename
+        else:
+            raise RuntimeError("CIF.loadCIF: what is %s type %s" % (_strFilename, type(_strFilename)))
+        if _bKeepComment:
+            self._parseCIF(infile.read())
+        else:
+            self._parseCIF(CIF._readCIF(infile))
+
+
+    @staticmethod
+    def isAscii(_strIn):
+        """
+        Check if all characters in a string are ascii,
+        
+        @param _strIn: input string
+        @type _strIn: python string
+        @return: boolean 
+        @rtype: boolean
+        """
+        bIsAcii = True
+        for i in _strIn:
+            if ord(i) > 127:
+                bIsAcii = False
+                break
+        return bIsAcii
+
+
+    @staticmethod
+    def _readCIF(_instream):
+        """
+        -Check if the filename containing the CIF data exists 
+        -read the cif file
+        -removes the comments 
+        
+        @param _instream: the file containing the CIF data
+        @type _instream: open file in read mode
+        @return: a string containing the raw data
+        @rtype: string
+        """
+        if not "readlines" in dir(_instream):
+            raise RuntimeError("CIF._readCIF(instream): I expected instream to be an opened file,\
+             here I got %s type %s" % (_instream, type(_instream)))
+        lLinesRead = _instream.readlines()
+        sText = ""
+        for sLine in lLinesRead:
+            iPos = sLine.find("#")
+            if iPos >= 0:
+                if CIF.isAscii(sLine):
+                    sText += sLine[:iPos] + os.linesep
+
+                if iPos > 80 :
+                    print("Warning, this line is too long and could cause problems in PreQuest", os.linesep, sLine)
+            else :
+                sText += sLine
+                if len(sLine.strip()) > 80 :
+                    print("Warning, this line is too long and could cause problems in PreQues", os.linesep, sLine)
+        return sText
+
+
+    def _parseCIF(self, sText):
+        """ 
+        -Parses the text of a CIF file   
+        -Cut it in fields
+        -Find all the loops and process    
+        -Find all the keys and values      
+        
+        @param sText: the content of the CIF-file
+        @type sText: string
+        @return: Nothing, the data are incorporated at the CIF object dictionary
+        @rtype: dictionary
+        """
+        loopidx = []
+        looplen = []
+        loop = []
+        #first of all : separate the cif file in fields
+        lFields = CIF._splitCIF(sText.strip())
+        #Then : look for loops
+        for i in range(len(lFields)):
+            if lFields[i].lower() == "loop_":
+                loopidx.append(i)
+        if len(loopidx) > 0:
+            for i in loopidx:
+                loopone, length, keys = CIF._analyseOneLoop(lFields, i)
+                loop.append([keys, loopone])
+                looplen.append(length)
+
+
+            for i in range(len(loopidx) - 1, -1, -1):
+                f1 = lFields[:loopidx[i]] + lFields[loopidx[i] + looplen[i]:]
+                lFields = f1
+
+            self["loop_"] = loop
+
+        for i in range(len(lFields) - 1):
+    #        print lFields[i], lFields[i+1]
+            if len(lFields[i + 1]) == 0 : lFields[i + 1] = "?"
+            if lFields[i][0] == "_" and lFields[i + 1][0] != "_":
+                self[lFields[i]] = lFields[i + 1]
+
+
+    @staticmethod
+    def _splitCIF(sText):
+        """
+        Separate the text in fields as defined in the CIF
+        
+        @param sText: the content of the CIF-file
+        @type sText: string
+        @return: list of all the fields of the CIF
+        @rtype: list
+        """
+        lFields = []
+        while True:
+            if len(sText) == 0:
+                break
+            elif sText[0] == "'":
+                idx = 0
+                bFinished = False
+                while not  bFinished:
+                    idx += 1 + sText[idx + 1:].find("'")
+    ##########debuging    in case we arrive at the end of the text             
+                    if idx >= len(sText) - 1:
+    #                    print sText,idx,len(sText)
+                        lFields.append(sText[1:-1].strip())
+                        sText = ""
+                        bFinished = True
+                        break
+
+                    if sText[idx + 1] in CIF.BLANK:
+                        lFields.append(sText[1:idx].strip())
+                        sText1 = sText[idx + 1:]
+                        sText = sText1.strip()
+                        bFinished = True
+
+            elif sText[0] == '"':
+                idx = 0
+                bFinished = False
+                while not  bFinished:
+                    idx += 1 + sText[idx + 1:].find('"')
+    ##########debuging    in case we arrive at the end of the text             
+                    if idx >= len(sText) - 1:
+    #                    print sText,idx,len(sText)
+                        lFields.append(sText[1:-1].strip())
+#                        print lFields[-1]
+                        sText = ""
+                        bFinished = True
+                        break
+
+                    if sText[idx + 1] in CIF.BLANK:
+                        lFields.append(sText[1:idx].strip())
+#                        print lFields[-1]
+                        sText1 = sText[idx + 1:]
+                        sText = sText1.strip()
+                        bFinished = True
+            elif sText[0] == ';':
+                if sText[1:].strip().find(CIF.BINARY_MARKER) == 0:
+                    idx = sText[32:].find(CIF.BINARY_MARKER)
+                    if idx == -1:
+                        idx = 0
+                    else:
+                        idx += 32 + len(CIF.BINARY_MARKER)
+                else:
+                    idx = 0
+                bFinished = False
+                while not  bFinished:
+                    idx += 1 + sText[idx + 1:].find(';')
+                    if sText[idx - 1] in CIF.EOL:
+                        lFields.append(sText[1:idx - 1].strip())
+                        sText1 = sText[idx + 1:]
+                        sText = sText1.strip()
+                        bFinished = True
+            else:
+                f = sText.split(None, 1)[0]
+                lFields.append(f)
+#                print lFields[-1]
+                sText1 = sText[len(f):].strip()
+                sText = sText1
+        return lFields
+
+
+    @staticmethod
+    def _analyseOneLoop(lFields, iStart):
+        """Processes one loop in the data extraction of the CIF file
+        @param lFields: list of all the words contained in the cif file
+        @type lFields: list
+        @param iStart: the starting index corresponding to the "loop_" key 
+        @type iStart: integer
+        @return: the list of loop dictionaries, the length of the data 
+            extracted from the lFields and the list of all the keys of the loop.
+        @rtype: tuple
+        """
+    #    in earch loop we first search the length of the loop
+    #    print lFields
+#        curloop = {}
+        loop = []
+        keys = []
+        i = iStart + 1
+        bFinished = False
+        while not bFinished:
+            if lFields[i][0] == "_":
+                keys.append(lFields[i])#.lower())
+                i += 1
+            else:
+                bFinished = True
+        data = []
+        while True:
+            if i >= len(lFields):
+                break
+            elif len(lFields[i]) == 0:
+                break
+            elif lFields[i][0] == "_":
+                break
+            elif lFields[i] in ["loop_", "stop_", "global_", "data_", "save_"]:
+                break
+            else:
+                data.append(lFields[i])
+                i += 1
+        #print len(keys), len(data)
+        k = 0
+
+        if len(data) < len(keys):
+            element = {}
+            for j in keys:
+                if k < len(data):
+                    element[j] = data[k]
+                else :
+                    element[j] = "?"
+                k += 1
+            #print element
+            loop.append(element)
+
+        else:
+            #print data
+            #print keys 
+            for i in range(len(data) / len(keys)):
+                element = {}
+                for j in keys:
+                    element[j] = data[k]
+                    k += 1
+    #            print element
+                loop.append(element)
+    #    print loop
+        return loop, 1 + len(keys) + len(data), keys
+
+
+
+
+
+
+#############################################################################################
+########     everything needed to  write a cif file #########################################
+#############################################################################################
+
+    def saveCIF(self, _strFilename="test.cif"):
+        """Transforms the CIF object in string then write it into the given file
+        @param _strFilename: the of the file to be written
+        @type param: string
+        """
+
+        try:
+            fFile = open(_strFilename, "w")
+        except IOError:
+            print("Error during the opening of file for write: %s" %
+                                                            _strFilename)
+            return
+        fFile.write(self._cif2str(_strFilename))
+        try:
+            fFile.close()
+        except IOError:
+            print("Error during the closing of file for write: %s" %
+                                                             _strFilename)
+
+
+    def _cif2str(self, _strFilename):
+        """converts a cif dictionnary to a string according to the CIF syntax
+        @param _strFilename: the name of the filename to be appended in the 
+                                header of the CIF file 
+        @type _strFilename: string
+        @return : a sting that corresponds to the content of the CIF-file.
+        @rtype: string
+        """
+        sCifText = ""
+        for i in __version__:
+            sCifText += "# " + i + os.linesep
+        if self.exists("_chemical_name_common"):
+            t = self["_chemical_name_common"].split()[0]
+        else:
+            t = os.path.splitext(os.path.split(_strFilename.strip())[1])[0]
+        sCifText += "data_%s%s" % (t, os.linesep)
+        #first of all get all the keys :
+        lKeys = self.keys()
+        lKeys.sort()
+        for sKey in lKeys:
+            if sKey == "loop_":
+                continue
+            sValue = str(self[sKey])
+            if sValue.find("\n") > -1: #should add value  between ;;
+                sLine = "%s %s;%s %s %s;%s" % (sKey, os.linesep, os.linesep,
+                                               sValue, os.linesep, os.linesep)
+            elif len(sValue.split()) > 1: #should add value between ''
+                sLine = "%s        '%s' \n" % (sKey, sValue)
+                if len(sLine) > 80:
+                    sLine = "%s %s '%s' %s" % (sKey, os.linesep,
+                                               sValue, os.linesep)
+            else:
+                sLine = "%s        %s %s" % (sKey, sValue, os.linesep)
+                if len(sLine) > 80:
+                    sLine = "%s %s  %s %s" % (sKey, os.linesep,
+                                                sValue, os.linesep)
+            sCifText += sLine
+        if self.has_key("loop_"):
+            for loop in self["loop_"]:
+                sCifText += "loop_ " + os.linesep
+                lKeys = loop[0]
+                llData = loop[1]
+                for sKey in lKeys:
+                    sCifText += " %s %s" % (sKey, os.linesep)
+                for lData in llData:
+                    sLine = ""
+                    for key in lKeys:
+                        sRawValue = lData[key]
+                        if sRawValue.find("\n") > -1: #should add value  between ;;
+                            sLine += "%s; %s %s;%s" % (os.linesep, sRawValue,
+                                                  os.linesep, os.linesep)
+                            sCifText += sLine
+                            sLine = ""
+                        else:
+                            if len(sRawValue.split()) > 1: #should add value between ''
+                                value = "'%s'" % (sRawValue)
+                            else:
+                                value = sRawValue
+                            if len(sLine) + len(value) > 78:
+                                sCifText += sLine + " " + os.linesep
+                                sLine = " " + value
+                            else:
+                                sLine += " " + value
+                    sCifText += sLine + " " + os.linesep
+                sCifText += os.linesep
+        #print sCifText
+        return sCifText
+
+
+    def exists(self, sKey):
+        """
+        Check if the key exists in the CIF and is non empty.
+        @param sKey: CIF key
+        @type sKey: string
+        @param cif: CIF dictionary
+        @return: True if the key exists in the CIF dictionary and is non empty
+        @rtype: boolean
+        """
+        bExists = False
+        if self.has_key(sKey):
+            if len(self[sKey]) >= 1:
+                if self[sKey][0] not in ["?", "."]:
+                    bExists = True
+        return bExists
+
+
+    def existsInLoop(self, sKey):
+        """
+        Check if the key exists in the CIF dictionary.
+        @param sKey: CIF key
+        @type sKey: string
+        @param cif: CIF dictionary
+        @return: True if the key exists in the CIF dictionary and is non empty
+        @rtype: boolean
+        """
+        if not self.exists("loop_"):
+            return False
+        bExists = False
+        if not bExists:
+            for i in self["loop_"]:
+                for j in i[0]:
+                    if j == sKey:
+                        bExists = True
+        return bExists
+
+
+    def loadCHIPLOT(self, _strFilename):
+        """
+        Load the powder diffraction CHIPLOT file and returns the 
+        pd_CIF dictionary in the object
+        
+        @param _strFilename: the name of the file to open
+        @type  _strFilename: string
+        @return: the CIF object corresponding to the powder diffraction
+        @rtype: dictionary
+        """
+        if not os.path.isfile(_strFilename):
+            print "I cannot find the file %s" % _strFilename
+            raise
+        lInFile = open(_strFilename, "r").readlines()
+        self["_audit_creation_method"] = 'From 2-D detector using FIT2D and CIFfile'
+        self["_pd_meas_scan_method"] = "fixed"
+        self["_pd_spec_description"] = lInFile[0].strip()
+        try:
+            iLenData = int(lInFile[3])
+        except ValueError:
+            iLenData = None
+        lOneLoop = []
+        try:
+            f2ThetaMin = float(lInFile[4].split()[0])
+            last = ""
+            for sLine in lInFile[-20:]:
+                if sLine.strip() != "":
+                    last = sLine.strip()
+            f2ThetaMax = float(last.split()[0])
+            limitsOK = True
+
+        except (ValueError, IndexError):
+            limitsOK = False
+            f2ThetaMin = 180.0
+            f2ThetaMax = 0
+#        print "limitsOK:", limitsOK
+        for sLine in lInFile[4:]:
+            sCleaned = sLine.split("#")[0].strip()
+            data = sCleaned.split()
+            if len(data) == 2 :
+                if not limitsOK:
+                    f2Theta = float(data[0])
+                    if f2Theta < f2ThetaMin :
+                        f2ThetaMin = f2Theta
+                    if f2Theta > f2ThetaMax :
+                        f2ThetaMax = f2Theta
+                lOneLoop.append({ "_pd_meas_intensity_total": data[1] })
+        if not iLenData:
+            iLenData = len(lOneLoop)
+        assert (iLenData == len(lOneLoop))
+        self[ "_pd_meas_2theta_range_inc" ] = "%.4f" % ((f2ThetaMax - f2ThetaMin) / (iLenData - 1))
+        if self[ "_pd_meas_2theta_range_inc" ] < 0:
+            self[ "_pd_meas_2theta_range_inc" ] = abs (self[ "_pd_meas_2theta_range_inc" ])
+            tmp = f2ThetaMax
+            f2ThetaMax = f2ThetaMin
+            f2ThetaMin = tmp
+        self[ "_pd_meas_2theta_range_max" ] = "%.4f" % f2ThetaMax
+        self[ "_pd_meas_2theta_range_min" ] = "%.4f" % f2ThetaMin
+        self[ "_pd_meas_number_of_points" ] = str(iLenData)
+        self["loop_"] = [ [ ["_pd_meas_intensity_total" ], lOneLoop ] ]
+
+
+    @staticmethod
+    def LoopHasKey(loop, key):
+        "Returns True if the key (string) exist in the array called loop"""
+        try:
+            loop.index(key)
+            return True
+        except ValueError:
+            return False
+
diff --git a/fabio/datIO.py b/fabio/datIO.py
new file mode 100644
index 0000000..c6b4527
--- /dev/null
+++ b/fabio/datIO.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+"""
+Authors: Henning O. Sorensen & Erik Knudsen
+         Center for Fundamental Research: Metal Structures in Four Dimensions
+         Risoe National Laboratory
+         Frederiksborgvej 399
+         DK-4000 Roskilde
+         email:erik.knudsen at risoe.dk
+         
+         and Jon Wright, ESRF
+"""
+
+class fabiodata(object):
+    """
+    A common class for dataIO in fable
+    Contains a 2d numpy array for keeping data, and two lists (clabels and rlabels)
+    containing labels for columns and rows respectively
+    """
+
+    def __init__(self, data=None, clabels=None, rlabels=None, fname=None):
+        """
+        set up initial values
+        """
+        if type(data) == type("string"):
+                raise Exception("fabioimage.__init__ bad argument - " + \
+                                "data should be numpy array")
+        self.data = data
+        if (self.data):
+            self.dims = self.data.shape
+        self.clabels = clabels
+        self.rlabels = rlabels
+        if (fname):
+            self.read(fname)
+
+    def read(self, fname=None):
+        """
+        To be overridden by format specific subclasses
+        """
+        raise Exception("Class has not implemented read method yet")
+
+#import stuff from Jon's columnfile things
+
+
+class columnfile (fabiodata):
+
+    def read(self, fname):
+        import cf_io
+        try:
+            infile = open(fname, 'rb')
+        except:
+            raise Exception("columnfile: file" + str(fname) + "not found.")
+        try:
+            (self.data, self.clabels) = cf_io.read(infile)
+        except:
+            raise Exception("columnfile: read error, file " + str(fname) + " possibly corrupt")
+        self.dims = self.data.shape
+        infile.close()
+
+
diff --git a/fabio/dm3image.py b/fabio/dm3image.py
new file mode 100644
index 0000000..752f928
--- /dev/null
+++ b/fabio/dm3image.py
@@ -0,0 +1,206 @@
+"""
+Authors: Henning O. Sorensen & Erik Knudsen
+         Center for Fundamental Research: Metal Structures in Four Dimensions
+         Risoe National Laboratory
+         Frederiksborgvej 399
+         DK-4000 Roskilde
+         email:erik.knudsen at risoe.dk
+
+        + Jon Wright, ESRF
+"""
+
+import numpy
+from fabioimage import fabioimage
+
+DATA_TYPES = {  2     :  numpy.int16,
+                4     :  numpy.uint16,
+                3     :  numpy.int32,
+                5     :  numpy.uint32,
+                6     :  numpy.float32,
+                7     :  numpy.float,
+                8     :  numpy.int8,
+                9     :  None,
+                10    :  None,
+                15    :  'Struct',
+                18    :  None,
+                20    :  None
+                }
+
+DATA_BYTES = {  2     :  2,
+                4     :  2,
+                3     :  4,
+                5     :  4,
+                6     :  4,
+                7     :  8,
+                8     :  1,
+                9     :  None,
+                10    :  None,
+                15    :  'Struct',
+                18    :  None,
+                20    :  None
+                }
+
+
+
+class dm3image(fabioimage):
+    """ Read and try to write the dm3 data format """
+
+
+    def _readheader(self):
+        self.infile.seek(0)
+        file_format = self.readbytes(4, numpy.uint32)[0] # should be 3
+        assert file_format == 3, 'Wrong file type '
+        self.bytes_in_file = self.readbytes(4, numpy.uint32)[0]
+        self.byte_order = self.readbytes(4, numpy.uint32)[0] # 0 = big, 1= little
+        print 'read dm3 file - file format ', file_format
+        print 'Bytes in file : ' , self.bytes_in_file
+        print 'Byte order :', self.byte_order, '  - 0 = bigEndian , 1 = littleEndian'
+
+        if self.byte_order == 0:
+            self.swap = True
+        elif self.byte_order == 1:
+            self.swap = False
+        else:
+            raise ValueError
+
+    def read(self, fname):
+        self.header = {}
+        self.resetvals()
+        self.infile = self._open(fname, "rb")
+        self._readheader()
+        self.go_on = True
+        print self.go_on
+        while self.go_on:
+            self.read_tag_group()
+            self.read_tag_entry()
+            if self.infile.tell() > self.bytes_in_file: break
+
+            while self.tag_is_data == 21:
+                self.read_tag_entry()
+                if self.infile.tell() > self.bytes_in_file:
+                    self.go_on = False
+
+        (dim1_raw, dim2_raw) = self.header['Active Size (pixels)'].split()
+        (dim1_raw, dim2_raw) = (eval(dim1_raw), eval(dim2_raw))
+        (dim1_binning, dim2_binning) = self.header['Binning'].split()
+        (dim1_binning, dim2_binning) = (eval(dim1_binning), eval(dim2_binning))
+        self.dim1 = dim1_raw / dim1_binning
+        self.dim2 = dim2_raw / dim2_binning
+        #print dim1,dim2
+        if self.header.has_key('Data'):
+            self.data = self.header['Data'].reshape(self.dim1, self.dim2)
+
+    def readbytes(self, bytes_to_read, format, swap=True):
+        raw = self.infile.read(bytes_to_read)
+        if format != None:
+            data = numpy.fromstring(raw, format)
+        else:
+            data = raw
+        if swap:
+            data = data.byteswap()
+        return data
+
+
+
+    def read_tag_group(self):
+
+        self.grouptag_is_sorted = self.readbytes(1, numpy.uint8)[0]
+        self.grouptag_is_open = self.readbytes(1, numpy.uint8)[0]
+        self.grouptag_no_tags = self.readbytes(4, numpy.uint32)[0]
+        #print 'TagGroup is sorted? ',self.grouptag_is_sorted
+        #print 'TagGroup is open? ',self.grouptag_is_open
+        #print 'no of tags in TagGroup', self.grouptag_no_tags
+
+    def read_tag_entry(self):
+
+        self.tag_is_data = self.readbytes(1, numpy.uint8)[0]
+        self.tag_label_length = self.readbytes(2, numpy.uint16)[0]
+        #print 'does Tag have data ?' , self.tag_is_data, ' -  20 = Tag group , 21 = data '
+        #print 'length of tag_label ', self.tag_label_length
+        if self.tag_label_length != 0:
+            tag_label = self.infile.read(self.tag_label_length)
+        else:
+            tag_label = None
+
+        if self.tag_is_data == 21:
+            # This is data
+            self.header[tag_label] = self.read_tag_type()
+            #print self.header[tag_label]
+
+
+    def read_tag_type(self):
+        if self.infile.read(4) != '%%%%':
+            raise IOError
+        self.tag_data_type = self.readbytes(4, numpy.uint32)[0]
+        #print 'data is of type :', self.tag_data_type , '  - 1 = simple, 2= string, 3 = array, >3 structs'
+        self.tag_encoded_type = self.readbytes(4, numpy.uint32)[0]
+        # print 'encode type: ', self.tag_encoded_type, DATA_TYPES[ self.tag_encoded_type] 
+        if self.tag_data_type == 1:
+            # simple type
+            return self.readbytes(DATA_BYTES[ self.tag_encoded_type],
+                                  DATA_TYPES[ self.tag_encoded_type],
+                                  swap=self.swap)[0]
+        # are the data stored in a simple array?
+        if self.tag_encoded_type == 20 and self.tag_data_type == 3 :
+            self.data_type = self.readbytes(4, numpy.uint32)[0]
+            self.no_data_elements = self.readbytes(4, numpy.uint32)[0]
+            if self.data_type == 10:
+                #print 'skip bytes', self.no_data_elements
+                dump = self.infile.read(self.no_data_elements)
+                return None
+
+            # print 'Data are stored as a simple a array -'
+            # print '%i data elemets stored as ' %self.no_data_elements, self.data_type
+            read_no_bytes = DATA_BYTES[self.data_type] * self.no_data_elements
+            format = DATA_TYPES[self.data_type]
+            return self.readbytes(read_no_bytes, format, swap=self.swap)
+
+        # are the data stored in a complex array ?
+        # print 'tag_type + data_type', self.tag_encoded_type,self.tag_data_type
+
+        #print self.tag_encoded_type , self.tag_data_type 
+        if self.tag_encoded_type == 20 and self.tag_data_type > 3 :
+            self.tag_encoded_type = self.readbytes(4, numpy.uint32)[0]
+            #print 'found array - new tag_encoded_type', self.tag_encoded_type
+            if self.tag_encoded_type == 15:            # struct type
+                 ###type = self.readbytes(4,numpy.int32)
+                struct_name_length = self.readbytes(4, numpy.int32)[0]
+                struct_number_fields = self.readbytes(4, numpy.int32)[0]
+                #print 'struct - name_length, number_field',  struct_name_length,struct_number_fields
+                #print self.infile.read(struct_name_length)
+                field_info = []
+                for i in range(struct_number_fields):
+                    field_info.append([self.readbytes(4, numpy.int32)[0], self.readbytes(4, numpy.int32)[0]])
+                #print field_info
+                self.no_data_elements = self.readbytes(4, numpy.int32)[0]
+                #print '%i data elemets stored as ' %self.no_data_elements
+                bytes_in_struct = 0
+                for i in range(struct_number_fields):
+                    bytes_in_struct += DATA_BYTES[field_info[i][1]]
+                #print 'skip bytes', self.no_data_elements* bytes_in_struct
+                dump = self.infile.read(self.no_data_elements * bytes_in_struct)
+                return None
+
+
+        if self.tag_encoded_type == 15:            # struct type
+            ###type = self.readbytes(4,numpy.int32)
+            struct_name_length = self.readbytes(4, numpy.int32)[0]
+            struct_number_fields = self.readbytes(4, numpy.int32)[0]
+            #print 'struct - name_length, number_field',  struct_name_length,struct_number_fields
+            #print self.infile.read(struct_name_length)
+            field_info = []
+            for i in range(struct_number_fields):
+                field_info.append([self.readbytes(4, numpy.int32)[0], self.readbytes(4, numpy.int32)[0]])
+            #print field_info
+            field_data = ''
+            for i in range(struct_number_fields):
+                #print type(i)
+                field_data = field_data + self.readbytes(field_info[i][0], None, swap=False) + ' '
+                field_data = field_data + '%i  ' % self.readbytes(DATA_BYTES[field_info[i][1]],
+                                                                 DATA_TYPES[field_info[i][1]],
+                                                                 swap=self.swap)[0]
+            return field_data
+
+    def read_data(self):
+        self.encoded_datatype = numpy.fromstring(self.infile.read(4), numpy.uint32).byteswap()
+
diff --git a/fabio/edfimage.py b/fabio/edfimage.py
new file mode 100644
index 0000000..3e4f098
--- /dev/null
+++ b/fabio/edfimage.py
@@ -0,0 +1,843 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+"""
+
+License: GPLv2+
+
+Authors: Henning O. Sorensen & Erik Knudsen
+         Center for Fundamental Research: Metal Structures in Four Dimensions
+         Risoe National Laboratory
+         Frederiksborgvej 399
+         DK-4000 Roskilde
+         email:erik.knudsen at risoe.dk
+
+        + Jon Wright, ESRF
+        
+2011-02-11: Mostly rewritten by Jérôme Kieffer (Jerome.Kieffer at esrf.eu) 
+            European Synchrotron Radiation Facility
+            Grenoble (France)
+
+"""
+
+import gzip, bz2, zlib, os, StringIO
+import numpy, logging
+logger = logging.getLogger("edfimage")
+from fabioimage import fabioimage
+from fabioutils import isAscii
+
+BLOCKSIZE = 512
+DATA_TYPES = {  "SignedByte"    :  numpy.int8,
+                "Signed8"       :  numpy.int8,
+                "UnsignedByte"  :  numpy.uint8,
+                "Unsigned8"     :  numpy.uint8,
+                "SignedShort"   :  numpy.int16,
+                "Signed16"      :  numpy.int16,
+                "UnsignedShort" :  numpy.uint16,
+                "Unsigned16"    :  numpy.uint16,
+                "UnsignedShortInteger" : numpy.uint16,
+                "SignedInteger" :  numpy.int32,
+                "Signed32"      :  numpy.int32,
+                "UnsignedInteger":  numpy.uint32,
+                "Unsigned32"    :  numpy.uint32,
+                "SignedLong"    :  numpy.int32,
+                "UnsignedLong"  :  numpy.uint32,
+                "Signed64"      :  numpy.int64,
+                "Unsigned64"    :  numpy.uint64,
+                "FloatValue"    :  numpy.float32,
+                "FLOATVALUE"    :  numpy.float32,
+                "FLOAT"         :  numpy.float32, # fit2d
+                "Float"         :  numpy.float32, # fit2d
+                "FloatIEEE32"   :  numpy.float32,
+                "Float32"       :  numpy.float32,
+                "Double"        :  numpy.float64,
+                "DoubleValue"   :  numpy.float64,
+                "FloatIEEE64"   :  numpy.float64,
+                "DoubleIEEE64"  :  numpy.float64
+                }
+
+NUMPY_EDF_DTYPE = {"int8"       :"SignedByte",
+                   "int16"      :"SignedShort",
+                   "int32"      :"SignedInteger",
+                   "int64"      :"Signed64",
+                   "uint8"      :"UnsignedByte",
+                   "uint16"     :"UnsignedShort",
+                   "uint32"     :"UnsignedInteger",
+                   "uint64"     :"Unsigned64",
+                   "float32"    :"FloatValue",
+                   "float64"    :"DoubleValue"
+             }
+
+MINIMUM_KEYS = ['HEADERID',
+                'IMAGE',
+                'BYTEORDER',
+                'DATATYPE',
+                'DIM_1',
+                'DIM_2',
+                'SIZE'] # Size is thought to be essential for writing at least
+
+DEFAULT_VALUES = {
+                  # I do not define default values as they will be calculated at write time
+                  # JK20110415
+                  }
+
+class Frame(object):
+    """
+    A class representing a single frame in an EDF file
+    """
+    def __init__(self, data=None, header=None, header_keys=None, number=None):
+        if header is None:
+            self.header = {}
+        else:
+            self.header = dict(header)
+
+        if header_keys is None:
+            self.header_keys = self.header.keys()
+        else:
+            self.header_keys = header_keys[:]
+            for key in header_keys:
+                if key not in self.header:
+                    logger.warning("Header key %s, in header_keys is not in header dictionary, poping !!!" % key)
+                    self.header_keys.remove(key)
+
+        self.capsHeader = {}
+        for key in self.header_keys:
+            try:
+                self.capsHeader[key.upper()] = key
+            except AttributeError:
+                logger.warning("Header key %s is not a string" % key)
+
+        self.rawData = None
+        self._data = data
+        self.dims = []
+        self.dim1 = 0
+        self.dim2 = 0
+        self.size = None
+        self.bpp = None
+        self.bytecode = None
+        if (number is not None) and isinstance(number, int):
+            self.iFrame = number
+        else:
+            self.iFrame = 0
+
+    def parseheader(self, block):
+        """
+        Parse the header in some EDF format from an already open file
+
+        @param block: string representing the header block
+        @type block: string, should be full ascii
+        @return: size of the binary blob
+        """
+        #reset values ...
+        self.header = {}
+        self.capsHeader = {}
+        self.header_keys = []
+        self.size = None
+        calcsize = 1
+        self.dims = []
+
+        for line in block.split(';'):
+            if '=' in line:
+                key, val = line.split('=' , 1)
+                key = key.strip()
+                self.header[key] = val.strip()
+                self.capsHeader[key.upper()] = key
+                self.header_keys.append(key)
+
+        # Compute image size
+        if "SIZE" in self.capsHeader:
+            try:
+                self.size = int(self.header[self.capsHeader["SIZE"]])
+            except ValueError:
+                logger.warning("Unable to convert to integer : %s %s " % (self.capsHeader["SIZE"], self.header[self.capsHeader["SIZE"]]))
+        if "DIM_1" in self.capsHeader:
+            try:
+                dim1 = int(self.header[self.capsHeader['DIM_1']])
+            except ValueError:
+                logger.error("Unable to convert to integer Dim_1: %s %s" % (self.capsHeader["DIM_1"], self.header[self.capsHeader["DIM_1"]]))
+            else:
+                calcsize *= dim1
+                self.dims.append(dim1)
+        else:
+            logger.error("No Dim_1 in headers !!!")
+        if "DIM_2" in self.capsHeader:
+            try:
+                dim2 = int(self.header[self.capsHeader['DIM_2']])
+            except ValueError:
+                logger.error("Unable to convert to integer Dim_3: %s %s" % (self.capsHeader["DIM_2"], self.header[self.capsHeader["DIM_2"]]))
+            else:
+                calcsize *= dim2
+                self.dims.append(dim2)
+        else:
+            logger.error("No Dim_2 in headers !!!")
+        iDim = 3
+        while iDim is not None:
+            strDim = "DIM_%i" % iDim
+            if strDim in self.capsHeader:
+                try:
+                    dim3 = int(self.header[self.capsHeader[strDim]])
+                except ValueError:
+                    logger.error("Unable to convert to integer %s: %s %s"
+                                  % (strDim, self.capsHeader[strDim], self.header[self.capsHeader[strDim]]))
+                    dim3 = None
+                    iDim = None
+                else:
+                    calcsize *= dim3
+                    self.dims.append(dim3)
+                    iDim += 1
+            else:
+                logger.debug("No Dim_3 -> it is a 2D image")
+                iDim = None
+        if self.bytecode is None:
+            if "DATATYPE" in self.capsHeader:
+                self.bytecode = DATA_TYPES[self.header[self.capsHeader['DATATYPE']]]
+            else:
+                self.bytecode = numpy.uint16
+                logger.warning("Defaulting type to uint16")
+        self.bpp = len(numpy.array(0, self.bytecode).tostring())
+        calcsize *= self.bpp
+        if (self.size is None):
+            self.size = calcsize
+        elif (self.size != calcsize):
+            if ("COMPRESSION" in self.capsHeader) and (self.header[self.capsHeader['COMPRESSION']].upper().startswith("NO")):
+                logger.info("Mismatch between the expected size %s and the calculated one %s" % (self.size, calcsize))
+                self.size = calcsize
+
+        for i, n in enumerate(self.dims):
+            exec "self.dim%i=%i" % (i + 1, n)
+
+        return self.size
+
+
+    def swap_needed(self):
+        """
+        Decide if we need to byteswap
+        """
+        if ('Low'  in self.header[self.capsHeader['BYTEORDER']] and numpy.little_endian) or \
+           ('High' in self.header[self.capsHeader['BYTEORDER']] and not numpy.little_endian):
+            return False
+        if ('High'  in self.header[self.capsHeader['BYTEORDER']] and numpy.little_endian) or \
+           ('Low' in self.header[self.capsHeader['BYTEORDER']] and not numpy.little_endian):
+            if self.bpp in [2, 4, 8]:
+                return True
+            else:
+                return False
+
+
+    def getData(self):
+        """
+        Unpack a binary blob according to the specification given in the header
+
+        @return: dataset as numpy.ndarray
+        """
+        data = None
+        if self._data is not None:
+            data = self._data
+        elif self.rawData is None:
+            data = self._data
+        else:
+            if self.bytecode is None:
+                if "DATATYPE" in self.capsHeader:
+                    self.bytecode = DATA_TYPES[self.header[self.capsHeader["DATATYPE"]]]
+                else:
+                    self.bytecode = numpy.uint16
+            dims = self.dims[:]
+            dims.reverse()
+
+            if ("COMPRESSION" in self.capsHeader):
+                compression = self.header[self.capsHeader["COMPRESSION"]].upper()
+                uncompressed_size = self.bpp
+                for i in dims:
+                    uncompressed_size *= i
+                if "OFFSET" in compression :
+                    try:
+                        import byte_offset#IGNORE:F0401
+                    except ImportError, error:
+                        logger.error("Unimplemented compression scheme:  %s (%s)" % (compression, error))
+                    else:
+                        myData = byte_offset.analyseCython(self.rawData, size=uncompressed_size)
+                        rawData = myData.astype(self.bytecode).tostring()
+                        self.size = uncompressed_size
+                elif compression == "NONE":
+                    rawData = self.rawData
+                elif "GZIP" in compression:
+                    fileobj = StringIO.StringIO(self.rawData)
+                    try:
+                        rawData = gzip.GzipFile(fileobj=fileobj).read()
+                    except IOError:
+                        logger.warning("Encounter the python-gzip bug with trailing garbage, trying subprocess gzip")
+                        try:
+                            #This is as an ugly hack against a bug in Python gzip
+                            import subprocess
+                            sub = subprocess.Popen(["gzip", "-d", "-f"], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
+                            rawData, err = sub.communicate(input=self.rawData)
+                            logger.debug("Gzip subprocess ended with %s err= %s; I got %s bytes back" % (sub.wait(), err, len(rawData)))
+                        except Exception, error: #IGNORE:W0703
+                            logger.warning("Unable to use the subprocess gzip (%s). Is gzip available? " % error)
+                            for i in range(1, 513):
+                                try:
+                                    fileobj = StringIO.StringIO(self.rawData[:-i])
+                                    rawData = gzip.GzipFile(fileobj=fileobj).read()
+                                except IOError:
+                                    logger.debug("trying with %s bytes less, doesn't work" % i)
+                                else:
+                                    break
+                            else:
+                                logger.error("I am totally unable to read this gzipped compressed data block, giving up")
+
+                    self.size = uncompressed_size
+                elif "BZ" in compression :
+                    rawData = bz2.decompress(self.rawData)
+                    self.size = uncompressed_size
+                elif "Z" in compression :
+                    rawData = zlib.decompress(self.rawData)
+                    self.size = uncompressed_size
+                else:
+                    logger.warning("Unknown compression scheme %s" % compression)
+                    rawData = self.rawData
+
+            else:
+                rawData = self.rawData
+
+            expected = self.size
+            obtained = len(rawData)
+            if expected > obtained:
+                logger.error("Data stream is incomplete: %s < expected %s bytes" % (obtained, expected))
+                rawData += "\x00" * (expected - obtained)
+            elif expected < len(rawData):
+                logger.info("Data stream contains trailing junk : %s > expected %s bytes" % (obtained, expected))
+                rawData = rawData[:expected]
+    #        logger.debug("dims = %s, bpp = %s, expected= %s obtained = %s" % (dims, self.bpp, expected, obtained))
+            if self.swap_needed():
+                data = numpy.fromstring(rawData, self.bytecode).byteswap().reshape(tuple(dims))
+            else:
+                data = numpy.fromstring(rawData, self.bytecode).reshape(tuple(dims))
+            self._data = data
+            self.rawData = None #no need to keep garbage in memory
+            self.bytecode = data.dtype.type
+        return data
+    def setData(self, npa=None):
+        """Setter for data in edf frame"""
+        self._data = npa
+    data = property(getData, setData, "property: (edf)frame.data, uncompress the datablock when needed")
+
+
+    def getEdfBlock(self, force_type=None, fit2dMode=False):
+        """
+        @param force_type: type of the dataset to be enforced like "float64" or "uint16"
+        @type force_type: string or numpy.dtype
+        @param fit2dMode: enforce compatibility with fit2d and starts countimg number of images at 1 
+        @type fit2dMode: boolean
+        @return: ascii header block 
+        @rtype: python string with the concatenation of the ascii header and the binary data block
+        """
+        if force_type is not None:
+            data = self.data.astype(force_type)
+        else:
+            data = self.data
+        fit2dMode = bool(fit2dMode)
+        for key in self.header:
+            KEY = key.upper()
+            if KEY not in self.capsHeader:
+                self.capsHeader[KEY] = key
+            if key not in self.header_keys:
+                self.header_keys.append(key)
+
+        header = self.header.copy()
+        header_keys = self.header_keys[:]
+        capsHeader = self.capsHeader.copy()
+
+        listHeader = ["{\n"]
+#        First of all clean up the headers:
+        for i in capsHeader:
+            if "DIM_" in i:
+                header.pop(capsHeader[i])
+                header_keys.remove(capsHeader[i])
+        for KEY in ["SIZE", "EDF_BINARYSIZE", "EDF_HEADERSIZE", "BYTEORDER", "DATATYPE", "HEADERID", "IMAGE"]:
+            if KEY in capsHeader:
+                header.pop(capsHeader[KEY])
+                header_keys.remove(capsHeader[KEY])
+        if "EDF_DATABLOCKID" in capsHeader:
+            header_keys.remove(capsHeader["EDF_DATABLOCKID"])
+            #but do not remove the value from dict, instead reset the key ...
+            if capsHeader["EDF_DATABLOCKID"] != "EDF_DataBlockID":
+                header["EDF_DataBlockID"] = header.pop(capsHeader["EDF_DATABLOCKID"])
+                capsHeader["EDF_DATABLOCKID"] = "EDF_DataBlockID"
+
+#            Then update static headers freshly deleted
+        header_keys.insert(0, "Size")
+        header["Size"] = len(data.tostring())
+        header_keys.insert(0, "HeaderID")
+        header["HeaderID"] = "EH:%06d:000000:000000" % (self.iFrame + fit2dMode)
+        header_keys.insert(0, "Image")
+        header["Image"] = str(self.iFrame + fit2dMode)
+
+        dims = list(data.shape)
+        nbdim = len(dims)
+        for i in dims:
+            key = "Dim_%i" % nbdim
+            header[key] = i
+            header_keys.insert(0, key)
+            nbdim -= 1
+        header_keys.insert(0, "DataType")
+        header["DataType"] = NUMPY_EDF_DTYPE[str(numpy.dtype(data.dtype))]
+        header_keys.insert(0, "ByteOrder")
+        if numpy.little_endian:
+            header["ByteOrder"] = "LowByteFirst"
+        else:
+            header["ByteOrder"] = "HighByteFirst"
+        approxHeaderSize = 100
+        for key in header:
+            approxHeaderSize += 7 + len(key) + len(str(header[key]))
+        approxHeaderSize = BLOCKSIZE * (approxHeaderSize // BLOCKSIZE + 1)
+        header_keys.insert(0, "EDF_HeaderSize")
+        header["EDF_HeaderSize"] = str(BLOCKSIZE * (approxHeaderSize // BLOCKSIZE + 1))
+        header_keys.insert(0, "EDF_BinarySize")
+        header["EDF_BinarySize"] = len(data.tostring())
+        header_keys.insert(0, "EDF_DataBlockID")
+        if not "EDF_DataBlockID" in header:
+            header["EDF_DataBlockID"] = "%i.Image.Psd" % (self.iFrame + fit2dMode)
+        preciseSize = 4 #2 before {\n 2 after }\n
+        for key in header_keys:
+            #Escape keys or values that are no ascii
+            strKey = str(key)
+            if not isAscii(strKey, listExcluded=["}", "{"]):
+                logger.warning("Non ascii key %s, skipping" % strKey)
+                continue
+            strValue = str(header[key])
+            if not isAscii(strValue, listExcluded=["}", "{"]):
+                logger.warning("Non ascii value %s, skipping" % strValue)
+                continue
+            line = strKey + " = " + strValue + " ;\n"
+            preciseSize += len(line)
+            listHeader.append(line)
+#            print type(line), line
+        if preciseSize > approxHeaderSize:
+            logger.error("I expected the header block only at %s in fact it is %s" % (approxHeaderSize, preciseSize))
+            for  idx, line in enumerate(listHeader[:]):
+                if line.startswith("EDF_HeaderSize"):
+                    headerSize = BLOCKSIZE * (preciseSize // BLOCKSIZE + 1)
+                    newline = "EDF_HeaderSize = %s ;\n" % headerSize
+                    delta = len(newline) - len(line)
+                    if (preciseSize // BLOCKSIZE) != ((preciseSize + delta) // BLOCKSIZE):
+                        headerSize = BLOCKSIZE * ((preciseSize + delta) // BLOCKSIZE + 1)
+                        newline = "EDF_HeaderSize = %s ;\n" % headerSize
+                    preciseSize = preciseSize + delta
+                    listHeader[idx] = newline
+                    break
+        else:
+            headerSize = approxHeaderSize
+        listHeader.append(" "*(headerSize - preciseSize) + "}\n")
+        return "".join(listHeader) + data.tostring()
+
+
+
+class edfimage(fabioimage):
+    """ Read and try to write the ESRF edf data format """
+
+    def __init__(self, data=None , header=None, header_keys=None, frames=None):
+        self.currentframe = 0
+        try:
+            dim = len(data.shape)
+        except Exception, error: #IGNORE:W0703
+            logger.debug("Data don't look like a numpy array (%s), resetting all!!" % error)
+            data = None
+            dim = 0
+        if dim == 2:
+            fabioimage.__init__(self, data, header)
+        elif dim == 1 :
+            data.shape = (0, len(data))
+            fabioimage.__init__(self, data, header)
+        elif dim == 3 :
+            fabioimage.__init__(self, data[0, :, :], header)
+        elif dim == 4 :
+            fabioimage.__init__(self, data[0, 0, :, :], header)
+        elif dim == 5 :
+            fabioimage.__init__(self, data[0, 0, 0, :, :], header)
+
+        if frames is None:
+            frame = Frame(data=data, header=header,
+                          header_keys=header_keys ,
+                          number=self.currentframe)
+            self.__frames = [frame]
+        else:
+            self.__frames = frames
+
+    @staticmethod
+    def _readHeaderBlock(infile):
+        """
+        Read in a header in some EDF format from an already open file
+        
+        @param infile: file object open in read mode
+        @return: string (or None if no header was found. 
+        """
+
+        block = infile.read(BLOCKSIZE)
+        if len(block) < BLOCKSIZE:
+            logger.debug("Under-short header: only %i bytes in %s" % (len(block), infile.name))
+            return
+        if (block.find("{") < 0) :
+            # This does not look like an edf file
+            logger.warning("no opening {. Corrupt header of EDF file %s" % infile.name)
+            return
+        while '}' not in block:
+            block = block + infile.read(BLOCKSIZE)
+            if len(block) > BLOCKSIZE * 20:
+                logger.warning("Runaway header in EDF file")
+                return
+        start = block.find("{") + 1
+        end = block.find("}")
+
+        # Now it is essential to go to the start of the binary part
+        if block[end: end + 3] == "}\r\n":
+            offset = end + 3 - len(block)
+        elif block[end: end + 2] == "}\n":
+            offset = end + 2 - len(block)
+        else:
+            logger.error("Unable to locate start of the binary section")
+            offset = None
+        if offset is not None:
+            try:
+                infile.seek(offset, os.SEEK_CUR)
+            except TypeError: #JK20110407 bugfix specific to MacOSX
+                pos = infile.tell()
+                infile.seek(pos + offset)
+        return block[start:end]
+
+
+    def _readheader(self, infile):
+        """
+        Read all headers in a file and populate self.header
+        data is not yet populated
+        @type infile: file object open in read mode
+        """
+        self.__frames = []
+
+        bContinue = True
+        while bContinue:
+            block = self._readHeaderBlock(infile)
+            if block is None:
+                bContinue = False
+                break
+            frame = Frame(number=self.nframes)
+            self.__frames.append(frame)
+            size = frame.parseheader(block)
+            frame.rawData = infile.read(size)
+            if len(frame.rawData) != size:
+                logger.warning("Non complete datablock: got %s, expected %s" % (len(frame.rawData), size))
+                bContinue = False
+                break
+
+        for i, frame in enumerate(self.__frames):
+            missing = []
+            for item in MINIMUM_KEYS:
+                if item not in frame.capsHeader:
+                    missing.append(item)
+            if len(missing) > 0:
+                logger.info("EDF file %s frame %i misses mandatory keys: %s " % (self.filename, i, " ".join(missing)))
+
+        self.currentframe = 0
+
+
+    def read(self, fname):
+        """
+        Read in header into self.header and
+            the data   into self.data
+        """
+        self.resetvals()
+        self.filename = fname
+
+        infile = self._open(fname, "rb")
+        self._readheader(infile)
+        if self.data is None:
+            self.data = self.unpack()
+#            self.bytecode = self.data.dtype.type
+        self.resetvals()
+        # ensure the PIL image is reset
+        self.pilimage = None
+        return self
+
+    def swap_needed(self):
+        """
+        Decide if we need to byteswap
+        """
+        if ('Low'  in self.header[self.capsHeader['BYTEORDER']] and numpy.little_endian) or \
+           ('High' in self.header[self.capsHeader['BYTEORDER']] and not numpy.little_endian):
+            return False
+        if ('High'  in self.header[self.capsHeader['BYTEORDER']] and numpy.little_endian) or \
+           ('Low' in self.header[self.capsHeader['BYTEORDER']] and not numpy.little_endian):
+            if self.bpp in [2, 4, 8]:
+                return True
+            else:
+                return False
+
+
+    def unpack(self):
+        """
+        Unpack a binary blob according to the specification given in the header and return the dataset
+
+        @return: dataset as numpy.ndarray
+        """
+        return self.__frames[self.currentframe].getData()
+
+
+    def getframe(self, num):
+        """ returns the file numbered 'num' in the series as a fabioimage """
+        newImage = None
+        if self.nframes == 1:
+            logger.debug("Single frame EDF; having fabioimage default behavour: %s" % num)
+            newImage = fabioimage.getframe(self, num)
+        elif num in xrange(self.nframes):
+            logger.debug("Multi frame EDF; having edfimage specific behavour: %s/%s" % (num, self.nframes))
+            newImage = edfimage(frames=self.__frames)
+            newImage.currentframe = num
+            newImage.filename = self.filename
+        else:
+            txt = "Cannot access frame: %s/%s" % (num, self.nframes)
+            logger.error(txt)
+            raise ValueError("edfimage.getframe:" + txt)
+        return newImage
+
+
+    def previous(self):
+        """ returns the previous file in the series as a fabioimage """
+        newImage = None
+        if self.nframes == 1:
+            newImage = fabioimage.previous(self)
+        else:
+            newFrameId = self.currentframe - 1
+            newImage = self.getframe(newFrameId)
+        return newImage
+
+
+    def next(self):
+        """ returns the next file in the series as a fabioimage """
+        newImage = None
+        if self.nframes == 1:
+            newImage = fabioimage.next(self)
+        else:
+            newFrameId = self.currentframe + 1
+            newImage = self.getframe(newFrameId)
+        return newImage
+
+
+    def write(self, fname, force_type=None, fit2dMode=False):
+        """
+        Try to write a file
+        check we can write zipped also
+        mimics that fabian was writing uint16 (we sometimes want floats)
+        
+        @param force_type: can be numpy.uint16 or simply "float"
+        @return: None
+        
+        """
+
+        outfile = self._open(fname, mode="wb")
+        for i, frame in enumerate(self.__frames):
+            frame.iFrame = i
+            outfile.write(frame.getEdfBlock(force_type=force_type, fit2dMode=fit2dMode))
+        outfile.close()
+
+
+    def appendFrame(self, frame=None, data=None, header=None):
+        """
+        Method used add a frame to an EDF file
+        @param frame: frame to append to edf image 
+        @type frame: instance of Frame
+        @return: None
+        """
+        if isinstance(frame, Frame):
+            self.__frames.append(frame)
+        else:
+            self.__frames.append(Frame(data, header))
+
+
+    def deleteFrame(self, frameNb=None):
+        """
+        Method used to remove a frame from an EDF image. by default the last one is removed.
+        @param frameNb: frame number to remove, by  default the last.
+        @type frameNb: integer
+        @return: None
+        """
+        if frameNb is None:
+            self.__frames.pop()
+        else:
+            self.__frames.pop(frameNb)
+
+
+################################################################################
+# Properties definition for header, data, header_keys and capsHeader 
+################################################################################
+    def getNbFrames(self):
+        """
+        Getter for number of frames
+        """
+        return len(self.__frames)
+    def setNbFrames(self, val):
+        """
+        Setter for number of frames ... should do nothing. Here just to avoid bugs  
+        """
+        if val != len(self.__frames):
+            logger.warning("trying to set the number of frames ")
+    nframes = property(getNbFrames, setNbFrames, "property: number of frames in EDF file")
+
+
+    def getHeader(self):
+        """
+        Getter for the headers. used by the property header,
+        """
+        return self.__frames[self.currentframe].header
+    def setHeader(self, _dictHeader):
+        """
+        Enforces the propagation of the header to the list of frames
+        """
+        try:
+            self.__frames[self.currentframe].header = _dictHeader
+        except AttributeError:
+            self.__frames = [Frame(header=_dictHeader)]
+        except IndexError:
+            if self.currentframe < len(self.__frames):
+                self.__frames.append(Frame(header=_dictHeader))
+    def delHeader(self):
+        """
+        Deleter for edf header
+        """
+        self.__frames[self.currentframe].header = {}
+    header = property(getHeader, setHeader, delHeader, "property: header of EDF file")
+
+    def getHeaderKeys(self):
+        """
+        Getter for edf header_keys
+        """
+        return self.__frames[self.currentframe].header_keys
+    def setHeaderKeys(self, _listtHeader):
+        """
+        Enforces the propagation of the header_keys to the list of frames
+        @param _listtHeader: list of the (ordered) keys in the header
+        @type _listtHeader: python list
+        """
+        try:
+            self.__frames[self.currentframe].header_keys = _listtHeader
+        except AttributeError:
+            self.__frames = [Frame(header_keys=_listtHeader)]
+        except IndexError:
+            if self.currentframe < len(self.__frames):
+                self.__frames.append(Frame(header_keys=_listtHeader))
+    def delHeaderKeys(self):
+        """
+        Deleter for edf header_keys
+        """
+        self.__frames[self.currentframe].header_keys = []
+    header_keys = property(getHeaderKeys, setHeaderKeys, delHeaderKeys, "property: header_keys of EDF file")
+
+    def getData(self):
+        """
+        getter for edf Data
+        @return: data for current frame  
+        @rtype: numpy.ndarray
+        """
+        npaData = None
+        try:
+            npaData = self.__frames[self.currentframe].data
+        except AttributeError:
+            self.__frames = [Frame()]
+            npaData = self.__frames[self.currentframe].data
+        except IndexError:
+            if self.currentframe < len(self.__frames):
+                self.__frames.append(Frame())
+                npaData = self.__frames[self.currentframe].data
+#        logger.warning("Data of %s, currentframe=%s  is type %s" % (id(self), self.currentframe, type(npaData)))
+        return npaData
+
+    def setData(self, _data):
+        """
+        Enforces the propagation of the data to the list of frames
+        @param _data: numpy array representing data 
+        """
+        try:
+            self.__frames[self.currentframe].data = _data
+        except AttributeError:
+            self.__frames = [Frame(data=_data)]
+        except IndexError:
+            if self.currentframe < len(self.__frames):
+                self.__frames.append(Frame(data=_data))
+    def delData(self):
+        """
+        deleter for edf Data
+        """
+        self.__frames[self.currentframe].data = None
+    data = property(getData, setData, delData, "property: data of EDF file")
+
+    def getCapsHeader(self):
+        """
+        getter for edf headers keys in upper case 
+        @return: data for current frame  
+        @rtype: dict
+        """
+        return self.__frames[self.currentframe].capsHeader
+    def setCapsHeader(self, _data):
+        """
+        Enforces the propagation of the header_keys to the list of frames
+        @param _data: numpy array representing data 
+        """
+        self.__frames[self.currentframe].capsHeader = _data
+    def delCapsHeader(self):
+        """
+        deleter for edf capsHeader
+        """
+        self.__frames[self.currentframe].capsHeader = {}
+    capsHeader = property(getCapsHeader, setCapsHeader, delCapsHeader, "property: capsHeader of EDF file, i.e. the keys of the header in UPPER case.")
+
+    def getDim1(self):
+        return self.__frames[self.currentframe].dim1
+    def setDim1(self, _iVal):
+        try:
+            self.__frames[self.currentframe].dim1 = _iVal
+        except AttributeError:
+            self.__frames = [Frame()]
+        except IndexError:
+            if self.currentframe < len(self.__frames):
+                self.__frames.append(Frame())
+                self.__frames[self.currentframe].dim1 = _iVal
+    dim1 = property(getDim1, setDim1)
+    def getDim2(self):
+        return self.__frames[self.currentframe].dim2
+    def setDim2(self, _iVal):
+        try:
+            self.__frames[self.currentframe].dim2 = _iVal
+        except AttributeError:
+            self.__frames = [Frame()]
+        except IndexError:
+            if self.currentframe < len(self.__frames):
+                self.__frames.append(Frame())
+                self.__frames[self.currentframe].dim2 = _iVal
+    dim2 = property(getDim2, setDim2)
+
+    def getDims(self):
+        return self.__frames[self.currentframe].dims
+    dims = property(getDims)
+    def getByteCode(self):
+        return self.__frames[self.currentframe].bytecode
+    def setByteCode(self, _iVal):
+        try:
+            self.__frames[self.currentframe].bytecode = _iVal
+        except AttributeError:
+            self.__frames = [Frame()]
+        except IndexError:
+            if self.currentframe < len(self.__frames):
+                self.__frames.append(Frame())
+                self.__frames[self.currentframe].bytecode = _iVal
+
+    bytecode = property(getByteCode, setByteCode)
+    def getBpp(self):
+        return self.__frames[self.currentframe].bpp
+    def setBpp(self, _iVal):
+        try:
+            self.__frames[self.currentframe].bpp = _iVal
+        except AttributeError:
+            self.__frames = [Frame()]
+        except IndexError:
+            if self.currentframe < len(self.__frames):
+                self.__frames.append(Frame())
+                self.__frames[self.currentframe].bpp = _iVal
+    bpp = property(getBpp, setBpp)
+
diff --git a/fabio/fabioimage.py b/fabio/fabioimage.py
new file mode 100644
index 0000000..74497f2
--- /dev/null
+++ b/fabio/fabioimage.py
@@ -0,0 +1,456 @@
+#!/usr/bin/env python 
+
+"""
+
+Authors: Henning O. Sorensen & Erik Knudsen
+         Center for Fundamental Research: Metal Structures in Four Dimensions
+         Risoe National Laboratory
+         Frederiksborgvej 399
+         DK-4000 Roskilde
+         email:erik.knudsen at risoe.dk
+         
+         and Jon Wright, Jerome Kieffer: ESRF
+
+"""
+
+import numpy, os, gzip, bz2, StringIO
+import Image
+import fabioutils
+
+
+class fabioStream(StringIO.StringIO):
+    """ 
+    just an interface providing the name and mode property to a StringIO
+    
+    BugFix for MacOSX
+    """
+    def __init__(self, data, fname=None, mode="r"):
+        StringIO.StringIO.__init__(self, data)
+        self.closed = False
+        if fname == None:
+            self.name = "fabioStream"
+        else:
+            self.name = fname
+        self.mode = mode
+
+
+class fabioimage(object):
+    """
+    A common object for images in fable
+    Contains a numpy array (.data) and dict of meta data (.header)
+    """
+
+    _need_a_seek_to_read = False
+    _need_a_real_file = False
+
+    def __init__(self, data=None , header=None):
+        """
+        Set up initial values
+        """
+        if type(data) == type("string"):
+            raise Exception("fabioimage.__init__ bad argument - " + \
+                            "data should be numpy array")
+        self.data = data
+        self.pilimage = None
+        if header is None:
+            self.header = {}
+        else:
+            self.header = header
+        self.header_keys = self.header.keys() # holds key ordering
+        if data is not None:
+            self.dim1, self.dim2 = data.shape
+        else:
+            self.dim1 = self.dim2 = 0
+        self.bytecode = None     # numpy typecode
+        self.bpp = 2             # bytes per pixel
+        # cache for image statistics
+        self.mean = self.maxval = self.stddev = self.minval = None
+        # Cache roi
+        self.area_sum = None
+        self.slice = None
+        # New for multiframe files
+        self.nframes = 1
+        self.currentframe = 0
+        self.filename = None
+
+    def getframe(self, num):
+        """ returns the file numbered 'num' in the series as a fabioimage """
+        if self.nframes == 1:
+            # single image per file
+            import openimage
+            return openimage.openimage(
+                fabioutils.jump_filename(self.filename, num))
+        raise Exception("getframe out of range")
+
+    def previous(self):
+        """ returns the previous file in the series as a fabioimage """
+        import openimage
+        return openimage.openimage(
+            fabioutils.previous_filename(self.filename))
+
+    def next(self):
+        """ returns the next file in the series as a fabioimage """
+        import openimage
+        return openimage.openimage(
+            fabioutils.next_filename(self.filename))
+
+    def toPIL16(self, filename=None):
+        """
+        Convert to Python Imaging Library 16 bit greyscale image
+
+        FIXME - this should be handled by the libraries now
+        """
+        if filename:
+            self.read(filename)
+        if self.pilimage is not None:
+            return self.pilimage
+        # mode map
+        size = self.data.shape[:2][::-1]
+        typmap = {
+            'float32' : "F"     ,
+            'int32'   : "F;32S" ,
+            'uint32'  : "F;32"  ,
+            'int16'   : "F;16S" ,
+            'uint16'  : "F;16"  ,
+            'int8'    : "F;8S"  ,
+            'uint8'   : "F;8"  }
+        if typmap.has_key(self.data.dtype.name):
+            mode2 = typmap[ self.data.dtype.name ]
+            mode1 = mode2[0]
+        else:
+            raise Exception("Unknown numpy type " + str(self.data.dtype.type))
+        # 
+        # hack for byteswapping for PIL in MacOS
+        testval = numpy.array((1, 0), numpy.uint8).view(numpy.uint16)[0]
+        if  testval == 1:
+            dats = self.data.tostring()
+        elif testval == 256:
+            dats = self.data.byteswap().tostring()
+        else:
+            raise Exception("Endian unknown in fabioimage.toPIL16")
+
+        self.pilimage = Image.frombuffer(mode1,
+                                         size,
+                                         dats,
+                                         "raw",
+                                         mode2,
+                                         0,
+                                         1)
+
+        return self.pilimage
+
+    def getheader(self):
+        """ returns self.header """
+        return self.header
+
+    def getmax(self):
+        """ Find max value in self.data, caching for the future """
+        if self.maxval is None:
+            self.maxval = self.data.max()
+        return self.maxval
+
+    def getmin(self):
+        """ Find min value in self.data, caching for the future """
+        if self.minval is None:
+            self.minval = self.data.min()
+        return self.minval
+
+    def make_slice(self, coords):
+        """
+        Convert a len(4) set of coords into a len(2) 
+        tuple (pair) of slice objects
+        the latter are immutable, meaning the roi can be cached
+        """
+        assert len(coords) == 4
+        if len(coords) == 4:
+            # fabian edfimage preference
+            if coords[0] > coords[2]:
+                coords[0:3:2] = [coords[2], coords[0]]
+            if coords[1] > coords[3]:
+                coords[1:4:2] = [coords[3], coords[1]]
+            #in fabian: normally coordinates are given as (x,y) whereas 
+            # a matrix is given as row,col 
+            # also the (for whichever reason) the image is flipped upside 
+            # down wrt to the matrix hence these tranformations
+            fixme = (self.dim2 - coords[3] - 1,
+                     coords[0] ,
+                     self.dim2 - coords[1] - 1,
+                     coords[2])
+        return (slice(int(fixme[0]), int(fixme[2]) + 1) ,
+                 slice(int(fixme[1]), int(fixme[3]) + 1))
+
+
+    def integrate_area(self, coords):
+        """ 
+        Sums up a region of interest 
+        if len(coords) == 4 -> convert coords to slices
+        if len(coords) == 2 -> use as slices
+        floor -> ? removed as unused in the function.
+        """
+        if self.data == None:
+            # This should return NAN, not zero ?
+            return 0
+        if len(coords) == 4:
+            sli = self.make_slice(coords)
+        elif len(coords) == 2 and isinstance(coords[0], slice) and \
+                                  isinstance(coords[1], slice):
+            sli = coords
+        if sli == self.slice and self.area_sum is not None:
+            return self.area_sum
+        self.slice = sli
+        self.area_sum = numpy.sum(
+                            numpy.ravel(
+                                self.data[ self.slice ].astype(numpy.float)))
+        return self.area_sum
+
+    def getmean(self):
+        """ return the mean """
+        if self.mean is None:
+            self.mean = self.data.mean(dtype=numpy.double)
+        return self.mean
+
+    def getstddev(self):
+        """ return the standard deviation """
+        if self.stddev == None:
+            self.stddev = self.data.std(dtype=numpy.double)
+        return self.stddev
+
+    def add(self, other):
+        """
+        Add another Image - warnign, does not clip to 16 bit images by default
+        """
+        if not hasattr(other, 'data'):
+            print 'edfimage.add() called with something that ' + \
+                'does not have a data field'
+        assert self.data.shape == other.data.shape , \
+                  'incompatible images - Do they have the same size?'
+        self.data = self.data + other.data
+        self.resetvals()
+
+
+    def resetvals(self):
+        """ Reset cache - call on changing data """
+        self.mean = self.stddev = self.maxval = self.minval = None
+        self.area_sum = None
+
+    def rebin(self, x_rebin_fact, y_rebin_fact, keep_I=True):
+        """ 
+        Rebin the data and adjust dims 
+        @param x_rebin_fact: x binning factor
+        @param y_rebin_fact: y binning factor
+        @param keep_I: shall the signal increase ?
+        @type x_rebin_fact: int
+        @type y_rebin_fact: int
+        @type keep_I: boolean
+
+        
+        """
+        if self.data == None:
+            raise Exception('Please read in the file you wish to rebin first')
+
+        if (self.dim1 % x_rebin_fact != 0) or (self.dim2 % y_rebin_fact != 0):
+            raise RuntimeError('image size is not divisible by rebin factor - ' + \
+                  'skipping rebin')
+        else:
+            dataIn = self.data.astype("float64")
+            shapeIn = self.data.shape
+            shapeOut = (shapeIn[0] / y_rebin_fact, shapeIn[1] / x_rebin_fact)
+            binsize = y_rebin_fact * x_rebin_fact
+            if binsize < 50: #method faster for small binning (4x4)
+                out = numpy.zeros(shapeOut, dtype="float64")
+                for j in range(x_rebin_fact):
+                    for i in range(y_rebin_fact):
+                        out += dataIn[i::y_rebin_fact, j::x_rebin_fact]
+            else: #method faster for large binning (8x8)
+                temp = self.data.astype("float64")
+                temp.shape = (shapeOut[0], y_rebin_fact, shapeOut[1], x_rebin_fact)
+                out = temp.sum(axis=3).sum(axis=1)
+        self.resetvals()
+        if keep_I:
+            self.data = (out / (y_rebin_fact * x_rebin_fact)).astype(self.data.dtype)
+        else:
+            self.data = out.astype(self.data.dtype)
+
+        self.dim1 = self.dim1 / x_rebin_fact
+        self.dim2 = self.dim2 / y_rebin_fact
+
+        #update header
+        self.update_header()
+
+    def write(self, fname):
+        """
+        To be overwritten - write the file
+        """
+        raise Exception("Class has not implemented readheader method yet")
+
+    def readheader(self, filename):
+        """
+        Call the _readheader function...
+        """
+        # Override the needs asserting that all headers can be read via python modules
+        save_state = self._need_a_real_file , self._need_a_seek_to_read
+        self._need_a_real_file , self._need_a_seek_to_read = False, False
+        fin = self._open(filename)
+        self._readheader(fin)
+        fin.close()
+        self._need_a_real_file , self._need_a_seek_to_read = save_state
+
+    def _readheader(self, fik_obj):
+        """
+        Must be overridden in classes
+        """
+        raise Exception("Class has not implemented _readheader method yet")
+
+    def update_header(self , **kwds):
+        """
+        update the header entries
+        by default pass in a dict of key, values.
+        """
+        self.header.update(kwds)
+
+    def read(self, filename):
+        """
+        To be overridden - fill in self.header and self.data
+        """
+        raise Exception("Class has not implemented read method yet")
+
+
+    def _open(self, fname, mode="rb"):
+        """
+        Try to handle compressed files, streams, shared memory etc
+        Return an object which can be used for "read" and "write" 
+        ... FIXME - what about seek ? 
+        """
+        fileObject = None
+        self.filename = fname
+        if hasattr(fname, "read") and hasattr(fname, "write"):
+            # It is already something we can use
+            return fname
+        if isinstance(fname, (str, unicode)):
+            self.header["filename"] = fname
+            if os.path.splitext(fname)[1] == ".gz":
+                fileObject = self._compressed_stream(fname,
+                                       fabioutils.COMPRESSORS['.gz'],
+                                       gzip.GzipFile,
+                                       mode)
+            elif os.path.splitext(fname)[1] == '.bz2':
+                fileObject = self._compressed_stream(fname,
+                                       fabioutils.COMPRESSORS['.bz2'],
+                                       bz2.BZ2File,
+                                       mode)
+            #
+            # Here we return the file even though it may be bzipped or gzipped
+            # but named incorrectly...
+            #
+            # FIXME - should we fix that or complain about the daft naming?
+            else:
+                fileObject = open(fname, mode)
+            if "name" not in dir(fileObject):
+                    fileObject.name = fname
+
+        return fileObject
+
+    def _compressed_stream(self,
+                           fname,
+                           system_uncompress,
+                           python_uncompress,
+                           mode='rb'):
+        """
+        Try to transparently handle gzip / bzip without always getting python 
+        performance
+        """
+        # assert that python modules are always OK based on performance benchmark
+        # Try to fix the way we are using them?
+        fobj = None
+        if self._need_a_real_file and mode[0] == "r":
+            fo = python_uncompress(fname, mode)
+            fobj = os.tmpfile()
+            fobj.write(fo.read())
+            fo.close()
+            fobj.seek(0)
+        elif self._need_a_seek_to_read and mode[0] == "r":
+            fo = python_uncompress(fname, mode)
+            fobj = fabioStream(fo.read(), fname, mode)
+        else:
+            fobj = python_uncompress(fname, mode)
+        return fobj
+
+
+def test():
+    """
+    check some basic fabioimage functionality
+    """
+    import time
+    start = time.time()
+
+    dat = numpy.ones((1024, 1024), numpy.uint16)
+    dat = (dat * 50000).astype(numpy.uint16)
+    assert dat.dtype.char == numpy.ones((1), numpy.uint16).dtype.char
+    hed = {"Title":"50000 everywhere"}
+    obj = fabioimage(dat, hed)
+
+    assert obj.getmax() == 50000
+    assert obj.getmin() == 50000
+    assert obj.getmean() == 50000 , obj.getmean()
+    assert obj.getstddev() == 0.
+
+    dat2 = numpy.zeros((1024, 1024), numpy.uint16, savespace=1)
+    cord = [ 256, 256, 790, 768 ]
+    slic = obj.make_slice(cord)
+    dat2[slic] = dat2[slic] + 100
+
+    obj = fabioimage(dat2, hed)
+
+    # New object, so...
+    assert obj.maxval is None
+    assert obj.minval is None
+
+    assert obj.getmax() == 100, obj.getmax()
+    assert obj.getmin() == 0 , obj.getmin()
+    npix = (slic[0].stop - slic[0].start) * (slic[1].stop - slic[1].start)
+    obj.resetvals()
+    area1 = obj.integrate_area(cord)
+    obj.resetvals()
+    area2 = obj.integrate_area(slic)
+    assert area1 == area2
+    assert obj.integrate_area(cord) == obj.integrate_area(slic)
+    assert obj.integrate_area(cord) == npix * 100, obj.integrate_area(cord)
+
+
+    def clean():
+        """ clean up the created testfiles"""
+        for name in ["testfile", "testfile.gz", "testfile.bz2"]:
+            try:
+                os.remove(name)
+            except:
+                continue
+
+
+    clean()
+
+    gzip.open("testfile.gz", "wb").write("{ hello }")
+    fout = obj._open("testfile.gz")
+    readin = fout.read()
+    assert readin == "{ hello }", readin + " gzipped file"
+
+
+    bz2.BZ2File("testfilebz", "wb").write("{ hello }")
+    fout = obj._open("testfile.bz2")
+    readin = fout.read()
+    assert readin == "{ hello }", readin + " bzipped file"
+
+    ftest = open("testfile", "wb")
+    ftest.write("{ hello }")
+    assert ftest == obj._open(ftest)
+    ftest.close()
+    fout = obj._open("testfile")
+    readin = fout.read()
+    assert readin == "{ hello }", readin + "plain file"
+    fout.close()
+    ftest.close()
+    clean()
+
+    print "Passed in", time.time() - start, "s"
+
+if __name__ == '__main__':
+    test()
diff --git a/fabio/fabioutils.py b/fabio/fabioutils.py
new file mode 100644
index 0000000..e0c73b8
--- /dev/null
+++ b/fabio/fabioutils.py
@@ -0,0 +1,253 @@
+import re, os
+
+def construct_filename(*args, **kwds):
+    raise Exception("You probably want fabio.jump_filename")
+
+
+
+FILETYPES = {
+    # extension NNNimage fabioclass
+    # type consistency - always use a list if one case is
+    'edf'    : ['edf'],
+    'cor'    : ['edf'],
+    'pnm'    : ['pnm'],
+    'pgm'    : ['pnm'],
+    'pbm'    : ['pnm'],
+    'tif'    : ['tif'],
+    'tiff'   : ['tif'],
+    'img'    : ['adsc', 'OXD', 'HiPiC'],
+    'mccd'   : ['marccd'],
+    'mar2300': ['mar345'],
+    'sfrm'   : ['bruker100'],
+    'msk'    : ['fit2dmask'],
+    'spr'    : ['fit2dspreadsheet'],
+    'dm3'    : ['dm3'],
+    'kcd'    : ['kcd'],
+    'cbf'    : ['cbf'],
+    'xml'    : ["xsd"],
+    'xsd'    : ["xsd"],
+             }
+
+# Add bzipped and gzipped
+for key in FILETYPES.keys():
+    FILETYPES[key + ".bz2"] = FILETYPES[key]
+    FILETYPES[key + ".gz"] = FILETYPES[key]
+
+
+# Compressors
+
+COMPRESSORS = {}
+
+try:
+    lines = os.popen("gzip -h 2>&1").read()
+    # Looking for "usage"
+    if "sage" in lines:
+        COMPRESSORS['.gz'] = 'gzip -dc '
+    else:
+        COMPRESSORS['.gz'] = None
+except:
+    COMPRESSORS['.gz'] = None
+
+try:
+    lines = os.popen("bzip2 -h 2>&1").read()
+    # Looking for "usage" 
+    if "sage" in lines:
+        COMPRESSORS['.bz2'] = 'bzip2 -dc '
+    else:
+        COMPRESSORS['.bz2'] = None
+except:
+    COMPRESSORS['.bz2'] = None
+
+
+def getnum(name):
+    """
+    # try to figure out a file number
+    # guess it starts at the back
+    """
+    stem , num, post_num = numstem(name)
+    try:
+        return int(num)
+    except ValueError:
+        return None
+
+class filename_object:
+    """
+    The 'meaning' of a filename
+    """
+    def __init__(self, stem,
+            num=None,
+            directory=None,
+            format=None,
+            extension=None,
+            postnum=None,
+            digits=4):
+        self.stem = stem
+        self.num = num
+        self.format = format
+        self.extension = extension
+        self.digits = digits
+        self.postnum = postnum
+        self.directory = directory
+
+    def str(self):
+        """ Return a string representation """
+        fmt = "stem %s, num %s format %s extension %s " + \
+                "postnum = %s digits %s dir %s"
+        return fmt % tuple([str(x) for x in [
+                    self.stem ,
+                    self.num ,
+                    self.format ,
+                    self.extension ,
+                    self.postnum ,
+                    self.digits ,
+                    self.directory ] ])
+
+
+    def tostring(self):
+        """
+        convert yourself to a string
+        """
+        name = self.stem
+        if self.digits is not None and self.num is not None:
+            fmt = "%0" + str(self.digits) + "d"
+            name += fmt % self.num
+        if self.postnum is not None:
+            name += self.postnum
+        if self.extension is not None:
+            name += self.extension
+        if self.directory is not None:
+            name = os.path.join(self.directory, name)
+        return name
+
+
+def numstem(name):
+    """ cant see how to do without reversing strings
+    Match 1 or more digits going backwards from the end of the string
+    """
+    reg = re.compile(r"^(.*?)(-?[0-9]{0,9})(\D*)$")
+    #reg = re.compile("""(\D*)(\d\d*)(\w*)""")
+    try:
+        res = reg.match(name).groups()
+        #res = reg.match(name[::-1]).groups()
+        #return [ r[::-1] for r in res[::-1]]
+        if len(res[0]) == len(res[1]) == 0: # Hack for file without number 
+            return [res[2], '', '']
+        return [ r for r in res]
+    except AttributeError: # no digits found
+        return [name, "", ""]
+
+def deconstruct_filename(filename):
+    """
+    Break up a filename to get image type and number
+    """
+    direc , name = os.path.split(filename)
+    if len(direc) == 0:
+        direc = None
+    parts = os.path.split(name)[-1].split(".")
+    # loop back from end
+    compressed = False
+    extn = ""
+    postnum = ""
+    ndigit = 4
+    if parts[-1] in ["gz", "bz2"]:
+        extn = "." + parts[-1]
+        parts = parts[:-1]
+        compressed = True
+    if parts[-1] in FILETYPES.keys():
+        typ = FILETYPES[parts[-1]]
+        extn = "." + parts[-1] + extn
+        try:
+            stem , numstring, postnum = numstem(".".join(parts[:-1]))
+            num = int(numstring)
+            ndigit = len(numstring)
+        except:
+            # There is no number - hence make num be None, not 0
+            num = None
+            stem = "".join(parts[:-1])
+    else:
+        # Probably two type left
+        if len(parts) == 1:
+            # Probably GE format stem_numb
+            parts2 = parts[0].split("_")
+            try:
+                num = int(parts2[-1])
+                ndigit = len(parts2[-1])
+                typ = ['GE']
+                stem = "_".join(parts2[:-1]) + "_"
+            except:
+                pass
+        else:
+            try:
+                num = int(parts[-1])
+                ndigit = len(parts[-1])
+                typ = ['bruker']
+                stem = ".".join(parts[:-1]) + "."
+            except:
+                typ = None
+                extn = "." + parts[-1] + extn
+                try:
+                    stem , numstring, postnum = numstem(".".join(parts[:-1]))
+                    num = int(numstring)
+                    ndigit = len(numstring)
+                except:
+                    raise
+            #            raise Exception("Cannot decode "+filename)
+    obj = filename_object(stem,
+            num=num,
+            directory=direc,
+            format=typ,
+            extension=extn,
+            postnum=postnum,
+            digits=ndigit)
+
+    return obj
+
+
+def next_filename(name, padding=True):
+    """ increment number """
+    obj = deconstruct_filename(name)
+    obj.num += 1
+    if not padding:
+        obj.digits = 0
+    return obj.tostring()
+
+def previous_filename(name, padding=True):
+    """ decrement number """
+    obj = deconstruct_filename(name)
+    obj.num -= 1
+    if not padding:
+        obj.digits = 0
+    return obj.tostring()
+
+def jump_filename(name, num, padding=True):
+    """ jump to number """
+    obj = deconstruct_filename(name)
+    obj.num = num
+    if not padding:
+        obj.digits = 0
+    return obj.tostring()
+
+
+def extract_filenumber(name):
+    """ extract file number """
+    obj = deconstruct_filename(name)
+    return obj.num
+
+def isAscii(name, listExcluded=None):
+    """
+    @param name: string to check
+    @param listExcluded: list of char or string excluded.
+    @return: True of False whether  name is pure ascii or not
+    """
+    isascii = None
+    try:
+        name.decode("ascii")
+    except UnicodeDecodeError:
+        isascii = False
+    else:
+        if listExcluded:
+            isascii = not(any(bad in  name for bad in listExcluded))
+        else:
+            isascii = True
+
+    return isascii
diff --git a/fabio/file_series.py b/fabio/file_series.py
new file mode 100644
index 0000000..601fca1
--- /dev/null
+++ b/fabio/file_series.py
@@ -0,0 +1,311 @@
+#!/usr/bin/env python
+
+"""
+
+Authors: Henning O. Sorensen & Erik Knudsen
+         Center for Fundamental Research: Metal Structures in Four Dimensions
+         Risoe National Laboratory
+         Frederiksborgvej 399
+         DK-4000 Roskilde
+         email:erik.knudsen at risoe.dk
+
+        + Jon Wright, ESRF
+"""
+from fabioutils import filename_object, next_filename
+#import fabioutils
+from openimage import openimage
+
+
+def new_file_series0(first_object, first=None, last=None, step=1):
+    """
+    Created from a fabio image
+    first and last are file numbers
+    """
+    im = first_object
+    nimages = 0
+    # for counting images
+    if None in (first, last):
+        step = 0
+        total = 1
+    else:
+        total = last - first
+
+    yield im
+    while nimages < total:
+        nimages += step
+        try:
+            newim = im.next()
+            im = newim
+        except:
+            import traceback
+            traceback.print_exc()
+
+            # Skip bad images
+            print "Got a problem here"
+            try:
+                im.filename = next_filename(im.filename)
+            except:
+                # KE: This will not work and will throw an exception
+                # fabio.next_filename doesn't understand %nnnn on the end
+                im.filename = next_filename(im.sequencefilename)
+            yield None
+        yield im
+
+
+
+def new_file_series(first_object, nimages=0, step=1, traceback=False):
+    """
+    A generator function that creates a file series starting from a a fabioimage.
+    Iterates through all images in a file (if more than 1), then proceeds to
+    the next file as determined by fabio.next_filename.
+    
+    first_object: the starting fabioimage, which will be the first one yielded
+      in the sequence
+    nimages:  the maximum number of images to consider
+    step: step size, will yield the first and every step'th image until nimages
+      is reached.  (e.g. nimages = 5, step = 2 will yield 3 images (0, 2, 4) 
+    traceback: if True causes it to print a traceback in the event of an
+      exception (missing image, etc.).  Otherwise the calling routine can handle
+      the exception as it chooses 
+    yields: the next fabioimage in the series.
+      In the event there is an exception, it yields the sys.exec_info for the
+      exception instead.  sys.exec_info is a tuple:
+        ( exceptionType, exceptionValue, exceptionTraceback )
+      from which all the exception information can be obtained.
+      Suggested usage:
+        for obj in new_file_series( ... ):
+          if not isinstance( obj, fabio.fabioimage.fabioimage ):
+            # deal with errors like missing images, non readable files, etc
+            # e.g.
+            traceback.print_exception(obj[0], obj[1], obj[2])
+    """
+    im = first_object
+    nprocessed = 0
+    abort = False
+    if nimages > 0:
+        yield im
+        nprocessed += 1
+    while nprocessed < nimages:
+        try:
+            newim = im.next()
+            im = newim
+            retVal = im
+        except Exception, ex:
+            import sys
+            retVal = sys.exc_info()
+            if(traceback):
+                import traceback
+                traceback.print_exc()
+                # Skip bad images
+                print "Got a problem here: next() failed"
+            # Skip bad images
+            try:
+                im.filename = next_filename(im.filename)
+            except:
+                pass
+        if nprocessed % step == 0:
+            yield retVal
+            # Avoid cyclic references with exc_info ?
+            retVal = None
+            if abort: break
+        nprocessed += 1
+
+
+
+class file_series(list):
+    """
+    represents a series of files to iterate
+    has an idea of a current position to do next and prev
+
+    You also get from the list python superclass:
+       append
+       count
+       extend
+       insert
+       pop
+       remove
+       reverse
+       sort
+    """
+    def __init__(self, list_of_strings):
+        """
+        arg should be a list of strings which are filenames
+        """
+        super(file_series, self).__init__(list_of_strings)
+        # track current position in list
+        self._current = 0
+
+
+    # methods which return a filename
+
+    def first(self):
+        """ first image in series """
+        return self[0]
+
+    def last(self):
+        """ last in series """
+        return self[-1]
+
+    def previous(self):
+        """ prev in a sequence"""
+        self._current -= 1
+        return self[self._current]
+
+    def current(self):
+        """ current position in a sequence """
+        return self[self._current]
+
+    def next(self):
+        """ next in a sequence """
+        self._current += 1
+        return self[self._current]
+
+    def jump(self, num):
+        """ goto a position in sequence """
+        assert num < len(self) and num > 0, "num out of range"
+        self._current = num
+        return self[self._current]
+
+    def len(self):
+        """ number of files"""
+        return len(self)
+
+
+    # Methods which return a fabioimage
+
+    def first_image(self):
+        """ first image in a sequence """
+        return openimage(self.first())
+
+    def last_image(self):
+        """ last image in a sequence """
+        return openimage(self.last())
+
+    def next_image(self):
+        """ Return the next image """
+        return openimage(self.next())
+
+    def previous_image(self):
+        """ Return the previous image """
+        return openimage(self.previous())
+
+    def jump_image(self, num):
+        """ jump to and read image """
+        return openimage(self.jump(num))
+
+    def current_image(self):
+        """ current image in sequence """
+        return openimage(self.current())
+
+    # methods which return a file_object
+
+    def first_object(self):
+        """ first image in a sequence """
+        return filename_object(self.first())
+
+    def last_object(self):
+        """ last image in a sequence """
+        return filename_object(self.last())
+
+    def next_object(self):
+        """ Return the next image """
+        return filename_object(self.next())
+
+    def previous_object(self):
+        """ Return the previous image """
+        return filename_object(self.previous())
+
+    def jump_object(self, num):
+        """ jump to and read image """
+        return filename_object(self.jump(num))
+
+    def current_object(self):
+        """ current image in sequence """
+        return filename_object(self.current())
+
+
+
+
+class numbered_file_series(file_series):
+    """
+    mydata0001.edf = "mydata" + 0001 + ".edf"
+    mydata0002.edf = "mydata" + 0002 + ".edf"
+    mydata0003.edf = "mydata" + 0003 + ".edf"
+    """
+    def __init__(self, stem, first, last, extension,
+                 digits=4, padding='Y', step=1):
+        """
+        stem - first part of the name
+        step - in case of every nth file
+        padding - possibility for specifying that numbers are not padded
+                  with zeroes up to digits
+        """
+        if padding == 'Y':
+            fmt = "%s%0" + str(digits) + "d%s"
+        else:
+            fmt = "%s%i%s"
+
+        super(numbered_file_series, self).__init__(
+            [ fmt % (stem, i, extension) for i in range(first,
+                                                          last + 1,
+                                                          step) ])
+
+
+class filename_series:
+    """ Much like the others, but created from a string filename """
+    def __init__(self, filename):
+        """ create from a filename (String)"""
+        self.obj = filename_object(filename)
+
+    def next(self):
+        """ increment number """
+        self.obj.num += 1
+        return self.obj.tostring()
+
+    def previous(self):
+        """ decrement number """
+        self.obj.num -= 1
+        return self.obj.tostring()
+
+    def current(self):
+        """ return current filename string"""
+        return self.obj.tostring()
+
+    def jump(self, num):
+        """ jump to a specific number """
+        self.obj.num = num
+        return self.obj.tostring()
+
+    # image methods
+    def next_image(self):
+        """ returns the next image as a fabioimage """
+        return openimage(self.next())
+    def prev_image(self):
+        """ returns the previos image as a fabioimage """
+        return openimage(self.previous())
+    def current_image(self):
+        """ returns the current image as a fabioimage"""
+        return openimage(self.current())
+    def jump_image(self, num):
+        """ returns the image number as a fabioimage"""
+        return openimage(self.jump(num))
+    # object methods
+    def next_object(self):
+        """ returns the next filename as a fabio.filename_object"""
+        self.obj.num += 1
+        return self.obj
+    def previous_object(self):
+        """ returns the previous filename as a fabio.filename_object"""
+        self.obj.num -= 1
+        return self.obj
+    def current_object(self):
+        """ returns the current filename as a fabio.filename_object"""
+        return self.obj
+    def jump_object(self, num):
+        """ returns the filename num as a fabio.filename_object"""
+        self.obj.num = num
+        return self.obj
+
+
+
+
diff --git a/fabio/fit2dmaskimage.py b/fabio/fit2dmaskimage.py
new file mode 100644
index 0000000..df612f6
--- /dev/null
+++ b/fabio/fit2dmaskimage.py
@@ -0,0 +1,86 @@
+## Automatically adapted for numpy.oldnumeric Oct 05, 2007 by alter_code1.py
+
+#!/usr/bin/env python
+"""
+
+Author: Andy Hammersley, ESRF
+Translation into python/fabio: Jon Wright, ESRF
+"""
+
+import numpy
+
+from fabioimage import fabioimage
+
+
+class fit2dmaskimage(fabioimage):
+    """ Read and try to write Andy Hammersley's mask format """
+
+
+    def _readheader(self, infile):
+        """
+        Read in a header from an already open file
+        """
+        # 1024 bytes gives 256x32 bit integers
+        header = infile.read(1024)
+        for i, j in [ ("M", 0),
+                      ("A", 4),
+                      ("S", 8),
+                      ("K", 12)  ]:
+            if header[j] != i:
+                raise Exception("Not a fit2d mask file")
+        fit2dhdr = numpy.fromstring(header, numpy.int32)
+        self.dim1 = fit2dhdr[4] # 1 less than Andy's fortran
+        self.dim2 = fit2dhdr[5]
+
+
+    def read(self, fname):
+        """
+        Read in header into self.header and
+            the data   into self.data
+        """
+        fin = self._open(fname)
+        self._readheader(fin)
+        # Compute image size
+        self.bytecode = numpy.uint8
+        self.bpp = len(numpy.array(0, self.bytecode).tostring())
+
+        # integer division
+        num_ints = (self.dim1 + 31) // 32
+        total = self.dim2 * num_ints * 4
+        data = fin.read(total)
+        assert len(data) == total
+        fin.close()
+
+        # Now to unpack it
+        data = numpy.fromstring(data, numpy.uint8)
+        data = numpy.reshape(data, (self.dim2, num_ints * 4))
+
+        result = numpy.zeros((self.dim2, num_ints * 4 * 8), numpy.uint8)
+
+        # Unpack using bitwise comparisons to 2**n
+        bits = numpy.ones((1), numpy.uint8)
+        for i in range(8):
+            temp = numpy.bitwise_and(bits, data)
+            result[:, i::8] = temp.astype(numpy.uint8)
+            bits = bits * 2
+        # Extra rows needed for packing odd dimensions
+        spares = num_ints * 4 * 8 - self.dim1
+        if spares == 0:
+            self.data = numpy.where(result == 0, 0, 1)
+        else:
+            self.data = numpy.where(result[:, :-spares] == 0, 0, 1)
+        # Transpose appears to be needed to match edf reader (scary??)
+#        self.data = numpy.transpose(self.data)
+        self.data = numpy.reshape(self.data.astype(numpy.uint16),
+                                    (self.dim2, self.dim1))
+        self.pilimage = None
+
+
+
+    def write(self, fname):
+        """
+        Try to write a file
+        check we can write zipped also
+        mimics that fabian was writing uint16 (we sometimes want floats)
+        """
+        raise Exception("Not implemented yet")
diff --git a/fabio/fit2dspreadsheetimage.py b/fabio/fit2dspreadsheetimage.py
new file mode 100644
index 0000000..671b2b5
--- /dev/null
+++ b/fabio/fit2dspreadsheetimage.py
@@ -0,0 +1,85 @@
+
+
+"""
+Read the fit2d ascii image output
+        + Jon Wright, ESRF
+"""
+
+import numpy
+
+from fabioimage import fabioimage
+
+
+
+
+class fit2dspreadsheetimage(fabioimage):
+    """
+    Read a fit2d ascii format
+    """
+
+    def _readheader(self, infile):
+        """
+
+        TODO : test for minimal attributes?
+        """
+        line = infile.readline()
+        try:
+            items = line.split()
+            xdim = int(items[0])
+            ydim = int(items[1])
+        except:
+            raise
+        self.header['title'] = line
+        self.header['Dim_1'] = xdim
+        self.header['Dim_2'] = ydim
+
+    def read(self, fname):
+        """
+        Read in header into self.header and
+            the data   into self.data
+        """
+        self.header = {}
+        self.resetvals()
+        infile = self._open(fname)
+        self._readheader(infile)
+        # Compute image size
+        try:
+            self.dim1 = int(self.header['Dim_1'])
+            self.dim2 = int(self.header['Dim_2'])
+        except:
+            raise Exception("file", str(fname) + \
+                                "is corrupt, cannot read it")
+        bytecode = numpy.float32
+
+        self.bpp = len(numpy.array(0, bytecode).tostring())
+
+        #now read the data into the array
+        try:
+            vals = []
+            for line in infile.readlines():
+                try:
+                    vals.append([float(x) for x in line.split()])
+                except:
+                    pass
+            self.data = numpy.array(vals).astype(bytecode)
+            assert self.data.shape == (self.dim2, self.dim1)
+
+        except:
+            raise IOError, "Error reading ascii"
+
+        self.resetvals()
+        # ensure the PIL image is reset
+        self.pilimage = None
+        return self
+
+
+if __name__ == "__main__":
+    import sys, time
+    start = time.time()
+    img = fit2dspreadsheetimage()
+    img.read(sys.argv[1])
+    print time.time() - start
+    print img.dim1, img.dim2, img.data.shape
+    from matplotlib.pylab import imshow, show
+    imshow(img.data.T)
+    show()
diff --git a/fabio/kcdimage.py b/fabio/kcdimage.py
new file mode 100644
index 0000000..a64aef6
--- /dev/null
+++ b/fabio/kcdimage.py
@@ -0,0 +1,125 @@
+#!/usr/bin/env python
+"""
+Authors: Jerome Kieffer, ESRF 
+         email:jerome.kieffer at esrf.fr
+
+kcd images are 2D images written by the old KappaCCD diffractometer built by Nonius in the 1990's
+Based on the edfimage.py parser.
+"""
+
+import numpy, logging
+import os, string
+from fabioimage import fabioimage
+logger = logging.getLogger("kcdimage")
+
+DATA_TYPES = {"u16"  :  numpy.uint16 }
+
+MINIMUM_KEYS = [
+                'ByteOrder',
+                'Data type',
+                'X dimension',
+                'Y dimension',
+                'Number of readouts']
+
+DEFAULT_VALUES = { "Data type": "u16" }
+
+
+
+
+class kcdimage(fabioimage):
+    """ 
+    Read the Nonius kcd data format """
+
+
+    def _readheader(self, infile):
+        """
+        Read in a header in some KCD format from an already open file
+        @
+        """
+        oneLine = infile.readline()
+        alphanum = string.digits + string.letters + ". "
+        asciiHeader = True
+        for oneChar in oneLine.strip():
+            if not oneChar in alphanum:
+                asciiHeader = False
+
+
+        if asciiHeader is False:
+            # This does not look like an edf file
+            logger.warning("First line of %s does not seam to be ascii text!" % infile.name)
+        endOfHeaders = False
+        while not endOfHeaders:
+            oneLine = infile.readline()
+            if len(oneLine) > 100:
+                endOfHeaders = True
+                break
+            if oneLine.strip() == "Binned mode":
+                oneLine = "Mode = Binned"
+            try:
+                key, val = oneLine.split('=' , 1)
+            except:
+                endOfHeaders = True
+                break
+            key = key.strip()
+            self.header_keys.append(key)
+            self.header[key] = val.strip()
+        missing = []
+        for item in MINIMUM_KEYS:
+            if item not in self.header_keys:
+                missing.append(item)
+        if len(missing) > 0:
+            logger.debug("KCD file misses the keys " + " ".join(missing))
+
+
+    def read(self, fname):
+        """
+        Read in header into self.header and
+            the data   into self.data
+        """
+        self.header = {}
+        self.resetvals()
+        infile = self._open(fname, "rb")
+        self._readheader(infile)
+        # Compute image size
+        try:
+            self.dim1 = int(self.header['X dimension'])
+            self.dim2 = int(self.header['Y dimension'])
+        except:
+            raise Exception("KCD file %s is corrupt, cannot read it" % fname)
+        try:
+            bytecode = DATA_TYPES[self.header['Data type']]
+            self.bpp = len(numpy.array(0, bytecode).tostring())
+        except KeyError:
+            bytecode = numpy.uint16
+            self.bpp = 2
+            logger.warning("Defaulting type to uint16")
+        try:
+            nbReadOut = int(self.header['Number of readouts'])
+        except KeyError:
+            logger.warning("Defaulting number of ReadOut to 1")
+            nbReadOut = 1
+        fileSize = os.stat(fname)[6]
+        expected_size = self.dim1 * self.dim2 * self.bpp * nbReadOut
+        infile.seek(fileSize - expected_size)
+        block = infile.read()
+        assert len(block) == expected_size
+        infile.close()
+
+        #now read the data into the array
+        self.data = numpy.zeros((self.dim2, self.dim1))
+        try:
+            for i in range(nbReadOut):
+                self.data += numpy.reshape(numpy.fromstring(
+                    block[i * expected_size / nbReadOut:(i + 1) * expected_size / nbReadOut], bytecode),
+                    [self.dim2, self.dim1])
+        except:
+            print len(block), bytecode, self.bpp, self.dim2, self.dim1
+            raise IOError, \
+              'Size spec in kcd-header does not match size of image data field'
+        self.bytecode = self.data.dtype.type
+        self.resetvals()
+        # ensure the PIL image is reset
+        self.pilimage = None
+        return self
+
+
diff --git a/fabio/mar345image.py b/fabio/mar345image.py
new file mode 100644
index 0000000..ce4c292
--- /dev/null
+++ b/fabio/mar345image.py
@@ -0,0 +1,143 @@
+#!/usr/bin/env python
+"""
+
+Authors: Henning O. Sorensen & Erik Knudsen
+         Center for Fundamental Research: Metal Structures in Four Dimensions
+         Risoe National Laboratory
+         Frederiksborgvej 399
+         DK-4000 Roskilde
+         email:erik.knudsen at risoe.dk
+          +
+         Jon Wright, ESRF, France
+"""
+
+from fabioimage import fabioimage
+import numpy, struct, string
+import logging
+logger = logging.getLogger("mar345image")
+
+class mar345image(fabioimage):
+    _need_a_real_file = True
+    def __init__(self, *args, **kwargs):
+        fabioimage.__init__(self, *args, **kwargs)
+        self.numhigh = None
+        self.numpixels = None
+
+    def read(self, fname):
+        """ Read a mar345 image"""
+        self.filename = fname
+        f = self._open(self.filename, "rb")
+        self._readheader(f)
+
+        try:
+            import mar345_io #IGNORE:F0401
+        except ImportError, error:
+            logger.error('%s. importing the mar345_io backend: generate an empty 1x1 picture' % error)
+            f.close()
+            self.dim1 = 1
+            self.dim2 = 1
+            self.bytecode = numpy.int #
+            self.data = numpy.resize(numpy.array([0], numpy.int), [1, 1])
+            return self
+
+        if 'compressed' in self.header['Format']:
+            self.data = mar345_io.unpack(f, self.dim1, self.dim2, self.numhigh)
+        else:
+            logger.error("cannot handle these formats yet " + \
+                "due to lack of documentation")
+            return None
+        self.bytecode = numpy.uint
+        f.close()
+        return self
+
+    def _readheader(self, infile=None):
+        """ Read a mar345 image header """
+        # clip was not used anywhere - commented out
+        # clip = '\x00'
+        #using a couple of local variables inside this function
+        f = infile
+        h = {}
+
+        #header is 4096 bytes long
+        l = f.read(64)
+        #the contents of the mar345 header is taken to be as
+        # described in
+        # http://www.mar-usa.com/support/downloads/mar345_formats.pdf
+        #the first 64 bytes are 4-byte integers (but in the CBFlib
+        # example image it seems to 128 bytes?)
+        #first 4-byte integer is a marker to check endianness
+        # TODO: turn this into a real check
+        if (l[0:4] == '1234'):
+            fs = 'I'
+        # unsigned integer, was using unsigned long (64 bit?)
+        fs = 'i'
+        #image dimensions
+        self.dim1 = self.dim2 = int(struct.unpack(fs, l[4:8])[0])
+        #number of high intensity pixels
+        self.numhigh = struct.unpack(fs, l[2 * 4 : (2 + 1) * 4])[0]
+        h['NumHigh'] = self.numhigh
+        #Image format
+        i = struct.unpack(fs, l[3 * 4 : (3 + 1) * 4])[0]
+        if i == 1:
+            h['Format'] = 'compressed'
+        elif i == 2:
+            h['Format'] = 'spiral'
+        else:
+            h['Format'] = 'compressed'
+            logger.warning("image format could not be detetermined" + \
+                "- assuming compressed mar345")
+        #collection mode
+        h['Mode'] = {0:'Dose', 1: 'Time'}[struct.unpack(fs, l[4 * 4:(4 + 1) * 4])[0]]
+        #total number of pixels
+        self.numpixels = struct.unpack(fs, l[5 * 4:(5 + 1) * 4])[0]
+        h['NumPixels'] = str(self.numpixels)
+        #pixel dimensions (length,height) in mm
+        h['PixelLength'] = struct.unpack(fs, l[6 * 4:(6 + 1) * 4])[0] / 1000.0
+        h['PixelHeight'] = struct.unpack(fs, l[7 * 4:(7 + 1) * 4])[0] / 1000.0
+        #x-ray wavelength in AA
+        h['Wavelength'] = struct.unpack(fs, l[8 * 4:(8 + 1) * 4])[0] / 1000000.0
+        #used distance
+        h['Distance'] = struct.unpack(fs, l[9 * 4:(9 + 1) * 4])[0] / 1000.0
+        #starting and ending phi
+        h['StartPhi'] = struct.unpack(fs, l[10 * 4:11 * 4])[0] / 1000.0
+        h['EndPhi'] = struct.unpack(fs, l[11 * 4:12 * 4])[0] / 1000.0
+        #starting and ending omega
+        h['StartOmega'] = struct.unpack(fs, l[12 * 4:13 * 4])[0] / 1000.0
+        h['EndOmega'] = struct.unpack(fs, l[13 * 4:14 * 4])[0] / 1000.0
+        #Chi and Twotheta angles
+        h['Chi'] = struct.unpack(fs, l[14 * 4:15 * 4])[0] / 1000.0
+        h['TwoTheta'] = struct.unpack(fs, l[15 * 4:16 * 4])[0] / 1000.0
+
+        #the rest of the header is ascii
+        # TODO: validate these values against the binaries already read
+        l = f.read(128)
+        if not 'mar research' in l:
+            logger.warning("the string \"mar research\" should be in " + \
+                "bytes 65-76 of the header but was not")
+        l = string.strip(f.read(4096 - 128 - 64))
+        for m in l.splitlines():
+            if m == 'END OF HEADER': break
+            n = m.split(' ', 1)
+            if n[0] == '':
+                continue
+            if n[0] in ('PROGRAM', 'DATE', 'SCANNER', 'HIGH', 'MULTIPLIER',
+                        'GAIN', 'WAVELENGTH', 'DISTANCE', 'RESOLUTION',
+                        'CHI', 'TWOTHETA', 'MODE', 'TIME', 'GENERATOR',
+                        'MONOCHROMATOR', 'REMARK'):
+                h[n[0]] = n[1].strip()
+                continue
+            if n[0] in ('FORMAT'):
+                (h['DIM'], h['FORMAT_TYPE'], h['NO_PIXELS']) = n[1].split()
+                continue
+            if n[0] in ('PIXEL', 'OFFSET', 'PHI', 'OMEGA', 'COUNTS',
+                        'CENTER', 'INTENSITY', 'HISTOGRAM', 'COLLIMATOR'):
+                n = m.split()
+                h.update([(n[0] + '_' + n[j], n[j + 1]) for j in range(1, len(n), 2)])
+                continue
+        self.header = h
+        return h
+
+    def write(self, fname):
+        logger.warning("write method not (yet?) implemented !!!!")
+
+
diff --git a/fabio/marccdimage.py b/fabio/marccdimage.py
new file mode 100644
index 0000000..228ec01
--- /dev/null
+++ b/fabio/marccdimage.py
@@ -0,0 +1,309 @@
+#!/usr/bin/env python
+"""
+
+Authors: Henning O. Sorensen & Erik Knudsen
+         Center for Fundamental Research: Metal Structures in Four Dimensions
+         Risoe National Laboratory
+         Frederiksborgvej 399
+         DK-4000 Roskilde
+         email:henning.sorensen at risoe.dk
+
+         + (mods for fabio) Jon Wright, ESRF
+marccdimage can read MarCCD and MarMosaic images including header info.
+
+JPW : Use a parser in case of typos (sorry?)
+
+"""
+
+
+# Base this on the tifimage (as marccd seems to be tiff with a 
+# special header 
+
+from tifimage import tifimage
+import logging
+logger = logging.getLogger("marccdimage")
+
+# Now for the c definition (found on mar webpage)
+# The following string is therefore copyrighted by Mar I guess
+
+CDEFINITION = """
+typedef struct frame_header_type {
+         /* File/header format parameters (256 bytes) */
+         UINT32        header_type;  /* flag for header type  
+                                           (can be  used as magic number) */
+         char header_name[16];           /* header name (MMX) */
+         UINT32        header_major_version;   /* header_major_version  (n.) */
+         UINT32        header_minor_version;   /* header_minor_version  (.n) */
+         UINT32        header_byte_order;/* BIG_ENDIAN (Motorola,MIPS);  
+                                            LITTLE_ENDIAN (DEC, Intel) */
+         UINT32        data_byte_order;  /* BIG_ENDIAN (Motorola,MIPS);  
+                                            LITTLE_ENDIAN (DEC, Intel) */
+         UINT32        header_size;      /* in bytes                     */
+         UINT32        frame_type;       /* flag for frame type */
+         UINT32        magic_number;     /* to be used as a flag - 
+                                            usually  to indicate new file */
+         UINT32        compression_type; /* type of image compression    */
+         UINT32        compression1;     /* compression parameter 1 */
+         UINT32        compression2;     /* compression parameter 2 */
+         UINT32        compression3;     /* compression parameter 3 */
+         UINT32        compression4;     /* compression parameter 4 */
+         UINT32        compression5;     /* compression parameter 4 */
+         UINT32        compression6;     /* compression parameter 4 */
+         UINT32        nheaders;         /* total number of headers      */
+         UINT32        nfast;            /* number of pixels in one line */
+         UINT32        nslow;            /* number of lines in image     */
+         UINT32        depth;            /* number of bytes per pixel    */
+         UINT32        record_length;    /* number of pixels between 
+                                            succesive rows */
+         UINT32        signif_bits;      /* true depth of data, in bits  */
+         UINT32        data_type;        /* (signed,unsigned,float...) */
+         UINT32        saturated_value;  /* value marks pixel as saturated */
+         UINT32        sequence;         /* TRUE or FALSE */
+         UINT32        nimages;          /* total number of images - size of 
+                                            each is nfast*(nslow/nimages) */
+         UINT32        origin;           /* corner of origin             */
+         UINT32        orientation;      /* direction of fast axis       */
+         UINT32        view_direction;   /* direction to view frame      */
+         UINT32        overflow_location;/* FOLLOWING_HEADER,  FOLLOWING_DATA */
+         UINT32        over_8_bits;      /* # of pixels with counts  255 */
+         UINT32        over_16_bits;     /* # of pixels with count  65535 */
+         UINT32        multiplexed;      /* multiplex flag */
+         UINT32        nfastimages;      /* # of images in fast direction */
+         UINT32        nslowimages;      /* # of images in slow direction */
+         UINT32        background_applied;/* flags correction has been applied 
+                                              hold magic number ? */
+         UINT32        bias_applied;     /* flags correction has been applied
+                                             hold magic number ? */
+         UINT32        flatfield_applied;/* flags correction has been applied -
+                                              hold magic number ? */
+         UINT32        distortion_applied;/*flags correction has been applied - 
+                                              hold magic number ? */
+         UINT32        original_header_type;    /* Header/frame type from  file 
+                                                    that frame is read from */
+         UINT32        file_saved;         /* Flag that file has been  saved, 
+                                              should be zeroed if modified */
+         char reserve1[(64-40)*sizeof(INT32)-16];
+
+         /* Data statistics (128) */
+         UINT32        total_counts[2];  /* 64 bit integer range = 1.85E19*/
+         UINT32        special_counts1[2];
+         UINT32        special_counts2[2];
+         UINT32        min;
+         UINT32        max;
+         UINT32        mean;
+         UINT32        rms;
+         UINT32        p10;
+         UINT32        p90;
+         UINT32        stats_uptodate;
+         UINT32        pixel_noise[MAXIMAGES]; /*1000*base noise value (ADUs) */
+         char reserve2[(32-13-MAXIMAGES)*sizeof(INT32)];
+
+         /* More statistics (256) */
+         UINT16 percentile[128];
+
+
+         /* Goniostat parameters (128 bytes) */
+         INT32 xtal_to_detector;  /* 1000*distance in millimeters */
+         INT32 beam_x;            /* 1000*x beam position (pixels) */
+         INT32 beam_y;            /* 1000*y beam position (pixels) */
+         INT32 integration_time;  /* integration time in  milliseconds */
+         INT32 exposure_time;     /* exposure time in milliseconds */
+         INT32 readout_time;      /* readout time in milliseconds */
+         INT32 nreads;            /* number of readouts to get this  image */
+         INT32 start_twotheta;    /* 1000*two_theta angle */
+         INT32 start_omega;       /* 1000*omega angle */
+         INT32 start_chi;         /* 1000*chi angle */
+         INT32 start_kappa;       /* 1000*kappa angle */
+         INT32 start_phi;         /* 1000*phi angle */
+         INT32 start_delta;       /* 1000*delta angle */
+         INT32 start_gamma;       /* 1000*gamma angle */
+         INT32 start_xtal_to_detector; /* 1000*distance in mm (dist in um)*/
+         INT32 end_twotheta;           /* 1000*two_theta angle */
+         INT32 end_omega;              /* 1000*omega angle */
+         INT32 end_chi;                /* 1000*chi angle */
+         INT32 end_kappa;              /* 1000*kappa angle */
+         INT32 end_phi;                /* 1000*phi angle */
+         INT32 end_delta;              /* 1000*delta angle */
+         INT32 end_gamma;              /* 1000*gamma angle */
+         INT32 end_xtal_to_detector;   /* 1000*distance in mm (dist in um)*/
+         INT32 rotation_axis;          /* active rotation axis */
+         INT32 rotation_range;         /* 1000*rotation angle */
+         INT32 detector_rotx;          /* 1000*rotation of detector  around X */
+         INT32 detector_roty;          /* 1000*rotation of detector  around Y */
+         INT32 detector_rotz;          /* 1000*rotation of detector  around Z */
+         char reserve3[(32-28)*sizeof(INT32)];
+
+         /* Detector parameters (128 bytes) */
+         INT32 detector_type;            /* detector type */
+         INT32 pixelsize_x;              /* pixel size (nanometers) */
+         INT32 pixelsize_y;              /* pixel size (nanometers) */
+         INT32 mean_bias;                        /* 1000*mean bias value */
+         INT32 photons_per_100adu;       /* photons / 100 ADUs */
+         INT32 measured_bias[MAXIMAGES];/* 1000*mean bias value for each image*/
+         INT32 measured_temperature[MAXIMAGES];  /* Temperature of each  
+                                                    detector in milliKelvins */
+         INT32 measured_pressure[MAXIMAGES]; /* Pressure of each  chamber 
+                                               in microTorr */
+         /* Retired reserve4 when MAXIMAGES set to 9 from 16 and 
+            two fields removed, and temp and pressure added
+          char reserve4[(32-(5+3*MAXIMAGES))*sizeof(INT32)]
+         */
+
+         /* X-ray source and optics parameters (128 bytes) */
+         /* X-ray source parameters (8*4 bytes) */
+         INT32 source_type;              /* (code) - target, synch. etc */
+         INT32 source_dx;                /* Optics param. - (size  microns) */
+         INT32 source_dy;                /* Optics param. - (size  microns) */
+         INT32 source_wavelength;        /* wavelength  (femtoMeters) */
+         INT32 source_power;             /* (Watts) */
+         INT32 source_voltage;           /* (Volts) */
+         INT32 source_current;           /* (microAmps) */
+         INT32 source_bias;              /* (Volts) */
+         INT32 source_polarization_x;    /* () */
+         INT32 source_polarization_y;    /* () */
+         char reserve_source[4*sizeof(INT32)];
+
+         /* X-ray optics_parameters (8*4 bytes) */
+         INT32 optics_type;              /* Optics type (code)*/
+         INT32 optics_dx;                /* Optics param. - (size  microns) */
+         INT32 optics_dy;                /* Optics param. - (size  microns) */
+         INT32 optics_wavelength;        /* Optics param. - (size  microns) */
+         INT32 optics_dispersion;        /* Optics param. - (*10E6) */
+         INT32 optics_crossfire_x;       /* Optics param. - (microRadians) */
+         INT32 optics_crossfire_y;       /* Optics param. - (microRadians) */
+         INT32 optics_angle;             /* Optics param. - (monoch.  
+                                                    2theta - microradians) */
+         INT32 optics_polarization_x;    /* () */
+         INT32 optics_polarization_y;    /* () */
+         char reserve_optics[4*sizeof(INT32)];
+
+         char reserve5[((32-28)*sizeof(INT32))];
+
+         /* File parameters (1024 bytes) */
+         char filetitle[128];            /*  Title                  */
+         char filepath[128];             /* path name for data  file  */
+         char filename[64];              /* name of data  file  */
+         char acquire_timestamp[32];     /* date and time of  acquisition */
+         char header_timestamp[32];      /* date and time of header  update  */
+         char save_timestamp[32];        /* date and time file  saved */
+         char file_comments[512];        /* comments, use as desired   */
+         char reserve6[1024-(128+128+64+(3*32)+512)];
+
+         /* Dataset parameters (512 bytes) */
+         char dataset_comments[512];     /* comments, used as desired   */
+         /* pad out to  3072 bytes */
+         char pad[3072-(256+128+256+(3*128)+1024+512)];     
+
+         } frame_header;
+"""
+
+import struct
+
+# Convert mar c header file types to python struct module types
+C_TO_STRUCT = {
+    "INT32"  : "i",
+    "UINT32" : "I",
+    "char"   : "c",
+    "UINT16" : "H"
+    }
+
+# Sizes (bytes) of mar c header objects
+C_SIZES = {
+    "INT32"  : 4,
+    "UINT32" : 4,
+    "char"   : 1,
+    "UINT16" : 2
+    }
+
+# This was worked out by trial and error from a trial image I think
+MAXIMAGES = 9
+
+
+def make_format(c_def_string):
+    """
+    Reads the header definition in c and makes the format 
+    string to pass to struct.unpack
+    """
+    lines = c_def_string.split("\n")
+    fmt = ""
+    names = []
+    expected = 0
+    for line in lines:
+        if line.find(";") == -1:
+            continue
+        decl = line.split(";")[0].lstrip().rstrip()
+        try:
+            [typ, name] = decl.split()
+        except ValueError:
+            logger.debug("skipping: %s" , line)
+            continue
+
+        if name.find("[") > -1:
+            # repeated ... times
+            try:
+                num = name.split("[")[1].split("]")[0]
+                num = num.replace("MAXIMAGES", str(MAXIMAGES))
+                num = num.replace("sizeof(INT32)", "4")
+                times = eval(num)
+            except Exception, error:
+                logger.error("%s Please decode %s", error, decl)
+                raise error
+        else:
+            times = 1
+        try:
+            fmt += C_TO_STRUCT[typ] * times
+            names += [name] * times
+            expected += C_SIZES[typ] * times
+        except KeyError:
+            continue
+    return names, fmt
+
+# Make these be compiled on loading module
+HEADER_NAMES, HEADER_FORMAT = make_format(CDEFINITION)
+
+def interpret_header(header, fmt, names):
+    """
+    given a format and header interpret it
+    """
+    values = struct.unpack(fmt, header)
+    hdr = {}
+    i = 0
+    for name in names:
+        if hdr.has_key(name):
+            if type(values[i]) == type("string"):
+                hdr[name] = hdr[name] + values[i]
+            else:
+                try:
+                    hdr[name].append(values[i])
+                except AttributeError:
+                    hdr[name] = [hdr[name], values[i]]
+        else:
+            hdr[name] = values[i]
+        i = i + 1
+
+    return hdr
+
+
+class marccdimage(tifimage):
+    """ Read in data in mar ccd format, also 
+        MarMosaic images, including header info """
+
+
+    def _readheader(self, infile):
+        """
+        Parser based approach
+        Gets all entries
+        """
+        infile.seek(1024)
+        hstr = infile.read(3072)
+        self.header = interpret_header(hstr, HEADER_FORMAT, HEADER_NAMES)
+
+
+
+    def _read(self, fname):
+        """
+        inherited from tifimage
+        ... a marccd image *is a* tif image
+        just with a header
+        """
+        return tifimage.read(self, fname)
diff --git a/fabio/openimage.py b/fabio/openimage.py
new file mode 100644
index 0000000..4e62bd0
--- /dev/null
+++ b/fabio/openimage.py
@@ -0,0 +1,150 @@
+"""
+
+Authors: Henning O. Sorensen & Erik Knudsen
+         Center for Fundamental Research: Metal Structures in Four Dimensions
+         Risoe National Laboratory
+         Frederiksborgvej 399
+         DK-4000 Roskilde
+         email:henning.sorensen at risoe.dk
+
+mods for fabio by JPW
+
+"""
+import sys, logging
+logger = logging.getLogger("openimage")
+from fabioutils  import deconstruct_filename, getnum, filename_object
+from fabioimage import fabioimage
+import edfimage
+import adscimage
+import tifimage
+import marccdimage
+import mar345image
+import fit2dmaskimage
+import brukerimage
+import bruker100image
+import pnmimage
+import GEimage
+import OXDimage
+import dm3image
+import HiPiCimage
+import pilatusimage
+import fit2dspreadsheetimage
+import kcdimage
+import cbfimage
+import xsdimage
+
+MAGIC_NUMBERS = [
+    # "\42\5a" : 'bzipped'
+    # "\1f\8b" : 'gzipped'
+    ("FORMAT :        86" , 'bruker'),
+    ("\x4d\x4d\x00\x2a"   , 'tif') ,
+    # The marCCD and Pilatus formats are both standard tif with a header
+    # hopefully these byte patterns are unique for the formats
+    # If not the image will be read, but the is missing 
+    ("\x49\x49\x2a\x00\x08\x00"   , 'marccd') ,
+    ("\x49\x49\x2a\x00\x82\x00"   , 'pilatus') ,
+    ("\x49\x49\x2a\x00"   , 'tif') ,
+    # ADSC must come before edf
+    ("{\nHEA"             , 'adsc'),
+    ("{"                  , 'edf'),
+    ("\r{"                , 'edf'),
+    ("\n{"                , 'edf'),
+    ("ADEPT"              , 'GE'),
+    ("OD"                 , 'OXD'),
+    ("IM"                 , 'HiPiC'),
+    ('\x2d\x04'           , 'mar345'),
+    ('\x04\x2d'           , 'mar345'), #some machines may need byteswapping
+    # hint : MASK in 32 bit
+    ('M\x00\x00\x00A\x00\x00\x00S\x00\x00\x00K\x00\x00\x00' , 'fit2dmask') ,
+    ('\x00\x00\x00\x03'   , 'dm3'),
+    ("No"                 , "kcd"),
+    ("<"                  , "xsd")
+    ]
+
+def do_magic(byts):
+    """ Try to interpret the bytes starting the file as a magic number """
+    for magic, format in MAGIC_NUMBERS:
+        if byts.find(magic) == 0:
+            return format
+        if 0: # debugging - bruker needed 18 bytes below
+            logger.debug("m: %s f: %s", magic, format)
+            logger.debug("bytes: %s len(bytes) %s", magic, len(magic))
+            logger.debug("found: %s", byts.find(magic))
+            for i in range(len(magic)):
+                logger.debug("%s %s %s %s ", ord(magic[i]), ord(byts[i]), magic[i], byts[i])
+    raise Exception("Could not interpret magic string")
+
+
+def openimage(filename):
+    """ Try to open an image """
+    if isinstance(filename, filename_object):
+        try:
+            obj = _openimage(filename.tostring())
+            obj.read(filename.tostring())
+        except:
+            # multiframe file
+            #logger.debug( "DEBUG: multiframe file, start # %d"%(
+            #    filename.num)
+            obj = _openimage(filename.stem)
+            obj.read(filename.stem, frame=filename.num)
+    else:
+        obj = _openimage(filename)
+        obj.read(filename)
+    return obj
+
+
+def openheader(filename):
+    """ return only the header"""
+    obj = _openimage(filename)
+    obj.readheader(filename)
+    return obj
+
+
+def _openimage(filename):
+    """ 
+    determine which format for a filename
+    and return appropriate class which can be used for opening the image
+    """
+    try:
+        imo = fabioimage()
+        byts = imo._open(filename).read(18)
+        filetype = do_magic(byts)
+        if filetype == "marccd" and filename.find("mccd") == -1:
+            # Cannot see a way around this. Need to find something
+            # to distinguish mccd from regular tif...
+            filetype = "tif"
+    except IOError, error:
+        logger.error("%s: File probably does not exist", error)
+        raise error
+    except:
+        try:
+            file_obj = deconstruct_filename(filename)
+            if file_obj == None:
+                raise Exception
+            if len(file_obj.format) != 1 and \
+                    type(file_obj.format) != type(["list"]):
+                # one of OXD/ ADSC - should have got in previous
+                raise Exception("openimage failed on magic bytes & name guess")
+            filetype = file_obj.format
+            #UNUSED filenumber = file_obj.num
+        except:
+            #import traceback
+            #traceback.print_exc()
+            raise Exception("Fabio could not identify " + filename)
+    klass_name = "".join(filetype) + 'image'
+    module = sys.modules.get("fabio." + klass_name, None)
+    if module is not None:
+        if hasattr(module, klass_name):
+            klass = getattr(module, klass_name)
+        else:
+            raise Exception("Module %s has no image class" % module)
+    else:
+        raise Exception("Filetype not known %s %s" % (filename, klass_name))
+    obj = klass()
+    # skip the read for read header
+    return obj
+
+
+
+
+
diff --git a/fabio/pilatusimage.py b/fabio/pilatusimage.py
new file mode 100644
index 0000000..f110dec
--- /dev/null
+++ b/fabio/pilatusimage.py
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+"""
+
+Authors: Henning O. Sorensen & Erik Knudsen
+         Center for Fundamental Research: Metal Structures in Four Dimensions
+         Risoe National Laboratory
+         Frederiksborgvej 399
+         DK-4000 Roskilde
+         email:henning.sorensen at risoe.dk
+
+         + (mods for fabio) Jon Wright, ESRF
+marccdimage can read MarCCD and MarMosaic images including header info.
+
+JPW : Use a parser in case of typos (sorry?)
+
+"""
+
+
+# Base this on the tifimage (as Pilatus is tiff with a 
+# tiff header 
+
+from fabio.tifimage import tifimage
+
+
+class pilatusimage(tifimage):
+    """ Read in Pilatus format, also 
+        pilatus images, including header info """
+
+
+    def _readheader(self, infile):
+        """
+        Parser based approach
+        Gets all entries
+        """
+
+        self.header = {}
+
+#        infile = open(infile)
+        hstr = infile.read(4096)
+        # well not very pretty - but seems to find start of 
+        # header information
+        if (hstr.find('# ') == -1):
+            return self.header
+
+        hstr = hstr[hstr.index('# '):]
+        hstr = hstr[:hstr.index('\x00')]
+        hstr = hstr.split('#')
+        go_on = True
+        while go_on:
+            try:
+                hstr.remove('')
+            except:
+                go_on = False
+
+
+
+        for line in hstr:
+            line = line[1:line.index('\r\n')]
+            if line.find(':') > -1:
+                dump = line.split(':')
+                self.header[dump[0]] = dump[1]
+            elif line.find('=') > -1:
+                dump = line.split('=')
+                self.header[dump[0]] = dump[1]
+            elif line.find(' ') > -1:
+                i = line.find(' ')
+                self.header[line[:i]] = line[i:]
+            elif line.find(',') > -1:
+                dump = line.split(',')
+                self.header[dump[0]] = dump[1]
+
+        return self.header
+
+
+
+    def _read(self, fname):
+        """
+        inherited from tifimage
+        ... a Pilatus image *is a* tif image
+        just with a header
+        """
+        return tifimage.read(self, fname)
diff --git a/fabio/pnmimage.py b/fabio/pnmimage.py
new file mode 100644
index 0000000..ca17ecf
--- /dev/null
+++ b/fabio/pnmimage.py
@@ -0,0 +1,141 @@
+## Automatically adapted for numpy.oldnumeric Oct 05, 2007 by alter_code1.py
+
+#!/usr/bin/env python
+"""
+
+Authors: Henning O. Sorensen & Erik Knudsen
+         Center for Fundamental Research: Metal Structures in Four Dimensions
+         Risoe National Laboratory
+         Frederiksborgvej 399
+         DK-4000 Roskilde
+         email:henning.sorensen at risoe.dk
+
+"""
+
+import numpy, logging
+logger = logging.getLogger("pnmimage")
+from fabioimage import fabioimage
+
+SUBFORMATS = ['P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7']
+
+HEADERITEMS = ['SUBFORMAT', 'DIMENSIONS', 'MAXVAL']
+P7HEADERITEMS = ['WIDTH', 'HEIGHT', 'DEPTH', 'MAXVAL', 'TUPLTYPE', 'ENDHDR']
+
+class pnmimage(fabioimage):
+    def __init__(self, *arg, **kwargs):
+        fabioimage.__init__(self, *arg, **kwargs)
+        fun = getattr(fabioimage, '__init__', lambda x: None)
+        fun(self)
+        self.data = None
+        self.header = {'Subformat':'P5'}
+        self.dim1 = self.dim2 = 0
+        self.m = self.maxval = self.stddev = self.minval = None
+        self.header_keys = self.header.keys()
+        self.bytecode = None
+
+    def _readheader(self, f):
+        #pnm images have a 3-line header but ignore lines starting with '#'
+        #1st line contains the pnm image sub format
+        #2nd line contains the image pixel dimension
+        #3rd line contains the maximum pixel value (at least for grayscale - check this)
+        self.header_keys = ['SUBFORMAT', 'DIMENSIONS', 'MAXVAL']
+
+        l = f.readline().strip()
+        if l not in SUBFORMATS:
+            raise IOError, ('unknown subformat of pnm: %s' % l)
+        else:
+            self.header['SUBFORMAT'] = l
+
+        if self.header['SUBFORMAT'] == 'P7':
+            self.header_keys = P7HEADERITEMS
+            #this one has a special header
+            while 'ENDHDR' not in l:
+                l = f.readline()
+                while(l[0] == '#'): l = f.readline()
+                s = l.lsplit(' ', 1)
+                if s[0] not in P7HEADERITEMS:
+                    raise IOError, ('Illegal pam (netpnm p7) headeritem %s' % s[0])
+                self.header[s[0]] = s[1]
+        else:
+            self.header_keys = HEADERITEMS
+            for k in self.header_keys[1:]:
+                l = f.readline()
+                while(l[0] == '#'): l = f.readline()
+                self.header[k] = l.strip()
+
+        #set the dimensions
+        dims = (self.header['DIMENSIONS'].split())
+        self.dim1, self.dim2 = int(dims[0]), int(dims[1])
+        #figure out how many bytes are used to store the data
+        #case construct here!
+        m = int(self.header['MAXVAL'])
+        if m < 256:
+            self.bytecode = numpy.uint8
+        elif m < 65536:
+            self.bytecode = numpy.uint16
+        elif m < 2147483648L:
+            self.bytecode = numpy.uint32
+            logger.warning('32-bit pixels are not really supported by the netpgm standard')
+        else:
+            raise IOError, 'could not figure out what kind of pixels you have'
+
+    def read(self, fname, verbose=0):
+        self.header = {}
+        self.resetvals()
+        infile = self._open(fname)
+        self._readheader(infile)
+
+        #read the image data
+        try:
+            #let the Subformat header field pick the right decoder
+            self.data = eval('self.' + self.header['SUBFORMAT'] + 'dec(infile,self.bytecode)')
+        except ValueError:
+            raise IOError
+        self.resetvals()
+        return self
+
+    def P1dec(self, buf, bytecode):
+        data = numpy.zeros((self.dim2, self.dim1))
+        i = 0
+        for l in buf.readlines():
+            try:
+                data[i, :] = numpy.array(l.split()).astype(bytecode)
+            except ValueError:
+                raise IOError, 'Size spec in pnm-header does not match size of image data field'
+        return data
+
+    def P4dec(self, buf, bytecode):
+        logger.warning('single bit (pbm) images are not supported - yet')
+
+    def P2dec(self, buf, bytecode):
+        data = numpy.zeros((self.dim2, self.dim1))
+        i = 0
+        for l in buf.readlines():
+            try:
+                data[i, :] = numpy.array(l.split()).astype(bytecode)
+            except ValueError:
+                raise IOError, 'Size spec in pnm-header does not match size of image data field'
+        return data
+
+    def P5dec(self, buf, bytecode):
+        l = buf.read()
+        try:
+            data = numpy.reshape(numpy.fromstring(l, bytecode), [self.dim2, self.dim1]).byteswap()
+        except ValueError:
+            raise IOError, 'Size spec in pnm-header does not match size of image data field'
+        return data
+
+    def P3dec(self, buf, bytecode):
+        #decode (plain-ppm) rgb image
+        pass
+
+    def P6dec(self, buf, bytecode):
+        #decode (ppm) rgb image
+        pass
+
+    def P7dec(self, buf, bytecode):
+        #decode pam images, i.e. call one of the other decoders
+        pass
+
+    def write(self, filename):
+        logger.warning('write pnm images is not implemented yet.')
diff --git a/fabio/readbytestream.py b/fabio/readbytestream.py
new file mode 100644
index 0000000..2ad7dc2
--- /dev/null
+++ b/fabio/readbytestream.py
@@ -0,0 +1,87 @@
+## Automatically adapted for numpy.oldnumeric Oct 05, 2007 by alter_code1.py
+
+
+
+"""
+Reads a bytestream
+
+Authors: Jon Wright    Henning O. Sorensen & Erik Knudsen
+         ESRF          Risoe National Laboratory
+"""
+
+import numpy, logging
+logger = logging.getLogger("readbytestream")
+DATATYPES = {
+    # type  sign bytes
+    ("int", 'n', 1) : numpy.uint8,
+    ("int", 'n', 2) : numpy.uint16,
+    ("int", 'n', 4) : numpy.uint32,
+    ("int", 'y', 1) : numpy.int8,
+    ("int", 'y', 2) : numpy.int16,
+    ("int", 'y', 4) : numpy.int32,
+    ('float', 'y', 4) : numpy.float32, # does this occur in bruker?
+    ('double', 'y', 4): numpy.float64
+    }
+
+
+def readbytestream(fil,
+                   offset,
+                   x,
+                   y,
+                   nbytespp,
+                   datatype='int',
+                   signed='n',
+                   swap='n',
+                   typeout=numpy.uint16):
+    """
+    Reads in a bytestream from a file (which may be a string indicating
+    a filename, or an already opened file (should be "rb"))
+    offset is the position (in bytes) where the pixel data start
+    nbytespp = number of bytes per pixel
+    type can be int or float (4 bytes pp) or double (8 bytes pp)
+    signed: normally signed data 'y', but 'n' to try to get back the 
+    right numbers when unsigned data are converted to signed 
+    (python once had no unsigned numeric types.)
+    swap, normally do not bother, but 'y' to swap bytes
+    typeout is the numpy type to output, normally uint16, 
+    but more if overflows occurred
+    x and y are the pixel dimensions
+    
+    TODO : Read in regions of interest
+    
+    PLEASE LEAVE THE STRANGE INTERFACE ALONE - 
+    IT IS USEFUL FOR THE BRUKER FORMAT
+    """
+    tin = "dunno"
+    length = nbytespp * x * y # bytes per pixel times number of pixels
+    if datatype in ['float', 'double']:
+        signed = 'y'
+
+    key = (datatype, signed, nbytespp)
+    try:
+        tin = DATATYPES[key]
+    except:
+        logging.warning("datatype,signed,nbytespp " + str(key))
+        raise Exception("Unknown combination of types to readbytestream")
+
+    # Did we get a string (filename) or a readable stream object?
+    if hasattr(fil, "read") and hasattr(fil, "seek"):
+        infile = fil
+        opened = False
+    else:
+        infile = open(fil, 'rb')
+        opened = True
+
+    infile.seek(offset)
+
+    arr = numpy.array(numpy.reshape(
+            numpy.fromstring(
+                infile.read(length), tin) , (x, y)), typeout)
+
+    if swap == 'y':
+        arr = arr.byteswap()
+
+    if opened:
+        infile.close()
+
+    return arr
diff --git a/fabio/tifimage.py b/fabio/tifimage.py
new file mode 100644
index 0000000..e506c4a
--- /dev/null
+++ b/fabio/tifimage.py
@@ -0,0 +1,266 @@
+#!/usr/bin/env python
+#-*- coding: utf8 -*-
+"""
+FabIO class for dealing with TIFF images. 
+In facts wraps TiffIO from Armando (available in PyMca) or falls back to PIL
+
+Authors: Jérôme Kieffer (jerome.kieffer at esrf.fr)
+         Henning O. Sorensen & Erik Knudsen
+             Center for Fundamental Research: Metal Structures in Four Dimensions
+             Risoe National Laboratory
+             Frederiksborgvej 399
+             DK-4000 Roskilde
+             email:henning.sorensen at risoe.dk    
+License: GPLv3+        
+"""
+__authors__ = ["Jérôme Kieffer", "Henning O. Sorensen", "Erik Knudsen"]
+__date__ = "11/07/2011"
+__license__ = "GPLv3+"
+__copyright__ = "ESRF, Grenoble & Risoe National Laboratory"
+
+import time, logging, struct
+logger = logging.getLogger("tifimage")
+import Image
+import numpy
+from fabioimage import fabioimage
+from TiffIO     import TiffIO
+
+PIL_TO_NUMPY = { "I;16": numpy.uint16,
+                   "F": numpy.float32,
+                   "1": numpy.bool,
+                   "I": numpy.int32,
+                   "L": numpy.uint8,
+                    }
+
+LITTLE_ENDIAN = 1234
+BIG_ENDIAN = 3412
+
+TYPES = {0:'invalid', 1:'byte', 2:'ascii', 3:'short', 4:'long', 5:'rational', 6:'sbyte', 7:'undefined', 8:'sshort', 9:'slong', 10:'srational', 11:'float', 12:'double'}
+
+TYPESIZES = {0:0, 1:1, 2:1, 3:2, 4:4, 5:8, 6:1, 7:1, 8:2, 9:4, 10:8, 11:4, 12:8}
+
+baseline_tiff_tags = {
+  256:'ImageWidth',
+  257:'ImageLength',
+  296:'ResolutionUnit',
+  306:'DateTime',
+  315:'Artist',
+  258:'BitsPerSample',
+  265:'CellLength',
+  264:'CellWidth',
+  259:'Compression',
+
+  262:'PhotometricInterpretation',
+  296:'ResolutionUnit',
+  282:'XResolution',
+  283:'YResolution',
+
+  278:'RowsPerStrip',
+  273:'StripOffset',
+  279:'StripByteCounts',
+
+  270:'ImageDescription',
+  271:'Make',
+  272:'Model',
+  320:'ColorMap',
+  305:'Software',
+  339:'SampleFormat',
+  33432:'Copyright'
+  }
+
+class tifimage(fabioimage):
+    """
+    Images in TIF format
+    Wraps TiffIO
+    """
+    _need_a_seek_to_read = True
+
+    def __init__(self, *args, **kwds):
+        """ Tifimage constructor adds an nbits member attribute """
+        self.nbits = None
+        fabioimage.__init__(self, *args, **kwds)
+        self.lib = None
+
+    def _readheader(self, infile):
+        """
+        Try to read Tiff images header...
+        """
+#        try:
+#            self.header = { "filename" : infile.name }
+#        except AttributeError:
+#            self.header = {}
+#
+#        t = Tiff_header(infile.read())
+#        self.header = t.header
+#        try:
+#            self.dim1 = int(self.header['ImageWidth'])
+#            self.dim2 = int(self.header['ImageLength'])
+#        except (KeyError):
+#            logger.warning("image dimensions could not be determined from header tags, trying to go on anyway")
+#         read the first 32 bytes to determine size
+        header = numpy.fromstring(infile.read(64), numpy.uint16)
+        self.dim1 = int(header[9])
+        self.dim2 = int(header[15])
+#         nbits is not a fabioimage attribute...
+        self.nbits = int(header[21]) # number of bits
+
+    def read(self, fname):
+        """
+        Wrapper for TiffIO.
+        """
+        infile = self._open(fname, "rb")
+        self._readheader(infile)
+        infile.seek(0)
+        tiffIO = TiffIO(infile)
+        if tiffIO.getNumberOfImages() > 0:
+            try:
+                self.data = tiffIO.getImage(0)
+            except IOError:
+                logger.warning("Unable to read %s with TiffIO" % fname)
+            else:
+                infile.seek(0)
+                self.lib = "TiffIO"
+                self.header = tiffIO.getInfo(0)
+                self.dim2, self.dim1 = self.data.shape
+        if self.lib is None:
+            try:
+                infile.seek(0)
+                self.pilimage = Image.open(infile)
+            except:
+                logger.error("Error in opening %s  with PIL" % fname)
+                self.lib = None
+                infile.seek(0)
+            else:
+                self.dim1, self.dim2 = self.pilimage.size
+                if self.pilimage.mode in PIL_TO_NUMPY:
+                    self.data = numpy.fromstring(self.pilimage.tostring(), PIL_TO_NUMPY[self.pilimage.mode])
+                else: #probably RGB or RGBA images: rely on PIL to convert it to greyscale float.
+                    self.data = numpy.fromstring(self.pilimage.convert("F").tostring(), numpy.float32)
+                self.data.shape = (self.dim2, self.dim1)
+
+        self.bpp = len(numpy.zeros(1, dtype=self.data.dtype).tostring())
+        self.bytecode = self.data.dtype.name
+        self.resetvals()
+        return self
+
+    def write(self, fname):
+        """
+        Overrides the fabioimage.write method and provides a simple TIFF image writer.
+        @param fname: name of the file to save the image to
+        @tag_type fname: string or unicode (file?)...
+        """
+        tiffIO = TiffIO(fname, mode="w")
+        tiffIO.writeImage(self.data, info=self.header, software="fabio.tifimage", date=time.ctime())
+
+
+
+#define a couple of helper classes here:         
+class Tiff_header(object):
+    def __init__(self, string):
+        if string[:4] == "II\x2a\x00":
+            self.byteorder = LITTLE_ENDIAN
+        elif string[:4] == 'MM\x00\x2a':
+            self.byteorder = BIG_ENDIAN
+        else:
+            logger.warning("Warning: This does not appear to be a tiff file")
+        #the next two bytes contains the offset of the oth IFD
+        offset_first_ifd = struct.unpack_from("h", string[4:])[0]
+        self.ifd = [Image_File_Directory()]
+        offset_next = self.ifd[0].unpack(string, offset_first_ifd)
+        while (offset_next != 0):
+            self.ifd.append(Image_File_Directory())
+            offset_next = self.ifd[-1].unpack(string, offset_next)
+
+        self.header = {}
+        #read the values of the header items into a dictionary
+        for entry in self.ifd[0].entries:
+            if entry.tag in baseline_tiff_tags.keys():
+                self.header[baseline_tiff_tags[entry.tag]] = entry.val
+            else:
+                self.header[entry.tag] = entry.val
+
+class Image_File_Directory(object):
+    def __init__(self, instring=None, offset= -1):
+        self.entries = []
+        self.offset = offset
+        self.count = None
+
+    def unpack(self, instring, offset= -1):
+        if (offset == -1): offset = self.offset
+
+        strInput = instring[offset:]
+        self.count = struct.unpack_from("H", strInput[:2])[0]
+        #0th IFD contains count-1 entries (count includes the adress of the next IFD)
+        for i in range(self.count - 1):
+            e = Image_File_Directory_entry().unpack(strInput[2 + 12 * (i + 1):])
+            if (e != None):
+                self.entries.append(e)
+            #extract data associated with tags
+            for e in self.entries:
+                if (e.val == None):
+                    e.extract_data(instring)
+        #do we have some more ifds in this file 
+        offset_next = struct.unpack_from("L", instring[offset + 2 + self.count * 12:])[0]
+        return offset_next
+
+class Image_File_Directory_entry(object):
+    def __init__(self, tag=0, tag_type=0, count=0, offset=0):
+        self.tag = tag
+        self.tag_type = tag_type
+        self.count = count
+        self.val_offset = offset
+        self.val = None
+
+    def unpack(self, strInput):
+        idfentry = strInput[:12]
+################################################################################
+# #        TOFIX: How is it possible that HHL (2+2+4 bytes has a size of )
+################################################################################
+        (tag, tag_type, count) = struct.unpack_from("HHL", idfentry)
+        self.tag = tag
+        self.count = count
+        self.tag_type = tag_type
+        self.val = None
+        if (count <= 0):
+            logger.warning("Tag # %s has an invalid count: %s. Tag is ignored" % (tag, count))
+            return
+        if(count * TYPESIZES[tag_type] <= 4):
+            self.val_offset = 8
+            self.extract_data(idfentry)
+            self.val_offset = None
+        else:
+            self.val_offset = struct.unpack_from("L", idfentry[8:])[0]
+        return self
+
+    def extract_data(self, full_string):
+        tag_type = self.tag_type
+        if (TYPES[tag_type] == 'byte'):
+            self.val = struct.unpack_from("B", full_string[self.val_offset:])[0]
+        elif (TYPES[tag_type] == 'short'):
+            self.val = struct.unpack_from("H", full_string[self.val_offset:])[0]
+        elif (TYPES[tag_type] == 'long'):
+            self.val = struct.unpack_from("L", full_string[self.val_offset:])[0]
+        elif (TYPES[tag_type] == 'sbyte'):
+            self.val = struct.unpack_from("b", full_string[self.val_offset:])[0]
+        elif (TYPES[tag_type] == 'sshort'):
+            self.val = struct.unpack_from("h", full_string[self.val_offset:])[0]
+        elif (TYPES[tag_type] == 'slong'):
+            self.val = struct.unpack_from("l", full_string[self.val_offset:])[0]
+        elif (TYPES[tag_type] == 'ascii'):
+            self.val = full_string[self.val_offset:self.val_offset + max(self.count, 4)]
+        elif (TYPES[tag_type] == 'rational'):
+            if self.val_offset != None:
+                (num, den) = struct.unpack_from("LL", full_string[self.val_offset:])
+                print self.val_offset
+                self.val = float(num) / den
+        elif (TYPES[tag_type] == 'srational'):
+            if self.val_offset != None:
+                (num, den) = struct.unpack_from("ll", full_string[self.val_offset:])
+                self.val = float(num) / den,
+        elif (TYPES[tag_type] == 'float'):
+            self.val = struct.unpack_from("f", full_string[self.val_offset:])[0]
+        elif (TYPES[tag_type] == 'double'):
+            if  self.val_offset != None:
+                self.val = struct.unpack_from("d", full_string[self.val_offset:])[0]
+        else:
+            logger.warning("unrecognized type of strInputentry self: %s tag: %s type: %s TYPE: %s" % (self, baseline_tiff_tags[self.tag], self.tag_type, TYPES[tag_type]))
diff --git a/fabio/xsdimage.py b/fabio/xsdimage.py
new file mode 100644
index 0000000..0af6b38
--- /dev/null
+++ b/fabio/xsdimage.py
@@ -0,0 +1,134 @@
+#!/usr/bin/env python
+# coding: utf8
+"""
+Authors: Jérôme Kieffer, ESRF 
+         email:jerome.kieffer at esrf.fr
+
+XSDimge are XML files containing numpy arrays 
+"""
+__author__ = "Jérôme Kieffer"
+__contact__ = "jerome.kieffer at esrf.eu"
+__license__ = "GPLv3+"
+__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
+
+import logging, numpy
+logger = logging.getLogger("xsdimage")
+from fabioimage import fabioimage
+import base64, hashlib
+try:
+    from lxml import etree
+except ImportError:
+    logger.warning("lxml library is probably not part of your python installation: disabling xsdimage format")
+    etree = None
+
+class xsdimage(fabioimage):
+    """ 
+    Read the XSDataImage XML File data format 
+    """
+    def __init__(self, data=None, header=None, fname=None):
+        """
+        Constructor of the class XSDataImage.
+
+        @param _strFilename: the name of the file to open
+        @type  _strFilename: string
+        """
+        fabioimage.__init__(self, data=data, header=header)
+        self.dims = []
+        self.size = None
+        self.coding = None
+        self.dtype = None
+        self.rawData = None
+        self.md5 = None
+        if fname is not None:
+            self.filename = fname
+            self.read(fname)
+
+    def read(self, fname):
+        """
+        """
+        self.header = {}
+        self.resetvals()
+        self.filename = fname
+        infile = self._open(fname, "rb")
+        self._readheader(infile)
+
+        try:
+            self.dim1, self.dim2 = self.dims[:2]
+        except:
+            raise IOError("XSD file %s is corrupt, no dimensions in it" % fname)
+        try:
+            self.bytecode = numpy.dtype(self.dtype).type
+            self.bpp = len(numpy.array(0, self.bytecode).tostring())
+        except TypeError:
+            self.bytecode = numpy.int32
+            self.bpp = 32
+            logger.warning("Defaulting type to int32")
+
+        exp_size = 1
+        for i in self.dims:
+            exp_size *= i
+        assert exp_size == self.size
+
+        decData = None
+        if self.coding == "base64":
+            decData = base64.b64decode(self.rawData)
+        elif self.coding == "base32":
+            decData = base64.b32decode(self.rawData)
+        elif self.coding == "base16":
+            decData = base64.b16decode(self.rawData)
+        else:
+            logger.warning("Unable to recognize the encoding of the data !!! got %s, expected base64, base32 or base16, I assume it is base64 " % self.coding)
+            decData = base64.b64decode(self.rawData)
+        if self.md5:
+            assert  hashlib.md5(decData).hexdigest() == self.md5
+
+
+        self.data = numpy.fromstring(decData, dtype=self.bytecode).reshape(tuple(self.dims))
+        if not numpy.little_endian: #by default little endian
+            self.data.byteswap(inplace=True)
+        self.resetvals()
+#        # ensure the PIL image is reset
+        self.pilimage = None
+        return self
+
+    def _readheader(self, infile):
+        """
+        Read all headers in a file and populate self.header
+        data is not yet populated
+        @type infile: file object open in read mode
+        """
+        xml = etree.parse(infile)
+        self.dims = []
+        for i in xml.xpath("//shape"):
+            try:
+                self.dims.append(int(i.text))
+            except ValueError, error:
+                logger.warning("%s Shape: Unable to convert %s to integer in %s" % (error, i.text, i))
+        for i in xml.xpath("//size"):
+            try:
+                self.size = int(i.text)
+            except Exception, error:#IGNORE:W0703
+                logger.warning("%s Size: Unable to convert %s to integer in %s" % (error, i.text, i))
+        self.dtype = None
+        for i in xml.xpath("//dtype"):
+            self.dtype = i.text
+        self.coding = None
+        for i in xml.xpath("//coding"):
+            j = i.find("value")
+            if j is not None:
+                self.coding = j.text
+        self.rawData = None
+        for i in xml.xpath("//data"):
+            self.rawData = i.text
+        self.md5 = None
+        for i in xml.xpath("//md5sum"):
+            j = i.find("value")
+            if j is not None:
+                self.md5 = j.text
+
+if etree is None:
+    xsdimage = None
+
+
+
+
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..be14ac0
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+#coding: utf8
+
+"""
+Setup script for python distutils package and fabio
+
+Added Erik Knudsen's mar 345 code
+"""
+try:
+    from setuptools import setup
+except ImportError:
+    from distutils.core import setup
+
+from distutils.core import  Extension
+
+
+# for numpy
+from numpy.distutils.misc_util import get_numpy_include_dirs
+
+
+
+mar345_backend = Extension('mar345_io',
+                           include_dirs=get_numpy_include_dirs(),
+                           sources=['src/mar345_iomodule.c',
+                                      'src/ccp4_pack.c'])
+
+cf_backend = Extension('cf_io', include_dirs=get_numpy_include_dirs(),
+      sources=['src/cf_iomodule.c', 'src/columnfile.c'])
+
+byteOffset_backend = Extension("byte_offset",
+                       include_dirs=get_numpy_include_dirs(),
+                           sources=['src/byte_offset.c'])
+
+# See the distutils docs...
+setup(name='fabio',
+      version="0.0.8",
+      author="Henning Sorensen, Erik Knudsen, Jon Wright, Régis Perdreau and Jérôme Kieffer",
+      author_email="fable-talk at lists.sourceforge.net",
+      description='Image IO for fable',
+      url="http://fable.wiki.sourceforge.net/fabio",
+      download_url="http://sourceforge.net/projects/fable/files/fabio/0.0.8",
+      ext_package="fabio",
+#      cmdclass = {'build_ext': build_ext},
+      ext_modules=[mar345_backend, cf_backend, byteOffset_backend ],
+      packages=["fabio"],
+      package_dir={"fabio": "fabio" }
+      )
+
+
diff --git a/src/byte_offset.c b/src/byte_offset.c
new file mode 100644
index 0000000..705ec47
--- /dev/null
+++ b/src/byte_offset.c
@@ -0,0 +1,5612 @@
+/* Generated by Cython 0.14 on Wed Dec 15 09:33:51 2010 */
+
+#define PY_SSIZE_T_CLEAN
+#include "Python.h"
+#ifndef Py_PYTHON_H
+    #error Python headers needed to compile C extensions, please install development version of Python.
+#else
+
+#include <stddef.h> /* For offsetof */
+#ifndef offsetof
+#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+  #ifndef __stdcall
+    #define __stdcall
+  #endif
+  #ifndef __cdecl
+    #define __cdecl
+  #endif
+  #ifndef __fastcall
+    #define __fastcall
+  #endif
+#endif
+
+#ifndef DL_IMPORT
+  #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+  #define DL_EXPORT(t) t
+#endif
+
+#ifndef PY_LONG_LONG
+  #define PY_LONG_LONG LONG_LONG
+#endif
+
+#if PY_VERSION_HEX < 0x02040000
+  #define METH_COEXIST 0
+  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
+  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
+#endif
+
+#if PY_VERSION_HEX < 0x02050000
+  typedef int Py_ssize_t;
+  #define PY_SSIZE_T_MAX INT_MAX
+  #define PY_SSIZE_T_MIN INT_MIN
+  #define PY_FORMAT_SIZE_T ""
+  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
+  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
+  #define PyNumber_Index(o)    PyNumber_Int(o)
+  #define PyIndex_Check(o)     PyNumber_Check(o)
+  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
+#endif
+
+#if PY_VERSION_HEX < 0x02060000
+  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
+  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
+  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
+  #define PyVarObject_HEAD_INIT(type, size) \
+          PyObject_HEAD_INIT(type) size,
+  #define PyType_Modified(t)
+
+  typedef struct {
+     void *buf;
+     PyObject *obj;
+     Py_ssize_t len;
+     Py_ssize_t itemsize;
+     int readonly;
+     int ndim;
+     char *format;
+     Py_ssize_t *shape;
+     Py_ssize_t *strides;
+     Py_ssize_t *suboffsets;
+     void *internal;
+  } Py_buffer;
+
+  #define PyBUF_SIMPLE 0
+  #define PyBUF_WRITABLE 0x0001
+  #define PyBUF_FORMAT 0x0004
+  #define PyBUF_ND 0x0008
+  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
+  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
+  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
+  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
+  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
+
+#endif
+
+#if PY_MAJOR_VERSION < 3
+  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+#else
+  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+  #define Py_TPFLAGS_CHECKTYPES 0
+  #define Py_TPFLAGS_HAVE_INDEX 0
+#endif
+
+#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
+  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+  #define PyBaseString_Type            PyUnicode_Type
+  #define PyStringObject               PyUnicodeObject
+  #define PyString_Type                PyUnicode_Type
+  #define PyString_Check               PyUnicode_Check
+  #define PyString_CheckExact          PyUnicode_CheckExact
+#endif
+
+#if PY_VERSION_HEX < 0x02060000
+  #define PyBytesObject                PyStringObject
+  #define PyBytes_Type                 PyString_Type
+  #define PyBytes_Check                PyString_Check
+  #define PyBytes_CheckExact           PyString_CheckExact
+  #define PyBytes_FromString           PyString_FromString
+  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
+  #define PyBytes_FromFormat           PyString_FromFormat
+  #define PyBytes_DecodeEscape         PyString_DecodeEscape
+  #define PyBytes_AsString             PyString_AsString
+  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
+  #define PyBytes_Size                 PyString_Size
+  #define PyBytes_AS_STRING            PyString_AS_STRING
+  #define PyBytes_GET_SIZE             PyString_GET_SIZE
+  #define PyBytes_Repr                 PyString_Repr
+  #define PyBytes_Concat               PyString_Concat
+  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
+  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
+  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
+#endif
+
+#ifndef PySet_CheckExact
+#  define PySet_CheckExact(obj)          (Py_TYPE(obj) == &PySet_Type)
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+  #define PyIntObject                  PyLongObject
+  #define PyInt_Type                   PyLong_Type
+  #define PyInt_Check(op)              PyLong_Check(op)
+  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
+  #define PyInt_FromString             PyLong_FromString
+  #define PyInt_FromUnicode            PyLong_FromUnicode
+  #define PyInt_FromLong               PyLong_FromLong
+  #define PyInt_FromSize_t             PyLong_FromSize_t
+  #define PyInt_FromSsize_t            PyLong_FromSsize_t
+  #define PyInt_AsLong                 PyLong_AsLong
+  #define PyInt_AS_LONG                PyLong_AS_LONG
+  #define PyInt_AsSsize_t              PyLong_AsSsize_t
+  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
+  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+  #define PyBoolObject PyLongObject
+#endif
+
+
+#if PY_MAJOR_VERSION >= 3
+  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
+  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
+#else
+  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
+  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
+#endif
+
+#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
+  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
+  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
+  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
+#else
+  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
+  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
+  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
+#endif
+
+#if PY_VERSION_HEX < 0x02050000
+  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
+  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
+  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
+#else
+  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
+  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
+  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
+#endif
+
+#if PY_VERSION_HEX < 0x02050000
+  #define __Pyx_NAMESTR(n) ((char *)(n))
+  #define __Pyx_DOCSTR(n)  ((char *)(n))
+#else
+  #define __Pyx_NAMESTR(n) (n)
+  #define __Pyx_DOCSTR(n)  (n)
+#endif
+
+#ifdef __cplusplus
+#define __PYX_EXTERN_C extern "C"
+#else
+#define __PYX_EXTERN_C extern
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+#define _USE_MATH_DEFINES
+#endif
+#include <math.h>
+#define __PYX_HAVE_API__byte_offset
+#include "stdio.h"
+#include "stdlib.h"
+#include "numpy/arrayobject.h"
+#include "numpy/ufuncobject.h"
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+
+/* inline attribute */
+#ifndef CYTHON_INLINE
+  #if defined(__GNUC__)
+    #define CYTHON_INLINE __inline__
+  #elif defined(_MSC_VER)
+    #define CYTHON_INLINE __inline
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_INLINE inline
+  #else
+    #define CYTHON_INLINE
+  #endif
+#endif
+
+/* unused attribute */
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define CYTHON_UNUSED __attribute__ ((__unused__))
+#   else
+#     define CYTHON_UNUSED
+#   endif
+# elif defined(__ICC) || defined(__INTEL_COMPILER)
+#   define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+#   define CYTHON_UNUSED
+# endif
+#endif
+
+typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
+
+
+/* Type Conversion Predeclarations */
+
+#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
+#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
+
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
+
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
+
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+
+
+#ifdef __GNUC__
+/* Test for GCC > 2.95 */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
+#define likely(x)   __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* __GNUC__ > 2 ... */
+#define likely(x)   (x)
+#define unlikely(x) (x)
+#endif /* __GNUC__ > 2 ... */
+#else /* __GNUC__ */
+#define likely(x)   (x)
+#define unlikely(x) (x)
+#endif /* __GNUC__ */
+    
+static PyObject *__pyx_m;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static PyObject *__pyx_empty_bytes;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+
+
+#if !defined(CYTHON_CCOMPLEX)
+  #if defined(__cplusplus)
+    #define CYTHON_CCOMPLEX 1
+  #elif defined(_Complex_I)
+    #define CYTHON_CCOMPLEX 1
+  #else
+    #define CYTHON_CCOMPLEX 0
+  #endif
+#endif
+
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    #include <complex>
+  #else
+    #include <complex.h>
+  #endif
+#endif
+
+#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
+  #undef _Complex_I
+  #define _Complex_I 1.0fj
+#endif
+
+static const char *__pyx_f[] = {
+  "byte_offset.pyx",
+  "numpy.pxd",
+};
+
+typedef npy_int8 __pyx_t_5numpy_int8_t;
+
+typedef npy_int16 __pyx_t_5numpy_int16_t;
+
+typedef npy_int32 __pyx_t_5numpy_int32_t;
+
+typedef npy_int64 __pyx_t_5numpy_int64_t;
+
+typedef npy_uint8 __pyx_t_5numpy_uint8_t;
+
+typedef npy_uint16 __pyx_t_5numpy_uint16_t;
+
+typedef npy_uint32 __pyx_t_5numpy_uint32_t;
+
+typedef npy_uint64 __pyx_t_5numpy_uint64_t;
+
+typedef npy_float32 __pyx_t_5numpy_float32_t;
+
+typedef npy_float64 __pyx_t_5numpy_float64_t;
+
+typedef npy_long __pyx_t_5numpy_int_t;
+
+typedef npy_longlong __pyx_t_5numpy_long_t;
+
+typedef npy_intp __pyx_t_5numpy_intp_t;
+
+typedef npy_uintp __pyx_t_5numpy_uintp_t;
+
+typedef npy_ulong __pyx_t_5numpy_uint_t;
+
+typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
+
+typedef npy_double __pyx_t_5numpy_float_t;
+
+typedef npy_double __pyx_t_5numpy_double_t;
+
+typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
+
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    typedef ::std::complex< float > __pyx_t_float_complex;
+  #else
+    typedef float _Complex __pyx_t_float_complex;
+  #endif
+#else
+    typedef struct { float real, imag; } __pyx_t_float_complex;
+#endif
+
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    typedef ::std::complex< double > __pyx_t_double_complex;
+  #else
+    typedef double _Complex __pyx_t_double_complex;
+  #endif
+#else
+    typedef struct { double real, imag; } __pyx_t_double_complex;
+#endif
+
+/* Type declarations */
+
+typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
+
+typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
+
+typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
+
+typedef npy_cdouble __pyx_t_5numpy_complex_t;
+
+#ifndef CYTHON_REFNANNY
+  #define CYTHON_REFNANNY 0
+#endif
+
+#if CYTHON_REFNANNY
+  typedef struct {
+    void (*INCREF)(void*, PyObject*, int);
+    void (*DECREF)(void*, PyObject*, int);
+    void (*GOTREF)(void*, PyObject*, int);
+    void (*GIVEREF)(void*, PyObject*, int);
+    void* (*SetupContext)(const char*, int, const char*);
+    void (*FinishContext)(void**);
+  } __Pyx_RefNannyAPIStruct;
+  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+  static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
+    PyObject *m = NULL, *p = NULL;
+    void *r = NULL;
+    m = PyImport_ImportModule((char *)modname);
+    if (!m) goto end;
+    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
+    if (!p) goto end;
+    r = PyLong_AsVoidPtr(p);
+  end:
+    Py_XDECREF(p);
+    Py_XDECREF(m);
+    return (__Pyx_RefNannyAPIStruct *)r;
+  }
+  #define __Pyx_RefNannySetupContext(name)           void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
+#else
+  #define __Pyx_RefNannySetupContext(name)
+  #define __Pyx_RefNannyFinishContext()
+  #define __Pyx_INCREF(r) Py_INCREF(r)
+  #define __Pyx_DECREF(r) Py_DECREF(r)
+  #define __Pyx_GOTREF(r)
+  #define __Pyx_GIVEREF(r)
+  #define __Pyx_XDECREF(r) Py_XDECREF(r)
+#endif /* CYTHON_REFNANNY */
+#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
+#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
+
+static void __Pyx_RaiseDoubleKeywordsError(
+    const char* func_name, PyObject* kw_name); /*proto*/
+
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
+
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
+
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+
+static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
+
+/* Run-time type information about structs used with buffers */
+struct __Pyx_StructField_;
+
+typedef struct {
+  const char* name; /* for error messages only */
+  struct __Pyx_StructField_* fields;
+  size_t size;     /* sizeof(type) */
+  char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */
+} __Pyx_TypeInfo;
+
+typedef struct __Pyx_StructField_ {
+  __Pyx_TypeInfo* type;
+  const char* name;
+  size_t offset;
+} __Pyx_StructField;
+
+typedef struct {
+  __Pyx_StructField* field;
+  size_t parent_offset;
+} __Pyx_BufFmt_StackElem;
+
+
+static CYTHON_INLINE int  __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
+static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
+
+static void __Pyx_RaiseBufferFallbackError(void); /*proto*/
+#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+
+static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
+
+static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
+
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
+
+static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/
+#if PY_MAJOR_VERSION < 3
+static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
+static void __Pyx_ReleaseBuffer(Py_buffer *view);
+#else
+#define __Pyx_GetBuffer PyObject_GetBuffer
+#define __Pyx_ReleaseBuffer PyBuffer_Release
+#endif
+
+Py_ssize_t __Pyx_zeros[] = {0};
+Py_ssize_t __Pyx_minusones[] = {-1};
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
+
+#ifndef __PYX_FORCE_INIT_THREADS
+  #if PY_VERSION_HEX < 0x02040200
+    #define __PYX_FORCE_INIT_THREADS 1
+  #else
+    #define __PYX_FORCE_INIT_THREADS 0
+  #endif
+#endif
+
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    #define __Pyx_CREAL(z) ((z).real())
+    #define __Pyx_CIMAG(z) ((z).imag())
+  #else
+    #define __Pyx_CREAL(z) (__real__(z))
+    #define __Pyx_CIMAG(z) (__imag__(z))
+  #endif
+#else
+    #define __Pyx_CREAL(z) ((z).real)
+    #define __Pyx_CIMAG(z) ((z).imag)
+#endif
+
+#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX
+    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
+    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
+#else
+    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
+    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
+#endif
+
+static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
+
+#if CYTHON_CCOMPLEX
+    #define __Pyx_c_eqf(a, b)   ((a)==(b))
+    #define __Pyx_c_sumf(a, b)  ((a)+(b))
+    #define __Pyx_c_difff(a, b) ((a)-(b))
+    #define __Pyx_c_prodf(a, b) ((a)*(b))
+    #define __Pyx_c_quotf(a, b) ((a)/(b))
+    #define __Pyx_c_negf(a)     (-(a))
+  #ifdef __cplusplus
+    #define __Pyx_c_is_zerof(z) ((z)==(float)0)
+    #define __Pyx_c_conjf(z)    (::std::conj(z))
+    #if 1
+        #define __Pyx_c_absf(z)     (::std::abs(z))
+        #define __Pyx_c_powf(a, b)  (::std::pow(a, b))
+    #endif
+  #else
+    #define __Pyx_c_is_zerof(z) ((z)==0)
+    #define __Pyx_c_conjf(z)    (conjf(z))
+    #if 1
+        #define __Pyx_c_absf(z)     (cabsf(z))
+        #define __Pyx_c_powf(a, b)  (cpowf(a, b))
+    #endif
+ #endif
+#else
+    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex);
+    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex);
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex);
+    #if 1
+        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);
+        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex);
+    #endif
+#endif
+
+static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
+
+#if CYTHON_CCOMPLEX
+    #define __Pyx_c_eq(a, b)   ((a)==(b))
+    #define __Pyx_c_sum(a, b)  ((a)+(b))
+    #define __Pyx_c_diff(a, b) ((a)-(b))
+    #define __Pyx_c_prod(a, b) ((a)*(b))
+    #define __Pyx_c_quot(a, b) ((a)/(b))
+    #define __Pyx_c_neg(a)     (-(a))
+  #ifdef __cplusplus
+    #define __Pyx_c_is_zero(z) ((z)==(double)0)
+    #define __Pyx_c_conj(z)    (::std::conj(z))
+    #if 1
+        #define __Pyx_c_abs(z)     (::std::abs(z))
+        #define __Pyx_c_pow(a, b)  (::std::pow(a, b))
+    #endif
+  #else
+    #define __Pyx_c_is_zero(z) ((z)==0)
+    #define __Pyx_c_conj(z)    (conj(z))
+    #if 1
+        #define __Pyx_c_abs(z)     (cabs(z))
+        #define __Pyx_c_pow(a, b)  (cpow(a, b))
+    #endif
+ #endif
+#else
+    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex);
+    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex);
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex);
+    #if 1
+        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);
+        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex);
+    #endif
+#endif
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+
+static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
+
+static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
+
+static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
+
+static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);
+
+static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);
+
+static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);
+
+static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
+
+static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
+
+static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
+
+static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
+
+static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
+
+static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
+
+static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);
+
+static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
+
+static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
+
+static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
+
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict);  /*proto*/
+
+static PyObject *__Pyx_ImportModule(const char *name); /*proto*/
+
+static void __Pyx_AddTraceback(const char *funcname); /*proto*/
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
+/* Module declarations from cpython.buffer */
+
+/* Module declarations from cpython.ref */
+
+/* Module declarations from libc.stdio */
+
+/* Module declarations from cpython.object */
+
+/* Module declarations from libc.stdlib */
+
+/* Module declarations from numpy */
+
+/* Module declarations from numpy */
+
+static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
+static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
+static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
+static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
+static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
+static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
+static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/
+/* Module declarations from cython */
+
+/* Module declarations from byte_offset */
+
+static __Pyx_TypeInfo __Pyx_TypeInfo_PY_LONG_LONG = { "long long", NULL, sizeof(PY_LONG_LONG), 'I' };
+#define __Pyx_MODULE_NAME "byte_offset"
+int __pyx_module_is_main_byte_offset = 0;
+
+/* Implementation of byte_offset */
+static PyObject *__pyx_builtin_ValueError;
+static PyObject *__pyx_builtin_range;
+static PyObject *__pyx_builtin_RuntimeError;
+static char __pyx_k_1[] = "ndarray is not C contiguous";
+static char __pyx_k_3[] = "ndarray is not Fortran contiguous";
+static char __pyx_k_5[] = "Non-native byte order not supported";
+static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)";
+static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd";
+static char __pyx_k_11[] = "Format string allocated too short.";
+static char __pyx_k_13[] = "\nAuthors:      J\303\251r\303\264me Kieffer, ESRF \nEmail:        jerome.kieffer at esrf.eu\n\nCif Binary Files images are 2D images written by the Pilatus detector and others.\nThey use a modified (simplified) byte-offset algorithm.  This file contains the \ndecompression function from a string to an int64 numpy array. \n\nThis is Cython: convert it to pure C then compile it with gcc\n$ cython byte_offset.pyx \n\n";
+static char __pyx_k_14[] = "J\303\251r\303\264me Kieffer";
+static char __pyx_k_15[] = "jerome.kieffer at esrf.eu";
+static char __pyx_k_16[] = "GPLv3+";
+static char __pyx_k_17[] = "2010, European Synchrotron Radiation Facility, Grenoble, France";
+static char __pyx_k__B[] = "B";
+static char __pyx_k__H[] = "H";
+static char __pyx_k__I[] = "I";
+static char __pyx_k__L[] = "L";
+static char __pyx_k__O[] = "O";
+static char __pyx_k__Q[] = "Q";
+static char __pyx_k__b[] = "b";
+static char __pyx_k__d[] = "d";
+static char __pyx_k__f[] = "f";
+static char __pyx_k__g[] = "g";
+static char __pyx_k__h[] = "h";
+static char __pyx_k__i[] = "i";
+static char __pyx_k__l[] = "l";
+static char __pyx_k__q[] = "q";
+static char __pyx_k__Zd[] = "Zd";
+static char __pyx_k__Zf[] = "Zf";
+static char __pyx_k__Zg[] = "Zg";
+static char __pyx_k__buf[] = "buf";
+static char __pyx_k__obj[] = "obj";
+static char __pyx_k__base[] = "base";
+static char __pyx_k__ndim[] = "ndim";
+static char __pyx_k__size[] = "size";
+static char __pyx_k__descr[] = "descr";
+static char __pyx_k__dtype[] = "dtype";
+static char __pyx_k__int64[] = "int64";
+static char __pyx_k__names[] = "names";
+static char __pyx_k__numpy[] = "numpy";
+static char __pyx_k__range[] = "range";
+static char __pyx_k__shape[] = "shape";
+static char __pyx_k__zeros[] = "zeros";
+static char __pyx_k__fields[] = "fields";
+static char __pyx_k__format[] = "format";
+static char __pyx_k__stream[] = "stream";
+static char __pyx_k__strides[] = "strides";
+static char __pyx_k____main__[] = "__main__";
+static char __pyx_k____test__[] = "__test__";
+static char __pyx_k__itemsize[] = "itemsize";
+static char __pyx_k__readonly[] = "readonly";
+static char __pyx_k__type_num[] = "type_num";
+static char __pyx_k__byteorder[] = "byteorder";
+static char __pyx_k__ValueError[] = "ValueError";
+static char __pyx_k____author__[] = "__author__";
+static char __pyx_k__suboffsets[] = "suboffsets";
+static char __pyx_k____contact__[] = "__contact__";
+static char __pyx_k____license__[] = "__license__";
+static char __pyx_k__byte_offset[] = "byte_offset";
+static char __pyx_k__RuntimeError[] = "RuntimeError";
+static char __pyx_k____copyright__[] = "__copyright__";
+static char __pyx_k__analyseCython[] = "analyseCython";
+static PyObject *__pyx_kp_u_1;
+static PyObject *__pyx_kp_u_11;
+static PyObject *__pyx_kp_s_14;
+static PyObject *__pyx_kp_s_15;
+static PyObject *__pyx_kp_s_16;
+static PyObject *__pyx_kp_s_17;
+static PyObject *__pyx_kp_u_3;
+static PyObject *__pyx_kp_u_5;
+static PyObject *__pyx_kp_u_7;
+static PyObject *__pyx_kp_u_8;
+static PyObject *__pyx_n_s__RuntimeError;
+static PyObject *__pyx_n_s__ValueError;
+static PyObject *__pyx_n_s____author__;
+static PyObject *__pyx_n_s____contact__;
+static PyObject *__pyx_n_s____copyright__;
+static PyObject *__pyx_n_s____license__;
+static PyObject *__pyx_n_s____main__;
+static PyObject *__pyx_n_s____test__;
+static PyObject *__pyx_n_s__analyseCython;
+static PyObject *__pyx_n_s__base;
+static PyObject *__pyx_n_s__buf;
+static PyObject *__pyx_n_s__byte_offset;
+static PyObject *__pyx_n_s__byteorder;
+static PyObject *__pyx_n_s__descr;
+static PyObject *__pyx_n_s__dtype;
+static PyObject *__pyx_n_s__fields;
+static PyObject *__pyx_n_s__format;
+static PyObject *__pyx_n_s__int64;
+static PyObject *__pyx_n_s__itemsize;
+static PyObject *__pyx_n_s__names;
+static PyObject *__pyx_n_s__ndim;
+static PyObject *__pyx_n_s__numpy;
+static PyObject *__pyx_n_s__obj;
+static PyObject *__pyx_n_s__range;
+static PyObject *__pyx_n_s__readonly;
+static PyObject *__pyx_n_s__shape;
+static PyObject *__pyx_n_s__size;
+static PyObject *__pyx_n_s__stream;
+static PyObject *__pyx_n_s__strides;
+static PyObject *__pyx_n_s__suboffsets;
+static PyObject *__pyx_n_s__type_num;
+static PyObject *__pyx_n_s__zeros;
+static PyObject *__pyx_int_15;
+static PyObject *__pyx_k_tuple_2;
+static PyObject *__pyx_k_tuple_4;
+static PyObject *__pyx_k_tuple_6;
+static PyObject *__pyx_k_tuple_9;
+static PyObject *__pyx_k_tuple_10;
+static PyObject *__pyx_k_tuple_12;
+
+/* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":26
+ * 
+ * @cython.boundscheck(False)
+ * def analyseCython(char * stream, int size):             # <<<<<<<<<<<<<<
+ *     """
+ *     Analyze a stream of char with any length of exception (2,4, or 8 bytes integers)
+ */
+
+static PyObject *__pyx_pf_11byte_offset_0analyseCython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static char __pyx_doc_11byte_offset_0analyseCython[] = "\n    Analyze a stream of char with any length of exception (2,4, or 8 bytes integers)\n    @param stream: string representing the compressed data\n    @param size: the size of the output array (of longInts)\n    @return : int64 ndArrays \n    ";
+static PyMethodDef __pyx_mdef_11byte_offset_0analyseCython = {__Pyx_NAMESTR("analyseCython"), (PyCFunction)__pyx_pf_11byte_offset_0analyseCython, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_11byte_offset_0analyseCython)};
+static PyObject *__pyx_pf_11byte_offset_0analyseCython(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  char *__pyx_v_stream;
+  int __pyx_v_size;
+  int __pyx_v_i;
+  int __pyx_v_j;
+  PY_LONG_LONG __pyx_v_last;
+  PY_LONG_LONG __pyx_v_current;
+  char __pyx_v_tmp8;
+  unsigned char __pyx_v_utmp8a;
+  unsigned char __pyx_v_utmp8b;
+  unsigned char __pyx_v_utmp8c;
+  unsigned char __pyx_v_utmp8d;
+  unsigned char __pyx_v_utmp8e;
+  unsigned char __pyx_v_utmp8f;
+  unsigned char __pyx_v_utmp8g;
+  PY_LONG_LONG __pyx_v_tmp64;
+  PY_LONG_LONG __pyx_v_tmp64a;
+  PY_LONG_LONG __pyx_v_tmp64b;
+  PY_LONG_LONG __pyx_v_tmp64c;
+  PY_LONG_LONG __pyx_v_tmp64d;
+  PY_LONG_LONG __pyx_v_tmp64e;
+  PY_LONG_LONG __pyx_v_tmp64f;
+  PY_LONG_LONG __pyx_v_tmp64g;
+  char __pyx_v_key8;
+  char __pyx_v_key0;
+  PyArrayObject *__pyx_v_dataOut;
+  Py_buffer __pyx_bstruct_dataOut;
+  Py_ssize_t __pyx_bstride_0_dataOut = 0;
+  Py_ssize_t __pyx_bshape_0_dataOut = 0;
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  PyObject *__pyx_t_5 = NULL;
+  PyArrayObject *__pyx_t_6 = NULL;
+  int __pyx_t_7;
+  PyObject *__pyx_t_8 = NULL;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  int __pyx_t_11;
+  int __pyx_t_12;
+  int __pyx_t_13;
+  int __pyx_t_14;
+  int __pyx_t_15;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__stream,&__pyx_n_s__size,0};
+  __Pyx_RefNannySetupContext("analyseCython");
+  __pyx_self = __pyx_self;
+  if (unlikely(__pyx_kwds)) {
+    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+    PyObject* values[2] = {0,0};
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+      case  0: break;
+      default: goto __pyx_L5_argtuple_error;
+    }
+    switch (PyTuple_GET_SIZE(__pyx_args)) {
+      case  0:
+      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stream);
+      if (likely(values[0])) kw_args--;
+      else goto __pyx_L5_argtuple_error;
+      case  1:
+      values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
+      if (likely(values[1])) kw_args--;
+      else {
+        __Pyx_RaiseArgtupleInvalid("analyseCython", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    }
+    if (unlikely(kw_args > 0)) {
+      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "analyseCython") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    }
+    __pyx_v_stream = PyBytes_AsString(values[0]); if (unlikely((!__pyx_v_stream) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_size = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+    goto __pyx_L5_argtuple_error;
+  } else {
+    __pyx_v_stream = PyBytes_AsString(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((!__pyx_v_stream) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    __pyx_v_size = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_size == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("analyseCython", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("byte_offset.analyseCython");
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_v_dataOut = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_bstruct_dataOut.buf = NULL;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":33
+ *     @return : int64 ndArrays
+ *     """
+ *     cdef int                i = 0             # <<<<<<<<<<<<<<
+ *     cdef int                j = 0
+ *     cdef long long          last = 0
+ */
+  __pyx_v_i = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":34
+ *     """
+ *     cdef int                i = 0
+ *     cdef int                j = 0             # <<<<<<<<<<<<<<
+ *     cdef long long          last = 0
+ *     cdef long long          current = 0
+ */
+  __pyx_v_j = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":35
+ *     cdef int                i = 0
+ *     cdef int                j = 0
+ *     cdef long long          last = 0             # <<<<<<<<<<<<<<
+ *     cdef long long          current = 0
+ *     cdef char               tmp8 = 0
+ */
+  __pyx_v_last = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":36
+ *     cdef int                j = 0
+ *     cdef long long          last = 0
+ *     cdef long long          current = 0             # <<<<<<<<<<<<<<
+ *     cdef char               tmp8 = 0
+ * 
+ */
+  __pyx_v_current = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":37
+ *     cdef long long          last = 0
+ *     cdef long long          current = 0
+ *     cdef char               tmp8 = 0             # <<<<<<<<<<<<<<
+ * 
+ *     cdef unsigned char      utmp8a = 0
+ */
+  __pyx_v_tmp8 = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":39
+ *     cdef char               tmp8 = 0
+ * 
+ *     cdef unsigned char      utmp8a = 0             # <<<<<<<<<<<<<<
+ *     cdef unsigned char      utmp8b = 0
+ *     cdef unsigned char      utmp8c = 0
+ */
+  __pyx_v_utmp8a = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":40
+ * 
+ *     cdef unsigned char      utmp8a = 0
+ *     cdef unsigned char      utmp8b = 0             # <<<<<<<<<<<<<<
+ *     cdef unsigned char      utmp8c = 0
+ *     cdef unsigned char      utmp8d = 0
+ */
+  __pyx_v_utmp8b = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":41
+ *     cdef unsigned char      utmp8a = 0
+ *     cdef unsigned char      utmp8b = 0
+ *     cdef unsigned char      utmp8c = 0             # <<<<<<<<<<<<<<
+ *     cdef unsigned char      utmp8d = 0
+ *     cdef unsigned char      utmp8e = 0
+ */
+  __pyx_v_utmp8c = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":42
+ *     cdef unsigned char      utmp8b = 0
+ *     cdef unsigned char      utmp8c = 0
+ *     cdef unsigned char      utmp8d = 0             # <<<<<<<<<<<<<<
+ *     cdef unsigned char      utmp8e = 0
+ *     cdef unsigned char      utmp8f = 0
+ */
+  __pyx_v_utmp8d = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":43
+ *     cdef unsigned char      utmp8c = 0
+ *     cdef unsigned char      utmp8d = 0
+ *     cdef unsigned char      utmp8e = 0             # <<<<<<<<<<<<<<
+ *     cdef unsigned char      utmp8f = 0
+ *     cdef unsigned char      utmp8g = 0
+ */
+  __pyx_v_utmp8e = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":44
+ *     cdef unsigned char      utmp8d = 0
+ *     cdef unsigned char      utmp8e = 0
+ *     cdef unsigned char      utmp8f = 0             # <<<<<<<<<<<<<<
+ *     cdef unsigned char      utmp8g = 0
+ * 
+ */
+  __pyx_v_utmp8f = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":45
+ *     cdef unsigned char      utmp8e = 0
+ *     cdef unsigned char      utmp8f = 0
+ *     cdef unsigned char      utmp8g = 0             # <<<<<<<<<<<<<<
+ * 
+ *     cdef long long          tmp64 = 0
+ */
+  __pyx_v_utmp8g = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":47
+ *     cdef unsigned char      utmp8g = 0
+ * 
+ *     cdef long long          tmp64 = 0             # <<<<<<<<<<<<<<
+ *     cdef long long          tmp64a = 0
+ *     cdef long long          tmp64b = 0
+ */
+  __pyx_v_tmp64 = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":48
+ * 
+ *     cdef long long          tmp64 = 0
+ *     cdef long long          tmp64a = 0             # <<<<<<<<<<<<<<
+ *     cdef long long          tmp64b = 0
+ *     cdef long long          tmp64c = 0
+ */
+  __pyx_v_tmp64a = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":49
+ *     cdef long long          tmp64 = 0
+ *     cdef long long          tmp64a = 0
+ *     cdef long long          tmp64b = 0             # <<<<<<<<<<<<<<
+ *     cdef long long          tmp64c = 0
+ *     cdef long long          tmp64d = 0
+ */
+  __pyx_v_tmp64b = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":50
+ *     cdef long long          tmp64a = 0
+ *     cdef long long          tmp64b = 0
+ *     cdef long long          tmp64c = 0             # <<<<<<<<<<<<<<
+ *     cdef long long          tmp64d = 0
+ *     cdef long long          tmp64e = 0
+ */
+  __pyx_v_tmp64c = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":51
+ *     cdef long long          tmp64b = 0
+ *     cdef long long          tmp64c = 0
+ *     cdef long long          tmp64d = 0             # <<<<<<<<<<<<<<
+ *     cdef long long          tmp64e = 0
+ *     cdef long long          tmp64f = 0
+ */
+  __pyx_v_tmp64d = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":52
+ *     cdef long long          tmp64c = 0
+ *     cdef long long          tmp64d = 0
+ *     cdef long long          tmp64e = 0             # <<<<<<<<<<<<<<
+ *     cdef long long          tmp64f = 0
+ *     cdef long long          tmp64g = 0
+ */
+  __pyx_v_tmp64e = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":53
+ *     cdef long long          tmp64d = 0
+ *     cdef long long          tmp64e = 0
+ *     cdef long long          tmp64f = 0             # <<<<<<<<<<<<<<
+ *     cdef long long          tmp64g = 0
+ * 
+ */
+  __pyx_v_tmp64f = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":54
+ *     cdef long long          tmp64e = 0
+ *     cdef long long          tmp64f = 0
+ *     cdef long long          tmp64g = 0             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __pyx_v_tmp64g = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":59
+ * 
+ * 
+ *     cdef char               key8 = 0x80             # <<<<<<<<<<<<<<
+ *     cdef char               key0 = 0x00
+ *     cdef numpy.ndarray[ long long  , ndim = 1] dataOut
+ */
+  __pyx_v_key8 = 0x80;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":60
+ * 
+ *     cdef char               key8 = 0x80
+ *     cdef char               key0 = 0x00             # <<<<<<<<<<<<<<
+ *     cdef numpy.ndarray[ long long  , ndim = 1] dataOut
+ *     dataOut = numpy.zeros(size, dtype=numpy.int64)
+ */
+  __pyx_v_key0 = 0x00;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":62
+ *     cdef char               key0 = 0x00
+ *     cdef numpy.ndarray[ long long  , ndim = 1] dataOut
+ *     dataOut = numpy.zeros(size, dtype=numpy.int64)             # <<<<<<<<<<<<<<
+ * 
+ *     with nogil:
+ */
+  __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_t_1 = PyInt_FromLong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
+  __Pyx_GIVEREF(__pyx_t_1);
+  __pyx_t_1 = 0;
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__numpy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_4);
+  __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__int64); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+  if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+  if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
+  {
+    __Pyx_BufFmt_StackElem __pyx_stack[1];
+    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dataOut);
+    __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_dataOut, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_PY_LONG_LONG, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack);
+    if (unlikely(__pyx_t_7 < 0)) {
+      PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
+      if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dataOut, (PyObject*)__pyx_v_dataOut, &__Pyx_TypeInfo_PY_LONG_LONG, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
+        Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10);
+        __Pyx_RaiseBufferFallbackError();
+      } else {
+        PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10);
+      }
+    }
+    __pyx_bstride_0_dataOut = __pyx_bstruct_dataOut.strides[0];
+    __pyx_bshape_0_dataOut = __pyx_bstruct_dataOut.shape[0];
+    if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  }
+  __pyx_t_6 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_v_dataOut));
+  __pyx_v_dataOut = ((PyArrayObject *)__pyx_t_5);
+  __pyx_t_5 = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":64
+ *     dataOut = numpy.zeros(size, dtype=numpy.int64)
+ * 
+ *     with nogil:             # <<<<<<<<<<<<<<
+ *         while (j < size):
+ *             if (stream[i] == key8):
+ */
+  {
+    #ifdef WITH_THREAD
+    PyThreadState *_save;
+    #endif
+    Py_UNBLOCK_THREADS
+    /*try:*/ {
+
+      /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":65
+ * 
+ *     with nogil:
+ *         while (j < size):             # <<<<<<<<<<<<<<
+ *             if (stream[i] == key8):
+ *                 if ((stream[i + 1] == key0) and (stream[i + 2] == key8)):
+ */
+      while (1) {
+        __pyx_t_11 = (__pyx_v_j < __pyx_v_size);
+        if (!__pyx_t_11) break;
+
+        /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":66
+ *     with nogil:
+ *         while (j < size):
+ *             if (stream[i] == key8):             # <<<<<<<<<<<<<<
+ *                 if ((stream[i + 1] == key0) and (stream[i + 2] == key8)):
+ *                     if (stream[i + 3] == key0) and (stream[i + 4] == key0) and (stream[i + 5] == key0) and (stream[i + 6] == key8):
+ */
+        __pyx_t_11 = ((__pyx_v_stream[__pyx_v_i]) == __pyx_v_key8);
+        if (__pyx_t_11) {
+
+          /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":67
+ *         while (j < size):
+ *             if (stream[i] == key8):
+ *                 if ((stream[i + 1] == key0) and (stream[i + 2] == key8)):             # <<<<<<<<<<<<<<
+ *                     if (stream[i + 3] == key0) and (stream[i + 4] == key0) and (stream[i + 5] == key0) and (stream[i + 6] == key8):
+ *                         #Retrieve the interesting Bytes of data
+ */
+          __pyx_t_11 = ((__pyx_v_stream[(__pyx_v_i + 1)]) == __pyx_v_key0);
+          if (__pyx_t_11) {
+            __pyx_t_12 = ((__pyx_v_stream[(__pyx_v_i + 2)]) == __pyx_v_key8);
+            __pyx_t_13 = __pyx_t_12;
+          } else {
+            __pyx_t_13 = __pyx_t_11;
+          }
+          if (__pyx_t_13) {
+
+            /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":68
+ *             if (stream[i] == key8):
+ *                 if ((stream[i + 1] == key0) and (stream[i + 2] == key8)):
+ *                     if (stream[i + 3] == key0) and (stream[i + 4] == key0) and (stream[i + 5] == key0) and (stream[i + 6] == key8):             # <<<<<<<<<<<<<<
+ *                         #Retrieve the interesting Bytes of data
+ *                         tmp8 = stream[i + 14]
+ */
+            __pyx_t_13 = ((__pyx_v_stream[(__pyx_v_i + 3)]) == __pyx_v_key0);
+            if (__pyx_t_13) {
+              __pyx_t_11 = ((__pyx_v_stream[(__pyx_v_i + 4)]) == __pyx_v_key0);
+              if (__pyx_t_11) {
+                __pyx_t_12 = ((__pyx_v_stream[(__pyx_v_i + 5)]) == __pyx_v_key0);
+                if (__pyx_t_12) {
+                  __pyx_t_14 = ((__pyx_v_stream[(__pyx_v_i + 6)]) == __pyx_v_key8);
+                  __pyx_t_15 = __pyx_t_14;
+                } else {
+                  __pyx_t_15 = __pyx_t_12;
+                }
+                __pyx_t_12 = __pyx_t_15;
+              } else {
+                __pyx_t_12 = __pyx_t_11;
+              }
+              __pyx_t_11 = __pyx_t_12;
+            } else {
+              __pyx_t_11 = __pyx_t_13;
+            }
+            if (__pyx_t_11) {
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":70
+ *                     if (stream[i + 3] == key0) and (stream[i + 4] == key0) and (stream[i + 5] == key0) and (stream[i + 6] == key8):
+ *                         #Retrieve the interesting Bytes of data
+ *                         tmp8 = stream[i + 14]             # <<<<<<<<<<<<<<
+ *                         utmp8a = stream[i + 13]
+ *                         utmp8b = stream[i + 12]
+ */
+              __pyx_v_tmp8 = (__pyx_v_stream[(__pyx_v_i + 14)]);
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":71
+ *                         #Retrieve the interesting Bytes of data
+ *                         tmp8 = stream[i + 14]
+ *                         utmp8a = stream[i + 13]             # <<<<<<<<<<<<<<
+ *                         utmp8b = stream[i + 12]
+ *                         utmp8c = stream[i + 11]
+ */
+              __pyx_v_utmp8a = (__pyx_v_stream[(__pyx_v_i + 13)]);
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":72
+ *                         tmp8 = stream[i + 14]
+ *                         utmp8a = stream[i + 13]
+ *                         utmp8b = stream[i + 12]             # <<<<<<<<<<<<<<
+ *                         utmp8c = stream[i + 11]
+ *                         utmp8d = stream[i + 10]
+ */
+              __pyx_v_utmp8b = (__pyx_v_stream[(__pyx_v_i + 12)]);
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":73
+ *                         utmp8a = stream[i + 13]
+ *                         utmp8b = stream[i + 12]
+ *                         utmp8c = stream[i + 11]             # <<<<<<<<<<<<<<
+ *                         utmp8d = stream[i + 10]
+ *                         utmp8e = stream[i + 9]
+ */
+              __pyx_v_utmp8c = (__pyx_v_stream[(__pyx_v_i + 11)]);
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":74
+ *                         utmp8b = stream[i + 12]
+ *                         utmp8c = stream[i + 11]
+ *                         utmp8d = stream[i + 10]             # <<<<<<<<<<<<<<
+ *                         utmp8e = stream[i + 9]
+ *                         utmp8f = stream[i + 8]
+ */
+              __pyx_v_utmp8d = (__pyx_v_stream[(__pyx_v_i + 10)]);
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":75
+ *                         utmp8c = stream[i + 11]
+ *                         utmp8d = stream[i + 10]
+ *                         utmp8e = stream[i + 9]             # <<<<<<<<<<<<<<
+ *                         utmp8f = stream[i + 8]
+ *                         utmp8g = stream[i + 7]
+ */
+              __pyx_v_utmp8e = (__pyx_v_stream[(__pyx_v_i + 9)]);
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":76
+ *                         utmp8d = stream[i + 10]
+ *                         utmp8e = stream[i + 9]
+ *                         utmp8f = stream[i + 8]             # <<<<<<<<<<<<<<
+ *                         utmp8g = stream[i + 7]
+ *                         # cast them  in 64 bit
+ */
+              __pyx_v_utmp8f = (__pyx_v_stream[(__pyx_v_i + 8)]);
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":77
+ *                         utmp8e = stream[i + 9]
+ *                         utmp8f = stream[i + 8]
+ *                         utmp8g = stream[i + 7]             # <<<<<<<<<<<<<<
+ *                         # cast them  in 64 bit
+ *                         tmp64 = tmp8
+ */
+              __pyx_v_utmp8g = (__pyx_v_stream[(__pyx_v_i + 7)]);
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":79
+ *                         utmp8g = stream[i + 7]
+ *                         # cast them  in 64 bit
+ *                         tmp64 = tmp8             # <<<<<<<<<<<<<<
+ *                         tmp64a = utmp8a
+ *                         tmp64b = utmp8b
+ */
+              __pyx_v_tmp64 = __pyx_v_tmp8;
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":80
+ *                         # cast them  in 64 bit
+ *                         tmp64 = tmp8
+ *                         tmp64a = utmp8a             # <<<<<<<<<<<<<<
+ *                         tmp64b = utmp8b
+ *                         tmp64c = utmp8c
+ */
+              __pyx_v_tmp64a = __pyx_v_utmp8a;
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":81
+ *                         tmp64 = tmp8
+ *                         tmp64a = utmp8a
+ *                         tmp64b = utmp8b             # <<<<<<<<<<<<<<
+ *                         tmp64c = utmp8c
+ *                         tmp64d = utmp8d
+ */
+              __pyx_v_tmp64b = __pyx_v_utmp8b;
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":82
+ *                         tmp64a = utmp8a
+ *                         tmp64b = utmp8b
+ *                         tmp64c = utmp8c             # <<<<<<<<<<<<<<
+ *                         tmp64d = utmp8d
+ *                         tmp64e = utmp8e
+ */
+              __pyx_v_tmp64c = __pyx_v_utmp8c;
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":83
+ *                         tmp64b = utmp8b
+ *                         tmp64c = utmp8c
+ *                         tmp64d = utmp8d             # <<<<<<<<<<<<<<
+ *                         tmp64e = utmp8e
+ *                         tmp64f = utmp8f
+ */
+              __pyx_v_tmp64d = __pyx_v_utmp8d;
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":84
+ *                         tmp64c = utmp8c
+ *                         tmp64d = utmp8d
+ *                         tmp64e = utmp8e             # <<<<<<<<<<<<<<
+ *                         tmp64f = utmp8f
+ *                         tmp64g = utmp8g
+ */
+              __pyx_v_tmp64e = __pyx_v_utmp8e;
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":85
+ *                         tmp64d = utmp8d
+ *                         tmp64e = utmp8e
+ *                         tmp64f = utmp8f             # <<<<<<<<<<<<<<
+ *                         tmp64g = utmp8g
+ *                         current = (tmp64 << 56) | (tmp64a << 48) | (tmp64b << 40) | (tmp64c << 32) | (tmp64d << 24) | (tmp64e << 16) | (tmp64f << 8) | (tmp64g)
+ */
+              __pyx_v_tmp64f = __pyx_v_utmp8f;
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":86
+ *                         tmp64e = utmp8e
+ *                         tmp64f = utmp8f
+ *                         tmp64g = utmp8g             # <<<<<<<<<<<<<<
+ *                         current = (tmp64 << 56) | (tmp64a << 48) | (tmp64b << 40) | (tmp64c << 32) | (tmp64d << 24) | (tmp64e << 16) | (tmp64f << 8) | (tmp64g)
+ *                         i += 15
+ */
+              __pyx_v_tmp64g = __pyx_v_utmp8g;
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":87
+ *                         tmp64f = utmp8f
+ *                         tmp64g = utmp8g
+ *                         current = (tmp64 << 56) | (tmp64a << 48) | (tmp64b << 40) | (tmp64c << 32) | (tmp64d << 24) | (tmp64e << 16) | (tmp64f << 8) | (tmp64g)             # <<<<<<<<<<<<<<
+ *                         i += 15
+ *                     else:
+ */
+              __pyx_v_current = ((((((((__pyx_v_tmp64 << 56) | (__pyx_v_tmp64a << 48)) | (__pyx_v_tmp64b << 40)) | (__pyx_v_tmp64c << 32)) | (__pyx_v_tmp64d << 24)) | (__pyx_v_tmp64e << 16)) | (__pyx_v_tmp64f << 8)) | __pyx_v_tmp64g);
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":88
+ *                         tmp64g = utmp8g
+ *                         current = (tmp64 << 56) | (tmp64a << 48) | (tmp64b << 40) | (tmp64c << 32) | (tmp64d << 24) | (tmp64e << 16) | (tmp64f << 8) | (tmp64g)
+ *                         i += 15             # <<<<<<<<<<<<<<
+ *                     else:
+ *                         #Retrieve the interesting Bytes of data
+ */
+              __pyx_v_i = (__pyx_v_i + 15);
+              goto __pyx_L13;
+            }
+            /*else*/ {
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":91
+ *                     else:
+ *                         #Retrieve the interesting Bytes of data
+ *                         tmp8 = stream[i + 6]             # <<<<<<<<<<<<<<
+ *                         utmp8a = stream[i + 5]
+ *                         utmp8b = stream[i + 4]
+ */
+              __pyx_v_tmp8 = (__pyx_v_stream[(__pyx_v_i + 6)]);
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":92
+ *                         #Retrieve the interesting Bytes of data
+ *                         tmp8 = stream[i + 6]
+ *                         utmp8a = stream[i + 5]             # <<<<<<<<<<<<<<
+ *                         utmp8b = stream[i + 4]
+ *                         utmp8c = stream[i + 3]
+ */
+              __pyx_v_utmp8a = (__pyx_v_stream[(__pyx_v_i + 5)]);
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":93
+ *                         tmp8 = stream[i + 6]
+ *                         utmp8a = stream[i + 5]
+ *                         utmp8b = stream[i + 4]             # <<<<<<<<<<<<<<
+ *                         utmp8c = stream[i + 3]
+ *                         # cast them  in 64 bit
+ */
+              __pyx_v_utmp8b = (__pyx_v_stream[(__pyx_v_i + 4)]);
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":94
+ *                         utmp8a = stream[i + 5]
+ *                         utmp8b = stream[i + 4]
+ *                         utmp8c = stream[i + 3]             # <<<<<<<<<<<<<<
+ *                         # cast them  in 64 bit
+ *                         tmp64 = tmp8
+ */
+              __pyx_v_utmp8c = (__pyx_v_stream[(__pyx_v_i + 3)]);
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":96
+ *                         utmp8c = stream[i + 3]
+ *                         # cast them  in 64 bit
+ *                         tmp64 = tmp8             # <<<<<<<<<<<<<<
+ *                         tmp64a = utmp8a
+ *                         tmp64b = utmp8b
+ */
+              __pyx_v_tmp64 = __pyx_v_tmp8;
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":97
+ *                         # cast them  in 64 bit
+ *                         tmp64 = tmp8
+ *                         tmp64a = utmp8a             # <<<<<<<<<<<<<<
+ *                         tmp64b = utmp8b
+ *                         tmp64c = utmp8c
+ */
+              __pyx_v_tmp64a = __pyx_v_utmp8a;
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":98
+ *                         tmp64 = tmp8
+ *                         tmp64a = utmp8a
+ *                         tmp64b = utmp8b             # <<<<<<<<<<<<<<
+ *                         tmp64c = utmp8c
+ *                         #Assemble data into a long long
+ */
+              __pyx_v_tmp64b = __pyx_v_utmp8b;
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":99
+ *                         tmp64a = utmp8a
+ *                         tmp64b = utmp8b
+ *                         tmp64c = utmp8c             # <<<<<<<<<<<<<<
+ *                         #Assemble data into a long long
+ *                         current = (tmp64 << 24) | (tmp64a << 16) | (tmp64b << 8) | (tmp64c);
+ */
+              __pyx_v_tmp64c = __pyx_v_utmp8c;
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":101
+ *                         tmp64c = utmp8c
+ *                         #Assemble data into a long long
+ *                         current = (tmp64 << 24) | (tmp64a << 16) | (tmp64b << 8) | (tmp64c);             # <<<<<<<<<<<<<<
+ *                         i += 7
+ *                 else:
+ */
+              __pyx_v_current = ((((__pyx_v_tmp64 << 24) | (__pyx_v_tmp64a << 16)) | (__pyx_v_tmp64b << 8)) | __pyx_v_tmp64c);
+
+              /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":102
+ *                         #Assemble data into a long long
+ *                         current = (tmp64 << 24) | (tmp64a << 16) | (tmp64b << 8) | (tmp64c);
+ *                         i += 7             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     tmp8 = stream[i + 2];
+ */
+              __pyx_v_i = (__pyx_v_i + 7);
+            }
+            __pyx_L13:;
+            goto __pyx_L12;
+          }
+          /*else*/ {
+
+            /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":104
+ *                         i += 7
+ *                 else:
+ *                     tmp8 = stream[i + 2];             # <<<<<<<<<<<<<<
+ *                     utmp8a = stream[i + 1]
+ *                     # cast them  in 64 bit
+ */
+            __pyx_v_tmp8 = (__pyx_v_stream[(__pyx_v_i + 2)]);
+
+            /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":105
+ *                 else:
+ *                     tmp8 = stream[i + 2];
+ *                     utmp8a = stream[i + 1]             # <<<<<<<<<<<<<<
+ *                     # cast them  in 64 bit
+ *                     tmp64 = tmp8
+ */
+            __pyx_v_utmp8a = (__pyx_v_stream[(__pyx_v_i + 1)]);
+
+            /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":107
+ *                     utmp8a = stream[i + 1]
+ *                     # cast them  in 64 bit
+ *                     tmp64 = tmp8             # <<<<<<<<<<<<<<
+ *                     tmp64a = utmp8a
+ *                     current = (tmp64 << 8) | (tmp64a);
+ */
+            __pyx_v_tmp64 = __pyx_v_tmp8;
+
+            /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":108
+ *                     # cast them  in 64 bit
+ *                     tmp64 = tmp8
+ *                     tmp64a = utmp8a             # <<<<<<<<<<<<<<
+ *                     current = (tmp64 << 8) | (tmp64a);
+ *                     i += 3
+ */
+            __pyx_v_tmp64a = __pyx_v_utmp8a;
+
+            /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":109
+ *                     tmp64 = tmp8
+ *                     tmp64a = utmp8a
+ *                     current = (tmp64 << 8) | (tmp64a);             # <<<<<<<<<<<<<<
+ *                     i += 3
+ *             else:
+ */
+            __pyx_v_current = ((__pyx_v_tmp64 << 8) | __pyx_v_tmp64a);
+
+            /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":110
+ *                     tmp64a = utmp8a
+ *                     current = (tmp64 << 8) | (tmp64a);
+ *                     i += 3             # <<<<<<<<<<<<<<
+ *             else:
+ *                 tmp8 = stream[i]
+ */
+            __pyx_v_i = (__pyx_v_i + 3);
+          }
+          __pyx_L12:;
+          goto __pyx_L11;
+        }
+        /*else*/ {
+
+          /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":112
+ *                     i += 3
+ *             else:
+ *                 tmp8 = stream[i]             # <<<<<<<<<<<<<<
+ *                 current = tmp8
+ *                 i += 1
+ */
+          __pyx_v_tmp8 = (__pyx_v_stream[__pyx_v_i]);
+
+          /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":113
+ *             else:
+ *                 tmp8 = stream[i]
+ *                 current = tmp8             # <<<<<<<<<<<<<<
+ *                 i += 1
+ *             last += current
+ */
+          __pyx_v_current = __pyx_v_tmp8;
+
+          /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":114
+ *                 tmp8 = stream[i]
+ *                 current = tmp8
+ *                 i += 1             # <<<<<<<<<<<<<<
+ *             last += current
+ *             dataOut[j] = last
+ */
+          __pyx_v_i = (__pyx_v_i + 1);
+        }
+        __pyx_L11:;
+
+        /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":115
+ *                 current = tmp8
+ *                 i += 1
+ *             last += current             # <<<<<<<<<<<<<<
+ *             dataOut[j] = last
+ *             j += 1
+ */
+        __pyx_v_last = (__pyx_v_last + __pyx_v_current);
+
+        /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":116
+ *                 i += 1
+ *             last += current
+ *             dataOut[j] = last             # <<<<<<<<<<<<<<
+ *             j += 1
+ * 
+ */
+        __pyx_t_7 = __pyx_v_j;
+        if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_0_dataOut;
+        *__Pyx_BufPtrStrided1d(PY_LONG_LONG *, __pyx_bstruct_dataOut.buf, __pyx_t_7, __pyx_bstride_0_dataOut) = __pyx_v_last;
+
+        /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":117
+ *             last += current
+ *             dataOut[j] = last
+ *             j += 1             # <<<<<<<<<<<<<<
+ * 
+ *     return dataOut
+ */
+        __pyx_v_j = (__pyx_v_j + 1);
+      }
+    }
+
+    /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":64
+ *     dataOut = numpy.zeros(size, dtype=numpy.int64)
+ * 
+ *     with nogil:             # <<<<<<<<<<<<<<
+ *         while (j < size):
+ *             if (stream[i] == key8):
+ */
+    /*finally:*/ {
+      Py_BLOCK_THREADS
+    }
+  }
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":119
+ *             j += 1
+ * 
+ *     return dataOut             # <<<<<<<<<<<<<<
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __Pyx_INCREF(((PyObject *)__pyx_v_dataOut));
+  __pyx_r = ((PyObject *)__pyx_v_dataOut);
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_5);
+  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
+    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
+    __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dataOut);
+  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
+  __Pyx_AddTraceback("byte_offset.analyseCython");
+  __pyx_r = NULL;
+  goto __pyx_L2;
+  __pyx_L0:;
+  __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dataOut);
+  __pyx_L2:;
+  __Pyx_DECREF((PyObject *)__pyx_v_dataOut);
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":188
+ *         # experimental exception made for __getbuffer__ and __releasebuffer__
+ *         # -- the details of this may change.
+ *         def __getbuffer__(ndarray self, Py_buffer* info, int flags):             # <<<<<<<<<<<<<<
+ *             # This implementation of getbuffer is geared towards Cython
+ *             # requirements, and does not yet fullfill the PEP.
+ */
+
+static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray_0__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray_0__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+  int __pyx_v_copy_shape;
+  int __pyx_v_i;
+  int __pyx_v_ndim;
+  int __pyx_v_endian_detector;
+  int __pyx_v_little_endian;
+  int __pyx_v_t;
+  char *__pyx_v_f;
+  PyArray_Descr *__pyx_v_descr = 0;
+  int __pyx_v_offset;
+  int __pyx_v_hasfields;
+  int __pyx_r;
+  int __pyx_t_1;
+  int __pyx_t_2;
+  int __pyx_t_3;
+  PyObject *__pyx_t_4 = NULL;
+  int __pyx_t_5;
+  int __pyx_t_6;
+  int __pyx_t_7;
+  PyObject *__pyx_t_8 = NULL;
+  char *__pyx_t_9;
+  __Pyx_RefNannySetupContext("__getbuffer__");
+  if (__pyx_v_info == NULL) return 0;
+  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
+  __Pyx_GIVEREF(__pyx_v_info->obj);
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":194
+ *             # of flags
+ *             cdef int copy_shape, i, ndim
+ *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
+ *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
+ * 
+ */
+  __pyx_v_endian_detector = 1;
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":195
+ *             cdef int copy_shape, i, ndim
+ *             cdef int endian_detector = 1
+ *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
+ * 
+ *             ndim = PyArray_NDIM(self)
+ */
+  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":197
+ *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
+ * 
+ *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
+ * 
+ *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
+ */
+  __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self));
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":199
+ *             ndim = PyArray_NDIM(self)
+ * 
+ *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
+ *                 copy_shape = 1
+ *             else:
+ */
+  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  if (__pyx_t_1) {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":200
+ * 
+ *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
+ *                 copy_shape = 1             # <<<<<<<<<<<<<<
+ *             else:
+ *                 copy_shape = 0
+ */
+    __pyx_v_copy_shape = 1;
+    goto __pyx_L5;
+  }
+  /*else*/ {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":202
+ *                 copy_shape = 1
+ *             else:
+ *                 copy_shape = 0             # <<<<<<<<<<<<<<
+ * 
+ *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
+ */
+    __pyx_v_copy_shape = 0;
+  }
+  __pyx_L5:;
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":204
+ *                 copy_shape = 0
+ * 
+ *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)             # <<<<<<<<<<<<<<
+ *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
+ *                 raise ValueError(u"ndarray is not C contiguous")
+ */
+  __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS);
+  if (__pyx_t_1) {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":205
+ * 
+ *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
+ *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):             # <<<<<<<<<<<<<<
+ *                 raise ValueError(u"ndarray is not C contiguous")
+ * 
+ */
+    __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS));
+    __pyx_t_3 = __pyx_t_2;
+  } else {
+    __pyx_t_3 = __pyx_t_1;
+  }
+  if (__pyx_t_3) {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":206
+ *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
+ *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
+ *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
+ * 
+ *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
+ */
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_Raise(__pyx_t_4, 0, 0);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L6;
+  }
+  __pyx_L6:;
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":208
+ *                 raise ValueError(u"ndarray is not C contiguous")
+ * 
+ *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)             # <<<<<<<<<<<<<<
+ *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
+ *                 raise ValueError(u"ndarray is not Fortran contiguous")
+ */
+  __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS);
+  if (__pyx_t_3) {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":209
+ * 
+ *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
+ *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):             # <<<<<<<<<<<<<<
+ *                 raise ValueError(u"ndarray is not Fortran contiguous")
+ * 
+ */
+    __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS));
+    __pyx_t_2 = __pyx_t_1;
+  } else {
+    __pyx_t_2 = __pyx_t_3;
+  }
+  if (__pyx_t_2) {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":210
+ *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
+ *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
+ *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
+ * 
+ *             info.buf = PyArray_DATA(self)
+ */
+    __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_Raise(__pyx_t_4, 0, 0);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    goto __pyx_L7;
+  }
+  __pyx_L7:;
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":212
+ *                 raise ValueError(u"ndarray is not Fortran contiguous")
+ * 
+ *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
+ *             info.ndim = ndim
+ *             if copy_shape:
+ */
+  __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self));
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":213
+ * 
+ *             info.buf = PyArray_DATA(self)
+ *             info.ndim = ndim             # <<<<<<<<<<<<<<
+ *             if copy_shape:
+ *                 # Allocate new buffer for strides and shape info. This is allocated
+ */
+  __pyx_v_info->ndim = __pyx_v_ndim;
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":214
+ *             info.buf = PyArray_DATA(self)
+ *             info.ndim = ndim
+ *             if copy_shape:             # <<<<<<<<<<<<<<
+ *                 # Allocate new buffer for strides and shape info. This is allocated
+ *                 # as one block, strides first.
+ */
+  if (__pyx_v_copy_shape) {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":217
+ *                 # Allocate new buffer for strides and shape info. This is allocated
+ *                 # as one block, strides first.
+ *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)             # <<<<<<<<<<<<<<
+ *                 info.shape = info.strides + ndim
+ *                 for i in range(ndim):
+ */
+    __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2)));
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":218
+ *                 # as one block, strides first.
+ *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)
+ *                 info.shape = info.strides + ndim             # <<<<<<<<<<<<<<
+ *                 for i in range(ndim):
+ *                     info.strides[i] = PyArray_STRIDES(self)[i]
+ */
+    __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":219
+ *                 info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2)
+ *                 info.shape = info.strides + ndim
+ *                 for i in range(ndim):             # <<<<<<<<<<<<<<
+ *                     info.strides[i] = PyArray_STRIDES(self)[i]
+ *                     info.shape[i] = PyArray_DIMS(self)[i]
+ */
+    __pyx_t_5 = __pyx_v_ndim;
+    for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
+      __pyx_v_i = __pyx_t_6;
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":220
+ *                 info.shape = info.strides + ndim
+ *                 for i in range(ndim):
+ *                     info.strides[i] = PyArray_STRIDES(self)[i]             # <<<<<<<<<<<<<<
+ *                     info.shape[i] = PyArray_DIMS(self)[i]
+ *             else:
+ */
+      (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":221
+ *                 for i in range(ndim):
+ *                     info.strides[i] = PyArray_STRIDES(self)[i]
+ *                     info.shape[i] = PyArray_DIMS(self)[i]             # <<<<<<<<<<<<<<
+ *             else:
+ *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
+ */
+      (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]);
+    }
+    goto __pyx_L8;
+  }
+  /*else*/ {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":223
+ *                     info.shape[i] = PyArray_DIMS(self)[i]
+ *             else:
+ *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
+ *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
+ *             info.suboffsets = NULL
+ */
+    __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self)));
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":224
+ *             else:
+ *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
+ *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)             # <<<<<<<<<<<<<<
+ *             info.suboffsets = NULL
+ *             info.itemsize = PyArray_ITEMSIZE(self)
+ */
+    __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self)));
+  }
+  __pyx_L8:;
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":225
+ *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
+ *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
+ *             info.suboffsets = NULL             # <<<<<<<<<<<<<<
+ *             info.itemsize = PyArray_ITEMSIZE(self)
+ *             info.readonly = not PyArray_ISWRITEABLE(self)
+ */
+  __pyx_v_info->suboffsets = NULL;
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":226
+ *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
+ *             info.suboffsets = NULL
+ *             info.itemsize = PyArray_ITEMSIZE(self)             # <<<<<<<<<<<<<<
+ *             info.readonly = not PyArray_ISWRITEABLE(self)
+ * 
+ */
+  __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self));
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":227
+ *             info.suboffsets = NULL
+ *             info.itemsize = PyArray_ITEMSIZE(self)
+ *             info.readonly = not PyArray_ISWRITEABLE(self)             # <<<<<<<<<<<<<<
+ * 
+ *             cdef int t
+ */
+  __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self)));
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":230
+ * 
+ *             cdef int t
+ *             cdef char* f = NULL             # <<<<<<<<<<<<<<
+ *             cdef dtype descr = self.descr
+ *             cdef list stack
+ */
+  __pyx_v_f = NULL;
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":231
+ *             cdef int t
+ *             cdef char* f = NULL
+ *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
+ *             cdef list stack
+ *             cdef int offset
+ */
+  __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr));
+  __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr;
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":235
+ *             cdef int offset
+ * 
+ *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
+ * 
+ *             if not hasfields and not copy_shape:
+ */
+  __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":237
+ *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
+ * 
+ *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
+ *                 # do not call releasebuffer
+ *                 info.obj = None
+ */
+  __pyx_t_2 = (!__pyx_v_hasfields);
+  if (__pyx_t_2) {
+    __pyx_t_3 = (!__pyx_v_copy_shape);
+    __pyx_t_1 = __pyx_t_3;
+  } else {
+    __pyx_t_1 = __pyx_t_2;
+  }
+  if (__pyx_t_1) {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":239
+ *             if not hasfields and not copy_shape:
+ *                 # do not call releasebuffer
+ *                 info.obj = None             # <<<<<<<<<<<<<<
+ *             else:
+ *                 # need to call releasebuffer
+ */
+    __Pyx_INCREF(Py_None);
+    __Pyx_GIVEREF(Py_None);
+    __Pyx_GOTREF(__pyx_v_info->obj);
+    __Pyx_DECREF(__pyx_v_info->obj);
+    __pyx_v_info->obj = Py_None;
+    goto __pyx_L11;
+  }
+  /*else*/ {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":242
+ *             else:
+ *                 # need to call releasebuffer
+ *                 info.obj = self             # <<<<<<<<<<<<<<
+ * 
+ *             if not hasfields:
+ */
+    __Pyx_INCREF(__pyx_v_self);
+    __Pyx_GIVEREF(__pyx_v_self);
+    __Pyx_GOTREF(__pyx_v_info->obj);
+    __Pyx_DECREF(__pyx_v_info->obj);
+    __pyx_v_info->obj = __pyx_v_self;
+  }
+  __pyx_L11:;
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":244
+ *                 info.obj = self
+ * 
+ *             if not hasfields:             # <<<<<<<<<<<<<<
+ *                 t = descr.type_num
+ *                 if ((descr.byteorder == '>' and little_endian) or
+ */
+  __pyx_t_1 = (!__pyx_v_hasfields);
+  if (__pyx_t_1) {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":245
+ * 
+ *             if not hasfields:
+ *                 t = descr.type_num             # <<<<<<<<<<<<<<
+ *                 if ((descr.byteorder == '>' and little_endian) or
+ *                     (descr.byteorder == '<' and not little_endian)):
+ */
+    __pyx_v_t = __pyx_v_descr->type_num;
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":246
+ *             if not hasfields:
+ *                 t = descr.type_num
+ *                 if ((descr.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
+ *                     (descr.byteorder == '<' and not little_endian)):
+ *                     raise ValueError(u"Non-native byte order not supported")
+ */
+    __pyx_t_1 = (__pyx_v_descr->byteorder == '>');
+    if (__pyx_t_1) {
+      __pyx_t_2 = __pyx_v_little_endian;
+    } else {
+      __pyx_t_2 = __pyx_t_1;
+    }
+    if (!__pyx_t_2) {
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":247
+ *                 t = descr.type_num
+ *                 if ((descr.byteorder == '>' and little_endian) or
+ *                     (descr.byteorder == '<' and not little_endian)):             # <<<<<<<<<<<<<<
+ *                     raise ValueError(u"Non-native byte order not supported")
+ *                 if   t == NPY_BYTE:        f = "b"
+ */
+      __pyx_t_1 = (__pyx_v_descr->byteorder == '<');
+      if (__pyx_t_1) {
+        __pyx_t_3 = (!__pyx_v_little_endian);
+        __pyx_t_7 = __pyx_t_3;
+      } else {
+        __pyx_t_7 = __pyx_t_1;
+      }
+      __pyx_t_1 = __pyx_t_7;
+    } else {
+      __pyx_t_1 = __pyx_t_2;
+    }
+    if (__pyx_t_1) {
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":248
+ *                 if ((descr.byteorder == '>' and little_endian) or
+ *                     (descr.byteorder == '<' and not little_endian)):
+ *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
+ *                 if   t == NPY_BYTE:        f = "b"
+ *                 elif t == NPY_UBYTE:       f = "B"
+ */
+      __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_Raise(__pyx_t_4, 0, 0);
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L13;
+    }
+    __pyx_L13:;
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":249
+ *                     (descr.byteorder == '<' and not little_endian)):
+ *                     raise ValueError(u"Non-native byte order not supported")
+ *                 if   t == NPY_BYTE:        f = "b"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_UBYTE:       f = "B"
+ *                 elif t == NPY_SHORT:       f = "h"
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_BYTE);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__b;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":250
+ *                     raise ValueError(u"Non-native byte order not supported")
+ *                 if   t == NPY_BYTE:        f = "b"
+ *                 elif t == NPY_UBYTE:       f = "B"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_SHORT:       f = "h"
+ *                 elif t == NPY_USHORT:      f = "H"
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_UBYTE);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__B;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":251
+ *                 if   t == NPY_BYTE:        f = "b"
+ *                 elif t == NPY_UBYTE:       f = "B"
+ *                 elif t == NPY_SHORT:       f = "h"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_USHORT:      f = "H"
+ *                 elif t == NPY_INT:         f = "i"
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_SHORT);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__h;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":252
+ *                 elif t == NPY_UBYTE:       f = "B"
+ *                 elif t == NPY_SHORT:       f = "h"
+ *                 elif t == NPY_USHORT:      f = "H"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_INT:         f = "i"
+ *                 elif t == NPY_UINT:        f = "I"
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_USHORT);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__H;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":253
+ *                 elif t == NPY_SHORT:       f = "h"
+ *                 elif t == NPY_USHORT:      f = "H"
+ *                 elif t == NPY_INT:         f = "i"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_UINT:        f = "I"
+ *                 elif t == NPY_LONG:        f = "l"
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_INT);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__i;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":254
+ *                 elif t == NPY_USHORT:      f = "H"
+ *                 elif t == NPY_INT:         f = "i"
+ *                 elif t == NPY_UINT:        f = "I"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_LONG:        f = "l"
+ *                 elif t == NPY_ULONG:       f = "L"
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_UINT);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__I;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":255
+ *                 elif t == NPY_INT:         f = "i"
+ *                 elif t == NPY_UINT:        f = "I"
+ *                 elif t == NPY_LONG:        f = "l"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_ULONG:       f = "L"
+ *                 elif t == NPY_LONGLONG:    f = "q"
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_LONG);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__l;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":256
+ *                 elif t == NPY_UINT:        f = "I"
+ *                 elif t == NPY_LONG:        f = "l"
+ *                 elif t == NPY_ULONG:       f = "L"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_LONGLONG:    f = "q"
+ *                 elif t == NPY_ULONGLONG:   f = "Q"
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_ULONG);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__L;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":257
+ *                 elif t == NPY_LONG:        f = "l"
+ *                 elif t == NPY_ULONG:       f = "L"
+ *                 elif t == NPY_LONGLONG:    f = "q"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_ULONGLONG:   f = "Q"
+ *                 elif t == NPY_FLOAT:       f = "f"
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__q;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":258
+ *                 elif t == NPY_ULONG:       f = "L"
+ *                 elif t == NPY_LONGLONG:    f = "q"
+ *                 elif t == NPY_ULONGLONG:   f = "Q"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_FLOAT:       f = "f"
+ *                 elif t == NPY_DOUBLE:      f = "d"
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__Q;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":259
+ *                 elif t == NPY_LONGLONG:    f = "q"
+ *                 elif t == NPY_ULONGLONG:   f = "Q"
+ *                 elif t == NPY_FLOAT:       f = "f"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_DOUBLE:      f = "d"
+ *                 elif t == NPY_LONGDOUBLE:  f = "g"
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_FLOAT);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__f;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":260
+ *                 elif t == NPY_ULONGLONG:   f = "Q"
+ *                 elif t == NPY_FLOAT:       f = "f"
+ *                 elif t == NPY_DOUBLE:      f = "d"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_LONGDOUBLE:  f = "g"
+ *                 elif t == NPY_CFLOAT:      f = "Zf"
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__d;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":261
+ *                 elif t == NPY_FLOAT:       f = "f"
+ *                 elif t == NPY_DOUBLE:      f = "d"
+ *                 elif t == NPY_LONGDOUBLE:  f = "g"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_CFLOAT:      f = "Zf"
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__g;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":262
+ *                 elif t == NPY_DOUBLE:      f = "d"
+ *                 elif t == NPY_LONGDOUBLE:  f = "g"
+ *                 elif t == NPY_CFLOAT:      f = "Zf"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__Zf;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":263
+ *                 elif t == NPY_LONGDOUBLE:  f = "g"
+ *                 elif t == NPY_CFLOAT:      f = "Zf"
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ *                 elif t == NPY_OBJECT:      f = "O"
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__Zd;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":264
+ *                 elif t == NPY_CFLOAT:      f = "Zf"
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"             # <<<<<<<<<<<<<<
+ *                 elif t == NPY_OBJECT:      f = "O"
+ *                 else:
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__Zg;
+      goto __pyx_L14;
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":265
+ *                 elif t == NPY_CDOUBLE:     f = "Zd"
+ *                 elif t == NPY_CLONGDOUBLE: f = "Zg"
+ *                 elif t == NPY_OBJECT:      f = "O"             # <<<<<<<<<<<<<<
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+    __pyx_t_1 = (__pyx_v_t == NPY_OBJECT);
+    if (__pyx_t_1) {
+      __pyx_v_f = __pyx_k__O;
+      goto __pyx_L14;
+    }
+    /*else*/ {
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":267
+ *                 elif t == NPY_OBJECT:      f = "O"
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
+ *                 info.format = f
+ *                 return
+ */
+      __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_4);
+      __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_8));
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+      PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8));
+      __Pyx_GIVEREF(((PyObject *)__pyx_t_8));
+      __pyx_t_8 = 0;
+      __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+      __Pyx_Raise(__pyx_t_8, 0, 0);
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+    __pyx_L14:;
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":268
+ *                 else:
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ *                 info.format = f             # <<<<<<<<<<<<<<
+ *                 return
+ *             else:
+ */
+    __pyx_v_info->format = __pyx_v_f;
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":269
+ *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ *                 info.format = f
+ *                 return             # <<<<<<<<<<<<<<
+ *             else:
+ *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
+ */
+    __pyx_r = 0;
+    goto __pyx_L0;
+    goto __pyx_L12;
+  }
+  /*else*/ {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":271
+ *                 return
+ *             else:
+ *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
+ *                 info.format[0] = '^' # Native data types, manual alignment
+ *                 offset = 0
+ */
+    __pyx_v_info->format = ((char *)malloc(255));
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":272
+ *             else:
+ *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
+ *                 info.format[0] = '^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
+ *                 offset = 0
+ *                 f = _util_dtypestring(descr, info.format + 1,
+ */
+    (__pyx_v_info->format[0]) = '^';
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":273
+ *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
+ *                 info.format[0] = '^' # Native data types, manual alignment
+ *                 offset = 0             # <<<<<<<<<<<<<<
+ *                 f = _util_dtypestring(descr, info.format + 1,
+ *                                       info.format + _buffer_format_string_len,
+ */
+    __pyx_v_offset = 0;
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":276
+ *                 f = _util_dtypestring(descr, info.format + 1,
+ *                                       info.format + _buffer_format_string_len,
+ *                                       &offset)             # <<<<<<<<<<<<<<
+ *                 f[0] = 0 # Terminate format string
+ * 
+ */
+    __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_v_f = __pyx_t_9;
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":277
+ *                                       info.format + _buffer_format_string_len,
+ *                                       &offset)
+ *                 f[0] = 0 # Terminate format string             # <<<<<<<<<<<<<<
+ * 
+ *         def __releasebuffer__(ndarray self, Py_buffer* info):
+ */
+    (__pyx_v_f[0]) = 0;
+  }
+  __pyx_L12:;
+
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_8);
+  __Pyx_AddTraceback("numpy.ndarray.__getbuffer__");
+  __pyx_r = -1;
+  __Pyx_GOTREF(__pyx_v_info->obj);
+  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
+  goto __pyx_L2;
+  __pyx_L0:;
+  if (__pyx_v_info->obj == Py_None) {
+    __Pyx_GOTREF(Py_None);
+    __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
+  }
+  __pyx_L2:;
+  __Pyx_XDECREF((PyObject *)__pyx_v_descr);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":279
+ *                 f[0] = 0 # Terminate format string
+ * 
+ *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
+ *             if PyArray_HASFIELDS(self):
+ *                 stdlib.free(info.format)
+ */
+
+static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
+static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
+  int __pyx_t_1;
+  __Pyx_RefNannySetupContext("__releasebuffer__");
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":280
+ * 
+ *         def __releasebuffer__(ndarray self, Py_buffer* info):
+ *             if PyArray_HASFIELDS(self):             # <<<<<<<<<<<<<<
+ *                 stdlib.free(info.format)
+ *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
+ */
+  __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self));
+  if (__pyx_t_1) {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":281
+ *         def __releasebuffer__(ndarray self, Py_buffer* info):
+ *             if PyArray_HASFIELDS(self):
+ *                 stdlib.free(info.format)             # <<<<<<<<<<<<<<
+ *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
+ *                 stdlib.free(info.strides)
+ */
+    free(__pyx_v_info->format);
+    goto __pyx_L5;
+  }
+  __pyx_L5:;
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":282
+ *             if PyArray_HASFIELDS(self):
+ *                 stdlib.free(info.format)
+ *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
+ *                 stdlib.free(info.strides)
+ *                 # info.shape was stored after info.strides in the same block
+ */
+  __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t)));
+  if (__pyx_t_1) {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":283
+ *                 stdlib.free(info.format)
+ *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
+ *                 stdlib.free(info.strides)             # <<<<<<<<<<<<<<
+ *                 # info.shape was stored after info.strides in the same block
+ * 
+ */
+    free(__pyx_v_info->strides);
+    goto __pyx_L6;
+  }
+  __pyx_L6:;
+
+  __Pyx_RefNannyFinishContext();
+}
+
+/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":756
+ * ctypedef npy_cdouble     complex_t
+ * 
+ * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
+ *     return PyArray_MultiIterNew(1, <void*>a)
+ * 
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  __Pyx_RefNannySetupContext("PyArray_MultiIterNew1");
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":757
+ * 
+ * cdef inline object PyArray_MultiIterNew1(a):
+ *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
+ * 
+ * cdef inline object PyArray_MultiIterNew2(a, b):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_r = __pyx_t_1;
+  __pyx_t_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1");
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":759
+ *     return PyArray_MultiIterNew(1, <void*>a)
+ * 
+ * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
+ *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
+ * 
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  __Pyx_RefNannySetupContext("PyArray_MultiIterNew2");
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":760
+ * 
+ * cdef inline object PyArray_MultiIterNew2(a, b):
+ *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
+ * 
+ * cdef inline object PyArray_MultiIterNew3(a, b, c):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_r = __pyx_t_1;
+  __pyx_t_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2");
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":762
+ *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
+ * 
+ * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
+ *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
+ * 
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  __Pyx_RefNannySetupContext("PyArray_MultiIterNew3");
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":763
+ * 
+ * cdef inline object PyArray_MultiIterNew3(a, b, c):
+ *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
+ * 
+ * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_r = __pyx_t_1;
+  __pyx_t_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3");
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":765
+ *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
+ * 
+ * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
+ *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
+ * 
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  __Pyx_RefNannySetupContext("PyArray_MultiIterNew4");
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":766
+ * 
+ * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
+ *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
+ * 
+ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_r = __pyx_t_1;
+  __pyx_t_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4");
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":768
+ *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
+ * 
+ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):             # <<<<<<<<<<<<<<
+ *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
+ * 
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
+  PyObject *__pyx_r = NULL;
+  PyObject *__pyx_t_1 = NULL;
+  __Pyx_RefNannySetupContext("PyArray_MultiIterNew5");
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":769
+ * 
+ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
+ *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)             # <<<<<<<<<<<<<<
+ * 
+ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
+ */
+  __Pyx_XDECREF(__pyx_r);
+  __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  __pyx_r = __pyx_t_1;
+  __pyx_t_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5");
+  __pyx_r = 0;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":771
+ *     return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
+ * 
+ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:             # <<<<<<<<<<<<<<
+ *     # Recursive utility function used in __getbuffer__ to get format
+ *     # string. The new location in the format string is returned.
+ */
+
+static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
+  PyArray_Descr *__pyx_v_child;
+  int __pyx_v_endian_detector;
+  int __pyx_v_little_endian;
+  PyObject *__pyx_v_fields;
+  PyObject *__pyx_v_childname;
+  PyObject *__pyx_v_new_offset;
+  PyObject *__pyx_v_t;
+  char *__pyx_r;
+  Py_ssize_t __pyx_t_1;
+  PyObject *__pyx_t_2 = NULL;
+  PyObject *__pyx_t_3 = NULL;
+  PyObject *__pyx_t_4 = NULL;
+  PyObject *__pyx_t_5 = NULL;
+  int __pyx_t_6;
+  int __pyx_t_7;
+  int __pyx_t_8;
+  int __pyx_t_9;
+  long __pyx_t_10;
+  char *__pyx_t_11;
+  __Pyx_RefNannySetupContext("_util_dtypestring");
+  __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_fields = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
+  __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_v_t = Py_None; __Pyx_INCREF(Py_None);
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":778
+ *     cdef int delta_offset
+ *     cdef tuple i
+ *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
+ *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
+ *     cdef tuple fields
+ */
+  __pyx_v_endian_detector = 1;
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":779
+ *     cdef tuple i
+ *     cdef int endian_detector = 1
+ *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
+ *     cdef tuple fields
+ * 
+ */
+  __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":782
+ *     cdef tuple fields
+ * 
+ *     for childname in descr.names:             # <<<<<<<<<<<<<<
+ *         fields = descr.fields[childname]
+ *         child, new_offset = fields
+ */
+  if (unlikely(__pyx_v_descr->names == Py_None)) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} 
+  }
+  __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2);
+  for (;;) {
+    if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
+    __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++;
+    __Pyx_DECREF(__pyx_v_childname);
+    __pyx_v_childname = __pyx_t_3;
+    __pyx_t_3 = 0;
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":783
+ * 
+ *     for childname in descr.names:
+ *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
+ *         child, new_offset = fields
+ * 
+ */
+    __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(((PyObject *)__pyx_v_fields));
+    __pyx_v_fields = ((PyObject*)__pyx_t_3);
+    __pyx_t_3 = 0;
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":784
+ *     for childname in descr.names:
+ *         fields = descr.fields[childname]
+ *         child, new_offset = fields             # <<<<<<<<<<<<<<
+ * 
+ *         if (end - f) - (new_offset - offset[0]) < 15:
+ */
+    if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) {
+      PyObject* tuple = ((PyObject *)__pyx_v_fields);
+      __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3);
+      if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4);
+      __Pyx_DECREF(((PyObject *)__pyx_v_child));
+      __pyx_v_child = ((PyArray_Descr *)__pyx_t_3);
+      __pyx_t_3 = 0;
+      __Pyx_DECREF(__pyx_v_new_offset);
+      __pyx_v_new_offset = __pyx_t_4;
+      __pyx_t_4 = 0;
+    } else {
+      __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2);
+      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":786
+ *         child, new_offset = fields
+ * 
+ *         if (end - f) - (new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
+ *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
+ * 
+ */
+    __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_3);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+    __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    if (__pyx_t_6) {
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":787
+ * 
+ *         if (end - f) - (new_offset - offset[0]) < 15:
+ *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
+ * 
+ *         if ((child.byteorder == '>' and little_endian) or
+ */
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_Raise(__pyx_t_5, 0, 0);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L5;
+    }
+    __pyx_L5:;
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":789
+ *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
+ * 
+ *         if ((child.byteorder == '>' and little_endian) or             # <<<<<<<<<<<<<<
+ *             (child.byteorder == '<' and not little_endian)):
+ *             raise ValueError(u"Non-native byte order not supported")
+ */
+    __pyx_t_6 = (__pyx_v_child->byteorder == '>');
+    if (__pyx_t_6) {
+      __pyx_t_7 = __pyx_v_little_endian;
+    } else {
+      __pyx_t_7 = __pyx_t_6;
+    }
+    if (!__pyx_t_7) {
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":790
+ * 
+ *         if ((child.byteorder == '>' and little_endian) or
+ *             (child.byteorder == '<' and not little_endian)):             # <<<<<<<<<<<<<<
+ *             raise ValueError(u"Non-native byte order not supported")
+ *             # One could encode it in the format string and have Cython
+ */
+      __pyx_t_6 = (__pyx_v_child->byteorder == '<');
+      if (__pyx_t_6) {
+        __pyx_t_8 = (!__pyx_v_little_endian);
+        __pyx_t_9 = __pyx_t_8;
+      } else {
+        __pyx_t_9 = __pyx_t_6;
+      }
+      __pyx_t_6 = __pyx_t_9;
+    } else {
+      __pyx_t_6 = __pyx_t_7;
+    }
+    if (__pyx_t_6) {
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":791
+ *         if ((child.byteorder == '>' and little_endian) or
+ *             (child.byteorder == '<' and not little_endian)):
+ *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
+ *             # One could encode it in the format string and have Cython
+ *             # complain instead, BUT: < and > in format strings also imply
+ */
+      __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_Raise(__pyx_t_5, 0, 0);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      goto __pyx_L6;
+    }
+    __pyx_L6:;
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":801
+ * 
+ *         # Output padding bytes
+ *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
+ *             f[0] = 120 # "x"; pad byte
+ *             f += 1
+ */
+    while (1) {
+      __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (!__pyx_t_6) break;
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":802
+ *         # Output padding bytes
+ *         while offset[0] < new_offset:
+ *             f[0] = 120 # "x"; pad byte             # <<<<<<<<<<<<<<
+ *             f += 1
+ *             offset[0] += 1
+ */
+      (__pyx_v_f[0]) = 120;
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":803
+ *         while offset[0] < new_offset:
+ *             f[0] = 120 # "x"; pad byte
+ *             f += 1             # <<<<<<<<<<<<<<
+ *             offset[0] += 1
+ * 
+ */
+      __pyx_v_f = (__pyx_v_f + 1);
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":804
+ *             f[0] = 120 # "x"; pad byte
+ *             f += 1
+ *             offset[0] += 1             # <<<<<<<<<<<<<<
+ * 
+ *         offset[0] += child.itemsize
+ */
+      __pyx_t_10 = 0;
+      (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1);
+    }
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":806
+ *             offset[0] += 1
+ * 
+ *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
+ * 
+ *         if not PyDataType_HASFIELDS(child):
+ */
+    __pyx_t_10 = 0;
+    (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize);
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":808
+ *         offset[0] += child.itemsize
+ * 
+ *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
+ *             t = child.type_num
+ *             if end - f < 5:
+ */
+    __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child));
+    if (__pyx_t_6) {
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":809
+ * 
+ *         if not PyDataType_HASFIELDS(child):
+ *             t = child.type_num             # <<<<<<<<<<<<<<
+ *             if end - f < 5:
+ *                 raise RuntimeError(u"Format string allocated too short.")
+ */
+      __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(__pyx_v_t);
+      __pyx_v_t = __pyx_t_3;
+      __pyx_t_3 = 0;
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":810
+ *         if not PyDataType_HASFIELDS(child):
+ *             t = child.type_num
+ *             if end - f < 5:             # <<<<<<<<<<<<<<
+ *                 raise RuntimeError(u"Format string allocated too short.")
+ * 
+ */
+      __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5);
+      if (__pyx_t_6) {
+
+        /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":811
+ *             t = child.type_num
+ *             if end - f < 5:
+ *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
+ * 
+ *             # Until ticket #99 is fixed, use integers to avoid warnings
+ */
+        __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_3);
+        __Pyx_Raise(__pyx_t_3, 0, 0);
+        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        goto __pyx_L10;
+      }
+      __pyx_L10:;
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":814
+ * 
+ *             # Until ticket #99 is fixed, use integers to avoid warnings
+ *             if   t == NPY_BYTE:        f[0] =  98 #"b"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
+ *             elif t == NPY_SHORT:       f[0] = 104 #"h"
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 98;
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":815
+ *             # Until ticket #99 is fixed, use integers to avoid warnings
+ *             if   t == NPY_BYTE:        f[0] =  98 #"b"
+ *             elif t == NPY_UBYTE:       f[0] =  66 #"B"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_SHORT:       f[0] = 104 #"h"
+ *             elif t == NPY_USHORT:      f[0] =  72 #"H"
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 66;
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":816
+ *             if   t == NPY_BYTE:        f[0] =  98 #"b"
+ *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
+ *             elif t == NPY_SHORT:       f[0] = 104 #"h"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_USHORT:      f[0] =  72 #"H"
+ *             elif t == NPY_INT:         f[0] = 105 #"i"
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 104;
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":817
+ *             elif t == NPY_UBYTE:       f[0] =  66 #"B"
+ *             elif t == NPY_SHORT:       f[0] = 104 #"h"
+ *             elif t == NPY_USHORT:      f[0] =  72 #"H"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_INT:         f[0] = 105 #"i"
+ *             elif t == NPY_UINT:        f[0] =  73 #"I"
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 72;
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":818
+ *             elif t == NPY_SHORT:       f[0] = 104 #"h"
+ *             elif t == NPY_USHORT:      f[0] =  72 #"H"
+ *             elif t == NPY_INT:         f[0] = 105 #"i"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_UINT:        f[0] =  73 #"I"
+ *             elif t == NPY_LONG:        f[0] = 108 #"l"
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 105;
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":819
+ *             elif t == NPY_USHORT:      f[0] =  72 #"H"
+ *             elif t == NPY_INT:         f[0] = 105 #"i"
+ *             elif t == NPY_UINT:        f[0] =  73 #"I"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_LONG:        f[0] = 108 #"l"
+ *             elif t == NPY_ULONG:       f[0] = 76  #"L"
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 73;
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":820
+ *             elif t == NPY_INT:         f[0] = 105 #"i"
+ *             elif t == NPY_UINT:        f[0] =  73 #"I"
+ *             elif t == NPY_LONG:        f[0] = 108 #"l"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_ULONG:       f[0] = 76  #"L"
+ *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 108;
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":821
+ *             elif t == NPY_UINT:        f[0] =  73 #"I"
+ *             elif t == NPY_LONG:        f[0] = 108 #"l"
+ *             elif t == NPY_ULONG:       f[0] = 76  #"L"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
+ *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 76;
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":822
+ *             elif t == NPY_LONG:        f[0] = 108 #"l"
+ *             elif t == NPY_ULONG:       f[0] = 76  #"L"
+ *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
+ *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 113;
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":823
+ *             elif t == NPY_ULONG:       f[0] = 76  #"L"
+ *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
+ *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
+ *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 81;
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":824
+ *             elif t == NPY_LONGLONG:    f[0] = 113 #"q"
+ *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
+ *             elif t == NPY_FLOAT:       f[0] = 102 #"f"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
+ *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 102;
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":825
+ *             elif t == NPY_ULONGLONG:   f[0] = 81  #"Q"
+ *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
+ *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
+ *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 100;
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":826
+ *             elif t == NPY_FLOAT:       f[0] = 102 #"f"
+ *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
+ *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"             # <<<<<<<<<<<<<<
+ *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
+ *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 103;
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":827
+ *             elif t == NPY_DOUBLE:      f[0] = 100 #"d"
+ *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
+ *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf             # <<<<<<<<<<<<<<
+ *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
+ *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 90;
+        (__pyx_v_f[1]) = 102;
+        __pyx_v_f = (__pyx_v_f + 1);
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":828
+ *             elif t == NPY_LONGDOUBLE:  f[0] = 103 #"g"
+ *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
+ *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd             # <<<<<<<<<<<<<<
+ *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
+ *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 90;
+        (__pyx_v_f[1]) = 100;
+        __pyx_v_f = (__pyx_v_f + 1);
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":829
+ *             elif t == NPY_CFLOAT:      f[0] = 90; f[1] = 102; f += 1 # Zf
+ *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
+ *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg             # <<<<<<<<<<<<<<
+ *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
+ *             else:
+ */
+      __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 90;
+        (__pyx_v_f[1]) = 103;
+        __pyx_v_f = (__pyx_v_f + 1);
+        goto __pyx_L11;
+      }
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":830
+ *             elif t == NPY_CDOUBLE:     f[0] = 90; f[1] = 100; f += 1 # Zd
+ *             elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
+ *             elif t == NPY_OBJECT:      f[0] = 79 #"O"             # <<<<<<<<<<<<<<
+ *             else:
+ *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ */
+      __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_3);
+      __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+      __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      if (__pyx_t_6) {
+        (__pyx_v_f[0]) = 79;
+        goto __pyx_L11;
+      }
+      /*else*/ {
+
+        /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":832
+ *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
+ *             else:
+ *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
+ *             f += 1
+ *         else:
+ */
+        __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_5));
+        __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(((PyObject *)__pyx_t_3));
+        PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5));
+        __Pyx_GIVEREF(((PyObject *)__pyx_t_5));
+        __pyx_t_5 = 0;
+        __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+        __Pyx_GOTREF(__pyx_t_5);
+        __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
+        __Pyx_Raise(__pyx_t_5, 0, 0);
+        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      }
+      __pyx_L11:;
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":833
+ *             else:
+ *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
+ *             f += 1             # <<<<<<<<<<<<<<
+ *         else:
+ *             # Cython ignores struct boundary information ("T{...}"),
+ */
+      __pyx_v_f = (__pyx_v_f + 1);
+      goto __pyx_L9;
+    }
+    /*else*/ {
+
+      /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":837
+ *             # Cython ignores struct boundary information ("T{...}"),
+ *             # so don't output it
+ *             f = _util_dtypestring(child, f, end, offset)             # <<<<<<<<<<<<<<
+ *     return f
+ * 
+ */
+      __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __pyx_v_f = __pyx_t_11;
+    }
+    __pyx_L9:;
+  }
+  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":838
+ *             # so don't output it
+ *             f = _util_dtypestring(child, f, end, offset)
+ *     return f             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  __pyx_r = __pyx_v_f;
+  goto __pyx_L0;
+
+  __pyx_r = 0;
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_XDECREF(__pyx_t_3);
+  __Pyx_XDECREF(__pyx_t_4);
+  __Pyx_XDECREF(__pyx_t_5);
+  __Pyx_AddTraceback("numpy._util_dtypestring");
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_DECREF((PyObject *)__pyx_v_child);
+  __Pyx_DECREF(__pyx_v_fields);
+  __Pyx_DECREF(__pyx_v_childname);
+  __Pyx_DECREF(__pyx_v_new_offset);
+  __Pyx_DECREF(__pyx_v_t);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":953
+ * 
+ * 
+ * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
+ *      cdef PyObject* baseptr
+ *      if base is None:
+ */
+
+static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
+  PyObject *__pyx_v_baseptr;
+  int __pyx_t_1;
+  __Pyx_RefNannySetupContext("set_array_base");
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":955
+ * cdef inline void set_array_base(ndarray arr, object base):
+ *      cdef PyObject* baseptr
+ *      if base is None:             # <<<<<<<<<<<<<<
+ *          baseptr = NULL
+ *      else:
+ */
+  __pyx_t_1 = (__pyx_v_base == Py_None);
+  if (__pyx_t_1) {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":956
+ *      cdef PyObject* baseptr
+ *      if base is None:
+ *          baseptr = NULL             # <<<<<<<<<<<<<<
+ *      else:
+ *          Py_INCREF(base) # important to do this before decref below!
+ */
+    __pyx_v_baseptr = NULL;
+    goto __pyx_L3;
+  }
+  /*else*/ {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":958
+ *          baseptr = NULL
+ *      else:
+ *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
+ *          baseptr = <PyObject*>base
+ *      Py_XDECREF(arr.base)
+ */
+    Py_INCREF(__pyx_v_base);
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":959
+ *      else:
+ *          Py_INCREF(base) # important to do this before decref below!
+ *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
+ *      Py_XDECREF(arr.base)
+ *      arr.base = baseptr
+ */
+    __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
+  }
+  __pyx_L3:;
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":960
+ *          Py_INCREF(base) # important to do this before decref below!
+ *          baseptr = <PyObject*>base
+ *      Py_XDECREF(arr.base)             # <<<<<<<<<<<<<<
+ *      arr.base = baseptr
+ * 
+ */
+  Py_XDECREF(__pyx_v_arr->base);
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":961
+ *          baseptr = <PyObject*>base
+ *      Py_XDECREF(arr.base)
+ *      arr.base = baseptr             # <<<<<<<<<<<<<<
+ * 
+ * cdef inline object get_array_base(ndarray arr):
+ */
+  __pyx_v_arr->base = __pyx_v_baseptr;
+
+  __Pyx_RefNannyFinishContext();
+}
+
+/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":963
+ *      arr.base = baseptr
+ * 
+ * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
+ *     if arr.base is NULL:
+ *         return None
+ */
+
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
+  PyObject *__pyx_r = NULL;
+  int __pyx_t_1;
+  __Pyx_RefNannySetupContext("get_array_base");
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":964
+ * 
+ * cdef inline object get_array_base(ndarray arr):
+ *     if arr.base is NULL:             # <<<<<<<<<<<<<<
+ *         return None
+ *     else:
+ */
+  __pyx_t_1 = (__pyx_v_arr->base == NULL);
+  if (__pyx_t_1) {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":965
+ * cdef inline object get_array_base(ndarray arr):
+ *     if arr.base is NULL:
+ *         return None             # <<<<<<<<<<<<<<
+ *     else:
+ *         return <object>arr.base
+ */
+    __Pyx_XDECREF(__pyx_r);
+    __Pyx_INCREF(Py_None);
+    __pyx_r = Py_None;
+    goto __pyx_L0;
+    goto __pyx_L3;
+  }
+  /*else*/ {
+
+    /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":967
+ *         return None
+ *     else:
+ *         return <object>arr.base             # <<<<<<<<<<<<<<
+ */
+    __Pyx_XDECREF(__pyx_r);
+    __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
+    __pyx_r = ((PyObject *)__pyx_v_arr->base);
+    goto __pyx_L0;
+  }
+  __pyx_L3:;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+static PyMethodDef __pyx_methods[] = {
+  {0, 0, 0, 0}
+};
+
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef __pyx_moduledef = {
+    PyModuleDef_HEAD_INIT,
+    __Pyx_NAMESTR("byte_offset"),
+    __Pyx_DOCSTR(__pyx_k_13), /* m_doc */
+    -1, /* m_size */
+    __pyx_methods /* m_methods */,
+    NULL, /* m_reload */
+    NULL, /* m_traverse */
+    NULL, /* m_clear */
+    NULL /* m_free */
+};
+#endif
+
+static __Pyx_StringTabEntry __pyx_string_tab[] = {
+  {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0},
+  {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0},
+  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
+  {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0},
+  {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0},
+  {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0},
+  {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0},
+  {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0},
+  {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0},
+  {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0},
+  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
+  {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
+  {&__pyx_n_s____author__, __pyx_k____author__, sizeof(__pyx_k____author__), 0, 0, 1, 1},
+  {&__pyx_n_s____contact__, __pyx_k____contact__, sizeof(__pyx_k____contact__), 0, 0, 1, 1},
+  {&__pyx_n_s____copyright__, __pyx_k____copyright__, sizeof(__pyx_k____copyright__), 0, 0, 1, 1},
+  {&__pyx_n_s____license__, __pyx_k____license__, sizeof(__pyx_k____license__), 0, 0, 1, 1},
+  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
+  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
+  {&__pyx_n_s__analyseCython, __pyx_k__analyseCython, sizeof(__pyx_k__analyseCython), 0, 0, 1, 1},
+  {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1},
+  {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1},
+  {&__pyx_n_s__byte_offset, __pyx_k__byte_offset, sizeof(__pyx_k__byte_offset), 0, 0, 1, 1},
+  {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1},
+  {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1},
+  {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1},
+  {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1},
+  {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1},
+  {&__pyx_n_s__int64, __pyx_k__int64, sizeof(__pyx_k__int64), 0, 0, 1, 1},
+  {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1},
+  {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1},
+  {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1},
+  {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1},
+  {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1},
+  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
+  {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1},
+  {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1},
+  {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
+  {&__pyx_n_s__stream, __pyx_k__stream, sizeof(__pyx_k__stream), 0, 0, 1, 1},
+  {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1},
+  {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1},
+  {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1},
+  {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1},
+  {0, 0, 0, 0, 0, 0, 0}
+};
+static int __Pyx_InitCachedBuiltins(void) {
+  __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  return 0;
+  __pyx_L1_error:;
+  return -1;
+}
+
+static int __Pyx_InitCachedConstants(void) {
+  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":206
+ *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
+ *                 and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
+ *                 raise ValueError(u"ndarray is not C contiguous")             # <<<<<<<<<<<<<<
+ * 
+ *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
+ */
+  __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_1));
+  PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2));
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":210
+ *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
+ *                 and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
+ *                 raise ValueError(u"ndarray is not Fortran contiguous")             # <<<<<<<<<<<<<<
+ * 
+ *             info.buf = PyArray_DATA(self)
+ */
+  __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_3));
+  PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4));
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":248
+ *                 if ((descr.byteorder == '>' and little_endian) or
+ *                     (descr.byteorder == '<' and not little_endian)):
+ *                     raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
+ *                 if   t == NPY_BYTE:        f = "b"
+ *                 elif t == NPY_UBYTE:       f = "B"
+ */
+  __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
+  PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6));
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":787
+ * 
+ *         if (end - f) - (new_offset - offset[0]) < 15:
+ *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
+ * 
+ *         if ((child.byteorder == '>' and little_endian) or
+ */
+  __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_8));
+  PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9));
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":791
+ *         if ((child.byteorder == '>' and little_endian) or
+ *             (child.byteorder == '<' and not little_endian)):
+ *             raise ValueError(u"Non-native byte order not supported")             # <<<<<<<<<<<<<<
+ *             # One could encode it in the format string and have Cython
+ *             # complain instead, BUT: < and > in format strings also imply
+ */
+  __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_5));
+  PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10));
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":811
+ *             t = child.type_num
+ *             if end - f < 5:
+ *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
+ * 
+ *             # Until ticket #99 is fixed, use integers to avoid warnings
+ */
+  __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12));
+  __Pyx_INCREF(((PyObject *)__pyx_kp_u_11));
+  PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12));
+  __Pyx_RefNannyFinishContext();
+  return 0;
+  __pyx_L1_error:;
+  __Pyx_RefNannyFinishContext();
+  return -1;
+}
+
+static int __Pyx_InitGlobals(void) {
+  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  return 0;
+  __pyx_L1_error:;
+  return -1;
+}
+
+#if PY_MAJOR_VERSION < 3
+PyMODINIT_FUNC initbyte_offset(void); /*proto*/
+PyMODINIT_FUNC initbyte_offset(void)
+#else
+PyMODINIT_FUNC PyInit_byte_offset(void); /*proto*/
+PyMODINIT_FUNC PyInit_byte_offset(void)
+#endif
+{
+  PyObject *__pyx_t_1 = NULL;
+  #if CYTHON_REFNANNY
+  void* __pyx_refnanny = NULL;
+  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
+  if (!__Pyx_RefNanny) {
+      PyErr_Clear();
+      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
+      if (!__Pyx_RefNanny)
+          Py_FatalError("failed to import 'refnanny' module");
+  }
+  __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_byte_offset(void)", __LINE__, __FILE__);
+  #endif
+  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #ifdef __pyx_binding_PyCFunctionType_USED
+  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  #endif
+  /*--- Library function declarations ---*/
+  /*--- Threads initialization code ---*/
+  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
+  #ifdef WITH_THREAD /* Python build with threading support? */
+  PyEval_InitThreads();
+  #endif
+  #endif
+  /*--- Module creation code ---*/
+  #if PY_MAJOR_VERSION < 3
+  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("byte_offset"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION);
+  #else
+  __pyx_m = PyModule_Create(&__pyx_moduledef);
+  #endif
+  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  #if PY_MAJOR_VERSION < 3
+  Py_INCREF(__pyx_m);
+  #endif
+  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
+  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  /*--- Initialize various global constants etc. ---*/
+  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (__pyx_module_is_main_byte_offset) {
+    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+  }
+  /*--- Builtin init code ---*/
+  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  /*--- Constants init code ---*/
+  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  /*--- Global init code ---*/
+  /*--- Function export code ---*/
+  /*--- Type init code ---*/
+  /*--- Type import code ---*/
+  __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  /*--- Function import code ---*/
+  /*--- Execution code ---*/
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":15
+ * """
+ * 
+ * __author__ = "Jrme Kieffer"             # <<<<<<<<<<<<<<
+ * __contact__ = "jerome.kieffer at esrf.eu"
+ * __license__ = "GPLv3+"
+ */
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____author__, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":16
+ * 
+ * __author__ = "Jrme Kieffer"
+ * __contact__ = "jerome.kieffer at esrf.eu"             # <<<<<<<<<<<<<<
+ * __license__ = "GPLv3+"
+ * __copyright__ = "2010, European Synchrotron Radiation Facility, Grenoble, France"
+ */
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____contact__, ((PyObject *)__pyx_kp_s_15)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":17
+ * __author__ = "Jrme Kieffer"
+ * __contact__ = "jerome.kieffer at esrf.eu"
+ * __license__ = "GPLv3+"             # <<<<<<<<<<<<<<
+ * __copyright__ = "2010, European Synchrotron Radiation Facility, Grenoble, France"
+ * 
+ */
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____license__, ((PyObject *)__pyx_kp_s_16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":18
+ * __contact__ = "jerome.kieffer at esrf.eu"
+ * __license__ = "GPLv3+"
+ * __copyright__ = "2010, European Synchrotron Radiation Facility, Grenoble, France"             # <<<<<<<<<<<<<<
+ * 
+ * 
+ */
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____copyright__, ((PyObject *)__pyx_kp_s_17)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":22
+ * 
+ * cimport numpy
+ * import numpy             # <<<<<<<<<<<<<<
+ * import cython
+ * 
+ */
+  __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":26
+ * 
+ * @cython.boundscheck(False)
+ * def analyseCython(char * stream, int size):             # <<<<<<<<<<<<<<
+ *     """
+ *     Analyze a stream of char with any length of exception (2,4, or 8 bytes integers)
+ */
+  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11byte_offset_0analyseCython, NULL, __pyx_n_s__byte_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__analyseCython, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+  /* "/home/kieffer/workspace-local/fabio/trunk/src/byte_offset.pyx":1
+ * # coding: utf8             # <<<<<<<<<<<<<<
+ * """
+ * Authors:      Jrme Kieffer, ESRF
+ */
+  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
+
+  /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":963
+ *      arr.base = baseptr
+ * 
+ * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
+ *     if arr.base is NULL:
+ *         return None
+ */
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  if (__pyx_m) {
+    __Pyx_AddTraceback("init byte_offset");
+    Py_DECREF(__pyx_m); __pyx_m = 0;
+  } else if (!PyErr_Occurred()) {
+    PyErr_SetString(PyExc_ImportError, "init byte_offset");
+  }
+  __pyx_L0:;
+  __Pyx_RefNannyFinishContext();
+  #if PY_MAJOR_VERSION < 3
+  return;
+  #else
+  return __pyx_m;
+  #endif
+}
+
+/* Runtime support code */
+
+static void __Pyx_RaiseDoubleKeywordsError(
+    const char* func_name,
+    PyObject* kw_name)
+{
+    PyErr_Format(PyExc_TypeError,
+        #if PY_MAJOR_VERSION >= 3
+        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
+        #else
+        "%s() got multiple values for keyword argument '%s'", func_name,
+        PyString_AS_STRING(kw_name));
+        #endif
+}
+
+static void __Pyx_RaiseArgtupleInvalid(
+    const char* func_name,
+    int exact,
+    Py_ssize_t num_min,
+    Py_ssize_t num_max,
+    Py_ssize_t num_found)
+{
+    Py_ssize_t num_expected;
+    const char *number, *more_or_less;
+
+    if (num_found < num_min) {
+        num_expected = num_min;
+        more_or_less = "at least";
+    } else {
+        num_expected = num_max;
+        more_or_less = "at most";
+    }
+    if (exact) {
+        more_or_less = "exactly";
+    }
+    number = (num_expected == 1) ? "" : "s";
+    PyErr_Format(PyExc_TypeError,
+        #if PY_VERSION_HEX < 0x02050000
+            "%s() takes %s %d positional argument%s (%d given)",
+        #else
+            "%s() takes %s %zd positional argument%s (%zd given)",
+        #endif
+        func_name, more_or_less, num_expected, number, num_found);
+}
+
+static int __Pyx_ParseOptionalKeywords(
+    PyObject *kwds,
+    PyObject **argnames[],
+    PyObject *kwds2,
+    PyObject *values[],
+    Py_ssize_t num_pos_args,
+    const char* function_name)
+{
+    PyObject *key = 0, *value = 0;
+    Py_ssize_t pos = 0;
+    PyObject*** name;
+    PyObject*** first_kw_arg = argnames + num_pos_args;
+
+    while (PyDict_Next(kwds, &pos, &key, &value)) {
+        name = first_kw_arg;
+        while (*name && (**name != key)) name++;
+        if (*name) {
+            values[name-argnames] = value;
+        } else {
+            #if PY_MAJOR_VERSION < 3
+            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
+            #else
+            if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) {
+            #endif
+                goto invalid_keyword_type;
+            } else {
+                for (name = first_kw_arg; *name; name++) {
+                    #if PY_MAJOR_VERSION >= 3
+                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
+                        PyUnicode_Compare(**name, key) == 0) break;
+                    #else
+                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
+                        _PyString_Eq(**name, key)) break;
+                    #endif
+                }
+                if (*name) {
+                    values[name-argnames] = value;
+                } else {
+                    /* unexpected keyword found */
+                    for (name=argnames; name != first_kw_arg; name++) {
+                        if (**name == key) goto arg_passed_twice;
+                        #if PY_MAJOR_VERSION >= 3
+                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
+                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
+                        #else
+                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
+                            _PyString_Eq(**name, key)) goto arg_passed_twice;
+                        #endif
+                    }
+                    if (kwds2) {
+                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
+                    } else {
+                        goto invalid_keyword;
+                    }
+                }
+            }
+        }
+    }
+    return 0;
+arg_passed_twice:
+    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
+    goto bad;
+invalid_keyword_type:
+    PyErr_Format(PyExc_TypeError,
+        "%s() keywords must be strings", function_name);
+    goto bad;
+invalid_keyword:
+    PyErr_Format(PyExc_TypeError,
+    #if PY_MAJOR_VERSION < 3
+        "%s() got an unexpected keyword argument '%s'",
+        function_name, PyString_AsString(key));
+    #else
+        "%s() got an unexpected keyword argument '%U'",
+        function_name, key);
+    #endif
+bad:
+    return -1;
+}
+
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
+    PyObject *result;
+    result = PyObject_GetAttr(dict, name);
+    if (!result)
+        PyErr_SetObject(PyExc_NameError, name);
+    return result;
+}
+
+static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
+    if (unlikely(!type)) {
+        PyErr_Format(PyExc_SystemError, "Missing type object");
+        return 0;
+    }
+    if (likely(PyObject_TypeCheck(obj, type)))
+        return 1;
+    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
+                 Py_TYPE(obj)->tp_name, type->tp_name);
+    return 0;
+}
+
+static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
+  unsigned int n = 1;
+  return *(unsigned char*)(&n) != 0;
+}
+
+typedef struct {
+  __Pyx_StructField root;
+  __Pyx_BufFmt_StackElem* head;
+  size_t fmt_offset;
+  int new_count, enc_count;
+  int is_complex;
+  char enc_type;
+  char packmode;
+} __Pyx_BufFmt_Context;
+
+static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
+                              __Pyx_BufFmt_StackElem* stack,
+                              __Pyx_TypeInfo* type) {
+  stack[0].field = &ctx->root;
+  stack[0].parent_offset = 0;
+  ctx->root.type = type;
+  ctx->root.name = "buffer dtype";
+  ctx->root.offset = 0;
+  ctx->head = stack;
+  ctx->head->field = &ctx->root;
+  ctx->fmt_offset = 0;
+  ctx->head->parent_offset = 0;
+  ctx->packmode = '@';
+  ctx->new_count = 1;
+  ctx->enc_count = 0;
+  ctx->enc_type = 0;
+  ctx->is_complex = 0;
+  while (type->typegroup == 'S') {
+    ++ctx->head;
+    ctx->head->field = type->fields;
+    ctx->head->parent_offset = 0;
+    type = type->fields->type;
+  }
+}
+
+static int __Pyx_BufFmt_ParseNumber(const char** ts) {
+    int count;
+    const char* t = *ts;
+    if (*t < '0' || *t > '9') {
+      return -1;
+    } else {
+        count = *t++ - '0';
+        while (*t >= '0' && *t < '9') {
+            count *= 10;
+            count += *t++ - '0';
+        }
+    }
+    *ts = t;
+    return count;
+}
+
+static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
+  char msg[] = {ch, 0};
+  PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%s'", msg);
+}
+
+static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
+  switch (ch) {
+    case 'b': return "'char'";
+    case 'B': return "'unsigned char'";
+    case 'h': return "'short'";
+    case 'H': return "'unsigned short'";
+    case 'i': return "'int'";
+    case 'I': return "'unsigned int'";
+    case 'l': return "'long'";
+    case 'L': return "'unsigned long'";
+    case 'q': return "'long long'";
+    case 'Q': return "'unsigned long long'";
+    case 'f': return (is_complex ? "'complex float'" : "'float'");
+    case 'd': return (is_complex ? "'complex double'" : "'double'");
+    case 'g': return (is_complex ? "'complex long double'" : "'long double'");
+    case 'T': return "a struct";
+    case 'O': return "Python object";
+    case 'P': return "a pointer";
+    case 0: return "end";
+    default: return "unparseable format string";
+  }
+}
+
+static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
+  switch (ch) {
+    case '?': case 'c': case 'b': case 'B': return 1;
+    case 'h': case 'H': return 2;
+    case 'i': case 'I': case 'l': case 'L': return 4;
+    case 'q': case 'Q': return 8;
+    case 'f': return (is_complex ? 8 : 4);
+    case 'd': return (is_complex ? 16 : 8);
+    case 'g': {
+      PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
+      return 0;
+    }
+    case 'O': case 'P': return sizeof(void*);
+    default:
+      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
+      return 0;
+    }
+}
+
+static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
+  switch (ch) {
+    case 'c': case 'b': case 'B': return 1;
+    case 'h': case 'H': return sizeof(short);
+    case 'i': case 'I': return sizeof(int);
+    case 'l': case 'L': return sizeof(long);
+    #ifdef HAVE_LONG_LONG
+    case 'q': case 'Q': return sizeof(PY_LONG_LONG);
+    #endif
+    case 'f': return sizeof(float) * (is_complex ? 2 : 1);
+    case 'd': return sizeof(double) * (is_complex ? 2 : 1);
+    case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
+    case 'O': case 'P': return sizeof(void*);
+    default: {
+      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
+      return 0;
+    }
+  }
+}
+
+typedef struct { char c; short x; } __Pyx_st_short;
+typedef struct { char c; int x; } __Pyx_st_int;
+typedef struct { char c; long x; } __Pyx_st_long;
+typedef struct { char c; float x; } __Pyx_st_float;
+typedef struct { char c; double x; } __Pyx_st_double;
+typedef struct { char c; long double x; } __Pyx_st_longdouble;
+typedef struct { char c; void *x; } __Pyx_st_void_p;
+#ifdef HAVE_LONG_LONG
+typedef struct { char c; PY_LONG_LONG x; } __Pyx_s_long_long;
+#endif
+
+static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) {
+  switch (ch) {
+    case '?': case 'c': case 'b': case 'B': return 1;
+    case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
+    case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
+    case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
+#ifdef HAVE_LONG_LONG
+    case 'q': case 'Q': return sizeof(__Pyx_s_long_long) - sizeof(PY_LONG_LONG);
+#endif
+    case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
+    case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
+    case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
+    case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
+    default:
+      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
+      return 0;
+    }
+}
+
+static size_t __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
+  switch (ch) {
+    case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I';
+    case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U';
+    case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R');
+    case 'O': return 'O';
+    case 'P': return 'P';
+    default: {
+      __Pyx_BufFmt_RaiseUnexpectedChar(ch);
+      return 0;
+    }
+  }
+}
+
+static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
+  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
+    const char* expected;
+    const char* quote;
+    if (ctx->head == NULL) {
+      expected = "end";
+      quote = "";
+    } else {
+      expected = ctx->head->field->type->name;
+      quote = "'";
+    }
+    PyErr_Format(PyExc_ValueError,
+                 "Buffer dtype mismatch, expected %s%s%s but got %s",
+                 quote, expected, quote,
+                 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
+  } else {
+    __Pyx_StructField* field = ctx->head->field;
+    __Pyx_StructField* parent = (ctx->head - 1)->field;
+    PyErr_Format(PyExc_ValueError,
+                 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
+                 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
+                 parent->type->name, field->name);
+  }
+}
+
+static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
+  char group;
+  size_t size, offset;
+  if (ctx->enc_type == 0) return 0;
+  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
+  do {
+    __Pyx_StructField* field = ctx->head->field;
+    __Pyx_TypeInfo* type = field->type;
+
+    if (ctx->packmode == '@' || ctx->packmode == '^') {
+      size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
+    } else {
+      size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
+    }
+    if (ctx->packmode == '@') {
+      int align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
+      int align_mod_offset;
+      if (align_at == 0) return -1;
+      align_mod_offset = ctx->fmt_offset % align_at;
+      if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
+    }
+
+    if (type->size != size || type->typegroup != group) {
+      if (type->typegroup == 'C' && type->fields != NULL) {
+        /* special case -- treat as struct rather than complex number */
+        size_t parent_offset = ctx->head->parent_offset + field->offset;
+        ++ctx->head;
+        ctx->head->field = type->fields;
+        ctx->head->parent_offset = parent_offset;
+        continue;
+      }
+
+      __Pyx_BufFmt_RaiseExpected(ctx);
+      return -1;
+    }
+
+    offset = ctx->head->parent_offset + field->offset;
+    if (ctx->fmt_offset != offset) {
+      PyErr_Format(PyExc_ValueError,
+                   "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d "
+                   "but %"PY_FORMAT_SIZE_T"d expected", ctx->fmt_offset, offset);
+      return -1;
+    }
+
+    ctx->fmt_offset += size;
+
+    --ctx->enc_count; /* Consume from buffer string */
+
+    /* Done checking, move to next field, pushing or popping struct stack if needed */
+    while (1) {
+      if (field == &ctx->root) {
+        ctx->head = NULL;
+        if (ctx->enc_count != 0) {
+          __Pyx_BufFmt_RaiseExpected(ctx);
+          return -1;
+        }
+        break; /* breaks both loops as ctx->enc_count == 0 */
+      }
+      ctx->head->field = ++field;
+      if (field->type == NULL) {
+        --ctx->head;
+        field = ctx->head->field;
+        continue;
+      } else if (field->type->typegroup == 'S') {
+        size_t parent_offset = ctx->head->parent_offset + field->offset;
+        if (field->type->fields->type == NULL) continue; /* empty struct */
+        field = field->type->fields;
+        ++ctx->head;
+        ctx->head->field = field;
+        ctx->head->parent_offset = parent_offset;
+        break;
+      } else {
+        break;
+      }
+    }
+  } while (ctx->enc_count);
+  ctx->enc_type = 0;
+  ctx->is_complex = 0;
+  return 0;
+}
+
+static int __Pyx_BufFmt_FirstPack(__Pyx_BufFmt_Context* ctx) {
+  if (ctx->enc_type != 0 || ctx->packmode != '@') {
+    PyErr_SetString(PyExc_ValueError, "Buffer packing mode currently only allowed at beginning of format string (this is a defect)");
+    return -1;
+  }
+  return 0;
+}
+
+static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
+  int got_Z = 0;
+  while (1) {
+    switch(*ts) {
+      case 0:
+        if (ctx->enc_type != 0 && ctx->head == NULL) {
+          __Pyx_BufFmt_RaiseExpected(ctx);
+          return NULL;
+        }
+        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+        if (ctx->head != NULL) {
+          __Pyx_BufFmt_RaiseExpected(ctx);
+          return NULL;
+        }
+        return ts;
+      case ' ':
+      case 10:
+      case 13:
+        ++ts;
+        break;
+      case '<':
+        if (!__Pyx_IsLittleEndian()) {
+          PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
+          return NULL;
+        }
+        if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL;
+        ctx->packmode = '=';
+        ++ts;
+        break;
+      case '>':
+      case '!':
+        if (__Pyx_IsLittleEndian()) {
+          PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
+          return NULL;
+        }
+        if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL;
+        ctx->packmode = '=';
+        ++ts;
+        break;
+      case '=':
+      case '@':
+      case '^':
+        if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL;
+        ctx->packmode = *ts++;
+        break;
+      case 'T': /* substruct */
+        {
+          int i;
+          const char* ts_after_sub;
+          int struct_count = ctx->new_count;
+          ctx->new_count = 1;
+          ++ts;
+          if (*ts != '{') {
+            PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
+            return NULL;
+          }
+          ++ts;
+          ts_after_sub = ts;
+          for (i = 0; i != struct_count; ++i) {
+            ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
+            if (!ts_after_sub) return NULL;
+          }
+          ts = ts_after_sub;
+        }
+        break;
+      case '}': /* end of substruct; either repeat or move on */
+        ++ts;
+        return ts;
+      case 'x':
+        if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+        ctx->fmt_offset += ctx->new_count;
+        ctx->new_count = 1;
+        ctx->enc_count = 0;
+        ctx->enc_type = 0;
+        ++ts;
+        break;
+      case 'Z':
+        got_Z = 1;
+        ++ts;
+        if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
+          __Pyx_BufFmt_RaiseUnexpectedChar('Z');
+          return NULL;
+        }        /* fall through */
+      case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
+      case 'l': case 'L': case 'q': case 'Q':
+      case 'f': case 'd': case 'g':
+      case 'O':
+        if (ctx->enc_type == *ts && got_Z == ctx->is_complex) {
+          /* Continue pooling same type */
+          ctx->enc_count += ctx->new_count;
+        } else {
+          /* New type */
+          if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
+          ctx->enc_count = ctx->new_count;
+          ctx->enc_type = *ts;
+          ctx->is_complex = got_Z;
+        }
+        ++ts;
+        ctx->new_count = 1;
+        got_Z = 0;
+        break;
+      default:
+        {
+          ctx->new_count = __Pyx_BufFmt_ParseNumber(&ts);
+          if (ctx->new_count == -1) { /* First char was not a digit */
+            char msg[2] = { *ts, 0 };
+            PyErr_Format(PyExc_ValueError,
+                         "Does not understand character buffer dtype format string ('%s')", msg);
+            return NULL;
+          }
+        }
+
+    }
+  }
+}
+
+static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
+  buf->buf = NULL;
+  buf->obj = NULL;
+  buf->strides = __Pyx_zeros;
+  buf->shape = __Pyx_zeros;
+  buf->suboffsets = __Pyx_minusones;
+}
+
+static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) {
+  if (obj == Py_None) {
+    __Pyx_ZeroBuffer(buf);
+    return 0;
+  }
+  buf->buf = NULL;
+  if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
+  if (buf->ndim != nd) {
+    PyErr_Format(PyExc_ValueError,
+                 "Buffer has wrong number of dimensions (expected %d, got %d)",
+                 nd, buf->ndim);
+    goto fail;
+  }
+  if (!cast) {
+    __Pyx_BufFmt_Context ctx;
+    __Pyx_BufFmt_Init(&ctx, stack, dtype);
+    if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
+  }
+  if ((unsigned)buf->itemsize != dtype->size) {
+    PyErr_Format(PyExc_ValueError,
+      "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)",
+      buf->itemsize, (buf->itemsize > 1) ? "s" : "",
+      dtype->name,
+      dtype->size, (dtype->size > 1) ? "s" : "");
+    goto fail;
+  }
+  if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
+  return 0;
+fail:;
+  __Pyx_ZeroBuffer(buf);
+  return -1;
+}
+
+static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
+  if (info->buf == NULL) return;
+  if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
+  __Pyx_ReleaseBuffer(info);
+}
+
+static void __Pyx_RaiseBufferFallbackError(void) {
+  PyErr_Format(PyExc_ValueError,
+     "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
+}
+
+
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
+    PyObject *tmp_type, *tmp_value, *tmp_tb;
+    PyThreadState *tstate = PyThreadState_GET();
+
+    tmp_type = tstate->curexc_type;
+    tmp_value = tstate->curexc_value;
+    tmp_tb = tstate->curexc_traceback;
+    tstate->curexc_type = type;
+    tstate->curexc_value = value;
+    tstate->curexc_traceback = tb;
+    Py_XDECREF(tmp_type);
+    Py_XDECREF(tmp_value);
+    Py_XDECREF(tmp_tb);
+}
+
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
+    PyThreadState *tstate = PyThreadState_GET();
+    *type = tstate->curexc_type;
+    *value = tstate->curexc_value;
+    *tb = tstate->curexc_traceback;
+
+    tstate->curexc_type = 0;
+    tstate->curexc_value = 0;
+    tstate->curexc_traceback = 0;
+}
+
+
+static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
+    PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
+}
+
+static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
+    PyErr_Format(PyExc_ValueError,
+        #if PY_VERSION_HEX < 0x02050000
+                 "need more than %d value%s to unpack", (int)index,
+        #else
+                 "need more than %zd value%s to unpack", index,
+        #endif
+                 (index == 1) ? "" : "s");
+}
+
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
+    PyErr_Format(PyExc_ValueError,
+        #if PY_VERSION_HEX < 0x02050000
+            "too many values to unpack (expected %d)", (int)expected);
+        #else
+            "too many values to unpack (expected %zd)", expected);
+        #endif
+}
+
+static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
+    if (t == Py_None) {
+      __Pyx_RaiseNoneNotIterableError();
+    } else if (PyTuple_GET_SIZE(t) < index) {
+      __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
+    } else {
+      __Pyx_RaiseTooManyValuesError(index);
+    }
+}
+
+#if PY_MAJOR_VERSION < 3
+static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
+  #if PY_VERSION_HEX >= 0x02060000
+  if (Py_TYPE(obj)->tp_flags & Py_TPFLAGS_HAVE_NEWBUFFER)
+      return PyObject_GetBuffer(obj, view, flags);
+  #endif
+  if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray_0__getbuffer__(obj, view, flags);
+  else {
+  PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
+  return -1;
+    }
+}
+
+static void __Pyx_ReleaseBuffer(Py_buffer *view) {
+  PyObject* obj = view->obj;
+  if (obj) {
+if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view);
+    Py_DECREF(obj);
+    view->obj = NULL;
+  }
+}
+
+#endif
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
+    PyObject *py_import = 0;
+    PyObject *empty_list = 0;
+    PyObject *module = 0;
+    PyObject *global_dict = 0;
+    PyObject *empty_dict = 0;
+    PyObject *list;
+    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
+    if (!py_import)
+        goto bad;
+    if (from_list)
+        list = from_list;
+    else {
+        empty_list = PyList_New(0);
+        if (!empty_list)
+            goto bad;
+        list = empty_list;
+    }
+    global_dict = PyModule_GetDict(__pyx_m);
+    if (!global_dict)
+        goto bad;
+    empty_dict = PyDict_New();
+    if (!empty_dict)
+        goto bad;
+    module = PyObject_CallFunctionObjArgs(py_import,
+        name, global_dict, empty_dict, list, NULL);
+bad:
+    Py_XDECREF(empty_list);
+    Py_XDECREF(py_import);
+    Py_XDECREF(empty_dict);
+    return module;
+}
+
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
+      return ::std::complex< float >(x, y);
+    }
+  #else
+    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
+      return x + y*(__pyx_t_float_complex)_Complex_I;
+    }
+  #endif
+#else
+    static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
+      __pyx_t_float_complex z;
+      z.real = x;
+      z.imag = y;
+      return z;
+    }
+#endif
+
+#if CYTHON_CCOMPLEX
+#else
+    static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+       return (a.real == b.real) && (a.imag == b.imag);
+    }
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+        __pyx_t_float_complex z;
+        z.real = a.real + b.real;
+        z.imag = a.imag + b.imag;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+        __pyx_t_float_complex z;
+        z.real = a.real - b.real;
+        z.imag = a.imag - b.imag;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+        __pyx_t_float_complex z;
+        z.real = a.real * b.real - a.imag * b.imag;
+        z.imag = a.real * b.imag + a.imag * b.real;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+        __pyx_t_float_complex z;
+        float denom = b.real * b.real + b.imag * b.imag;
+        z.real = (a.real * b.real + a.imag * b.imag) / denom;
+        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) {
+        __pyx_t_float_complex z;
+        z.real = -a.real;
+        z.imag = -a.imag;
+        return z;
+    }
+    static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) {
+       return (a.real == 0) && (a.imag == 0);
+    }
+    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) {
+        __pyx_t_float_complex z;
+        z.real =  a.real;
+        z.imag = -a.imag;
+        return z;
+    }
+    #if 1
+        static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) {
+//          #if HAVE_HYPOT
+//            return hypotf(z.real, z.imag);
+//          #else
+            return sqrtf(z.real*z.real + z.imag*z.imag);
+//          #endif
+        }
+        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) {
+            __pyx_t_float_complex z;
+            float r, lnr, theta, z_r, z_theta;
+            if (b.imag == 0 && b.real == (int)b.real) {
+                if (b.real < 0) {
+                    float denom = a.real * a.real + a.imag * a.imag;
+                    a.real = a.real / denom;
+                    a.imag = -a.imag / denom;
+                    b.real = -b.real;
+                }
+                switch ((int)b.real) {
+                    case 0:
+                        z.real = 1;
+                        z.imag = 0;
+                        return z;
+                    case 1:
+                        return a;
+                    case 2:
+                        z = __Pyx_c_prodf(a, a);
+                        return __Pyx_c_prodf(a, a);
+                    case 3:
+                        z = __Pyx_c_prodf(a, a);
+                        return __Pyx_c_prodf(z, a);
+                    case 4:
+                        z = __Pyx_c_prodf(a, a);
+                        return __Pyx_c_prodf(z, z);
+                }
+            }
+            if (a.imag == 0) {
+                if (a.real == 0) {
+                    return a;
+                }
+                r = a.real;
+                theta = 0;
+            } else {
+                r = __Pyx_c_absf(a);
+                theta = atan2f(a.imag, a.real);
+            }
+            lnr = logf(r);
+            z_r = expf(lnr * b.real - theta * b.imag);
+            z_theta = theta * b.real + lnr * b.imag;
+            z.real = z_r * cosf(z_theta);
+            z.imag = z_r * sinf(z_theta);
+            return z;
+        }
+    #endif
+#endif
+
+#if CYTHON_CCOMPLEX
+  #ifdef __cplusplus
+    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
+      return ::std::complex< double >(x, y);
+    }
+  #else
+    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
+      return x + y*(__pyx_t_double_complex)_Complex_I;
+    }
+  #endif
+#else
+    static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
+      __pyx_t_double_complex z;
+      z.real = x;
+      z.imag = y;
+      return z;
+    }
+#endif
+
+#if CYTHON_CCOMPLEX
+#else
+    static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+       return (a.real == b.real) && (a.imag == b.imag);
+    }
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+        __pyx_t_double_complex z;
+        z.real = a.real + b.real;
+        z.imag = a.imag + b.imag;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+        __pyx_t_double_complex z;
+        z.real = a.real - b.real;
+        z.imag = a.imag - b.imag;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+        __pyx_t_double_complex z;
+        z.real = a.real * b.real - a.imag * b.imag;
+        z.imag = a.real * b.imag + a.imag * b.real;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+        __pyx_t_double_complex z;
+        double denom = b.real * b.real + b.imag * b.imag;
+        z.real = (a.real * b.real + a.imag * b.imag) / denom;
+        z.imag = (a.imag * b.real - a.real * b.imag) / denom;
+        return z;
+    }
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) {
+        __pyx_t_double_complex z;
+        z.real = -a.real;
+        z.imag = -a.imag;
+        return z;
+    }
+    static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) {
+       return (a.real == 0) && (a.imag == 0);
+    }
+    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) {
+        __pyx_t_double_complex z;
+        z.real =  a.real;
+        z.imag = -a.imag;
+        return z;
+    }
+    #if 1
+        static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) {
+//          #if HAVE_HYPOT
+//            return hypot(z.real, z.imag);
+//          #else
+            return sqrt(z.real*z.real + z.imag*z.imag);
+//          #endif
+        }
+        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) {
+            __pyx_t_double_complex z;
+            double r, lnr, theta, z_r, z_theta;
+            if (b.imag == 0 && b.real == (int)b.real) {
+                if (b.real < 0) {
+                    double denom = a.real * a.real + a.imag * a.imag;
+                    a.real = a.real / denom;
+                    a.imag = -a.imag / denom;
+                    b.real = -b.real;
+                }
+                switch ((int)b.real) {
+                    case 0:
+                        z.real = 1;
+                        z.imag = 0;
+                        return z;
+                    case 1:
+                        return a;
+                    case 2:
+                        z = __Pyx_c_prod(a, a);
+                        return __Pyx_c_prod(a, a);
+                    case 3:
+                        z = __Pyx_c_prod(a, a);
+                        return __Pyx_c_prod(z, a);
+                    case 4:
+                        z = __Pyx_c_prod(a, a);
+                        return __Pyx_c_prod(z, z);
+                }
+            }
+            if (a.imag == 0) {
+                if (a.real == 0) {
+                    return a;
+                }
+                r = a.real;
+                theta = 0;
+            } else {
+                r = __Pyx_c_abs(a);
+                theta = atan2(a.imag, a.real);
+            }
+            lnr = log(r);
+            z_r = exp(lnr * b.real - theta * b.imag);
+            z_theta = theta * b.real + lnr * b.imag;
+            z.real = z_r * cos(z_theta);
+            z.imag = z_r * sin(z_theta);
+            return z;
+        }
+    #endif
+#endif
+
+#if PY_MAJOR_VERSION < 3
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
+    Py_XINCREF(type);
+    Py_XINCREF(value);
+    Py_XINCREF(tb);
+    /* First, check the traceback argument, replacing None with NULL. */
+    if (tb == Py_None) {
+        Py_DECREF(tb);
+        tb = 0;
+    }
+    else if (tb != NULL && !PyTraceBack_Check(tb)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: arg 3 must be a traceback or None");
+        goto raise_error;
+    }
+    /* Next, replace a missing value with None */
+    if (value == NULL) {
+        value = Py_None;
+        Py_INCREF(value);
+    }
+    #if PY_VERSION_HEX < 0x02050000
+    if (!PyClass_Check(type))
+    #else
+    if (!PyType_Check(type))
+    #endif
+    {
+        /* Raising an instance.  The value should be a dummy. */
+        if (value != Py_None) {
+            PyErr_SetString(PyExc_TypeError,
+                "instance exception may not have a separate value");
+            goto raise_error;
+        }
+        /* Normalize to raise <class>, <instance> */
+        Py_DECREF(value);
+        value = type;
+        #if PY_VERSION_HEX < 0x02050000
+            if (PyInstance_Check(type)) {
+                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
+                Py_INCREF(type);
+            }
+            else {
+                type = 0;
+                PyErr_SetString(PyExc_TypeError,
+                    "raise: exception must be an old-style class or instance");
+                goto raise_error;
+            }
+        #else
+            type = (PyObject*) Py_TYPE(type);
+            Py_INCREF(type);
+            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
+                PyErr_SetString(PyExc_TypeError,
+                    "raise: exception class must be a subclass of BaseException");
+                goto raise_error;
+            }
+        #endif
+    }
+
+    __Pyx_ErrRestore(type, value, tb);
+    return;
+raise_error:
+    Py_XDECREF(value);
+    Py_XDECREF(type);
+    Py_XDECREF(tb);
+    return;
+}
+
+#else /* Python 3+ */
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
+    if (tb == Py_None) {
+        tb = 0;
+    } else if (tb && !PyTraceBack_Check(tb)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: arg 3 must be a traceback or None");
+        goto bad;
+    }
+    if (value == Py_None)
+        value = 0;
+
+    if (PyExceptionInstance_Check(type)) {
+        if (value) {
+            PyErr_SetString(PyExc_TypeError,
+                "instance exception may not have a separate value");
+            goto bad;
+        }
+        value = type;
+        type = (PyObject*) Py_TYPE(value);
+    } else if (!PyExceptionClass_Check(type)) {
+        PyErr_SetString(PyExc_TypeError,
+            "raise: exception class must be a subclass of BaseException");
+        goto bad;
+    }
+
+    PyErr_SetObject(type, value);
+
+    if (tb) {
+        PyThreadState *tstate = PyThreadState_GET();
+        PyObject* tmp_tb = tstate->curexc_traceback;
+        if (tb != tmp_tb) {
+            Py_INCREF(tb);
+            tstate->curexc_traceback = tb;
+            Py_XDECREF(tmp_tb);
+        }
+    }
+
+bad:
+    return;
+}
+#endif
+
+static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
+    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+    if (sizeof(unsigned char) < sizeof(long)) {
+        long val = __Pyx_PyInt_AsLong(x);
+        if (unlikely(val != (long)(unsigned char)val)) {
+            if (!unlikely(val == -1 && PyErr_Occurred())) {
+                PyErr_SetString(PyExc_OverflowError,
+                    (is_unsigned && unlikely(val < 0)) ?
+                    "can't convert negative value to unsigned char" :
+                    "value too large to convert to unsigned char");
+            }
+            return (unsigned char)-1;
+        }
+        return (unsigned char)val;
+    }
+    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
+}
+
+static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
+    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+    if (sizeof(unsigned short) < sizeof(long)) {
+        long val = __Pyx_PyInt_AsLong(x);
+        if (unlikely(val != (long)(unsigned short)val)) {
+            if (!unlikely(val == -1 && PyErr_Occurred())) {
+                PyErr_SetString(PyExc_OverflowError,
+                    (is_unsigned && unlikely(val < 0)) ?
+                    "can't convert negative value to unsigned short" :
+                    "value too large to convert to unsigned short");
+            }
+            return (unsigned short)-1;
+        }
+        return (unsigned short)val;
+    }
+    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
+}
+
+static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
+    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+    if (sizeof(unsigned int) < sizeof(long)) {
+        long val = __Pyx_PyInt_AsLong(x);
+        if (unlikely(val != (long)(unsigned int)val)) {
+            if (!unlikely(val == -1 && PyErr_Occurred())) {
+                PyErr_SetString(PyExc_OverflowError,
+                    (is_unsigned && unlikely(val < 0)) ?
+                    "can't convert negative value to unsigned int" :
+                    "value too large to convert to unsigned int");
+            }
+            return (unsigned int)-1;
+        }
+        return (unsigned int)val;
+    }
+    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
+}
+
+static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
+    const char neg_one = (char)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+    if (sizeof(char) < sizeof(long)) {
+        long val = __Pyx_PyInt_AsLong(x);
+        if (unlikely(val != (long)(char)val)) {
+            if (!unlikely(val == -1 && PyErr_Occurred())) {
+                PyErr_SetString(PyExc_OverflowError,
+                    (is_unsigned && unlikely(val < 0)) ?
+                    "can't convert negative value to char" :
+                    "value too large to convert to char");
+            }
+            return (char)-1;
+        }
+        return (char)val;
+    }
+    return (char)__Pyx_PyInt_AsLong(x);
+}
+
+static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
+    const short neg_one = (short)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+    if (sizeof(short) < sizeof(long)) {
+        long val = __Pyx_PyInt_AsLong(x);
+        if (unlikely(val != (long)(short)val)) {
+            if (!unlikely(val == -1 && PyErr_Occurred())) {
+                PyErr_SetString(PyExc_OverflowError,
+                    (is_unsigned && unlikely(val < 0)) ?
+                    "can't convert negative value to short" :
+                    "value too large to convert to short");
+            }
+            return (short)-1;
+        }
+        return (short)val;
+    }
+    return (short)__Pyx_PyInt_AsLong(x);
+}
+
+static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
+    const int neg_one = (int)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+    if (sizeof(int) < sizeof(long)) {
+        long val = __Pyx_PyInt_AsLong(x);
+        if (unlikely(val != (long)(int)val)) {
+            if (!unlikely(val == -1 && PyErr_Occurred())) {
+                PyErr_SetString(PyExc_OverflowError,
+                    (is_unsigned && unlikely(val < 0)) ?
+                    "can't convert negative value to int" :
+                    "value too large to convert to int");
+            }
+            return (int)-1;
+        }
+        return (int)val;
+    }
+    return (int)__Pyx_PyInt_AsLong(x);
+}
+
+static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
+    const signed char neg_one = (signed char)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+    if (sizeof(signed char) < sizeof(long)) {
+        long val = __Pyx_PyInt_AsLong(x);
+        if (unlikely(val != (long)(signed char)val)) {
+            if (!unlikely(val == -1 && PyErr_Occurred())) {
+                PyErr_SetString(PyExc_OverflowError,
+                    (is_unsigned && unlikely(val < 0)) ?
+                    "can't convert negative value to signed char" :
+                    "value too large to convert to signed char");
+            }
+            return (signed char)-1;
+        }
+        return (signed char)val;
+    }
+    return (signed char)__Pyx_PyInt_AsSignedLong(x);
+}
+
+static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
+    const signed short neg_one = (signed short)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+    if (sizeof(signed short) < sizeof(long)) {
+        long val = __Pyx_PyInt_AsLong(x);
+        if (unlikely(val != (long)(signed short)val)) {
+            if (!unlikely(val == -1 && PyErr_Occurred())) {
+                PyErr_SetString(PyExc_OverflowError,
+                    (is_unsigned && unlikely(val < 0)) ?
+                    "can't convert negative value to signed short" :
+                    "value too large to convert to signed short");
+            }
+            return (signed short)-1;
+        }
+        return (signed short)val;
+    }
+    return (signed short)__Pyx_PyInt_AsSignedLong(x);
+}
+
+static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
+    const signed int neg_one = (signed int)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+    if (sizeof(signed int) < sizeof(long)) {
+        long val = __Pyx_PyInt_AsLong(x);
+        if (unlikely(val != (long)(signed int)val)) {
+            if (!unlikely(val == -1 && PyErr_Occurred())) {
+                PyErr_SetString(PyExc_OverflowError,
+                    (is_unsigned && unlikely(val < 0)) ?
+                    "can't convert negative value to signed int" :
+                    "value too large to convert to signed int");
+            }
+            return (signed int)-1;
+        }
+        return (signed int)val;
+    }
+    return (signed int)__Pyx_PyInt_AsSignedLong(x);
+}
+
+static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
+    const int neg_one = (int)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+    if (sizeof(int) < sizeof(long)) {
+        long val = __Pyx_PyInt_AsLong(x);
+        if (unlikely(val != (long)(int)val)) {
+            if (!unlikely(val == -1 && PyErr_Occurred())) {
+                PyErr_SetString(PyExc_OverflowError,
+                    (is_unsigned && unlikely(val < 0)) ?
+                    "can't convert negative value to int" :
+                    "value too large to convert to int");
+            }
+            return (int)-1;
+        }
+        return (int)val;
+    }
+    return (int)__Pyx_PyInt_AsLong(x);
+}
+
+static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
+    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+#if PY_VERSION_HEX < 0x03000000
+    if (likely(PyInt_Check(x))) {
+        long val = PyInt_AS_LONG(x);
+        if (is_unsigned && unlikely(val < 0)) {
+            PyErr_SetString(PyExc_OverflowError,
+                            "can't convert negative value to unsigned long");
+            return (unsigned long)-1;
+        }
+        return (unsigned long)val;
+    } else
+#endif
+    if (likely(PyLong_Check(x))) {
+        if (is_unsigned) {
+            if (unlikely(Py_SIZE(x) < 0)) {
+                PyErr_SetString(PyExc_OverflowError,
+                                "can't convert negative value to unsigned long");
+                return (unsigned long)-1;
+            }
+            return PyLong_AsUnsignedLong(x);
+        } else {
+            return PyLong_AsLong(x);
+        }
+    } else {
+        unsigned long val;
+        PyObject *tmp = __Pyx_PyNumber_Int(x);
+        if (!tmp) return (unsigned long)-1;
+        val = __Pyx_PyInt_AsUnsignedLong(tmp);
+        Py_DECREF(tmp);
+        return val;
+    }
+}
+
+static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
+    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+#if PY_VERSION_HEX < 0x03000000
+    if (likely(PyInt_Check(x))) {
+        long val = PyInt_AS_LONG(x);
+        if (is_unsigned && unlikely(val < 0)) {
+            PyErr_SetString(PyExc_OverflowError,
+                            "can't convert negative value to unsigned PY_LONG_LONG");
+            return (unsigned PY_LONG_LONG)-1;
+        }
+        return (unsigned PY_LONG_LONG)val;
+    } else
+#endif
+    if (likely(PyLong_Check(x))) {
+        if (is_unsigned) {
+            if (unlikely(Py_SIZE(x) < 0)) {
+                PyErr_SetString(PyExc_OverflowError,
+                                "can't convert negative value to unsigned PY_LONG_LONG");
+                return (unsigned PY_LONG_LONG)-1;
+            }
+            return PyLong_AsUnsignedLongLong(x);
+        } else {
+            return PyLong_AsLongLong(x);
+        }
+    } else {
+        unsigned PY_LONG_LONG val;
+        PyObject *tmp = __Pyx_PyNumber_Int(x);
+        if (!tmp) return (unsigned PY_LONG_LONG)-1;
+        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
+        Py_DECREF(tmp);
+        return val;
+    }
+}
+
+static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
+    const long neg_one = (long)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+#if PY_VERSION_HEX < 0x03000000
+    if (likely(PyInt_Check(x))) {
+        long val = PyInt_AS_LONG(x);
+        if (is_unsigned && unlikely(val < 0)) {
+            PyErr_SetString(PyExc_OverflowError,
+                            "can't convert negative value to long");
+            return (long)-1;
+        }
+        return (long)val;
+    } else
+#endif
+    if (likely(PyLong_Check(x))) {
+        if (is_unsigned) {
+            if (unlikely(Py_SIZE(x) < 0)) {
+                PyErr_SetString(PyExc_OverflowError,
+                                "can't convert negative value to long");
+                return (long)-1;
+            }
+            return PyLong_AsUnsignedLong(x);
+        } else {
+            return PyLong_AsLong(x);
+        }
+    } else {
+        long val;
+        PyObject *tmp = __Pyx_PyNumber_Int(x);
+        if (!tmp) return (long)-1;
+        val = __Pyx_PyInt_AsLong(tmp);
+        Py_DECREF(tmp);
+        return val;
+    }
+}
+
+static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
+    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+#if PY_VERSION_HEX < 0x03000000
+    if (likely(PyInt_Check(x))) {
+        long val = PyInt_AS_LONG(x);
+        if (is_unsigned && unlikely(val < 0)) {
+            PyErr_SetString(PyExc_OverflowError,
+                            "can't convert negative value to PY_LONG_LONG");
+            return (PY_LONG_LONG)-1;
+        }
+        return (PY_LONG_LONG)val;
+    } else
+#endif
+    if (likely(PyLong_Check(x))) {
+        if (is_unsigned) {
+            if (unlikely(Py_SIZE(x) < 0)) {
+                PyErr_SetString(PyExc_OverflowError,
+                                "can't convert negative value to PY_LONG_LONG");
+                return (PY_LONG_LONG)-1;
+            }
+            return PyLong_AsUnsignedLongLong(x);
+        } else {
+            return PyLong_AsLongLong(x);
+        }
+    } else {
+        PY_LONG_LONG val;
+        PyObject *tmp = __Pyx_PyNumber_Int(x);
+        if (!tmp) return (PY_LONG_LONG)-1;
+        val = __Pyx_PyInt_AsLongLong(tmp);
+        Py_DECREF(tmp);
+        return val;
+    }
+}
+
+static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
+    const signed long neg_one = (signed long)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+#if PY_VERSION_HEX < 0x03000000
+    if (likely(PyInt_Check(x))) {
+        long val = PyInt_AS_LONG(x);
+        if (is_unsigned && unlikely(val < 0)) {
+            PyErr_SetString(PyExc_OverflowError,
+                            "can't convert negative value to signed long");
+            return (signed long)-1;
+        }
+        return (signed long)val;
+    } else
+#endif
+    if (likely(PyLong_Check(x))) {
+        if (is_unsigned) {
+            if (unlikely(Py_SIZE(x) < 0)) {
+                PyErr_SetString(PyExc_OverflowError,
+                                "can't convert negative value to signed long");
+                return (signed long)-1;
+            }
+            return PyLong_AsUnsignedLong(x);
+        } else {
+            return PyLong_AsLong(x);
+        }
+    } else {
+        signed long val;
+        PyObject *tmp = __Pyx_PyNumber_Int(x);
+        if (!tmp) return (signed long)-1;
+        val = __Pyx_PyInt_AsSignedLong(tmp);
+        Py_DECREF(tmp);
+        return val;
+    }
+}
+
+static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
+    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
+    const int is_unsigned = neg_one > const_zero;
+#if PY_VERSION_HEX < 0x03000000
+    if (likely(PyInt_Check(x))) {
+        long val = PyInt_AS_LONG(x);
+        if (is_unsigned && unlikely(val < 0)) {
+            PyErr_SetString(PyExc_OverflowError,
+                            "can't convert negative value to signed PY_LONG_LONG");
+            return (signed PY_LONG_LONG)-1;
+        }
+        return (signed PY_LONG_LONG)val;
+    } else
+#endif
+    if (likely(PyLong_Check(x))) {
+        if (is_unsigned) {
+            if (unlikely(Py_SIZE(x) < 0)) {
+                PyErr_SetString(PyExc_OverflowError,
+                                "can't convert negative value to signed PY_LONG_LONG");
+                return (signed PY_LONG_LONG)-1;
+            }
+            return PyLong_AsUnsignedLongLong(x);
+        } else {
+            return PyLong_AsLongLong(x);
+        }
+    } else {
+        signed PY_LONG_LONG val;
+        PyObject *tmp = __Pyx_PyNumber_Int(x);
+        if (!tmp) return (signed PY_LONG_LONG)-1;
+        val = __Pyx_PyInt_AsSignedLongLong(tmp);
+        Py_DECREF(tmp);
+        return val;
+    }
+}
+
+#ifndef __PYX_HAVE_RT_ImportType
+#define __PYX_HAVE_RT_ImportType
+static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
+    long size, int strict)
+{
+    PyObject *py_module = 0;
+    PyObject *result = 0;
+    PyObject *py_name = 0;
+    char warning[200];
+
+    py_module = __Pyx_ImportModule(module_name);
+    if (!py_module)
+        goto bad;
+    #if PY_MAJOR_VERSION < 3
+    py_name = PyString_FromString(class_name);
+    #else
+    py_name = PyUnicode_FromString(class_name);
+    #endif
+    if (!py_name)
+        goto bad;
+    result = PyObject_GetAttr(py_module, py_name);
+    Py_DECREF(py_name);
+    py_name = 0;
+    Py_DECREF(py_module);
+    py_module = 0;
+    if (!result)
+        goto bad;
+    if (!PyType_Check(result)) {
+        PyErr_Format(PyExc_TypeError,
+            "%s.%s is not a type object",
+            module_name, class_name);
+        goto bad;
+    }
+    if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) {
+        PyOS_snprintf(warning, sizeof(warning),
+            "%s.%s size changed, may indicate binary incompatibility",
+            module_name, class_name);
+        #if PY_VERSION_HEX < 0x02050000
+        PyErr_Warn(NULL, warning);
+        #else
+        PyErr_WarnEx(NULL, warning, 0);
+        #endif
+    }
+    else if (((PyTypeObject *)result)->tp_basicsize != size) {
+        PyErr_Format(PyExc_ValueError,
+            "%s.%s has the wrong size, try recompiling",
+            module_name, class_name);
+        goto bad;
+    }
+    return (PyTypeObject *)result;
+bad:
+    Py_XDECREF(py_module);
+    Py_XDECREF(result);
+    return 0;
+}
+#endif
+
+#ifndef __PYX_HAVE_RT_ImportModule
+#define __PYX_HAVE_RT_ImportModule
+static PyObject *__Pyx_ImportModule(const char *name) {
+    PyObject *py_name = 0;
+    PyObject *py_module = 0;
+
+    #if PY_MAJOR_VERSION < 3
+    py_name = PyString_FromString(name);
+    #else
+    py_name = PyUnicode_FromString(name);
+    #endif
+    if (!py_name)
+        goto bad;
+    py_module = PyImport_Import(py_name);
+    Py_DECREF(py_name);
+    return py_module;
+bad:
+    Py_XDECREF(py_name);
+    return 0;
+}
+#endif
+
+#include "compile.h"
+#include "frameobject.h"
+#include "traceback.h"
+
+static void __Pyx_AddTraceback(const char *funcname) {
+    PyObject *py_srcfile = 0;
+    PyObject *py_funcname = 0;
+    PyObject *py_globals = 0;
+    PyCodeObject *py_code = 0;
+    PyFrameObject *py_frame = 0;
+
+    #if PY_MAJOR_VERSION < 3
+    py_srcfile = PyString_FromString(__pyx_filename);
+    #else
+    py_srcfile = PyUnicode_FromString(__pyx_filename);
+    #endif
+    if (!py_srcfile) goto bad;
+    if (__pyx_clineno) {
+        #if PY_MAJOR_VERSION < 3
+        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
+        #else
+        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
+        #endif
+    }
+    else {
+        #if PY_MAJOR_VERSION < 3
+        py_funcname = PyString_FromString(funcname);
+        #else
+        py_funcname = PyUnicode_FromString(funcname);
+        #endif
+    }
+    if (!py_funcname) goto bad;
+    py_globals = PyModule_GetDict(__pyx_m);
+    if (!py_globals) goto bad;
+    py_code = PyCode_New(
+        0,            /*int argcount,*/
+        #if PY_MAJOR_VERSION >= 3
+        0,            /*int kwonlyargcount,*/
+        #endif
+        0,            /*int nlocals,*/
+        0,            /*int stacksize,*/
+        0,            /*int flags,*/
+        __pyx_empty_bytes, /*PyObject *code,*/
+        __pyx_empty_tuple,  /*PyObject *consts,*/
+        __pyx_empty_tuple,  /*PyObject *names,*/
+        __pyx_empty_tuple,  /*PyObject *varnames,*/
+        __pyx_empty_tuple,  /*PyObject *freevars,*/
+        __pyx_empty_tuple,  /*PyObject *cellvars,*/
+        py_srcfile,   /*PyObject *filename,*/
+        py_funcname,  /*PyObject *name,*/
+        __pyx_lineno,   /*int firstlineno,*/
+        __pyx_empty_bytes  /*PyObject *lnotab*/
+    );
+    if (!py_code) goto bad;
+    py_frame = PyFrame_New(
+        PyThreadState_GET(), /*PyThreadState *tstate,*/
+        py_code,             /*PyCodeObject *code,*/
+        py_globals,          /*PyObject *globals,*/
+        0                    /*PyObject *locals*/
+    );
+    if (!py_frame) goto bad;
+    py_frame->f_lineno = __pyx_lineno;
+    PyTraceBack_Here(py_frame);
+bad:
+    Py_XDECREF(py_srcfile);
+    Py_XDECREF(py_funcname);
+    Py_XDECREF(py_code);
+    Py_XDECREF(py_frame);
+}
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
+    while (t->p) {
+        #if PY_MAJOR_VERSION < 3
+        if (t->is_unicode) {
+            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
+        } else if (t->intern) {
+            *t->p = PyString_InternFromString(t->s);
+        } else {
+            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
+        }
+        #else  /* Python 3+ has unicode identifiers */
+        if (t->is_unicode | t->is_str) {
+            if (t->intern) {
+                *t->p = PyUnicode_InternFromString(t->s);
+            } else if (t->encoding) {
+                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
+            } else {
+                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
+            }
+        } else {
+            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
+        }
+        #endif
+        if (!*t->p)
+            return -1;
+        ++t;
+    }
+    return 0;
+}
+
+/* Type Conversion Functions */
+
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
+   int is_true = x == Py_True;
+   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
+   else return PyObject_IsTrue(x);
+}
+
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
+  PyNumberMethods *m;
+  const char *name = NULL;
+  PyObject *res = NULL;
+#if PY_VERSION_HEX < 0x03000000
+  if (PyInt_Check(x) || PyLong_Check(x))
+#else
+  if (PyLong_Check(x))
+#endif
+    return Py_INCREF(x), x;
+  m = Py_TYPE(x)->tp_as_number;
+#if PY_VERSION_HEX < 0x03000000
+  if (m && m->nb_int) {
+    name = "int";
+    res = PyNumber_Int(x);
+  }
+  else if (m && m->nb_long) {
+    name = "long";
+    res = PyNumber_Long(x);
+  }
+#else
+  if (m && m->nb_int) {
+    name = "int";
+    res = PyNumber_Long(x);
+  }
+#endif
+  if (res) {
+#if PY_VERSION_HEX < 0x03000000
+    if (!PyInt_Check(res) && !PyLong_Check(res)) {
+#else
+    if (!PyLong_Check(res)) {
+#endif
+      PyErr_Format(PyExc_TypeError,
+                   "__%s__ returned non-%s (type %.200s)",
+                   name, name, Py_TYPE(res)->tp_name);
+      Py_DECREF(res);
+      return NULL;
+    }
+  }
+  else if (!PyErr_Occurred()) {
+    PyErr_SetString(PyExc_TypeError,
+                    "an integer is required");
+  }
+  return res;
+}
+
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
+  Py_ssize_t ival;
+  PyObject* x = PyNumber_Index(b);
+  if (!x) return -1;
+  ival = PyInt_AsSsize_t(x);
+  Py_DECREF(x);
+  return ival;
+}
+
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
+#if PY_VERSION_HEX < 0x02050000
+   if (ival <= LONG_MAX)
+       return PyInt_FromLong((long)ival);
+   else {
+       unsigned char *bytes = (unsigned char *) &ival;
+       int one = 1; int little = (int)*(unsigned char*)&one;
+       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
+   }
+#else
+   return PyInt_FromSize_t(ival);
+#endif
+}
+
+static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
+   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
+   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
+       return (size_t)-1;
+   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
+       PyErr_SetString(PyExc_OverflowError,
+                       "value too large to convert to size_t");
+       return (size_t)-1;
+   }
+   return (size_t)val;
+}
+
+
+#endif /* Py_PYTHON_H */
diff --git a/src/byte_offset.pyx b/src/byte_offset.pyx
new file mode 100644
index 0000000..12dbab3
--- /dev/null
+++ b/src/byte_offset.pyx
@@ -0,0 +1,119 @@
+# coding: utf8
+"""
+Authors:      Jérôme Kieffer, ESRF 
+Email:        jerome.kieffer at esrf.eu
+
+Cif Binary Files images are 2D images written by the Pilatus detector and others.
+They use a modified (simplified) byte-offset algorithm.  This file contains the 
+decompression function from a string to an int64 numpy array. 
+
+This is Cython: convert it to pure C then compile it with gcc
+$ cython byte_offset.pyx 
+
+"""
+
+__author__ = "Jérôme Kieffer"
+__contact__ = "jerome.kieffer at esrf.eu"
+__license__ = "GPLv3+"
+__copyright__ = "2010, European Synchrotron Radiation Facility, Grenoble, France"
+
+
+cimport numpy
+import numpy
+import cython
+
+ at cython.boundscheck(False)
+def analyseCython(char * stream, int size):
+    """
+    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 : int64 ndArrays 
+    """
+    cdef int                i = 0
+    cdef int                j = 0
+    cdef long long          last = 0
+    cdef long long          current = 0
+    cdef char               tmp8 = 0
+
+    cdef unsigned char      utmp8a = 0
+    cdef unsigned char      utmp8b = 0
+    cdef unsigned char      utmp8c = 0
+    cdef unsigned char      utmp8d = 0
+    cdef unsigned char      utmp8e = 0
+    cdef unsigned char      utmp8f = 0
+    cdef unsigned char      utmp8g = 0
+
+    cdef long long          tmp64 = 0
+    cdef long long          tmp64a = 0
+    cdef long long          tmp64b = 0
+    cdef long long          tmp64c = 0
+    cdef long long          tmp64d = 0
+    cdef long long          tmp64e = 0
+    cdef long long          tmp64f = 0
+    cdef long long          tmp64g = 0
+
+
+
+
+    cdef char               key8 = 0x80
+    cdef char               key0 = 0x00
+    cdef numpy.ndarray[ long long  , ndim = 1] dataOut
+    dataOut = numpy.zeros(size, dtype=numpy.int64)
+
+    with nogil:
+        while (j < size):
+            if (stream[i] == key8):
+                if ((stream[i + 1] == key0) and (stream[i + 2] == key8)):
+                    if (stream[i + 3] == key0) and (stream[i + 4] == key0) and (stream[i + 5] == key0) and (stream[i + 6] == key8):
+                        #Retrieve the interesting Bytes of data
+                        tmp8 = stream[i + 14]
+                        utmp8a = stream[i + 13]
+                        utmp8b = stream[i + 12]
+                        utmp8c = stream[i + 11]
+                        utmp8d = stream[i + 10]
+                        utmp8e = stream[i + 9]
+                        utmp8f = stream[i + 8]
+                        utmp8g = stream[i + 7]
+                        # cast them  in 64 bit
+                        tmp64 = tmp8
+                        tmp64a = utmp8a
+                        tmp64b = utmp8b
+                        tmp64c = utmp8c
+                        tmp64d = utmp8d
+                        tmp64e = utmp8e
+                        tmp64f = utmp8f
+                        tmp64g = utmp8g
+                        current = (tmp64 << 56) | (tmp64a << 48) | (tmp64b << 40) | (tmp64c << 32) | (tmp64d << 24) | (tmp64e << 16) | (tmp64f << 8) | (tmp64g)
+                        i += 15
+                    else:
+                        #Retrieve the interesting Bytes of data
+                        tmp8 = stream[i + 6]
+                        utmp8a = stream[i + 5]
+                        utmp8b = stream[i + 4]
+                        utmp8c = stream[i + 3]
+                        # cast them  in 64 bit
+                        tmp64 = tmp8
+                        tmp64a = utmp8a
+                        tmp64b = utmp8b
+                        tmp64c = utmp8c
+                        #Assemble data into a long long
+                        current = (tmp64 << 24) | (tmp64a << 16) | (tmp64b << 8) | (tmp64c);
+                        i += 7
+                else:
+                    tmp8 = stream[i + 2];
+                    utmp8a = stream[i + 1]
+                    # cast them  in 64 bit
+                    tmp64 = tmp8
+                    tmp64a = utmp8a
+                    current = (tmp64 << 8) | (tmp64a);
+                    i += 3
+            else:
+                tmp8 = stream[i]
+                current = tmp8
+                i += 1
+            last += current
+            dataOut[j] = last
+            j += 1
+
+    return dataOut
diff --git a/src/ccp4_pack.c b/src/ccp4_pack.c
new file mode 100644
index 0000000..b217fbf
--- /dev/null
+++ b/src/ccp4_pack.c
@@ -0,0 +1,320 @@
+#ifndef _MSC_VER
+#include <stdint.h> 
+#else
+#include "stdint.h" 
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#define CCP4_PCK_BLOCK_HEADER_LENGTH 6
+#define CCP4_PCK_BLOCK_HEADER_LENGTH_V2 8
+/*array translating the number of errors per block*/
+static unsigned int CCP4_PCK_ERR_COUNT[] = {1,2,4,8,16,32,64,128};
+/*array translating the number of bits per error*/
+static unsigned int CCP4_PCK_BIT_COUNT[]= {0,4,5,6,7,8,16,32};
+/*array translating the number of errors per block - can use shifts as well actually*/
+static unsigned int CCP4_PCK_ERR_COUNT_V2[] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768};
+/*array translating the number of bits per error*/
+static unsigned int CCP4_PCK_BIT_COUNT_V2[]= {0,4,5,6,7,8,9,10,11,12,13,14,15,16,32};
+
+static const unsigned char CCP4_PCK_MASK[]={0x00,
+  0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF};
+
+static const unsigned int CCP4_PCK_MASK_16[]={0x00,
+  0x01,  0x03,  0x07,  0x0F,  0x1F,   0x3F,   0x7F,   0xFF,
+  0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF};
+
+static const unsigned long CCP4_PCK_MASK_32[]={0x00,
+  0x01,      0x03,      0x07,      0x0F,      0x1F,       0x3F,       0x7F,       0xFF,
+  0x1FF,     0x3FF,     0x7FF,     0xFFF,     0x1FFF,     0x3FFF,     0x7FFF,     0xFFFF,
+  0x1FFFF,   0x3FFFF,   0x7FFFF,   0xFFFFF,   0x1FFFFF,   0x3FFFFF,   0x7FFFFF,   0xFFFFFF,
+  0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF, 0xFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF, 0xFFFFFFFF};
+
+#define pfail_nonzero(a) if ((a)) return NULL;
+
+void *mar345_read_data(FILE *file, int ocount, int dim1, int dim2);
+void *ccp4_unpack(void *unpacked_array, void *packed, size_t dim1, size_t dim2, size_t max_num_int);
+void *ccp4_unpack_v2(void *unpacked_array, void *packed, size_t dim1, size_t dim2, size_t max_num_int);
+
+/**unpack a new style mar345 image a'la what is done in CBFlib
+ * assumes the file is already positioned after the ascii header
+ * Perhaps the positioning should be done here as well.
+ */
+void * mar345_read_data(FILE *file, int ocount, int dim1, int dim2){
+  /* first process overflow bytes - for now we just ignore them
+   * these are stored in 64 byte records*/
+  int orecords=(int)(ocount/8.0+0.875);
+  int *odata,x,y,version=0;
+  char *c,cbuffer[64]="";
+  unsigned int *unpacked_array;
+  
+  odata=(int*)malloc(64*8*orecords);
+  if (!odata)
+    return NULL;
+  pfail_nonzero (orecords-fread(odata,64,orecords,file));
+  /* there is no stdout in a gui, sorry
+  printf("have %d overflows in %d recs\n",ocount,orecords);
+  */ 
+  /* now after they have been read find the CCP4.....string and compare to dim1*/
+  c=cbuffer;
+  while((*c)!=EOF){
+    
+    if (c==cbuffer+63){
+     c=cbuffer;
+    } 
+    
+    *c=(char)getc(file);
+    /*set the next character to a \0 so the string is always terminated*/
+    *(c+1)='\0';
+    
+    if (*c=='\n'){
+      /*check for the CCP- string*/
+      x=y=0;
+      sscanf(cbuffer,"CCP4 packed image, X: %04d, Y: %04d", &x,&y);
+      if (x==dim1 || y ==dim2){
+        version=1;
+        break;
+      }
+      x=y=0;
+      sscanf(cbuffer,"CCP4 packed image V2, X: %04d, Y: %04d", &x,&y);
+      if (x==dim1 || y ==dim2){
+        version=2;
+        break;
+      }
+      c=cbuffer;
+    } else
+      c++;
+  }
+  /* allocate memory for the arrays*/
+  unpacked_array=(unsigned int*) malloc(sizeof(unsigned int)*dim1*dim2);
+  if (!unpacked_array)
+    return NULL;
+  /*relay to whichever version of ccp4_unpack is appropriate*/
+  switch(version){
+    case 1:
+      ccp4_unpack(unpacked_array,(void*)file,dim1,dim2,0);
+      break;
+    case 2:
+      ccp4_unpack_v2(unpacked_array,(void*)file,dim1,dim2,0);
+      break;
+    default:
+      return NULL;
+  }
+  
+  /*handle overflows*/
+  while (ocount>0){
+    unsigned int adress,value;
+    adress=odata[2*ocount-2];
+    if (adress){
+      value=odata[2*ocount-1];
+      /*adresses start at 1*/
+      unpacked_array[adress-1]=value;
+    }
+    ocount--;
+  }
+  return unpacked_array;
+}
+
+/**unpack a ccp4-style packed array into the memory location pointed to by unpacked_array
+ * if this is null alloocate memory and return a pointer to it
+ * \return NULL if unsuccesful
+ * TODO change this to read directly from the FILE to not waste memory*/ 
+void * ccp4_unpack(
+    void *unpacked_array,
+    void *packed,
+    size_t dim1,size_t dim2,
+    size_t max_num_int){
+
+  uint8_t t_,t2,_conv;
+  int err_val,bit_offset,num_error=0,num_bits=0,read_bits;
+  int i;
+  int x4,x3,x2,x1;
+  unsigned int *int_arr=(unsigned int *) unpacked_array;
+  FILE *instream=(FILE *)packed;
+  
+  /*if no maximum integers are give read the whole nine yards*/
+  if (max_num_int==0){
+    max_num_int=dim1*dim2;
+  }
+  /*if a NULL pointer is passed allocate some new memory*/
+  if (unpacked_array==NULL){
+    if ( (unpacked_array=malloc(sizeof(unsigned int)*max_num_int))==NULL){
+      errno=ENOMEM;
+      return NULL;
+    }
+  }
+  /*packed bits always start at byte boundary after header*/
+  bit_offset=0;
+  /*read the first byte of the current_block*/
+  t_=(unsigned char)fgetc(instream);
+  /*while less than num ints have been unpacked*/
+  i=0;  
+  while(i<max_num_int){
+    if (num_error==0){
+      /* at the beginning of block - read the 6 block header bits*/
+      if (bit_offset>=(8-CCP4_PCK_BLOCK_HEADER_LENGTH)){
+        /*we'll be reading past the next byte boundary*/
+        t2=(unsigned char ) fgetc(instream);
+        t_=(t_>>bit_offset) + ((unsigned char)t2 <<(8-bit_offset) );
+        num_error=CCP4_PCK_ERR_COUNT[t_ & CCP4_PCK_MASK[3]];
+        num_bits=CCP4_PCK_BIT_COUNT[(t_>>3) & CCP4_PCK_MASK[3]];
+        bit_offset=CCP4_PCK_BLOCK_HEADER_LENGTH+bit_offset-8;
+        t_=t2;
+      }else{
+        num_error=CCP4_PCK_ERR_COUNT[(t_>>bit_offset) & CCP4_PCK_MASK[3]];
+        num_bits=CCP4_PCK_BIT_COUNT[(t_>>(3+bit_offset)) & CCP4_PCK_MASK[3]];
+        bit_offset+=CCP4_PCK_BLOCK_HEADER_LENGTH;
+      } 
+    } else {
+      /*reading the data in the block*/
+      while(num_error>0){
+        err_val=0;
+        read_bits=0;
+        while(read_bits<num_bits){
+          if (bit_offset+(num_bits-read_bits)>=8) {
+            /*read to next full byte boundary and convert*/
+            _conv= (t_>>bit_offset) & CCP4_PCK_MASK[8-bit_offset];
+            err_val|= (unsigned int) _conv << read_bits;
+            read_bits+=(8-bit_offset);
+            /*have read to byte boundary - set offset to 0 and read next byte*/
+            bit_offset=0;
+            t_=(unsigned char) fgetc(instream);
+          }
+          else {
+            /*must stop before next byte boundary - also this means that these are the last bits in the error*/
+            _conv= (t_ >>bit_offset) & CCP4_PCK_MASK[num_bits-read_bits];
+            err_val|= _conv<<read_bits;
+            bit_offset+= (num_bits-read_bits);
+            read_bits=num_bits;
+          }
+          
+        }
+        /*if the msb is set, the error is negative -
+         * fill up with 1s to get a 2's compl representation*/
+        if (err_val & (1 << (num_bits-1)) )
+        {
+          err_val|= -1<<(num_bits-1);
+        }
+        /*store the current value in the unpacked array*/ 
+        if (i>dim1){
+          /*the current pixel is not in the first row - averaging is possible
+           *n.b. the averaging calculation is performed in the 2's complement domain*/
+          x4=(int16_t) int_arr[i-1];
+          x3=(int16_t) int_arr[i-dim1+1];
+          x2=(int16_t) int_arr[i-dim1];
+          x1=(int16_t) int_arr[i-dim1-1];
+          int_arr[i]=(uint16_t) (err_val + (x4 + x3 + x2 + x1 +2) /4 );
+          i=i;
+        } else if (i!=0){
+          /*current pixel is in the 1st row but is not first pixel*/
+          int_arr[i]=(uint16_t) (err_val + int_arr[i-1]);
+        } else {
+          int_arr[i]=(uint16_t) err_val;
+        }
+        i++;
+        num_error--;
+      } 
+    }/*else*/
+  }
+  return (void *) unpacked_array;
+}
+
+void * ccp4_unpack_v2(
+    void *unpacked_array,
+    void *packed,
+    size_t dim1,size_t dim2,
+    size_t max_num_int){
+
+  uint8_t t_,t2,_conv;
+  int err_val,bit_offset,num_error=0,num_bits=0,read_bits;
+  int i;
+  unsigned int x4=0,x3=0,x2=0,x1=0;
+  unsigned int *int_arr=(unsigned int *) unpacked_array;
+  FILE *instream=(FILE *)packed;
+  
+  /*if no maximum integers are give read the whole nine yards*/
+  if (max_num_int==0){
+    max_num_int=dim1*dim2;
+  }
+  /*if a NULL pointer is passed allocate some new memory*/
+  if (unpacked_array==NULL){
+    if ( (unpacked_array=malloc(sizeof(unsigned int)*max_num_int))==NULL){
+      errno=ENOMEM;
+      return NULL;
+    }
+  }
+  /*packed bits always start at byte boundary after header*/
+  bit_offset=0;
+  /*read the first byte of the current_block*/
+  t_=(unsigned char)fgetc(instream);
+  /*while less than num ints have been unpacked*/
+  i=0;  
+  while(i<max_num_int){
+    if (num_error==0){
+      /* at the beginning of block - read the 6 block header bits*/
+      if (bit_offset>=(8-CCP4_PCK_BLOCK_HEADER_LENGTH_V2)){
+        /*we'll be reading past the next byte boundary*/
+        t2=(unsigned char ) fgetc(instream);
+        t_=(t_>>bit_offset) + ((unsigned char)t2 <<(8-bit_offset) );
+        num_error=CCP4_PCK_ERR_COUNT_V2[t_ & CCP4_PCK_MASK[4]];
+        num_bits=CCP4_PCK_BIT_COUNT_V2[(t_>>4) & CCP4_PCK_MASK[4]];
+        bit_offset=CCP4_PCK_BLOCK_HEADER_LENGTH_V2+bit_offset-8;
+        t_=t2;
+      }else{
+        num_error=CCP4_PCK_ERR_COUNT_V2[ (t_>>bit_offset) & CCP4_PCK_MASK[4] ];
+        num_bits=CCP4_PCK_BIT_COUNT_V2[ (t_>>(4+bit_offset)) & CCP4_PCK_MASK[4] ];
+        bit_offset+=CCP4_PCK_BLOCK_HEADER_LENGTH_V2;
+      } 
+    } else {
+      /*reading the data in the block*/
+      while(num_error>0){
+        err_val=0;
+        read_bits=0;
+        while(read_bits<num_bits){
+          if (bit_offset+(num_bits-read_bits)>=8) {
+            /*read to next full byte boundary and convert*/
+            _conv= (t_>>bit_offset) & CCP4_PCK_MASK[8-bit_offset];
+            err_val|= (unsigned int) _conv << read_bits;
+            read_bits+=(8-bit_offset);
+            /*have read to byte boundary - set offset to 0 and read next byte*/
+            bit_offset=0;
+            t_=(unsigned char) fgetc(instream);
+          }
+          else {
+            /*must stop before next byte boundary - also this means that these are the last bits in the error*/
+            _conv= (t_ >>bit_offset) & CCP4_PCK_MASK[num_bits-read_bits];
+            err_val|= _conv<<read_bits;
+            bit_offset+= (num_bits-read_bits);
+            read_bits=num_bits;
+          }
+          
+        }
+        /*if the msb is set, the error is negative -
+         * fill up with 1s to get a 2's compl representation*/
+        if (err_val & (1 << (num_bits-1)) )
+        {
+          err_val|= -1<<(num_bits-1);
+        }
+        /*store the current value in the unpacked array*/ 
+        if (i>dim1){
+          /*the current pixel is not in the first row - averaging is possible
+           *n.b. the averaging calculation is performed in the 2's complement domain*/
+          x4=(int16_t) int_arr[i-1];
+          x3=(int16_t) int_arr[i-dim1+1];
+          x2=(int16_t) int_arr[i-dim1];
+          x1=(int16_t) int_arr[i-dim1-1];
+          int_arr[i]=(uint16_t) (err_val + (x4 + x3 + x2 + x1 +2) /4 );
+          i=i;
+        } else if (i!=0){
+          /*current pixel is in the 1st row but is not first pixel*/
+          int_arr[i]=(uint16_t) (err_val + int_arr[i-1]);
+        } else {
+          int_arr[i]=(uint16_t) err_val;
+        }
+        i++;
+        num_error--;
+      } 
+    }/*else*/
+  }
+  return (void *) unpacked_array;
+}
diff --git a/src/cf_iomodule.c b/src/cf_iomodule.c
new file mode 100644
index 0000000..e7dc5b2
--- /dev/null
+++ b/src/cf_iomodule.c
@@ -0,0 +1,79 @@
+#include <Python.h>
+#include <numpy/arrayobject.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "columnfile.h"
+
+static PyObject *cf_read(PyObject *self, PyObject *args, PyObject *keywds){
+  cf_data *cf__;
+  PyArrayObject *py_data;
+  PyStringObject *str;
+  PyListObject *clabels;
+
+  static char *kwlist[]={"file","mode",NULL};
+  const char mode[]="a ";
+  unsigned int flags=0;
+
+  /* perhaps not const */
+  int dim1,dim2,ocount;
+  int dims[2];
+  int i;
+  FILE *file;
+
+  PyObject *py_file; 
+  if (!PyArg_ParseTupleAndKeywords(args,keywds,"O|s",kwlist,&py_file,&mode))
+   return NULL;
+  file=PyFile_AsFile(py_file);
+
+  if (strchr(mode,'z')){
+    flags|=CF_GZ_COMP;
+  }
+  if(strchr(mode,'b')){
+    cf__=(cf_data *) cf_read_bin(file,NULL,flags);
+  }else if (strchr(mode,'a')) {
+    cf__=(cf_data *) cf_read_ascii(file,NULL,flags);
+  }else{
+    fprintf(stderr,"unrecognized mode for columnfile %s (assuming ascii)\n",mode);
+    cf__= (cf_data *)cf_read_ascii(file,NULL,flags);
+  }
+  /*check for failure to read*/
+  if (cf__==NULL){
+    return Py_BuildValue("OO",Py_None,Py_None);
+  } 
+  dims[0]=cf__->nrows;dims[1]=cf__->ncols;
+  /*since data may be non-contigous we can't simply create a numpy-array from cf__->data, as Numpy's memory model prohibits it*/
+  /*i.e. py_data=(PyArrayObject*)PyArray_SimpleNewFromData(2, dims, NPY_DOUBLE, (void*)(&(cf__->data[0][0])));
+   * won't work*/
+  py_data=(PyArrayObject *)PyArray_SimpleNew(2,dims,NPY_DOUBLE);
+  for (i=0;i<cf__->nrows;i++){
+    memcpy((double *)PyArray_GETPTR2(py_data,i,0),cf__->data[i],cf__->ncols*sizeof(double));
+  }
+  clabels=(PyListObject *)PyList_New(0);
+  for (i=0;i<cf__->ncols;i++){
+    str = (PyStringObject*)PyString_FromString(cf__->clabels[i]);
+    if (PyList_Append((PyObject*)clabels,(PyObject*)str)){
+      fprintf(stderr,"cannot insert column label %d\n",i);
+    }
+  }
+  cf_free(cf__);
+  return Py_BuildValue("OO", PyArray_Return(py_data),clabels);
+}
+
+
+
+static PyMethodDef cf_io_Methods[] = {
+  {"read",(PyCFunction)cf_read, METH_VARARGS | METH_KEYWORDS, "call the c-columnfile reading interface. The mode keyword argument is either:\n  \"a\" for ascii (the default)\n  \"b\" for binary"},
+  {NULL, NULL, 0, NULL}
+};
+
+
+PyMODINIT_FUNC initcf_io(void)
+{
+  (void) Py_InitModule("cf_io",cf_io_Methods);
+  import_array();
+
+  if (PyErr_Occurred())
+    Py_FatalError("cannot initialize cf_iomodule.c");
+}
+
+
diff --git a/src/columnfile.c b/src/columnfile.c
new file mode 100644
index 0000000..ff824a1
--- /dev/null
+++ b/src/columnfile.c
@@ -0,0 +1,226 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef HAVE_ZLIB_H
+#define HAVE_ZLIB_H 0
+#else
+#include <zlib.h>
+#endif
+
+
+
+#include "columnfile.h"
+
+static char hdr_ctl[]="# %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s";
+
+
+
+int compression_yes(char *fname){
+  /*should we use compression*/
+  char *p;
+  if ( HAVE_ZLIB_H && (p=strstr(fname,".gz"))!=NULL && p<fname+strlen(fname) ){
+    return 1;
+  }
+  return 0;
+}
+
+void cf_free( cf_data *p){
+  int i;
+  if (p!=NULL){
+    for (i=0;i<p->nralloc;i++){
+      if (p->data[i]!=NULL) free(p->data[i]);
+    }
+    if( p->data!=NULL){free(p->data);}
+    for (i=0;i<p->ncols;i++){
+      if(p->clabels[i]!=NULL) free(p->clabels[i]);
+    }
+    if(p->clabels!=NULL){free(p->clabels);}
+    free(p);
+  }
+}
+
+int cf_write(char *fname,void *cf_handle, unsigned int FLAGS){
+  int status;
+#if HAVE_ZLIB_H
+  if (FLAGS & CF_GZ_COMP){
+    gzFile gzfp=gzopen(fname,"wbh");
+    if (gzfp==NULL) return -1;
+    status=-1;
+    if (FLAGS && CF_BIN){
+      status=cf_write_bin_gz(gzfp,cf_handle);
+    }else{
+      status=cf_write_ascii_gz(gzfp,cf_handle);
+    }
+    gzclose(gzfp);
+    return status;
+  }else{
+#else 
+  if(1){
+#endif
+    FILE *fp=fopen(fname,"wb");
+    if (fp==NULL) return -1;
+    status=-1;
+    if (FLAGS && CF_BIN){
+      /*status=cf_write_bin(fp,cf_handle);
+        */
+    }else{
+      status=cf_write_ascii(fp,cf_handle,0);
+    }
+    fclose(fp);
+    return status;
+  }
+}
+
+int cf_write_ascii(void *fp, void *cf_handle, unsigned int FLAGS){/*{{{*/
+  int r,c;
+  cf_data *cf_=(cf_data *) cf_handle;
+#if HAVE_ZLIB_H
+  if (FLAGS & CF_GZ_COMP){
+    gzprintf((gzFile)fp,"#");
+    for (i=0;i<cf_->ncols;i++){
+      gzprintf((gzFile)fp," %s",cf_->clabels[i]);
+    }
+    gzprintf((gzFile)fp,"\n");
+    for (r=0;r<cf_->nrows;r++){
+      for (i=0;i<cf_->ncols;i++){
+        gzprintf((gzFile)fp," %g",cf_->data[i][r]);
+      }
+      gzprintf((gzFile)fp,"\n");
+    }
+    return 0;
+  }else{
+#endif
+    fprintf((FILE *)fp,"#");
+    for (c=0;c<cf_->ncols;c++){
+      fprintf((FILE *)fp," %s",cf_->clabels[c]);
+    }
+    fprintf((FILE *)fp,"\n");
+    for (r=0;r<cf_->nrows;r++){
+      for (c=0;c<cf_->ncols;c++){
+        fprintf((FILE *)fp," %g",cf_->data[c][r]);
+      }
+      fprintf((FILE *)fp,"\n");
+    }
+    return 0;
+#if HAVE_ZLIB_H
+  }
+#endif
+}/*}}}*/
+
+void *cf_read_ascii(void *fp, void *dest, unsigned int FLAGS){/*{{{*/
+  /*read the first line and figure out how many columns we have*/
+  char line[2048];
+  char *fi; /* returned by fgets */
+  int i,r;
+  int nr_alloc=CF_INIT_ROWS;
+  int nc_alloc=CF_INIT_COLS;
+  int ncols,nrows;
+  char **clabels,**cp;
+  double **data,**dp;
+  char *p;
+  cf_data *dest_local;
+
+  /*read the first line into buffer*/
+#if HAVE_ZLIB_H
+  if (FLAGS & CF_GZ_COMP){
+    if ((gzgets((gzFile )fp,line,2048))==Z_NULL) {fprintf(stderr,"zlib io error in %s \n",__FILE__);return NULL;}
+  }else{
+    if((fgets(line,2048,(FILE *)fp))==NULL){fprintf(stderr,"io-error in %s\n",__FILE__);return NULL;}
+  }
+#else
+  if((fgets(line,2048,(FILE *)fp))==NULL){fprintf(stderr,"io-error in %s\n",__FILE__);return NULL;}
+#endif
+
+  /*initially allocate room for 32 columns - if that is not enough should reallocate*/
+  clabels=(char**) malloc(CF_INIT_COLS* sizeof(char*));
+  for (cp=clabels;cp<clabels+CF_INIT_COLS;cp++){
+    *cp=(char *)malloc(CF_HEADER_ITEM*sizeof(char));
+  }
+
+  /*try to sscanf it using 32 conversions - if that doesn't work use pedestrian version*/
+  ncols=sscanf(line,hdr_ctl,repeat16_inc(clabels,0),repeat16_inc(clabels,16),*(clabels+32));
+  if (ncols==32+1 || ncols==0){
+    /*aha we probably didn't get it all*/
+    /*step through buffer with char ptr and check for whitespace->non-ws slopes. when one is found read from pc-1 into header storage. exit when line is exhausted*/
+    /*count the number of entries*/
+    ncols=0;
+    /*headers are supposed to start with # so skip that*/
+    if (*line=='#') p=line+1;
+    else p=line;
+    while (*p!='\0' || *p!='\n' || p<line+2048){
+      if( is_ws(*p) && !is_ws(*(p+1)) && *(p+1)!='\0') {
+        if(ncols==nc_alloc){
+          clabels=(char**)realloc(clabels,sizeof(char *));
+          *(clabels+ncols)=(char*)malloc(CF_HEADER_ITEM*sizeof(char));
+          nc_alloc++;
+        }
+        sscanf(p,"%s",*(clabels+ncols));
+        ncols++;
+      }
+      p++;
+    }
+  }
+  /*alloc a number of rows*/
+  data=(double**)malloc(nr_alloc*sizeof(double*));
+  for (dp=data;dp<data+nr_alloc;dp++){
+    *dp=(double*)malloc(ncols*sizeof(double));
+  }
+
+  r=0;
+  do {
+#if HAVE_ZLIB_H
+  if (FLAGS & CF_GZ_COMP){
+    if ((gzgets((gzFile )fp,line,2048))==Z_NULL) {fprintf(stderr,"zlib io error reading file at %s\n",__LINE__);return -1;}
+    if(gzeof((gzFile)fp)) break;
+  }else{
+    fi=fgets(line,2048,(FILE *)fp);
+    if (feof((FILE *)fp)) break;
+  }
+#else
+  fi=fgets(line,2048,(FILE *)fp);
+  if (feof((FILE *)fp)) break;
+#endif
+
+    i=0;  
+    p=line;
+
+    while (i<ncols && *p!='\0' && *p!='\n' && p<line+2048){
+      /*find the starting points of data items. these are transitions from whitespace to non-ws
+       * 1st one may not have beginning whitespace*/
+      if( (!is_ws(*p) && p==line) || (is_ws(*p) && !is_ws(*(p+1)) && *(p+1)!='\0') ) {
+        *(data[r] + i++)=atof(p);//0;//strtod(p,NULL);
+      }
+      p++;
+    }
+
+    r++;
+    if (r==nr_alloc){
+      /*we need to expand the data buffer*/
+      nr_alloc+=nr_alloc;
+      data=(double**)realloc(data,nr_alloc*sizeof(double*));
+      for (dp=data+r;dp<data+nr_alloc;dp++){
+        *dp=(double*)malloc(ncols*sizeof(double));
+      }
+    }
+  } while (1);
+
+  if (dest==NULL){
+    dest_local=(cf_data*)malloc(sizeof(cf_data));
+  }else{
+    dest_local=(cf_data*)dest;
+  }
+  ((cf_data *) dest_local)->ncols=ncols;
+  ((cf_data *) dest_local)->nrows=r;
+  ((cf_data *) dest_local)->nralloc=nr_alloc;
+  ((cf_data *) dest_local)->clabels=clabels;
+  ((cf_data *) dest_local)->data=data;
+
+  return (void *) dest_local;
+}/*}}}*/
+
+
+void *cf_read_bin(void *fp, void *dest, unsigned int FLAGS){
+  return NULL;
+
+}
diff --git a/src/columnfile.h b/src/columnfile.h
new file mode 100644
index 0000000..6d11e4b
--- /dev/null
+++ b/src/columnfile.h
@@ -0,0 +1,55 @@
+#ifndef CF_H
+#define CF_H 1
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#define CF_INIT_ROWS 8192
+#define CF_INIT_COLS 32
+#define CF_HEADER_ITEM 128
+
+
+#define CF_GZ_COMP 1
+#define CF_BIN 2
+
+
+#define repeat16_inc(name,offset) \
+  *((name)+(offset)),*((name)+(offset)+1),*((name)+(offset)+2),*((name)+(offset)+3),*((name)+(offset)+4), \
+  *((name)+(offset)+5),*((name)+(offset)+6),*((name)+(offset)+7),*((name)+(offset)+8),*((name)+(offset)+9), \
+  *((name)+(offset)+10),*((name)+(offset)+11),*((name)+(offset)+12),*((name)+(offset)+13),*((name)+(offset)+14),*((name)+(offset)+15)
+
+#define cf_check_realloc(p,i,chunk_size,item_size) \
+  do {\
+    if((i)%(chunk_size)==0){\
+  } while (0);
+
+#define cf_sscan_column(source,conversion,dest,prefix) \
+    do {\
+      int tmpi=0;\
+      if ((prefix)!=NULL) sscanf(source,prefix);\
+      while (sscanf( (source) , (conversion) , ((dest) +tmpi))){\
+        tmpi++;\
+      }\
+    } while (0);
+
+#define is_ws(character) \
+    ( (character==' ') || ((character)=='\t') || ((character)=='\v') || ((character) =='\r') || ((character) =='\n') )
+
+typedef struct cf_data{
+  int ncols,nrows;
+  unsigned int nralloc;
+  double **data;
+  char **clabels;
+} cf_data;
+
+void * cf_read_ascii(void *fp, void *dest, unsigned int FLAGS);
+void * cf_read_bin(void *fp, void *dest, unsigned int FLAGS);
+int cf_write(char *fname, void *cf_handle, unsigned int FLAGS);
+int cf_write_bin(void *fp, void *cf_handle);
+int cf_write_ascii(void *fp, void *cf_handle,unsigned int FLAGS);
+void cf_free( cf_data *cf_handle);
+
+
+
+#endif
diff --git a/src/mar345_iomodule.c b/src/mar345_iomodule.c
new file mode 100644
index 0000000..df3e2b4
--- /dev/null
+++ b/src/mar345_iomodule.c
@@ -0,0 +1,45 @@
+#include <Python.h>
+#include <numpy/arrayobject.h>
+#include <stdlib.h>
+#include <stdio.h>
+/* The args are int in ccp4_pack.c, not unsigned */
+void *mar345_read_data(FILE *file, int ocount, int dim1, int dim2);
+
+static PyObject * mar345_io_unpack(PyObject *self, PyObject *args){
+  /* not a const int dim1, dim2 since passed by address  to parse tuple ?!? */
+  int dim1,dim2,ocount;
+  npy_intp dims[2];
+  PyArrayObject *py_unpacked;
+  PyObject *py_file;
+  int *unpacked;
+  FILE *file;
+  if (!PyArg_ParseTuple(args, "Oiii", &py_file,&dim1,&dim2,&ocount))
+    return NULL;
+  dims[0]=dim1;dims[1]=dim2;
+
+  file=PyFile_AsFile(py_file);
+
+  /* Space is malloc'ed in here */
+  unpacked=(int*)mar345_read_data(file,ocount,dim1,dim2);
+  
+  /* memcpy(py_unpacked->data,unpacked,dim1*dim2*2); would also need a free */
+  
+  py_unpacked=(PyArrayObject*)PyArray_SimpleNewFromData(2, dims, NPY_UINT, (void *)unpacked);
+
+  return Py_BuildValue ("O", PyArray_Return(py_unpacked));
+}
+
+static PyMethodDef mar345_io_Methods[] = {
+  {"unpack", mar345_io_unpack, METH_VARARGS, "Unpack a mar345 compressed image"},
+  {NULL, NULL, 0, NULL}        /* Sentinel */
+};
+
+PyMODINIT_FUNC
+initmar345_io(void)
+{
+  (void) Py_InitModule("mar345_io", mar345_io_Methods);
+  import_array();
+
+  if(PyErr_Occurred())
+    Py_FatalError("cannot initialize mar345_iomodule.c");
+}
diff --git a/src/stdint.h b/src/stdint.h
new file mode 100644
index 0000000..c55d95d
--- /dev/null
+++ b/src/stdint.h
@@ -0,0 +1,247 @@
+// ISO C9x  compliant stdint.h for Microsoft Visual Studio
+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 
+// 
+//  Copyright (c) 2006-2008 Alexander Chemeris
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+//   1. Redistributions of source code must retain the above copyright notice,
+//      this list of conditions and the following disclaimer.
+// 
+//   2. Redistributions in binary form must reproduce the above copyright
+//      notice, this list of conditions and the following disclaimer in the
+//      documentation and/or other materials provided with the distribution.
+// 
+//   3. The name of the author may be used to endorse or promote products
+//      derived from this software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// 
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_STDINT_H_ // [
+#define _MSC_STDINT_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif
+
+#include <limits.h>
+
+// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
+// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
+// or compiler give many errors like this:
+//   error C2733: second C linkage of overloaded function 'wmemchr' not allowed
+#ifdef __cplusplus
+extern "C" {
+#endif
+#  include <wchar.h>
+#ifdef __cplusplus
+}
+#endif
+
+// Define _W64 macros to mark types changing their size, like intptr_t.
+#ifndef _W64
+#  if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
+#     define _W64 __w64
+#  else
+#     define _W64
+#  endif
+#endif
+
+
+// 7.18.1 Integer types
+
+// 7.18.1.1 Exact-width integer types
+
+// Visual Studio 6 and Embedded Visual C++ 4 doesn't
+// realize that, e.g. char has the same size as __int8
+// so we give up on __intX for them.
+#if (_MSC_VER < 1300)
+   typedef char              int8_t;
+   typedef short             int16_t;
+   typedef int               int32_t;
+   typedef unsigned char     uint8_t;
+   typedef unsigned short    uint16_t;
+   typedef unsigned int      uint32_t;
+#else
+   typedef __int8            int8_t;
+   typedef __int16           int16_t;
+   typedef __int32           int32_t;
+   typedef unsigned __int8   uint8_t;
+   typedef unsigned __int16  uint16_t;
+   typedef unsigned __int32  uint32_t;
+#endif
+typedef __int64              int64_t;
+typedef unsigned __int64     uint64_t;
+
+
+// 7.18.1.2 Minimum-width integer types
+typedef int8_t    int_least8_t;
+typedef int16_t   int_least16_t;
+typedef int32_t   int_least32_t;
+typedef int64_t   int_least64_t;
+typedef uint8_t   uint_least8_t;
+typedef uint16_t  uint_least16_t;
+typedef uint32_t  uint_least32_t;
+typedef uint64_t  uint_least64_t;
+
+// 7.18.1.3 Fastest minimum-width integer types
+typedef int8_t    int_fast8_t;
+typedef int16_t   int_fast16_t;
+typedef int32_t   int_fast32_t;
+typedef int64_t   int_fast64_t;
+typedef uint8_t   uint_fast8_t;
+typedef uint16_t  uint_fast16_t;
+typedef uint32_t  uint_fast32_t;
+typedef uint64_t  uint_fast64_t;
+
+// 7.18.1.4 Integer types capable of holding object pointers
+#ifdef _WIN64 // [
+   typedef __int64           intptr_t;
+   typedef unsigned __int64  uintptr_t;
+#else // _WIN64 ][
+   typedef _W64 int               intptr_t;
+   typedef _W64 unsigned int      uintptr_t;
+#endif // _WIN64 ]
+
+// 7.18.1.5 Greatest-width integer types
+typedef int64_t   intmax_t;
+typedef uint64_t  uintmax_t;
+
+
+// 7.18.2 Limits of specified-width integer types
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [   See footnote 220 at page 257 and footnote 221 at page 259
+
+// 7.18.2.1 Limits of exact-width integer types
+#define INT8_MIN     ((int8_t)_I8_MIN)
+#define INT8_MAX     _I8_MAX
+#define INT16_MIN    ((int16_t)_I16_MIN)
+#define INT16_MAX    _I16_MAX
+#define INT32_MIN    ((int32_t)_I32_MIN)
+#define INT32_MAX    _I32_MAX
+#define INT64_MIN    ((int64_t)_I64_MIN)
+#define INT64_MAX    _I64_MAX
+#define UINT8_MAX    _UI8_MAX
+#define UINT16_MAX   _UI16_MAX
+#define UINT32_MAX   _UI32_MAX
+#define UINT64_MAX   _UI64_MAX
+
+// 7.18.2.2 Limits of minimum-width integer types
+#define INT_LEAST8_MIN    INT8_MIN
+#define INT_LEAST8_MAX    INT8_MAX
+#define INT_LEAST16_MIN   INT16_MIN
+#define INT_LEAST16_MAX   INT16_MAX
+#define INT_LEAST32_MIN   INT32_MIN
+#define INT_LEAST32_MAX   INT32_MAX
+#define INT_LEAST64_MIN   INT64_MIN
+#define INT_LEAST64_MAX   INT64_MAX
+#define UINT_LEAST8_MAX   UINT8_MAX
+#define UINT_LEAST16_MAX  UINT16_MAX
+#define UINT_LEAST32_MAX  UINT32_MAX
+#define UINT_LEAST64_MAX  UINT64_MAX
+
+// 7.18.2.3 Limits of fastest minimum-width integer types
+#define INT_FAST8_MIN    INT8_MIN
+#define INT_FAST8_MAX    INT8_MAX
+#define INT_FAST16_MIN   INT16_MIN
+#define INT_FAST16_MAX   INT16_MAX
+#define INT_FAST32_MIN   INT32_MIN
+#define INT_FAST32_MAX   INT32_MAX
+#define INT_FAST64_MIN   INT64_MIN
+#define INT_FAST64_MAX   INT64_MAX
+#define UINT_FAST8_MAX   UINT8_MAX
+#define UINT_FAST16_MAX  UINT16_MAX
+#define UINT_FAST32_MAX  UINT32_MAX
+#define UINT_FAST64_MAX  UINT64_MAX
+
+// 7.18.2.4 Limits of integer types capable of holding object pointers
+#ifdef _WIN64 // [
+#  define INTPTR_MIN   INT64_MIN
+#  define INTPTR_MAX   INT64_MAX
+#  define UINTPTR_MAX  UINT64_MAX
+#else // _WIN64 ][
+#  define INTPTR_MIN   INT32_MIN
+#  define INTPTR_MAX   INT32_MAX
+#  define UINTPTR_MAX  UINT32_MAX
+#endif // _WIN64 ]
+
+// 7.18.2.5 Limits of greatest-width integer types
+#define INTMAX_MIN   INT64_MIN
+#define INTMAX_MAX   INT64_MAX
+#define UINTMAX_MAX  UINT64_MAX
+
+// 7.18.3 Limits of other integer types
+
+#ifdef _WIN64 // [
+#  define PTRDIFF_MIN  _I64_MIN
+#  define PTRDIFF_MAX  _I64_MAX
+#else  // _WIN64 ][
+#  define PTRDIFF_MIN  _I32_MIN
+#  define PTRDIFF_MAX  _I32_MAX
+#endif  // _WIN64 ]
+
+#define SIG_ATOMIC_MIN  INT_MIN
+#define SIG_ATOMIC_MAX  INT_MAX
+
+#ifndef SIZE_MAX // [
+#  ifdef _WIN64 // [
+#     define SIZE_MAX  _UI64_MAX
+#  else // _WIN64 ][
+#     define SIZE_MAX  _UI32_MAX
+#  endif // _WIN64 ]
+#endif // SIZE_MAX ]
+
+// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
+#ifndef WCHAR_MIN // [
+#  define WCHAR_MIN  0
+#endif  // WCHAR_MIN ]
+#ifndef WCHAR_MAX // [
+#  define WCHAR_MAX  _UI16_MAX
+#endif  // WCHAR_MAX ]
+
+#define WINT_MIN  0
+#define WINT_MAX  _UI16_MAX
+
+#endif // __STDC_LIMIT_MACROS ]
+
+
+// 7.18.4 Limits of other integer types
+
+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [   See footnote 224 at page 260
+
+// 7.18.4.1 Macros for minimum-width integer constants
+
+#define INT8_C(val)  val##i8
+#define INT16_C(val) val##i16
+#define INT32_C(val) val##i32
+#define INT64_C(val) val##i64
+
+#define UINT8_C(val)  val##ui8
+#define UINT16_C(val) val##ui16
+#define UINT32_C(val) val##ui32
+#define UINT64_C(val) val##ui64
+
+// 7.18.4.2 Macros for greatest-width integer constants
+#define INTMAX_C   INT64_C
+#define UINTMAX_C  UINT64_C
+
+#endif // __STDC_CONSTANT_MACROS ]
+
+
+#endif // _MSC_STDINT_H_ ]
diff --git a/stdeb.cfg b/stdeb.cfg
new file mode 100644
index 0000000..a785456
--- /dev/null
+++ b/stdeb.cfg
@@ -0,0 +1,8 @@
+[DEFAULT]
+Package: python-fabio
+Depends: python-imaging, python-numpy
+XS-Python-Version: >= 2.5
+Maintainer: Jerome Kieffer <jerome.kieffer at esrf.fr>
+Build-Depends: python-dev
+Recommends: python-numpy-ext
+
diff --git a/test/benchheader.py b/test/benchheader.py
new file mode 100644
index 0000000..988acab
--- /dev/null
+++ b/test/benchheader.py
@@ -0,0 +1,21 @@
+
+
+import timeit, os, sys
+sys.path.insert(0, os.path.abspath("../build/lib.linux-x86_64-2.6"))
+
+junk = [".svn", "testfile", "testfile.bz2", "testfile.gz"]
+
+#for fname in :
+#    if fname.find("") == -1:
+#        images.append(fname)
+images = [os.path.join("testimages", i) for i in os.listdir("testimages") if (i not in junk) ]
+images.sort()
+for im in images:
+    s = "ret = fabio.openimage.openheader(r\"%s\")" % (im)
+    t = timeit.Timer(s,
+            setup="import fabio.openimage")
+    print "%10.6f" % (t.timeit(10) / 10.0), im
+
+
+
+
diff --git a/test/coral31_benchheaders b/test/coral31_benchheaders
new file mode 100644
index 0000000..d622a64
--- /dev/null
+++ b/test/coral31_benchheaders
@@ -0,0 +1,46 @@
+  0.000857 testimages/Cr8F8140k103.0026
+  0.046055 testimages/Cr8F8140k103.0026.bz2
+  0.001116 testimages/Cr8F8140k103.0026.gz
+  0.000727 testimages/F2K_Seb_Lyso0675.edf
+  0.083457 testimages/F2K_Seb_Lyso0675.edf.bz2
+  0.000906 testimages/F2K_Seb_Lyso0675.edf.gz
+  0.000454 testimages/GE_aSI_detector_image_1529
+  0.058213 testimages/GE_aSI_detector_image_1529.bz2
+  0.000798 testimages/GE_aSI_detector_image_1529.gz
+  0.000572 testimages/b191_1_9_1.img
+  0.057766 testimages/b191_1_9_1.img.bz2
+  0.000981 testimages/b191_1_9_1.img.gz
+  0.000556 testimages/b191_1_9_1_uncompressed.img
+  0.078372 testimages/b191_1_9_1_uncompressed.img.bz2
+  0.001016 testimages/b191_1_9_1_uncompressed.img.gz
+  0.003505 testimages/corkcont2_H_0089.mccd
+  0.067027 testimages/corkcont2_H_0089.mccd.bz2
+  0.004070 testimages/corkcont2_H_0089.mccd.gz
+  0.000617 testimages/example.mar2300
+  0.153640 testimages/example.mar2300.bz2
+  0.000832 testimages/example.mar2300.gz
+  0.000430 testimages/face.edf
+  0.001603 testimages/face.edf.bz2
+  0.001281 testimages/face.edf.gz
+  0.000349 testimages/face.msk
+  0.000797 testimages/face.msk.bz2
+  0.000507 testimages/face.msk.gz
+  0.000431 testimages/fit2d_click.edf
+  0.002208 testimages/fit2d_click.edf.bz2
+  0.011531 testimages/fit2d_click.edf.gz
+  0.000408 testimages/fit2d_click.msk
+  0.000592 testimages/fit2d_click.msk.bz2
+  0.002028 testimages/fit2d_click.msk.gz
+  0.000444 testimages/mb_LP_1_001.edf
+  0.020046 testimages/mb_LP_1_001.img
+  0.644009 testimages/mb_LP_1_001.img.bz2
+  0.130721 testimages/mb_LP_1_001.img.gz
+  0.000385 testimages/oPPA_5grains_0001.tif
+  0.011607 testimages/oPPA_5grains_0001.tif.bz2
+  0.001579 testimages/oPPA_5grains_0001.tif.gz
+  0.003500 testimages/somedata_0001.mccd
+  0.078679 testimages/somedata_0001.mccd.bz2
+  0.003825 testimages/somedata_0001.mccd.gz
+  0.000364 testimages/testmap1_0002.tif
+  0.000399 testimages/testmap1_0002.tif.bz2
+  0.000536 testimages/testmap1_0002.tif.gz
diff --git a/test/coral31_benchmark b/test/coral31_benchmark
new file mode 100644
index 0000000..99d2622
--- /dev/null
+++ b/test/coral31_benchmark
@@ -0,0 +1,53 @@
+I/O 1  : Time to read the image
+I/O 2  : Time to read the image (repeat
+Fabio  : Time for fabio to read the image
+Shell  : Time for shell to do decompression
+Python : Time for python to do decompression
+
+I/O 1  I/O 2  Fabio  Shell  Python   Size/MB
+0.0000 0.0000 0.0100                   0.508 testimages/Cr8F8140k103.0026
+0.0100 0.0000 0.0600 0.0358 0.0300     0.508 testimages/Cr8F8140k103.0026.bz2
+0.0000 0.0000 0.0100 0.0114 0.0100     0.508 testimages/Cr8F8140k103.0026.gz
+0.0100 0.0100 0.0300                   8.003 testimages/F2K_Seb_Lyso0675.edf
+0.0000 0.0100 0.9700 0.9219 0.9200     8.003 testimages/F2K_Seb_Lyso0675.edf.bz2
+0.0000 0.0100 0.1400 0.1360 0.1200     8.003 testimages/F2K_Seb_Lyso0675.edf.gz
+0.0100 0.0200 0.0300                   8.008 testimages/GE_aSI_detector_image_1529
+0.0100 0.0000 0.7700 0.6982 0.6800     8.008 testimages/GE_aSI_detector_image_1529.bz2
+0.0100 0.0000 0.1000 0.1031 0.1000     8.008 testimages/GE_aSI_detector_image_1529.gz
+0.0000 0.0000 0.3400                   0.256 testimages/b191_1_9_1.img
+0.0000 0.0000 0.3800 0.0278 0.0300     0.256 testimages/b191_1_9_1.img.bz2
+0.0000 0.0000 0.3300 0.0083 0.0000     0.256 testimages/b191_1_9_1.img.gz
+0.0000 0.0000 0.0000                   1.005 testimages/b191_1_9_1_uncompressed.img
+0.0000 0.0000 0.1400 0.0954 0.1000     1.005 testimages/b191_1_9_1_uncompressed.img.bz2
+0.0000 0.0000 0.0200 0.0159 0.0100     1.005 testimages/b191_1_9_1_uncompressed.img.gz
+0.0100 0.0100 0.1500                   8.004 testimages/corkcont2_H_0089.mccd
+0.0100 0.0000 0.5000 0.3985 0.3700     8.004 testimages/corkcont2_H_0089.mccd.bz2
+0.0000 0.0000 0.1600 0.1114 0.0700     8.004 testimages/corkcont2_H_0089.mccd.gz
+0.0100 0.0000 0.1400                   3.471 testimages/example.mar2300
+0.0000 0.0000 0.7900 0.5799 0.5500     3.471 testimages/example.mar2300.bz2
+0.0000 0.0100 0.1800 0.0671 0.0400     3.471 testimages/example.mar2300.gz
+0.0000 0.0000 0.0000                   0.215 testimages/face.edf
+0.0000 0.0000 0.0100 0.0201 0.0000     0.215 testimages/face.edf.bz2
+0.0000 0.0000 0.0000 0.0183 0.0000     0.215 testimages/face.edf.gz
+0.0000 0.0000 0.0000                   0.008 testimages/face.msk
+0.0000 0.0000 0.0100 0.0188 0.0000     0.008 testimages/face.msk.bz2
+0.0000 0.0100 0.0000 0.0185 0.0000     0.008 testimages/face.msk.gz
+0.0100 0.0000 0.0100                   4.001 testimages/fit2d_click.edf
+0.0000 0.0000 0.0200 0.0436 0.0200     4.001 testimages/fit2d_click.edf.bz2
+0.0000 0.0000 0.0300 0.0524 0.0300     4.001 testimages/fit2d_click.edf.gz
+0.0000 0.0000 0.1100                   0.126 testimages/fit2d_click.msk
+0.0000 0.0000 0.1100 0.0189 0.0100     0.126 testimages/fit2d_click.msk.bz2
+0.0000 0.0000 0.1000 0.0180 0.0000     0.126 testimages/fit2d_click.msk.gz
+0.0600 0.0700 0.1300                  36.001 testimages/mb_LP_1_001.edf
+0.0400 0.0300 0.1600                  18.000 testimages/mb_LP_1_001.img
+0.0100 0.0000 2.4600 2.4958 1.8100    18.000 testimages/mb_LP_1_001.img.bz2
+0.0100 0.0100 0.4100 0.2717 0.2300    18.000 testimages/mb_LP_1_001.img.gz
+0.0200 0.0100 0.1800                   8.067 testimages/oPPA_5grains_0001.tif
+0.0000 0.0000 0.5100 0.5660 0.3400     8.067 testimages/oPPA_5grains_0001.tif.bz2
+0.0000 0.0000 0.1900 0.0829 0.0400     8.067 testimages/oPPA_5grains_0001.tif.gz
+0.0000 0.0000 0.0300                   2.004 testimages/somedata_0001.mccd
+0.0000 0.0000 0.2600 0.2281 0.2100     2.004 testimages/somedata_0001.mccd.bz2
+0.0000 0.0000 0.0700 0.0507 0.0200     2.004 testimages/somedata_0001.mccd.gz
+0.0000 0.0000 0.0000                   0.023 testimages/testmap1_0002.tif
+0.0000 0.0000 0.0000 0.0192 0.0000     0.023 testimages/testmap1_0002.tif.bz2
+0.0000 0.0000 0.0000 0.0205 0.0000     0.023 testimages/testmap1_0002.tif.gz
diff --git a/test/eeepc-jonathanw_benchheaders b/test/eeepc-jonathanw_benchheaders
new file mode 100644
index 0000000..32b0750
--- /dev/null
+++ b/test/eeepc-jonathanw_benchheaders
@@ -0,0 +1,46 @@
+  0.002404 testimages/Cr8F8140k103.0026
+  0.206815 testimages/Cr8F8140k103.0026.bz2
+  0.003507 testimages/Cr8F8140k103.0026.gz
+  0.001946 testimages/F2K_Seb_Lyso0675.edf
+  0.400643 testimages/F2K_Seb_Lyso0675.edf.bz2
+  0.015549 testimages/F2K_Seb_Lyso0675.edf.gz
+  0.000832 testimages/GE_aSI_detector_image_1529
+  0.297967 testimages/GE_aSI_detector_image_1529.bz2
+  0.002485 testimages/GE_aSI_detector_image_1529.gz
+  0.001397 testimages/b191_1_9_1.img
+  0.399226 testimages/b191_1_9_1.img.bz2
+  0.010648 testimages/b191_1_9_1.img.gz
+  0.001454 testimages/b191_1_9_1_uncompressed.img
+  0.386724 testimages/b191_1_9_1_uncompressed.img.bz2
+  0.003699 testimages/b191_1_9_1_uncompressed.img.gz
+  0.013971 testimages/corkcont2_H_0089.mccd
+  0.453871 testimages/corkcont2_H_0089.mccd.bz2
+  0.017732 testimages/corkcont2_H_0089.mccd.gz
+  0.001761 testimages/example.mar2300
+  0.723718 testimages/example.mar2300.bz2
+  0.002948 testimages/example.mar2300.gz
+  0.000841 testimages/face.edf
+  0.011863 testimages/face.edf.bz2
+  0.004975 testimages/face.edf.gz
+  0.000680 testimages/face.msk
+  0.002963 testimages/face.msk.bz2
+  0.001511 testimages/face.msk.gz
+  0.000861 testimages/fit2d_click.edf
+  0.011688 testimages/fit2d_click.edf.bz2
+  0.035719 testimages/fit2d_click.edf.gz
+  0.000706 testimages/fit2d_click.msk
+  0.001966 testimages/fit2d_click.msk.bz2
+  0.006991 testimages/fit2d_click.msk.gz
+  0.000755 testimages/mb_LP_1_001.edf
+  0.058444 testimages/mb_LP_1_001.img
+  3.408607 testimages/mb_LP_1_001.img.bz2
+  0.488263 testimages/mb_LP_1_001.img.gz
+  0.000593 testimages/oPPA_5grains_0001.tif
+  0.060364 testimages/oPPA_5grains_0001.tif.bz2
+  0.005937 testimages/oPPA_5grains_0001.tif.gz
+  0.013839 testimages/somedata_0001.mccd
+  0.381711 testimages/somedata_0001.mccd.bz2
+  0.019168 testimages/somedata_0001.mccd.gz
+  0.000574 testimages/testmap1_0002.tif
+  0.000943 testimages/testmap1_0002.tif.bz2
+  0.001888 testimages/testmap1_0002.tif.gz
diff --git a/test/eeepc-jonathanw_benchmark b/test/eeepc-jonathanw_benchmark
new file mode 100644
index 0000000..f6a09ba
--- /dev/null
+++ b/test/eeepc-jonathanw_benchmark
@@ -0,0 +1,53 @@
+I/O 1  : Time to read the image
+I/O 2  : Time to read the image (repeat
+Fabio  : Time for fabio to read the image
+Shell  : Time for shell to do decompression
+Python : Time for python to do decompression
+
+I/O 1  I/O 2  Fabio  Shell  Python   Size/MB
+0.0000 0.0000 0.0200                   0.508 testimages/Cr8F8140k103.0026
+0.0000 0.0000 0.2700 0.1878 0.1600     0.508 testimages/Cr8F8140k103.0026.bz2
+0.0000 0.0000 0.0500 0.0430 0.0300     0.508 testimages/Cr8F8140k103.0026.gz
+0.0300 0.0300 0.0500                   8.003 testimages/F2K_Seb_Lyso0675.edf
+0.0200 0.0100 3.7200 3.6164 3.4900     8.003 testimages/F2K_Seb_Lyso0675.edf.bz2
+0.0200 0.0200 0.5200 0.6880 0.5000     8.003 testimages/F2K_Seb_Lyso0675.edf.gz
+0.0300 0.0300 0.0600                   8.008 testimages/GE_aSI_detector_image_1529
+0.0000 0.0200 3.1800 3.0424 2.8600     8.008 testimages/GE_aSI_detector_image_1529.bz2
+0.0100 0.0100 0.3800 0.5069 0.3500     8.008 testimages/GE_aSI_detector_image_1529.gz
+0.0000 0.0000 1.4400                   0.256 testimages/b191_1_9_1.img
+0.0000 0.0100 1.7400 0.1409 0.1200     0.256 testimages/b191_1_9_1.img.bz2
+0.0000 0.0000 1.4200 0.0255 0.0200     0.256 testimages/b191_1_9_1.img.gz
+0.0000 0.0000 0.0200                   1.005 testimages/b191_1_9_1_uncompressed.img
+0.0100 0.0000 0.6000 0.3607 0.3400     1.005 testimages/b191_1_9_1_uncompressed.img.bz2
+0.0100 0.0000 0.0500 0.0674 0.0400     1.005 testimages/b191_1_9_1_uncompressed.img.gz
+0.0300 0.0200 0.3400                   8.004 testimages/corkcont2_H_0089.mccd
+0.0000 0.0100 1.9600 1.6794 1.5200     8.004 testimages/corkcont2_H_0089.mccd.bz2
+0.0000 0.0000 0.5700 0.4143 0.2900     8.004 testimages/corkcont2_H_0089.mccd.gz
+0.0100 0.0100 0.7000                   3.471 testimages/example.mar2300
+0.0100 0.0100 3.0400 2.1931 2.0400     3.471 testimages/example.mar2300.bz2
+0.0100 0.0100 0.9000 0.2436 0.2100     3.471 testimages/example.mar2300.gz
+0.0100 0.0000 0.0000                   0.215 testimages/face.edf
+0.0000 0.0000 0.0100 0.0284 0.0100     0.215 testimages/face.edf.bz2
+0.0000 0.0000 0.0000 0.0217 0.0100     0.215 testimages/face.edf.gz
+0.0000 0.0000 0.0200                   0.008 testimages/face.msk
+0.0100 0.0000 0.0200 0.0181 0.0100     0.008 testimages/face.msk.bz2
+0.0000 0.0000 0.0200 0.0166 0.0000     0.008 testimages/face.msk.gz
+0.0300 0.0100 0.0400                   4.001 testimages/fit2d_click.edf
+0.0000 0.0000 0.1300 0.1984 0.1100     4.001 testimages/fit2d_click.edf.bz2
+0.0000 0.0000 0.1300 0.1338 0.0900     4.001 testimages/fit2d_click.edf.gz
+0.0000 0.0000 0.3200                   0.126 testimages/fit2d_click.msk
+0.0000 0.0000 0.3200 0.0212 0.0000     0.126 testimages/fit2d_click.msk.bz2
+0.0000 0.0000 0.3300 0.0201 0.0000     0.126 testimages/fit2d_click.msk.gz
+0.2000 0.1500 0.2800                  36.001 testimages/mb_LP_1_001.edf
+0.0700 0.0800 0.3500                  18.000 testimages/mb_LP_1_001.img
+0.0200 0.0200 10.4500 7.4476 6.8900    18.000 testimages/mb_LP_1_001.img.bz2
+0.0500 0.0200 1.5700 2.1255 0.9200    18.000 testimages/mb_LP_1_001.img.gz
+0.0400 0.0200 0.5300                   8.067 testimages/oPPA_5grains_0001.tif
+0.0000 0.0000 1.9100 1.5322 1.3800     8.067 testimages/oPPA_5grains_0001.tif.bz2
+0.0000 0.0000 0.6400 0.2398 0.1800     8.067 testimages/oPPA_5grains_0001.tif.gz
+0.0000 0.0100 0.0900                   2.004 testimages/somedata_0001.mccd
+0.0000 0.0000 0.9200 0.7265 0.6400     2.004 testimages/somedata_0001.mccd.bz2
+0.0000 0.0100 0.1700 0.1496 0.0900     2.004 testimages/somedata_0001.mccd.gz
+0.0000 0.0000 0.0000                   0.023 testimages/testmap1_0002.tif
+0.0000 0.0000 0.0100 0.0211 0.0000     0.023 testimages/testmap1_0002.tif.bz2
+0.0100 0.0000 0.0000 0.0203 0.0000     0.023 testimages/testmap1_0002.tif.gz
diff --git a/test/esrflinux1-1a_benchheaders b/test/esrflinux1-1a_benchheaders
new file mode 100644
index 0000000..7b848b4
--- /dev/null
+++ b/test/esrflinux1-1a_benchheaders
@@ -0,0 +1,46 @@
+  0.041507 testimages/Cr8F8140k103.0026
+  0.060209 testimages/Cr8F8140k103.0026.bz2
+  0.001523 testimages/Cr8F8140k103.0026.gz
+  0.001040 testimages/F2K_Seb_Lyso0675.edf
+  0.115198 testimages/F2K_Seb_Lyso0675.edf.bz2
+  0.001390 testimages/F2K_Seb_Lyso0675.edf.gz
+  0.000740 testimages/GE_aSI_detector_image_1529
+  0.082954 testimages/GE_aSI_detector_image_1529.bz2
+  0.001530 testimages/GE_aSI_detector_image_1529.gz
+  0.001205 testimages/b191_1_9_1.img
+  0.082022 testimages/b191_1_9_1.img.bz2
+  0.001455 testimages/b191_1_9_1.img.gz
+  0.000870 testimages/b191_1_9_1_uncompressed.img
+  0.107474 testimages/b191_1_9_1_uncompressed.img.bz2
+  0.002650 testimages/b191_1_9_1_uncompressed.img.gz
+  0.007094 testimages/corkcont2_H_0089.mccd
+  0.135271 testimages/corkcont2_H_0089.mccd.bz2
+  0.006231 testimages/corkcont2_H_0089.mccd.gz
+  0.041302 testimages/example.mar2300
+  0.215028 testimages/example.mar2300.bz2
+  0.001293 testimages/example.mar2300.gz
+  0.000765 testimages/face.edf
+  0.002466 testimages/face.edf.bz2
+  0.002021 testimages/face.edf.gz
+  0.000607 testimages/face.msk
+  0.041250 testimages/face.msk.bz2
+  0.000841 testimages/face.msk.gz
+  0.000759 testimages/fit2d_click.edf
+  0.003282 testimages/fit2d_click.edf.bz2
+  0.017603 testimages/fit2d_click.edf.gz
+  0.000693 testimages/fit2d_click.msk
+  0.000938 testimages/fit2d_click.msk.bz2
+  0.003037 testimages/fit2d_click.msk.gz
+  0.000748 testimages/mb_LP_1_001.edf
+  0.028433 testimages/mb_LP_1_001.img
+  0.835932 testimages/mb_LP_1_001.img.bz2
+  0.171870 testimages/mb_LP_1_001.img.gz
+  0.000714 testimages/oPPA_5grains_0001.tif
+  0.031276 testimages/oPPA_5grains_0001.tif.bz2
+  0.003840 testimages/oPPA_5grains_0001.tif.gz
+  0.005126 testimages/somedata_0001.mccd
+  0.110826 testimages/somedata_0001.mccd.bz2
+  0.006386 testimages/somedata_0001.mccd.gz
+  0.003645 testimages/testmap1_0002.tif
+  0.001334 testimages/testmap1_0002.tif.bz2
+  0.001180 testimages/testmap1_0002.tif.gz
diff --git a/test/esrflinux1-1a_benchmark b/test/esrflinux1-1a_benchmark
new file mode 100644
index 0000000..858b59e
--- /dev/null
+++ b/test/esrflinux1-1a_benchmark
@@ -0,0 +1,3563 @@
+I/O 1  : Time to read the image
+I/O 2  : Time to read the image (repeat
+Fabio  : Time for fabio to read the image
+Shell  : Time for shell to do decompression
+Python : Time for python to do decompression
+
+I/O 1  I/O 2  Fabio  Shell  Python   Size/MB
+0.0000 0.0000 0.0200                   0.508 testimages/Cr8F8140k103.0026
+Thu Oct 30 12:14:08 2008    stats
+
+         637 function calls in 0.008 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.008    0.008 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.001    0.001    0.001    0.001 brukerimage.py:35(_readheader)
+        1    0.000    0.000    0.007    0.007 brukerimage.py:84(read)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.008    0.008 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.003    0.003 readbytestream.py:27(readbytestream)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        6    0.000    0.000    0.000    0.000 {hasattr}
+        2    0.000    0.000    0.000    0.000 {len}
+       80    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.003    0.003    0.003    0.003 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+      127    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+       92    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        6    0.001    0.000    0.001    0.000 {method 'read' of 'file' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+       92    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+      184    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.001    0.001    0.001    0.001 {numpy.core.multiarray.array}
+        1    0.001    0.001    0.001    0.001 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+        1    0.000    0.000    0.000    0.000 {range}
+
+
+0.0000 0.0000 0.0800 0.0530 0.0400     0.508 testimages/Cr8F8140k103.0026.bz2
+Thu Oct 30 12:14:08 2008    stats
+
+         637 function calls in 0.079 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.079    0.079 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.001    0.001    0.030    0.030 brukerimage.py:35(_readheader)
+        1    0.000    0.000    0.049    0.049 brukerimage.py:84(read)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.001    0.000    0.001    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.079    0.079 openimage.py:67(openimage)
+        1    0.000    0.000    0.030    0.030 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.015    0.015 readbytestream.py:27(readbytestream)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        6    0.000    0.000    0.000    0.000 {hasattr}
+        2    0.000    0.000    0.000    0.000 {len}
+       80    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.003    0.003    0.003    0.003 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+      127    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+       92    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        6    0.071    0.012    0.071    0.012 {method 'read' of 'bz2.BZ2File' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'seek' of 'bz2.BZ2File' objects}
+       92    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+      184    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'tell' of 'bz2.BZ2File' objects}
+        1    0.001    0.001    0.001    0.001 {numpy.core.multiarray.array}
+        1    0.001    0.001    0.001    0.001 {numpy.core.multiarray.fromstring}
+        1    0.000    0.000    0.000    0.000 {range}
+
+
+0.0000 0.0100 0.0200 0.0182 0.0100     0.508 testimages/Cr8F8140k103.0026.gz
+Thu Oct 30 12:14:09 2008    stats
+
+         818 function calls in 0.019 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.019    0.019 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.001    0.001    0.002    0.002 brukerimage.py:35(_readheader)
+        1    0.000    0.000    0.017    0.017 brukerimage.py:84(read)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        7    0.001    0.000    0.012    0.002 gzip.py:208(read)
+       12    0.000    0.000    0.011    0.001 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       12    0.003    0.000    0.003    0.000 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:360(tell)
+        1    0.000    0.000    0.000    0.000 gzip.py:374(seek)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.019    0.019 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.012    0.012 readbytestream.py:27(readbytestream)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+       12    0.006    0.001    0.006    0.001 {built-in method decompress}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        6    0.000    0.000    0.000    0.000 {hasattr}
+       27    0.000    0.000    0.000    0.000 {len}
+       80    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.003    0.003    0.003    0.003 {method 'astype' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+      127    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+       92    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       58    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        6    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+       92    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+      184    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+        4    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       12    0.000    0.000    0.000    0.000 {min}
+        1    0.001    0.001    0.001    0.001 {numpy.core.multiarray.array}
+        1    0.001    0.001    0.001    0.001 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+        4    0.000    0.000    0.000    0.000 {ord}
+        2    0.000    0.000    0.000    0.000 {range}
+       14    0.001    0.000    0.001    0.000 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0100 0.0200 0.0200                   8.003 testimages/F2K_Seb_Lyso0675.edf
+Thu Oct 30 12:14:09 2008    stats
+
+         624 function calls in 0.034 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.002    0.002    0.034    0.034 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.001    0.001    0.001    0.001 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.031    0.031 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.032    0.032 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 {apply}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+       12    0.000    0.000    0.000    0.000 {len}
+       90    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      180    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+        8    0.015    0.002    0.015    0.002 {method 'read' of 'file' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+      180    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+       91    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.015    0.015    0.015    0.015 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+
+
+0.0100 0.0000 1.1700 1.1390 1.0800     8.003 testimages/F2K_Seb_Lyso0675.edf.bz2
+Thu Oct 30 12:14:13 2008    stats
+
+         624 function calls in 1.164 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.001    0.001    1.164    1.164 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.001    0.001    0.058    0.058 edfimage.py:55(_readheader)
+        1    0.000    0.000    1.104    1.104 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.002    0.001 fabioimage.py:259(_open)
+        2    0.001    0.001    0.001    0.001 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    1.163    1.163 openimage.py:67(openimage)
+        1    0.001    0.001    0.058    0.058 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 {apply}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+       12    0.000    0.000    0.000    0.000 {len}
+       90    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      180    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+        8    1.142    0.143    1.142    0.143 {method 'read' of 'bz2.BZ2File' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+      180    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+       91    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.015    0.015    0.015    0.015 {numpy.core.multiarray.fromstring}
+
+
+0.0100 0.0100 0.1900 0.6054 0.1700     8.003 testimages/F2K_Seb_Lyso0675.edf.gz
+Thu Oct 30 12:14:15 2008    stats
+
+         845 function calls in 0.595 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.002    0.002    0.595    0.595 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.001    0.001    0.001    0.001 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.590    0.590 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.401    0.200 fabioimage.py:259(_open)
+        2    0.000    0.000    0.401    0.200 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        8    0.002    0.000    0.174    0.022 gzip.py:208(read)
+       17    0.000    0.000    0.172    0.010 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       16    0.041    0.003    0.054    0.003 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.400    0.200 gzip.py:60(__init__)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.593    0.593 openimage.py:67(openimage)
+        1    0.000    0.000    0.002    0.002 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.000    0.000 {apply}
+       16    0.108    0.007    0.108    0.007 {built-in method decompress}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+       45    0.000    0.000    0.000    0.000 {len}
+       90    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      180    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+       68    0.009    0.000    0.009    0.000 {method 'read' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+      180    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+       91    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       16    0.000    0.000    0.000    0.000 {min}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.015    0.015    0.015    0.015 {numpy.core.multiarray.fromstring}
+        2    0.400    0.200    0.400    0.200 {open}
+        4    0.000    0.000    0.000    0.000 {ord}
+       18    0.013    0.001    0.013    0.001 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0100 0.0200 0.0400                   8.008 testimages/GE_aSI_detector_image_1529
+Thu Oct 30 12:14:16 2008    stats
+
+         87 function calls in 0.434 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.002    0.002    0.434    0.434 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 GEimage.py:29(_readheader)
+        1    0.001    0.001    0.031    0.031 GEimage.py:460(read)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.401    0.201 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.432    0.432 openimage.py:67(openimage)
+        1    0.000    0.000    0.401    0.401 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        2    0.000    0.000    0.000    0.000 {len}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       21    0.015    0.001    0.015    0.001 {method 'read' of 'file' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        9    0.015    0.002    0.015    0.002 {numpy.core.multiarray.fromstring}
+        2    0.401    0.201    0.401    0.201 {open}
+
+
+0.0100 0.0000 0.9400 0.8904 0.8400     8.008 testimages/GE_aSI_detector_image_1529.bz2
+Thu Oct 30 12:14:19 2008    stats
+
+         87 function calls in 0.947 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.002    0.002    0.947    0.947 <string>:1(<module>)
+        1    0.000    0.000    0.040    0.040 GEimage.py:29(_readheader)
+        1    0.002    0.002    0.904    0.904 GEimage.py:460(read)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.001    0.000    0.001    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.945    0.945 openimage.py:67(openimage)
+        1    0.001    0.001    0.041    0.041 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        2    0.000    0.000    0.000    0.000 {len}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       21    0.885    0.042    0.885    0.042 {method 'read' of 'bz2.BZ2File' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        3    0.040    0.013    0.040    0.013 {method 'seek' of 'bz2.BZ2File' objects}
+        9    0.016    0.002    0.016    0.002 {numpy.core.multiarray.fromstring}
+
+
+0.0000 0.0100 0.1500 0.1368 0.1200     8.008 testimages/GE_aSI_detector_image_1529.gz
+Thu Oct 30 12:14:20 2008    stats
+
+         365 function calls in 0.147 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.002    0.002    0.147    0.147 <string>:1(<module>)
+        1    0.000    0.000    0.001    0.001 GEimage.py:29(_readheader)
+        1    0.002    0.002    0.144    0.144 GEimage.py:460(read)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        3    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        3    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+       32    0.002    0.000    0.127    0.004 gzip.py:208(read)
+       15    0.000    0.000    0.125    0.008 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       15    0.041    0.003    0.054    0.004 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        1    0.000    0.000    0.000    0.000 gzip.py:363(rewind)
+        3    0.000    0.000    0.000    0.000 gzip.py:374(seek)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.145    0.145 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+       15    0.066    0.004    0.066    0.004 {built-in method decompress}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+       33    0.000    0.000    0.000    0.000 {len}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      110    0.005    0.000    0.005    0.000 {method 'read' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        9    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       15    0.000    0.000    0.000    0.000 {min}
+        9    0.016    0.002    0.016    0.002 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+        6    0.000    0.000    0.000    0.000 {ord}
+        3    0.000    0.000    0.000    0.000 {range}
+       18    0.013    0.001    0.013    0.001 {zlib.crc32}
+        3    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0000 0.0000 0.4500                   0.256 testimages/b191_1_9_1.img
+Thu Oct 30 12:14:21 2008    stats
+
+         128 function calls in 0.444 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.444    0.444 <string>:1(<module>)
+        1    0.422    0.422    0.443    0.443 OXDimage.py:145(read)
+        1    0.000    0.000    0.000    0.000 OXDimage.py:27(_readheader)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.444    0.444 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        4    0.000    0.000    0.000    0.000 {len}
+        2    0.006    0.003    0.006    0.003 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.003    0.003    0.003    0.003 {method 'copy' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        9    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        8    0.001    0.000    0.001    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'readline' of 'file' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+       46    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+        1    0.010    0.010    0.010    0.010 {range}
+
+
+0.0000 0.0000 0.5300 0.0439 0.0300     0.256 testimages/b191_1_9_1.img.bz2
+Thu Oct 30 12:14:23 2008    stats
+
+         128 function calls in 0.538 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.538    0.538 <string>:1(<module>)
+        1    0.424    0.424    0.510    0.510 OXDimage.py:145(read)
+        1    0.000    0.000    0.055    0.055 OXDimage.py:27(_readheader)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.001    0.000    0.001    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.537    0.537 openimage.py:67(openimage)
+        1    0.000    0.000    0.027    0.027 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        4    0.000    0.000    0.000    0.000 {len}
+        2    0.006    0.003    0.006    0.003 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.003    0.003    0.003    0.003 {method 'copy' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        9    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        8    0.033    0.004    0.033    0.004 {method 'read' of 'bz2.BZ2File' objects}
+        6    0.028    0.005    0.028    0.005 {method 'readline' of 'bz2.BZ2File' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        3    0.026    0.009    0.026    0.009 {method 'seek' of 'bz2.BZ2File' objects}
+        2    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+       46    0.001    0.000    0.001    0.000 {numpy.core.multiarray.fromstring}
+        1    0.014    0.014    0.014    0.014 {range}
+
+
+0.0000 0.0000 0.4600 0.0149 0.0100     0.256 testimages/b191_1_9_1.img.gz
+Thu Oct 30 12:14:24 2008    stats
+
+         398 function calls in 0.464 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.464    0.464 <string>:1(<module>)
+        1    0.431    0.431    0.461    0.461 OXDimage.py:145(read)
+        1    0.000    0.000    0.001    0.001 OXDimage.py:27(_readheader)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.002    0.001 fabioimage.py:259(_open)
+        2    0.000    0.000    0.002    0.001 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        3    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        3    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+       22    0.001    0.000    0.006    0.000 gzip.py:208(read)
+        6    0.000    0.000    0.000    0.000 gzip.py:240(_unread)
+       11    0.000    0.000    0.005    0.000 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       11    0.001    0.000    0.001    0.000 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        1    0.000    0.000    0.000    0.000 gzip.py:363(rewind)
+        3    0.000    0.000    0.000    0.000 gzip.py:374(seek)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        6    0.000    0.000    0.000    0.000 gzip.py:391(readline)
+        2    0.000    0.000    0.002    0.001 gzip.py:60(__init__)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.464    0.464 openimage.py:67(openimage)
+        1    0.000    0.000    0.002    0.002 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+       11    0.003    0.000    0.003    0.000 {built-in method decompress}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+       47    0.000    0.000    0.000    0.000 {len}
+       10    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        2    0.006    0.003    0.006    0.003 {method 'astype' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.003    0.003    0.003    0.003 {method 'copy' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       19    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        7    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       70    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        9    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       16    0.000    0.000    0.000    0.000 {min}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+       46    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        2    0.002    0.001    0.002    0.001 {open}
+        6    0.000    0.000    0.000    0.000 {ord}
+        4    0.014    0.003    0.014    0.003 {range}
+       14    0.000    0.000    0.000    0.000 {zlib.crc32}
+        3    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0100 0.0000 0.0000                   1.005 testimages/b191_1_9_1_uncompressed.img
+Thu Oct 30 12:14:24 2008    stats
+
+         120 function calls in 0.007 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.007    0.007 <string>:1(<module>)
+        1    0.000    0.000    0.006    0.006 OXDimage.py:145(read)
+        1    0.000    0.000    0.000    0.000 OXDimage.py:27(_readheader)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.007    0.007 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        3    0.000    0.000    0.000    0.000 {len}
+        1    0.002    0.002    0.002    0.002 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        9    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        7    0.002    0.000    0.002    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'readline' of 'file' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+       45    0.002    0.000    0.002    0.000 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+
+
+0.0000 0.0000 0.1700 0.1178 0.1000     1.005 testimages/b191_1_9_1_uncompressed.img.bz2
+Thu Oct 30 12:14:25 2008    stats
+
+         120 function calls in 0.179 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.179    0.179 <string>:1(<module>)
+        1    0.000    0.000    0.143    0.143 OXDimage.py:145(read)
+        1    0.000    0.000    0.069    0.069 OXDimage.py:27(_readheader)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.001    0.000    0.001    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.178    0.178 openimage.py:67(openimage)
+        1    0.001    0.001    0.036    0.036 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        3    0.000    0.000    0.000    0.000 {len}
+        1    0.002    0.002    0.002    0.002 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.001    0.001    0.001    0.001 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        9    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        7    0.103    0.015    0.103    0.015 {method 'read' of 'bz2.BZ2File' objects}
+        6    0.034    0.006    0.034    0.006 {method 'readline' of 'bz2.BZ2File' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        3    0.034    0.011    0.034    0.011 {method 'seek' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+       45    0.002    0.000    0.002    0.000 {numpy.core.multiarray.fromstring}
+
+
+0.0000 0.0000 0.0200 0.0249 0.0200     1.005 testimages/b191_1_9_1_uncompressed.img.gz
+Thu Oct 30 12:14:25 2008    stats
+
+         433 function calls in 0.021 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.021    0.021 <string>:1(<module>)
+        1    0.000    0.000    0.020    0.020 OXDimage.py:145(read)
+        1    0.000    0.000    0.001    0.001 OXDimage.py:27(_readheader)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        3    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        3    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+       19    0.000    0.000    0.015    0.001 gzip.py:208(read)
+        6    0.000    0.000    0.000    0.000 gzip.py:240(_unread)
+       13    0.000    0.000    0.015    0.001 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       13    0.005    0.000    0.006    0.000 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        1    0.000    0.000    0.000    0.000 gzip.py:363(rewind)
+        3    0.000    0.000    0.000    0.000 gzip.py:374(seek)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        6    0.000    0.000    0.000    0.000 gzip.py:391(readline)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.021    0.021 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+       13    0.008    0.001    0.008    0.001 {built-in method decompress}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+       46    0.000    0.000    0.000    0.000 {len}
+        8    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.002    0.002    0.002    0.002 {method 'astype' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       17    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        7    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      111    0.001    0.000    0.001    0.000 {method 'read' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        9    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       16    0.000    0.000    0.000    0.000 {min}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+       45    0.002    0.000    0.002    0.000 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+        6    0.000    0.000    0.000    0.000 {ord}
+        3    0.000    0.000    0.000    0.000 {range}
+       16    0.002    0.000    0.002    0.000 {zlib.crc32}
+        3    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0100 0.0200 0.2100                   8.004 testimages/corkcont2_H_0089.mccd
+Thu Oct 30 12:14:26 2008    stats
+
+         4000 function calls in 0.169 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.004    0.004    0.169    0.169 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.001    0.001 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        1    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.001    0.001    0.067    0.067 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.049    0.049 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        2    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.001    0.001    0.014    0.014 ImageFile.py:115(load)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        2    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.001    0.000 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.000    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:521(_setup)
+       31    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       25    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:139(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:77(__init__)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.006    0.006    0.007    0.007 marccdimage.py:264(interpret_header)
+        1    0.000    0.000    0.007    0.007 marccdimage.py:292(_readheader)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.165    0.165 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:74(split)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.033    0.033 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.007    0.007    0.164    0.164 tifimage.py:53(read)
+        1    0.000    0.000    0.000    0.000 {PIL._imaging.new}
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.035    0.035    0.035    0.035 {built-in method convert}
+      128    0.005    0.000    0.005    0.000 {built-in method decode}
+      256    0.033    0.000    0.033    0.000 {built-in method encode}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        4    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       12    0.000    0.000    0.000    0.000 {isinstance}
+       40    0.000    0.000    0.000    0.000 {len}
+        1    0.000    0.000    0.000    0.000 {max}
+      421    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+     2523    0.001    0.000    0.001    0.000 {method 'has_key' of 'dict' objects}
+        3    0.032    0.011    0.032    0.011 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      152    0.008    0.000    0.008    0.000 {method 'read' of 'file' objects}
+       10    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        2    0.000    0.000    0.000    0.000 {min}
+        1    0.033    0.033    0.033    0.033 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+      188    0.000    0.000    0.000    0.000 {ord}
+       11    0.000    0.000    0.000    0.000 {range}
+
+
+0.0000 0.0000 0.6300 0.6214 0.4500     8.004 testimages/corkcont2_H_0089.mccd.bz2
+Thu Oct 30 12:14:28 2008    stats
+
+         4002 function calls in 0.657 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.005    0.005    0.657    0.657 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.002    0.002 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        1    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.001    0.001    0.067    0.067 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.043    0.043 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        2    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.001    0.001    0.012    0.012 ImageFile.py:115(load)
+        1    0.000    0.000    0.001    0.001 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        2    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.001    0.000 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.000    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:521(_setup)
+       31    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       25    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:139(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:77(__init__)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.453    0.226 fabioimage.py:259(_open)
+        2    0.001    0.000    0.453    0.226 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.006    0.006    0.007    0.007 marccdimage.py:264(interpret_header)
+        1    0.000    0.000    0.007    0.007 marccdimage.py:292(_readheader)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.652    0.652 openimage.py:67(openimage)
+        1    0.000    0.000    0.041    0.041 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:74(split)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.032    0.032 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.007    0.007    0.611    0.611 tifimage.py:53(read)
+        1    0.001    0.001    0.001    0.001 {PIL._imaging.new}
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.031    0.031    0.031    0.031 {built-in method convert}
+      128    0.005    0.000    0.005    0.000 {built-in method decode}
+      256    0.034    0.000    0.034    0.000 {built-in method encode}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        4    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       12    0.000    0.000    0.000    0.000 {isinstance}
+       40    0.000    0.000    0.000    0.000 {len}
+        1    0.000    0.000    0.000    0.000 {max}
+      421    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+     2523    0.001    0.000    0.001    0.000 {method 'has_key' of 'dict' objects}
+        3    0.032    0.011    0.032    0.011 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    0.492    0.246    0.492    0.246 {method 'read' of 'bz2.BZ2File' objects}
+      151    0.006    0.000    0.006    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       10    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+        1    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        2    0.000    0.000    0.000    0.000 {min}
+        1    0.033    0.033    0.033    0.033 {numpy.core.multiarray.fromstring}
+      188    0.000    0.000    0.000    0.000 {ord}
+       11    0.000    0.000    0.000    0.000 {range}
+
+
+0.0100 0.0000 0.2400 0.1626 0.0900     8.004 testimages/corkcont2_H_0089.mccd.gz
+Thu Oct 30 12:14:29 2008    stats
+
+         4194 function calls in 0.264 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.005    0.005    0.264    0.264 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.001    0.001 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        1    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.001    0.001    0.065    0.065 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.038    0.038 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        2    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.001    0.001    0.015    0.015 ImageFile.py:115(load)
+        1    0.000    0.000    0.001    0.001 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        2    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.001    0.000 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.000    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:521(_setup)
+       31    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       25    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:139(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:77(__init__)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.106    0.053 fabioimage.py:259(_open)
+        2    0.000    0.000    0.106    0.053 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        2    0.000    0.000    0.098    0.049 gzip.py:208(read)
+       13    0.000    0.000    0.097    0.007 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       12    0.030    0.002    0.043    0.004 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.009    0.005 gzip.py:60(__init__)
+        1    0.006    0.006    0.007    0.007 marccdimage.py:264(interpret_header)
+        1    0.000    0.000    0.007    0.007 marccdimage.py:292(_readheader)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.259    0.259 openimage.py:67(openimage)
+        1    0.000    0.000    0.009    0.009 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:74(split)
+        2    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.032    0.032 string.py:306(join)
+        3    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.007    0.007    0.251    0.251 tifimage.py:53(read)
+        1    0.001    0.001    0.001    0.001 {PIL._imaging.new}
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.023    0.023    0.023    0.023 {built-in method convert}
+      128    0.006    0.000    0.006    0.000 {built-in method decode}
+       12    0.052    0.004    0.052    0.004 {built-in method decompress}
+      256    0.032    0.000    0.032    0.000 {built-in method encode}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        4    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       12    0.000    0.000    0.000    0.000 {isinstance}
+       65    0.000    0.000    0.000    0.000 {len}
+        1    0.000    0.000    0.000    0.000 {max}
+      421    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+     2523    0.001    0.000    0.001    0.000 {method 'has_key' of 'dict' objects}
+        3    0.032    0.011    0.032    0.011 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      151    0.006    0.000    0.006    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       66    0.002    0.000    0.002    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        7    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        3    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       14    0.000    0.000    0.000    0.000 {min}
+        1    0.033    0.033    0.033    0.033 {numpy.core.multiarray.fromstring}
+        2    0.009    0.005    0.009    0.005 {open}
+      192    0.000    0.000    0.000    0.000 {ord}
+       11    0.000    0.000    0.000    0.000 {range}
+       14    0.013    0.001    0.013    0.001 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0100 0.0000 0.2000                   3.471 testimages/example.mar2300
+Thu Oct 30 12:14:30 2008    stats
+
+         222 function calls in 0.201 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.201    0.201 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:139(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:77(__init__)
+        2    0.000    0.000    0.003    0.002 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.198    0.198 mar345image.py:21(read)
+        1    0.000    0.000    0.001    0.001 mar345image.py:46(_readheader)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.201    0.201 openimage.py:67(openimage)
+        1    0.000    0.000    0.003    0.003 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:74(split)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 string.py:246(strip)
+       15    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+       16    0.000    0.000    0.000    0.000 {len}
+        1    0.196    0.196    0.196    0.196 {mar345_io.unpack}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        3    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        4    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+       10    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+       67    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'splitlines' of 'str' objects}
+       17    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+       15    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       11    0.000    0.000    0.000    0.000 {method 'update' of 'dict' objects}
+        2    0.003    0.002    0.003    0.002 {open}
+       11    0.000    0.000    0.000    0.000 {range}
+
+
+0.0000 0.0000 0.9900 0.8456 0.6700     3.471 testimages/example.mar2300.bz2
+Thu Oct 30 12:14:33 2008    stats
+
+         227 function calls in 0.998 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.998    0.998 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:139(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:77(__init__)
+        2    0.000    0.000    0.693    0.346 fabioimage.py:259(_open)
+        2    0.001    0.000    0.693    0.346 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.895    0.895 mar345image.py:21(read)
+        1    0.000    0.000    0.001    0.001 mar345image.py:46(_readheader)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.998    0.998 openimage.py:67(openimage)
+        1    0.000    0.000    0.103    0.103 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:74(split)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 string.py:246(strip)
+       15    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+       16    0.000    0.000    0.000    0.000 {len}
+        1    0.198    0.198    0.198    0.198 {mar345_io.unpack}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.003    0.003    0.003    0.003 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        3    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    0.780    0.390    0.780    0.390 {method 'read' of 'bz2.BZ2File' objects}
+        3    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+       10    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+       67    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'splitlines' of 'str' objects}
+       17    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+       15    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       11    0.000    0.000    0.000    0.000 {method 'update' of 'dict' objects}
+        1    0.013    0.013    0.013    0.013 {method 'write' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {posix.tmpfile}
+       11    0.000    0.000    0.000    0.000 {range}
+
+
+0.0100 0.0000 0.2800 0.1064 0.0600     3.471 testimages/example.mar2300.gz
+Thu Oct 30 12:14:34 2008    stats
+
+         414 function calls in 0.268 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.268    0.268 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:139(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:77(__init__)
+        2    0.000    0.000    0.065    0.033 fabioimage.py:259(_open)
+        2    0.000    0.000    0.065    0.033 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        2    0.000    0.000    0.051    0.026 gzip.py:208(read)
+       14    0.000    0.000    0.051    0.004 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       13    0.009    0.001    0.014    0.001 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        1    0.000    0.000    0.267    0.267 mar345image.py:21(read)
+        1    0.000    0.000    0.001    0.001 mar345image.py:46(_readheader)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.268    0.268 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:74(split)
+        2    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 string.py:246(strip)
+       17    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+       13    0.032    0.002    0.032    0.002 {built-in method decompress}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+       43    0.000    0.000    0.000    0.000 {len}
+        1    0.198    0.198    0.198    0.198 {mar345_io.unpack}
+        3    0.003    0.001    0.003    0.001 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        3    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       58    0.004    0.000    0.004    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        8    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+       67    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'splitlines' of 'str' objects}
+       17    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+       17    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       11    0.000    0.000    0.000    0.000 {method 'update' of 'dict' objects}
+        1    0.013    0.013    0.013    0.013 {method 'write' of 'file' objects}
+       13    0.000    0.000    0.000    0.000 {min}
+        2    0.000    0.000    0.000    0.000 {open}
+        4    0.000    0.000    0.000    0.000 {ord}
+        1    0.000    0.000    0.000    0.000 {posix.tmpfile}
+       11    0.000    0.000    0.000    0.000 {range}
+       15    0.006    0.000    0.006    0.000 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0000 0.0000 0.0100                   0.215 testimages/face.edf
+Thu Oct 30 12:14:35 2008    stats
+
+         119 function calls in 0.003 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.003    0.003 <string>:1(<module>)
+        2    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:1321(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 __init__.py:959(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.000    0.000    0.000    0.000 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.002    0.002 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.002    0.001 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.003    0.003 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        9    0.000    0.000    0.000    0.000 {len}
+        7    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       12    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+        4    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        2    0.002    0.001    0.002    0.001 {open}
+
+
+0.0000 0.0000 0.0000 0.0443 0.0000     0.215 testimages/face.edf.bz2
+Thu Oct 30 12:14:35 2008    stats
+
+         119 function calls in 0.007 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.007    0.007 <string>:1(<module>)
+        2    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:1321(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 __init__.py:959(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.000    0.000    0.001    0.001 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.004    0.004 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.004    0.002 fabioimage.py:259(_open)
+        2    0.004    0.002    0.004    0.002 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.007    0.007 openimage.py:67(openimage)
+        1    0.000    0.000    0.003    0.003 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        9    0.000    0.000    0.000    0.000 {len}
+        7    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       12    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+        4    0.003    0.001    0.003    0.001 {method 'read' of 'bz2.BZ2File' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+
+
+0.0000 0.0000 0.0100 0.0373 0.0000     0.215 testimages/face.edf.gz
+Thu Oct 30 12:14:36 2008    stats
+
+         212 function calls in 0.004 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.004    0.004 <string>:1(<module>)
+        2    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:1321(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 __init__.py:959(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.000    0.000    0.001    0.001 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.003    0.003 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        4    0.000    0.000    0.002    0.001 gzip.py:208(read)
+        4    0.000    0.000    0.002    0.001 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+        3    0.000    0.000    0.001    0.000 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.000    0.000 gzip.py:60(__init__)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.004    0.004 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        2    0.000    0.000    0.000    0.000 {apply}
+        3    0.001    0.000    0.001    0.000 {built-in method decompress}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+       16    0.000    0.000    0.000    0.000 {len}
+        7    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       12    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+       31    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        7    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        3    0.000    0.000    0.000    0.000 {min}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+        4    0.000    0.000    0.000    0.000 {ord}
+        5    0.000    0.000    0.000    0.000 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0000 0.0000 0.0000                   0.008 testimages/face.msk
+Thu Oct 30 12:14:36 2008    stats
+
+         82 function calls in 0.008 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.008    0.008 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fit2dmaskimage.py:19(_readheader)
+        1    0.002    0.002    0.007    0.007 fit2dmaskimage.py:36(read)
+        2    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 numeric.py:797(ones)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.008    0.008 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        4    0.000    0.000    0.000    0.000 {len}
+        9    0.000    0.000    0.000    0.000 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        1    0.000    0.000    0.000    0.000 {method 'fill' of 'numpy.ndarray' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        3    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.empty}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        1    0.005    0.005    0.005    0.005 {numpy.core.multiarray.where}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.zeros}
+        2    0.000    0.000    0.000    0.000 {open}
+        1    0.000    0.000    0.000    0.000 {range}
+
+
+0.0000 0.0000 0.0100 0.0335 0.0000     0.008 testimages/face.msk.bz2
+Thu Oct 30 12:14:36 2008    stats
+
+         82 function calls in 0.010 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.010    0.010 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fit2dmaskimage.py:19(_readheader)
+        1    0.002    0.002    0.009    0.009 fit2dmaskimage.py:36(read)
+        2    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 numeric.py:797(ones)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.010    0.010 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        4    0.000    0.000    0.000    0.000 {len}
+        9    0.000    0.000    0.000    0.000 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        1    0.000    0.000    0.000    0.000 {method 'fill' of 'numpy.ndarray' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        3    0.001    0.000    0.001    0.000 {method 'read' of 'bz2.BZ2File' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.empty}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        1    0.005    0.005    0.005    0.005 {numpy.core.multiarray.where}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.zeros}
+        1    0.000    0.000    0.000    0.000 {range}
+
+
+0.0000 0.0000 0.0100 0.0317 0.0000     0.008 testimages/face.msk.gz
+Thu Oct 30 12:14:36 2008    stats
+
+         171 function calls in 0.010 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.010    0.010 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fit2dmaskimage.py:19(_readheader)
+        1    0.002    0.002    0.008    0.008 fit2dmaskimage.py:36(read)
+        2    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        3    0.000    0.000    0.001    0.000 gzip.py:208(read)
+        3    0.000    0.000    0.001    0.000 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+        3    0.000    0.000    0.000    0.000 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.000    0.000 gzip.py:60(__init__)
+        1    0.000    0.000    0.000    0.000 numeric.py:797(ones)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.010    0.010 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        3    0.000    0.000    0.000    0.000 {built-in method decompress}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+       11    0.000    0.000    0.000    0.000 {len}
+        9    0.000    0.000    0.000    0.000 {method 'astype' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        1    0.000    0.000    0.000    0.000 {method 'fill' of 'numpy.ndarray' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       31    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        6    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        3    0.000    0.000    0.000    0.000 {min}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.empty}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        1    0.005    0.005    0.005    0.005 {numpy.core.multiarray.where}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.zeros}
+        2    0.000    0.000    0.000    0.000 {open}
+        4    0.000    0.000    0.000    0.000 {ord}
+        1    0.000    0.000    0.000    0.000 {range}
+        5    0.000    0.000    0.000    0.000 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0100 0.0000 0.0100                   4.001 testimages/fit2d_click.edf
+Thu Oct 30 12:14:40 2008    stats
+
+         119 function calls in 0.013 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.013    0.013 <string>:1(<module>)
+        2    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:1321(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 __init__.py:959(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.000    0.000    0.000    0.000 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.012    0.012 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.013    0.013 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        9    0.000    0.000    0.000    0.000 {len}
+        7    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       12    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+        4    0.008    0.002    0.008    0.002 {method 'read' of 'file' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.004    0.004    0.004    0.004 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+
+
+0.0000 0.0000 0.0200 0.0646 0.0200     4.001 testimages/fit2d_click.edf.bz2
+Thu Oct 30 12:14:40 2008    stats
+
+         119 function calls in 0.027 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.027    0.027 <string>:1(<module>)
+        2    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:1321(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 __init__.py:959(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.000    0.000    0.001    0.001 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.025    0.025 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.001    0.000    0.001    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.027    0.027 openimage.py:67(openimage)
+        1    0.000    0.000    0.002    0.002 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        9    0.000    0.000    0.000    0.000 {len}
+        7    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       12    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+        4    0.022    0.005    0.022    0.005 {method 'read' of 'bz2.BZ2File' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.004    0.004    0.004    0.004 {numpy.core.multiarray.fromstring}
+
+
+0.0000 0.0000 0.0500 0.0864 0.0300     4.001 testimages/fit2d_click.edf.gz
+Thu Oct 30 12:14:40 2008    stats
+
+         242 function calls in 0.053 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.053    0.053 <string>:1(<module>)
+        2    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:1321(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 __init__.py:959(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.000    0.000    0.007    0.007 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.046    0.046 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        4    0.004    0.001    0.047    0.012 gzip.py:208(read)
+        6    0.000    0.000    0.043    0.007 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+        5    0.014    0.003    0.022    0.004 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.053    0.053 openimage.py:67(openimage)
+        1    0.000    0.000    0.007    0.007 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        2    0.000    0.000    0.000    0.000 {apply}
+        5    0.021    0.004    0.021    0.004 {built-in method decompress}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+       20    0.000    0.000    0.000    0.000 {len}
+        7    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       12    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+       47    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        7    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        5    0.000    0.000    0.000    0.000 {min}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.004    0.004    0.004    0.004 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+        4    0.000    0.000    0.000    0.000 {ord}
+        7    0.008    0.001    0.008    0.001 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0000 0.0000 0.1400                   0.126 testimages/fit2d_click.msk
+Thu Oct 30 12:14:41 2008    stats
+
+         82 function calls in 0.125 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.125    0.125 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fit2dmaskimage.py:19(_readheader)
+        1    0.013    0.013    0.125    0.125 fit2dmaskimage.py:36(read)
+        2    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 numeric.py:797(ones)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.125    0.125 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        4    0.000    0.000    0.000    0.000 {len}
+        9    0.014    0.002    0.014    0.002 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        1    0.000    0.000    0.000    0.000 {method 'fill' of 'numpy.ndarray' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        3    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.empty}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        1    0.097    0.097    0.097    0.097 {numpy.core.multiarray.where}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.zeros}
+        2    0.001    0.000    0.001    0.000 {open}
+        1    0.000    0.000    0.000    0.000 {range}
+
+
+0.0000 0.0000 0.1300 0.0389 0.0000     0.126 testimages/fit2d_click.msk.bz2
+Thu Oct 30 12:14:41 2008    stats
+
+         82 function calls in 0.135 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.135    0.135 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fit2dmaskimage.py:19(_readheader)
+        1    0.012    0.012    0.134    0.134 fit2dmaskimage.py:36(read)
+        2    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 numeric.py:797(ones)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.135    0.135 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        4    0.000    0.000    0.000    0.000 {len}
+        9    0.014    0.002    0.014    0.002 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        1    0.000    0.000    0.000    0.000 {method 'fill' of 'numpy.ndarray' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        3    0.001    0.000    0.001    0.000 {method 'read' of 'bz2.BZ2File' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.empty}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        1    0.106    0.106    0.106    0.106 {numpy.core.multiarray.where}
+        1    0.001    0.001    0.001    0.001 {numpy.core.multiarray.zeros}
+        1    0.000    0.000    0.000    0.000 {range}
+
+
+0.0000 0.0000 0.1200 0.0346 0.0000     0.126 testimages/fit2d_click.msk.gz
+Thu Oct 30 12:14:41 2008    stats
+
+         193 function calls in 0.134 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.134    0.134 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.001    0.001 fit2dmaskimage.py:19(_readheader)
+        1    0.012    0.012    0.132    0.132 fit2dmaskimage.py:36(read)
+        2    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        6    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        3    0.000    0.000    0.002    0.001 gzip.py:208(read)
+        2    0.000    0.000    0.002    0.001 gzip.py:245(_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+        2    0.000    0.000    0.000    0.000 gzip.py:295(_add_read_data)
+        2    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        4    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.000    0.000 gzip.py:60(__init__)
+        1    0.000    0.000    0.000    0.000 numeric.py:797(ones)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.134    0.134 openimage.py:67(openimage)
+        1    0.000    0.000    0.002    0.002 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        4    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        2    0.001    0.001    0.001    0.001 {built-in method decompress}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+       10    0.000    0.000    0.000    0.000 {len}
+        9    0.013    0.001    0.013    0.001 {method 'astype' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        1    0.000    0.000    0.000    0.000 {method 'fill' of 'numpy.ndarray' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       46    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        8    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        4    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        2    0.000    0.000    0.000    0.000 {min}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.empty}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        1    0.104    0.104    0.104    0.104 {numpy.core.multiarray.where}
+        1    0.001    0.001    0.001    0.001 {numpy.core.multiarray.zeros}
+        2    0.000    0.000    0.000    0.000 {open}
+        4    0.000    0.000    0.000    0.000 {ord}
+        1    0.000    0.000    0.000    0.000 {range}
+        4    0.000    0.000    0.000    0.000 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0800 0.0700 0.1600                  36.001 testimages/mb_LP_1_001.edf
+Thu Oct 30 12:14:42 2008    stats
+
+         119 function calls in 0.164 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.006    0.006    0.164    0.164 <string>:1(<module>)
+        2    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:1321(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 __init__.py:959(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.000    0.000    0.000    0.000 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.151    0.151 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.006    0.006    0.158    0.158 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        9    0.000    0.000    0.000    0.000 {len}
+        7    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       12    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+        4    0.072    0.018    0.072    0.018 {method 'read' of 'file' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.079    0.079    0.079    0.079 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+
+
+0.0400 0.0400 0.1600                  18.000 testimages/mb_LP_1_001.img
+Thu Oct 30 12:14:42 2008    stats
+
+         183 function calls in 0.158 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.003    0.003    0.158    0.158 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.004    0.004    0.152    0.152 adscimage.py:25(read)
+        1    0.000    0.000    0.023    0.023 adscimage.py:71(_readheader)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.002    0.002    0.155    0.155 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 {apply}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+       22    0.000    0.000    0.000    0.000 {len}
+       17    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.058    0.058    0.058    0.058 {method 'byteswap' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        4    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    0.034    0.017    0.034    0.017 {method 'read' of 'file' objects}
+       19    0.022    0.001    0.022    0.001 {method 'readline' of 'file' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+       17    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+       51    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+        1    0.034    0.034    0.034    0.034 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+
+
+0.0100 0.0100 3.0700 2.2536 2.1600    18.000 testimages/mb_LP_1_001.img.bz2
+Thu Oct 30 12:14:53 2008    stats
+
+         183 function calls in 3.079 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.003    0.003    3.079    3.079 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.003    0.003    3.033    3.033 adscimage.py:25(read)
+        1    0.000    0.000    0.782    0.782 adscimage.py:71(_readheader)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.001    0.000    0.001    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.004    0.004    3.076    3.076 openimage.py:67(openimage)
+        1    0.000    0.000    0.039    0.039 openimage.py:81(_openimage)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 {apply}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+       22    0.000    0.000    0.000    0.000 {len}
+       17    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.062    0.062    0.062    0.062 {method 'byteswap' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        4    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    2.149    1.075    2.149    1.075 {method 'read' of 'bz2.BZ2File' objects}
+       19    0.782    0.041    0.782    0.041 {method 'readline' of 'bz2.BZ2File' objects}
+        8    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.039    0.039    0.039    0.039 {method 'seek' of 'bz2.BZ2File' objects}
+       17    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+       51    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+        1    0.036    0.036    0.036    0.036 {numpy.core.multiarray.fromstring}
+
+
+0.0100 0.0100 0.5100 0.4089 0.2700    18.000 testimages/mb_LP_1_001.img.gz
+Thu Oct 30 12:14:55 2008    stats
+
+         1123 function calls in 0.519 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.003    0.003    0.519    0.519 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:62(getnum)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.003    0.003    0.512    0.512 adscimage.py:25(read)
+        1    0.000    0.000    0.129    0.129 adscimage.py:71(_readheader)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        3    0.000    0.000    0.002    0.001 fabioimage.py:259(_open)
+        3    0.000    0.000    0.001    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        3    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        3    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+       37    0.009    0.000    0.392    0.011 gzip.py:208(read)
+       19    0.004    0.000    0.004    0.000 gzip.py:240(_unread)
+       75    0.001    0.000    0.383    0.005 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       74    0.087    0.001    0.126    0.002 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        3    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        3    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+       19    0.003    0.000    0.129    0.007 gzip.py:391(readline)
+        3    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.003    0.003    0.516    0.516 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        3    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.000    0.000 {apply}
+       74    0.243    0.003    0.243    0.003 {built-in method decompress}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+      239    0.000    0.000    0.000    0.000 {len}
+       51    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.062    0.062    0.062    0.062 {method 'byteswap' of 'numpy.ndarray' objects}
+        3    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       38    0.005    0.000    0.005    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+       20    0.005    0.000    0.005    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      136    0.012    0.000    0.012    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        9    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+       17    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+       51    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+        8    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       90    0.000    0.000    0.000    0.000 {min}
+        1    0.036    0.036    0.036    0.036 {numpy.core.multiarray.fromstring}
+        3    0.001    0.000    0.001    0.000 {open}
+        6    0.000    0.000    0.000    0.000 {ord}
+       77    0.039    0.001    0.039    0.001 {zlib.crc32}
+        3    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0200 0.0000 0.2000                   8.067 testimages/oPPA_5grains_0001.tif
+Thu Oct 30 12:14:56 2008    stats
+
+         11340 function calls in 0.234 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.005    0.005    0.236    0.236 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.008    0.008 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+      512    0.002    0.000    0.006    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.001    0.001    0.062    0.062 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.121    0.121 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+      513    0.001    0.000    0.001    0.000 Image.py:91(isTupleType)
+        1    0.005    0.005    0.098    0.098 ImageFile.py:115(load)
+        1    0.000    0.000    0.001    0.001 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+      511    0.001    0.000    0.001    0.000 ImageFile.py:49(_tilesort)
+        4    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.008    0.002 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.004    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        8    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        1    0.001    0.001    0.004    0.004 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.008    0.008 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.008    0.008 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.002    0.002    0.007    0.007 TiffImagePlugin.py:521(_setup)
+       37    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+      536    0.002    0.000    0.003    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:139(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:77(__init__)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.231    0.231 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:74(split)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.030    0.030 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(_readheader)
+        1    0.007    0.007    0.230    0.230 tifimage.py:53(read)
+        1    0.001    0.001    0.001    0.001 {PIL._imaging.new}
+      513    0.001    0.000    0.001    0.000 {apply}
+        1    0.022    0.022    0.022    0.022 {built-in method convert}
+      512    0.054    0.000    0.054    0.000 {built-in method decode}
+      256    0.030    0.000    0.030    0.000 {built-in method encode}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        3    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        3    0.000    0.000    0.000    0.000 {chr}
+      511    0.000    0.000    0.000    0.000 {cmp}
+      515    0.001    0.000    0.001    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+      523    0.001    0.000    0.001    0.000 {isinstance}
+      557    0.000    0.000    0.000    0.000 {len}
+        1    0.000    0.000    0.000    0.000 {max}
+     1290    0.001    0.000    0.001    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        3    0.030    0.010    0.030    0.010 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      541    0.023    0.000    0.023    0.000 {method 'read' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'readline' of 'file' objects}
+       10    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+      528    0.007    0.000    0.007    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.002    0.002 {method 'sort' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+     1024    0.001    0.000    0.001    0.000 {min}
+        2    0.032    0.016    0.032    0.016 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+     2244    0.001    0.000    0.001    0.000 {ord}
+       12    0.000    0.000    0.000    0.000 {range}
+
+
+0.0000 0.0000 0.7100 0.4409 0.4700     8.067 testimages/oPPA_5grains_0001.tif.bz2
+Thu Oct 30 12:14:58 2008    stats
+
+         11342 function calls in 0.722 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.005    0.005    0.723    0.723 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.009    0.009 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+      512    0.002    0.000    0.005    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.001    0.001    0.063    0.063 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.104    0.104 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+      513    0.001    0.000    0.001    0.000 Image.py:91(isTupleType)
+        1    0.005    0.005    0.080    0.080 ImageFile.py:115(load)
+        1    0.000    0.000    0.001    0.001 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+      511    0.001    0.000    0.001    0.000 ImageFile.py:49(_tilesort)
+        4    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.008    0.002 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.004    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        8    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        1    0.001    0.001    0.004    0.004 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.008    0.008 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.008    0.008 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.002    0.002    0.008    0.008 TiffImagePlugin.py:521(_setup)
+       37    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+      536    0.002    0.000    0.003    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:139(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:77(__init__)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.487    0.244 fabioimage.py:259(_open)
+        2    0.001    0.000    0.487    0.243 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.718    0.718 openimage.py:67(openimage)
+        1    0.000    0.000    0.013    0.013 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:74(split)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.030    0.030 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(_readheader)
+        1    0.007    0.007    0.703    0.703 tifimage.py:53(read)
+        1    0.001    0.001    0.001    0.001 {PIL._imaging.new}
+      513    0.001    0.000    0.001    0.000 {apply}
+        1    0.024    0.024    0.024    0.024 {built-in method convert}
+      512    0.054    0.000    0.054    0.000 {built-in method decode}
+      256    0.033    0.000    0.033    0.000 {built-in method encode}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        3    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        3    0.000    0.000    0.000    0.000 {chr}
+      511    0.000    0.000    0.000    0.000 {cmp}
+      515    0.001    0.000    0.001    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+      523    0.001    0.000    0.001    0.000 {isinstance}
+      557    0.000    0.000    0.000    0.000 {len}
+        1    0.000    0.000    0.000    0.000 {max}
+     1290    0.001    0.000    0.001    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        3    0.030    0.010    0.030    0.010 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    0.499    0.249    0.499    0.249 {method 'read' of 'bz2.BZ2File' objects}
+      540    0.012    0.000    0.012    0.000 {method 'read' of 'cStringIO.StringI' objects}
+        2    0.000    0.000    0.000    0.000 {method 'readline' of 'cStringIO.StringI' objects}
+       10    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+      528    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        1    0.000    0.000    0.002    0.002 {method 'sort' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+     1024    0.001    0.000    0.001    0.000 {min}
+        2    0.033    0.017    0.033    0.017 {numpy.core.multiarray.fromstring}
+     2244    0.001    0.000    0.001    0.000 {ord}
+       12    0.000    0.000    0.000    0.000 {range}
+
+
+0.0000 0.0000 0.2700 0.1194 0.0500     8.067 testimages/oPPA_5grains_0001.tif.gz
+Thu Oct 30 12:14:59 2008    stats
+
+         11494 function calls in 0.276 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.004    0.004    0.277    0.277 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.009    0.009 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+      512    0.002    0.000    0.005    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.001    0.001    0.066    0.066 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.100    0.100 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+      513    0.001    0.000    0.001    0.000 Image.py:91(isTupleType)
+        1    0.005    0.005    0.079    0.079 ImageFile.py:115(load)
+        1    0.000    0.000    0.001    0.001 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+      511    0.001    0.000    0.001    0.000 ImageFile.py:49(_tilesort)
+        4    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.008    0.002 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.004    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        8    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        1    0.001    0.001    0.004    0.004 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.008    0.008 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.008    0.008 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.002    0.002    0.007    0.007 TiffImagePlugin.py:521(_setup)
+       37    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+      536    0.002    0.000    0.003    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:139(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:77(__init__)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.055    0.027 fabioimage.py:259(_open)
+        2    0.000    0.000    0.055    0.027 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        2    0.000    0.000    0.055    0.028 gzip.py:208(read)
+        8    0.000    0.000    0.055    0.007 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+        7    0.026    0.004    0.040    0.006 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.273    0.273 openimage.py:67(openimage)
+        1    0.000    0.000    0.002    0.002 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:74(split)
+        2    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.032    0.032 string.py:306(join)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(_readheader)
+        1    0.007    0.007    0.270    0.270 tifimage.py:53(read)
+        1    0.001    0.001    0.001    0.001 {PIL._imaging.new}
+      513    0.001    0.000    0.001    0.000 {apply}
+        1    0.021    0.021    0.021    0.021 {built-in method convert}
+      512    0.052    0.000    0.052    0.000 {built-in method decode}
+        7    0.014    0.002    0.014    0.002 {built-in method decompress}
+      256    0.033    0.000    0.033    0.000 {built-in method encode}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        3    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        3    0.000    0.000    0.000    0.000 {chr}
+      511    0.000    0.000    0.000    0.000 {cmp}
+      515    0.001    0.000    0.001    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+      523    0.001    0.000    0.001    0.000 {isinstance}
+      572    0.000    0.000    0.000    0.000 {len}
+        1    0.000    0.000    0.000    0.000 {max}
+     1290    0.001    0.000    0.001    0.000 {method 'append' of 'list' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        3    0.032    0.011    0.032    0.011 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      540    0.012    0.000    0.012    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       61    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'readline' of 'cStringIO.StringI' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+      528    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        7    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.002    0.002 {method 'sort' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+     1031    0.001    0.000    0.001    0.000 {min}
+        2    0.033    0.017    0.033    0.017 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+     2248    0.001    0.000    0.001    0.000 {ord}
+       12    0.000    0.000    0.000    0.000 {range}
+        9    0.013    0.001    0.013    0.001 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0100 0.0000 0.0400                   2.004 testimages/somedata_0001.mccd
+Thu Oct 30 12:15:00 2008    stats
+
+         3424 function calls in 0.032 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.032    0.032 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.001    0.001 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        1    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.000    0.000    0.010    0.010 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.008    0.008 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        2    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.000    0.000    0.004    0.004 ImageFile.py:115(load)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        2    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.001    0.000 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.000    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:521(_setup)
+       31    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       25    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:139(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:77(__init__)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.006    0.006    0.007    0.007 marccdimage.py:264(interpret_header)
+        1    0.000    0.000    0.007    0.007 marccdimage.py:292(_readheader)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.032    0.032 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:74(split)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.006    0.006 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.032    0.032 tifimage.py:53(read)
+        1    0.000    0.000    0.000    0.000 {PIL._imaging.new}
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.004    0.004    0.004    0.004 {built-in method convert}
+       32    0.001    0.000    0.001    0.000 {built-in method decode}
+       64    0.004    0.000    0.004    0.000 {built-in method encode}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        4    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       12    0.000    0.000    0.000    0.000 {isinstance}
+       40    0.000    0.000    0.000    0.000 {len}
+        1    0.000    0.000    0.000    0.000 {max}
+      229    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+     2523    0.001    0.000    0.001    0.000 {method 'has_key' of 'dict' objects}
+        3    0.006    0.002    0.006    0.002 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       56    0.002    0.000    0.002    0.000 {method 'read' of 'file' objects}
+       10    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        2    0.000    0.000    0.000    0.000 {min}
+        1    0.005    0.005    0.005    0.005 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+      188    0.000    0.000    0.000    0.000 {ord}
+       11    0.000    0.000    0.000    0.000 {range}
+
+
+0.0000 0.0000 0.2900 0.2321 0.2200     2.004 testimages/somedata_0001.mccd.bz2
+Thu Oct 30 12:15:01 2008    stats
+
+         3426 function calls in 0.300 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.300    0.300 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.002    0.002 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        1    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.000    0.000    0.013    0.013 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.007    0.007 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        2    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.000    0.000    0.003    0.003 ImageFile.py:115(load)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        2    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.001    0.000 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.000    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:521(_setup)
+       31    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       25    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:139(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:77(__init__)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.214    0.107 fabioimage.py:259(_open)
+        2    0.001    0.000    0.213    0.107 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.006    0.006    0.007    0.007 marccdimage.py:264(interpret_header)
+        1    0.000    0.000    0.007    0.007 marccdimage.py:292(_readheader)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.300    0.300 openimage.py:67(openimage)
+        1    0.000    0.000    0.050    0.050 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:74(split)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.007    0.007 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.250    0.250 tifimage.py:53(read)
+        1    0.000    0.000    0.000    0.000 {PIL._imaging.new}
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.004    0.004    0.004    0.004 {built-in method convert}
+       32    0.001    0.000    0.001    0.000 {built-in method decode}
+       64    0.005    0.000    0.005    0.000 {built-in method encode}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        4    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       12    0.000    0.000    0.000    0.000 {isinstance}
+       40    0.000    0.000    0.000    0.000 {len}
+        1    0.000    0.000    0.000    0.000 {max}
+      229    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+     2523    0.001    0.000    0.001    0.000 {method 'has_key' of 'dict' objects}
+        3    0.007    0.002    0.007    0.002 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    0.261    0.131    0.261    0.131 {method 'read' of 'bz2.BZ2File' objects}
+       55    0.001    0.000    0.001    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       10    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+        1    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        2    0.000    0.000    0.000    0.000 {min}
+        1    0.007    0.007    0.007    0.007 {numpy.core.multiarray.fromstring}
+      188    0.000    0.000    0.000    0.000 {ord}
+       11    0.000    0.000    0.000    0.000 {range}
+
+
+0.0000 0.0000 0.0600 0.0715 0.0300     2.004 testimages/somedata_0001.mccd.gz
+Thu Oct 30 12:15:01 2008    stats
+
+         3604 function calls in 0.073 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.073    0.073 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.002    0.002 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        1    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.000    0.000    0.013    0.013 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.012    0.012 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        2    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.000    0.000    0.005    0.005 ImageFile.py:115(load)
+        1    0.000    0.000    0.001    0.001 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        2    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.001    0.000 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.000    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:521(_setup)
+       31    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       25    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:139(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:77(__init__)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.032    0.016 fabioimage.py:259(_open)
+        2    0.000    0.000    0.032    0.016 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        2    0.000    0.000    0.032    0.016 gzip.py:208(read)
+       12    0.000    0.000    0.031    0.003 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       11    0.007    0.001    0.010    0.001 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        1    0.006    0.006    0.007    0.007 marccdimage.py:264(interpret_header)
+        1    0.000    0.000    0.007    0.007 marccdimage.py:292(_readheader)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.073    0.073 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:74(split)
+        2    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.006    0.006 string.py:306(join)
+        3    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.072    0.072 tifimage.py:53(read)
+        1    0.001    0.001    0.001    0.001 {PIL._imaging.new}
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.007    0.007    0.007    0.007 {built-in method convert}
+       32    0.002    0.000    0.002    0.000 {built-in method decode}
+       11    0.019    0.002    0.019    0.002 {built-in method decompress}
+       64    0.006    0.000    0.006    0.000 {built-in method encode}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        4    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       12    0.000    0.000    0.000    0.000 {isinstance}
+       63    0.000    0.000    0.000    0.000 {len}
+        1    0.000    0.000    0.000    0.000 {max}
+      229    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+     2523    0.001    0.000    0.001    0.000 {method 'has_key' of 'dict' objects}
+        3    0.006    0.002    0.006    0.002 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       55    0.002    0.000    0.002    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       59    0.001    0.000    0.001    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        7    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        3    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       13    0.000    0.000    0.000    0.000 {min}
+        1    0.006    0.006    0.006    0.006 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+      192    0.000    0.000    0.000    0.000 {ord}
+       11    0.000    0.000    0.000    0.000 {range}
+       13    0.003    0.000    0.003    0.000 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0000 0.0000 0.0000                   0.023 testimages/testmap1_0002.tif
+Thu Oct 30 12:15:01 2008    stats
+
+         616 function calls in 0.003 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.003    0.003 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.001    0.001 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        2    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.000    0.000    0.000    0.000 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.000    0.000 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        3    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:115(load)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:49(_tilesort)
+        4    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.001    0.000 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.000    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        8    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:521(_setup)
+       37    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       26    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:139(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:77(__init__)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:259(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.003    0.003 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:74(split)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(_readheader)
+        1    0.000    0.000    0.002    0.002 tifimage.py:53(read)
+        1    0.000    0.000    0.000    0.000 {PIL._imaging.new}
+        3    0.000    0.000    0.000    0.000 {apply}
+        1    0.000    0.000    0.000    0.000 {built-in method convert}
+        2    0.000    0.000    0.000    0.000 {built-in method decode}
+        1    0.000    0.000    0.000    0.000 {built-in method encode}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cmp}
+        5    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       13    0.000    0.000    0.000    0.000 {isinstance}
+       44    0.000    0.000    0.000    0.000 {len}
+        1    0.000    0.000    0.000    0.000 {max}
+       15    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        3    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       29    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+       10    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+       16    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {min}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+      204    0.000    0.000    0.000    0.000 {ord}
+       12    0.000    0.000    0.000    0.000 {range}
+
+
+0.0000 0.0000 0.0000 0.0360 0.0000     0.023 testimages/testmap1_0002.tif.bz2
+Thu Oct 30 12:15:01 2008    stats
+
+         618 function calls in 0.004 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.004    0.004 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.002    0.002 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        2    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.000    0.000    0.000    0.000 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.000    0.000 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        3    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:115(load)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:49(_tilesort)
+        4    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.001    0.000 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.000    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        8    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:521(_setup)
+       37    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       26    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:139(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:77(__init__)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.001    0.001 fabioimage.py:259(_open)
+        2    0.001    0.000    0.001    0.000 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.004    0.004 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:74(split)
+        4    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(_readheader)
+        1    0.000    0.000    0.003    0.003 tifimage.py:53(read)
+        1    0.000    0.000    0.000    0.000 {PIL._imaging.new}
+        3    0.000    0.000    0.000    0.000 {apply}
+        1    0.000    0.000    0.000    0.000 {built-in method convert}
+        2    0.000    0.000    0.000    0.000 {built-in method decode}
+        1    0.000    0.000    0.000    0.000 {built-in method encode}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        1    0.000    0.000    0.000    0.000 {cmp}
+        5    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       13    0.000    0.000    0.000    0.000 {isinstance}
+       44    0.000    0.000    0.000    0.000 {len}
+        1    0.000    0.000    0.000    0.000 {max}
+       15    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        3    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'read' of 'bz2.BZ2File' objects}
+       28    0.000    0.000    0.000    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       10    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+       16    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+        4    0.000    0.000    0.000    0.000 {min}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+      204    0.000    0.000    0.000    0.000 {ord}
+       12    0.000    0.000    0.000    0.000 {range}
+
+
+0.0000 0.0000 0.0000 0.0343 0.0000     0.023 testimages/testmap1_0002.tif.gz
+Thu Oct 30 12:15:02 2008    stats
+
+         738 function calls in 0.005 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.005    0.005 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.002    0.002 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        2    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.000    0.000    0.000    0.000 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.000    0.000 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        3    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:115(load)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:49(_tilesort)
+        4    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.001    0.000 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.000    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        8    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:521(_setup)
+       37    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       26    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:139(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:77(__init__)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:187(resetvals)
+        2    0.000    0.000    0.002    0.001 fabioimage.py:259(_open)
+        2    0.000    0.000    0.002    0.001 fabioimage.py:288(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:83(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        6    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        2    0.000    0.000    0.001    0.000 gzip.py:208(read)
+        3    0.000    0.000    0.001    0.000 gzip.py:245(_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+        2    0.000    0.000    0.000    0.000 gzip.py:295(_add_read_data)
+        2    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        4    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.001    0.001 gzip.py:60(__init__)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.005    0.005 openimage.py:67(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:81(_openimage)
+        2    0.000    0.000    0.000    0.000 posixpath.py:74(split)
+        2    0.000    0.000    0.000    0.000 posixpath.py:89(splitext)
+        1    0.000    0.000    0.000    0.000 re.py:178(compile)
+        1    0.000    0.000    0.000    0.000 re.py:219(_compile)
+        1    0.000    0.000    0.000    0.000 string.py:306(join)
+        4    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(_readheader)
+        1    0.000    0.000    0.004    0.004 tifimage.py:53(read)
+        1    0.000    0.000    0.000    0.000 {PIL._imaging.new}
+        3    0.000    0.000    0.000    0.000 {apply}
+        1    0.000    0.000    0.000    0.000 {built-in method convert}
+        2    0.000    0.000    0.000    0.000 {built-in method decode}
+        2    0.000    0.000    0.000    0.000 {built-in method decompress}
+        1    0.000    0.000    0.000    0.000 {built-in method encode}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        1    0.000    0.000    0.000    0.000 {cmp}
+        5    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       13    0.000    0.000    0.000    0.000 {isinstance}
+       50    0.000    0.000    0.000    0.000 {len}
+        1    0.000    0.000    0.000    0.000 {max}
+       15    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        3    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       28    0.000    0.000    0.000    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       50    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+       16    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        9    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        6    0.000    0.000    0.000    0.000 {min}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        2    0.001    0.001    0.001    0.001 {open}
+      208    0.000    0.000    0.000    0.000 {ord}
+       12    0.000    0.000    0.000    0.000 {range}
+        4    0.000    0.000    0.000    0.000 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
diff --git a/test/get_test_images.sh b/test/get_test_images.sh
new file mode 100644
index 0000000..aa9c120
--- /dev/null
+++ b/test/get_test_images.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+
+#
+#wget "http://teamsites.risoe.dk/totalcryst/File exchange/fabio_testimages.zip"
+# --http-user=username
+# --http-password=password
+
+
+wget http://downloads.sourceforge.net/fable/fabio_testimages.zip
+
+cd testimages
+
+unzip ../fabio_testimages.zip
+
+for name in $(ls *.bz2 ) ; do
+    bunzip2 -k $name
+    sleep 1
+    gzip ${name%.bz2}
+    sleep 1
+    bunzip2 -k $name
+done
+
+fit2d_12_081_i686_linux2.4.20 -nogr <<EOF
+3072
+3072
+NO
+INPUT
+ADSC
+mb_LP_1_001.img
+OUTPUT
+"KLORA" 
+mb_LP_1_001.edf
+QUIT
+YES
+EOF
diff --git a/test/lapwright_benchheaders b/test/lapwright_benchheaders
new file mode 100644
index 0000000..6e13ad3
--- /dev/null
+++ b/test/lapwright_benchheaders
@@ -0,0 +1,47 @@
+  0.000583 testimages/Cr8F8140k103.0026
+  0.051907 testimages/Cr8F8140k103.0026.bz2
+  0.000820 testimages/Cr8F8140k103.0026.gz
+  0.000396 testimages/F2K_Seb_Lyso0675.edf
+  0.100052 testimages/F2K_Seb_Lyso0675.edf.bz2
+  0.000672 testimages/F2K_Seb_Lyso0675.edf.gz
+  0.000184 testimages/GE_aSI_detector_image_1529
+  0.071242 testimages/GE_aSI_detector_image_1529.bz2
+  0.000594 testimages/GE_aSI_detector_image_1529.gz
+  0.000318 testimages/b191_1_9_1.img
+  0.073274 testimages/b191_1_9_1.img.bz2
+  0.000767 testimages/b191_1_9_1.img.gz
+  0.000301 testimages/b191_1_9_1_uncompressed.img
+  0.088887 testimages/b191_1_9_1_uncompressed.img.bz2
+  0.000809 testimages/b191_1_9_1_uncompressed.img.gz
+  0.003353 testimages/corkcont2_H_0089.mccd
+  0.081050 testimages/corkcont2_H_0089.mccd.bz2
+  0.003884 testimages/corkcont2_H_0089.mccd.gz
+  0.000363 testimages/example.mar2300
+  0.193586 testimages/example.mar2300.bz2
+  0.000607 testimages/example.mar2300.gz
+  0.000173 testimages/face.edf
+  0.001616 testimages/face.edf.bz2
+  0.001207 testimages/face.edf.gz
+  0.000128 testimages/face.msk
+  0.000726 testimages/face.msk.bz2
+  0.000348 testimages/face.msk.gz
+  0.000167 testimages/fit2d_click.edf
+  0.002242 testimages/fit2d_click.edf.bz2
+  0.009748 testimages/fit2d_click.edf.gz
+  0.000131 testimages/fit2d_click.msk
+  0.000441 testimages/fit2d_click.msk.bz2
+  0.001680 testimages/fit2d_click.msk.gz
+  0.000174 testimages/mb_LP_1_001.edf
+  0.013777 testimages/mb_LP_1_001.img
+  0.666265 testimages/mb_LP_1_001.img.bz2
+  0.147505 testimages/mb_LP_1_001.img.gz
+  0.000139 testimages/oPPA_5grains_0001.tif
+  0.011123 testimages/oPPA_5grains_0001.tif.bz2
+  0.001009 testimages/oPPA_5grains_0001.tif.gz
+  0.003373 testimages/somedata_0001.mccd
+  0.095547 testimages/somedata_0001.mccd.bz2
+  0.003814 testimages/somedata_0001.mccd.gz
+  0.000128 testimages/testmap1_0002.tif
+  0.000211 testimages/testmap1_0002.tif.bz2
+  0.000349 testimages/testmap1_0002.tif.gz
+  0.000383 testimages/testspr.spr.gz
diff --git a/test/lapwright_benchmark b/test/lapwright_benchmark
new file mode 100644
index 0000000..aa9b7ec
--- /dev/null
+++ b/test/lapwright_benchmark
@@ -0,0 +1,54 @@
+I/O 1  : Time to read the image
+I/O 2  : Time to read the image (repeat
+Fabio  : Time for fabio to read the image
+Shell  : Time for shell to do decompression
+Python : Time for python to do decompression
+
+I/O 1  I/O 2  Fabio  Shell  Python   Size/MB
+0.0000 0.0000 0.0000                   0.508 testimages/Cr8F8140k103.0026
+0.0000 0.0000 0.0600 0.0363 0.0300     0.508 testimages/Cr8F8140k103.0026.bz2
+0.0000 0.0000 0.0100 0.0111 0.0100     0.508 testimages/Cr8F8140k103.0026.gz
+0.0100 0.0100 0.0200                   8.003 testimages/F2K_Seb_Lyso0675.edf
+0.0100 0.0000 0.7300 0.7201 0.6900     8.003 testimages/F2K_Seb_Lyso0675.edf.bz2
+0.0100 0.0000 0.1600 0.1851 0.1500     8.003 testimages/F2K_Seb_Lyso0675.edf.gz
+0.0100 0.0100 0.0200                   8.008 testimages/GE_aSI_detector_image_1529
+0.0100 0.0000 0.6200 0.6092 0.4900     8.008 testimages/GE_aSI_detector_image_1529.bz2
+0.0000 0.0100 0.1200 0.1191 0.1200     8.008 testimages/GE_aSI_detector_image_1529.gz
+0.0100 0.0000 0.4100                   0.256 testimages/b191_1_9_1.img
+0.0000 0.0000 0.4700 0.0305 0.0300     0.256 testimages/b191_1_9_1.img.bz2
+0.0000 0.0000 0.4600 0.0071 0.0100     0.256 testimages/b191_1_9_1.img.gz
+0.0000 0.0000 0.0100                   1.005 testimages/b191_1_9_1_uncompressed.img
+0.0000 0.0000 0.1200 0.0655 0.0600     1.005 testimages/b191_1_9_1_uncompressed.img.bz2
+0.0000 0.0000 0.0400 0.0341 0.0100     1.005 testimages/b191_1_9_1_uncompressed.img.gz
+0.0200 0.0000 0.1300                   8.004 testimages/corkcont2_H_0089.mccd
+0.0000 0.0000 0.4200 0.3214 0.2900     8.004 testimages/corkcont2_H_0089.mccd.bz2
+0.0000 0.0000 0.1800 0.0977 0.0900     8.004 testimages/corkcont2_H_0089.mccd.gz
+0.0000 0.0000 0.1800                   3.471 testimages/example.mar2300
+0.0100 0.0000 0.7600 0.4990 0.5800     3.471 testimages/example.mar2300.bz2
+0.0100 0.0000 0.3000 0.0672 0.0500     3.471 testimages/example.mar2300.gz
+0.0000 0.0000 0.0000                   0.215 testimages/face.edf
+0.0000 0.0000 0.0000 0.0109 0.0000     0.215 testimages/face.edf.bz2
+0.0000 0.0000 0.0000 0.0098 0.0000     0.215 testimages/face.edf.gz
+0.0000 0.0000 0.0100                   0.008 testimages/face.msk
+0.0000 0.0000 0.0100 0.0089 0.0000     0.008 testimages/face.msk.bz2
+0.0000 0.0000 0.0100 0.0084 0.0000     0.008 testimages/face.msk.gz
+0.0000 0.0100 0.0100                   4.001 testimages/fit2d_click.edf
+0.0000 0.0000 0.0300 0.0498 0.0200     4.001 testimages/fit2d_click.edf.bz2
+0.0000 0.0000 0.0400 0.0433 0.0300     4.001 testimages/fit2d_click.edf.gz
+0.0000 0.0000 0.1100                   0.126 testimages/fit2d_click.msk
+0.0000 0.0000 0.1100 0.0184 0.0000     0.126 testimages/fit2d_click.msk.bz2
+0.0000 0.0000 0.1300 0.0117 0.0000     0.126 testimages/fit2d_click.msk.gz
+0.0400 0.0400 0.0800                  36.001 testimages/mb_LP_1_001.edf
+0.0200 0.0200 0.1100                  18.000 testimages/mb_LP_1_001.img
+0.0100 0.0000 1.9300 1.3436 1.1800    18.000 testimages/mb_LP_1_001.img.bz2
+0.0100 0.0100 0.4200 0.3263 0.2600    18.000 testimages/mb_LP_1_001.img.gz
+0.0200 0.0000 0.1400                   8.067 testimages/oPPA_5grains_0001.tif
+0.0000 0.0000 0.3800 0.2985 0.2300     8.067 testimages/oPPA_5grains_0001.tif.bz2
+0.0000 0.0000 0.1600 0.0624 0.0600     8.067 testimages/oPPA_5grains_0001.tif.gz
+0.0100 0.0000 0.0200                   2.004 testimages/somedata_0001.mccd
+0.0000 0.0000 0.1800 0.1373 0.1200     2.004 testimages/somedata_0001.mccd.bz2
+0.0000 0.0000 0.0400 0.0466 0.0300     2.004 testimages/somedata_0001.mccd.gz
+0.0000 0.0000 0.0100                   0.023 testimages/testmap1_0002.tif
+0.0000 0.0000 0.0000 0.0080 0.0000     0.023 testimages/testmap1_0002.tif.bz2
+0.0000 0.0000 0.0000 0.0078 0.0000     0.023 testimages/testmap1_0002.tif.gz
+0.0000 0.0000 1.0200 0.1523 0.1200     9.141 testimages/testspr.spr.gz
diff --git a/test/lintaillefer_benchHeaders b/test/lintaillefer_benchHeaders
new file mode 100644
index 0000000..c08838e
--- /dev/null
+++ b/test/lintaillefer_benchHeaders
@@ -0,0 +1,95 @@
+  0.000329 testimages/Cr8F8140k103.0026
+  0.037044 testimages/Cr8F8140k103.0026.bz2
+  0.000592 testimages/Cr8F8140k103.0026.gz
+  0.003818 testimages/F2K_Seb_Lyso0675.edf
+  0.557174 testimages/F2K_Seb_Lyso0675.edf.bz2
+  0.086970 testimages/F2K_Seb_Lyso0675.edf.gz
+  0.000493 testimages/F2K_Seb_Lyso0675_header_only.edf
+  0.001307 testimages/F2K_Seb_Lyso0675_header_only.edf.bz2
+  0.000816 testimages/F2K_Seb_Lyso0675_header_only.edf.gz
+  0.000236 testimages/GE_aSI_detector_image_1529
+  0.051342 testimages/GE_aSI_detector_image_1529.bz2
+  0.000785 testimages/GE_aSI_detector_image_1529.gz
+  0.001612 testimages/MultiFrame-Frame0.edf
+  0.176526 testimages/MultiFrame-Frame0.edf.bz2
+  0.021154 testimages/MultiFrame-Frame0.edf.gz
+  0.001412 testimages/MultiFrame-Frame1.edf
+  0.176522 testimages/MultiFrame-Frame1.edf.bz2
+  0.021324 testimages/MultiFrame-Frame1.edf.gz
+  0.003797 testimages/MultiFrame.edf
+  0.505238 testimages/MultiFrame.edf.bz2
+  0.086753 testimages/MultiFrame.edf.gz
+  0.000412 testimages/XSDataImage.edf
+  0.003893 testimages/XSDataImage.xml
+  0.003825 testimages/XSDataImageInv.xml
+  0.000221 testimages/b191_1_9_1.img
+  0.055115 testimages/b191_1_9_1.img.bz2
+  0.000593 testimages/b191_1_9_1.img.gz
+  0.000210 testimages/b191_1_9_1_uncompressed.img
+  0.060150 testimages/b191_1_9_1_uncompressed.img.bz2
+  0.000622 testimages/b191_1_9_1_uncompressed.img.gz
+  0.002060 testimages/corkcont2_H_0089.mccd
+  0.056873 testimages/corkcont2_H_0089.mccd.bz2
+  0.002520 testimages/corkcont2_H_0089.mccd.gz
+  0.001412 testimages/edfCompressed_U16.edf
+  0.409378 testimages/edfCompressed_U16.edf.bz2
+  0.009362 testimages/edfCompressed_U16.edf.gz
+  0.001355 testimages/edfGzip_U16.edf
+  0.409779 testimages/edfGzip_U16.edf.bz2
+  0.009243 testimages/edfGzip_U16.edf.gz
+  0.003138 testimages/edfUncompressed_U16.edf
+  0.461300 testimages/edfUncompressed_U16.edf.bz2
+  0.065004 testimages/edfUncompressed_U16.edf.gz
+  0.000304 testimages/example.mar2300
+  0.132916 testimages/example.mar2300.bz2
+  0.000491 testimages/example.mar2300.gz
+  0.000294 testimages/face.edf
+  0.002074 testimages/face.edf.bz2
+  0.001499 testimages/face.edf.gz
+  0.000097 testimages/face.msk
+  0.000470 testimages/face.msk.bz2
+  0.000302 testimages/face.msk.gz
+  0.001673 testimages/fit2d_click.edf
+  0.018431 testimages/fit2d_click.edf.bz2
+  0.020730 testimages/fit2d_click.edf.gz
+  0.000095 testimages/fit2d_click.msk
+  0.000281 testimages/fit2d_click.msk.bz2
+  0.001220 testimages/fit2d_click.msk.gz
+  0.001084 testimages/i01f0001.edf
+  0.110340 testimages/i01f0001.edf.bz2
+  0.012220 testimages/i01f0001.edf.gz
+  0.001402 testimages/i01f0001.kcd
+  0.078815 testimages/i01f0001.kcd.bz2
+  0.007362 testimages/i01f0001.kcd.gz
+  0.000401 testimages/id13_badPadding.edf
+  0.066293 testimages/id13_badPadding.edf.bz2
+  0.007500 testimages/id13_badPadding.edf.gz
+  0.000297 testimages/im0000.edf
+  0.005363 testimages/im0000.edf.bz2
+  0.001566 testimages/im0000.edf.gz
+  0.000166 testimages/image.0000
+  0.001915 testimages/image.0000.bz2
+  0.000981 testimages/image.0000.gz
+  0.021417 testimages/mb_LP_1_001.edf
+  1.442814 testimages/mb_LP_1_001.edf.bz2
+  0.267614 testimages/mb_LP_1_001.edf.gz
+  0.011164 testimages/mb_LP_1_001.img
+  0.395687 testimages/mb_LP_1_001.img.bz2
+  0.067309 testimages/mb_LP_1_001.img.gz
+  0.011211 testimages/mb_LP_1_002.img
+  0.000093 testimages/oPPA_5grains_0001.tif
+  0.011608 testimages/oPPA_5grains_0001.tif.bz2
+  0.001260 testimages/oPPA_5grains_0001.tif.gz
+  0.102151 testimages/run2_1_00148.cbf
+  0.577272 testimages/run2_1_00148.cbf.bz2
+  0.156771 testimages/run2_1_00148.cbf.gz
+  0.010526 testimages/run2_1_00148.edf
+  0.862486 testimages/run2_1_00148.edf.bz2
+  0.118586 testimages/run2_1_00148.edf.gz
+  0.002041 testimages/somedata_0001.mccd
+  0.070370 testimages/somedata_0001.mccd.bz2
+  0.002538 testimages/somedata_0001.mccd.gz
+  0.000089 testimages/testmap1_0002.tif
+  0.000198 testimages/testmap1_0002.tif.bz2
+  0.000430 testimages/testmap1_0002.tif.gz
+  0.000087 testimages/tifimagewrite_test0000.tif
diff --git a/test/profile_compressed.py b/test/profile_compressed.py
new file mode 100644
index 0000000..40dcdaa
--- /dev/null
+++ b/test/profile_compressed.py
@@ -0,0 +1,131 @@
+
+"""
+Benchmark the bz2 and gzip modules compared to their system counterparts
+"""
+
+import cProfile, os, time, random, gzip, bz2, struct, sys
+
+try: 
+    import pstats
+except:
+    print "Your package manager is probably teasing you"
+    print "try sudo apt-get install python-profiler"
+    sys.exit()
+
+
+
+print "Setting up"
+npts = int(1e6)
+data = [ random.random() for i in range(npts) ]
+sdata = struct.pack( "d"*npts, *tuple(data) )
+open("prof.dat","wb").write(sdata)
+open("prof2.dat","wb").write(" "*npts*8)
+
+os.system("gzip -c prof.dat > prof.dat.gz")
+os.system("bzip2 -c prof.dat > prof.dat.bz2")
+os.system("gzip -c prof2.dat > prof2.dat.gz")
+os.system("bzip2 -c prof2.dat > prof2.dat.bz2")
+
+print "Done setup"
+sys.stdout.flush()
+def tst(fobj, fname):
+    """test"""
+    fo = fobj(fname, "rb")
+    fo.read()
+    return
+
+
+
+print "Python gzip module"
+start = time.time()
+cProfile.run( "tst(gzip.GzipFile, 'prof.dat.gz')", "gzstats")
+p = pstats.Stats("gzstats")
+p.strip_dirs().sort_stats(-1).print_stats()
+del p
+
+
+print "Python bz2 module"
+cProfile.run( "tst(bz2.BZ2File, 'prof.dat.bz2')", "bz2stats")
+p = pstats.Stats("bz2stats")
+p.strip_dirs().sort_stats(-1).print_stats()
+del p
+
+def tstsys(cmd):
+    """ test system"""
+    fo = os.popen(cmd,"rb")
+    fo.read()
+    return
+
+print "System gzip"
+cProfile.run( "tstsys('gzip -cd prof.dat.gz')", "gzosstats")
+p = pstats.Stats("gzosstats")
+p.strip_dirs().sort_stats(-1).print_stats()
+del p
+
+print "System bz2"
+cProfile.run( "tstsys('bzip2 -cd prof.dat.bz2')", "bz2osstats")
+p = pstats.Stats("bz2osstats")
+p.strip_dirs().sort_stats(-1).print_stats()
+del p
+
+
+
+import timeit
+cl = ["ret = gzip.GzipFile(      'prof.dat.gz' ,'rb').read()",
+      "ret = os.popen(  'gzip -dc prof.dat.gz' ,'rb').read()",
+      "ret = bz2.BZ2File(        'prof.dat.bz2','rb').read()",
+      "ret = os.popen( 'bzip2 -dc prof.dat.bz2','rb').read()",
+      "ret = gzip.GzipFile(     'prof2.dat.gz' ,'rb').read()",
+      "ret = os.popen( 'gzip -dc prof2.dat.gz' ,'rb').read()",
+      "ret = bz2.BZ2File(       'prof2.dat.bz2','rb').read()",
+      "ret = os.popen('bzip2 -dc prof2.dat.bz2','rb').read()",
+    ]
+
+if sys.platform != "win32":
+    cl.append("ret = os.popen(  'gzip -dc prof.dat.gz' ,'rb',2**20).read()")
+    cl.append("ret = os.popen( 'bzip2 -dc prof.dat.bz2','rb',2**20).read()")
+    cl.append("ret = os.popen( 'gzip -dc prof2.dat.gz' ,'rb',2**20).read()")
+    cl.append("ret = os.popen(' bzip2 -dc prof2.dat.bz2','rb',2**20).read()")
+
+for s in cl:
+    t = timeit.Timer(s, setup="import os, gzip, bz2")
+    print s, ":", t.timeit(5)/5
+
+# Finally - shell version
+
+if sys.platform == 'win32':
+    start = time.time()
+    s = "gzip -cd prof.dat.gz > junk"
+    os.system(s)
+    print s, ":", time.time()-start, "seconds via shell"
+    start = time.time()
+    s  = "bzip2 -cd prof.dat.bz2 > junk"
+    os.system(s)
+    print s, ":", time.time()-start, "seconds via shell"
+    start = time.time()
+    s = "gzip -cd prof2.dat.gz > junk"
+    os.system(s)
+    print s, ":", time.time()-start, "seconds via shell"
+    start = time.time()
+    s = "bzip2 -cd prof2.dat.bz2 > junk"
+    os.system(s)
+    print s, ":", time.time()-start, "seconds via shell"
+    os.remove("junk")
+else:
+    sys.stdout.flush()
+    s = "time gzip -cd prof.dat.gz > /dev/null"
+    print "Time shell gzip:", s
+    os.system(s)
+    sys.stdout.flush()
+    s = "time bzip2 -cd prof.dat.bz2 > /dev/null"
+    print "Time shell bzip2:", s
+    os.system(s)
+    sys.stdout.flush()
+    s = "time gzip -cd prof2.dat.gz > /dev/null"
+    print "Time shell gzip:", s
+    os.system(s)
+    sys.stdout.flush()
+    s = "time bzip2 -cd prof2.dat.bz2 > /dev/null"
+    print "Time shell bzip2:", s
+    os.system(s)
+
diff --git a/test/testGEimage.py b/test/testGEimage.py
new file mode 100644
index 0000000..d5f5efd
--- /dev/null
+++ b/test/testGEimage.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+"""
+# Unit tests
+
+# builds on stuff from ImageD11.test.testpeaksearch
+"""
+
+import unittest, sys, os, logging
+logger = logging.getLogger("testfit2dmaskdfimage")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+from fabio.GEimage import GEimage
+# filename dim1 dim2 min max mean stddev
+TESTIMAGES = """GE_aSI_detector_image_1529      2048 2048 1515 16353 1833.0311 56.9124
+                GE_aSI_detector_image_1529.gz   2048 2048 1515 16353 1833.0311 56.9124
+                GE_aSI_detector_image_1529.bz2  2048 2048 1515 16353 1833.0311 56.9124"""
+
+
+class testGE(unittest.TestCase):
+
+    def setUp(self):
+        """
+        download images
+        """
+        UtilsTest.getimage("GE_aSI_detector_image_1529.bz2")
+
+
+    def test_read(self):
+        for line in TESTIMAGES.split("\n"):
+            vals = line.split()
+            name = vals[0]
+            dim1, dim2 = [int(x) for x in vals[1:3]]
+            mini, maxi, mean, stddev = [float(x) for x in vals[3:]]
+            obj = GEimage()
+            obj.read(os.path.join("testimages", name))
+
+            self.assertAlmostEqual(mini, obj.getmin(), 4, "getmin")
+            self.assertAlmostEqual(maxi, obj.getmax(), 4, "getmax")
+            self.assertAlmostEqual(mean, obj.getmean(), 4, "getmean")
+            self.assertAlmostEqual(stddev, obj.getstddev(), 4, "getstddev")
+            self.assertEqual(dim1, obj.dim1, "dim1")
+            self.assertEqual(dim2, obj.dim2, "dim2")
+
+
+def test_suite_all_GE():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(testGE("test_read"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_GE()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
diff --git a/test/testOXDimage.py b/test/testOXDimage.py
new file mode 100644
index 0000000..e18903a
--- /dev/null
+++ b/test/testOXDimage.py
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+"""
+# Unit tests
+
+# builds on stuff from ImageD11.test.testpeaksearch
+"""
+
+import unittest, sys, os, logging
+logger = logging.getLogger("testOXDimage")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+from fabio.OXDimage import OXDimage
+
+# filename dim1 dim2 min max mean stddev values are from OD Sapphire 3.0 
+TESTIMAGES = """b191_1_9_1_uncompressed.img  512 512 -500 11975 25.70 90.2526
+                b191_1_9_1_uncompressed.img  512 512 -500 11975 25.70 90.2526"""
+
+
+class testOXD(unittest.TestCase):
+    def setUp(self):
+        UtilsTest.getimage("b191_1_9_1.img.bz2")
+        UtilsTest.getimage("b191_1_9_1_uncompressed.img.bz2")
+
+    def test_read(self):
+        "Test reading of compressed OXD images"
+        for line in TESTIMAGES.split("\n"):
+            vals = line.split()
+            name = vals[0]
+            dim1, dim2 = [int(x) for x in vals[1:3]]
+            mini, maxi, mean, stddev = [float(x) for x in vals[3:]]
+            obj = OXDimage()
+            obj.read(os.path.join("testimages", name))
+
+            self.assertAlmostEqual(mini, obj.getmin(), 2, "getmin")
+            self.assertAlmostEqual(maxi, obj.getmax(), 2, "getmax")
+            self.assertAlmostEqual(mean, obj.getmean(), 2, "getmean")
+            self.assertAlmostEqual(stddev, obj.getstddev(), 2, "getstddev")
+            self.assertEqual(dim1, obj.dim1, "dim1")
+            self.assertEqual(dim2, obj.dim2, "dim2")
+
+
+
+class testOXD_same(unittest.TestCase):
+    def setUp(self):
+        self.f1 = UtilsTest.getimage("b191_1_9_1.img.bz2")[:-4]
+        self.f2 = UtilsTest.getimage("b191_1_9_1_uncompressed.img.bz2")[:-4]
+    def test_same(self):
+        """test if images are actually the same"""
+        o1 = fabio.open(self.f1)
+        o2 = fabio.open(self.f2)
+        for attr in ["getmin", "getmax", "getmean", "getstddev"]:
+            a1 = getattr(o1, attr)()
+            a2 = getattr(o2, attr)()
+            self.assertEqual(a1, a2, attr)
+
+
+def test_suite_all_OXD():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(testOXD("test_read"))
+    testSuite.addTest(testOXD_same("test_same"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_OXD()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
+
diff --git a/test/testXSDimage.py b/test/testXSDimage.py
new file mode 100755
index 0000000..91789e6
--- /dev/null
+++ b/test/testXSDimage.py
@@ -0,0 +1,96 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+"""
+# Unit tests
+
+# builds on stuff from ImageD11.test.testpeaksearch
+"""
+
+import unittest
+import os
+import logging
+import sys
+logger = logging.getLogger("testXSDimage")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+from fabio.xsdimage import xsdimage
+import numpy
+# filename dim1 dim2 min max mean stddev values are from OD Sapphire 3.0 
+TESTIMAGES = """XSDataImage.xml     512 512        86 61204     511.63    667.15
+                XSDataImageInv.xml  512 512  -0.2814 0.22705039 2.81e-08  0.010"""
+
+
+class testXSD(unittest.TestCase):
+    def setUp(self):
+        UtilsTest.getimage("XSDataImage.edf")
+        UtilsTest.getimage("XSDataImage.xml")
+        UtilsTest.getimage("XSDataImageInv.xml")
+
+    def test_read(self):
+        "Test reading of XSD images"
+        for line in TESTIMAGES.split("\n"):
+            vals = line.split()
+            name = vals[0]
+            dim1, dim2 = [int(x) for x in vals[1:3]]
+            mini, maxi, mean, stddev = [float(x) for x in vals[3:]]
+            obj = xsdimage()
+            obj.read(os.path.join("testimages", name))
+
+            self.assertAlmostEqual(mini, obj.getmin(), 2, "getmin")
+            self.assertAlmostEqual(maxi, obj.getmax(), 2, "getmax")
+            self.assertAlmostEqual(mean, obj.getmean(), 2, "getmean")
+            logger.info("%s %s %s" % (name, stddev, obj.getstddev()))
+            self.assertAlmostEqual(stddev, obj.getstddev(), 2, "getstddev")
+            self.assertEqual(dim1, obj.dim1, "dim1")
+            self.assertEqual(dim2, obj.dim2, "dim2")
+
+    def test_same(self):
+        """ test if an image is the same as the EDF equivalent"""
+        xsd = fabio.open(os.path.join("testimages", "XSDataImage.edf"))
+        edf = fabio.open(os.path.join("testimages", "XSDataImage.xml"))
+        self.assertAlmostEqual(0, abs(xsd.data - edf.data).max(), 1, "images are the same")
+
+    def test_invert(self):
+        """ Tests that 2 matrixes are invert """
+        m1 = fabio.open(os.path.join("testimages", "XSDataImage.xml"))
+        m2 = fabio.open(os.path.join("testimages", "XSDataImageInv.xml"))
+        self.assertAlmostEqual(
+        abs((numpy.matrix(m1.data) * numpy.matrix(m2.data)) - numpy.identity(m1.data.shape[0])).max(),
+        0, 3, "matrices are invert of each other")
+
+
+def test_suite_all_XSD():
+    testSuite = unittest.TestSuite()
+    if xsdimage is None:
+        logging.warning("xsdimage is None ... probably an import error related to lxml. Skipping test")
+    else:
+        testSuite.addTest(testXSD("test_read"))
+        testSuite.addTest(testXSD("test_same"))
+        testSuite.addTest(testXSD("test_invert"))
+    return testSuite
+
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_XSD()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
+
diff --git a/test/test_all.bat b/test/test_all.bat
new file mode 100644
index 0000000..aee516e
--- /dev/null
+++ b/test/test_all.bat
@@ -0,0 +1,26 @@
+cd ..
+set PYT=c:\python25\python
+%PYT% setup.py build --compiler=mingw32
+set PYTHONPATH=..\build\lib.win32-2.5
+cd test
+
+%PYT% testheadernotsingleton.py
+%PYT% testadscimage.py
+%PYT% testbrukerimage.py
+%PYT% testedfimage.py
+%PYT% testfabioimage.py
+%PYT% testfilenames.py
+%PYT% test_filename_steps.py
+%PYT% test_file_series.py
+%PYT% testfit2dmaskimage.py
+%PYT% testGEimage.py
+%PYT% testmar345image.py
+%PYT% testmccdimage.py
+%PYT% testopenheader.py
+%PYT% testopenimage.py
+%PYT% testOXDimage.py
+%PYT% testtifgz.py
+
+%PYT% test_all_images.py > win32_benchmark
+%PYT% benchheader.py > win32_benchheaders
+:END
diff --git a/test/test_all.py b/test/test_all.py
new file mode 100755
index 0000000..b48da45
--- /dev/null
+++ b/test/test_all.py
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+
+"""
+Test suite for all fabio modules.
+"""
+
+import unittest
+import os
+import logging
+import sys
+
+logger = logging.getLogger("test_all_fabio")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+    import fabio
+
+
+from testfabioimage         import test_suite_all_fabio
+from testedfimage           import test_suite_all_edf
+from testcbfimage           import test_suite_all_cbf
+from testfilenames          import test_suite_all_filenames
+from test_file_series       import test_suite_all_series
+from test_filename_steps    import test_suite_all_steps
+from test_flat_binary       import test_suite_all_flat
+from testadscimage          import test_suite_all_adsc
+from testfit2dmaskimage     import test_suite_all_fit2d
+from testGEimage            import test_suite_all_GE
+from testheadernotsingleton import test_suite_all_header
+from testmar345image        import test_suite_all_mar345
+from testbrukerimage        import test_suite_all_bruker
+from testmccdimage          import test_suite_all_mccd
+from testopenheader         import test_suite_all_openheader
+from testopenimage          import test_suite_all_openimage
+from testOXDimage           import test_suite_all_OXD
+from testkcdimage           import test_suite_all_kcd
+from testtifimage           import test_suite_all_tiffimage
+from testXSDimage           import test_suite_all_XSD
+
+def test_suite_all():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(test_suite_all_fabio())
+    testSuite.addTest(test_suite_all_filenames())
+    testSuite.addTest(test_suite_all_series())
+    testSuite.addTest(test_suite_all_steps())
+#    testSuite.addTest(test_suite_all_flat())
+    testSuite.addTest(test_suite_all_adsc())
+    testSuite.addTest(test_suite_all_edf())
+    testSuite.addTest(test_suite_all_cbf())
+    testSuite.addTest(test_suite_all_fit2d())
+    testSuite.addTest(test_suite_all_GE())
+    testSuite.addTest(test_suite_all_header())
+    testSuite.addTest(test_suite_all_mar345())
+    testSuite.addTest(test_suite_all_bruker())
+    testSuite.addTest(test_suite_all_mccd())
+    testSuite.addTest(test_suite_all_openheader())
+    testSuite.addTest(test_suite_all_openimage())
+    testSuite.addTest(test_suite_all_OXD())
+    testSuite.addTest(test_suite_all_kcd())
+    testSuite.addTest(test_suite_all_tiffimage())
+    testSuite.addTest(test_suite_all_XSD())
+    return testSuite
+
+if __name__ == '__main__':
+
+    mysuite = test_suite_all()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
+
diff --git a/test/test_all.sh b/test/test_all.sh
new file mode 100755
index 0000000..164a018
--- /dev/null
+++ b/test/test_all.sh
@@ -0,0 +1,32 @@
+
+echo "Deprecated !!!"
+exit 0
+
+cd ..
+export PYT=python
+$PYT setup.py build
+export PYTHONPATH=../build/lib.linux-x86_64-2.6
+cd test
+
+# ls *.py | awk '{print "$PYT",$1}'
+
+$PYT testheadernotsingleton.py
+$PYT testadscimage.py
+$PYT testbrukerimage.py
+$PYT testedfimage.py
+$PYT testfabioimage.py
+$PYT testfilenames.py
+$PYT test_filename_steps.py
+$PYT test_file_series.py
+$PYT testfit2dmaskimage.py
+$PYT testGEimage.py
+$PYT testmar345image.py
+$PYT testmccdimage.py
+$PYT testopenheader.py
+$PYT testopenimage.py
+$PYT testOXDimage.py
+$PYT testtifgz.py
+
+$PYT test_all_images.py > `hostname`_benchmark
+$PYT benchheader.py > `hostname`_benchheaders
+
diff --git a/test/test_all_images.py b/test/test_all_images.py
new file mode 100644
index 0000000..d0ecb8c
--- /dev/null
+++ b/test/test_all_images.py
@@ -0,0 +1,96 @@
+
+"""
+Check we can read all the test images
+"""
+
+
+import glob, os, time, fabio.openimage, gzip, bz2,  pstats, sys
+try:
+    import  cProfile
+except:
+    import  profile as cProfile 
+
+times = {}
+images = []
+
+for fname in glob.glob(os.path.join("testimages","*")):
+    if fname.find("header_only")==-1:
+        images.append(fname)
+
+images.sort()
+
+def shellbench(cmd, imname):
+    """
+    The shell appears to be lying about it's performance. It claims 
+    zero time to gunzip a file when it actually takes 200 ms. This is 
+    cheating via a cache I suspect. We shall try to avoid this problem
+    """ 
+    if sys.platform != "win32":
+        os.system("touch "+imname)
+    astart = time.time()
+    dummy_file = os.popen(cmd + " " + imname, "rb").read()
+    return time.time() - astart
+    
+
+print "I/O 1  : Time to read the image"
+print "I/O 2  : Time to read the image (repeat"
+print "Fabio  : Time for fabio to read the image"
+print "Shell  : Time for shell to do decompression"
+print "Python : Time for python to do decompression\n"
+
+print "I/O 1  I/O 2  Fabio  Shell  Python   Size/MB"
+for im in images:
+    # Network/disk io time first
+    start = time.clock()
+    the_file = open(im,"rb").read()
+    times[im] =  [ time.clock()-start ]
+    start = time.clock()
+    # Network/disk should be cached
+    the_file = open(im,"rb").read()
+    times[im].append( time.clock() - start )
+    start = time.clock()
+    try:
+        fim = fabio.openimage.openimage(im)
+    except KeyboardInterrupt:
+        raise
+    except:
+        print "Problem with", im
+        continue
+        # raise
+    times[im].append( time.clock() - start )
+    nt = 3
+    ns = 2
+    # Now check for a fabio slowdown effect    
+    if im[-3:] == '.gz':
+        times[im].append(shellbench("gzip -cd ", im))
+        nt += 1
+        ns -= 1
+        start = time.clock()
+        the_file = gzip.GzipFile(im,"rb").read()
+        times[im].append( time.clock()-start )  
+        nt += 1
+        ns -= 1
+    if im[-4:] == '.bz2':
+        times[im].append(shellbench("bzip2 -cd ", im))
+        nt += 1 
+        ns -= 1
+        start = time.clock()
+        the_file = bz2.BZ2File(im,"rb").read()
+        times[im].append( time.clock()-start )  
+        nt += 1
+        ns -= 1
+    # Speed ratings in megabytes per second (for fabio)
+    MB = len(the_file) / 1024.0 / 1024.0
+    try:
+        print ("%.4f "*nt + " "*7*ns)% tuple(times[im]), "%8.3f"%(MB), im
+    except:
+        print times[im], MB, im
+        raise
+
+    cProfile.run("fabio.openimage.openimage(im)","stats")
+    p = pstats.Stats("stats")
+    # Hack around python2.4 
+    s = sys.stdout
+    sys.stdout = open("profile.txt","a")
+    p.strip_dirs().sort_stats(-1).print_stats()
+    sys.stdout = s
diff --git a/test/test_file_series.py b/test/test_file_series.py
new file mode 100644
index 0000000..f18add6
--- /dev/null
+++ b/test/test_file_series.py
@@ -0,0 +1,127 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*- 
+
+"""
+test cases for fileseries
+
+"""
+import unittest
+import os
+import logging
+import sys
+logger = logging.getLogger("test_file_series")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+    import fabio
+
+from fabio.file_series import numbered_file_series , file_series
+
+class testrandomseries(unittest.TestCase):
+    """arbitrary series"""
+    def setUp(self):
+        """sets up"""
+        self.fso = file_series(["first", "second", "last" ])
+    def testfirst(self):
+        """check first"""
+        self.assertEqual("first", self.fso.first())
+    def testlast(self):
+        """check first"""
+        self.assertEqual("last" , self.fso.last())
+    def testjump(self):
+        """check jump"""
+        self.assertEqual("second", self.fso.jump(1))
+
+
+
+
+class testedfnumbered(unittest.TestCase):
+    """
+    Typical sequence of edf files
+    """
+    def setUp(self):
+        """ note extension has the . in it"""
+        self.fso = numbered_file_series("mydata", 0, 10005, ".edf")
+
+    def testfirst(self):
+        """ first in series"""
+        self.assertEqual(self.fso.first(), "mydata0000.edf")
+
+    def testlast(self):
+        """ last in series"""
+        self.assertEqual(self.fso.last(), "mydata10005.edf")
+
+    def testnext(self):
+        """ check all in order """
+        mylist = [ "mydata%04d.edf" % (i) for i in range(0, 10005) ]
+        i = 1
+        while i < len(mylist):
+            self.assertEqual(mylist[i], self.fso.next())
+            i += 1
+
+    def testprevious(self):
+        """ check all in order """
+        mylist = [ "mydata%04d.edf" % (i) for i in range(0, 10005) ]
+        i = 10003
+        self.fso.jump(10004)
+        while i > 0 :
+            self.assertEqual(mylist[i], self.fso.previous())
+            i -= 1
+
+
+    def testprevjump(self):
+        """check current"""
+        self.fso.jump(9999)
+        self.assertEqual("mydata9999.edf", self.fso.current())
+        self.assertEqual("mydata9998.edf", self.fso.previous())
+
+    def testnextjump(self):
+        """check current"""
+        self.fso.jump(9999)
+        self.assertEqual("mydata9999.edf", self.fso.current())
+        self.assertEqual("mydata10000.edf", self.fso.next())
+
+    def testlen(self):
+        """check len"""
+        self.assertEqual(self.fso.len() , 10006)# +1 for 0000
+
+
+def test_suite_all_series():
+    testSuite = unittest.TestSuite()
+
+    testSuite.addTest(testrandomseries("testfirst"))
+    testSuite.addTest(testrandomseries("testlast"))
+    testSuite.addTest(testrandomseries("testjump"))
+
+    testSuite.addTest(testedfnumbered("testfirst"))
+    testSuite.addTest(testedfnumbered("testprevious"))
+    testSuite.addTest(testedfnumbered("testlast"))
+    testSuite.addTest(testedfnumbered("testnext"))
+    testSuite.addTest(testedfnumbered("testprevjump"))
+    testSuite.addTest(testedfnumbered("testnextjump"))
+    testSuite.addTest(testedfnumbered("testlen"))
+
+    return testSuite
+
+if __name__ == '__main__':
+
+    mysuite = test_suite_all_series()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
diff --git a/test/test_filename_steps.py b/test/test_filename_steps.py
new file mode 100644
index 0000000..e05c0c0
--- /dev/null
+++ b/test/test_filename_steps.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*- 
+
+import unittest, sys, os, logging
+logger = logging.getLogger("test_filename_steps")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+
+class test_next(unittest.TestCase):
+    def test_next1(self):
+        for name, next in [ [ "data0001.edf", "data0002.edf" ],
+                [ "bob1.edf", "bob2.edf" ],
+                [ "1.edf", "2.edf" ],
+                [ "1.mar2300", "2.mar2300" ],
+                ]:
+            self.assertEqual(next, fabio.next_filename(name))
+
+class test_prev(unittest.TestCase):
+    def test_prev1(self):
+        for name, prev in [ [ "data0001.edf", "data0000.edf" ],
+                [ "bob1.edf", "bob0.edf" ],
+                [ "1.edf", "0.edf" ],
+                [ "1.mar2300", "0.mar2300" ],
+                ]:
+            self.assertEqual(prev, fabio.previous_filename(name))
+
+class test_jump(unittest.TestCase):
+    def test_jump1(self):
+        for name, res, num in [ [ "data0001.edf", "data99993.edf" , 99993 ],
+                [ "bob1.edf", "bob0.edf", 0 ],
+                [ "1.edf", "123456.edf" , 123456],
+                [ "mydata001.mar2300.gz", "mydata003.mar2300.gz", 3 ],
+                ]:
+            self.assertEqual(res, fabio.jump_filename(name, num))
+
+
+def test_suite_all_steps():
+    testSuite = unittest.TestSuite()
+
+    testSuite.addTest(test_next("test_next1"))
+    testSuite.addTest(test_prev("test_prev1"))
+    testSuite.addTest(test_jump("test_jump1"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_steps()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
diff --git a/test/test_flat_binary.py b/test/test_flat_binary.py
new file mode 100644
index 0000000..49599b4
--- /dev/null
+++ b/test/test_flat_binary.py
@@ -0,0 +1,73 @@
+
+import unittest, sys, os, logging
+logger = logging.getLogger("test_flat_binary")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+
+
+class test_flat_binary(unittest.TestCase):
+
+    filenames = [
+        "not.a.file",
+        "bad_news_1234",
+        "empty_files_suck_1234.edf",
+        "notRUBY_1234.dat"]
+
+    def setUp(self):
+        for filename in self.filenames:
+            f = open(filename, "wb")
+            # A 2048 by 2048 blank image
+            f.write("\0x0" * 2048 * 2048 * 2)
+        f.close()
+
+    def test_openimage(self):
+        """
+        test the opening of "junk" empty images ...
+        JK: I wonder if this test makes sense !
+        """
+        nfail = 0
+        for filename in self.filenames:
+            try:
+                im = fabio.open(filename)
+                if im.data.tostring() != "\0x0" * 2048 * 2048 * 2:
+                    nfail += 1
+                else:
+                    logger.info("**** Passed: %s" % filename)
+            except:
+                logger.warning("failed for: %s" % filename)
+                nfail += 1
+        self.assertEqual(nfail, 0, " %s failures out of %s" % (nfail, len(self.filenames)))
+
+    def tearDown(self):
+        for filename in self.filenames:
+            os.remove(filename)
+
+def test_suite_all_flat():
+    testSuite = unittest.TestSuite()
+
+    testSuite.addTest(test_flat_binary("test_openimage"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_flat()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
diff --git a/test/testadscimage.py b/test/testadscimage.py
new file mode 100644
index 0000000..b49b21d
--- /dev/null
+++ b/test/testadscimage.py
@@ -0,0 +1,105 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+
+"""
+# Unit tests
+
+# builds on stuff from ImageD11.test.testpeaksearch
+
+Updated by Jerome Kieffer (jerome.kieffer at esrf.eu), 2011
+"""
+
+import unittest, sys, os, logging
+logger = logging.getLogger("testadscimage")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+from fabio.adscimage import adscimage
+from fabio.edfimage import edfimage
+
+
+# statistics come from fit2d I think
+# filename dim1 dim2 min max mean stddev
+TESTIMAGES = """mb_LP_1_001.img 3072 3072 0.0000 65535. 120.33 147.38 
+mb_LP_1_001.img.gz  3072 3072 0.0000 65535.  120.33 147.38 
+mb_LP_1_001.img.bz2 3072 3072 0.0000 65535.  120.33 147.38 """
+
+
+
+class testmatch(unittest.TestCase):
+    """ 
+    check the ??fit2d?? conversion to edf gives same numbers 
+    """
+    def setUp(self):
+        """ Download images """
+        self.fn_adsc = UtilsTest.getimage("mb_LP_1_001.img.bz2")[:-4]
+        self.fn_edf = UtilsTest.getimage("mb_LP_1_001.edf.bz2")[:-4]
+
+    def testsame(self):
+        """test ADSC image match to EDF"""
+        im1 = edfimage()
+        im1.read(self.fn_edf)
+        im2 = adscimage()
+        im2.read(self.fn_adsc)
+        diff = (im1.data.astype("float32") - im2.data.astype("float32"))
+        logger.debug("type: %s %s shape %s %s " % (im1.data.dtype, im2.data.dtype, im1.data.shape, im2.data.shape))
+        logger.debug("im1 min %s %s max %s %s " % (im1.data.min(), im2.data.min(), im1.data.max(), im2.data.max()))
+        logger.debug("delta min %s max %s mean %s" % (diff.min(), diff.max(), diff.mean()))
+        self.assertEqual(abs(diff).max(), 0.0, "asdc data == edf data")
+
+
+class testflatmccdsadsc(unittest.TestCase):
+    """
+    """
+    def test_read(self):
+        """ check we can read flat ADSC images"""
+        for line in TESTIMAGES.split("\n"):
+            vals = line.split()
+            name = vals[0]
+            dim1, dim2 = [int(x) for x in vals[1:3]]
+            mini, maxi, mean, stddev = [float(x) for x in vals[3:]]
+            obj = adscimage()
+            obj.read(os.path.join("testimages", name))
+            self.assertAlmostEqual(mini, obj.getmin(), 2, "getmin")
+            self.assertAlmostEqual(maxi, obj.getmax(), 2, "getmax")
+            self.assertAlmostEqual(mean, obj.getmean(), 2, "getmean")
+            self.assertAlmostEqual(stddev, obj.getstddev(), 2, "getstddev")
+            self.assertEqual(dim1, obj.dim1, "dim1")
+            self.assertEqual(dim2, obj.dim2, "dim2")
+
+
+
+
+
+
+def test_suite_all_adsc():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(testmatch("testsame"))
+    testSuite.addTest(testflatmccdsadsc("test_read"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_adsc()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
+
+
+
diff --git a/test/testbrukerimage.py b/test/testbrukerimage.py
new file mode 100644
index 0000000..bd7ee05
--- /dev/null
+++ b/test/testbrukerimage.py
@@ -0,0 +1,156 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+"""
+#bruker Unit tests
+
+#built on testedfimage
+"""
+
+import unittest, sys, os, logging
+logger = logging.getLogger("testbrukerimage")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+from fabio.brukerimage import brukerimage
+import numpy
+import bz2, gzip
+#this is actually a violation of the bruker format since the order of
+# the header items is specified
+#in the standard, whereas the order of a python dictionary is not
+MYHEADER = {"FORMAT":'86',
+            'NPIXELB':'2',
+            'VERSION':'9',
+            'HDRBLKS':'5',
+            'NOVERFL':'4',
+            'NCOLS':'256',
+            'NROWS':'256',
+            'WORDORD':'0'}
+
+MYIMAGE = numpy.ones((256, 256), numpy.uint16) * 16
+MYIMAGE[0, 0] = 0
+MYIMAGE[1, 1] = 32
+MYIMAGE[127:129, 127:129] = 65535
+
+OVERFLOWS = [
+    ["%09d" % 4194304, ("%07d" % (127 * 256 + 127))],
+    ["%09d" % 4194304, ("%07d" % (127 * 256 + 128))],
+    ["%09d" % 4194304, ("%07d" % (128 * 256 + 127))],
+    ["%09d" % 4194304, ("%07d" % (128 * 256 + 128))]
+    ]
+
+class testbruker(unittest.TestCase):
+    """basic test"""
+    filename = 'testimages/image.0000'
+
+    def setUp(self):
+        """ Generate a test bruker image """
+        if not os.path.isfile(self.filename):
+            fout = open(self.filename, 'wb')
+            wrb = 0
+            for key, val in MYHEADER.iteritems():
+                fout.write(("%-7s" % key) + ':' + ("%-72s" % val))
+                wrb = wrb + 80
+            hdrblks = int(MYHEADER['HDRBLKS'])
+            while (wrb < hdrblks * 512):
+                fout.write("\x1a\x04")
+                fout.write('.'*78)
+                wrb = wrb + 80
+            fout.write(MYIMAGE.tostring())
+
+            noverfl = int(MYHEADER['NOVERFL'])
+            for ovf in OVERFLOWS:
+                fout.write(ovf[0] + ovf[1])
+            fout.write('.' * (512 - (16 * noverfl) % 512))
+
+    def test_read(self):
+        """ see if we can read the test image """
+        obj = brukerimage()
+        obj.read(self.filename)
+        self.assertAlmostEqual(obj.getmean() , 272.0, 2)
+        self.assertEqual(obj.getmin() , 0)
+        self.assertEqual(obj.getmax() , 4194304)
+
+class testbzipbruker(testbruker):
+    """ test for a bzipped image """
+    def setUp(self):
+        """ create the image """
+        testbruker.setUp(self)
+        if not os.path.isfile(self.filename + ".bz2"):
+            bz2.BZ2File(self.filename + ".bz2", "wb").write(open(self.filename, "rb").read())
+            self.filename += ".bz2"
+
+class testgzipbruker(testbruker):
+    """ test for a gzipped image """
+    def setUp(self):
+        """ Create the image """
+        testbruker.setUp(self)
+        if not os.path.isfile(self.filename + ".gz"):
+            gzip.open(self.filename + ".gz", "wb").write(open(self.filename, "rb").read())
+#            os.system("gzip %s" % (self.filename))
+            self.filename += ".gz"
+
+
+
+
+# statistics come from fit2d I think
+# filename dim1 dim2 min max mean stddev
+
+TESTIMAGES = """Cr8F8140k103.0026   512  512  0  145942 289.37  432.17 
+Cr8F8140k103.0026.gz   512  512  0  145942 289.37  432.17 
+Cr8F8140k103.0026.bz2   512  512  0 145942 289.37  432.17 """
+
+
+class test_real_im(unittest.TestCase):
+    """ check some read data from bruker detector"""
+    def setUp(self):
+        """
+        download images
+        """
+        UtilsTest.getimage("Cr8F8140k103.0026.bz2")
+
+    def test_read(self):
+        """ check we can read bruker images"""
+        for line in TESTIMAGES.split("\n"):
+            vals = line.split()
+            name = vals[0]
+            dim1, dim2 = [int(x) for x in vals[1:3]]
+            mini, maxi, mean, stddev = [float(x) for x in vals[3:]]
+            obj = brukerimage()
+            obj.read(os.path.join("testimages", name))
+            self.assertAlmostEqual(mini, obj.getmin(), 2, "getmin")
+            self.assertAlmostEqual(maxi, obj.getmax(), 2, "getmax")
+            self.assertAlmostEqual(mean, obj.getmean(), 2, "getmean")
+            self.assertAlmostEqual(stddev, obj.getstddev(), 2, "getstddev")
+            self.assertEqual(dim1, obj.dim1, "dim1")
+            self.assertEqual(dim2, obj.dim2, "dim2")
+
+def test_suite_all_bruker():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(testbruker("test_read"))
+    testSuite.addTest(testbzipbruker("test_read"))
+    testSuite.addTest(testgzipbruker("test_read"))
+    testSuite.addTest(test_real_im("test_read"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_bruker()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
diff --git a/test/testcbfimage.py b/test/testcbfimage.py
new file mode 100755
index 0000000..a7ea466
--- /dev/null
+++ b/test/testcbfimage.py
@@ -0,0 +1,112 @@
+#!/usr/bin/env python
+# coding: utf8
+
+"""
+2011: Jerome Kieffer for ESRF.
+
+Unit tests for CBF images based on references images taken from:
+http://pilatus.web.psi.ch/DATA/DATASETS/insulin_0.2/
+
+"""
+import unittest, sys, os, logging
+logger = logging.getLogger("testcbfimage")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+from fabio.cbfimage import cbfimage
+import time
+
+class test_cbfimage_reader(unittest.TestCase):
+    """ test cbf image reader """
+
+    def __init__(self, methodName):
+        "Constructor of the class"
+        unittest.TestCase.__init__(self, methodName)
+        testimgdir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "testimages")
+        self.edf_filename = os.path.join(testimgdir, "run2_1_00148.edf")
+        self.cbf_filename = os.path.join(testimgdir, "run2_1_00148.cbf")
+
+
+    def setUp(self):
+        """Download images"""
+
+        UtilsTest.getimage(os.path.basename(self.edf_filename + ".bz2"))
+        UtilsTest.getimage(os.path.basename(self.cbf_filename))
+
+
+    def test_read(self):
+        """ check whole reader"""
+        times = []
+        times.append(time.time())
+        cbf = fabio.open(self.cbf_filename)
+        times.append(time.time())
+        edf = fabio.open(self.edf_filename)
+        times.append(time.time())
+
+        self.assertAlmostEqual(0, abs(cbf.data - edf.data).max())
+        logger.info("Reading CBF took %.3fs whereas the same EDF took %.3fs" % (times[1] - times[0], times[2] - times[1]))
+
+    def test_byte_offset(self):
+        """ check byte offset algorythm"""
+        cbf = fabio.open(self.cbf_filename)
+        starter = "\x0c\x1a\x04\xd5"
+        startPos = cbf.cif["_array_data.data"].find(starter) + 4
+        data = cbf.cif["_array_data.data"][ startPos: startPos + int(cbf.header["X-Binary-Size"])]
+        startTime = time.time()
+        numpyRes = cbfimage.analyseNumpy(data, size=cbf.dim1 * cbf.dim2)
+        tNumpy = time.time() - startTime
+        logger.info("Timing for Numpy method : %.3fs" % tNumpy)
+
+#        startTime = time.time()
+#        weaveRes = cbfimage.analyseWeave(data, size=cbf.dim1 * cbf.dim2)
+#        tWeave = time.time() - startTime
+#        delta = abs(numpyRes - weaveRes).max()
+#        self.assertAlmostEqual(0, delta)
+#        logger.info("Timing for Weave method : %.3fs, max delta=%s" % (tWeave, delta))
+
+        startTime = time.time()
+        pythonRes = cbfimage.analysePython(data, size=cbf.dim1 * cbf.dim2)
+        tPython = time.time() - startTime
+        delta = abs(numpyRes - pythonRes).max()
+        self.assertAlmostEqual(0, delta)
+        logger.info("Timing for Python method : %.3fs, max delta= %s" % (tPython, delta))
+
+        from fabio.byte_offset import analyseCython
+        startTime = time.time()
+        cythonRes = analyseCython(stream=data, size=cbf.dim1 * cbf.dim2)
+        tCython = time.time() - startTime
+        delta = abs(numpyRes - cythonRes).max()
+        self.assertAlmostEqual(0, delta)
+        logger.info("Timing for Cython method : %.3fs, max delta= %s" % (tCython, delta))
+
+
+def test_suite_all_cbf():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(test_cbfimage_reader("test_read"))
+    testSuite.addTest(test_cbfimage_reader("test_byte_offset"))
+    return testSuite
+
+if __name__ == '__main__':
+
+    mysuite = test_suite_all_cbf()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
+
diff --git a/test/testedfimage.py b/test/testedfimage.py
new file mode 100644
index 0000000..4038ff0
--- /dev/null
+++ b/test/testedfimage.py
@@ -0,0 +1,283 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*- 
+
+"""
+# Unit tests
+
+# builds on stuff from ImageD11.test.testpeaksearch
+"""
+import unittest, sys, os, logging
+logger = logging.getLogger("testedfimage")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+from fabio.edfimage import edfimage
+import numpy
+import gzip, bz2
+
+
+
+class testflatedfs(unittest.TestCase):
+    """ test some flat images """
+    filename = "testimages/im0000.edf"
+    MYHEADER = "{\n%-1020s}\n" % (
+"""Omega = 0.0 ; 
+Dim_1 = 256 ;
+Dim_2 = 256 ;
+DataType = FloatValue ;
+ByteOrder = LowByteFirst ;
+Image = 1;
+History-1 = something=something else;
+\n\n""")
+
+    MYIMAGE = numpy.ones((256, 256), numpy.float32) * 10
+    MYIMAGE[0, 0] = 0
+    MYIMAGE[1, 1] = 20
+
+    assert len(MYIMAGE[0:1, 0:1].tostring()) == 4, \
+    len(MYIMAGE[0:1, 0:1].tostring())
+
+    def setUp(self):
+        """ initialize"""
+        if not os.path.isfile(self.filename):
+            outf = open(self.filename, "wb")
+            assert len(self.MYHEADER) % 1024 == 0
+            outf.write(self.MYHEADER)
+            outf.write(self.MYIMAGE.tostring())
+            outf.close()
+
+
+    def test_read(self):
+        """ check readable"""
+        obj = edfimage()
+        obj.read(self.filename)
+        self.assertEqual(obj.dim1 , 256)
+        self.assertEqual(obj.dim2 , 256)
+        self.assertEqual(obj.bpp , 4)
+        self.assertEqual(obj.bytecode, numpy.float32)
+        self.assertEqual(obj.data.shape, (256, 256))
+        self.assertEqual(obj.header['History-1'],
+                         "something=something else")
+
+    def test_getstats(self):
+        """ test statistics"""
+        obj = edfimage()
+        obj.read(self.filename)
+        self.assertEqual(obj.getmean() , 10)
+        self.assertEqual(obj.getmin() , 0)
+        self.assertEqual(obj.getmax() , 20)
+
+
+
+
+class testbzipedf(testflatedfs):
+    """ same for bzipped versions """
+    def setUp(self):
+        """set it up"""
+        testflatedfs.setUp(self)
+        if not os.path.isfile(self.filename + ".bz2"):
+                    bz2.BZ2File(self.filename + ".bz2", "wb").write(open(self.filename, "rb").read())
+        self.filename += ".bz2"
+
+class testgzipedf(testflatedfs):
+    """ same for gzipped versions """
+    def setUp(self):
+        """ set it up """
+        testflatedfs.setUp(self)
+        if not os.path.isfile(self.filename + ".gz"):
+                    gzip.open(self.filename + ".gz", "wb").write(open(self.filename, "rb").read())
+        self.filename += ".gz"
+
+
+
+
+
+# statistics come from fit2d I think
+# filename dim1 dim2 min max mean stddev
+TESTIMAGES = """F2K_Seb_Lyso0675.edf     2048 2048 982 17467 1504.29  217.61
+                F2K_Seb_Lyso0675.edf.bz2 2048 2048 982 17467 1504.29  217.61
+                F2K_Seb_Lyso0675.edf.gz  2048 2048 982 17467 1504.29  217.61
+                id13_badPadding.edf      512  512  85  61947 275.62   583.44 """
+
+class testedfs(unittest.TestCase):
+    """
+    Read some test images 
+    """
+    def setUp(self):
+        UtilsTest.getimage("F2K_Seb_Lyso0675.edf.bz2")
+        UtilsTest.getimage("id13_badPadding.edf.bz2")
+
+    def test_read(self):
+        """ check we can read these images"""
+        for line in TESTIMAGES.split("\n"):
+            vals = line.split()
+            name = vals[0]
+            dim1, dim2 = [int(x) for x in vals[1:3]]
+            mini, maxi, mean, stddev = [float(x) for x in vals[3:]]
+            obj = edfimage()
+            try:
+                obj.read(os.path.join("testimages", name))
+            except:
+                print "Cannot read image", name
+                raise
+            self.assertAlmostEqual(mini, obj.getmin(), 2, "testedfs: %s getmin()" % name)
+            self.assertAlmostEqual(maxi, obj.getmax(), 2, "testedfs: %s getmax" % name)
+            logger.info("%s Mean: exp=%s, obt=%s" % (name, mean, obj.getmean()))
+            self.assertAlmostEqual(mean, obj.getmean(), 2, "testedfs: %s getmean" % name)
+            logger.info("%s StdDev:  exp=%s, obt=%s" % (name, stddev, obj.getstddev()))
+            self.assertAlmostEqual(stddev, obj.getstddev(), 2, "testedfs: %s getstddev" % name)
+            self.assertEqual(dim1, obj.dim1, "testedfs: %s dim1" % name)
+            self.assertEqual(dim2, obj.dim2, "testedfs: %s dim2" % name)
+
+    def test_rebin(self):
+        """test the rebin of edfdata"""
+        f = edfimage()
+        f.read(os.path.join("testimages", "F2K_Seb_Lyso0675.edf"))
+        f.rebin(1024, 1024)
+        self.assertEqual(abs(numpy.array([[1547, 1439], [1536, 1494]]) - f.data).max(), 0, "data are the same after rebin")
+
+
+
+class testedfcompresseddata(unittest.TestCase):
+    """
+    Read some test images with their data-block compressed.
+    Z-Compression and Gzip compression are implemented Bzip2 and byte offet are experimental 
+    """
+    def setUp(self):
+        UtilsTest.getimage("edfGzip_U16.edf.bz2")
+        UtilsTest.getimage("edfCompressed_U16.edf.bz2")
+        UtilsTest.getimage("edfUncompressed_U16.edf.bz2")
+
+    def test_read(self):
+        """ check we can read these images"""
+        ref = edfimage()
+        gzipped = edfimage()
+        compressed = edfimage()
+        refFile = "edfUncompressed_U16.edf"
+        gzippedFile = "edfGzip_U16.edf"
+        compressedFile = "edfCompressed_U16.edf"
+        try:
+            ref.read(os.path.join("testimages", refFile))
+        except:
+            raise RuntimeError("Cannot read image Uncompressed image %s" % refFile)
+        try:
+            gzipped.read(os.path.join("testimages", gzippedFile))
+        except:
+            raise RuntimeError("Cannot read image gzippedFile image %s" % gzippedFile)
+        try:
+            compressed.read(os.path.join("testimages", compressedFile))
+        except:
+            raise RuntimeError("Cannot read image compressedFile image %s" % compressedFile)
+        self.assertEqual((ref.data - gzipped.data).max(), 0, "Gzipped data block is correct")
+        self.assertEqual((ref.data - compressed.data).max(), 0, "Zlib compressed data block is correct")
+
+
+class testedfmultiframe(unittest.TestCase):
+    """
+    Read some test images with their data-block compressed.
+    Z-Compression and Gzip compression are implemented Bzip2 and byte offet are experimental 
+    """
+    def setUp(self):
+        UtilsTest.getimage("MultiFrame.edf.bz2")
+        UtilsTest.getimage("MultiFrame-Frame0.edf.bz2")
+        UtilsTest.getimage("MultiFrame-Frame1.edf.bz2")
+        self.ref = edfimage()
+        self.frame0 = edfimage()
+        self.frame1 = edfimage()
+        self.refFile = "MultiFrame.edf"
+        self.Frame0File = "MultiFrame-Frame0.edf"
+        self.Frame1File = "MultiFrame-Frame1.edf"
+        try:
+            self.ref.read(os.path.join("testimages", self.refFile))
+        except:
+            raise RuntimeError("Cannot read image refFile image %s" % self.refFile)
+        try:
+            self.frame0.read(os.path.join("testimages", self.Frame0File))
+        except:
+            raise RuntimeError("Cannot read image Frame0File image %s" % self.Frame0File)
+        try:
+            self.frame1.read(os.path.join("testimages", self.Frame1File))
+        except:
+            raise RuntimeError("Cannot read image Frame1File image %s" % self.Frame1File)
+
+    def test_getFrame_multi(self):
+        """testedfmultiframe.test_getFrame_multi"""
+        self.assertEqual((self.ref.data - self.frame0.data).max(), 0, "getFrame_multi: Same data for frame 0")
+        f1_multi = self.ref.getframe(1)
+#        logger.warning("f1_multi.header=%s\nf1_multi.data=  %s" % (f1_multi.header, f1_multi.data))
+        self.assertEqual((f1_multi.data - self.frame1.data).max(), 0, "getFrame_multi: Same data for frame 1")
+
+    def test_getFrame_mono(self):
+        "testedfmultiframe.test_getFrame_mono"
+        self.assertEqual((self.ref.data - self.frame0.data).max(), 0, "getFrame_mono: Same data for frame 0")
+        f1_mono = self.frame0.getframe(1)
+        self.assertEqual((f1_mono.data - self.frame1.data).max(), 0, "getFrame_mono: Same data for frame 1")
+
+    def test_next_multi(self):
+        """testedfmultiframe.test_getFrame_mono"""
+        self.assertEqual((self.ref.data - self.frame0.data).max(), 0, "next_multi: Same data for frame 0")
+        next = self.ref.next()
+        self.assertEqual((next.data - self.frame1.data).max(), 0, "next_multi: Same data for frame 1")
+
+    def text_next_mono(self):
+        "testedfmultiframe.text_next_mono"
+        self.assertEqual((self.ref.data - self.frame0.data).max(), 0, "next_mono: Same data for frame 0")
+        next = self.frame0.next()
+        self.assertEqual((next.data - self.frame1.data).max(), 0, "next_mono: Same data for frame 1")
+
+    def test_previous_multi(self):
+        """testedfmultiframe.test_previous_multi"""
+        f1 = self.ref.getframe(1)
+        self.assertEqual((f1.data - self.frame1.data).max(), 0, "previous_multi: Same data for frame 1")
+        f0 = f1.previous()
+        self.assertEqual((f0.data - self.frame1.data).max(), 0, "previous_multi: Same data for frame 0")
+
+    def text_previous_mono(self):
+        "testedfmultiframe.text_previous_mono"
+        f1 = self.ref.getframe(1)
+        self.assertEqual((f1.data - self.frame1.data).max(), 0, "previous_mono: Same data for frame 1")
+        prev = self.frame1.previous()
+        self.assertEqual((prev.data - self.frame0.data).max(), 0, "previous_mono: Same data for frame 0")
+
+
+def test_suite_all_edf():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(testflatedfs("test_read"))
+    testSuite.addTest(testflatedfs("test_getstats"))
+    testSuite.addTest(testbzipedf("test_read"))
+    testSuite.addTest(testbzipedf("test_getstats"))
+    testSuite.addTest(testgzipedf("test_read"))
+    testSuite.addTest(testgzipedf("test_getstats"))
+    testSuite.addTest(testedfs("test_read"))
+    testSuite.addTest(testedfs("test_rebin"))
+    testSuite.addTest(testedfcompresseddata("test_read"))
+    testSuite.addTest(testedfmultiframe("test_getFrame_multi"))
+    testSuite.addTest(testedfmultiframe("test_getFrame_mono"))
+    testSuite.addTest(testedfmultiframe("test_next_multi"))
+    testSuite.addTest(testedfmultiframe("text_next_mono"))
+    testSuite.addTest(testedfmultiframe("test_previous_multi"))
+    testSuite.addTest(testedfmultiframe("text_previous_mono"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_edf()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
diff --git a/test/testfabioimage.py b/test/testfabioimage.py
new file mode 100644
index 0000000..1a3e36a
--- /dev/null
+++ b/test/testfabioimage.py
@@ -0,0 +1,227 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*- 
+"""
+Test cases for the fabioimage class
+
+testsuite by Jerome Kieffer (Jerome.Kieffer at esrf.eu)
+"""
+import unittest, sys, os, logging
+logger = logging.getLogger("testfabioimage")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+from fabio.fabioimage import fabioimage
+import numpy
+import gzip, bz2
+
+class test50000(unittest.TestCase):
+    """ test with 50000 everywhere"""
+    def setUp(self):
+        """make the image"""
+        dat = numpy.ones((1024, 1024), numpy.uint16)
+        dat = (dat * 50000).astype(numpy.uint16)
+        assert dat.dtype.char == numpy.ones((1), numpy.uint16).dtype.char
+        hed = {"Title":"50000 everywhere"}
+        self.obj = fabioimage(dat, hed)
+
+    def testgetmax(self):
+        """check max"""
+        self.assertEqual(self.obj.getmax(), 50000)
+
+    def testgetmin(self):
+        """check min"""
+        self.assertEqual(self.obj.getmin(), 50000)
+
+    def testgetmean(self):
+        """check mean"""
+        self.assertEqual(self.obj.getmean(), 50000)
+
+    def getstddev(self):
+        """check stddev"""
+        self.assertEqual(self.obj.getstddev(), 0)
+
+class testslices(unittest.TestCase):
+    """check slicing"""
+    def setUp(self):
+        """make test data"""
+        dat2 = numpy.zeros((1024, 1024), numpy.uint16)
+        hed = {"Title":"zeros and 100"}
+        self.cord = [ 256, 256, 790, 768 ]
+        self.obj = fabioimage(dat2, hed)
+        self.slic = slic = self.obj.make_slice(self.cord)
+        # Note - d2 is modified *after* fabioimage is made
+        dat2[slic] = dat2[slic] + 100
+        assert self.obj.maxval is None
+        assert self.obj.minval is None
+        self.npix = (slic[0].stop - slic[0].start) * \
+            (slic[1].stop - slic[1].start)
+
+    def testgetmax(self):
+        """check max"""
+        self.assertEqual(self.obj.getmax(), 100)
+
+    def testgetmin(self):
+        """check min"""
+        self.assertEqual(self.obj.getmin(), 0)
+
+    def testintegratearea(self):
+        """ check integrations"""
+        self.obj.resetvals()
+        area1 = self.obj.integrate_area(self.cord)
+        self.obj.resetvals()
+        area2 = self.obj.integrate_area(self.slic)
+        self.assertEqual(area1, area2)
+        self.assertEqual(area1, self.npix * 100)
+
+    def testRebin(self):
+        """Test the rebin method"""
+        big = numpy.arange(64).reshape((8, 8))
+        res = numpy.array([[13, 17], [45, 49]])
+        fabimg = fabioimage(data=big, header={})
+        fabimg.rebin(4, 4)
+        self.assertEqual(abs(res - fabimg.data).max(), 0, "data are the same after rebin")
+
+
+class testopen(unittest.TestCase):
+    """check opening compressed files"""
+    testfile = "testimages/testfile"
+    def setUp(self):
+        """ create test files"""
+        if not os.path.isfile(self.testfile):
+            open(self.testfile, "wb").write("{ hello }")
+        if not os.path.isfile(self.testfile + ".gz"):
+            gzip.open(self.testfile + ".gz", "wb").write("{ hello }")
+        if not os.path.isfile(self.testfile + ".bz2"):
+            bz2.BZ2File(self.testfile + ".bz2", "wb").write("{ hello }")
+        self.obj = fabioimage()
+
+    def testFlat(self):
+        """ no compression"""
+        res = self.obj._open(self.testfile).read()
+        self.assertEqual(res , "{ hello }")
+
+    def testgz(self):
+        """ gzipped """
+        res = self.obj._open(self.testfile + ".gz").read()
+        self.assertEqual(res , "{ hello }")
+
+    def testbz2(self):
+        """ bzipped"""
+        res = self.obj._open(self.testfile + ".bz2").read()
+        self.assertEqual(res , "{ hello }")
+
+
+NAMES = { numpy.uint8 :  "numpy.uint8",
+          numpy.int8  :  "numpy.int8" ,
+          numpy.uint16:  "numpy.uint16",
+          numpy.int16 :  "numpy.int16" ,
+          numpy.uint32:  "numpy.uint32" ,
+          numpy.int32 :  "numpy.int32"   ,
+          numpy.float32: "numpy.float32" ,
+          numpy.float64: "numpy.float64"}
+
+
+class testPILimage(unittest.TestCase):
+    """ check PIL creation"""
+    def setUp(self):
+        """ list of working numeric types"""
+        self.okformats = [numpy.uint8,
+                          numpy.int8,
+                          numpy.uint16,
+                          numpy.int16,
+                          numpy.uint32,
+                          numpy.int32,
+                          numpy.float32]
+
+
+    def mkdata(self, shape, typ):
+        """ generate [01] testdata """
+        return (numpy.random.random(shape)).astype(typ)
+
+
+    def testpil(self):
+
+        for typ in self.okformats:
+            name = NAMES[typ]
+            for shape in [(10, 20), (431, 1325)]:
+                testdata = self.mkdata(shape, typ)
+                img = fabioimage(testdata, {"title":"Random data"})
+                pim = img.toPIL16()
+                for i in [ 0, 5, 6, shape[1] - 1 ]:
+                    for j in [0, 5, 7, shape[0] - 1 ]:
+                        errstr = name + " %d %d %f %f t=%s" % (
+                            i, j, testdata[j, i], pim.getpixel((i, j)), typ)
+
+                        er1 = img.data[j, i] - pim.getpixel((i, j))
+                        er2 = img.data[j, i] + pim.getpixel((i, j))
+
+                        # difference as % error in case of rounding
+                        if er2 != 0.:
+                            err = er1 / er2
+                        else:
+                            err = er1
+
+                        self.assertAlmostEquals(err,
+                                                 0,
+                                                 6,
+                                                 errstr)
+
+
+class testPILimage2(testPILimage):
+    """ check with different numbers"""
+    def mkdata(self, shape, typ):
+        """ positive and big"""
+        return (numpy.random.random(shape) * sys.maxint / 10).astype(typ)
+
+class testPILimage3(testPILimage):
+    """ check with different numbers"""
+    def mkdata(self, shape, typ):
+        """ positive, negative and big"""
+        return ((numpy.random.random(shape) - 0.5) * sys.maxint / 10).astype(typ)
+
+def test_suite_all_fabio():
+    testSuite = unittest.TestSuite()
+
+    testSuite.addTest(test50000("testgetmax"))
+    testSuite.addTest(test50000("testgetmin"))
+    testSuite.addTest(test50000("testgetmean"))
+    testSuite.addTest(test50000("getstddev"))
+
+    testSuite.addTest(testslices("testgetmax"))
+    testSuite.addTest(testslices("testgetmin"))
+    testSuite.addTest(testslices("testintegratearea"))
+    testSuite.addTest(testslices("testRebin"))
+
+    testSuite.addTest(testopen("testFlat"))
+    testSuite.addTest(testopen("testgz"))
+    testSuite.addTest(testopen("testbz2"))
+
+    testSuite.addTest(testPILimage("testpil"))
+    testSuite.addTest(testPILimage2("testpil"))
+    testSuite.addTest(testPILimage3("testpil"))
+
+    return testSuite
+
+if __name__ == '__main__':
+
+    mysuite = test_suite_all_fabio()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
diff --git a/test/testfilenames.py b/test/testfilenames.py
new file mode 100644
index 0000000..6f76392
--- /dev/null
+++ b/test/testfilenames.py
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*- 
+
+
+"""
+Test cases for filename deconstruction
+
+
+testsuite by Jerome Kieffer (Jerome.Kieffer at esrf.eu)
+"""
+
+import unittest, sys, os, logging
+logger = logging.getLogger("testfilenames")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+
+CASES = [
+    (1, 'edf', "data0001.edf"),
+    (10001, 'edf', "data10001.edf"),
+    (10001, 'edf', "data10001.edf.gz"),
+    (10001, 'edf', "data10001.edf.bz2"),
+    (2, 'marccd', "data0002.mccd"),
+    (12345, 'marccd', "data12345.mccd"),
+    (10001, 'marccd', "data10001.mccd.gz"),
+    (10001, 'marccd', "data10001.mccd.bz2"),
+    (123, 'marccd', "data123.mccd.gz"),
+    (3, 'tif', "data0003.tif"),
+    (4, 'tif', "data0004.tiff"),
+    (12, 'bruker', "sucrose101.012.gz"),
+    (99, 'bruker', "sucrose101.099"),
+    (99, 'bruker', "sucrose101.0099"),
+    (99, 'bruker', "sucrose101.0099.bz2"),
+    (99, 'bruker', "sucrose101.0099.gz"),
+    (2, 'fit2dmask', "fit2d.msk"),
+    (None, 'fit2dmask', "mymask.msk"),
+    (670005, 'edf' , 'S82P670005.edf'),
+    (670005, 'edf' , 'S82P670005.edf.gz'),
+    # based on only the name it can be either img or oxd
+    (1     , 'adsc_or_OXD_or_HiPiC' , 'mb_LP_1_001.img'),
+    (2     , 'adsc_or_OXD_or_HiPiC' , 'mb_LP_1_002.img.gz'),
+    (3     , 'adsc_or_OXD_or_HiPiC' , 'mb_LP_1_003.img.bz2'),
+    (3     , 'adsc_or_OXD_or_HiPiC' , os.path.join("data", 'mb_LP_1_003.img.bz2')),
+    ]
+
+
+MORE_CASES = [
+    ("data0010.edf", "data0012.edf", 10),
+    ("data1000.pnm", "data999.pnm", 1000),
+    ("data0999.pnm", "data1000.pnm", 999),
+    ("data123457.edf", "data123456.edf", 123457),
+    ("d0ata000100.mccd", "d0ata000012.mccd", 100),
+    (os.path.join("images/sampledir", "P33S670003.edf"),
+     os.path.join("images/sampledir", "P33S670002.edf"), 670003),
+    (os.path.join("images/P33S67", "P33S670003.edf"),
+     os.path.join("images/P33S67", "P33S670002.edf"), 670003),
+    ("image2301.mar2300", "image2300.mar2300", 2301),
+    ("image2300.mar2300", "image2301.mar2300", 2300),
+    ("image.0123", "image.1234", 123),
+    ("mymask.msk", "mymask.msk", None),
+    ("data_123.mccd.bz2", "data_001.mccd.bz2", 123)
+    ]
+
+
+class testfilenames(unittest.TestCase):
+    """ check the name -> number, type conversions """
+
+    def test_many_cases(self):
+        """ loop over CASES """
+        for num, typ, name in CASES:
+            obj = fabio.deconstruct_filename(name)
+            self.assertEqual(num, obj.num , name + " num=" + str(num) + \
+                                                 " != obj.num=" + str(obj.num))
+            self.assertEqual(typ, "_or_".join(obj.format),
+                                 name + " " + "_or_".join(obj.format))
+            self.assertEqual(name, obj.tostring() , name + " " + obj.tostring())
+
+    def test_more_cases(self):
+        for nname, oname, num in MORE_CASES:
+            name = fabio.construct_filename(oname, num)
+            self.assertEqual(name, nname)
+
+    def test_more_cases_jump(self):
+        for nname, oname, num in MORE_CASES:
+            name = fabio.jump_filename(oname, num)
+            self.assertEqual(name, nname)
+
+
+def test_suite_all_filenames():
+    testSuite = unittest.TestSuite()
+
+    testSuite.addTest(testfilenames("test_many_cases"))
+#    testSuite.addTest(testfilenames("test_more_cases"))
+    testSuite.addTest(testfilenames("test_more_cases_jump"))
+
+    return testSuite
+
+if __name__ == '__main__':
+
+    mysuite = test_suite_all_filenames()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
diff --git a/test/testfit2dmaskimage.py b/test/testfit2dmaskimage.py
new file mode 100644
index 0000000..4cb81e0
--- /dev/null
+++ b/test/testfit2dmaskimage.py
@@ -0,0 +1,112 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+## Automatically adapted for numpy.oldnumeric Oct 05, 2007 by alter_code1.py
+
+
+
+# Unit tests
+
+""" Test the fit2d mask reader
+
+Updated by Jerome Kieffer (jerome.kieffer at esrf.eu), 2011
+"""
+import unittest, sys, os, logging
+logger = logging.getLogger("testfit2dmaskdfimage")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+from fabio.fit2dmaskimage import fit2dmaskimage
+import numpy
+
+class testfacemask(unittest.TestCase):
+    """ test the picture of a face """
+
+    def setUp(self):
+        """
+        download images
+        """
+        self.filename = UtilsTest.getimage("face.msk.bz2")[:-4]
+        self.edffilename = UtilsTest.getimage("face.edf.bz2") [:-4]
+
+
+    def test_getmatch(self):
+        """ test edf and msk are the same """
+        i = fit2dmaskimage()
+        i.read(self.filename)
+        j = fabio.open(self.edffilename)
+        # print "edf: dim1",oe.dim1,"dim2",oe.dim2
+        self.assertEqual(i.dim1, j.dim1)
+        self.assertEqual(i.dim2, j.dim2)
+        self.assertEqual(i.data.shape, j.data.shape)
+        diff = j.data - i.data
+        sumd = abs(diff).sum(dtype=float)
+        self.assertEqual(sumd , 0.0)
+
+class testclickedmask(unittest.TestCase):
+    """ A few random clicks to make a test mask """
+
+    def setUp(self):
+        """
+        download images
+        """
+        self.filename = UtilsTest.getimage("fit2d_click.msk.bz2")[:-4]
+        self.edffilename = UtilsTest.getimage("fit2d_click.edf.bz2")[:-4]
+
+    def test_read(self):
+        """ Check it reads a mask OK """
+        i = fit2dmaskimage()
+        i.read(self.filename)
+        self.assertEqual(i.dim1 , 1024)
+        self.assertEqual(i.dim2 , 1024)
+        self.assertEqual(i.bpp , 1)
+        self.assertEqual(i.bytecode, numpy.uint8)
+        self.assertEqual(i.data.shape, (1024, 1024))
+
+    def test_getmatch(self):
+        """ test edf and msk are the same """
+        i = fit2dmaskimage()
+        j = fabio.open(self.edffilename)
+        i.read(self.filename)
+        self.assertEqual(i.data.shape, j.data.shape)
+        diff = j.data - i.data
+        self.assertEqual(i.getmax(), 1)
+        self.assertEqual(i.getmin(), 0)
+        sumd = abs(diff).sum(dtype=float)
+        self.assertEqual(sumd , 0)
+
+
+
+
+
+def test_suite_all_fit2d():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(testfacemask("test_getmatch"))
+    testSuite.addTest(testclickedmask("test_read"))
+    testSuite.addTest(testclickedmask("test_getmatch"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_fit2d()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
+
+
+
diff --git a/test/testheadernotsingleton.py b/test/testheadernotsingleton.py
new file mode 100644
index 0000000..0c234d7
--- /dev/null
+++ b/test/testheadernotsingleton.py
@@ -0,0 +1,63 @@
+#!/usr/bin/python
+# -*- coding: utf8 -*-
+"""
+# Unit tests
+
+# builds on stuff from ImageD11.test.testpeaksearch
+"""
+
+import unittest, sys, os, logging
+logger = logging.getLogger("testheadernotsingleton")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+import shutil
+
+class testheadernotsingleton(unittest.TestCase):
+
+    def setUp(self):
+        """
+        download images
+        """
+        self.file1 = UtilsTest.getimage("mb_LP_1_001.img.bz2")[:-4]
+
+
+    def testheader(self):
+        file2 = self.file1.replace("mb_LP_1_001.img", "mb_LP_1_002.img")
+        self.assertTrue(os.path.exists(self.file1))
+        if not os.path.exists(file2):
+            shutil.copy(self.file1, file2)
+        image1 = fabio.open(self.file1)
+        image2 = fabio.open(file2)
+        self.assertEqual(image1.header['filename'] , self.file1)
+        self.assertEqual(image2.header['filename'] , file2)
+        self.assertNotEqual(image1.header['filename'] ,
+                             image2.header['filename'])
+
+def test_suite_all_header():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(testheadernotsingleton("testheader"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_header()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
diff --git a/test/testkcdimage.py b/test/testkcdimage.py
new file mode 100755
index 0000000..c39bbd6
--- /dev/null
+++ b/test/testkcdimage.py
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+"""
+
+Test for Nonius Kappa CCD cameras.
+
+"""
+
+import unittest, sys, os, logging
+logger = logging.getLogger("testkcdimage")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+from fabio.kcdimage     import kcdimage
+from fabio.edfimage     import edfimage
+from fabio.openimage    import openimage
+
+
+
+class testkcd(unittest.TestCase):
+    """basic test"""
+    kcdfilename = 'i01f0001.kcd'
+    edffilename = 'i01f0001.edf'
+    results = """i01f0001.kcd   625 576  96  66814.0 195.3862972   243.58150990245315"""
+
+
+    def setUp(self):
+        """Download files"""
+        self.kcdfilename = UtilsTest.getimage(self.kcdfilename)
+        self.edffilename = UtilsTest.getimage(self.edffilename)
+
+    def test_read(self):
+        """ check we can read kcd images"""
+        vals = self.results.split()
+        name = vals[0]
+        dim1, dim2 = [int(x) for x in vals[1:3]]
+        mini, maxi, mean, stddev = [float(x) for x in vals[3:]]
+        obj = openimage(os.path.join("testimages", name))
+        self.assertAlmostEqual(mini, obj.getmin(), 4, "getmin")
+        self.assertAlmostEqual(maxi, obj.getmax(), 4, "getmax")
+        self.assertAlmostEqual(mean, obj.getmean(), 4, "getmean")
+        self.assertAlmostEqual(stddev, obj.getstddev(), 4, "getstddev")
+        self.assertEqual(dim1, obj.dim1, "dim1")
+        self.assertEqual(dim2, obj.dim2, "dim2")
+
+
+    def test_same(self):
+        """ see if we can read kcd images and if they are the same as the EDF """
+        kcd = kcdimage()
+        kcd.read(self.kcdfilename)
+        edf = fabio.open(self.edffilename)
+        diff = (kcd.data.astype("int32") - edf.data.astype("int32"))
+        self.assertAlmostEqual(abs(diff).sum(dtype=int), 0, 4)
+
+
+def test_suite_all_kcd():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(testkcd("test_read"))
+    testSuite.addTest(testkcd("test_same"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_kcd()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
diff --git a/test/testmar345image.py b/test/testmar345image.py
new file mode 100644
index 0000000..79bf3d5
--- /dev/null
+++ b/test/testmar345image.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+"""
+# Unit tests
+
+# builds on stuff from ImageD11.test.testpeaksearch
+"""
+import unittest, sys, os, logging
+logger = logging.getLogger("testmar345image")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+from fabio.mar345image import mar345image
+
+# filename dim1 dim2 min max mean stddev
+TESTIMAGES = """example.mar2300     2300 2300 0 999999 180.15 4122.67
+                example.mar2300.bz2 2300 2300 0 999999 180.15 4122.67
+                example.mar2300.gz  2300 2300 0 999999 180.15 4122.67"""
+
+
+class testMAR345(unittest.TestCase):
+    def setUp(self):
+        """
+        download images
+        """
+        self.mar = UtilsTest.getimage("example.mar2300.bz2")[:-4]
+
+    def test_read(self):
+        """
+        Test the reading of Mar345 images 
+        """
+        for line in TESTIMAGES.split('\n'):
+            vals = line.strip().split()
+            name = vals[0]
+            dim1, dim2 = [int(x) for x in vals[1:3]]
+            mini, maxi, mean, stddev = [float(x) for x in vals[3:]]
+            obj = mar345image()
+            obj.read(os.path.join("testimages", name))
+
+            self.assertAlmostEqual(mini, obj.getmin(), 2, "getmin")
+            self.assertAlmostEqual(maxi, obj.getmax(), 2, "getmax")
+            self.assertAlmostEqual(mean, obj.getmean(), 2, "getmean")
+            self.assertAlmostEqual(stddev, obj.getstddev(), 2, "getstddev")
+            self.assertEqual(dim1, obj.dim1, "dim1")
+            self.assertEqual(obj.dim1, obj.dim2, "dim2!=dim1")
+
+
+
+def test_suite_all_mar345():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(testMAR345("test_read"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_mar345()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
diff --git a/test/testmccdimage.py b/test/testmccdimage.py
new file mode 100644
index 0000000..3fdd169
--- /dev/null
+++ b/test/testmccdimage.py
@@ -0,0 +1,109 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+"""
+# Unit tests
+
+# builds on stuff from ImageD11.test.testpeaksearch
+"""
+
+import unittest, sys, os, logging
+logger = logging.getLogger("testmccdimage")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+from fabio.marccdimage import marccdimage
+from fabio.tifimage import tifimage
+import numpy
+
+# statistics come from fit2d I think
+# filename dim1 dim2 min max mean stddev
+TESTIMAGES = """corkcont2_H_0089.mccd      2048 2048  0  354    7.2611 14.639
+                corkcont2_H_0089.mccd.bz2  2048 2048  0  354    7.2611 14.639
+                corkcont2_H_0089.mccd.gz   2048 2048  0  354    7.2611 14.639
+                somedata_0001.mccd         1024 1024  0  20721  128.37 136.23
+                somedata_0001.mccd.bz2     1024 1024  0  20721  128.37 136.23
+                somedata_0001.mccd.gz      1024 1024  0  20721  128.37 136.23"""
+
+class testnormaltifok(unittest.TestCase):
+    """
+    check we can read normal tifs as well as mccd
+    """
+    imdata = None
+    image = 'testimages/tifimagewrite_test0000.tif'
+    def setUp(self):
+        """
+        create an image 
+        """
+        self.imdata = numpy.zeros((24, 24), numpy.uint16)
+        self.imdata[ 12:14, 15:17 ] = 42
+        obj = tifimage(self.imdata, { })
+        obj.write(self.image)
+
+    def test_read_openimage(self):
+        from fabio.openimage import openimage
+        obj = openimage(self.image)
+        if obj.data.astype(int).tostring() != self.imdata.astype(int).tostring():
+            logger.info("%s %s" % (type(self.imdata), self.imdata.dtype))
+            logger.info("%s %s" % (type(obj.data), obj.data.dtype))
+            logger.info("%s %s" % (obj.data - self.imdata))
+        self.assertEqual(obj.data.astype(int).tostring(),
+                          self.imdata.astype(int).tostring())
+
+
+
+
+class testflatmccds(unittest.TestCase):
+    def setUp(self):
+        UtilsTest.getimage("corkcont2_H_0089.mccd.bz2")
+        UtilsTest.getimage("somedata_0001.mccd.bz2")
+
+    def test_read(self):
+        """ check we can read MarCCD images"""
+        for line in TESTIMAGES.split("\n"):
+            vals = line.split()
+            name = vals[0]
+            dim1, dim2 = [int(x) for x in vals[1:3]]
+            mini, maxi, mean, stddev = [float(x) for x in vals[3:]]
+            obj = marccdimage()
+            obj.read(os.path.join("testimages", name))
+            self.assertAlmostEqual(mini, obj.getmin(), 2, "getmin")
+            self.assertAlmostEqual(maxi, obj.getmax(), 2, "getmax")
+            self.assertAlmostEqual(mean, obj.getmean(), 2, "getmean")
+            self.assertAlmostEqual(stddev, obj.getstddev(), 2, "getstddev")
+            self.assertEqual(dim1, obj.dim1, "dim1")
+            self.assertEqual(dim2, obj.dim2, "dim2")
+
+
+
+
+
+def test_suite_all_mccd():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(testnormaltifok("test_read_openimage"))
+    testSuite.addTest(testflatmccds("test_read"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_mccd()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
+
+
diff --git a/test/testopenheader.py b/test/testopenheader.py
new file mode 100644
index 0000000..06e2152
--- /dev/null
+++ b/test/testopenheader.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+"""
+# Unit tests
+"""
+
+import unittest, sys, os, logging
+logger = logging.getLogger("testopenheader")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+from fabio.openimage import openheader
+
+
+class test1(unittest.TestCase):
+    """openheader opening edf"""
+    def setUp(self):
+        self.name = UtilsTest.getimage("F2K_Seb_Lyso0675_header_only.edf.bz2")[:-4]
+
+    def testcase(self):
+        """ check openheader can read edf headers"""
+        for ext in ["", ".bz2", ".gz"]:
+            name = self.name + ext
+            obj = openheader(name)
+            logger.debug(" %s obj = %s" % (name, obj.header))
+            self.assertEqual(obj.header["title"],
+                             "ESPIA FRELON Image",
+                             "Error on file %s" % name)
+
+
+
+def test_suite_all_openheader():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(test1("testcase"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_openheader()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
+
+
diff --git a/test/testopenimage.py b/test/testopenimage.py
new file mode 100644
index 0000000..7bd7c2a
--- /dev/null
+++ b/test/testopenimage.py
@@ -0,0 +1,234 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+"""
+# Unit tests
+
+# builds on stuff from ImageD11.test.testpeaksearch
+"""
+import unittest, sys, os, logging
+logger = logging.getLogger("testopenimage")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+
+from utilstest import UtilsTest
+from fabio.openimage import openimage
+from fabio.edfimage import edfimage
+from fabio.marccdimage import marccdimage
+from fabio.fit2dmaskimage import fit2dmaskimage
+from fabio.OXDimage import OXDimage
+from fabio.brukerimage import brukerimage
+from fabio.adscimage import adscimage
+
+class testopenedf(unittest.TestCase):
+    """openimage opening edf"""
+    fname = "F2K_Seb_Lyso0675.edf.bz2"
+    def setUp(self):
+        self.fname = UtilsTest.getimage(self.__class__.fname)
+
+    def testcase(self):
+        """ check we can read EDF image with openimage"""
+        obj = openimage(self.fname)
+        obj2 = edfimage()
+        obj2.read(self.fname)
+        self.assertEqual(obj.data[10, 10], obj2.data[10, 10])
+        self.assertEqual(type(obj), type(obj2))
+        self.assertEqual(abs(obj.data.astype(int) - obj2.data.astype(int)).sum(), 0)
+
+        # etc
+
+class testedfgz(testopenedf):
+    """openimage opening edf gzip"""
+    fname = "F2K_Seb_Lyso0675.edf.gz"
+
+
+class testedfbz2(testopenedf):
+    """openimage opening edf bzip"""
+    fname = "F2K_Seb_Lyso0675.edf.bz2"
+
+
+
+class testopenmccd(unittest.TestCase):
+    """openimage opening mccd"""
+    fname = "somedata_0001.mccd"
+    def setUp(self):
+        self.fname = UtilsTest.getimage(self.__class__.fname)
+    def testcase(self):
+        """ check we can read it"""
+        obj = openimage(self.fname)
+        obj2 = marccdimage()
+        obj2.read(self.fname)
+        self.assertEqual(obj.data[10, 10], obj2.data[10, 10])
+        self.assertEqual(type(obj), type(obj2))
+        self.assertEqual(abs(obj.data.astype(int) - obj2.data.astype(int)).sum(), 0)
+
+        # etc
+
+class testmccdgz(testopenmccd):
+    """openimage opening mccd gzip"""
+    fname = "somedata_0001.mccd.gz"
+
+
+class testmccdbz2(testopenmccd):
+    """openimage opening mccd bzip"""
+    fname = "somedata_0001.mccd.bz2"
+
+
+
+
+
+class testmask(unittest.TestCase):
+    """openimage opening mccd"""
+    fname = "face.msk"
+    def setUp(self):
+        """ check file exists """
+        self.fname = UtilsTest.getimage(self.__class__.fname)
+
+    def testcase(self):
+        """ check we can read Fit2D mask with openimage"""
+        obj = openimage(self.fname)
+        obj2 = fit2dmaskimage()
+        obj2.read(self.fname)
+        self.assertEqual(obj.data[10, 10], obj2.data[10, 10])
+        self.assertEqual(type(obj), type(obj2))
+        self.assertEqual(abs(obj.data.astype(int) - obj2.data.astype(int)).sum(), 0)
+        self.assertEqual(abs(obj.data.astype(int) - obj2.data.astype(int)).sum(), 0)
+        # etc
+
+class testmaskgz(testmask):
+    """openimage opening mccd gzip"""
+    fname = "face.msk.gz"
+
+class testmaskbz2(testmask):
+    """openimage opening mccd bzip"""
+    fname = "face.msk.bz2"
+
+
+
+
+
+class testbruker(unittest.TestCase):
+    """openimage opening bruker"""
+    fname = "Cr8F8140k103.0026"
+    def setUp(self):
+        self.fname = UtilsTest.getimage(self.__class__.fname)
+    def testcase(self):
+        """ check we can read it"""
+        obj = openimage(self.fname)
+        obj2 = brukerimage()
+        obj2.read(self.fname)
+        self.assertEqual(obj.data[10, 10], obj2.data[10, 10])
+        self.assertEqual(type(obj), type(obj2))
+        self.assertEqual(abs(obj.data.astype(int) - obj2.data.astype(int)).sum(), 0)
+        # etc
+
+class testbrukergz(testbruker):
+    """openimage opening bruker gzip"""
+    fname = "Cr8F8140k103.0026.gz"
+
+class testbrukerbz2(testbruker):
+    """openimage opening bruker bzip"""
+    fname = "Cr8F8140k103.0026.bz2"
+
+
+
+
+class testadsc(unittest.TestCase):
+    """openimage opening adsc"""
+    fname = os.path.join("testimages", "mb_LP_1_001.img")
+    def setUp(self):
+        self.fname = UtilsTest.getimage("mb_LP_1_001.img.bz2")
+    def testcase(self):
+        """ check we can read it"""
+        obj = openimage(self.fname)
+        obj2 = adscimage()
+        obj2.read(self.fname)
+        self.assertEqual(obj.data[10, 10], obj2.data[10, 10])
+        self.assertEqual(type(obj), type(obj2))
+        self.assertEqual(abs(obj.data.astype(int) - obj2.data.astype(int)).sum(), 0)
+        # etc
+
+class testadscgz(testadsc):
+    """openimage opening adsc gzip"""
+    fname = os.path.join("testimages", "mb_LP_1_001.img.gz")
+
+class testadscbz2(testadsc):
+    """openimage opening adsc bzip"""
+    fname = os.path.join("testimages", "mb_LP_1_001.img.bz2")
+
+
+
+
+
+class testOXD(unittest.TestCase):
+    """openimage opening adsc"""
+    fname = "b191_1_9_1.img.bz2"
+    def setUp(self):
+        self.fname = UtilsTest.getimage(self.__class__.fname)[:-4]
+    def testcase(self):
+        """ check we can read OXD images with openimage"""
+        obj = openimage(self.fname)
+        obj2 = OXDimage()
+        obj2.read(self.fname)
+        self.assertEqual(obj.data[10, 10], obj2.data[10, 10])
+        self.assertEqual(type(obj), type(obj2))
+        self.assertEqual(abs(obj.data.astype(int) - obj2.data.astype(int)).sum(), 0)
+        # etc
+
+
+class testOXDUNC(testOXD):
+    """openimage opening oxd"""
+    fname = "b191_1_9_1_uncompressed.img.bz2"
+    def setUp(self):
+        self.fname = UtilsTest.getimage(self.__class__.fname)[:-4]
+
+
+def test_suite_all_openimage():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(testedfbz2("testcase"))
+    testSuite.addTest(testopenedf("testcase"))
+    testSuite.addTest(testedfgz("testcase"))
+
+    testSuite.addTest(testmccdbz2("testcase"))
+    testSuite.addTest(testopenmccd("testcase"))
+    testSuite.addTest(testmccdgz("testcase"))
+
+    testSuite.addTest(testmaskbz2("testcase"))
+    testSuite.addTest(testmask("testcase"))
+    testSuite.addTest(testmaskgz("testcase"))
+
+    testSuite.addTest(testbrukerbz2("testcase"))
+    testSuite.addTest(testbruker("testcase"))
+    testSuite.addTest(testbrukergz("testcase"))
+
+    testSuite.addTest(testadscbz2("testcase"))
+    testSuite.addTest(testadsc("testcase"))
+    testSuite.addTest(testadscgz("testcase"))
+
+    testSuite.addTest(testOXD("testcase"))
+    testSuite.addTest(testOXDUNC("testcase"))
+
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_openimage()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
diff --git a/test/testtifgz.py b/test/testtifgz.py
new file mode 100644
index 0000000..a12558b
--- /dev/null
+++ b/test/testtifgz.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+"""
+#gipped Tiff Unit tests
+
+#built on testedfimage
+"""
+
+import unittest, sys, os, logging
+logger = logging.getLogger("testtifgz")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+
+
+class testgziptif(unittest.TestCase):
+    def setUp(self):
+        self.unzipped = UtilsTest.getimage("oPPA_5grains_0001.tif.bz2")[:-4]
+        self.zipped = self.unzipped + ".gz"
+        assert os.path.exists(self.zipped)
+        assert os.path.exists(self.unzipped)
+
+    def test1(self):
+        o1 = fabio.open(self.zipped)
+        o2 = fabio.open(self.unzipped)
+        self.assertEqual(o1.data[0, 0], 10)
+        self.assertEqual(o2.data[0, 0], 10)
+
+
+class testtif_rect(unittest.TestCase):
+    def setUp(self):
+        self.fn = UtilsTest.getimage("testmap1_0002.tif.bz2")[:-4]
+
+    def test1(self):
+        for ext in ["", ".gz", ".bz2"]:
+            o1 = fabio.open(self.fn + ext)
+            self.assertEqual(o1.data.shape, (100, 120))
+
+
+def test_suite_all_tiff():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(testgziptif("test1"))
+    testSuite.addTest(testtif_rect("test1"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_tiff()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
diff --git a/test/testtifimage.py b/test/testtifimage.py
new file mode 100755
index 0000000..a1bba9a
--- /dev/null
+++ b/test/testtifimage.py
@@ -0,0 +1,134 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+"""
+# Tiff Unit tests
+
+#built on testedfimage
+"""
+
+import unittest
+import os
+import logging
+import sys
+logger = logging.getLogger("testTiff")
+force_build = False
+
+for opts in sys.argv[:]:
+    if opts in ["-d", "--debug"]:
+        logging.basicConfig(level=logging.DEBUG)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-i", "--info"]:
+        logging.basicConfig(level=logging.INFO)
+        sys.argv.pop(sys.argv.index(opts))
+    elif opts in ["-f", "--force"]:
+        force_build = True
+        sys.argv.pop(sys.argv.index(opts))
+try:
+    logger.debug("Tests loaded from file: %s" % __file__)
+except:
+    __file__ = os.getcwd()
+
+from utilstest import UtilsTest
+if force_build:
+    UtilsTest.forceBuild()
+import fabio
+from testtifgz import testtif_rect, testgziptif
+
+class testtifimage_pilatus(unittest.TestCase):
+    def setUp(self):
+        UtilsTest.getimage("pilatus2M.tif.bz2")
+        UtilsTest.getimage("pilatus2M.edf.bz2")
+
+        self.tif = os.path.join("testimages",
+                                   "pilatus2M.tif")
+        self.edf = os.path.join("testimages",
+                                     "pilatus2M.edf")
+        assert os.path.exists(self.tif)
+        assert os.path.exists(self.edf)
+
+    def test1(self):
+        """
+        Testing pilatus tif bug
+        """
+        o1 = fabio.open(self.tif).data
+        o2 = fabio.open(self.edf).data
+        self.assertEqual(abs(o1 - o2).max(), 0.0)
+
+class testtifimage_packbits(unittest.TestCase):
+    def setUp(self):
+        UtilsTest.getimage("oPPA_5grains_0001.tif.bz2")
+        UtilsTest.getimage("oPPA_5grains_0001.edf.bz2")
+
+        self.tif = os.path.join("testimages",
+                                   "oPPA_5grains_0001.tif")
+        self.edf = os.path.join("testimages",
+                                     "oPPA_5grains_0001.edf")
+        assert os.path.exists(self.tif)
+        assert os.path.exists(self.edf)
+
+    def test1(self):
+        """
+        Testing packbit comressed data tif bug
+        """
+        o1 = fabio.open(self.tif).data
+        o2 = fabio.open(self.edf).data
+        self.assertEqual(abs(o1 - o2).max(), 0.0)
+
+class testtifimage_fit2d(unittest.TestCase):
+    def setUp(self):
+        UtilsTest.getimage("fit2d.tif.bz2")
+        UtilsTest.getimage("fit2d.edf.bz2")
+
+        self.tif = os.path.join("testimages",
+                                   "fit2d.tif")
+        self.edf = os.path.join("testimages",
+                                     "fit2d.edf")
+        assert os.path.exists(self.tif)
+        assert os.path.exists(self.edf)
+
+    def test1(self):
+        """
+        Testing packbit comressed data tif bug
+        """
+        o1 = fabio.open(self.tif).data
+        o2 = fabio.open(self.edf).data
+        self.assertEqual(abs(o1 - o2).max(), 0.0)
+
+class testtifimage_a0009(unittest.TestCase):
+    """
+    test image from ??? with this error 
+a0009.tif TIFF 1024x1024 1024x1024+0+0 16-bit Grayscale DirectClass 2MiB 0.000u 0:00.010
+identify: a0009.tif: invalid TIFF directory; tags are not sorted in ascending order. `TIFFReadDirectory' @ tiff.c/TIFFWarnings/703.
+identify: a0009.tif: TIFF directory is missing required "StripByteCounts" field, calculating from imagelength. `TIFFReadDirectory' @ tiff.c/TIFFWarnings/703.
+
+    """
+    def setUp(self):
+        self.tif = UtilsTest.getimage("a0009.tif.bz2")[:-4]
+        self.edf = UtilsTest.getimage("a0009.edf.bz2")[:-4]
+        logger.warning("files %s %s ", self.tif, self.edf)
+        assert os.path.exists(self.tif)
+        assert os.path.exists(self.edf)
+
+    def test1(self):
+        """
+        Testing packbit comressed data tif bug
+        """
+        o1 = fabio.open(self.tif).data
+        o2 = fabio.open(self.edf).data
+        self.assertEqual(abs(o1 - o2).max(), 0.0)
+
+
+def test_suite_all_tiffimage():
+    testSuite = unittest.TestSuite()
+    testSuite.addTest(testtifimage_packbits("test1"))
+    testSuite.addTest(testtifimage_pilatus("test1"))
+    testSuite.addTest(testtifimage_fit2d("test1"))
+    testSuite.addTest(testgziptif("test1"))
+    testSuite.addTest(testtif_rect("test1"))
+    testSuite.addTest(testtifimage_a0009("test1"))
+    return testSuite
+
+if __name__ == '__main__':
+    mysuite = test_suite_all_tiffimage()
+    runner = unittest.TextTestRunner()
+    runner.run(mysuite)
diff --git a/test/utilstest.py b/test/utilstest.py
new file mode 100644
index 0000000..0f53548
--- /dev/null
+++ b/test/utilstest.py
@@ -0,0 +1,180 @@
+# coding: utf8
+#
+#    Project: Fabio tests class utilities
+#             http://www.edna-site.org
+#
+#    File: "$Id:$"
+#
+#    Copyright (C) 2010 European Synchrotron Radiation Facility
+#                       Grenoble, France
+#
+#    Principal authors: Jérôme KIEFFER (jerome.kieffer at esrf.fr)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the Lesser GNU General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+__authors__ = ["Jérôme Kieffer"]
+__contact__ = "jerome.kieffer at esrf.eu"
+__license__ = "LGPLv3+"
+__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
+
+import os, imp, sys, subprocess, threading
+import distutils.util
+import logging
+import bz2
+import gzip
+if sys.version_info >= (3, 0):
+    import urllib as urllib2
+else:
+    import urllib2
+
+logger = logging.getLogger("utilstest")
+
+class UtilsTest(object):
+    """
+    Static class providing useful stuff for preparing tests.
+    """
+    timeout = 60        #timeout in seconds for downloading images
+    url_base = "http://downloads.sourceforge.net/fable"
+    test_home = os.path.dirname(os.path.abspath(__file__))
+    name = "fabio"
+    image_home = os.path.join(test_home, "testimages")
+    if not os.path.isdir(image_home):
+        os.makedirs(image_home)
+    platform = distutils.util.get_platform()
+    architecture = "lib.%s-%i.%i" % (platform,
+                                    sys.version_info[0], sys.version_info[1])
+    fabio_home = os.path.join(os.path.dirname(test_home),
+                                        "build", architecture)
+    logger.info("Fabio Home is: " + fabio_home)
+    if "fabio" in sys.modules:
+        logger.info("Fabio module was already loaded from  %s" % sys.modules["fabio"])
+        fabio = None
+        sys.modules.pop("fabio")
+    if not os.path.isdir(fabio_home):
+        logger.warning("Building Fabio to %s" % fabio_home)
+        p = subprocess.Popen([sys.executable, "setup.py", "build"],
+                         shell=False, cwd=os.path.dirname(test_home))
+        logger.info("subprocess ended with rc= %s" % p.wait())
+
+    fabio = imp.load_module(*((name,) + imp.find_module(name, [fabio_home])))
+    sys.modules[name] = fabio
+    logging.info("pyFAI loaded from %s" % fabio.__file__)
+
+    @classmethod
+    def forceBuild(cls):
+        """
+        force the recompilation of Fabio
+        """
+        logger.info("Building Fabio to %s" % cls.fabio_home)
+        p = subprocess.Popen([sys.executable, "setup.py", "build"],
+                         shell=False, cwd=os.path.dirname(cls.test_home))
+        logger.info("subprocess ended with rc= %s" % p.wait())
+        fabio = imp.load_module(*((cls.name,) + imp.find_module(cls.name, [cls.fabio_home])))
+        sys.modules[cls.name] = fabio
+        logger.info("fabio loaded from %s" % fabio.__file__)
+
+
+
+    @classmethod
+    def timeoutDuringDownload(cls):
+        """
+        Function called after a timeout in the download part ... 
+        just raise an Exception.
+        """
+        raise RuntimeError("""Could not automatically download test images!
+If you are behind a firewall, please set the environment variable http_proxy.
+Otherwise please try to download the images manually from
+""" + cls.url_base)
+
+
+    @classmethod
+    def getimage(cls, imagename):
+        """
+        Downloads the requested image
+        @return:  path of the image, locally
+        """
+        logger.info("UtilsTest.getimage('%s')" % imagename)
+        fullimagename = os.path.join(cls.image_home, imagename)
+        if not os.path.isfile(fullimagename):
+            logger.info("Trying to download image %s, timeout set to %ss"
+                          % (imagename, cls.timeout))
+            if "http_proxy" in os.environ:
+                dictProxies = {'http': os.environ["http_proxy"]}
+                proxy_handler = urllib2.ProxyHandler(dictProxies)
+                opener = urllib2.build_opener(proxy_handler).open
+            else:
+                opener = urllib2.urlopen
+
+#           Nota: since python2.6 there is a timeout in the urllib2
+            timer = threading.Timer(cls.timeout + 1, cls.timeoutDuringDownload)
+            timer.start()
+            logger.info("wget %s/%s" % (cls.url_base, imagename))
+            if sys.version > (2, 6):
+                data = opener("%s/%s" % (cls.url_base, imagename),
+                              data=None, timeout=cls.timeout).read()
+            else:
+                data = opener("%s/%s" % (cls.url_base, imagename),
+                              data=None).read()
+            timer.cancel()
+            logger.info("Image %s successfully downloaded." % imagename)
+
+            try:
+                open(fullimagename, "wb").write(data)
+            except IOError:
+                raise IOError("unable to write downloaded \
+                    data to disk at %s" % cls.image_home)
+
+            if not os.path.isfile(fullimagename):
+                raise RuntimeError("Could not automatically \
+                download test images %s!\n \ If you are behind a firewall, \
+                please set the environment variable http_proxy.\n \
+                Otherwise please try to download the images manually from \n \
+                %s" % (cls.url_base, imagename))
+
+            if imagename.endswith(".bz2"):
+                decompressed = bz2.decompress(data)
+                basename = fullimagename[:-4]
+            elif imagename.endswith(".gz"):
+                decompressed = gzip.open(fullimagename).read()
+                basename = fullimagename[:-3]
+            else:
+                decompressed = data
+                basename = fullimagename
+
+            gzipname = basename + ".gz"
+            bzip2name = basename + ".bz2"
+
+            if basename != fullimagename:
+                try:
+                    open(basename, "wb").write(decompressed)
+                except IOError:
+                    raise IOError("unable to write decompressed \
+                    data to disk at %s" % cls.image_home)
+            if gzipname != fullimagename:
+                try:
+                    gzip.open(gzipname, "wb").write(decompressed)
+                except IOError:
+                    raise IOError("unable to write gzipped \
+                    data to disk at %s" % cls.image_home)
+            if bzip2name != fullimagename:
+                try:
+                    bz2.BZ2File(bzip2name, "wb").write(decompressed)
+                except IOError:
+                    raise IOError("unable to write bzipped2 \
+                    data to disk at %s" % cls.image_home)
+        return fullimagename
+
+
+
diff --git a/test/win32_benchheaders b/test/win32_benchheaders
new file mode 100644
index 0000000..d8c759d
--- /dev/null
+++ b/test/win32_benchheaders
@@ -0,0 +1,46 @@
+  0.002363 testimages\Cr8F8140k103.0026
+  0.066067 testimages\Cr8F8140k103.0026.bz2
+  0.001853 testimages\Cr8F8140k103.0026.gz
+  0.002819 testimages\F2K_Seb_Lyso0675.edf
+  0.121077 testimages\F2K_Seb_Lyso0675.edf.bz2
+  0.002366 testimages\F2K_Seb_Lyso0675.edf.gz
+  0.001428 testimages\GE_aSI_detector_image_1529
+  0.082350 testimages\GE_aSI_detector_image_1529.bz2
+  0.003077 testimages\GE_aSI_detector_image_1529.gz
+  0.000956 testimages\b191_1_9_1.img
+  0.096141 testimages\b191_1_9_1.img.bz2
+  0.002030 testimages\b191_1_9_1.img.gz
+  0.001849 testimages\b191_1_9_1_uncompressed.img
+  0.107067 testimages\b191_1_9_1_uncompressed.img.bz2
+  0.001737 testimages\b191_1_9_1_uncompressed.img.gz
+  0.001170 testimages\corkcont2_H_0089.mccd
+  0.091742 testimages\corkcont2_H_0089.mccd.bz2
+  0.002270 testimages\corkcont2_H_0089.mccd.gz
+  0.001537 testimages\example.mar2300
+  0.257166 testimages\example.mar2300.bz2
+  0.002286 testimages\example.mar2300.gz
+  0.001194 testimages\face.edf
+  0.002741 testimages\face.edf.bz2
+  0.003132 testimages\face.edf.gz
+  0.000567 testimages\face.msk
+  0.001318 testimages\face.msk.bz2
+  0.000881 testimages\face.msk.gz
+  0.001576 testimages\fit2d_click.edf
+  0.002984 testimages\fit2d_click.edf.bz2
+  0.016475 testimages\fit2d_click.edf.gz
+  0.000976 testimages\fit2d_click.msk
+  0.000984 testimages\fit2d_click.msk.bz2
+  0.003222 testimages\fit2d_click.msk.gz
+  0.062191 testimages\mb_LP_1_001.img
+  1.668834 testimages\mb_LP_1_001.img.bz2
+  0.181976 testimages\mb_LP_1_001.img.gz
+  0.058940 testimages\mb_LP_1_002.img
+  0.000631 testimages\oPPA_5grains_0001.tif
+  0.028324 testimages\oPPA_5grains_0001.tif.bz2
+  0.004554 testimages\oPPA_5grains_0001.tif.gz
+  0.000595 testimages\somedata_0001.mccd
+  0.113065 testimages\somedata_0001.mccd.bz2
+  0.001092 testimages\somedata_0001.mccd.gz
+  0.000538 testimages\testmap1_0002.tif
+  0.000787 testimages\testmap1_0002.tif.bz2
+  0.001096 testimages\testmap1_0002.tif.gz
diff --git a/test/win32_benchmark b/test/win32_benchmark
new file mode 100644
index 0000000..6fe2c51
--- /dev/null
+++ b/test/win32_benchmark
@@ -0,0 +1,3285 @@
+I/O 1  : Time to read the image
+I/O 2  : Time to read the image (repeat
+Fabio  : Time for fabio to read the image
+Shell  : Time for shell to do decompression
+Python : Time for python to do decompression
+
+I/O 1  I/O 2  Fabio  Shell  Python   Size/MB
+0.0025 0.0020 0.0095                   0.508 testimages\Cr8F8140k103.0026
+Mon Mar 16 12:20:12 2009    stats
+
+         637 function calls in 0.011 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.011    0.011 <string>:1(<module>)
+        1    0.001    0.001    0.002    0.002 brukerimage.py:35(_readheader)
+        1    0.000    0.000    0.010    0.010 brukerimage.py:84(read)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.011    0.011 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        1    0.000    0.000    0.005    0.005 readbytestream.py:27(readbytestream)
+        2    0.000    0.000    0.000    0.000 {getattr}
+        6    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        4    0.000    0.000    0.000    0.000 {max}
+       80    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.003    0.003    0.003    0.003 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+      127    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+       92    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        6    0.002    0.000    0.002    0.000 {method 'read' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+       92    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+      184    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.001    0.001    0.001    0.001 {numpy.core.multiarray.array}
+        1    0.001    0.001    0.001    0.001 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+        1    0.000    0.000    0.000    0.000 {range}
+
+
+0.0012 0.0009 0.1342 0.1880 0.0778     0.508 testimages\Cr8F8140k103.0026.bz2
+Mon Mar 16 12:20:14 2009    stats
+
+         637 function calls in 0.137 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.137    0.137 <string>:1(<module>)
+        1    0.002    0.002    0.054    0.054 brukerimage.py:35(_readheader)
+        1    0.000    0.000    0.083    0.083 brukerimage.py:84(read)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.001 fabioimage.py:284(_open)
+        2    0.001    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.137    0.137 openimage.py:68(openimage)
+        1    0.000    0.000    0.054    0.054 openimage.py:94(_openimage)
+        1    0.000    0.000    0.025    0.025 readbytestream.py:27(readbytestream)
+        2    0.000    0.000    0.000    0.000 {getattr}
+        6    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        4    0.000    0.000    0.000    0.000 {max}
+       80    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.003    0.003    0.003    0.003 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+      127    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+       92    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        6    0.126    0.021    0.126    0.021 {method 'read' of 'bz2.BZ2File' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'seek' of 'bz2.BZ2File' objects}
+       92    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+      184    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'tell' of 'bz2.BZ2File' objects}
+        1    0.001    0.001    0.001    0.001 {numpy.core.multiarray.array}
+        1    0.002    0.002    0.002    0.002 {numpy.core.multiarray.fromstring}
+        1    0.000    0.000    0.000    0.000 {range}
+
+
+0.0015 0.0011 0.0306 0.1250 0.0194     0.508 testimages\Cr8F8140k103.0026.gz
+Mon Mar 16 12:20:14 2009    stats
+
+         814 function calls in 0.032 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.032    0.032 <string>:1(<module>)
+        1    0.001    0.001    0.003    0.003 brukerimage.py:35(_readheader)
+        1    0.000    0.000    0.030    0.030 brukerimage.py:84(read)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        7    0.002    0.000    0.021    0.003 gzip.py:208(read)
+       12    0.000    0.000    0.019    0.002 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       12    0.005    0.000    0.006    0.000 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:360(tell)
+        1    0.000    0.000    0.000    0.000 gzip.py:374(seek)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        2    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.032    0.032 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        1    0.000    0.000    0.024    0.024 readbytestream.py:27(readbytestream)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+       12    0.011    0.001    0.011    0.001 {built-in method decompress}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        6    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+       25    0.000    0.000    0.000    0.000 {len}
+        2    0.000    0.000    0.000    0.000 {max}
+       80    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.003    0.003    0.003    0.003 {method 'astype' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+      127    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+       92    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       58    0.001    0.000    0.001    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        6    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+       92    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+      184    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+        4    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       12    0.000    0.000    0.000    0.000 {min}
+        1    0.002    0.002    0.002    0.002 {numpy.core.multiarray.array}
+        1    0.002    0.002    0.002    0.002 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+        4    0.000    0.000    0.000    0.000 {ord}
+        2    0.000    0.000    0.000    0.000 {range}
+       14    0.001    0.000    0.001    0.000 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0350 0.0294 0.0529                   8.003 testimages\F2K_Seb_Lyso0675.edf
+Mon Mar 16 12:20:14 2009    stats
+
+         624 function calls in 0.052 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.001    0.001    0.052    0.052 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.002    0.002    0.002    0.002 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.049    0.049 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.051    0.051 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        1    0.000    0.000    0.000    0.000 {apply}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+       10    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+       90    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      180    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+        8    0.027    0.003    0.027    0.003 {method 'read' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+      180    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+       91    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.019    0.019    0.019    0.019 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+
+
+0.0102 0.0091 1.3386 1.6250 1.2248     8.003 testimages\F2K_Seb_Lyso0675.edf.bz2
+Mon Mar 16 12:20:20 2009    stats
+
+         624 function calls in 1.319 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.001    0.001    1.319    1.319 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.001    0.001    0.061    0.061 edfimage.py:55(_readheader)
+        1    0.000    0.000    1.252    1.252 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.001    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    1.318    1.318 openimage.py:68(openimage)
+        1    0.001    0.001    0.065    0.065 openimage.py:94(_openimage)
+        1    0.000    0.000    0.000    0.000 {apply}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+       10    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+       90    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.001    0.001    0.001    0.001 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      180    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+        8    1.301    0.163    1.301    0.163 {method 'read' of 'bz2.BZ2File' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+      180    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+       91    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.012    0.012    0.012    0.012 {numpy.core.multiarray.fromstring}
+
+
+0.0115 0.0139 0.2080 0.3750 0.1809     8.003 testimages\F2K_Seb_Lyso0675.edf.gz
+Mon Mar 16 12:20:20 2009    stats
+
+         841 function calls in 0.209 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.001    0.001    0.209    0.209 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.002    0.002    0.003    0.003 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.206    0.206 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        8    0.002    0.000    0.189    0.024 gzip.py:208(read)
+       17    0.001    0.000    0.187    0.011 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       16    0.032    0.002    0.044    0.003 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        2    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.208    0.208 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.000    0.000 {apply}
+       16    0.125    0.008    0.125    0.008 {built-in method decompress}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+       43    0.000    0.000    0.000    0.000 {len}
+        2    0.000    0.000    0.000    0.000 {max}
+       90    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      180    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+       68    0.018    0.000    0.018    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+      180    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+       91    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       16    0.000    0.000    0.000    0.000 {min}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.014    0.014    0.014    0.014 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+        4    0.000    0.000    0.000    0.000 {ord}
+       18    0.011    0.001    0.011    0.001 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0174 0.0233 0.0333                   8.008 testimages\GE_aSI_detector_image_1529
+Mon Mar 16 12:20:20 2009    stats
+
+         475 function calls in 0.039 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.001    0.001    0.039    0.039 <string>:1(<module>)
+        1    0.001    0.001    0.002    0.002 GEimage.py:183(_readheader)
+        1    0.000    0.000    0.038    0.038 GEimage.py:196(read)
+        1    0.000    0.000    0.000    0.000 GEimage.py:211(_makeframename)
+        1    0.001    0.001    0.035    0.035 GEimage.py:217(_readframe)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.038    0.038 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+      130    0.000    0.000    0.001    0.000 struct.py:77(unpack)
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        4    0.000    0.000    0.000    0.000 {max}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      157    0.022    0.000    0.022    0.000 {method 'read' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+      130    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        1    0.012    0.012    0.012    0.012 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+
+
+0.0047 0.0043 1.0045 1.3290 0.9405     8.008 testimages\GE_aSI_detector_image_1529.bz2
+Mon Mar 16 12:20:24 2009    stats
+
+         477 function calls in 1.016 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.001    0.001    1.016    1.016 <string>:1(<module>)
+        1    0.001    0.001    0.002    0.002 GEimage.py:183(_readheader)
+        1    0.000    0.000    0.970    0.970 GEimage.py:196(read)
+        1    0.000    0.000    0.000    0.000 GEimage.py:211(_makeframename)
+        1    0.001    0.001    0.028    0.028 GEimage.py:217(_readframe)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.001    0.000    0.939    0.470 fabioimage.py:284(_open)
+        2    0.001    0.000    0.938    0.469 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    1.015    1.015 openimage.py:68(openimage)
+        1    0.001    0.001    0.045    0.045 openimage.py:94(_openimage)
+      130    0.001    0.000    0.001    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        4    0.000    0.000    0.000    0.000 {max}
+        1    0.001    0.001    0.001    0.001 {method 'close' of 'cStringIO.StringI' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    0.982    0.491    0.982    0.491 {method 'read' of 'bz2.BZ2File' objects}
+      156    0.015    0.000    0.015    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+      130    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        1    0.012    0.012    0.012    0.012 {numpy.core.multiarray.fromstring}
+
+
+0.0079 0.0071 0.2199 0.3750 0.1330     8.008 testimages\GE_aSI_detector_image_1529.gz
+Mon Mar 16 12:20:26 2009    stats
+
+         683 function calls in 0.166 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.001    0.001    0.166    0.166 <string>:1(<module>)
+        1    0.001    0.001    0.002    0.002 GEimage.py:183(_readheader)
+        1    0.000    0.000    0.165    0.165 GEimage.py:196(read)
+        1    0.000    0.000    0.000    0.000 GEimage.py:211(_makeframename)
+        1    0.001    0.001    0.026    0.026 GEimage.py:217(_readframe)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.136    0.068 fabioimage.py:284(_open)
+        2    0.000    0.000    0.136    0.068 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        2    0.001    0.001    0.136    0.068 gzip.py:208(read)
+       14    0.000    0.000    0.135    0.010 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       13    0.033    0.003    0.044    0.003 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.000    0.000 gzip.py:60(__init__)
+        2    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.166    0.166 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+      132    0.001    0.000    0.001    0.000 struct.py:77(unpack)
+       13    0.082    0.006    0.082    0.006 {built-in method decompress}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+       27    0.000    0.000    0.000    0.000 {len}
+        2    0.000    0.000    0.000    0.000 {max}
+        1    0.001    0.001    0.001    0.001 {method 'close' of 'cStringIO.StringI' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      156    0.014    0.000    0.014    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       77    0.008    0.000    0.008    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        7    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+      132    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       13    0.000    0.000    0.000    0.000 {min}
+        1    0.011    0.011    0.011    0.011 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+        4    0.000    0.000    0.000    0.000 {ord}
+       15    0.011    0.001    0.011    0.001 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0017 0.0007 0.8216                   0.256 testimages\b191_1_9_1.img
+Mon Mar 16 12:20:28 2009    stats
+
+         128 function calls in 0.758 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.758    0.758 <string>:1(<module>)
+        1    0.743    0.743    0.757    0.757 OXDimage.py:145(read)
+        1    0.001    0.001    0.001    0.001 OXDimage.py:27(_readheader)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.758    0.758 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        2    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+        2    0.003    0.002    0.003    0.002 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.002    0.002    0.002    0.002 {method 'copy' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        9    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        8    0.001    0.000    0.001    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'readline' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+       46    0.001    0.000    0.001    0.000 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+        1    0.006    0.006    0.006    0.006 {range}
+
+
+0.0179 0.0004 0.7436 0.0930 0.0380     0.256 testimages\b191_1_9_1.img.bz2
+Mon Mar 16 12:20:28 2009    stats
+
+         128 function calls in 0.773 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.773    0.773 <string>:1(<module>)
+        1    0.657    0.657    0.740    0.740 OXDimage.py:145(read)
+        1    0.001    0.001    0.066    0.066 OXDimage.py:27(_readheader)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.001 fabioimage.py:284(_open)
+        2    0.001    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.773    0.773 openimage.py:68(openimage)
+        1    0.000    0.000    0.032    0.032 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        2    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+        2    0.003    0.001    0.003    0.001 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.002    0.002    0.002    0.002 {method 'copy' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        9    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        8    0.037    0.005    0.037    0.005 {method 'read' of 'bz2.BZ2File' objects}
+        6    0.034    0.006    0.034    0.006 {method 'readline' of 'bz2.BZ2File' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        3    0.031    0.010    0.031    0.010 {method 'seek' of 'bz2.BZ2File' objects}
+        2    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+       46    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        1    0.006    0.006    0.006    0.006 {range}
+
+
+0.0141 0.0004 0.6509 0.0620 0.0056     0.256 testimages\b191_1_9_1.img.gz
+Mon Mar 16 12:20:30 2009    stats
+
+         394 function calls in 0.660 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.660    0.660 <string>:1(<module>)
+        1    0.642    0.642    0.659    0.659 OXDimage.py:145(read)
+        1    0.001    0.001    0.002    0.002 OXDimage.py:27(_readheader)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        3    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        3    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+       22    0.001    0.000    0.006    0.000 gzip.py:208(read)
+        6    0.000    0.000    0.000    0.000 gzip.py:240(_unread)
+       11    0.000    0.000    0.006    0.001 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       11    0.001    0.000    0.001    0.000 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        1    0.000    0.000    0.000    0.000 gzip.py:363(rewind)
+        3    0.000    0.000    0.000    0.000 gzip.py:374(seek)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        6    0.000    0.000    0.001    0.000 gzip.py:391(readline)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        2    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.660    0.660 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+       11    0.003    0.000    0.003    0.000 {built-in method decompress}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+       45    0.000    0.000    0.000    0.000 {len}
+        2    0.000    0.000    0.000    0.000 {max}
+       10    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        2    0.002    0.001    0.002    0.001 {method 'astype' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.002    0.002    0.002    0.002 {method 'copy' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       19    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       70    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        9    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       16    0.000    0.000    0.000    0.000 {min}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+       46    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+        6    0.000    0.000    0.000    0.000 {ord}
+        4    0.006    0.001    0.006    0.001 {range}
+       14    0.000    0.000    0.000    0.000 {zlib.crc32}
+        3    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0024 0.0024 0.0064                   1.005 testimages\b191_1_9_1_uncompressed.img
+Mon Mar 16 12:20:30 2009    stats
+
+         120 function calls in 0.007 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.007    0.007 <string>:1(<module>)
+        1    0.000    0.000    0.006    0.006 OXDimage.py:145(read)
+        1    0.000    0.000    0.000    0.000 OXDimage.py:27(_readheader)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.007    0.007 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        1    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+        1    0.002    0.002    0.002    0.002 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        9    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        7    0.001    0.000    0.001    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'readline' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+       45    0.001    0.000    0.001    0.000 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+
+
+0.0021 0.0005 0.1782 0.1870 0.1076     1.005 testimages\b191_1_9_1_uncompressed.img.bz2
+Mon Mar 16 12:20:32 2009    stats
+
+         120 function calls in 0.178 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.178    0.178 <string>:1(<module>)
+        1    0.000    0.000    0.142    0.142 OXDimage.py:145(read)
+        1    0.000    0.000    0.071    0.071 OXDimage.py:27(_readheader)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.001    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.178    0.178 openimage.py:68(openimage)
+        1    0.001    0.001    0.036    0.036 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        1    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+        1    0.001    0.001    0.001    0.001 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        9    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        7    0.102    0.015    0.102    0.015 {method 'read' of 'bz2.BZ2File' objects}
+        6    0.035    0.006    0.035    0.006 {method 'readline' of 'bz2.BZ2File' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        3    0.036    0.012    0.036    0.012 {method 'seek' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+       45    0.002    0.000    0.002    0.000 {numpy.core.multiarray.fromstring}
+
+
+0.0030 0.0009 0.0189 0.0790 0.0152     1.005 testimages\b191_1_9_1_uncompressed.img.gz
+Mon Mar 16 12:20:32 2009    stats
+
+         429 function calls in 0.020 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.020    0.020 <string>:1(<module>)
+        1    0.000    0.000    0.019    0.019 OXDimage.py:145(read)
+        1    0.000    0.000    0.001    0.001 OXDimage.py:27(_readheader)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        3    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        3    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+       19    0.000    0.000    0.015    0.001 gzip.py:208(read)
+        6    0.000    0.000    0.000    0.000 gzip.py:240(_unread)
+       13    0.000    0.000    0.015    0.001 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       13    0.004    0.000    0.005    0.000 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        1    0.000    0.000    0.000    0.000 gzip.py:363(rewind)
+        3    0.000    0.000    0.000    0.000 gzip.py:374(seek)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        6    0.000    0.000    0.001    0.000 gzip.py:391(readline)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        2    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.020    0.020 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+       13    0.008    0.001    0.008    0.001 {built-in method decompress}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+       44    0.000    0.000    0.000    0.000 {len}
+        2    0.000    0.000    0.000    0.000 {max}
+        8    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.001    0.001    0.001    0.001 {method 'astype' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       17    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      111    0.001    0.000    0.001    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        9    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       16    0.000    0.000    0.000    0.000 {min}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+       45    0.001    0.000    0.001    0.000 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+        6    0.000    0.000    0.000    0.000 {ord}
+        3    0.000    0.000    0.000    0.000 {range}
+       16    0.001    0.000    0.001    0.000 {zlib.crc32}
+        3    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0164 0.0176 0.2444                   8.004 testimages\corkcont2_H_0089.mccd
+Mon Mar 16 12:20:32 2009    stats
+
+         1304 function calls in 0.142 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.006    0.006    0.142    0.142 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.003    0.003 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        1    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.001    0.001    0.049    0.049 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.050    0.050 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        2    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.001    0.001    0.028    0.028 ImageFile.py:115(load)
+        1    0.000    0.000    0.012    0.012 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        2    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.002    0.001 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.001    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.001    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.002    0.002 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.002    0.002 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:521(_setup)
+       31    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       25    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.136    0.136 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        1    0.000    0.000    0.023    0.023 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(__init__)
+        1    0.000    0.000    0.000    0.000 tifimage.py:39(_readheader)
+        1    0.006    0.006    0.135    0.135 tifimage.py:58(read)
+        1    0.012    0.012    0.012    0.012 {_imaging.new}
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.022    0.022    0.022    0.022 {built-in method convert}
+      128    0.005    0.000    0.005    0.000 {built-in method decode}
+      256    0.025    0.000    0.025    0.000 {built-in method encode}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        4    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       13    0.000    0.000    0.000    0.000 {isinstance}
+       34    0.000    0.000    0.000    0.000 {len}
+        5    0.000    0.000    0.000    0.000 {max}
+      267    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        3    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.023    0.011    0.023    0.011 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      152    0.010    0.000    0.010    0.000 {method 'read' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       11    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        3    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {min}
+        2    0.028    0.014    0.028    0.014 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+      188    0.000    0.000    0.000    0.000 {ord}
+       11    0.000    0.000    0.000    0.000 {range}
+
+
+0.0034 0.0042 0.7445 0.8120 0.5688     8.004 testimages\corkcont2_H_0089.mccd.bz2
+Mon Mar 16 12:20:34 2009    stats
+
+         1306 function calls in 0.748 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.006    0.006    0.748    0.748 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.003    0.003 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        1    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.001    0.001    0.049    0.049 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.040    0.040 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        2    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.001    0.001    0.018    0.018 ImageFile.py:115(load)
+        1    0.000    0.000    0.009    0.009 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        2    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.002    0.001 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.001    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.001    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.002    0.002 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.002    0.002 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:521(_setup)
+       31    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       25    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.001    0.000    0.566    0.283 fabioimage.py:284(_open)
+        2    0.001    0.000    0.565    0.282 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.742    0.742 openimage.py:68(openimage)
+        1    0.001    0.001    0.050    0.050 openimage.py:94(_openimage)
+        1    0.000    0.000    0.023    0.023 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(__init__)
+        1    0.000    0.000    0.000    0.000 tifimage.py:39(_readheader)
+        1    0.007    0.007    0.691    0.691 tifimage.py:58(read)
+        1    0.009    0.009    0.009    0.009 {_imaging.new}
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.023    0.023    0.023    0.023 {built-in method convert}
+      128    0.004    0.000    0.004    0.000 {built-in method decode}
+      256    0.024    0.000    0.024    0.000 {built-in method encode}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        4    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       13    0.000    0.000    0.000    0.000 {isinstance}
+       34    0.000    0.000    0.000    0.000 {len}
+        5    0.000    0.000    0.000    0.000 {max}
+      267    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        3    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.023    0.012    0.023    0.012 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    0.613    0.307    0.613    0.307 {method 'read' of 'bz2.BZ2File' objects}
+      151    0.003    0.000    0.003    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       11    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        3    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+        2    0.000    0.000    0.000    0.000 {min}
+        2    0.027    0.014    0.027    0.014 {numpy.core.multiarray.fromstring}
+      188    0.000    0.000    0.000    0.000 {ord}
+       11    0.000    0.000    0.000    0.000 {range}
+
+
+0.0045 0.0051 0.2546 0.3130 0.1230     8.004 testimages\corkcont2_H_0089.mccd.gz
+Mon Mar 16 12:20:36 2009    stats
+
+         1494 function calls in 0.258 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.005    0.005    0.258    0.258 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.001    0.001 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        1    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.001    0.001    0.048    0.048 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.041    0.041 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        2    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.001    0.001    0.019    0.019 ImageFile.py:115(load)
+        1    0.000    0.000    0.010    0.010 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        2    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.001    0.000 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.000    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:521(_setup)
+       31    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       25    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.122    0.061 fabioimage.py:284(_open)
+        2    0.000    0.000    0.122    0.061 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        2    0.001    0.001    0.122    0.061 gzip.py:208(read)
+       13    0.000    0.000    0.120    0.009 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       12    0.040    0.003    0.051    0.004 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        2    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.253    0.253 openimage.py:68(openimage)
+        1    0.000    0.000    0.002    0.002 openimage.py:94(_openimage)
+        1    0.000    0.000    0.023    0.023 string.py:306(join)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(__init__)
+        1    0.000    0.000    0.000    0.000 tifimage.py:39(_readheader)
+        1    0.009    0.009    0.250    0.250 tifimage.py:58(read)
+        1    0.010    0.010    0.010    0.010 {_imaging.new}
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.022    0.022    0.022    0.022 {built-in method convert}
+      128    0.005    0.000    0.005    0.000 {built-in method decode}
+       12    0.065    0.005    0.065    0.005 {built-in method decompress}
+      256    0.024    0.000    0.024    0.000 {built-in method encode}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        4    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       13    0.000    0.000    0.000    0.000 {isinstance}
+       59    0.000    0.000    0.000    0.000 {len}
+        3    0.000    0.000    0.000    0.000 {max}
+      267    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        3    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.023    0.012    0.023    0.012 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      151    0.003    0.000    0.003    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       66    0.003    0.000    0.003    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       11    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        7    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        3    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       14    0.000    0.000    0.000    0.000 {min}
+        2    0.029    0.015    0.029    0.015 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+      192    0.000    0.000    0.000    0.000 {ord}
+       11    0.000    0.000    0.000    0.000 {range}
+       14    0.011    0.001    0.011    0.001 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0100 0.0089 0.8983                   3.471 testimages\example.mar2300
+Mon Mar 16 12:20:36 2009    stats
+
+         231 function calls in 0.517 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.517    0.517 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:137(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:74(__init__)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.515    0.515 mar345image.py:19(read)
+        1    0.001    0.001    0.001    0.001 mar345image.py:47(_readheader)
+        2    0.000    0.000    0.000    0.000 ntpath.py:116(splitdrive)
+        2    0.000    0.000    0.000    0.000 ntpath.py:158(split)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.517    0.517 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        1    0.000    0.000    0.000    0.000 re.py:186(compile)
+        1    0.000    0.000    0.000    0.000 re.py:227(_compile)
+        1    0.000    0.000    0.000    0.000 string.py:246(strip)
+       15    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+       17    0.000    0.000    0.000    0.000 {len}
+        1    0.514    0.514    0.514    0.514 {mar345_io.unpack}
+        4    0.000    0.000    0.000    0.000 {max}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        3    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        4    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       67    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'splitlines' of 'str' objects}
+       17    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+       15    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       11    0.000    0.000    0.000    0.000 {method 'update' of 'dict' objects}
+        2    0.001    0.000    0.001    0.000 {open}
+       11    0.000    0.000    0.000    0.000 {range}
+
+
+0.0077 0.0079 1.4724 1.0150 0.7642     3.471 testimages\example.mar2300.bz2
+Mon Mar 16 12:20:42 2009    stats
+
+         236 function calls in 1.510 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    1.510    1.510 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:137(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:74(__init__)
+        2    0.000    0.000    0.837    0.418 fabioimage.py:284(_open)
+        2    0.001    0.001    0.836    0.418 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    1.383    1.383 mar345image.py:19(read)
+        1    0.000    0.000    0.001    0.001 mar345image.py:47(_readheader)
+        2    0.000    0.000    0.000    0.000 ntpath.py:116(splitdrive)
+        2    0.000    0.000    0.000    0.000 ntpath.py:158(split)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    1.510    1.510 openimage.py:68(openimage)
+        1    0.001    0.001    0.127    0.127 openimage.py:94(_openimage)
+        1    0.000    0.000    0.000    0.000 re.py:186(compile)
+        1    0.000    0.000    0.000    0.000 re.py:227(_compile)
+        1    0.000    0.000    0.000    0.000 string.py:246(strip)
+       15    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+       17    0.000    0.000    0.000    0.000 {len}
+        1    0.545    0.545    0.545    0.545 {mar345_io.unpack}
+        4    0.000    0.000    0.000    0.000 {max}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        3    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    0.886    0.443    0.886    0.443 {method 'read' of 'bz2.BZ2File' objects}
+        3    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+       67    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'splitlines' of 'str' objects}
+       17    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+       15    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       11    0.000    0.000    0.000    0.000 {method 'update' of 'dict' objects}
+        1    0.074    0.074    0.074    0.074 {method 'write' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {nt.tmpfile}
+       11    0.000    0.000    0.000    0.000 {range}
+
+
+0.0076 0.0078 0.6351 0.1410 0.0660     3.471 testimages\example.mar2300.gz
+Mon Mar 16 12:20:44 2009    stats
+
+         419 function calls in 0.649 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.649    0.649 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:121(numstem)
+        1    0.000    0.000    0.000    0.000 __init__.py:137(deconstruct_filename)
+        1    0.000    0.000    0.000    0.000 __init__.py:74(__init__)
+        2    0.000    0.000    0.127    0.064 fabioimage.py:284(_open)
+        2    0.000    0.000    0.127    0.064 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        2    0.001    0.000    0.066    0.033 gzip.py:208(read)
+       14    0.000    0.000    0.065    0.005 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       13    0.012    0.001    0.017    0.001 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.000    0.000 gzip.py:60(__init__)
+        1    0.000    0.000    0.648    0.648 mar345image.py:19(read)
+        1    0.001    0.001    0.001    0.001 mar345image.py:47(_readheader)
+        2    0.000    0.000    0.000    0.000 ntpath.py:116(splitdrive)
+        2    0.000    0.000    0.000    0.000 ntpath.py:158(split)
+        2    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.649    0.649 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        1    0.000    0.000    0.000    0.000 re.py:186(compile)
+        1    0.000    0.000    0.000    0.000 re.py:227(_compile)
+        1    0.000    0.000    0.000    0.000 string.py:246(strip)
+       17    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+       13    0.040    0.003    0.040    0.003 {built-in method decompress}
+        1    0.000    0.000    0.000    0.000 {built-in method groups}
+        1    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+       44    0.000    0.000    0.000    0.000 {len}
+        1    0.519    0.519    0.519    0.519 {mar345_io.unpack}
+        2    0.000    0.000    0.000    0.000 {max}
+        3    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
+        3    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        3    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       58    0.008    0.000    0.008    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        8    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+       67    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'splitlines' of 'str' objects}
+       17    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+       17    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       11    0.000    0.000    0.000    0.000 {method 'update' of 'dict' objects}
+        1    0.060    0.060    0.060    0.060 {method 'write' of 'file' objects}
+       13    0.000    0.000    0.000    0.000 {min}
+        1    0.000    0.000    0.000    0.000 {nt.tmpfile}
+        2    0.000    0.000    0.000    0.000 {open}
+        4    0.000    0.000    0.000    0.000 {ord}
+       11    0.000    0.000    0.000    0.000 {range}
+       15    0.005    0.000    0.005    0.000 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0046 0.0005 0.0012                   0.215 testimages\face.edf
+Mon Mar 16 12:20:44 2009    stats
+
+         119 function calls in 0.001 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.001    0.001 <string>:1(<module>)
+        2    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:1321(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:959(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.000    0.000    0.000    0.000 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.001    0.001 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.001    0.001 openimage.py:68(openimage)
+        1    0.000    0.000    0.000    0.000 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 {apply}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        7    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+        7    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       12    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+        4    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+
+
+0.0016 0.0002 0.0045 0.0620 0.0036     0.215 testimages\face.edf.bz2
+Mon Mar 16 12:20:44 2009    stats
+
+         119 function calls in 0.005 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.005    0.005 <string>:1(<module>)
+        2    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:1321(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:959(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.000    0.000    0.001    0.001 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.004    0.004 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.005    0.005 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 {apply}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        7    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+        7    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       12    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+        4    0.004    0.001    0.004    0.001 {method 'read' of 'bz2.BZ2File' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+
+
+0.0003 0.0003 0.0038 0.0620 0.0030     0.215 testimages\face.edf.gz
+Mon Mar 16 12:20:44 2009    stats
+
+         208 function calls in 0.005 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.005    0.005 <string>:1(<module>)
+        2    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:1321(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:959(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.000    0.000    0.001    0.001 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.003    0.003 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        4    0.000    0.000    0.003    0.001 gzip.py:208(read)
+        4    0.000    0.000    0.003    0.001 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+        3    0.000    0.000    0.001    0.000 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        2    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.005    0.005 openimage.py:68(openimage)
+        1    0.000    0.000    0.002    0.002 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        2    0.000    0.000    0.000    0.000 {apply}
+        3    0.002    0.001    0.002    0.001 {built-in method decompress}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+       14    0.000    0.000    0.000    0.000 {len}
+        2    0.000    0.000    0.000    0.000 {max}
+        7    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       12    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+       31    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        7    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        3    0.000    0.000    0.000    0.000 {min}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+        4    0.000    0.000    0.000    0.000 {ord}
+        5    0.000    0.000    0.000    0.000 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0007 0.0004 0.0054                   0.008 testimages\face.msk
+Mon Mar 16 12:20:44 2009    stats
+
+         82 function calls in 0.006 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.006    0.006 <string>:1(<module>)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fit2dmaskimage.py:19(_readheader)
+        1    0.002    0.002    0.005    0.005 fit2dmaskimage.py:36(read)
+        2    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 numeric.py:1461(ones)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.006    0.006 openimage.py:68(openimage)
+        1    0.000    0.000    0.000    0.000 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        2    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+        9    0.000    0.000    0.000    0.000 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        1    0.000    0.000    0.000    0.000 {method 'fill' of 'numpy.ndarray' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        3    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.empty}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        1    0.003    0.003    0.003    0.003 {numpy.core.multiarray.where}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.zeros}
+        2    0.000    0.000    0.000    0.000 {open}
+        1    0.000    0.000    0.000    0.000 {range}
+
+
+0.0003 0.0002 0.0057 0.0630 0.0012     0.008 testimages\face.msk.bz2
+Mon Mar 16 12:20:44 2009    stats
+
+         82 function calls in 0.007 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.007    0.007 <string>:1(<module>)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fit2dmaskimage.py:19(_readheader)
+        1    0.001    0.001    0.006    0.006 fit2dmaskimage.py:36(read)
+        2    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 numeric.py:1461(ones)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.007    0.007 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        2    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+        9    0.000    0.000    0.000    0.000 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        1    0.000    0.000    0.000    0.000 {method 'fill' of 'numpy.ndarray' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        3    0.001    0.000    0.001    0.000 {method 'read' of 'bz2.BZ2File' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.empty}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        1    0.003    0.003    0.003    0.003 {numpy.core.multiarray.where}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.zeros}
+        1    0.000    0.000    0.000    0.000 {range}
+
+
+0.0004 0.0004 0.0056 0.0630 0.0010     0.008 testimages\face.msk.gz
+Mon Mar 16 12:20:44 2009    stats
+
+         167 function calls in 0.007 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.007    0.007 <string>:1(<module>)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fit2dmaskimage.py:19(_readheader)
+        1    0.001    0.001    0.005    0.005 fit2dmaskimage.py:36(read)
+        2    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        3    0.000    0.000    0.001    0.000 gzip.py:208(read)
+        3    0.000    0.000    0.001    0.000 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+        3    0.000    0.000    0.000    0.000 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        2    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 numeric.py:1461(ones)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.007    0.007 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        3    0.000    0.000    0.000    0.000 {built-in method decompress}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        9    0.000    0.000    0.000    0.000 {len}
+        2    0.000    0.000    0.000    0.000 {max}
+        9    0.000    0.000    0.000    0.000 {method 'astype' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        1    0.000    0.000    0.000    0.000 {method 'fill' of 'numpy.ndarray' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       31    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        6    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        3    0.000    0.000    0.000    0.000 {min}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.empty}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        1    0.003    0.003    0.003    0.003 {numpy.core.multiarray.where}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.zeros}
+        2    0.000    0.000    0.000    0.000 {open}
+        4    0.000    0.000    0.000    0.000 {ord}
+        1    0.000    0.000    0.000    0.000 {range}
+        5    0.000    0.000    0.000    0.000 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.1201 0.0069 0.0154                   4.001 testimages\fit2d_click.edf
+Mon Mar 16 12:20:44 2009    stats
+
+         119 function calls in 0.025 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.001    0.001    0.025    0.025 <string>:1(<module>)
+        2    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:1321(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:959(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.000    0.000    0.000    0.000 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.023    0.023 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.025    0.025 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 {apply}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        7    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+        7    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       12    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+        4    0.006    0.001    0.006    0.001 {method 'read' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.016    0.016    0.016    0.016 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+
+
+0.0030 0.0005 0.0681 0.1250 0.0623     4.001 testimages\fit2d_click.edf.bz2
+Mon Mar 16 12:20:44 2009    stats
+
+         119 function calls in 0.067 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.001    0.001    0.067    0.067 <string>:1(<module>)
+        2    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:1321(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:959(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.000    0.000    0.002    0.002 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.062    0.062 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.001    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.065    0.065 openimage.py:68(openimage)
+        1    0.000    0.000    0.003    0.003 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 {apply}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        7    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+        7    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       12    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+        4    0.057    0.014    0.057    0.014 {method 'read' of 'bz2.BZ2File' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.006    0.006    0.006    0.006 {numpy.core.multiarray.fromstring}
+
+
+0.0008 0.0004 0.0632 0.1410 0.0437     4.001 testimages\fit2d_click.edf.gz
+Mon Mar 16 12:20:44 2009    stats
+
+         238 function calls in 0.063 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.063    0.063 <string>:1(<module>)
+        2    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:1321(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:959(debug)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.000    0.000    0.000    0.000 edfimage.py:153(swap_needed)
+        1    0.000    0.000    0.011    0.011 edfimage.py:55(_readheader)
+        1    0.000    0.000    0.055    0.055 edfimage.py:87(read)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        4    0.004    0.001    0.052    0.013 gzip.py:208(read)
+        6    0.000    0.000    0.048    0.008 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+        5    0.015    0.003    0.023    0.005 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        2    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.062    0.062 openimage.py:68(openimage)
+        1    0.000    0.000    0.007    0.007 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        2    0.000    0.000    0.000    0.000 {apply}
+        5    0.024    0.005    0.024    0.005 {built-in method decompress}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+       18    0.000    0.000    0.000    0.000 {len}
+        2    0.000    0.000    0.000    0.000 {max}
+        7    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        8    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       12    0.000    0.000    0.000    0.000 {method 'lstrip' of 'str' objects}
+       47    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rstrip' of 'str' objects}
+        7    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        7    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        5    0.000    0.000    0.000    0.000 {min}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.008    0.008    0.008    0.008 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+        4    0.000    0.000    0.000    0.000 {ord}
+        7    0.007    0.001    0.007    0.001 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0009 0.0003 0.0767                   0.126 testimages\fit2d_click.msk
+Mon Mar 16 12:20:44 2009    stats
+
+         82 function calls in 0.081 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.081    0.081 <string>:1(<module>)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fit2dmaskimage.py:19(_readheader)
+        1    0.014    0.014    0.080    0.080 fit2dmaskimage.py:36(read)
+        2    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 numeric.py:1461(ones)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.081    0.081 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        2    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+        9    0.007    0.001    0.007    0.001 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        1    0.000    0.000    0.000    0.000 {method 'fill' of 'numpy.ndarray' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        3    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.empty}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        1    0.057    0.057    0.057    0.057 {numpy.core.multiarray.where}
+        1    0.002    0.002    0.002    0.002 {numpy.core.multiarray.zeros}
+        2    0.001    0.000    0.001    0.000 {open}
+        1    0.000    0.000    0.000    0.000 {range}
+
+
+0.0017 0.0003 0.0777 0.0620 0.0022     0.126 testimages\fit2d_click.msk.bz2
+Mon Mar 16 12:20:44 2009    stats
+
+         82 function calls in 0.080 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.080    0.080 <string>:1(<module>)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fit2dmaskimage.py:19(_readheader)
+        1    0.012    0.012    0.079    0.079 fit2dmaskimage.py:36(read)
+        2    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 numeric.py:1461(ones)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.080    0.080 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        2    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+        9    0.007    0.001    0.007    0.001 {method 'astype' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        1    0.000    0.000    0.000    0.000 {method 'fill' of 'numpy.ndarray' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        3    0.001    0.000    0.001    0.000 {method 'read' of 'bz2.BZ2File' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.empty}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        1    0.057    0.057    0.057    0.057 {numpy.core.multiarray.where}
+        1    0.001    0.001    0.001    0.001 {numpy.core.multiarray.zeros}
+        1    0.000    0.000    0.000    0.000 {range}
+
+
+0.0021 0.0003 0.0750 0.0630 0.0020     0.126 testimages\fit2d_click.msk.gz
+Mon Mar 16 12:20:46 2009    stats
+
+         189 function calls in 0.077 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.077    0.077 <string>:1(<module>)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.001    0.001 fit2dmaskimage.py:19(_readheader)
+        1    0.012    0.012    0.075    0.075 fit2dmaskimage.py:36(read)
+        2    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        6    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        3    0.000    0.000    0.003    0.001 gzip.py:208(read)
+        2    0.000    0.000    0.002    0.001 gzip.py:245(_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+        2    0.000    0.000    0.000    0.000 gzip.py:295(_add_read_data)
+        2    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        4    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.000    0.000 gzip.py:60(__init__)
+        2    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 numeric.py:1461(ones)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.077    0.077 openimage.py:68(openimage)
+        1    0.000    0.000    0.002    0.002 openimage.py:94(_openimage)
+        4    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        2    0.001    0.001    0.001    0.001 {built-in method decompress}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+        8    0.000    0.000    0.000    0.000 {len}
+        2    0.000    0.000    0.000    0.000 {max}
+        9    0.006    0.001    0.006    0.001 {method 'astype' of 'numpy.ndarray' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        1    0.000    0.000    0.000    0.000 {method 'fill' of 'numpy.ndarray' objects}
+       12    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       46    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        8    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'tostring' of 'numpy.ndarray' objects}
+        4    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        2    0.000    0.000    0.000    0.000 {min}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.array}
+        1    0.000    0.000    0.000    0.000 {numpy.core.multiarray.empty}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        1    0.054    0.054    0.054    0.054 {numpy.core.multiarray.where}
+        1    0.001    0.001    0.001    0.001 {numpy.core.multiarray.zeros}
+        2    0.000    0.000    0.000    0.000 {open}
+        4    0.000    0.000    0.000    0.000 {ord}
+        1    0.000    0.000    0.000    0.000 {range}
+        4    0.000    0.000    0.000    0.000 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0377 0.0507 0.2064                  18.000 testimages\mb_LP_1_001.img
+Mon Mar 16 12:20:46 2009    stats
+
+         183 function calls in 0.210 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.002    0.002    0.210    0.210 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.003    0.003    0.204    0.204 adscimage.py:25(read)
+        1    0.000    0.000    0.074    0.074 adscimage.py:71(_readheader)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.003    0.003    0.208    0.208 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        1    0.000    0.000    0.000    0.000 {apply}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+       20    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+       17    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.060    0.060    0.060    0.060 {method 'byteswap' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        4    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    0.040    0.020    0.040    0.020 {method 'read' of 'file' objects}
+       19    0.074    0.004    0.074    0.004 {method 'readline' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+       17    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+       51    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+        1    0.027    0.027    0.027    0.027 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+
+
+0.1270 0.0125 4.6505 3.4060 2.6507    18.000 testimages\mb_LP_1_001.img.bz2
+Mon Mar 16 12:21:00 2009    stats
+
+         183 function calls in 4.413 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.002    0.002    4.413    4.413 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.002    0.002    4.356    4.356 adscimage.py:25(read)
+        1    0.000    0.000    1.657    1.657 adscimage.py:71(_readheader)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.001    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.002    0.002    4.411    4.411 openimage.py:68(openimage)
+        1    0.001    0.001    0.054    0.054 openimage.py:94(_openimage)
+        1    0.000    0.000    0.000    0.000 {apply}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+       20    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+       17    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.051    0.051    0.051    0.051 {method 'byteswap' of 'numpy.ndarray' objects}
+        1    0.001    0.001    0.001    0.001 {method 'close' of 'bz2.BZ2File' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        4    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    2.626    1.313    2.626    1.313 {method 'read' of 'bz2.BZ2File' objects}
+       19    1.657    0.087    1.657    0.087 {method 'readline' of 'bz2.BZ2File' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.045    0.045    0.045    0.045 {method 'seek' of 'bz2.BZ2File' objects}
+       17    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+       51    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+        1    0.026    0.026    0.026    0.026 {numpy.core.multiarray.fromstring}
+
+
+0.1923 0.0227 0.5979 1.0000 0.3347    18.000 testimages\mb_LP_1_001.img.gz
+Mon Mar 16 12:21:04 2009    stats
+
+         1121 function calls in 0.607 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.002    0.002    0.607    0.607 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.003    0.003    0.601    0.601 adscimage.py:25(read)
+        1    0.001    0.001    0.179    0.179 adscimage.py:71(_readheader)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        3    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        3    0.000    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        3    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        3    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+       37    0.019    0.001    0.485    0.013 gzip.py:208(read)
+       19    0.005    0.000    0.005    0.000 gzip.py:240(_unread)
+       75    0.002    0.000    0.466    0.006 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       74    0.104    0.001    0.138    0.002 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        3    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        3    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+       19    0.005    0.000    0.178    0.009 gzip.py:391(readline)
+        3    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        3    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.002    0.002    0.605    0.605 openimage.py:68(openimage)
+        1    0.000    0.000    0.002    0.002 openimage.py:94(_openimage)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.000    0.000 {apply}
+       74    0.295    0.004    0.295    0.004 {built-in method decompress}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+      237    0.000    0.000    0.000    0.000 {len}
+        3    0.000    0.000    0.000    0.000 {max}
+       51    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.056    0.056    0.056    0.056 {method 'byteswap' of 'numpy.ndarray' objects}
+        3    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+       38    0.005    0.000    0.005    0.000 {method 'find' of 'str' objects}
+       20    0.007    0.000    0.007    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      136    0.030    0.000    0.030    0.000 {method 'read' of 'file' objects}
+        9    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        9    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+       17    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+       51    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+        8    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       90    0.000    0.000    0.000    0.000 {min}
+        1    0.034    0.034    0.034    0.034 {numpy.core.multiarray.fromstring}
+        3    0.001    0.000    0.001    0.000 {open}
+        6    0.000    0.000    0.000    0.000 {ord}
+       77    0.034    0.000    0.034    0.000 {zlib.crc32}
+        3    0.001    0.000    0.001    0.000 {zlib.decompressobj}
+
+
+0.7949 0.0430 0.1928                  18.000 testimages\mb_LP_1_002.img
+Mon Mar 16 12:21:04 2009    stats
+
+         183 function calls in 0.208 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.002    0.002    0.208    0.208 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 __init__.py:1158(getEffectiveLevel)
+        1    0.000    0.000    0.000    0.000 __init__.py:1313(info)
+        1    0.000    0.000    0.000    0.000 __init__.py:973(info)
+        1    0.003    0.003    0.203    0.203 adscimage.py:25(read)
+        1    0.000    0.000    0.084    0.084 adscimage.py:71(_readheader)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.002    0.002    0.206    0.206 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        1    0.000    0.000    0.000    0.000 {apply}
+        2    0.000    0.000    0.000    0.000 {getattr}
+        4    0.000    0.000    0.000    0.000 {hasattr}
+        1    0.000    0.000    0.000    0.000 {isinstance}
+       20    0.000    0.000    0.000    0.000 {len}
+        4    0.000    0.000    0.000    0.000 {max}
+       17    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.052    0.052    0.052    0.052 {method 'byteswap' of 'numpy.ndarray' objects}
+        1    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        4    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    0.037    0.018    0.037    0.018 {method 'read' of 'file' objects}
+       19    0.084    0.004    0.084    0.004 {method 'readline' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+        1    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+       17    0.000    0.000    0.000    0.000 {method 'split' of 'str' objects}
+       51    0.000    0.000    0.000    0.000 {method 'strip' of 'str' objects}
+        1    0.027    0.027    0.027    0.027 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+
+
+0.2505 0.0227 0.2163                   8.067 testimages\oPPA_5grains_0001.tif
+Mon Mar 16 12:21:06 2009    stats
+
+         11319 function calls in 0.221 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.004    0.004    0.223    0.223 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.019    0.019 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+      512    0.003    0.000    0.006    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.001    0.001    0.055    0.055 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.110    0.110 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+      513    0.001    0.000    0.002    0.000 Image.py:91(isTupleType)
+        1    0.008    0.008    0.088    0.088 ImageFile.py:115(load)
+        1    0.000    0.000    0.010    0.010 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+      511    0.001    0.000    0.001    0.000 ImageFile.py:49(_tilesort)
+        4    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.018    0.005 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.010    0.001 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.001    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        8    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        1    0.003    0.003    0.009    0.009 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.018    0.018 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.018    0.018 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.005    0.005    0.017    0.017 TiffImagePlugin.py:521(_setup)
+       37    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+      536    0.005    0.000    0.007    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.219    0.219 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        1    0.000    0.000    0.030    0.030 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(__init__)
+        1    0.000    0.000    0.000    0.000 tifimage.py:39(_readheader)
+        1    0.005    0.005    0.218    0.218 tifimage.py:58(read)
+        1    0.010    0.010    0.010    0.010 {_imaging.new}
+      513    0.001    0.000    0.001    0.000 {apply}
+        1    0.022    0.022    0.022    0.022 {built-in method convert}
+      512    0.039    0.000    0.039    0.000 {built-in method decode}
+      256    0.024    0.000    0.024    0.000 {built-in method encode}
+        2    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        3    0.000    0.000    0.000    0.000 {chr}
+      511    0.000    0.000    0.000    0.000 {cmp}
+      515    0.001    0.000    0.001    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+      524    0.001    0.000    0.001    0.000 {isinstance}
+      551    0.000    0.000    0.000    0.000 {len}
+        5    0.000    0.000    0.000    0.000 {max}
+     1290    0.001    0.000    0.001    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        3    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.030    0.015    0.030    0.015 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      541    0.019    0.000    0.019    0.000 {method 'read' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'readline' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+      528    0.002    0.000    0.002    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.001    0.001 {method 'sort' of 'list' objects}
+        5    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+     1024    0.001    0.000    0.001    0.000 {min}
+        2    0.030    0.015    0.030    0.015 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+     2244    0.002    0.000    0.002    0.000 {ord}
+       12    0.000    0.000    0.000    0.000 {range}
+
+
+0.0164 0.0005 0.7279 0.8430 0.5297     8.067 testimages\oPPA_5grains_0001.tif.bz2
+Mon Mar 16 12:21:08 2009    stats
+
+         11321 function calls in 0.759 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.004    0.004    0.765    0.765 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.010    0.010 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+      512    0.003    0.000    0.007    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.001    0.001    0.053    0.053 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.121    0.121 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+      513    0.001    0.000    0.002    0.000 Image.py:91(isTupleType)
+        1    0.008    0.008    0.099    0.099 ImageFile.py:115(load)
+        1    0.000    0.000    0.007    0.007 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+      511    0.001    0.000    0.001    0.000 ImageFile.py:49(_tilesort)
+        4    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.010    0.002 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.006    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.001    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        8    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        1    0.001    0.001    0.005    0.005 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.010    0.010 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.009    0.009 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.002    0.002    0.008    0.008 TiffImagePlugin.py:521(_setup)
+       37    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+      536    0.003    0.000    0.004    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.001    0.000    0.528    0.264 fabioimage.py:284(_open)
+        2    0.001    0.000    0.527    0.264 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.761    0.761 openimage.py:68(openimage)
+        1    0.001    0.001    0.015    0.015 openimage.py:94(_openimage)
+        1    0.000    0.000    0.028    0.028 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(__init__)
+        1    0.000    0.000    0.000    0.000 tifimage.py:39(_readheader)
+        1    0.006    0.006    0.746    0.746 tifimage.py:58(read)
+        1    0.007    0.007    0.007    0.007 {_imaging.new}
+      513    0.001    0.000    0.001    0.000 {apply}
+        1    0.022    0.022    0.022    0.022 {built-in method convert}
+      512    0.040    0.000    0.040    0.000 {built-in method decode}
+      256    0.024    0.000    0.024    0.000 {built-in method encode}
+        2    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        3    0.000    0.000    0.000    0.000 {chr}
+      511    0.000    0.000    0.000    0.000 {cmp}
+      515    0.001    0.000    0.001    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+      524    0.001    0.000    0.001    0.000 {isinstance}
+      551    0.000    0.000    0.000    0.000 {len}
+        5    0.000    0.000    0.000    0.000 {max}
+     1290    0.001    0.000    0.001    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        3    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.028    0.014    0.028    0.014 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    0.540    0.270    0.540    0.270 {method 'read' of 'bz2.BZ2File' objects}
+      540    0.028    0.000    0.028    0.000 {method 'read' of 'cStringIO.StringI' objects}
+        2    0.000    0.000    0.000    0.000 {method 'readline' of 'cStringIO.StringI' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+      528    0.001    0.000    0.001    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        1    0.000    0.000    0.001    0.001 {method 'sort' of 'list' objects}
+        5    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+     1024    0.001    0.000    0.001    0.000 {min}
+        2    0.028    0.014    0.028    0.014 {numpy.core.multiarray.fromstring}
+     2244    0.001    0.000    0.001    0.000 {ord}
+       12    0.000    0.000    0.000    0.000 {range}
+
+
+0.0125 0.0006 0.2968 0.2810 0.0891     8.067 testimages\oPPA_5grains_0001.tif.gz
+Mon Mar 16 12:21:10 2009    stats
+
+         11469 function calls in 0.283 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.006    0.006    0.284    0.284 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.010    0.010 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+      512    0.003    0.000    0.006    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.001    0.001    0.049    0.049 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.096    0.096 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+      513    0.001    0.000    0.002    0.000 Image.py:91(isTupleType)
+        1    0.007    0.007    0.074    0.074 ImageFile.py:115(load)
+        1    0.000    0.000    0.007    0.007 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+      511    0.001    0.000    0.001    0.000 ImageFile.py:49(_tilesort)
+        4    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.010    0.002 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.006    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.001    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        8    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        1    0.001    0.001    0.005    0.005 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.010    0.010 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.010    0.010 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.002    0.002    0.009    0.009 TiffImagePlugin.py:521(_setup)
+       37    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+      536    0.003    0.000    0.004    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.082    0.041 fabioimage.py:284(_open)
+        2    0.000    0.000    0.082    0.041 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        2    0.001    0.001    0.084    0.042 gzip.py:208(read)
+        8    0.000    0.000    0.083    0.010 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+        7    0.032    0.005    0.045    0.006 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        2    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.001    0.001    0.278    0.278 openimage.py:68(openimage)
+        1    0.000    0.000    0.004    0.004 openimage.py:94(_openimage)
+        1    0.000    0.000    0.024    0.024 string.py:306(join)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(__init__)
+        1    0.000    0.000    0.000    0.000 tifimage.py:39(_readheader)
+        1    0.008    0.008    0.273    0.273 tifimage.py:58(read)
+        1    0.007    0.007    0.007    0.007 {_imaging.new}
+      513    0.001    0.000    0.001    0.000 {apply}
+        1    0.022    0.022    0.022    0.022 {built-in method convert}
+      512    0.039    0.000    0.039    0.000 {built-in method decode}
+        7    0.037    0.005    0.037    0.005 {built-in method decompress}
+      256    0.024    0.000    0.024    0.000 {built-in method encode}
+        2    0.000    0.000    0.000    0.000 {built-in method match}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        3    0.000    0.000    0.000    0.000 {chr}
+      511    0.000    0.000    0.000    0.000 {cmp}
+      515    0.001    0.000    0.001    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+      524    0.001    0.000    0.001    0.000 {isinstance}
+      566    0.000    0.000    0.000    0.000 {len}
+        3    0.000    0.000    0.000    0.000 {max}
+     1290    0.001    0.000    0.001    0.000 {method 'append' of 'list' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        3    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.024    0.012    0.024    0.012 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+      540    0.010    0.000    0.010    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       61    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'readline' of 'cStringIO.StringI' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+      528    0.001    0.000    0.001    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        7    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.001    0.001 {method 'sort' of 'list' objects}
+        5    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+     1031    0.001    0.000    0.001    0.000 {min}
+        2    0.028    0.014    0.028    0.014 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+     2248    0.001    0.000    0.001    0.000 {ord}
+       12    0.000    0.000    0.000    0.000 {range}
+        9    0.012    0.001    0.012    0.001 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0576 0.0076 0.0391                   2.004 testimages\somedata_0001.mccd
+Mon Mar 16 12:21:10 2009    stats
+
+         728 function calls in 0.045 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.001    0.001    0.045    0.045 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.003    0.003 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        1    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.000    0.000    0.016    0.016 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.016    0.016 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        2    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.000    0.000    0.008    0.008 ImageFile.py:115(load)
+        1    0.000    0.000    0.002    0.002 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        2    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.002    0.001 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.001    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.001    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.002    0.002 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.002    0.002 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:521(_setup)
+       31    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       25    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.044    0.044 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        1    0.000    0.000    0.006    0.006 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(__init__)
+        1    0.000    0.000    0.000    0.000 tifimage.py:39(_readheader)
+        1    0.002    0.002    0.043    0.043 tifimage.py:58(read)
+        1    0.002    0.002    0.002    0.002 {_imaging.new}
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.008    0.008    0.008    0.008 {built-in method convert}
+       32    0.002    0.000    0.002    0.000 {built-in method decode}
+       64    0.010    0.000    0.010    0.000 {built-in method encode}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        4    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       13    0.000    0.000    0.000    0.000 {isinstance}
+       34    0.000    0.000    0.000    0.000 {len}
+        5    0.000    0.000    0.000    0.000 {max}
+       75    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        3    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.006    0.003    0.006    0.003 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       56    0.004    0.000    0.004    0.000 {method 'read' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       11    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        3    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {min}
+        2    0.006    0.003    0.006    0.003 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+      188    0.000    0.000    0.000    0.000 {ord}
+       11    0.000    0.000    0.000    0.000 {range}
+
+
+0.0265 0.0011 0.2741 0.3130 0.1863     2.004 testimages\somedata_0001.mccd.bz2
+Mon Mar 16 12:21:10 2009    stats
+
+         730 function calls in 0.280 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.001    0.001    0.280    0.280 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.003    0.003 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        1    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.000    0.000    0.012    0.012 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.009    0.009 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        2    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.000    0.000    0.004    0.004 ImageFile.py:115(load)
+        1    0.000    0.000    0.002    0.002 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        2    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.002    0.001 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.001    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.001    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.002    0.002 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.002    0.002 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:521(_setup)
+       31    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       25    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.001    0.000    0.189    0.095 fabioimage.py:284(_open)
+        2    0.001    0.000    0.189    0.094 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.279    0.279 openimage.py:68(openimage)
+        1    0.001    0.001    0.059    0.059 openimage.py:94(_openimage)
+        1    0.000    0.000    0.006    0.006 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(__init__)
+        1    0.000    0.000    0.000    0.000 tifimage.py:39(_readheader)
+        1    0.002    0.002    0.220    0.220 tifimage.py:58(read)
+        1    0.002    0.002    0.002    0.002 {_imaging.new}
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.005    0.005    0.005    0.005 {built-in method convert}
+       32    0.001    0.000    0.001    0.000 {built-in method decode}
+       64    0.006    0.000    0.006    0.000 {built-in method encode}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        4    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       13    0.000    0.000    0.000    0.000 {isinstance}
+       34    0.000    0.000    0.000    0.000 {len}
+        5    0.000    0.000    0.000    0.000 {max}
+       75    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        3    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.006    0.003    0.006    0.003 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    0.246    0.123    0.246    0.123 {method 'read' of 'bz2.BZ2File' objects}
+       55    0.001    0.000    0.001    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       11    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        3    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+        2    0.000    0.000    0.000    0.000 {min}
+        2    0.006    0.003    0.006    0.003 {numpy.core.multiarray.fromstring}
+      188    0.000    0.000    0.000    0.000 {ord}
+       11    0.000    0.000    0.000    0.000 {range}
+
+
+0.0307 0.0016 0.0655 0.1090 0.0349     2.004 testimages\somedata_0001.mccd.gz
+Mon Mar 16 12:21:12 2009    stats
+
+         904 function calls in 0.067 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.001    0.001    0.067    0.067 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.002    0.002 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        1    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.000    0.000    0.012    0.012 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.008    0.008 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        2    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.000    0.000    0.004    0.004 ImageFile.py:115(load)
+        1    0.000    0.000    0.001    0.001 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        2    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.001    0.000 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.000    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        4    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:521(_setup)
+       31    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       25    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.034    0.017 fabioimage.py:284(_open)
+        2    0.000    0.000    0.034    0.017 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        3    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        2    0.000    0.000    0.035    0.017 gzip.py:208(read)
+       12    0.000    0.000    0.034    0.003 gzip.py:245(_read)
+        1    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+       11    0.007    0.001    0.010    0.001 gzip.py:295(_add_read_data)
+        1    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        2    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.001    0.000 gzip.py:60(__init__)
+        2    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.066    0.066 openimage.py:68(openimage)
+        1    0.000    0.000    0.002    0.002 openimage.py:94(_openimage)
+        1    0.000    0.000    0.006    0.006 string.py:306(join)
+        2    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(__init__)
+        1    0.000    0.000    0.000    0.000 tifimage.py:39(_readheader)
+        1    0.002    0.002    0.064    0.064 tifimage.py:58(read)
+        1    0.001    0.001    0.001    0.001 {_imaging.new}
+        2    0.000    0.000    0.000    0.000 {apply}
+        1    0.005    0.005    0.005    0.005 {built-in method convert}
+       32    0.001    0.000    0.001    0.000 {built-in method decode}
+       11    0.021    0.002    0.021    0.002 {built-in method decompress}
+       64    0.006    0.000    0.006    0.000 {built-in method encode}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        4    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       13    0.000    0.000    0.000    0.000 {isinstance}
+       57    0.000    0.000    0.000    0.000 {len}
+        3    0.000    0.000    0.000    0.000 {max}
+       75    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        3    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.006    0.003    0.006    0.003 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       55    0.001    0.000    0.001    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       59    0.002    0.000    0.002    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       11    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        7    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        3    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        2    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+       13    0.000    0.000    0.000    0.000 {min}
+        2    0.006    0.003    0.006    0.003 {numpy.core.multiarray.fromstring}
+        2    0.001    0.000    0.001    0.000 {open}
+      192    0.000    0.000    0.000    0.000 {ord}
+       11    0.000    0.000    0.000    0.000 {range}
+       13    0.003    0.000    0.003    0.000 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+
+0.0031 0.0008 0.0030                   0.023 testimages\testmap1_0002.tif
+Mon Mar 16 12:21:12 2009    stats
+
+         595 function calls in 0.003 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.003    0.003 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.002    0.002 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        2    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.000    0.000    0.000    0.000 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.000    0.000 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        3    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:115(load)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:49(_tilesort)
+        4    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.001    0.000 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.000    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        8    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:521(_setup)
+       37    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       26    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.003    0.003 openimage.py:68(openimage)
+        1    0.000    0.000    0.000    0.000 openimage.py:94(_openimage)
+        1    0.000    0.000    0.000    0.000 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(__init__)
+        1    0.000    0.000    0.000    0.000 tifimage.py:39(_readheader)
+        1    0.000    0.000    0.002    0.002 tifimage.py:58(read)
+        1    0.000    0.000    0.000    0.000 {_imaging.new}
+        3    0.000    0.000    0.000    0.000 {apply}
+        1    0.000    0.000    0.000    0.000 {built-in method convert}
+        2    0.000    0.000    0.000    0.000 {built-in method decode}
+        1    0.000    0.000    0.000    0.000 {built-in method encode}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cmp}
+        5    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       14    0.000    0.000    0.000    0.000 {isinstance}
+       38    0.000    0.000    0.000    0.000 {len}
+        5    0.000    0.000    0.000    0.000 {max}
+       15    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        3    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       29    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       16    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        5    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {min}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+      204    0.000    0.000    0.000    0.000 {ord}
+       12    0.000    0.000    0.000    0.000 {range}
+
+
+0.0018 0.0003 0.0024 0.0470 0.0008     0.023 testimages\testmap1_0002.tif.bz2
+Mon Mar 16 12:21:12 2009    stats
+
+         597 function calls in 0.003 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.003    0.003 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.001    0.001 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        2    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.000    0.000    0.000    0.000 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.000    0.000 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        3    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:115(load)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:49(_tilesort)
+        4    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.001    0.000 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.000    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        8    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:521(_setup)
+       37    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       26    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:284(_open)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        4    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.003    0.003 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        1    0.000    0.000    0.000    0.000 string.py:306(join)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(__init__)
+        1    0.000    0.000    0.000    0.000 tifimage.py:39(_readheader)
+        1    0.000    0.000    0.003    0.003 tifimage.py:58(read)
+        1    0.000    0.000    0.000    0.000 {_imaging.new}
+        3    0.000    0.000    0.000    0.000 {apply}
+        1    0.000    0.000    0.000    0.000 {built-in method convert}
+        2    0.000    0.000    0.000    0.000 {built-in method decode}
+        1    0.000    0.000    0.000    0.000 {built-in method encode}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        1    0.000    0.000    0.000    0.000 {cmp}
+        5    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       14    0.000    0.000    0.000    0.000 {isinstance}
+       38    0.000    0.000    0.000    0.000 {len}
+        5    0.000    0.000    0.000    0.000 {max}
+       15    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        3    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'read' of 'bz2.BZ2File' objects}
+       28    0.000    0.000    0.000    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       12    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       16    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        5    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+        4    0.000    0.000    0.000    0.000 {min}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+      204    0.000    0.000    0.000    0.000 {ord}
+       12    0.000    0.000    0.000    0.000 {range}
+
+
+0.0004 0.0003 0.0023 0.0470 0.0012     0.023 testimages\testmap1_0002.tif.gz
+Mon Mar 16 12:21:12 2009    stats
+
+         713 function calls in 0.004 CPU seconds
+
+   Ordered by: standard name
+
+   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
+        1    0.000    0.000    0.004    0.004 <string>:1(<module>)
+        1    0.000    0.000    0.000    0.000 ArgImagePlugin.py:401(_accept)
+        1    0.000    0.000    0.000    0.000 BmpImagePlugin.py:55(_accept)
+        1    0.000    0.000    0.000    0.000 BufrStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 CurImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:32(i32)
+        1    0.000    0.000    0.000    0.000 DcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:118(_accept)
+        1    0.000    0.000    0.000    0.000 EpsImagePlugin.py:29(i32)
+        1    0.000    0.000    0.000    0.000 FitsStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:25(i16)
+        1    0.000    0.000    0.000    0.000 FliImagePlugin.py:34(_accept)
+        1    0.000    0.000    0.000    0.000 FpxImagePlugin.py:46(_accept)
+        2    0.000    0.000    0.000    0.000 GbrImagePlugin.py:18(i32)
+        1    0.000    0.000    0.000    0.000 GbrImagePlugin.py:21(_accept)
+        1    0.000    0.000    0.000    0.000 GifImagePlugin.py:47(_accept)
+        1    0.000    0.000    0.000    0.000 GribStubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 Hdf5StubImagePlugin.py:28(_accept)
+        1    0.000    0.000    0.000    0.000 IcnsImagePlugin.py:204(<lambda>)
+        1    0.000    0.000    0.000    0.000 IcoImagePlugin.py:37(_accept)
+        1    0.000    0.000    0.000    0.000 ImImagePlugin.py:110(_open)
+        1    0.000    0.000    0.001    0.001 Image.py:1879(open)
+        1    0.000    0.000    0.000    0.000 Image.py:280(preinit)
+        2    0.000    0.000    0.000    0.000 Image.py:361(_getdecoder)
+        1    0.000    0.000    0.000    0.000 Image.py:377(_getencoder)
+        5    0.000    0.000    0.000    0.000 Image.py:439(__init__)
+        1    0.000    0.000    0.000    0.000 Image.py:448(_new)
+        4    0.000    0.000    0.000    0.000 Image.py:484(__getattr__)
+        1    0.000    0.000    0.000    0.000 Image.py:503(tostring)
+        3    0.000    0.000    0.000    0.000 Image.py:587(load)
+        1    0.000    0.000    0.000    0.000 Image.py:638(convert)
+        5    0.000    0.000    0.000    0.000 Image.py:82(isStringType)
+        3    0.000    0.000    0.000    0.000 Image.py:91(isTupleType)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:115(load)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:219(load_prepare)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:228(load_end)
+        1    0.000    0.000    0.000    0.000 ImageFile.py:49(_tilesort)
+        4    0.000    0.000    0.000    0.000 ImageFile.py:508(_safe_read)
+        4    0.000    0.000    0.001    0.000 ImageFile.py:63(__init__)
+        1    0.000    0.000    0.000    0.000 ImtImagePlugin.py:37(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:110(_open)
+        1    0.000    0.000    0.000    0.000 IptcImagePlugin.py:62(field)
+        1    0.000    0.000    0.000    0.000 JpegImagePlugin.py:231(_accept)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:28(i32)
+        1    0.000    0.000    0.000    0.000 McIdasImagePlugin.py:31(_accept)
+        1    0.000    0.000    0.000    0.000 PcxImagePlugin.py:35(_accept)
+        1    0.000    0.000    0.000    0.000 PngImagePlugin.py:261(_accept)
+        1    0.000    0.000    0.000    0.000 PpmImagePlugin.py:40(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:157(_accept)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:168(__init__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:180(reset)
+       14    0.000    0.000    0.000    0.000 TiffImagePlugin.py:199(__getitem__)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:209(get)
+       11    0.000    0.000    0.000    0.000 TiffImagePlugin.py:215(getscalar)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:230(has_key)
+        8    0.000    0.000    0.000    0.000 TiffImagePlugin.py:255(load_short)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:262(load_long)
+        2    0.000    0.000    0.000    0.000 TiffImagePlugin.py:269(load_rational)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:295(load)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:445(_open)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:477(_seek)
+        1    0.000    0.000    0.000    0.000 TiffImagePlugin.py:497(_decoder)
+        1    0.000    0.000    0.001    0.001 TiffImagePlugin.py:521(_setup)
+       37    0.000    0.000    0.000    0.000 TiffImagePlugin.py:64(il16)
+       26    0.000    0.000    0.000    0.000 TiffImagePlugin.py:66(il32)
+        1    0.000    0.000    0.000    0.000 fabioimage.py:212(resetvals)
+        2    0.000    0.000    0.001    0.001 fabioimage.py:284(_open)
+        2    0.000    0.000    0.001    0.000 fabioimage.py:314(_compressed_stream)
+        2    0.000    0.000    0.000    0.000 fabioimage.py:39(__init__)
+        1    0.000    0.000    0.000    0.000 fromnumeric.py:101(reshape)
+        2    0.000    0.000    0.000    0.000 gzip.py:157(_init_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:161(_read_gzip_header)
+        6    0.000    0.000    0.000    0.000 gzip.py:18(U32)
+        2    0.000    0.000    0.001    0.000 gzip.py:208(read)
+        3    0.000    0.000    0.001    0.000 gzip.py:245(_read)
+        2    0.000    0.000    0.000    0.000 gzip.py:27(LOWU32)
+        2    0.000    0.000    0.000    0.000 gzip.py:295(_add_read_data)
+        2    0.000    0.000    0.000    0.000 gzip.py:301(_read_eof)
+        2    0.000    0.000    0.000    0.000 gzip.py:315(close)
+        2    0.000    0.000    0.000    0.000 gzip.py:334(__del__)
+        4    0.000    0.000    0.000    0.000 gzip.py:39(read32)
+        2    0.000    0.000    0.000    0.000 gzip.py:60(__init__)
+        2    0.000    0.000    0.000    0.000 ntpath.py:183(splitext)
+        1    0.000    0.000    0.000    0.000 openimage.py:54(do_magic)
+        1    0.000    0.000    0.004    0.004 openimage.py:68(openimage)
+        1    0.000    0.000    0.001    0.001 openimage.py:94(_openimage)
+        1    0.000    0.000    0.000    0.000 string.py:306(join)
+        4    0.000    0.000    0.000    0.000 struct.py:77(unpack)
+        1    0.000    0.000    0.000    0.000 tifimage.py:34(__init__)
+        1    0.000    0.000    0.000    0.000 tifimage.py:39(_readheader)
+        1    0.000    0.000    0.003    0.003 tifimage.py:58(read)
+        1    0.000    0.000    0.000    0.000 {_imaging.new}
+        3    0.000    0.000    0.000    0.000 {apply}
+        1    0.000    0.000    0.000    0.000 {built-in method convert}
+        2    0.000    0.000    0.000    0.000 {built-in method decode}
+        2    0.000    0.000    0.000    0.000 {built-in method decompress}
+        1    0.000    0.000    0.000    0.000 {built-in method encode}
+        2    0.000    0.000    0.000    0.000 {built-in method pixel_access}
+        1    0.000    0.000    0.000    0.000 {built-in method setimage}
+        1    0.000    0.000    0.000    0.000 {cStringIO.StringIO}
+        1    0.000    0.000    0.000    0.000 {cmp}
+        5    0.000    0.000    0.000    0.000 {getattr}
+        5    0.000    0.000    0.000    0.000 {hasattr}
+       14    0.000    0.000    0.000    0.000 {isinstance}
+       44    0.000    0.000    0.000    0.000 {len}
+        3    0.000    0.000    0.000    0.000 {max}
+       15    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
+        2    0.000    0.000    0.000    0.000 {method 'close' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
+        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
+        3    0.000    0.000    0.000    0.000 {method 'find' of 'str' objects}
+        5    0.000    0.000    0.000    0.000 {method 'has_key' of 'dict' objects}
+        2    0.000    0.000    0.000    0.000 {method 'join' of 'str' objects}
+        2    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
+       28    0.000    0.000    0.000    0.000 {method 'read' of 'cStringIO.StringI' objects}
+       50    0.000    0.000    0.000    0.000 {method 'read' of 'file' objects}
+        6    0.000    0.000    0.000    0.000 {method 'rfind' of 'str' objects}
+       16    0.000    0.000    0.000    0.000 {method 'seek' of 'cStringIO.StringI' objects}
+        9    0.000    0.000    0.000    0.000 {method 'seek' of 'file' objects}
+        1    0.000    0.000    0.000    0.000 {method 'sort' of 'list' objects}
+        5    0.000    0.000    0.000    0.000 {method 'tell' of 'cStringIO.StringI' objects}
+        6    0.000    0.000    0.000    0.000 {method 'tell' of 'file' objects}
+        4    0.000    0.000    0.000    0.000 {method 'unpack' of 'Struct' objects}
+        6    0.000    0.000    0.000    0.000 {min}
+        2    0.000    0.000    0.000    0.000 {numpy.core.multiarray.fromstring}
+        2    0.000    0.000    0.000    0.000 {open}
+      208    0.000    0.000    0.000    0.000 {ord}
+       12    0.000    0.000    0.000    0.000 {range}
+        4    0.000    0.000    0.000    0.000 {zlib.crc32}
+        2    0.000    0.000    0.000    0.000 {zlib.decompressobj}
+
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-fabio.git



More information about the debian-science-commits mailing list