monte_carlo_cmv_global
- circuit_analyzer.all.monte_carlo_cmv_global(circuit_model, wavelengths, inst_corners=None, fixed_hierarchy_insts=None, distributions=None, correlation_matrix=None, sample_size=100, parallel=False, parallel_option='number', seed=None, save_path=None)
Run a monte carlo simulation where one or more parameters are modified globally.
This method modifies all properties that are defined in the variability configuration. When a parameter goes beyond the window, it is clipped to the min/max corner value.
This method differs from monte_carlo_global in that it modifies the parameters of the CircuitModelView. monte_carlo_global modifies the CompactModel parameters directly.
- Parameters:
- circuit_model: CircuitModel
IPKISS CircuitModel used in the simulation.
- wavelengths: array-like
An array of wavelengths, for instance: np.linspace(1.54, 1.56, 1001).
- inst_corners: dict
Dictionary mapping the name of the instances to the list of fab corner parameters (for instance [‘s’, ‘t’]) that you want to vary. By default, each instance will vary one of their fab corner parameters.
- fixed_hierarchy_insts: list
List of names of the instances wherein the variability should remain constant for each instance in the hierarchy.
- distributions: dict
- correlation_matrix: numpy.ndarray, optional
Correlation matrix of the distributions. If not provided, an identity matrix will be used, indicating no correlation.
- sample_size: int, default = 100
Number of Monte Carlo simulations
- parallel: bool, optional
Parallelize the calculations to potentially reduce the simulation time.
- parallel_option: str
String of what to parallelize, either over ‘wavelengths’ or over the ‘number’ of simulations. Options are ‘wavelengths’ or ‘number’.
- seed: int, optional
Seed of the random generator.
- save_path: str/path, optional
Path where the save file will be stored, for instance: save_path = “simulation_results.data”.
- Returns:
- an array of S matrices, one S matrix per sampling.
Examples
>>> import circuit_analyzer.all as ca >>> cell = MZI() >>> cm = cell.CircuitModel() >>> >>> wavelengths = np.linspace(1.5, 1.6, 501)
>>> s = cm.get_smatrix(wavelengths=wavelengths) # will give the nominal >>> with ca.setup('/path/to/configuration'): >>> smats = monte_carlo_cmv_global( >>> circuit_model=cm, >>> wavelengths=wavelengths, >>> sample_size=100, >>> parallel=False, >>> seed=0, >>> distributions={ >>> "neff": partial(NormalDistribution, mu=4.3, sigma=0.001), >>> }, >>> )