Exemple #1
0
def plot_looped_data(directory):
    file_list = get_data_paths(directory)
    print(len(file_list))

    voltage_list = list()
    current_list = list()

    try:
        for file in sorted(file_list, key=file_sort):
            print(file)
            for_voltage = list()
            rev_voltage = list()
            for_current = list()
            rev_current = list()
            forward, reverse = get_looped_cv_data(file)
            for reading_for, reading_rev in zip(forward, reverse):
                for_voltage.append(reading_for[0])
                rev_voltage.append(reading_rev[0])
                for_current.append(reading_for[1])
                rev_current.append(reading_rev[1])
            forward_np = np.array(forward)
            reverse_np = np.array(reverse)
            voltage = np.concatenate((for_voltage, rev_voltage[::-1]), axis=0)
            current = np.concatenate((for_current, rev_current[::-1]), axis=0)
            voltage_list.append(voltage)
            current_list.append(current)
    except ValueError:
        print('could not be read')

    return voltage_list, current_list
Exemple #2
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()
Exemple #3
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]
from Meth_blue_06_09 import get_data_paths, calculate_graph_data
import matplotlib.pyplot as plt
import os


directory1 = '/Users/st659/Google Drive/Resazurin Growth 12-1-17'
directory2 = '/Users/st659/Google Drive/Resazurin Growth 11-1-17'
directory3 = '/Users/st659/Google Drive/Resazurin Growth 5-1-17'
plt.style.use(['seaborn-white', 'seaborn-notebook'])

paths1 = get_data_paths(directory1)
paths2 = get_data_paths(directory2)
paths3 = get_data_paths(directory3)

blank = paths1[:2]
mg4_paths = paths1[3:]
mg5_paths = paths2[2:]
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)

from Meth_blue_06_09 import get_data_paths, calculate_graph_data
import matplotlib.pyplot as plt
import os
from EIS_Reader import EISReader

cv_directory = '/Users/st659/Google Drive/ITO Diazonium 24-2-17/CV'
eis_directory = '/Users/st659/Google Drive/ITO Diazonium 24-2-17/EIS'

cv_paths = get_data_paths(cv_directory)
eis_paths = get_data_paths(eis_directory)

plt.style.use(['seaborn-white', 'seaborn-notebook'])
fig = plt.figure()
ax = fig.add_subplot(121)
ax2 = fig.add_subplot(122)
ax3 = ax2.twinx()

for cv_path, eis_path in zip(cv_paths, eis_paths):
    sub_data_2, data, legend = calculate_graph_data(cv_path)
    eis_reader = EISReader(eis_path)
    ax2.loglog(eis_reader.eis.frequency, eis_reader.eis.magnitude)
    ax3.semilogx(eis_reader.eis.frequency,
                 eis_reader.eis.phase,
                 linestyle='--')
    print(eis_reader.eis.frequency)
    legend_str = cv_path.split('/')[-1]
    print(legend_str)
    leg = legend_str.split('.')[0]
    leg = leg.split('_')[1]
    ax.plot(sub_data_2[0], sub_data_2[1], label=leg)
Exemple #6
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)
Exemple #7
0
from Meth_blue_06_09 import get_data_paths, calculate_graph_data
import matplotlib.pyplot as plt
import os

directory = '/Users/st659/Google Drive/ITO Resazurin 17-5-17/Resazurin/Gold'
directory2 = '/Users/st659/Google Drive/ITO Resazurin 17-5-17/MB/SHU'
paths = get_data_paths(directory)

paths_2 = get_data_paths(directory2)
blank = paths[:2]
mg = paths[2:]

mg_pseudo = paths_2[2:]

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)
Exemple #8
0
from Meth_blue_06_09 import get_data_paths, calculate_graph_data
from EIS_Reader import EISReader
import matplotlib.pyplot as plt
import os

directory = '/Users/st659/Google Drive/ITO Diazonium'

paths = get_data_paths(directory)

plt.style.use(['seaborn-white', 'seaborn-notebook'])
fig = plt.figure()
ax = fig.add_subplot(111)

print(len(paths))
for path in paths:
    sub_data_2, data, legend = calculate_graph_data(path)

    legend_str = path.split('/')[-1]
    print(legend_str)
    leg = legend_str.split('.')[0]
    print(legend)
    ax.plot(sub_data_2[0], sub_data_2[1], label=leg)

plt.title('Electrografting of Diazonium Salts to ITO')
plt.ylabel('Current (mA)')
plt.xlabel('Voltage (V)')
plt.legend(loc='upper left')
plt.savefig(os.path.join(directory, 'ITO_Diaz-22-2-17.png'), dpi=300)
plt.show()