aglie / meerkat

A python program for performing reciprocal space reconstruction from single crystal x-ray measurements.
MIT License
9 stars 6 forks source link

BKGPIX.CBF from XDS #3

Open k-eks opened 9 years ago

k-eks commented 9 years ago

The XDS generated file "BKGPIX.CBF" can not be read by meerkat, converting the file to a TIFF works though!

bizartor commented 9 years ago

I think I am having the same issue, except when I convert BKGINIT.cbf to BKGINIT.tif using ADXV, it doesn't work either. Could you tell me which program you use to convert to tiff?

Here's what I've tried. The meerkat script consists of just the first 4 lines of the example on the main page, using either BKGINIT.cbf or BKGINIT.tif:

$ cat ISF_B_136_06.py from meerkat import reconstruct_data import fabio

load the pixels which should be used in reconstruction

measured_pixels=fabio.open('BKGINIT.cbf').data>=0

Running that script using BKGINIT.cbf gives the following:

$ python ISF_B_136_06.py WARNING:fabioimage:PIL is not installed ... trying to do without WARNING:tifimage:PIL is not installed ... trying to do without WARNING:bruker100image:PIL is not installed ... trying to do without Traceback (most recent call last): File "ISF_B_136_06.py", line 5, in measuredpixels=fabio.open('BKGINIT.cbf').data>=0 File "/usr/lib/python2.7/site-packages/fabio/openimage.py", line 113, in openimage obj = obj.read(filename, frame) File "/usr/lib/python2.7/site-packages/fabio/cbfimage.py", line 207, in read ref = numpy.string(self.header["Content-MD5"]) KeyError: 'Content-MD5'

Running the script using BKGINIT.tif gives a different error:

$ python ISF_B_136_06.py WARNING:fabioimage:PIL is not installed ... trying to do without WARNING:tifimage:PIL is not installed ... trying to do without WARNING:bruker100image:PIL is not installed ... trying to do without WARNING:tifimage:Unable to read BKGINIT.tif with TiffIO due to Unsupported number of bits for unsigned int: (8, 8, 8, 8), trying PIL ERROR:tifimage:Error in opening BKGINIT.tif: no tiff reader managed to read the file. Traceback (most recent call last): File "ISF_B_136_06.py", line 5, in measured_pixels=fabio.open('BKGINIT.tif').data>=0 File "/usr/lib/python2.7/site-packages/fabio/openimage.py", line 113, in openimage obj = obj.read(filename, frame) File "/usr/lib/python2.7/site-packages/fabio/tifimage.py", line 166, in read self.bpp = len(numpy.zeros(1, dtype=self.data.dtype).tostring()) AttributeError: 'NoneType' object has no attribute 'dtype'

aglie commented 9 years ago

Oh, it is interesting. This is an error in fabio, most probably it did not install fully. Could you provide the version of fabio? You can get it running the following in a terminal

python -c 'import fabio; print fabio._version.version'
k-eks commented 9 years ago

My Version is 0.2.1

aglie commented 9 years ago

Oh, I managed to reproduce. Now I'll try to figure out what is wrong.

aglie commented 9 years ago

As a quick fix you can use no mask for now:

from meerkat import reconstruct_data

#reconstruct dataset
reconstruct_data(filename_template='../frames/PdCPTN01002_%05i.cbf,
        first_image=1,
        last_image=3600,
        reconstruct_in_orthonormal_basis=False,
        maxind=[4,5,16], #the reconstruction will be made for h=-4...4, k=-5...5, l=-16...16
        number_of_pixels=[801, 801, 801], #The resulting size of the array. Controls the step size
        polarization_factor=0.5,
        path_to_XPARM='/home/arkadiy/work/data/PdCPTN01002/xds',
        output_filename='reconstruction.h5',
        all_in_memory=False,
        size_of_cache=100,
        override=True)
k-eks commented 9 years ago

@bizartor I'm using ALBULA from DECTRIS (https://www.dectris.com/Albula_Overview.html)

aglie commented 9 years ago

Ok, the status so far:

I registered it as an issue on fabio and proposed the fix for their creators:

https://github.com/kif/fabio/issues/25

Once they accept it, the fix will be available on fabio installation from pip. If you are not patient enough to wait for that, you can get the patched version of fabio from here:

https://github.com/aglie/fabio

and install it with distutils.

bizartor commented 9 years ago

Thank you for your replies @k-eks and @aglie. I'm away this week, so I can't access the computer to test the fixed fabio, but I will do so when I get back. In the meantime I had a quick question about the specification of maxind, for which I will start a new thread.