Discussion List Archives

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Imgcif-l] Reading CBF files from Python

Dear Graeme and Jon,

   It sounds like you two have things under control.
Let me know you need anything.

   Regards,
     Herbert

=====================================================
  Herbert J. Bernstein, Professor of Computer Science
    Dowling College, Kramer Science Center, KSC 121
         Idle Hour Blvd, Oakdale, NY, 11769

                  +1-631-244-3035
                  yaya@dowling.edu
=====================================================

On Mon, 21 Jun 2010, Jon Wright wrote:

> Hi Graeme,
>
> To use the binding the wrapper needs to be compiled, which should just
> mean typing "python setup.py build" in the pycbf subfolder. Then you
> just need to drop pycbf.py and _pycbf.so somewhere on your python path
> (import sys; print sys.path). The binding runs entirely via calls to
> CBFlib, so if there is something useful in there, it should be possible
> to include it. Herbert can probably help more for knowing where to look.
>
> If you can send an example image off-list I'll try to take a look
>
> Best
>
> Jon
>
> Graeme.Winter@Diamond.ac.uk wrote:
>>> Hi Jon,
>>>
>>> Thanks - I see that this is bundled with cctbx and Labelit, which was
>>> awesome. However it seems that the modules from pycbf aren't available
>>> as standard :o(  - I am slightly hamstrung by the fact that I use the
>>> cctbx python, so having access to other python extensions presents a
>>> problem. However I *really need* cctbx :o) - xia2 won't work without it
>>> now.
>>>
>>> My rate limiting step right now is the reading and writing of the byte
>>> offset compression. I am going to guess that if I messed with the python
>>> paths and such I should be able to find your implementation. Do you have
>>> a method in there which will allow me to just pack and unpack the
>>> byte_offset compressed regions?
>>>
>>> This is the data in question:
>>>
>>> ###CBF: Version July 2008 generated by XDS
>>>
>>> data_FRAME.cbf
>>>
>>> _array_data.header_convention "XDS special"
>>> _array_data.header_contents
>>> ;
>>> ;
>>>
>>> _array_data.data
>>> ;
>>> --CIF-BINARY-FORMAT-SECTION--
>>> Content-Type: application/octet-stream;
>>>      conversions="x-CBF_BYTE_OFFSET"
>>> Content-Transfer-Encoding: BINARY
>>> X-Binary-Size:   9450352
>>> X-Binary-ID: 1
>>> X-Binary-Element-Type: "signed 32-bit integer"
>>> X-Binary-Element-Byte-Order: LITTLE_ENDIAN
>>> X-Binary-Number-of-Elements:   9437184
>>> X-Binary-Size-Fastest-Dimension:    3072
>>> X-Binary-Size-Second-Dimension:    3072
>>> (massive binary blob)
>>>
>>> The bit which is causing me problems is that the cbflib adaptor raises
>>> an exception as most of the "proper" cbf stuff (i.e. the CIF) is not
>>> present. Erk.
>>>
>>> Any suggestions will be pounced apon!
>>>
>>> Many thanks,
>>>
>>> Graeme
>>>
>>> -----Original Message-----
>>> From: imgcif-l-bounces@iucr.org [mailto:imgcif-l-bounces@iucr.org] On
>>> Behalf Of Jon Wright
>>> Sent: 21 June 2010 10:06
>>> To: The Crystallographic Binary File and its imgCIF application to image
>>> data
>>> Subject: Re: [Imgcif-l] Reading CBF files from Python
>>>
>>> Hi Graeme,
>>>
>>> There is a swig based python binding included with CBFlib in the pycbf
>>> subfolder. It should work for reading files (see pycbf_test1.py).
>>> Further work was needed for writing. Let me know if you run into
>>> problems. Improvements are most welcome.
>>>
>>> Best
>>>
>>> Jon
>>>
>>> Graeme.Winter@Diamond.ac.uk wrote:
>>>> Hi Folks,
>>>>
>>>> Does anyone know if CBF images can be read from Python? I coded up
>>>> something in Python to do this but it's a spot slow to say the least.
>>>> My interest is partly in reading the cbf "image" files calculated by
>>>> XDS to explain what it has been up to. I could code something up in
>>>> 'c' or a bridge to CBFlib but that would be hardish to maintain, so a
>>>> solution using existing Python libraries would suit me better.
>>>>
>>>> I looked quickly at PyCIFrw but this appears to be mostly about the
>>>> CIF side of things rather than the MIME encoded chunks. Please correct
>>>
>>>> me if I am wrong. I also tried iotbx.detectors.cbf.CBFImage but hit an
>
>
> [*** Terminated Message ***]
>
_______________________________________________
imgcif-l mailing list
imgcif-l@iucr.org
http://scripts.iucr.org/mailman/listinfo/imgcif-l

Reply to: [list | sender only]
International Union of Crystallography

Scientific Union Member of the International Science Council (admitted 1947). Member of CODATA, the ISC Committee on Data. Partner with UNESCO, the United Nations Educational, Scientific and Cultural Organization in the International Year of Crystallography 2014.

International Science Council Scientific Freedom Policy

The IUCr observes the basic policy of non-discrimination and affirms the right and freedom of scientists to associate in international scientific activity without regard to such factors as ethnic origin, religion, citizenship, language, political stance, gender, sex or age, in accordance with the Statutes of the International Council for Science.