Skip to content

Commit f486e26

Browse files
sample distributions
1 parent b26102b commit f486e26

File tree

4 files changed

+190
-150
lines changed

4 files changed

+190
-150
lines changed

src/sbmlsim/sensitivity/example/sensitivity_example.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def _sensitivity_parameters() -> list[SensitivityParameter]:
124124
console.print(SensitivityParameter.parameters_to_df(sensitivity_parameters))
125125

126126
settings = {
127-
"cache_results": False,
127+
"cache_results": True,
128128
"n_cores": int(round(0.9 * multiprocessing.cpu_count())),
129129
"seed": 1234
130130
}
@@ -137,8 +137,6 @@ def _sensitivity_parameters() -> list[SensitivityParameter]:
137137
N=1000,
138138
**settings,
139139
)
140-
sa_sampling.execute()
141-
sa_sampling.plot()
142140

143141
sa_local = LocalSensitivityAnalysis(
144142
sensitivity_simulation=sensitivity_simulation,
@@ -148,8 +146,6 @@ def _sensitivity_parameters() -> list[SensitivityParameter]:
148146
difference=0.01,
149147
**settings,
150148
)
151-
sa_local.execute()
152-
sa_local.plot()
153149

154150
sa_sobol = SobolSensitivityAnalysis(
155151
sensitivity_simulation=sensitivity_simulation,
@@ -159,8 +155,6 @@ def _sensitivity_parameters() -> list[SensitivityParameter]:
159155
N=4096,
160156
**settings,
161157
)
162-
sa_sobol.execute()
163-
sa_sobol.plot()
164158

165159
sa_fast = FASTSensitivityAnalysis(
166160
sensitivity_simulation=sensitivity_simulation,
@@ -170,5 +164,13 @@ def _sensitivity_parameters() -> list[SensitivityParameter]:
170164
N=1000,
171165
**settings,
172166
)
173-
sa_fast.execute()
174-
sa_fast.plot()
167+
168+
sas = [
169+
# sa_local,
170+
sa_sampling,
171+
# sa_sobol,
172+
# sa_fast,
173+
]
174+
for sa in sas:
175+
sa.execute()
176+
sa.plot()

src/sbmlsim/sensitivity/example/simple_chain.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
_m = Model(
88
sid="simple_chain",
99
name="Model Simple Chain",
10-
notes="""Simple S1 -> S2 -> S3 conversion for testing.""",
10+
notes="""Simple S1 S2 S3 conversion for testing.""",
1111
creators=[
1212
Creator(
1313
familyName="König",
@@ -48,18 +48,20 @@
4848
]
4949

5050
_m.parameters = [
51-
Parameter(sid="k1", value=1.0, name="rate S1 -> S2 conversion"),
52-
Parameter(sid="k2", value=1.0, name="rate S2 -> S3 conversion"),
51+
Parameter(sid="k1", value=1.0, name="rate S1 S2 conversion"),
52+
Parameter(sid="k2", value=1.0, name="rate S2 S3 conversion"),
5353
]
5454

5555
_m.reactions = [
5656
Reaction(
5757
sid="R1",
58+
name="R1: S1 ➞ S2 conversion",
5859
equation="S1 -> S2",
5960
formula="k1 * S1",
6061
),
6162
Reaction(
6263
sid="R2",
64+
name="R2: S2 ➞ S3 conversion",
6365
equation="S2 -> S3",
6466
formula="k2 * S2",
6567
)
Lines changed: 85 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,89 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core"
3-
xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" level="3"
4-
version="2" comp:required="true">
2+
<sbml xmlns="http://www.sbml.org/sbml/level3/version2/core" xmlns:comp="http://www.sbml.org/sbml/level3/version1/comp/version1" level="3" version="2" comp:required="true">
3+
<notes>
4+
<body xmlns="http://www.w3.org/1999/xhtml">
5+
<p>Created with <a href="https://github.com/matthiaskoenig/sbmlutils">https://github.com/matthiaskoenig/sbmlutils</a>.
6+
<a href="https://doi.org/10.5281/zenodo.5525390">
7+
<img src="https://zenodo.org/badge/DOI/10.5281/zenodo.5525390.svg" alt="DOI"/></a></p>
8+
</body>
9+
</notes>
10+
<model metaid="meta_simple_chain" id="simple_chain" name="Model Simple Chain">
511
<notes>
6-
<body xmlns="http://www.w3.org/1999/xhtml">
7-
<p>Created with <a href="https://github.com/matthiaskoenig/sbmlutils">
8-
https://github.com/matthiaskoenig/sbmlutils</a>.
9-
<a href="https://doi.org/10.5281/zenodo.5525390">
10-
<img src="https://zenodo.org/badge/DOI/10.5281/zenodo.5525390.svg"
11-
alt="DOI"/>
12-
</a>
13-
</p>
14-
</body>
12+
<body xmlns="http://www.w3.org/1999/xhtml">
13+
<p>Simple S1 ➞ S2 ➞ S3 conversion for testing.</p>
14+
</body>
1515
</notes>
16-
<model metaid="meta_simple_chain" id="simple_chain" name="Model Simple Chain">
17-
<notes>
18-
<body xmlns="http://www.w3.org/1999/xhtml">
19-
<p>Simple S1 -&gt; S2 -&gt; S3 conversion for testing.</p>
20-
</body>
21-
</notes>
22-
<annotation>
23-
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
24-
xmlns:dcterms="http://purl.org/dc/terms/"
25-
xmlns:vCard4="http://www.w3.org/2006/vcard/ns#"
26-
>
27-
<rdf:Description rdf:about="#meta_simple_chain">
28-
<dcterms:creator>
29-
<rdf:Bag>
30-
<rdf:li rdf:parseType="Resource">
31-
<vCard4:hasName rdf:parseType="Resource">
32-
<vCard4:family-name>König</vCard4:family-name>
33-
<vCard4:given-name>Matthias</vCard4:given-name>
34-
</vCard4:hasName>
35-
<vCard4:hasEmail>koenigmx@hu-berlin.de</vCard4:hasEmail>
36-
<vCard4:organization-name>Humboldt-University Berlin,
37-
Institute for Theoretical Biology
38-
</vCard4:organization-name>
39-
</rdf:li>
40-
</rdf:Bag>
41-
</dcterms:creator>
42-
<dcterms:created rdf:parseType="Resource">
43-
<dcterms:W3CDTF>2026-01-22T15:10:29Z</dcterms:W3CDTF>
44-
</dcterms:created>
45-
<dcterms:modified rdf:parseType="Resource">
46-
<dcterms:W3CDTF>2026-01-22T15:10:29Z</dcterms:W3CDTF>
47-
</dcterms:modified>
48-
</rdf:Description>
49-
</rdf:RDF>
50-
</annotation>
51-
<listOfCompartments>
52-
<compartment id="Vli" name="liver volume" spatialDimensions="3" size="1"
53-
constant="true"/>
54-
</listOfCompartments>
55-
<listOfSpecies>
56-
<species id="S1" name="S1" compartment="Vli" initialConcentration="1"
57-
hasOnlySubstanceUnits="false" boundaryCondition="false"
58-
constant="false"/>
59-
<species id="S2" name="S2" compartment="Vli" initialConcentration="0"
60-
hasOnlySubstanceUnits="false" boundaryCondition="false"
61-
constant="false"/>
62-
<species id="S3" name="S3" compartment="Vli" initialConcentration="0"
63-
hasOnlySubstanceUnits="false" boundaryCondition="false"
64-
constant="false"/>
65-
</listOfSpecies>
66-
<listOfParameters>
67-
<parameter id="k1" name="rate S1 -&gt; S2 conversion" value="1"
68-
constant="true"/>
69-
<parameter id="k2" name="rate S2 -&gt; S3 conversion" value="1"
70-
constant="true"/>
71-
</listOfParameters>
72-
<listOfReactions>
73-
<reaction id="R1" reversible="false">
74-
<listOfReactants>
75-
<speciesReference species="S1" stoichiometry="1" constant="true"/>
76-
</listOfReactants>
77-
<listOfProducts>
78-
<speciesReference species="S2" stoichiometry="1" constant="true"/>
79-
</listOfProducts>
80-
<kineticLaw>
81-
<math xmlns="http://www.w3.org/1998/Math/MathML">
82-
<apply>
83-
<times/>
84-
<ci>k1</ci>
85-
<ci>S1</ci>
86-
</apply>
87-
</math>
88-
</kineticLaw>
89-
</reaction>
90-
<reaction id="R2" reversible="false">
91-
<listOfReactants>
92-
<speciesReference species="S2" stoichiometry="1" constant="true"/>
93-
</listOfReactants>
94-
<listOfProducts>
95-
<speciesReference species="S3" stoichiometry="1" constant="true"/>
96-
</listOfProducts>
97-
<kineticLaw>
98-
<math xmlns="http://www.w3.org/1998/Math/MathML">
99-
<apply>
100-
<times/>
101-
<ci>k2</ci>
102-
<ci>S2</ci>
103-
</apply>
104-
</math>
105-
</kineticLaw>
106-
</reaction>
107-
</listOfReactions>
108-
</model>
16+
<annotation>
17+
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:vCard4="http://www.w3.org/2006/vcard/ns#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
18+
<rdf:Description rdf:about="#meta_simple_chain">
19+
<dcterms:creator>
20+
<rdf:Bag>
21+
<rdf:li rdf:parseType="Resource">
22+
<vCard4:hasName rdf:parseType="Resource">
23+
<vCard4:family-name>König</vCard4:family-name>
24+
<vCard4:given-name>Matthias</vCard4:given-name>
25+
</vCard4:hasName>
26+
<vCard4:hasEmail>koenigmx@hu-berlin.de</vCard4:hasEmail>
27+
<vCard4:organization-name>Humboldt-University Berlin, Institute for Theoretical Biology</vCard4:organization-name>
28+
</rdf:li>
29+
</rdf:Bag>
30+
</dcterms:creator>
31+
<dcterms:created rdf:parseType="Resource">
32+
<dcterms:W3CDTF>2026-01-26T22:23:01Z</dcterms:W3CDTF>
33+
</dcterms:created>
34+
<dcterms:modified rdf:parseType="Resource">
35+
<dcterms:W3CDTF>2026-01-26T22:23:01Z</dcterms:W3CDTF>
36+
</dcterms:modified>
37+
</rdf:Description>
38+
</rdf:RDF>
39+
</annotation>
40+
<listOfCompartments>
41+
<compartment id="Vli" name="liver volume" spatialDimensions="3" size="1" constant="true"/>
42+
</listOfCompartments>
43+
<listOfSpecies>
44+
<species id="S1" name="S1" compartment="Vli" initialConcentration="1" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
45+
<species id="S2" name="S2" compartment="Vli" initialConcentration="0" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
46+
<species id="S3" name="S3" compartment="Vli" initialConcentration="0" hasOnlySubstanceUnits="false" boundaryCondition="false" constant="false"/>
47+
</listOfSpecies>
48+
<listOfParameters>
49+
<parameter id="k1" name="rate S1 ➞ S2 conversion" value="1" constant="true"/>
50+
<parameter id="k2" name="rate S2 ➞ S3 conversion" value="1" constant="true"/>
51+
</listOfParameters>
52+
<listOfReactions>
53+
<reaction id="R1" name="R1: S1 ➞ S2 conversion" reversible="false">
54+
<listOfReactants>
55+
<speciesReference species="S1" stoichiometry="1" constant="true"/>
56+
</listOfReactants>
57+
<listOfProducts>
58+
<speciesReference species="S2" stoichiometry="1" constant="true"/>
59+
</listOfProducts>
60+
<kineticLaw>
61+
<math xmlns="http://www.w3.org/1998/Math/MathML">
62+
<apply>
63+
<times/>
64+
<ci> k1 </ci>
65+
<ci> S1 </ci>
66+
</apply>
67+
</math>
68+
</kineticLaw>
69+
</reaction>
70+
<reaction id="R2" name="R2: S2 ➞ S3 conversion" reversible="false">
71+
<listOfReactants>
72+
<speciesReference species="S2" stoichiometry="1" constant="true"/>
73+
</listOfReactants>
74+
<listOfProducts>
75+
<speciesReference species="S3" stoichiometry="1" constant="true"/>
76+
</listOfProducts>
77+
<kineticLaw>
78+
<math xmlns="http://www.w3.org/1998/Math/MathML">
79+
<apply>
80+
<times/>
81+
<ci> k2 </ci>
82+
<ci> S2 </ci>
83+
</apply>
84+
</math>
85+
</kineticLaw>
86+
</reaction>
87+
</listOfReactions>
88+
</model>
10989
</sbml>

0 commit comments

Comments
 (0)