src/amuse/datamodel/particles.py
def copy_attribute(self, name, target_name = None):
        """ Copy the values of one attribute from the source set to the target set.
        The copied attribute can have a different name in the target set.

        :argument name: name of the attribute in the source set
        :argument target_name: name of the attribute in the target set, when None (default) the target_name
           will be set equal to the name

        >>> from amuse.datamodel import Particles
        >>> from amuse.units import units
        >>> particles1 = Particles(2)
        >>> particles2 = particles1.copy()
        >>> particles1.mass = 1 | units.m
        >>> particles2.mass = 3 | units.m
        >>> channel = particles1.new_channel_to(particles2)
        >>> channel.copy_attribute("mass", "mass_from_p2")
        >>> print particles2.mass_from_p2
        [1.0, 1.0] m
        >>> print particles2.mass - particles2.mass_from_p2
        [2.0, 2.0] m

        """
        if target_name is None:
            target_name = name

        self._reindex()
        
        if len(self.keys) == 0:
            return
            
        data = self.from_particles.get_values_in_store(self.from_indices, [name,])
        self.to_particles.set_values_in_store(self.to_indices, [target_name,], data)
 Copy the values of one attribute from the source set to the target set.
        The copied attribute can have a different name in the target set.

        :argument name: name of the attribute in the source set
        :argument target_name: name of the attribute in the target set, when None (default) the target_name
           will be set equal to the name

        >>> from amuse.datamodel import Particles
        >>> from amuse.units import units
        >>> particles1 = Particles(2)
        >>> particles2 = particles1.copy()
        >>> particles1.mass = 1 | units.m
        >>> particles2.mass = 3 | units.m
        >>> channel = particles1.new_channel_to(particles2)
        >>> channel.copy_attribute("mass", "mass_from_p2")
        >>> print particles2.mass_from_p2
        [1.0, 1.0] m
        >>> print particles2.mass - particles2.mass_from_p2
        [2.0, 2.0] m

        
Copy the values of one attribute from the source set to the target set.
The copied attribute can have a different name in the target set.
Copy the values of one attribute from the source set to the target set . The copied attribute can have a different name in the target set .
def copy_attribute(self, name, target_name = None):
        if target_name is None:
            target_name = name
        self._reindex()
        if len(self.keys) == 0:
            return
        data = self.from_particles.get_values_in_store(self.from_indices, [name,])
        self.to_particles.set_values_in_store(self.to_indices, [target_name,], data)
def copy_attribute ( self , name , target_name = None ) : if target_name is None : target_name = name self . _reindex ( ) if len ( self . keys ) == 0 : return data = self . from_particles . get_values_in_store ( self . from_indices , [ name , ] ) self . to_particles . set_values_in_store ( self . to_indices , [ target_name , ] , data )
Copy the values of one attribute from the source set to the target set.
Copy the values of one attribute from the source set to the target set .
""" Copy the values of one attribute from the source set to the target set.
        The copied attribute can have a different name in the target set.

        :argument name: name of the attribute in the source set
        :argument target_name: name of the attribute in the target set, when None (default) the target_name
           will be set equal to the name

        >>> from amuse.datamodel import Particles
        >>> from amuse.units import units
        >>> particles1 = Particles(2)
        >>> particles2 = particles1.copy()
        >>> particles1.mass = 1 | units.m
        >>> particles2.mass = 3 | units.m
        >>> channel = particles1.new_channel_to(particles2)
        >>> channel.copy_attribute("mass", "mass_from_p2")
        >>> print particles2.mass_from_p2
        [1.0, 1.0] m
        >>> print particles2.mass - particles2.mass_from_p2
        [2.0, 2.0] m

        """
self
name
name of the attribute in the source set
name of the attribute in the source set
target_name
name of the attribute in the target set, when None (default) the target_name
will be set equal to the name

>>> from amuse.datamodel import Particles
>>> from amuse.units import units
>>> particles1 = Particles(2)
>>> particles2 = particles1.copy()
>>> particles1.mass = 1 | units.m
>>> particles2.mass = 3 | units.m
>>> channel = particles1.new_channel_to(particles2)
>>> channel.copy_attribute("mass", "mass_from_p2")
>>> print particles2.mass_from_p2
[1.0, 1.0] m
>>> print particles2.mass - particles2.mass_from_p2
[2.0, 2.0] m
name of the attribute in the target set when None ( default ) the target_name will be set equal to the name >>> from amuse . datamodel import Particles >>> from amuse . units import units >>> particles1 = Particles ( 2 ) >>> particles2 = particles1 . copy () >>> particles1 . mass = 1 | units . m >>> particles2 . mass = 3 | units . m >>> channel = particles1 . new_channel_to ( particles2 ) >>> channel . copy_attribute ( " mass " " mass_from_p2 " ) >>> print particles2 . mass_from_p2 [ 1 . 0 1 . 0 ] m >>> print particles2 . mass - particles2 . mass_from_p2 [ 2 . 0 2 . 0 ] m