kqcircuits.simulations.epr.example

kqcircuits.simulations.epr.example.partition_regions(simulation: Simulation | Element, prefix: str = '') list[PartitionRegion][source]

Derives partition regions needed to simulate a single element. Function pointer can be either passed to get_single_element_sim_class as partition_region_function argument, or a manually implemented Simulation class could implement the get_partition_regions function such that it calls this function.

When KLayout is open in GUI mode, the partition region defined here can be visualised by enabling the _epr_show parameter and assigning layers for each partition region using _epr_part_reg_XXX_layer. For partition regions to be detected in GUI mode, they need to be listed in kqcircuits.simulations.epr.gui_config.

Parameters:
  • simulation – refpoints and parameters of the single element simulation are used to derive the partition regions

  • prefix – optional prefix differentiates sets of partition regions if extracted from multiple elements within simulation

Returns:

List of partition regions

kqcircuits.simulations.epr.example.correction_cuts(simulation: Simulation | Element, prefix: str = '') dict[str, dict][source]

Derives correction cuts for each partition region in a single element. This function is meant to be passed to get_epr_correction_simulations as correction_cuts argument. If a composition of multiple such functions is needed (for example simulation contains multiple elements, for each we want to calculate EPR), a function can be defined that returns a dict consisting of multiple correction_cuts calls, then that function can be passed to get_epr_correction_simulations.

When KLayout is open in GUI mode, the correction cuts defined here can be visualised by enabling the _epr_show parameter and assigning a layer for correction cuts using _epr_cross_section_cut_layer.

Parameters:
  • simulation – refpoints and parameters of the single element simulation are used to derive the partition regions

  • prefix – optional prefix differentiates sets of partition regions if extracted from multiple elements within simulation

Returns:

Configuration dict of correction cuts used by get_epr_correction_simulations

kqcircuits.simulations.epr.example.extract_from(simulation: Simulation | Element, refpoint_prefix: str, parameter_remap_function: Callable[[Simulation | Element, str], any]) Simulation[source]

To enable reusing partition_regions and correction_cuts functions for simulation that is composed of multiple single elements, implement extract_from function like this, where in the last list argument all simulation parameters (note: not refpoints) that were used to implement partition_regions and correction_cuts are listed.

../_images/kqcircuits.simulations.epr.example.png