pyfracval.particle_generation ============================= .. py:module:: pyfracval.particle_generation .. autoapi-nested-parse:: Functions for generating primary particle radii. Module Contents --------------- .. py:function:: random_normal_custom() Generates a normally distributed random number using the Ziggurat method as implemented in numpy, which is generally preferred over custom acceptance-rejection methods unless specific properties are needed. .. py:function:: lognormal_pp_radii(rp_gstd, rp_g, n, seed = None, truncate = True) Generate N random radii from a lognormal distribution. :param rp_gstd: Geometric standard deviation of the distribution (must be >= 1.0). If 1.0, generates monodisperse particles. :type rp_gstd: float :param rp_g: Geometric mean radius of the distribution (must be > 0). :type rp_g: float :param n: Number of radii to generate. :type n: int :param seed: Random seed for reproducibility, by default None. :type seed: int | None, optional :param truncate: Use the FracVAL 2*sigma truncate version :type truncate: bool, optional :returns: A 1D NumPy array of N generated radii. :rtype: np.ndarray :raises ValueError: If `rp_g` is not positive. .. rubric:: Notes Uses `numpy.random.lognormal`. The underlying normal distribution's parameters are mu=log(rp_g) and sigma=log(rp_gstd). The original Fortran code included optional truncation at approximately +/- 2 geometric standard deviations; this is not enabled by default here.