示例#1
0
@author: scott
"""

import numpy as np
from matplotlib import pyplot as plt

from EC_MS import download_cinfdata_set, plot_signal
from EC_MS import load_calibration_results
from EC_MS import plot_flux

#plt.close('all')


data = download_cinfdata_set(setup='microreactorNG', time='2019-06-05 13:11:18')

plot_signal(data, leg=True)


mdict = load_calibration_results('19F04_calibration.pkl')



O2, CO2, CO, Ar = mdict['O2'], mdict['CO2'], mdict['CO'], mdict['Ar']

if True: # take background from CO2 cracking into account when calculating CO flux
    # NOTE below on why cal_mat is used exactly this way.
    CO.cal_mat = {'M28':1/CO.F_cal}
    CO.cal_mat['M44'] = - CO.cal_mat['M28'] * CO2.spectrum['M28']/CO2.spectrum['M44']


# U:\FYSIK\list-SurfCat\setups\sniffer\Data\single_crystal_Cu\19J08_Ruben
MSset = {"comment": "20A30%"}  #'time':'2020-01-26%',
folder = "20A30_16O"

if not os.path.isdir("pickles"):
    os.mkdir("pickles")  # to put the synchronized data, as pickle files
if not os.path.isdir("overviews"):
    os.mkdir("overviews")  # to put the overview plots

# -------- first, we get all the MS data from the folder and combine it -------- #
if True:  # it's a bit slow...

    MS_data = download_cinfdata_set(**MSset)

    # now, as a sanity check, and to find our way around the experiment, we plot all of the MS data!
    ax = plot_signal(MS_data)
    ax.legend()
    plt.savefig("./overviews/" + folder +
                "_MS_data.png")  # and save it as an overview plot.

    # also, save the combined MS data as a pickle!
    with open("./pickles/" + folder + "_MS_data.pkl",
              "wb") as pkl:  # defines the file, 'wb' means 'write binary'.
        pickle.dump(MS_data, pkl)  # save MS_data into the file

# -------- Then, we load each EC experiment and combining it with MS data -------- #

# figure out which files correspond to EC data:
data_folder = data_dir + os.sep + folder
data_list = os.listdir(
    data_folder)  # list of all the files in the data directory
示例#3
0
from EC_MS import download_cinfdata_set, plot_signal, plot_flux
from EC_MS import Chip, point_calibration, recalibrate
from EC_MS import save_calibration_results

plt.close('all')


chip = Chip('SI-3iv1-14-B4')

print('\nAir flux through the chip in mol/s: ' + str(chip.capillary_flow(gas='air') / 6.02e23))


data = download_cinfdata_set(setup='microreactorNG', time='2019-02-22 14:05:27', use_caching=True)


ax = plot_signal(data, unit='A')
ax.legend()


O2 = point_calibration(data, mol='O2', mass='M32', cal_type='external', tspan=[2000, 3000], carrier='air', chip=chip)
Ar = point_calibration(data, mol='Ar', mass='M40', cal_type='external', tspan=[2000, 3000], carrier='air', chip=chip)
N2 = point_calibration(data, mol='N2', mass='M28', cal_type='external', tspan=[2000, 3000], carrier='air', chip=chip)

quantify = {'CH4':'M15', 'CO2':'M44', 'CO':'M28',
            #'CH3OH':'M31'
            }

def T(M):
    return M**(-1/2)

mdict, ax = recalibrate(quantify=quantify, trusted=[O2], external=[O2, Ar,