def compose_after(self, transform): r""" A :map:`Transform` that represents **this** transform composed **after** the given transform:: c = a.compose_after(b) c.apply(p) == a.apply(b.apply(p)) ``a`` and ``b`` are left unchanged. This corresponds to the usual mathematical formalism for the compose operator, ``o``. An attempt is made to perform native composition, but will fall back to a :map:`TransformChain` as a last resort. See :attr:`composes_with` for a description of how the mode of composition is decided. Parameters ---------- transform : :map:`Transform` Transform to be applied **before** ``self`` Returns ------- transform : :map:`Transform` or :map:`TransformChain` If the composition was native, a single new :map:`Transform` will be returned. If not, a :map:`TransformChain` is returned instead. """ if isinstance(transform, self.composes_with): return self._compose_after(transform) else: # best we can do is a TransformChain, let Transform handle that. return Transform.compose_after(self, transform)
def compose_after(self, transform): r""" c = a.compose_after(b) c.apply(p) == a.apply(b.apply(p)) a and b are left unchanged. This corresponds to the usual mathematical formalism for the compose operator, `o`. Parameters ---------- transform : :class:`Composable` Transform to be applied **before** self Returns -------- transform : :class:`Composable` The resulting transform. """ if isinstance(transform, self.composes_with): return self._compose_after(transform) else: # best we can do is a TransformChain, let Transform handle that. return Transform.compose_after(self, transform)
def compose_after(self, transform): r""" A :map:`Transform` that represents **this** transform composed **after** the given transform:: c = a.compose_after(b) c.apply(p) == a.apply(b.apply(p)) ``a`` and ``b`` are left unchanged. This corresponds to the usual mathematical formalism for the compose operator, `o`. An attempt is made to perform native composition, but will fall back to a :map:`TransformChain` as a last resort. See :attr:`composes_with` for a description of how the mode of composition is decided. Parameters ---------- transform : :map:`Transform` Transform to be applied **before** ``self`` Returns -------- transform : :map:`Transform` or :map:`TransformChain` If the composition was native, a single new :map:`Transform` will be returned. If not, a :map:`TransformChain` is returned instead. """ if isinstance(transform, self.composes_with): return self._compose_after(transform) else: # best we can do is a TransformChain, let Transform handle that. return Transform.compose_after(self, transform)
def compose_before(self, transform): r""" c = a.compose_before(b) c.apply(p) == b.apply(a.apply(p)) a and b are left unchanged. Parameters ---------- transform : :class:`Composable` Transform to be applied **after** self Returns -------- transform : :class:`Composable` The resulting transform. """ if isinstance(transform, self.composes_with): return self._compose_before(transform) else: # best we can do is a TransformChain, let Transform handle that. return Transform.compose_before(self, transform)