diff --git a/OP1.select b/OP1.select index 5cf4f7c398969612f60be5c43f1fb33300080737..6335d3e24028333162f0b52ac832d81a2861c71f 100644 --- a/OP1.select +++ b/OP1.select @@ -1,8 +1,8 @@ -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 diff --git a/README b/README index 36a787d2e59d2ef4f6d3bdb19aaad84717f1e398..26b5e9b300e16ef0a6240dca373de5b005d17146 100644 --- a/README +++ b/README @@ -1,3 +1,6 @@ ./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 diff --git a/data_select.py b/data_select.py index 729adf805afa34d97b96438710f34a93df7848b6..d70691f8a9f824aef6f92d7133d16e6cec5c6f5b 100755 --- a/data_select.py +++ b/data_select.py @@ -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) + +