Skip to content

Commit

Permalink
Removed Generator and project
Browse files Browse the repository at this point in the history
  • Loading branch information
joernweissenborn committed Sep 17, 2021
1 parent 968ebb8 commit 9d61605
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 579 deletions.
75 changes: 47 additions & 28 deletions glotaran/examples/sequential.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
from glotaran.analysis.simulation import simulate
from glotaran.builtin.megacomplexes.decay import DecayMegacomplex
from glotaran.builtin.megacomplexes.spectral import SpectralMegacomplex
from glotaran.io import load_model
from glotaran.io import load_parameters
from glotaran.model import Model
from glotaran.parameter import ParameterGroup
from glotaran.project import Scheme
from glotaran.project.generators.generator import generate_model_yml

sim_model = Model.from_dict(
{
Expand Down Expand Up @@ -92,6 +88,21 @@
}
)

parameter = ParameterGroup.from_dict(
{
"j": [
["1", 1, {"vary": False, "non-negative": False}],
["0", 0, {"vary": False, "non-negative": False}],
],
"kinetic": [
["1", 0.5],
["2", 0.3],
["3", 0.1],
],
"irf": [["center", 0.3], ["width", 0.1]],
}
)

_time = np.arange(-1, 20, 0.01)
_spectral = np.arange(600, 700, 1.4)

Expand All @@ -104,28 +115,36 @@
noise_std_dev=1e-2,
)

parameter_yml = """
initial_concentration:
- ["1", 1]
- ["0", 0]
- {"vary": False, "non-negative": False}
decay:
- [species_1, 0.5]
- [species_2, 0.3]
- [species_3, 0.1]
irf:
- [center, 0.3]
- [width, 0.1]
"""
parameter = load_parameters(parameter_yml, format_name="yml_str")

model_yml = generate_model_yml("decay-sequential", nr_species=3, irf=True)
model = load_model(model_yml, format_name="yml_str")

scheme = Scheme(
model=model,
parameters=parameter,
data={"dataset_1": dataset},
model = Model.from_dict(
{
"initial_concentration": {
"j1": {"compartments": ["s1", "s2", "s3"], "parameters": ["j.1", "j.0", "j.0"]},
},
"k_matrix": {
"k1": {
"matrix": {
("s2", "s1"): "kinetic.1",
("s3", "s2"): "kinetic.2",
("s3", "s3"): "kinetic.3",
}
}
},
"megacomplex": {
"m1": {
"type": "decay",
"k_matrix": ["k1"],
}
},
"irf": {
"irf1": {"type": "gaussian", "center": "irf.center", "width": "irf.width"},
},
"dataset": {
"dataset1": {
"initial_concentration": "j1",
"megacomplex": ["m1"],
"irf": "irf1",
}
},
},
megacomplex_types={"decay": DecayMegacomplex},
)
2 changes: 1 addition & 1 deletion glotaran/io/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

from glotaran.model import Model
from glotaran.parameter import ParameterGroup
from glotaran.plugin_system.project_io_registration import SavingOptions
from glotaran.project import Result
from glotaran.project import SavingOptions
from glotaran.project import Scheme

DataLoader = Callable[[str], Union[xr.Dataset, xr.DataArray]]
Expand Down
Loading

0 comments on commit 9d61605

Please sign in to comment.