QuadraturePoints
- class QuadraturePoints(points_per_axis=None, num_axes=None)[source]
Bases:
object
Helper class that defines quadrature points.
Notes
This implements the Probabilist’s version of the Gauss-Hermite quadrature points. This consists of the Hermite polynomial
\[H_{e_n}(x) = (-1)^n \exp{\frac{x^2}{2}} \frac{\partial^n}{\partial x^n} \exp{-\frac{x^2}{2}}\]and its associated weights. For details see [17], [8] and for a multi-variate extension [11].
- points_per_axis
Number of points to use per axis
- Type:
int
- num_axes
Number of axis in each point. This can be set manually, but will be updated when
update_points()
is called to match the supplied mean.- Type:
int
- weights
Weight of each quadrature point
- Type:
numpy array
- points
Each row corresponds to a quadrature point and the total number of rows is the total number of points.
- Type:
M x N numpy array
Methods
Plots the weighted points.
Updates the quadrature points given some initial point and scale.
Attributes
Covariance of the points, accounting for the weights.
Mean of the points, accounting for the weights.
Read only expected number of points.
- plot_points(inds, x_lbl='X Position', y_lbl='Y Position', ttl='Weighted Positions', size_factor=10000, **kwargs)[source]
Plots the weighted points.
Keywrod arguments are processed with
gncpy.plotting.init_plotting_opts()
. This function implementsf_hndl
Any title/axis/text options
- Parameters:
inds (list or int) – Indices of the point vector to plot. Can be a list of at most 2 elements. If only 1 is given a bar chart is created.
x_lbl (string, optional) – Label for the x-axis. The default is ‘X Position’.
y_lbl (string, optional) – Label for the y-axis. The default is ‘Y Position’.
ttl (string, optional) – Title of the plot. The default is ‘Weighted positions’.
size_factor (int, optional) – Factor to multiply the weight by when determining the marker size. Only used if plotting 2 indices. The default is 100**2.
**kwargs (dict) – Additional standard plotting options.
- Returns:
fig – Handle to the figure used.
- Return type:
matplotlib figure handle
- update_points(mean, scale, have_sqrt=False)[source]
Updates the quadrature points given some initial point and scale.
- Parameters:
mean (N x 1 numpy array) – Point to represent by quadrature points.
scale (N x N numpy array) – Covariance or square root of the covariance matrix of the given point.
have_sqrt (bool) – Optional flag indicating if the square root of the matrix was supplied. The default is False.
- Return type:
None.
- property cov
Covariance of the points, accounting for the weights.
- property mean
Mean of the points, accounting for the weights.
- property num_points
Read only expected number of points.