Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -831,7 +831,7 @@ def lvad_plots(Rm, Ra, Emax, Emin, Vd, Tc, start_v, beta, loop_simulated=True):
|
|
| 831 |
new_ef, pao_ed, pao_es, CO, MAP, Vlvs, Plvs = f_lvad(Rs, Rm, Ra, Rc, Ca, Cs, Cr, Ls, Emin, Vd, Tc, start_v, Emax, c, slope0, w0, x60, y00, y01, y02, y03, y04)
|
| 832 |
|
| 833 |
# Create the figure and the loop that we will manipulate
|
| 834 |
-
N =
|
| 835 |
|
| 836 |
fig, ax = plt.subplots(figsize=(6, 4))
|
| 837 |
plt.ylim((0,220))
|
|
@@ -839,14 +839,14 @@ def lvad_plots(Rm, Ra, Emax, Emin, Vd, Tc, start_v, beta, loop_simulated=True):
|
|
| 839 |
start = (N-2)*60000
|
| 840 |
end = (N)*60000
|
| 841 |
if loop_simulated:
|
| 842 |
-
line1
|
| 843 |
point1 = ax.scatter(Vlv0[start:end], Plv0[start:end], c="b", s=5)#, label='End Diastole')
|
| 844 |
-
line2
|
| 845 |
point2 = ax.scatter(Vlvs[start:(start+1)], Plvs[start:(start+1)], color=(78/255, 192/255, 44/255), s=5)#, label='End Diastole')
|
| 846 |
#point = ax.scatter(volumes[start:(start+1)], pressures[start:(start+1)], c="b", s=5, label='End Systole')
|
| 847 |
else:
|
| 848 |
-
line1
|
| 849 |
-
line2
|
| 850 |
|
| 851 |
ax.set_xlabel('LV Volume (ml)')
|
| 852 |
ax.set_ylabel('LV Pressure (mmHg)')
|
|
@@ -857,17 +857,15 @@ def lvad_plots(Rm, Ra, Emax, Emin, Vd, Tc, start_v, beta, loop_simulated=True):
|
|
| 857 |
def update(frame):
|
| 858 |
# update to add more of the loop
|
| 859 |
end = (N-2)*60000+1000 * frame
|
| 860 |
-
x = Vlv0[start:end]
|
| 861 |
-
y = Plv0[start:end]
|
| 862 |
x2 = Vlvs[start:end]
|
| 863 |
y2 = Plvs[start:end]
|
| 864 |
-
ax.plot(
|
| 865 |
-
|
| 866 |
|
| 867 |
|
| 868 |
plt.legend(loc='upper left', framealpha=1)
|
| 869 |
-
plt.ylim((0,220))
|
| 870 |
-
plt.xlim((0,250))
|
| 871 |
|
| 872 |
if loop_simulated:
|
| 873 |
# plt.title('', fontsize=16)
|
|
|
|
| 831 |
new_ef, pao_ed, pao_es, CO, MAP, Vlvs, Plvs = f_lvad(Rs, Rm, Ra, Rc, Ca, Cs, Cr, Ls, Emin, Vd, Tc, start_v, Emax, c, slope0, w0, x60, y00, y01, y02, y03, y04)
|
| 832 |
|
| 833 |
# Create the figure and the loop that we will manipulate
|
| 834 |
+
N = 70
|
| 835 |
|
| 836 |
fig, ax = plt.subplots(figsize=(6, 4))
|
| 837 |
plt.ylim((0,220))
|
|
|
|
| 839 |
start = (N-2)*60000
|
| 840 |
end = (N)*60000
|
| 841 |
if loop_simulated:
|
| 842 |
+
line1 = ax.plot(Vlv0[start:end], Plv0[start:end], lw=1, color='b',label='No LVAD')
|
| 843 |
point1 = ax.scatter(Vlv0[start:end], Plv0[start:end], c="b", s=5)#, label='End Diastole')
|
| 844 |
+
line2 = ax.plot(Vlvs[start:(start+1)], Plvs[start:(start+1)], lw=1, color=(78/255, 192/255, 44/255), label=f"LVAD, ω(0)= {round(w0,2)}r/min")
|
| 845 |
point2 = ax.scatter(Vlvs[start:(start+1)], Plvs[start:(start+1)], color=(78/255, 192/255, 44/255), s=5)#, label='End Diastole')
|
| 846 |
#point = ax.scatter(volumes[start:(start+1)], pressures[start:(start+1)], c="b", s=5, label='End Systole')
|
| 847 |
else:
|
| 848 |
+
line1 = ax.plot(Vlv0, Plv0, color='blue', label='No LVAD') #blue
|
| 849 |
+
line2 = ax.plot(Vlvs, Plvs, color=(78/255, 192/255, 44/255), label=f"LVAD, ω(0)= {round(w0,2)}r/min") #green
|
| 850 |
|
| 851 |
ax.set_xlabel('LV Volume (ml)')
|
| 852 |
ax.set_ylabel('LV Pressure (mmHg)')
|
|
|
|
| 857 |
def update(frame):
|
| 858 |
# update to add more of the loop
|
| 859 |
end = (N-2)*60000+1000 * frame
|
| 860 |
+
#x = Vlv0[start:end]
|
| 861 |
+
#y = Plv0[start:end]
|
| 862 |
x2 = Vlvs[start:end]
|
| 863 |
y2 = Plvs[start:end]
|
| 864 |
+
#ax.plot(x2, y2, lw=1, color='b',label='No LVAD')
|
| 865 |
+
ax.plot(x2, y2, lw=1, color=(78/255, 192/255, 44/255), label=f"LVAD, ω(0)= {round(w0,2)}r/min")
|
| 866 |
|
| 867 |
|
| 868 |
plt.legend(loc='upper left', framealpha=1)
|
|
|
|
|
|
|
| 869 |
|
| 870 |
if loop_simulated:
|
| 871 |
# plt.title('', fontsize=16)
|