在这种情况下如何使用解包?

时间:2021-03-24 08:36:13

标签: python unwrap

我实际上是在尝试解开一个信号,而 numpy 函数没有做我想要的。我当然已经在网上搜索了答案,但不幸的是没有任何帮助: 这是代码的一部分:

  • NT 可以在 1 到 48 的范围内。
  • h1 的大小以 Gb 为单位(例如 10-20Gb),我在一个 NT 中提取了大约 20,000,000 行。
  • 我无法在一个大过程中完成,我需要将其与 NT 分开。
for i in range(0,NT,1):#NT
    A = 0
    temp = pd.DataFrame()
    h1 = pd.read_hdf(path,'foo',start=int(Compt1*i/NT),stop=int(Compt1*(i+1)/NT))
    print('\033[0m'+'calcule d1 et d2 : NT '+str(i+1)+' / '+str(NT))
    temp = list(h1.phi)
    
    # s=temp[0]-tp
    # if s<(-np.pi) :
    #     temp[0]+=2*np.pi
    # elif s>np.pi:
    #     temp[0]-=2*np.pi
    
    # ech=NT*record_size
    
    # for y in range(1,len(temp),1):
    #     s=temp[y]-temp[y-1]
    #     if s<(-np.pi) :
    #         temp[y]+=2*np.pi
    #     elif s>np.pi:
    #         temp[y]-=2*np.pi
    # temp0=[tempi*(londe/(4*np.pi)) for tempi in temp]
    
    temp0 = np.unwrap(temp,axis=0)
    A = pd.DataFrame({
        'd1':[temp0*(londe/(4*np.pi)) for temp0 in temp],
        'd2':Q+np.cumsum(h1.deltax)})
    h1 = 0
    tp = temp[-1]
    Q = A.iloc[-1,1]
    A = A.apply(pd.to_numeric, downcast='float')
    print('\033[0m'+'enregistrement')
    with pd.HDFStore(pathout, data_columns=True) as store:
        try:
            nrows = store.get_storer('foo').nrows
        except:
            nrows = 0
        A.index = pd.Series(A.index) + nrows
        store.append('foo', A)
    print('\033[32m'+'Ok')

这是我得到的(d1 不好,d2 好):

https://imgur.com/a/ELrrKaM

链接中的最后一个是我想要的,第一个是我得到的,第二个是我通过缩放得到的。

1 个答案:

答案 0 :(得分:0)

问题已解决:这是这条线

temp0=np.unwrap(temp,axis=0)
'd1':[temp0*(londe/(4*np.pi)) for temp0 in temp],

成为谁

temp0=np.unwrap(temp)*(londe/(4*np.pi))
'd1':temp0,

谢谢你的回答