def gp_ccX():
inDir, outDir = getWorkDirs()<EOL>data, alldata = OrderedDict(), None<EOL>for infile in os.listdir(inDir):<EOL><INDENT>key = os.path.splitext(infile)[<NUM_LIT:0>].replace('<STR_LIT:_>', '<STR_LIT:/>')<EOL>data_import = np.loadtxt(open(os.path.join(inDir, infile), '<STR_LIT:rb>'))<EOL>data_import[:,<NUM_LIT:3>] = <NUM_LIT>*(data_import[:,<NUM_LIT:3>]/data_import[:,<NUM_LIT:1>])<EOL>data_import[:,(<NUM_LIT:0>,<NUM_LIT:1>)] = np.log10(data_import[:,(<NUM_LIT:0>,<NUM_LIT:1>)])<EOL>data_import[:,<NUM_LIT:2>] = <NUM_LIT:0><EOL>data[key] = data_import<EOL>alldata = data[key] if alldata is None else np.vstack((alldata, data[key]))<EOL><DEDENT>lindata = alldata[alldata[:,<NUM_LIT:0>]><NUM_LIT>]<EOL>m = (lindata[-<NUM_LIT:1>,<NUM_LIT:1>]-lindata[<NUM_LIT:0>,<NUM_LIT:1>])/(lindata[-<NUM_LIT:1>,<NUM_LIT:0>]-lindata[<NUM_LIT:0>,<NUM_LIT:0>])<EOL>t = lindata[<NUM_LIT:0>,<NUM_LIT:1>] - m * lindata[<NUM_LIT:0>,<NUM_LIT:0>]<EOL>popt1, pcov = curve_fit(<EOL>linear, lindata[:,<NUM_LIT:0>], lindata[:,<NUM_LIT:1>], p0=[m, t],<EOL>sigma=lindata[:,<NUM_LIT:3>], absolute_sigma=True<EOL>)<EOL>popt2, pcov = curve_fit(<EOL>lambda x, c, d: fitfunc(x, popt1[<NUM_LIT:0>], popt1[<NUM_LIT:1>], c, d),<EOL>alldata[:,<NUM_LIT:0>], alldata[:,<NUM_LIT:1>], sigma=alldata[:,<NUM_LIT:3>], absolute_sigma=True,<EOL>)<EOL>popt = np.hstack((popt1, popt2))<EOL>model = lambda x: fitfunc(x, *popt)<EOL>yfit = np.array([model(x) for x in alldata[:,<NUM_LIT:0>]])<EOL>stddev = <NUM_LIT>*np.sqrt( <EOL>np.average((alldata[:,<NUM_LIT:1>]-yfit)**<NUM_LIT:2>, weights=<NUM_LIT:1.>/alldata[:,<NUM_LIT:3>])<EOL>)<EOL>print('<STR_LIT>' % stddev)<EOL>errorband = np.array([[x, model(x), <NUM_LIT:0>, <NUM_LIT:0>, stddev] for x in np.linspace(<NUM_LIT:1>,<NUM_LIT:4>)])<EOL>fitdata = np.array([[x, model(x), <NUM_LIT:0>, <NUM_LIT:0>, <NUM_LIT:0>] for x in np.linspace(<NUM_LIT:1>,<NUM_LIT:4>)])<EOL>par_names = ['<STR_LIT:a>', '<STR_LIT:b>', '<STR_LIT:c>', '<STR_LIT:d>']<EOL>energies = [<NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT:200>]<EOL>labels = dict(<EOL>('<STR_LIT>' % (par_name, popt[i]), [<NUM_LIT>, <NUM_LIT:3>-i*<NUM_LIT>, True])<EOL>for i,par_name in enumerate(par_names)<EOL>)<EOL>ccX_vals = [<NUM_LIT:10>**model(np.log10(energy)) for energy in energies]<EOL>ccX = ['<STR_LIT:U+0020>'.join([<EOL>'<STR_LIT>' % energy,<EOL>'<STR_LIT>'.format(ufloat(ccX_vals[i], stddev/<NUM_LIT>*ccX_vals[i])),<EOL>'<STR_LIT>'<EOL>]) for i,energy in enumerate(energies)]<EOL>print(ccX)<EOL>make_plot(<EOL>data = [errorband] + list(data.values()) + [fitdata],<EOL>properties = [<EOL>'<STR_LIT>' % default_colors[<NUM_LIT:8>]<EOL>] + [<EOL>'<STR_LIT>' % (default_colors[i])<EOL>for i in range(len(data))<EOL>] + ['<STR_LIT>'],<EOL>titles = ['<STR_LIT>'] + list(data.keys()) + ['<STR_LIT>'],<EOL>xlabel = '<STR_LIT>',<EOL>ylabel = '<STR_LIT>',<EOL>name = os.path.join(outDir, '<STR_LIT>'),<EOL>size = '<STR_LIT>', xr = [<NUM_LIT:1>, <NUM_LIT:4>], yr = [<NUM_LIT:0.5>,<NUM_LIT>],<EOL>key = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>'],<EOL>tmargin = <NUM_LIT>, rmargin = <NUM_LIT>, bmargin = <NUM_LIT>,<EOL>lines = dict(<EOL>('<STR_LIT>' % (np.log10(energy)), '<STR_LIT>') for energy in energies<EOL>), labels = labels,<EOL>)<EOL>
fit experimental data