Skip to main content
Gathering Interest

CDF Synthetic Time Series : logical and time depth operations

Related products:Other
Anita Hæhre
ane.eide
joar.saether
+13
  • Anita Hæhre
    Anita Hæhre
  • ane.eide
    ane.eide
  • joar.saether
    joar.saether
  • Stig Grafsrønningen
  • Pedersen Jon-Robert
  • ishita1983
    ishita1983
  • alfi
  • Kristian Nymoen
  • Thomas Røkke
  • Patrick Galler
  • Raluca Bala
  • Abram Ziegelaar
    Abram Ziegelaar
  • Lars Lie
  • Ole Thoresen
  • JON L
  • Giovanna Luna Rosseto
  • Andrew Wagner
    Andrew Wagner
  • KHAN MUDASSIR

APSHANKAR Sagar
Committed

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()

2 replies

  • Backend developer
  • 36 replies
  • July 5, 2024

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
Seasoned Practitioner
Forum|alt.badge.img

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.


Reply


Cookie Policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings