[Imgcif-l] Reading CBF files from Python

Nicholas K. Sauter nksauter at lbl.gov
Thu Jun 24 19:54:03 BST 2010


Hi Graeme,

What would be the overall goal here?  Normally within CCTBX, the return 
values and argument values are Python types, so instead of char * and 
unsigned short * we use Python string and scitbx.flex_int.  It may be 
possible to wrap raw pointers with Boost Python such that they are 
treated opaquely by Python, but we don't usually use this procedure. 

Then again, cctbx::cbflib_adaptbx specializes the byte offset 
compression (optimized_byte_offset) so that integer arrays can be 
compressed extra fast, above what is possible with the generic low-level 
routine. 

Are we aiming here to compress non-integer types, mixing of multiple 
types, better performance, or something else?

Best,
Nick


Graeme.Winter at Diamond.ac.uk wrote:
> Hi Nick,
>
> Many thanks - this is rather quicker than my pure Python implementation
> (just over two orders of magnitude!)
>
> Would it be straightforward to boost the lower level compression /
> decompression routines? It's not clear from the cbflib docs that these
> would be easily extracted - for instance:
>
>  char * compressed = cbf_byte_offset_compress(unsigned short * array,
> int nx, int ny)
>
>  - and - 
>
>  unsigned short * array = cbf_byte_offset_decompress(char * compressed,
> int nx, int ny)
>
> Are not really exported in a stand alone fashion?
>
> Still - this is *much* better than what I have right now.
>
> Best wishes,
>
> Graeme


More information about the imgcif-l mailing list