src/amuse/datamodel/particles.py
def sorted_by_attributes(self, *attributes):
        """
        Returns a subset with the same particles, but sorted
        using the given attribute names. The last attribute name
        in the call is used for the primary sort order, the
        second-to-last attribute name for the secondary sort order,
        and so on. See also numpy.lexsort


        >>> particles = Particles(4)
        >>> particles.mass = [2.0, 3.0, 1.0, 4.0] | units.kg
        >>> particles.radius = [3.0, 2.0, 1.0, 2.0] | units.m
        >>> sorted = particles.sorted_by_attributes('mass', 'radius')
        >>> print sorted.radius
        [1.0, 2.0, 2.0, 3.0] m
        >>> print sorted.mass
        [1.0, 3.0, 4.0, 2.0] kg
        """
        indices = self.get_all_indices_in_store()
        keys = self.get_all_keys_in_store()
        values = self.get_values_in_store(indices, attributes)
        values = [x.number for x in values]
        sorted_indices =  numpy.lexsort(values)

        return self._subset(keys[sorted_indices])

        Returns a subset with the same particles, but sorted
        using the given attribute names. The last attribute name
        in the call is used for the primary sort order, the
        second-to-last attribute name for the secondary sort order,
        and so on. See also numpy.lexsort


        >>> particles = Particles(4)
        >>> particles.mass = [2.0, 3.0, 1.0, 4.0] | units.kg
        >>> particles.radius = [3.0, 2.0, 1.0, 2.0] | units.m
        >>> sorted = particles.sorted_by_attributes('mass', 'radius')
        >>> print sorted.radius
        [1.0, 2.0, 2.0, 3.0] m
        >>> print sorted.mass
        [1.0, 3.0, 4.0, 2.0] kg
        
Returns a subset with the same particles, but sorted
using the given attribute names. The last attribute name
in the call is used for the primary sort order, the
second-to-last attribute name for the secondary sort order,
and so on.


Returns a subset with the same particles but sorted using the given attribute names . The last attribute name in the call is used for the primary sort order the second - to - last attribute name for the secondary sort order and so on .
def sorted_by_attributes(self, *attributes):
        indices = self.get_all_indices_in_store()
        keys = self.get_all_keys_in_store()
        values = self.get_values_in_store(indices, attributes)
        values = [x.number for x in values]
        sorted_indices =  numpy.lexsort(values)
        return self._subset(keys[sorted_indices])
def sorted_by_attributes ( self , * attributes ) : indices = self . get_all_indices_in_store ( ) keys = self . get_all_keys_in_store ( ) values = self . get_values_in_store ( indices , attributes ) values = [ x . number for x in values ] sorted_indices = numpy . lexsort ( values ) return self . _subset ( keys [ sorted_indices ] )
Returns a subset with the same particles, but sorted
using the given attribute names.
Returns a subset with the same particles but sorted using the given attribute names .
"""
        Returns a subset with the same particles, but sorted
        using the given attribute names. The last attribute name
        in the call is used for the primary sort order, the
        second-to-last attribute name for the secondary sort order,
        and so on. See also numpy.lexsort


        >>> particles = Particles(4)
        >>> particles.mass = [2.0, 3.0, 1.0, 4.0] | units.kg
        >>> particles.radius = [3.0, 2.0, 1.0, 2.0] | units.m
        >>> sorted = particles.sorted_by_attributes('mass', 'radius')
        >>> print sorted.radius
        [1.0, 2.0, 2.0, 3.0] m
        >>> print sorted.mass
        [1.0, 3.0, 4.0, 2.0] kg
        """
self