示例#1
0
def main():
    plt.style.use(['seaborn-white', 'seaborn-notebook'])
    directory = "/Users/st659/Google Drive/Meth Blue Glucose 12-10-16"

    paths = get_data_paths(directory)

    print(paths)

    sub_bw_anti_3, bw_anti_3, legend1 = calculate_graph_data(paths[3:6])
    sub_bw_noanti_3, bw_noanti_3, legend2 = calculate_graph_data(paths[6:9])
    sub_pk_anti_3, pk_anti_3, legend3 = calculate_graph_data(paths[10:12])
    sub_pk_noanti_3, pk_noanti_3, legend4 = calculate_graph_data(paths[12:15])

    bw_mean = np.array([bw_anti_3[1], bw_noanti_3[1]])
    pk_mean = np.array([pk_anti_3[1], pk_noanti_3[1]])
    total_mean_matrix = np.array(
        [bw_anti_3[1], bw_noanti_3[1], pk_noanti_3[1], pk_anti_3[1]])

    mean_var = np.var(total_mean_matrix, axis=0)
    bw_var = np.var(bw_mean, axis=0)
    pk_var = np.var(pk_mean, axis=0)
    print(len(mean_var))

    figure_var = plt.figure()
    ax_var = figure_var.add_subplot(111)
    ax_var.plot(bw_noanti_3[0], bw_var, label='BW')
    ax_var.plot(bw_noanti_3[0], pk_var, label='PK')
    plt.legend(loc='upper right')

    figure1 = plt.figure()
    ax1 = figure1.add_subplot(211)
    ax1.errorbar(sub_bw_anti_3[0],
                 sub_bw_anti_3[1],
                 sub_bw_anti_3[2],
                 label=legend1)
    ax1.errorbar(sub_bw_noanti_3[0],
                 sub_bw_noanti_3[1],
                 sub_bw_noanti_3[2],
                 label=legend2)
    ax1.set_ylabel('Current (mA)')
    ax1.set_xlabel('Voltage (V)')
    plt.legend(loc='upper left')
    ax2 = figure1.add_subplot(212)
    ax2.errorbar(sub_pk_anti_3[0],
                 sub_pk_anti_3[1],
                 sub_pk_anti_3[2],
                 label=legend3)
    ax2.errorbar(sub_pk_noanti_3[0],
                 sub_pk_noanti_3[1],
                 sub_pk_noanti_3[2],
                 label=legend4)
    ax2.set_ylabel('Current (mA)')
    ax2.set_xlabel('Voltage (V)')
    plt.legend(loc='upper left')

    plt.show()
示例#2
0
def cv_difference(directory):
    paths = get_data_paths(directory)
    sub_bw_anti, bw_anti, bw_anti_max_volt, legend1 = calculate_graph_data(
        paths[3:6])
    sub_bw_noanti, bw_noanti, bw_noanti_max_volt, legend2 = calculate_graph_data(
        paths[6:9])
    sub_pk_anti, pk_anti, pk_anti_max_volt, legend3 = calculate_graph_data(
        paths[10:12])
    sub_pk_noanti, pk_noanti, pk_noanti_max_volt, legend4 = calculate_graph_data(
        paths[12:15])

    diff_bw = np.subtract(sub_bw_anti[1], sub_bw_noanti[1])
    diff_bw_std = np.sqrt(
        np.add(np.square(sub_bw_anti[2]), np.square(sub_bw_noanti[2])))
    diff_pk = np.subtract(sub_pk_anti[1], sub_pk_noanti[1])
    diff_pk_std = np.sqrt(
        np.add(np.square(sub_pk_anti[2]), np.square(sub_pk_noanti[2])))

    return [sub_bw_anti[0], diff_bw, diff_bw_std, diff_pk, diff_pk_std]
示例#3
0
mg6_paths = paths3[2:]

print(mg6_paths)
print(mg5_paths)
print(mg4_paths)
paths_list = [blank, mg4_paths, mg6_paths]

fig2 = plt.figure()

legends = ['Blank', 'E.coli MG1655 $10^{4}$ cfu/ml', 'E.coli MG1655 $10^{6}$ cfu/ml']

ax2 = fig2.add_subplot(111)


data_list = list()
for path in paths_list:
    sub_data_2, data, legend = calculate_graph_data(path)
    data_list.append(sub_data_2)
    legend_str = path[0].split('/')[-1]
    legend = legend_str.split('_')[0]
    ax2.errorbar(sub_data_2[0], sub_data_2[1], sub_data_2[2], label = legend)

ax2.legend(legends, loc='lower right')
ax2.set_ylabel('Current (mA)')
ax2.set_xlabel('Voltage vs Ag/AgCl (V)')

plt.xlim((-0.6, 0))
plt.ylim((-0.06, 0.02))

#plt.savefig(os.path.join(directory2,'Resazurin_OnChip.png'), dpi=300)
plt.show()
示例#4
0
def main():
    directory = "/Users/st659/Google Drive/Meth Blue 12-09"
    
    paths = get_data_paths(directory)

    plt.style.use(['seaborn-white', 'seaborn-notebook'])

    print(paths)

    # sub_bw_anti_3, bw_anti_3, = calculate_graph_data(paths[0:3])
    # sub_bw_noanti_3, bw_noanti_3 = calculate_graph_data(paths[3:6])
    # sub_pk_anti_3, pk_anti_3 = calculate_graph_data(paths[6:9])
    # sub_pk_noanti_3, pk_noanti_3 = calculate_graph_data(paths[9:12])
    #
    # figure1 = plt.figure()
    # ax1 = figure1.add_subplot(111)
    # ax1.errorbar(sub_bw_anti_3[0], sub_bw_anti_3[1], sub_bw_anti_3[2])
    # ax1.errorbar(sub_bw_noanti_3[0], sub_bw_noanti_3[1], sub_bw_noanti_3[2])
    # ax1.errorbar(sub_pk_anti_3[0], sub_pk_anti_3[1], sub_pk_anti_3[2])
    # ax1.errorbar(sub_pk_noanti_3[0], sub_pk_noanti_3[1], sub_pk_noanti_3[2])
    #
    # plt.xlabel('Voltage vs reference (V)')
    # plt.ylabel('Current (mA)')
    # plt.xlim([-0.3, 0])
    # plt.ylim([-0.02, 0.01])
    # plt.legend(('BW25113 0$\mu g/ml$ Ampicillin', 'BW25133 50$\mu g/ml$ Ampicillin', 'BW25113 with PKD3 0$\mu g/ml$ Ampicillin', 'BW25113 with PKD3 50$\mu g/ml$ Ampicillin'),loc='lower right', fontsize = '10')
    # plt.title(r'Antibiotic Susceptibility of $10^{3}$ Bacteria after 5 hours incubation')
    
    
    # sub_bw_anti_4, bw_anti_4, l= calculate_graph_data(paths[12:15])
    # sub_bw_noanti_4, bw_noanti_4, l = calculate_graph_data(paths[15:18])
    # sub_pk_anti_4, pk_anti_4, l = calculate_graph_data(paths[18:21])
    # sub_pk_noanti_4, pk_noanti_4, l = calculate_graph_data(paths[21:24])
    #
    # figure2 = plt.figure()
    # ax2 = figure2.add_subplot(111)
    # ax2.errorbar(sub_bw_anti_4[0], sub_bw_anti_4[1], sub_bw_anti_4[2])
    # ax2.errorbar(sub_bw_noanti_4[0], sub_bw_noanti_4[1], sub_bw_noanti_4[2])
    # ax2.errorbar(sub_pk_anti_4[0], sub_pk_anti_4[1], sub_pk_anti_4[2])
    # ax2.errorbar(sub_pk_noanti_4[0], sub_pk_noanti_4[1], sub_pk_noanti_4[2])
    #
    # plt.xlabel('Voltage vs reference (V)')
    # plt.ylabel('Current (mA)')
    # plt.xlim([-0.3, 0])
    # plt.ylim([-0.02, 0.01])
    # plt.legend(('BW25113 50$\mu g/ml$ Ampicillin', 'BW25133 0$\mu g/ml$ Ampicillin', 'BW25113 with PKD3 50$\mu g/ml$ Ampicillin', 'BW25113 with PKD3 0$\mu g/ml$ Ampicillin'),loc='lower right', fontsize = '10')
    # plt.title(r'Antibiotic Susceptibility of $10^{4}$ CFU/ml after 5 hours incubation')
    # #plt.savefig(os.path.join(directory,'susceptibility 10_4.png'), dpi=1200)
    #
    # diff = np.subtract(sub_bw_anti_4[1], sub_bw_noanti_4[1])
    # diff_std = np.sqrt(np.add(np.square(sub_bw_anti_4[2]), np.square(sub_bw_noanti_4[2])))
    # diff2 = np.subtract(sub_pk_anti_4[1], sub_pk_noanti_4[1])
    # diff2_std = np.sqrt(np.add(np.square(sub_pk_anti_4[2]), np.square(sub_pk_noanti_4[2])))
    #
    # figure2 = plt.figure()
    # ax3 = figure2.add_subplot(211)
    # ax3.errorbar(sub_bw_anti_4[0], diff, diff_std, label='BW', color='b')
    # ax3.set_ylabel('$\Delta$ Current (mA)')
    #
    # plt.legend(loc = 'upper left')
    # ax4 = figure2.add_subplot(212)
    # ax4.errorbar(sub_bw_anti_4[0], diff2, diff2_std, label='PK', color='g')
    # ax4.set_ylabel('$\Delta$ Current (mA)')
    # ax4.set_xlabel('Voltage (V)')
    # plt.legend(loc = 'upper left')
    #
    #
    #
    #
    # sub_bw_anti_5, bw_anti_5, l = calculate_graph_data(paths[24:27])
    # sub_bw_noanti_5, bw_noanti_5, l = calculate_graph_data(paths[27:30])
    # sub_pk_anti_5, pk_anti_5, l = calculate_graph_data(paths[30:33])
    # sub_pk_noanti_5, pk_noanti_5, l = calculate_graph_data(paths[33:36])
    #
    # mean_matrix = np.array([bw_anti_5[1], bw_noanti_5[1], pk_noanti_5[1], pk_anti_5[1]])
    # mean_var = np.var(mean_matrix, axis=0)
    # print(len(mean_var))
    #
    # figure_var = plt.figure()
    # ax_var = figure_var.add_subplot(111)
    # ax_var.plot(bw_noanti_5[0], mean_var)
    # plt.show()
    
    # diff = np.subtract(sub_bw_anti_5[1], sub_bw_noanti_5[1])
    # diff_std = np.sqrt(np.add(np.square(sub_bw_anti_5[2]), np.square(sub_bw_noanti_5[2])))
    # diff2 = np.subtract(sub_pk_anti_5[1], sub_pk_noanti_5[1])
    # diff2_std = np.sqrt(np.add(np.square(sub_pk_anti_5[2]), np.square(sub_pk_noanti_5[2])))
    #
    # figure3 = plt.figure()
    # ax5 = figure3.add_subplot(211)
    # ax5.errorbar(sub_bw_anti_4[0], diff, diff_std, label='BW', color='b')
    # ax5.set_ylabel('$\Delta$ Current (mA)')
    #
    # plt.legend(loc = 'upper left')
    # ax6 = figure3.add_subplot(212)
    # ax6.errorbar(sub_bw_anti_4[0], diff2, diff2_std, label='PK', color='g')
    # ax6.set_ylabel('$\Delta$ Current (mA)')
    # ax6.set_xlabel('Voltage (V)')
    # plt.legend(loc = 'upper left')
    #
    # figure3 = plt.figure()
    # ax3 = figure3.add_subplot(111)
    # ax3.errorbar(sub_bw_anti_5[0], sub_bw_anti_5[1], sub_bw_anti_5[2])
    # ax3.errorbar(sub_bw_noanti_5[0], sub_bw_noanti_5[1], sub_bw_noanti_5[2])
    # ax3.errorbar(sub_pk_anti_5[0], sub_pk_anti_5[1], sub_pk_anti_5[2])
    # ax3.errorbar(sub_pk_noanti_5[0], sub_pk_noanti_5[1], sub_pk_noanti_5[2])
    #
    # plt.xlabel('Voltage vs reference (V)')
    # plt.ylabel('Current (mA)')
    # plt.xlim([-0.3, 0])
    # plt.ylim([-0.02, 0.01])
    # plt.legend(('BW25113 50$\mu g/ml$ Ampicillin', 'BW25133 00$\mu g/ml$ Ampicillin', 'BW25113 with PKD3 50$\mu g/ml$ Ampicillin', 'BW25113 with PKD3 0$\mu g/ml$ Ampicillin'),loc='lower right', fontsize = '10')
    # plt.title(r'Antibiotic Susceptibility of $10^{5}$ CFU/ml after 5 hours incubation')
    # #plt.savefig(os.path.join(directory,'susceptibility 10_5.png'), dpi=1200)
    #
    sub_bw_anti_6, bw_anti_6, leg= calculate_graph_data(paths[36:39])
    sub_bw_noanti_6, bw_noanti_6, leg = calculate_graph_data(paths[39:42])
    sub_pk_anti_6, pk_anti_6, leg = calculate_graph_data(paths[42:45])
    sub_pk_noanti_6, pk_noanti_6, leg = calculate_graph_data(paths[45:48])

    figure4 = plt.figure()
    ax4 = figure4.add_subplot(111)
    ax4.errorbar(sub_bw_anti_6[0], sub_bw_anti_6[1], sub_bw_anti_6[2])
    ax4.errorbar(sub_bw_noanti_6[0], sub_bw_noanti_6[1], sub_bw_noanti_6[2])
    ax4.errorbar(sub_pk_anti_6[0], sub_pk_anti_6[1], sub_pk_anti_6[2])
    ax4.errorbar(sub_pk_noanti_6[0], sub_pk_noanti_6[1], sub_pk_noanti_6[2])

    plt.xlabel('Voltage vs reference (V)')
    plt.ylabel('Current (mA)')
    plt.xlim([-0.3, 0])
    plt.ylim([-0.02, 0.01])
    plt.legend(('BW25113 50$\mu g/ml$ Ampicillin', 'BW25133 0$\mu g/ml$ Ampicillin', 'BW25113 with PKD3 50$\mu g/ml$ Ampicillin', 'BW25113 with PKD3 0$\mu g/ml$ Ampicillin'),loc='lower right', fontsize = '10')
    plt.title(r'Antibiotic Susceptibility of $10^{6}$ CFU/ml after 5 hours incubation')
    plt.savefig(os.path.join(directory,'susceptibility 10_6 300dpi.png'), dpi=300)
示例#5
0
plt.style.use(['seaborn-white', 'seaborn-notebook'])
data_list = list()
data_list_2 = list()

# fig = plt.figure()
fig2 = plt.figure()

# ax = fig.add_subplot(111)
ax = fig2.add_subplot(111)
#ax2 = fig2.add_subplot(122)

# for path in paths_list:

for pb_path in paths:
    print(pb_path)
    no, pb, legend = calculate_graph_data(pb_path)
    #esfe, shu, seg = calculate_graph_data(shu_path)

    #legend_str = path[0].split('/')[-1]
    #legend = legend_str.split('_')[0]
    #ax.plot(shu[0], shu[1])
    ax.plot(pb[0], pb[1])

#plt.xlim((-0.6,0))
#plt.ylim((-0.06, 0.02))
#plt.legend(loc = 'lower right')
#plt.title('E.coli MG1655 Pseudo starting at 10^5 CFU/ml after 5 hours Incubation with 1mM Resazurin')
ax.set_xlabel('Voltage vs AgAgCl (V)')
ax.set_ylabel('Current (mA)')
#ax2.set_xlabel('Voltage vs AgAgCl (V)')
示例#6
0
data_list_2 = list()



# fig = plt.figure()
fig2 = plt.figure()

# ax = fig.add_subplot(111)
ax = fig2.add_subplot(121)
ax2 = fig2.add_subplot(122)

# for path in paths_list:


for pb_path, shu_path in zip(paths, paths_2):
    no, pb, legend = calculate_graph_data(pb_path)
    esfe, shu, seg = calculate_graph_data(shu_path)

    #legend_str = path[0].split('/')[-1]
    #legend = legend_str.split('_')[0]
    ax.plot(shu[0], shu[1])
    ax2.plot(pb[0], pb[1])

#plt.xlim((-0.6,0))
#plt.ylim((-0.06, 0.02))
#plt.legend(loc = 'lower right')
#plt.title('E.coli MG1655 Pseudo starting at 10^5 CFU/ml after 5 hours Incubation with 1mM Resazurin')
ax.set_xlabel('Voltage vs AgAgCl (V)')
ax.set_ylabel('Current (mA)')
ax2.set_xlabel('Voltage vs AgAgCl (V)')