[docs]classUnaryIsometricOpSimple(DelayedOp):"""Delayed unary isometric operation involving an n-dimensional seed array with no additional arguments, similar to Bioconductor's ``DelayedArray::DelayedUnaryIsoOpStack`` class. This is used for simple mathematical operations like NumPy's :py:meth:`~numpy.log`. This class is intended for developers to construct new :py:class:`~delayedarray.DelayedArray.DelayedArray` instances. End-users should not be interacting with ``UnaryIsometricOpSimple`` objects directly. """
[docs]def__init__(self,seed,operation:OP):""" Args: seed: Any object that satisfies the seed contract, see :py:class:`~delayedarray.DelayedArray.DelayedArray` for details. operation: String specifying the unary operation. """f=_choose_operator(operation)dummy=f(zeros(1,dtype=seed.dtype))self._seed=seedself._op=operationself._dtype=dummy.dtypeself._sparse=is_sparse(self._seed)anddummy[0]==0
@propertydefshape(self)->Tuple[int,...]:""" Returns: Tuple of integers specifying the extent of each dimension of the object after the operation. This should be the same as ``seed``. """returnself._seed.shape@propertydefdtype(self)->dtype:""" Returns: NumPy type for the contents of the object after the operation. This may or may not be the same as the ``seed`` array, depending on how NumPy does the casting for the requested operation. """returnself._dtype@propertydefseed(self):""" Returns: The seed object. """returnself._seed@propertydefoperation(self)->OP:""" Returns: Name of the operation. """returnself._op