def show_baseline_rd_fig(test_data_ids, Ns, samp_range):
    '\n    Plot relative distances from points found by the baseline solver.\n    test_ids, Ns, and samp_range should be as in show_baseline_re_fig.\n    '
    log = True
    mpl.rcParams['mathtext.default'] = 'regular'
    sp = 1
    for samp in samp_range:
        for (test_data_id, N) in zip(test_data_ids, Ns):
            print(('samp %d, N %d' % (samp, N)))
            npz = np.load(('results/baseline_rd_%s_N_%d_s_%d.npz' % (test_data_id, N, samp)))
            (in_rr, out_rr) = (npz['in_RR'], npz['out_RR'])
            if (in_rr > 0).any():
                in_rr[(in_rr == 0)] = in_rr[(in_rr > 0)].min()
            else:
                in_rr[(in_rr == 0)] = (2 ** (- 30))
            ax = plt.subplot(len(samp_range), len(Ns), sp)
            sp += 1
            if np.isinf(out_rr).any():
                if np.isinf(out_rr).all():
                    out_rr[:] = (4 * in_rr.max())
                else:
                    out_rr[np.isinf(out_rr)] = (4 * out_rr[(~ np.isinf(out_rr))].max())
            print('out_rr:')
            print(out_rr.shape)
            print((out_rr == 0).sum())
            print(np.isinf(in_rr).sum())
            print(np.isinf(out_rr).sum())
            print(np.isnan(out_rr).sum())
            if (out_rr.shape[0] > 0):
                plt.hist(np.log2(out_rr), bins=30, log=log, facecolor='k')
            plt.hist(np.log2(in_rr), bins=10, log=log, facecolor='w')
            if (N == Ns[0]):
                plt.ylabel('# of pairs')
            if (samp == samp_range[0]):
                ax.set_title(('N = %d' % N))
            if (samp == samp_range[(- 1)]):
                plt.xlabel('Baseline Relative Distance')
            plt.xlim([(- 30), 50])
            plt.xticks(range((- 30), 51, 10), ([''] + [('$2^{%d}$' % xl) for xl in range((- 20), 51, 10)]))
    plt.show()
Plot relative distances from points found by the baseline solver.
test_ids, Ns, and samp_range should be as in show_baseline_re_fig.
def show_baseline_rd_fig(test_data_ids, Ns, samp_range):
    '\n    Plot relative distances from points found by the baseline solver.\n    test_ids, Ns, and samp_range should be as in show_baseline_re_fig.\n    '
    log = True
    mpl.rcParams['mathtext.default'] = 'regular'
    sp = 1
    for samp in samp_range:
        for (test_data_id, N) in zip(test_data_ids, Ns):
            print(('samp %d, N %d' % (samp, N)))
            npz = np.load(('results/baseline_rd_%s_N_%d_s_%d.npz' % (test_data_id, N, samp)))
            (in_rr, out_rr) = (npz['in_RR'], npz['out_RR'])
            if (in_rr > 0).any():
                in_rr[(in_rr == 0)] = in_rr[(in_rr > 0)].min()
            else:
                in_rr[(in_rr == 0)] = (2 ** (- 30))
            ax = plt.subplot(len(samp_range), len(Ns), sp)
            sp += 1
            if np.isinf(out_rr).any():
                if np.isinf(out_rr).all():
                    out_rr[:] = (4 * in_rr.max())
                else:
                    out_rr[np.isinf(out_rr)] = (4 * out_rr[(~ np.isinf(out_rr))].max())
            print('out_rr:')
            print(out_rr.shape)
            print((out_rr == 0).sum())
            print(np.isinf(in_rr).sum())
            print(np.isinf(out_rr).sum())
            print(np.isnan(out_rr).sum())
            if (out_rr.shape[0] > 0):
                plt.hist(np.log2(out_rr), bins=30, log=log, facecolor='k')
            plt.hist(np.log2(in_rr), bins=10, log=log, facecolor='w')
            if (N == Ns[0]):
                plt.ylabel('# of pairs')
            if (samp == samp_range[0]):
                ax.set_title(('N = %d' % N))
            if (samp == samp_range[(- 1)]):
                plt.xlabel('Baseline Relative Distance')
            plt.xlim([(- 30), 50])
            plt.xticks(range((- 30), 51, 10), ([] + [('$2^{%d}$' % xl) for xl in range((- 20), 51, 10)]))
    plt.show()