src/amuse/datamodel/particles.py
def sorted_by_attribute(self, attribute, kind='mergesort'):
        """
        Returns a subset with the same particles, but sorted
        using the given attribute name

        :argument: kind, the sort method for supported kinds see
            the numpy.sort documentation


        >>> particles = Particles(3)
        >>> particles.mass = [2.0, 3.0, 1.0] | units.kg
        >>> particles.radius = [1.0, 2.0, 3.0] | units.m
        >>> sorted = particles.sorted_by_attribute('mass')
        >>> print sorted.mass
        [1.0, 2.0, 3.0] kg
        >>> print sorted.radius
        [3.0, 1.0, 2.0] m
        """
        return self.__getitem__(getattr(self, attribute).argsort(kind=kind))

        Returns a subset with the same particles, but sorted
        using the given attribute name

        :argument: kind, the sort method for supported kinds see
            the numpy.sort documentation


        >>> particles = Particles(3)
        >>> particles.mass = [2.0, 3.0, 1.0] | units.kg
        >>> particles.radius = [1.0, 2.0, 3.0] | units.m
        >>> sorted = particles.sorted_by_attribute('mass')
        >>> print sorted.mass
        [1.0, 2.0, 3.0] kg
        >>> print sorted.radius
        [3.0, 1.0, 2.0] m
        
Returns a subset with the same particles, but sorted
using the given attribute name

:argument: kind, the sort method for supported kinds see
the numpy.sort documentation


Returns a subset with the same particles but sorted using the given attribute name : argument : kind the sort method for supported kinds see the numpy . sort documentation
def sorted_by_attribute(self, attribute, kind='mergesort'):
        return self.__getitem__(getattr(self, attribute).argsort(kind=kind))
def sorted_by_attribute ( self , attribute , kind = 'mergesort' ) : return self . __getitem__ ( getattr ( self , attribute ) . argsort ( kind = kind ) )
Returns a subset with the same particles, but sorted
using the given attribute name
Returns a subset with the same particles but sorted using the given attribute name
"""
        Returns a subset with the same particles, but sorted
        using the given attribute name

        :argument: kind, the sort method for supported kinds see
            the numpy.sort documentation


        >>> particles = Particles(3)
        >>> particles.mass = [2.0, 3.0, 1.0] | units.kg
        >>> particles.radius = [1.0, 2.0, 3.0] | units.m
        >>> sorted = particles.sorted_by_attribute('mass')
        >>> print sorted.mass
        [1.0, 2.0, 3.0] kg
        >>> print sorted.radius
        [3.0, 1.0, 2.0] m
        """
self
attribute
kind