Beispiel #1
0
	def plot_absmag(self, N):
		figure()
		for i in N:
			T_list = []
			absM_list = []
			for sim in self.simulations:	
				if sim.N == i:
					absM_list.append(sim.absM_end)
					T_list.append(sim.T)
			T_diff = []			
			T_list, absM_list = zip(*sorted(zip(T_list, absM_list)))
			for j in range(len(T_list)-1):
				T_diff.append((absM_list[j+1]-absM_list[j])/(T_list[j+1]-T_list[j-1]))
			T_diff = abs(np.asarray(T_diff))			
			index = T_diff.argmax()
			self.Tc.append((T_list[index+1]+T_list[index])/2.0)
			self.L.append(1./i)
			plot(T_list, absM_list, '-*', legend="N = %d" % i)
			title("Absolute magnetic moment as a function of temperature")
			xlabel("$kT/J$")
			ylabel("$|\mathcal{M}|$")
			hold('on')
		hardcopy(self.figurepath + "absmag.png")
		slope, intercept, tmp1, tmp2, tmp3 = stats.linregress(self.L, self.Tc)
		x = np.linspace(0, 0.05, 20)
		y = intercept + slope*x
		hold("off")
		figure()
		plot(self.L, self.Tc, '*', legend="Data points")
		hold("on")
		plot(x, y, legend="%f $L^{-1}$ + %f" %(slope, intercept))
		xlabel("$1/L$")
		ylabel("$kT_c/J$")
		title("Calculated critical temperature")
		hardcopy(self.figurepath + "calctc.png")
Beispiel #2
0
 def plot_fitted_velocities(self, destination = False):
     if self.P == 0:
         self.fit_velocities();
     data = self.model.modelFunction([self.v_mean, self.v_r, self.P, self.t_0], self.t);
     figure();
     plot(self.t, self.velocities, '--r');
     hold('on');
     plot(self.t, data, '-b')
     title("Least square modeled velocities");
     xlabel('t [s]');
     ylabel('v [m/s]');
     legend('v_mean=%g \n v_r=%g \n P=%g \n t_0=%g' % (self.v_mean, self.v_r, self.P, self.t_0));
     if destination:
         hardcopy(destination);
Beispiel #3
0
 def plot_heat_capacity(self, N):
     figure()
     for i in N:
         T_list = []
         hc_list = []
         for sim in self.simulations:
             if sim.N == i:
                 hc_list.append(sim.heat_capacity)
                 T_list.append(sim.T)
         T_list, hc_list = zip(*sorted(zip(T_list, hc_list)))
         plot(T_list, hc_list, '-*', legend="N = %d" % i)
         xlabel("$kT/J$")
         ylabel("$C_V/k$")
         title("Heat capacity as a function of temperature")
         hold('on')
     hardcopy(self.figurepath + "heat_capacity.png")
Beispiel #4
0
 def plot_energies(self, N):
     figure()
     for i in N:
         T_list = []
         E_list = []
         for sim in self.simulations:
             if sim.N == i:
                 E_list.append(sim.E_end)
                 T_list.append(sim.T)
         T_list, E_list = zip(*sorted(zip(T_list, E_list)))
         plot(T_list, E_list, '-*', legend="N = %d" % i)
         title("Energy as a function of temperature")
         xlabel("$kT/J$")
         ylabel("$E/J$")
         hold('on')
     hardcopy(self.figurepath + "energy.png")
Beispiel #5
0
 def plot_fitted_velocities(self, destination=False):
     if self.P == 0:
         self.fit_velocities()
     data = self.model.modelFunction(
         [self.v_mean, self.v_r, self.P, self.t_0], self.t)
     figure()
     plot(self.t, self.velocities, '--r')
     hold('on')
     plot(self.t, data, '-b')
     title("Least square modeled velocities")
     xlabel('t [s]')
     ylabel('v [m/s]')
     legend('v_mean=%g \n v_r=%g \n P=%g \n t_0=%g' %
            (self.v_mean, self.v_r, self.P, self.t_0))
     if destination:
         hardcopy(destination)
Beispiel #6
0
	def plot_heat_capacity(self, N):
		figure()
		for i in N:
			T_list = []
			hc_list = []
			for sim in self.simulations:	
				if sim.N == i:
					hc_list.append(sim.heat_capacity)
					T_list.append(sim.T)
			T_list, hc_list = zip(*sorted(zip(T_list, hc_list)))
			plot(T_list, hc_list, '-*', legend="N = %d" % i)
			xlabel("$kT/J$")
			ylabel("$C_V/k$")
			title("Heat capacity as a function of temperature")
			hold('on')
		hardcopy(self.figurepath + "heat_capacity.png")
Beispiel #7
0
	def plot_energies(self, N):
		figure()
		for i in N:
			T_list = []
			E_list = []
			for sim in self.simulations:	
				if sim.N == i:
					E_list.append(sim.E_end)
					T_list.append(sim.T)
			T_list, E_list = zip(*sorted(zip(T_list, E_list)))
			plot(T_list, E_list, '-*', legend="N = %d" % i)
			title("Energy as a function of temperature")
			xlabel("$kT/J$")
			ylabel("$E/J$")
			hold('on')
		hardcopy(self.figurepath + "energy.png")
Beispiel #8
0
 def plot_susceptibility(self, N):
     figure()
     legends = []
     for i in N:
         T_list = []
         su_list = []
         #legends.append("N = %d" % i)
         for sim in self.simulations:
             if sim.N == i:
                 su_list.append(sim.susceptibility)
                 T_list.append(sim.T)
         T_list, su_list = zip(*sorted(zip(T_list, su_list)))
         plot(T_list, su_list, '-*', legend="N = %d" % i)
         title("Susceptibility as a function of temperature")
         xlabel("$kT/J$")
         ylabel("$\chi J$")
         hold('on')
     hardcopy(self.figurepath + "susceptibility.png")
Beispiel #9
0
	def plot_susceptibility(self, N):
		figure()
		legends = []
		for i in N:
			T_list = []
			su_list = []
			#legends.append("N = %d" % i)
			for sim in self.simulations:	
				if sim.N == i:
					su_list.append(sim.susceptibility)
					T_list.append(sim.T)
			T_list, su_list = zip(*sorted(zip(T_list, su_list)))
			plot(T_list, su_list, '-*', legend="N = %d" % i)
			title("Susceptibility as a function of temperature")
			xlabel("$kT/J$")
			ylabel("$\chi J$")
			hold('on')
		hardcopy(self.figurepath + "susceptibility.png")
Beispiel #10
0
 def plot_absmag(self, N):
     figure()
     for i in N:
         T_list = []
         absM_list = []
         for sim in self.simulations:
             if sim.N == i:
                 absM_list.append(sim.absM_end)
                 T_list.append(sim.T)
         T_diff = []
         T_list, absM_list = zip(*sorted(zip(T_list, absM_list)))
         for j in range(len(T_list) - 1):
             T_diff.append((absM_list[j + 1] - absM_list[j]) /
                           (T_list[j + 1] - T_list[j - 1]))
         T_diff = abs(np.asarray(T_diff))
         index = T_diff.argmax()
         self.Tc.append((T_list[index + 1] + T_list[index]) / 2.0)
         self.L.append(1. / i)
         plot(T_list, absM_list, '-*', legend="N = %d" % i)
         title("Absolute magnetic moment as a function of temperature")
         xlabel("$kT/J$")
         ylabel("$|\mathcal{M}|$")
         hold('on')
     hardcopy(self.figurepath + "absmag.png")
     slope, intercept, tmp1, tmp2, tmp3 = stats.linregress(self.L, self.Tc)
     x = np.linspace(0, 0.05, 20)
     y = intercept + slope * x
     hold("off")
     figure()
     plot(self.L, self.Tc, '*', legend="Data points")
     hold("on")
     plot(x, y, legend="%f $L^{-1}$ + %f" % (slope, intercept))
     xlabel("$1/L$")
     ylabel("$kT_c/J$")
     title("Calculated critical temperature")
     hardcopy(self.figurepath + "calctc.png")