<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import nix
import numpy as np
import matplotlib.pylab as plt


def create_sinewave(duration=1, freq=10, stepsize=0.01):
    x = np.arange(0, duration*2*np.pi, stepsize)
    y = np.sin(freq*x)
    return x, y 


def plot_data(data_array):
    x_axis = data_array.dimensions[0]
    x = np.arange(0, data_array.data.shape[0])
    x = x * x_axis.sampling_interval + x_axis.offset
    y = data_array.data
    plt.plot(x, y)
    plt.xlabel(x_axis.label + " [" + x_axis.unit + "]")
    plt.ylabel(data_array.label + " [" + data_array.unit + "]")
    plt.title(data_array.name)
    plt.show()


if __name__ == "__main__":
    # fake some data
    duration = 2<commit_msg>[tutorial] improved plot of regular sampled data<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import nix
import numpy as np
import matplotlib.pylab as plt


def create_sinewave(duration=1, freq=10, stepsize=0.01):
    x = np.arange(0, duration*2*np.pi, stepsize)
    y = np.sin(freq*x)
    return x, y 


def plot_data(data_array):
    x_axis = data_array.dimensions[0]
    x = np.arange(0, data_array.data.shape[0])
    x = x * x_axis.sampling_interval + x_axis.offset
    y = data_array.data
    plt.plot(x, y)
    plt.xlabel(x_axis.label + " [" + x_axis.unit + "]")
    plt.ylabel(data_array.label + " [" + data_array.unit + "]")
    plt.title(data_array.name)
    plt.xlim(0, np.max(x))
    plt.ylim((1.1 * np.min(y), 1.1 * np.max(y)))
    plt.show()


if __name__ == "__main__":
    # fake some data
    duration = 2
{'fraction_non_alphanumeric': 0.15823190262652145, 'fraction_numerical': 0.01985906470211403, 'mean_word_length': 3.110526315789474, 'pattern_counts': {'":': 2, '<': 3, '<?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': '3096798', 'n_tokens_mistral': 643, 'n_tokens_neox': 626, 'n_words': 123}