Filter Zero from multiple curves in User Chart

79 views
Skip to first unread message

saalmu...@gmail.com

unread,
Feb 17, 2021, 6:03:58 PM2/17/21
to golden-cheetah-users
Hi Ale, 

i would like to remove the coffee break period (POWER = 0) from my user chart showing three curves: MPP6m% vs HRR% vs MPP6m%/HRR%. 

For the MPP6M% curve i use 

xx <- samples(SECS);

yy <- 100*smooth(samples(POWER), sma, backward, 81)/MMP6m;

yy <- yy[x>0];

xx <- xx[yy[i] > 0 ];

which works perfectly fine (only i can't the x-axis to show hh:mm:ss rather than seconds)

I can't use the same approach for HRR% because (luckily) my heartrate is never zero. 

How can i cut out the zero-power section of the ride from the heartrate curve?


Thanks

Juergen 

Message has been deleted

Ale Martinez

unread,
Feb 17, 2021, 6:47:06 PM2/17/21
to golden-cheetah-users
El miércoles, 17 de febrero de 2021 a la(s) 20:03:58 UTC-3, saalmu...@gmail.com escribió:
Hi Ale, 

i would like to remove the coffee break period (POWER = 0) from my user chart showing three curves: MPP6m% vs HRR% vs MPP6m%/HRR%. 

For the MPP6M% curve i use 

xx <- samples(SECS);

yy <- 100*smooth(samples(POWER), sma, backward, 81)/MMP6m;

yy <- yy[x>0];

xx <- xx[yy[i] > 0 ];

which works perfectly fine (only i can't the x-axis to show hh:mm:ss rather than seconds)

Change the x-axis from Continuous to Time 

I can't use the same approach for HRR% because (luckily) my heartrate is never zero. 

How can i cut out the zero-power section of the ride from the heartrate curve?

In the same way you filter the xx vector above using yy vector, something like: 
xx <- xx[samples(POWER)[i]>0] 
yy <- yy[samples(POWER)[i]>0] 
 

saalmu...@gmail.com

unread,
Feb 17, 2021, 7:47:34 PM2/17/21
to golden-cheetah-users
Hi Ale, 
thanks, the axes work! 

Great ! That works. 
It's quite slow, though. I suppose all the vector parsing ... ?

Ale Martinez

unread,
Feb 17, 2021, 9:14:35 PM2/17/21
to golden-cheetah-users
There are more efficient ways, but you should read the documentation, for example to precompute an index vector see https://github.com/GoldenCheetah/GoldenCheetah/wiki/UG_Special-Topics_Formula-Syntax-and-Expressions#filtering-out-zeroes-with-the-nonzero

saalmu...@gmail.com

unread,
Feb 18, 2021, 1:16:41 AM2/18/21
to golden-cheetah-users
Precomputing an index, lightening fast now! 
Thank you very much, Ale!

I use a sequence now for the X axis so i get a nice, continuous graph with the coffee break excluded. :-) 

Reply all
Reply to author
Forward
0 new messages