Skip to content

Commit 16ebb62

Browse files
authored
Merge pull request #351 from DiODeProject/missing-rate
Fixes #321 and fixes #322
2 parents 8dcd2c3 + cb9452b commit 16ebb62

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

mumot/models.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,11 +1706,20 @@ def _get_solutions(self):
17061706
self._solutions = solve(iter(self._equations.values()), self._reactants, force=False, positive=False, set=False)
17071707
return self._solutions
17081708

1709+
def _get_rates_from_stoichiometry(self):
1710+
rates = set()
1711+
for reaction in self._stoichiometry.values():
1712+
if reaction['rate']:
1713+
for symb in reaction['rate'].atoms():
1714+
if isinstance(symb, Symbol):
1715+
rates.add( symb )
1716+
return rates
1717+
17091718
def _create_free_param_dictionary_for_controller(self, inputParams, initWidgets=None, showSystemSize=False, showPlotLimits=False):
17101719
initWidgetsSympy = {parse_latex(paramName): paramValue for paramName, paramValue in initWidgets.items()} if initWidgets is not None else {}
17111720

17121721
paramValuesDict = {}
1713-
for freeParam in self._rates.union(self._constantReactants):
1722+
for freeParam in self._get_rates_from_stoichiometry().union(self._constantReactants):
17141723
paramValuesDict[str(freeParam)] = utils._parse_input_keyword_for_numeric_widgets(
17151724
inputValue=utils._get_item_from_params_list(inputParams, str(freeParam)),
17161725
defaultValueRangeStep=[defaults.MuMoTdefault._initialRateValue, defaults.MuMoTdefault._rateLimits[0], defaults.MuMoTdefault._rateLimits[1], defaults.MuMoTdefault._rateStep],
@@ -1837,7 +1846,7 @@ def _getFuncs(self):
18371846
argList.append(reactant)
18381847
for reactant in self._constantReactants:
18391848
argList.append(reactant)
1840-
for rate in self._rates:
1849+
for rate in self._get_rates_from_stoichiometry():
18411850
argList.append(rate)
18421851
if self._systemSize is not None:
18431852
argList.append(self._systemSize)

mumot/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def _get_params(self, refModel=None):
188188
for name, value in self._fixedParams.items():
189189
# if name == 'systemSize' or name == 'plotLimits':
190190
# continue
191-
if name not in self._mumotModel._rates and name not in self._mumotModel._constantReactants:
191+
if name not in self._mumotModel._get_rates_from_stoichiometry() and name not in self._mumotModel._constantReactants:
192192
continue
193193
name = repr(name)
194194
if name in model._ratesLaTeX:

0 commit comments

Comments
 (0)