# Diff of /branches/stage3.1/doc/examples/cookbook/cblib2.py

revision 2944 by jfenwick, Thu Feb 4 01:42:47 2010 UTC revision 2945 by jfenwick, Wed Feb 24 00:17:46 2010 UTC
# Line 29  Author: Antony Hallam antony.hallam@uqco Line 29  Author: Antony Hallam antony.hallam@uqco
29  import numpy as np  import numpy as np
30  from esys.escript import Data  from esys.escript import Data
31  from esys.escript.pdetools import Locator  from esys.escript.pdetools import Locator
32    from cblib import toXYTuple
33
34  # Calculate the location of quivers for a matplotlib plot  # Calculate the location of quivers for a matplotlib plot
35  # quivshape :: [x,y] :: number of quivers in x and y direction  # quivshape :: [x,y] :: number of quivers in x and y direction
# Line 52  def toQuivLocs(quivshape,lenxax,lenyax,q Line 53  def toQuivLocs(quivshape,lenxax,lenyax,q
53      qulocs = np.array(qulocs) #turn into a numpy array      qulocs = np.array(qulocs) #turn into a numpy array
54      return qu,qulocs      return qu,qulocs
55

# Extract the X and Y coordinates of an array
# coords :: escript coordiantes from .getX function
def toXYTuple(coords):
coords = np.array(coords.toListOfTuples()) #convert to Tuple
coordX = coords[:,0]; coordY = coords[:,1] #X and Y components.
return coordX,coordY

56  def toRegGrid(grid,domain,newx,newy,width,depth):  def toRegGrid(grid,domain,newx,newy,width,depth):
57      import pylab as pl      import pylab as pl
58      oldspacecoords=domain.getX()      oldspacecoords=domain.getX()

Legend:
 Removed from v.2944 changed lines Added in v.2945