[AstroPy] Elliptical 2D gaussian kernel?
Larry Bradley
larry.bradley at gmail.com
Tue Apr 5 22:03:57 EDT 2016
Until #3605 is completed, you can create an elliptical 2D Gaussian kernel
using a combination of astropy.modeling.models.Gaussian2D and either
CustomKernel or Model2DKernel from the astropy.convolution subpackage.
CustomKernel creates a kernel from an odd-sized numpy array, while
Model2DKernel creates a kernel from an astropy model instance.
Here are concrete examples of both methods:
>>> from astropy.modeling.models import Gaussian2D
>>> from astropy.convolution import CustomKernel, Model2DKernel
>>> from astropy.coordinates import Angle
>>> theta = Angle(20, 'deg')
>>> g1 = Gaussian2D(10, 50, 50, 15, 5, theta=theta.radian)
>>> y, x = np.mgrid[:101, :101]
>>> kernel1 = CustomKernel(g1(x, y))
>>> g2 = Gaussian2D(10, 0, 0, 15, 5, theta=theta.radian)
>>> kernel2 = Model2DKernel(g2, x_size=101, y_size=101)
kernel1 and kernel2 are identical. Note that for Model2DKernel the model
position parameters are relative to the center of the kernel array (the g1
and g2 models have different x, y positions).
Cheers,
Larry
On Tue, Apr 5, 2016 at 8:02 PM, John K. Parejko <parejkoj at uw.edu> wrote:
> I'm curious whether there is a 2D Gaussian convolution kernel in astropy
> that has different x/y sigmas and rotation? I found
> astropy.convolution.Gaussian2DKernel, but that's circular.
>
> Looks like this was partially worked on in #3605, but it looks like it's
> stalled out?
>
> https://github.com/astropy/astropy/issues/3605
>
> John
>
> --
> *************************
> John Parejko
> parejkoj at uw.edu
> http://staff.washington.edu/parejkoj/
> Department of Physics and Astronomy
> University of Washington
> Seattle, WA
> **************************
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> https://mail.scipy.org/mailman/listinfo/astropy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20160405/cdacb9b0/attachment.html>
More information about the AstroPy
mailing list