【问题标题】:Applying 1D cosine taper to 3D array将 1D 余弦锥度应用于 3D 阵列
【发布时间】:2020-07-30 16:29:41
【问题描述】:

我有一个时间序列数据集,我已将其窗口化为 n 个段。我的数据现在有维度(n、t、x、y)。我希望对每个段应用维度为 (t,) 的余弦锥度,但我显然不能将维度 (t,) 的数组乘以维度 (t, x, y) 的数组。

有人可以为我提供一种方法吗?

【问题讨论】:

  • 请提供样例数据和预期输出,以确保读者能够重现问题。

标签: python arrays numpy windowing


【解决方案1】:

您可以使用 NumPy broadcasting 将它们相乘。

在这种情况下,只需重塑你的余弦窗口并乘以类似的东西

# data set with shape (n, t, x, y), window has shape (t,)
tapered_data = data * window.reshape(1, t, 1, 1)

【讨论】:

  • 谢谢大卫!这正是我想要的。
猜你喜欢
  • 2014-03-03
  • 2017-12-03
  • 1970-01-01
  • 2013-12-14
  • 1970-01-01
  • 2016-10-22
  • 1970-01-01
  • 2012-01-16
  • 2015-01-24
相关资源
最近更新 更多