HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/anaconda3/Lib/site-packages/astropy/visualization/transform.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst


__all__ = ["BaseTransform", "CompositeTransform"]


class BaseTransform:
    """
    A transformation object.

    This is used to construct transformations such as scaling, stretching, and
    so on.
    """

    def __add__(self, other):
        return CompositeTransform(other, self)


class CompositeTransform(BaseTransform):
    """
    A combination of two transforms.

    Parameters
    ----------
    transform_1 : :class:`astropy.visualization.BaseTransform`
        The first transform to apply.
    transform_2 : :class:`astropy.visualization.BaseTransform`
        The second transform to apply.
    """

    def __init__(self, transform_1, transform_2):
        super().__init__()
        self.transform_1 = transform_1
        self.transform_2 = transform_2

    def __call__(self, values, clip=True):
        return self.transform_2(self.transform_1(values, clip=clip), clip=clip)

    @property
    def inverse(self):
        return self.__class__(self.transform_2.inverse, self.transform_1.inverse)