otype
# Access to `otype` feature data.
In general, features are stored as dictionaries, but this specific feature has an optimised representation. Since it is a large feature and present in any CF dataset, this pays off.
Supports two backends: - Dict-based tuple format (.tf loading): data = (type_tuple, maxSlot, maxNode, slotType) - Mmap numpy array (.cfm loading): data = numpy uint8/uint16 array, with type_list parameter
Classes
class
OtypeFeature
Attributes
| Name | Type | Description |
|---|---|---|
| _data | tuple[(str, ...)] | | — |
| _is_mmap | bool | — |
| _type_list | list[str] | None | — |
| all | tuple[(str, ...)] | None | List of all node types from big to small. |
| api | Api | — |
| data | tuple[(str, ...)] | | Access to raw type data. |
| maxNode | int | None | — |
| maxSlot | int | None | — |
| meta | dict[(str, str)] | Metadata of the feature. |
| slotType | str | None | — |
| support | dict[(str, tuple[(int, int)])] | Support dict for s() method: type -> (min_node, max_node). |
Methods
__init__(self, api: Api, metaData: dict[(str, str)], data: tuple[(tuple[(str, ...)], int, int, str)] | , type_list: list[str] | dict[(str, Any)] | None = None) → NoneInitialize OtypeFeature with either dict-based or mmap backend.
Parameters
api: ApimetaData: dict[(str, str)]data: tuple[(tuple[(str, ...)], int, int, str)] |type_list: list[str] | dict[(str, Any)] | None= None
items(self) → Iterator[tuple[(int, str)]]As in `cfabric.nodefeature.NodeFeature.items`.
s(self, val: str) → tuple[(int, ...)]Query all nodes having a specified node type.
Parameters
val: str
sInterval(self, val: str) → tuple[(int, int)] | tuple[()]The interval of nodes having a specified node type.
Parameters
val: str
v(self, n: int) → str | NoneGet the node type of a node.
Parameters
n: int