Skip to content
Snippets Groups Projects
Commit 31ce74bf authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Description allowed in .select files, generate matlab file for each selected interval

parent 4ad43a26
No related branches found
No related tags found
No related merge requests found
2016-10-17:12:44:00,2016-10-17:12:47:00
2016-10-18:11:33:00,2016-10-18:11:37:00
2016-10-24:13:05:00,2016-10-24:13:10:00
2016-11-01:12:43:30,2016-11-01:12:48:30
2016-11-01:12:48:30,2016-11-01:12:53:30
2016-11-01:12:53:30,2016-11-01:12:58:20
2016-11-28:12:17:30,2016-11-28:12:21:00
2016-11-30:11:12:00,2016-11-30:11:17:00
2016-10-17:12:44:00,2016-10-17:12:47:00,kalman
2016-10-18:11:33:00,2016-10-18:11:37:00,kalman
2016-10-24:13:05:00,2016-10-24:13:10:00,kalman
2016-11-01:12:43:30,2016-11-01:12:48:30,raw
2016-11-01:12:48:30,2016-11-01:12:53:30,kalman
2016-11-01:12:53:30,2016-11-01:12:58:20,average
2016-11-28:12:17:30,2016-11-28:12:21:00,raw
2016-11-30:11:12:00,2016-11-30:11:17:00,kalman
./grab.py 1609200030 1609262200
./data_select.py OP1.select data/*
./plot.py --seconds selected/OP1
# Select some columns to fit Matlab/Octave load command
cut -d, -f5-10 data/data_2016-11-01 > matlab/data_2016-11-01
......@@ -11,7 +11,17 @@ if __name__ == '__main__':
segment = []
for l in open(sys.argv[1]):
# print(l)
t1,t2 = l.strip().split(',')
tmp = l.strip().split(',')
print(tmp)
if len(tmp) < 2:
print('No selection interval "%s"', l.strip())
if len(tmp) >= 2:
t1,t2 = tmp[0:2]
if len(tmp) >= 3:
description = tmp[2]
else:
description = ''
# print(t1,t2)
# Get selection interval
s1 = time.mktime(time.strptime(t1, '%Y-%m-%d:%H:%M:%S')) - Y2K
......@@ -41,7 +51,7 @@ if __name__ == '__main__':
t_total += s[-1][0] - s[0][0]
time_jump = int(t_total * 0.2 / len(segment))
# Output selection
# Output selection suitable for plot program
outfile = open('selected/%s' % op, 'w')
# Empty space at start of plot
......@@ -66,4 +76,16 @@ if __name__ == '__main__':
pass
pass
# Output selection suitable for matlab/octave
if not os.path.exists('matlab'):
os.mkdir('matlab')
if not os.path.exists('matlab/%s' % op):
os.mkdir('matlab/%s' % op)
for s in segment:
outfile = open('matlab/%s/%s' % (op, s[0][1].strip()), 'w')
for row in s:
print("%s" % (",".join(row[5:11])),
file=outfile)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment