Example #1
0
def getDecimation(source_signal):
    #getting source singal length
    sig_len = len(source_signal)
    # Copy source signal (in order to not interfere source signal)
    sig1_ = copy.deepcopy(source_signal)
    # Creating list for storing signals
    decimation_list = list()

    #Geting coprimes of sign len e.g len=  256 coprimes = [1,3,5,7 ... 255]
    # index 1 because of coprimes method return tuple of 2element
    # (the number of total coprimes, and list of coprimes)
    #
    coprime_list = coprimes(sig_len)[1]

    # For each coprime of source signal length we will create a signal using decimation
    for i in range(len(coprime_list)):
        # tmp for signal we are going to get with decimation
        sig2_ = [0 for i in range(sig_len)]

        # creating rest signals with decimation
        decimation(sig1_, sig2_, coprime_list[i])

        # appending decimation_list with list
        # that contains decimated sig and
        # decimation coefficient that used to create that sig
        decimation_list.append([sig2_, coprime_list[i]])
    return decimation_list
Example #2
0
    def get_decimation(self):
        # Copy source signal
        sig1_ = copy.deepcopy(self.__table[5])
        decimation_list = list()
        coprime_list = cal.coprimes(self.__p - 1)[1]

        for i in range(len(coprime_list)):
            # tmp for signal we are going to get with decimation
            sig2_ = [0 for i in range(self.__p - 1)]

            # creating rest signals with decimation
            modules.arr_procedures.decimation(sig1_, sig2_, coprime_list[i])

            # appending decimation_list with list
            # that contains decimated sig and
            # decimation cof that used to create that sig
            decimation_list.append([sig2_, coprime_list[i]])
        return decimation_list
Example #3
0
import modules.arr_procedures
from modules import arr_procedures as ap, calculations as cal
from classes.CDS import CDS
from classes.Hadamar import Hadamar

if __name__ == "__main__":
    # only for 256
    p = 257

    # Creating object CDS
    c = CDS(p)
    # Print General Info
    print("P = {0}\nL = {1}".format(p, p - 1))
    print("ϕ({0}) = {1}".format(p - 1, cal.coprimes(p - 1)))
    print(("ϴmin = {0}".format(cal.findPrimitive(p))))
    ap.print_2d_arr(c.table)

    # decimated signals and coef
    decimation_signals = c.get_decimation()

    h = Hadamar(p - 1)
    hadamar_sig_list = h.getHadamMatrix()

    # Decimated signals without first sig(because its the same as source)
    b = list()
    for item in decimation_signals:
        # we only need signals so use 0th pos
        b.append(item[0])
    b.pop(0)

    # cal.printPair(d)
Example #4
0
 def print_general_info(self):
     print("P = {0}\nL = {1}".format(self.__p, self.__p - 1))
     print("ϕ({0}) = {1}".format(self.__p - 1, cal.coprimes(self.__p - 1)))
     print(("ϴmin = {0}".format(self.get_teta_min())))