src/amuse/datamodel/particles.py
def select_array(self, selection_function, attributes = ()):
        """
        Returns a subset view on this set. The subset
        will contain all particles for which the selection
        function returned True. The selection function
        is called with a vector quantities containing all
        the values for the attributes parameter.

        This function can be faster than the select function
        as it works on entire arrays. The selection_function
        is called once.

        >>> particles = Particles(3)
        >>> particles.mass = [10.0, 20.0, 30.0] | units.kg
        >>> particles.x = [1.0, 2.0, 3.0] | units.m
        >>> subset = particles.select_array(lambda x : x > 15.0 | units.kg, ["mass"])
        >>> print subset.mass
        [20.0, 30.0] kg
        >>> print subset.x
        [2.0, 3.0] m


        >>> particles = Particles(1000)
        >>> particles.x = units.m.new_quantity(numpy.arange(1,1001))
        >>> subset = particles.select_array(lambda x : x > (500 | units.m), ("x",) )
        >>> print len(subset)
        500
        """
        keys = self.get_all_keys_in_store()
        #values = self._get_values(keys, attributes) #fast but no vectors
        quantities = [getattr(self, x) for x in attributes]
        selections = selection_function(*quantities)
        selected_keys =  numpy.compress(selections, keys)

        return self._subset(selected_keys)

        Returns a subset view on this set. The subset
        will contain all particles for which the selection
        function returned True. The selection function
        is called with a vector quantities containing all
        the values for the attributes parameter.

        This function can be faster than the select function
        as it works on entire arrays. The selection_function
        is called once.

        >>> particles = Particles(3)
        >>> particles.mass = [10.0, 20.0, 30.0] | units.kg
        >>> particles.x = [1.0, 2.0, 3.0] | units.m
        >>> subset = particles.select_array(lambda x : x > 15.0 | units.kg, ["mass"])
        >>> print subset.mass
        [20.0, 30.0] kg
        >>> print subset.x
        [2.0, 3.0] m


        >>> particles = Particles(1000)
        >>> particles.x = units.m.new_quantity(numpy.arange(1,1001))
        >>> subset = particles.select_array(lambda x : x > (500 | units.m), ("x",) )
        >>> print len(subset)
        500
        
Returns a subset view on this set. The subset
will contain all particles for which the selection
function returned True. The selection function
is called with a vector quantities containing all
the values for the attributes parameter.

This function can be faster than the select function
as it works on entire arrays. The selection_function
is called once.




Returns a subset view on this set . The subset will contain all particles for which the selection function returned True . The selection function is called with a vector quantities containing all the values for the attributes parameter . This function can be faster than the select function as it works on entire arrays . The selection_function is called once .
def select_array(self, selection_function, attributes = ()):
        keys = self.get_all_keys_in_store()
        quantities = [getattr(self, x) for x in attributes]
        selections = selection_function(*quantities)
        selected_keys =  numpy.compress(selections, keys)
        return self._subset(selected_keys)
def select_array ( self , selection_function , attributes = ( ) ) : keys = self . get_all_keys_in_store ( ) quantities = [ getattr ( self , x ) for x in attributes ] selections = selection_function ( * quantities ) selected_keys = numpy . compress ( selections , keys ) return self . _subset ( selected_keys )
Returns a subset view on this set.
Returns a subset view on this set .
"""
        Returns a subset view on this set. The subset
        will contain all particles for which the selection
        function returned True. The selection function
        is called with a vector quantities containing all
        the values for the attributes parameter.

        This function can be faster than the select function
        as it works on entire arrays. The selection_function
        is called once.

        >>> particles = Particles(3)
        >>> particles.mass = [10.0, 20.0, 30.0] | units.kg
        >>> particles.x = [1.0, 2.0, 3.0] | units.m
        >>> subset = particles.select_array(lambda x : x > 15.0 | units.kg, ["mass"])
        >>> print subset.mass
        [20.0, 30.0] kg
        >>> print subset.x
        [2.0, 3.0] m


        >>> particles = Particles(1000)
        >>> particles.x = units.m.new_quantity(numpy.arange(1,1001))
        >>> subset = particles.select_array(lambda x : x > (500 | units.m), ("x",) )
        >>> print len(subset)
        500
        """ #values = self._get_values(keys, attributes) #fast but no vectors
self
selection_function
attributes