import tkinter as tk
import numpy as np

class Sonar:

    def __init__(self, T=4, beta=3, fd=80000, fs=20000, tau=0.1, d=1000):
        self.T = T
        self.beta = beta
        self.fd = fd
        self.fs = fs
        self.tau = tau
        self.d = d
        self.c = 1500
        self.time = np.arange(0, self.T, 1/self.fd)

    def hilbert(self, signal):
        f = np.fft.fft(signal)
        N = len(f)
        for i in range(N/2, N):
            f[i] = 0
        s = np.fft.ifft(f)
        return s
        

    def detector(self, s_left, s_right):
        h_left = np.fft.fft(s_left)
        h_right = np.fft.fft(s_right)

        r = 100
        phi = 20
        df = 0

        return [r, phi, df]