PyCoBi.pycobi
Module that contains the base class ODESystem that represents the main user interface of PyCoBi for parameter continuations, results visualization and results storage.
- class pycobi.pycobi.Continuation(key: int, name: str | None, branch_id: int, icps: ~typing.List[tuple] = <factory>, auto_solution: ~typing.Any | None = None, summary: ~pandas.core.frame.DataFrame | None = None)[source]
Bases:
objectOne continuation tracked by ODESystem — bundles together what was previously scattered across the auto_solutions, results, _results_map, and _branches dicts.
Fields
- key
The pycobi key (an int) under which this continuation is stored.
- name
User-supplied name passed to run(…, name=…), or None.
- branch_id
auto-07p’s BR identifier for the branch this continuation lives on. Multiple continuations may share a branch_id (e.g. when one extends another or when bidirectional merges into the same branch).
- icps
Continuation parameter index tuples used to grow this branch. A bidirectional run that goes both ways in PAR(4) records [(4,)] once; a branch that was extended a second time in PAR(5) appends (5,).
- auto_solution
The auto-07p
bifDiagobject holding the actual solution data. Not pickle-safe — excluded from to_file; on from_file this will be None for loaded instances.- summary
PyCoBi’s parsed DataFrame summary of the continuation. Populated by _create_summary after auto.run returns.
- auto_solution: Any = None
- branch_id: int
- icps: List[tuple]
- key: int
- name: str | None
- summary: DataFrame | None = None
- class pycobi.pycobi.ODESystem(eq_file: str, working_dir: str | None = None, auto_dir: str | None = None, init_cont: bool = False, params: list | None = None, state_vars: list | None = None, **kwargs)[source]
Bases:
object- HOMCONT_PSI_NAMES = {1: 'Resonant eigenvalues (neutral saddle)', 2: 'Double real stable leading eigenvalues', 3: 'Double real unstable leading eigenvalues', 4: 'Neutral saddle / saddle-focus / bi-focus', 5: 'Neutrally-divergent saddle-focus (stable complex)', 6: 'Neutrally-divergent saddle-focus (unstable complex)', 7: 'Three leading stable eigenvalues', 8: 'Three leading unstable eigenvalues', 9: 'Local bifurcation — NSTAB decreases (zero eigvalue / Hopf)', 10: 'Local bifurcation — NSTAB increases', 11: 'Orbit flip (leading stable direction)', 12: 'Orbit flip (leading unstable direction)', 13: 'Inclination flip (stable manifold)', 14: 'Inclination flip (unstable manifold)', 15: 'Non-central homoclinic to saddle-node, stable manifold (codim-2 non-central SNIC bifurcation, Nechyporenko-Ashwin-Tsaneva-Atanasova 2026)', 16: 'Non-central homoclinic to saddle-node, unstable manifold (codim-2 non-central SNIC bifurcation, Nechyporenko-Ashwin-Tsaneva-Atanasova 2026)'}
- additional_attributes
- auto_solutions
- blocked_indices = (10, 15)
- continuations
- continue_homoclinic(origin: Any | str | int | None = None, *, starting_point: str | None = None, ICP: list, NUNSTAB: int, NSTAB: int, IEQUIB: int = 1, ITWIST: int = 0, IPSI: tuple = (15, 16), name: str = 'hom', dat_basename: str | None = None, n_points: int = 201, label_psi_crossings: bool = True, saddle_state: dict | None = None, warmup_period: float | None = None, **run_kwargs) tuple[source]
Continue a homoclinic orbit seeded from a near-homoclinic LC or a pre-existing
.datfile.Wraps the auto-07p HomCont workflow (Chapter 20 of the AUTO manual) so the calling code can describe a saddle-node-on-invariant-cycle (SNIC) detection in a single line:
# Mode A — extract the seed from an LC continuation: ode.continue_homoclinic( origin='lc_branch', # an LC continuation that approached a homoclinic starting_point='LP1', # label where the orbit's period blew up ICP=['eta', 'J'], # 2-parameter homoclinic curve NUNSTAB=1, NSTAB=1, # saddle's eigenvalue split IPSI=(15, 16), # SNIC test functions ) # Mode B — start from a pre-existing .dat (auto-07p demo style): ode.continue_homoclinic( dat_basename='mtn', # working_dir/mtn.dat is read verbatim ICP=[1, 2], NUNSTAB=1, NSTAB=1, IEQUIB=2, IPSI=(15, 16), PAR={11: 1046.18, 12: 5.74, 13: 0.51}, # IEQUIB>0 equilibrium )
Pipeline (mode A):
Extract the orbit at
(origin, starting_point)and write it as a.datfile in the working directory (viaextract_orbit_to_dat()); read the seed’s PAR vector off the auto solution and forward viaPAR={...}.Run a
c='hom'continuation that reads the.datas the initial solution (ISTART=1), with the requestedIPSItest functions. The corresponding test-function PARs (PAR(20 + IPSI[j])) are appended toICPso they’re recorded along the branch.When
label_psi_crossings=True(default), scan those PAR columns for sign changes and mark each crossing as a'SNIC'bifurcation on the resulting summary. Note: the label name is a historical shorthand — what these flags actually detect is the codim-2 non-central SNIC bifurcation (Nechyporenko, Ashwin & Tsaneva- Atanasova, A novel route to oscillations via non-central SNICeroclinic bifurcation, SIAM J. Appl. Dyn. Syst. 2026, arXiv:2412.12298), i.e. a homoclinic to a saddle-node whose return trajectory comes in along the saddle-node’s stable manifold rather than its central (zero-eigenvalue) direction. It is not the standard codim-1 SNIC (saddle-node on an invariant cycle) — the non-central SNIC is a codim-2 endpoint that bounds a curve of standard SNIC bifurcations.
Pipeline (mode B):
Same as mode A but step 1 reads an existing
working_dir/<dat_basename>.datinstead of synthesising it. PassPAR={...}to set whatever parameter values the seed orbit corresponds to (typically required forIEQUIB > 0workflows where the equilibrium values live inPAR(11+i)).- Parameters:
origin – Key of the LC continuation that approached the homoclinic.
starting_point – Label of the orbit on
originto seed from.ICP – Continuation parameters for the homoclinic curve (typically two free model parameters). The PSI-tracking PARs are appended automatically — do not include them yourself.
NUNSTAB – Number of unstable / stable eigenvalues of the saddle the orbit is homoclinic to. See AUTO manual §20.4.
NSTAB – Number of unstable / stable eigenvalues of the saddle the orbit is homoclinic to. See AUTO manual §20.4.
IEQUIB – Equilibrium-handling flag (1 = solve for the saddle as part of the continuation, the most common choice).
ITWIST – 0 = no adjoint; 1 = compute orientation-flip indicator. AUTO §20.4.
IPSI – PSI test functions to monitor. Defaults to
(15, 16)— non-central homoclinic to saddle-node in the stable / unstable manifold respectively (AUTO §20.5). Zero-crossings of these two mark the codim-2 non-central SNIC bifurcation in the sense of Nechyporenko et al. 2026 (arXiv:2412.12298) — a vertex that terminates a curve of codim-1 SNIC bifurcations. SeeHOMCONT_PSI_NAMESfor the full table of 16 PSI test functions auto-07p makes available.name – Name to register the resulting continuation under.
dat_basename – Stem for the generated
.datfile (defaultf'{name}_seed'). Auto-07p readsf'{stem}.dat'when givendat=stem.n_points – Mesh resolution for the seed (forwarded to
extract_orbit_to_dat()).label_psi_crossings – When True, mark PSI sign changes as
'SNIC'in the summary’sbifurcationcolumn for downstream plotting / inspection.**run_kwargs – Forwarded to
ODESystem.run(). Common picks:DSMAX,NMX,UZR,UZSTOP,RL0,RL1.
- Returns:
(summary, continuation)from the underlyingrun()call. Whenlabel_psi_crossingsis True,summary['bifurcation']carries'SNIC'labels at every detected PSI zero-crossing.- Return type:
tuple
- dir
- extract(keys: list, cont: Any | str | int, point: str | int | None = None) tuple[source]
Extract properties from a solution.
- Parameters:
keys – Keys of the properties (e.g. state variable names, parameter names, …).
cont – Key of the solution branch.
point – Key of the solution on the branch. When omitted (default), all rows of the summary are returned; when provided, only the row at that label.
- Returns:
Tuple with 2 entries: (1) the requested slice of the continuation summary, either a DataFrame (when point is None — multiple rows × len(keys) cols) or a Series (when point is provided — a single labeled row indexed by the requested keys); (2) a dict mapping each input key to the column name that was actually used to look it up in the summary (these can differ when PyCoBi’s _var_map_inv translates ‘PAR(i)’ / ‘U(i)’ back to user-facing names).
- Return type:
tuple
- extract_orbit_to_dat(cont: Any | str | int, point: str | int, path: str | Path, *, n_points: int | None = None, variables: list | None = None, phase_shift_to: dict | None = None) Path[source]
Write a labelled periodic-orbit profile to an auto-07p
.datfile.Used to seed HomCont (
IPS=9) continuations from a near-homoclinic limit cycle. Reads the per-mesh state values directly from auto-07p’s solution object — no need for the calling continuation to have been run withget_timeseries=True.- Parameters:
cont – Key of the limit-cycle continuation that contains the labelled orbit (name string, integer branch index, or the continuation object).
point – Auto-07p label of the orbit on that branch (
'LP1','UZ2', …).path – Output file path;
.datis appended if missing.n_points – If given, linearly interpolate the orbit onto this many evenly spaced mesh points (forwarded to
write_auto_dat()).variables – Optional subset of state-variable names to write. Defaults to every variable auto-07p exposed via the solution’s
coordnames.phase_shift_to – Optional
{var_name: target_value, ...}dict that re-rolls the orbit so its closest-approach point to the given state lies att = 0. Distance is the L2 norm over the keys provided (other state variables are not consulted). Useful when seedingcontinue_homoclinicfrom a near-homoclinic LC: the orbit’st = 0end should sit near the saddle equilibrium so HomCont’s stable / unstable manifold projections align with the orbit’s phase from step one. Without this, the LC’s arbitrary phase choice typically leaves auto-07p’s HomCont Newton step unable to advance off the seed (MX at step 2).
- Returns:
The path the file was written to.
- Return type:
pathlib.Path
- classmethod from_file(filename: str, auto_dir: str | None = None)[source]
Load ODESystem from a pickle file written by to_file.
- Parameters:
filename – Path to the pickle file written by ODESystem.to_file.
auto_dir – Installation directory of auto-07p.
- Returns:
ODESystem instance with state restored from the file. Slots not stored on disk (the live auto module, the PyRates CircuitTemplate, the cwd snapshots) are re-initialised by __init__ rather than from the file.
- Return type:
- classmethod from_template(template: CircuitTemplate, working_dir: str | None = None, auto_dir: str | None = None, init_cont: bool = False, init_kwargs: dict | None = None, analytical_jacobian: bool = True, auto_constants: str | tuple | list = ('ivp',), **kwargs)[source]
Instantiates ODESystem from a pyrates.CircuitTemplate.
- Parameters:
template – Instance of the class pyrates.CircuitTemplate.
working_dir – Directory in which all the fortran equation and auto-07p constant files are saved.
auto_dir – Installation directory of auto-07p.
init_cont – If true, an IVP time integration is run at instantiation against the freshly generated c.ivp file. Defaults to false — set to true to opt into the legacy behaviour. See __init__ for details.
init_kwargs – Additional keyword arguments that will be provided to the ODESystem.run method for performing the time integration.
analytical_jacobian – If true (default), instruct PyRates to symbolically differentiate the vector field and emit DFDU/DFDP inside the generated func subroutine; the generated c.* file will set JAC=1 so auto-07p uses the analytical Jacobian. Set to false to fall back to auto-07p’s finite-difference Jacobian (useful when symbolic differentiation is slow or produces unwieldy expressions for the model at hand). Can be overridden on a per-continuation basis by passing JAC=0 or JAC=1 to ODESystem.run.
auto_constants –
Name (or iterable of names) of auto-07p continuation scenarios PyRates should emit c.<name> files for. One file is written per requested scenario, each pre-configured with auto-07p constants appropriate for that mode. Recognised scenarios:
'ivp'— initial-value problem / time integration (IPS=-2). Required wheninit_cont=True.'eq'— equilibrium continuation in one parameter (IPS=1).'lc'— limit-cycle continuation in one parameter, with PAR(11) as the period (IPS=2).'bvp'— boundary-value problem (IPS=4).
Pass e.g.
auto_constants=('ivp', 'eq', 'lc')to set up all three at once and then switch scenarios on a per-call basis viaode.run(c='eq', ...). Auto-07p constants passed as kwargs (NMX,DSMAX,UZSTOP, …) apply to every requested scenario; per-scenario overrides can be applied at run-time on the correspondingODESystem.runcall. Defaults to('ivp',)for backward compatibility.kwargs –
Additional keyword arguments provided to the pyrates.CircuitTemplate.get_run_func method that is used to generate the fortran equation file and the auto constants file that will be used to initialize ODESystem.
For boundary-value problems (
'bvp'scenario, IPS=4), the following kwargs are recognised:boundary_conditions: list of residual expressions in PyRates-name space; tokensu0_<var>/u1_<var>refer to the state at t=0 / t=1, andpar_<param>refers to a model parameter. Each entry should evaluate to 0 at the solution.NBCis auto-derived from the list length. Example:boundary_conditions=['u1_r - u0_r', 'u1_v - u0_v']for a periodic BC.integral_constraints: same DSL but with token prefixesu_<var>/uold_<var>/udot_<var>/upold_<var>.NINTis auto-derived. Example:integral_constraints=['u_r * udot_r']for a phase condition.bcnd_fortran+nbc: raw-Fortran escape hatch for theBCNDsubroutine body when the DSL is too restrictive. Auto-07p indexing applies (FB(i) = ...,U0(j),U1(j),args(k)).nbcmust match the number of residuals the body fills.icnd_fortran+nint: same for theICNDsubroutine body.
boundary_conditionsandbcnd_fortranare mutually exclusive (likewise theICNDpair). When none are provided the routines fall back to bare stubs (the existing IPS=1/2/-2 behaviour).
- Returns:
ODESystem instance.
- Return type:
- classmethod from_yaml(path: str, working_dir: str | None = None, auto_dir: str | None = None, init_cont: bool = False, init_kwargs: dict | None = None, analytical_jacobian: bool = True, auto_constants: str | tuple | list = ('ivp',), **kwargs)[source]
Instantiates ODESystem from a YAML definition file.
- Parameters:
path – Full path to a YAML model definition file for a pyrates.CircuitTemplate.
working_dir – Directory in which all the fortran equation and auto-07p constant files are saved.
auto_dir – Installation directory of auto-07p.
init_cont – If true, an IVP time integration is run at instantiation against the freshly generated c.ivp file. Defaults to false — set to true to opt into the legacy behaviour. See __init__ for details.
init_kwargs – Additional keyword arguments that will be provided to the ODESystem.run method for performing the time integration.
analytical_jacobian – If true (default), instruct PyRates to symbolically differentiate the vector field and emit DFDU/DFDP inside the generated func subroutine; the generated c.* file will set JAC=1 so auto-07p uses the analytical Jacobian. Set to false to fall back to auto-07p’s finite-difference Jacobian (useful when symbolic differentiation is slow or produces unwieldy expressions for the model at hand).
auto_constants – Name (or iterable of names) of auto-07p continuation scenarios to generate c.<name> files for. See from_template for the recognised scenarios and their default constants. Defaults to (‘ivp’,) for backward compatibility.
kwargs – Additional keyword arguments provided to the pyrates.CircuitTemplate.get_run_func method that is used to generate the fortran equation file and the auto constants file that will be used to initialize ODESystem.
- Returns:
ODESystem instance.
- Return type:
- get_continuation(key_or_name: int | str) Continuation[source]
Return the Continuation dataclass for a stored continuation, looked up by user-supplied name or by pyauto-key int.
Examples
>>> sols, _ = ode.run(starting_point='EP2', name='eta_branch', ICP='eta', ...) >>> cont = ode.get_continuation('eta_branch') >>> cont.branch_id, cont.icps, len(cont.summary) (1, [(4,)], 30)
- get_solution(cont: Any | str | int, point: str | int | None = None) Any | tuple[source]
Extract auto solution object of a given solution/solution branch.
- Parameters:
cont – Key of the solution branch.
point – Key of the solution on the branch.
- Returns:
Solution type (only if point is provided), auto solution object.
- Return type:
Union[Any, tuple]
- get_summary(cont: Any | str | int | None = None, point=None) DataFrame[source]
Extract summary of continuation from PyCoBi.
- Parameters:
cont – Key of the solution branch.
point – Key of the solution on the branch.
- Returns:
All recorded state variables, parameters, etc. for the solution/solution branch.
- Return type:
DataFrame
- label_homoclinic_terminus(cont: Any | str | int, *, threshold_ratio: float = 5.0, period_var: str = 'PAR(11)', label: str = 'HC') int | None[source]
Heuristically tag the homoclinic terminus on an LC continuation.
A saddle-loop homoclinic shows up at the end of a limit-cycle branch as a divergence of the orbit’s period: as the parameter approaches the homoclinic value, the period grows without bound (logarithmically in the canonical case). Auto-07p doesn’t issue a built-in label for this — the continuation just stops at NMX or hits DSMIN — but a useful rule-of-thumb is “if the maximum period on the branch is at least
threshold_ratiotimes the minimum period, the row carrying that maximum is approximating a homoclinic orbit”.This helper applies that heuristic to the summary of
cont: finds the row with the largestPAR(11)value, and — if the max-to-min period ratio exceedsthreshold_ratio— overwrites that row’sbifurcationentry withlabel(default'HC'). Stronger auto-07p labels (LP,PD,BP,HB) at the same row are preserved;RGandEPare replaced. Returns the row’s index, orNoneif the heuristic didn’t trigger.- Parameters:
cont – Key of the LC continuation to scan.
threshold_ratio – Minimum max-to-min period ratio for the heuristic to fire. Default 5.0 — generous enough that ordinary fold-of-cycles (where the period grows ~2x along the branch) don’t get relabelled, but tight enough that the period-divergence at a saddle-loop homoclinic stands out clearly.
period_var – Summary column name carrying the period. PyCoBi’s default is
'PAR(11)'(auto-07p’s reserved period slot).label – Replacement bifurcation label. Default
'HC'(mnemonic for homoclinic).
- Returns:
Row index of the relabelled row, or
Noneif the period growth was below threshold (no homoclinic detected).- Return type:
int or None
- merge(key: int, cont, icp: tuple)[source]
Merges two solutions from two separate auto continuations.
- Parameters:
key – PyCoBi identifier under which the merged solution should be stored. Must be equal to identifier of first continuation.
cont – auto continuation object that should be merged with the continuation object under key.
icp – Continuation parameter that was used in both continuations that are to be merged.
- plot_bifurcation_points(solution_types: DataFrame, x_vals: DataFrame, y_vals: DataFrame, ax: Axes, default_color: str = 'k', default_marker: str = '*', default_size: float = 10, ignore: list | None = None, custom_bf_styles: dict | None = None) tuple[source]
Plot markers for special solutions at coordinates in 2D space.
- Parameters:
solution_types – Type of each solution, entries of DataFrame should be strings.
x_vals – X-coordinates of each solution.
y_vals – Y-coordinates of each special solution
ax – Axis in which to plot the data. If not provided, a new figure will be created.
default_color – Default color to be used if bifurcation style is not known.
default_marker – Default marker style to be used if bifurcation style is not known.
default_size – Default marker size.
ignore – List of solution types that should not be displayed.
custom_bf_styles – Dictionary containing adjustments to the default bifurcation markers and colors.
- Returns:
A 2-entry tuple of (1) a list of PathCollections that correspond to bifurcation points, and (2) a list of corresponding bifurcation types.
- Return type:
tuple
- plot_continuation(x: str, y: str, cont: Any | str | int, ax: Axes | None = None, force_axis_lim_update: bool = False, bifurcation_legend: bool = True, get_stability: bool = True, **kwargs) LineCollection[source]
Line plot of 1D/2D parameter continuations and the respective codimension 1/2 bifurcations.
- Parameters:
x – Key of the parameter/variable plotted on the x-axis.
y – Key of the variable/parameter plotted on the y-axis.
cont – Key of the solution branch to be plotted.
ax – Axis in which to plot the data. If not provided, a new figure will be created.
force_axis_lim_update – If true, the axis limits of x and y axis will be updated after creating the line plots.
bifurcation_legend – If true, a legend will be plotted that lists the type of all special solutions on a continuation curve.
get_stability – If true, the stability of the solutions will be indicated via different line styles.
kwargs – Additional keyword arguments that allow to control the appearance of the line plot.
- Returns:
Line object that was created.
- Return type:
LineCollection
- plot_continuation_grid(plots: list, ncols: int = 2, figsize: tuple | None = None, sharex: bool = False, sharey: bool = False, **shared_kwargs) tuple[source]
Lay out multiple 1D/2D continuations as a grid of subplots.
Convenience helper to compare continuations side-by-side (e.g. a codim-1 scan in eta next to its codim-2 fold curve in (eta, Delta), or several “same x/y, different parameter setting” diagrams).
- Parameters:
plots – List of dicts, one per subplot. Each dict must contain
'x','y', and'cont'(forwarded toplot_continuation()as the corresponding positional args). Any additional keys overrideshared_kwargsfor that specific subplot — except'title', which is set on the subplot’s axes viaax.set_title. The optional'panel_label'key is drawn in the upper-left corner of the subplot (useful for figure-quality (a), (b), (c) annotations).ncols – Number of columns in the grid. Rows are derived from
ceil(len(plots) / ncols). Default 2.figsize – Forwarded to
matplotlib.pyplot.subplots(). Defaults to(5 * ncols, 4 * nrows)— i.e. each subplot gets ~5x4 inches.sharex – Forwarded to
matplotlib.pyplot.subplots(). Useful when all panels live on the same parameter range.sharey – Forwarded to
matplotlib.pyplot.subplots(). Useful when all panels live on the same parameter range.shared_kwargs – Keyword arguments applied to every subplot (e.g.
bifurcation_legend=Falseto suppress the per-panel legend). Per-plot keys override these.
- Returns:
(fig, axes, line_cols).axesis the flat list ofAxes(lengthlen(plots); trailing positions in the grid that have no plot are deleted).line_colsis the list of LineCollections returned by eachplot_continuationcall, in the same order asplots.- Return type:
tuple
- plot_timeseries(var: str, cont: Any | str | int, points: list | None = None, ax: Axes | None = None, linespecs: list | None = None, **kwargs) Axes[source]
Plot state variable of a periodic solution over time.
- Parameters:
var – Key of the state variable.
cont – Key of the solution branch.
points – List with keys of the solutions for which to create time series plots. When
None(default), every labelled point on the continuation is plotted as a separate trace.ax – Axis in which to plot the data. If not provided, a new figure will be created.
linespecs – Per-trace keyword overrides;
linespecs[i]is merged intokwargsfor the i-th point.kwargs – Additional keyword arguments that control the appearance of the plot.
- Returns:
Axis object that contains the plotted timeseries.
- Return type:
plt.Axes
- plot_trajectory(variables: list | tuple, cont: Any | str | int, point: str | int | None = None, ax: Axes | None = None, force_axis_lim_update: bool = False, cutoff: float | None = None, colorbar: bool = False, colorbar_label: str | None = None, **kwargs) LineCollection[source]
Plot trajectory of state variables through phase space over time.
- Parameters:
variables – State variables for which to create the trajectory. If 2, a 2D plot will be created, if 3, a 3D plot.
cont – Key of the solution branch to be plotted.
point – Key of the solution on the solution branch for which to plot the trajectories.
ax – Axis in which to plot the data. If not provided, a new figure will be created.
force_axis_lim_update – If true, the axis limits of x and y-axis will be updated after creating the line plots.
cutoff – Initial time to be disregarded for plotting.
colorbar – For 3D plots only: if true, attach a colorbar to the figure showing the scalar that
_get_3d_line_collectionmapped onto the LineCollection’s color (default: the projected x-axis variable). Useful when the colour gradient already encodes time or a state variable. Ignored for 2D plots.colorbar_label – Label for the colorbar. Defaults to the array key (
'x'/'y'/'z'— whichever the LineCollection’sarray=kwarg points at).kwargs – Additional keyword arguments that allow to control the appearance of the line plot.
- Returns:
Line object that was created.
- Return type:
LineCollection
- property pyrates_template
- static reset_auto_state() None[source]
Clear auto-07p’s per-process cross-run state (
parnames,unames).auto-07p’s Python wrapper deliberately leaves the
parnames/unamesentries on its global runner intact between successiverun()calls — seeauto/runAUTO.py:# do not completely replace existing constants data but # leave the special keys such as unames, parnames, etc, intact
That’s helpful when iterating on a single model, but it leaks across unrelated model loads. Concretely: an ODESystem for model A whose generated c.* declares
unames = {1: 'r', 2: 'v'}populates the global runner; instantiating model B whose c.* declares no unames will inherit{1: 'r', 2: 'v'}and silently relabel B’s DataFrame columns with A’s state-variable names. The same applies toparnames.Call this between unrelated model loads (typically in test teardown, or right before constructing a fresh ODESystem from a different model). No-ops if auto was never imported, or if its internal layout differs from what we expect.
- results
- run(origin: int | str | object | None = None, starting_point: str | int | None = None, variables: list | None = None, params: list | None = None, get_stability: bool = True, get_period: bool = False, get_timeseries: bool = False, get_eigenvals: bool = False, get_lyapunov_exp: bool = False, reduce_limit_cycle: bool = True, bidirectional: bool = False, name: str | None = None, _reverse_direction: bool = False, **auto_kwargs) tuple[source]
Wraps auto-07p command run and stores requested solution details on instance.
- Parameters:
origin – Key of the solution branch that contains the solution starting_point, from which the new continuation will be started.
starting_point –
Solution on the origin branch to start the new continuation from. Accepted forms:
Auto-07p label string —
'EP','LP1','HB2'etc. The first two characters are the bifurcation type; the optional trailing integer disambiguates when the branch carries several solutions of the same type (1-based, defaults to 1). The IVP that init_cont=True runs produces'EP1'for the initial state and'EP2'for the converged steady state — use'EP2'when starting an equilibrium continuation from the IVP’s terminal state.Bare bifurcation type (no number) —
'EP'is equivalent to'EP1'.Integer point index — a 1-based auto-07p point number on the branch (the
PTcolumn of the printed table). Useful when auto produced unlabeled regular points that you want to continue from.None— only valid on the very first call against a fresh ODESystem (when no prior continuation exists to extend); subsequent calls require an explicit starting point so PyCoBi knows which branch to extend.
variables – Keys of the state variables that should be recorded for each continuation recording step.
params – Keys of the parameters that should be recorded for each continuation recording step.
get_stability – If true, the stability of each solution will be stored in the results under the key ‘stability’.
get_period – If true, the period of periodic solutions will be stored in the results under the key ‘period’.
get_timeseries – If true, the time vector associated with the state variables of a periodic solution will be stored under the key ‘time’.
get_eigenvals – If true, the eigenvalues (floquet multipliers) or steady-state (periodic) solutions will be stored under the key ‘eigenvalues’.
get_lyapunov_exp – If true, the local lyapunov exponents of solutions will be stored under the key ‘lyapunov’.
reduce_limit_cycle – If true, the values of each state variable will be reduced to the minimum and maximum for limit cycle solutions. Else, the state variable values will be stored for multiple discretized points along the limit cycle solution (number depends on the arguments passed to Auto).
bidirectional – If true, parameter continuation will be performed into both directions for a given continuation parameter.
name – Name, under which the resulting solution branch will be accessible for future continuations.
_reverse_direction – Private flag set internally by the recursive call that bidirectional=True makes. Tells run() that this invocation is the reverse-direction half of a bidirectional continuation, so the result is merged into the forward branch rather than registered as a fresh continuation. Don’t pass manually.
auto_kwargs – Additional keyword arguments to be passed to the auto command run. All auto-07p constants can be overridden here (e.g. NMX, DSMAX, ICP, …). In particular, JAC=0/JAC=1 overrides the Jacobian source for this single continuation: pass JAC=0 to force finite-difference Jacobian even if from_template / from_yaml was instantiated with analytical_jacobian=True, and vice versa.
- Returns:
DataFrame with the results, auto solution branch object.
- Return type:
tuple
- to_file(filename: str, results_only: bool = True, **kwargs) None[source]
Save the instance state on disc via pickle.
- Parameters:
filename – Path to write the pickle file to. If a file already exists at this path it will be overwritten.
results_only – When true (default), only the PyCoBi-side bookkeeping (results, _branches, _results_map) is saved — enough to reproduce DataFrames and plots without rerunning auto-07p. When false, all pickle-safe slots are saved (see _PICKLE_EXCLUDE for the slots intentionally omitted because they can’t round-trip).
kwargs – Extra metadata to attach to the dump. Restored as additional_attributes.
- Return type:
None