Documentation

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

NameTypeDescription
_datatuple[(str, ...)] |
_is_mmapbool
_type_listlist[str] | None
alltuple[(str, ...)] | NoneList of all node types from big to small.
apiApi
datatuple[(str, ...)] | Access to raw type data.
maxNodeint | None
maxSlotint | None
metadict[(str, str)]Metadata of the feature.
slotTypestr | None
supportdict[(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) None

Initialize OtypeFeature with either dict-based or mmap backend.

Parameters
  • api: Api
  • metaData: 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 | None

Get the node type of a node.

Parameters
  • n: int