fips.Matrix#
- class fips.Matrix(data, name=None, index=None, columns=None, dtype=None, copy=None, sparse=False)[source]#
Bases:
MultiBlockMixin,Structure2DBase class for all matrix-like objects in the inversion framework.
Wraps a pandas DataFrame and ensures consistent index handling. Matrices represent 2D components of the inversion problem, such as forward operators and covariance matrices.
- Parameters:
data (np.ndarray or pd.DataFrame or Matrix or scalar) – 2D data representing the matrix.
name (str, optional) – Name for the Matrix.
index (pd.MultiIndex) – Index for the rows of the DataFrame.
columns (pd.MultiIndex, optional) – Index for the columns of the DataFrame. If None, uses the same as index.
dtype (data type, optional) – Data type to force.
copy (bool, optional) – Whether to copy the data.
sparse (bool, default False) – If True, store the assembled matrix in pandas sparse format. Sparsification is applied after block assembly; use threshold zeroing in your builder before passing data here.
Attributes
Accessor for retrieving MatrixBlock instances from the Matrix. |
|
The underlying data, which must be numeric and non-NaN. |
Methods
|
Scale the matrix by a scalar factor. |
Convert to xarray (not implemented for base Matrix class). |
Inherited
From Structure2D: columns, is_sparse, name, to_dense, to_frame, to_sparse, values
From Structure: copy, reindex, round_index, shape, to_numpy, xs
From Pickleable: from_file, to_file