patjdixon Posted July 27, 2022 Share Posted July 27, 2022 I am trying to create a signal that is the maximum or minimum of a signal. If I use agggregate, I get a single value in time, not a signal that applies to all time periods: What I want is the equivalent of what you get with a constant, but instead of a hard coded value I want the max or min of a signal. As you see below, the constant signal is for all time periods I thought toScalars might help, but it doesn't work: Any ideas? Link to comment Share on other sites More sharing options...
Seeq Team Joe Reckamp Posted July 27, 2022 Seeq Team Share Posted July 27, 2022 Hi patjdixon, For the aggregate function, you currently are using “startkey”, which means that the value of the aggregate is placed at the start time stamp of the capsule you are aggregating over. Instead, if you switch that to “durationkey”, it will place the value as a constant straight line across the length of the capsule. Link to comment Share on other sites More sharing options...
patjdixon Posted July 27, 2022 Author Share Posted July 27, 2022 Thank you Joe, that gets me partway there. That creates a constant for the duration of the condition. What I need is the max or min during the condition becoming a signal for a constant signal for all times Link to comment Share on other sites More sharing options...
Super Seeqer Shamus Cunningham Posted July 28, 2022 Super Seeqer Share Posted July 28, 2022 I think what you are going for will look like the formula below Where $SearchArea is the total range where any of your valid data capsule could fall (you can be very conservative with these dates). This formula will work if you have multiple valid data range capsules as long as they all fall within the $SearchArea $SearchArea = capsule("2020-01-01T00:00:00Z","2022-07-28T00:00:00Z") $Signal.within($ValidData).maxValue($SearchArea).toSignal() 1 Link to comment Share on other sites More sharing options...
patjdixon Posted July 28, 2022 Author Share Posted July 28, 2022 Shamus, that is fantastic, we are really close! The missing piece is the capsule. I do not want to hard code the dates in. I would like to use all capsules in the "Data valid" condition. In my case there is only one capsule for "Data valid", but regardless I would like that condition to determine when to obtain the max or min. Is there a way to do that? Link to comment Share on other sites More sharing options...
Super Seeqer Shamus Cunningham Posted July 28, 2022 Super Seeqer Share Posted July 28, 2022 It is possible to create a moving window for the SearchArea --- please read below $SearchArea = capsule("2020-01-01T00:00:00Z",now()) However there could be some performance impacts if there are a lot of downstream calculations dependent on this value. Since this value would need to be continuously evaluated Seeq will not be able to cache the result and so this number as well as any calculations which are dependent on it will show up as dotted lines indicating that the results are subject to change. If this is just for a visualization or the number of datapoints is not that large it may not be a problem, however if you are seeing performance issues consider moving the SearchArea back to a fixed range Link to comment Share on other sites More sharing options...
patjdixon Posted July 28, 2022 Author Share Posted July 28, 2022 There seems to be a misunderstanding. I do not want to find the max for a moving window. I want to find the max for "Data valid". I want to specify the condition for "Data valid" and find the max for capsules with that condition. In my case I have only 1 capsule for this condition. Whatever that max value is, I want the signal to apply for all time, like a constant. We have accomplished creating the signal for all time, but the capsule("2020-01-01T00:00:00Z","2022-07-28T00:00:00Z") uses a fixed time period instead of the "Data valid" condition. If there is a way to use "Data valid" instead of hard coded times, I will have what I want. Link to comment Share on other sites More sharing options...
Super Seeqer Shamus Cunningham Posted July 28, 2022 Super Seeqer Share Posted July 28, 2022 The first response with the hard coded dates will give you the answer you are looking for as long as you do anticipate adding new capsules to the "Data Valid" condition in the future. The part of the formula that limits the scope of the search is the $signal.within($ValidData) section. This means that only data that falls within capsules part of the ValidData condition AND within the capsule("2020-01-01T00:00:00Z","2022-07-28T00:00:00Z") date range 1 Link to comment Share on other sites More sharing options...
patjdixon Posted July 28, 2022 Author Share Posted July 28, 2022 Now I see! I was assuming maxValue($SearchArea) was hard coding the search. Your explanation makes sense: maxValue is returning a search result, but then $signal.within($ValidData) is only passing the capsules in the condition to it. Therefore, as long as $SearchArea fully includes the capsules in $ValidData it will work. I just need to hard code dates well before and well after any capsules I would use. Thanks! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now