Spaces:
Running
Running
Franny Dean
commited on
Commit
•
e65991c
1
Parent(s):
ca643d4
debugging
Browse files- .ipynb_checkpoints/app-checkpoint.py +9 -5
- app.py +9 -5
.ipynb_checkpoints/app-checkpoint.py
CHANGED
@@ -388,7 +388,11 @@ def Plv(volume, Emax, Emin, t, Tc, Vd):
|
|
388 |
def Elastance(Emax,Emin, t, Tc):
|
389 |
t = t-int(t/Tc)*Tc #can remove this if only want 1st ED (and the 1st ES before)
|
390 |
tn = t/(0.2+0.15*Tc)
|
391 |
-
|
|
|
|
|
|
|
|
|
392 |
|
393 |
def solve_ODE_for_volume(Rm, Ra, Emax, Emin, Vd, Tc, start_v, t):
|
394 |
|
@@ -524,7 +528,7 @@ def lvad_ode(y, t, Rs, Rm, Ra, Rc, Ca, Cs, Cr, Ls, Emax, Emin, Tc, Vd, ratew):
|
|
524 |
#from simaan2008dynamical:
|
525 |
Ri = 0.0677
|
526 |
R0 = 0.0677
|
527 |
-
Rk = 0
|
528 |
x1bar = 1.
|
529 |
alpha = -3.5
|
530 |
Li = 0.0127
|
@@ -539,7 +543,7 @@ def lvad_ode(y, t, Rs, Rm, Ra, Rc, Ca, Cs, Cr, Ls, Emax, Emin, Tc, Vd, ratew):
|
|
539 |
if (P_lv <= x1bar): Rk = alpha * (P_lv - x1bar)
|
540 |
Lstar = Li + L0 + b1
|
541 |
Lstar2 = -Li -L0 +b1
|
542 |
-
Rstar = Ri +
|
543 |
|
544 |
dydt = [-x6 + r(x2-P_lv)/Rm-r(P_lv-x4)/Ra, (x3-x2)/(Rs*Cr)-r(x2-P_lv)/(Cr*Rm), (x2-x3)/(Rs*Cs)+x5/Cs, -x5/Ca+r(P_lv-x4)/(Ca*Ra) + x6/Ca, (x4-x3)/Ls-Rc*x5/Ls, -P_lv / Lstar2 + x4/Lstar2 + (Ri+R0+Rk-b0) / Lstar2 * x6 - b2 / Lstar2 * x7**2, ratew]
|
545 |
|
@@ -554,7 +558,7 @@ def f_nolvad(Tc, start_v, Emax, showpvloop):
|
|
554 |
start_pla = float(start_v*Elastance(Emax, Emin, 0.0, Tc))
|
555 |
start_pao = 75.
|
556 |
start_pa = start_pao
|
557 |
-
start_qt = 0 #aortic flow is Q_T and is 0 at ED, also see Fig5 in simaan2008dynamical
|
558 |
|
559 |
y0 = [start_v, start_pla, start_pa, start_pao, start_qt]
|
560 |
|
@@ -789,7 +793,7 @@ def lvad_plots(Rm, Ra, Emax, Emin, Vd, Tc, start_v, gamma):
|
|
789 |
Ls=0.0005
|
790 |
|
791 |
#get values for periodic loops:
|
792 |
-
ef_nolvad, pao_ed, pao_es, co_nolvad, y00, y01, y02, y03, y04, Vlv0, Plv0 = f_nolvad(Tc, start_v, Emax, 0)
|
793 |
#pao_eds = [pao_ed]
|
794 |
#pao_ess = [pao_es]
|
795 |
|
|
|
388 |
def Elastance(Emax,Emin, t, Tc):
|
389 |
t = t-int(t/Tc)*Tc #can remove this if only want 1st ED (and the 1st ES before)
|
390 |
tn = t/(0.2+0.15*Tc)
|
391 |
+
print(tn)
|
392 |
+
print(Emax)
|
393 |
+
print(Emin)
|
394 |
+
print(Tc)
|
395 |
+
return (Emax-Emin)*1.55*(tn/0.7)**1.9/((tn/0.7)**1.9+1.0)*1.0/((tn/1.17)**21.9+1.0) + Emin
|
396 |
|
397 |
def solve_ODE_for_volume(Rm, Ra, Emax, Emin, Vd, Tc, start_v, t):
|
398 |
|
|
|
528 |
#from simaan2008dynamical:
|
529 |
Ri = 0.0677
|
530 |
R0 = 0.0677
|
531 |
+
Rk = 0.0
|
532 |
x1bar = 1.
|
533 |
alpha = -3.5
|
534 |
Li = 0.0127
|
|
|
543 |
if (P_lv <= x1bar): Rk = alpha * (P_lv - x1bar)
|
544 |
Lstar = Li + L0 + b1
|
545 |
Lstar2 = -Li -L0 +b1
|
546 |
+
Rstar = Ri + R0 + Rk + b0
|
547 |
|
548 |
dydt = [-x6 + r(x2-P_lv)/Rm-r(P_lv-x4)/Ra, (x3-x2)/(Rs*Cr)-r(x2-P_lv)/(Cr*Rm), (x2-x3)/(Rs*Cs)+x5/Cs, -x5/Ca+r(P_lv-x4)/(Ca*Ra) + x6/Ca, (x4-x3)/Ls-Rc*x5/Ls, -P_lv / Lstar2 + x4/Lstar2 + (Ri+R0+Rk-b0) / Lstar2 * x6 - b2 / Lstar2 * x7**2, ratew]
|
549 |
|
|
|
558 |
start_pla = float(start_v*Elastance(Emax, Emin, 0.0, Tc))
|
559 |
start_pao = 75.
|
560 |
start_pa = start_pao
|
561 |
+
start_qt = 0.0 #aortic flow is Q_T and is 0 at ED, also see Fig5 in simaan2008dynamical
|
562 |
|
563 |
y0 = [start_v, start_pla, start_pa, start_pao, start_qt]
|
564 |
|
|
|
793 |
Ls=0.0005
|
794 |
|
795 |
#get values for periodic loops:
|
796 |
+
ef_nolvad, pao_ed, pao_es, co_nolvad, y00, y01, y02, y03, y04, Vlv0, Plv0 = f_nolvad(Tc, start_v, Emax, 0.0)
|
797 |
#pao_eds = [pao_ed]
|
798 |
#pao_ess = [pao_es]
|
799 |
|
app.py
CHANGED
@@ -388,7 +388,11 @@ def Plv(volume, Emax, Emin, t, Tc, Vd):
|
|
388 |
def Elastance(Emax,Emin, t, Tc):
|
389 |
t = t-int(t/Tc)*Tc #can remove this if only want 1st ED (and the 1st ES before)
|
390 |
tn = t/(0.2+0.15*Tc)
|
391 |
-
|
|
|
|
|
|
|
|
|
392 |
|
393 |
def solve_ODE_for_volume(Rm, Ra, Emax, Emin, Vd, Tc, start_v, t):
|
394 |
|
@@ -524,7 +528,7 @@ def lvad_ode(y, t, Rs, Rm, Ra, Rc, Ca, Cs, Cr, Ls, Emax, Emin, Tc, Vd, ratew):
|
|
524 |
#from simaan2008dynamical:
|
525 |
Ri = 0.0677
|
526 |
R0 = 0.0677
|
527 |
-
Rk = 0
|
528 |
x1bar = 1.
|
529 |
alpha = -3.5
|
530 |
Li = 0.0127
|
@@ -539,7 +543,7 @@ def lvad_ode(y, t, Rs, Rm, Ra, Rc, Ca, Cs, Cr, Ls, Emax, Emin, Tc, Vd, ratew):
|
|
539 |
if (P_lv <= x1bar): Rk = alpha * (P_lv - x1bar)
|
540 |
Lstar = Li + L0 + b1
|
541 |
Lstar2 = -Li -L0 +b1
|
542 |
-
Rstar = Ri +
|
543 |
|
544 |
dydt = [-x6 + r(x2-P_lv)/Rm-r(P_lv-x4)/Ra, (x3-x2)/(Rs*Cr)-r(x2-P_lv)/(Cr*Rm), (x2-x3)/(Rs*Cs)+x5/Cs, -x5/Ca+r(P_lv-x4)/(Ca*Ra) + x6/Ca, (x4-x3)/Ls-Rc*x5/Ls, -P_lv / Lstar2 + x4/Lstar2 + (Ri+R0+Rk-b0) / Lstar2 * x6 - b2 / Lstar2 * x7**2, ratew]
|
545 |
|
@@ -554,7 +558,7 @@ def f_nolvad(Tc, start_v, Emax, showpvloop):
|
|
554 |
start_pla = float(start_v*Elastance(Emax, Emin, 0.0, Tc))
|
555 |
start_pao = 75.
|
556 |
start_pa = start_pao
|
557 |
-
start_qt = 0 #aortic flow is Q_T and is 0 at ED, also see Fig5 in simaan2008dynamical
|
558 |
|
559 |
y0 = [start_v, start_pla, start_pa, start_pao, start_qt]
|
560 |
|
@@ -789,7 +793,7 @@ def lvad_plots(Rm, Ra, Emax, Emin, Vd, Tc, start_v, gamma):
|
|
789 |
Ls=0.0005
|
790 |
|
791 |
#get values for periodic loops:
|
792 |
-
ef_nolvad, pao_ed, pao_es, co_nolvad, y00, y01, y02, y03, y04, Vlv0, Plv0 = f_nolvad(Tc, start_v, Emax, 0)
|
793 |
#pao_eds = [pao_ed]
|
794 |
#pao_ess = [pao_es]
|
795 |
|
|
|
388 |
def Elastance(Emax,Emin, t, Tc):
|
389 |
t = t-int(t/Tc)*Tc #can remove this if only want 1st ED (and the 1st ES before)
|
390 |
tn = t/(0.2+0.15*Tc)
|
391 |
+
print(tn)
|
392 |
+
print(Emax)
|
393 |
+
print(Emin)
|
394 |
+
print(Tc)
|
395 |
+
return (Emax-Emin)*1.55*(tn/0.7)**1.9/((tn/0.7)**1.9+1.0)*1.0/((tn/1.17)**21.9+1.0) + Emin
|
396 |
|
397 |
def solve_ODE_for_volume(Rm, Ra, Emax, Emin, Vd, Tc, start_v, t):
|
398 |
|
|
|
528 |
#from simaan2008dynamical:
|
529 |
Ri = 0.0677
|
530 |
R0 = 0.0677
|
531 |
+
Rk = 0.0
|
532 |
x1bar = 1.
|
533 |
alpha = -3.5
|
534 |
Li = 0.0127
|
|
|
543 |
if (P_lv <= x1bar): Rk = alpha * (P_lv - x1bar)
|
544 |
Lstar = Li + L0 + b1
|
545 |
Lstar2 = -Li -L0 +b1
|
546 |
+
Rstar = Ri + R0 + Rk + b0
|
547 |
|
548 |
dydt = [-x6 + r(x2-P_lv)/Rm-r(P_lv-x4)/Ra, (x3-x2)/(Rs*Cr)-r(x2-P_lv)/(Cr*Rm), (x2-x3)/(Rs*Cs)+x5/Cs, -x5/Ca+r(P_lv-x4)/(Ca*Ra) + x6/Ca, (x4-x3)/Ls-Rc*x5/Ls, -P_lv / Lstar2 + x4/Lstar2 + (Ri+R0+Rk-b0) / Lstar2 * x6 - b2 / Lstar2 * x7**2, ratew]
|
549 |
|
|
|
558 |
start_pla = float(start_v*Elastance(Emax, Emin, 0.0, Tc))
|
559 |
start_pao = 75.
|
560 |
start_pa = start_pao
|
561 |
+
start_qt = 0.0 #aortic flow is Q_T and is 0 at ED, also see Fig5 in simaan2008dynamical
|
562 |
|
563 |
y0 = [start_v, start_pla, start_pa, start_pao, start_qt]
|
564 |
|
|
|
793 |
Ls=0.0005
|
794 |
|
795 |
#get values for periodic loops:
|
796 |
+
ef_nolvad, pao_ed, pao_es, co_nolvad, y00, y01, y02, y03, y04, Vlv0, Plv0 = f_nolvad(Tc, start_v, Emax, 0.0)
|
797 |
#pao_eds = [pao_ed]
|
798 |
#pao_ess = [pao_es]
|
799 |
|