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, trans_path: List[DCplxTrans], parameters: Dict, parent_name: str, name: str, refpoints: dict)[source]
Bases:
objectAll junction properties we want to store when extracting junctions
- kqcircuits.util.replace_junctions.extract_junctions(top_cell: Cell, tuned_junction_parameters: Dict, halt_on_missing_params: bool = True, check_paramset: bool = True, old_translation: bool = False) 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 “junction_type” in tuned_junction_parameters is changed from top_cell, then tuned_junction_parameters should also include parameters exclusive to new “junction_type”.
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, then depending on halt_on_missing_params argument, extract_junctions will either raise an exception, or simply print a warning.
To prevent parameter schema checking, set check_paramset to False. This could be useful if you’re only interested in junction locations.
Junctions will be transformed such that the chip face where the junctions preside is facing the viewer. For some chips this means that the layout gets mirrored. By default, mirrored chip is also translated so that bottom left corner is at origin. If old_translation is set to True, it will leave chip translation in place, only performing mirroring.
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, old_translation: bool = False) 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.
Layout will be transformed such that the chip is facing the viewer. For some chips this means that the layout gets mirrored. By default, mirrored chip is also translated so that bottom left corner is at origin. If old_translation is set to True, it will leave chip translation in place, only performing mirroring.