print("Dimensions must be one of ", dim_names) exit() if dim.getMaximum() != -dim.getMinimum(): print('Workspace dimensions must be centered on zero') exit() #dim_list.append((dim.getNBins(), (dim.getMaximum()-dim.getMinimum())/dim.getNBins())) fft_dim = np.fft.fftshift( np.fft.fftfreq(dim.getNBins(), (dim.getMaximum() - dim.getMinimum()) / dim.getNBins())) dim_list.append((fft_dim[0], fft_dim[-1])) dimX = ws.getXDimension() dimY = ws.getYDimension() dimZ = ws.getZDimension() signal = ws.getSignalArray().copy() sg = SpaceGroupFactory.createSpaceGroup(space_group) X = np.linspace(dimX.getMinimum(), dimX.getMaximum(), dimX.getNBins() + 1) Y = np.linspace(dimY.getMinimum(), dimY.getMaximum(), dimY.getNBins() + 1) Z = np.linspace(dimZ.getMinimum(), dimZ.getMaximum(), dimZ.getNBins() + 1) box_width = 0.1 # in hkl dimensions for h in range(int(np.ceil(dimX.getMinimum())), int(np.floor(dimX.getMaximum())) + 1): for k in range(int(np.ceil(dimY.getMinimum())), int(np.floor(dimY.getMaximum())) + 1): for l in range(int(np.ceil(dimZ.getMinimum())), int(np.floor(dimZ.getMaximum())) + 1):
from mantid.simpleapi import LoadMD import matplotlib.pyplot as plt import matplotlib.colors as colors import matplotlib.transforms as mtransforms import numpy as np benzil = LoadMD('/SNS/users/rwp/benzil/benzil_300K_bkg_subtract_sym_All_noCC_flat2_fft.nxs') signal = benzil.getSignalArray() x, y = np.meshgrid(np.linspace(-10,10,501),np.linspace(-10,10,501)) plt.pcolormesh(x, y, signal[:,:,252], norm=colors.SymLogNorm(linthresh=0.2, linscale=0, vmin=-1.0, vmax=1.0), cmap='coolwarm') plt.colorbar() plt.show() plt.pcolormesh(x, y, signal[:,260,:], norm=colors.SymLogNorm(linthresh=0.05, linscale=1, vmin=-1.0, vmax=1.0), cmap='coolwarm') plt.colorbar() plt.show() fig = plt.pcolormesh(x, y, signal[:,:,252].transpose(), vmax=1,vmin=0,cmap='viridis') trans_data = mtransforms.Affine2D().skew(np.arctan(np.sin(np.deg2rad(-30))), 0) + fig.get_transform() fig.set_transform(trans_data) plt.show() fig = plt.pcolormesh(x, y, signal[:,:,252], norm=colors.SymLogNorm(linthresh=0.1, linscale=1, vmin=-1.0, vmax=1.0), cmap='coolwarm') trans_data = mtransforms.Affine2D().skew(np.arctan(np.sin(np.deg2rad(-30))), 0) + fig.get_transform() fig.set_transform(trans_data) plt.colorbar() plt.show()