Created
July 6, 2015 18:48
-
-
Save leelasd/fec73fd73fa269c75865 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import scipy.stats as stats | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
cm = plt.cm.get_cmap('rainbow') | |
df1=pd.read_csv('Dat.csv') | |
df2=pd.read_csv('Dat2.csv') | |
df=df1.append(df2) | |
df=df.sort(['RDF','SIG']) | |
df['ERR']=df.RDF - 2.40 | |
fig,ax1 = plt.subplots() | |
ax2 = ax1.twinx() | |
for i in range(0,40): | |
llim=0.0+i*0.05 | |
ulim=0.05+i*0.05 | |
ndf=df[(df.ERR >= llim )&(df.ERR <= ulim)] | |
x=ndf.SIG | |
y=ndf.EPS | |
Y=np.log10(y) | |
if (len(Y)>2): | |
m,c,r,p,se1=stats.linregress(x,Y) | |
print i,llim,ulim,m,c,r**2 | |
cm1lab="$"+('y=%2.2fx+%2.2f, r^2=%1.2f'%(m,c,r**2))+"$"; | |
ax1.plot(x, m*x+c,c=cm(i*9),linewidth=2,label=cm1lab) | |
ax2.plot(x,y,'o',mfc='none',mec=cm(i*9),mew=1.2) | |
ax2.set_yscale('log') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment