Discussion List Archives

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

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

Hi Nick,

You are of course correct - I was trying to think about this in 'C' terms - however it also occurs to me that the char * is a NULL terminated string... the API below would be broken then :o)

So strCompressedImage = compress(integerArray) and the inverse with flex_ints would be correct. And much cleaner.

I didn't think byte offset worked with anything other than integers? I would be aiming for compression and decompression of integer maps much faster than my python implementation, which is clearly not hard!

How does this sound? I could see that this would be more generally useful...

Best wishes,

Graeme




-----Original Message-----
From: imgcif-l-bounces@iucr.org on behalf of Nicholas K. Sauter
Sent: Thu 6/24/2010 7:54 PM
To: The Crystallographic Binary File and its imgCIF application to image data
Subject: Re: [Imgcif-l] Reading CBF files from Python

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@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
_______________________________________________
imgcif-l mailing list
imgcif-l@iucr.org
http://scripts.iucr.org/mailman/listinfo/imgcif-l


-- 
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. 
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
 



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