gdsfactory.technology.LayerViews#

class gdsfactory.technology.LayerViews(filepath: PathLike | None = None, layers: type[LayerEnum] | None = None, *, layer_views: dict[str, ~gdsfactory.technology.layer_views.LayerView] = <factory>, custom_dither_patterns: dict[str, ~gdsfactory.technology.layer_views.HatchPattern] = <factory>, custom_line_styles: dict[str, ~gdsfactory.technology.layer_views.LineStyle] = <factory>)[source]#

A container for layer properties for KLayout layer property (.lyp) files.

layer_views#

Dictionary of LayerViews describing how to display gds layers.

Type:

dict[str, gdsfactory.technology.layer_views.LayerView]

custom_dither_patterns#

Custom dither patterns.

Type:

dict[str, gdsfactory.technology.layer_views.HatchPattern]

custom_line_styles#

Custom line styles.

Type:

dict[str, gdsfactory.technology.layer_views.LineStyle]

layers#

Specify a layer_map to get the layer tuple based on the name of the LayerView, rather than the ‘layer’ argument.

Type:

type[kfactory.kcell.LayerEnum] | None

__init__(filepath: Path | str | None = None, layers: type[LayerEnum] | None = None, **data: Any) None[source]#

Initialize LayerViews object.

Parameters:
  • filepath – can be YAML or LYP.

  • layers – Optional layermap.

  • data – Additional data to add to the LayerViews object.

Methods

__init__([filepath, layers])

Initialize LayerViews object.

add_layer_view(name[, layer_view])

Adds a layer to LayerViews.

clear()

Deletes all layers in the LayerViews.

construct([_fields_set])

copy(*[, include, exclude, update, deep])

Returns a copy of the model.

dict(*[, include, exclude, by_alias, ...])

from_lyp(filepath[, layer_pattern])

Write all layer properties to a KLayout .lyp file.

from_orm(obj)

from_yaml(layer_file)

Import layer properties from two yaml files.

get(name)

Returns Layer from name.

get_from_tuple(layer_tuple)

Returns LayerView from layer tuple.

get_layer_tuples()

Returns a tuple for each layer.

get_layer_view_groups()

Return the LayerViews that contain other LayerViews.

get_layer_views([exclude_groups])

Return all LayerViews.

json(*[, include, exclude, by_alias, ...])

model_construct([_fields_set])

Creates a new instance of the Model class with validated data.

model_copy(*[, update, deep])

Usage docs: https://docs.pydantic.dev/2.10/concepts/serialization/#model_copy

model_dump(*[, mode, include, exclude, ...])

Usage docs: https://docs.pydantic.dev/2.10/concepts/serialization/#modelmodel_dump

model_dump_json(*[, indent, include, ...])

Usage docs: https://docs.pydantic.dev/2.10/concepts/serialization/#modelmodel_dump_json

model_json_schema([by_alias, ref_template, ...])

Generates a JSON schema for a model class.

model_parametrized_name(params)

Compute the class name for parametrizations of generic classes.

model_post_init(_BaseModel__context)

Override this method to perform additional initialization after __init__ and model_construct.

model_rebuild(*[, force, raise_errors, ...])

Try to rebuild the pydantic-core schema for the model.

model_validate(obj, *[, strict, ...])

Validate a pydantic model instance.

model_validate_json(json_data, *[, strict, ...])

Usage docs: https://docs.pydantic.dev/2.10/concepts/json/#json-parsing

model_validate_strings(obj, *[, strict, context])

Validate the given object with string data against the Pydantic model.

parse_file(path, *[, content_type, ...])

parse_obj(obj)

parse_raw(b, *[, content_type, encoding, ...])

preview_layerset([size, spacing])

Generates a Component with all the layers.

schema([by_alias, ref_template])

schema_json(*[, by_alias, ref_template])

to_lyp(filepath[, overwrite])

Write all layer properties to a KLayout .lyp file.

to_yaml(layer_file)

Export layer properties to a YAML file.

update_forward_refs(**localns)

validate(value)

Attributes

model_computed_fields

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_extra

Get extra fields set during validation.

model_fields

model_fields_set

Returns the set of fields that have been explicitly set on this model instance.

layer_views

custom_dither_patterns

custom_line_styles

layers