[cctbxbb] flex index

Ralf Grosse-Kunstleve rwgrosse-kunstleve at lbl.gov
Tue Oct 18 04:28:00 PDT 2011


Yes, that's true, the padded arrays are a permanent struggle. A few days ago
Nat changed the fft_map.real_map_unpadded() method to do the unpadding in
place by default, to avoid memory overhead. That's probably the way to go in
most situations.
Ralf

On Tue, Oct 18, 2011 at 4:20 AM, Monarin Uervirojnangkoorn <
monarin at biochem.uni-luebeck.de> wrote:

> Thanks!. very useful. although doesn't really work with padded array (as in
> the case of real_map object). but found my way round.
>
> best
> mona
>
> On Oct 18, 2011, at 11:17 AM, Ralf Grosse-Kunstleve wrote:
>
> Hi Mona,
>
> Try this:
>
> from scitbx.array_family import flex
> a=flex.double([1,4,5,7,5,6,6,1])
> a.set_selected(a > 5, 5)
> print list(a)
>
> Or in smaller steps:
>
> bool_selection = a > 5
> assert bool_selection.size() == a.size()
> print list(bool_selection)
> a.set_selected(bool_selection, 5)
> print list(a)
>
> You can also call a.set_selected(bool_selection, b)
> where b is an array with as many elements as you have True in the
> bool_selection.
>
> This kind of working with selections is very typical within cctbx/phenix.
> If you look through our sources you'll find a lot of examples; in passing,
> we have two types of selections, bool selections as above, and integer
> selections. The latter are useful for permutations, e.g. to sort array
> elements, or if you know you select only a small number of elements from a
> large array. Let me know if you have more questions about selections and
> I'll be happy to explain. (I guess one day I should write a "Working with
> selections" tutorial.)
>
> Ralf
>
> On Tue, Oct 18, 2011 at 2:54 AM, Monarin Uervirojnangkoorn <
> monarin at biochem.uni-luebeck.de> wrote:
>
>> Hi,
>>
>> I'm using flex and 'd like to get an access to elements fall beyond/ below
>> certain value. eg.
>> a=[1,4,5,7,5,6,6,1]
>> anything beyond 5 should be set to 5. (in matlab then a(a>5)=5;)
>> if you could tell me how to do this quickly for flex, that would be great.
>> for now i use loop and that is... pretty slow.
>>
>> many thanks.
>> mona
>>
>>
>>
>>  ^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^
>> Institute of Biochemistry,
>> Institut für Neuro- und Bioinformatik,
>> Graduate School for Computing in Medicine and Life Sciences
>> University of Lübeck,
>> Ratzeburger Allee 160
>> Lübeck 23538
>> Germany
>> Tel: +49451-5004072
>> Fax: +49451-5004068
>>
>>
>>
>>
>>
>> _______________________________________________
>> cctbxbb mailing list
>> cctbxbb at phenix-online.org
>> http://phenix-online.org/mailman/listinfo/cctbxbb
>>
>>
> _______________________________________________
> cctbxbb mailing list
> cctbxbb at phenix-online.org
> http://phenix-online.org/mailman/listinfo/cctbxbb
>
>
> ^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^
> Institute of Biochemistry,
> Institut für Neuro- und Bioinformatik,
> Graduate School for Computing in Medicine and Life Sciences
> University of Lübeck,
> Ratzeburger Allee 160
> Lübeck 23538
> Germany
> Tel: +49451-5004072
> Fax: +49451-5004068
>
>
>
>
>
> _______________________________________________
> cctbxbb mailing list
> cctbxbb at phenix-online.org
> http://phenix-online.org/mailman/listinfo/cctbxbb
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://phenix-online.org/pipermail/cctbxbb/attachments/20111018/3a0141e4/attachment-0001.htm>


More information about the cctbxbb mailing list