Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
TorkelE committed Feb 1, 2024
1 parent 3cfc392 commit 4de0daa
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
matrix:
group:
- Core
- ModelingToolkitExt
- ModelingToolkitSIExt
version:
- '1'
- '1.6'
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ SymbolicUtils = "d1185830-fcd6-423d-90d6-eec64667417b"
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"

[extensions]
ModelingToolkitExt = ["ModelingToolkit", "SymbolicUtils", "Symbolics"]
ModelingToolkitSIExt = ["ModelingToolkit", "SymbolicUtils", "Symbolics"]

[compat]
AbstractAlgebra = "0.34.5, 0.35"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/creating_ode.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ assess_identifiability(ode)

## Defining using `ModelingToolkit`

`StructuralIdentifiability` has an extension `ModelingToolkitExt` which allows to use `ODESystem` from `ModelingToolkit` to describe
`StructuralIdentifiability` has an extension `ModelingToolkitSIExt` which allows to use `ODESystem` from `ModelingToolkit` to describe
a model. The extension is loaded automatically once `ModelingToolkit` is loaded via `using ModelingToolkit`.
In this case, one should encode the equations for the states as `ODESystem` and specify the outputs separately.
In order to do this, we first introduce all functions and scalars:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tutorials/discrete_time.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ assess_local_identifiability(dds; funcs_to_check = [β * S])
As other main functions in the package, `assess_local_identifiability` accepts an optional parameter `loglevel` (default: `Logging.Info`)
to adjust the verbosity of logging.

If one loads `ModelingToolkit` (and thus the `ModelingToolkitExt` extension), one can use `DiscreteSystem` from `ModelingToolkit` to
If one loads `ModelingToolkit` (and thus the `ModelingToolkitSIExt` extension), one can use `DiscreteSystem` from `ModelingToolkit` to
describe the input model (now in terms of difference!):

```@example discrete_mtk
Expand Down
11 changes: 4 additions & 7 deletions ext/ModelingToolkitExt.jl → ext/ModelingToolkitSIExt.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ModelingToolkitExt
module ModelingToolkitSIExt

using DataStructures
using Logging
Expand All @@ -15,9 +15,6 @@ else
using ..ModelingToolkit
end

export mtk_to_si
export assess_local_identifiability, assess_identifiability, find_identifiable_functions

# ------------------------------------------------------------------------------

function eval_at_nemo(e::Num, vals::Dict)
Expand Down Expand Up @@ -96,7 +93,7 @@ Output:
- `conversion` dictionary from the symbols in the input MTK model to the variable
involved in the produced `ODE` object
"""
function mtk_to_si(
function StructuralIdentifiability.mtk_to_si(

Check warning on line 96 in ext/ModelingToolkitSIExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/ModelingToolkitSIExt.jl#L96

Added line #L96 was not covered by tests
de::ModelingToolkit.AbstractTimeDependentSystem,
measured_quantities::Array{ModelingToolkit.Equation},
)
Expand All @@ -106,7 +103,7 @@ function mtk_to_si(
)
end

function mtk_to_si(
function StructuralIdentifiability.mtk_to_si(

Check warning on line 106 in ext/ModelingToolkitSIExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/ModelingToolkitSIExt.jl#L106

Added line #L106 was not covered by tests
de::ModelingToolkit.AbstractTimeDependentSystem,
measured_quantities::Array{<:Symbolics.Num},
)
Expand All @@ -116,7 +113,7 @@ function mtk_to_si(
)
end

function mtk_to_si(
function StructuralIdentifiability.mtk_to_si(

Check warning on line 116 in ext/ModelingToolkitSIExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/ModelingToolkitSIExt.jl#L116

Added line #L116 was not covered by tests
de::ModelingToolkit.AbstractTimeDependentSystem,
measured_quantities::Array{<:SymbolicUtils.BasicSymbolic},
)
Expand Down
6 changes: 6 additions & 0 deletions src/StructuralIdentifiability.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,10 @@ end
using PrecompileTools
include("precompile.jl")

### Extensions ###

# ModelingToolkit extension.
function mtk_to_si end
export mtk_to_si

end
6 changes: 5 additions & 1 deletion test/extensions/modelingtoolkit.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
if GROUP == "All" || GROUP == "ModelingToolkitExt"
if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
@testset "Check identifiability of `ODESystem` object" begin
using ModelingToolkit
using ModelingToolkit: parameters
Expand Down Expand Up @@ -656,4 +656,8 @@ if GROUP == "All" || GROUP == "ModelingToolkitExt"
) == c[:res]
end
end

@testset "Exporting ModelingToolkit Model to SI Model" begin

end
end
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ using StructuralIdentifiability:
const GROUP = get(ENV, "GROUP", "All")

@static if VERSION >= v"1.10.0"
if GROUP == "All" || GROUP == "ModelingToolkitExt"
if GROUP == "All" || GROUP == "ModelingToolkitSIExt"
using Pkg
Pkg.add("ModelingToolkit")
Pkg.add("Symbolics")
Expand Down Expand Up @@ -123,7 +123,7 @@ function get_test_files(group)
if group == "All" ||
(group == "Core" && dir != "./extensions") ||
(
group == "ModelingToolkitExt" &&
group == "ModelingToolkitSIExt" &&
dir == "./extensions" &&
VERSION >= v"1.10.0"
)
Expand Down

0 comments on commit 4de0daa

Please sign in to comment.