def irrad_frac(b, component, solve_for=None, **kwargs):
    """
    Create a constraint to ensure that energy is conserved and all incident
    light is accounted for.
    """

    comp_ps = b.get_component(component=component)

    irrad_frac_refl_bol = comp_ps.get_parameter(qualifier='irrad_frac_refl_bol')
    irrad_frac_lost_bol = comp_ps.get_parameter(qualifier='irrad_frac_lost_bol')

    if solve_for in [irrad_frac_lost_bol, None]:
        lhs = irrad_frac_lost_bol
        rhs = 1.0 - irrad_frac_refl_bol
    elif solve_for in [irrad_frac_refl_bol]:
        lhs = irrad_frac_refl_bol
        rhs = 1.0 - irrad_frac_lost_bol
    else:
        raise NotImplementedError

    return lhs, rhs, {'component': component}
def irrad_frac ( b , component , solve_for = None , ** kwargs ) : comp_ps = b . get_component ( component = component ) irrad_frac_refl_bol = comp_ps . get_parameter ( qualifier = 'irrad_frac_refl_bol' ) irrad_frac_lost_bol = comp_ps . get_parameter ( qualifier = 'irrad_frac_lost_bol' ) if solve_for in [ irrad_frac_lost_bol , None ] : lhs = irrad_frac_lost_bol rhs = 1.0 - irrad_frac_refl_bol elif solve_for in [ irrad_frac_refl_bol ] : lhs = irrad_frac_refl_bol rhs = 1.0 - irrad_frac_lost_bol else : raise NotImplementedError return lhs , rhs , { 'component' : component }
Create a constraint to ensure that energy is conserved and all incident
    light is accounted for.