viewangle=view_angle, figwidth=figwidth, figheight_multiplier=figheight_multiplier, val_lim=bij_lim, equalaxis=equalaxis) # Else if vertical front view slices 3D plot else: bij_slice3d = PlotSurfaceSlices3D(list_x, list_y, list_z, list_bij_i, xlabel='$x$ [m]', ylabel='$y$ [m]', zlabel='$z$ [m]', val_label=bijlabels_pred[i], name=fignames_predtest[i], save=save_fig, show=show, figdir=figdir, viewangle=view_angle, figwidth=figwidth, equalaxis=equalaxis, cbar_orient='horizontal', val_lim=bij_lim) bij_slice3d.initializeFigure() bij_slice3d.plotFigure(contour_lvl=contour_lvl) plotTurbineLocations(bij_slice3d, slicedir, horslice_offsets, turb_borders, turb_centers_frontview) bij_slice3d.finalizeFigure(show_xylabel=show_xylabel, show_zlabel=show_zlabel,
# kX, kY = 2*np.pi*(freqX - freqX.min()), 2*np.pi*(freqY - freqY.min()) # # krOld = 0 # E, kr = np.zeros((uFft.shape[0], 1)), np.zeros((uFft.shape[0], 1)) # for i in range(uFft.shape[0]): # kr[i] = np.sqrt(kX[i]**2 + kY[i]**2) # dk = abs(krOld - kr[i]) # eii = float(uFft[i, i]*np.conj(uFft[i, i])) # E[i] = eii/2. # # krOld = kr[i] from PlottingTool import PlotSurfaceSlices3D myplot = PlotSurfaceSlices3D(X, Y, Z, UmagSliceMesh, name = 'surf', figDir = './', xLim = (0, 3000), yLim = (0, 3000), zLim = (0, 1000), viewAngles = (20, -100)) myplot.initializeFigure() myplot.plotFigure() myplot.finalizeFigure() # import matplotlib as mpl # import matplotlib.pyplot as plt # from mpl_toolkits.mplot3d import Axes3D # from scipy.interpolate import griddata
from PlottingTool import Plot2D_InsetZoom, PlotSurfaceSlices3D # myplot = Plot2D_InsetZoom(grid_x, grid_z, zoomBox = (1000, 2500, 0, 500), z2D = Uinterp, equalAxis = True, name = caseName + '_slice', figDir = 'R:/') # # myplot.initializeFigure() # myplot.plotFigure(contourLvl = 100) # myplot.finalizeFigure() myplot2 = PlotSurfaceSlices3D(grid_x, grid_y, grid_z, Uinterp, name=caseName + '_3d', figDir='R:/', xLim=(0, 3000), yLim=(0, 3000), zLim=(0, 1000), show=False, xLabel=r'\textit{x} [m]', yLabel=r'\textit{z} [m]', zLabel=r'\textit{U} [m/s]') myplot2.initializeFigure() myplot2.plotFigure() myplot2.finalizeFigure() # from PlottingTool import plot2D, plot2DWithInsetZoom # # plot2D(grid_x, grid_z, z2D = Uinterp, contourLvl = 10, equalAxis = True) # plot2DWithInsetZoom(grid_x, grid_z, zoomBox = (1000, 2500, 0, 500), z2D = Uinterp, contourLvl = 100, equalAxis = True, name = caseName, xLabel = r'\textit{x} [m]', yLabel = r'\textit{z} [m]', zLabel = r'\textit{U} [m/s]') # # # fig, ax = plt.subplots(1, 1, num = 'asf')
r2D = np.linspace(0, np.sqrt(lx**2 + ly**2), x2D.shape[0]) """ Plot 5 Scalar Bases in 1 figure for a slice location """ if case.slicesOrientate[gradUAvgName + '_' + sliceNames[i]] == 'horizontal': slicePlot3D = PlotContourSlices3D(listX2D, listY2D, listVals3D, horSliceOffsets, contourLvl = contourLvl, gradientBg = False, name = inputNames[j] + '_' + sliceNames[i], xLabel = xLabel, yLabel = yLabel, zLabel = zLabel, cmapLabel = valLabel, save = save, show = show, figDir = case.resultPath, viewAngles = viewAngle, figWidth = figWidth, equalAxis = equalAxis, cbarOrientate = 'vertical') elif case.slicesOrientate[gradUAvgName + '_' + sliceNames[i]] == 'vertical': slicePlot3D = PlotSurfaceSlices3D(listX2D, listY2D, listZ2D, listVals3D, xLabel = xLabel, yLabel = yLabel, zLabel = zLabel, cmapLabel = valLabel, name = str(sliceNames), save = save, show = show, figDir = case.resultPath, viewAngles = viewAngle, figWidth = figWidth, equalAxis = equalAxis, cbarOrientate = 'horizontal') slicePlot3D.initializeFigure(figSize = figSize) slicePlot3D.plotFigure() slicePlot3D.finalizeFigure()
alpha=0.5, fill=False, edgecolor=(0.25, 0.25, 0.25), zorder=100) patches = [] for i in range(10): patches.append(copy(patch)) patches = iter(patches) # Initialize vertical surface plot instance plot3d = PlotSurfaceSlices3D(list_x2d, list_y2d, list_z2d, list_val3d, xlabel=xlabel, ylabel=ylabel, zlabel=zlabel, val_label=val_label[0], name=figname_3d, save=save, show=show, figdir=case.result_path, viewangle=view_angle, figwidth=figwidth, equalaxis=equalaxis, cbar_orient='horizontal', val_lim=val_lim) # Again separate instance for z component if list_val3d_z[0] is not None: plot3d_z = PlotSurfaceSlices3D(list_x2d, list_y2d, list_z2d,
if case.slices_orient[slicename] == 'horizontal': bij_slice3d = PlotContourSlices3D(list_x, list_y, list_bij_i, horslice_offsets, name='b' + ij[i] + '_' + str( slicenames), xlabel=r'$x$ [m]', ylabel=r'$y$ [m]', zlabel=r'$z$ [m]', val_label=bij_label[i], cbar_orient='vertical', save=save, show=show, figdir=case.result_path, viewangle=view_angle, figwidth=figwidth, figheight_multiplier=figheight_multiplier, val_lim=bij_lim, equalaxis=equalaxis) # Else if vertical front view slices 3D plot else: bij_slice3d = PlotSurfaceSlices3D(list_x, list_y, list_z, list_bij_i, xlabel='$x$ [m]', ylabel='$y$ [m]', zlabel='$z$ [m]', val_label=bij_label[i], name='b' + ij[i] + '_' + str( slicenames), save=save, show=show, figdir=case.result_path, viewangle=view_angle, figwidth=figwidth, equalaxis=equalaxis, cbar_orient='horizontal', val_lim=bij_lim) bij_slice3d.initializeFigure() bij_slice3d.plotFigure(contour_lvl=contour_lvl) plotTurbineLocations(bij_slice3d, case.slices_orient[slicename], horslice_offsets, turb_borders, turb_centers_frontview) bij_slice3d.finalizeFigure(show_xylabel=show_xylabel, show_zlabel=show_zlabel, show_ticks=show_ticks) # Rij if 'rij' in plot_property or '*' in plot_property: figheight_multiplier = 1.75 if case.slices_orient[slicename] == 'horizontal' else 1 ij = ['11', '12', '13', '22', '23', '33'] for i in range(6):
for i in range(len(bijcomp)): bij_pred_all_ij, bij_test_all_ij = [], [] for j in range(len(bij_pred_all)): bij_pred_all_ij.append(bij_pred_all[j][..., i]) bij_test_all_ij.append(bij_test_all[j][..., i]) # True bij bij_test_plot = PlotSurfaceSlices3D( list_x=list_x, list_y=(cc1_all[0], ) * len(cc1_all), list_z=cc2_all, list_val=bij_test_all_ij, val_lim=bijlims, save=save_fig, show=show, figheight_multiplier=figheight_multiplier, figdir=figdir, name=fignames_test[i], xlabel='$D$ [-]', ylabel=xlabel, zlabel=ylabel, val_label=bijlabels[i], figwidth='half', viewangle=viewangle) bij_test_plot.initializeFigure(constrained_layout=True, proj_type='persp') bij_test_plot.plotFigure() # bij_pred_plot.axes.yaxis.set_ticklabels([]) # bij_pred_plot.axes.zaxis.set_ticklabels([]) for i2 in range(len(slice_offset)): patch = next(patches)
# Max of lambda is 2/3. Min of lambda is -1/3. lam1[sumlam12 > 1 / 3.], lam2[sumlam12 > 1 / 3.] = np.nan, np.nan # Since sum of eigen values in rank-2 anistropy tensor should 0 lam3 = 0 - lam1 - lam2 thirdInv = -3 * lam1 * lam2 * (lam1 + lam2) thirdInvPlot = PlotSurfaceSlices3D(lam1, lam2, lam3, thirdInv, show=show, save=save, figDir=figDir, figWidth=figWidth, equalAxis=equalAxis, cbarOrientate=cbarOrientate, xLabel=xLabel, yLabel=yLabel, zLabel=zLabel, cmapLabel=cmapLabel, name=name, viewAngles=viewAngle, xLim=xLim, yLim=yLim, zLim=zLim) thirdInvPlot.initializeFigure() thirdInvPlot.plotFigure() thirdInvPlot.finalizeFigure(pad=pad, fraction=fraction, showCbar=showCbar)