# [Kst] A use case for scripting?

Nicolas Brisset nicolas.brisset at free.fr
Sat Jul 21 12:25:51 UTC 2012

```Hi,

I've been using Kst lately to check the performance of some sensors against a known reference.
Basically, what I do is: compute the error (difference between the 2 signals), plot a histogram and compute the 2-sigma value of the error distribution.
Where it hurts is that I have to do quite a few operations on each vetor. It's always the same, and quickly becomes tedious with the increasing number of vectors.
What I'd dream of is being able to write a scripting function like checkAgainstReference(new_curve, reference_curve, new_column = true) which would:
1) check that x vectors and lengths are compatible
2) extract the y vectors from the curves
3) compute a new vector which is the difference of the previous y vectors
4) plot a histogram of the error
4) compute the absolute value of the error (without plotting)
5) compute a histogram of the absolute value of the error
6) compute a cumulative sum of the previous
7) create a new curve plotting the cumulative sum against the bin (x) vector of the histogram
8) create a new curve checking when the cumulative sum reaches 95%
9) use the 95% curve as a x-marker with a dotted red line in the cumulative sum plot
10) put all that either in a new column of a given tab (third arg at true), or create a new tab

I can do all this manually and it works fine once you've figured out some of the details I left out here for the sake of brevity, so the question is not whether Kst can do it.
I haven't really checked scripting yet, so the question is: could it solve my issue of having to repeat all those operations a large number of times? That would be totally awesome and make my colleague doing this in scilab pale with envy!

Nicolas
```