Example #1
0
 def all_data(self):
     for it in range(self.ntests):
         offsets = self._gen_offsets()
         arena_sz = self.arena.getSize()
         pos = Position2D(
             arena_sz.x * np.random.rand(self.npos) + offsets.x,
             arena_sz.y * np.random.rand(self.npos) + offsets.y, self.dt)
         self._inject_outliers(pos, offsets)
         yield self.Data(pos, offsets)
Example #2
0
    def test_naive_version(self, reference_spatial_map):
        d, ref_rate_map, ref_xedges, ref_yedges = reference_spatial_map

        # Tested code
        ar = CircularArena(self.arenaR, Pair2D(self.sigma, self.sigma))
        pos = Position2D(d.pos_x, d.pos_y, d.pos_dt)
        their_rate_map = spatialRateMap(d.spike_times, pos, ar, self.sigma)
        their_edges = ar.getDiscretisation()
        # print(np.max(np.abs(their_rate_map - ref_rate_map)))
        np.testing.assert_allclose(their_rate_map, ref_rate_map, self.rtol)
        np.testing.assert_allclose(their_edges.x, ref_xedges, self.rtol)
        np.testing.assert_allclose(their_edges.y, ref_yedges, self.rtol)
Example #3
0
 def createPosition(self, nx, ny, dt):
     x = np.arange(nx)
     y = np.arange(ny) + 10
     return Position2D(x, y, dt)
Example #4
0
def position(possize, dt_fixture):
    x = np.arange(possize)
    y = np.arange(possize) + 10
    return Position2D(x, y, dt_fixture)
Example #5
0
 def pc(pos):
     return Position2D(np.copy(pos.x), np.copy(pos.y), pos.dt)
Example #6
0
def positions(npos, dt_fixture):
    x = np.arange(npos, dtype=np.float)
    y = np.arange(npos, dtype=np.float) + 10.
    return Position2D(x, y, dt_fixture)
Example #7
0
def fix_pos_data(fix_arena):
    ar = fix_arena

    pos_x = np.random.rand(100000) * ar.sz.x / 2.
    pos_y = np.random.rand(100000) * ar.sz.y / 2.
    return Position2D(pos_x, pos_y, 0.02)