Skip to content

compile_graph_block_coordinates

from tensorsig.offset_coded_signatures.graph_queries import compile_graph_block_coordinates

Compile every requested source column in one common PIT2 program.

occupancy optionally restricts the source to a single fine cell, with one row per chronological block and one column per named channel. Separate calls have separate coordinate spaces; their columns must not be combined. Resource exhaustion raises :class:ResourceLimit, never a zero verdict.

Source code in src/tensorsig/offset_coded_signatures/_graph/rational_coordinates.py
def compile_graph_block_coordinates(
    composition,
    graph,
    *,
    channels,
    occupancy=None,
    max_vertices=5000,
    max_dimension=20000,
    max_outputs=128,
):
    """Compile every requested source column in one common PIT2 program.

    ``occupancy`` optionally restricts the source to a single fine cell, with
    one row per chronological block and one column per named channel. Separate
    calls have separate coordinate spaces; their columns must not be combined.
    Resource exhaustion raises :class:`ResourceLimit`, never a zero verdict.
    """
    from ..quotients import DependenceGraph

    if not isinstance(graph, DependenceGraph):
        raise TypeError("graph must be a DependenceGraph")
    spec = {
        "kind": "graph-block",
        "q": list(composition),
        "channels": channels,
        "edges": [list(edge) for edge in sorted(graph.edges)],
    }
    if occupancy is not None:
        spec["occupancy"] = [list(row) for row in occupancy]
    return evaluate(
        spec,
        {"vertices": max_vertices, "dimension": max_dimension, "outputs": max_outputs},
    )