发呀发呀

1、TDS

def deal_data1(INDEX,th):
    T=100
    x,y=time_change(INDEX)
    total_len=len(y)
    i=0
    m=1
    flag = 0  # 用于标记非冗余数据的位置
    result_data = []  # 最后去除冗余数据的数据
    temp_data = []  # 临时存放冗余数据的数组
    result_time = []  # 去除冗余的时间数据
    TH=th
    print(INDEX)
    print(th)
    y_data=[]
    com_num=0
    for h in x:
        x_str.append(h)
    X=np.array(x_str)
    for k in y:
        y_data.append(k)
    Y=np.array(y_data)

    if(TH==0.0):
        return len(y),0,len(y)

    for a,b in zip(x,y):
        if(i==flag):
            result_time.append(X[0])
            result_data.append(Y[0])
        else:
            for j in range(flag,i,m):
                m = int(round((i-flag) / 2, 1))
                if (m == 0):
                    m = 1
                else:
                    m = int(round((i-flag) / 2, 1))
                if(iTH or lag>T):
                            result_data.append(Y[i])
                            result_time.append(X[i])
                            flag=i
                            break
        i=i+1
    # print(result_data)
    # print(len(result_data))
    print(len(result_data),com_num,len(y))
    return len(result_data),com_num,len(y)

2、DAWF

def deal_data(INDEX,th):
    print(INDEX)
    print(th)
    x,y=time_change(INDEX)
    i=0
    no_redundant_flag=0
    flag=0
    n=0
    com_num=0
    result_data=[]
    temp_data=[]
    result_time=[]
    if(th==0.0):
        return len(y),0,len(y)
    for r in zip(y):
        if(i+1

你可能感兴趣的:(学习)