gdsfactoryplus

GDSFactory+ python library.

Modules:

Name Description
bbox

Generate cell bbox.

cli

GDSFactory+ CLI.

cli_test

Test Component Builds.

core

GDSFactory+ core utilities.

explore

PDK exploration utilities.

export_spice

Uses VLSIRTools to convert from Klayout's DB Netlist to common spice formats.

freeze

Freeze a python cell as schematic netlist.

generate_svg

Generate SVG from cell.

lazy

Lazy module imports.

logger

GDSFactory+ Logger.

models

GDSFactory+ Pydantic models.

parse_oc_spice

Parse OC Spice.

project

Find the GDSFactory+ project folder.

serve

GDSFactory+ Server.

settings

Parse the GDSFactory+ settings.

show

Show a python object in a vscode panel.

version

Simply the GDSFactory+ version.

Classes:

Name Description
DoItForMe

DoItForMe Data.

ErrorMessage

A message to vscode to trigger an error popup.

RefreshTreesMessage

A message to vscode to trigger a pics tree reload.

ReloadLayoutMessage

A message to vscode to trigger a gds viewer reload.

ReloadSchematicMessage

A message to vscode to trigger a schematic reload.

RestartServerMessage

A message to vscode to trigger a server restart.

Result

Result class containing logs and errors to be returned.

ShowGdsMessage

A message to vscode to show a GDS.

ShowMessage

A message to vscode to show an object.

SimulationConfig

Data model for simulation configuration.

SimulationData

Data model for simulation.

UpdateProgressMessage

A message to vscode to update progress status.

User

User class containing user information from GDSFactory+.

Functions:

Name Description
activate_pdk_by_name

Activate a PDK by name and return the pdk.

build_cell

Build a cell given the path where it's defined and the cell name.

build_component_with_inserted_defaults

Build a component with inserted defaults.

check_conn

Run connectivity check on the given GDS file.

check_drc

Run DRC check on the given GDS file.

classify_cells

Classify cells.

clear_cells_from_cache

Clear cells from cache by factory names.

cli_environment

Get a CLI environment.

ensure_recursive_netlist

Ensure that a given object is a recursive netlist.

find_docode_project_dir

Find the GDSFactory+ project folder, return None if not found.

fix_log_line_numbers

Patches a different format for file + line nr combination into logs.

generate_multipolygon

Generate a MultiPolygon from a component.

get_base_schema

Get base netlist schema.

get_cell_path

Get the path of the file to which a cell belongs.

get_cells

Returns PCells (component functions) from a module or list of modules.

get_custom_cell_names

Get the project components of a pdk.

get_logger

Get the GDSFactory+ logger.

get_module

Get the module to which a cell belongs.

get_netlist_schema

Get the schema for a specific netlist.

get_pdk_cell_names

Get all the cell names of the foundry PDK.

get_pdk_graph

Get a graph of all cells and their dependencies in the PDK.

get_ports

Get the ports from a component.

get_python_cells

Get all python cells within a folder.

get_settings

Get the gdsfactoryplus settings.

get_svg

Get the (possible cached) svg for a cell.

get_top_level_cells

Get top level cells in th epdk graph with possibility to filer out some.

get_yaml_cell_name

Get the cell name of a yaml cell.

get_yaml_cell_path

Get the path of the file to which a yaml cell belongs.

get_yaml_cells

Get all yaml cells within a folder.

get_yaml_paths

Get all yaml pic paths within a folder.

guess_default_pcell_argument

Guess the default argument of a pcell.

ignore_prints

Ignore any output to stdout or stderr.

import_module_from_path

Import a python module given its name and path.

import_pdk

Import a pdk by name without activating.

import_pdk_from_path

Import a pdk by path to the pdk and give it a name.

import_python_modules

Import all python modules within a folder.

is_cell

Returns True if a function is a cell (component function).

is_from_module

Check if a member is part of a module.

is_shadowing_pdk_component

Check if a component name shadows a PDK component.

lazy_import

Lazily import a module.

lazy_setattr

Lazily set an attribute on a LazyModule.

list_cells_from_regex

Find all cells in a python file decorated with @cell using a regex.

load_kcl

Load KCL file.

maybe

Maybe execute a function, if it failes return None.

maybe_find_docode_project_dir

Find the GDSFactory+ project folder, raise FileNotFoundErorr if not found.

maybe_open

Maybe open a file, if opening fails use sys.stderr as file.

merge_rdb_strings

Merge RDB Strings.

optical_lvs

Perform optical lvs on a cell.

plot_pdk_relations

Plot PDK releationships with matplotlib.

print_to_file

Print content to a file.

register_cells

Register all cells in a given folder.

save_kcl

Save KCL file.

send_error

Show an error message in vscode.

send_message

Send a message to vscode.

show_cell

Show a cell in vscode.

try_get_ports

Maybe get the ports from a component, but return an empty dict otherwise.

validate_access

Validates the API key and returns the license information.

DoItForMe

Bases: BaseModel

DoItForMe Data.

ErrorMessage

Bases: BaseModel

A message to vscode to trigger an error popup.

RefreshTreesMessage

Bases: BaseModel

A message to vscode to trigger a pics tree reload.

ReloadLayoutMessage

Bases: BaseModel

A message to vscode to trigger a gds viewer reload.

ReloadSchematicMessage

Bases: BaseModel

A message to vscode to trigger a schematic reload.

RestartServerMessage

Bases: BaseModel

A message to vscode to trigger a server restart.

Result

Bases: BaseModel

Result class containing logs and errors to be returned.

ShowGdsMessage

Bases: BaseModel

A message to vscode to show a GDS.

ShowMessage

Bases: BaseModel

A message to vscode to show an object.

SimulationConfig

Bases: BaseModel

Data model for simulation configuration.

SimulationData

Bases: BaseModel

Data model for simulation.

UpdateProgressMessage

Bases: BaseModel

A message to vscode to update progress status.

User

Bases: BaseModel

User class containing user information from GDSFactory+.

activate_pdk_by_name

activate_pdk_by_name(pdk_name: str, *, register: bool = True) -> Pdk

Activate a PDK by name and return the pdk.

build_cell

build_cell(path: str, name: str = '') -> Callable[..., Component]

Build a cell given the path where it's defined and the cell name.

build_component_with_inserted_defaults

build_component_with_inserted_defaults(pcell_name: str) -> Component

Build a component with inserted defaults.

check_conn

check_conn(path: str | Path, *, verbose: bool = True) -> str

Run connectivity check on the given GDS file.

Parameters:

Name Type Description Default
path str | Path

path to the GDS file to run the check on.

required
verbose bool

if True, print status messages to stderr.

True

check_drc

check_drc(
    path: str | Path,
    pdk: str = pdk or name,
    process: str = process,
    timeout: int = timeout,
    host: str = host,
    api_key: str = key,
    *,
    verbose: bool = True,
) -> str

Run DRC check on the given GDS file.

Parameters:

Name Type Description Default
path str | Path

path to the GDS file to run the check on.

required
pdk str

PDK to use for the check.

pdk or name
process str

the drc rules might be slightly different depending on the process

process
timeout int

timeout in seconds for the check (DRC only).

timeout
host str

api host (DRC only).

host
api_key str

the api key (DRC only).

key
verbose bool

if True, print status messages to stderr.

True
Note

the connectivity check runs locally, so for this check the api parameters timeout, host, api_key will be ignored.

classify_cells

classify_cells(pdk: Pdk) -> tuple[_CellDict, _CellDict, _CellDict]

Classify cells.

clear_cells_from_cache

clear_cells_from_cache(*factory_names: str, remove_unnamed: bool = True) -> list[int]

Clear cells from cache by factory names.

cli_environment

cli_environment(
    ignore_stdout: bool, ignore_stderr: bool, pdk_name: str | None = None
) -> Generator[None, None, None]

Get a CLI environment.

ensure_recursive_netlist

ensure_recursive_netlist(obj: Any) -> dict

Ensure that a given object is a recursive netlist.

find_docode_project_dir

find_docode_project_dir() -> Path

Find the GDSFactory+ project folder, return None if not found.

fix_log_line_numbers

fix_log_line_numbers(content: str) -> str

Patches a different format for file + line nr combination into logs.

generate_multipolygon

generate_multipolygon(comp: Component) -> MultiPolygon

Generate a MultiPolygon from a component.

get_base_schema

get_base_schema() -> Schema

Get base netlist schema.

get_cell_path

get_cell_path(cell: Any, *, error_on_not_found: bool = False) -> str

Get the path of the file to which a cell belongs.

get_cells

get_cells(
    modules: Iterable[ModuleType],
    *,
    ignore_not_from_module: bool = True,
    ignore_non_decorated: bool = True,
    ignore_underscored: bool = False,
    ignore_partials: bool = False,
) -> dict[str, Callable[..., Component]]

Returns PCells (component functions) from a module or list of modules.

Parameters:

Name Type Description Default
modules Iterable[ModuleType]

A module or an iterable of modules.

required
ignore_not_from_module bool

only include functions that are from the module.

True
ignore_non_decorated bool

only include functions that are decorated with gf.cell

True
ignore_underscored bool

only include functions that do not start with '_'

False
ignore_partials bool

only include functions, not partials.

False

get_custom_cell_names

get_custom_cell_names(pdk: Pdk) -> list[str]

Get the project components of a pdk.

get_logger cached

get_logger() -> Logger

Get the GDSFactory+ logger.

get_module

get_module(cell: Any) -> str | None

Get the module to which a cell belongs.

get_netlist_schema

get_netlist_schema(netlist: dict) -> Schema

Get the schema for a specific netlist.

get_pdk_cell_names

get_pdk_cell_names(pdk_name: str) -> list[str]

Get all the cell names of the foundry PDK.

get_pdk_graph

get_pdk_graph() -> DiGraph

Get a graph of all cells and their dependencies in the PDK.

get_ports

get_ports(comp: str) -> dict[str, str]

Get the ports from a component.

get_python_cells

get_python_cells(
    folder: str, paths: list[str] | None = None, logger: Logger | None = None
) -> dict[str, Callable[..., Component]]

Get all python cells within a folder.

get_settings cached

get_settings() -> Settings

Get the gdsfactoryplus settings.

get_svg cached

get_svg(comp: Component, width: int, height: int, theme: str = 'dark') -> str

Get the (possible cached) svg for a cell.

get_top_level_cells

get_top_level_cells(
    g: DiGraph, *, no_fixed: bool = True, reverse: bool = False
) -> list[str]

Get top level cells in th epdk graph with possibility to filer out some.

get_yaml_cell_name

get_yaml_cell_name(path: str) -> str

Get the cell name of a yaml cell.

get_yaml_cell_path

get_yaml_cell_path(cell_name: str) -> str

Get the path of the file to which a yaml cell belongs.

get_yaml_cells

get_yaml_cells(
    folder: str, paths: list[str] | None = None
) -> dict[str, Callable[..., Component]]

Get all yaml cells within a folder.

get_yaml_paths

get_yaml_paths(folder: str, paths: list[str] | None = None) -> list[str]

Get all yaml pic paths within a folder.

guess_default_pcell_argument

guess_default_pcell_argument(
    pcell_name: str, argument_name: str, annotation: Any = None
) -> Any

Guess the default argument of a pcell.

ignore_prints

ignore_prints(stdout: bool = True, stderr: bool = False) -> Iterator[None]

Ignore any output to stdout or stderr.

import_module_from_path

import_module_from_path(module_name: str, file_path: str) -> ModuleType

Import a python module given its name and path.

import_pdk

import_pdk(pdk_name: str) -> Pdk

Import a pdk by name without activating.

import_pdk_from_path

import_pdk_from_path(path: str, pdk_name: str) -> Pdk

Import a pdk by path to the pdk and give it a name.

This is useful if the pdk is not installed in the current environment.

import_python_modules

import_python_modules(folder: str, logger: Logger | None = None) -> list[ModuleType]

Import all python modules within a folder.

is_cell

is_cell(
    func: Any,
    *,
    ignore_non_decorated: bool = False,
    ignore_underscored: bool = True,
    ignore_partials: bool = False,
    name: str = "",
) -> bool

Returns True if a function is a cell (component function).

Parameters:

Name Type Description Default
func Any

A function or partial function.

required
ignore_non_decorated bool

only include functions that are decorated with gf.cell

False
ignore_underscored bool

only include functions that do not start with '_'

True
ignore_partials bool

only include functions, not partials

False
name str

The name of the function.

''

is_from_module

is_from_module(member: Any, module: ModuleType, *, ignore_partials: bool) -> bool

Check if a member is part of a module.

is_shadowing_pdk_component

is_shadowing_pdk_component(pdk_name: str, name: str) -> bool

Check if a component name shadows a PDK component.

lazy_import

lazy_import(module_name: str, *callables: str) -> Any

Lazily import a module.

lazy_setattr

lazy_setattr(module_with_attrs: str, value: Any) -> None

Lazily set an attribute on a LazyModule.

list_cells_from_regex

list_cells_from_regex(py_path: str) -> list[str]

Find all cells in a python file decorated with @cell using a regex.

load_kcl

load_kcl() -> KCLayout

Load KCL file.

maybe

maybe(
    func: Callable[..., T], /, exc: type[Exception] = Exception
) -> Callable[..., T | None]

Maybe execute a function, if it failes return None.

maybe_find_docode_project_dir

maybe_find_docode_project_dir() -> Path | None

Find the GDSFactory+ project folder, raise FileNotFoundErorr if not found.

maybe_open

maybe_open(path: str, mode: str) -> Generator[TextIOWrapper, None, None]

Maybe open a file, if opening fails use sys.stderr as file.

merge_rdb_strings

merge_rdb_strings(*xml_strings: str) -> str

Merge RDB Strings.

optical_lvs

optical_lvs(
    cell: DKCell, ref: str, equivalent_ports: dict[str, list[list[str]]] | None = None
) -> ReportDatabase

Perform optical lvs on a cell.

plot_pdk_relations

plot_pdk_relations() -> None

Plot PDK releationships with matplotlib.

print_to_file

print_to_file(path: str, value: str) -> None

Print content to a file.

register_cells

register_cells(
    folder: str | None = None,
    yaml_cells: dict[str, Callable[..., Component]] | None = None,
    python_cells: dict[str, Callable[..., Component]] | None = None,
    logger: Logger | None = None,
) -> None

Register all cells in a given folder.

save_kcl

save_kcl() -> KCLayout

Save KCL file.

send_error

send_error(category: str, message: str, path: str) -> None

Show an error message in vscode.

send_message

send_message(message: Message) -> None

Send a message to vscode.

show_cell

show_cell(
    cell: ProtoTKCell | Path | str,
    lyrdb: ReportDatabase | Path | str | None = None,
    l2n: LayoutToNetlist | Path | str | None = None,
    keep_position: bool = True,
    save_options: SaveLayoutOptions | None = None,
    use_libraries: bool = True,
    library_save_options: SaveLayoutOptions | None = None,
    technology: str | None = None,
    **kwargs: Any,
) -> None

Show a cell in vscode.

try_get_ports

try_get_ports(comp: str) -> dict[str, str]

Maybe get the ports from a component, but return an empty dict otherwise.

validate_access

validate_access(
    pdk_name: str,
    api_key: str = "",
    pdk_key: str = "",
    *,
    check_pdk_access: bool = False,
) -> dict[str, Any]

Validates the API key and returns the license information.

On This Page