WIP: Resolve "Implement a NumpyDataContainer"

This merge request implements a NumpyDataContainer class that is derived from a DataContainer, and inherits the functionality of a NumbersMixin, a ComparisonMixin and a ForwardAttrsToDataMixin.

Classes that have to be implemented:

  • NumpyDataContainer
  • ForwardAttrsToDataMixin which forwards all attributes of a DataContainer to the internal data type. For an object NumpyDataContainer ndc this means that calling ndc.shape calls the shape method of the internally stored np.ndarray. Therefore all attributes (including functions) of the internal numpy.ndarray can be accessed.
  • ComparisonMixin which yields the functionality to compare two objects such as x==y, x!=y, x<y, x<=y, x>y, x>=y
  • NumbersMixin which provides the ability to perform ...
    • binary operations: z = x + y, z = x - y, z = x * y, z = x ** y, z = x % y, z = x ** y, z = x / y, z = x // y, z = divmod(x, y) on copies of the data
    • unary operations: floor(x), ...
    • in-place operations: x += y, ...

Tests:

  • A NumpyDataContainer object is constructed correctly
  • The ForwardAttrsToDataMixin calls the corresponding numpy.ndarray methods. Test this by comparing the results of thesame operation on numpy.ndarray's and NumpyDataContainer objects
  • The methods of the ComparisonMixin by comparing with the analog operations on numpy.ndarray's
  • The methods of the NumbersMixin for operations with other NumpyDataContainer objects and operations with simple scalars

Related issues

Closes #4 (closed)

Edited by Utopia Developers

Merge request reports

Loading