In [1]:
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on 20191125

@author: zhangji

test the linear relationship
U_t =?= U_sh + U_wm
U_t is the total velocity
U_sh is the velocity induced by shear flow
U_wm is the active velocity. 
"""

# %pylab inline
# pylab.rcParams['figure.figsize'] = (25, 11)
# fontsize = 40

# import numpy as np
# import scipy as sp
# from scipy.optimize import leastsq, curve_fit
# from scipy import interpolate
# from scipy.interpolate import interp1d
# from scipy.io import loadmat, savemat
# # import scipy.misc

# import matplotlib
# from matplotlib import pyplot as plt
# from matplotlib import animation, rc
# import matplotlib.ticker as mtick
# from mpl_toolkits.axes_grid1.inset_locator import inset_axes, zoomed_inset_axes
# from mpl_toolkits.mplot3d import Axes3D, axes3d

# from sympy import symbols, simplify, series, exp
# from sympy.matrices import Matrix
# from sympy.solvers import solve

# from IPython.display import display, HTML
# from tqdm import tqdm_notebook as tqdm
# import pandas as pd
# import re
# from scanf import scanf
# import os
# import glob

# from codeStore import support_fun as spf
# from src.support_class import *
# from src import stokes_flow as sf

# rc('animation', html='html5')
# PWD = os.getcwd()
# font = {'size': 20}
# matplotlib.rc('font', **font)
# np.set_printoptions(linewidth=90, precision=5)

import os
import glob
import re
import pandas as pd
from scanf import scanf
import natsort 
import numpy as np
import scipy as sp
from scipy.optimize import leastsq, curve_fit
from scipy import interpolate
from scipy import spatial
# from scipy.interpolate import interp1d
from scipy.io import loadmat, savemat
# import scipy.misc
import importlib
from IPython.display import display, HTML
import pickle

import matplotlib
from matplotlib import pyplot as plt
from matplotlib import colors as mcolors
from matplotlib import animation, rc
import matplotlib.ticker as mtick
from mpl_toolkits.axes_grid1.inset_locator import inset_axes, zoomed_inset_axes
from mpl_toolkits.mplot3d import Axes3D, axes3d
from matplotlib import ticker, cm
from mpl_toolkits.axes_grid1 import make_axes_locatable

from time import time
from src import support_class as spc
from src import jeffery_model as jm
from codeStore import support_fun as spf
from codeStore import support_fun_table as spf_tb

# %matplotlib notebook

%matplotlib inline
rc('animation', html='html5')
rc('text', usetex=True)
params = {'text.latex.preamble': [r'\usepackage{bm}', r'\usepackage{amsmath}']}
plt.rcParams.update(params)
fontsize = 40
figsize = (30, 16)
PWD = os.getcwd()

In [2]:
fig = plt.figure(figsize=(2, 2))
fig.patch.set_facecolor('white')
ax0 = fig.add_subplot(1, 1, 1)



In [3]:
fft_pickle = 'hlxC01_tau1a'

In [4]:
with open('%s.pickle' % fft_pickle, 'rb') as handle:
    pickle_data = pickle.load(handle)
tw = pickle_data[0][1][4][2].values
tw_fft = np.fft.fft2(tw)
tw_fft[0, 0]


Out[4]:
(1433.4416879076475+0j)

In [202]:
# do 2D IFFT myself and compare with numpy version
use_idx_max = 1

# ((psi, ((theta, phi, ui))))
with open('%s.pickle' % fft_pickle, 'rb') as handle:
    pickle_data = pickle.load(handle)
ttheta, tphi = pickle_data[0][1][0][:2]
tpsi = np.array([ti[0] for ti in pickle_data])
tw = pickle_data[0][1][5][2].values

tw_fft = np.fft.fft2(tw)
th_freq = np.fft.fftfreq(ttheta.size, 1 / ttheta.size)
ph_freq = np.fft.fftfreq(tphi.size, 1 / tphi.size)
idx_max = np.dstack(np.unravel_index(np.argsort(np.abs(tw_fft).ravel()), tw_fft.shape))[0][::-1]
    
# numpy version IFFT
idx = np.zeros_like(tw_fft, dtype=bool)
for ti in idx_max[:use_idx_max]:
    idx[ti[0], ti[1]] = 1
tw_fft2 = tw_fft * idx
tw2 = np.fft.ifft2(tw_fft2)

# do IFFT myself
tw3 = np.zeros_like(tw2)
tM, tN = tw_fft.shape
tm, tn = np.meshgrid(np.arange(tM), np.arange(tN), indexing='ij')
for tk, tl in idx_max[:use_idx_max]:
    tAkl = tw_fft[tk, tl]
    tw3 = tw3 + tAkl * np.exp(2 * np.pi * 1j * tm * tk / tM) / tM * \
                       np.exp(2 * np.pi * 1j * tn * tl / tN) / tN
    print(tk, tl, tAkl)
    print((np.abs(tw3.imag) / np.abs(tw3)).max())
print((tw3 - tw).max(), np.abs(tw3 - tw2).max())


0 1 (41.43437201119278+4.997383689261055j)
0.999989251311336
(0.08760196833067893+0.01216229602232495j) 3.0555271774230604e-17

In [6]:
# print values of primary frequence
print_idx_max = 20

# ((psi, ((theta, phi, ui))))
with open('%s.pickle' % fft_pickle, 'rb') as handle:
    pickle_data = pickle.load(handle)
ttheta, tphi = pickle_data[0][1][0][:2]
tpsi = np.array([ti[0] for ti in pickle_data])
tw = pickle_data[0][1][3][2].values

tw_fft = np.fft.fft2(tw)
idx_max = np.dstack(np.unravel_index(np.argsort(np.abs(tw_fft).ravel()), tw_fft.shape))[0][::-1]
for i0, (tk, tl) in enumerate(idx_max[:print_idx_max]):
    if not np.mod(i0, 2):
        print('*', tk, tl, tw_fft[tk, tl])
    else:
        print(' ', tk, tl, tw_fft[tk, tl])


* 0 2 (3.4325658413780578-202.97501905454095j)
  0 61 (3.4325658413780578+202.97501905454095j)
* 31 2 (7.957450693382612+100.50878266096345j)
  1 61 (7.957450693382612-100.50878266096345j)
* 31 61 (-7.761270122781182-57.207434958553726j)
  1 2 (-7.761270122781182+57.207434958553726j)
* 31 0 (3.0385152986246124+21.13258990018759j)
  1 0 (3.0385152986246124-21.132589900187586j)
* 0 3 (-0.767417881391293+8.099140242165005j)
  0 60 (-0.767417881391293-8.099140242165005j)
* 30 0 (-0.8079932045273466-6.925239150784718j)
  2 0 (-0.8079932045273467+6.9252391507847175j)
* 0 4 (-0.6980948006319172+4.418253334465155j)
  0 59 (-0.6980948006319172-4.418253334465155j)
* 0 1 (-0.48832050837783036-4.227743685383918j)
  0 62 (-0.48832050837783036+4.227743685383918j)
* 0 0 (-3.7971307644025134+0j)
  1 60 (-0.053966934112297825+3.753842780090676j)
* 31 3 (-0.053966934112297825-3.753842780090676j)
  0 58 (-0.6844678593550718-3.10688138307184j)

In [7]:
print(tw.shape, tw_fft.shape, ttheta.shape, tphi.shape)


(32, 63) (32, 63) (32,) (63,)

In [8]:
# 2D fft of Wx, Wy, Wz
importlib.reload(spf_tb)
use_uidx = 3 # 3: wx, 4: wy, 5: wz
tktl_list = [[0, 2], [31, 2], [1, 2]]

# ((psi, ((theta, phi, ui))))
with open('%s.pickle' % fft_pickle, 'rb') as handle:
    pickle_data = pickle.load(handle)
ttheta, tphi = pickle_data[0][1][0][:2]
tpsi = np.array([ti[0] for ti in pickle_data])
tw = pickle_data[0][1][use_uidx][2].values

for tktl in tktl_list:
    if np.sum(tktl) < 1:
        spf_tb.show_fft_major(tw, (tktl, ), ttheta, tphi)
    else:
        spf_tb.show_fft_fit(tw, tktl, ttheta, tphi)

spf_tb.show_fft_major(tw, tktl_list, ttheta, tphi)


use frequence pairs 3.432566-202.975019i and 3.432566+202.975019i at (0, 2) and (0, 61)
absolute abs of imag part is 4.249818523937006e-17
use frequence pairs 7.957451+100.508783i and 7.957451-100.508783i at (31, 2) and (1, 61)
absolute abs of imag part is 2.449359953878663e-17
use frequence pairs -7.761270+57.207435i and -7.761270-57.207435i at (1, 2) and (31, 61)
absolute abs of imag part is 1.3785497857514637e-17
use frequence pairs 3.432566-202.975019i and 3.432566+202.975019i at (0, 2) and (0, 61)
use frequence pairs 7.957451+100.508783i and 7.957451-100.508783i at (31, 2) and (1, 61)
use frequence pairs -7.761270+57.207435i and -7.761270-57.207435i at (1, 2) and (31, 61)
absolute abs of imag part is 7.623384997357543e-17
Out[8]:
True

In [72]:
# 2D fft of Wx, Wy, Wz, investigate real and imaginary parts of Akl as function of \psi
importlib.reload(spf_tb)
use_uidx = 3 # 3: wx, 4: wy, 5: wz
tktl = [0, 2]
use_psi_freq = 3
# tktl = [31, 2]
# tktl = [1, 2]

# ((psi, ((theta, phi, ui))))
with open('%s.pickle' % fft_pickle, 'rb') as handle:
    pickle_data = pickle.load(handle)
ttheta, tphi = pickle_data[0][1][0][:2]
tpsi = np.array([ti[0] for ti in pickle_data])

Akl_list = []
Amp_list = []
alpha_list = []
psi_list = []
for tpsi, table_psi_data in pickle_data[:]:
    psi_list.append(tpsi)
    tw = table_psi_data[use_uidx][2].values
#     spf_tb.show_fft_fit(tw, tktl, ttheta, tphi)
    Akl, Amp_use, w_th_use, w_ph_use, alpha_use = spf_tb.factor_wpi_kl(tw, tktl)
    Akl_list.append(Akl)
    Amp_list.append(Amp_use)
    alpha_list.append(alpha_use)


fig, axes = plt.subplots(2, 2, figsize=(8, 6), dpi=200)
fig.patch.set_facecolor('white')    
tx = np.hstack((np.array(psi_list), np.array(psi_list) + 2 * np.pi))
tfreq = np.fft.rfftfreq(tx.size, np.mean(np.diff(tx)) / (2 * np.pi))
# real part of Akl
ty = np.hstack((np.real(Akl_list), np.real(Akl_list)))
tfft = np.fft.rfft(ty)
tfft_abs = np.abs(tfft)
tfft2 = tfft.copy()
tidx = np.argsort(tfft_abs)[::-1]
tfft2[tidx[use_psi_freq:]] = 0
ty2 = np.fft.irfft(tfft2)
ax = axes[0, 0]
ax.plot(tx, ty, 'o')
ax.plot(tx, ty2, '-')
ax.set_xlabel('$\\psi$')
ax.set_ylabel('$\\Re(\\Omega_{p%d})$' % (use_uidx - 2))
ax = axes[0, 1]
ax.plot(tfreq, tfft_abs, '.')
ax.set_xlim(-0.1, 3)
plt.tight_layout()

# imaginary part of Akl
ty = np.hstack((np.imag(Akl_list), np.imag(Akl_list)))
tfft = np.fft.rfft(ty)
tfft_abs = np.abs(tfft)
tfft2 = tfft.copy()
tidx = np.argsort(tfft_abs)[::-1]
tfft2[tidx[use_psi_freq:]] = 0
ty2 = np.fft.irfft(tfft2)
ax = axes[1, 0]
ax.plot(tx, ty, 'o')
ax.plot(tx, ty2, '-')
ax.set_xlabel('$\\psi$')
ax.set_ylabel('$\\Im(\\Omega_{p%d})$' % (use_uidx - 2))
ax = axes[1, 1]
ax.plot(tfreq, tfft_abs, '.')
ax.set_xlim(-0.1, 3)
plt.tight_layout()


Full 3D FFT version


In [286]:
use_uidx = 3 # 3: wx, 4: wy, 5: wz

In [205]:
# do 3D IFFT myself and compare with numpy version
importlib.reload(spf_tb)
use_idx_max = 6

# ((psi, ((theta, phi, ui), )))
with open('%s.pickle' % fft_pickle, 'rb') as handle:
    pickle_data = pickle.load(handle)
ttheta, tphi = pickle_data[0][1][0][:2]
tpsi = np.array([ti[0] for ti in pickle_data])
U_all = [[] for i in range(6)]
for tpsi, table_psi_data in pickle_data:
    for (ty, tx, tU), Ui in zip(table_psi_data, U_all):
        Ui.append((tpsi, ty, tx, tU))
tw = np.dstack([tU.values for _, _, _, tU in U_all[use_uidx]])

tw_fft = np.fft.fftn(tw)
idx_max = np.dstack(np.unravel_index(np.argsort(np.abs(tw_fft).ravel()), tw_fft.shape))[0][::-1]
# numpy version IFFT
idx = np.zeros_like(tw_fft, dtype=bool)
for ti in idx_max[:use_idx_max]:
    idx[ti[0], ti[1], ti[2]] = 1
tw_fft2 = tw_fft * idx
tw2 = np.fft.ifftn(tw_fft2)

print()
# do IFFT myself
tw3 = np.zeros_like(tw2)
tM, tN, tO = tw_fft.shape
tm, tn, to = np.meshgrid(np.arange(tM), np.arange(tN), np.arange(tO), indexing='ij')
for tk, tl, tj in idx_max[:use_idx_max]:
    tAkl = tw_fft[tk, tl, tj]
    tw3 = tw3 + tAkl * np.exp(2 * np.pi * 1j * tm * tk / tM) / tM * \
                       np.exp(2 * np.pi * 1j * tn * tl / tN) / tN * \
                       np.exp(2 * np.pi * 1j * to * tj / tO) / tO
    print(tk, tl, tj, tAkl)
    print((np.abs(tw3.imag) / np.abs(tw3)).max())
print(np.abs(tw3 - tw2).max())


0 2 0 (152.14165350125123-1520.4270751266356j)
0.9999999999999999
0 61 0 (152.14165350125143+1520.4270751266354j)
3.2410940792804805e-14
0 2 13 (-291.2810062127978-786.2015796429384j)
0.9998904923893726
0 61 2 (-291.2810062127978+786.2015796429384j)
2.142472223614152e-13
0 2 2 (441.28822378616246-712.897044203203j)
0.9999992975300621
0 61 13 (441.28822378616246+712.897044203203j)
1.9929967551757893e-09
6.638764778492686e-15

In [284]:
t1 = [np.abs(tw_fft[tk, tl, tj]) for tk, tl, tj in idx_max]
plt.plot(t1, '.')
plt.xlim(-1, 50)
# plt.ylim(10, 100)


Out[284]:
(-1, 50)

In [281]:
# print values of primary frequence
importlib.reload(spf_tb)
print_idx_max = 100

# ((psi, ((theta, phi, ui), )))
with open('%s.pickle' % fft_pickle, 'rb') as handle:
    pickle_data = pickle.load(handle)
ttheta, tphi = pickle_data[0][1][0][:2]
tpsi = np.array([ti[0] for ti in pickle_data])
U_all = [[] for i in range(6)]
for tpsi, table_psi_data in pickle_data:
    for (ty, tx, tU), Ui in zip(table_psi_data, U_all):
        Ui.append((tpsi, ty, tx, tU))
tw = np.dstack([tU.values for _, _, _, tU in U_all[use_uidx]])

tw_fft = np.fft.fftn(tw)
idx_max = np.dstack(np.unravel_index(np.argsort(np.abs(tw_fft).ravel()), tw_fft.shape))[0][::-1]
t1 = []
for i0, (tk, tl, tj) in enumerate(idx_max[:print_idx_max]):
    t1.append(np.abs(tw_fft[tk, tl, tj]))
    if not np.mod(i0, 2):
        print('%5d * [%d, %d, %d] ' % (i0, tk, tl, tj), tw_fft[tk, tl, tj], np.abs(tw_fft[tk, tl, tj]))
    else:
        print('        [%d, %d, %d] ' % (tk, tl, tj), tw_fft[tk, tl, tj], np.abs(tw_fft[tk, tl, tj]))


    0 * [0, 2, 0]  (152.14165350125123-1520.4270751266356j) 1528.0201482664522
        [0, 61, 0]  (152.14165350125143+1520.4270751266354j) 1528.020148266452
    2 * [0, 2, 13]  (-291.2810062127978-786.2015796429384j) 838.4256367820534
        [0, 61, 2]  (-291.2810062127978+786.2015796429384j) 838.4256367820534
    4 * [0, 2, 2]  (441.28822378616246-712.897044203203j) 838.4256031908913
        [0, 61, 13]  (441.28822378616246+712.897044203203j) 838.4256031908913
    6 * [31, 61, 0]  (-157.2774778591558-784.2981397528328j) 799.9123558624977
        [1, 2, 0]  (-157.27747785915568+784.2981397528326j) 799.9123558624976
    8 * [31, 2, 0]  (-1.2463795495721552+799.9102052968966j) 799.9111763190366
        [1, 61, 0]  (-1.2463795495722403-799.9102052968965j) 799.9111763190365
   10 * [1, 61, 13]  (234.19010001819163-354.1196581070332j) 424.55357165424095
        [31, 2, 2]  (234.19010001819163+354.1196581070332j) 424.55357165424095
   12 * [31, 61, 2]  (408.7437903578051-114.77799454041386j) 424.5532642517127
        [1, 2, 13]  (408.7437903578051+114.77799454041386j) 424.5532642517127
   14 * [1, 61, 2]  (-235.29213451547187-353.387965761858j) 424.55322741695306
        [31, 2, 13]  (-235.29213451547187+353.387965761858j) 424.55322741695306
   16 * [31, 61, 13]  (-421.3942070930773+51.69174863899536j) 424.55284082073973
        [1, 2, 2]  (-421.3942070930773-51.69174863899536j) 424.55284082073973
   18 * [1, 0, 2]  (-310.0120803480629-191.2320707222109j) 364.24880896776926
        [31, 0, 13]  (-310.0120803480629+191.2320707222109j) 364.24880896776926
   20 * [1, 0, 13]  (341.3626022846885-127.07720360464963j) 364.24859905640267
        [31, 0, 2]  (341.3626022846885+127.07720360464963j) 364.24859905640267
   22 * [30, 0, 13]  (94.39791181494265-71.89491799399721j) 118.65852261167451
        [2, 0, 2]  (94.39791181494265+71.89491799399721j) 118.65852261167451
   24 * [2, 0, 13]  (-114.72471122505435+30.297669576590167j) 118.6579459937022
        [30, 0, 2]  (-114.72471122505435-30.297669576590167j) 118.6579459937022
   26 * [0, 2, 1]  (-108.73153875058327-36.87920577537687j) 114.81560581076155
        [0, 61, 14]  (-108.73153875058327+36.87920577537687j) 114.81560581076155
   28 * [0, 2, 14]  (-113.88303043588007+14.603459448821164j) 114.81552878044394
        [0, 61, 1]  (-113.88303043588007-14.603459448821164j) 114.81552878044394
   30 * [0, 3, 0]  (-9.144050086266297+60.66684712614891j) 61.35209851510923
        [0, 60, 0]  (-9.144050086266294-60.666847126148895j) 61.35209851510922
   32 * [31, 61, 1]  (40.52569546620296+45.86616743625379j) 61.20487977530787
        [1, 2, 14]  (40.52569546620296-45.86616743625379j) 61.20487977530787
   34 * [31, 61, 14]  (19.708587062069824-57.9448456155465j) 61.20484896960946
        [1, 2, 1]  (19.708587062069824+57.9448456155465j) 61.20484896960946
   36 * [31, 2, 14]  (50.78665564345734+34.15593940785707j) 61.20386089357697
        [1, 61, 1]  (50.78665564345734-34.15593940785707j) 61.20386089357697
   38 * [31, 2, 1]  (50.89258597048787-33.99769107881961j) 61.20374421107216
        [1, 61, 14]  (50.89258597048787+33.99769107881961j) 61.20374421107216
   40 * [0, 0, 1]  (-42.053729677132395-9.72459950672787j) 43.16345694361815
        [0, 0, 14]  (-42.053729677132395+9.72459950672787j) 43.16345694361815
   42 * [3, 61, 13]  (38.23590324698209-8.308671496484715j) 39.1282291849385
        [29, 2, 2]  (38.23590324698209+8.308671496484715j) 39.1282291849385
   44 * [29, 61, 2]  (38.90826177905409+4.142443737156125j) 39.128157058350006
        [3, 2, 13]  (38.90826177905409-4.142443737156125j) 39.128157058350006
   46 * [29, 61, 13]  (-24.48791648684357+30.517953629185293j) 39.12804042601327
        [3, 2, 2]  (-24.48791648684357-30.517953629185293j) 39.12804042601327
   48 * [29, 2, 13]  (-32.21503079379731+22.20785653356145j) 39.12795804614083
        [3, 61, 2]  (-32.21503079379731-22.20785653356145j) 39.12795804614083
   50 * [0, 59, 0]  (-6.686521523895493-33.07636799814807j) 33.74545436111998
        [0, 4, 0]  (-6.686521523895496+33.07636799814807j) 33.74545436111998
   52 * [0, 3, 13]  (10.10741050501336+32.11112541801197j) 33.664285566875606
        [0, 60, 2]  (10.10741050501336-32.11112541801197j) 33.664285566875606
   54 * [0, 60, 13]  (-19.12327439594967-27.705312890008486j) 33.66428353546314
        [0, 3, 2]  (-19.12327439594967+27.705312890008486j) 33.66428353546314
   56 * [28, 2, 13]  (-24.764244719796373+21.712382710066766j) 32.934713897199245
        [4, 61, 2]  (-24.764244719796373-21.712382710066766j) 32.934713897199245
   58 * [4, 2, 2]  (-18.49110464518447-27.25382005981434j) 32.93465741209253
        [28, 61, 13]  (-18.49110464518447+27.25382005981434j) 32.93465741209253
   60 * [28, 61, 2]  (32.932868552195245-0.3358574007695232j) 32.93458108538535
        [4, 2, 13]  (32.932868552195245+0.3358574007695232j) 32.93458108538535
   62 * [28, 2, 2]  (32.63974113582696+4.39653285564766j) 32.93451385043635
        [4, 61, 13]  (32.63974113582696-4.39653285564766j) 32.93451385043635
   64 * [1, 3, 0]  (7.87683218504384-31.137113939453595j) 32.117975492702804
        [31, 60, 0]  (7.876832185043838+31.13711393945359j) 32.1179754927028
   66 * [31, 3, 0]  (1.6509270091334083-32.07551340609027j) 32.117971919997736
        [1, 60, 0]  (1.6509270091334096+32.075513406090266j) 32.11797191999773
   68 * [0, 1, 0]  (1.5805408935891732-31.669077268490714j) 31.708493571185986
        [0, 62, 0]  (1.5805408935891716+31.66907726849071j) 31.708493571185983
   70 * [27, 2, 2]  (27.65240921076616+1.1846539671098988j) 27.677773396381696
        [5, 61, 13]  (27.65240921076616-1.1846539671098988j) 27.677773396381696
   72 * [5, 2, 13]  (27.493402996208467+3.188911652329292j) 27.677723277724382
        [27, 61, 2]  (27.493402996208467-3.188911652329292j) 27.677723277724382
   74 * [5, 2, 2]  (-13.391864943491557-24.222161723392226j) 27.677701588442737
        [27, 61, 13]  (-13.391864943491557+24.222161723392226j) 27.677701588442737
   76 * [5, 61, 2]  (-18.778952837738316-20.332269312088837j) 27.677612705240843
        [27, 2, 13]  (-18.778952837738316+20.332269312088837j) 27.677612705240843
   78 * [0, 5, 0]  (-5.925950899282228+23.27271373311054j) 24.015330490418318
        [0, 58, 0]  (-5.925950899282203-23.272713733110454j) 24.01533049041823
   80 * [26, 2, 13]  (-14.303597927581839+19.104818683962087j) 23.866022094622103
        [6, 61, 2]  (-14.303597927581839-19.104818683962087j) 23.866022094622103
   82 * [6, 2, 13]  (23.298522797775913+5.173439373103497j) 23.86599336934588
        [26, 61, 2]  (23.298522797775913-5.173439373103497j) 23.86599336934588
   84 * [6, 61, 13]  (23.83554350045724+1.2047503260495693j) 23.865970697005096
        [26, 2, 2]  (23.83554350045724-1.2047503260495693j) 23.865970697005096
   86 * [6, 2, 2]  (-9.551274196215155-21.871359271177166j) 23.865942159072475
        [26, 61, 13]  (-9.551274196215155+21.871359271177166j) 23.865942159072475
   88 * [7, 2, 2]  (-6.5657393347732835-20.04183484105232j) 21.089904618281416
        [25, 61, 13]  (-6.5657393347732835+20.04183484105232j) 21.089904618281416
   90 * [25, 2, 2]  (20.866585040121166-3.060957151303203j) 21.089898765018354
        [7, 61, 13]  (20.866585040121166+3.060957151303203j) 21.089898765018354
   92 * [7, 2, 13]  (20.021230093118525+6.6281775369244755j) 21.089864672457836
        [25, 61, 2]  (20.021230093118525-6.6281775369244755j) 21.089864672457836
   94 * [7, 61, 2]  (-10.869676805740141-18.072962028077228j) 21.08985135864088
        [25, 2, 13]  (-10.869676805740141+18.072962028077228j) 21.08985135864088
   96 * [24, 2, 13]  (-8.11732988429776+17.20536195472731j) 19.024077492580066
        [8, 61, 2]  (-8.11732988429776-17.20536195472731j) 19.024077492580066
   98 * [24, 61, 2]  (17.368009891870372-7.76322437224384j) 19.024074754318747
        [8, 2, 13]  (17.368009891870372+7.76322437224384j) 19.024074754318747

In [213]:
tktltj_list = ([0, 2, 0], [0, 2, 13], [0, 2, 2], [31, 61, 0], [31, 2, 0], [1, 61, 13], 
               [31, 61, 2], [1, 61, 2], [31, 61, 13], [1, 0, 2], [1, 0, 13], )


use frequence pairs 152.141654-1520.427075i and 152.141654+1520.427075i at (0, 2, 0) and (0, 61, 0)
absolute abs of imag part is 2.8292992985060873e-17

In [285]:
importlib.reload(spf_tb)
tktltj_list = ([0, 2, 0], [0, 2, 13], [0, 2, 2], [31, 61, 0], [31, 2, 0], [1, 61, 13], 
               [31, 61, 2], [1, 61, 2], [31, 61, 13], [1, 0, 2], [1, 0, 13], )

# ((psi, ((theta, phi, ui), )))
with open('%s.pickle' % fft_pickle, 'rb') as handle:
    pickle_data = pickle.load(handle)
ttheta_all, tphi_all = pickle_data[0][1][0][:2]
tpsi_all = np.array([ti[0] for ti in pickle_data])
U_all = [[] for i in range(6)]
for _, table_psi_data in pickle_data:
    for (_, _, tU), Ui in zip(table_psi_data, U_all):
        Ui.append(tU)
tw = np.dstack(U_all[use_uidx])

spf_tb.show_3dfft_major(tw, tktltj_list, ttheta_all, tphi_all, tpsi_all)


use frequence pairs 152.141654-1520.427075i and 152.141654+1520.427075i at (0, 2, 0) and (0, 61, 0)
use frequence pairs -291.281006-786.201580i and -291.281006+786.201580i at (0, 2, 13) and (0, 61, 2)
use frequence pairs 441.288224-712.897044i and 441.288224+712.897044i at (0, 2, 2) and (0, 61, 13)
use frequence pairs -157.277478-784.298140i and -157.277478+784.298140i at (31, 61, 0) and (1, 2, 0)
use frequence pairs -1.246380+799.910205i and -1.246380-799.910205i at (31, 2, 0) and (1, 61, 0)
use frequence pairs 234.190100-354.119658i and 234.190100+354.119658i at (1, 61, 13) and (31, 2, 2)
use frequence pairs 408.743790-114.777995i and 408.743790+114.777995i at (31, 61, 2) and (1, 2, 13)
use frequence pairs -235.292135-353.387966i and -235.292135+353.387966i at (1, 61, 2) and (31, 2, 13)
use frequence pairs -421.394207+51.691749i and -421.394207-51.691749i at (31, 61, 13) and (1, 2, 2)
use frequence pairs -310.012080-191.232071i and -310.012080+191.232071i at (1, 0, 2) and (31, 0, 13)
use frequence pairs 341.362602-127.077204i and 341.362602+127.077204i at (1, 0, 13) and (31, 0, 2)
absolute abs of imag part is 1.0016356045820221e-16
Out[285]:
True