Re: Extract Indices of Numpy Array Based on Given Bit Information

2014-10-18 Thread Artur Bercik
On Sat, Oct 18, 2014 at 4:10 PM, Chris Angelico wrote: > On Sat, Oct 18, 2014 at 6:02 PM, Artur Bercik wrote: > > So, the Bit No. 2-5 for the following case is '1101', right? > > > > 1073741877: 1110101 > > > > If my required bit combination for Bit No. 2-5 is '1011', t

Re: Extract Indices of Numpy Array Based on Given Bit Information

2014-10-18 Thread Artur Bercik
So, the Bit No. 2-5 for the following case is '1101', right? 1073741877: 1110101 If my required bit combination for Bit No. 2-5 is '1011', then the above number (1073741877) is not chosen, right?? Look forward to know your confirmation. On Sat, Oct 18, 2014 at 3:50 PM,

Re: Extract Indices of Numpy Array Based on Given Bit Information

2014-10-18 Thread Artur Bercik
Thanks Chris Angelico for your nice answer. I got some sense, but could not imagine if required Bit No. 2–5, and Bit Combination . I hope example with the new case would make me more sense. Artur On Sat, Oct 18, 2014 at 3:24 PM, Chris Angelico wrote: > On Sat, Oct 18, 2014 at 4:58 PM, A

Re: Extract Indices of Numpy Array Based on Given Bit Information

2014-10-18 Thread Chris Angelico
On Sat, Oct 18, 2014 at 6:21 PM, Artur Bercik wrote: > Thank you very much Chris Angelico, I have come to know it. > You're most welcome. And thank you for taking heed of the request to not top-post. :) Hang around, you never know what weird and wonderful things you'll learn! -- https://mail.pyt

Re: Extract Indices of Numpy Array Based on Given Bit Information

2014-10-18 Thread Chris Angelico
On Sat, Oct 18, 2014 at 6:02 PM, Artur Bercik wrote: > So, the Bit No. 2-5 for the following case is '1101', right? > > 1073741877: 1110101 > > If my required bit combination for Bit No. 2-5 is '1011', then the above > number (1073741877) is not chosen, right?? > > Look f

Re: Extract Indices of Numpy Array Based on Given Bit Information

2014-10-17 Thread Chris Angelico
On Sat, Oct 18, 2014 at 5:42 PM, Artur Bercik wrote: > I got some sense, but could not imagine if required Bit No. 2–5, and Bit > Combination . > > I hope example with the new case would make me more sense. > Just write the number in binary, with the bits you're interested in set to 1, and e

Re: Extract Indices of Numpy Array Based on Given Bit Information

2014-10-17 Thread Chris Angelico
On Sat, Oct 18, 2014 at 4:58 PM, Artur Bercik wrote: > I want to get the index of my data where the following occurs: > > Bit No. 0–1 > Bit Combination: 00 So, what you want to do is look at each number in binary, and find the ones that have two zeroes in the last two places? 1073741824: 1000

Extract Indices of Numpy Array Based on Given Bit Information

2014-10-17 Thread Artur Bercik
Dear Python and Numpy Users: My data are in the form of '32-bit unsigned integer' as follows: myData = np.array([1073741824, 1073741877, 1073742657, 1073742709, 1073742723, 1073755137, 1073755189,1073755969],dtype=np.int32) I want to get the index of my data where the following occurs: Bit No.