dacapo.gp.dacapo_points_source
Classes
A provider for serving graph data in gunpowder pipelines. |
Module Contents
- class dacapo.gp.dacapo_points_source.GraphSource(key: gunpowder.GraphKey, graph: gunpowder.Graph)
A provider for serving graph data in gunpowder pipelines.
The Graph Source loads a single graph to serve to the pipeline based on ROI requests it receives.
- key
The key of the graph to be served.
- Type:
gp.GraphKey
- graph
The graph to be served.
- Type:
gp.Graph
- setup()
Set up the provider.
- provide(request)
Provides the graph for the requested ROI.
Note
This class is a subclass of gunpowder.BatchProvider and is used to serve graph data to gunpowder pipelines.
- key
- graph
- setup()
Set up the provider. This function sets the provider to provide the graph with the given key.
- Raises:
RuntimeError – If the key is already provided.
Examples
>>> graph_source.setup()
- provide(request)
Provides the graph for the requested ROI.
This method will be passively called by gunpowder to get a batch. Depending on the request we provide a subgraph of our data, or nothing at all.
- Parameters:
request (gp.BatchRequest) – BatchRequest with the same ROI for
graph. (each requested array and)
- Returns:
The graph contained in a Batch.
- Return type:
outputs (gp.Batch)
- Raises:
KeyError – If the requested key is not in the request.
Examples
>>> request = gp.BatchRequest() >>> request[gp.GraphKey("GRAPH")] = gp.GraphSpec(roi=gp.Roi((0, 0, 0), (1, 1, 1))) >>> graph_source.provide(request)