コード例 #1
0
 def setUp(self):
     n =100
     self.xmax = 100
     self.xmin = 10
     self.ymax = 200
     self.ymin = 5
     particles = Particles('nazwa', n)
     self.simulation = simulation(particles)
     self.simulation.set_boundaries(self.xmax, self.xmin, self.ymax, self.ymin)
 def setUp(self):
     n = 100
     self.xmax = 10
     self.xmin = 0
     self.ymax = 20
     self.ymin = 0
     particles = Particles('nazwa', n)
     self.simulation = simulation(particles)
     self.simulation.set_coordinations(n, self.xmax, self.xmin, self.ymax,
                                       self.ymin)
コード例 #3
0
 def setUp(self):
     self.n = 10
     self.vmax = 1
     particles = Particles('nazwa', self.n)
     self.simulation = simulation(particles)
     self.simulation.set_velocities(self.n, self.vmax)
     self.xmax = 10
     self.xmin = 0
     self.ymax = 20
     self.ymin = 0
     self.simulation.set_coordinations(self.n, self.xmax, self.xmin,
                                       self.ymax, self.ymin)
コード例 #4
0
class Test_Particles(unittest.TestCase):
    def setUp(self):
        self.n = 100
        self.kulki = Particles('nazwa', self.n)

    def test_coordinates(self):
        self.assertEqual(self.kulki.coordinates.shape, (2, self.n))

    def test_coordinates(self):
        self.assertEqual(self.kulki.velocities.shape, (2, self.n))

    def test_log(self):
        self.kulki.log()
        self.kulki.log()
        with open(self.kulki.name, 'r') as csvfile:
            csvreader = csv.reader(csvfile)
            row_count = 0
            for row in csvreader:
                #print (row)
                row_count += 1
                column_count = len(row)

        self.assertEqual(row_count, int(4))
        self.assertEqual(column_count, self.n)
コード例 #5
0
    def __init__(self):
        self.W = 200

        self.n = 400
        self.vmax = self.W / (2 * self.n)
        particles = Particles('symulacja', self.n)
        self.simulation = simulation(particles)
        self.simulation.set_velocities(self.n, self.vmax)
        self.xmax = 30
        self.xmin = 0
        self.ymax = 30
        self.ymin = 0
        self.simulation.set_coordinations(self.n, 1, self.xmin, self.ymax,
                                          self.ymin)
        self.simulation.set_boundaries(self.xmax, self.xmin, self.ymax,
                                       self.ymin)
        self.simulation.run(2000, 0.5)  #(1/(self.W))*np.log2(self.W))
コード例 #6
0
 def setUp(self):
     self.animation = Animation()
     self.animation.n = 2
     self.animation.vmax = 3
     particles = Particles('symulacja', self.animation.n)
     self.animation.simulation = simulation(particles)
     self.animation.simulation.set_velocities(self.animation.n,
                                              self.animation.vmax)
     self.animation.xmax = 30
     self.animation.xmin = 0
     self.animation.ymax = 20
     self.animation.ymin = 0
     self.animation.simulation.set_coordinations(self.animation.n, 1,
                                                 self.animation.xmin,
                                                 self.animation.ymax,
                                                 self.animation.ymin)
     self.animation.simulation.set_boundaries(self.animation.xmax,
                                              self.animation.xmin,
                                              self.animation.ymax,
                                              self.animation.ymin)
コード例 #7
0
 def setUp(self):
     self.n = 100
     self.vmax = 10
     particles = Particles('nazwa', self.n)
     self.simulation = simulation(particles)
     self.simulation.set_velocities(self.n, self.vmax)
コード例 #8
0
 def setUp(self):
     self.n = 100
     self.kulki = Particles('nazwa', self.n)