In [6]:
# import numpy as np

# # !/usr/bin/env python3
# # -*- coding: utf-8 -*-
# """
# Created on 20181219

# @author: zhangji

# Trajection of a ellipse, Jeffery equation. 
# """

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

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

import matplotlib
# matplotlib.use('agg')
from matplotlib import pyplot as plt
import matplotlib.colors as colors
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 mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable
from mpl_toolkits.mplot3d.art3d import Line3DCollection
from matplotlib import cm

from tqdm import tqdm, tqdm_notebook
from time import time
from src.support_class import *
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')
fontsize = 40
PWD = os.getcwd()

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



In [2]:
job_dir = 'ecoC01B05_T0.01_psi-0b'
table_name = 'ecoC01B05_T0.01'

In [3]:
# show phase map of theta-phi, load date
importlib.reload(spf_tb)

t_headle = '(.*?).pickle'
t_path = os.listdir(os.path.join(PWD, job_dir))
filename_list = [filename for filename in os.listdir(os.path.join(PWD, job_dir)) 
                 if re.match(t_headle, filename) is not None]
ini_theta_list = []
ini_phi_list = []
lst_eta_list = []
theta_max_fre_list = []
phi_max_fre_list = []
psi_max_fre_list = []
eta_max_fre_list = []
pickle_path_list = []
idx_list = []
for i0, tname in enumerate(tqdm_notebook(filename_list[:])):
    tpath = os.path.join(PWD, job_dir, tname)
    with open(tpath, 'rb') as handle:
        tpick = pickle.load(handle)
    ini_theta_list.append(tpick['ini_theta'])
    ini_phi_list.append(tpick['ini_phi'])
    lst_eta_list.append(tpick['Table_eta'][-1])
    pickle_path_list.append(tpath)
    idx_list.append(i0)
    
    # fft rule
    tx = tpick['Table_t']
    tmin = np.max((0, tx.max() - 1000))
    idx = tx > tmin
#     pick_fre = np.min((spf_tb.get_major_fre(tpick['Table_t'], tpick['Table_theta']), 
#                        spf_tb.get_major_fre(tpick['Table_t'], tpick['Table_phi']), 
#                        spf_tb.get_major_fre(tpick['Table_t'], tpick['Table_psi']), 
#                        spf_tb.get_major_fre(tpick['Table_t'], tpick['Table_eta']), ))
#     tmin = tx.max() - 1 / pick_fre * 10
#     idx = np.logical_and(np.hstack((True, np.diff(tx)>0)), tx > tmin)
    theta_max_fre_list.append(spf_tb.get_major_fre(tx[idx], tpick['Table_theta'][idx]))
    phi_max_fre_list.append(spf_tb.get_major_fre(tx[idx], tpick['Table_phi'][idx]))
    psi_max_fre_list.append(spf_tb.get_major_fre(tx[idx], tpick['Table_psi'][idx]))
    eta_max_fre_list.append(spf_tb.get_major_fre(tx[idx], tpick['Table_eta'][idx]))

data0 = pd.DataFrame({'ini_theta': np.around(ini_theta_list, 3), 
                 'ini_phi': np.around(ini_phi_list, 3), 
                 'lst_eta': np.around(lst_eta_list, 3), 
                 'theta_max_fre': theta_max_fre_list, 
                 'phi_max_fre': phi_max_fre_list, 
                 'psi_max_fre': psi_max_fre_list, 
                 'eta_max_fre': eta_max_fre_list, 
                 'data_idx': idx_list })
data = data0.pivot_table(index=['ini_theta'], columns=['ini_phi'])
lst_eta = data.lst_eta
theta_max_fre = data.theta_max_fre
phi_max_fre = data.phi_max_fre
psi_max_fre = data.psi_max_fre
eta_max_fre = data.eta_max_fre
data_idx = data.data_idx.fillna(-1).astype(int)


/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:17: TqdmDeprecationWarning: This function will be removed in tqdm==5.0.0
Please use `tqdm.notebook.tqdm` instead of `tqdm.tqdm_notebook`


In [5]:
# check if the 3D parameter space is been traversed or not 
do_check = False
if do_check:
    t_headle = '(.*?).pickle'
    t_path = os.listdir(os.path.join(PWD, job_dir))
    filename_list = [filename for filename in os.listdir(os.path.join(PWD, job_dir)) 
                     if re.match(t_headle, filename) is not None]
    ttheta = []
    tphi = []
    tpsi = []
    for i0, tname in enumerate(tqdm_notebook(filename_list[:])):
        tpath = os.path.join(PWD, job_dir, tname)
        with open(tpath, 'rb') as handle:
            tpick = pickle.load(handle)
        ttheta.append(tpick['Table_theta'])
        tphi.append(tpick['Table_phi'])
        tpsi.append(tpick['Table_psi'])

    ttheta, tphi, tpsi = np.hstack(ttheta), np.hstack(tphi), np.hstack(tpsi)
    from evtk.hl import pointsToVTK
    vtu_name = '/home/zhangji/check_th_ph_ps_%s' % job_dir
    pointsToVTK(vtu_name, 
                ttheta, tphi, tpsi, 
                data={'th_ph_ps': ttheta})
    print('save theta_phi_psi infomation to %s' % vtu_name)

In [ ]:
# sort phase map of theta-phi using the name beging with pick frequience
importlib.reload(spf_tb)

# clear dir
dirpath = os.path.join(PWD, job_dir, 'th_ph_fft')
if os.path.exists(dirpath) and os.path.isdir(dirpath):
    import shutil
    shutil.rmtree(dirpath)
    print('remove folder %s' % dirpath)
os.makedirs(dirpath)
print('make folder %s' % dirpath)

for tname in tqdm_notebook(filename_list[:]):
    tpath = os.path.join(PWD, job_dir, tname)
    with open(tpath, 'rb') as handle:
        tpick = pickle.load(handle)
    Table_t = tpick['Table_t']
    Table_dt = tpick['Table_dt']
    Table_X = tpick['Table_X']
    Table_P = tpick['Table_P']
    Table_P2 = tpick['Table_P2']
    Table_theta = tpick['Table_theta']
    Table_phi = tpick['Table_phi']
    Table_psi = tpick['Table_psi']
    Table_eta = tpick['Table_eta']
    
    tmin = np.max((0, Table_t.max() - 1000))
    idx = Table_t > tmin    
    freq_pk = spf_tb.get_major_fre(Table_t[idx], Table_theta[idx])
    idx = Table_t > Table_t.max() - 1 / freq_pk * 10
    save_name = 'fre%.5f_%s.jpg' % (freq_pk, os.path.splitext(os.path.basename(tname))[0])
    fig = spf_tb.light_save_theta_phi(os.path.join(dirpath, save_name), 
                                Table_t[idx], Table_dt[idx], Table_X[idx], Table_P[idx], Table_P2[idx], 
                                Table_theta[idx], Table_phi[idx], Table_psi[idx], Table_eta[idx])
    plt.close(fig)

In [8]:
importlib.reload(spf_tb)
theta, phi = 1.503, 1.604

tpick, _ = spf_tb.load_table_date_pickle(job_dir, theta, phi)
Table_t = tpick['Table_t']
Table_dt = tpick['Table_dt']
Table_X = tpick['Table_X']
Table_P = tpick['Table_P']
Table_P2 = tpick['Table_P2']
Table_theta = tpick['Table_theta']
Table_phi = tpick['Table_phi']
Table_psi = tpick['Table_psi']
Table_eta = tpick['Table_eta']
print('-ini_theta %f -ini_phi %f -ini_psi %f' % 
      (tpick['Table_theta'][0], tpick['Table_phi'][0], tpick['Table_psi'][0]))

freq_pk = spf_tb.get_major_fre(Table_t, Table_theta)
idx = Table_t > Table_t.max() - 1 / freq_pk * 10
# spf_tb.show_table_result(Table_t[idx], Table_dt[idx], Table_X[idx], Table_P[idx], Table_P2[idx], 
#                          Table_theta[idx], Table_phi[idx], Table_psi[idx], Table_eta[idx], save_every)
spf_tb.show_theta_phi(Table_t[idx], Table_dt[idx], Table_X[idx], Table_P[idx], Table_P2[idx], 
                      Table_theta[idx], Table_phi[idx], Table_psi[idx], Table_eta[idx])
spf_tb.show_theta_phi_psi_eta(Table_t[idx], Table_dt[idx], Table_X[idx], Table_P[idx], Table_P2[idx], 
                              Table_theta[idx], Table_phi[idx], Table_psi[idx], Table_eta[idx])
spf_tb.show_center_X(Table_t[idx], Table_dt[idx], Table_X[idx], Table_P[idx], Table_P2[idx], 
                     Table_theta[idx], Table_phi[idx], Table_psi[idx], Table_eta[idx], 
                     table_name=table_name)


-ini_theta 1.502501 -ini_phi 1.604218 -ini_psi 0.000000
/home/zhangji/stokes_flow_master/codeStore/support_fun_table.py:609: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
  plt.tight_layout()
Out[8]:
True

In [12]:
with pd.option_context('display.max_rows', 100, 'display.max_columns', 100):
    display(data.theta_max_fre)


ini_phi 0.000 0.134 0.267 0.401 0.535 0.668 0.802 0.936 1.069 1.203 1.337 1.471 1.604 1.738 1.872 2.005 2.139 2.273 2.406 2.540 2.674 2.807 2.941 3.075 3.208 3.342 3.476 3.609 3.743 3.877 4.011 4.144 4.278 4.412 4.545 4.679 4.813 4.946 5.080 5.214 5.347 5.481 5.615 5.748 5.882 6.016 6.150 6.283
ini_theta
0.000 0.019000 0.019000 0.018999 0.019000 0.018999 0.019000 0.018999 0.019001 0.019000 0.018999 0.019000 0.018999 0.015999 0.016000 0.015999 0.016001 0.016001 0.016000 0.015999 0.016001 0.015999 0.015999 0.016000 0.016000 0.015999 0.016000 0.016000 0.015999 0.016000 0.016000 0.015999 0.016000 0.016000 0.016001 0.015999 0.016001 0.019000 0.018999 0.018999 0.018999 0.019000 0.019000 0.019000 0.019000 0.018999 0.019000 0.019000 0.019000
0.137 0.019000 0.019935 0.019001 0.019907 0.019000 0.018999 0.019001 0.019000 0.018999 0.018999 0.018999 0.018999 0.020100 0.019000 0.018999 0.018999 0.018999 0.018999 0.019553 0.019000 0.019000 0.019001 0.016001 0.015999 0.016000 0.016001 0.015999 0.016001 0.016001 0.016000 0.015999 0.015999 0.016000 0.016001 0.015999 0.015999 0.015999 0.016001 0.020428 0.018999 0.019000 0.019000 0.018999 0.019000 0.018999 0.020002 0.019000 0.018999
0.273 0.019000 0.018999 0.019000 0.018999 0.018999 0.018999 0.019817 0.018999 0.020604 0.018999 0.019000 0.018999 0.020449 0.018999 0.020543 0.018999 0.019001 0.019000 0.019985 0.018999 0.018999 0.015999 0.016000 0.015999 0.016000 0.016001 0.015999 0.016000 0.015999 0.015999 0.015999 0.015999 0.016000 0.015999 0.016000 0.015999 0.015999 0.015999 0.018999 0.020388 0.019000 0.019001 0.018999 0.019000 0.019000 0.019000 0.018999 0.018999
0.410 0.018999 0.019000 0.018999 0.018999 0.019001 0.019838 0.018999 0.018999 0.019000 0.018999 0.019000 0.018999 0.020477 0.019936 0.018999 0.018999 0.018999 0.018999 0.019000 0.020120 0.020002 0.015999 0.016002 0.015999 0.016001 0.016000 0.016002 0.016000 0.016000 0.016000 0.015999 0.015999 0.015999 0.015999 0.016000 0.016001 0.015999 0.016002 0.019000 0.018999 0.020605 0.019001 0.019000 0.019001 0.019891 0.019001 0.018999 0.019000
0.546 0.019683 0.019994 0.018999 0.018999 0.018999 0.018999 0.018999 0.019000 0.020053 0.018999 0.019001 0.019000 0.019000 0.020968 0.019000 0.019000 0.018999 0.020521 0.018999 0.020058 0.019845 0.019000 0.016002 0.016000 0.016000 0.016000 0.016002 0.015999 0.016001 0.015999 0.015999 0.015999 0.016000 0.016001 0.016002 0.016001 0.016000 0.018999 0.018999 0.018999 0.020128 0.018999 0.018999 0.018999 0.020166 0.019000 0.018999 0.020685
0.683 0.019874 0.019000 0.018999 0.019001 0.018999 0.019001 0.019001 0.018999 0.019000 0.018999 0.018999 0.020609 0.018999 0.018999 0.018999 0.019846 0.020164 0.019001 0.020096 0.019000 0.019001 0.018999 0.016003 0.015999 0.015999 0.016000 0.016000 0.016001 0.015999 0.015999 0.015999 0.015999 0.016003 0.016002 0.015999 0.015999 0.015999 0.019000 0.019000 0.019000 0.018999 0.019000 0.019002 0.019000 0.020602 0.018999 0.019002 0.020054
0.820 0.019000 0.020672 0.019000 0.019000 0.018999 0.019000 0.018999 0.019002 0.018999 0.018999 0.018999 0.019652 0.019619 0.019002 0.019000 0.018999 0.018999 0.018999 0.019000 0.020139 0.019839 0.016000 0.016000 0.016002 0.015999 0.016000 0.016000 0.015999 0.015999 0.015999 0.015999 0.016002 0.015999 0.016000 0.016000 0.015999 0.019000 0.018999 0.018999 0.019000 0.019001 0.019000 0.019000 0.019000 0.019000 0.018999 0.019000 0.018999
0.956 0.020417 0.018999 0.020316 0.020331 0.019000 0.020334 0.019001 0.019000 0.020365 0.018999 0.019001 0.018999 0.018999 0.018999 0.018999 0.018999 0.018999 0.019968 0.020086 0.019000 0.019000 0.015999 0.015999 0.015999 0.015999 0.016000 0.016001 0.015999 0.015999 0.016000 0.015999 0.016000 0.015999 0.015999 0.019000 0.018999 0.018999 0.018999 0.018999 0.018999 0.018999 0.020341 0.018999 0.018999 0.018999 0.020267 0.019918 0.019744
1.093 0.019000 0.018999 0.019887 0.018999 0.019001 0.019000 0.019731 0.019000 0.018999 0.019000 0.018999 0.019001 0.018999 0.016001 0.016003 0.015999 0.016001 0.015999 0.015999 0.015999 0.016002 0.015999 0.016000 0.016002 0.016000 0.015999 0.015999 0.015999 0.016001 0.015999 0.016000 0.018999 0.018999 0.019000 0.018999 0.020644 0.018999 0.018999 0.018999 0.018999 0.018999 0.018999 0.018999 0.019754 0.018999 0.018999 0.020585 0.019000
1.229 0.019000 0.018999 0.019000 0.018999 0.018999 0.018999 0.020640 0.019683 0.015999 0.015999 0.018999 0.018999 0.018999 0.019001 0.019000 0.019618 0.020396 0.019964 0.018999 0.018999 0.016003 0.019000 0.015999 0.016000 0.016000 0.016002 0.016001 0.016001 0.019953 0.019000 0.018999 0.019000 0.019000 0.019000 0.019001 0.018999 0.019001 0.019001 0.019000 0.019000 0.019000 0.019000 0.019001 0.018999 0.020331 0.020476 0.020522 0.019000
1.366 0.018999 0.018999 0.020493 0.020620 0.019000 0.019000 0.018999 0.019001 0.019000 0.018999 0.019000 0.018999 0.018999 0.015999 0.019001 0.018999 0.020069 0.018999 0.020165 0.016002 0.020273 0.020433 0.016001 0.015999 0.015999 0.019001 0.018999 0.019821 0.018999 0.019925 0.019760 0.020183 0.020632 0.019851 0.020627 0.019818 0.020000 0.018999 0.019001 0.019001 0.019002 0.019000 0.019001 0.018999 0.018999 0.018999 0.018999 0.019000
1.503 0.018999 0.020464 0.020024 0.018999 0.020478 0.016001 0.018999 0.019000 0.018999 0.018999 0.018999 0.018999 0.019840 0.018999 0.020184 0.019000 0.015999 0.018999 0.019000 0.018999 0.016001 0.018999 0.019870 0.016003 0.018999 0.019000 0.019000 0.018999 0.018999 0.020176 0.020099 0.020320 0.019891 0.020499 0.020174 0.020627 0.020027 0.020483 0.020291 0.020262 0.020249 0.020358 0.019970 0.020134 0.020636 0.018999 0.018999 0.019000
1.639 0.019000 0.018999 0.018999 0.018999 0.020410 0.019000 0.016002 0.016001 0.016000 0.016005 0.016000 0.018999 0.019000 0.020372 0.015999 0.015999 0.018999 0.018999 0.019000 0.016001 0.020093 0.019001 0.019001 0.016002 0.018999 0.019000 0.018999 0.020261 0.020568 0.020021 0.020653 0.020352 0.020065 0.019764 0.019853 0.019579 0.019607 0.020435 0.020686 0.020066 0.020090 0.020001 0.020873 0.019000 0.018999 0.018999 0.019001 0.019001
1.776 0.019869 0.018999 0.018999 0.019759 0.016002 0.018999 0.019977 0.018999 0.016001 0.018999 0.020066 0.018999 0.019000 0.018999 0.019002 0.018999 0.015999 0.018999 0.018999 0.020438 0.019876 0.019000 0.020219 0.015999 0.018999 0.018999 0.019000 0.018999 0.019002 0.019000 0.019000 0.018999 0.019000 0.018999 0.020137 0.020642 0.019600 0.020431 0.020661 0.020564 0.018999 0.019000 0.019002 0.020676 0.018999 0.018999 0.018999 0.020272
1.912 0.018999 0.018999 0.018999 0.020450 0.019001 0.018999 0.016001 0.018999 0.019000 0.015999 0.016001 0.018999 0.019000 0.016000 0.020252 0.019000 0.018999 0.018999 0.019000 0.016001 0.016004 0.016000 0.016001 0.016002 0.016000 0.018999 0.019000 0.019000 0.019000 0.019003 0.019001 0.019000 0.019000 0.019000 0.019000 0.018999 0.019000 0.019001 0.019001 0.019000 0.018999 0.018999 0.019000 0.019000 0.018999 0.018999 0.019000 0.019000
2.049 0.019000 0.019000 0.018999 0.019000 0.018999 0.019735 0.019000 0.018999 0.019830 0.018999 0.019845 0.018999 0.018999 0.019000 0.018999 0.019000 0.018999 0.015999 0.016001 0.015999 0.015999 0.016000 0.015999 0.016000 0.015999 0.019000 0.018999 0.020141 0.019000 0.020087 0.019000 0.018999 0.018999 0.019993 0.018999 0.018999 0.019000 0.018999 0.020421 0.019000 0.020323 0.019001 0.018999 0.020032 0.019000 0.019001 0.020585 0.018999
2.185 0.019000 0.018999 0.018999 0.019000 0.019984 0.019826 0.018999 0.018999 0.018999 0.019000 0.019001 0.019000 0.019000 0.019001 0.015999 0.016000 0.016000 0.016000 0.015999 0.016001 0.016002 0.016001 0.015999 0.015999 0.015999 0.020692 0.018999 0.018999 0.019916 0.020797 0.018999 0.019000 0.018999 0.020089 0.019000 0.018999 0.020484 0.019000 0.019000 0.018999 0.018999 0.018999 0.019000 0.018999 0.019000 0.018999 0.019001 0.018999
2.322 0.018999 0.019000 0.019000 0.019894 0.018999 0.019956 0.018999 0.020052 0.019000 0.019000 0.019911 0.016000 0.015999 0.015999 0.016003 0.016000 0.015999 0.015999 0.015999 0.015999 0.016000 0.016001 0.016001 0.015999 0.016001 0.018999 0.020564 0.018999 0.018999 0.018999 0.018999 0.018999 0.019729 0.018999 0.020699 0.019000 0.018999 0.018999 0.019002 0.018999 0.019000 0.018999 0.020745 0.018999 0.018999 0.018999 0.019000 0.018999
2.459 0.020035 0.018999 0.019000 0.019927 0.018999 0.018999 0.018999 0.018999 0.019846 0.016000 0.015999 0.015999 0.016000 0.015999 0.016001 0.016001 0.015999 0.015999 0.016000 0.016002 0.016000 0.016002 0.016002 0.015999 0.016002 0.016002 0.019944 0.018999 0.019000 0.019000 0.019000 0.018999 0.020402 0.018999 0.020217 0.019000 0.018999 0.019000 0.019001 0.018999 0.019000 0.019000 0.018999 0.020467 0.018999 0.018999 0.019000 0.019971
2.595 0.018999 0.018999 0.019897 0.019000 0.020099 0.018999 0.019778 0.018999 0.018999 0.015999 0.016000 0.015999 0.016003 0.016001 0.016002 0.016000 0.015999 0.015999 0.016001 0.016001 0.016000 0.016000 0.016002 0.015999 0.016000 0.016000 0.018999 0.020544 0.018999 0.019000 0.019001 0.018999 0.020330 0.019001 0.020265 0.019000 0.018999 0.018999 0.018999 0.019000 0.018999 0.019000 0.018999 0.020397 0.018999 0.020472 0.019000 0.018999
2.732 0.019000 0.020088 0.018999 0.019000 0.019793 0.018999 0.019000 0.018999 0.018999 0.016000 0.015999 0.016001 0.016003 0.016003 0.016001 0.015999 0.015999 0.015999 0.016000 0.016001 0.016001 0.016000 0.016002 0.016001 0.016000 0.016001 0.018999 0.018999 0.019692 0.019000 0.019000 0.018999 0.018999 0.019000 0.019912 0.018999 0.018999 0.018999 0.018999 0.018999 0.019000 0.019000 0.020698 0.020169 0.019000 0.020086 0.019000 0.018999
2.868 0.018999 0.019002 0.019000 0.018999 0.018999 0.019987 0.019000 0.018999 0.018999 0.019000 0.015999 0.015999 0.015999 0.015999 0.016001 0.016000 0.015999 0.015999 0.016000 0.016000 0.016000 0.016000 0.016003 0.016000 0.015999 0.016004 0.019002 0.020327 0.018999 0.019000 0.019001 0.018999 0.019000 0.019001 0.019871 0.019000 0.018999 0.018999 0.019866 0.018999 0.018999 0.019001 0.018999 0.019000 0.018999 0.018999 0.019001 0.019000
3.005 0.019996 0.018999 0.018999 0.018999 0.018999 0.018999 0.018999 0.019723 0.018999 0.019000 0.016000 0.016000 0.016003 0.015999 0.016000 0.015999 0.015999 0.015999 0.016000 0.016001 0.015999 0.016000 0.016001 0.016000 0.015999 0.016002 0.019000 0.020888 0.018999 0.018999 0.019000 0.019001 0.018999 0.018999 0.018999 0.018999 0.018999 0.018999 0.019001 0.019002 0.018999 0.019000 0.020604 0.019001 0.018999 0.020666 0.019001 0.020182
3.142 0.016000 0.016000 0.016000 0.018999 0.020152 0.019874 0.018999 0.019000 0.018999 0.019000 0.019000 0.018999 0.018999 0.018999 0.018999 0.019001 0.019000 0.018999 0.020461 0.020055 0.019002 0.020506 0.018999 0.019000 0.020413 0.018999 0.019000 0.020108 0.019000 0.019000 0.018999 0.019773 0.019001 0.018999 0.015999 0.015999 0.015999 0.016002 0.015999 0.015999 0.015999 0.016000 0.016002 0.016000 0.016002 0.016002 0.016002 0.016001

In [14]:
# sort all frequrents
with np.printoptions(precision=10, suppress=True, threshold=1e10):
    print(np.flipud(np.sort(data.theta_max_fre.values.flatten())))


[0.0209675968 0.0208876341 0.0208732029 0.0207971724 0.0207452003 0.0206994962
 0.0206981551 0.0206923452 0.0206859855 0.020685435  0.0206760691 0.020672237
 0.0206662874 0.0206607613 0.0206533585 0.0206441971 0.0206422864 0.0206398284
 0.0206359174 0.0206317061 0.0206271873 0.0206271674 0.0206203353 0.0206090074
 0.0206052421 0.0206038265 0.0206037878 0.0206015639 0.0205854158 0.0205849284
 0.0205679197 0.0205644193 0.0205642993 0.0205440829 0.0205432129 0.0205224104
 0.0205212204 0.0205063565 0.0204987284 0.0204934108 0.0204835577 0.0204828548
 0.0204778838 0.0204768598 0.0204760832 0.0204716758 0.0204671471 0.0204641181
 0.0204607654 0.0204498722 0.0204485907 0.0204375126 0.0204346878 0.0204325241
 0.0204306652 0.0204280352 0.0204213245 0.0204174708 0.0204131191 0.0204096309
 0.0204024379 0.0203971887 0.0203957904 0.0203879232 0.0203718037 0.0203645518
 0.0203583795 0.0203520802 0.0203414099 0.0203340786 0.0203314968 0.0203314713
 0.0203303877 0.0203271759 0.0203231893 0.0203202375 0.0203157353 0.0202907601
 0.0202728938 0.0202722141 0.0202667219 0.0202650834 0.0202617674 0.0202610893
 0.0202518803 0.0202487047 0.0202185517 0.0202170818 0.0201835751 0.0201826147
 0.0201820308 0.0201756021 0.0201741026 0.0201685696 0.0201657429 0.0201654848
 0.020163937  0.0201518072 0.0201409337 0.02013935   0.0201368373 0.0201337767
 0.0201278975 0.0201199757 0.0201077327 0.0200996459 0.0200993773 0.0200989427
 0.0200963993 0.0200926117 0.0200904155 0.0200888464 0.0200883282 0.0200866995
 0.0200862943 0.0200856927 0.0200687122 0.0200660708 0.0200660611 0.0200651695
 0.0200581926 0.0200550925 0.020054112  0.0200530781 0.0200520778 0.0200345553
 0.0200323196 0.0200266477 0.0200235786 0.0200206434 0.0200022369 0.0200015234
 0.0200014366 0.0199996742 0.0199959722 0.0199935814 0.0199932046 0.0199869369
 0.0199849454 0.0199838352 0.0199773522 0.0199706872 0.0199698017 0.019967881
 0.0199640458 0.0199564274 0.0199530049 0.0199438424 0.0199357523 0.0199349673
 0.0199270235 0.0199253605 0.0199175432 0.019916112  0.0199120882 0.0199113992
 0.0199073079 0.0198968892 0.0198942126 0.0198909623 0.0198906238 0.0198866642
 0.0198761411 0.0198741881 0.0198738284 0.0198706704 0.0198701252 0.0198685336
 0.0198659418 0.019852837  0.0198507313 0.0198464024 0.0198461982 0.0198450346
 0.0198449047 0.0198402178 0.0198394021 0.0198383989 0.0198297857 0.0198258832
 0.0198213229 0.0198175761 0.0198168653 0.0197929331 0.0197780052 0.0197734239
 0.0197638723 0.0197600035 0.019759368  0.0197538922 0.0197442831 0.0197351921
 0.0197307361 0.0197293147 0.019723329  0.0196923386 0.0196830909 0.0196827242
 0.0196522069 0.0196186593 0.0196179537 0.0196068469 0.0196001184 0.019579329
 0.0195527144 0.0190029932 0.0190024499 0.019002146  0.0190019543 0.019001915
 0.0190018577 0.0190018495 0.0190017769 0.0190017493 0.0190017354 0.019001723
 0.0190017081 0.0190016109 0.0190015185 0.0190014286 0.0190014246 0.0190014021
 0.0190013916 0.0190012854 0.0190012828 0.0190012784 0.0190012709 0.0190012672
 0.0190012478 0.0190011742 0.0190011715 0.0190011679 0.019001148  0.0190011422
 0.0190011369 0.0190011134 0.0190010983 0.0190010799 0.0190010329 0.0190010235
 0.0190009839 0.0190009695 0.0190009671 0.0190009135 0.0190008932 0.0190008687
 0.0190008646 0.0190008519 0.0190008439 0.0190008414 0.0190008018 0.0190007976
 0.0190007855 0.0190007716 0.019000765  0.0190007526 0.0190007506 0.0190007484
 0.0190007278 0.0190007276 0.0190007225 0.0190006657 0.0190006641 0.0190006544
 0.0190006491 0.0190006491 0.0190006429 0.0190006375 0.0190006346 0.0190006345
 0.019000626  0.0190006256 0.0190005888 0.0190005762 0.0190005681 0.0190005435
 0.0190005012 0.0190004989 0.0190004942 0.0190004895 0.0190004838 0.0190004793
 0.0190004673 0.0190004489 0.0190004423 0.0190004296 0.0190004281 0.0190004148
 0.0190004148 0.0190004015 0.0190004008 0.0190003725 0.0190003715 0.0190003689
 0.0190003641 0.0190003288 0.0190003233 0.0190003202 0.0190003098 0.0190002978
 0.0190002927 0.0190002854 0.0190002837 0.019000274  0.019000257  0.0190002562
 0.019000253  0.0190002519 0.0190002309 0.0190002236 0.0190002214 0.0190002206
 0.0190002139 0.0190002051 0.0190001896 0.0190001882 0.0190001752 0.019000156
 0.0190001543 0.0190001517 0.0190001397 0.0190001155 0.0190001121 0.0190001047
 0.01900009   0.0190000899 0.0190000898 0.0190000845 0.019000081  0.0190000771
 0.0190000748 0.019000073  0.0190000695 0.0190000563 0.0190000318 0.0190000246
 0.0190000188 0.0190000168 0.019000007  0.0190000028 0.0189999974 0.0189999908
 0.0189999861 0.0189999857 0.0189999809 0.0189999775 0.0189999741 0.0189999661
 0.018999965  0.0189999633 0.0189999432 0.0189999348 0.0189999329 0.0189999262
 0.0189999233 0.0189999211 0.0189999168 0.0189999128 0.018999895  0.0189998943
 0.0189998881 0.0189998867 0.0189998829 0.0189998827 0.0189998796 0.0189998739
 0.0189998673 0.0189998651 0.0189998441 0.0189998403 0.0189998387 0.0189998309
 0.0189998281 0.018999815  0.0189998136 0.0189998085 0.0189998055 0.018999796
 0.0189997951 0.0189997841 0.0189997738 0.0189997709 0.0189997694 0.0189997644
 0.018999755  0.0189997536 0.0189997507 0.0189997476 0.0189997453 0.0189997396
 0.0189997294 0.0189997292 0.0189997274 0.018999723  0.0189997185 0.0189997172
 0.0189997163 0.0189997138 0.0189997108 0.0189997099 0.0189997016 0.0189996977
 0.0189996961 0.0189996953 0.0189996922 0.0189996908 0.0189996892 0.0189996865
 0.0189996854 0.018999685  0.018999684  0.0189996787 0.0189996694 0.0189996686
 0.0189996651 0.0189996647 0.0189996606 0.0189996592 0.0189996592 0.0189996579
 0.0189996576 0.0189996571 0.0189996538 0.0189996533 0.0189996523 0.0189996509
 0.01899965   0.0189996437 0.0189996416 0.0189996415 0.0189996356 0.0189996285
 0.0189996237 0.0189996225 0.0189996221 0.0189996205 0.0189996197 0.0189996195
 0.0189996152 0.0189996139 0.0189996137 0.0189996127 0.0189996114 0.0189996106
 0.0189996023 0.018999599  0.0189995926 0.0189995911 0.0189995903 0.0189995878
 0.0189995789 0.0189995789 0.0189995695 0.0189995644 0.0189995637 0.0189995617
 0.0189995597 0.0189995589 0.0189995547 0.0189995539 0.018999551  0.0189995497
 0.0189995494 0.0189995477 0.0189995443 0.0189995434 0.0189995415 0.0189995399
 0.0189995336 0.0189995331 0.0189995326 0.0189995251 0.0189995246 0.0189995221
 0.0189995217 0.0189995202 0.0189995198 0.0189995193 0.018999516  0.0189995145
 0.0189995128 0.0189995095 0.0189995051 0.0189995012 0.0189995012 0.0189994884
 0.0189994873 0.0189994871 0.0189994865 0.0189994848 0.0189994837 0.0189994835
 0.0189994831 0.0189994829 0.018999482  0.018999474  0.0189994715 0.0189994646
 0.0189994599 0.0189994562 0.0189994539 0.0189994392 0.0189994391 0.0189994334
 0.0189994289 0.0189994284 0.0189994276 0.0189994259 0.0189994237 0.0189994217
 0.0189994202 0.01899942   0.0189994186 0.0189994174 0.0189994124 0.018999411
 0.0189994102 0.01899941   0.0189994081 0.0189994078 0.0189994064 0.0189993995
 0.018999399  0.0189993987 0.0189993959 0.0189993949 0.018999391  0.0189993904
 0.0189993782 0.0189993755 0.0189993754 0.0189993739 0.0189993723 0.0189993694
 0.018999364  0.0189993633 0.0189993625 0.0189993621 0.0189993588 0.018999354
 0.0189993513 0.0189993507 0.0189993472 0.0189993466 0.0189993454 0.0189993447
 0.0189993397 0.0189993375 0.0189993373 0.0189993319 0.0189993271 0.0189993267
 0.018999323  0.0189993216 0.0189993206 0.0189993177 0.0189993137 0.0189993117
 0.0189993076 0.0189993044 0.0189993016 0.0189993002 0.0189992936 0.0189992932
 0.0189992868 0.0189992862 0.0189992848 0.0189992836 0.0189992786 0.0189992755
 0.0189992741 0.0189992736 0.0189992727 0.0189992713 0.0189992703 0.0189992632
 0.0189992587 0.0189992529 0.0189992527 0.0189992488 0.0189992477 0.0189992436
 0.0189992403 0.0189992393 0.0189992373 0.0189992364 0.0189992361 0.0189992358
 0.0189992344 0.0189992296 0.0189992289 0.0189992268 0.0189992243 0.0189992241
 0.0189992219 0.0189992205 0.0189992131 0.0189992129 0.0189992115 0.0189992109
 0.0189992106 0.01899921   0.0189992074 0.0189992008 0.0189992003 0.0189991972
 0.0189991971 0.0189991889 0.018999182  0.0189991753 0.0189991729 0.0189991687
 0.018999161  0.018999156  0.0189991549 0.0189991516 0.0189991465 0.0189991434
 0.0189991425 0.01899914   0.0189991383 0.0189991378 0.0189991355 0.0189991331
 0.0189991318 0.0189991304 0.0189991296 0.0189991269 0.0189991262 0.0189991233
 0.018999122  0.0189991123 0.0189991117 0.0189991116 0.0189991097 0.0189991092
 0.018999108  0.0189991068 0.0189991059 0.0189991041 0.0189990975 0.0189990893
 0.018999089  0.0189990871 0.0189990864 0.0189990844 0.0189990835 0.0189990791
 0.0189990788 0.0189990788 0.0189990786 0.0189990779 0.0189990746 0.0189990739
 0.0189990726 0.0189990699 0.0189990685 0.0189990684 0.0189990682 0.0189990645
 0.0189990605 0.0189990587 0.0189990566 0.0189990533 0.0189990498 0.018999048
 0.0189990472 0.0189990383 0.018999028  0.0189990193 0.0189990192 0.0189990183
 0.0189990181 0.0189990175 0.0189990102 0.0189990091 0.0189990077 0.0189990074
 0.018999003  0.018998999  0.0189989937 0.0189989912 0.0189989898 0.0189989892
 0.0189989878 0.018998986  0.0189989855 0.0189989854 0.0189989844 0.0189989829
 0.018998981  0.0189989801 0.0189989729 0.0189989723 0.018998971  0.0189989668
 0.0189989609 0.0189989567 0.0189989559 0.0189989544 0.0189989533 0.0189989519
 0.0189989513 0.0189989509 0.0189989508 0.0189989475 0.0189989466 0.0189989429
 0.0189989418 0.018998939  0.0189989373 0.0189989371 0.018998931  0.0189989299
 0.0189989291 0.0189989277 0.0189989256 0.018998924  0.0189989207 0.0189989189
 0.0189989139 0.0189989114 0.0189989102 0.0189989079 0.0189989073 0.018998905
 0.0189989042 0.0189989024 0.0189989019 0.0189989013 0.0189988975 0.0189988962
 0.0189988955 0.018998895  0.0189988949 0.0189988948 0.0189988946 0.0189988915
 0.0189988903 0.0189988854 0.0189988835 0.0189988829 0.0189988821 0.0189988817
 0.0189988814 0.018998877  0.0189988761 0.0189988704 0.0189988682 0.0189988679
 0.0189988644 0.018998862  0.0189988614 0.0189988606 0.0189988589 0.0189988559
 0.0189988518 0.0189988479 0.0189988474 0.0189988463 0.0189988443 0.0189988381
 0.0189988361 0.0189988341 0.0189988334 0.0189988333 0.0189988307 0.0189988237
 0.0189988227 0.0189988222 0.0189988191 0.0189988161 0.0189988135 0.0189988133
 0.01899881   0.0189988091 0.0189988086 0.018998807  0.0189988035 0.0189988034
 0.018998797  0.0189987951 0.0189987947 0.0189987912 0.0189987912 0.0189987902
 0.0189987896 0.0189987893 0.018998786  0.0189987852 0.0189987851 0.0189987849
 0.0189987848 0.0189987836 0.018998782  0.0189987747 0.018998773  0.0189987709
 0.0189987699 0.0189987693 0.018998768  0.0189987641 0.0189987622 0.0189987598
 0.0189987534 0.0189987513 0.0189987503 0.0189987478 0.0189987475 0.018998747
 0.0189987366 0.0189987334 0.018998732  0.0189987259 0.0189987208 0.0189987133
 0.0189987127 0.0189987029 0.018998701  0.0189986995 0.0189986993 0.0189986975
 0.0189986947 0.01899869   0.0189986868 0.0189986855 0.0189986848 0.0189986842
 0.0160045507 0.0160039634 0.0160035574 0.0160034017 0.0160032429 0.0160030242
 0.016002924  0.0160028269 0.0160028261 0.0160028159 0.0160026947 0.0160026056
 0.0160025498 0.0160025034 0.0160024589 0.0160024328 0.0160023835 0.0160022985
 0.0160022763 0.0160021492 0.0160021414 0.0160021232 0.0160021106 0.0160020766
 0.016002071  0.0160020586 0.016002008  0.0160019953 0.0160019554 0.0160018794
 0.0160018711 0.016001791  0.0160017383 0.0160017259 0.0160017252 0.0160016848
 0.0160016741 0.016001664  0.0160016627 0.0160016613 0.016001648  0.0160016122
 0.016001608  0.0160015339 0.0160015047 0.0160015025 0.0160014782 0.0160014519
 0.016001444  0.0160014232 0.0160014027 0.0160013467 0.0160013253 0.0160013227
 0.0160013025 0.0160011983 0.0160011743 0.0160011552 0.0160011413 0.0160011321
 0.0160011273 0.0160011196 0.0160011112 0.01600108   0.0160010514 0.0160010477
 0.0160010187 0.0160010153 0.0160010132 0.0160009631 0.016000954  0.0160009529
 0.0160009485 0.0160009441 0.0160009429 0.0160009258 0.016000847  0.0160008115
 0.0160008103 0.0160007889 0.0160007862 0.0160007637 0.0160007614 0.016000726
 0.0160007207 0.016000713  0.0160007129 0.0160007027 0.0160006813 0.0160006655
 0.0160006627 0.0160006548 0.0160006425 0.0160006416 0.0160006279 0.0160006199
 0.0160005999 0.0160005954 0.0160005813 0.0160005312 0.0160005085 0.0160004996
 0.0160004896 0.0160004891 0.0160004399 0.0160004264 0.0160004082 0.016000382
 0.0160003771 0.01600035   0.0160003424 0.0160003402 0.016000331  0.0160003123
 0.0160002926 0.0160002832 0.0160002742 0.0160002719 0.0160002571 0.0160002068
 0.0160001952 0.0160001685 0.0160001561 0.0160001542 0.016000145  0.0160001368
 0.0160001354 0.0160001251 0.0160001057 0.0160000959 0.0160000931 0.0160000748
 0.0160000687 0.0160000655 0.0160000621 0.0160000318 0.0160000061 0.0159999997
 0.0159999988 0.0159999927 0.0159999912 0.0159999836 0.015999983  0.0159999829
 0.0159999824 0.0159999627 0.015999954  0.0159999533 0.0159999525 0.0159999513
 0.015999945  0.0159999218 0.0159999083 0.0159998899 0.015999875  0.0159998701
 0.0159998694 0.0159998447 0.015999843  0.0159998146 0.0159998094 0.0159997962
 0.0159997888 0.0159997834 0.0159997807 0.0159997774 0.0159997769 0.015999734
 0.0159997291 0.0159997271 0.0159997252 0.0159997193 0.015999715  0.0159997127
 0.015999693  0.0159996875 0.0159996783 0.0159996696 0.0159996674 0.0159996531
 0.0159996416 0.0159996128 0.0159995941 0.0159995677 0.0159995566 0.0159995521
 0.0159995249 0.0159995131 0.0159995019 0.0159994995 0.0159994904 0.0159994892
 0.0159994887 0.0159994845 0.0159994827 0.0159994815 0.0159994634 0.0159994524
 0.0159994514 0.0159994451 0.0159994449 0.015999437  0.0159994334 0.0159994213
 0.0159994154 0.0159994108 0.0159994062 0.0159993984 0.0159993982 0.0159993979
 0.015999394  0.0159993887 0.0159993885 0.0159993869 0.0159993767 0.0159993742
 0.0159993633 0.0159993369 0.0159993294 0.0159993197 0.0159993192 0.0159993079
 0.0159993034 0.0159993017 0.0159992949 0.0159992783 0.0159992756 0.015999272
 0.0159992705 0.0159992701 0.0159992589 0.0159992567 0.0159992386 0.0159992324
 0.0159992319 0.0159992278 0.0159992217 0.0159992188 0.0159992147 0.0159992139
 0.0159992105 0.0159992056 0.0159992045 0.0159991904 0.0159991884 0.0159991855
 0.0159991729 0.0159991653 0.0159991543 0.015999138  0.015999125  0.0159991214
 0.0159991155 0.0159991143 0.0159991129 0.0159991115 0.0159991095 0.0159991095
 0.0159991068 0.0159991048 0.0159991012 0.0159990998 0.0159990988 0.0159990845
 0.0159990826 0.0159990712 0.0159990654 0.0159990576 0.0159990572 0.0159990547
 0.0159990507 0.0159990419 0.015999035  0.0159990296 0.0159990275 0.0159989965
 0.0159989952 0.0159989913 0.0159989854 0.0159989788 0.0159989787 0.015998978
 0.0159989752 0.0159989741 0.0159989732 0.0159989726 0.0159989721 0.0159989687
 0.0159989665 0.0159989625 0.0159989619 0.0159989544 0.0159989444 0.0159989362
 0.0159989353 0.0159989222 0.0159989204 0.0159989197 0.01599891   0.0159989099
 0.0159989094 0.0159989093 0.0159989036 0.0159988814 0.0159988797 0.0159988762
 0.0159988699 0.0159988672 0.0159988601 0.0159988505 0.0159988448 0.0159988374
 0.0159988284 0.0159988217 0.0159988136 0.0159988055 0.0159987954 0.0159987945
 0.0159987819 0.015998763  0.0159987606 0.0159987515 0.0159987362 0.015998731 ]

In [15]:
spf_tb.show_traj_phase_map_fre(theta_max_fre)
# spf_tb.show_traj_phase_map_fre(phi_max_fre)
# spf_tb.show_traj_phase_map_fre(psi_max_fre)
# spf_tb.show_traj_phase_map_fre(eta_max_fre)


Out[15]:
True

In [15]:
# put images with same frequence into a subdirect
importlib.reload(spf_tb)
def t_show_idx(iidx):
    theta = type_fre.index.values[iidx[0][0]]
    phi = type_fre.columns.values[iidx[1][0]]
    print(theta, phi)
    spf_tb.show_pickle_results(job_dir, theta, phi, table_name)
    return True

tfre = theta_max_fre.copy()
check_fre_list = [0.0160, 0.0190, 0.0203]
atol_fre_list =  [0.0001, 0.0001, 0.0008]

type_fre = tfre.copy()
type_fre.iloc[:, :] = len(check_fre_list) 
for i0, (check_fre, atol_fre) in enumerate(zip(check_fre_list, atol_fre_list)):
    use_idx = np.isclose(tfre, check_fre, rtol=0, atol=atol_fre)
    type_fre.iloc[use_idx] = i0
    iidx = np.where(use_idx)
    t_show_idx(iidx)

# plot one of the remaind cases
if np.any(type_fre.values == len(check_fre_list)):
    iidx = np.where(type_fre.values == len(check_fre_list))
    t_show_idx(iidx)

spf_tb.show_traj_phase_map_type(type_fre)
spf_tb.save_separate_angleList_fft(job_dir, tfre, check_fre_list, atol_fre_list)


0.0 1.604
-ini_theta 0.000000 -ini_phi 0.000000 -ini_psi 3.141593
/home/zhangji/stokes_flow_master/codeStore/support_fun_table.py:609: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
  plt.tight_layout()
0.0 0.0
-ini_theta 0.000000 -ini_phi 0.000000 -ini_psi 0.000000
0.137 0.134
-ini_theta 0.136591 -ini_phi 0.133685 -ini_psi 0.000000
frequency in the range (0.015900, 0.016100)
remove folder ecoC01B05_T0.01_psi-0b/fre_separate/fre_0.016000
make folder ecoC01B05_T0.01_psi-0b/fre_separate/fre_0.016000
frequency in the range (0.018900, 0.019100)
remove folder ecoC01B05_T0.01_psi-0b/fre_separate/fre_0.019000
make folder ecoC01B05_T0.01_psi-0b/fre_separate/fre_0.019000
frequency in the range (0.019500, 0.021100)
make folder ecoC01B05_T0.01_psi-0b/fre_separate/fre_0.020300
remove folder ecoC01B05_T0.01_psi-0b/fre_separate/remainders
make folder ecoC01B05_T0.01_psi-0b/fre_separate/remainders

Out[15]:
True

In [ ]:
# create phase map
importlib.reload(spf_tb)
def tget_ax0():
    n_xticks = 32
    xticks = np.arange(n_xticks)
    fig = plt.figure(figsize=(20, 20))
    fig.patch.set_facecolor('white')
    axs = []
    axs.append(fig.add_subplot(221, polar=True))
    axs.append(fig.add_subplot(222, polar=True))
    axs.append(fig.add_subplot(223, polar=True))
    axs.append(fig.add_subplot(224, polar=True))
    for ax0 in axs:
        ax0.set_xticks(xticks / n_xticks * 2 * np.pi)
        ax0.set_xticklabels(['$\dfrac{%d}{%d}2\pi$' % (i0, n_xticks) for i0 in xticks])
        ax0.set_yticklabels([])
        ax0.set_ylim(0, np.pi)
    plt.tight_layout()
    return fig, axs

check_fre_list = [1.000, 0.0220, 1.0000, 0.0540]
atol_list =      [0.004, 0.0005, 0.0005, 0.0005]
color_list =     ['b',   'g',    'r',    'c',   'm', 'y', 'k']
psi_lim_fct = 20
resampling_fct = 10

data0['use_max_fre'] = data0.theta_max_fre
case_path_list = spf_tb.separate_fre_path(check_fre_list, atol_list, data0, pickle_path_list)
for idx, psi_lim1 in enumerate(np.linspace(0, 2 * np.pi, psi_lim_fct * 16, 
                                           endpoint=False)[::psi_lim_fct]):
    fig, (ax0, ax1, ax2, ax3) = tget_ax0()
    ax_list = [ax0, ax0, ax1, ax2, ax3]
    psi_lim = (psi_lim1, psi_lim1 + 2 * np.pi / (psi_lim_fct * 16))
    desc = '$\psi\in[%.3f\pi, %.3f\pi)$' % ((psi_lim[0] / np.pi), (psi_lim[1] / np.pi))
    fig.suptitle(desc, fontsize=fontsize*0.8)
    for check_fre, case_path, color, axi in zip(check_fre_list, case_path_list, color_list, ax_list):
        thandle = '%f' % check_fre
        spf_tb.draw_phase_map_theta(case_path, color, psi_lim, axs=(axi, ax_list[-1]), thandle=thandle, 
                                    resampling=True, resampling_fct=resampling_fct)
    tdir = os.path.join(PWD, job_dir, 'phase_mape_fre')
    if not os.path.exists(tdir):
        os.makedirs(tdir)
    figname = os.path.join(tdir, '%04d.png' % (idx))
    fig.savefig(os.path.join(tdir, figname))
    print('save to %s' % figname)
    plt.close(fig)


/home/zhangji/stokes_flow_master/codeStore/support_fun_table.py:12: UserWarning: matplotlib.pyplot as already been imported, this call will have no effect.
  matplotlib.use('agg')
0th frequence range: (0.996000, 1.004000)
1th frequence range: (0.021500, 0.022500)
2th frequence range: (0.999500, 1.000500)
3th frequence range: (0.053500, 0.054500)
tmax_fre=0.048002, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph0.401_ps0.000_D20190714_T225427.pickle
tmax_fre=0.052003, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.683_ph2.941_ps0.000_D20190715_T023809.pickle
tmax_fre=0.035997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph1.738_ps0.000_D20190715_T020546.pickle
tmax_fre=0.052011, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.366_ph3.075_ps0.000_D20190715_T024550.pickle
tmax_fre=0.051998, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.229_ph3.208_ps0.000_D20190715_T025014.pickle
tmax_fre=0.036003, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph2.005_ps0.000_D20190715_T020546.pickle
tmax_fre=0.052012, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.322_ph3.476_ps0.000_D20190715_T031731.pickle
tmax_fre=0.052001, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.683_ph3.075_ps0.000_D20190715_T024550.pickle
tmax_fre=0.052001, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.322_ph3.208_ps0.000_D20190715_T025013.pickle
tmax_fre=0.051998, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.093_ph3.208_ps0.000_D20190715_T025013.pickle
tmax_fre=0.050005, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph0.000_ps0.000_D20190714_T225427.pickle
tmax_fre=0.052002, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.366_ph3.208_ps0.000_D20190715_T025014.pickle
tmax_fre=0.052001, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.820_ph3.075_ps0.000_D20190715_T024550.pickle
tmax_fre=0.051997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.459_ph3.342_ps0.000_D20190715_T031151.pickle
tmax_fre=0.052005, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.093_ph2.941_ps0.000_D20190715_T023808.pickle
tmax_fre=0.050003, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th3.005_ph0.134_ps0.000_D20190714_T225427.pickle
tmax_fre=0.052011, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.185_ph3.342_ps0.000_D20190715_T031150.pickle
tmax_fre=0.052004, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph3.208_ps0.000_D20190715_T025013.pickle
tmax_fre=0.039005, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph4.011_ps0.000_D20190715_T032724.pickle
tmax_fre=0.049996, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.366_ph6.150_ps0.000_D20190715_T045619.pickle
tmax_fre=0.035999, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph1.069_ps0.000_D20190715_T005116.pickle
tmax_fre=0.052003, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.956_ph2.941_ps0.000_D20190715_T023809.pickle
tmax_fre=0.035999, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph1.604_ps0.000_D20190715_T020546.pickle
tmax_fre=0.035001, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph4.679_ps0.000_D20190715_T040314.pickle
tmax_fre=0.052007, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph3.075_ps0.000_D20190715_T024550.pickle
tmax_fre=0.035004, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph1.471_ps0.000_D20190715_T013943.pickle
tmax_fre=0.050013, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.229_ph6.150_ps0.000_D20190715_T045619.pickle
tmax_fre=0.037003, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph5.080_ps0.000_D20190715_T040605.pickle
tmax_fre=0.051999, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.137_ph3.075_ps0.000_D20190715_T024550.pickle
tmax_fre=0.049997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.732_ph0.134_ps0.000_D20190714_T225427.pickle
tmax_fre=0.050005, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.956_ph0.000_ps0.000_D20190714_T225427.pickle
tmax_fre=0.048009, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.912_ph0.401_ps0.000_D20190714_T225427.pickle
tmax_fre=0.052011, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.459_ph3.208_ps0.000_D20190715_T025014.pickle
tmax_fre=0.035998, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph4.412_ps0.000_D20190715_T035348.pickle
tmax_fre=0.052006, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.868_ph3.476_ps0.000_D20190715_T031732.pickle
tmax_fre=0.037005, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph4.144_ps0.000_D20190715_T032725.pickle
tmax_fre=0.052001, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.912_ph3.208_ps0.000_D20190715_T025014.pickle
tmax_fre=0.051999, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.546_ph2.941_ps0.000_D20190715_T023808.pickle
tmax_fre=0.035998, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph1.203_ps0.000_D20190715_T011130.pickle
tmax_fre=0.036000, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph4.412_ps0.000_D20190715_T035348.pickle
tmax_fre=0.052007, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th3.005_ph3.208_ps0.000_D20190715_T025013.pickle
tmax_fre=0.052017, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.956_ph3.208_ps0.000_D20190715_T025013.pickle
tmax_fre=0.051997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.732_ph3.342_ps0.000_D20190715_T031150.pickle
tmax_fre=0.036002, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph5.214_ps0.000_D20190715_T040610.pickle
tmax_fre=0.052003, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.956_ph3.075_ps0.000_D20190715_T024550.pickle
tmax_fre=0.035001, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph1.604_ps0.000_D20190715_T020546.pickle
tmax_fre=0.051999, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th3.005_ph3.476_ps0.000_D20190715_T031732.pickle
tmax_fre=0.052012, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.546_ph2.807_ps0.000_D20190715_T023653.pickle
tmax_fre=0.052001, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.820_ph2.941_ps0.000_D20190715_T023809.pickle
tmax_fre=0.052000, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.868_ph3.342_ps0.000_D20190715_T031151.pickle
tmax_fre=0.036002, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph4.813_ps0.000_D20190715_T040330.pickle
tmax_fre=0.036003, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph1.203_ps0.000_D20190715_T011131.pickle
tmax_fre=0.036007, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph2.139_ps0.000_D20190715_T021010.pickle
tmax_fre=0.051997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.049_ph3.342_ps0.000_D20190715_T031151.pickle
tmax_fre=0.050010, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.912_ph0.000_ps0.000_D20190714_T225427.pickle
tmax_fre=0.036006, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph4.946_ps0.000_D20190715_T040521.pickle
tmax_fre=0.036000, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph4.545_ps0.000_D20190715_T040119.pickle
tmax_fre=0.051997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.273_ph3.075_ps0.000_D20190715_T024550.pickle
tmax_fre=0.051997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.273_ph2.941_ps0.000_D20190715_T023808.pickle
tmax_fre=0.036003, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph5.080_ps0.000_D20190715_T040604.pickle
tmax_fre=0.052000, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.912_ph3.342_ps0.000_D20190715_T031150.pickle
tmax_fre=0.036005, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph4.679_ps0.000_D20190715_T040314.pickle
tmax_fre=0.051997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.410_ph2.807_ps0.000_D20190715_T142926.pickle
tmax_fre=0.035000, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph1.738_ps0.000_D20190715_T020547.pickle
tmax_fre=0.051999, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.410_ph2.941_ps0.000_D20190715_T023809.pickle
tmax_fre=0.051997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.137_ph2.807_ps0.000_D20190715_T023653.pickle
tmax_fre=0.052001, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.776_ph3.342_ps0.000_D20190715_T031151.pickle
tmax_fre=0.036997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph5.347_ps0.000_D20190715_T042036.pickle
tmax_fre=0.049998, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.820_ph6.016_ps0.000_D20190715_T045020.pickle
tmax_fre=0.051997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.868_ph3.208_ps0.000_D20190715_T025013.pickle
tmax_fre=0.036998, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph4.278_ps0.000_D20190715_T033910.pickle
tmax_fre=0.045999, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th3.142_ph3.476_ps0.000_D20190715_T031731.pickle
tmax_fre=0.053009, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th3.142_ph0.267_ps0.000_D20190714_T225427.pickle
tmax_fre=0.051996, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph5.481_ps0.000_D20190715_T043702.pickle
tmax_fre=0.035999, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph1.471_ps0.000_D20190715_T013943.pickle
tmax_fre=0.052000, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.366_ph3.342_ps0.000_D20190715_T031151.pickle
tmax_fre=0.052004, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph3.208_ps0.000_D20190715_T025014.pickle
tmax_fre=0.052000, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.185_ph3.476_ps0.000_D20190715_T031731.pickle
tmax_fre=0.052003, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.776_ph3.208_ps0.000_D20190715_T025014.pickle
tmax_fre=0.051999, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.776_ph3.476_ps0.000_D20190715_T031732.pickle
tmax_fre=0.049998, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph0.267_ps0.000_D20190714_T225427.pickle
tmax_fre=0.052006, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph3.075_ps0.000_D20190715_T024550.pickle
tmax_fre=0.049996, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.956_ph6.283_ps0.000_D20190715_T045619.pickle
tmax_fre=0.036003, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph1.872_ps0.000_D20190715_T020547.pickle
tmax_fre=0.052001, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th3.005_ph3.342_ps0.000_D20190715_T031151.pickle
tmax_fre=0.038000, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph2.273_ps0.000_D20190715_T021007.pickle
tmax_fre=0.050002, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.776_ph0.267_ps0.000_D20190714_T225427.pickle
tmax_fre=0.050000, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.912_ph6.283_ps0.000_D20190715_T045619.pickle
tmax_fre=0.052012, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.546_ph3.075_ps0.000_D20190715_T024550.pickle
tmax_fre=0.051999, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph3.342_ps0.000_D20190715_T031150.pickle
tmax_fre=0.035999, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph4.545_ps0.000_D20190715_T040118.pickle
tmax_fre=0.051997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.459_ph3.476_ps0.000_D20190715_T031731.pickle
tmax_fre=0.052011, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.049_ph3.476_ps0.000_D20190715_T031732.pickle
tmax_fre=0.034998, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph4.813_ps0.000_D20190715_T040331.pickle
tmax_fre=0.049999, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th3.142_ph3.208_ps0.000_D20190715_T025014.pickle
tmax_fre=0.048007, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.093_ph6.016_ps0.000_D20190715_T045021.pickle
tmax_fre=0.046996, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.683_ph2.807_ps0.000_D20190715_T023653.pickle
tmax_fre=0.035999, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph1.337_ps0.000_D20190715_T011429.pickle
tmax_fre=0.049997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.683_ph6.016_ps0.000_D20190715_T142926.pickle
tmax_fre=0.049999, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph6.283_ps0.000_D20190715_T045619.pickle
tmax_fre=0.051998, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph3.342_ps0.000_D20190715_T031150.pickle
tmax_fre=0.051997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.229_ph3.075_ps0.000_D20190715_T024550.pickle
tmax_fre=0.035006, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph1.872_ps0.000_D20190715_T020547.pickle
tmax_fre=0.052006, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.595_ph3.342_ps0.000_D20190715_T031150.pickle
tmax_fre=0.052003, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.776_ph3.075_ps0.000_D20190715_T024550.pickle
tmax_fre=0.052009, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.912_ph3.476_ps0.000_D20190715_T031731.pickle
tmax_fre=0.052002, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.410_ph2.807_ps0.000_D20190715_T023652.pickle
tmax_fre=0.036997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph1.069_ps0.000_D20190715_T005116.pickle
tmax_fre=0.051997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.185_ph3.208_ps0.000_D20190715_T025013.pickle
tmax_fre=0.045997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.683_ph6.016_ps0.000_D20190715_T045020.pickle
tmax_fre=0.052011, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.595_ph3.476_ps0.000_D20190715_T031731.pickle
tmax_fre=0.036003, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph1.337_ps0.000_D20190715_T011428.pickle
tmax_fre=0.051999, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.322_ph3.342_ps0.000_D20190715_T031151.pickle
tmax_fre=0.037008, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph0.936_ps0.000_D20190715_T005118.pickle
tmax_fre=0.047998, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.912_ph0.267_ps0.000_D20190714_T225427.pickle
tmax_fre=0.037000, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph2.005_ps0.000_D20190715_T020546.pickle
tmax_fre=0.051997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.049_ph3.208_ps0.000_D20190715_T025014.pickle
tmax_fre=0.052018, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.093_ph3.075_ps0.000_D20190715_T024550.pickle
tmax_fre=0.035000, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.503_ph4.946_ps0.000_D20190715_T040522.pickle
tmax_fre=0.051997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.732_ph3.476_ps0.000_D20190715_T031731.pickle
tmax_fre=0.052007, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th3.142_ph0.134_ps0.000_D20190714_T225427.pickle
tmax_fre=0.052005, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.137_ph2.941_ps0.000_D20190715_T023808.pickle
tmax_fre=0.036007, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.639_ph4.278_ps0.000_D20190715_T033910.pickle
tmax_fre=0.052002, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.410_ph3.075_ps0.000_D20190715_T024550.pickle
tmax_fre=0.052000, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th2.595_ph3.208_ps0.000_D20190715_T025013.pickle
tmax_fre=0.049997, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th1.366_ph0.134_ps0.000_D20190714_T225427.pickle
tmax_fre=0.052009, n_match=0 /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/th0.273_ph2.807_ps0.000_D20190715_T023653.pickle



save to /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/phase_mape_fre/0000.png



save to /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/phase_mape_fre/0001.png



save to /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/hlxC01_a_psi-0e/phase_mape_fre/0002.png


In [ ]:

calculate the phase map of stable trajectory using the KMeans method.


In [186]:
# show phase map of theta-phi, part 1
importlib.reload(spf_tb)
job_dir = 'ecoC01B05_T0.01_psi-0a'
table_name = 'ecoC01B05_T0.01'

t_headle = '(.*?).pickle'
t_path = os.listdir(os.path.join(PWD, job_dir))
filename_list = [filename for filename in os.listdir(os.path.join(PWD, job_dir)) 
                 if re.match(t_headle, filename) is not None]
ini_theta_list = []
ini_phi_list = []
lst_eta_list = []
pickle_path_list = []
idx_list = []
theta_primary_fre_list = []
phi_primary_fre_list = []
psi_primary_fre_list = []
for i0, tname in enumerate(tqdm_notebook(filename_list[:])):
    tpath = os.path.join(PWD, job_dir, tname)
    with open(tpath, 'rb') as handle:
        tpick = pickle.load(handle)
    ini_theta_list.append(tpick['ini_theta'])
    ini_phi_list.append(tpick['ini_phi'])
    lst_eta_list.append(tpick['Table_eta'][-1])
    pickle_path_list.append(tpath)
    idx_list.append(i0)
    
    # fft rule
    tx = tpick['Table_t']
    tmin = np.max((0, tx.max() - 1000))
    idx = tx > tmin
    # the last frequence is the major frequence. 
    use_fft_number = 3
    t1 = -use_fft_number - 1
    theta_primary_fre_list.append(spf_tb.get_primary_fft_fre(tx[idx], tpick['Table_theta'][idx])[t1:-1])
    phi_primary_fre_list.append(spf_tb.get_primary_fft_fre(tx[idx], tpick['Table_phi'][idx])[t1:-1])
    psi_primary_fre_list.append(spf_tb.get_primary_fft_fre(tx[idx], tpick['Table_psi'][idx])[t1:-1])


/home/zhangji/anaconda3/lib/python3.5/site-packages/ipykernel/__main__.py:17: TqdmDeprecationWarning: This function will be removed in tqdm==5.0.0
Please use `tqdm.notebook.tqdm` instead of `tqdm.tqdm_notebook`


In [216]:
# show phase map of theta-phi, part 2
def show_phase_map(tuse):
    fig = plt.figure(figsize=(20, 12), dpi=300)
    fig.patch.set_facecolor('white')
    ax0 = fig.add_subplot(111, polar=True)
    n_xticks = 32
    xticks = np.arange(n_xticks)
    ax0.set_xticks(xticks / n_xticks * 2 * np.pi)
    ax0.set_xticklabels(['$\dfrac{%d}{%d}2\pi$' % (i0, n_xticks) for i0 in xticks])
    ax0.set_yticklabels([])
    ax0.set_ylim(0, np.pi)
    tdata = tuse.values
    im = ax0.pcolor(tuse.columns.values, tuse.index.values, tdata, 
                    cmap=plt.get_cmap('Set2', np.nanmax(tdata)+1), 
                    vmin=np.nanmin(tdata)-.5, vmax=np.nanmax(tdata)+.5)
    ticks = np.arange(np.nanmin(tdata), np.nanmax(tdata)+1)
    fig.colorbar(im, ax=ax0, orientation='vertical', ticks=ticks).ax.tick_params(labelsize=fontsize)

In [257]:
np.around(np.pi, 3)


Out[257]:
3.142

In [239]:
from sklearn.cluster import KMeans
from sklearn.mixture import GaussianMixture

use_data = np.hstack((np.vstack(theta_primary_fre_list)[:, 1:], 
                      np.vstack(phi_primary_fre_list)[:, 1:]))
#KMeans
km = KMeans(n_clusters=6, n_init=10, max_iter=1000, tol=1e-9, precompute_distances=True, n_jobs=-1, random_state=0)
km.fit(use_data)
km.predict(use_data)
tlabels = km.labels_

# # personal process
# tlabels[tlabels == 4] = 3

tdata1 = pd.DataFrame({'ini_theta': np.around(ini_theta_list, 3), 
                      'ini_phi': np.around(ini_phi_list, 3), 
                      'lst_eta': np.around(lst_eta_list, 3), 
                      'use_fre': tlabels, 
                      'data_idx': idx_list })
tdata1 = tdata1.pivot_table(index=['ini_theta'], columns=['ini_phi'])
show_phase_map(tdata1.use_fre)



In [250]:
np.array(ini_theta_list)[tlabels==show_tlabel]


Out[250]:
array([0.81955, 0.40977, 2.18546, 0.81955, 0.68295, 0.54636, 0.81955, 1.77568, 2.59523,
       2.59523, 1.5025 , 2.86841, 0.13659, 2.04887, 2.04887, 1.5025 , 1.77568, 2.59523,
       0.95614, 0.40977, 0.81955, 0.40977, 2.04887, 1.77568, 1.63909, 0.13659, 1.77568,
       1.36591, 1.63909, 1.36591, 1.77568, 2.32205, 3.005  , 2.32205, 0.54636, 2.32205,
       1.36591, 3.14159, 2.18546, 3.005  , 0.81955, 2.73182, 2.04887, 1.09273, 3.14159,
       2.86841, 0.27318, 1.77568, 2.18546, 0.27318, 3.14159, 2.73182, 1.5025 , 0.54636,
       1.36591, 1.5025 , 2.45864, 1.63909, 3.005  , 0.95614, 1.36591, 2.59523, 1.77568,
       0.81955, 1.63909, 2.18546, 2.04887, 0.54636, 0.40977, 0.13659, 1.63909, 2.18546,
       2.18546, 0.40977, 1.22932, 2.73182, 1.77568, 2.32205, 3.14159, 1.09273, 0.27318,
       2.59523, 1.36591, 1.36591, 3.005  , 2.18546, 2.59523, 2.45864, 0.40977, 1.09273,
       2.59523, 1.77568, 2.45864, 1.5025 , 0.27318, 1.63909, 2.04887, 0.95614, 2.45864,
       0.68295, 1.36591, 1.36591, 2.59523, 1.22932, 2.32205, 2.59523, 2.45864, 2.86841,
       0.54636, 2.45864, 2.86841, 2.32205, 1.77568, 1.22932, 1.22932, 2.73182, 2.86841,
       0.54636, 0.54636, 2.86841, 2.86841, 1.22932, 1.5025 , 2.73182, 1.36591, 1.5025 ,
       1.36591, 2.59523, 1.63909, 0.40977, 0.81955, 1.77568, 0.68295, 0.27318, 1.77568,
       0.68295, 1.36591, 0.40977, 0.95614, 1.36591, 0.54636, 2.32205, 0.27318, 2.45864,
       1.36591, 0.81955, 0.68295, 1.22932, 3.14159, 2.04887, 1.09273, 0.13659, 0.95614,
       3.005  , 2.18546, 2.32205, 0.40977, 0.95614, 2.73182, 0.13659, 1.5025 , 2.45864,
       0.13659, 2.04887, 0.68295, 2.18546, 1.77568, 0.40977, 0.54636, 0.13659, 1.5025 ,
       0.95614, 0.95614, 1.36591, 0.40977, 0.81955, 0.95614, 1.77568, 2.86841, 0.68295,
       0.27318, 0.68295, 2.32205, 0.27318, 0.13659, 0.54636, 0.27318, 1.36591, 1.91227,
       2.73182, 2.18546, 2.59523, 3.14159, 3.14159, 2.32205, 2.04887, 0.40977, 2.59523,
       3.14159, 1.5025 , 2.59523, 3.005  , 0.54636, 2.18546, 0.13659, 0.68295, 2.86841,
       3.005  , 2.73182, 2.73182, 3.005  , 0.95614, 1.5025 , 2.32205, 1.77568, 3.14159,
       2.45864, 0.81955, 0.68295, 3.005  , 1.91227, 2.86841, 0.54636, 1.36591, 1.91227,
       1.63909, 0.54636, 0.95614, 2.73182, 0.68295, 1.36591, 2.18546, 3.14159])

In [251]:
importlib.reload(spf_tb)
show_tlabel = 0

for theta, phi in zip(np.array(ini_theta_list)[tlabels==show_tlabel][:10], 
                         np.array(ini_phi_list)[tlabels==show_tlabel][:10]): 
    spf_tb.show_pickle_results(job_dir, theta, phi, table_name, fast_mode=1)


-ini_theta 0.819546 -ini_phi 1.604218 -ini_psi 0.000000
-ini_theta 0.409773 -ini_phi 0.133685 -ini_psi 0.000000
-ini_theta 2.185456 -ini_phi 0.534739 -ini_psi 0.000000
-ini_theta 0.819546 -ini_phi 2.540011 -ini_psi 0.000000
-ini_theta 0.682955 -ini_phi 0.133685 -ini_psi 0.000000
-ini_theta 0.546364 -ini_phi 0.534739 -ini_psi 0.000000
-ini_theta 0.819546 -ini_phi 0.133685 -ini_psi 0.000000
-ini_theta 1.775683 -ini_phi 0.935794 -ini_psi 0.000000
-ini_theta 2.595229 -ini_phi 0.267370 -ini_psi 0.000000
-ini_theta 2.595229 -ini_phi 0.133685 -ini_psi 0.000000

In [241]:
importlib.reload(spf_tb)

for show_tlabel in np.arange(tlabels.max()+1): 
    theta = np.array(ini_theta_list)[tlabels==show_tlabel][0]
    phi = np.array(ini_phi_list)[tlabels==show_tlabel][0]
    spf_tb.show_pickle_results(job_dir, theta, phi, table_name, fast_mode=2)


-ini_theta 0.819546 -ini_phi 1.604218 -ini_psi 0.000000
-ini_theta 3.005002 -ini_phi 0.401054 -ini_psi 0.000000
-ini_theta 1.639092 -ini_phi 0.267370 -ini_psi 0.000000
-ini_theta 3.141592 -ini_phi 0.334212 -ini_psi 0.000000
-ini_theta 2.595229 -ini_phi 2.807381 -ini_psi 0.000000
-ini_theta 2.458638 -ini_phi 3.074750 -ini_psi 0.000000

In [ ]:
tlabels=