-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
557959c
commit a14fcdd
Showing
9 changed files
with
144 additions
and
158 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
from glotaran.examples import sequential | ||
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,67 @@ | ||
import numpy as np | ||
|
||
from glotaran.analysis.simulation import simulate | ||
from glotaran.io import load_model | ||
from glotaran.io import load_parameters | ||
from glotaran.project import Scheme | ||
from glotaran.project.generators import generate_model_yml | ||
|
||
SIMULATION_MODEL_YML = generate_model_yml( | ||
"spectral-decay-parallel", **{"nr_compartments": 3, "irf": True} | ||
) | ||
SIMULATION_MODEL = load_model(SIMULATION_MODEL_YML, format_name="yml_str") | ||
|
||
MODEL_YML = generate_model_yml("decay-parallel", **{"nr_compartments": 3, "irf": True}) | ||
MODEL = load_model(MODEL_YML, format_name="yml_str") | ||
|
||
WANTED_PARAMETER_YML = """ | ||
rates: | ||
- [species_1, 0.5] | ||
- [species_2, 0.3] | ||
- [species_3, 0.1] | ||
irf: | ||
- [center, 0.3] | ||
- [width, 0.1] | ||
shapes: | ||
species_1: | ||
- [amplitude, 30] | ||
- [location, 620] | ||
- [width, 40] | ||
species_2: | ||
- [amplitude, 20] | ||
- [location, 630] | ||
- [width, 20] | ||
species_3: | ||
- [amplitude, 60] | ||
- [location, 650] | ||
- [width, 60] | ||
""" | ||
WANTED_PARAMETER = load_parameters(WANTED_PARAMETER_YML, format_name="yml_str") | ||
|
||
PARAMETER_YML = """ | ||
rates: | ||
- [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") | ||
|
||
TIME_AXIS = np.arange(-1, 20, 0.01) | ||
SPECTRAL_AXIS = np.arange(600, 700, 1.4) | ||
|
||
DATASET = simulate( | ||
SIMULATION_MODEL, | ||
"dataset_1", | ||
WANTED_PARAMETER, | ||
{"time": TIME_AXIS, "spectral": SPECTRAL_AXIS}, | ||
noise=True, | ||
noise_std_dev=1e-2, | ||
) | ||
|
||
SCHEME = Scheme(model=MODEL, parameters=PARAMETER, data={"dataset1": DATASET}) |
This file was deleted.
Oops, something went wrong.
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,67 @@ | ||
import numpy as np | ||
|
||
from glotaran.analysis.simulation import simulate | ||
from glotaran.io import load_model | ||
from glotaran.io import load_parameters | ||
from glotaran.project import Scheme | ||
from glotaran.project.generators import generate_model_yml | ||
|
||
SIMULATION_MODEL_YML = generate_model_yml( | ||
"spectral-decay-sequential", **{"nr_compartments": 3, "irf": True} | ||
) | ||
SIMULATION_MODEL = load_model(SIMULATION_MODEL_YML, format_name="yml_str") | ||
|
||
MODEL_YML = generate_model_yml("decay-sequential", **{"nr_compartments": 3, "irf": True}) | ||
MODEL = load_model(MODEL_YML, format_name="yml_str") | ||
|
||
WANTED_PARAMETER_YML = """ | ||
rates: | ||
- [species_1, 0.5] | ||
- [species_2, 0.3] | ||
- [species_3, 0.1] | ||
irf: | ||
- [center, 0.3] | ||
- [width, 0.1] | ||
shapes: | ||
species_1: | ||
- [amplitude, 30] | ||
- [location, 620] | ||
- [width, 40] | ||
species_2: | ||
- [amplitude, 20] | ||
- [location, 630] | ||
- [width, 20] | ||
species_3: | ||
- [amplitude, 60] | ||
- [location, 650] | ||
- [width, 60] | ||
""" | ||
WANTED_PARAMETER = load_parameters(WANTED_PARAMETER_YML, format_name="yml_str") | ||
|
||
PARAMETER_YML = """ | ||
rates: | ||
- [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") | ||
|
||
TIME_AXIS = np.arange(-1, 20, 0.01) | ||
SPECTRAL_AXIS = np.arange(600, 700, 1.4) | ||
|
||
DATASET = simulate( | ||
SIMULATION_MODEL, | ||
"dataset_1", | ||
WANTED_PARAMETER, | ||
{"time": TIME_AXIS, "spectral": SPECTRAL_AXIS}, | ||
noise=True, | ||
noise_std_dev=1e-2, | ||
) | ||
|
||
SCHEME = Scheme(model=MODEL, parameters=PARAMETER, data={"dataset1": DATASET}) |
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import xarray as xr | ||
|
||
from glotaran.examples.sequential import dataset | ||
from glotaran.examples.parallel_spectral_decay import DATASET as parallel_dataset | ||
from glotaran.examples.sequential_spectral_decay import DATASET as sequential_dataset | ||
|
||
|
||
def test_dataset(): | ||
assert isinstance(dataset, xr.Dataset) | ||
assert isinstance(parallel_dataset, xr.Dataset) | ||
assert isinstance(sequential_dataset, xr.Dataset) |
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 |
---|---|---|
@@ -1 +1,4 @@ | ||
"""The glotaran generator package.""" | ||
|
||
from glotaran.project.generators.generator import generate_model | ||
from glotaran.project.generators.generator import generate_model_yml |
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