-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from hetalang/paramsfx
ArrayPartition for parameters
- Loading branch information
Showing
11 changed files
with
274 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// heta build --source ./in_vitro_model/index.heta | ||
|
||
include ./qsp-units.heta | ||
// include model.heta | ||
|
||
include one-compartment.heta | ||
|
||
// #export { format: DBSolve, filepath: dbsolve_in_vitro }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//heta build --source ./in_vitro_model/index.heta | ||
|
||
t {units: hour}; | ||
|
||
F @Const {units: UL} = 0.97; | ||
dose @Const {units: pg} = 10; | ||
kabs @Const {units: 1/h} = 1e-2; | ||
kel @Const {units: 1/h} = 1.2e-3; | ||
|
||
time_start @Const {units: h} = 100; | ||
time_end @Const {units: h} = 100.1; | ||
time_inj @Const {units: h} = .1; | ||
dose_inj @Const {units: pg} = 1; | ||
switch @Record {units: UL} .= 0; | ||
|
||
gut @Compartment {units: L} .= 1; | ||
Vd @Compartment {units: L} .= 5; | ||
|
||
a0 @Species { | ||
compartment: gut, | ||
units: pg, | ||
output: true, | ||
isAmount: true | ||
}; | ||
c1 @Species { | ||
compartment: Vd, | ||
units: pg/L, | ||
output: true | ||
}; | ||
r_inj @Reaction { actors: > a0, units: pg/h }; | ||
r_abs @Reaction { actors: a0 > c1, units: pg/h }; | ||
r_el @Reaction { actors: c1 > , units: pg/h }; | ||
|
||
a0 .= F * dose; | ||
c1 .= 0; | ||
|
||
r_inj := switch * dose_inj / time_inj; | ||
r_abs := kabs * a0; | ||
r_el := kel * c1 * Vd; | ||
|
||
sw @TimeSwitcher { start: time_start, active: false }; | ||
switch [sw]= 1; | ||
|
||
sw_end @TimeSwitcher { start: time_end, active: false }; | ||
switch [sw_end]= 0; | ||
|
||
// #export { format: SBML, filepath: sbml_output }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
fmole #defineUnit { | ||
units: [ { kind: mole, multiplier: 1e-15 } ] | ||
}; | ||
pmole #defineUnit { | ||
units: [ { kind: mole, multiplier: 1e-12 } ] | ||
}; | ||
nmole #defineUnit { | ||
units: [ { kind: mole, multiplier: 1e-9 } ] | ||
}; | ||
umole #defineUnit { | ||
units: [ { kind: mole, multiplier: 1e-6 } ] | ||
}; | ||
mmole #defineUnit { | ||
units: [ { kind: mole, multiplier: 1e-3 } ] | ||
}; | ||
fM #defineUnit { | ||
units: [ { kind: mole, multiplier: 1e-15 }, { kind: litre, exponent: -1} ] | ||
}; | ||
|
||
pM #defineUnit { | ||
units: [ { kind: mole, multiplier: 1e-12 }, { kind: litre, exponent: -1} ] | ||
}; | ||
nM #defineUnit { | ||
units: [ { kind: mole, multiplier: 1e-9 }, { kind: litre, exponent: -1} ] | ||
}; | ||
uM #defineUnit { | ||
units: [ { kind: mole, multiplier: 1e-6 }, { kind: litre, exponent: -1} ] | ||
}; | ||
mM #defineUnit { | ||
units: [ { kind: mole, multiplier: 1e-3 }, { kind: litre, exponent: -1} ] | ||
}; | ||
M #defineUnit { | ||
units: [ { kind: mole }, { kind: litre, exponent: -1} ] | ||
}; | ||
kM #defineUnit { | ||
units: [ { kind: mole, multiplier: 1e3 }, { kind: litre, exponent: -1 } ] | ||
}; | ||
|
||
fL #defineUnit { | ||
units: [ { kind: litre, multiplier: 1e-15 } ] | ||
}; | ||
pL #defineUnit { | ||
units: [ { kind: litre, multiplier: 1e-12 } ] | ||
}; | ||
nL #defineUnit { | ||
units: [ { kind: litre, multiplier: 1e-9 } ] | ||
}; | ||
uL #defineUnit { | ||
units: [ { kind: litre, multiplier: 1e-6 } ] | ||
}; | ||
mL #defineUnit { | ||
units: [ { kind: litre, multiplier: 1e-3 } ] | ||
}; | ||
dL #defineUnit { | ||
units: [ { kind: litre, multiplier: 1e-1 } ] | ||
}; | ||
L #defineUnit { | ||
units: [ { kind: litre } ] | ||
}; | ||
|
||
fs #defineUnit { | ||
units: [ { kind: second, multiplier: 1e-15 } ] | ||
}; | ||
ps #defineUnit { | ||
units: [ { kind: second, multiplier: 1e-12 } ] | ||
}; | ||
ns #defineUnit { | ||
units: [ { kind: second, multiplier: 1e-9 } ] | ||
}; | ||
us #defineUnit { | ||
units: [ { kind: second, multiplier: 1e-6 } ] | ||
}; | ||
ms #defineUnit { | ||
units: [ { kind: second, multiplier: 1e-3 } ] | ||
}; | ||
s #defineUnit { | ||
units: [ { kind: second } ] | ||
}; | ||
h #defineUnit { | ||
units: [ { kind: hour, multiplier: 1 } ] | ||
}; | ||
week #defineUnit { | ||
units: [ { kind: day, multiplier: 7 } ] | ||
}; | ||
|
||
fg #defineUnit { | ||
units: [ { kind: kilogram, multiplier: 1e-18 } ] | ||
}; | ||
pg #defineUnit { | ||
units: [ { kind: kilogram, multiplier: 1e-15 } ] | ||
}; | ||
ng #defineUnit { | ||
units: [ { kind: kilogram, multiplier: 1e-12 } ] | ||
}; | ||
ug #defineUnit { | ||
units: [ { kind: kilogram, multiplier: 1e-9 } ] | ||
}; | ||
mg #defineUnit { | ||
units: [ { kind: kilogram, multiplier: 1e-6 } ] | ||
}; | ||
g #defineUnit { | ||
units: [ { kind: kilogram, multiplier: 1e-3 } ] | ||
}; | ||
kg #defineUnit { | ||
units: [ { kind: kilogram } ] | ||
}; | ||
|
||
kat #defineUnit { | ||
units: [ { kind: katal } ] | ||
}; | ||
|
||
cell #defineUnit { | ||
units: [ { kind: item } ] | ||
}; | ||
kcell #defineUnit { | ||
units: [ { kind: item, multiplier: 1e3 } ] | ||
}; | ||
|
||
cal #defineUnit { | ||
units: [ { kind: joule, multiplier: 4.1868 } ] | ||
}; | ||
kcal #defineUnit { | ||
units: [ { kind: joule, multiplier: 4.1868e3 } ] | ||
}; | ||
|
||
fm #defineUnit { | ||
units: [ { kind: metre, multiplier: 1e-15 } ] | ||
}; | ||
pm #defineUnit { | ||
units: [ { kind: metre, multiplier: 1e-12 } ] | ||
}; | ||
nm #defineUnit { | ||
units: [ { kind: metre, multiplier: 1e-9 } ] | ||
}; | ||
um #defineUnit { | ||
units: [ { kind: metre, multiplier: 1e-6 } ] | ||
}; | ||
mm #defineUnit { | ||
units: [ { kind: metre, multiplier: 1e-13 } ] | ||
}; | ||
cm #defineUnit { | ||
units: [ { kind: metre, multiplier: 1e-2 } ] | ||
}; | ||
m #defineUnit { | ||
units: [ { kind: metre } ] | ||
}; | ||
|
||
UL #defineUnit { | ||
units: [ { kind: dimensionless } ] | ||
}; | ||
percent #defineUnit { | ||
units: [ { kind: dimensionless, multiplier: 1e-2 } ] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
platform = load_platform("$HetaSimulatorDir/test/examples/single_comp_events"); | ||
model = platform.models[:nameless]; | ||
|
||
scn0 = Scenario(model, (0.,4000.); observables=[:a0,:c1]) | ||
s0 = sim(scn0; tstops=[100., 100.1]) | ||
@test isapprox(s0(100.1)[:a0]-s0(100.)[:a0], 0.0; atol=1e-2) | ||
@test isapprox(s0(100.1)[:c1]-s0(100.)[:c1], 0.0; atol=1e-2) | ||
|
||
scn1 = Scenario(model, (0.,4000.); observables=[:a0,:c1], events_active=[:sw=>true, :sw_end=>true], events_save=(true,true)) | ||
s1 = sim(scn1) | ||
@test isapprox(s1(100.1)[:a0]-s1(100.)[:a0], 1.0; atol=1e-2) | ||
@test isapprox(s1(100.1)[:c1]-s1(100.)[:c1], 0.0; atol=1e-2) |