osmose.trophic_network

Community trophic-network diagnostics from OSMOSE dietMatrix output.

Reads the per-timestep diet matrix (output/Trophic/_dietMatrix.csv), aggregates it to a species-level predator->prey network per timestep, and (via make_trophic_network_html) renders an interactive pyvis node-link graph with a FIXED layout so the graph is stable as you step through time.

The network shows DIET COMPOSITION (% of a predator’s diet), NOT consumption- weighted trophic flow; predator size-stages are averaged UNWEIGHTED to species (the ‘stage’ level keeps them split, which is exact); prey size-stages are summed to species (exact). See the design doc’s honest-limitations.

Functions

available_times(output_dir)

Sorted unique Time values in the diet matrix (slider bounds).

diet_network_at(output_dir, *, time[, ...])

Long predator, prey, proportion (percent) for one timestep.

make_trophic_network_html(diet_df, *, positions)

Self-contained pyvis node-link HTML (fixed layout, physics off) for a diet network.

network_node_universe(output_dir[, ...])

All node ids (prey + predator) that can appear at any timestep, for the layout.

species_layout(node_ids)

Deterministic FIXED (x, y) per node, scaled for vis.js.