Properties
Properties(**kwargs)Properties container.
Args
- **kwargs (int, float, str, bytes, Sequence[int, float, str, bytes]): Named properties.
Example
>>> properties = pf.Properties(int_value=1, byte_string=b"text")>>> properties["int_value"]1>>> del properties.int_value>>> propertiesProperties(**{"byte_string": b"text"})>>> properties.byte_stringb'text'>>> component = pf.Component()>>> component.properties.new_value = 123>>> component.propertiesProperties(**{"new_value": 123})Note
Sequences of length 1 are replaced by their contents. Strings are stored as ‘bytes’ using the utf-8 encoding.
Methods
Section titled “Methods”| Method | Description |
|---|---|
add_gds_property | Set a property compatible with GDSII layouts. |
copy | Create a copy of these properties. |
get | Return the value for key if key is in properties, else default. |
keys | Return the keys for these properties. |
add_gds_property
Section titled “add_gds_property”add_gds_property(self, attribute, value)Set a property compatible with GDSII layouts.
GDSII properties are stored under the “S_GDS_PROPERTY” key and are composed of a non-negative attribute number and a string value.
Args
- attribute (int): Property attribute number.
- value (str | bytes): Property value. Strings are stored as bytes using the utf-8 encoding.
Returns
Properties: This object.
Note
GDSII files only support properties on geometrical structures, labels, and references. Properties on components (cells) are not supported and will not be included in the gds file.
copy(self)Create a copy of these properties.
Returns
New copy.
get(self, key, default=None)Return the value for key if key is in properties, else default.
Args
- key (str): Property key to retrieve.
- default (object): Return value if
keyis not found.
Returns
object: Retrieved property value or default.
keys(self)Return the keys for these properties.
Returns
Property keys.