예제 #1
0
class Interpolator(object):
    def __init__(self, fileName):
        try:
            from gridData import Grid
        except ModuleNotFoundError:
            raise ModuleNotFoundError("The dependency 'GridDataFormats' is required for this functionality!")
        
        self.grid = Grid(fileName) # stores the grid data
            
    def __call__(self, xyz):
        return self.grid.interpolated(xyz[:,0], xyz[:,1], xyz[:,2])
예제 #2
0
  attribute "dep" string "positions"
  object "regular positions regular connections" class field
  component "positions" value 1
  component "connections" value 2
  component "data" value 3
"""

edge1 = g.edges[0]
edge2 = g.edges[1]
edge3 = g.edges[2]

grid = g.grid

edges = g.edges

g.interpolated([1, 1, 1], [2, 3, 2], [2, 3, 2])

import numpy as np
# Visualization
from mpl_toolkits.mplot3d import Axes3D  # noqa: F401 unused import
import matplotlib.pyplot as plt

x = np.arange(30)
y = np.arange(30)
z = np.arange(30)

xx, yy, zz = np.meshgrid(x, y, z)

flat = grid.flatten()

flat[flat < 1] = 0
예제 #3
0
class Interpolator(object):
    def __init__(self, fileName):
        self.grid = Grid(fileName)  # stores the grid data

    def __call__(self, xyz):
        return self.grid.interpolated(xyz[:, 0], xyz[:, 1], xyz[:, 2])
예제 #4
0
        # if writepdb:
        #     with open(surface_fname, "a") as fid:
        #         fid.write(f"{len(x)*len(z)}\n\n")

        # for step_z in cylinder_grid:

        for j, step_z in enumerate(z):
            # layer[j] = np.array(
            #     [
            #         dat.interpolated(x, y, np.repeat(step_z, len(x)))
            #     ],
            #     dtype=np.float32,
            # )
            zcrd = np.repeat(step_z, len(x))
            xyz = np.vstack((x, y, zcrd))
            vals = dat.interpolated(*xyz)
            if run_charge_density:
                mean[j] += np.sum(vals)
                stddev[j] += np.var(vals)
            else:
                mean[j] = vals.mean()
                stddev[j] = vals.std()
            # print(x.min(), x.max(), y.min(), y.max(), step_z, mean.shape)
            # else:
            #     this_layer = np.array(
            #         [
            #             dat.interpolated(x, y, np.repeat(step_z, len(x))) / N
            #         ],
            #         dtype=np.float32,
            #     )
            #     layer.append( this_layer