[chronojump] Fixed small bug in eccentric detection
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Fixed small bug in eccentric detection
- Date: Sun, 1 Apr 2012 15:31:01 +0000 (UTC)
commit 2f4c8fa3ee53a4c4d1111dcb27b1bd007d6fdc22
Author: Xavier de Blas <xaviblas gmail com>
Date: Sun Apr 1 23:30:30 2012 +0800
Fixed small bug in eccentric detection
encoder/graph.R | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 8087d96..c40dfe9 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -189,10 +189,21 @@ paint <- function(rawdata, eccon, xmin, xmax, yrange, knRanges, superpose, highl
crossSpeedInMiddle = b$cross[,1]
crossDownToUp=0
count=1
+
+ #the -2 is to know if speed goes from down to up or vicerversa
+ #we use -2 to know the 2ms before
+ #maybe data has not started, then look what happens 2 ms later
for(i in crossSpeedInMiddle) {
- if(speed$y[i-2]<0) {
- crossDownToUp[count]=i
- count=count+1
+ if(i>2) {
+ if(speed$y[i-2]<0) {
+ crossDownToUp[count]=i
+ count=count+1
+ }
+ } else {
+ if(speed$y[i+2]>0) {
+ crossDownToUp[count]=i
+ count=count+1
+ }
}
}
eccentric=1:min(crossDownToUp)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]