<commit_before>
from __future__ import print_function

import numpy as np
import matplotlib.pyplot as plt

from common_filters import LowPassFilter
from signals import Signal
from units import Units

if __name__ == "__main__":
    r = 318
    c = 10 * Units.u
    lpf = LowPassFilter.make(r, c)

    input_signal = Signal.sine(0.01, 200, 5)
    output_signal = lpf.execute(input_signal)

    plt.plot(input_signal, label="Input")
    plt.plot(output_signal, label="Output")
    plt.legend()
    plt.show()<commit_msg>Working LPF<commit_after>
from __future__ import print_function

import numpy as np
import matplotlib.pyplot as plt

from common_filters import LowPassFilter
from signals import Signal
from units import Units

if __name__ == "__main__":
    r = 318
    c = 1 * Units.u
    lpf = LowPassFilter.make(r, c)
    print("Cutoff frequency: {0}".format(LowPassFilter.cutoff_frequency(r, c)))

    fs, transfers = [], []
    for f in range(100, 1000, 100):
        input_signal = Signal.sine(0.1, f, 5)
        output_signal = lpf.execute(input_signal)

        fs.append(f)
        transfers.append(max(output_signal) / 5)

        #plt.plot(input_signal, label="Input: {0} Hz".format(f))
        #plt.plot(output_signal, label="Output: {0} Hz".format(f))

    plt.xlabel("Frequency (in Hz.)")
    plt.ylabel("Gain")
    plt.plot(fs, transfers)
    plt.legend()
    plt.show()
{'fraction_non_alphanumeric': 0.1184115523465704, 'fraction_numerical': 0.023826714801444042, 'mean_word_length': 3.470967741935484, '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': '6209660', 'n_tokens_mistral': 512, 'n_tokens_neox': 465, 'n_words': 121}