How to use the plasmapy.particles.symbols.atomic_symbol function in plasmapy

To help you get started, we’ve selected a few plasmapy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PlasmaPy / PlasmaPy / plasmapy / particles / atomic.py View on Github external
for isotope in _Isotopes.keys():
            if element + "-" in isotope and isotope[0 : len(element)] == element:
                isotopes.append(isotope)
        if element == "H":
            isotopes.insert(1, "D")
            isotopes.insert(2, "T")
        mass_numbers = [mass_number(isotope) for isotope in isotopes]
        sorted_isotopes = [
            mass_number
            for (isotope, mass_number) in sorted(zip(mass_numbers, isotopes))
        ]
        return sorted_isotopes

    if argument is not None:
        try:
            element = atomic_symbol(argument)
            isotopes_list = known_isotopes_for_element(element)
        except InvalidElementError:
            raise InvalidElementError(
                "known_isotopes is unable to get "
                f"isotopes from an input of: {argument}"
            )
        except InvalidParticleError:
            raise InvalidParticleError("Invalid particle in known_isotopes.")
    elif argument is None:
        isotopes_list = []
        for atomic_numb in range(1, len(_Elements.keys()) + 1):
            isotopes_list += known_isotopes_for_element(atomic_numb)

    return isotopes_list
github PlasmaPy / PlasmaPy / plasmapy / particles / atomic.py View on Github external
>>> periodic_table_group("Al")
    13
    >>> periodic_table_group("neon")
    18
    >>> periodic_table_group("barium")
    2

    """
    # TODO: Implement @particle_input
    if not isinstance(argument, (str, Integral)):
        raise TypeError(
            "The argument to periodic_table_group must be "
            "either a string representing the element or its "
            "symbol, or an integer representing its atomic number."
        )
    symbol = atomic_symbol(argument)
    group = _Elements[symbol]["group"]
    return group
github PlasmaPy / PlasmaPy / plasmapy / particles / atomic.py View on Github external
def known_isotopes_for_element(argument):
        element = atomic_symbol(argument)
        isotopes = []
        for isotope in _Isotopes.keys():
            if element + "-" in isotope and isotope[0 : len(element)] == element:
                isotopes.append(isotope)
        if element == "H":
            isotopes.insert(1, "D")
            isotopes.insert(2, "T")
        mass_numbers = [mass_number(isotope) for isotope in isotopes]
        sorted_isotopes = [
            mass_number
            for (isotope, mass_number) in sorted(zip(mass_numbers, isotopes))
        ]
        return sorted_isotopes