correlated_parameter_distributions
- circuit_analyzer.all.correlated_parameter_distributions(names, means, cov, sample_size, seed=None)
Generate a dictionary of correlated normal distributions.
- Parameters:
- nameslist
list of names of the parameters that you want to sample. If a parameter is a list, tuple or an array, for instance ‘name = [1, 2, 4]’, then split that parameter into ‘name:0’, ‘name:1’ and ‘name:2’.
- meanslist
list of the means of the parameters that you want to sample. Same length of ‘names’.
- cov: np.ndarray
covariance matrix
- sample_sizeint
number of 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.
- Returns:
- parameter_distributiondict
a dict with per parameter name a normal distribution.
Examples
>>> import circuit_analyzer.all as ca >>> import numpy as np >>> var_n_eff = 0.01**2 >>> var_n_g = 0.01**2 >>> var_loss_dB_cm = 0.1**2 >>> var_sc_1 = (0.5**0.5 * 0.01) ** 2 >>> var_sc_2 = (0.5**0.5 * 0.01) ** 2 >>> covar1 = 0.5 * np.sqrt(var_n_eff * var_n_g) >>> covar2 = np.sqrt(var_sc_1 * var_sc_2) >>> parameter_distribution = ca.correlated_parameter_distributions( >>> names=["n_eff", "n_g", "loss_dB_cm", "straight_coupling1", "straight_coupling2"], >>> means=[1.0, 2.0, 2.0, 0.5**0.5, 0.5**0.5], >>> cov=np.array( >>> [ >>> [var_n_eff, covar1, 0.0, 0.0, 0.0], >>> [covar1, var_n_g, 0.0, 0.0, 0.0], >>> [0.0, 0.0, var_loss_dB_m, 0.0, 0.0], >>> [0.0, 0.0, 0.0, var_sc_1, covar2], >>> [0.0, 0.0, 0.0, covar2, var_sc_2], >>> ] >>> ), >>> sample_size=80, >>> seed=0, >>> )