def asini(b, orbit, solve_for=None):
    """
    Create a constraint for asini in an orbit.

    If any of the required parameters ('asini', 'sma', 'incl') do not
    exist in the orbit, they will be created.

    :parameter b: the :class:`phoebe.frontend.bundle.Bundle`
    :parameter str orbit: the label of the orbit in which this
        constraint should be built
    :parameter str solve_for:  if 'asini' should not be the derived/constrained
        parameter, provide which other parameter should be derived
        (ie 'sma' or 'incl')
    :returns: lhs (Parameter), rhs (ConstraintParameter), args (list of arguments
        that were passed to this function)
    """

    orbit_ps = _get_system_ps(b, orbit)

    # We want to get the parameters in THIS orbit, but calling through
    # the bundle in case we need to create it.
    # To do that, we need to know the search parameters to get items from this PS.
    metawargs = orbit_ps.meta
    metawargs.pop('qualifier')

    # Now we'll define the parameters in case they don't exist and need to be created
    sma_def = FloatParameter(qualifier='sma', value=8.0, default_unit=u.solRad, description='Semi major axis')
    incl_def = FloatParameter(qualifier='incl', value=90.0, default_unit=u.deg, description='Orbital inclination angle')
    asini_def = FloatParameter(qualifier='asini', value=8.0, default_unit=u.solRad, description='Projected semi major axis')

    # And now call get_or_create on the bundle
    sma, created = b.get_or_create('sma', sma_def, **metawargs)
    incl, created = b.get_or_create('incl', incl_def, **metawargs)
    asini, created = b.get_or_create('asini', asini_def, **metawargs)

    if solve_for in [None, asini]:
        lhs = asini
        rhs = sma * sin(incl)

    elif solve_for == sma:
        lhs = sma
        rhs = asini / sin(incl)

    elif solve_for == incl:
        lhs = incl
        rhs = arcsin(asini/sma)

    else:
        raise NotImplementedError

    #- return lhs, rhs, args_as_pss
    return lhs, rhs, {'orbit': orbit}
def asini ( b , orbit , solve_for = None ) : orbit_ps = _get_system_ps ( b , orbit ) metawargs = orbit_ps . meta metawargs . pop ( 'qualifier' ) sma_def = FloatParameter ( qualifier = 'sma' , value = 8.0 , default_unit = u . solRad , description = 'Semi major axis' ) incl_def = FloatParameter ( qualifier = 'incl' , value = 90.0 , default_unit = u . deg , description = 'Orbital inclination angle' ) asini_def = FloatParameter ( qualifier = 'asini' , value = 8.0 , default_unit = u . solRad , description = 'Projected semi major axis' ) sma , created = b . get_or_create ( 'sma' , sma_def , ** metawargs ) incl , created = b . get_or_create ( 'incl' , incl_def , ** metawargs ) asini , created = b . get_or_create ( 'asini' , asini_def , ** metawargs ) if solve_for in [ None , asini ] : lhs = asini rhs = sma * sin ( incl ) elif solve_for == sma : lhs = sma rhs = asini / sin ( incl ) elif solve_for == incl : lhs = incl rhs = arcsin ( asini / sma ) else : raise NotImplementedError return lhs , rhs , { 'orbit' : orbit }
Create a constraint for asini in an orbit.

    If any of the required parameters ('asini', 'sma', 'incl') do not
    exist in the orbit, they will be created.

    :parameter b: the :class:`phoebe.frontend.bundle.Bundle`
    :parameter str orbit: the label of the orbit in which this
        constraint should be built
    :parameter str solve_for:  if 'asini' should not be the derived/constrained
        parameter, provide which other parameter should be derived
        (ie 'sma' or 'incl')
    :returns: lhs (Parameter), rhs (ConstraintParameter), args (list of arguments
        that were passed to this function)