NormalDistribution
- class circuit_analyzer.all.NormalDistribution
A Normal (Gaussian) distribution with preset PDF and correlation function.
This class wraps the general Distribution interface with a normal distribution probability density function (PDF), and provides a default correlation function based on a specified correlation coefficient.
- Parameters:
- mufloat
Mean of the normal distribution. Passed as keyword argument at initialization.
- sigmafloat
Standard deviation of the normal distribution. Passed as keyword argument at initialization.
- afloat, optional
Lower bound of the support of the distribution.
- bfloat, optional
Upper bound of the support of the distribution.
- sample_size: int
The number of samples taken from the distribution. The samples are stored in self.samples.
- seedNone or int or
numpy.random.RandomState
instance, optional This parameter defines the RandomState object to use for drawing random variates. If None (or np.random), the global np.random state is used. If integer, it is used to seed the local RandomState instance. Default is None.
- namestr, optional
Name of the distribution.
- correlates_toIterable, optional
Arguments to be passed to the default correlation function. Should be a list of the form: [other_distribution, rho], where:
other_distribution is another NormalDistribution instance.
rho is a float between -1 and 1, representing the correlation coefficient.
Notes
This class uses a preset normal distribution PDF:
pdf(x, mu, sigma) = (1 / (sigma * sqrt(2π))) * exp(-0.5 * ((x - mu) / sigma)^2)
where mu and sigma must be provided as keyword arguments when initializing the instance.
It also uses a default correlation function that applies Cholesky-based correlation between two distributions, adjusting samples as:
X_correlated = ρ * X_other + sqrt(1 - ρ²) * X_self
This is automatically applied if correlates_to is provided.
Examples
>>> import circuit_analyzer.all as ca >>> distribution = { >>> "n_eff": ca.NormalDistribution( >>> mu=2.4, >>> sigma=0.001, >>> a=2.397, >>> b=2.403, >>> sample_size=80, >>> name="n_eff", >>> seed=0, >>> ), >>> }