python RunModels.py
---------------------------------------
>>> STRIKE-GOLDD toolbox for Python <<<
---------------------------------------
Analyzing the C2M model...
>>> The model contains:
2 states:
[[x1]
[x2]]
1 outputs:
[x1]
1 known inputs:
[u1]
0 unknown inputs:
[]
4 parameters:
[[x3]
[x4]
[x5]
[x6]]
>>> Building the observability-identifiability matrix requires at least 5 Lie derivatives
Calculating derivatives: 1 2 3 4 5
>>> Observability-Identifiability matrix built with 5 Lie derivatives
(calculated in 0.19940662384033203 seconds)
>>> Calculating rank of matrix with size 6x6...
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
File /users/StrikePy/StrikePy/RunModels.py:13
10 from strike_goldd import strike_goldd
12 # Without arguments...
---> 13 strike_goldd()
15 # Passing to it the options of the predefined model HIV...
16 #strike_goldd('options_HIV')
File /users/StrikePy/StrikePy/strike_goldd.py:406, in strike_goldd(*args=())
404 tic = time()
405 rational_onx = rationalize_all_numbers(Matrix(onx))
--> 406 rango = st.generic_rank(Matrix(rational_onx))
rational_onx = Matrix([
[
...
...
3273 M1, M2, M3 = [M.subs(rnst).evalf(n=p) for p in plist]
3275 # calculate the coeffs of the charpoly
3276 # berkowitz-method sorts from highes to lowest -> reverse the tuples
File /users/miniconda3/envs/py39/lib/python3.9/site-packages/symbtools/core.py:3154, in rnd_number_subs_tuples(expr=Matrix([
[ ...+ u1_d2 + u1_d3*(-x3 - x4 + 2) + u1_d3 + u1_d4]]), seed=68434, rational=True, prime=False, minmax=None, **kwargs={})
3151 tuples = [(reverse_dict[s], list_of_primes.pop()) for s in atoms_list]
3153 elif rational:
-> 3154 tuples = [(reverse_dict[s], clean_numbers( rnd()*delta + min_val )) for s in atoms_list]
atoms_list = [u1, u1_d1, u1_d2, u1_d3, u1_d4, x1, x2, x3, x4, x5, x6]
reverse_dict = {u1: u1, u1_d1: u1_d1, u1_d2: u1_d2, u1_d3: u1_d3, u1_d4: u1_d4, x1: x1, x2: x2, x3: x3, x4: x4, x5: x5, x6: x6}
delta = 1
min_val = 0
3155 else:
3156 tuples = [(reverse_dict[s], rnd()*delta + min_val) for s in atoms_list]
File /users/miniconda3/envs/py39/lib/python3.9/site-packages/symbtools/core.py:3154, in <listcomp>(.0=<list_iterator object>)
3151 tuples = [(reverse_dict[s], list_of_primes.pop()) for s in atoms_list]
3153 elif rational:
-> 3154 tuples = [(reverse_dict[s], clean_numbers( rnd()*delta + min_val )) for s in atoms_list]
reverse_dict = {u1: u1, u1_d1: u1_d1, u1_d2: u1_d2, u1_d3: u1_d3, u1_d4: u1_d4, x1: x1, x2: x2, x3: x3, x4: x4, x5: x5, x6: x6}
delta = 1
min_val = 0
s = u1
3155 else:
3156 tuples = [(reverse_dict[s], rnd()*delta + min_val) for s in atoms_list]
File /users/miniconda3/envs/py39/lib/python3.9/site-packages/symbtools/core.py:2988, in clean_numbers(expr=0.8213521271023622727369684071163646876811981201...5000000000000000000000000000000000000000000000000, eps=1e-10)
2986 symb_gen = sp.numbered_symbols('cde', cls = sp.Dummy)
2987 for f in floats:
-> 2988 rat = sp_fff(f, maxden)
maxden = 10000000000
f = 0.8213521271023622727369684071163646876811981201171875000000000000000000000000000000000000000000000000
2989 rats.append(rat)
2990 dummy_symbs.append(next(symb_gen))
File /users/miniconda3/envs/py39/lib/python3.9/site-packages/symbtools/core.py:344, in sp_fff(x=0.8213521271023622727369684071163646876811981201...5000000000000000000000000000000000000000000000000, maxden=10000000000)
342 def sp_fff(x, maxden):
343 """ sympy_fraction from float"""
--> 344 return sp.Rational(fractionfromfloat(x, maxden))
sp = <module 'sympy' from '/n/fs/ragr-research/users/yihangs/miniconda3/envs/py39/lib/python3.9/site-packages/sympy/__init__.py'>
x = 0.8213521271023622727369684071163646876811981201171875000000000000000000000000000000000000000000000000
maxden = 10000000000
File /users/miniconda3/envs/py39/lib/python3.9/site-packages/symbtools/core.py:338, in fractionfromfloat(x_=0.8213521271023622727369684071163646876811981201...5000000000000000000000000000000000000000000000000, maxden=10000000000)
330 """
331 fraction from float
332 args:
333 x
334 maxdenominator (default = 1000)
335 """
337 x = float(x_)
--> 338 assert x == x_ # fails intentionally for numpy.complex
x = 0.8213521271023623
x_ = 0.8213521271023622727369684071163646876811981201171875000000000000000000000000000000000000000000000000
339 return Fr.from_float(x).limit_denominator(maxden)
AssertionError:
Hi,
I tried to run
python RunModel.pyin Python 3.9, with no modification of any file in StrikePy, but got the following AssertionError:Could you help me figure this issue out?
Thanks!