Discussion List Archives

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

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

All,

OK, Graeme Winter's compress/uncompress routines are now checked in to 
the open source Computational Crystallography Toolbox, 
http://cctbx.sf.net.  They use the CBF byte-offset algorithm to convert 
an integer array to compressed string and vice versa.

A Python unit test to excercise the entire cycle is at 
cctbx_sources/cbflib_adaptbx/excercise_compression.py

Herbert---
You were right:  reading the entire compressed file directly into a 
memory buffer allows the decompression routine to operate much faster, 
compared with getc() or a smaller buffer.  2Kx2K files compress & 
uncompress in about 50 ms...faster than anything else I've seen!

Nick Sauter

Graeme.Winter@Diamond.ac.uk wrote:
> Hi Folks,
>
> In case anyone is interested, I coded up a pretty simple implementation
> of the byte offset compression and decompression in C++, with the
> interface
>
>   vector<char> compress(vector<int> data)
>   vector<int> uncompress(vector<char> packed)
>
> It could be useful for people wanting to "edit" images, which is what I
> had in mind. It's finding it's way into cctbx (thanks Nick!) but I will
> be happy to mail it out if anyone would like it.
>
> Best wishes,
>
> Graeme
>
>
>   
>   

_______________________________________________
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.