def doCONTIN(self, gamma_min=1, gamma_max=1E6): ''' run CONTIN program using module pyCONTIN generate an input file and an output file pyCONTIN: https://github.com/kanhua/pyCONTIN ''' # genetate paramTemplate file for pyCONTIN module content = ''' TEST DATA SET 1 (inverse laplace transform) LAST,,1 GMNMX,1,{} GMNMX,2,{} IWT,,1 NERFIT,,0 NINTT,,-1 NLINF,,1 IFORMY,,(1E11.4) IFORMT,,(1E11.4) DOUSNQ,,1 IUSER,10,2 RUSER,10,-1 NONNEG,,1'''.format(str(gamma_min), str(gamma_max)) with open('paramTemplate.txt', 'w') as f: f.write(content) self.paramTemplateFile = 'paramTemplate.txt' if self.testParams['Time Unit'] == 'microsecond': xdata = self.Ctau[:, 0] * 1e-6 # in CONTIN, unit of delay time is sec ydata = self.Ctau[:, 1] runCONTINfit(xdata, ydata, self.paramTemplateFile) self.CONTINOutputFile = 'CONTINOutput.txt'
def testExperimentFile(templateFile): filepath='/Users/kanhua/Dropbox/Experiment data drive/TTI data/20140910 GaAsN test DLTS/OMARS1' filepath2='/Users/kanhua/Dropbox/Experiment data drive/TTI data/20140910 GaAsN test DLTS/' cp=capTime(join(filepath,'T012.Y1A')) xdata=cp.time ydata=-cp.capTrans plt.plot(xdata,ydata) plt.show() alldata=runCONTINfit(xdata,ydata,templateFile) for i,data in enumerate(alldata): plt.semilogx(data[1][:,2],data[1][:,0],hold=True) plt.xlabel("emission rate(s^-1)") plt.ylabel("amplitude") plt.title("alpha %s"%data[0][1]) plt.savefig("./tmpoutput/test"+str(i)+".png") plt.close()
def Contin(g2_tau, contin_pars): create_contin_parameter_file(contin_pars) parameterFile = os.path.join( 'contin', "contin_parameter_template.txt" ) #the parameters for the contin program are stored in this file. # print(parameterFile) alldata = runCONTINfit( g2_tau[0, :], g2_tau[1, :], parameterFile) #, continInputFile=None, continOutputFile=None) # print('\n\n\n\n contin data', data_temp) return alldata
def testExperimentFile(templateFile): filepath = '/Users/kanhua/Dropbox/Experiment data drive/TTI data/20140910 GaAsN test DLTS/OMARS1' filepath2 = '/Users/kanhua/Dropbox/Experiment data drive/TTI data/20140910 GaAsN test DLTS/' cp = capTime(join(filepath, 'T012.Y1A')) xdata = cp.time ydata = -cp.capTrans plt.plot(xdata, ydata) plt.show() alldata = runCONTINfit(xdata, ydata, templateFile) for i, data in enumerate(alldata): plt.semilogx(data[1][:, 2], data[1][:, 0], hold=True) plt.xlabel("emission rate(s^-1)") plt.ylabel("amplitude") plt.title("alpha %s" % data[0][1]) plt.savefig("./tmpoutput/test" + str(i) + ".png") plt.close()
# ## This example file demonstrates how to use pyCONTIN wrapper # Load the required packages import numpy as np import matplotlib.pyplot as plt from CONTINWrapper import runCONTINfit # #### Load example transient file trans_data = np.loadtxt("demo_input.csv") # #### Assign template file template_file = "paramTemplate.txt" fp = open("paramTemplate.txt", 'r') alldata = runCONTINfit(trans_data[:, 0], trans_data[:, 1], template_file) testxdata = alldata[2][1][:, 2] testydata = alldata[2][1][:, 0] plt.plot(testxdata, testydata) plt.show()