# Path: proptools/constants.py



import numpy as np
from scipy.optimize import minimize
from proptools.constants import charge, amu_kg, g
    If only ``V_b`` and ``m_ion`` are provided, the ideal specific impulse will be computed.
    If ``divergence_correction``, ``double_fraction``, or ``mass_utilization`` are provided,
    the specific impulse will be reduced by the corresponding efficiency factors.

    Reference: Goebel and Katz, equation 2.4-8.

    Arguments:
        V_b (scalar): Beam voltage [units: volt].
        m_ion (scalar): Ion mass [units: kilogram].
        divergence_correction (scalar in (0, 1])): Thrust correction factor for beam divergence
            [units: dimensionless].
        double_fraction (scalar in [0, 1]): The doubly-charged ion current over the singly-charged
            ion current, :math:`I^{++} / I^+` [units: dimensionless].
        mass_utilization (scalar in (0, 1])): Mass utilization efficiency [units: dimensionless].

    Returns:
        scalar: the specific impulse [units: second].
    """
    # Check inputs
    if divergence_correction < 0 or divergence_correction > 1:
        raise ValueError('divergence_correction {:.f} is not in [0, 1]'.format(
            divergence_correction))
    if mass_utilization < 0 or mass_utilization > 1:
        raise ValueError('mass_utilization {:.f} is not in [0, 1]'.format(mass_utilization))

    # Compute the efficiency factor
    efficiency = (divergence_correction * double_ion_thrust_correction(double_fraction)
                  * mass_utilization)

    # Compute the ideal specific impulse

# Path: proptools/constants.py



# Path: proptools/electric/generic.py
import numpy as np
from scipy.optimize import minimize
from proptools.constants import charge, amu_kg, g

    If only ``V_b`` and ``m_ion`` are provided, the ideal specific impulse will be computed.
    If ``divergence_correction``, ``double_fraction``, or ``mass_utilization`` are provided,
    the specific impulse will be reduced by the corresponding efficiency factors.

    Reference: Goebel and Katz, equation 2.4-8.

    Arguments:
        V_b (scalar): Beam voltage [units: volt].
        m_ion (scalar): Ion mass [units: kilogram].
        divergence_correction (scalar in (0, 1])): Thrust correction factor for beam divergence
            [units: dimensionless].
        double_fraction (scalar in [0, 1]): The doubly-charged ion current over the singly-charged
            ion current, :math:`I^{++} / I^+` [units: dimensionless].
        mass_utilization (scalar in (0, 1])): Mass utilization efficiency [units: dimensionless].

    Returns:
        scalar: the specific impulse [units: second].
    """
    # Check inputs
    if divergence_correction < 0 or divergence_correction > 1:
        raise ValueError('divergence_correction {:.f} is not in [0, 1]'.format(
            divergence_correction))
    if mass_utilization < 0 or mass_utilization > 1:
        raise ValueError('mass_utilization {:.f} is not in [0, 1]'.format(mass_utilization))

    # Compute the efficiency factor
    efficiency = (divergence_correction * double_ion_thrust_correction(double_fraction)
                  * mass_utilization)

    # Compute the ideal specific impulse

    I_sp_ideal = 1 / g * (2 * (charge / m_ion) * V_b)**0.5