Franny Dean commited on
Commit
ca624a0
1 Parent(s): 3d2cf31

animation changed to animate and video save

Browse files
Files changed (2) hide show
  1. .ipynb_checkpoints/app-checkpoint.py +4 -4
  2. app.py +4 -4
.ipynb_checkpoints/app-checkpoint.py CHANGED
@@ -460,7 +460,7 @@ def pvloop_simulator(Rm, Ra, Emax, Emin, Vd, Tc, start_v, animate=True):
460
  plt.ylim((0,220))
461
  plt.xlim((0,250))
462
  start = (N-2)*60000
463
- end = (N-2)*60000+50000
464
  if animate:
465
  line = ax.plot(volumes[start:(start+1)], pressures[start:(start+1)], lw=1, color='b')
466
  point = ax.scatter(volumes[start:(start+1)], pressures[start:(start+1)], c="b", s=5)
@@ -484,7 +484,7 @@ def pvloop_simulator(Rm, Ra, Emax, Emin, Vd, Tc, start_v, animate=True):
484
  ax.plot(x, y, lw=1, c='b')
485
 
486
  if animate:
487
- anim = animation.FuncAnimation(fig, partial(update), frames=43, interval=1)
488
  anim.save("prediction.mp4")
489
 
490
  return plt, Rm, Ra, Emax, Emin, Vd, Tc, start_v
@@ -514,8 +514,8 @@ def generate_example():
514
 
515
  plot, Rm, Ra, Emax, Emin, Vd,Tc, start_v = pvloop_simulator(Rm=round(results[4].item(),2), Ra=round(results[5].item(),2), Emax=results[2].item(), Emin=round(results[3].item(),2), Vd=round(results[6].item(),2), Tc=round(results[0].item(),2), start_v=round(results[1].item(),2))
516
  video = video.replace("avi", "mp4")
517
- # animated = "prediction.mp4"
518
- return video, plot, Rm, Ra, Emax, Emin, Vd, Tc, start_v
519
 
520
  title = "Non-Invasive Medical Digital Twins using Physics-Informed Self-Supervised Learning"
521
 
 
460
  plt.ylim((0,220))
461
  plt.xlim((0,250))
462
  start = (N-2)*60000
463
+ end = (N)*60000
464
  if animate:
465
  line = ax.plot(volumes[start:(start+1)], pressures[start:(start+1)], lw=1, color='b')
466
  point = ax.scatter(volumes[start:(start+1)], pressures[start:(start+1)], c="b", s=5)
 
484
  ax.plot(x, y, lw=1, c='b')
485
 
486
  if animate:
487
+ anim = animation.FuncAnimation(fig, partial(update), frames=60, interval=1)
488
  anim.save("prediction.mp4")
489
 
490
  return plt, Rm, Ra, Emax, Emin, Vd, Tc, start_v
 
514
 
515
  plot, Rm, Ra, Emax, Emin, Vd,Tc, start_v = pvloop_simulator(Rm=round(results[4].item(),2), Ra=round(results[5].item(),2), Emax=results[2].item(), Emin=round(results[3].item(),2), Vd=round(results[6].item(),2), Tc=round(results[0].item(),2), start_v=round(results[1].item(),2))
516
  video = video.replace("avi", "mp4")
517
+ animated = "prediction.mp4"
518
+ return video, animated, Rm, Ra, Emax, Emin, Vd, Tc, start_v
519
 
520
  title = "Non-Invasive Medical Digital Twins using Physics-Informed Self-Supervised Learning"
521
 
app.py CHANGED
@@ -460,7 +460,7 @@ def pvloop_simulator(Rm, Ra, Emax, Emin, Vd, Tc, start_v, animate=True):
460
  plt.ylim((0,220))
461
  plt.xlim((0,250))
462
  start = (N-2)*60000
463
- end = (N-2)*60000+50000
464
  if animate:
465
  line = ax.plot(volumes[start:(start+1)], pressures[start:(start+1)], lw=1, color='b')
466
  point = ax.scatter(volumes[start:(start+1)], pressures[start:(start+1)], c="b", s=5)
@@ -484,7 +484,7 @@ def pvloop_simulator(Rm, Ra, Emax, Emin, Vd, Tc, start_v, animate=True):
484
  ax.plot(x, y, lw=1, c='b')
485
 
486
  if animate:
487
- anim = animation.FuncAnimation(fig, partial(update), frames=43, interval=1)
488
  anim.save("prediction.mp4")
489
 
490
  return plt, Rm, Ra, Emax, Emin, Vd, Tc, start_v
@@ -514,8 +514,8 @@ def generate_example():
514
 
515
  plot, Rm, Ra, Emax, Emin, Vd,Tc, start_v = pvloop_simulator(Rm=round(results[4].item(),2), Ra=round(results[5].item(),2), Emax=results[2].item(), Emin=round(results[3].item(),2), Vd=round(results[6].item(),2), Tc=round(results[0].item(),2), start_v=round(results[1].item(),2))
516
  video = video.replace("avi", "mp4")
517
- # animated = "prediction.mp4"
518
- return video, plot, Rm, Ra, Emax, Emin, Vd, Tc, start_v
519
 
520
  title = "Non-Invasive Medical Digital Twins using Physics-Informed Self-Supervised Learning"
521
 
 
460
  plt.ylim((0,220))
461
  plt.xlim((0,250))
462
  start = (N-2)*60000
463
+ end = (N)*60000
464
  if animate:
465
  line = ax.plot(volumes[start:(start+1)], pressures[start:(start+1)], lw=1, color='b')
466
  point = ax.scatter(volumes[start:(start+1)], pressures[start:(start+1)], c="b", s=5)
 
484
  ax.plot(x, y, lw=1, c='b')
485
 
486
  if animate:
487
+ anim = animation.FuncAnimation(fig, partial(update), frames=60, interval=1)
488
  anim.save("prediction.mp4")
489
 
490
  return plt, Rm, Ra, Emax, Emin, Vd, Tc, start_v
 
514
 
515
  plot, Rm, Ra, Emax, Emin, Vd,Tc, start_v = pvloop_simulator(Rm=round(results[4].item(),2), Ra=round(results[5].item(),2), Emax=results[2].item(), Emin=round(results[3].item(),2), Vd=round(results[6].item(),2), Tc=round(results[0].item(),2), start_v=round(results[1].item(),2))
516
  video = video.replace("avi", "mp4")
517
+ animated = "prediction.mp4"
518
+ return video, animated, Rm, Ra, Emax, Emin, Vd, Tc, start_v
519
 
520
  title = "Non-Invasive Medical Digital Twins using Physics-Informed Self-Supervised Learning"
521