Source code#
Analytical#
Monte Carlo#
- class Result(binding)[source]#
Bases:
objectOutput container for an RSA simulation run.
Holds arrays plus domain metadata, computed statistics, and plotting helpers.
- property positions: ndarray#
Get the sphere center positions as a NumPy array of shape (N, 3).
- Returns:
Array of sphere center positions.
- Return type:
np.ndarray
- property radii: ndarray#
Get the sphere radii as a NumPy array of shape (N,).
- Returns:
Array of sphere radii.
- Return type:
np.ndarray
- property statistics#
Get the simulation statistics.
- Returns:
The simulation statistics.
- Return type:
Statistics
- property sphere_configuration#
Get the sphere configuration object.
- Returns:
The configuration of spheres in the simulation.
- Return type:
SphereConfiguration
- property domain#
Get the simulation domain.
- Returns:
The domain (box) dimensions and boundary conditions.
- Return type:
Domain
- compute_partial_pair_correlation_function(**kwargs) tuple[source]#
Compute the partial pair correlation function g_ij(r).
- Parameters:
**kwargs (dict) – Keyword arguments passed to the binding method.
- Returns:
A tuple containing: - centers (Quantity): The radial distances with units. - g_ij (np.ndarray): The partial pair correlation values.
- Return type:
tuple
- property partial_volume_fractions: ndarray#
Get the partial volume fractions of each component.
- Returns:
Array of partial volume fractions.
- Return type:
np.ndarray
- property partial_volumes: ndarray#
Get the partial volumes of each component.
- Returns:
Array of partial volumes.
- Return type:
np.ndarray
- compute_pair_correlation_function(**kwargs) None[source]#
Compute the total pair correlation function g(r).
- Parameters:
**kwargs (dict) – Keyword arguments passed to the binding method.
- property pair_correlation_centers: ndarray#
Get the radial centers for the pair correlation function.
- Returns:
Array of radial centers.
- Return type:
np.ndarray
- property pair_correlation_values: ndarray#
Get the values of the pair correlation function g(r).
- Returns:
Array of pair correlation values.
- Return type:
np.ndarray
- plot_centers_3d(maximum_points_3d: int = 10000) Figure[source]#
Plot the sphere centers in a 3D scatter plot.
- maximum_points_3dint
Maximum number of points to plot (subsampling if necessary).
- plt.Figure
The matplotlib Figure object containing the 3D scatter plot.
Extra Parameters#
- showbool
Whether to display the plot after creation.
- save_asstr, optional
If provided, save the figure to this path.
- figure_sizetuple, optional
Size of the figure in inches.
- tight_layoutbool, default=True
Whether to use tight layout for the figure.
- axesmatplotlib.axes.Axes, optional
Axes to draw on. If None, a new figure+axes are created.
- xscalestr, optional
X-axis scale type (e.g., ‘linear’, ‘log’).
- yscalestr, optional
Y-axis scale type (e.g., ‘linear’, ‘log’).
- xlimtuple, optional
X-axis limits as (min, max).
- ylimtuple, optional
Y-axis limits as (min, max).
- stylestr, default=plot_style
Matplotlib style to use for the plot.
- **kwargs
Additional keyword arguments to pass to the plotting function.
- returns:
Figure – The figure with the market prices plot.
- rtype:
matplotlib.figure.Figure
- plot_radius_distribution(bins: int = 40, density: bool = True, alpha: float = 0.85) Figure[source]#
Plot the distribution of sphere radii.
- binsint
Number of histogram bins.
- densitybool
Whether to normalize the histogram to form a probability density.
- alphafloat
Transparency level for the histogram bars.
Extra Parameters#
- showbool
Whether to display the plot after creation.
- save_asstr, optional
If provided, save the figure to this path.
- figure_sizetuple, optional
Size of the figure in inches.
- tight_layoutbool, default=True
Whether to use tight layout for the figure.
- axesmatplotlib.axes.Axes, optional
Axes to draw on. If None, a new figure+axes are created.
- xscalestr, optional
X-axis scale type (e.g., ‘linear’, ‘log’).
- yscalestr, optional
Y-axis scale type (e.g., ‘linear’, ‘log’).
- xlimtuple, optional
X-axis limits as (min, max).
- ylimtuple, optional
Y-axis limits as (min, max).
- stylestr, default=plot_style
Matplotlib style to use for the plot.
- **kwargs
Additional keyword arguments to pass to the plotting function.
- returns:
Figure – The figure with the market prices plot.
- rtype:
matplotlib.figure.Figure
- plot_slice_2d(slice_axis: Literal['x', 'y', 'z'] = 'z', slice_center_fraction: float = 0.5, slice_thickness_fraction: float = 0.08, maximum_circles_in_slice: int = 2500) Figure[source]#
Plot a 2D slice of the sphere configuration.
- slice_axisLiteral[“x”, “y”, “z”]
Axis along which to take the slice.
- slice_center_fractionfloat
Fractional position along the slice axis where the slice is centered (0.0 to 1.0).
- slice_thickness_fractionfloat
Fractional thickness of the slice relative to the box length along the slice axis (0.0 to 1.0).
- maximum_circles_in_sliceint
Maximum number of circles to plot in the slice (subsampling if necessary).
Extra Parameters#
- showbool
Whether to display the plot after creation.
- save_asstr, optional
If provided, save the figure to this path.
- figure_sizetuple, optional
Size of the figure in inches.
- tight_layoutbool, default=True
Whether to use tight layout for the figure.
- axesmatplotlib.axes.Axes, optional
Axes to draw on. If None, a new figure+axes are created.
- xscalestr, optional
X-axis scale type (e.g., ‘linear’, ‘log’).
- yscalestr, optional
Y-axis scale type (e.g., ‘linear’, ‘log’).
- xlimtuple, optional
X-axis limits as (min, max).
- ylimtuple, optional
Y-axis limits as (min, max).
- stylestr, default=plot_style
Matplotlib style to use for the plot.
- **kwargs
Additional keyword arguments to pass to the plotting function.
- returns:
Figure – The figure with the market prices plot.
- rtype:
matplotlib.figure.Figure
- plot_pair_correlation(n_bins: int = 80, maximum_pairs: int = 300000) Figure[source]#
Plot the partial pair correlation functions g_ij(r) obtained from the RSA configuration, overlaying all (i, j) curves on a single axis.
- n_binsint
Number of radial distance bins.
- maximum_pairsint
Number of Monte Carlo sampled pairs used for estimation.
- matplotlib.figure.Figure
Figure containing the overlaid plot of all g_ij(r) curves.
Extra Parameters#
- showbool
Whether to display the plot after creation.
- save_asstr, optional
If provided, save the figure to this path.
- figure_sizetuple, optional
Size of the figure in inches.
- tight_layoutbool, default=True
Whether to use tight layout for the figure.
- axesmatplotlib.axes.Axes, optional
Axes to draw on. If None, a new figure+axes are created.
- xscalestr, optional
X-axis scale type (e.g., ‘linear’, ‘log’).
- yscalestr, optional
Y-axis scale type (e.g., ‘linear’, ‘log’).
- xlimtuple, optional
X-axis limits as (min, max).
- ylimtuple, optional
Y-axis limits as (min, max).
- stylestr, default=plot_style
Matplotlib style to use for the plot.
- **kwargs
Additional keyword arguments to pass to the plotting function.
- returns:
Figure – The figure with the market prices plot.
- rtype:
matplotlib.figure.Figure