SplitCosineBellWindow#

class photutils.psf_matching.SplitCosineBellWindow(alpha, beta)[source]#

Bases: object

Class to define a 2D split cosine bell taper function.

This is the base class for window functions, providing full control over both the inner flat region (beta) and the taper width (alpha). The window equals 1.0 in the inner region, smoothly transitions to 0.0 using a cosine taper, and remains 0.0 outside.

This window is useful when you need precise control over both the preserved central region and the taper characteristics.

Parameters:
alphafloat, optional

The percentage of array values that are tapered. alpha must be between 0.0 and 1.0, inclusive.

betafloat, optional

The inner diameter as a fraction of the array size beyond which the taper begins. beta must be between 0.0 and 1.0, inclusive.

Examples

import matplotlib.pyplot as plt
from photutils.psf_matching import SplitCosineBellWindow

taper = SplitCosineBellWindow(alpha=0.4, beta=0.3)
data = taper((101, 101))
fig, ax = plt.subplots()
axim = ax.imshow(data, origin='lower')
fig.colorbar(axim)

(Source code, png, hires.png, pdf, svg)

../_images/photutils-psf_matching-SplitCosineBellWindow-1.png

A 1D cut across the image center:

import matplotlib.pyplot as plt
from photutils.psf_matching import SplitCosineBellWindow

taper = SplitCosineBellWindow(alpha=0.4, beta=0.3)
data = taper((101, 101))
fig, ax = plt.subplots()
ax.plot(data[50, :])

(Source code, png, hires.png, pdf, svg)

../_images/photutils-psf_matching-SplitCosineBellWindow-2.png

Methods Summary

__call__(shape)

Generate the window function for the given shape.

Methods Documentation

__call__(shape)[source]#

Generate the window function for the given shape.

Parameters:
shapetuple of int

The size of the output array along each axis.

Returns:
result2D ndarray

The window function as a 2D array.