Skip to content

Commit

Permalink
intertypes loads, but some tests don't work
Browse files Browse the repository at this point in the history
  • Loading branch information
olynch committed Jan 18, 2024
1 parent 7b7fdc1 commit 966eed4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
11 changes: 3 additions & 8 deletions src/amr.it
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ end


@sum Distribution begin
StandardUniform(str::String)
StandardUniform()
Uniform(min::Float64, max::Float64)
StandardNormal(str::String)
StandardNormal()
Normal(mean::Float64, variance::Float64)
PointMass(value::Float64)
Undefined(str::String)
Undefined()
end

struct Observable
Expand All @@ -37,11 +37,6 @@ end
Time(id::Symbol, units::Unit)
end

struct Pair
first::Symbol
second::Symbol
end

@sum Note begin
Name(str::String)
Description(str::String)
Expand Down
11 changes: 5 additions & 6 deletions src/amr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ using ..SyntacticModelsBase
@intertypes "amr.it" module amr end

using .amr
import .amr: Pair

nomath = Math("")

Expand All @@ -28,7 +27,7 @@ nounit = Unit("", nomath)
@data Semantic <: AbstractTerm begin
ODEList(statements::Vector{Expression})
ODERecord(rates::Vector{Rate}, initials::Vector{Initial}, parameters::Vector{Parameter}, time::Time)
Typing(system::ACSetSpec, map::Vector{Pair})
Typing(system::ACSetSpec, map::Vector{Base.Pair})
end


Expand Down Expand Up @@ -189,16 +188,16 @@ end

function load(::Type{Distribution}, d::AbstractDict)
@match d begin
Dict("type"=>"StandardUniform1") => StandardUniform
Dict("type"=>"StandardNormal") => StandardNormal
Dict("type"=>"StandardUniform1") => StandardUniform()
Dict("type"=>"StandardNormal") => StandardNormal()
Dict("type"=>"Uniform", "parameters"=>p) => Uniform(p["minimum"], p["maximum"])
Dict("type"=>"Uniform1", "parameters"=>p) => Uniform(p["minimum"], p["maximum"])
Dict("type"=>"Normal", "parameters"=>p) => Normal(p["mu"], p["var"])
Dict("type"=>"PointMass", "parameters"=>p) => PointMass(p["value"])
end
end

load(::Type{Distribution}, ::Nothing) = PointMass(missing)
load(::Type{Distribution}, ::Nothing) = Undefined()

function load(::Type{Note}, d::AbstractDict)
@match d begin
Expand All @@ -221,7 +220,7 @@ function load(::Type{Parameter}, d::AbstractDict)
u,
d["value"],
load(Distribution, get(d,"distribution", nothing))
)
)
end

function load(::Type{ODERecord}, d::AbstractDict)
Expand Down
4 changes: 2 additions & 2 deletions src/askemdecapodes.it
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@sum ASKEMDeca begin
ASKEMDecaExpr(header::amr.Header, model::decapodes.DecaExpr, annotations::Vector{amr.Annotation{Symbol,Symbol}})
ASKEMDecapode(header::amr.Header, model::decapodes.SummationDecapode, annotations::Vector{amr.Annotation{Symbol,Symbol}})
ASKEMDecaExpr(header::amr.Header, model::decapodes.DecaExpr, annotations::Vector{amr.Annotation})
ASKEMDecapode(header::amr.Header, model::decapodeacset.SymSummationDecapode, annotations::Vector{amr.Annotation})
end
1 change: 1 addition & 0 deletions src/decapodes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import DiagrammaticEquations: decapodes, decapodeacset
end

using .askemdecapodes
using .askemdecapodes: ASKEMDecaExpr, ASKEMDecapode

@doc """ ASKEMDeca
Expand Down
8 changes: 3 additions & 5 deletions test/core.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
include("../src/SyntacticModels.jl")

using .SyntacticModels
using .SyntacticModels.ASKEMDecapodes
using SyntacticModels
using SyntacticModels.ASKEMDecapodes

using Test
using JSON3
Expand Down Expand Up @@ -35,4 +33,4 @@ include("amr_examples.jl")
include("decapodes_examples.jl")
include("uwd_examples.jl")
include("composite_models_examples.jl")
include("serialization_mwe.jl")
include("serialization_mwe.jl")

0 comments on commit 966eed4

Please sign in to comment.