Skip to content

Commit

Permalink
Merge bed5c10 into f68892b
Browse files Browse the repository at this point in the history
  • Loading branch information
joernweissenborn committed Nov 11, 2019
2 parents f68892b + bed5c10 commit 8d84a04
Show file tree
Hide file tree
Showing 2 changed files with 273 additions and 138 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,149 +344,11 @@ class ThreeComponentSequential:
axis = {"time": time, "spectral": spectral}


class IrfDispersion:
model = KineticSpectrumModel.from_dict({
'initial_concentration': {
'j1': {
'compartments': ['s1', 's2', 's3', 's4'],
'parameters': ['j.1', 'j.0', 'j.0', 'j.0']
},
},
'megacomplex': {
'mc1': {'k_matrix': ['k1']},
},
'k_matrix': {
"k1": {'matrix': {
("s2", "s1"): 'kinetic.1',
("s3", "s2"): 'kinetic.2',
("s4", "s3"): 'kinetic.3',
("s4", "s4"): 'kinetic.4',
}}
},
'irf': {
'irf1': {
'type': 'spectral-multi-gaussian',
'center': ['irf.center'],
'width': ['irf.width'],
'dispersion_center': 'irf.dispcenter',
'center_dispersion': ['irf.centerdisp'],
},
},
'dataset': {
'dataset1': {
'initial_concentration': 'j1',
'irf': 'irf1',
'megacomplex': ['mc1'],
},
},
})
sim_model = KineticSpectrumModel.from_dict({
'initial_concentration': {
'j1': {
'compartments': ['s1', 's2', 's3', 's4'],
'parameters': ['j.1', 'j.0', 'j.0', 'j.0']
},
},
'megacomplex': {
'mc1': {'k_matrix': ['k1']},
},
'k_matrix': {
"k1": {'matrix': {
("s2", "s1"): 'kinetic.1',
("s3", "s2"): 'kinetic.2',
("s4", "s3"): 'kinetic.3',
("s4", "s4"): 'kinetic.4',
}}
},
'shape': {
'sh1': {
'type': "gaussian",
'amplitude': "shape.amps.1",
'location': "shape.locs.1",
'width': "shape.width.1",
},
'sh2': {
'type': "gaussian",
'amplitude': "shape.amps.2",
'location': "shape.locs.2",
'width': "shape.width.2",
},
'sh3': {
'type': "gaussian",
'amplitude': "shape.amps.3",
'location': "shape.locs.3",
'width': "shape.width.3",
},
'sh4': {
'type': "gaussian",
'amplitude': "shape.amps.4",
'location': "shape.locs.4",
'width': "shape.width.4",
},
},
'irf': {
'irf1': {
'type': 'spectral-multi-gaussian',
'center': ['irf.center'],
'width': ['irf.width'],
'dispersion_center': 'irf.dispcenter',
'center_dispersion': ['irf.centerdisp'],
},
},
'dataset': {
'dataset1': {
'initial_concentration': 'j1',
'irf': 'irf1',
'megacomplex': ['mc1'],
'shape': {'s1': 'sh1', 's2': 'sh2', 's3': 'sh3', 's4': 'sh4'}
},
},
})

initial = ParameterGroup.from_dict({
'j': [
['1', 1, {'vary': False, 'non-negative': False}],
['0', 0, {'vary': False, 'non-negative': False}],
],
'kinetic': [
["1", 1],
["2", 0.4],
["3", 0.05],
["4", 0.009],
{'non-negative': True}
],
'irf': [['center', 0.3],
['width', 0.1],
['dispcenter', 400, {'vary': False}],
['centerdisp', 0.25]],
})
wanted = ParameterGroup.from_dict({
'j': [
['1', 1, {'vary': False, 'non-negative': False}],
['0', 0, {'vary': False, 'non-negative': False}],
],
'kinetic': [
["1", 1],
["2", 0.4],
["3", 0.05],
["4", 0.009],
],

'shape': {'amps': [2, 4, 5, 8], 'locs': [320, 380, 420, 460], 'width': [30, 20, 10, 40]},
'irf': [['center', 0.3], ['width', 0.1], ['dispcenter', 400], ['centerdisp', 0.25]],
})

time = np.arange(-1, 30, 0.01)
spectral = np.arange(300, 500, 25)
axis = {"time": time, "spectral": spectral}


@pytest.mark.parametrize("suite", [
OneComponentOneChannel,
OneComponentOneChannelGaussianIrf,
ThreeComponentParallel,
ThreeComponentSequential,
IrfDispersion,
])
@pytest.mark.parametrize("nnls", [True, False])
def test_kinetic_model(suite, nnls):
Expand Down

0 comments on commit 8d84a04

Please sign in to comment.