lmpy.data_wrangling.matrix.base

Module containing Matrix Data Wrangler base class.

Module Contents

Classes

_MatrixDataWrangler

Constructor for _MatrixDataWrangler base class.

class lmpy.data_wrangling.matrix.base._MatrixDataWrangler(**params)[source]

Bases: lmpy.data_wrangling.base._DataWrangler

Constructor for _MatrixDataWrangler base class.

Parameters

**params (dict) – Named parameters to pass to _DataWrangler base class.

name = _MatrixDataWrangler[source]
_report_slice(self, axis, idx, modified=False, purged=False)[source]

Report what is done on a matrix slice.

Parameters
  • axis (int) – The axis of the interaction.

  • idx (int) – The index of the interaction.

  • modified (bool) – Was the slice modified.

  • purged (bool) – Was the slice purged.

reorder(self, matrix, *axes_order)[source]

Reorder / subset a matrix for a number of dimensions.

Parameters
  • matrix (Matrix) – A matrix to reorder.

  • *axes_order (list of iterables) – Iterables for each dimension of a matrix to reorder / subset.

Returns

A reordered and / or subset matrix.

Return type

Matrix

abstract wrangle_matrix(self, matrix)[source]

Wrangle a matrix.

Parameters

matrix (Matrix) – A matrix to wrangle.

Raises

NotImplementedError – This method is not implemeneted for the base class.