def PlotSingle(self, ax, fig, dat, Extent=None, Annotate=False): if Extent==None: if self.vmin==-999 and self.vmax==-999: im = ax.imshow(dat,origin='lower',aspect='auto') else: im = ax.imshow(dat,origin='lower',aspect='auto',vmin=self.vmin, vmax=self.vmax) else: if self.vmin==-999 and self.vmax==-999: im = ax.imshow(dat,origin='lower',aspect='auto',extent=Extent) else: im = ax.imshow(dat,origin='lower',aspect='auto',extent=Extent,vmin=self.vmin, vmax=self.vmax) if Annotate: from matplotlib.legend import rcParams rcParams.update({'font.size':self.fsize}) fig.subplots_adjust(top=0.94, right=0.96,left=0.05,bottom=0.11) cb=plt.colorbar(im) cb.set_label(self.cblabel) plt.xlabel(self.xlabel, fontsize = self.fsize) plt.ylabel(self.ylabel, fontsize = self.fsize) plt.title(self.title, fontsize = self.fsize) if self.HideAxis: frame1 = plt.gca() frame1.axes.get_xaxis().set_visible(False) frame1.axes.get_yaxis().set_visible(False) return
def PlotRaw(self, Annotate=False, Extent=None, std=False): import matplotlib.pyplot as plt # Make pixel size the same in x- and y-directions. self.Plotysize = self.Plotxsize * self.AspectRatio fig = plt.figure(figsize=(self.Plotxsize, self.Plotysize)) if std == True: tmpdat = self.STD print("Mean STD", np.mean(tmpdat), np.mean(self.STD / self.rad)) else: tmpdat = self.rad if Extent == None: if self.vmin == -999 and self.vmax == -999: im = plt.imshow(tmpdat, origin='lower', aspect='auto') else: im = plt.imshow(tmpdat, origin='lower', aspect='auto', vmin=self.vmin, vmax=self.vmax) else: if self.vmin == -999 and self.vmax == -999: im = plt.imshow(tmpdat, origin='lower', aspect='auto', extent=Extent) else: im = plt.imshow(tmpdat, origin='lower', aspect='auto', extent=Extent, vmin=self.vmin, vmax=self.vmax) if Annotate: from matplotlib.legend import rcParams rcParams.update({'font.size': self.fsize}) fig.subplots_adjust(top=0.94, right=0.96, left=0.11, bottom=0.11) cb = plt.colorbar() cb.set_label(self.cblabel) plt.xlabel(self.xlabel, fontsize=self.fsize) plt.ylabel(self.ylabel, fontsize=self.fsize) plt.title(self.title, fontsize=self.fsize) if self.HideAxis: frame1 = plt.gca() frame1.axes.get_xaxis().set_visible(False) frame1.axes.get_yaxis().set_visible(False) plt.show()
def plot_images_column(**kwargsall): from mpl_toolkits.axes_grid1 import make_axes_locatable nplots=len(kwargsall) # nplots subplots, the axes array is 1-d fig, axarr = plt.subplots(nplots, sharex=True, figsize=(14,15)) ip=0 for items in sorted(kwargsall.items()): kwargs = items[1] img=kwargs['data'] if kwargs['log_img']: data = np.log10(img) data = np.where(data>np.log10(kwargs['threshold']), data, np.log10(kwargs['threshold'])) else: data = img data = np.where(data>kwargs['threshold'], data, kwargs['threshold']) yp = np.arange(0, kwargs['data'].shape[1]) if 'vmin' in kwargs: im=axarr[ip].imshow(data, origin='lower', aspect='auto', extent=kwargs['extent'], cmap=kwargs['cmap'], vmin=kwargs['vmin'], vmax=kwargs['vmax']) else: im=axarr[ip].imshow(data, origin='lower', aspect='auto', extent=kwargs['extent'], cmap=kwargs['cmap']) if ip==nplots-1: axarr[ip].set_xlabel(kwargs['xlabel'], fontsize=FONTSIZE) axarr[ip].set_ylabel(kwargs['ylabel'], fontsize=FONTSIZE) axarr[ip].set_title(kwargs['title'], fontsize=FONTSIZE) # Colorbars are a bit of a mess, from: # https://matplotlib.org/gallery/axes_grid1/demo_axes_divider.html#sphx-glr-gallery-axes-grid1-demo-axes-divider-py divider = make_axes_locatable(axarr[ip]) ax_cb = divider.new_horizontal(size="2%", pad=0.05) fig1 = axarr[ip].get_figure() fig1.add_axes(ax_cb) plt.colorbar(im, cax=ax_cb) ax_cb.yaxis.tick_right() ax_cb.yaxis.set_tick_params(labelright=True) ip=ip+1 rcParams.update({'font.size':FONTSIZE}) fig.subplots_adjust(top=0.96, right=0.93,left=0.08,bottom=0.05)
def plot_img(img, **kwargs): if 'figsize' in kwargs: figsize=kwargs['figsize'] else: figsize=(18,7.2) fig = plt.figure(figsize=figsize) ax = fig.add_subplot(111) rcParams.update({'font.size':FONTSIZE}) # fig.subplots_adjust(top=0.99, right=0.98,left=0.09,bottom=0.02) fig.subplots_adjust(top=0.99, right=0.98,left=0.09,bottom=0.02) if 'extent' in kwargs: extent=kwargs['extent'] else: extent=None if 'flip_x' in kwargs: if kwargs['flip_x']: img=img[:,::-1] if kwargs['log_img']: data = np.log10(img) data = np.where(data>np.log10(kwargs['threshold']), data, np.log10(kwargs['threshold'])) else: data = img data = np.where(data>kwargs['threshold'], data, kwargs['threshold']) print("extent", extent) if 'vmin' in kwargs: im = ax.imshow(data, origin='lower', cmap=kwargs['cmap'], extent=extent, vmin=kwargs['vmin'], vmax=kwargs['vmax']) else: im = ax.imshow(data, origin='lower', cmap=kwargs['cmap'], extent=extent) ax.set_title(kwargs['title'], fontsize=FONTSIZE) ax.set_xlabel(kwargs['xlabel'], fontsize = FONTSIZE) ax.set_ylabel(kwargs['ylabel'], fontsize = FONTSIZE) if 'cb_shrink' in kwargs: shrink=kwargs['cb_shrink'] else: shrink=0.64 if 'cb_ticks' in kwargs: plt.colorbar(im, shrink=shrink, pad=0.02, ticks=kwargs['cb_ticks']) else: plt.colorbar(im, shrink=shrink, pad=0.02)
def plot_img_statistics_5(Img, **kwargs): fig = plt.figure(1, figsize=(14,18)) rcParams.update({'font.size':FONTSIZE}) fig.subplots_adjust(top=0.96, right=0.93,left=0.08,bottom=0.05) ax1 = plt.subplot(511) ax2 = plt.subplot(512) ax3 = plt.subplot(513) ax4 = plt.subplot(514) ax5 = plt.subplot(515) yp = np.arange(0, Img.shape[1]) colorline1='b' colorline2='r' if kwargs['log_img']: data = np.log10(Img.img) data = np.where(data>np.log10(Img.threshold), data, np.log10(Img.threshold)) else: data = Img.img data = np.where(data>Img.threshold, data, Img.threshold) print("data min/max", data.min(), data.max()) # print ("Centerline", Img.Centerline) ax1.imshow(data, aspect='auto', origin='lower', extent=kwargs['extent'], cmap=kwargs['cmap'])#, cmap=cmaps.gist_ncar_r)# ax1.set_ylabel('Vertical pixel number', fontsize=FONTSIZE) ax1.set_title(kwargs['title'], fontsize=FONTSIZE) box = ax1._position.bounds height = box[3] tmpax = fig.add_axes([box[0], box[1] , box[2], height]) tmpax.set_axis_off() tmpax.plot(yp,Img.Centerline,c=colorline2) # tmpax.plot(np.sin(np.linspace(0,np.random.randint(20,1000),1000))*0.4) tmpax.set_ylim(Img.shape[0],0) #Upside down since origin=lower tmpax.set_xlim(0,len(yp)-1) # yval=Img.shape[0]-Img.Centerline # Turn upside down yval=Img.Centerline # ax2.plot(yp,Img.Centerline,c=colorline1) ax2.plot(yp, yval, c=colorline1) # ax2.set_ylim(ax2.get_ylim()[::-1]) # ax2.set_ylim(20,40) ax2.set_ylabel('Centerline', fontsize=FONTSIZE) data = Img.Centerline data = data[~np.isnan(data)] indx= np.where(np.absolute(data)>1.0) print('{:20s} {:7.3f} {:7.2f} {:7d} {:7d} {:7.3f}'.format('Centerline', np.nanmin(Img.Centerline), np.nanmax(Img.Centerline), len(indx[0]),\ data.shape[0], 100*len(indx[0])/float(data.shape[0]))) # ax2.set_ylim(Img.shape[0],0) #Upside down since origin=lower # ax2.set_ylim(0,Img.shape[0]) ax2.set_ylim(-2,2) ax2.plot([0,len(yp)-1],[0,0],c='k') ax2.plot([0,len(yp)-1],[1,1],c='k',linestyle=':') ax2.plot([0,len(yp)-1],[-1,-1],c='k',linestyle=':') ax2.set_xlim(0,len(yp)-1) data = Img.Dispersion data = data[~np.isnan(data)] indx= np.where(np.absolute(data)>1.0) print('{:20s} {:7.3f} {:7.2f} {:7d} {:7d} {:7.3f}'.format('Dispersion',np.nanmin(Img.Dispersion), np.nanmax(Img.Dispersion), len(indx[0]),\ data.shape[0], 100*len(indx[0])/float(data.shape[0]))) ax3.plot(yp,Img.Dispersion,c=colorline1) # ax3.set_ylim(0,20) ax3.set_ylim(-2,2) ax3.plot([0,len(yp)-1],[0,0],c='k') ax3.plot([0,len(yp)-1],[1,1],c='k',linestyle=':') ax3.plot([0,len(yp)-1],[-1,-1],c='k',linestyle=':') ax3.set_ylabel('Abs. dispersion', fontsize=FONTSIZE) ax3.set_xlim(0,len(yp)-1) data = Img.RelativeDispersion data = data[~np.isnan(data)] indx= np.where(np.absolute(data)>1.0) print('{:20s} {:7.3f} {:7.2f} {:7d} {:7d} {:7.3f}'.format('RelativeDispersion', np.nanmin(Img.RelativeDispersion), np.nanmax(Img.RelativeDispersion), len(indx[0]),\ data.shape[0], 100*len(indx[0])/float(data.shape[0]))) ax4.plot(yp,Img.RelativeDispersion,c=colorline1) # ax4.set_ylim(0,15) ax4.set_ylim(-2,2) ax4.plot([0,len(yp)-1],[0,0],c='k') ax4.plot([0,len(yp)-1],[1,1],c='k',linestyle=':') ax4.plot([0,len(yp)-1],[-1,-1],c='k',linestyle=':') ax4.set_ylabel('Rel. dispersion', fontsize=FONTSIZE) ax4.set_xlim(0,len(yp)-1) data = Img.AbsoluteSkewness data = data[~np.isnan(data)] indx= np.where(np.absolute(data)>1.0) print('{:20s} {:7.3f} {:7.2f} {:7d} {:7d} {:7.3f}'.format('AbsoluteSkewness', np.nanmin(Img.AbsoluteSkewness), np.nanmax(Img.AbsoluteSkewness), len(indx[0]),\ data.shape[0], 100*len(indx[0])/float(data.shape[0]))) ax5.plot(yp,Img.AbsoluteSkewness,c=colorline1) ax5.set_ylim(-4,4) ax5.plot([0,len(yp)-1],[0,0],c='k') ax5.plot([0,len(yp)-1],[1,1],c='k',linestyle=':') ax5.plot([0,len(yp)-1],[-1,-1],c='k',linestyle=':') ax5.set_xlabel('Horizontal pixel number', fontsize=FONTSIZE) ax5.set_ylabel('Abs. skewness', fontsize=FONTSIZE) ax5.set_xlim(0,len(yp)-1)
def plot_img_statistics(Img, **kwargs): fig = plt.figure(1, figsize=(14,15)) rcParams.update({'font.size':FONTSIZE}) fig.subplots_adjust(top=0.96, right=0.93,left=0.08,bottom=0.1) fig.subplots_adjust(hspace=0.4) ax1 = plt.subplot(311) ax2 = plt.subplot(312) ax3 = plt.subplot(313) yp = np.arange(0, Img.shape[1]) includeLES=False if kwargs['LESdata'] != None: includeLES=True LESImg = kwargs['LESdata'] colorline1='b' colorline2='r' colorline3='g' colorline4='k' if kwargs['log_img']: data = np.log10(Img.img) data = np.where(data>np.log10(Img.threshold), data, np.log10(Img.threshold)) else: data = Img.img data = np.where(data>Img.threshold, data, Img.threshold) print("data min/max", data.min(), data.max()) ax1.imshow(data, aspect='auto', origin='lower', extent=kwargs['extent'], cmap=cmaps.Greys) ax1.set_ylabel('Vertical pixel number', fontsize=FONTSIZE) ax1.set_xlabel('Horizontal pixel number', fontsize=FONTSIZE) if kwargs['title']!='': ax1.set_title(kwargs['title'], fontsize=FONTSIZE) box = ax1._position.bounds height = box[3] tmpax = fig.add_axes([box[0], box[1] , box[2], height]) tmpax.set_axis_off() linewidth=3 Img.phis = np.arange(Img.meta["phi1"], Img.meta["phi2"], (Img.meta["phi2"]-Img.meta["phi1"])/Img.img.shape[1])-180 PlotAng=True #False # indx = np.where(Img.Centerline>0.0) Img.Centerline = Img.Centerline[indx[0]] if PlotAng: tmpy = Img.phis[indx[0]] AngleShift=1.0 tmpax.plot(tmpy, Img.Centerline,c=colorline2, lw=linewidth, linestyle=':') tmpax.set_xlim(Img.phis[0],Img.phis[len(Img.phis)-1]) else: tmpyp = yp[indx[0]] tmpax.plot(tmpyp, Img.Centerline,c=colorline2, lw=linewidth, linestyle=':') tmpax.set_xlim(0,len(yp)-1) tmpax.set_ylim(Img.shape[0],0) #Upside down since origin=lower # tmpax.set_xlim(Img.meta["phi1"]-180, Img.meta["phi2"]-180) if includeLES: D = 0.26 # Distance from camera to plume in km. Roughly estimated from Fig. 2 and tuned xcentre = LESImg.x[int(LESImg.x.shape[0]/2)] phis = np.rad2deg(np.arctan((LESImg.x-xcentre)/D) ) # print "LESImg.x", LESImg.x-xcentre # print "phis", phis[0], phis[len(phis)-1] # print "Img.thetas", Img.thetas.shape, Img.thetas tmpCL = np.interp(Img.phis, phis, LESImg.Centerline) # print "tmpCL", tmpCL.shape, tmpCL.min(), tmpCL.max(), Img.Centerline.min(), Img.Centerline.max() xpixoffset=10 xoffset= 12 #9#*0.115 # 46/400=0.115 yoffset=9 #+88-78 yscale = Img.shape[0]/float(LESImg.shape[0]) # tmpax.plot(Img.phis+xoffset, tmpCL*yscale+yoffset,c=colorline2, linestyle=':', lw=linewidth) indxdiff1=20 #0 indxdiff2=len(tmpCL)-20 tmpCL=tmpCL*yscale+yoffset if PlotAng: tmpax.plot(Img.phis+AngleShift, tmpCL,c=colorline2, linestyle='-', lw=linewidth) else: tmpax.plot(yp[indxdiff1-xoffset:indxdiff2-xoffset]+xpixoffset, tmpCL[indxdiff1-xoffset:indxdiff2-xoffset],c=colorline2, linestyle='-', lw=linewidth) # CL_diff = (Img.Centerline[indxdiff1:indxdiff2]-tmpCL[indxdiff1-xoffset:indxdiff2-xoffset])/tmpCL[indxdiff1:indxdiff2] # CL_diff = (Img.Centerline[indxdiff1:indxdiff2]-tmpCL[indxdiff1-xoffset:indxdiff2-xoffset]) # fn = 'Stats_CL_V01.txt' # fp=open(fn,'w') # for CLimg, CLLES, diff in zip(Img.Centerline[indxdiff1:indxdiff2], tmpCL[indxdiff1-xoffset:indxdiff2-xoffset], CL_diff): # fp.write('{:f} {:f} {:f}\n'.format(CLimg, CLLES, diff)) # close(fn) ximgind1 = 20 ximgind2 = len(Img.Centerline)#-ximgind1 ximg = np.arange(ximgind1, ximgind2) xlesoffset=0 xlesind1 = 11 xlesind2 = len(LESImg.Centerline)-10#-xlesind1 fn = 'Stats_CL_V03.txt' fp=open(fn,'a') tmpimg = Img.Centerline[ximgind1:ximgind2] tmples = LESImg.Centerline[xlesind1:xlesind2] xles = np.linspace(ximgind1, ximgind2, len(tmples)) print xles.shape, ximg.shape, tmples.shape, LESImg.Centerline.shape, xles.min(), xles.max(), ximg.min(), ximg.max() tmpCL = yoffset+yscale*np.interp(ximg, xles, tmples) CL_diff =tmpimg - tmpCL for CLimg, CLLES, diff in zip(tmpimg, tmpCL, CL_diff): fp.write('{:f} {:f} {:f}\n'.format(CLimg, CLLES, diff)) close(fn) # print("Dispersion", np.nanmin(Img.Dispersion), np.nanmax(Img.Dispersion)) # print "Img.Dispersion", Img.Dispersion.shape, Img.Dispersion indx = np.where(Img.Dispersion>0.0) Img.Dispersion = Img.Dispersion[indx[0]] Img.RelativeDispersion = Img.RelativeDispersion[indx[0]] pls = [] if PlotAng: xx = np.arange(0,len(Img.phis)) tmpxx = np.arange(0,len(Img.phis[indx[0]])) AngleOffSet=180 # pl, = ax2.plot(Img.phis+AngleOffSet,Img.Dispersion,c=colorline1) pl, = ax2.plot(tmpxx, Img.Dispersion,c=colorline1, linestyle=':') #pls.append(pl) # pl, = ax2.plot(Img.phis+AngleOffSet,Img.RelativeDispersion,c=colorline2) pl, = ax2.plot(tmpxx, Img.RelativeDispersion,c=colorline2, linestyle=':') # pls.append(pl) # print xx[len(xx)-1], xx # ax2.set_xlim(0,xx[len(xx)-1]) ax2.set_xlim(8,400) else: tmpyp = yp[indx[0]] pl, = ax2.plot(tmpyp,Img.Dispersion,c=colorline1, linestyle=':') #pls.append(pl) pl, = ax2.plot(tmpyp,Img.RelativeDispersion,c=colorline2, linestyle=':') # pls.append(pl) ax2.set_xlim(0,len(yp)-1) # ax2.set_xlim(1,400) # ax2.set_ylim(0,20) ax2.set_ylim(0.1,20) # tmpax.set_xlim(Img.meta["phi1"]-180, Img.meta["phi2"]-180) ax2.set_xscale('log') ax2.set_yscale('log') ax2.set_ylabel('Dispersion', fontsize=FONTSIZE) ax2.set_xlabel('Log$_{10}$ of horizontal pixel number', fontsize=FONTSIZE) # ax2.legend((pls[0], pls[1]), ('Absolute dispersion','Relative dispersion',), # prop={'size':FONTSIZE}, loc='lower right') if includeLES: tmpDIS = np.interp(Img.phis, phis, LESImg.Dispersion) # tmpDIS = np.interp(yp, phis, LESImg.Dispersion) # yscale = Img.shape[0]/float(LESImg.shape[0]) yoffset=0 # tmpDIS=tmpDIS*yscale+yoffset tmpDIS2 = np.interp(Img.phis, phis, LESImg.RelativeDispersion) tmpDIS2 =tmpDIS2*yscale+yoffset if PlotAng: PixelShift=1 pl, = ax2.plot(xx+PixelShift, tmpDIS,c=colorline1, linestyle='-', lw=linewidth) # ax2.plot(Img.phis+AngleShift+AngleOffSet, tmpDIS,c=colorline1, linestyle=':', lw=linewidth) pls.append(pl) pl, = ax2.plot(xx+PixelShift, tmpDIS2,c=colorline2, linestyle='-', lw=linewidth) pls.append(pl) # ax2.plot(Img.phis+AngleShift+AngleOffSet, tmpDIS2*yscale+yoffset,c=colorline2, linestyle=':', lw=linewidth) else: pl, = ax2.plot(yp+xoffset, tmpDIS,c=colorline1, linestyle='-', lw=linewidth) pls.append(pl) pl, = ax2.plot(yp+xoffset, tmpDIS2, c=colorline2, linestyle='-', lw=linewidth) pls.append(pl) indx1=10 indx2=30 # 60# indx = np.where((yp>indx1) & (yp<indx2)) x = yp[indx] y = Img.RelativeDispersion[indx] m,b = np.polyfit(x, y, 1) print "m,b img", m,b indx = np.where((yp>indx1+xoffset) & (yp<indx2+xoffset)) x = yp[indx] y = LESImg.RelativeDispersion[indx] m,b = np.polyfit(x, y, 1) print "m,b LES", m,b, pls ax2.legend((pls[0], pls[1]), ('Absolute dispersion','Relative dispersion',), prop={'size':FONTSIZE}, loc='lower right') # AD_diff = (Img.Dispersion[indxdiff1:indxdiff2]-tmpDIS[indxdiff1-xoffset:indxdiff2-xoffset]) # fn = 'Stats_AD_V01.txt' # fp=open(fn,'a') # for ADimg, ADLES, diff in zip(Img.Dispersion[indxdiff1:indxdiff2], tmpDIS[indxdiff1-xoffset:indxdiff2-xoffset], AD_diff): # fp.write('{:f} {:f} {:f}\n'.format(ADimg, ADLES, diff)) # close(fn) # RD_diff = (Img.RelativeDispersion[indxdiff1:indxdiff2]-tmpDIS2[indxdiff1-xoffset:indxdiff2-xoffset]) # fn = 'Stats_RD_V01.txt' # fp=open(fn,'a') # for RDimg, RDLES, diff in zip(Img.RelativeDispersion[indxdiff1:indxdiff2], tmpDIS2[indxdiff1-xoffset:indxdiff2-xoffset], RD_diff): # fp.write('{:f} {:f} {:f}\n'.format(RDimg, RDLES, diff)) # close(fn) fn = 'Stats_AD_V03.txt' fp=open(fn,'a') tmpimg = Img.Dispersion[ximgind1:ximgind2] tmples = LESImg.Dispersion[xlesind1:xlesind2] tmpCL = yscale*np.interp(ximg, xles, tmples) CL_diff =tmpimg - tmpCL for CLimg, CLLES, diff in zip(tmpimg, tmpCL, CL_diff): fp.write('{:f} {:f} {:f}\n'.format(CLimg, CLLES, diff)) close(fn) fn = 'Stats_RD_V03.txt' fp=open(fn,'a') tmpimg = Img.RelativeDispersion[ximgind1:ximgind2] tmples = LESImg.RelativeDispersion[xlesind1:xlesind2] tmpCL = yscale*np.interp(ximg, xles, tmples) CL_diff =tmpimg - tmpCL for CLimg, CLLES, diff in zip(tmpimg, tmpCL, CL_diff): fp.write('{:f} {:f} {:f}\n'.format(CLimg, CLLES, diff)) close(fn) print("AbsoluteSkewness", np.nanmin(Img.AbsoluteSkewness), np.nanmax(Img.AbsoluteSkewness)) print "Img.AbsoluteSkewness", Img.Skewness.shape, Img.Skewness indx = np.where(Img.Skewness!=0.0) Img.Skewness = Img.Skewness[indx[0]] print "Img.AbsoluteSkewness", Img.Skewness.shape, Img.Skewness if PlotAng: # ax3.plot(Img.phis, Img.AbsoluteSkewness,c=colorline1, lw=linewidth, linestyle=':') ax3.plot(Img.phis[indx[0]], Img.Skewness,c=colorline1, lw=linewidth, linestyle=':') ax3.set_xlim(Img.phis[0],Img.phis[len(Img.phis)-1]) else: # ax3.plot(yp,Img.AbsoluteSkewness,c=colorline1, linestyle=':') ax3.plot(yp[indx[0]],Img.Skewness,c=colorline1, linestyle=':') ax3.set_xlim(0,len(yp)) ax3.set_ylim(-2,2) # ax3.set_xlabel('Horizontal pixel number', fontsize=FONTSIZE) ax3.set_xlabel('Horizontal viewing angle', fontsize=FONTSIZE) ax3.set_ylabel('Skewness', fontsize=FONTSIZE) if includeLES: tmpDIS = np.interp(Img.phis, phis, LESImg.Skewness) # tmpDIS = np.interp(Img.phis, phis, LESImg.AbsoluteSkewness) # tmpDIS = np.interp(yp, phis, LESImg.Dispersion) yscale = 1 #Img.shape[0]/float(LESImg.shape[0]) yoffset=0 # ax2.plot(Img.phis+xoffset, tmpDIS*yscale+yoffset,c=colorline1, linestyle=':', lw=linewidth) if PlotAng: ax3.plot(Img.phis+AngleShift, tmpDIS*yscale+yoffset,c=colorline1, linestyle='-', lw=linewidth) else: ax3.plot(yp[indxdiff1-xoffset:indxdiff2-xoffset]+xpixoffset, tmpDIS[indxdiff1-xoffset:indxdiff2-xoffset]*yscale+yoffset,c=colorline1, linestyle='-', lw=linewidth) # SK_diff = (Img.AbsoluteSkewness[indxdiff1:indxdiff2]-tmpDIS[indxdiff1-xoffset:indxdiff2-xoffset])/tmpDIS[indxdiff1:indxdiff2] # SK_diff = (Img.AbsoluteSkewness[indxdiff1:indxdiff2]-tmpDIS[indxdiff1-xoffset:indxdiff2-xoffset]) # fn = 'Stats_Skewness_V01.txt' # fp=open(fn,'a') # for SKimg, SKLES, diff in zip(Img.AbsoluteSkewness[indxdiff1:indxdiff2], tmpDIS[indxdiff1-xoffset:indxdiff2-xoffset], SK_diff): # fp.write('{:f} {:f} {:f}\n'.format(SKimg, SKLES, diff)) # close(fn) fn = 'Stats_Skewness_V03.txt' fp=open(fn,'a') # tmpimg = Img.AbsoluteSkewness[ximgind1:ximgind2] tmpimg = Img.Skewness[ximgind1:ximgind2] # tmples = LESImg.AbsoluteSkewness[xlesind1:xlesind2] tmples = LESImg.Skewness[xlesind1:xlesind2] tmpCL = yscale*np.interp(ximg, xles, tmples) CL_diff =tmpimg - tmpCL for CLimg, CLLES, diff in zip(tmpimg, tmpCL, CL_diff): fp.write('{:f} {:f} {:f}\n'.format(CLimg, CLLES, diff)) close(fn)
xmin = 677 xmax = 697 xmaL = 5 xmiL = 1 txt = '0.3 nm resolution' my_legend(host, pl_list, txt, 0.02, 0.87, fsize, 1, plt) txt = '0.3 nm resolution, fluorescence included' my_legend(host, pl_list, txt, 0.02, 0.92, fsize, 2, plt) txt = 'Fluorescence signal' my_legend(host, pl_list, txt, 0.02, 0.8, fsize, 3, plt) ymajorLocator = MultipleLocator(2) par.yaxis.set_major_locator(ymajorLocator) yminorLocator = MultipleLocator(0.2) par.yaxis.set_minor_locator(yminorLocator) rcParams.update({'font.size': fsize}) host.set_xlim(xmin, xmax) host.set_ylim(ymin, ymax) host.set_xlabel(r"Wavelength [nm]", fontsize=fsize) host.set_ylabel(ylabel, fontsize=fsize) xminorLocator = MultipleLocator(xmiL) xmajorLocator = MultipleLocator(xmaL) host.xaxis.set_minor_locator(xminorLocator) host.xaxis.set_major_locator(xmajorLocator) ymajorLocator = MultipleLocator(ymaL) host.yaxis.set_major_locator(ymajorLocator) yminorLocator = MultipleLocator(ymiL) host.yaxis.set_minor_locator(yminorLocator)