EllipticalTophat2DKernel

class radio_beam.EllipticalTophat2DKernel(stddev_maj, stddev_min, position_angle, support_scaling=1, **kwargs)[source]

Bases: Kernel2D

2D Elliptical Tophat filter kernel.

The Tophat filter can produce artifacts when applied repeatedly on the same data.

Parameters:
stddev_majfloat

Standard deviation of the Gaussian kernel in direction 1

stddev_minfloat

Standard deviation of the Gaussian kernel in direction 1

position_anglefloat

Position angle of the elliptical gaussian

x_sizeodd int, optional

Size in x direction of the kernel array. Default = support_scaling * stddev.

y_sizeodd int, optional

Size in y direction of the kernel array. Default = support_scaling * stddev.

support_scalingint

The amount to scale the stddev to determine the size of the kernel

modestr, optional
One of the following discretization modes:
  • ‘center’ (default)

    Discretize model by taking the value at the center of the bin.

  • ‘linear_interp’

    Discretize model by performing a bilinear interpolation between the values at the corners of the bin.

  • ‘oversample’

    Discretize model by taking the average on an oversampled grid.

  • ‘integrate’

    Discretize model by integrating the model over the bin.

factornumber, optional

Factor of oversampling. Default factor = 10.

See also

Box2DKernel, Tophat2DKernel, MexicanHat2DKernel, Ring2DKernel
TrapezoidDisk2DKernel, AiryDisk2DKernel, Gaussian2DKernel
EllipticalGaussian2DKernel

Examples

Kernel response:

import matplotlib.pyplot as plt
from radio_beam import EllipticalTophat2DKernel
tophat_2D_kernel = EllipticalTophat2DKernel(10, 5, np.pi/4)
plt.imshow(tophat_2D_kernel, interpolation='none', origin='lower')
plt.xlabel('x [pixels]')
plt.ylabel('y [pixels]')
plt.colorbar()
plt.show()

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

../_images/radio_beam-EllipticalTophat2DKernel-1.png

Attributes Summary

array

Filter kernel array.

center

Index of the kernel center.

dimension

Kernel dimension.

is_bool

Indicates if kernel is bool.

model

Kernel response model.

separable

Indicates if the filter kernel is separable.

shape

Shape of the kernel array.

truncation

Absolute deviation of the sum of the kernel array values from one.

Methods Summary

normalize([mode])

Normalize the filter kernel.

Attributes Documentation

array

Filter kernel array.

center

Index of the kernel center.

dimension

Kernel dimension.

is_bool

Indicates if kernel is bool.

If the kernel is bool the multiplication in the convolution could be omitted, to increase the performance.

model

Kernel response model.

separable

Indicates if the filter kernel is separable.

A 2D filter is separable, when its filter array can be written as the outer product of two 1D arrays.

If a filter kernel is separable, higher dimension convolutions will be performed by applying the 1D filter array consecutively on every dimension. This is significantly faster, than using a filter array with the same dimension.

shape

Shape of the kernel array.

truncation

Absolute deviation of the sum of the kernel array values from one.

Methods Documentation

normalize(mode='integral')

Normalize the filter kernel.

Parameters:
mode{‘integral’, ‘peak’}
One of the following modes:
  • ‘integral’ (default)

    Kernel is normalized such that its integral = 1.

  • ‘peak’

    Kernel is normalized such that its peak = 1.