mufasa.nodes.fusion.map_fusion#

Classes#

MapFusion

Base for fusion nodes that combine BayesianMaps element-wise.

BayesianFusion

Fuse two or more BayesianMaps by summing their log-odds.

LogicalAnd

Logical AND in log-odds space: element-wise minimum across inputs.

LogicalOr

Logical OR in log-odds space: element-wise maximum across inputs.

Module Contents#

class mufasa.nodes.fusion.map_fusion.MapFusion#

Bases: mufasa.node.Node

Base for fusion nodes that combine BayesianMaps element-wise.

The output BayesianMap is allocated once on the first process() call and reused thereafter; data is updated in-place via numpy’s out= parameter.

Subclasses implement _combine(stacked, out=None) to define the reduction.

configure(crs, bbox, resolution) → None#

Receive spatial configuration from the Graph at construction time.

Override in nodes that need crs/bbox/resolution to initialise internal state (e.g. POM creates its map here). Default is a no-op.

Return type:

None

property map: mufasa.map.BayesianMap#
Return type:

mufasa.map.BayesianMap

reset() → None#

Clear all runtime state, returning the node to its post-init condition.

Called by the framework between pipeline runs so the same node instance can process a fresh dataset without being reconstructed. Override in nodes that hold mutable state (buffers, accumulators, fitted models). The default is a no-op — stateless nodes need not override this.

Return type:

None

process() → mufasa.map.BayesianMap#

Process incoming data and forward results to successors.

Override with the signature appropriate for this node’s role:

Observation-consuming nodes receive one observation per call:

def process(self, obs: Observation) -> None:
    result = ...                    # compute result
    for succ in self._successors:
        succ.process(result)        # push to downstream nodes

Map-consuming nodes are called with no arguments and read their input from the predecessor via its .map attribute:

def process(self) -> None:
    m = self._predecessors[0].map   # read upstream map
    ...                             # update self.map in place
    self._trigger_successors()      # notify downstream nodes

Sink nodes collect data without emitting anything further:

def process(self, obs: Observation) -> None:
    self._collected.append(obs)
Return type:

mufasa.map.BayesianMap

get_config() → dict#

Return all constructor arguments as a plain JSON-serializable dict.

Used by Graph.to_config() to serialise the pipeline. Every key must be a string; every value must be JSON-serializable.

Return type:

dict

class mufasa.nodes.fusion.map_fusion.BayesianFusion#

Bases: MapFusion

Fuse two or more BayesianMaps by summing their log-odds.

Assumes conditional independence between sources. Inputs and output are all in log-odds space (BayesianMap.data); no logit/expit conversions needed.

class mufasa.nodes.fusion.map_fusion.LogicalAnd#

Bases: MapFusion

Logical AND in log-odds space: element-wise minimum across inputs.

Conservative fusion — a cell is occupied only if all sources agree.

class mufasa.nodes.fusion.map_fusion.LogicalOr#

Bases: MapFusion

Logical OR in log-odds space: element-wise maximum across inputs.

Permissive fusion — a cell is occupied if any source indicates it.