Seeq Team

5

84

Seeq Team

3

4

Members

1

7

Seeq Team

1

53

Popular Content

Showing content with the highest reputation since 04/23/2024 in all areas

1. Finding conditional monthly averages of measurements by product code one year in the past

Hi Sam, Thanks for your response and the additional information. To create the table you need, we can utilize the transform function along with a capsule expression to iterate through each product run capsule. Within this loop we will calculate the previous year averages and dynamically set these to capsule properties based on the Product ID. If you're not familiar with transforms and capsule expressions, here is a good Tips and Tricks article. Below is an example of formula code you can integrate with your existing Product Type signal to condition formula. // existing \$product_type.toCondition('Product ID') code here ... // I am assuming this is defined as \$product_condition // if necessary, define your measurement signals filtered for \$good_runs \$a_good = \$a.within(\$good_runs) \$b_good = \$b.within(\$good_runs) \$b_good = \$b.within(\$good_runs) \$months = months() // monthly periodic condition // Loop through each capsule in \$product_condition and calculate last year's measurement averages \$product_condition.transform(\$capsule -> { \$productid = \$capsule.property('Product ID') // get Product ID from the current capsule // Extract a monthly capsule from \$months one year prior to the current capsule. Note that your current capsule could span two months. // .first() selects the month based on the start month of the capsule. Change this to .last() if you want the ending month. \$previous_year_month_capsule = \$months.toGroup(capsule(\$capsule.startKey()-1y,\$capsule.endKey()-1y)).first() // Calculate scalar averages over the previous year month capsule, filtered for current product ID \$a_avg = \$a_good.within(\$product_condition.keep('Product ID', isEqualTo(\$productid))).average(\$previous_year_month_capsule) \$b_avg = \$b_good.within(\$product_condition.keep('Product ID', isEqualTo(\$productid))).average(\$previous_year_month_capsule) \$c_avg = \$c_good.within(\$product_condition.keep('Product ID', isEqualTo(\$productid))).average(\$previous_year_month_capsule) // Set averages as capsule properties \$capsule.setProperty('Previous Year Month Average A', \$a_avg) .setProperty('Previous Year Month Average B', \$b_avg) .setProperty('Previous Year Month Average C', \$c_avg) }) From here, create a Condition Table and use the Columns selector to pick each of the Capsule properties you want in the table. Here's an example of how you might set up the Condition Table using the Example >> Batch Data >> Reactor 1 data source: We'll mostly ignore my previous reply 😅 - helpful if you want the previous year average signals for analysis but not for the table filtered by Product ID. Hope this helps! Dan
2 points
2. Finding conditional monthly averages of measurements by product code one year in the past

If an expression isn't assigned to a variable in formula, Seeq expects it to be the formula output, and that output is expected to be the last expression in the formula. That's where your error is coming from -- your line 1 isn't assigned to a variable so Seeq expects it to be the formula output.
1 point
3. Future warning on bool values

We will log it so that we fix the warning. In the meantime, since it’s just a warning, there must be something else that is stopping your script at that cell… the only way a script will stop executing is if an unhandled exception is thrown.
1 point
4. Future warning on bool values

Yes, it's telling you to restart the kernel after successfully updating SPy.
1 point
5. Future warning on bool values

I believe that warning has been fixed, can you do `spy.upgrade()` to get the latest version of SPy?
1 point

1 point
7. Requesting advice on building Asset Tree & Analysis using TDD principles

There are a few things that you are likely trying to verify whenever you make changes: 1. The asset tree contains the signals, conditions and scalars you expect. 2. The results of the calculations within the tree are what you expect. For #1, I'd recommend creating a test (either in a notebook cell, or calling out to a separate .py file) that, after your tree has been pushed, utilizes `spy.search()` to "spot-check" important members of the tree that you expect to be there. You can use the `all_properties=True` flag if you'd like to check things like formulas. For #2, I'd recommend creating another test that uses `spy.pull()` to spot-check calculations at hard-coded time intervals and ensure that you're seeing (roughly) the values you expect by looking at the min / max / avg of the returned data. Although these are relatively "loose" tests, at least they will catch major regressions. You can further implement TDD methodology whenever you fix a "bug" in your tree going forward: First add a test that "fails" and illustrates the problem, then fix it such that the test passes. Then make that test part of the suite that you run after updating the tree.
1 point
8. Finding conditional monthly averages of measurements by product code one year in the past

This was incredibly helpful, thank you! I'll need to tweak this slightly as I've realized I'll need to filter by Product ID and an additional variable, but think what you've shared here is enough for me to figure out the rest. Will reply back if not. Thanks again!
1 point