aquakin.BiofilmSolution#

class aquakin.BiofilmSolution(t, C, profile, depth, model)[source]#

Bases: _HasNamedSpecies, PlottableSolutionMixin, ExportableSolutionMixin

Solution returned by BiofilmReactor.solve().

Variables:
  • t (jnp.ndarray) – Times at which the solution was recorded, shape (n_t,).

  • C (jnp.ndarray) – Bulk concentration trajectory, shape (n_t, n_species). This is the measurable (well-mixed liquid) signal; C_named() reads it. It is the raw integrated state (likewise profile): if the model sets clip_negative_states, entries may be small transient negatives, because the max(C, 0) clamp is applied only when evaluating the reaction rates, not to the saved state. These are a normal numerical transient, not an error; clip with jnp.maximum(sol.C, 0.0) for display if needed.

  • profile (jnp.ndarray) – Full depth-resolved trajectory, shape (n_t, n_compartments, n_species), where compartment 0 is the bulk and 1..``n_layers`` run from the biofilm surface (adjacent to the bulk) to the wall.

  • depth (jnp.ndarray) – Mid-point depth of each biofilm layer from the surface, shape (n_layers,) (metres). Bulk has no depth and is omitted.

  • model (CompiledModel) – The model that produced this solution.

Parameters:
  • t (Array)

  • C (Array)

  • profile (Array)

  • depth (Array)

  • model (CompiledModel)

__init__(t, C, profile, depth, model)#
Parameters:
  • t (Array)

  • C (Array)

  • profile (Array)

  • depth (Array)

  • model (CompiledModel)

Return type:

None

Methods

C_named(species)

Return the trajectory of a single species by name.

C_named_many(species)

Trajectories of several species by name, as {name: array}.

__init__(t, C, profile, depth, model)

final_named([species])

Values at the last recorded point, as {name: float}.

plot([species, ax])

Plot one or more species against the independent axis (time, or axial position for a PFR).

profile_named(species)

Depth profile of one species over time, shape (n_t, n_compartments).

to_csv([path_or_buf, units_in_columns])

Write the solution to CSV (delegates to to_dataframe()).

to_dataframe(*[, profile, units_in_columns])

Return the solution as a pandas DataFrame.

units_named(species)

Return the declared units of a species (for axis/column labels).

Attributes

final

Every species' value at the last recorded point ({name: float}).

time_unit

The time unit of self.t ("s", "d", .

t

C

profile

depth

model

profile_named(species)[source]#

Depth profile of one species over time, shape (n_t, n_compartments).

Parameters:

species (str)

Return type:

Array

to_dataframe(*, profile=False, units_in_columns=False)[source]#

Return the solution as a pandas DataFrame.

By default this is the bulk (measurable) trajectory: one row per time, one column per species, indexed by time – identical to the other solutions.

Parameters:
  • profile (bool, optional) – If True, return the full depth-resolved trajectory instead: a MultiIndex of (t, compartment) rows (compartment 0 is the bulk, 1..``n_layers`` run surface->wall), a depth column (NaN for the bulk row), and one column per species.

  • units_in_columns (bool, optional) – Append " [unit]" to each species column label.