On 10/18/2012 9:10 AM, florian reuscher wrote:
Hello
first of all, I really like to use veusz. So much better than anything I
ever created with Excel.
Unfortunatley there is one thing very easy to do in Excel I cannot
do in veusz (or I probably just don't know how)
When I have several datasets with for a example the temperature
evolution T(t) of some items, I would like to create a new dataset
giving the average of these temperatures for each timestep? Is this
possible?
just to make it absolutely clear:
input
K1(4) 10;25;12;13
K2(4) 20;35;10;7
output I would like to have
kO(4) 15;30;11;10
thanks in advance

Hi Florian,
If all you want to do is average the the datasets together point-by-point, the easiest way is to use the dataset plugin found at Data->Operations->Compute->Mean of Datasets... You can use the "+" button to add as many input datasets as you want to set set to be averaged. If, however, you want to average datasets with different orderings of the points, the only way I know how to do that is with a bit of python code. If you have four datasets x1, y1, x2, and y2 (where the actual values in x1 and x2 are identical but in different orders), you can calculate the mean values by creating two new datasets

x_mean = unique(x1)
y_mean = [ mean(concatenate((y1[x1 == x], y2[x2 == x]))) for x in unique(x1) ]

There's probably a less verbose way, but if you write a custom function it's not bad, especially since Veusz now supports the *args syntax in custom functions:

# use as meanAll(x1,y1,x2,y2,...)
meanAll(*args): [ mean(concatenate([ args[i+1][args[i] == x] for i in xrange(0, len(args), 2) ])) for x in unique(args[0]) ]

Regards,
-- BKS

_______________________________________________
Veusz-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/veusz-discuss

Répondre à