Skip to content

Commit e5c2680

Browse files
committed
fix structural indexing stuff
1 parent 3417eb9 commit e5c2680

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ DataFrames = "1"
3535
DiffEqParamEstim = "2.1"
3636
DifferentialEquations = "7.7"
3737
Distributions = "0.25"
38-
Documenter = "0.27"
38+
Documenter = "1.4.1"
3939
HomotopyContinuation = "2.6"
4040
Latexify = "0.15, 0.16"
4141
ModelingToolkit = "9.5"

docs/pages.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pages = Any[
1212
"model_creation/constraint_equations.md",
1313
"model_creation/compositional_modeling.md",
1414
# Events.
15-
# Distributed parameters, rates, and initial conditions.
15+
"model_creation/TOBEREMOVED_parametric_stoichiometry.md",# Distributed parameters, rates, and initial conditions.
1616
# Loading and writing models to files.
1717
# Model visualisation.
1818
"model_creation/network_analysis.md",
@@ -48,7 +48,7 @@ pages = Any[
4848
# ODE parameter fitting using Turing.
4949
# SDE/Jump fitting.
5050
# Non-parameter fitting optimisation.
51-
"inverse_problems/07_structural_identifiability.md",
51+
"inverse_problems/structural_identifiability.md",
5252
# Practical identifiability.
5353
# GLobal and local sensitivity analysis.
5454
"Inverse problem examples" => Any[

docs/src/model_simulation/simulation_structure_interfacing.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ When simulating a model, one begins with creating a [problem](https://docs.sciml
33

44
Generally, when we have a structure `simulation_struct` and want to interface with the unknown (or parameter) `G`, we use `simulation_struct[:G]` to access the value, and `simulation_struct[:G] = 5.0` to set it to a new value. However, see the following examples for full details.
55

6+
!!! note
7+
The following tutorial will describe how to interface with problems, integrators, and solutions using `[]` notation. An alternative is to use the `ModelingToolkit.getu`, `ModelingToolkit.getp`, `ModelingToolkit.setu`, and `ModelingToolkit.setp` functions. These requires an additional step to use, however, they can also improve performance when a very large number interfaces are carried out.
8+
69
## Interfacing problem objects
710

811
We begin by demonstrating how we can interface with problem objects. We will demonstrate using a `ODEProblem`, however, it works similarly for other problem types.
@@ -24,7 +27,7 @@ oprob[:X1]
2427
```
2528
with the notation being identical for parameters:
2629
```@example ex1
27-
oprob[:k1]
30+
oprob.ps[:k1]
2831
```
2932

3033
If we want to change an unknown's initial condition value, we use the following notation
@@ -33,6 +36,9 @@ oprob[:X1] = 10.0
3336
```
3437
with parameters using the same notation.
3538

39+
!!! note
40+
When interfacing with a parameter, `.ps` must be appended to the structure uses (e.g. `oprob`). This is not done when species are interfaced with.
41+
3642
#### [Remaking problems using the `remake` function](@id simulation_structure_interfacing_remake)
3743
Typically, when modifying problems, it is recommended to use the `remake` function. Unlike when we do `oprob[:X1] = 10.0` (which modifies the problem in question), `remake` creates a new problem object. The `remake` function takes a problem as input, and any fields you wish to modify (and their new values) as optional inputs. Thus, we can do:
3844
```@example ex1
@@ -74,7 +80,7 @@ integrator[:X1]
7480
```
7581
or a parameter:
7682
```@example ex1
77-
integrator[:k1]
83+
integrator.ps[:k1]
7884
```
7985
Similarly, we can update their values using:
8086
```@example ex1
@@ -95,7 +101,7 @@ sol[:X1]
95101
```
96102
while when we access a parameter we only get a single value:
97103
```@example ex1
98-
sol[:k1]
104+
sol.ps[:k1]
99105
```
100106
Finally, we note that we cannot change the values of solution unknowns or parameters (i.e. both `sol[:X1] = 0.0` and `sol[:k1] = 0.0` generate errors).
101107

@@ -124,7 +130,7 @@ u0 = [X1 => 1.0, X2 => 5.0]
124130
p = [:k1 => 5.0, :k2 => 2.0]
125131
oprob = ODEProblem(rn, u0, (0.0,10.0), p)
126132
127-
oprob[k1]
133+
oprob.ps[k1]
128134
```
129135
To interface with integrators and solutions we use a similar syntax.
130136

0 commit comments

Comments
 (0)