TroglodyteDerivations commited on
Commit
7c78869
1 Parent(s): 70cbdc1

Updated lines 388-392 with: def Dispersion(self): # """Calculate the dispersion of the swarm""" dispersion = np.std(self.gpos[:, 0]) + np.std(self.gpos[:, 1]) return dispersion

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -378,12 +378,17 @@ class GWO:
378
  plt.close() # Close the figure to free up memory
379
  return Image.open(buf)
380
 
 
 
 
 
 
 
 
381
  def Dispersion(self):
382
- """Calculate the dispersion of the swarm"""
383
- x, y = self.gpos[:, 0], self.gpos[:, 1]
384
- dx = x.max() - x.min()
385
- dy = y.max() - y.min()
386
- return (dx + dy) / 2.0
387
 
388
  def plot_dispersion(self):
389
  """Plot the dispersion over time"""
 
378
  plt.close() # Close the figure to free up memory
379
  return Image.open(buf)
380
 
381
+ #def Dispersion(self):
382
+ #"""Calculate the dispersion of the swarm"""
383
+ #x, y = self.gpos[:, 0], self.gpos[:, 1]
384
+ #dx = x.max() - x.min()
385
+ #dy = y.max() - y.min()
386
+ #return (dx + dy) / 2.0
387
+
388
  def Dispersion(self):
389
+ # """Calculate the dispersion of the swarm"""
390
+ dispersion = np.std(self.gpos[:, 0]) + np.std(self.gpos[:, 1])
391
+ return dispersion
 
 
392
 
393
  def plot_dispersion(self):
394
  """Plot the dispersion over time"""