distribution
Distribution Module
This module provides various classes representing 2D pupil distributions.
Kramer Harrison, 2024
Functions
|
Create a distribution based on the given distribution type. |
Classes
Base class for distributions. |
|
A class representing a cross-shaped distribution. |
|
A class for Gaussian quadrature on circular domains, based on _[1]. |
|
A class representing a hexagonal distribution. |
|
|
A class representing a line distribution along the x-axis. |
|
A class representing a line distribution along the y-axis. |
|
A class representing a random distribution. |
RingDistribution class for generating points along a single ring. |
|
|
A class representing a Sobol distribution. |
Represents a uniform distribution of points within a square, which is |
- class BaseDistribution[source]
Base class for distributions.
- This class provides a base implementation for generating points and
visualizing the distribution.
- x
The x-coordinates of the generated points.
- y
The y-coordinates of the generated points.
- class CrossDistribution[source]
A class representing a cross-shaped distribution.
- This distribution generates points in the shape of a cross,
with the x-axis and y-axis as the arms of the cross.
If num_points is odd, it generates 2 * num_points - 1 points. If num_points is even and positive, it generates 2 * num_points points. num_points represents the number of points along the full extent of each axis before potential origin merging. If num_points is 0, 0 points are generated.
- x
Array of x-coordinates of the generated points.
- y
Array of y-coordinates of the generated points.
- generate_points(num_points: int)[source]
Generate points in the shape of a cross.
- Parameters:
num_points – The number of points to generate in each axis.
- view() tuple[Figure, Axes]
Visualize the distribution.
This method plots the distribution points and a unit circle for reference. :returns: A tuple containing the figure and axes of the plot.
- class GaussianQuadrature[source]
A class for Gaussian quadrature on circular domains, based on _[1].
Generates points in a circular pattern, with optimal placement for Gaussian quadrature over the unit disk. The total number of points is num_rings * num_spokes.
- x
Array of x-coordinates of the generated points.
- y
Array of y-coordinates of the generated points.
- weights
Array of weights, normalized to 1.0.
- generate_points(num_rings: int, num_spokes: int | None = None)[source]
Generate radially symmetric points. :param num_rings: Number of rings. :type num_rings: int :param num_angles: Number of spokes, by default None. If None, the
number of spokes is 4 * (num_rings + 1). In that case, the integration over the unit disk is exact for polynomials of degree num_rings in x and y.
- view() tuple[Figure, Axes]
Visualize the distribution.
This method plots the distribution points and a unit circle for reference. :returns: A tuple containing the figure and axes of the plot.
- class HexagonalDistribution[source]
A class representing a hexagonal distribution.
Generates points in a hexagonal pattern. The total number of points is 1 + 3 * num_rings * (num_rings + 1), including the center point.
- x
Array of x-coordinates of the generated points.
- y
Array of y-coordinates of the generated points.
- generate_points(num_rings: int = 6)[source]
Generate points in a hexagonal distribution.
- Parameters:
num_rings – Number of rings in the hexagonal distribution. Defaults to 6.
- view() tuple[Figure, Axes]
Visualize the distribution.
This method plots the distribution points and a unit circle for reference. :returns: A tuple containing the figure and axes of the plot.
- class LineXDistribution(positive_only: bool = False)[source]
A class representing a line distribution along the x-axis.
Generates num_points along the x-axis.
- positive_only
Flag indicating whether the distribution should be limited to positive values only.
- Type:
bool
- x
The x-coordinates of the generated points.
- y
The y-coordinates of the generated points.
- generate_points(num_points: int)[source]
Generates points along the x-axis based on the specified parameters.
- Parameters:
num_points (int) – The number of points to generate.
- view() tuple[Figure, Axes]
Visualize the distribution.
This method plots the distribution points and a unit circle for reference. :returns: A tuple containing the figure and axes of the plot.
- class LineYDistribution(positive_only: bool = False)[source]
A class representing a line distribution along the y-axis.
Generates num_points along the y-axis.
- positive_only
Flag indicating whether the distribution should be positive-only.
- x
The x-coordinates of the generated points.
- y
The y-coordinates of the generated points.
- generate_points(num_points: int)[source]
Generates points along the line distribution.
- Parameters:
num_points (int) – The number of points to generate.
- view() tuple[Figure, Axes]
Visualize the distribution.
This method plots the distribution points and a unit circle for reference. :returns: A tuple containing the figure and axes of the plot.
- class RandomDistribution(seed=None)[source]
A class representing a random distribution.
Generates num_points random points within the unit disk.
- rng
The random number generator from the backend.
- Type:
be.Generator
- x
The x-coordinates of the generated points.
- y
The y-coordinates of the generated points.
- generate_points(num_points: int)[source]
Generates random points.
- Parameters:
num_points (int) – The number of points to generate.
- view() tuple[Figure, Axes]
Visualize the distribution.
This method plots the distribution points and a unit circle for reference. :returns: A tuple containing the figure and axes of the plot.
- class RingDistribution[source]
RingDistribution class for generating points along a single ring.
Generates num_points along a single ring at the maximum aperture value (radius 1).
- generate_points(num_points: int)[source]
Generate points along a ring at the maximum aperture value.
- Parameters:
num_points (int) – The number of points to generate in each ring.
- view() tuple[Figure, Axes]
Visualize the distribution.
This method plots the distribution points and a unit circle for reference. :returns: A tuple containing the figure and axes of the plot.
- class SobolDistribution(seed: int | None = None)[source]
A class representing a Sobol distribution.
Generates num_points points using a Sobol low-discrepancy sequence within the unit disk.
- seed
Seed for the Sobol sequence generator.
- Type:
int | None
- x
The x-coordinates of the generated points.
- y
The y-coordinates of the generated points.
- generate_points(num_points: int)[source]
Generates Sobol points.
- Parameters:
num_points (int) – The number of points to generate.
- view() tuple[Figure, Axes]
Visualize the distribution.
This method plots the distribution points and a unit circle for reference. :returns: A tuple containing the figure and axes of the plot.
- class UniformDistribution[source]
- Represents a uniform distribution of points within a square, which is
masked to the unit disk.
Generates points on a square grid of num_points x num_points and then masks them to the unit disk. The resulting number of points is approximately num_points^2 * pi / 4.
- x
The x-coordinates of the generated points.
- y
The y-coordinates of the generated points.
- generate_points(num_points: int)[source]
Generates a grid of points within the unit disk.
- Parameters:
num_points (int) – The number of points along each axis to generate.
- view() tuple[Figure, Axes]
Visualize the distribution.
This method plots the distribution points and a unit circle for reference. :returns: A tuple containing the figure and axes of the plot.
- create_distribution(distribution_type: DistributionType) BaseDistribution[source]
Create a distribution based on the given distribution type.
- Parameters:
distribution_type – The type of distribution to create.
- Returns:
An instance of the specified distribution type.
- Raises:
ValueError – If an invalid distribution type is provided.