Hi all, Michael's solution worked like a charm. Thanks to all for your valuable input!
Rgs. >>> 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 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 Marjolaine Rouault wrote: > 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 much in python. The > only thing I found was binary_repr which converts to a sting and can only be > used for 1 point at a time. > > Any suggestions? > > Thanks, Marjolaine. > > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users