Commit e6e13188 authored by marc barbarosa's avatar marc barbarosa
Browse files

corrections

parent 8026010c
Pipeline #19904752 failed with stage
in 61 minutes and 47 seconds
......@@ -593,6 +593,14 @@ class read_hdf5_data:
self.box = np.array(box)
self.dim = self.ubound - self.lbound + 1
def get_box_range(self):
x = np.linspace(self.box[0, 0], self.box[1, 0], self.Array.shape[0])
y = np.linspace(self.box[0, 1], self.box[1, 1], self.Array.shape[1])
z = np.linspace(self.box[0, 2], self.box[1, 2], self.Array.shape[2])
return x, y, z
def export_cube(self, fname, origin=None):
"""
Export cube file
......@@ -615,7 +623,7 @@ class read_hdf5_data:
"""
vtk exporter for paraview
"""
from evtk.hl import gridToVTK
from pyevtk.hl import gridToVTK
import ase.units as un
gridToVTK(fname, self.xmesh*un.Bohr, self.ymesh*un.Bohr, self.zmesh*un.Bohr, pointData = {self.args.quantity: self.Array})
......@@ -700,6 +708,7 @@ class read_hdf5_data:
self.Rotxmesh = np.zeros(self.Array.shape, dtype = np.float32, order="F")
self.Rotymesh = np.zeros(self.Array.shape, dtype = np.float32, order="F")
self.Rotzmesh = np.zeros(self.Array.shape, dtype = np.float32, order="F")
self.RotArray = np.zeros(self.Array.shape, dtype = np.float32, order="F")
try:
import numba
......@@ -710,8 +719,8 @@ class read_hdf5_data:
if NUMBA:
from ase.mbpt_lcao_utils.numba_funcs import euler_rotation_mesh_numba
euler_rotation_mesh_numba(x, y, z, euler_mat, self.Rotxmesh,
self.Rotymesh, self.Rotzmesh)
euler_rotation_mesh_numba(x, y, z, self.Array, euler_mat, self.Rotxmesh,
self.Rotymesh, self.Rotzmesh, self.RotArray)
else:
warnings.warn("Numba import error, using python routine")
for i in range(self.Array.shape[0]):
......@@ -721,6 +730,7 @@ class read_hdf5_data:
self.Rotxmesh[i, j, k] = ind[0]
self.Rotymesh[i, j, k] = ind[1]
self.Rotzmesh[i, j, k] = ind[2]
self.RotArray[i, j, k] = self.Array[ind[0], ind[1], ind[2]]
class read_text_data:
......@@ -1190,6 +1200,7 @@ class MBPT_LCAO_Properties_figure:
self.bohr_rad = 0.52917721
self.figname = 'default'
self.cmap = None #cm.jet
self.cmap_lut = None
self.interpolation = "bicubic" # imshow interpolation
self.units = 'au'
self.interpolation = "bicubic"
......
......@@ -1249,6 +1249,8 @@ def plot_imshow_spatial(args, prop, ax, data, z):
if isinstance(pvm, str):
if pvm == "equal":
vminmax[i] = sign*np.max(abs(z))
elif pvm.split("_")[1] == "max":
vminmax[i] = float(pvm.split("_")[0])*np.max(z)
else:
vminmax[i] = float(pvm)*minmax
elif pvm is None:
......@@ -1259,13 +1261,15 @@ def plot_imshow_spatial(args, prop, ax, data, z):
raise ValueError("wrong option for prop.vmin or prop.vmax")
vmin, vmax = vminmax[0], vminmax[1]
#prop.vmin, prop.vmax = vminmax[0], vminmax[1]
cmap = cm.get_cmap(prop.cmap, lut=prop.cmap_lut)
z = z.T[::-1, :]
if prop.plan== 'x':
#im = plt.imshow(z, extent=[y_min, y_max, z_min, z_max], vmin=vmin, vmax = vmax)
ext = [y_min, y_max, z_min, z_max]
im = ax.imshow(z, extent=ext, cmap=cm.get_cmap(prop.cmap), vmin=vmin,
im = ax.imshow(z, extent=ext, cmap=cmap, vmin=vmin,
vmax=vmax, aspect=prop.aspect, interpolation=prop.interpolation)
r = abs(data.box[1][1]-data.box[0][1])/100
......@@ -1299,7 +1303,7 @@ def plot_imshow_spatial(args, prop, ax, data, z):
elif prop.plan == 'y':
#im = plt.imshow(z, extent=[x_min, x_max, z_min, z_max], vmin=vmin, vmax = vmax)
ext = [x_min, x_max, z_min, z_max]
im = ax.imshow(z, extent=ext, cmap=cm.get_cmap(prop.cmap), vmin=vmin,
im = ax.imshow(z, extent=ext, cmap=cmap, vmin=vmin,
vmax=vmax, aspect=prop.aspect, interpolation=prop.interpolation)
r = abs(data.box[1][0]-data.box[0][0])/100
......@@ -1331,7 +1335,7 @@ def plot_imshow_spatial(args, prop, ax, data, z):
elif prop.plan == 'z':
ext = [x_min, x_max, y_min, y_max]
im = ax.imshow(z, extent=ext, cmap=cm.get_cmap(prop.cmap), vmin=vmin,
im = ax.imshow(z, extent=ext, cmap=cmap, vmin=vmin,
vmax=vmax, aspect=prop.aspect, interpolation=prop.interpolation)
r = abs(data.box[1][0]-data.box[0][0])/100
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment