solarwindpy.core.vector.BField

class BField(data: DataFrame)[source]

Bases: Vector

A class representing a magnetic field, inheriting from Vector.

property pressure: Series

Calculate the magnetic pressure or energy density.

Returns:

Magnetic pressure.

Return type:

pd.Series

Notes

The magnetic pressure is calculated using

\[p_B = \frac{1}{2\mu_0} B^2\]
property pb: Series

Shortcut for pressure.

Returns:

Magnetic pressure.

Return type:

pd.Series

__init__(data: DataFrame)

Initialize a Vector instance.

Parameters:

data (pandas.DataFrame) – The vector data with x, y and z components.

property cartesian: DataFrame

Cartesian coordinates of the vector.

Returns:

Columns x, y and z.

Return type:

pd.DataFrame

property colat

Shortcut to colatitude property.

Returns:

Colatitude in degrees.

Return type:

pd.Series

property colatitude: Series

Colatitude of the vector.

Returns:

Colatitude in degrees.

Return type:

pd.Series

property constants: Constants

Physical constants.

Returns:

Physical constants instance.

Return type:

uc.Constants

cos_theta(other: Vector | DataFrame) Series

Cosine of the angle between this vector and other.

Parameters:

other (Vector or pandas.DataFrame) – Vector to calculate the angle with.

Returns:

Cosine of the angle.

Return type:

pd.Series

Raises:

NotImplementedError – If other is not a Vector or DataFrame.

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 lat

Shortcut to latitude property.

Returns:

Latitude in degrees.

Return type:

pd.Series

property latitude

Latitude of the vector.

Returns:

Latitude in degrees.

Return type:

pd.Series

property logger: Logger

Logger instance for this object.

Returns:

Logger instance.

Return type:

logging.Logger

property lon: Series

Shortcut for longitude.

Returns:

Longitude in degrees.

Return type:

pd.Series

property longitude: Series

Longitude of the vector.

Returns:

Longitude in degrees.

Return type:

pd.Series

property mag: Series

Calculate the magnitude of the vector.

Returns:

Vector magnitude.

Return type:

pd.Series

property magnitude: Series

Alias for mag.

Returns:

Vector magnitude.

Return type:

pd.Series

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

project(other: Vector | DataFrame) DataFrame

Project self onto other.

Parameters:

other (Vector or pandas.DataFrame) – Vector to project onto.

Returns:

Parallel and perpendicular components of the projection.

Return type:

pd.DataFrame

Raises:

NotImplementedError – If other is not a Vector or DataFrame.

property r: Series

Shortcut to mag when using spherical coordinates.

Returns:

Vector magnitude.

Return type:

pd.Series

property rho: Series

Magnitude of the vector in the xy-plane.

Returns:

XY-plane magnitude.

Return type:

pd.Series

set_data(new: DataFrame)

Set new vector data.

Parameters:

new (pandas.DataFrame) – New vector data.

Raises:

ValueError – If new does not contain the required columns.

tail()

Return the last few rows of the data.

Returns:

Last few rows of the data.

Return type:

pd.DataFrame

property unit_vector: Vector

Cartesian unit vector.

Returns:

Normalised vector.

Return type:

Vector

property units: Units

Units conversion factors.

Returns:

Units conversion instance.

Return type:

uc.Units

property uv: Vector

Shortcut for unit_vector.

Returns:

Normalised vector.

Return type:

Vector