Exemplo n.º 1
0
        def link(f, search_range, *args, **kw):
            kw = dict(self.linker_opts, **kw)
            size = 3
            separation = kw['separation']
            f = f.copy()
            topleft = (f[['y', 'x']].min().values - 4 * separation).astype(
                np.int)
            f[['y', 'x']] -= topleft
            shape = (f[['y', 'x']].max().values + 4 * separation).astype(
                np.int)
            reader = CoordinateReader(f, shape, size,
                                      t=f['frame'].unique())

            pred.pos_columns = kw.get('pos_columns', ['x', 'y'])
            pred.t_column = kw.get('t_column', 'frame')

            f = []
            for i, frame in trackpy.find_link_iter(reader, predictor=pred.predict,
                                                   search_range=search_range,
                                                   *args, **kw):
                f.append(frame)

            f = pandas.concat(f)
            f[['y', 'x']] += topleft

            return f
Exemplo n.º 2
0
        def link_iter(f, search_range, *args, **kw):
            kw = dict(self.linker_opts, **kw)
            size = 3
            separation = kw['separation']
            # convert the iterable to a single DataFrame (OK for tests)
            f = [_f for _f in f]
            indices = [_f['frame'].iloc[0] for _f in f]
            f = pandas.concat([_f for _f in f])
            topleft = (f[['y', 'x']].min().values - 4 * separation).astype(
                np.int)
            f[['y', 'x']] -= topleft
            shape = (f[['y', 'x']].max().values + 4 * separation).astype(
                np.int)
            reader = CoordinateReader(f, shape, size, t=indices)

            pred.pos_columns = kw.get('pos_columns', ['x', 'y'])
            pred.t_column = kw.get('t_column', 'frame')

            for i, frame in trackpy.find_link_iter(reader, predictor=pred.predict,
                                                   search_range=search_range,
                                                   *args, **kw):
                pred.observe(frame)
                frame[['y', 'x']] += topleft

                yield frame
Exemplo n.º 3
0
        def link(f, search_range, *args, **kw):
            kw = dict(self.linker_opts, **kw)
            size = 3
            separation = kw['separation']
            f = f.copy()
            topleft = (f[['y', 'x']].min().values - 4 * separation).astype(
                np.int)
            f[['y', 'x']] -= topleft
            shape = (f[['y', 'x']].max().values + 4 * separation).astype(
                np.int)
            reader = CoordinateReader(f, shape, size,
                                      t=f['frame'].unique())

            pred.pos_columns = kw.get('pos_columns', ['x', 'y'])
            pred.t_column = kw.get('t_column', 'frame')

            f = []
            for i, frame in trackpy.find_link_iter(reader, predictor=pred.predict,
                                                   search_range=search_range,
                                                   *args, **kw):
                f.append(frame)

            f = pandas.concat(f)
            f[['y', 'x']] += topleft

            return f
Exemplo n.º 4
0
        def link_iter(f, search_range, *args, **kw):
            kw = dict(self.linker_opts, **kw)
            size = 3
            separation = kw['separation']
            # convert the iterable to a single DataFrame (OK for tests)
            f = [_f for _f in f]
            indices = [_f['frame'].iloc[0] for _f in f]
            f = pandas.concat([_f for _f in f])
            topleft = (f[['y', 'x']].min().values - 4 * separation).astype(
                np.int)
            f[['y', 'x']] -= topleft
            shape = (f[['y', 'x']].max().values + 4 * separation).astype(
                np.int)
            reader = CoordinateReader(f, shape, size, t=indices)

            pred.pos_columns = kw.get('pos_columns', ['x', 'y'])
            pred.t_column = kw.get('t_column', 'frame')

            for i, frame in trackpy.find_link_iter(reader, predictor=pred.predict,
                                                   search_range=search_range,
                                                   *args, **kw):
                pred.observe(frame)
                frame[['y', 'x']] += topleft

                yield frame
Exemplo n.º 5
0
        def link_iter(f, search_range, *args, **kw):
            kw = dict(self.linker_opts, **kw)
            size = 3
            separation = kw['separation']
            # convert the iterable to a single DataFrame (OK for tests)
            f = [_f for _f in f]
            indices = [_f['frame'].iloc[0] for _f in f]
            f = pandas.concat([_f for _f in f])
            topleft = (f[['y', 'x']].min().values - 4 * separation).astype(int)
            f[['y', 'x']] -= topleft
            shape = (f[['y', 'x']].max().values + 4 * separation).astype(int)
            reader = CoordinateReader(f, shape, size, t=indices)

            for i, frame in trackpy.find_link_iter(reader,
                                                   search_range=search_range,
                                                   *args,
                                                   **kw):
                frame[['y', 'x']] += topleft
                yield frame