In [1]:
# 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 [2]:
fig = plt.figure(figsize=(2, 2))
fig.patch.set_facecolor('white')
ax0 = fig.add_subplot(1, 1, 1)



In [3]:
job_dir = 'ecoliB01_passive_a'
table_name = 'planeShearRatex_1d_passive'

In [21]:
# 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 = np.logical_and(tx > tmin, np.hstack((False, np.diff(tx) > 0)))
#     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 [22]:
# 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 [26]:
# 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 = np.hstack((np.diff(Table_t), 0))
    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 = np.logical_and(Table_t > tmin, np.hstack((False, np.diff(Table_t) > 0)))
    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)


remove folder /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/ecoliB01_passive_a/th_ph_fft
make folder /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/ecoliB01_passive_a/th_ph_fft
/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:13: TqdmDeprecationWarning: This function will be removed in tqdm==5.0.0
Please use `tqdm.notebook.tqdm` instead of `tqdm.tqdm_notebook`
  del sys.path[0]


In [30]:
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 = np.hstack((np.diff(Table_t), 0))
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
idx = Table_t > 0
# 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.712739
/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[30]:
True

In [28]:
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.026988 0.026976 0.026928 0.026951 0.026970 0.027001 0.026958 0.026971 0.026971 0.026921 0.026941 0.026941 0.026922 0.026931 0.026932 0.026935 0.026947 0.026977 0.026967 0.026959 0.026951 0.026978 0.026960 0.026966 0.026921 0.026974 0.026967 0.026938 0.026997 0.026973 0.026947 0.026985 0.026950 0.026984 0.026977 0.026914 0.027008 0.026929 0.026921 0.026979 0.026978 0.026942 0.026939 0.026990 0.026950 0.026990 0.026966 0.026941
0.137 0.026921 0.026922 0.026944 0.026972 0.026972 0.026958 0.026934 0.026971 0.026997 0.026941 0.026919 0.026932 0.027023 0.026965 0.026919 0.026947 0.026976 0.026955 0.026969 0.026960 0.027005 0.026982 0.026942 0.026964 0.026923 0.026952 0.026953 0.026998 0.026993 0.026999 0.026996 0.026959 0.026957 0.026930 0.026922 0.026938 0.026936 0.026939 0.026941 0.026987 0.026931 0.026990 0.027010 0.026915 0.026999 0.026970 0.026974 0.026924
0.273 0.027006 0.026949 0.026924 0.026939 0.026962 0.026914 0.026949 0.026949 0.026976 0.026927 0.027012 0.026982 0.026928 0.026971 0.027000 0.026979 0.026963 0.026933 0.026981 0.026990 0.026933 0.026942 0.026993 0.027008 0.026922 0.026949 0.026975 0.026934 0.026998 0.026974 0.026997 0.026932 0.026979 0.026917 0.026924 0.026960 0.026942 0.026940 0.026929 0.026961 0.026925 0.026956 0.026923 0.027007 0.026994 0.026915 0.026969 0.026941
0.410 0.026971 0.026949 0.026952 0.026941 0.026952 0.026957 0.026923 0.026934 0.026950 0.026981 0.026960 0.026940 0.026937 0.026952 0.026933 0.026926 0.026969 0.026982 0.026978 0.026979 0.026918 0.026959 0.026937 0.026949 0.026996 0.026936 0.026956 0.026929 0.026976 0.026945 0.027014 0.026958 0.026995 0.027005 0.026985 0.026921 0.026942 0.026946 0.026922 0.026920 0.026947 0.026965 0.026959 0.026917 0.026944 0.026975 0.026921 0.026945
0.546 0.026957 0.026946 0.026924 0.026973 0.026972 0.026971 0.026945 0.026925 0.026934 0.027001 0.026926 0.026971 0.026984 0.026946 0.026917 0.026963 0.027005 0.026938 0.026963 0.026970 0.026965 0.026915 0.026915 0.026947 0.026932 0.026974 0.026966 0.026981 0.026992 0.026948 0.026990 0.027018 0.026954 0.026991 0.026986 0.026935 0.026934 0.026954 0.027001 0.026922 0.026998 0.026945 0.026992 0.026923 0.026968 0.026980 0.026962 0.026927
0.683 0.026936 0.026969 0.026995 0.026971 0.026946 0.026965 0.026924 0.026962 0.026931 0.026985 0.026974 0.026992 0.026921 0.026919 0.026965 0.026953 0.027006 0.027006 0.026944 0.026940 0.026955 0.026930 0.026967 0.026933 0.026973 0.026958 0.026971 0.026944 0.026949 0.026917 0.026919 0.026983 0.026933 0.026953 0.026943 0.026994 0.026968 0.026915 0.026940 0.026984 0.026952 0.026980 0.026981 0.026932 0.026991 0.026987 0.026947 0.026996
0.820 0.026993 0.026964 0.026923 0.026956 0.026937 0.027000 0.026915 0.026973 0.026966 0.026996 0.026969 0.026950 0.026998 0.026957 0.026929 0.026980 0.026984 0.026963 0.027000 0.027019 0.026916 0.026939 0.027012 0.027009 0.026948 0.026944 0.026947 0.026951 0.026916 0.026956 0.026983 0.027001 0.026964 0.026944 0.026936 0.026937 0.027002 0.026925 0.026940 0.026959 0.026931 0.026982 0.026926 0.026960 0.026919 0.026989 0.026979 0.026983
0.956 0.026932 0.026954 0.026973 0.027000 0.026927 0.026968 0.026949 0.026986 0.026927 0.027019 0.026970 0.026943 0.026958 0.026976 0.026962 0.026945 0.026962 0.026915 0.026963 0.026964 0.026918 0.026920 0.026967 0.026954 0.027006 0.026974 0.026935 0.026920 0.026967 0.026985 0.026944 0.027008 0.026969 0.026992 0.026997 0.026964 0.026915 0.026952 0.026990 0.026960 0.026933 0.026945 0.026974 0.026930 0.026975 0.026981 0.026916 0.026925
1.093 0.026968 0.026973 0.026945 0.026983 0.026958 0.026967 0.026928 0.026987 0.027010 0.027001 0.026963 0.026977 0.026921 0.026962 0.026965 0.026960 0.026961 0.026937 0.026975 0.026953 0.026952 0.026960 0.026985 0.026941 0.026962 0.026955 0.026968 0.026946 0.026919 0.026915 0.026965 0.026967 0.026951 0.026938 0.026928 0.026953 0.026983 0.026941 0.027012 0.026924 0.026957 0.026935 0.026942 0.026930 0.026936 0.026952 0.026952 0.026954
1.229 0.027001 0.026919 0.026955 0.026924 0.026922 0.026960 0.026976 0.026996 0.026933 0.026954 0.026981 0.026952 0.026978 0.026966 0.027001 0.026942 0.026936 0.026944 0.026993 0.026989 0.026915 0.026967 0.026941 0.026956 0.026989 0.026959 0.026935 0.026974 0.027008 0.026951 0.026947 0.026928 0.026941 0.026969 0.026933 0.026935 0.027007 0.026946 0.026995 0.026942 0.026943 0.026938 0.027007 0.026977 0.026920 0.026929 0.026963 0.026967
1.366 0.026951 0.026990 0.026949 0.026957 0.026970 0.027003 0.027007 0.027008 0.026948 0.026990 0.026956 0.026975 0.026997 0.026942 0.026923 0.026939 0.026944 0.026945 0.026977 0.026918 0.026998 0.026998 0.026942 0.026981 0.026942 0.027007 0.026984 0.026926 0.026927 0.026932 0.026933 0.026937 0.027010 0.026968 0.026952 0.026978 0.026969 0.026992 0.026921 0.026974 0.026970 0.026918 0.026983 0.026997 0.027009 0.026951 0.026943 0.026967
1.503 0.026929 0.026965 0.026951 0.026952 0.026961 0.026975 0.026938 0.026923 0.026991 0.026953 0.026963 0.026973 0.026972 0.026943 0.026935 0.026932 0.026969 0.026923 0.026962 0.026930 0.026940 0.026941 0.026970 0.026933 0.026943 0.027007 0.026949 0.026920 0.026978 0.026930 0.026971 0.026972 0.026931 0.026949 0.026937 0.026976 0.026938 0.026955 0.026971 0.026929 0.026985 0.026977 0.026928 0.026945 0.026982 0.026979 0.026932 0.026939
1.639 0.026960 0.026966 0.026950 0.026930 0.026972 0.026932 0.026987 0.026978 0.026920 0.026962 0.026947 0.026970 0.026979 0.026921 0.026942 0.026928 0.026967 0.027001 0.026994 0.026955 0.026937 0.027007 0.026953 0.026974 0.026920 0.026963 0.026930 0.027002 0.026963 0.026931 0.026963 0.026984 0.026966 0.026928 0.026951 0.026945 0.026987 0.026988 0.026946 0.026948 0.026992 0.026995 0.026984 0.026984 0.026980 0.026969 0.026984 0.026959
1.776 0.026996 0.026943 0.026957 0.026916 0.027008 0.026966 0.026979 0.026984 0.026971 0.026992 0.026918 0.026956 0.026987 0.026964 0.026949 0.026936 0.026935 0.026961 0.026997 0.027022 0.026948 0.026975 0.026978 0.026932 0.027006 0.026953 0.026986 0.026974 0.026952 0.027000 0.026987 0.026958 0.026924 0.027009 0.026997 0.026929 0.026944 0.026959 0.026966 0.026995 0.026919 0.026980 0.026997 0.026972 0.026923 0.026931 0.026923 0.026964
1.912 0.026933 0.026942 0.026924 0.026961 0.026924 0.026990 0.026968 0.026973 0.026990 0.026972 0.026935 0.026983 0.026937 0.026962 0.026915 0.026964 0.026957 0.026988 0.026935 0.026953 0.026925 0.026980 0.026962 0.026934 0.026963 0.026931 0.026937 0.026979 0.026933 0.026947 0.026951 0.026937 0.026946 0.026958 0.026919 0.026979 0.026925 0.026942 0.026921 0.026983 0.026924 0.026922 0.026994 0.026972 0.026950 0.026974 0.026990 0.026919
2.049 0.026965 0.026985 0.026969 0.026920 0.026964 0.026921 0.026927 0.026986 0.026990 0.026974 0.026955 0.026938 0.026927 0.026917 0.026930 0.027003 0.026950 0.026920 0.026973 0.026926 0.027005 0.026925 0.026957 0.026994 0.026973 0.026966 0.027014 0.026918 0.026952 0.026969 0.026988 0.026984 0.026958 0.026980 0.026994 0.026936 0.026977 0.026925 0.026926 0.026987 0.026995 0.026964 0.026969 0.026961 0.026991 0.027010 0.026965 0.026967
2.185 0.026958 0.026918 0.026990 0.026980 0.026957 0.026934 0.026997 0.026983 0.026966 0.026966 0.026975 0.026950 0.027010 0.026928 0.026927 0.026935 0.026958 0.026915 0.026942 0.026939 0.026955 0.026945 0.026927 0.027017 0.026924 0.026940 0.026980 0.026960 0.026993 0.026982 0.026938 0.026979 0.027016 0.027002 0.026936 0.026966 0.026988 0.026934 0.026917 0.026942 0.026978 0.027015 0.026944 0.026956 0.026968 0.026918 0.026997 0.026958
2.322 0.026933 0.026918 0.026988 0.026934 0.026963 0.026969 0.026966 0.026920 0.026967 0.026979 0.026995 0.026972 0.026940 0.026917 0.026959 0.026984 0.026930 0.026975 0.026948 0.026949 0.027000 0.026977 0.027007 0.026925 0.026971 0.026939 0.026965 0.026974 0.026979 0.026964 0.026934 0.026975 0.026974 0.026987 0.026973 0.026952 0.026984 0.026932 0.026924 0.026958 0.026943 0.026982 0.026971 0.026919 0.026969 0.026923 0.026978 0.026930
2.459 0.026940 0.026916 0.026953 0.026998 0.026934 0.026954 0.026980 0.026988 0.026925 0.026940 0.026932 0.026929 0.026967 0.026947 0.026919 0.026989 0.026948 0.026938 0.026976 0.026918 0.026980 0.026965 0.026925 0.026987 0.026941 0.026966 0.026986 0.026940 0.026976 0.026943 0.026981 0.026962 0.026978 0.026962 0.026952 0.026958 0.026952 0.026922 0.026971 0.026967 0.026938 0.026919 0.026925 0.026974 0.026968 0.027002 0.026976 0.026997
2.595 0.026974 0.026975 0.026975 0.026991 0.026984 0.026965 0.026979 0.026973 0.026930 0.026971 0.027000 0.026994 0.026917 0.026948 0.026979 0.026995 0.026940 0.026965 0.026973 0.026992 0.026951 0.026947 0.026944 0.026932 0.026967 0.026934 0.026963 0.026936 0.026921 0.026975 0.026916 0.026923 0.026925 0.026973 0.026964 0.026977 0.027000 0.026957 0.026937 0.026921 0.026935 0.026938 0.026955 0.026925 0.026968 0.026942 0.026963 0.026990
2.732 0.026934 0.026946 0.026961 0.026957 0.026946 0.027007 0.026955 0.026918 0.026943 0.026915 0.026991 0.026963 0.026951 0.026957 0.027006 0.026924 0.026959 0.026971 0.026950 0.026933 0.026946 0.026952 0.026961 0.026947 0.026917 0.026949 0.026960 0.027013 0.026952 0.026925 0.026998 0.026963 0.026941 0.027012 0.026945 0.026999 0.026916 0.026983 0.026996 0.026991 0.026979 0.026950 0.026990 0.026959 0.026979 0.026981 0.026973 0.026917
2.868 0.026939 0.026916 0.026996 0.027006 0.026935 0.026975 0.026959 0.026971 0.026918 0.026995 0.027015 0.026984 0.026984 0.026984 0.026945 0.026989 0.027006 0.026998 0.027009 0.026939 0.026975 0.026969 0.026915 0.026925 0.026937 0.026932 0.026962 0.026942 0.026941 0.026918 0.026974 0.026950 0.026949 0.026918 0.026995 0.026979 0.027005 0.026950 0.026965 0.026961 0.026971 0.026928 0.026917 0.026975 0.027014 0.026968 0.026945 0.026978
3.005 0.026963 0.026937 0.026962 0.027003 0.026974 0.026941 0.026928 0.026980 0.026960 0.026936 0.026949 0.026930 0.026919 0.026996 0.026939 0.026974 0.026945 0.026990 0.026988 0.026931 0.026924 0.026932 0.026943 0.026997 0.026967 0.026947 0.026937 0.026942 0.026983 0.026966 0.027006 0.026951 0.026948 0.026914 0.026956 0.026922 0.026944 0.026933 0.026995 0.026978 0.026944 0.026926 0.026972 0.026925 0.026971 0.027004 0.026986 0.026984
3.142 0.026962 0.027002 0.026973 0.027012 0.026930 0.026999 0.026953 0.026923 0.026998 0.026951 0.026941 0.026959 0.026951 0.026939 0.026921 0.026946 0.026941 0.026937 0.026916 0.026952 0.026932 0.026984 0.026935 0.027000 0.026944 0.026946 0.026991 0.026960 0.026944 0.027016 0.026944 0.026921 0.026929 0.026967 0.026928 0.026988 0.027019 0.026963 0.026953 0.026968 0.026981 0.026983 0.026924 0.026970 0.026993 0.026986 0.026936 0.026968

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


[0.0270232562 0.0270219094 0.0270194183 0.0270187828 0.0270186344 0.0270179247
 0.0270165814 0.0270161332 0.0270155703 0.0270147201 0.0270147155 0.0270143824
 0.0270142611 0.0270136931 0.0270128784 0.0270123461 0.0270120347 0.0270119916
 0.0270119219 0.0270118482 0.0270103245 0.027010158  0.0270098178 0.0270097894
 0.0270095559 0.0270091332 0.0270090978 0.0270086579 0.0270086341 0.027008336
 0.0270080029 0.0270077477 0.0270077378 0.0270075528 0.0270075462 0.0270073103
 0.0270072842 0.027006982  0.0270069669 0.027006764  0.0270066716 0.0270065846
 0.0270065784 0.027006554  0.0270064859 0.0270063554 0.0270063197 0.0270061224
 0.0270061159 0.0270061141 0.0270060643 0.0270060454 0.0270056824 0.0270054198
 0.0270052907 0.0270051655 0.027005039  0.0270050018 0.0270037058 0.0270033407
 0.0270027661 0.0270027006 0.0270021706 0.0270021287 0.0270021146 0.0270020311
 0.027001998  0.0270014225 0.0270013277 0.0270013099 0.0270011657 0.0270009481
 0.0270009372 0.0270007705 0.0270006488 0.0270004728 0.0270003159 0.0270001859
 0.0269999757 0.0269999319 0.026999926  0.0269999154 0.0269997906 0.0269997398
 0.0269993522 0.0269989432 0.0269986635 0.0269985345 0.0269984904 0.0269983611
 0.0269983565 0.0269983375 0.0269979613 0.0269979295 0.026997796  0.0269977693
 0.0269976898 0.0269975658 0.0269974299 0.0269973501 0.0269973147 0.02699724
 0.0269971732 0.0269970519 0.0269969827 0.026996947  0.0269969377 0.026996758
 0.0269967539 0.0269967244 0.0269966337 0.0269964232 0.026996351  0.0269963297
 0.0269961206 0.0269960446 0.0269959441 0.0269957106 0.0269956467 0.0269955829
 0.0269954072 0.0269953334 0.0269953119 0.026995251  0.0269951993 0.026995062
 0.0269950294 0.0269949605 0.0269947046 0.026994694  0.0269946018 0.026994479
 0.0269943984 0.0269940457 0.0269938596 0.0269937901 0.0269936359 0.0269935299
 0.026993405  0.0269931628 0.0269929698 0.0269929068 0.02699276   0.026992538
 0.0269923603 0.0269922231 0.0269921408 0.0269920453 0.0269920015 0.0269918448
 0.0269918186 0.0269917169 0.0269914958 0.0269914367 0.0269913932 0.026991354
 0.0269913348 0.0269912281 0.026990713  0.0269905894 0.0269904294 0.0269903945
 0.0269903622 0.0269903334 0.0269902652 0.0269901783 0.0269901367 0.0269901267
 0.0269900897 0.0269899976 0.0269899107 0.0269898752 0.0269898322 0.0269896852
 0.0269896205 0.0269895921 0.0269894754 0.0269893255 0.0269892898 0.0269891573
 0.0269888728 0.0269881025 0.0269880072 0.0269880028 0.0269879641 0.0269878472
 0.0269878454 0.0269878391 0.0269878248 0.026987615  0.0269873193 0.0269870942
 0.0269870794 0.0269870189 0.026986896  0.0269868692 0.0269868277 0.0269868238
 0.0269866933 0.0269865095 0.0269863671 0.0269860788 0.0269860508 0.0269859711
 0.0269858433 0.0269856621 0.0269856507 0.0269853916 0.0269853785 0.0269851632
 0.0269849016 0.0269848989 0.0269847026 0.0269845277 0.0269844773 0.026984465
 0.0269843348 0.0269842031 0.026984095  0.0269840567 0.0269840386 0.0269838723
 0.0269838573 0.0269838402 0.0269838298 0.0269837794 0.0269837489 0.0269836829
 0.0269836638 0.026983589  0.0269835887 0.026983569  0.0269835563 0.0269834312
 0.0269833723 0.0269831772 0.0269831749 0.0269830706 0.0269829002 0.0269828919
 0.0269828513 0.0269828103 0.0269825636 0.0269825607 0.0269825485 0.0269820491
 0.026982009  0.0269819791 0.0269819005 0.026981784  0.0269816109 0.0269815692
 0.0269814464 0.0269813062 0.0269812777 0.0269812231 0.0269811386 0.0269811002
 0.0269808796 0.0269808627 0.026980749  0.0269805576 0.0269804233 0.0269803498
 0.026980205  0.0269800094 0.0269799644 0.0269799595 0.026979918  0.0269797398
 0.026979664  0.0269796112 0.0269796062 0.0269795742 0.0269794748 0.0269794561
 0.0269793929 0.0269793501 0.0269792889 0.0269792673 0.0269792639 0.0269792264
 0.0269792225 0.0269791107 0.0269789183 0.0269789143 0.0269788419 0.0269787837
 0.026978783  0.0269787352 0.026978695  0.0269785419 0.0269783603 0.026978277
 0.0269782226 0.0269782116 0.0269781908 0.0269780003 0.0269778884 0.0269778858
 0.0269778851 0.0269778819 0.0269778233 0.0269778147 0.0269775244 0.0269772915
 0.0269772684 0.0269770461 0.0269769667 0.0269768538 0.0269766887 0.0269766506
 0.0269766442 0.0269765611 0.0269764838 0.0269764713 0.0269764439 0.0269764223
 0.0269763142 0.0269760466 0.0269760345 0.0269760332 0.0269757674 0.0269755696
 0.0269754089 0.0269751933 0.0269750659 0.0269750373 0.0269749867 0.0269749536
 0.0269748821 0.0269748562 0.0269748361 0.0269747949 0.0269747597 0.0269747087
 0.0269746525 0.0269746512 0.0269746206 0.026974548  0.0269744973 0.0269744817
 0.0269744765 0.0269743696 0.026974366  0.0269743475 0.0269743458 0.0269742733
 0.0269741172 0.0269739942 0.0269739917 0.0269739071 0.0269738583 0.0269737691
 0.0269735963 0.0269735854 0.026973581  0.0269735677 0.0269735054 0.0269735045
 0.0269734123 0.0269733954 0.0269733944 0.026973363  0.0269733476 0.0269732825
 0.0269732209 0.0269730719 0.0269729969 0.0269729817 0.0269729466 0.0269728756
 0.0269727763 0.0269727387 0.0269726708 0.0269726375 0.0269724999 0.0269724863
 0.0269724771 0.0269724063 0.026972302  0.0269722312 0.026972225  0.0269721702
 0.0269719253 0.0269719033 0.0269718324 0.0269714718 0.0269714652 0.0269714045
 0.0269712602 0.0269711412 0.026971101  0.0269710758 0.0269710571 0.0269709545
 0.0269709186 0.0269708865 0.0269708677 0.026970824  0.0269707282 0.0269707275
 0.0269707197 0.0269707017 0.0269706995 0.0269706714 0.026970586  0.0269702918
 0.0269702498 0.0269701134 0.0269700511 0.026970011  0.0269699815 0.0269698778
 0.0269697732 0.026969524  0.0269694781 0.0269693395 0.0269693122 0.0269692732
 0.0269691759 0.0269691474 0.0269691327 0.0269690512 0.0269689957 0.0269689137
 0.0269689117 0.0269688829 0.0269688788 0.0269688699 0.0269688448 0.0269687813
 0.0269682429 0.0269681045 0.0269680284 0.0269680158 0.0269679654 0.0269679631
 0.0269679285 0.0269678918 0.0269677964 0.0269677795 0.0269677616 0.0269676094
 0.026967606  0.0269674355 0.0269674351 0.0269674327 0.0269673903 0.0269673465
 0.0269671725 0.0269671723 0.0269671472 0.0269670755 0.0269670693 0.0269670507
 0.0269670445 0.0269669869 0.0269669196 0.0269668247 0.0269667381 0.0269666357
 0.0269666274 0.0269664282 0.0269663295 0.0269662513 0.0269662507 0.0269661513
 0.0269661403 0.026965998  0.0269659946 0.0269659569 0.0269659301 0.0269657824
 0.0269657195 0.0269656966 0.0269656961 0.0269656657 0.0269656554 0.0269654873
 0.0269654733 0.0269654035 0.0269652392 0.0269652293 0.0269652275 0.0269652077
 0.026965191  0.0269651133 0.0269650386 0.0269648179 0.0269647942 0.0269645469
 0.0269645185 0.0269645157 0.0269644782 0.0269643625 0.0269643374 0.0269642287
 0.0269642169 0.0269641613 0.026964145  0.0269639635 0.0269638722 0.0269638408
 0.0269637562 0.0269635679 0.0269634178 0.026963312  0.0269632907 0.0269631905
 0.02696318   0.0269631517 0.0269631311 0.0269630403 0.0269629015 0.0269628564
 0.0269628476 0.0269628336 0.0269628215 0.0269627985 0.0269627919 0.0269626353
 0.0269626249 0.0269625799 0.0269625556 0.0269624448 0.0269624288 0.0269624208
 0.026962253  0.0269621591 0.0269621224 0.0269620049 0.0269619469 0.0269618708
 0.026961829  0.0269618133 0.0269617578 0.0269616532 0.0269616201 0.0269615755
 0.0269615216 0.0269612169 0.0269610524 0.0269610353 0.0269610231 0.0269610141
 0.026960876  0.0269606762 0.0269606399 0.0269606096 0.0269603113 0.0269603023
 0.0269602657 0.0269601899 0.0269601248 0.0269600175 0.0269599741 0.0269599217
 0.0269598802 0.0269598543 0.0269598002 0.0269597742 0.026959766  0.0269595044
 0.0269594799 0.0269594725 0.0269592399 0.0269591815 0.0269590462 0.0269590462
 0.0269590433 0.0269590068 0.0269589809 0.0269589549 0.0269589424 0.026958686
 0.0269585975 0.0269584995 0.026958359  0.0269582232 0.026958209  0.026958143
 0.0269581045 0.0269578745 0.0269578205 0.0269578181 0.026957756  0.0269577347
 0.0269576093 0.0269576083 0.0269575109 0.0269574177 0.0269573521 0.0269573054
 0.0269571347 0.0269570733 0.0269570146 0.0269569013 0.0269568997 0.0269568798
 0.0269567731 0.0269566234 0.0269566021 0.0269565589 0.0269563655 0.0269563073
 0.0269563061 0.0269560887 0.0269559338 0.026955778  0.0269557234 0.0269556689
 0.0269555115 0.0269554961 0.0269554306 0.0269553403 0.0269550533 0.0269550264
 0.0269549711 0.0269549579 0.0269547355 0.0269545511 0.0269545288 0.0269542232
 0.0269542034 0.0269539631 0.0269538235 0.0269536919 0.0269536738 0.0269535756
 0.0269533941 0.0269531805 0.0269530129 0.0269529837 0.0269529629 0.0269529581
 0.0269528805 0.026952612  0.026952592  0.0269525853 0.0269525768 0.0269525575
 0.0269524748 0.0269524473 0.0269524092 0.0269523799 0.0269523556 0.02695231
 0.0269522041 0.0269521907 0.0269520375 0.0269520285 0.0269520215 0.0269519924
 0.0269519297 0.0269519198 0.0269518706 0.0269517738 0.0269516583 0.0269515477
 0.0269515158 0.0269515024 0.0269514989 0.0269514691 0.0269514206 0.026951387
 0.0269513802 0.0269512762 0.026951243  0.0269511506 0.0269511401 0.0269510495
 0.0269509365 0.0269508458 0.0269508027 0.0269507465 0.0269507357 0.0269504983
 0.0269504828 0.0269504355 0.026950274  0.0269502565 0.0269502507 0.0269501708
 0.0269499493 0.0269498697 0.0269498051 0.0269496079 0.02694951   0.0269494896
 0.0269494835 0.0269494643 0.0269493377 0.0269491842 0.0269490199 0.0269489581
 0.0269489576 0.0269489211 0.0269488563 0.0269488359 0.0269488108 0.0269488048
 0.0269487674 0.0269486385 0.0269485794 0.0269483206 0.0269482773 0.0269482555
 0.026948105  0.0269480844 0.0269480554 0.0269478981 0.0269478362 0.0269475261
 0.0269474977 0.0269474887 0.0269472884 0.0269471803 0.02694693   0.0269468753
 0.0269467812 0.0269467218 0.0269467162 0.0269467144 0.026946622  0.0269466206
 0.0269465425 0.0269465267 0.0269464157 0.0269463291 0.0269463049 0.0269462658
 0.0269461489 0.0269461361 0.0269460513 0.026945936  0.0269457226 0.0269457138
 0.0269456534 0.0269456125 0.0269455498 0.026945497  0.0269454783 0.026945345
 0.0269452868 0.0269452518 0.0269452002 0.0269451978 0.0269450968 0.0269450194
 0.0269449874 0.0269449027 0.0269448729 0.0269448368 0.0269446928 0.02694454
 0.0269444981 0.026944322  0.0269441712 0.0269441416 0.0269441294 0.0269440953
 0.0269440469 0.0269440446 0.0269439082 0.0269438617 0.0269437956 0.0269437638
 0.0269436926 0.0269436796 0.0269435619 0.0269435563 0.0269435433 0.026943477
 0.0269433582 0.026942935  0.0269428837 0.026942883  0.026942837  0.0269427775
 0.0269427213 0.026942689  0.026942648  0.0269425551 0.026942371  0.0269423708
 0.0269422875 0.0269422848 0.0269422283 0.0269422254 0.0269421952 0.0269421085
 0.02694204   0.0269420308 0.0269419413 0.0269419203 0.0269418602 0.0269418219
 0.0269418181 0.0269418139 0.0269416774 0.0269416663 0.0269416453 0.0269414031
 0.0269412455 0.0269412207 0.026941094  0.0269410702 0.0269410628 0.0269409012
 0.02694087   0.0269408383 0.0269408212 0.026940818  0.0269407892 0.0269407758
 0.0269407357 0.0269406647 0.0269406629 0.0269406553 0.0269406472 0.0269404733
 0.02694047   0.0269404287 0.0269402878 0.02694023   0.0269400927 0.0269399677
 0.0269399635 0.0269399586 0.0269398981 0.0269397367 0.0269395565 0.0269394871
 0.0269392873 0.0269391977 0.026939176  0.0269390614 0.0269390362 0.0269387716
 0.0269387683 0.0269385759 0.0269385538 0.0269385265 0.0269385222 0.026938453
 0.0269383271 0.026938259  0.0269382472 0.026938149  0.0269381462 0.0269381384
 0.0269378778 0.0269377163 0.0269377041 0.0269376849 0.0269375178 0.0269374055
 0.026937346  0.0269373349 0.0269372755 0.0269372075 0.0269371211 0.0269370014
 0.0269369712 0.0269369338 0.0269368777 0.0269368471 0.0269367841 0.0269366148
 0.0269366092 0.0269365833 0.0269365448 0.0269364652 0.0269363013 0.0269362295
 0.0269362219 0.0269360884 0.026936061  0.0269360495 0.026935962  0.0269355918
 0.0269355755 0.0269355601 0.0269355103 0.0269354889 0.0269354336 0.0269354011
 0.0269353828 0.0269352269 0.026935202  0.0269351601 0.0269351076 0.0269350149
 0.0269350133 0.0269347194 0.026934659  0.026934593  0.0269345097 0.0269344866
 0.0269344047 0.0269343114 0.0269341153 0.0269340061 0.0269338163 0.0269337511
 0.0269337268 0.0269336764 0.0269335784 0.0269335778 0.0269335578 0.0269335163
 0.0269332535 0.0269332448 0.0269331522 0.0269330245 0.0269329013 0.0269328893
 0.0269328331 0.0269328007 0.0269327872 0.0269327694 0.0269327638 0.0269327095
 0.0269326751 0.0269326435 0.0269325917 0.0269324641 0.0269323979 0.0269323254
 0.026932242  0.0269322225 0.0269321544 0.0269320251 0.0269320044 0.0269319644
 0.0269318678 0.026931767  0.0269316945 0.026931689  0.0269316454 0.0269316116
 0.0269315881 0.0269315413 0.026931415  0.0269313073 0.0269312757 0.0269312312
 0.0269310826 0.0269309624 0.0269306619 0.0269306565 0.0269306131 0.0269304827
 0.0269303697 0.0269302693 0.0269302137 0.026930157  0.0269301187 0.0269300938
 0.0269300851 0.0269300846 0.0269299352 0.0269299104 0.0269298481 0.0269297366
 0.0269297102 0.0269294953 0.0269294789 0.0269294228 0.0269292734 0.0269292642
 0.0269292131 0.0269291573 0.0269290574 0.0269290397 0.0269287835 0.0269284032
 0.0269283778 0.0269281664 0.0269280413 0.0269280302 0.0269280234 0.0269279458
 0.0269277467 0.0269277283 0.0269275974 0.026927554  0.0269275046 0.0269273577
 0.0269273085 0.0269271384 0.0269269818 0.026926921  0.0269267941 0.0269267781
 0.0269266507 0.0269265479 0.0269264566 0.0269259795 0.026925962  0.0269258169
 0.0269256935 0.0269256023 0.0269255461 0.0269254706 0.0269253838 0.0269253304
 0.0269252584 0.0269252581 0.0269252498 0.0269250817 0.0269250671 0.026924992
 0.0269249692 0.0269248522 0.0269248285 0.0269248216 0.0269247465 0.026924674
 0.0269246316 0.0269246051 0.0269244642 0.0269244476 0.0269243736 0.0269243085
 0.0269242684 0.0269242104 0.0269242004 0.0269241107 0.0269240077 0.0269239701
 0.0269237873 0.0269237827 0.0269237653 0.0269237235 0.0269236476 0.0269235195
 0.026923376  0.0269233591 0.0269233154 0.0269232822 0.0269231082 0.0269230149
 0.0269229804 0.0269228985 0.0269228511 0.0269227557 0.0269226575 0.0269225965
 0.0269225477 0.0269224614 0.02692232   0.0269221935 0.0269221298 0.0269220405
 0.0269219413 0.0269217147 0.0269216675 0.0269215931 0.0269215368 0.0269214368
 0.0269213154 0.0269213141 0.0269212336 0.0269212322 0.0269210937 0.0269210765
 0.0269210724 0.0269209882 0.0269207268 0.0269207111 0.0269206269 0.0269206165
 0.0269206019 0.0269205434 0.0269205377 0.0269203871 0.0269203118 0.0269202443
 0.0269202306 0.0269200205 0.0269199783 0.0269199556 0.0269198953 0.0269198083
 0.0269196417 0.0269194878 0.0269194472 0.0269193269 0.0269192152 0.0269190856
 0.0269190109 0.0269190025 0.0269188818 0.0269188448 0.0269186643 0.0269186201
 0.0269185741 0.0269185662 0.0269185533 0.0269184871 0.026918217  0.0269181398
 0.0269181129 0.0269181029 0.0269180819 0.0269179661 0.0269179135 0.026917844
 0.0269177923 0.0269176751 0.0269176559 0.0269176073 0.0269175221 0.0269174286
 0.0269172919 0.0269172505 0.0269172386 0.0269171211 0.0269170582 0.0269168698
 0.0269168455 0.0269167748 0.0269166645 0.026916612  0.0269164199 0.0269163713
 0.0269161991 0.0269161723 0.0269160715 0.0269160523 0.0269158839 0.0269158288
 0.0269157621 0.0269154606 0.026915416  0.0269153141 0.0269152426 0.0269151034
 0.0269149751 0.0269149743 0.0269149471 0.026914947  0.0269149434 0.0269148701
 0.026914849  0.0269145652 0.0269145608 0.0269144437 0.0269141165 0.0269137457]

In [10]:
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[10]:
True

In [ ]:
# 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

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=