kqcircuits.util.replace_junctions

Functions to tune and replace junctions in existing design files.

See scripts/macros/export/export_tuned_junctions.lym for a use case of these functions

class kqcircuits.util.replace_junctions.JunctionEntry(class_type: type, trans: DCplxTrans, parameters: Dict, parent_name: str, name: str)[source]

Bases: object

All junction properties we want to store when extracting junctions

kqcircuits.util.replace_junctions.extract_junctions(top_cell: Cell, tuned_junction_parameters: Dict) List[JunctionEntry][source]

Extracts all junction elements placed in the top_cell. Junction parameters are tuned according to tuned_junction_parameters dict.

tuned_junction_parameters is a dict with junction’s parent cell name as key, where parent cell is an element that contains the junction, e.g. “QB1”, “testarray_nw” etc. The value is also a dict, with junction cell’s name as key, e.g “squid”, “squid_0”, “squid_3” etc. For example testarray cells may have multiple junction cells. Then tuned_junction_parameters[parent_name][name] is a dict of junction parameters.

If top_cell has pcell data, the parameter values that are missing in tuned_junction_parameters can be inferred from the Junction PCell’s values. So tuned_junction_parameters may only contain parameter values that are different from how junctions were defined in top_cell.

If top_cell has no pcell data, tuned_junction_parameters must include all parameter keys of the junction parameter schema for each junction contained in the top_cell, even if the parameter values are the same as were used to construct top_cell. If that is not the case, extract_junctions will raise an exception.

Returns a list of JunctionEntry objects that can be used to place the extracted junctions into another cell that has tuned parameters but is otherwise identical in shape, placement and orientation.

Junction type may also be changed, if junction_type is tuned to have some other junction class name. For every junction that has its junction_type changed, even if the cell contains PCell data, tuned_junction_parameters should have at least all parameters present that are in the new junction type but not in the old junction type.

kqcircuits.util.replace_junctions.check_static_cell_has_junctions(top_cell: Cell) bool[source]

Perform quick check on a static chip cell if it contains a junction.

Args: top_cell - top cell of the chip

Returns: True if chip contains at least one junction.

kqcircuits.util.replace_junctions.place_junctions(top_cell: Cell, junctions: List[JunctionEntry]) None[source]

Places junctions to top_cell in the same location and orientation as in the cell they were extracted from, but with possibly tuned parameters.

kqcircuits.util.replace_junctions.get_tuned_junction_json(junctions: List[JunctionEntry]) Dict[source]

Returns a jsonable dict of all junction parameters for each junction entry in junctions.

If junctions were extracted from a cell with pcell data, the json can be extracted to have an exhaustive list of all junction parameters so that junctions can then be tuned using a cell with no pcell data, which is faster to read.

kqcircuits.util.replace_junctions.copy_one_layer_of_cell(write_path: str, top_cell: Cell, junctions: List[JunctionEntry], layer_string: str) None[source]

Extracts all geometry in top_cell at layer layer_string and saves the geometry into a new file at write_path. The face of the layer is determined from junctions parameters.

This can be used to extract geometry of alignment markers as well as other geometry to visualize junctions within a context of surrounding elements. The file at write_path may be loaded later and junctions may be placed using place_junctions into the top cell of the file, then saved again.

kqcircuits.util.replace_junctions.replace_squids(cell, junction_type, parameter_name, parameter_start, parameter_step, parameter_end=None)[source]

DEPRECATED! Replaces squids by code generated squids with the given parameter sweep.

All squids below top_cell in the cell hierarchy are removed. The number of code generated squids may be limited by the value of parameter_end.

Parameters:
  • cell (Cell) – The cell where the squids to be replaced are

  • junction_type – class name of the code generated squid that replaces the other squids

  • parameter_name (str) – Name of the parameter to be swept

  • parameter_start – Start value of the parameter

  • parameter_step – Parameter value increment step

  • parameter_end – End value of the parameter. If None, there is no limit for the parameter value, so that all squids are replaced

kqcircuits.util.replace_junctions.replace_squid(top_cell, inst_name, junction_type, mirror=False, squid_index=0, **params)[source]

DEPRECATED! Replaces a SQUID by the requested alternative in the named instance.

Replaces the SQUID(s) in the sub-element(s) named inst_name with other SQUID(s) of junction_type. The necessary SQUID parameters are specified in params. If inst_name is a Test Structure then squid_index specifies which SQUID to change.

Parameters:
  • top_cell – The top cell with SQUIDs to be replaced

  • inst_name – Instance name of PCell containing the SQUID to be replaced

  • junction_type – Name of SQUID Class or .gds/.oas file

  • mirror – Mirror the SQUID along its vertical axis

  • squid_index – Index of the SQUID to be replaced within a Test Structure

  • **params – Extra parameters for the new SQUID

kqcircuits.util.replace_junctions.convert_cells_to_static(layout)[source]

DEPRECATED! Converts all cells in the layout to static.

../_images/kqcircuits.util.replace_junctions.png