Skip to main content
APSHANKAR Sagar
Seasoned ⭐️⭐️
Seasoned ⭐️⭐️
Jul 5, 2024 8:55 AM UTC
Gathering Interest

CDF Synthetic Time Series : logical and time depth operations

Related products:Other

We use Synthetic Time Series for as many things as we can to avoid using the trouble of re-indexing and interpolating in pandas.

However, CDF Synthetic Time Series can’t do any basic logical operations, comparison operations or lag operations. For instance, if I want a time series that gives me 1 when my TS values is between an LCL and a UCL and 0 otherwise. 

In pandas, this is simple:

1 if pd.between(x, LCL, UCL) else 0

but since CDF STS doesn’t support if, and, not, >, <  etc, so this doesn’t work.

Another use-case was when I needed the moving average for the last hour. I had to make a time series and manage it’s creation, DM entry etc when I would have preferred to use an STS since the only use of that calculation was as an intermediate step. 

The map command in CDF STS looked promising but it doesn’t work without a string input. 
I’d like STS to support:

  • if()
  • and()
  • or()
  • not()
  • lag()
  • lead()
  • movingAverage()
  • movingSum()
  • abs()

6 replies

matiasholte
Practitioner ⭐️⭐️⭐️
Backend developer
Jul 5, 2024 9:14 AM UTC

I like the idea!
There are some hacks available to do boolean logic, for instance using on_error, and the fact that some operations will fail for negative numbers.
For instance:
on_error(1+0*(ln(x-LCL)*ln(UCL-x)), 0) (sqrt to allow equality)

The 1 is the value if true. 0*(…) is an ugly hack that will return 0, unless any of the operations throw an error, and the ,0 at the end is the default value in case of error.

I do not recommend using this approach, it’s too ugly for that. There are similar alternatives, using math and round(), but they also create long expressions.

As for time delay/lag, it is not possible, not even with query hacking, and a good suggestion.
 

Everton Colling
Expert ⭐️⭐️⭐️⭐️
Expert ⭐️⭐️⭐️⭐️
Jul 5, 2024 9:30 AM UTC

Hi @APSHANKAR Sagar!


Thank you for suggesting this product idea. We will follow the traction this idea gets in the community. You can expect updates on this post if we decide to include this in our future roadmap, or if we require more information.

Seasoned ⭐️⭐️
Mar 25, 2025 5:28 PM UTC

Hi!

These features, especially the moving average in combination with the logical operators will make the synthetic timeseries very powerful. Is there any plan yet to implement this?

Everton Colling
Expert ⭐️⭐️⭐️⭐️
Expert ⭐️⭐️⭐️⭐️
Nov 20, 2026 9:27 AM UTC

Hi ​@APSHANKAR Sagar and ​@Yatish Pitta!

Following up on my earlier reply with an update: we have started development of a new time series calculation engine, and logical/comparison operators and time-window operations like lag and moving averages are among the capabilities we're designing for. Our current estimate is a Private Preview for early adopters by May 25, 2027, with the production release planned for the second half of 2027, depending on feedback from the preview.

I'd like to hear how you would use these today. Would either of you be available for a call? I can walk you through what we're planning, and your input will help shape the feature. ​@APSHANKAR Sagar this also covers your post on set points and process values, so we can discuss both in the same call.

APSHANKAR Sagar
Seasoned ⭐️⭐️
Seasoned ⭐️⭐️
Nov 20, 2026 9:39 AM UTC

Yes, we would love to participate! Looking forward to your message or email.

Everton Colling
Expert ⭐️⭐️⭐️⭐️
Expert ⭐️⭐️⭐️⭐️
Nov 20, 2026 9:47 AM UTC

I reached out to Taylor Zwick and asked him to facilitate setting up a call.