3.4.10. horton.grid.visual
– Grids suitable for visualization¶
-
class
horton.grid.visual.
LineGrid
(p1, p2, size, extend=0)¶ Bases:
horton.grid.base.IntGrid
Arguments:
- p1, p2
- Two points defining the line segment
- size
- The number of grid points
Optional arguments:
- extend
- Used to control how far the grid points extrapolate from the line segment.
-
eval_decomposition
(*args, **kwargs)¶ Evaluate a spherical decomposition
Arguments:
- cubic_splines
- A list cubic splines, where each item is a radial function that is associated with a corresponding real spherical harmonic.
- center
- The center of the spherically symmetric function
- output
- The output array
Optional arguments:
- cell
- A unit cell when periodic boundary conditions are used.
-
eval_spline
(*args, **kwargs)¶ Evaluate a spherically symmetric function
Arguments:
- cubic_spline
- A cubic spline with the radial dependence
- center
- The center of the spherically symmetric function
- output
- The output array
Optional arguments:
- cell
- A unit cell when periodic boundary conditions are used.
-
integrate
(*args, **kwargs)¶ Integrate the product of all arguments
Arguments:
- data1, data2, ...
- All arguments must be arrays with the same size as the number of grid points. The arrays contain the functions, evaluated at the grid points, that must be multiplied and integrated.
Optional arguments:
- center=None
- When given, multipole moments are computed with respect to this center instead of a plain integral.
- lmax=0
- The maximum angular momentum to consider when computing multipole moments
- mtype=1
- The type of multipole moments: 1=``cartesian``, 2=``pure``, 3=``radial``, 4=``surface``.
- segments=None
- This argument can be used to divide the grid in segments. When given, it must be an array with the number of grid points in each consecutive segment. The integration is then carried out over each segment separately and an array of results is returned. The sum over all elements gives back the total integral.
-
zeros
()¶
-
p1
¶ The first point of the line segment
-
p2
¶ The second point of the line segment
-
points
¶ The grid points.
-
shape
¶ The shape of the grid.
-
size
¶ The size of the grid.
-
subgrids
¶ A list of grid objects used to construct this grid.
-
weights
¶ The grid weights.
-
x
¶ The 1D axis for the grid points, useful for plotting
\(p_1\) and \(p_2\) correspond to \(x_1=-|p_2-p_1|/2\) and \(x_2=+|p_2-p_1|/2\), respectively.
-
class
horton.grid.visual.
RectangleGrid
(origin, axis0, axis1, l0, h0, l1, h1)¶ Bases:
horton.grid.base.IntGrid
Arguments:
- origin
- The origin for the definition of the rectangle.
- axis0, axis1
- The basis vectors that define the plane of the rectangle and the 2D space in this plane.
- l0, h0
- The lowest and highest position along axis0. (These must be integers.) Hence, along the first axis, there are (h0-l0+1) grid points.
- l1, h1
- The lowest and highest position along axis1.
-
eval_decomposition
(*args, **kwargs)¶ Evaluate a spherical decomposition
Arguments:
- cubic_splines
- A list cubic splines, where each item is a radial function that is associated with a corresponding real spherical harmonic.
- center
- The center of the spherically symmetric function
- output
- The output array
Optional arguments:
- cell
- A unit cell when periodic boundary conditions are used.
-
eval_spline
(*args, **kwargs)¶ Evaluate a spherically symmetric function
Arguments:
- cubic_spline
- A cubic spline with the radial dependence
- center
- The center of the spherically symmetric function
- output
- The output array
Optional arguments:
- cell
- A unit cell when periodic boundary conditions are used.
-
integrate
(*args, **kwargs)¶ Integrate the product of all arguments
Arguments:
- data1, data2, ...
- All arguments must be arrays with the same size as the number of grid points. The arrays contain the functions, evaluated at the grid points, that must be multiplied and integrated.
Optional arguments:
- center=None
- When given, multipole moments are computed with respect to this center instead of a plain integral.
- lmax=0
- The maximum angular momentum to consider when computing multipole moments
- mtype=1
- The type of multipole moments: 1=``cartesian``, 2=``pure``, 3=``radial``, 4=``surface``.
- segments=None
- This argument can be used to divide the grid in segments. When given, it must be an array with the number of grid points in each consecutive segment. The integration is then carried out over each segment separately and an array of results is returned. The sum over all elements gives back the total integral.
-
prepare_contour
(data)¶ Returns arguments suitable for matplotlib.pyplot.contour
Arguments:
- data
- A vector with the correct number of elements (self.size)
Returns: suitable arguments for matplotlib.pyplot.contour
- x, y
- A numpy vector with the x and y axes (measured in units defined by the lengths of axis0 and axis1, respectively.
- z
- the same as data, transformed in a suitable 2D numpy array
-
zeros
()¶
-
axis0
¶ The first basis vector
-
axis1
¶ The second basis vector
-
h0
¶ The highest index along axis0
-
h1
¶ The highest index along axis1
-
l0
¶ The lowest index along axis0
-
l1
¶ The lowest index along axis1
-
origin
¶ The origin for the definition of the rectangle
-
points
¶ The grid points.
-
shape
¶ The shape of the grid.
-
size
¶ The size of the grid.
-
subgrids
¶ A list of grid objects used to construct this grid.
-
weights
¶ The grid weights.