IonizationStateο
- class plasmapy.particles.ionization_state.IonizationState(
- particle: ~plasmapy.particles.particle_class.Particle,
- ionic_fractions=None,
- *,
- T_e: ~astropy.units.quantity.Quantity = <Quantity nan K>,
- T_i: ~astropy.units.quantity.Quantity = None,
- kappa: float = inf,
- n_elem: ~astropy.units.quantity.Quantity = <Quantity nan 1 / m3>,
- tol: float = 1e-15,
Bases:
object
Representation of the ionization state distribution of a single element or isotope.
- Parameters:
particle (particle-like) β A
str
orParticle
instance representing an element, isotope, or ion; or an integer representing the atomic number of an element.ionic_fractions (
ndarray
,list
,tuple
, orQuantity
; optional) β The ionization fractions of an element, where the indices correspond to the charge number. This argument should contain the atomic number plus one items, and must sum to one within an absolute tolerance oftol
if dimensionless. Alternatively, this argument may be aQuantity
that represents the number densities of each neutral/ion. This argument cannot be specified whenparticle
is an ion.T_e (
Quantity
, keyword-only, optional) β The electron temperature or thermal energy per electron.n_elem (
Quantity
, keyword-only, optional) β The number density of the element, including neutrals and all ions.tol (
float
or integer, keyword-only, default:1e-15
) β The absolute tolerance used byisclose
and similar functions when testing normalizations and making comparisons.
- Raises:
ParticleError β If the ionic fractions are not normalized or contain invalid values, or if number density information is provided through both
ionic_fractions
andn_elem
.InvalidParticleError β If the particle is invalid.
Examples
>>> import astropy.units as u >>> states = IonizationState("H", [0.6, 0.4], n_elem=1 * u.cm**-3, T_e=11000 * u.K) >>> states.ionic_fractions[0] # fraction of hydrogen that is neutral 0.6 >>> states.ionic_fractions[1] # fraction of hydrogen that is ionized 0.4 >>> states.n_e # electron number density <Quantity 400000. 1 / m3> >>> states.n_elem # element number density <Quantity 1000000. 1 / m3>
If the input particle is an ion, then the ionization state for the corresponding element or isotope will be set to
1.0
for that ion. For example, when the input particle is an alpha particle, the base particle will be He-4, and all He-4 particles will be set as doubly charged.>>> states = IonizationState("alpha") >>> states.base_particle 'He-4' >>> states.ionic_fractions array([0., 0., 1.])
Attributes Summary
The electron temperature.
The ion temperature.
Return the mean charge number.
A
list
of the charge numbers with the highest ionic fractions.The root-mean-square charge number.
The atomic number of the element.
The symbol of the element or isotope.
An array of the charge numbers.
The atomic symbol of the element.
The ionic fractions, where the index corresponds to the charge number.
The ionic symbols for all charge states.
The isotope symbol for an isotope, or
None
if the particle is not an isotope.The ΞΊ parameter for a kappa distribution function for electrons.
The electron number density assuming a single species plasma.
The total number density of neutrals and all ions.
The number densities for each state.
The absolute tolerance for comparisons.
Methods Summary
average_ion
(*[,Β include_neutrals,Β ...])Return a
CustomParticle
instance representing the average particle in this ionization state.Normalize the ionization state distribution (if set) so that the sum of the ionic fractions becomes equal to one.
summarize
([minimum_ionic_fraction])Print quicklook information.
to_list
()Return a
ParticleList
of the ionic levels.Attributes Documentation
- T_eο
The electron temperature.
- T_iο
The ion temperature. If the ion temperature has not been provided, then this attribute will provide the electron temperature.
- Z_meanο
Return the mean charge number.
- Z_most_abundantο
A
list
of the charge numbers with the highest ionic fractions.Examples
>>> He = IonizationState("He", [0.2, 0.5, 0.3]) >>> He.Z_most_abundant [1] >>> Li = IonizationState("Li", [0.4, 0.4, 0.2, 0.0]) >>> Li.Z_most_abundant [0, 1]
- Z_rmsο
The root-mean-square charge number.
- atomic_numberο
The atomic number of the element.
- base_particleο
The symbol of the element or isotope.
- charge_numbersο
An array of the charge numbers.
- elementο
The atomic symbol of the element.
- ionic_fractionsο
The ionic fractions, where the index corresponds to the charge number.
Examples
>>> hydrogen_states = IonizationState("H", [0.9, 0.1]) >>> hydrogen_states.ionic_fractions array([0.9, 0.1])
- ionic_symbolsο
The ionic symbols for all charge states.
- kappaο
The ΞΊ parameter for a kappa distribution function for electrons.
The value of
kappa
must be greater than1.5
in order to have a valid distribution function. Ifkappa
isinf
, then the distribution function reduces to a Maxwellian.
- n_eο
The electron number density assuming a single species plasma.
- n_elemο
The total number density of neutrals and all ions.
- number_densitiesο
The number densities for each state.
- tolο
The absolute tolerance for comparisons.
This attribute is used as the
atol
parameter innumpy.isclose
,numpy.allclose
,astropy.units.isclose
, andastropy.units.allclose
when testing normalizations and making comparisons.
Methods Documentation
- average_ion( ) CustomParticle [source]ο
Return a
CustomParticle
instance representing the average particle in this ionization state.By default, the weighted mean will be used as the average, with the ionic fractions as the weights. If
use_rms_charge
oruse_rms_mass
isTrue
, then this method will return the root mean square of the charge or mass, respectively.- Parameters:
include_neutrals (
bool
, keyword-only, default:True
) β IfTrue
, include neutrals when calculating the mean values of the different particles. IfFalse
, exclude neutrals.use_rms_charge (
bool
, keyword-only, default:False
) β IfTrue
, use the root-mean-square charge instead of the mean charge.use_rms_mass (
bool
, keyword-only, default:False
) β IfTrue
, use the root-mean-square mass instead of the mean mass.
- Return type:
Examples
>>> state = IonizationState("He", [0.1, 0.9, 0.0]) >>> state.average_ion() CustomParticle(mass=6.645657...e-27 kg, charge=1.44...e-19 C) >>> state.average_ion(include_neutrals=False) CustomParticle(mass=6.6455660...e-27 kg, charge=1.602...e-19 C) >>> state.average_ion(use_rms_charge=True, use_rms_mass=True) CustomParticle(mass=6.645657...e-27 kg, charge=1.519958...e-19 C)
- normalize() None [source]ο
Normalize the ionization state distribution (if set) so that the sum of the ionic fractions becomes equal to one.
This method may be used, for example, to correct for rounding errors.
- summarize(minimum_ionic_fraction: float = 0.01) None [source]ο
Print quicklook information.
- Parameters:
minimum_ionic_fraction (real number, default:
0.01
) β If the ionic fraction for a particular ionization state is below this level, then information for it will not be printed.
Examples
>>> import astropy.units as u >>> He_states = IonizationState( ... "He", ... [0.941, 0.058, 0.001], ... T_e=5.34 * u.K, ... kappa=4.05, ... n_elem=5.51e19 * u.m**-3, ... ) >>> He_states.summarize() IonizationState instance for He with Z_mean = 0.06 ---------------------------------------------------------------- He 0+: 0.941 n_i = 5.18e+19 m**-3 T_i = 5.34e+00 K He 1+: 0.058 n_i = 3.20e+18 m**-3 T_i = 5.34e+00 K ---------------------------------------------------------------- n_elem = 5.51e+19 m**-3 n_e = 3.31e+18 m**-3 T_e = 5.34e+00 K kappa = 4.05 ----------------------------------------------------------------
- to_list() ParticleList [source]ο
Return a
ParticleList
of the ionic levels.