src/amuse/ext/orbital_elements.py
def new_binary_from_orbital_elements(
        mass1,
        mass2,
        semimajor_axis,
        eccentricity=0,
        true_anomaly=0 | units.deg,
        inclination=0 | units.deg,
        longitude_of_the_ascending_node=0 | units.deg,
        argument_of_periapsis=0 | units.deg,
        G=None
        ):
    """
    returns a two-particle Particle set, with the second particle's position
    and velocities computed from the input orbital elements.
    inclination is given between 0 and 180 deg.
    angles are assumed to be in deg if no unit is given.
    """
    def angle_with_unit(angle, default_unit=units.deg):
        try:
            default_unit = angle.unit
        except:
            angle = angle | default_unit
        return angle

    # If no unit is given for angles, assume they are in degrees
    true_anomaly = angle_with_unit(true_anomaly, default_unit=units.deg)
    inclination = angle_with_unit(inclination, default_unit=units.deg)
    argument_of_periapsis = angle_with_unit(
            argument_of_periapsis,
            default_unit=units.deg
            )
    longitude_of_the_ascending_node = angle_with_unit(
            longitude_of_the_ascending_node,
            default_unit=units.deg
            )
    primary, secondary = generate_binaries(
            mass1, mass2, semimajor_axis,
            eccentricity=eccentricity,
            true_anomaly=true_anomaly,
            inclination=inclination,
            longitude_of_the_ascending_node=longitude_of_the_ascending_node,
            argument_of_periapsis=argument_of_periapsis,
            G=G
            )

    result = Particles()
    result.add_particle(primary[0])
    result.add_particle(secondary[0])
    return result

    returns a two-particle Particle set, with the second particle's position
    and velocities computed from the input orbital elements.
    inclination is given between 0 and 180 deg.
    angles are assumed to be in deg if no unit is given.
    
returns a two-particle Particle set, with the second particle's position
and velocities computed from the input orbital elements.
inclination is given between 0 and 180 deg.
angles are assumed to be in deg if no unit is given.
returns a two - particle Particle set with the second particle ' s position and velocities computed from the input orbital elements . inclination is given between 0 and 180 deg . angles are assumed to be in deg if no unit is given .
def new_binary_from_orbital_elements(
        mass1,
        mass2,
        semimajor_axis,
        eccentricity=0,
        true_anomaly=0 | units.deg,
        inclination=0 | units.deg,
        longitude_of_the_ascending_node=0 | units.deg,
        argument_of_periapsis=0 | units.deg,
        G=None
        ):
    def angle_with_unit(angle, default_unit=units.deg):
        try:
            default_unit = angle.unit
        except:
            angle = angle | default_unit
        return angle
    true_anomaly = angle_with_unit(true_anomaly, default_unit=units.deg)
    inclination = angle_with_unit(inclination, default_unit=units.deg)
    argument_of_periapsis = angle_with_unit(
            argument_of_periapsis,
            default_unit=units.deg
            )
    longitude_of_the_ascending_node = angle_with_unit(
            longitude_of_the_ascending_node,
            default_unit=units.deg
            )
    primary, secondary = generate_binaries(
            mass1, mass2, semimajor_axis,
            eccentricity=eccentricity,
            true_anomaly=true_anomaly,
            inclination=inclination,
            longitude_of_the_ascending_node=longitude_of_the_ascending_node,
            argument_of_periapsis=argument_of_periapsis,
            G=G
            )
    result = Particles()
    result.add_particle(primary[0])
    result.add_particle(secondary[0])
    return result
def new_binary_from_orbital_elements ( mass1 , mass2 , semimajor_axis , eccentricity = 0 , true_anomaly = 0 | units . deg , inclination = 0 | units . deg , longitude_of_the_ascending_node = 0 | units . deg , argument_of_periapsis = 0 | units . deg , G = None ) : def angle_with_unit ( angle , default_unit = units . deg ) : try : default_unit = angle . unit except : angle = angle | default_unit return angle true_anomaly = angle_with_unit ( true_anomaly , default_unit = units . deg ) inclination = angle_with_unit ( inclination , default_unit = units . deg ) argument_of_periapsis = angle_with_unit ( argument_of_periapsis , default_unit = units . deg ) longitude_of_the_ascending_node = angle_with_unit ( longitude_of_the_ascending_node , default_unit = units . deg ) primary , secondary = generate_binaries ( mass1 , mass2 , semimajor_axis , eccentricity = eccentricity , true_anomaly = true_anomaly , inclination = inclination , longitude_of_the_ascending_node = longitude_of_the_ascending_node , argument_of_periapsis = argument_of_periapsis , G = G ) result = Particles ( ) result . add_particle ( primary [ 0 ] ) result . add_particle ( secondary [ 0 ] ) return result
returns a two-particle Particle set, with the second particle's position
and velocities computed from the input orbital elements.
returns a two - particle Particle set with the second particle ' s position and velocities computed from the input orbital elements .
"""
    returns a two-particle Particle set, with the second particle's position
    and velocities computed from the input orbital elements.
    inclination is given between 0 and 180 deg.
    angles are assumed to be in deg if no unit is given.
    """ # If no unit is given for angles, assume they are in degrees
mass1
mass2
semimajor_axis
eccentricity
true_anomaly
inclination
longitude_of_the_ascending_node
argument_of_periapsis
G