osmose.engine.processes.predation

Predation process.

Public API:

predation_for_cell(cell_indices, state, config, rng, n_subdt, ...)
    Apply predation within a single cell. In-place on state.
enable_diet_tracking / disable_diet_tracking / get_diet_matrix
    Diet-tracking helpers.
compute_size_overlap, compute_appetite, compute_feeding_stages
    Utility predicates.

Test-exposed private helpers (leading underscore — not stable API):

_predation_in_cell_python, _predation_in_cell_numba
_predation_on_resources
    Used by targeted tests that need to exercise a specific backend
    or the resource-predation path in isolation. Tests that import
    these take on the maintenance burden if signatures change.

Production code uses mortality.mortality() rather than this module directly; predation_for_cell is exposed for predation-isolated testing.

Functions

compute_appetite(biomass, ingestion_rate, ...)

Return the maximum biomass a predator can eat in one sub-timestep.

compute_size_overlap(pred_length, ...)

Return True if the predator/prey size ratio falls within [ratio_min, ratio_max).

disable_diet_tracking([ctx])

Disable diet tracking (keeps buffer for reuse).

enable_diet_tracking(n_schools, n_species[, ctx])

Enable per-school diet tracking with a (n_schools, n_species) matrix.

get_diet_matrix([ctx])

Return the active diet matrix, or None if tracking is disabled.

predation_for_cell(cell_indices, state, ...)

Apply predation (+ optional resource predation) within a single cell.