stats
The statistics module for the pCubit package.
- class Generator(buffer=None, hull='automatic', hull_rel_tol=0.03, particle_statistics=None, pore_statistics=None, target_particle_volume_fraction=None, target_pore_volume_fraction=None, seed=None)
Bases:
objectA class for generating particles/pores based on given statistics.
Calling an instance of the class with the numbers of particles and/or pores as the keyword arguments
num_particlesandnum_poreswill generate and return the particles and/or pores (i.e. instances ofParticlesand/orPores).When a
Generatoris instantiated with a target particle/pore volume fraction, aPoissonpoint process governs the number of each size of the particles/pores being generated. In this case, the number of particles/pores is not specified when calling.- Note:
Discrete particle/pore
radiistatistics must be utilized when specifying a target particle/pore volume fraction, due to thePoissonpoint process being used.- Warning:
The volume fraction calculation currently ignores variations due to boundary/particle/pore overlap removal. If particles/pores are unlikely to overlap during placement and a buffer is used, this will not be an issue.
- property bounding_box
The bounding box of the convex hull, i.e. of
hull.- Returns:
numpy.ndarray: The bounding box.
- property hull
The convex hull in which particles/pores will be generated.
- Returns:
scipy.spatial.Delaunay: The convex hull.
- property hull_volume
The volume fo the convex hull.
- Returns:
float: The volume.
- property particle_statistics
The statistics for generating particles.
- Returns:
Statistics: The statistics.
- property pore_statistics
The statistics for generating pores.
- Returns:
Statistics: The statistics.
- property target_particle_volume_fraction
The target volume fraction for particle generation.
- Returns:
float: The volume fraction.
- property target_pore_volume_fraction
The target volume fraction for pore generation.
- Returns:
float: The volume fraction.
- class Poisson(intensity=None, sizes=array([1]), seed=None)
Bases:
objectThe Poisson distribution or point process class.
Calling an instance of the class with the number(s) of occurrences as the argument(s) returns the probability of those number(s) of occurrences.
For \(M\) disjoint intervals, the Poisson distribution describing the probability that there are \(n_j\) occurrences in the \(j\mathrm{th}\) th interval is
\[P(\mathbf{n}) = \prod_{j=1}^M \frac{(\lambda s_j)^{n_j}}{n_j!} \, e^{\lambda s_j} ,\]where \(s_j\) is size of the \(j\mathrm{th}\) interval, and \(\lambda\) is the Poisson process intensity.
Properties
Let the sum over the probabilities be denoted as
\[\langle f\rangle \equiv \sum_{i=1}^M \sum_{n_i=0}^\infty P(\mathbf{n}) f(\mathbf{n}) .\]The probability distribution is normalized,
\[\langle 1 \rangle = 1 ,\]and each expected number of occurences is intensity times multiplying the size,
\[\langle n_k \rangle = \lambda s_k .\]If the sizes are relative to the total size, i.e. if the sizes are discrete probabilities, the expected total number of occurences is \(\lambda\).
- property intensity
The Poisson intensity, \(\lambda\). In certain cases, this is also the expectation value for the (total) number of occurrences.
- Returns:
float: The intensity.
- sample(num_samples=1)
Draw samples from the distribution.
- Args:
- num_samples (int, optional, default=1):
The number of samples to draw.
- Returns:
numpy.ndarray: The samples.
- property sizes
The size(s) of the disjoint intervals.
- Returns:
numpy.ndarray: The size(s).
- class Statistics(location=None, radii=None, angles=None)
Bases:
objectA class for the statistics of pores/particles.
- property angles
The statistics for the angles of the particles/pores.
- Returns:
object: The angles statistics.
- property location
The statistics for the location of the particles/pores.
- Returns:
object: The location statistics.
- property radii
The statistics for the radii of the particles/pores.
- Returns:
object: The radii statistics.