solarwindpy.core.tensor.Tensor

class Tensor(data: DataFrame)[source]

Bases: Base

Container for tensor-valued quantities.

Parameters:

data (pandas.DataFrame) – Tensor data with components par, per and scalar.

__init__(data: DataFrame)[source]

Initialize the Tensor object.

Parameters:

data (pandas.DataFrame) – Tensor data to be stored.

set_data(new: DataFrame)[source]

Set new tensor data.

Parameters:

new (pandas.DataFrame) – The new tensor data.

Raises:

ValueError – If new does not contain the required columns.

property magnitude: Series | DataFrame

Calculate and return the magnitude of the tensor.

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