import sys import numpy as np import matplotlib.pyplot as plt import re import os from scipy.optimize import curve_fit from scipy.stats import sem from matplotlib import rc import commonAnalysis as ca plt.rc('text', usetex=True) plt.style.use('ggplot') """ Script to retrieve info about mc simulation of random graphs from graph evolution Then calculates relevant info and produces various plots given these .txt files """ t1, m1, mags1 = ca.extractInfo(sys.argv[1]) abs_mags1 = np.abs(mags1) abs_sterr = sem(abs_mags1, axis=1) sus = np.zeros(len(t1)) sus_error = np.zeros(len(t1)) for i, mag in enumerate(abs_mags1): sus[i] = np.var(mag, ddof=1) sus_error[i] = ca.jackKnife(mag, np.var) plt.errorbar(t1, sus, yerr=sus_error, fmt='bo', markersize='4') plt.plot(t1[np.argmax(sus)], max(sus), 'r^', label=r"$T_C = {} \pm {}$".format(t1[np.argmax(sus)], t1[1] - t1[0])) plt.xlabel(r"$T$")
#!/usr/bin/env python import sys import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit from commonAnalysis import extractInfo, spinspin, correlation_func_fit, tc_correlation_fit plt.rc('text', usetex='true') plt.style.use('ggplot') t, means, mags = extractInfo(sys.argv[1]) ss, errors = spinspin( sys.argv[1], compares=9) #set compares for no. of spins being correlated #most of the parameters here should be set according to how the specific data has been generated print len(ss), len(errors) print len(ss[0]) sus = np.zeros(len(t)) sus_error = np.zeros(len(t)) for i, mag in enumerate(np.abs(mags)): sus[i] = np.var(mag, ddof=1) / t[i] spins = np.array( ss[10] ) #10 index is arbitrary, corresponds to specific temp index being looked at sterrs = np.array(errors[10]) distance = np.arange(1, len(spins) + 1) #tstar = t.index(2.269) #popt, pcov = curve_fit(correlation_func_fit, xdata = distance, ydata = spins)