Skip to content

Commit f533d3e

Browse files
author
Dilawar Singh
committed
Fixed script to draw position and speed from arduino data.
1 parent 1391936 commit f533d3e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

analysis/get_data_line_from_tiff.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import datetime
2424

2525
fmt_ = "%Y-%m-%dT%H:%M:%S.%f"
26-
cmPerPixel_ = 1/37.8
2726

2827
def toTime( string ):
2928
return datetime.datetime.strptime( string, fmt_)
@@ -36,7 +35,7 @@ def plotFile( filename ):
3635
except Exception as e:
3736
pass
3837
mpl.rcParams['axes.linewidth'] = 0.1
39-
plt.rc('text', usetex=True)
38+
plt.rc('text', usetex=False)
4039
plt.rc('font', family='serif')
4140

4241
with open( filename, 'r' ) as f:
@@ -50,17 +49,17 @@ def plotFile( filename ):
5049
continue
5150
datalines.append( fs )
5251

53-
x1, x2, x3, blink = [],[],[],[]
54-
speed = []
52+
x1, x2, blink = [],[],[]
53+
count, speed = [], []
5554
for l in datalines:
5655
if len(l) < 12:
5756
continue
58-
t1, t2, t3 = list( map( toTime, [l[0], l[1], l[12]] ) )
57+
t1, t2 = list( map( toTime, [l[0], l[1]] ) )
5958
x1.append( t1 )
6059
x2.append( t2 )
61-
x3.append( t3 )
6260
blink.append(float(l[-1]))
63-
speed.append( cmPerPixel_ * float(l[-2]))
61+
speed.append( float(l[-2]))
62+
count.append(float(l[-3]))
6463

6564
print( 'Plotting' )
6665
plt.figure()
@@ -70,8 +69,9 @@ def plotFile( filename ):
7069

7170
# speed and direction
7271
ax1 = plt.subplot( 212 )
73-
ax2 = ax1.twinx()
74-
ax1.plot( x3, speed, color='blue', label = 'speed' )
72+
ax11 = ax1.twinx()
73+
ax1.plot( x2, speed, color='blue', label = 'speed' )
74+
ax11.plot(x2, count, label='Count')
7575
ax1.set_title( 'Speed+Direction' )
7676

7777
outfile = '%s_raw.png' % sys.argv[1]

0 commit comments

Comments
 (0)