In [31]:
#from __future__ import division 
%pylab inline
import string
%matplotlib qt 
#%matplotlib notebook
#%matplotlib nbagg
import matplotlib.ticker as ticker
import os

txt = 'run'
#txt = 'OldData/run'
txt2 = '/rho_'
inp ='/input_nrg.dat'


rcParams.update({'font.size': 30})
rc("text", usetex = True)
rc("font", family = "serif")
#rcParams['figure.subplot.hspace'] = 0.3
rcParams['figure.subplot.wspace'] = 0.1
from scipy.interpolate import griddata
from scipy.optimize import curve_fit
from scipy import interpolate
mpl.rcParams['lines.linewidth'] = 2
Gamma = 2.82691*0.01
pi*Gamma


def readfile(ini):
        output = txt+repr(ini)+'/EntropyChain1Ch_NupPdn_zEQ1.dat'
        output = txt+repr(ini)+'/EntropyImp1ChNupPdn_Majorana_zEQ1.dat'
        infile = open(os.path.abspath(output), 'r')
        text = infile.readlines()
        
        #Data managemente
        Temp = [];         Tot = [];  Chain = [];  Imp = [];  
        for x in text:
            #print(list(x))
            a =x.split(' ') ; a[3]=a[3].split('\n')[0] 
            Temp.append(float(a[0]))
            Tot.append(float(a[1]))
            Chain.append(float(a[2]))
            Imp.append(float(a[3]))
        return array(Temp) , array(Tot) , array(Chain) , array(Imp)


Populating the interactive namespace from numpy and matplotlib
WARNING: pylab import has clobbered these variables: ['griddata']
`%matplotlib` prevents importing * from pylab and numpy

In [32]:
#returns the parameter value of file ini  at the given line    
def readfile_Param(ini, line):
        #output = txt+repr(ini)+txt2 +repr(dot)+'_'+repr(dot)+'_OmegaRhow_zEQAVG.00.dat'
        output = txt+repr(ini)+ inp 
        #output = '/home/cifucito/nrgcode/TwoChNRG/src/Main/Run/Run2DOtM/rho_2_2_OmegaRhow.dat'
        infile = open(os.path.abspath(output), 'r')
        text = infile.readlines()
        return  float(text[line])   
    
    
    
#read files for folder ini and dot 
#return
def readfile2(ini, dot):
        output = txt+repr(ini)+txt2 +repr(dot)+'_'+repr(dot)+'_OmegaRhow_zEQAVG.00.dat'
        
        output = txt+repr(ini)+txt2 +repr(dot)+'_'+repr(dot)+'_OmegaRhow.dat'
        #output = 'NotSoOld_Data/'+txt+repr(ini)+txt2 +repr(dot)+'_'+repr(dot)+'_OmegaRhow.dat'
        #output = 'OldData/'+txt+repr(ini)+txt2 +repr(dot)+'_'+repr(dot)+'_OmegaRhow.dat'
        infile = open(os.path.abspath(output), 'r')
        text = infile.readlines()
        
        #Data managemente
        vec = [];        vec2 = []  
        for x in text:
            #print(list(x))
            a =x.split(' ') ;            vec.append(float(a[-3]))
            vec2.append(float(a[0]))
        #if j%20 == 1 : vec = vec[::-1];
        DOS= array(vec) ; w = array(vec2) 
        return DOS , w

In [48]:
ini = 30 ; line = 21
Temp , Tot , Chain , Imp = readfile(ini)
param = readfile_Param(ini, line)
semilogx(Temp , Tot/log(2) , label = 'Tot'+ ', \eta_1 = '+ str(param) )
semilogx(Temp , Chain/log(2) , label = 'Chain' + ', \eta_1 = '+ str(param) )
semilogx(Temp , Imp/log(2) , label = 'Imp'+  ',\eta_1 = '+ str(param) )
legend(fontsize=18,loc='lower left')


Out[48]:
<matplotlib.legend.Legend at 0x7fd0788a4a50>

In [18]:
legend(fontsize=18,loc='lower left')
xlabel('Temperature')
ylabel('$\\times \log(2)$')


Out[18]:
<matplotlib.text.Text at 0x7fd07bddc210>

In [47]:
ini = 30 ; line = 21
Temp , Tot , Chain , Imp = readfile(ini)
Rho , w  =readfile2(3, 0)
plot(range(size(w[w>0])),log(Rho[w>0]) )
plot(range(size(Imp[::-4])),Imp[::-4] )


Out[47]:
[<matplotlib.lines.Line2D at 0x7fd06aea8b50>]

In [ ]: