Skip to content

v0.51.0

Choose a tag to compare

@AADavin AADavin released this 21 Sep 08:27
· 49 commits to main since this release

Added

  • Two traits can feed back into each other with no exact solution. simulate_traits now takes
    traits.continuous(...) specs beside traits.discrete(...) ones, and runs two models. In the
    first, two continuous traits each set the other's optimum through a curve,
    reverts_to=set_by("traits:<name>", f, step=0.01). In the second, a discrete trait paints a
    continuous trait's optimum through regimes="traits:<name>" with reverts_to={state: theta},
    while the discrete trait's switch rate reads the continuous one. Both hold every driver still
    over slices of at most step and are first order in it: halving step halves the error, and it
    also changes the numbers for a given seed, so convergence is checked across seeds. Two traits
    that set each other's sigma squared are refused as not built. A pair of straight-line optima is
    refused too, naming the exact simulate_continuous call to write instead. (#456)
  • A continuous driver is read along its real path, not the straight line between its node values.
    The path is drawn after the trait is simulated, conditioned on both node values, from its own
    random stream — so a seed gives the same node values it always gave. It is exact for Brownian
    motion and Ornstein-Uhlenbeck, and stays exact under a changing_at schedule, a Drift among
    lineages and a diversity-dependent sigma squared. A trait grown with regimes= or a driven
    optimum keeps the line, as does a correlated trait. Write path=False on the link to ask for the
    line, and the written form records it. (#454)
  • A continuous trait writes trait_path.tsv by default: its path within each branch, node ·
    time · trait · variance. A driver read from a file now gives the same answer as the same
    driver held in memory; a directory without the file falls back to the line and says so.
    write(dir, step=...) chooses the resolution. Reading a written path at a finer step than it
    was written at warns: the points between the written ones are drawn on the spot, so they are a
    valid path but not the one the same driver gives in memory. (#454)
  • Continuous traits can steer each other. Give pull keyed by pairs of traits,
    pull={("x", "x"): 1.0, ("y", "y"): 2.0, ("y", "x"): -0.8}, and x's distance from its optimum
    moves y. The effect can run both ways. The run is exact: each branch is one draw from the
    multivariate OU transition, computed in numpy with no new dependency. The matrix is minus the
    selection matrix of coevolve (Ringen et al. 2026). (#452)
  • A continuous trait's optimum can follow another continuous trait.
    simulate_continuous(tree, pull=2.0, reverts_to=set_by(x, lambda v: 1.0 + 0.8 * v, step=0.01))
    reads the optimum off x, a trait grown first on the same tree, as a result or its written
    trait_values.tsv. The engine reads x in stretches of at most step and solves OU exactly
    within each one. A modified σ² still works alongside it. A discrete trait keeps setting the
    optimum through regimes=. (#451)

Fixed

  • A continuous driver grown with at_speciation started each branch from the parent's node value
    instead of the value after the jump at the split, which pulled the whole within-branch reading
    toward the parent. The branch now starts where the engine started it. The root branch likewise
    starts from the trait at t=0 rather than from its own end value. (#454)