示例#1
0
    def generateDefRandomSeq(self, if_rmax):

        while True:
            sig = self.generateRandomSeq()
            # Getting PFAK
            corel_list = modules.arr_procedures.getCorellation(sig, sig)
            rmax = cal.getMax(corel_list, 1, self.__P - 1, True)
            if rmax[0] <= if_rmax:
                return sig
                break
示例#2
0
def test_auto_correl(source_sig, soure_sig_len):
    print("Signal: ", source_sig)

    sig1_ = copy.deepcopy(source_sig)
    sig2_ = copy.deepcopy(source_sig)

    print("PFAK")
    pereodic_auto_corel_list = modules.arr_procedures.getCorellation(
        sig1_, sig2_)
    print("R = ", pereodic_auto_corel_list)
    print("Rmax = ",
          cal.getMax(pereodic_auto_corel_list, 1, soure_sig_len, True))

    print("AFAK")
    apereodic_auto_corel_list = modules.arr_procedures.getCorellation(
        sig1_, sig2_, True)
    print("R = ", apereodic_auto_corel_list)
    print("Rmax = ", cal.getMax(apereodic_auto_corel_list, 1, soure_sig_len))

    return pereodic_auto_corel_list, apereodic_auto_corel_list
示例#3
0
def test_auto_correl(source_sig):
    print("Signal: ", source_sig)
    start_point = 1
    finish_point = len(source_sig) - 1

    sig1_ = copy.deepcopy(source_sig)
    sig2_ = copy.deepcopy(source_sig)

    print("PFAK")
    pereodic_auto_corel_list = getCorellation(sig1_, sig2_)
    print("R = ", pereodic_auto_corel_list)
    print("Rmax = ",
          getMax(pereodic_auto_corel_list, start_point, finish_point, True))

    print("AFAK")
    apereodic_auto_corel_list = getCorellation(sig1_, sig2_, True)
    print("R = ", apereodic_auto_corel_list)
    print("Rmax = ",
          getMax(apereodic_auto_corel_list, start_point, finish_point))

    return pereodic_auto_corel_list, apereodic_auto_corel_list
示例#4
0
    def generateDefRandomSeq2(self, if_rmax):
        counter = 0
        while True:
            if counter >= 100:
                counter = 0
                if_rmax += 1

            sig = self.generateRandomSeq()
            # Getting PFAK
            corel_list = modules.arr_procedures.getCorellation(sig, sig)
            rmax = cal.getMax(corel_list, 1, self.__P - 1, True)
            if rmax[0] <= if_rmax:
                print(if_rmax)
                return sig
                break
            else:
                counter += 1
示例#5
0
        -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, -1, 1, 1, 1, 1, -1, 1, -1, 1,
        -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1, 1, 1,
        -1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1,
        -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, 1, 1
    ]

    sig3 = [
        1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1, -1,
        -1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, 1,
        1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1,
        1, -1, -1, 1, 1, 1, -1, -1, -1, 1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1,
        1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, -1,
        1, -1, 1, -1, 1, 1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, 1, 1,
        -1, 1, -1, -1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1,
        1, 1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1,
        1, 1, 1, 1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1,
        1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, 1, -1,
        -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, -1,
        -1, 1, -1, 1, 1, -1, 1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, 1,
        -1, -1, -1, -1, 1, 1, 1, -1, 1, 1, -1
    ]

    pfvk_list = modules.arr_procedures.getCorellation(sig1, sig2)
    rmax, rmaxrmax_indx_list = cal.getMax(pfvk_list, 0, len(pfvk_list), True)
    print(pfvk_list)
    print("Rmax = {0} = {1:.2f}√N".format(rmax,
                                          rmax / math.sqrt(len(pfvk_list))))

    pl.build_plot(pfvk_list)

    exit()
示例#6
0
    ap.print_2d_arr(c.table)

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

    # getting source signal from the table
    source_sig = c.table[5]

    sig1_ = copy.deepcopy(source_sig)
    sig2_ = copy.deepcopy(source_sig)

    print("PFAK")
    pereodic_auto_corel_list = modules.arr_procedures.getCorellation(
        sig1_, sig2_)
    print("R = ", pereodic_auto_corel_list)
    print("Rmax = ", cal.getMax(pereodic_auto_corel_list, 1, p - 1, True))

    print("AFAK")
    apereodic_auto_corel_list = modules.arr_procedures.getCorellation(
        sig1_, sig2_, True)
    print("R = ", apereodic_auto_corel_list)
    print("Rmax = ", cal.getMax(apereodic_auto_corel_list, 1, p - 1))

    # building plot
    # plot.build_plot(pereodic_auto_corel_list, "PFAK")

    # 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])