solarwindpy.core.plasma

The Plasma class that contains all Ions, magnetic field, and spacecraft information.

Propoded Updates

-It would be cute if one could call plasma % a, i.e. plasma mod

an ion and return a new plasma without that ion in it. Well, either mod or subtract. Subtract and add probably make more sense. (20180129)

-See (https://drive.google.com/drive/folders/0ByIrJAE4KMTtaGhRcXkxNHhmY2M)

for the various methods that might be worth considering including __getattr__ vs __getattribute__, __hash__, __deepcopy__, __copy__, etc. (20180129)

-Convert Plasma.__call__ to Plasma.__getitem__ and Plasma.__iter__ to

to allow iterating over ions. (20180316) N.B. This could have complicated results as to how we actually access the underlying data and objects stored in the DataFrame.

-Define __format__ methods for use with str.format. (20180316)

-Define Plasma.__len__ to return the number of ions in the plasma. (20180316)

-Split each class into its own file. Suggested by EM. (BLA 20180217)

-Add Plasma.dropna(*args, **kwargs) that passes everything to plasma.data.dropna

and then calls self.__Plasma__set_ions() to update the ions after drop. (20180404)

-Moved _conform_species to base.Base so that it is accessable for

alfvenic_turbulence.py. Did not move tests out of test_plasma.py. (20181121)

Classes

Plasma(data,Β *species[,Β spacecraft,Β ...])

Container for multi-species plasma physics data and analysis.

class Plasma(data, *species, spacecraft=None, auxiliary_data=None, log_plasma_stats=False)[source]

Bases: Base

Container for multi-species plasma physics data and analysis.

The Plasma class serves as the central container for solar wind plasma analysis, combining ion moment data, magnetic field measurements, and spacecraft trajectory information for comprehensive plasma physics calculations.

This class enables analysis of multi-species plasma including protons, alpha particles, and heavier ions. It provides convenient access to ion species through attribute shortcuts and supports advanced plasma physics calculations such as plasma beta, Coulomb collision frequencies, and thermal parameters.

Attribute access is first attempted on the underlying ions table before falling back to super().__getattr__. This allows convenient shorthand such as plasma.a to access the alpha particle Ion and plasma.p1 for protons.

data

Multi-indexed DataFrame containing plasma measurements with columns labeled by (β€œM”, β€œC”, β€œS”) for measurement, component, and species.

Type:

pandas.DataFrame

ions

Dictionary-like access to individual ion species objects.

Type:

pandas.Series of Ion objects

species

Available ion species identifiers in the plasma.

Type:

list of str

spacecraft

Spacecraft trajectory and velocity information.

Type:

Spacecraft, optional

auxiliary_data

Additional measurements such as quality flags or derived parameters.

Type:

pandas.DataFrame, optional

Notes

Thermal speeds assume the relationship \(mw^2 = 2kT\) where \(m\) is ion mass, \(w\) is thermal speed, \(k\) is Boltzmann’s constant, and \(T\) is temperature.

The underlying data structure uses a three-level MultiIndex for columns: - Level 0 (M): Measurement type (β€˜n’, β€˜v’, β€˜w’, β€˜b’, etc.) - Level 1 (C): Component (β€˜x’, β€˜y’, β€˜z’, β€˜par’, β€˜per’, etc.) - Level 2 (S): Species identifier (β€˜p1’, β€˜a’, β€˜o6’, etc.)

Examples

Create a plasma object from multi-species data:

>>> import pandas as pd
>>> import numpy as np
>>> # Create sample MultiIndex data
>>> epoch = pd.date_range('2023-01-01', periods=3, freq='1min')
>>> columns = pd.MultiIndex.from_tuples([
...     ('n', '', 'p1'), ('v', 'x', 'p1'), ('v', 'y', 'p1'), ('v', 'z', 'p1'),
...     ('n', '', 'a'), ('v', 'x', 'a'), ('v', 'y', 'a'), ('v', 'z', 'a'),
...     ('w', 'par', 'p1'), ('w', 'per', 'p1'), ('w', 'par', 'a'), ('w', 'per', 'a'),
...     ('b', 'x', ''), ('b', 'y', ''), ('b', 'z', '')
... ], names=['M', 'C', 'S'])
>>> data = pd.DataFrame(np.random.rand(3, len(columns)),
...                     index=epoch, columns=columns)
>>> plasma = Plasma(data, 'p1', 'a')  # Protons and alphas
>>> type(plasma.p1).__name__  # Proton ion object
'Ion'

Calculate plasma physics parameters:

>>> beta = plasma.beta('p1')          # Plasma beta for protons
>>> type(beta).__name__
'Tensor'

Idenfity ion species in plasma:

>>> plasma.species
['p1', 'a']
__init__(data, *species, spacecraft=None, auxiliary_data=None, log_plasma_stats=False)[source]

Initialize a Plasma instance.

Parameters:
  • data (pandas.DataFrame) – Contains the magnetic field and core ion moments. Columns are a three-level MultiIndex labelled ("M", "C", "S") for measurement, component, and species. The index should contain datetime information, for example Epoch when loading from a CDF file.

  • *species (str) – Iterable of species contained in data.

  • spacecraft (Spacecraft, optional) – Spacecraft trajectory and velocity information. If None, the Coulomb number nc() method will raise a ValueError.

  • auxiliary_data (pandas.DataFrame, optional) – Additional measurements to carry with the plasma, for example data quality flags. The column labelling scheme must match data.

  • log_plasma_stats (bool, default False) – Log summary statistics when data is set.

Notes

Thermal speeds assume \(mw^2 = 2kT\).

Examples

>>> epoch = pd.Series({0: pd.to_datetime("1995-01-01"),
...                    1: pd.to_datetime("2015-03-23"),
...                    2: pd.to_datetime("2022-10-09")}, name="Epoch")
>>> data = {
... ("b", "x", ""): {0: 0.5, 1: 0.6, 2: 0.7},
... ("b", "y", ""): {0: -0.25, 1: -0.26, 2: 0.27},
... ("b", "z", ""): {0: 0.3, 1: 0.4, 2: -0.7},
... ("n", "", "a"): {0: 0.5, 1: 1.0, 2: 1.5},
... ("n", "", "p1"): {0: 1.0, 1: 2.0, 2: 3.0},
... ("v", "x", "a"): {0: 125.0, 1: 250.0, 2: 375.0},
... ("v", "x", "p1"): {0: 100.0, 1: 200.0, 2: 300.0},
... ("v", "y", "a"): {0: 250.0, 1: 375.0, 2: 750.0},
... ("v", "y", "p1"): {0: 200.0, 1: 300.0, 2: 600.0},
... ("v", "z", "a"): {0: 500.0, 1: 750.0, 2: 1000.0},
... ("v", "z", "p1"): {0: 400.0, 1: 600.0, 2: 800.0},
... ("w", "par", "a"): {0: 3.0, 1: 4.0, 2: 5.0},
... ("w", "par", "p1"): {0: 10.0, 1: 20.0, 2: 30.0},
... ("w", "per", "a"): {0: 7.0, 1: 9.0, 2: 10.0},
... ("w", "per", "p1"): {0: 7.0, 1: 26.0, 2: 28.0},
... }
>>> data = pd.DataFrame.from_dict(data, orient="columns")
>>> data.columns.names = ["M", "C", "S"]
>>> data.index = epoch
>>> data.T
Epoch     1995-01-01  2015-03-23  2022-10-09
M C   S
b x             0.50        0.60        0.70
  y            -0.25       -0.26        0.27
  z             0.30        0.40       -0.70
n     a         0.50        1.00        1.50
      p1        1.00        2.00        3.00
v x   a       125.00      250.00      375.00
      p1      100.00      200.00      300.00
  y   a       250.00      375.00      750.00
      p1      200.00      300.00      600.00
  z   a       500.00      750.00     1000.00
      p1      400.00      600.00      800.00
w par a         3.00        4.00        5.00
      p1       10.00       20.00       30.00
  per a         7.00        9.00       10.00
      p1        7.00       26.00       28.00
>>> plasma = Plasma(data, "a", "p1")
property epoch

Time index of the plasma data.

Returns:

Datetime index containing measurement timestamps.

Return type:

pandas.DatetimeIndex

Examples

>>> plasma.epoch
DatetimeIndex(['1995-01-01', '2015-03-23', '2022-10-09'],
              dtype='datetime64[ns]', name='Epoch', freq=None)
property spacecraft

Spacecraft object stored in plasma.

property sc

Shortcut to spacecraft.

property auxiliary_data

Any data that does not fall into the following categories.

Epoch is index.

-magnetic field -ion velocity -ion number density -ion thermal speed

property aux

Shortcut to auxiliary_data.

property log_plasma_at_init

Flag indicating whether to log plasma statistics during initialization.

Returns:

True if plasma statistics should be logged at initialization.

Return type:

bool

See also

set_log_plasma_stats

Method to modify this setting

set_log_plasma_stats(new)[source]

Set flag for logging plasma statistics during initialization.

Parameters:

new (bool) – Whether to enable logging of plasma statistics.

Notes

When enabled, summary statistics including density ranges, velocity distributions, and magnetic field statistics are logged during plasma initialization.

Examples

>>> plasma.set_log_plasma_stats(True)
>>> plasma.log_plasma_at_init
True
save(fname, dkey='FC', sckey='SC', akey='FC_AUX', data_modifier_fcn=None, sc_modifier_fcn=None, aux_modifier_fcn=None)[source]

Save the plasma’s data and aux DataFrame to an HDF5 file at fname.

Parameters:
  • fname (str or pathlib.Path.) – File name pointing to the save location. The typical use when creating a data file in Create_Datafile.ipynb is fname(β€œswe”, β€œh5”, strip_date=True).

  • dkey (None) – The HDF5 file key at which to store the data.

  • sckey (None) – The HDF5 file key at which to store the spacecraft data.

  • akey (None) – The HDF5 file key at which to store the auxiliary_data.

  • data_modifier_fcn (None, FunctionType) –

    A function to modify the data saved, e.g. if you don’t want to save a specific species in the data file, you can pass.

    def modify_data(data):

    return data.drop(β€œa”, axis=1, level=”S”)

    It can only take one argument, data.

  • spacecraft_modifier_fcn (None, FunctionType) – A function to modifie the spacecraft data saved. See data_modifier_fcn for syntax.

  • aux_modifier_fcn (None, FunctionType) – A function to modify the auxiliary_data saved. See data_modifier_fcn for syntax.

classmethod load_from_file(fname, *species, dkey='FC', sckey='SC', akey='FC_AUX', sc_frame=None, sc_name=None, start=None, stop=None, **kwargs)[source]

Load data from an HDF5 file at fname and create a plasma.

Parameters:
  • fname (str or pathlib.Path) – The file from which to load the data.

  • species (list-like of str) – The species to load. If none are passed, they are automatically selected from the data.

  • dkey (str, "FC") – The key for getting data from HDF5 file.

  • sckey (str, "SC") – The key for getting spacecraft data from the HDF5 file.

  • akey (str, "FC_AUX") – key for getting auxiliary data from HDF5 file.

  • start (None, parsable by pd.to_datetime) – If not None, time to start/stop for loading data.

  • stop (None, parsable by pd.to_datetime) – If not None, time to start/stop for loading data.

  • kwargs – Passed to Plasma.__init__.

property species

Tuple of species contained in plasma.

property ions

pd.Series containing the ions.

drop_species(*species: str) Plasma[source]

Return a new Plasma without the specified species.

Parameters:

*species (str) – Species to remove from the plasma.

Returns:

A new plasma containing only the remaining species.

Return type:

Plasma

Raises:

ValueError – If all species are removed.

set_spacecraft(new)[source]

Set or update the spacecraft trajectory data.

Parameters:

new (Spacecraft or None) – Spacecraft trajectory object containing position and velocity data. Must have matching datetime index with plasma data.

Raises:

AssertionError – If spacecraft index does not match plasma data index.

Notes

The spacecraft data is required for calculating certain plasma physics parameters such as Coulomb collision frequencies that depend on the plasma frame transformation.

Examples

>>> sc = Spacecraft(trajectory_data)
>>> plasma.set_spacecraft(sc)
>>> plasma.spacecraft.position  # Access trajectory data
set_auxiliary_data(new)[source]

Set or update auxiliary measurement data.

Parameters:

new (pandas.DataFrame or None) – Additional measurements such as data quality flags, derived parameters, or instrument-specific metadata. Must have matching datetime index with plasma data.

Raises:

AssertionError – If auxiliary data index does not match plasma data index.

Notes

Auxiliary data provides additional context for plasma measurements without being part of the core plasma physics calculations. Common examples include quality flags, statistical uncertainties, or instrument operational parameters.

Examples

>>> quality_flags = pd.DataFrame({'quality': [0, 1, 0]},
...                              index=plasma.epoch)
>>> plasma.set_auxiliary_data(quality_flags)
>>> plasma.aux.quality  # Access auxiliary data
set_data(new)[source]

Set the data and log statistics about it.

property bfield

Magnetic field data.

property b

Shortcut for bfield.

number_density(*species, skipna=True)[source]

Get the plasma number densities.

Parameters:
  • species (str) – Each species is a string. If only one string is passed, it can contain β€œ+”. If this is the case, the species are summed over and a pd.Series is returned. Otherwise, the individual quantities are returned as a pd.DataFrame.

  • skipna (bool, default True) – Follows pd.DataFrame.sum convention. If True, NA excluded from results. If False, NA propagates. False is helpful to identify when a species is not measured using NaNs in its number density.

Returns:

n – See Parameters for more info.

Return type:

pd.Series or pd.DataFrame

n(*species, skipna=True)[source]

Shortcut to number_density().

mass_density(*species)[source]

Get the plasma mass densities.

Parameters:

species (str) – Each species is a string. If only one string is passed, it can contain β€œ+”. If this is the case, the species are summed over and a pd.Series is returned. Otherwise, the individual quantities are returned as a pd.DataFrame.

Returns:

rho – See Parameters for more info.

Return type:

pd.Series or pd.DataFrame

rho(*species)[source]

Shortcut to mass_density().

thermal_speed(*species)[source]

Get the thermal speed.

Parameters:

species (str) – Each species is a string. A total species (β€œs0+s1+…”) cannot be passed because the result is physically amibguous.

Returns:

w – See Parameters for more info.

Return type:

pd.Series or pd.DataFrame

w(*species)[source]

Shortcut to thermal_speed().

pth(*species)[source]

Get the thermal pressure.

Parameters:

species (str) – Each species is a string. If only one string is passed, it can contain β€œ+”. If this is the case, the species are summed over and a pd.Series is returned. Otherwise, the individual quantities are returned as a pd.DataFrame.

Returns:

pth – See Parameters for more info.

Return type:

pd.Series or pd.DataFrame

temperature(*species)[source]

Get the thermal temperature.

Parameters:

species (str) – Each species is a string. If only one string is passed, it can contain β€œ+”. If this is the case, the species are summed over and a pd.Series is returned. Otherwise, the individual quantities are returned as a pd.DataFrame.

Returns:

temp – See Parameters for more info.

Return type:

pd.Series or pd.DataFrame

beta(*species)[source]

Get perpendicular, parallel, and scalar plasma beta.

Parameters:

species (str) – Each species is a string. Species handling controlled by pth().

Returns:

beta – See Parameters for more info.

Return type:

pd.DataFrame

Notes

In uncertain units, the NRL Plasma Formulary (2016) defined \(\beta\):

\(\beta = \frac{8 \pi n k_B T}{B^2} = \frac{2 k_b T / m}{B^2 / 4 \phi \rho}\)

and the Alfven speed as:

\(C_A^2 = B^2 / 4 \pi \rho\).

I define thermal speed as:

\(w^2 = \frac{2 k_B T}{m}\).

Combining these equations, we get:

\(\beta = w^2 / C_A^2\),

which is independent of dimensional constants. Given I define \(p_{th} = \frac{1}{2} \rho w^2\) and \(C_A^2 = \frac{1}{\mu_0}B^2 \rho\) in SI units, I can rewrite \(\beta\)

\(\beta = \frac{2 p_{th}}{\rho} \frac{\mu_0 \rho}{B^2} = \frac{2 \mu_0 p_{th}}{B^2}\).

anisotropy(*species)[source]

Pressure anisotropy.

Note that for a single species, the pressure anisotropy is just the temperature anisotropy.

Parameters:

species (str) – Each species is a string. Species handling is primarily controlled by pth().

Returns:

ani – See Parameters for more info.

Return type:

pd.Series or pd.DataFrame

velocity(*species, project_m2q=False)[source]

Get an ion velocity or calculate the center-of-mass velocity.

Parameters:
  • species (str) – Each species is a string. If only one string is passed and contains β€œ+”, return a pd.Series containing the center-of-mass velocity Vector. If contains a single species, return that ion’s velocity.

  • project_m2q (bool, False) – If True, project velocity by \(\sqrt{m/q}\). Disables center-of- mass species.

Returns:

velocity

Return type:

pd.Series or pd.DataFrame

v(*species, project_m2q=False)[source]

Shortcut to velocity.

dv(s0, s1, project_m2q=False)[source]

Calculate the differential flow between species s0 and s1.

Calculate the differential flow between species s0 and species s1: \(v_{s0} - v_{s1}\).

Parameters:
  • s0 (str) – If either species contains a β€œ+”, the center-of-mass velocity for the indicated species is used.

  • s1 (str) – If either species contains a β€œ+”, the center-of-mass velocity for the indicated species is used.

  • project_m2q (bool, False) – If True, project each speed by \(\sqrt{m/q}\). Disables center- of-mass species.

Returns:

dv

Return type:

vector.Vector

See also

vector.Vector

pdynamic(*species, project_m2q=False)[source]

Calculate the dynamic or drift pressure for the given species.

\(p_{\tilde{v}} = 0.5 \sum_i \rho_i (v_i - v_\mathrm{com})^2\)

The calculation is done in the plasma frame.

Parameters:
  • species (list-like of str) – List-like of individual species, e.g. [β€œa”, β€œp1”]. Can NOT be a list-like including sums, e.g. [β€œa”, β€œp1+p2”].

  • project_m2q (bool, False) – If True, project the velocities by \(\sqrt{m/q}\). Allows for only two species to be passed and takes the differential flow between them.

Returns:

pdv – Dynamic pressure due to species.

Return type:

pd.Series

pdv(*species, project_m2q=False)[source]

Shortcut to pdynamic().

sound_speed(*species)[source]

Calculate the sound speed.

Parameters:

species (str) – TODO: What controls species?

Returns:

cs

Return type:

pd.DataFrame or pd.Series depending on species inputs.

cs(*species)[source]

Shortcut to sound_speed().

ca(*species)[source]

Calculate the isotropic MHD Alfven speed.

Parameters:

species (str) – Species controlled by mass_density()

Returns:

ca

Return type:

pd.DataFrame or pd.Series depending on species inputs.

afsq(*species, pdynamic=False)[source]

Calculate the square of anisotropy factor.

\(AF^2 = 1 + \frac{\mu_0}{B^s}\left(p_\perp - p_\parallel - p_{\tilde{v}}\right)\)

N.B. Because of the \(1 +\), afsq(s0, s1).sum(axis=1) is not the

same as afsq(s0+s1). The two are related by:

afsq.(s0+s1) = 1 + (afsq(s0, s1) - 1).sum(axis=1)

Parameters:
  • species (str) – Each species is a string. If only one string is passed, it can contain β€œ+”. If this is the case, the species are summed over and a pd.Series is returned. Otherwise, the individual quantities are returned as a pd.DataFrame.

  • pydnamic (bool, str) – If str, the component of the dynamic pressure to use when calculating \(p_{\tilde{v}}\).

Returns:

afsq

Return type:

pd.Series or pd.DataFrame depending on the len(species).

caani(*species, pdynamic=False)[source]

Calculate the anisotropic MHD Alfven speed:

\(C_{A;Ani} = C_A\sqrt{AFSQ}\)

Parameters:
  • species (str) – Each species is a string. If only one string is passed, it can contain β€œ+”. In either case, all species are summed over and a pd.Series is returned. This addresses complications from the stuple = self._chk_species(*species) mass densities in Ca and AFSQ, the latter via pth().

  • pydnamic (bool, str) – If str, the component of the dynamic pressure to use when calculating \(p_{\tilde{v}}\).

Returns:

caani – Only pd.Series is returned because of the combination of mass density and pressure terms in the CaAni equation.

Return type:

pd.Series

See also

ca, afsq

lnlambda(s0, s1)[source]

Calculate the Coulomb logarithm between species s0 and s1.

\(\ln_\lambda_{i,i} = 29.9 - \ln(\frac{z_0 * z_1 * (a_0 + a_1)}{a_0 * T_1 + a_1 * T_0} \sqrt{\frac{n_0 z_0^2}{T_0} + \frac{n_1 z_1^2}{T_1}})\)

Parameters:

species (str) – Each species is a string. It cannot be a sum of species, nor can it be an iterable of species.

Returns:

lnlambda – Only pd.Series is returned because Coulomb require species alignment in such a fashion that array operations using pd.DataFrame alignment won’t work.

Return type:

pd.Series

See also

nuc

nuc(sa, sb, both_species=True)[source]

Calculate the momentum collision rate following [1].

Parameters:
  • sa (str) – The test, field particle species. Each can only identify a single ion species and it cannot be an iterable of lists, etc.

  • sb (str) – The test, field particle species. Each can only identify a single ion species and it cannot be an iterable of lists, etc.

  • both_species (bool) – If True, calculate the effective collision rate for a two-ion-species plasma following Eq. (23). Otherwise, calculate it following Eq. (18).

Returns:

nu

Return type:

pd.Series

Notes

If nu.name is β€œsa-sb”, then both_species=False in calclulation. If nu.name is β€œsa+sb”, then both_species=True.

See also

lnlambda, nc

References

[1] HernΓ‘ndez, R., & Marsch, E. (1985). Collisional time scales for

temperature and velocity exchange between drifting Maxwellians. Journal of Geophysical Research, 90(A11), 11062. <https://doi.org/10.1029/JA090iA11p11062>.

nc(sa, sb, both_species=True)[source]

Calculate the Coulomb number between species sa and sb.

Parameters:
  • sa (str) – Species identifying the ions to use in calculation. Can’t be a combination of things like β€œs0+s1”, β€œs0,s1”, nor (β€œs0”, β€œs1”).

  • sb (str) – Species identifying the ions to use in calculation. Can’t be a combination of things like β€œs0+s1”, β€œs0,s1”, nor (β€œs0”, β€œs1”).

  • both_species (bool) – Passed to nuc. If True, calculate the two-ion-plasma collision frequency.

Returns:

nc – Coulomb number

Return type:

pd.Series

See also

nuc, lnlambda

vdf_ratio(beam='p2', core='p1')[source]

Calculate the ratio of the VDFs at the beam velocity.

Calculate the ratio of a bi-Maxwellian proton beam to a bi-Maxwellian proton core VDF at the peak beam velocity.

To avoid overflow erros, we return ln(ratio).

The VDF for species \(i\) at velocity \(v_j\) is:

\(f_i(v_j) = \frac{n_i}{(\pi w_i ^2)^{3/2}} \exp[ -(\frac{v_j - v_i}{w_i})^2]\)

The beam to core VDF ratio evaluated at the proton beam velocity is:

\(\frac{f_2}{f_1}|_{v_2} = \frac{n_2}{n_1} ( \frac{w_1}{w_2} )^3 \exp[ (\frac{v_2 - v_1}{w_1})^2 ]\)

where \(n\) is the number density, \(w\) gives the thermal speed, and \(u\) is the bulk velocity.

In the case of a Bimaxwellian, we \(w^3 = w_\parallel w_\perp^2\) \((\frac{v - v_i}{w_i})^2 = (\frac{v - v_i}{w_i})_\parallel^2 + (\frac{v - v_i}{w_i})_\perp^2\).

Parameters:
  • plasma (pd.DataFrame) – Contains the number densities, vector velocities, and thermal speeds of the beam and core species.

  • beam (str, "p2") – The beam population, defaults to proton beams.

  • core (str, "p1") – The core population, defaults to proton core.

Returns:

f2f1 – Natural logarithm of the beam to core VDF ratio.

Return type:

pd.Series

Notes

This routine was written for Faraday cup data quality validation, so alpha particle velocities are projected with by \(\sqrt{2.0}\) to the velocity window in which they are measured.

estimate_electrons(inplace=False)[source]

Estimate the electron parameters with a scalar temperature.

Assume temperature is the same as proton scalar temerature.

heat_flux(*species)[source]

Calculate the parallel heat flux.

\(Q_\parallel = \rho (v^3 + \frac{3}{2}vw^2)\)

where \(v\) is each species’ velocity in the Center-of-Mass frame and \(w\) is each species parallel thermal speed.

Parameters:

species (list of strings) – The species to use. If a sum is indicated, take the sum of the input species.

Returns:

q – Dimensionality depends on species inputs.

Return type:

pd.Series or pd.DataFrame

qpar(*species)[source]

Shortcut to heat_flux().

build_alfvenic_turbulence(species, **kwargs)[source]

Create an Alfvenic turbulence instance.

Parameters:
  • species (str) – Species identifier. When no , present, use center-of-mass velocity as the velocity term. Alternatively, may contain up to one ,. This is a unique Plasma case in which s0+s1,s0+s1+s2 is a valid identifier. Here, the 2nd species is treated as the mass density passed to AlfvenTurbulence and used for converting magentic field in Alfven units.

  • kwargs – Passed to rolling method in AlfvenicTurbulence to specify window size.

S(*species)[source]

Shortcut to specific_entropy().

specific_entropy(*species)[source]

Calculate the specific entropy following [1] as.

\(p_\mathrm{th} \rho^{-\gamma}\)

where \(gamma=5/3\), \(p_\mathrm{th}\) is the thermal presure, and \(rho\) is the mass density.

Parameters:

species (str or list-like of str) –

Comma separated strings (β€œa,p1”) are invalid. Comma separated lists (β€œa”, β€œp1”) are valid. Total effective species (β€œa+p1”) are valid and use

\(p_\mathrm{th} = \sum_s p_{\mathrm{th},s}\) \(\rho = \sum_s \rho_s\).

References

[1] Siscoe, G. L. (1983). Solar System Magnetohydrodynamics (pp.

11–100). <https://doi.org/10.1007/978-94-009-7194-3_2>.

kinetic_energy_flux(*species)[source]

Calculate the plasma kinetic energy flux.

Parameters:

species (str) – Each species is a string. If only one string is passed, it can contain β€œ+”. If this is the case, the species are summed over and a pd.Series is returned. Otherwise, the individual quantities are returned as a pd.DataFrame.

Returns:

rho – See Parameters for more info.

Return type:

pd.Series or pd.DataFrame

Wk(*species)[source]

Shortcut to kinetic_energy_flux().

property constants: Constants

Physical constants.

Returns:

Physical constants instance.

Return type:

uc.Constants

property data: DataFrame

Underlying DataFrame containing the data.

Returns:

Data with MultiIndex columns.

Return type:

pd.DataFrame

head()

Return the first few rows of the data.

Returns:

First few rows of the data.

Return type:

pd.DataFrame

property logger: Logger

Logger instance for this object.

Returns:

Logger instance.

Return type:

logging.Logger

static mi_tuples(x: Tuple[Tuple[str, ...], ...]) MultiIndex

Create a MultiIndex from tuples with appropriate names.

Parameters:

x (Tuple[Tuple[str, ...], ...]) – Tuples to create MultiIndex from.

Returns:

MultiIndex created from tuples.

Return type:

MI

tail()

Return the last few rows of the data.

Returns:

Last few rows of the data.

Return type:

pd.DataFrame

property units: Units

Units conversion factors.

Returns:

Units conversion instance.

Return type:

uc.Units