<commit_before>from Modules import SignalData

import numpy as np
import matplotlib.pyplot as plt

from Modules import fourier

def SignalFreqPlot(SignalInfo,start,end):

	value=SignalInfo.getvalues()
	signal=value[2]

	if(value[1]==".wav"):
		factor=1
		startslice=start*factor*int(value[3])
		endslice=end*factor*int(value[3])
		signal_chunk = signal[startslice:endslice, :]
		signal_chunk = signal_chunk.flatten()
		signal_chunk = signal_chunk - 127.5
	else:
		factor=2
		startslice=start*factor*int(value[3])
		endslice=end*factor*int(value[3])
		signal_chunk = signal[startslice:endslice]
		signal_chunk = signal_chunk - 127.5

	signal_chunk_iq = np.empty(signal_chunk.shape[0] // 2, dtype=np.complex128)
	signal_chunk_iq.real = signal_chunk[::2]
	signal_chunk_iq.imag = signal_chunk[1::2]

	frequency,transform=fourier.CalcFourier(signal_chunk_iq,value[3],value[4])

	plt.rcParams["figure.figsize"] = (16, 6)
	fig = plt.figure()

	ax = fig.add_subplot(111)
	plt.gca().xaxis.grid(True)
	plt.gca().yaxis.grid(True)
	ax.set_title("Freq Domain Plot of Signal")
	ax.set_xlabel('Freq(Hz)')
	ax.set_ylabel('|X(t)|')
	plt.plot(frequency, transform)
	plt.show()<commit_msg>Added till bandpass filter<commit_after>from Modules import SignalData

import numpy as np
import matplotlib.pyplot as plt

from Modules import fourier


def SignalFreqPlot(SignalInfo, start, end):

    value = SignalInfo.getvalues()
    signal = value[2]

    if(value[1] == ".wav"):
        factor = 1
        startslice = start * factor * int(value[3])
        endslice = end * factor * int(value[3])
        signal_chunk = signal[startslice:endslice, :]
        signal_chunk = signal_chunk.flatten()
        signal_chunk = signal_chunk - 127.5
    elif(value[1] == ".dat"):
        factor = 2
        startslice = start * factor * int(value[3])
        endslice = end * factor * int(value[3])
        signal_chunk = signal[startslice:endslice]
        signal_chunk = signal_chunk - 127.5
    else:
        factor = 1
        startslice = start * factor * int(value[3])
        endslice = end * factor * int(value[3])
        signal_chunk_iq = signal[startslice:endslice]

    if(value[1] != ".txt"):
        signal_chunk_iq = np.empty(
            signal_chunk.shape[0] // 2, dtype=np.complex128)
        signal_chunk_iq.real = signal_chunk[::2]
        signal_chunk_iq.imag = signal_chunk[1::2]

    frequency, transform = fourier.CalcFourier(
        signal_chunk_iq, value[3], value[4])

    plt.rcParams["figure.figsize"] = (16, 6)
    fig = plt.figure()

    ax = fig.add_subplot(111)
    plt.gca().xaxis.grid(True)
    plt.gca().yaxis.grid(True)
    ax.set_title("Freq Domain Plot of Signal")
    ax.set_xlabel('Freq(Hz)')
    ax.set_ylabel('|X(t)|')
    plt.plot(frequency, transform)
    plt.show()
{'fraction_non_alphanumeric': 0.13776978417266186, 'fraction_numerical': 0.024820143884892086, 'mean_word_length': 3.697635135135135, 'pattern_counts': {'":': 0, '<': 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': '5908495', 'n_tokens_mistral': 1052, 'n_tokens_neox': 997, 'n_words': 179}