随着时间的推移分散一组 3d 点

发布于 2025-01-10 02:00:05 字数 1033 浏览 1 评论 0原文

我有一个以下类别的数据集:

class Event:

def __init__(self, timestamp, lx, ly, lz, nature):
    try:
        self.timestamp = datetime.strptime(timestamp, "%d/%m/%Y %H:%M")
    except:
        self.timestamp = datetime.strptime(timestamp, "%d/%m/%Y %H:%M:%S")
    self.x = lx
    self.y = ly
    self.z = lz
    self.nature = nature

问题是我正在尝试在 3d 中对这些点随时间的散布进行动画处理,其中我将指定 delta t 并从 t0 开始迭代直到 t max ,其中每一步都会有新的散点是在间隔增量中具有 t 的点。
这是我设法做的顺序:

def animation_tremor_events(index_Event):
    dx, dy, dz = arr_s_t_points[index_Event, 0], arr_s_t_points[index_Event, 1], arr_s_t_points[index_Event, 2]
    print(dx, dy, dz)
    text.set_text("{:d}: [{:.0f},{:.0f},{:.0f}]".format(index_Event, dx, dy, dz))  # for debugging
    x.append(dx)
    y.append(dy)
    z.append(dz)
    graph._offsets3d = (x, y, z)
    return graph,

这些是重要的部分,因为代码太长

ani = animation.FuncAnimation(fig, animation_tremor_events, frames=600, interval=0.001, save_count=5000)
plt.show()

I have a data set of the following class:

class Event:

def __init__(self, timestamp, lx, ly, lz, nature):
    try:
        self.timestamp = datetime.strptime(timestamp, "%d/%m/%Y %H:%M")
    except:
        self.timestamp = datetime.strptime(timestamp, "%d/%m/%Y %H:%M:%S")
    self.x = lx
    self.y = ly
    self.z = lz
    self.nature = nature

the thing is I am trying to animate a scatter of these points over time in 3d where I would specify a delta t and starting from t0 I would iterate till t max where at each step the new scattered points are the ones that have t in the increment to the interval.
this is the sequential one I manged to do:

def animation_tremor_events(index_Event):
    dx, dy, dz = arr_s_t_points[index_Event, 0], arr_s_t_points[index_Event, 1], arr_s_t_points[index_Event, 2]
    print(dx, dy, dz)
    text.set_text("{:d}: [{:.0f},{:.0f},{:.0f}]".format(index_Event, dx, dy, dz))  # for debugging
    x.append(dx)
    y.append(dy)
    z.append(dz)
    graph._offsets3d = (x, y, z)
    return graph,

these are the important segments because the code is too long

ani = animation.FuncAnimation(fig, animation_tremor_events, frames=600, interval=0.001, save_count=5000)
plt.show()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文