Python:有什么方法可以在没有填充数据的情况下获得周期性3D信号/场的n阶抗素?
如标题中所述,我想获得3D场(例如带有形状的数组(1024,1024,1024))的n-th-th(例如4-th)订单抗动力,每一侧l。 如果我需要超过周期L的抗体值,则必须在求解抗体之前定期添加数据(“包装”)。 ,这种方法是高度的存储器消耗,特别是对于1024^3阵列。我的Python代码片段如下所示:
import numpy as np
from scipy.interpolate import make_interp_spline
data = np.load("xxx.npy") # shape: (1024,1024,1024)
data_pad = np.pad(data, ( (1024,1024), (1024,1024), (1024,1024) ), "wrap")
# 4th antiderivative of the padded data along x
interp_x = make_interp_spline(x_pad, data_pad, k=3, axis=0)
interp_x4 = interp_x.antiderivative(4)
是否有其他方法可以实现相同的目标而无需填充数据?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如我在定期信号的评论中提到的那样,您可以从傅立叶转变中获得抗动力。
如果您的函数为
(n+1)
times可区分,则可以获取n
衍生品,此后,您将遇到与 gibbs netomenon可悲的是,我们在这里没有方程式支持
,但使用,AS
d(Omega) * F(Omega)
,如果d(Omega)
到处都是零,则可以颠倒派生。让我们从一个1D示例开始,
如果您的数据具有多个维度,则可以为每个轴个人应用此示例
,假设您的尺寸为
0< = x,y,z< 1
在周期1的情况下,您可以写作
假设要求解毒药方程,您可以通过
As I mentioned in the comments for periodic signals you can get antiderivatives from the Fourier transfrom.
If your function is
(n+1)
times differentiable, you can getn
derivatives, after that you will have problems related to the Gibbs phenomenonIt is sad that we don't have equations support here
but using the translation identities you can get e.g.
(f(x+a) - f(x-a)) / (2*a)
, asD(omega) * F(omega)
, and ifD(omega)
is non-zero everywhere, you can invert the derivation.Let's start with a 1D example
If your data has multiple dimensions you can apply this for for each axis individually
Assuming that your dimensions are
0 <= x,y,z < 1
with period 1then you could write
Suppose you want to solve the Poison's equation, you can do it by