How to use the photutils.aperture.attributes.PositiveScalar function in photutils

To help you get started, we’ve selected a few photutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github astropy / photutils / photutils / aperture / rectangle.py View on Github external
--------
    >>> from photutils import RectangularAnnulus
    >>> aper = RectangularAnnulus([10., 20.], 3., 8., 5.)
    >>> aper = RectangularAnnulus((10., 20.), 3., 8., 5., theta=np.pi)

    >>> pos1 = (10., 20.)  # (x, y)
    >>> pos2 = (30., 40.)
    >>> pos3 = (50., 60.)
    >>> aper = RectangularAnnulus([pos1, pos2, pos3], 3., 8., 5.)
    >>> aper = RectangularAnnulus((pos1, pos2, pos3), 3., 8., 5., theta=np.pi)
    """

    _shape_params = ('w_in', 'w_out', 'h_out', 'theta')
    positions = PixelPositions('positions')
    w_in = PositiveScalar('w_in')
    w_out = PositiveScalar('w_out')
    h_out = PositiveScalar('h_out')
    theta = Scalar('theta')

    def __init__(self, positions, w_in, w_out, h_out, theta=0.):
        if not w_out > w_in:
            raise ValueError("'w_out' must be greater than 'w_in'")

        self.positions = positions
        self.w_in = w_in
        self.w_out = w_out
        self.h_out = h_out
        self.h_in = self.w_in * self.h_out / self.w_out
        self.theta = theta

    @property
    def _xy_extents(self):
github astropy / photutils / photutils / aperture / circle.py View on Github external
Examples
    --------
    >>> from photutils import CircularAnnulus
    >>> aper = CircularAnnulus([10., 20.], 3., 5.)
    >>> aper = CircularAnnulus((10., 20.), 3., 5.)

    >>> pos1 = (10., 20.)  # (x, y)
    >>> pos2 = (30., 40.)
    >>> pos3 = (50., 60.)
    >>> aper = CircularAnnulus([pos1, pos2, pos3], 3., 5.)
    >>> aper = CircularAnnulus((pos1, pos2, pos3), 3., 5.)
    """

    _shape_params = ('r_in', 'r_out')
    positions = PixelPositions('positions')
    r_in = PositiveScalar('r_in')
    r_out = PositiveScalar('r_out')

    def __init__(self, positions, r_in, r_out):
        if not r_out > r_in:
            raise ValueError('r_out must be greater than r_in')

        self.positions = positions
        self.r_in = r_in
        self.r_out = r_out

    @property
    def _xy_extents(self):
        return self.r_out, self.r_out

    @property
    def area(self):
github astropy / photutils / photutils / aperture / rectangle.py View on Github external
Examples
    --------
    >>> from photutils import RectangularAnnulus
    >>> aper = RectangularAnnulus([10., 20.], 3., 8., 5.)
    >>> aper = RectangularAnnulus((10., 20.), 3., 8., 5., theta=np.pi)

    >>> pos1 = (10., 20.)  # (x, y)
    >>> pos2 = (30., 40.)
    >>> pos3 = (50., 60.)
    >>> aper = RectangularAnnulus([pos1, pos2, pos3], 3., 8., 5.)
    >>> aper = RectangularAnnulus((pos1, pos2, pos3), 3., 8., 5., theta=np.pi)
    """

    _shape_params = ('w_in', 'w_out', 'h_out', 'theta')
    positions = PixelPositions('positions')
    w_in = PositiveScalar('w_in')
    w_out = PositiveScalar('w_out')
    h_out = PositiveScalar('h_out')
    theta = Scalar('theta')

    def __init__(self, positions, w_in, w_out, h_out, theta=0.):
        if not w_out > w_in:
            raise ValueError("'w_out' must be greater than 'w_in'")

        self.positions = positions
        self.w_in = w_in
        self.w_out = w_out
        self.h_out = h_out
        self.h_in = self.w_in * self.h_out / self.w_out
        self.theta = theta

    @property
github astropy / photutils / photutils / aperture / ellipse.py View on Github external
--------
    >>> from photutils import EllipticalAperture
    >>> aper = EllipticalAperture([10., 20.], 5., 3.)
    >>> aper = EllipticalAperture((10., 20.), 5., 3., theta=np.pi)

    >>> pos1 = (10., 20.)  # (x, y)
    >>> pos2 = (30., 40.)
    >>> pos3 = (50., 60.)
    >>> aper = EllipticalAperture([pos1, pos2, pos3], 5., 3.)
    >>> aper = EllipticalAperture((pos1, pos2, pos3), 5., 3., theta=np.pi)
    """

    _shape_params = ('a', 'b', 'theta')
    positions = PixelPositions('positions')
    a = PositiveScalar('a')
    b = PositiveScalar('b')
    theta = Scalar('theta')

    def __init__(self, positions, a, b, theta=0.):
        self.positions = positions
        self.a = a
        self.b = b
        self.theta = theta

    @property
    def _xy_extents(self):
        return self._calc_extents(self.a, self.b, self.theta)

    @property
    def area(self):
        return math.pi * self.a * self.b
github astropy / photutils / photutils / aperture / rectangle.py View on Github external
--------
    >>> from photutils import RectangularAperture
    >>> aper = RectangularAperture([10., 20.], 5., 3.)
    >>> aper = RectangularAperture((10., 20.), 5., 3., theta=np.pi)

    >>> pos1 = (10., 20.)  # (x, y)
    >>> pos2 = (30., 40.)
    >>> pos3 = (50., 60.)
    >>> aper = RectangularAperture([pos1, pos2, pos3], 5., 3.)
    >>> aper = RectangularAperture((pos1, pos2, pos3), 5., 3., theta=np.pi)
    """

    _shape_params = ('w', 'h', 'theta')
    positions = PixelPositions('positions')
    w = PositiveScalar('w')
    h = PositiveScalar('h')
    theta = Scalar('theta')

    def __init__(self, positions, w, h, theta=0.):
        self.positions = positions
        self.w = w
        self.h = h
        self.theta = theta

    @property
    def _xy_extents(self):
        return self._calc_extents(self.w, self.h, self.theta)

    @property
    def area(self):
        return self.w * self.h
github astropy / photutils / photutils / aperture / ellipse.py View on Github external
Examples
    --------
    >>> from photutils import EllipticalAnnulus
    >>> aper = EllipticalAnnulus([10., 20.], 3., 8., 5.)
    >>> aper = EllipticalAnnulus((10., 20.), 3., 8., 5., theta=np.pi)

    >>> pos1 = (10., 20.)  # (x, y)
    >>> pos2 = (30., 40.)
    >>> pos3 = (50., 60.)
    >>> aper = EllipticalAnnulus([pos1, pos2, pos3], 3., 8., 5.)
    >>> aper = EllipticalAnnulus((pos1, pos2, pos3), 3., 8., 5., theta=np.pi)
    """

    _shape_params = ('a_in', 'a_out', 'b_out', 'theta')
    positions = PixelPositions('positions')
    a_in = PositiveScalar('a_in')
    a_out = PositiveScalar('a_out')
    b_out = PositiveScalar('b_out')
    theta = Scalar('theta')

    def __init__(self, positions, a_in, a_out, b_out, theta=0.):
        if not a_out > a_in:
            raise ValueError('"a_out" must be greater than "a_in".')

        self.positions = positions
        self.a_in = a_in
        self.a_out = a_out
        self.b_out = b_out
        self.b_in = self.b_out * self.a_in / self.a_out
        self.theta = theta

    @property
github astropy / photutils / photutils / aperture / ellipse.py View on Github external
Examples
    --------
    >>> from photutils import EllipticalAperture
    >>> aper = EllipticalAperture([10., 20.], 5., 3.)
    >>> aper = EllipticalAperture((10., 20.), 5., 3., theta=np.pi)

    >>> pos1 = (10., 20.)  # (x, y)
    >>> pos2 = (30., 40.)
    >>> pos3 = (50., 60.)
    >>> aper = EllipticalAperture([pos1, pos2, pos3], 5., 3.)
    >>> aper = EllipticalAperture((pos1, pos2, pos3), 5., 3., theta=np.pi)
    """

    _shape_params = ('a', 'b', 'theta')
    positions = PixelPositions('positions')
    a = PositiveScalar('a')
    b = PositiveScalar('b')
    theta = Scalar('theta')

    def __init__(self, positions, a, b, theta=0.):
        self.positions = positions
        self.a = a
        self.b = b
        self.theta = theta

    @property
    def _xy_extents(self):
        return self._calc_extents(self.a, self.b, self.theta)

    @property
    def area(self):
        return math.pi * self.a * self.b
github astropy / photutils / photutils / aperture / ellipse.py View on Github external
--------
    >>> from photutils import EllipticalAnnulus
    >>> aper = EllipticalAnnulus([10., 20.], 3., 8., 5.)
    >>> aper = EllipticalAnnulus((10., 20.), 3., 8., 5., theta=np.pi)

    >>> pos1 = (10., 20.)  # (x, y)
    >>> pos2 = (30., 40.)
    >>> pos3 = (50., 60.)
    >>> aper = EllipticalAnnulus([pos1, pos2, pos3], 3., 8., 5.)
    >>> aper = EllipticalAnnulus((pos1, pos2, pos3), 3., 8., 5., theta=np.pi)
    """

    _shape_params = ('a_in', 'a_out', 'b_out', 'theta')
    positions = PixelPositions('positions')
    a_in = PositiveScalar('a_in')
    a_out = PositiveScalar('a_out')
    b_out = PositiveScalar('b_out')
    theta = Scalar('theta')

    def __init__(self, positions, a_in, a_out, b_out, theta=0.):
        if not a_out > a_in:
            raise ValueError('"a_out" must be greater than "a_in".')

        self.positions = positions
        self.a_in = a_in
        self.a_out = a_out
        self.b_out = b_out
        self.b_in = self.b_out * self.a_in / self.a_out
        self.theta = theta

    @property
    def _xy_extents(self):
github astropy / photutils / photutils / aperture / rectangle.py View on Github external
>>> from photutils import RectangularAnnulus
    >>> aper = RectangularAnnulus([10., 20.], 3., 8., 5.)
    >>> aper = RectangularAnnulus((10., 20.), 3., 8., 5., theta=np.pi)

    >>> pos1 = (10., 20.)  # (x, y)
    >>> pos2 = (30., 40.)
    >>> pos3 = (50., 60.)
    >>> aper = RectangularAnnulus([pos1, pos2, pos3], 3., 8., 5.)
    >>> aper = RectangularAnnulus((pos1, pos2, pos3), 3., 8., 5., theta=np.pi)
    """

    _shape_params = ('w_in', 'w_out', 'h_out', 'theta')
    positions = PixelPositions('positions')
    w_in = PositiveScalar('w_in')
    w_out = PositiveScalar('w_out')
    h_out = PositiveScalar('h_out')
    theta = Scalar('theta')

    def __init__(self, positions, w_in, w_out, h_out, theta=0.):
        if not w_out > w_in:
            raise ValueError("'w_out' must be greater than 'w_in'")

        self.positions = positions
        self.w_in = w_in
        self.w_out = w_out
        self.h_out = h_out
        self.h_in = self.w_in * self.h_out / self.w_out
        self.theta = theta

    @property
    def _xy_extents(self):
        return self._calc_extents(self.w_out, self.h_out, self.theta)
github astropy / photutils / photutils / aperture / ellipse.py View on Github external
>>> from photutils import EllipticalAnnulus
    >>> aper = EllipticalAnnulus([10., 20.], 3., 8., 5.)
    >>> aper = EllipticalAnnulus((10., 20.), 3., 8., 5., theta=np.pi)

    >>> pos1 = (10., 20.)  # (x, y)
    >>> pos2 = (30., 40.)
    >>> pos3 = (50., 60.)
    >>> aper = EllipticalAnnulus([pos1, pos2, pos3], 3., 8., 5.)
    >>> aper = EllipticalAnnulus((pos1, pos2, pos3), 3., 8., 5., theta=np.pi)
    """

    _shape_params = ('a_in', 'a_out', 'b_out', 'theta')
    positions = PixelPositions('positions')
    a_in = PositiveScalar('a_in')
    a_out = PositiveScalar('a_out')
    b_out = PositiveScalar('b_out')
    theta = Scalar('theta')

    def __init__(self, positions, a_in, a_out, b_out, theta=0.):
        if not a_out > a_in:
            raise ValueError('"a_out" must be greater than "a_in".')

        self.positions = positions
        self.a_in = a_in
        self.a_out = a_out
        self.b_out = b_out
        self.b_in = self.b_out * self.a_in / self.a_out
        self.theta = theta

    @property
    def _xy_extents(self):
        return self._calc_extents(self.a_out, self.b_out, self.theta)