04
Jun
from deephaven import time_tablefrom deephaven.updateby import ema_timet1 = time_table('PT00:00:00.1') .update(["Label = ii%2 == 0 ? `cos` : `sin`", "X = ii%2 == 0 ? cos(0.05*ii)+0.7*random() : sin(0.01*ii)+0.7*random()"])t2 = t1.update_by([ema_time("Timestamp", "PT00:00:01", "XEma=X")], by="Label")from deephaven.plot import Figurep = Figure() .plot_xy("Value", t=t2, x="Timestamp", y="X", by=["Label"]) .plot_xy("EMA", t=t2, x="Timestamp", y="XEma", by=["Label"]) .show() Source link lol