aquakin.BatchSolution#

class aquakin.BatchSolution(t, C, model, events_log=None)[source]#

Bases: _HasNamedSpecies, PlottableSolutionMixin, ExportableSolutionMixin

Solution returned by BatchReactor.solve().

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

  • C (jnp.ndarray) – Concentration trajectory, shape (n_t, n_species). This is the raw integrated state. If the model sets clip_negative_states (on by default for ASM1), individual entries may be small transient negatives: the max(C, 0) clamp is applied only when evaluating the reaction rates (and state-derived conditions such as pH), not to the saved state, so the rates were computed on the clamped values while the trajectory keeps the raw ones. These negatives are a normal numerical transient of a stiff solve, not a solver or model error; clip them yourself (jnp.maximum(sol.C, 0.0)) for display if needed.

  • model (CompiledModel) – The model that produced this solution. Retained so that the inherited C_named() can look up species by name.

  • events_log (list of (float, str), optional) – When the solve used events=, the fired events in order as (time, name) – the audit trail of switch times. None for a plain solve.

Parameters:
  • t (Array)

  • C (Array)

  • model (CompiledModel)

  • events_log (list | None)

__init__(t, C, model, events_log=None)#
Parameters:
  • t (Array)

  • C (Array)

  • model (CompiledModel)

  • events_log (list | None)

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, model[, events_log])

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).

to_csv([path_or_buf, units_in_columns])

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

to_dataframe(*[, 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

events_log

final

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

time_unit

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

t

C

model