|
@@ -135,10 +135,16 @@ class model:
|
|
|
self.dM[self.lut[c]][self.lut[t]]=\
|
|
|
function.sumArray(arr)
|
|
|
else:
|
|
|
-#just set once
|
|
|
+ #just set once
|
|
|
self.fM[self.lut[c],self.lut[t]]=sum(arr)
|
|
|
-
|
|
|
-
|
|
|
+ #use fM to build static part of fJ
|
|
|
+ N=system.n*(system.m+1)
|
|
|
+ self.fJ=numpy.zeros((N,N))
|
|
|
+ for i in range(system.m+1):
|
|
|
+ fJ[i*system.n:(i+1)*system.n,i*system.n:(i+1)*system.n]=system.M(t)
|
|
|
+ return system.jacobi(t)
|
|
|
+ f
|
|
|
+ #
|
|
|
|
|
|
#build SE part
|
|
|
self.buildSE()
|
|
@@ -160,7 +166,9 @@ class model:
|
|
|
#print(parList)
|
|
|
self.m=len(parList)
|
|
|
self.lutSE={c:i for (i,c) in zip(range(self.m),parList)}
|
|
|
-
|
|
|
+ w=self.getWeights(self.lutSE)
|
|
|
+ w=numpy.sqrt(w)
|
|
|
+
|
|
|
self.qSS={}
|
|
|
self.SS=numpy.zeros((self.m,self.n,self.n))
|
|
|
for parName in parList:
|
|
@@ -174,9 +182,9 @@ class model:
|
|
|
#print('[{} {} {}] {}'.format(parName,compartment,t,targets[t]))
|
|
|
arr=targets[t]
|
|
|
if not function.contains(arr):
|
|
|
- self.SS[k,i,j]=sum(arr)
|
|
|
+ self.SS[k,i,j]=w[k]*sum(arr)
|
|
|
continue
|
|
|
- ft=function.sumArray(arr)
|
|
|
+ ft=function.sumArray(arr,w[k])
|
|
|
try:
|
|
|
self.qSS[k][i][j]=ft
|
|
|
except (KeyError,TypeError):
|
|
@@ -189,7 +197,13 @@ class model:
|
|
|
self.qSS[k][i][j]=ft
|
|
|
|
|
|
|
|
|
-
|
|
|
+ #use fM to build static part of fJ
|
|
|
+ N=self.n*(self.m+1)
|
|
|
+ self.fJ=numpy.zeros((N,N))
|
|
|
+ for i in range(self.m+1):
|
|
|
+ self.fJ[i*self.n:(i+1)*self.n,i*self.n:(i+1)*self.n]=self.fM
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
def inspect(self):
|
|
@@ -327,6 +341,17 @@ class model:
|
|
|
ub=[f(t) for f in self.fu]
|
|
|
return numpy.array(ub)
|
|
|
|
|
|
+ def jacobiFull(self,t):
|
|
|
+
|
|
|
+ #update jacobi created during build phase with time dependent values
|
|
|
+ for i in self.dM:
|
|
|
+ for j in self.dM[i]:
|
|
|
+ for k in range(system.m+1):
|
|
|
+ self.fJ[k*system.n+i,k*system.n+j]=self.dM[i][j](t)
|
|
|
+ return self.fJ
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
def fSS(self,t):
|
|
|
for k in self.qSS:
|
|
|
for i in self.qSS[k]:
|
|
@@ -438,7 +463,9 @@ class model:
|
|
|
|
|
|
s2out=numpy.zeros(se.shape[1:])
|
|
|
se2=numpy.multiply(se,se)
|
|
|
- return numpy.sqrt(numpy.dot(se2,self.getWeights(self.lutSE)))
|
|
|
+ #w=self.getWeights(self.lutSE)
|
|
|
+ w=numpy.ones((self.m))
|
|
|
+ return numpy.sqrt(numpy.dot(se2,w))
|
|
|
|
|
|
|
|
|
def get(self,parName):
|