osmose.engine_cs.build

Build the parameter bundle the C# engine runs from (spec section 8.2, plan task 1.2).

Python resolves, C# computes (spec 8.1): every table here is what the Python engine itself reads, already parsed, per species and, where a value can change, per step. The C# engine never sees a config key, a file or a species name it must interpret.

Tasks 1.2a/b build the header, the static tables (contract, run, time, grid, species, growth, predation with feeding stages, stage accessibility, non-fishing mortality, output settings) and the per-step fishing and reproduction tables. Resources, movement and the result buffers (1.2c) follow.

Entry names, dtypes and shapes are the contract. Every array is validated against n_total = n_focal + n_background (or n_focal) here, so a mis-sized table fails at build time with its name rather than inside the engine.

Module Attributes

STAGE_METRICS

predation.stage.metric codes.

ACCESS_NONE

access.mode codes.

ACCESS_SPECIES

access.mode codes.

ACCESS_STAGE

access.mode codes.

GROWTH_CLASSES

growth.class codes.

MOVEMENT_METHODS

movement.method codes.

PATCH_STREAM

the patches get their own stream, derived from the run seed, so they never share one with anything else.

STAGE_BUFFERS

The life-stage buffers, named as the StepOutput fields they become.

FAMILY_STAGE

Bits of output.families (C# OutputFamilies).

N_MORTALITY_CAUSES

Columns of result.mortality, in MortalityCause order.

Functions

age_bin_offsets(config)

Where each focal species' age classes start in a by-age record (n_species + 1 values).

allocate_results(b, config)

Allocate the result buffers and the control block and register them in b.

build_bundle(config, raw, grid, *, seed[, ...])

The bundle for one run of config (an EngineConfig) on grid.

diet_columns(config)

The diet's prey columns, as simulate() sizes its diet matrix: the focal species, the background species, then the resources ResourceState discovered (Java's DietOutput; osmose.engine.output.diet_prey_names).

family_shapes(config)

The shape of ONE record of every family that is on, by buffer name (the StepOutput field of the same name), in the engine's order (C# OutputLayout.Specs).

n_records(n_steps, record_frequency, ...)

How many records a run writes: one per full window plus a trailing partial one (as simulate flushes it), plus the initial record when output.step0.include is set.

output_families(config)

The families _collect_outputs computes for this config beyond the minimal set, by the same switches it reads.

size_edges(config)

The left edges of the length classes, as _collect_distributions forms them.

Classes

RunBuffers(record_step, window_steps, ...[, ...])

The arrays the C# engine writes into, owned by Python (spec 8.4/8.5).

Exceptions

BundleBuildError

The config cannot be expressed as a bundle (a table has the wrong size, etc.).