Jump to content

Applying Seeq formula to part of the signals in my search dataframe when pulling the data


Siqi Hu

Recommended Posts

Hello, 

Does there exist a method to pull the data with some of them need to be applied with a formula? For example, I want to pull several signals all at once, including "SP", "MODE", "OUT", "PV". For SP and MODE, these attributes are categorical, so there are only four possibilities, for instance, for their values, which are 0, 1, 8, 9. However, with spy.pull() function, these attributes will be interpolated. So I have to pull first the data for "OUT", "PV", and again pull the data for "SP" and "MODE" with a parameter "calculation", as follows:

# My current method is with 2 pull functions, but they took too much time for many signals
my_pull_1 = spy.pull(
    my_search.query("Name not in ('MODE', 'SP')"),
    start=start,
    end=end,
    grid=grid,
)

my_pull_2 = spy.pull(
    my_search.query("Name in ('MODE', 'SP')"),
    start=start,
    end=end,
    grid=grid,
    calculation="$signal.toStep()"
)

Since in my_search dataframe, there could be thousands of different "MODE" and "SP" signals, pulling the data twice will be very slow. Is there a way that I can pull only once the data, and apply the function to only part of the signals, like defining the formula parameter for the function? 

# what I would like to realize is something like this
my_pull = spy.pull(
    my_search,
    start=start,
    end=end,
    grid=grid,
	formula="$Mode.toStep()",
	formula_parameters={
		"$Mode": my_search[my_search['Name'] == 'MODE']
	}
)

Thanks in advance, 

Siqi

 

Edited by Siqi Hu
Link to comment
Share on other sites

  • Seeq Team

Hi Siqi,

If the tags being searched remains the same, splitting the spy.pull() into two separate functions will not take much longer than if the signals were pulled in one signal. 

In your case, you can specify grid = None to avoid the interpolation, rather than using the formula parameter. Your pull should look something like this

my_pull_1 = spy.pull(
    my_search.query("Name not in ('MODE', 'SP')"),
    start=start,
    end=end
)

my_pull_2 = spy.pull(
    my_search.query("Name in ('MODE', 'SP')"),
    start=start,
    end=end,
    grid=None
)

 

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...