Skip to content

Instantly share code, notes, and snippets.

@kragniz
Created May 1, 2014 03:42
Show Gist options
  • Save kragniz/5e5c4992588f2ca0f442 to your computer and use it in GitHub Desktop.
Save kragniz/5e5c4992588f2ca0f442 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
trial = {}
def make_time_temp(string_to_parse):
first_time = None
last_time, last_temp = 0, 0
times, temps = [], []
for line in string_to_parse.split('\n'):
time, temp = line.split()
if time == '-':
time = last_time
if temp == '-':
temp = last_temp
h, m, s = time.split(':')
time_s = int(h)*60*60 + int(m)*60 + int(s)
if first_time is None:
first_time = time_s
times.append(time_s - first_time)
temps.append(temp)
last_time, last_temp = time, temp
return {'time': times, 'temp': temps}
def make_trial(calories, mass, pressure, temps):
return {
'calories': calories,
'mass': mass,
'pressure': pressure,
'data': make_time_temp(temps)
}
# <codecell>
trial[1] = make_trial(6, 0.109, 1, '''11:52:55 23.51
11:57:58 23.5
11:59:32 23.49
12:01:15 23.49
12:02:15 23.48
12:03:15 23.48
12:04:15 23.48
12:05:15 23.48
12:06:15 23.48
12:07:15 23.48
12:09:15 23.48
12:09:48 23.48
12:09:00 23.48
12:09:15 23.48
12:10:45 23.48
12:10:45 23.48
12:11:00 23.48
12:11:15 23.48
12:11:30 23.49
12:11:45 23.49
12:12:00 23.49
12:12:15 23.49
12:12:30 23.49
12:12:45 23.49
12:13:00 23.49
12:13:15 23.5
12:13:30 23.5
12:13:45 23.5
12:14:00 23.5
12:14:15 23.5
12:14:20 23.5
12:14:45 23.5
12:15:00 23.5
12:15:15 23.5
12:15:30 23.5
12:15:45 23.5
12:16:00 23.5
12:16:15 23.5
12:16:30 23.5
12:17:00 23.5
12:18:00 23.5
12:19:00 23.49''')
# <codecell>
trial[2] = make_trial(15, 0.1008, 20, '''1:38:45 23.08
1:41:20 23.06
1:42:40 23.06
1:45:17 23.06
1:47:05 23.05
1:49:20 23.04
1:50:20 23.04
1:51:30 23.04
1:55:00 23.04
1:56:15 -
1:56:30 23.04
1:56:45 23.06
1:57:00 23.08
1:57:30 23.1
1:57:45 23.12
1:58:00 23.14
1:58:15 23.15
1:58:30 23.16
1:58:45 23.16
1:59:00 23.18
1:59:15 23.18
1:59:30 23.18
1:59:45 23.19
2:00:00 23.2
2:00:00 23.2
2:00:30 23.2
2:00:45 23.2
2:01:00 23.2
2:01:15 23.2
2:01:30 23.2
2:01:45 23.2
2:02:00 23.2
2:02:15 23.21
2:02:30 23.21
2:03:00 23.21
2:03:30 23.21
2:04:00 23.22
2:04:30 23.22
2:05:00 23.21
2:05:30 23.21
2:06:00 23.21
2:06:30 23.21
2:07:30 23.21
2:08:30 23.21''')
# <codecell>
:00trial[3] = make_trial(15, 0.105, 15, '''2:41:20 23.22
2:44:30 23.32
2:48:00 23.3
2:48:15 233
2:48:30 23.3
2:48:45 23.3
2:49:00 23.3
2:49:15 23.3
2:49:30 23.3
2:50:45 23.3
2:50:30 23.3
2:51:00 23.3
2:51:30 23.3
2:52:15 23.3
2:52:30 23.3
2:53:00 23.3
2:54:00 23.3
2:55:00 23.3
2:57:30 23.3
2:57:45 23.32
2:58:00 23.35
2:58:15 23.36
2:58:30 23.38
2:58:45 23.4
2:59:00 23.41
2:59:15 23.42
2:59:30 23.42
2:59:45 23.44
3:00:00 23.44
3:00:15 23.44
3:00:30 23.45
3:00:45 23.45
3:01:00 23.46
3:01:15 23.46
3:01:30 23.46
3:01:45 23.46
3:02:00 23.46
3:02:15 23.46
3:02:45 23.46
3:03:15 23.46
3:03:45 23.46
3:04:15 23.46
3:05:15 23.46
3:06:15 23.46''')
# <codecell>
trial[5] = make_trial(13, 0.1045, 10, '''1:20:00 22.06
1:22:00 22.06
1:24:00 22.06
1:25:00 22.06
1:26:15 22.07
1:26:30 22.08
1:26:45 22.1
1:27:00 22.12
1:27:15 22.14
1:27:30 22.15
1:27:45 22.16
1:28:00 22.17
1:28:15 22.18
1:28:30 22.18
1:28:45 22.2
1:29:00 22.2
1:29:15 22.2
1:29:30 22.2
1:29:45 22.2
1:30:00 22.21
1:30:30 22.21
1:30:45 22.21
1:31:00 22.22
1:31:15 22.22
1:31:30 22.22
1:31:45 22.22
1:32:00 22.22
1:32:30 22.22
1:33:00 22.22
1:33:30 22.22
1:34:00 22.22
1:34:30 22.22''')
# <codecell>
trial[6] = make_trial(3, 0.1055, 5, '''11:18:40 21.29
11:21:20 21.28
11:27:38 21.28
11:28:40 21.26
11:36:15 21.26
11:37:00 21.26
11:37:15 21.27
11:37:30 21.29
11:37:45 21.3
11:38:00 21.32
11:38:15 21.33
11:38:30 21.35
11:38:45 21.35
11:39:00 21.37
11:39:15 21.37
11:39:30 21.38
11:39:45 21.39
11:40:00 21.39
11:40:15 21.4
11:40:30 21.4
11:40:45 21.4
11:41:00 21.4
11:41:15 21.4
11:41:30 21.4
11:41:45 21.4
11:41:15 21.4
11:43:00 21.4
11:43:45 21.41
11:44:30 21.41
11:45:15 21.41
11:46:00 21.41
11:46:45 21.41
11:47:30 21.41
11:48:15 21.41
11:49:00 21.41''')
# <codecell>
trial[7] = make_trial(9, 0.1038, 3.1, '''12:16:40 19.94
12:19:30 19.94
12:21:40 19.94
12:22:40 19.94
12:23:15 19.96
12:23:30 19.98
12:23:45 20
12:24:00 20.01
12:24:15 20.02
12:24:30 20.04
12:24:45 20.05
12:25:00 20.06
12:25:15 20.07
12:25:30 20.08
12:25:45 20.08
12:26:00 20.09
12:26:15 20.1
12:26:30 20.1
12:26:45 20.1
12:27:00 20.1
12:27:30 20.1
12:28:00 20.11
12:28:30 20.11
12:29:00 20.12
12:29:30 20.12
12:30:00 20.12
12:30:30 20.12
12:31:30 20.13
12:32:00 20.13
12:32:30 20.14
12:33:00 20.14
12:34:00 20.14
12:35:00 20.14
12:36:00 20.14
12:37:00 20.15
12:38:00 20.16
12:39:00 20.16
12:40:00 20.17''')
# <codecell>
trial[8] = make_trial(8, 0.978, 2, '''7:13:00 22.2
7:14:00 22.2
7:15:00 22.2
7:16:00 22.2
7:17:00 22.2
7:18:00 22.2
7:20:15 22.21
7:20:30 22.21
7:20:45 -
7:21:00 22.26
7:21:15 22.27
7:21:30 22.29
7:21:45 22.3
7:22:00 22.31
7:22:15 22.32
7:22:30 22.32
7:22:45 22.32
7:23:00 22.33
7:23:15 22.33
7:23:30 22.33
7:23:45 22.33
7:24:00 22.33
7:24:30 22.33
7:25:00 22.33
7:25:30 22.33
7:26:00 22.33
7:26:30 22.33
7:27:00 22.33
7:27:30 22.33
7:28:00 22.33''')
# <codecell>
trial[9] = make_trial(18, 0.3691, 5, '''8:59:30 22.88
9:02:00 22.88
9:06:00 22.88
9:06:30 22.89
9:06:45 22.33
9:07:00 23.01
9:07:15 23.08
9:07:30 23.14
9:07:45 23.2
9:08:00 23.14
9:08:15 23.29
9:08:30 23.32
9:08:45 23.34
9:09:00 23.36
9:09:15 23.39
9:09:30 23.4
9:09:45 23.42
9:10:00 23.43
9:10:15 23.44
9:10:30 23.45
9:10:45 23.46
9:11:00 23.46
9:11:15 23.47
9:11:30 23.47
9:11:45 23.47
9:12:00 23.47
9:12:30 23.48
9:13:00 23.48
9:13:30 23.48
9:14:00 23.48
9:14:30 23.48
9:15:00 23.48
9:15:30 23.48
9:16:30 23.48
9:17:30 23.48''')
# <codecell>
trial[10] = make_trial(13, 0.3756, 3, '''9:58:30 23.2
10:02:50 23.2
10:04:20 23.2
10:18:20 23.21
10:18:30 23.22
10:18:45 23.22
10:19:00 23.25
10:19:15 23.32
10:19:30 23.4
10:06:45 23.45
10:07:00 23.51
10:07:15 23.55
10:07:30 23.58
10:07:45 23.61
10:08:00 23.64
10:08:15 23.67
10:08:30 23.68
10:08:45 23.7
10:09:00 23.72
10:09:15 23.72
10:09:30 23.74
10:09:45 23.75
10:10:00 23.76
10:10:15 23.76
10:10:30 23.78
10:10:45 23.78
10:11:00 23.78
10:11:15 23.8
10:11:30 23.8
10:11:45 23.8
10:12:00 23.8
10:12:15 23.8
10:12:30 23.81
10:12:45 23.81
10:13:00 23.82
10:13:15 23.82
10:13:30 23.82
10:14:00 23.82
10:14:30 23.82
10:15:00 23.82
10:15:30 23.82
10:16:00 23.82
10:16:30 23.82
10:17:00 23.82
10:17:30 23.82
10:18:00 23.82
10:18:30 23.82''')
# <codecell>
trial[11] = make_trial(16.5, 0.3773, 10, '''10:45:00 23.58
10:50:00 23.58
10:51:00 23.58
10:51:15 23.64
10:51:30 23.73
10:51:45 23.8
10:52:00 23.88
10:52:15 23.95
10:52:30 23.98
10:52:45 24.03
10:53:00 24.06
10:53:15 24.09
10:53:30 24.11
10:53:45 24.13
10:54:00 24.14
10:54:15 24.16
10:54:30 24.16
10:54:45 24.18
10:55:00 24.18
10:55:15 24.19
10:55:30 24.2
10:55:45 24.2
10:56:00 24.2
10:56:15 24.2
10:56:30 24.2
10:57:00 24.21
10:57:30 24.21
10:58:00 24.21
10:58:30 24.21
10:59:00 24.21
10:59:30 24.21
11:00:00 24.21
11:00:30 24.21
11:01:00 24.21
11:01:30 24.21
11:02:00 581:02:24
11:02:30 24.21
11:03:00 24.21
11:03:30 24.21''')
# <codecell>
trial[12] = make_trial(19.5, 0.3764, 15, '''11:34:00 24.08
11:39:00 24.08
11:39:45 24.12
11:40:00 24.2
11:40:15 24.26
11:40:30 24.34
11:40:45 24.4
11:41:00 24.44
11:41:15 24.48
11:41:30 24.52
11:41:45 24.54
11:42:00 24.58
11:42:15 24.6
11:43:30 24.6
11:43:45 24.62
11:43:00 24.63
11:43:30 24.64
11:43:45 24.64
11:44:00 24.65
11:44:15 24.66
11:44:30 24.66
11:44:45 24.66
11:45:00 24.66
11:45:30 24.66
11:46:00 24.66
11:46:30 24.66
11:47:00 24.66
11:47:30 24.66
11:48:00 24.66
11:48:30 24.66
11:49:00 24.66''')
# <codecell>
trial[13] = make_trial(16.25, 0.9572, 20, '''12:20:00 24.2
12:25:00 24.2
12:25:15 24.2
12:25:30 24.24
12:25:45 24.46
12:26:00 24.79
12:26:15 25.16
12:26:30 25.44
12:26:45 25.68
12:27:00 25.72
12:27:15 26.08
12:27:30 26.21
12:27:45 26.31
12:28:00 26.39
12:28:15 26.45
12:28:30 26.51
12:28:45 26.54
12:29:00 26.57
12:29:15 26.6
12:29:30 26.62
12:29:45 26.64
12:30:00 26.64
12:30:15 26.66
12:30:30 26.66
13:30:45 26.67
12:31:00 26.68
12:31:15 26.68
12:31:30 26.68
12:31:45 26.68
12:32:00 26.68
12:32:15 26.68
12:32:30 26.68
12:33:00 26.68
12:33:30 26.68
12:34:00 26.68
12:34:30 26.68
12:35:00 26.68
12:35:30 26.68
12:36:00 26.68''')
# <codecell>
trial[14] = make_trial(16, 0.3772, 25, '''0:00:15 21.66
0:00:30 21.75
0:00:45 21.83
0:01:00 21.91
0:01:15 21.98
0:01:30 22.03
0:01:45 22.08
0:02:00 22.11
0:02:15 22.14
0:02:30 22.16
0:02:45 22.18
0:03:00 22.19
0:03:15 22.2
0:03:30 22.22
0:03:45 22.22
0:04:00 22.22
0:04:15 22.24
0:04:30 22.24
0:04:45 22.24
0:05:00 22.24
0:05:30 22.25
0:06:00 22.25
0:06:30 22.25
0:07:00 22.26
0:08:00 22.26
0:09:00 22.26
0:10:00 22.26
0:11:00 22.26
0:12:00 22.26''')
# <codecell>
trial[15] = make_trial(15, 0.3618, 30, '''8:30:00 21.64
8:40:00 21.64
8:39:15 21.64
8:39:30 21.68
8:39:45 21.75
8:40:00 21.83
8:40:15 21.9
8:40:30 21.96
8:40:45 22.01
8:41:00 22.05
8:41:15 22.08
8:41:30 22.11
8:41:45 22.13
8:42:00 22.14
8:42:15 22.16
8:42:30 22.18
8:42:45 22.18
8:43:00 22.19
8:43:15 22.2
8:43:30 22.2
8:43:45 22.2
8:44:15 22.21
8:44:45 22.22
8:45:15 22.22
8:45:45 22.22
8:46:15 22.22
8:46:45 22.22
8:47:45 22.22
8:48:45 22.22
8:49:45 22.22''')
# <codecell>
print trial
# <codecell>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment