Re: [Matplotlib-users] interger to binary

2008-09-07 Thread Marjolaine Rouault
Hi, Thanks a lot to all of you for your help. This looks very promising. I will test it on Monday. Regards, Marjolaine. Michael Droettboom [EMAIL PROTECTED] 09/05/08 7:54 PM You could do something like: def bitget(value, bit_number): return (value (1 bit_number)) != 0 which will

[Matplotlib-users] interger to binary

2008-09-05 Thread Marjolaine Rouault
Hi, I was wondering if python has the equivalent of the matlab bitget.m function. I have a large 2 dimensional variable of type uint32 which I must convert to binaries and then find if bit 23 of the binary for each point is 0 or 1. The matlab bitget function is ideal for that but I can't find

Re: [Matplotlib-users] interger to binary

2008-09-05 Thread Michael Droettboom
You could do something like: def bitget(value, bit_number): return (value (1 bit_number)) != 0 which will return True or False for the given bit number, and this function works on numpy arrays. (Bits are numbered base-0 -- I don't know if that matches matlab). Hope that helps, Mike