def _reconstruct_isotope_symbol(element: str, mass_numb: Integral) -> str: """ Receive a `str` representing an atomic symbol and an `int` representing a mass number. Return the isotope symbol or `None` if no mass number information is available. Raises an `~plasmapy.particles.exceptions.InvalidParticleError` for isotopes that have not yet been discovered. """ if mass_numb is not None: isotope = f"{element}-{mass_numb}" if isotope == "H-2": isotope = "D" elif isotope == "H-3": isotope = "T" if isotope not in _Isotopes.keys(): raise InvalidParticleError( f"The string '{isotope}' does not correspond to " f"a valid isotope.") else: isotope = None return isotope
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