本文整理汇总了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"
)