def run_pyscamp(inputs, a, b, window, max_matches, thresh, ptype, rrows, rcols): args = {} args['pearson'] = True if thresh: args['threshold'] = thresh if rrows: args['mheight'] = rrows if rcols: args['mwidth'] = rcols if '--no_gpu' in extra_opts: args['gpus'] = [] if not max_matches: max_matches = 5 mp_columns_out = None mp_columns_out_index = None mp_rows_out = None mp_rows_out_index = None if ptype == "1NN_INDEX": if a == b: mp_columns_out, mp_columns_out_index = mp.selfjoin( inputs[a], window, **args) else: mp_columns_out, mp_columns_out_index = mp.abjoin( inputs[a], inputs[b], window, **args) elif ptype == "SUM_THRESH": if a == b: mp_columns_out = mp.selfjoin_sum(inputs[a], window, **args) else: mp_columns_out = mp.abjoin_sum(inputs[a], inputs[b], window, **args) elif ptype == "ALL_NEIGHBORS": if a == b: mp_columns_out = mp.selfjoin_knn(inputs[a], window, max_matches, **args) else: mp_columns_out = mp.abjoin_knn(inputs[a], inputs[b], window, max_matches, **args) else: raise ValueError( 'pyscamp does not support profile type {}'.format(ptype)) if mp_columns_out is not None: mp_columns_out = mp_columns_out.squeeze() if mp_columns_out_index is not None: mp_columns_out_index = mp_columns_out_index.squeeze() if mp_rows_out is not None: mp_rows_out = mp_rows_out.squeeze() if mp_rows_out_index is not None: mp_rows_out_index = mp_rows_out_index.squeeze() return mp_columns_out, mp_columns_out_index, mp_rows_out, mp_rows_out_index
print("1NN INDEX AB join pass") else: failed = True print("1NN INDEX AB join fail") dist = mp.selfjoin_sum(arr, 1024, threshold=0.90, pearson=True) dist = dist.reshape((len(dist), 1)) vdist = reduce_sum_thresh(dm_self, 0.90) if compare_vectors(vdist, np.array(dist)): print("SUM Self join pass") else: failed = True print("SUM Self join fail") dist = mp.abjoin_sum(arr, arr2, 1024, threshold=0.90, pearson=True) dist = dist.reshape((len(dist), 1)) vdist = reduce_sum_thresh(dm_ab, 0.90) if compare_vectors(vdist, np.array(dist)): print("SUM AB join pass") else: failed = True print("SUM AB join fail") dist = mp.selfjoin(arr, 1024, threads=1) dist = mp.selfjoin(arr, 1024, threads=2) if mp.gpu_supported(): print('GPUs Supported') # TODO(zpzim): add a correctness check here once we have a test for that