| Server IP : 217.160.0.135 / Your IP : 216.73.217.85 Web Server : Apache System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64 User : sws1074145052 ( 1074145052) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/lib/python3/dist-packages/scipy/ndimage/__pycache__/ |
Upload File : |
�
d�c~, � �f � d dl Z d dlmZ ddlmZ ddlmZ g d�Zd� Zd� Zdd
�Z dd�Z
dd�Zdd
�ZdS )� N)�normalize_axis_index� )�_ni_support)� _nd_image)�fourier_gaussian�fourier_uniform�fourier_ellipsoid�
fourier_shiftc � � | �v|j j t j t j t j fv r!t j |j |j �� � } n�t j |j t j �� � } n�t | � � t u r[| t j t j t j t j fvrt d� � �t j |j | �� � } n| j |j k rt d� � �| S �N��dtypezoutput type not supportedzoutput shape not correct)
r �type�numpy� complex64�
complex128�float32�zeros�shape�float64�RuntimeError��output�inputs �8/usr/lib/python3/dist-packages/scipy/ndimage/_fourier.py�_get_output_fourierr ( s� � �
�~��;�����1A� %�
� /� /� /��[���E�K�@�@�@�F�F��[���E�M�B�B�B�F�F�
�f���� � ��%�/�5�+;��-���8� 8� 8��:�;�;�;���U�[��7�7�7��� ���� $� $��5�6�6�6��M� c �� � | �k|j j t j t j fv r!t j |j |j �� � } n�t j |j t j �� � } nzt | � � t u rE| t j t j fvrt d� � �t j |j | �� � } n| j |j k rt d� � �| S r )r r r r r r r r r s r �_get_output_fourier_complexr 9 s� � �
�~��;�����1A�B�B�B��[���E�K�@�@�@�F�F��[���E�4D�E�E�E�F�F�
�f���� � ��%�/�5�+;�<�<�<��:�;�;�;���U�[��7�7�7��� ���� $� $��5�6�6�6��Mr ���c �^ � t j | � � } t || � � }t || j � � }t j || j � � }t j |t j �� � }|j j s|�
� � }t j | ||||d� � |S )a
Multidimensional Gaussian fourier filter.
The array is multiplied with the fourier transform of a Gaussian
kernel.
Parameters
----------
input : array_like
The input array.
sigma : float or sequence
The sigma of the Gaussian kernel. If a float, `sigma` is the same for
all axes. If a sequence, `sigma` has to contain one value for each
axis.
n : int, optional
If `n` is negative (default), then the input is assumed to be the
result of a complex fft.
If `n` is larger than or equal to zero, the input is assumed to be the
result of a real fft, and `n` gives the length of the array before
transformation along the real transform direction.
axis : int, optional
The axis of the real transform.
output : ndarray, optional
If given, the result of filtering the input is placed in this array.
Returns
-------
fourier_gaussian : ndarray
The filtered input.
Examples
--------
>>> from scipy import ndimage, datasets
>>> import numpy.fft
>>> import matplotlib.pyplot as plt
>>> fig, (ax1, ax2) = plt.subplots(1, 2)
>>> plt.gray() # show the filtered result in grayscale
>>> ascent = datasets.ascent()
>>> input_ = numpy.fft.fft2(ascent)
>>> result = ndimage.fourier_gaussian(input_, sigma=4)
>>> result = numpy.fft.ifft2(result)
>>> ax1.imshow(ascent)
>>> ax2.imshow(result.real) # the imaginary part is an artifact
>>> plt.show()
r
r �
r �asarrayr r �ndimr �_normalize_sequencer �flags�
contiguous�copyr �fourier_filter)r �sigma�n�axisr �sigmass r r r H s� � �\
�M�%� � �E�
���
/�
/�F���e�j�1�1�D�
�
,�U�E�J�
?�
?�F�
�]�6���
7�
7�
7�F��<�"� �������
��U�F�A�t�V�Q�?�?�?��Mr c �^ � t j | � � } t || � � }t || j � � }t j || j � � }t j |t j �� � }|j j s|�
� � }t j | ||||d� � |S )a
Multidimensional uniform fourier filter.
The array is multiplied with the Fourier transform of a box of given
size.
Parameters
----------
input : array_like
The input array.
size : float or sequence
The size of the box used for filtering.
If a float, `size` is the same for all axes. If a sequence, `size` has
to contain one value for each axis.
n : int, optional
If `n` is negative (default), then the input is assumed to be the
result of a complex fft.
If `n` is larger than or equal to zero, the input is assumed to be the
result of a real fft, and `n` gives the length of the array before
transformation along the real transform direction.
axis : int, optional
The axis of the real transform.
output : ndarray, optional
If given, the result of filtering the input is placed in this array.
Returns
-------
fourier_uniform : ndarray
The filtered input.
Examples
--------
>>> from scipy import ndimage, datasets
>>> import numpy.fft
>>> import matplotlib.pyplot as plt
>>> fig, (ax1, ax2) = plt.subplots(1, 2)
>>> plt.gray() # show the filtered result in grayscale
>>> ascent = datasets.ascent()
>>> input_ = numpy.fft.fft2(ascent)
>>> result = ndimage.fourier_uniform(input_, size=20)
>>> result = numpy.fft.ifft2(result)
>>> ax1.imshow(ascent)
>>> ax2.imshow(result.real) # the imaginary part is an artifact
>>> plt.show()
r
r r"