monte_carlo_corners
- circuit_analyzer.all.monte_carlo_corners(circuit_model, wavelengths, inst_corners=None, fixed_hierarchy_insts=None, sample_size=100, parallel=False, parallel_option='number', seed=None, save_path=None)
Run a monte carlo simulation where each instance varies randomly across corners. Use fixed_hierarchy_insts to limit the variations inside specific hierarchical cells.
Use this method if you want to analyze a circuit with a mix of variation at large-scale, but fixing variations of subcircuits.
- 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 circuit instances wherein the corners should remain constant for each instance in the hierarchy.
- 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)
>>> with ca.setup('/path/to/configuration'): >>> result = ca.monte_carlo_corners( >>> circuit_model=cm, >>> wavelengths=wavelengths, >>> inst_corners={"dc": ["insertion_loss_corner"]}, >>> sample_size=100, >>> seed=0, >>> )