RatioCombiner

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

class RatioCombiner(eps: float = 1e-08)[source]

Bases: object

Element-wise ratio of two sibling blocks: first / (second + eps).

Ratios of two modalities (e.g. PET over CT uptake, T1 post-contrast over pre-contrast) cancel subject-level intensity scale and are a classic habitat feature. The denominator is guarded by eps so a zero-valued voxel yields a large-but-finite ratio instead of an inf that would poison every downstream statistic.

Parameters:

eps – Constant added to the denominator before dividing. Must be non-negative.

__init__(eps: float = 1e-08) → None[source]
property spec: Spec

Return the algorithm specification used for provenance.

__call__(blocks: Sequence[DataFrame], *, context: Mapping[str, Any] | None = None) → DataFrame[source]

Divide the first child block by the second.

Parameters:
  • blocks – Exactly two blocks: numerator first, denominator second.

  • context – Carries the child source labels under "sources".

Returns:

One column per paired column, named ratio-{numerator}-{denominator}.