L=L, # the working distance in [m] ) if True: # Change this to True to make subfigure c # The code for the x-axis of subfigure c (the "F-vs-f" plot) is not yet implemented # in ixdat, so this requires the old EC_MS package # TODO from EC_MS import Molecule, recalibrate mdict = {} # EC_MS works with a dictionary of Molecule objects. for cal in calibration.ms_cal_results: m = Molecule(cal.mol, primary=cal.mass, F_cal=cal.F) mdict[cal.name] = m # The analysis of the calibration is done with EC_MS's "recalibrate" function: _, ax_c = recalibrate( internal=[mdict["CO2_M44"], mdict["O2_M32"], mdict["H2_M2"]], external=[mdict["He_M4"], mdict["CO_M28"], mdict["H2_M2_carrier"]], labels=True, ) # save it: ax_c.get_figure().savefig("paper_I_fig_S1c.png") # ----------------- Saving the calibration ---------------------- # We're also finished annotating figure a, so save that: fig_a.savefig( "paper_I_fig_S1a.png") # you can use eg .svg instead for vector graphics. # save the calibration: calibration.export() # this creates Scott2021a_ElectrocmimActa_calibration.ix
CO = point_calibration(data_MS, mol="CO", cal_type="external", chip=chip, tspan=tspan_CO, tspan_bg=tspan_He) mdict["CO"] = CO H2_2 = point_calibration( data_MS, mol="H2", cal_type="external", chip=chip, tspan=tspan_H2, tspan_bg=tspan_air, ) # f**k that, for some reason that looks even worse. save_calibration_results(mdict, "20A31_calibration_results.pkl") mdict, ax_F_vs_f = recalibrate( internal=[mdict["CO2_M44"], mdict["O2_M32"], mdict["H2"]], external=[He, CO, H2_2], ) fig_0 = ax_0[0].get_figure() fig_0.set_figwidth(fig_0.get_figwidth() * 2.5) fig_0.savefig("calibration_experiment.svg") ax_cal_curve_H2.get_figure().savefig("H2 calibration curve.svg") ax_F_vs_f.get_figure().savefig("F vs f.svg")
chip = chip_calibration(data, mol=O2, gas='O2', composition=1, chip='microreactor', tspan=[8200, 8350]) chip.save('MR12') print('\nAir flux through the chip in mol/s: ' + str(chip.capillary_flow(gas='air') / 6.02e23)) Ar = point_calibration(data, mol='Ar', mass='M40', cal_type='external', tspan=[10000, 10200], carrier='Ar', chip=chip) CO = point_calibration(data, mol='CO', mass='M28', cal_type='external', tspan=[15400, 15600], carrier='CO', chip=chip) H2 = point_calibration(data, mol='H2', mass='M2', cal_type='external', tspan=[20000, 20200], carrier='H2', chip=chip) def T(M): #return M**(-1/2) return M**(-1/2.5) quantify = {'CH4':'M15', 'CO2':'M44', #'CO':'M28', # CO has an external calibration #'CH3OH':'M31' # we don't have a data file for methanol } mdict, ax = recalibrate(quantify=quantify, trusted=[O2], external=[O2, Ar, H2, CO], transmission_function=T, labels=True) save_calibration_results(mdict, '19F04_calibration.pkl')