-
Notifications
You must be signed in to change notification settings - Fork 0
/
16_08_30_growthCurveData.py
685 lines (552 loc) · 22.7 KB
/
16_08_30_growthCurveData.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
import openpyxl as xlsx
import numpy as np
import matplotlib.pyplot as plt
import data_muncher as dm
from scipy.optimize import fmin
'''
Analysis of the 16_08_30 data
plate layout
10^-6 A : BB52 (1-3) : SS13 (4-6) : SS17 (7-9)
2^-1 * 10^-6 A : BB52 (1-3) : SS13 (4-6) : SS17 (7-9)
2^-2 * 10^-6 B : BB52 (1-3) : SS13 (4-6) : SS17 (7-9)
2^-3 * 10^-6 C : BB52 (1-3) : SS13 (4-6) : SS17 (7-9)
2^-4 * 10^-6 D : BB52 (1-3) : SS13 (4-6) : SS17 (7-9)
2^-5 * 10^-6 E : BB52 (1-3) : SS13 (4-6) : SS17 (7-9)
2^-6 * 10^-6 F : BB52 (1-3) : SS13 (4-6) : SS17 (7-9)
Blank H : LB Broth
Additionally BB52 was used for preparing the standard curve
'''
#Loading the 16_08_30 plate reader file
f = '16_08_30 Dilution Curve.xlsx'
ex = dm.Experiment(f);
data_series = ex.read('Time [s]')
time_labels = data_series.list_of_series[0]
PlateReadout = dm.Sample();
row_ids = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
column_ids = map(str, range(1, 13))
well_ids = [ r + c for r in row_ids for c in column_ids if ex.search(r + c)]
for w in well_ids:
W = dm.Well();
W.measurements = ex.read(w) #Read well data vertically in columns from plate reader spreadsheet
PlateReadout.addWell(w, W)
data_series = PlateReadout.get_measurements()
#Assigning Samples from plate layout
#BB52 dilution
BB52_10_6 = dm.Sample()
BB52_10_6.addWell('A1', PlateReadout['A1'])
BB52_10_6.addWell('A2', PlateReadout['A2'])
BB52_10_6.addWell('A3', PlateReadout['A3'])
BB52_10_6_2_1 = dm.Sample()
BB52_10_6_2_1.addWell('B1', PlateReadout['B1'])
BB52_10_6_2_1.addWell('B2', PlateReadout['B2'])
BB52_10_6_2_1.addWell('B3', PlateReadout['B3'])
BB52_10_6_2_2 = dm.Sample()
BB52_10_6_2_2.addWell('C1', PlateReadout['C1'])
BB52_10_6_2_2.addWell('C2', PlateReadout['C2'])
BB52_10_6_2_2.addWell('C3', PlateReadout['C3'])
BB52_10_6_2_3 = dm.Sample()
BB52_10_6_2_3.addWell('D1', PlateReadout['D1'])
BB52_10_6_2_3.addWell('D2', PlateReadout['D2'])
BB52_10_6_2_3.addWell('D3', PlateReadout['D3'])
BB52_10_6_2_4 = dm.Sample()
BB52_10_6_2_4.addWell('E1', PlateReadout['E1'])
BB52_10_6_2_4.addWell('E2', PlateReadout['E2'])
BB52_10_6_2_4.addWell('E3', PlateReadout['E3'])
BB52_10_6_2_5 = dm.Sample()
BB52_10_6_2_5.addWell('F1', PlateReadout['F1'])
BB52_10_6_2_5.addWell('F2', PlateReadout['F2'])
BB52_10_6_2_5.addWell('F3', PlateReadout['F3'])
BB52_10_6_2_6 = dm.Sample()
BB52_10_6_2_6.addWell('G1', PlateReadout['G1'])
BB52_10_6_2_6.addWell('G2', PlateReadout['G2'])
BB52_10_6_2_6.addWell('G3', PlateReadout['G3'])
blank = dm.Sample()
blank.addWell('H1', PlateReadout['H1'])
blank.addWell('H2', PlateReadout['H2'])
blank.addWell('H3', PlateReadout['H3'])
blank.addWell('H4', PlateReadout['H4'])
blank.addWell('H5', PlateReadout['H5'])
blank.addWell('H6', PlateReadout['H6'])
blank.addWell('H7', PlateReadout['H7'])
blank.addWell('H8', PlateReadout['H8'])
#blank.addWell('H9', PlateReadout['H9'])
# must determine why the palte reader cannot read the final column that is inputted
#SS13 Dilution
#GFP expression present for only SS13
SS13_10_6 = dm.Sample()
SS13_10_6.addWell('A4', PlateReadout['A4'])
SS13_10_6.addWell('A5', PlateReadout['A5'])
SS13_10_6.addWell('A6', PlateReadout['A6'])
SS13_10_6_2_1 = dm.Sample()
SS13_10_6_2_1.addWell('B4', PlateReadout['B4'])
SS13_10_6_2_1.addWell('B5', PlateReadout['B5'])
SS13_10_6_2_1.addWell('B6', PlateReadout['B6'])
SS13_10_6_2_2 = dm.Sample()
SS13_10_6_2_2.addWell('C4', PlateReadout['C4'])
SS13_10_6_2_2.addWell('C5', PlateReadout['C5'])
SS13_10_6_2_2.addWell('C6', PlateReadout['C6'])
SS13_10_6_2_3 = dm.Sample()
SS13_10_6_2_3.addWell('D4', PlateReadout['D4'])
SS13_10_6_2_3.addWell('D5', PlateReadout['D5'])
SS13_10_6_2_3.addWell('D6', PlateReadout['D6'])
SS13_10_6_2_4 = dm.Sample()
SS13_10_6_2_4.addWell('E4', PlateReadout['E4'])
SS13_10_6_2_4.addWell('E5', PlateReadout['E5'])
SS13_10_6_2_4.addWell('E6', PlateReadout['E6'])
SS13_10_6_2_5 = dm.Sample()
SS13_10_6_2_5.addWell('F4', PlateReadout['F4'])
SS13_10_6_2_5.addWell('F5', PlateReadout['F5'])
SS13_10_6_2_5.addWell('F6', PlateReadout['F6'])
SS13_10_6_2_6 = dm.Sample()
SS13_10_6_2_6.addWell('G4', PlateReadout['G4'])
SS13_10_6_2_6.addWell('G5', PlateReadout['G5'])
SS13_10_6_2_6.addWell('G6', PlateReadout['G6'])
#SS17 Dilution
SS17_10_6 = dm.Sample()
SS17_10_6.addWell('A7', PlateReadout['A7'])
SS17_10_6.addWell('A8', PlateReadout['A8'])
SS17_10_6.addWell('A9', PlateReadout['A9'])
SS17_10_6_2_1 = dm.Sample()
SS17_10_6_2_1.addWell('B7', PlateReadout['B7'])
SS17_10_6_2_1.addWell('B8', PlateReadout['B8'])
SS17_10_6_2_1.addWell('B9', PlateReadout['B9'])
SS17_10_6_2_2 = dm.Sample()
SS17_10_6_2_2.addWell('C7', PlateReadout['C7'])
SS17_10_6_2_2.addWell('C8', PlateReadout['C8'])
SS17_10_6_2_2.addWell('C9', PlateReadout['C9'])
SS17_10_6_2_3 = dm.Sample()
SS17_10_6_2_3.addWell('D7', PlateReadout['D7'])
SS17_10_6_2_3.addWell('D8', PlateReadout['D8'])
SS17_10_6_2_3.addWell('D9', PlateReadout['D9'])
SS17_10_6_2_4 = dm.Sample()
SS17_10_6_2_4.addWell('E7', PlateReadout['E7'])
SS17_10_6_2_4.addWell('E8', PlateReadout['E8'])
SS17_10_6_2_4.addWell('E9', PlateReadout['E9'])
SS17_10_6_2_5 = dm.Sample()
SS17_10_6_2_5.addWell('F7', PlateReadout['F7'])
SS17_10_6_2_5.addWell('F8', PlateReadout['F8'])
SS17_10_6_2_5.addWell('F9', PlateReadout['F9'])
SS17_10_6_2_6 = dm.Sample()
SS17_10_6_2_6.addWell('G7', PlateReadout['G7'])
SS17_10_6_2_6.addWell('G8', PlateReadout['G8'])
SS17_10_6_2_6.addWell('G9', PlateReadout['G9'])
# Plot the 10^-6 dilution
plt.plot(time_labels, BB52_10_6.mean())
plt.plot(time_labels, SS13_10_6.mean())
plt.plot(time_labels, SS17_10_6.mean())
plt.plot(time_labels, blank.mean())
plt.ylabel('optical density (OD)')
plt.xlabel('Time (sec)')
plt.legend(['BB52', 'SS13', 'SS17', 'Blank'])
plt.title('Optical Density for 10^-6 Diltuion Factor')
plt.show()
#Plot the 10^-6*2^-1 Optical Density Dilution
plt.plot(time_labels, BB52_10_6_2_1.mean())
plt.plot(time_labels, SS13_10_6_2_1.mean())
plt.plot(time_labels, SS17_10_6_2_1.mean())
plt.plot(time_labels, blank.mean())
plt.ylabel('optical density (OD)')
plt.xlabel('Time (sec)')
plt.legend(['BB52', 'SS13', 'SS17', 'Blank'])
plt.title('Optical Density for 10^-6*2^-1 Diltuion Factor')
plt.show()
#Plot the 10^-6*2^-2 Optical Density Dilution
plt.plot(time_labels, BB52_10_6_2_2.mean())
plt.plot(time_labels, SS13_10_6_2_2.mean())
plt.plot(time_labels, SS17_10_6_2_2.mean())
plt.plot(time_labels, blank.mean())
plt.ylabel('optical density (OD)')
plt.xlabel('Time (sec)')
plt.legend(['BB52', 'SS13', 'SS17', 'Blank'])
plt.title('Optical Density for 10^-6*2^-2 Diltuion Factor')
plt.show()
#Plot the 10^-6*2^-3 Optical Density Dilution
plt.plot(time_labels, BB52_10_6_2_3.mean())
plt.plot(time_labels, SS13_10_6_2_3.mean())
plt.plot(time_labels, SS17_10_6_2_3.mean())
plt.plot(time_labels, blank.mean())
plt.ylabel('optical density (OD)')
plt.xlabel('Time (sec)')
plt.legend(['BB52', 'SS13', 'SS17', 'Blank'])
plt.title('Optical Density for 10^-6*2^-3 Diltuion Factor')
plt.show()
#Plot the 10^-6*2^-4 Optical Density Dilution
plt.plot(time_labels, BB52_10_6_2_4.mean())
plt.plot(time_labels, SS13_10_6_2_4.mean())
plt.plot(time_labels, SS17_10_6_2_4.mean())
plt.plot(time_labels, blank.mean())
plt.ylabel('optical density (OD)')
plt.xlabel('Time (sec)')
plt.legend(['BB52', 'SS13', 'SS17', 'Blank'])
plt.title('Optical Density for 10^-6*2^-4 Diltuion Factor')
plt.show()
#Plot the 10^-6*2^-5 Optical Density Dilution
plt.plot(time_labels, BB52_10_6_2_5.mean())
plt.plot(time_labels, SS13_10_6_2_5.mean())
plt.plot(time_labels, SS17_10_6_2_5.mean())
plt.plot(time_labels, blank.mean())
plt.ylabel('optical density (OD)')
plt.xlabel('Time (sec)')
plt.legend(['BB52', 'SS13', 'SS17', 'Blank'])
plt.title('Optical Density for 10^-6*2^-5 Diltuion Factor')
plt.show()
#Plot the 10^-6*2^-6 Optical Density Dilution
plt.plot(time_labels, BB52_10_6_2_6.mean())
plt.plot(time_labels, SS13_10_6_2_6.mean())
plt.plot(time_labels, SS17_10_6_2_6.mean())
plt.plot(time_labels, blank.mean())
plt.ylabel('optical density (OD)')
plt.xlabel('Time (sec)')
plt.legend(['BB52', 'SS13', 'SS17', 'Blank'])
plt.title('Optical Density for 10^-6*2^-6 Diltuion Factor')
plt.show()
#Subtract the Mean of the blank from the Mean of each Data Series
blankAvg = np.asarray(blank.mean())
blankStd = np.asarray(blank.std());
# LOQ is the standard deviation of the blank multiplied by 3
LOQ = 3 * blankStd
LOQ = np.mean(LOQ)
#The 10^-6 Dilution Data with the Blank subtracted and 3 times the LOQ masked
avgBB52_10_6 = np.asarray(BB52_10_6.mean())
avgBB52_10_6 = avgBB52_10_6 - blankAvg
for value in avgBB52_10_6:
if value < LOQ:
avgBB52_10_6 = np.delete(avgBB52_10_6, value)
avgSS13_10_6 = np.asarray(SS13_10_6.mean())
avgSS13_10_6 = avgSS13_10_6 - blankAvg
for value in avgSS13_10_6:
if value < LOQ:
avgSS13_10_6 = np.delete(avgSS13_10_6, value)
avgSS17_10_6 = np.asarray(SS17_10_6.mean())
avgSS17_10_6 = avgSS17_10_6 - blankAvg
for value in avgSS17_10_6:
if value < LOQ:
avgSS17_10_6 = np.delete(avgSS17_10_6, value)
#The 10^-6* 2^-1 Dilution Data with the Blank subtracted and 3 times the LOQ masked
avgBB52_10_6_2_1 = np.asarray(BB52_10_6_2_1.mean())
avgBB52_10_6_2_1 = avgBB52_10_6_2_1 - blankAvg
for value in avgBB52_10_6_2_1:
if value < LOQ:
avgBB52_10_6_2_1 = np.delete(avgBB52_10_6_2_1, value)
avgSS13_10_6_2_1 = np.asarray(SS13_10_6_2_1.mean())
avgSS13_10_6_2_1 = avgSS13_10_6_2_1 - blankAvg
for value in avgSS13_10_6_2_1:
if value < LOQ:
avgSS13_10_6_2_1 = np.delete(avgSS13_10_6_2_1, value)
avgSS17_10_6_2_1 = np.asarray(SS17_10_6_2_1.mean())
avgSS17_10_6_2_1 = avgSS17_10_6_2_1 - blankAvg
for value in avgSS17_10_6_2_1:
if value < LOQ:
avgSS17_10_6_2_1 = np.delete(avgSS17_10_6_2_1, value)
#The 10^-6*2^-2 Dilution DAta with the Blank subtracted and 3 tmes the LOQ masked
avgBB52_10_6_2_2 = np.asarray(BB52_10_6_2_2.mean())
avgBB52_10_6_2_2 = avgBB52_10_6_2_2 - blankAvg
for value in avgBB52_10_6_2_2:
if value < LOQ:
avgBB52_10_6_2_2 = np.delete(avgBB52_10_6_2_2, value)
avgSS13_10_6_2_2 = np.asarray(SS13_10_6_2_2.mean())
avgSS13_10_6_2_2 = avgSS13_10_6_2_2 - blankAvg
for value in avgSS13_10_6_2_2:
if value < LOQ:
avgSS13_10_6_2_2 = np.delete(avgSS13_10_6_2_2, value)
avgSS17_10_6_2_2 = np.asarray(SS17_10_6_2_2.mean())
avgSS17_10_6_2_2 = avgSS17_10_6_2_2 - blankAvg
for value in avgSS17_10_6_2_2:
if value < LOQ:
avgSS17_10_6_2_2 = np.delete(avgSS17_10_6_2_2, value)
#The 10^-6*2^-3 Dilution DAta with the Blank subtracted and 3 tmes the LOQ masked
avgBB52_10_6_2_3 = np.asarray(BB52_10_6_2_3.mean())
avgBB52_10_6_2_3 = avgBB52_10_6_2_3 - blankAvg
for value in avgBB52_10_6_2_3:
if value < LOQ:
avgBB52_10_6_2_3 = np.delete(avgBB52_10_6_2_3, value)
avgSS13_10_6_2_3 = np.asarray(SS13_10_6_2_3.mean())
avgSS13_10_6_2_3 = avgSS13_10_6_2_3 - blankAvg
for value in avgSS13_10_6_2_3:
if value < LOQ:
avgSS13_10_6_2_3 = np.delete(avgSS13_10_6_2_3, value)
avgSS17_10_6_2_3 = np.asarray(SS17_10_6_2_3.mean())
avgSS17_10_6_2_3 = avgSS17_10_6_2_3 - blankAvg
for value in avgSS17_10_6_2_3:
if value < LOQ:
avgSS17_10_6_2_3 = np.delete(avgSS17_10_6_2_3, value)
#The 10^-6*2^-4 Dilution DAta with the Blank subtracted and 3 tmes the LOQ masked
avgBB52_10_6_2_4 = np.asarray(BB52_10_6_2_4.mean())
avgBB52_10_6_2_4 = avgBB52_10_6_2_4 - blankAvg
for value in avgBB52_10_6_2_4:
if value < LOQ:
avgBB52_10_6_2_4 = np.delete(avgBB52_10_6_2_4, value)
avgSS13_10_6_2_4 = np.asarray(SS13_10_6_2_4.mean())
avgSS13_10_6_2_4 = avgSS13_10_6_2_4 - blankAvg
for value in avgSS13_10_6_2_4:
if value < LOQ:
avgSS13_10_6_2_4 = np.delete(avgSS13_10_6_2_4 , value)
avgSS17_10_6_2_4 = np.asarray(SS17_10_6_2_4.mean())
avgSS17_10_6_2_4 = avgSS17_10_6_2_4 - blankAvg
for value in avgSS17_10_6_2_4:
if value < LOQ:
avgSS17_10_6_2_4 = np.delete(avgSS17_10_6_2_4 , value)
#The 10^-6*2^-5 Dilution DAta with the Blank subtracted and 3 tmes the LOQ masked
avgBB52_10_6_2_5 = np.asarray(BB52_10_6_2_5.mean())
avgBB52_10_6_2_5 = avgBB52_10_6_2_5 - blankAvg
for value in avgBB52_10_6_2_5:
if value < LOQ:
avgBB52_10_6_2_5 = np.delete(avgBB52_10_6_2_5 , value)
avgSS13_10_6_2_5 = np.asarray(SS13_10_6_2_5.mean())
avgSS13_10_6_2_5 = avgSS13_10_6_2_5 - blankAvg
for value in avgSS13_10_6_2_5 :
if value < LOQ:
avgSS13_10_6_2_5 = np.delete(avgSS13_10_6_2_5 , value)
avgSS17_10_6_2_5 = np.asarray(SS17_10_6_2_5.mean())
avgSS17_10_6_2_5 = avgSS17_10_6_2_5 - blankAvg
for value in avgSS17_10_6_2_5:
if value < LOQ:
avgSS17_10_6_2_5 = np.delete(avgSS17_10_6_2_5, value)
#The 10^-6*2^-6 Dilution DAta with the Blank subtracted and 3 tmes the LOQ masked
avgBB52_10_6_2_6 = np.asarray(BB52_10_6_2_6.mean())
avgBB52_10_6_2_6 = avgBB52_10_6_2_6 - blankAvg
for value in avgBB52_10_6_2_6:
if value < LOQ:
avgBB52_10_6_2_6 = np.delete(avgBB52_10_6_2_6, value)
avgSS13_10_6_2_6 = np.asarray(SS13_10_6_2_6.mean())
avgSS13_10_6_2_6 = avgSS13_10_6_2_6 - blankAvg
for value in avgSS13_10_6_2_6:
if value < LOQ:
avgSS13_10_6_2_6 = np.delete(avgSS13_10_6_2_6, value)
avgSS17_10_6_2_6 = np.asarray(SS17_10_6_2_6.mean())
avgSS17_10_6_2_6 = avgSS17_10_6_2_6 - blankAvg
mask = (avgSS17_10_6_2_6 > LOQ)
for value in avgSS17_10_6_2_6:
if value < LOQ:
avgSS17_10_6_2_6 = np.delete(avgSS17_10_6_2_6, value)
#Translating from ODE to ADF for all of the data
# ADF(Arbitrary Dilution Factor) --> ACF(Arbitrary Cell/Concentration Factor)
# y(ACF) = a(ODE)^2 + b(ODE) + c
a = 0.31
b = -0.1336
c = 0.2625
# 10^-6 dilituion data
BB52_10_6_ACF = list()
for value in avgBB52_10_6 :
ACF = a * value * value + b * value + c
BB52_10_6_ACF.append(ACF)
SS13_10_6_ACF = list()
for value in avgSS13_10_6 :
ACF = a * value * value + b * value + c
SS13_10_6_ACF.append(ACF)
SS17_10_6_ACF = list()
for value in avgSS17_10_6:
ACF = a * value * value + b * value + c
SS17_10_6_ACF.append(ACF)
# 10^-6 * 2^-1 dilution data
BB52_10_6_2_1_ACF = list()
for value in avgBB52_10_6_2_1:
ACF = a * value * value + b * value + c
BB52_10_6_2_1_ACF.append(ACF)
SS13_10_6_2_1_ACF = list()
for value in avgSS13_10_6_2_1:
ACF = a * value * value + b * value + c
SS13_10_6_2_1_ACF.append(ACF)
SS17_10_6_2_1_ACF = list()
for value in avgSS17_10_6_2_1:
ACF = a * value * value + b * value + c
SS17_10_6_2_1_ACF.append(ACF)
# 10^-6 * 2^-2 dilution data
BB52_10_6_2_2_ACF = list()
for value in avgBB52_10_6_2_2:
ACF = a * value * value + b * value + c
BB52_10_6_2_2_ACF.append(ACF)
SS13_10_6_2_2_ACF = list()
for value in avgSS13_10_6_2_2:
ACF = a * value * value + b * value + c
SS13_10_6_2_2_ACF.append(ACF)
SS17_10_6_2_2_ACF = list()
for value in avgSS17_10_6_2_2:
ACF = a * value * value + b * value + c
SS17_10_6_2_2_ACF.append(ACF)
#10^-6 * 2^-3 diltuion data ACF conversion
BB52_10_6_2_3_ACF = list()
for value in avgBB52_10_6_2_3:
ACF = a * value * value + b * value + c
BB52_10_6_2_3_ACF.append(ACF)
SS13_10_6_2_3_ACF = list()
for value in avgSS13_10_6_2_3:
ACF = a * value * value + b * value + c
SS13_10_6_2_3_ACF.append(ACF)
SS17_10_6_2_3_ACF = list()
for value in avgSS17_10_6_2_3:
ACF = a * value * value + b * value + c
SS17_10_6_2_3_ACF.append(ACF)
#10^-6 * 2^-4 diltuion data ACF conversion
BB52_10_6_2_4_ACF = list()
for value in avgBB52_10_6_2_4:
ACF = a * value * value + b * value + c
BB52_10_6_2_4_ACF.append(ACF)
SS13_10_6_2_4_ACF = list()
for value in avgSS13_10_6_2_4:
ACF = a * value * value + b * value + c
SS13_10_6_2_4_ACF.append(ACF)
SS17_10_6_2_4_ACF = list()
for value in avgSS17_10_6_2_4:
ACF = a * value * value + b * value + c
SS17_10_6_2_4_ACF.append(ACF)
#10^-6 * 2^-5 diltuion data ACF conversion
BB52_10_6_2_5_ACF = list()
for value in avgBB52_10_6_2_5:
ACF = a * value * value + b * value + c
BB52_10_6_2_5_ACF.append(ACF)
SS13_10_6_2_5_ACF = list()
for value in avgSS13_10_6_2_5:
ACF = a * value * value + b * value + c
SS13_10_6_2_5_ACF.append(ACF)
SS17_10_6_2_5_ACF = list()
for value in avgSS17_10_6_2_5:
ACF = a * value * value + b * value + c
SS17_10_6_2_5_ACF.append(ACF)
#10^-6 * 2^-6 diltuion data ACF conversion
BB52_10_6_2_6_ACF = list()
for value in avgBB52_10_6_2_6:
ACF = a * value * value + b * value + c
BB52_10_6_2_6_ACF.append(ACF)
SS13_10_6_2_6_ACF = list()
for value in avgSS13_10_6_2_6:
ACF = a * value * value + b * value + c
SS13_10_6_2_6_ACF.append(ACF)
SS17_10_6_2_6_ACF = list()
for value in avgSS17_10_6_2_6:
ACF = a * value * value + b * value + c
SS17_10_6_2_6_ACF.append(ACF)
#Estimating the initial point of the graph by doing a 1:1000 dilution for
#smallest value that was calculated for the ACF for each data set
#Once the guess is made it is then added the beginning of each array
# 10^-6 initial guess data
Initial_BB52_10_6_ACF = BB52_10_6_ACF[0] / 1000
BB52_10_6_ACF = np.asarray(BB52_10_6_ACF)
BB52_10_6_ACF = np.insert(BB52_10_6_ACF, 0, Initial_BB52_10_6_ACF)
Initial_SS13_10_6_ACF = SS13_10_6_ACF[0] / 1000
SS13_10_6_ACF = np.asarray(SS13_10_6_ACF)
SS13_10_6_ACF = np.insert(SS13_10_6_ACF, 0, Initial_SS13_10_6_ACF)
Initial_SS17_10_6_ACF = SS17_10_6_ACF[0] / 1000
SS17_10_6_ACF = np.asarray(SS17_10_6_ACF)
SS17_10_6_ACF = np.insert(SS17_10_6_ACF, 0, Initial_SS17_10_6_ACF)
# 10^-6* 2^-1 Initial guesss data
Initial_BB52_10_6_2_1_ACF = BB52_10_6_2_1_ACF[0] / 1000
BB52_10_6_2_1_ACF = np.asarray(BB52_10_6_2_1_ACF)
BB52_10_6_2_1_ACF = np.insert(BB52_10_6_2_1_ACF, 0, Initial_BB52_10_6_2_1_ACF)
Initial_SS13_10_6_2_1_ACF = SS13_10_6_2_1_ACF[0] / 1000
SS13_10_6_2_1_ACF = np.asarray(SS13_10_6_2_1_ACF)
SS13_10_6_2_1_ACF = np.insert(SS13_10_6_2_1_ACF, 0, Initial_SS13_10_6_2_1_ACF)
Initial_SS17_10_6_2_1_ACF = SS17_10_6_2_1_ACF[0] / 1000
SS17_10_6_2_1_ACF = np.asarray(SS17_10_6_2_1_ACF)
SS17_10_6_2_1_ACF = np.insert(SS17_10_6_2_1_ACF, 0, Initial_SS17_10_6_2_1_ACF)
# 10^-6* 2^-2 Initial guesss data
Initial_BB52_10_6_2_2_ACF = BB52_10_6_2_2_ACF[0] / 1000
BB52_10_6_2_2_ACF = np.asarray(BB52_10_6_2_2_ACF)
BB52_10_6_2_2_ACF = np.insert(BB52_10_6_2_2_ACF, 0, Initial_BB52_10_6_2_2_ACF)
Initial_SS13_10_6_2_2_ACF = SS13_10_6_2_2_ACF[0] / 1000
SS13_10_6_2_2_ACF = np.asarray(SS13_10_6_2_2_ACF)
SS13_10_6_2_2_ACF = np.insert(SS13_10_6_2_2_ACF, 0, Initial_SS13_10_6_2_2_ACF)
Initial_SS17_10_6_2_2_ACF = SS17_10_6_2_2_ACF[0] / 1000
SS17_10_6_2_2_ACF = np.asarray(SS17_10_6_2_2_ACF)
SS17_10_6_2_2_ACF = np.insert(SS17_10_6_2_2_ACF, 0, Initial_SS17_10_6_2_2_ACF)
# 10^-6* 2^-3 Initial guesss data
Initial_BB52_10_6_2_3_ACF = BB52_10_6_2_3_ACF[0] / 1000
BB52_10_6_2_3_ACF = np.asarray(BB52_10_6_2_3_ACF)
BB52_10_6_2_3_ACF = np.insert(BB52_10_6_2_3_ACF, 0, Initial_BB52_10_6_2_3_ACF)
Initial_SS13_10_6_2_3_ACF = SS13_10_6_2_3_ACF[0] / 1000
SS13_10_6_2_3_ACF = np.asarray(SS13_10_6_2_3_ACF)
SS13_10_6_2_3_ACF = np.insert(SS13_10_6_2_3_ACF, 0, Initial_SS13_10_6_2_3_ACF)
Initial_SS17_10_6_2_3_ACF = SS17_10_6_2_3_ACF[0] / 1000
SS17_10_6_2_3_ACF = np.asarray(SS17_10_6_2_3_ACF)
SS17_10_6_2_3_ACF = np.insert(SS17_10_6_2_3_ACF, 0, Initial_SS17_10_6_2_3_ACF)
# 10^-6* 2^-4 Initial guesss data
Initial_BB52_10_6_2_4_ACF = BB52_10_6_2_4_ACF[0] / 1000
BB52_10_6_2_4_ACF = np.asarray(BB52_10_6_2_4_ACF)
BB52_10_6_2_4_ACF = np.insert(BB52_10_6_2_4_ACF, 0, Initial_BB52_10_6_2_4_ACF)
Initial_SS13_10_6_2_4_ACF = SS13_10_6_2_4_ACF[0] / 1000
SS13_10_6_2_4_ACF = np.asarray(SS13_10_6_2_4_ACF)
SS13_10_6_2_4_ACF = np.insert(SS13_10_6_2_4_ACF, 0, Initial_SS13_10_6_2_4_ACF)
Initial_SS17_10_6_2_4_ACF = SS17_10_6_2_4_ACF[0] / 1000
SS17_10_6_2_4_ACF = np.asarray(SS17_10_6_2_4_ACF)
SS17_10_6_2_4_ACF = np.insert(SS17_10_6_2_4_ACF, 0, Initial_SS17_10_6_2_4_ACF)
# 10^-6* 2^-5 Initial guesss data
Initial_BB52_10_6_2_5_ACF = BB52_10_6_2_5_ACF[0] / 1000
BB52_10_6_2_5_ACF = np.asarray(BB52_10_6_2_5_ACF)
BB52_10_6_2_5_ACF = np.insert(BB52_10_6_2_5_ACF, 0, Initial_BB52_10_6_2_5_ACF)
Initial_SS13_10_6_2_5_ACF = SS13_10_6_2_5_ACF[0] / 1000
SS13_10_6_2_5_ACF = np.asarray(SS13_10_6_2_5_ACF)
SS13_10_6_2_5_ACF = np.insert(SS13_10_6_2_5_ACF, 0, Initial_SS13_10_6_2_5_ACF)
Initial_SS17_10_6_2_5_ACF = SS17_10_6_2_5_ACF[0] / 1000
SS17_10_6_2_5_ACF = np.asarray(SS17_10_6_2_5_ACF)
SS17_10_6_2_5_ACF = np.insert(SS17_10_6_2_5_ACF, 0, Initial_SS17_10_6_2_5_ACF)
# 10^-6* 2^-6 Initial guesss data
Initial_BB52_10_6_2_6_ACF = BB52_10_6_2_6_ACF[0] / 1000
BB52_10_6_2_6_ACF = np.asarray(BB52_10_6_2_6_ACF)
BB52_10_6_2_6_ACF = np.insert(BB52_10_6_2_6_ACF, 0, Initial_BB52_10_6_2_6_ACF)
'''
Initial_SS13_10_6_2_6_ACF = SS13_10_6_2_6_ACF[0] / 1000
SS13_10_6_2_6_ACF = np.asarray(SS13_10_6_2_6_ACF)
SS13_10_6_2_6_ACF = np.insert(SS13_10_6_2_6_ACF, 0, Initial_SS13_10_6_2_6_ACF)
'''
Initial_SS17_10_6_2_6_ACF = SS17_10_6_2_6_ACF[0] / 1000
SS17_10_6_2_6_ACF = np.asarray(SS17_10_6_2_6_ACF)
SS17_10_6_2_6_ACF = np.insert(SS17_10_6_2_6_ACF, 0, Initial_SS17_10_6_2_6_ACF)
# Normalizaing with respect to the LOQ
#Normalizing the 10^-6 ACF Data
BB52_10_6_ACF = BB52_10_6_ACF/ LOQ
SS13_10_6_ACF = SS13_10_6_ACF / LOQ
SS17_10_6_ACF = SS17_10_6_ACF / LOQ
# Normalizing the 10^-6 * 2^-1 ACF Data
BB52_10_6_2_1_ACF = BB52_10_6_2_1_ACF/ LOQ
SS13_10_6_2_1_ACF = SS13_10_6_2_1_ACF / LOQ
SS17_10_6_2_1_ACF = SS17_10_6_2_1_ACF / LOQ
# Normalizing the 10^-6 * 2^-2 ACF Data
BB52_10_6_2_2_ACF = BB52_10_6_2_2_ACF/ LOQ
SS13_10_6_2_2_ACF = SS13_10_6_2_2_ACF / LOQ
SS17_10_6_2_2_ACF = SS17_10_6_2_2_ACF / LOQ
# Normalizing the 10^-6 * 2^-3 ACF Data
BB52_10_6_2_3_ACF = BB52_10_6_2_3_ACF/ LOQ
SS13_10_6_2_3_ACF = SS13_10_6_2_3_ACF / LOQ
SS17_10_6_2_3_ACF = SS17_10_6_2_3_ACF / LOQ
# Normalizing the 10^-6 * 2^-4 ACF Data
BB52_10_6_2_4_ACF = BB52_10_6_2_4_ACF/ LOQ
SS13_10_6_2_4_ACF = SS13_10_6_2_4_ACF / LOQ
SS17_10_6_2_4_ACF = SS17_10_6_2_4_ACF / LOQ
# Normalizing the 10^-6 * 2^-5 ACF Data
BB52_10_6_2_5_ACF = BB52_10_6_2_5_ACF/ LOQ
SS13_10_6_2_5_ACF = SS13_10_6_2_5_ACF / LOQ
SS17_10_6_2_5_ACF = SS17_10_6_2_5_ACF / LOQ
# Normalizing the 10^-6 * 2^-6 ACF Data
BB52_10_6_2_6_ACF = BB52_10_6_2_6_ACF/ LOQ
SS13_10_6_2_6_ACF = SS13_10_6_2_6_ACF / LOQ
SS17_10_6_2_6_ACF = SS17_10_6_2_6_ACF / LOQ
# a = max Value
# u = growth rate
# y = beginning linear range
def Gompertz(initial_guesses, t):
results = [] # collects the returned values
e = np.exp(1)
for x in t:
results.append( a * np.exp(-np.exp((initial_guesses[0]*e)/a*(initial_guesses[1] -x) + 1)))
return results
# Solving the Objective function for a given set of gueses for 1/20 dilutution data set
# used for the optimization
def Object(initial_guesses, data):
t = np.linspace(0, 57600, len(data))
output = Gompertz(initial_guesses, t)
output = np.asarray(output)
result = np.sum(np.power((data - output), 2))
return result
#Calling the objective function and Gompertz for 10^-6 dilution
a =1
u = np.log(2)/20./60
y =2500
guesses = (u, y)
initial_guesses = np.asarray(guesses)
estimates = fmin(Object, initial_guesses, args = (BB52_10_6_ACF,))
print estimates
time = np.linspace(0, 57600, len(BB52_10_6_ACF))
values = Gompertz(estimates, time)
plt.plot(time, values)
plt.plot(time, BB52_10_6_ACF)
plt.show()