# Path: orbkit/grid.py
# def grid_init(is_vector=False, force=False):
# def get_grid(start='\t'):
# def tolist():
# def todict():
# def get_shape():
# def set_grid(xnew,ynew,znew,is_vector):
# def set_boundaries(is_regular,Nx=None,Ny=None,Nz=None):
# def get_bbox():
# def grid2vector():
# def vector2grid(Nx,Ny,Nz):
# def matrix_grid2vector(matrix): 
# def matrix_vector2grid(matrix,Nx=None,Ny=None,Nz=None): 
# def mv2g(**kwargs):
# def grid_sym_op(symop):
# def grid_translate(dx,dy,dz):
# def rot(ang,axis):
# def reflect(plane):
# def inversion():
# def sph2cart_vector(r,theta,phi):
# def cyl2cart_vector(r,phi,zed):
# def random_grid(geo_spec,N=1e6,scale=0.5):
# def read(filename, comment='#'):
#   def check(i, is_vector):
# def adjust_to_geo(qc,extend=5.0,step=0.1):
# def check_atom_select(atom,geo_info,geo_spec,interactive=True,
#                       display=sys.stdout.write):
# def center_grid(ac,display=sys.stdout.write):
# def reset_grid():
#   N_ = [len(x),len(y),len(z)]
#     N_ = [Nx,Ny,Nz]
#   P=[numpy.zeros((3,1)), numpy.reshape(ac,(3,1))]
#   N_   = [len(grid[0]), len(grid[1]), len(grid[2])]
#   N_   = [ 101,  101,  101]
# N_   = [ 101,  101,  101]   #: Specifies the number of grid points (regular grid).
# 
# Path: orbkit/output/tools.py
# def meshgrid2(*arrs):
#   '''adapted from:
#   http://stackoverflow.com/a/1830192
#   '''
#   arrs = tuple(reversed(arrs)) 
#   lens = list(map(len, arrs))
#   dim = len(arrs)
#   
#   sz = 1
#   for s in lens:
#       sz*=s
#   
#   ans = []    
#   for i, arr in enumerate(arrs):
#     slc = [1]*dim
#     slc[i] = lens[i]
#     arr2 = numpy.asarray(arr).reshape(slc)
#     for j, sz in enumerate(lens):
#       if j!=i:
#         arr2 = arr2.repeat(sz, axis=j) 
#     ans.append(arr2)
#   
#   return tuple(ans[::-1])


import numpy
from orbkit import grid
from .tools import meshgrid2
    from enthought.traits.api import HasTraits, Range, Instance, on_trait_change, Bool, Str,List,Button
    from enthought.traitsui.api import View, Item, Group, ListStrEditor,HSplit,VSplit
    from traits.api import HasTraits, Range, Instance, on_trait_change, Bool, Str,List,Button
    from traitsui.api import View, Item, Group, ListStrEditor,HSplit,VSplit
    from enthought.mayavi import mlab
    from enthought.mayavi.core.api import PipelineBase
    from enthought.mayavi.core.ui.api import MayaviScene, SceneEditor, MlabSceneModel
    from mayavi import mlab
    from mayavi.core.api import PipelineBase
    from mayavi.core.ui.api import MayaviScene, SceneEditor, MlabSceneModel
  from copy import deepcopy
  data : numpy.ndarray, shape=(len(x), len(y),len(z)) or shape=(N, len(x), len(y),len(z))
    Contains the output data.
  geo_spec : 
    See :ref:`Central Variables` for details.
    If not None, the atom positions will be drawn additionally.
  datalabels : None or list of str
    Contains information about the plotted data with len(datalabels) == len(data).
  '''
  try:
  except ImportError:
  
  try:
  except ImportError:
  
  data = numpy.array(data)
  
  if data.ndim == 3:
    data = data[numpy.newaxis]
  elif is_vectorfield and data.ndim == 4:
    data = data[numpy.newaxis]

  if geo_spec is not None and numpy.ndim(geo_spec) == 2:
      geo_spec = [geo_spec for i in range(len(data))]
  
  if datalabels is not None and len(datalabels) < len(data):
    raise ValueError('`datalabels` has to be a list of strings with the same' +
                     'length as `data`.')
  if datalabels is not None:
    datalabels = ['%03d: %s' % (i,j) for i,j in enumerate(datalabels[:len(data)])]
  

# Path: orbkit/grid.py
# def grid_init(is_vector=False, force=False):
# def get_grid(start='\t'):
# def tolist():
# def todict():
# def get_shape():
# def set_grid(xnew,ynew,znew,is_vector):
# def set_boundaries(is_regular,Nx=None,Ny=None,Nz=None):
# def get_bbox():
# def grid2vector():
# def vector2grid(Nx,Ny,Nz):
# def matrix_grid2vector(matrix): 
# def matrix_vector2grid(matrix,Nx=None,Ny=None,Nz=None): 
# def mv2g(**kwargs):
# def grid_sym_op(symop):
# def grid_translate(dx,dy,dz):
# def rot(ang,axis):
# def reflect(plane):
# def inversion():
# def sph2cart_vector(r,theta,phi):
# def cyl2cart_vector(r,phi,zed):
# def random_grid(geo_spec,N=1e6,scale=0.5):
# def read(filename, comment='#'):
#   def check(i, is_vector):
# def adjust_to_geo(qc,extend=5.0,step=0.1):
# def check_atom_select(atom,geo_info,geo_spec,interactive=True,
#                       display=sys.stdout.write):
# def center_grid(ac,display=sys.stdout.write):
# def reset_grid():
#   N_ = [len(x),len(y),len(z)]
#     N_ = [Nx,Ny,Nz]
#   P=[numpy.zeros((3,1)), numpy.reshape(ac,(3,1))]
#   N_   = [len(grid[0]), len(grid[1]), len(grid[2])]
#   N_   = [ 101,  101,  101]
# N_   = [ 101,  101,  101]   #: Specifies the number of grid points (regular grid).
# 
# Path: orbkit/output/tools.py
# def meshgrid2(*arrs):
#   '''adapted from:
#   http://stackoverflow.com/a/1830192
#   '''
#   arrs = tuple(reversed(arrs)) 
#   lens = list(map(len, arrs))
#   dim = len(arrs)
#   
#   sz = 1
#   for s in lens:
#       sz*=s
#   
#   ans = []    
#   for i, arr in enumerate(arrs):
#     slc = [1]*dim
#     slc[i] = lens[i]
#     arr2 = numpy.asarray(arr).reshape(slc)
#     for j, sz in enumerate(lens):
#       if j!=i:
#         arr2 = arr2.repeat(sz, axis=j) 
#     ans.append(arr2)
#   
#   return tuple(ans[::-1])


# Path: orbkit/output/mayavi_interface.py
import numpy
from orbkit import grid
from .tools import meshgrid2
    from enthought.traits.api import HasTraits, Range, Instance, on_trait_change, Bool, Str,List,Button
    from enthought.traitsui.api import View, Item, Group, ListStrEditor,HSplit,VSplit
    from traits.api import HasTraits, Range, Instance, on_trait_change, Bool, Str,List,Button
    from traitsui.api import View, Item, Group, ListStrEditor,HSplit,VSplit
    from enthought.mayavi import mlab
    from enthought.mayavi.core.api import PipelineBase
    from enthought.mayavi.core.ui.api import MayaviScene, SceneEditor, MlabSceneModel
    from mayavi import mlab
    from mayavi.core.api import PipelineBase
    from mayavi.core.ui.api import MayaviScene, SceneEditor, MlabSceneModel
  from copy import deepcopy

  data : numpy.ndarray, shape=(len(x), len(y),len(z)) or shape=(N, len(x), len(y),len(z))
    Contains the output data.
  geo_spec : 
    See :ref:`Central Variables` for details.
    If not None, the atom positions will be drawn additionally.
  datalabels : None or list of str
    Contains information about the plotted data with len(datalabels) == len(data).
  '''
  try:
  except ImportError:
  
  try:
  except ImportError:
  
  data = numpy.array(data)
  
  if data.ndim == 3:
    data = data[numpy.newaxis]
  elif is_vectorfield and data.ndim == 4:
    data = data[numpy.newaxis]

  if geo_spec is not None and numpy.ndim(geo_spec) == 2:
      geo_spec = [geo_spec for i in range(len(data))]
  
  if datalabels is not None and len(datalabels) < len(data):
    raise ValueError('`datalabels` has to be a list of strings with the same' +
                     'length as `data`.')
  if datalabels is not None:
    datalabels = ['%03d: %s' % (i,j) for i,j in enumerate(datalabels[:len(data)])]
  

  Z,Y,X = meshgrid2(z,y,x)