from numpy import histogram, log10,logspace, shape, arange, pi, r_, diff, sqrt, correlate from numpy import append, zeros#, conj #from numpy.fft import rfft, irfft from matplotlib.pyplot import figure, show from read import ReadResults, ReadProfile, ReadTiming, ReadDelayVsAngle, ReadGeneration from constants import yr, degre from analytic import Analytic_delay_vs_theta def timing(time,weight,nbBins=100000,max_dt=315576000): # max_dt=10yr ''' Compute flux versus time delay Input: directory name Input (optional): generation (default = all) Output: time delay (sec), flux ''' cond = (time>1e3) #& (time conv1[:-1]] & r_[conv1[:-1] > conv1[1:], True]] ax.plot(delta_t,CC_GeV_TeV,linestyle="steps-mid",label="GeV VS TeV band") #print(" GeV - TeV band: ",delta_t[r_[True, conv2[1:] > conv2[:-1]] & r_[conv2[:-1] > conv2[1:], True]]) ax.plot(delta_t,CC_MeV_TeV,linestyle="steps-mid",label="MeV VS TeV band") #print " MeV - TeV band: ",delta_t[r_[True, conv3[1:] > conv3[:-1]] & r_[conv3[:-1] > conv3[1:], True]] else: ax.plot(delta_t,CC_GeV_TeV,linestyle="steps-mid",label=fileId) #ax.set_xscale('log') #ax.set_yscale('log') ax.set_xlim([-1e16,1e16]) ax.legend(loc="best") ax.grid(b=True,which='major') ax.set_xlabel("Time delay [s]") ax.set_ylabel("cross correlation [normalized]") show()