Jump to content

Profile match across assets using SPy


sam.webb

Recommended Posts

I'm having some issues with the asset swap behavior in the Python API.

I'm attempting to do a profile match using a formula like this:

$target.profileSearch($prof, toTime('2021-09-16T20:08:00-06'), toTime('2021-09-17T22:09:00-06'), 99)

In this scenario, both $target and $prof come from the same type of asset. I want to switch $target, but keep $prof the same - in other words, train a profile on a signal from one asset, then apply it to an arbitrary number of other assets.

However, when I swap the assets, Seeq swaps both the target and the profile to the same asset, rendering the profile useless.

I can fix this issue in the GUI by using SPy to create a dummy asset and mapping the profile tag to a dummy attribute in that asset. However, this doesn't work when I use SPy to pull the data directly using an asset list and the 'calculate' parameter. I get the following error: 

[SPyRuntimeError] To pull data for an asset, the "calculate" parameter must be a calculated item that involves only one asset.

What would be the best pattern to use to accomplish what I'm trying to accomplish here? So far I've resisted creating an entire new ghost asset tree for the thousands of assets in my location - I'm hoping there a better path forward than that.

Link to comment
Share on other sites

  • Seeq Team

Hi Sam,

Unfortunately, there’s no great workaround for this as it doesn’t know which asset to swap out. Therefore, the only way to “fix” the issue so that you can swap the formula would be to make $prof be not asset specific. There’s two options for this that I think could do what you are looking for:

  1. If the signal underneath $prof is available outside of the asset tree, use that signal instead so that it doesn’t have the asset reference that you do not want to swap. For example, when you connect to PI, you often have the common name in the asset tree (PI AF), but it is really a duplicate of a more complex PI tag name that it is referencing. Using that reference which is not in AF will allow you to swap only the target portion which is linked to the asset tree and maintain the $prof as a not asset specific value.

  2. If #1 is not an option, another option would be to use spy.push to create a new signal that doesn’t have an asset assignment. If you did a spy.pull of the data from the timeframe being used for $prof, spy.push that data back into Seeq, and then point $prof to that Seeq Data Lab signal instead (which will not be specific to a particular asset), then you should be able to swap the calculation.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...