<commit_before>

import ot
import numpy as np

# import pytest


def test_plot1D_mat():

    n = 100  # nb bins

    # bin positions
    x = np.arange(n, dtype=np.float64)

    # Gaussian distributions
    a = ot.datasets.get_1D_gauss(n, m=20, s=5)  # m= mean, s= std
    b = ot.datasets.get_1D_gauss(n, m=60, s=10)

    # loss matrix
    M = ot.dist(x.reshape((n, 1)), x.reshape((n, 1)))
    M /= M.max()

    ot.plot.plot1D_mat(a, b, M, 'Cost matrix M')


def test_plot2D_samples_mat():

    n = 50  # nb samples

    mu_s = np.array([0, 0])
    cov_s = np.array([[1, 0], [0, 1]])

    mu_t = np.array([4, 4])
    cov_t = np.array([[1, -.8], [-.8, 1]])

    xs = ot.datasets.get_2D_samples_gauss(n, mu_s, cov_s)
    xt = ot.datasets.get_2D_samples_gauss(n, mu_t, cov_t)

    G = 1.0 * (np.random.rand(n, n) < 0.01)

    ot.plot.plot2D_samples_mat(xs, xt, G, thr=1e-5)<commit_msg>test plot with no X<commit_after>

import numpy as np
import matplotlib
matplotlib.use('Agg')


def test_plot1D_mat():

    import ot

    n = 100  # nb bins

    # bin positions
    x = np.arange(n, dtype=np.float64)

    # Gaussian distributions
    a = ot.datasets.get_1D_gauss(n, m=20, s=5)  # m= mean, s= std
    b = ot.datasets.get_1D_gauss(n, m=60, s=10)

    # loss matrix
    M = ot.dist(x.reshape((n, 1)), x.reshape((n, 1)))
    M /= M.max()

    ot.plot.plot1D_mat(a, b, M, 'Cost matrix M')


def test_plot2D_samples_mat():

    import ot

    n = 50  # nb samples

    mu_s = np.array([0, 0])
    cov_s = np.array([[1, 0], [0, 1]])

    mu_t = np.array([4, 4])
    cov_t = np.array([[1, -.8], [-.8, 1]])

    xs = ot.datasets.get_2D_samples_gauss(n, mu_s, cov_s)
    xt = ot.datasets.get_2D_samples_gauss(n, mu_t, cov_t)

    G = 1.0 * (np.random.rand(n, n) < 0.01)

    ot.plot.plot2D_samples_mat(xs, xt, G, thr=1e-5)
{'fraction_non_alphanumeric': 0.17448923246824957, 'fraction_numerical': 0.047487575924903366, 'mean_word_length': 2.6754563894523327, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4356563', 'n_tokens_mistral': 893, 'n_tokens_neox': 823, 'n_words': 182}