本文整理匯總了Python中pyfftw.empty_aligned方法的典型用法代碼示例。如果您正苦於以下問題:Python pyfftw.empty_aligned方法的具體用法?Python pyfftw.empty_aligned怎麽用?Python pyfftw.empty_aligned使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyfftw
的用法示例。
在下文中一共展示了pyfftw.empty_aligned方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: pyfftw_empty_aligned
# 需要導入模塊: import pyfftw [as 別名]
# 或者: from pyfftw import empty_aligned [as 別名]
def pyfftw_empty_aligned(shape, dtype, order='C', n=None):
"""
Construct an empty byte-aligned array for efficient use by :mod:`pyfftw`.
This function is a wrapper for :func:`pyfftw.empty_aligned`
Parameters
----------
shape : sequence of ints
Output array shape
dtype : dtype
Output array dtype
n : int, optional (default None)
Output array should be aligned to n-byte boundary
Returns
-------
a : ndarray
Empty array with required byte-alignment
"""
return pyfftw.empty_aligned(shape, dtype, order, n)
示例2: empty_aligned
# 需要導入模塊: import pyfftw [as 別名]
# 或者: from pyfftw import empty_aligned [as 別名]
def empty_aligned(shape, dtype, order='C', n=None):
"""Construct an empty byte-aligned array for FFTs.
Construct an empty byte-aligned array for efficient use by :mod:`pyfftw`.
This function is a wrapper for :func:`pyfftw.empty_aligned`
Parameters
----------
shape : sequence of ints
Output array shape
dtype : dtype
Output array dtype
order : {'C', 'F'}, optional (default 'C')
Specify whether arrays should be stored in row-major (C-style) or
column-major (Fortran-style) order
n : int, optional (default None)
Output array should be aligned to n-byte boundary
Returns
-------
a : ndarray
Empty array with required byte-alignment
"""
return pyfftw.empty_aligned(shape, dtype, order, n)
示例3: rfftn_empty_aligned
# 需要導入模塊: import pyfftw [as 別名]
# 或者: from pyfftw import empty_aligned [as 別名]
def rfftn_empty_aligned(shape, axes, dtype, order='C', n=None):
"""Construct an empty byte-aligned array for real FFTs.
Construct an empty byte-aligned array for efficient use by :mod:`pyfftw`
functions :func:`pyfftw.interfaces.numpy_fft.rfftn` and
:func:`pyfftw.interfaces.numpy_fft.irfftn`. The shape of the
empty array is appropriate for the output of
:func:`pyfftw.interfaces.numpy_fft.rfftn` applied
to an array of the shape specified by parameter `shape`, and for the
input of the corresponding :func:`pyfftw.interfaces.numpy_fft.irfftn`
call that reverses this operation.
Parameters
----------
shape : sequence of ints
Output array shape
axes : sequence of ints
Axes on which the FFT will be computed
dtype : dtype
Real dtype from which the complex dtype of the output array is derived
order : {'C', 'F'}, optional (default 'C')
Specify whether arrays should be stored in row-major (C-style) or
column-major (Fortran-style) order
n : int, optional (default None)
Output array should be aligned to n-byte boundary
Returns
-------
a : ndarray
Empty array with required byte-alignment
"""
ashp = list(shape)
raxis = axes[-1]
ashp[raxis] = ashp[raxis] // 2 + 1
cdtype = complex_dtype(dtype)
return pyfftw.empty_aligned(ashp, cdtype, order, n)
示例4: initFFTs
# 需要導入模塊: import pyfftw [as 別名]
# 或者: from pyfftw import empty_aligned [as 別名]
def initFFTs(self):
"""
Initialise the FFT Objects required for running the WFS
Initialised various FFT objects which are used through the WFS,
these include FFTs to calculate focal planes, and to convolve LGS
PSFs with the focal planes
"""
#Calculate the FFT padding to use
self.subapFFTPadding = self.nx_subap_pixels_oversize * self.config.fftOversamp
if self.subapFFTPadding < self.nx_subap_interp:
while self.subapFFTPadding<self.nx_subap_interp:
self.config.fftOversamp+=1
self.subapFFTPadding\
=self.nx_subap_pixels_oversize*self.config.fftOversamp
logger.warning("requested WFS FFT Padding less than FOV size... Setting oversampling to: %d"%self.config.fftOversamp)
#Init the FFT to the focal plane
# self.FFT = AOFFT.FFT(
# inputSize=(
# self.n_subaps, self.subapFFTPadding, self.subapFFTPadding),
# axes=(-2,-1), mode="pyfftw",dtype=CDTYPE,
# THREADS=self.threads,
# fftw_FLAGS=(self.config.fftwFlag,"FFTW_DESTROY_INPUT"))
self.fft_input_data = pyfftw.empty_aligned(
(self.n_subaps, self.subapFFTPadding, self.subapFFTPadding), dtype=CDTYPE)
self.fft_output_data = pyfftw.empty_aligned(
(self.n_subaps, self.subapFFTPadding, self.subapFFTPadding), dtype=CDTYPE)
self.FFT = pyfftw.FFTW(
self.fft_input_data, self.fft_output_data, axes=(-2, -1),
threads=self.threads, flags=(self.config.fftwFlag, "FFTW_DESTROY_INPUT")
)
# If LGS uplink, init FFTs to conovolve LGS PSF and WFS PSF(s)
# This works even if no lgsConfig.uplink as ``and`` short circuits
if self.lgsConfig and self.lgsConfig.uplink:
self.ifft_input_data = pyfftw.empty_aligned(
(self.n_subaps, self.subapFFTPadding, self.subapFFTPadding), dtype=CDTYPE)
self.ifft_output_data = pyfftw.empty_aligned(
(self.n_subaps, self.subapFFTPadding, self.subapFFTPadding), dtype=CDTYPE)
self.iFFT = pyfftw.FFTW(
self.ifft_input_data, self.ifft_output_data, axes=(-2, -1),
threads=self.threads, flags=(self.config.fftwFlag, "FFTW_DESTROY_INPUT"),
direction="FFTW_BACKWARD"
)
self.lgs_ifft_input_data = pyfftw.empty_aligned(
(self.subapFFTPadding, self.subapFFTPadding), dtype=CDTYPE)
self.lgs_ifft_output_data = pyfftw.empty_aligned(
(self.subapFFTPadding, self.subapFFTPadding), dtype=CDTYPE)
self.lgs_iFFT = pyfftw.FFTW(
self.lgs_ifft_input_data, self.lgs_ifft_output_data, axes=(0, 1),
threads=self.threads, flags=(self.config.fftwFlag, "FFTW_DESTROY_INPUT"),
direction="FFTW_BACKWARD"
)