Commits

remosu committed c37970e

pep8 formatting

  • Participants
  • Parent commits 1cad6ca

Comments (0)

Files changed (1)

 
     def move(self, delta_t):
         self.x += delta_t * self.v
-        
+
     def overlaps_with(self, other_particle, radius):
-        squared_distance = np.sum((other_particle.x - self.x)**2)
-        return squared_distance < 4.0 * radius**2
+        squared_distance = np.sum((other_particle.x - self.x) ** 2)
+        return squared_distance < 4.0 * radius ** 2
+
 
 class Box(object):
     def __init__(self, size=10):
 
             if i % self.nprint == 0:
                 print i,  self.time
-                
+
             self.t_events.append(self.time)
 
             if next_event[1] is None:
     particles = [Particle(x, v) for x, v in itertools.izip(coords, vels)]
     return particles
 
+
 def create_random_particles(seed, box, num_particles, radius, minimium_velocity, maximum_velocity):
     particles = []
     np.random.seed(seed)
     coords_lower_bound = -box.size + radius
     for i in xrange(0, num_particles):
         overlap = True
-        while(overlap):   
+        while(overlap):
             x = np.random.uniform(coords_lower_bound, coords_upper_bound, 2)
             v = np.random.uniform(minimium_velocity, maximum_velocity, 2)
             new_particle = Particle(x, v)
-            overlap = is_there_overlap(new_particle, particles, radius)    
+            overlap = is_there_overlap(new_particle, particles, radius)
         particles.append(new_particle)
     return particles
 
+
 def is_there_overlap(new_particle, particles, radius):
     for particle in particles:
         if new_particle.overlaps_with(particle, radius):
             return True
     return False
 
+
 def create_simulation_from_files(coords_filename, vels_filename, box_size, eps):
     particles = load_initial_particles(coords_filename, vels_filename)
     rules = CollisionRules(Box(box_size), eps)
     return Simulation(particles, rules)
 
+
 def create_simulation(num_particles, seed, radius, box_size, eps, minimium_velocity, maximum_velocity):
     box = Box(box_size)
     particles = create_random_particles(seed, box, num_particles, radius, minimium_velocity, maximum_velocity)