def dih_plotter3(dirname,savename,numplot): inlist = dih_tablereader(dirname) plotlist = inlist[0:numplot] colors = iter(cm.rainbow(np.linspace(0,1,len(plotlist)))) #creates color table for memberlist in plotlist: x = memberlist[0] #x coordinate data y = memberlist[1] #y coordinate data ysmooth = dih_boxcar(y) xshort = x[0:len(ysmooth)] peaklist =signal.find_peaks_cwt(ysmooth, np.arange(1,30))#continuous wavelet transformation plt.plot(xshort,ysmooth,color = next(colors)) for num in peaklist: plt.plot(xshort[num],ysmooth[num],'gD')#places markers on peaks peak = max(ysmooth) peaklist2 = [i for i, j in enumerate(ysmooth) if j == peak] for num in peaklist2: plt.plot(xshort[num],ysmooth[num],'rD') #finish up plot characteristics plt.title('Super Most Awesome Graph!') plt.ylabel('Flux') plt.xlabel('Time') pylab.ylim([-5,5]) pylab.xlim([0,6.3]) plt.savefig(savename)#saves postscript file return plotlist
def dih_minlistmaker(dirname): indata = d.dih_tablereader(dirname) timelist = [] endlist = [] for memberlist in indata: y = memberlist[1] cave = min(y) cavelist = [i for i, j in enumerate(y) if j == cave] timelist.append(cavelist[0]) for member in timelist: for item in member: endlist.append(item) return endlist
def dih_errmaker(dirname): indata = d.dih_tablereader(dirname) endlist =[] for member in indata: y = member[1] diff = abs(max(y)-min(y)) if diff > 2.0: err = 6.3/11 elif diff < 1.0: err = 6.3/5 else: err = 6.3/9 endlist.append(err) return endlist
def dih_maxlistmaker(dirname): indata = d.dih_tablereader(dirname) timelist =[] endlist =[] for memberlist in indata: y = memberlist[1] peak = max(y) peaklist = [i for i, j in enumerate(y) if j==peak] timelist.append(peaklist[0]) for member in timelist: for item in member: endlist.append(item) return endlist
def dih_basichist(dirname,histname): indata = d.dih_tablereader(dirname) peaklist = [] for memberlist in indata: y = memberlist[1] peak = max(y) peaklist.append(peak) P.figure() n, bins, patches = P.hist(peaklist,12, histtype = "stepfilled") (mu,sigma) = norm.fit(peaklist) plotline = mlab.normpdf(bins,mu,sigma) plt.plot(bins, plotline) plt.xlabel('Max value of Random Data') plt.ylabel('Fraction of Counts') plt.title('Practice with Histograms') plt.savefig(histname) return peaklist