gdsfactory.technology.LayerViews#
- class gdsfactory.technology.LayerViews(filepath=None, layers=None, *, layer_views=<factory>, custom_dither_patterns=<factory>, custom_line_styles=<factory>)[source]#
A container for layer properties for KLayout layer property (.lyp) files.
- Parameters:
filepath (PathLike | None)
layers (type[LayerEnum] | None)
layer_views (dict[str, LayerView])
custom_dither_patterns (dict[str, HatchPattern])
custom_line_styles (dict[str, LineStyle])
- layer_views#
Dictionary of LayerViews describing how to display gds layers.
- Type:
dict[str, 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.layer.LayerEnum] | None
- __init__(filepath=None, layers=None, **data)[source]#
Initialize LayerViews object.
- Parameters:
filepath (Path | str | None) – can be YAML or LYP.
layers (type[LayerEnum] | None) – Optional layermap.
data (Any) – Additional data to add to the LayerViews object.
- Return type:
None
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])!!! abstract "Usage Documentation"
model_dump(*[, mode, include, exclude, ...])!!! abstract "Usage Documentation"
model_dump_json(*[, indent, ensure_ascii, ...])!!! abstract "Usage Documentation"
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(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, extra, ...])Validate a pydantic model instance.
model_validate_json(json_data, *[, strict, ...])!!! abstract "Usage Documentation"
model_validate_strings(obj, *[, strict, ...])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_fieldsmodel_configConfiguration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
model_extraGet extra fields set during validation.
model_fieldsmodel_fields_setReturns the set of fields that have been explicitly set on this model instance.