How to use the tigramite.tigramite_cython_code._get_neighbors_within_eps_cython function in tigramite

To help you get started, we’ve selected a few tigramite examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jakobrunge / tigramite / tigramite / independence_tests.py View on Github external
elif self.transform == 'ranks':
            array = array.argsort(axis=1).argsort(axis=1).astype('float')


        # Use cKDTree to get distances eps to the k-th nearest neighbors for
        # every sample in joint space XYZ with maximum norm
        tree_xyz = spatial.cKDTree(array.T)
        epsarray = tree_xyz.query(array.T, k=knn+1, p=np.inf,
                                  eps=0., n_jobs=self.n_jobs)[0][:, knn].astype('float')

        # Prepare for fast cython access
        dim_x = int(np.where(xyz == 0)[0][-1] + 1)
        dim_y = int(np.where(xyz == 1)[0][-1] + 1 - dim_x)

        k_xz, k_yz, k_z = \
                tigramite_cython_code._get_neighbors_within_eps_cython(array,
                                                                       T,
                                                                       dim_x,
                                                                       dim_y,
                                                                       epsarray,
                                                                       knn,
                                                                       dim)
        return k_xz, k_yz, k_z