<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 CDF(X > x) = 1/x^mu = x^-mu
PDF(X=x) = 1/x^(mu+1) = x^-(mu +1)
alpha = mu +1
mu = 1.5 # coinbase
CDF (X > x = 5) = 1/5^1.5
Step1:  Arrival of new vulnerabilities
Step2:  Arrival of New Researchers
Step3:  Researcher Arrival following rewards
Step4:  Inter-time between 2 awards
<ASSISTANT_TASK:>
Python Code:
1000*(1/10**1.5)
Explanation: CDF(X > x) = 1/x^mu = x^-mu
PDF(X=x) = 1/x^(mu+1) = x^-(mu +1)
alpha = mu +1
mu = 1.5 # coinbase
CDF (X > x = 5) = 1/5^1.5
End of explanation
bins = np.arange(1,max(date)+1,7)
H = pl.histogram(date,bins = bins)
x = H[1][:-1]
y = H[0]
c = (y>0)*(x > 30.0)
lx = np.log10(x[c] - min(x[c])+1)
ly = np.log10(y[c])
B = binning(lx,ly,20)
c = (B[0] >= -1)*(B[0] < 3.0)*(B[1] > 0.1)
fit = S.linregress(B[0][c],B[1][c])
print fit
pl.plot(lx,ly,'b.')
pl.plot(B[0],B[1],'ro')
pl.plot(B[0][c],B[0][c]*fit[0]+fit[1],'k-')
pl.xlabel("Time [days]")
pl.ylabel("Count new Vulnerabilities")
Explanation: Arrival of new vulnerabilities
End of explanation
arrivals = []
uuser = []
for u in np.unique(user):
    index = np.argwhere(user==u)[0][0]
    arrivals = np.append(arrivals,index)
    uuser = np.append(uuser,u)
    #print u,date[arrivals[-1]]
o = np.argsort(arrivals)
uuser = uuser[o]
arrivals = arrivals[o]
binsize = 7
bins = np.arange(1,max(date)+1,binsize)
H = pl.histogram(date[list(arrivals)],bins = bins)
x = H[1][:-1]
y = H[0]
c = (y>0)*(x > 0)
lx = np.log10(x[c] - min(x[c])+1)
ly = np.log10(y[c])
B = binning(lx,ly,20)
c = (B[0] >= -1)*(B[0] < 3.0)#*(B[1] > .4)
fit = S.linregress(B[0][c],B[1][c])
print fit
pl.plot(lx,ly,'b.')
pl.plot(B[0],B[1],'ro')
pl.plot(B[0][c],B[0][c]*fit[0]+fit[1],'k-')
pl.xlabel("log10(Time [days])")
pl.ylabel("log10(Count new researchers)")
Explanation: Arrival of New Researchers
End of explanation
x = H[1][:-1]
y = H[0]
c = y > 0
x = x[c]
y = y[c]
ly = np.log10(y)
Hr = pl.histogram(date,weights=reward,bins=bins)
xr = Hr[1][:-1]
yr = Hr[0]
c = yr > 0
xr = xr[c]
yr = yr[c]
lyr = np.log10(yr)
Hra = pl.histogram(date[list(arrivals)],weights=reward[list(arrivals)],bins=bins)
xra = Hra[1][:-1]
yra = Hra[0]
c = yra > 0
xra = xra[c]
yra = yra[c]
lyra = np.log10(yra)
print len(lyr),len(lyra)
pl.bar(x,ly,binsize,color="blue",alpha=0.3)
pl.bar(xr,lyr,binsize,color = "red",alpha=0.3)
#pl.bar(xra,lyra,binsize,color = "purple",alpha=0.3)
pl.xlabel("Time")
pl.ylabel("log10(values)")
h = H[0] + np.random.rand(len(H[0])) - 0.5
hr = Hr[0] + np.random.rand(len(H[0])) - 0.5
print S.spearmanr(h,hr),len(h),len(hr)
L,rho = crossLagCorr(hr[:],h[:],lagspan=15)
pl.plot(np.array(L)*binsize,rho,'o-')
pl.ylim(ymax=1)
pl.ylabel("cross-correlation hr -> h")
pl.xlabel("Time [days]")
Explanation: Researcher Arrival following rewards
End of explanation
test = []
for u in uuser:
    index = np.argwhere(user==u)
    df = np.diff(date[index].flatten())
    test = np.append(test,df)
test[test < 1] = 1. 
x,y = rankorder(test)
pl.loglog(x,y,'o')
print np.median(test),np.mean(test),np.std(test),np.percentile(test,90)
pl.xlabel("delta t between two awards by one user")
pl.ylabel("rank ordering")
x = []
y = []
X = []
Y = []
for u in uuser:
    index = np.argwhere(user==u)
    x = np.append(x,len(reward[index].flatten()))
    y = np.append(y,np.sum(reward[index].flatten()))
    
    #print len(reward[index].flatten())
    Y = np.append(Y,reward[index].flatten())
    X = np.append(X,np.arange(1,len(reward[index].flatten())+1))
print len(X),len(Y)
    
pl.figure(1,(8,8))
c = (X > 0)*(Y > 0)
lX = np.log10(X[c])
lY = np.log10(Y[c])
B = binning(X[c],lY[c],30)
print S.linregress(X[c],lY[c])
fit = S.linregress(B[0],B[1])
print fit
pl.plot(X[c],lY[c],'.')
pl.plot(B[0],B[1],'ro')
pl.plot(B[0],B[0]*fit[0]+fit[1],'k-')
pl.xlabel("rank submission with award")
pl.ylabel("log10(bounty)")
pl.figure(2,(8,8))    
c = (x > 0)*(y > 0)
lx = np.log10(x[c])
ly = np.log10(y[c])
B = binning(lx,ly,30)
fit = S.linregress(B[0],B[1])
print fit
pl.plot(lx,ly,'.')
pl.plot(B[0],B[1],'ro')
pl.plot(B[0],B[0]*fit[0] + fit[1],'k-')
pl.xlabel("log10(count rewards)")
pl.ylabel("lgo10(sum rewards)")
Explanation: Inter-time between 2 awards
End of explanation
<END_TASK>