API reference#

Model and analyses#

class symident.Model(odes=None, observables=None, *, reactions=None, totals=None, trafo=None, conditions=None, events=None, inputs=(), unknown_inputs=(), known_inputs=(), fixed=(), parameters=(), regimes=None, equilibrate=None, positive=None, reduce_cq=None)[source]#

An ODE model with observables, conditions and events.

Parameters:
odesdict, optional

Right-hand sides, state name to expression (^ or ** for powers), with switches such as piecewise() and comparisons allowed (see the guide). Derived from reactions when omitted.

observablesdict or list of dict

Observables, name to expression; a list gives one dict per condition.

reactionsdict, optional

Reaction network with keys species, stoichiometry (reactions by species) and rates; it gives the totals and the zero-state analysis under equilibrate.

totalsdict, optional

Conserved totals, name to expression, each conserved by the right-hand sides; computed from reactions, else from the linear conservation laws of odes, when omitted, as nonnegative combinations where these span the laws. reduce_cq eliminates one species per total.

trafodict or list of dict, optional

Parameter transformation; an entry named like a state sets the initial value of that state. A list holds one transformation per condition.

conditionspandas.DataFrame or dict, optional

One row per condition; a numeric cell fixes a symbol, a string replaces it by an expression or another name, and a column named like a state sets the initial value of that state. As a dict: {"rows": [...], "cols": {name: [values]}}.

eventslist of dict, optional

Events with keys var, time, value and method (replace, add or multiply); root in place of time resets var each time the root expression changes sign, and cond lists the conditions (from 0) an event belongs to, all by default. Each condition starts at \(t = 0\), or at the earliest event of the condition when that comes before; an event at the start applies to the initial values.

inputssequence of str

Input states, zero at the start and at rest; an event sets them.

unknown_inputssequence of str

Unknown functions of time of no assumed form, symbols in the right-hand sides and observables without an equation. A direction may change them along with the parameters (see the guide).

known_inputssequence of str

Known functions of time of no assumed form, symbols in the right-hand sides and observables without an equation; their values and time derivatives are known.

fixedsequence of str

Known symbols.

parameterssequence of str

Additional symbols treated as parameters.

regimeslist or dict, optional

The regimes an experiment visits, for a model with switches: each entry is a comparison or a list of comparisons that selects the regimes on those sides, the first entry the regime at the start; a dict gives one list per condition name. Without it every regime counts. See the guide.

equilibratebool, optional

The default of detect()’s equilibrate for this model.

positivebool or sequence of str, optional

The default of detect()’s positive for this model.

reduce_cqbool, optional

The default of detect()’s reduce_cq for this model.

classmethod from_petab(path)[source]#

The model of a PEtab problem; see read_petab().

symident.read_petab(path)[source]#

A Model from a PEtab problem.

Parameters:
pathstr

The YAML file of a PEtab problem, format version 1 or 2, with one SBML model.

Returns:
Model

One condition per experiment (v1: per pair of preequilibration and simulation condition) with measurements. The estimated parameters stay symbols; every other parameter takes the nominal or SBML value. Model.equilibrate is set when every experiment starts with a preequilibration or is a readout at rest, and Model.reduce_cq when the preequilibrated network has conserved totals. Model.positive holds the estimated parameters of the model on a log scale or with a positive lower bound. m.petab lists the experiments, the estimated parameters, the fixed values, the renamed ids, under without_effect the estimated parameters that no remaining term holds and under at_rest the experiments read at rest.

Raises:
PEtabError

For an SBML or PEtab feature without a counterpart in the model language: algebraic rules, delays, fast reactions, variable stoichiometry, a volume that depends on species, event triggers other than a time or one comparison, and preequilibration in some experiments only; and for a problem the reader cannot map, such as several subproblems, a fixed parameter without nominal value or an unknown condition target.

Warns:
UserWarning

For estimated parameters without effect on the model: every term that holds them vanishes in every experiment.

Notes

An id that the expression language cannot read, one with a leading underscore or one that names a constant such as pi, gets an X in front or an _ behind, in the model and in every table; m.petab["renamed"] maps the ids of the problem to the new names. The time of an SBML event takes the values of the event parameters in each experiment.

A volume that a rate rule changes is a state, one that an assignment rule in time and parameters gives enters with the time derivative of the volume, and a concentration in either is diluted by \(-[x] V'/V\). A volume that an event or a period resets keeps the amount of every species in it that the reset does not set. The noise model does not enter, nor does a log transformation of an observable. A placeholder of an observable takes the override from the measurement table; one observable measured with several overrides in an experiment becomes one observable per override. A parameter that a later period changes becomes the value at the start plus an input, zero at rest, that an event at the start of the period sets; where every period sets the value the parameter already has, there is no input. A species target of a period after the first is an event. A switch between two expressions at a time that every experiment fixes becomes a step state, off during a preequilibration, that an event switches on at that time or at the start.

An experiment in one period without a preequilibration whose measurements are all at time inf is a readout at rest: the system starts from the values of the condition, rests under that condition, and only the resting values of the observables enter. The reading assumes that a resting state exists and is the one the experiment reaches. An experiment with a finite measurement time is a trajectory; so is every experiment when one of them starts without a preequilibration and is not a readout at rest, with a warning, since all conditions start alike.

A parameter value that names another parameter, such as an initial assignment, takes the value of that parameter in each experiment. States that start at 0 in every experiment, that no event sets and whose rates vanish where all of them are 0 leave the model.

exception symident.PEtabError[source]#

A PEtab problem or SBML model that the reader does not support.

symident.detect(model, *, scalings_only=False, equilibrate=None, reduce_cq=None, free_initial=None, reconstruct=False, positive=None, verify=True, gauge=False, cores=1, control=None, engine='modular', trace=False, mode='local', global_options=None)[source]#

Structural non-identifiabilities of a model, locally and, with mode="global", globally.

Parameters:
modelModel
scalings_onlybool

Only the scaling symmetries, from an exact integer kernel.

equilibratebool, optional

Start at a steady state with the inputs at zero, then apply the events at the start; a state without dynamics that is not an input rests at the initial value. Defaults to model.equilibrate, else False.

reduce_cqbool, optional

Eliminate one species per conserved total and take the totals as coordinates; an event on a species of a total changes the total. Defaults to model.reduce_cq, else False.

free_initialsequence of str, optional

States that hold the free resting value of their total (equilibrate without reduce_cq), one per total with independent coefficients; an invalid choice raises an InputError. Not given, the states are chosen by the structure of the model, choices that tie are compared by rank status and levels, and info["settings"]["free_initial"] holds the states taken.

reconstructbool

Return general directions as exact rational functions.

positivebool or sequence of str, optional

Coordinates known to be positive; defaults to model.positive, else True. An entry may be an expression positive on the domain, such as "1-x" for a fraction x below one.

verifybool

Check the rank where the Lie order is not proven sufficient.

gaugebool, None or sequence of str

False reconstructs every direction; None fixes one coordinate per scaling, chosen to keep the general directions narrow; a sequence ranks the coordinates to fix (* as wildcard).

coresint

Threads and worker processes.

controldict, optional

Settings from reconst_control().

enginestr

"modular" (finite fields) or "symbolic" (sympy, small models).

tracebool or str

Print stage timings; "full" adds the Lie-order diagnostics.

modestr

"local" analyzes local identifiability only. "global" analyzes it first, reduces the directions found, and then counts the values of the coordinates with the output of a generic one and reconstructs the maps between them, the discrete symmetries (Symmetries.discrete(), needs msolve, implies reconstruct=True). The result holds them in discrete_symmetries and info["discrete"]; a model the global analysis does not handle gets the reason in info["discrete"]["unsupported"] and a warning.

global_optionsdict, optional

Arguments of the global analysis: order, points, memory, experiments and the work limits msolve_entries, msolve_terms, search_entries and elimination_terms of Symmetries.discrete().

Returns:
Symmetries
symident.reduce(result, *, fixed=None, positive=None, d_poly=3, d_darboux=2, d_exp=2, separable=True, zero_limits=False, alternatives=False, allow_open=True, allow_checked=True, check=True, work_cap=4000, branch=None)[source]#

Reparametrization that removes the directions of a detection result.

The model is described in the invariants of the directions, each a new parameter q_<k>. The invariants are coordinates on the quotient of the parameter space by the orbits, a chart, which is returned only where it is valid on the declared domain. A scaling (Symmetry.kind) fixes one coordinate to one, a translation is replaced by the linear invariants with a coordinate fixed to zero on a face of the positive orthant, and a curved direction by the invariants of that direction.

Parameters:
resultSymmetries or dict

A detection result, or the raw form from to_dict().

fixedsequence of str, optional

Coordinates with known values; defaults to the gauge of the result.

positivebool or sequence of str, optional

Coordinates known to be positive; defaults to the setting of the detection.

d_poly, d_darboux, d_expint

Degree bounds of polynomial and rational invariants, Darboux polynomials and exponential-factor numerators.

separablebool

Solve separable blocks by quadratures.

zero_limitsbool

Report which coordinates each block can drive to zero.

work_capint

Candidate sections the search of one block may try; reaching it is an entry in Reduction.limits.

alternativesbool

Also return, in Reduction.alternatives, the charts of the other valid choices of the fixed coordinates; they are searched anyway when the first chart contains a root that does not simplify.

allow_openbool

Reduce the directions with a closed form and leave those of level "open" in place, with a warning; False makes such a direction an error.

allow_checkedbool

Reduce also on a direction of level "checked" and on a result whose saturation check failed, with a warning; False makes either an error.

checkbool

Run the detection again on the model with the trafo applied (closed loop) and record in Reduction.checks whether exactly the remaining directions are left; needs the model of a Symmetries result of a detection without scalings_only. Large models may turn it off.

branchstr, optional

With a discrete symmetry of a detection with mode="global": the side of the fixed set as an inequality, such as "k01 > k12", on which the trafo maps free values in the positive orthant one to one, chained with the section; Reduction.discrete["branches"] lists the sides. Without it every branch is in Reduction.alternatives and the trafo is the section alone.

Returns:
Reduction
Warns:
UserWarning

When a direction is open, checked or verified, the saturation check failed, or a claim of a section is not proven.

Results#

class symident.Symmetries(raw, model=None)[source]#

Result of detect().

Attributes:
identifiablebool or None

Whether the model is structurally locally identifiable; None with scalings_only. True is proven. False holds as far as info["rank_status"] says: with a lower bound the model may still be identifiable.

rank, dimint or None

Rank of the OIM and number of coordinates; None with scalings_only.

symmetrieslist of Symmetry

The non-identifiable directions; a direction is the generator \(X = \sum_i \xi_i \, \partial_{\theta_i}\).

infodict

The computation:

  • rank_status: status ("proven", "verified" or "lower bound"), why and probability; with a lower bound the number of directions is an upper bound. rank_proven and rank_proof: the number of directions that prove the rank, and how; rank_fields and rank_fields_bound: the directions held by invariant fields at every order, and the error bound of their check.

  • coordinates: the coordinates of the analysis, parameters and free initial values.

  • lie_order_used, lie_block_orders, lie_order_driver, lie_plateau: the Lie order taken, per condition or chain, the condition that needs the highest, and the flat orders that ended the saturation. lie_certified, lie_uncertified: whether the order is proven sufficient, and the conditions where it is not; lie_certificate: why the symbolic engine has no certificate.

  • gap_order_used, gap_certified, gap_certificate, gap_bound: the same for the gap order of events after the start; series_certified, series_certificate: for the series order of resting states (None where they do not apply).

  • order_bound, order_bound_why: the probability that a certified order is not sufficient, or why there is none; order_draws: the most points drawn for one random point of the Lie order certificate, which multiplies the terms of the certificate.

  • bound: the probability that a wrong closed form passes the kernel check, or why none applies. proof: per direction verified on every entry, why the exact proof did not apply; attempts: per open direction, the routes tried and why they failed.

  • verification: the saturation guard, with ok and reason; where ok is False the rank still grows past the order used.

  • projection: the rank modulo the unknown inputs, modulo the fresh coordinates of switch surfaces, or modulo resting states whose Jacobian is singular at the base point.

  • unknown_inputs, known_inputs: per input the jets and the order up to which they are exact.

  • assumptions: the declared domain and switch starts the result assumes, and the error_bound of a verified closed form or rank.

  • limits: the work caps and orders that stopped part of the analysis; while it is not empty, a direction without closed form may have one. errors: exceptions a route recorded.

  • branches: resting states with several roots modulo a prime, and the one taken.

  • switching: the surfaces and regimes of a model with switches; where the rule of the switches is not proven, uncertified says why and candidates lists the directions it leaves open, which are not reported as symmetries. zero_states: states every condition keeps at zero, which the analysis drops.

  • gauge_suggestion: the coordinates a gauge would fix, in a detection without gauge that has scalings and general directions.

  • conditions, segments, engine, elapsed, timing, settings: the number of conditions and of segments between events, the engine, the seconds elapsed in total and per stage, and the settings of the detection.

gaugelist of str or None

The coordinates fixed by a gauged detection.

modelModel or None

A copy of the model detected.

methodstr

"observability", or "scaling" with scalings_only.

unproven()[source]#

The directions of level "verified" or "checked", whose closed form is checked but not proven.

Returns:
list of Symmetry
summary(verbose=False)[source]#

The computation report and the result.

Parameters:
verbosebool

Also the settings verify, sym_engine and degree_cap, and the reason of each direction without closed form.

Returns:
str
solution_count(order=None)[source]#

The number of values of the coordinates that give the output of a generic one.

Local identifiability leaves finitely many such values; more than one is a discrete symmetry, which the Lie method does not see. The count solves the Taylor coefficients of the observables up to order at a random point modulo a prime with msolve, so it is a check at that point, not a proof. Values are counted over the algebraic closure, so values outside the declared domain, such as the negative root of a square, count too. The model has one condition (a one-row grid or one-element lists), no events, switches or unknown inputs.

Parameters:
orderint, optional

The highest Taylor coefficient; twice the number of coordinates by default.

Returns:
dict or None

{"count", "order", "prime"}, or None where the model is not rational, msolve fails, reaches the work caps (msolve_entries and msolve_terms of discrete()), or the solutions are not finitely many. Points where a coordinate or a denominator vanishes are not counted.

Raises:
ValueError

For a result detected with reduce_cq, a model with unknown inputs, or a model that is not rational after the rewrites.

MsolveMissingError

Where msolve is not found (install_msolve()).

discrete(order=None, points=5, cores=1, memory=None, experiments=None, msolve_entries=None, msolve_terms=None, search_entries=None, elimination_terms=None)[source]#

The discrete symmetries: other values of the coordinates in the domain with the same output.

The Taylor coefficients of the observables up to order are equated with their values at a point. msolve counts the solutions over the algebraic closure modulo a prime, and over the reals in the declared domain at points random rational points, where the number may differ between regions. Where the other solutions are rational functions sigma of the coordinates, sigma is reconstructed from the characteristic polynomials of the coordinates over the solutions, checked on the output at random points ("checked") and, where every state has a free initial value, proven by the map of the states ("exact"). Permutations of coordinates with the same dependence of the output are tested as candidates first. A model with logarithmic coordinates, observables under an injective function or factors exp(a*time) is rewritten into rational form with the same fiber, and the results are given in the coordinates of the model. Other non-rational terms of the states become new states and new coordinates, their values at the start; the count is then that of this relaxed model (info["relaxed"]). A free power x^alpha of a state that starts at 0 enters through (x/c)^alpha, c the leading Taylor coefficient of x, as a series in t and t^(k*alpha) (info["start_powers"]). A sigma that maps no point of the domain into it is listed but not relevant. The jets of unknown inputs are unknowns of the count, not coordinates; a sigma may change the input (state_maps). A result of reduce_cq is counted on the level sets of the conserved totals, with the species solved through the totals in info["eliminated"].

Parameters:
orderint, optional

The highest Taylor coefficient; twice the number of coordinates by default.

pointsint or list of dict

The number of random points of the count in the domain, or the points themselves as {coordinate: value}.

coresint

Threads of msolve.

memoryfloat, optional

GiB of address space one call of msolve may take, 8 by default; past it the call fails.

experimentsbool or int, optional

The count of several experiments with shared parameters and free starts, projected onto the parameters and starts of the first, which bounds the fiber of a model with free starts and no rational first integral, proven at one point of the parameters (docs/method/global.rst, “Several experiments”). By default it runs where a short count of one experiment finds none; True runs it first with the number of experiments from the rank criterion, a number K with K experiments, False never. info["experiments"] reports it, or why it does not apply.

msolve_entriesint, optional

The nonzero entries of the matrices of the F4 rounds that one call of msolve may reduce, 4 * 10^8 by default, read from the output of msolve; the call ends after the round that passes it, without a result. The first short count and the count of a block before the stages take a fraction of it.

msolve_termsint, optional

The most terms of one system given to msolve, 10^5 by default; a larger system is not solved.

search_entriesint, optional

The entries of the matrices over finite fields that the exact count may reduce, 5 * 10^8 by default, in the search for the invariant functions as rational functions of the output coefficients (docs/method/global.rst, “The exact count”).

elimination_termsint, optional

The most terms of a polynomial of the elimination of the states in the exact count, 3 * 10^6 by default.

The global analysis stops on these work limits and on further fixed caps on orders,
points and candidates, never on a clock, so that the result is the same on every machine.
A count or a proof that reaches a limit ends without a result, and ``info[“limits”]`` or
the certificate names the limit and the value of the limit.
Returns:
dict

symmetries: per sigma the map of the coordinates it changes, changes, level, found_by ("candidates", "fiber"), state_maps (the maps of the states that prove it, one per segment), preserves_domain (True, False, or None with the domain_conditions under which sigma(theta) lies in the domain) and fixed_set, the factors on which sigma fixes theta. info: order, count (solutions over the algebraic closure at a random point modulo a prime), count_bound (the probability that a generic point has more, None where the count is exact or has no bound), count_domain (the points of the fiber of a generic point of the domain inside the domain, where the count is final and each map keeps the domain or leaves it entirely, else None), counts per point (complex, real, in_domain, undecided), closed_forms, count_final (every solution is the image of a proven sigma), fundamental_domain (inequalities that keep one point of each orbit), rewrites, candidates, timing (seconds per stage), certificate (what the result rests on: the invariance per map, the size of the orbit, exact with the invariant functions as rational functions of the output coefficients, the verified count with count_bound, or the axiom of the count where neither applies, and complete: "exact", "verified", "axiom", "no" or "open"; with the count of several experiments also route, and pinned where the exact search stopped and the functions it proved were counted), experiments (the number of experiments, the orders, the count and the certificate first_integrals of the premise, or why the route does not apply) and limits.

Raises:
ValueError

Unless the result is identifiable and was detected without equilibrate, on a model with one condition and no events or switches, and for a model with unknown inputs and events, switches or more than one condition.

MsolveMissingError

Where msolve is not found (install_msolve()).

reduce(**kwargs)[source]#

Shortcut for reduce() with this result; kwargs are passed on.

A repeated call with the same arguments returns a copy of the reduction computed first.

Returns:
Reduction
to_dict()[source]#

The raw result.

Returns:
dict

Nested dicts and lists.

class symident.Symmetry[source]#

One non-identifiable direction, a dict whose entries are also attributes.

Attributes:
typestr

"scaling" or "general": found as an integer scaling, or otherwise.

kindstr or None

The orbit geometry: "scaling" (\(\xi_i = w_i \theta_i\), orbits are lines in logarithmic coordinates, monomial invariants), "translation" (constant \(\xi\), orbits are lines in linear coordinates, linear invariants, a section on a face of the positive orthant) or "curved" (all others), each up to a common factor of the components; None without a closed form. Translations and curved directions are of type "general".

supportlist of str

Coordinates the direction moves.

explicitbool

Whether the generator is known in closed form.

generatordict or None

Component \(\xi_i\) per coordinate as a string; None when not reconstructed.

weightsdict or None

Integer weights \(w_i\) of a scaling as strings, \(\xi_i = w_i \theta_i\).

degreeint or None

Total degree of the components.

levelstr

How far the direction is established:

  • "exact": proven over Q.

  • "verified": in the kernel at random points modulo a verification prime \(q\), with the error probability in info["bound"]; at a start at rest (equilibrate) on the resting variety of the parameters drawn.

  • "checked": the same test without an error bound, or on part of the entries only; info["bound"] says why a bound does not apply.

  • "open": no closed form; reason says why.

state_componentsdict or None

For an exact direction, the components \(\xi_x\) on the states of the field that proves it, \(X = \sum \xi_\theta \partial_\theta + \sum \xi_x \partial_x\), in the first condition; None where none is needed or known.

input_changedict or None

For an exact direction of a model with unknown_inputs, the component \(\xi_w\) of the proving field on each unknown input; None otherwise.

routestr or None

How a closed form was obtained, e.g. "static subsystem".

reasonstr or None

Why a direction has no closed form.

complete_generator, factordict or None, str or None

The generator times factor, a positive function that makes the flow exist for all times; None for very long components.

displaydict

Factored components of a general direction, where shorter.

sympy()[source]#

The generator components as sympy expressions.

Returns:
dict or None

Coordinate to expression; None without a closed form.

class symident.Reduction(raw)[source]#

Result of reduce(): the model in a chart, the invariants of the directions as new parameters.

Attributes:
trafodict or None

Parameter transformation over all coordinates; None without directions. An entry named in a condition grid goes into the cells of the grid; under equilibrate an entry named like a state pins the resting value it holds, which a model takes in fixed when it is a number.

blockslist of dict

One entry per set of coupled directions, with labels, support, status ("reduced", "fixed" when fixed removes the scaling, "invariant_only" when no section is certified, "unresolved"), stage (the invariant search that reduced it), level, generator_level, unproven (the claims of the block section not proven), pins and, with zero_limits, zero_compatibility. A scaling block holds the pinned coordinates as transversal. A general block holds invariants and new_parameters (the invariant each q_<k> stands for); a curved one also section, solved_domain, count, injective (every orbit meets the section at most once; not claimed under partial coverage or on a face) and reach (every level set of the invariants is one orbit). coverage is "partial" when the section covers part of the positive orthant only; sign_conditions then lists the entries without a positivity certificate as conditions on the new parameters, and the trafo covers the orbits on which they hold. A face section (face) holds face_why, why the model is not shown continuous up to the face (None when it is), and face_level. A block of directions that unknown inputs absorb holds inputs: the inputs (absorb), the proof ("inversion" with the determinant, or "lift" with the components of the lift per direction) and the condition under which the section gives the output of a point.

removed, remaininglist of str

Labels of the directions.

dependentlist of str

Labels of listed directions that depend on the others and need no reduction.

alternativeslist of dict

The charts of the other valid choices of the fixed coordinates, each with trafo, pins, removed, remaining and rational; the returned one has the best level, removes the most directions, and prefers charts without sign_conditions, then charts that cover the whole domain, then a rational trafo.

partiallist of str

Removed directions whose chart covers only part of the domain: some positive coordinates have no positive preimage in the new parameters.

levelstr

The lowest level of the reduced blocks: "exact", "verified", "checked" or "open", the last when a claim of a section is not proven.

assumptionsdict

What the reduction assumes: domain (the declared positive coordinates, True for all) and starts (the sides of switches declared at the start by regimes, per condition), together with error_bound, the probability that a verified closed form or rank of the detection is wrong (None without one).

checksdict

pins and invariants: whether every pin holds under the trafo and every invariant of a block maps to the new parameter of the invariant, over Q (failed lists the others), and why where SymPy failed; loop: the closed loop of reduce(check=True), with the number of directions the reduced model has, the number expected, the rank_status of that detection, ok (None where the loop could not run) and reason.

errorslist of str

Exceptions that the reduction turned into failed routes, such as an alternative section left out (see the DEBUG switch).

limitslist of str

The work caps that stopped a section or invariant search.

coordinateslist of str

The coordinates of the detection.

fixedlist of str

The coordinates held fixed: the fixed argument of reduce(), else the gauge of the detection.

discretedict or None

With a detection that searched discrete symmetries (detect(mode="global")): the symmetries that can map a point of the domain into it, the fundamental_domain, inequalities that keep one point of each of their orbits, and the coordinates they are stated in (the reduced model’s for a model with directions). injective and reach of a section refer to the orbits of the directions: a discrete symmetry maps a point of the section to another point with the same output, which the fundamental domain excludes. branches holds per side of the fixed set of the map the chart of that side (see reduce(), branch), branch the chosen one, and why the reason where there are none.

summary(verbose=False, detailed=False)[source]#

The verdict, the reparametrization and one line per block.

Parameters:
verbosebool

Also the invariants of reduced and fixed blocks and the choices of pinned coordinates.

detailedbool

Explain each section.

Returns:
str
to_dict()[source]#

The raw reduction.

Returns:
dict

Nested dicts and lists.

Settings and programs#

symident.reconst_control(relevance_cap=6, relevance_cap_dir=24, relevance_cap_sparse=30, degree_cap=4, sample_slack=5, probe_retries=8, laurent_deg_num=4, laurent_deg_den=2, laurent_cand_cap=200000, term_cap=60, general_deg_num=4, general_deg_den=3, gap_order_cap=8, minsupport_cand_cap=20000, perprime_cap=120, perprime_min_primes=3, homotopy=True, homotopy_degree=4, seed=0, exact_proof=True, degree_cap_max=8, exact_work_cap=500000, input_jet_order=0)[source]#

Saturation and closed-form reconstruction settings.

Parameters:
relevance_capint

Coordinates in one entry for the dense fit; wider entries use sparse interpolation.

relevance_cap_dirint

Coordinates in one direction; a wider one is reported by the support. The narrow route, which samples the kernel on the support of the direction alone, bounds each entry only where the model has no event gaps, resting states or unknown inputs.

relevance_cap_sparseint

Coordinates in one entry for the sparse fit; a wider entry is reported by the support of the direction.

degree_capint

Total degree bound of the dense rational fit.

degree_cap_maxint

Total degree up to which an entry past degree_cap is probed along lines, doubling the bound, and fitted at the degree found.

sample_slackint

Samples beyond the minimum of the fit.

probe_retriesint

Retries of the relevance probe when a perturbation changes the pivots.

laurent_deg_num, laurent_deg_denint

Numerator degree and monomial denominator degree of the sparse Laurent fit.

laurent_cand_capint

Candidate monomials of the Laurent and general sparse fits.

term_capint

Terms of a sparse entry.

general_deg_num, general_deg_denint

Numerator and denominator degree of the general sparse rational fit.

gap_order_capint

Highest order of the power series in the time between events; reaching it is an entry in info["limits"]. Curve samples of resting conditions start at this order and double it, up to four times, where a kernel at eps = 1 needs more.

minsupport_cand_capint

Column subsets searched for directions with small support.

perprime_capint

Samples per prime for the reconstruction under a steady state.

perprime_min_primesint

Primes with samples for a reconstruction under a steady state.

homotopybool

Whether directions still open are fitted along parameter lines as a last route.

homotopy_degreeint

Total degree bound of the entries fitted by the homotopy route.

seedint

Seed of the random choices: sample points and the order of trials. The same seed and model give the same result.

exact_proofbool

Whether closed forms that no route proved over Q are proven through the fields of each regime; this runs a detection per regime unless the field route already did.

exact_work_capfloat

Work budget of those detections, regimes times coordinates times tape length; past it the proof is skipped and listed in info[“limits”].

input_jet_orderint

Jets per unknown input, the input and the time derivatives of the input; 0 chooses them from the model and lengthens them while the Lie order reaches past them.

Returns:
dict
symident.switches(**kw)[source]#

Set switches for the duration of a with block.

Parameters:
**kw

Switch names, listed in the API reference, with their values. A value wins over the environment variable SYMIDENT_<NAME>: True and False switch a flag on and off, and a number sets a number switch. None removes the setting, so that the environment variable decides again. A path switch (MSOLVE, CACHE) takes a path.

Examples

>>> import symident as si
>>> with si.switches(DEBUG=True, TIMING=True):
...     si.detect(model)
symident.install_msolve(dir=None, version=None, jobs=None, quiet=False, ask=None)[source]#

Build msolve from source into a per-user cache.

msolve solves the coupled resting-state systems of detect(..., equilibrate=True) and the systems of solution_count(). It is built with static GMP, MPFR and FLINT; the build needs a C compiler, make, m4 and curl or wget, network access and a few minutes. Not available on Windows. With the default dir symident finds the build without further settings; for another dir set SYMIDENT_CACHE to it.

Parameters:
dirstr, optional

Cache directory; defaults to cache_dir().

versionstr, optional

msolve release; defaults to SYMIDENT_MSOLVE_VERSION, else the tested release.

jobsint, optional

Parallel make jobs; defaults to SYMIDENT_JOBS, else the available cores, at most 8.

quietbool

Suppress the build output.

askbool, optional

Ask before downloading; defaults to whether the session is interactive.

Returns:
str or None

Path of the msolve executable, None if the user declined.

Raises:
RuntimeError

On Windows, without curl/wget, make or m4, or when the build fails.

symident.install.find_msolve()[source]#

The msolve to use and where it was found, (path, source), or (None, None).

Searched in order: SYMIDENT_MSOLVE, the builds in the cache, each deps-msolve-<version>/bin/msolve (msolve.exe on Windows) with an empty file deps-msolve-<version>/.msolve-complete, then msolve on the PATH if it is a tested version. Each candidate must solve a test system.

Returns:
tuple

(path, source) with source "SYMIDENT_MSOLVE", "cache" or "PATH", or (None, None).

symident.install.cache_dir()[source]#

The per-user cache of symident.

Returns:
str

SYMIDENT_CACHE if set, else the platform’s cache directory.

exception symident.sym.msolve.MsolveMissingError[source]#

Raised when the msolve executable is not available.

Switches#

Each switch is an environment variable SYMIDENT_<NAME> or a keyword of switches().

Debugging:

DEBUG

exceptions a route would record in info["errors"] are raised, except failures of SymPy.

DIAG

every diagnostic switch on.

KERNEL_MODE

forward or reverse fixes the mode of the kernel rows, check builds every call in both and raises where the rows differ; environment only.

Diagnostic output:

TIMING

stage times.

LIEDIAG

saturation, Lie order caps and sufficiency proofs.

ROUTEDIAG

errors inside the narrow and forward routes.

FWDDIAG

the forward seed of the resting states.

SOLVEDIAG

each resting-state solve.

HOMDIAG

the homotopy route.

BANKDIAG

the sample bank of the dense fit.

STATICDIAG

the static subsystem fields.

REDDIAG

the reduction solve.

JOINTDIAG

the joint resting-state rows.

CURVEDIAG

the lines and kernels at eps = 1 of curve samples.

Routes:

NOFIELDS

no invariant-field routes (global symmetries, field proof).

NOJET

no jet route inside the narrow route.

NOGROUP

no translation groups in the narrow route.

NOFWDSEED

no forward seed of the resting states.

NODIAG

no diagonal start: resting conditions continued from the forward one only.

RESTCURVE

curve samples of the resting conditions also where a direct solve is cheap.

NORESTCURVE

direct resting solves for reconstruction and checks, never curve samples.

NOSHARED

a tape per condition also where the conditions differ only in the values of symbols.

NOSELECT

every condition analyzed, also where many conditions add nothing to the rank.

Numbers:

LIEPLATEAU

orders the rank stays flat before the saturation ends (3).

LIEPLATEAU_BLOCK

the plateau per condition block; 0 for one plateau.

STACKEDPLATEAU

in the first pass over the stacked rows of many conditions, the plateau as a fraction of the order the rank last rose at, consecutive orders without change (0.5); it decides no claim: that pass settles a rank only by proven directions or invariant fields.

VERIFY_MARGIN

orders the saturation guard checks past the reported one (6).

JETWORK

characters of jets the jet route may form (1000000).

BLOCKMB

megabytes of Taylor values per column block of the kernel (an eighth of the physical memory over the cores, 256 to 1024); environment only.

JETMB

megabytes of the jets the kernel keeps for calls at higher orders (eight column blocks); environment only.

MSOLVE_GB

gigabytes of address space of one call of msolve in discrete() where memory is not given (8).

FIBER_TERMS

terms of the equations of the fiber that one count of discrete() takes (400000).

Installation of msolve:

MSOLVE

path of the msolve executable.

CACHE

directory of the symident cache.

MSOLVE_VERSION

msolve version install_msolve() builds.

GMP_VERSION

GMP version install_msolve() builds.

MPFR_VERSION

MPFR version install_msolve() builds.

FLINT_VERSION

FLINT version install_msolve() builds.

JOBS

parallel jobs of install_msolve().