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 = 'ecoC01B05_T0.25_psi-0a'
table_name = 'ecoC01B05_tao1_wm0.25'

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


make folder /home/zhangji/stokes_flow_master/head_Force/do_calculate_table/ecoC01B05_T0.25_psi-0a/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 [6]:
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[6]:
True

In [7]:
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.018999 0.019000 0.019000 0.019000 0.018999 0.018999 0.018999 0.019000 0.019000 0.018999 0.019000 0.018999 0.020000 0.020000 0.019999 0.020036 0.020001 0.020000 0.019999 0.020064 0.020000 0.020000 0.019999 0.020000 0.019999 0.020000 0.020001 0.020001 0.020000 0.020000 0.020001 0.020001 0.020000 0.020001 0.020000 0.019999 0.019001 0.019000 0.019000 0.019000 0.019000 0.018999 0.018999 0.019000 0.019000 0.019000 0.018999 0.019000
0.137 0.019000 0.018999 0.019000 0.018999 0.018999 0.020000 0.019999 0.020001 0.019999 0.018999 0.018999 0.019001 0.019001 0.018999 0.018999 0.014999 0.015001 0.015000 0.014999 0.018999 0.019000 0.014999 0.018999 0.019999 0.018999 0.019000 0.014999 0.014999 0.015000 0.014999 0.014999 0.014999 0.015000 0.014999 0.015000 0.014999 0.019001 0.018999 0.019000 0.020000 0.019000 0.019000 0.018999 0.016999 0.018999 0.019665 0.019000 0.018999
0.273 0.020000 0.020103 0.019368 0.019999 0.019001 0.019000 0.019000 0.018999 0.018999 0.018999 0.020076 0.018999 0.014999 0.015000 0.014999 0.015001 0.015000 0.014999 0.015002 0.019999 0.018999 0.018999 0.018999 0.019000 0.019000 0.014999 0.014999 0.015001 0.015000 0.014999 0.015000 0.014999 0.014999 0.015000 0.014999 0.015001 0.014999 0.015000 0.015001 0.019000 0.019470 0.019001 0.019385 0.016999 0.018999 0.019000 0.018999 0.019999
0.410 0.018999 0.020001 0.019000 0.018999 0.019000 0.019000 0.018999 0.020000 0.018999 0.015000 0.015001 0.015001 0.015001 0.015001 0.015000 0.015000 0.014999 0.014999 0.020000 0.019000 0.018999 0.020000 0.020001 0.018999 0.019000 0.015000 0.015000 0.014999 0.015001 0.014999 0.014999 0.015001 0.014999 0.015001 0.014999 0.014999 0.015001 0.015001 0.014999 0.014999 0.018999 0.018999 0.018999 0.017000 0.019001 0.020000 0.019000 0.019001
0.546 0.019000 0.019999 0.019000 0.019001 0.018999 0.018999 0.014998 0.014999 0.015000 0.015000 0.015000 0.014999 0.015001 0.015000 0.014999 0.014999 0.015000 0.019000 0.018999 0.019999 0.016999 0.019002 0.015000 0.019000 0.019999 0.014999 0.014999 0.015000 0.015001 0.015000 0.014999 0.014999 0.014999 0.015000 0.014999 0.015000 0.015001 0.014999 0.014999 0.014999 0.014999 0.019002 0.019000 0.017002 0.016999 0.019999 0.019000 0.019000
0.683 0.018999 0.019000 0.019001 0.018999 0.018999 0.014999 0.015001 0.015000 0.014999 0.015003 0.015000 0.014998 0.014999 0.015001 0.019001 0.018999 0.019619 0.020000 0.018999 0.018999 0.019000 0.019000 0.014999 0.019001 0.018999 0.014999 0.015001 0.015000 0.015001 0.014999 0.014998 0.014999 0.015001 0.014999 0.015000 0.015001 0.015000 0.015000 0.015001 0.015000 0.015001 0.014999 0.019000 0.018999 0.016999 0.018999 0.018999 0.019000
0.820 0.018999 0.018999 0.018999 0.019000 0.015001 0.014999 0.015000 0.015000 0.015000 0.014999 0.015000 0.018999 0.019000 0.019000 0.019000 0.019000 0.014999 0.019000 0.020000 0.017001 0.018999 0.019000 0.015000 0.019000 0.018999 0.015000 0.015002 0.015001 0.014999 0.014999 0.014999 0.015000 0.015000 0.014999 0.014999 0.015001 0.014999 0.015001 0.015002 0.015001 0.015000 0.015001 0.018999 0.019000 0.018999 0.019586 0.018999 0.018999
0.956 0.019002 0.018999 0.018999 0.014999 0.014999 0.019000 0.015000 0.014999 0.014999 0.014998 0.014999 0.015001 0.020000 0.019002 0.017001 0.018999 0.020000 0.014999 0.014999 0.018999 0.014999 0.017000 0.014999 0.019001 0.018999 0.015000 0.015000 0.014999 0.014999 0.014999 0.014999 0.014999 0.014999 0.014999 0.014999 0.015000 0.014999 0.015002 0.015002 0.014999 0.015002 0.014999 0.014999 0.019437 0.020000 0.016998 0.018999 0.019001
1.093 0.019510 0.019000 0.015000 0.014999 0.019000 0.015000 0.014999 0.014999 0.015000 0.019848 0.017000 0.018999 0.018999 0.018999 0.019999 0.018999 0.016999 0.017002 0.015000 0.019001 0.019000 0.018999 0.018999 0.018999 0.018999 0.015000 0.014999 0.014999 0.014999 0.014999 0.015000 0.014999 0.015000 0.015001 0.015000 0.014999 0.015001 0.015000 0.015001 0.014999 0.018999 0.018999 0.014999 0.014999 0.019000 0.017001 0.019000 0.020000
1.229 0.019000 0.014999 0.015000 0.019389 0.015000 0.014999 0.018999 0.017002 0.019999 0.014999 0.019001 0.020269 0.015000 0.018999 0.017000 0.018999 0.018999 0.018999 0.018999 0.014999 0.018999 0.017001 0.019001 0.020000 0.015000 0.015001 0.014999 0.014999 0.015000 0.015001 0.015002 0.014999 0.015000 0.014999 0.014999 0.014999 0.015000 0.015000 0.019000 0.020178 0.018999 0.019002 0.020241 0.018999 0.019000 0.018999 0.017000 0.018999
1.366 0.019000 0.018999 0.020203 0.019442 0.018999 0.019000 0.018999 0.020000 0.019999 0.019000 0.019999 0.020015 0.020001 0.019002 0.018999 0.014999 0.019000 0.019001 0.015000 0.018999 0.014999 0.020239 0.018999 0.018999 0.014999 0.015000 0.014999 0.015002 0.015000 0.014999 0.015000 0.018999 0.019000 0.020000 0.018999 0.018999 0.019000 0.020126 0.020357 0.018999 0.018999 0.019000 0.019001 0.019000 0.018999 0.018999 0.017002 0.019000
1.503 0.019000 0.015002 0.020000 0.019001 0.020000 0.019000 0.020070 0.016999 0.020001 0.018999 0.014999 0.015000 0.018999 0.019001 0.014999 0.019000 0.014999 0.019000 0.019000 0.019000 0.020000 0.019000 0.018999 0.019000 0.015001 0.015000 0.014999 0.019999 0.018999 0.019000 0.018999 0.018999 0.020138 0.019999 0.019999 0.020174 0.020148 0.019925 0.019856 0.019818 0.019000 0.019000 0.018999 0.018999 0.019512 0.019999 0.019497 0.019000
1.639 0.018999 0.020372 0.018999 0.015000 0.020000 0.014999 0.019999 0.019000 0.018999 0.020000 0.020000 0.019000 0.016999 0.015001 0.019000 0.014999 0.019000 0.014999 0.018999 0.014999 0.020000 0.018999 0.015000 0.019000 0.014999 0.015000 0.019000 0.019999 0.018999 0.018999 0.018999 0.020000 0.020304 0.019999 0.020000 0.019425 0.019574 0.020000 0.019490 0.019999 0.018999 0.018999 0.019000 0.018999 0.018999 0.018999 0.016998 0.018999
1.776 0.020350 0.014999 0.018999 0.018999 0.017001 0.015001 0.017000 0.019000 0.018999 0.014999 0.014999 0.018999 0.016999 0.014999 0.018999 0.015001 0.020000 0.019999 0.014999 0.019000 0.014999 0.015002 0.017000 0.018999 0.018999 0.015001 0.018999 0.018999 0.019000 0.018999 0.019001 0.018999 0.019001 0.019999 0.020000 0.019000 0.019000 0.018999 0.019000 0.019001 0.018999 0.020366 0.017001 0.016999 0.017000 0.016998 0.017000 0.020091
1.912 0.020270 0.014999 0.019722 0.019001 0.016999 0.016999 0.020001 0.014999 0.014999 0.020001 0.019000 0.015000 0.018999 0.014999 0.017001 0.015000 0.018999 0.014999 0.014999 0.018999 0.016999 0.020000 0.018999 0.014999 0.018999 0.014999 0.018999 0.019000 0.016999 0.019001 0.019000 0.019001 0.019000 0.019000 0.016999 0.016999 0.017000 0.016999 0.017001 0.016999 0.017001 0.016999 0.016999 0.017000 0.017000 0.017001 0.017000 0.020140
2.049 0.020332 0.014999 0.014999 0.019000 0.015000 0.019999 0.018999 0.018999 0.016999 0.019000 0.017000 0.014999 0.015000 0.020256 0.019002 0.014999 0.018999 0.019000 0.016999 0.020000 0.019000 0.015001 0.018999 0.018999 0.014999 0.019000 0.014999 0.018999 0.018999 0.016998 0.017001 0.017000 0.016999 0.016999 0.017001 0.017002 0.017003 0.017001 0.016999 0.017001 0.017001 0.017001 0.017000 0.016998 0.017002 0.016999 0.016998 0.020000
2.185 0.020000 0.018999 0.014999 0.019000 0.019000 0.015000 0.015001 0.014999 0.014999 0.019000 0.018999 0.014999 0.014999 0.019000 0.019000 0.019999 0.017001 0.016999 0.020002 0.019000 0.019000 0.019400 0.020181 0.019000 0.015002 0.019915 0.014999 0.019000 0.019001 0.018999 0.019605 0.016999 0.017001 0.016999 0.017002 0.017000 0.016999 0.017002 0.017000 0.017001 0.016999 0.016999 0.017001 0.019999 0.019000 0.018999 0.017001 0.020136
2.322 0.020000 0.020000 0.014999 0.014999 0.014999 0.014999 0.014999 0.015000 0.018999 0.019999 0.019000 0.020000 0.019999 0.019000 0.016999 0.016999 0.019999 0.018999 0.018999 0.018999 0.020163 0.018999 0.019520 0.019999 0.014999 0.015000 0.018999 0.015002 0.018999 0.019000 0.018999 0.018999 0.019999 0.016999 0.016999 0.016999 0.016999 0.016999 0.016999 0.017000 0.019000 0.019000 0.019789 0.019000 0.018999 0.020213 0.017001 0.019999
2.459 0.018999 0.019000 0.015001 0.014999 0.015001 0.019000 0.018999 0.019000 0.019000 0.020000 0.018999 0.020000 0.016999 0.017000 0.018999 0.019000 0.019001 0.018999 0.020000 0.019671 0.019000 0.019000 0.020153 0.020001 0.018999 0.015002 0.018999 0.014999 0.019000 0.019000 0.019000 0.018999 0.018999 0.019000 0.018999 0.019460 0.018999 0.018999 0.019000 0.018999 0.020000 0.019000 0.020026 0.018999 0.019000 0.018999 0.017002 0.019000
2.595 0.019000 0.019001 0.014999 0.014999 0.015001 0.018999 0.020360 0.019001 0.018999 0.017000 0.017000 0.020000 0.018999 0.019999 0.018999 0.019000 0.019999 0.019491 0.018999 0.020175 0.019000 0.020159 0.018999 0.018999 0.018999 0.015001 0.020031 0.014999 0.014999 0.018999 0.018999 0.020113 0.018999 0.019000 0.019999 0.018999 0.020026 0.018999 0.019001 0.018999 0.019001 0.019000 0.019000 0.019554 0.018999 0.016999 0.017000 0.018999
2.732 0.018999 0.019001 0.019000 0.015001 0.019001 0.018999 0.017000 0.018999 0.017000 0.020000 0.019000 0.019001 0.019000 0.020000 0.018999 0.018999 0.019999 0.019000 0.019999 0.018999 0.019377 0.019000 0.019413 0.019000 0.019000 0.015000 0.018999 0.018999 0.015001 0.018999 0.020000 0.019000 0.019000 0.020121 0.018999 0.018999 0.020301 0.020065 0.019000 0.018999 0.020070 0.019999 0.019000 0.019568 0.018999 0.016999 0.018999 0.019000
2.868 0.019000 0.018999 0.018999 0.014999 0.019000 0.016999 0.019000 0.017000 0.019721 0.019642 0.019999 0.019000 0.019000 0.019999 0.018999 0.018999 0.018999 0.019000 0.020155 0.018999 0.018999 0.019463 0.019000 0.018999 0.020370 0.014999 0.019999 0.018999 0.014999 0.014999 0.018999 0.020000 0.020000 0.019999 0.020000 0.019000 0.019000 0.018999 0.019652 0.018999 0.020000 0.019000 0.018999 0.018999 0.017001 0.017001 0.018999 0.019000
3.005 0.019000 0.018999 0.019000 0.014999 0.018999 0.016999 0.017000 0.019597 0.019999 0.018999 0.019001 0.018999 0.018999 0.018999 0.019999 0.020000 0.018999 0.018999 0.018999 0.020258 0.019000 0.018999 0.019000 0.018999 0.019000 0.014999 0.019000 0.018999 0.014999 0.014999 0.015000 0.019000 0.018999 0.019000 0.018999 0.018999 0.018999 0.019001 0.018999 0.018999 0.019000 0.018999 0.019000 0.019000 0.016999 0.016999 0.018999 0.018999
3.142 0.019001 0.018999 0.014999 0.018999 0.018999 0.014999 0.015000 0.015001 0.019000 0.018999 0.018999 0.020001 0.018999 0.018999 0.019001 0.020000 0.018999 0.019000 0.020231 0.017000 0.018999 0.018999 0.019001 0.019397 0.019000 0.019001 0.019001 0.019000 0.017000 0.016998 0.020000 0.019000 0.018999 0.019000 0.018999 0.020000 0.018999 0.018999 0.018999 0.019000 0.018999 0.019000 0.018999 0.018999 0.018999 0.019000 0.020118 0.019000

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


[0.0203715936 0.0203704508 0.0203659186 0.0203595207 0.0203571788 0.0203496775
 0.0203320023 0.0203038911 0.0203012416 0.0202698453 0.0202689574 0.0202584901
 0.0202557955 0.0202409315 0.0202386431 0.0202313077 0.0202129378 0.0202027429
 0.0201807375 0.0201783439 0.0201753733 0.0201744264 0.0201629355 0.0201591458
 0.0201550552 0.0201529201 0.0201475946 0.0201395268 0.0201382822 0.0201360292
 0.020126219  0.0201212495 0.020118246  0.0201130737 0.0201025301 0.0200913098
 0.0200755979 0.0200704291 0.0200701739 0.0200651645 0.0200639443 0.0200363762
 0.0200309838 0.0200262359 0.0200261414 0.0200145474 0.0200015543 0.020001267
 0.0200010697 0.0200009677 0.0200009548 0.0200009483 0.0200009455 0.0200008236
 0.0200006911 0.0200006779 0.0200006636 0.0200006459 0.0200005992 0.0200005431
 0.0200005343 0.0200005058 0.0200004702 0.0200004691 0.0200004525 0.0200004391
 0.0200004053 0.0200003852 0.0200003682 0.0200003062 0.0200002959 0.020000285
 0.0200002816 0.0200002631 0.02000024   0.020000213  0.0200002101 0.0200001938
 0.0200001493 0.0200001373 0.0200001322 0.0200001215 0.0200001198 0.0200001051
 0.0200001044 0.0200000946 0.0200000833 0.0200000649 0.0200000434 0.0200000198
 0.0200000075 0.0200000013 0.0199999901 0.019999949  0.0199999124 0.0199998665
 0.0199998629 0.0199998317 0.0199998135 0.0199998088 0.0199997982 0.0199997694
 0.0199997556 0.019999734  0.0199997324 0.0199997271 0.019999696  0.0199996953
 0.0199996915 0.0199996879 0.0199996773 0.0199996689 0.0199996153 0.0199996105
 0.0199996004 0.0199995958 0.0199995933 0.0199995862 0.0199995767 0.0199995718
 0.0199995439 0.0199995304 0.0199995167 0.019999516  0.0199994914 0.0199994816
 0.0199994812 0.0199994756 0.0199994646 0.0199994376 0.0199994254 0.0199994186
 0.0199994109 0.0199994092 0.0199993981 0.0199993901 0.0199993879 0.0199993777
 0.0199993772 0.0199993661 0.0199993516 0.0199993476 0.0199993465 0.0199993185
 0.0199993176 0.0199993094 0.0199993078 0.0199992915 0.019999287  0.019999278
 0.0199992691 0.0199992523 0.0199992507 0.0199992414 0.0199992395 0.0199992356
 0.0199992097 0.0199992077 0.0199992043 0.0199991915 0.0199991869 0.0199991575
 0.0199991452 0.019999139  0.0199991159 0.0199990771 0.0199990598 0.019999058
 0.0199990377 0.0199990372 0.0199990119 0.0199989996 0.0199989951 0.0199989947
 0.0199246047 0.0199148797 0.0198556645 0.0198482651 0.0198181336 0.0197891216
 0.0197221467 0.0197211282 0.01967069   0.0196651238 0.0196516344 0.0196420711
 0.019619141  0.0196052161 0.019597029  0.0195858934 0.0195738342 0.0195678569
 0.0195540178 0.0195201129 0.0195124997 0.0195098168 0.0194968939 0.0194914853
 0.0194897579 0.0194703854 0.0194626159 0.0194604595 0.019441663  0.0194368841
 0.019425412  0.0194130269 0.0194004252 0.0193969264 0.0193893706 0.0193845523
 0.0193769267 0.0193684444 0.0190023513 0.0190023197 0.0190019168 0.0190017532
 0.0190017134 0.0190016826 0.0190015663 0.0190014603 0.0190014489 0.0190014223
 0.0190013796 0.0190012714 0.0190012235 0.0190011342 0.0190011075 0.0190010963
 0.0190010464 0.0190010116 0.0190009781 0.0190009754 0.0190009358 0.0190009301
 0.0190009299 0.0190009023 0.0190008617 0.0190008601 0.0190008287 0.0190007754
 0.019000757  0.0190007036 0.0190006852 0.0190006798 0.0190006795 0.0190006787
 0.0190006658 0.0190006437 0.0190006427 0.019000632  0.0190006189 0.0190006087
 0.0190005941 0.0190005885 0.0190005746 0.0190005636 0.0190005406 0.0190005361
 0.0190005307 0.019000524  0.0190005133 0.0190005046 0.0190004932 0.0190004705
 0.0190004611 0.0190004583 0.0190004501 0.0190004497 0.0190004467 0.0190004439
 0.0190004304 0.0190004293 0.0190004234 0.0190004171 0.0190003983 0.0190003934
 0.0190003879 0.0190003671 0.0190003527 0.0190003376 0.0190003173 0.0190003143
 0.0190003119 0.0190003048 0.0190003039 0.0190002956 0.0190002857 0.0190002854
 0.0190002771 0.0190002748 0.0190002739 0.0190002709 0.0190002644 0.0190002639
 0.0190002594 0.0190002579 0.0190002565 0.0190002498 0.0190002459 0.0190002454
 0.0190002429 0.0190002273 0.0190002254 0.0190002157 0.0190002078 0.0190002026
 0.0190001963 0.0190001956 0.0190001787 0.0190001582 0.0190001471 0.0190001426
 0.0190001271 0.0190001127 0.0190001116 0.0190001051 0.0190001028 0.0190001028
 0.019000092  0.0190000913 0.0190000903 0.0190000815 0.0190000737 0.0190000731
 0.0190000695 0.0190000631 0.0190000619 0.0190000509 0.0190000468 0.0190000461
 0.019000042  0.0190000404 0.0190000359 0.0190000316 0.0190000292 0.0190000285
 0.019000027  0.0190000072 0.018999999  0.0189999948 0.0189999942 0.0189999928
 0.0189999878 0.0189999864 0.0189999699 0.0189999627 0.0189999605 0.0189999565
 0.0189999514 0.0189999488 0.0189999464 0.0189999422 0.0189999212 0.0189999181
 0.0189999135 0.0189998978 0.0189998976 0.0189998965 0.0189998891 0.0189998792
 0.0189998781 0.0189998678 0.0189998647 0.0189998638 0.01899986   0.0189998537
 0.0189998498 0.0189998478 0.0189998441 0.0189998361 0.0189998341 0.0189998278
 0.0189998259 0.0189998256 0.0189998247 0.0189998243 0.0189998061 0.0189998048
 0.0189998016 0.0189997868 0.0189997851 0.018999782  0.0189997812 0.018999776
 0.0189997757 0.0189997739 0.018999772  0.0189997577 0.0189997544 0.0189997533
 0.0189997477 0.0189997413 0.018999739  0.018999736  0.0189997203 0.0189997105
 0.0189997022 0.0189996961 0.018999696  0.0189996925 0.0189996839 0.0189996827
 0.0189996737 0.0189996681 0.0189996675 0.0189996458 0.0189996436 0.0189996435
 0.0189996366 0.0189996362 0.0189996333 0.0189996326 0.0189996322 0.0189996303
 0.018999624  0.0189996222 0.018999619  0.0189996093 0.0189996092 0.0189996046
 0.0189995974 0.0189995946 0.0189995902 0.0189995804 0.0189995791 0.0189995773
 0.0189995735 0.0189995661 0.0189995632 0.0189995627 0.0189995621 0.0189995603
 0.0189995564 0.0189995545 0.018999554  0.0189995538 0.0189995497 0.0189995486
 0.0189995459 0.0189995443 0.0189995415 0.0189995357 0.0189995296 0.0189995277
 0.0189995181 0.0189995173 0.0189995144 0.0189995087 0.0189995064 0.0189995041
 0.0189995026 0.0189994996 0.0189994963 0.0189994951 0.0189994852 0.0189994816
 0.0189994792 0.0189994792 0.0189994788 0.018999472  0.0189994638 0.0189994602
 0.0189994573 0.0189994518 0.0189994495 0.0189994474 0.018999446  0.0189994373
 0.0189994356 0.0189994293 0.0189994292 0.0189994281 0.0189994223 0.0189994217
 0.0189994215 0.0189994184 0.018999416  0.0189994136 0.0189994118 0.0189994059
 0.0189994041 0.0189994033 0.0189993918 0.0189993857 0.0189993832 0.0189993794
 0.0189993783 0.0189993775 0.0189993754 0.0189993751 0.0189993735 0.0189993732
 0.0189993605 0.0189993603 0.0189993567 0.0189993562 0.0189993557 0.0189993555
 0.018999355  0.0189993543 0.01899935   0.0189993447 0.0189993422 0.0189993401
 0.0189993321 0.0189993294 0.0189993293 0.0189993291 0.0189993199 0.0189993167
 0.0189993167 0.018999315  0.0189993123 0.018999309  0.0189993088 0.0189993043
 0.0189993033 0.0189993029 0.0189993023 0.0189993017 0.0189993016 0.0189993015
 0.0189993008 0.0189993004 0.0189992992 0.0189992979 0.0189992968 0.0189992938
 0.0189992934 0.0189992917 0.0189992917 0.0189992913 0.0189992836 0.0189992833
 0.0189992826 0.018999282  0.0189992789 0.0189992786 0.018999274  0.0189992738
 0.0189992712 0.0189992658 0.0189992643 0.0189992602 0.0189992584 0.0189992568
 0.0189992564 0.0189992522 0.0189992388 0.0189992383 0.0189992293 0.0189992274
 0.0189992268 0.018999225  0.0189992246 0.0189992192 0.0189992177 0.0189992176
 0.0189992151 0.0189992118 0.0189992055 0.0189992051 0.0189992049 0.0189992027
 0.0189991974 0.0189991883 0.0189991832 0.0189991812 0.0189991789 0.0189991772
 0.0189991765 0.0189991757 0.0189991734 0.0189991702 0.0189991675 0.0189991614
 0.0189991599 0.0189991569 0.0189991502 0.0189991479 0.0189991389 0.0189991366
 0.0189991342 0.0189991336 0.0189991326 0.0189991294 0.0189991263 0.0189991257
 0.0189991253 0.0189991235 0.0189991227 0.018999122  0.0189991208 0.0189991194
 0.0189991099 0.0189991074 0.0189991067 0.0189991042 0.018999102  0.0189990965
 0.018999096  0.0189990949 0.0189990916 0.0189990875 0.0189990875 0.0189990818
 0.0189990811 0.0189990801 0.0189990755 0.0189990722 0.0189990675 0.0189990655
 0.0189990633 0.0189990615 0.0189990541 0.0189990519 0.0189990502 0.0189990424
 0.0189990415 0.0189990355 0.0189990339 0.0189990324 0.0189990314 0.0189990277
 0.018999027  0.0189990202 0.0189990089 0.0189990069 0.0189990067 0.0189990034
 0.0189989968 0.0189989955 0.018998991  0.0189989895 0.0189989886 0.0189989874
 0.0189989866 0.0189989813 0.0189989812 0.0189989782 0.018998973  0.0189989718
 0.018998969  0.0189989662 0.0189989651 0.0189989618 0.0189989586 0.018998958
 0.0189989568 0.0189989556 0.0189989545 0.0189989539 0.0189989487 0.0189989457
 0.0189989451 0.0189989444 0.018998944  0.0189989375 0.018998935  0.0189989338
 0.018998928  0.0189989261 0.0189989255 0.0189989212 0.0189989207 0.0189989198
 0.0189989154 0.0189989118 0.0189989107 0.0189989057 0.0189988992 0.0189988988
 0.0189988978 0.0189988948 0.0189988923 0.0189988894 0.0189988847 0.018998884
 0.0189988781 0.0189988778 0.0189988734 0.0189988705 0.0189988695 0.0189988691
 0.0189988676 0.0189988676 0.0189988672 0.0189988663 0.0189988632 0.0189988627
 0.0189988624 0.0189988604 0.0189988556 0.018998855  0.0189988548 0.0189988541
 0.0189988462 0.0189988455 0.018998834  0.0189988332 0.0189988328 0.0189988311
 0.0189988303 0.0189988298 0.0189988264 0.0189988246 0.0189988232 0.0189988155
 0.0189988107 0.0189988095 0.0189988084 0.0189988071 0.0189988049 0.0189987973
 0.0189987957 0.0189987952 0.0189987948 0.0189987834 0.0170032042 0.0170023961
 0.0170022154 0.0170021829 0.0170021642 0.0170021419 0.0170018292 0.0170017844
 0.0170016938 0.0170016076 0.0170014678 0.0170014623 0.0170014344 0.0170014293
 0.0170013777 0.0170013136 0.0170013067 0.0170012474 0.0170011896 0.0170011304
 0.0170010788 0.017001041  0.0170008541 0.0170007665 0.0170007574 0.0170007362
 0.0170007313 0.0170006676 0.0170006516 0.0170006466 0.0170006403 0.0170006037
 0.01700059   0.0170005882 0.0170004259 0.0170003893 0.0170002273 0.0170001993
 0.0170001522 0.0170001262 0.0170001093 0.0170000627 0.0170000568 0.0169999841
 0.0169999044 0.0169998837 0.0169998832 0.0169998786 0.0169998432 0.0169998366
 0.0169997832 0.0169997796 0.016999774  0.0169997679 0.0169997047 0.0169996963
 0.0169996813 0.0169996686 0.0169995503 0.0169995482 0.0169995379 0.0169995181
 0.0169995067 0.0169994847 0.0169994558 0.01699942   0.0169994131 0.0169993872
 0.0169993323 0.0169992935 0.016999214  0.0169992103 0.016999192  0.0169991601
 0.0169990824 0.0169990822 0.0169990787 0.0169990343 0.0169990192 0.0169989888
 0.0169989543 0.0169989413 0.0169989151 0.0169989043 0.0169988904 0.0169988805
 0.0169988709 0.0169988668 0.016998856  0.0169988523 0.0169988043 0.0169987744
 0.0169987662 0.016998757  0.0169987561 0.0169987523 0.0169987308 0.0169987124
 0.0169986794 0.0169986671 0.0169986423 0.0169986345 0.0169986336 0.016998632
 0.0169985865 0.0169985558 0.0169985491 0.0169985435 0.0169985316 0.0169985204
 0.0169984996 0.0169984968 0.0169984299 0.0169984129 0.0169984108 0.0169984016
 0.016998388  0.0150026332 0.0150024523 0.0150024042 0.0150020966 0.0150020872
 0.0150019271 0.0150018759 0.0150018494 0.0150017626 0.015001707  0.015001682
 0.0150016047 0.0150015629 0.0150015229 0.0150014905 0.0150014686 0.0150013881
 0.0150013789 0.0150013411 0.0150013302 0.0150012606 0.0150012294 0.0150011908
 0.0150011793 0.0150011662 0.015001093  0.015001081  0.0150010723 0.0150010674
 0.0150010245 0.0150009953 0.0150009468 0.0150009402 0.0150009385 0.015000933
 0.0150009287 0.0150009057 0.0150008784 0.0150008349 0.0150008327 0.0150008303
 0.0150008154 0.0150007991 0.0150007932 0.0150007835 0.0150007742 0.0150007702
 0.0150007603 0.0150007595 0.015000746  0.0150007449 0.0150007211 0.0150007168
 0.0150007156 0.0150006903 0.0150006872 0.015000679  0.0150006503 0.0150006475
 0.0150006374 0.0150006228 0.0150006196 0.0150005815 0.0150005789 0.0150005576
 0.015000495  0.0150004414 0.0150004337 0.0150004121 0.0150003917 0.015000387
 0.015000384  0.0150003562 0.0150003446 0.0150003258 0.015000295  0.0150002708
 0.0150002632 0.0150002078 0.0150001922 0.0150001554 0.0150001541 0.015000136
 0.015000136  0.0150001254 0.0150001197 0.0150001129 0.0150001018 0.0150000802
 0.015000079  0.0150000631 0.0150000555 0.0150000339 0.0150000291 0.0150000271
 0.0150000243 0.0150000242 0.015000024  0.0149999966 0.0149999947 0.0149999887
 0.0149999606 0.0149999517 0.01499995   0.0149999431 0.0149999412 0.0149999403
 0.0149999266 0.0149999062 0.0149999061 0.0149998961 0.0149998858 0.0149998799
 0.0149998657 0.0149998399 0.014999766  0.0149997649 0.014999755  0.0149997532
 0.0149997308 0.0149997046 0.014999698  0.0149996937 0.0149996919 0.0149996872
 0.0149996851 0.0149996799 0.014999677  0.0149996636 0.0149996467 0.014999638
 0.0149996351 0.0149996157 0.0149996124 0.0149996069 0.0149995925 0.014999589
 0.0149995869 0.0149995716 0.0149995579 0.014999555  0.0149995487 0.0149995468
 0.0149995426 0.0149995126 0.0149995124 0.0149994994 0.0149994365 0.0149994159
 0.0149994013 0.0149994007 0.0149993965 0.0149993772 0.0149993631 0.014999354
 0.0149993535 0.014999339  0.0149993296 0.014999326  0.014999326  0.014999321
 0.0149993177 0.0149992987 0.0149992772 0.0149992751 0.0149992687 0.0149992668
 0.0149992484 0.0149992354 0.0149992352 0.0149992055 0.0149991935 0.0149991841
 0.0149991807 0.0149991773 0.014999166  0.0149991603 0.0149991599 0.0149991549
 0.0149991523 0.014999141  0.01499912   0.0149991174 0.014999116  0.0149991144
 0.0149991108 0.01499911   0.0149991088 0.0149990942 0.0149990897 0.0149990806
 0.0149990752 0.0149990647 0.0149990634 0.0149990584 0.0149990531 0.0149990517
 0.0149990433 0.0149990414 0.0149990392 0.0149990351 0.0149990222 0.0149990206
 0.01499902   0.014999018  0.0149990168 0.0149990134 0.0149990124 0.0149989908
 0.0149989852 0.0149989796 0.0149989747 0.0149989746 0.0149989727 0.014998965
 0.0149989643 0.01499896   0.0149989494 0.0149989338 0.0149989299 0.0149989294
 0.0149989271 0.0149989234 0.0149989104 0.0149989045 0.0149989019 0.014998899
 0.0149988987 0.014998897  0.0149988942 0.0149988821 0.0149988787 0.0149988766
 0.0149988766 0.0149988755 0.014998872  0.0149988716 0.0149988712 0.0149988609
 0.0149988546 0.0149988515 0.0149988482 0.0149988451 0.0149988377 0.0149988362
 0.0149988358 0.0149988345 0.0149988302 0.0149988285 0.0149988265 0.0149988189
 0.0149988153 0.0149988136 0.0149987994 0.0149987964 0.0149987932 0.0149987913
 0.0149987894 0.0149987866 0.0149987835 0.0149987823 0.0149987636 0.0149987594
 0.0149987593 0.0149987504 0.0149987499 0.0149987445 0.0149987438 0.0149987407
 0.0149987277 0.0149987276 0.0149987186 0.0149987095 0.0149986956 0.0149986941
 0.0149986771 0.0149986759 0.0149986736 0.0149986703 0.0149986693 0.0149986629
 0.0149986584 0.0149986342 0.0149986342 0.0149986313 0.0149986308 0.0149986286
 0.0149986244 0.0149986151 0.014998601  0.0149985995 0.0149985989 0.0149985972
 0.0149985906 0.0149985884 0.0149985799 0.0149985789 0.0149985693 0.0149985643
 0.0149985461 0.0149985414 0.0149985373 0.0149985367 0.0149985309 0.0149985298
 0.0149985257 0.0149985237 0.014998518  0.0149985156 0.0149985156 0.0149985064
 0.0149985063 0.0149985029 0.0149984744 0.0149984614 0.0149984436 0.0149984196]

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

In [17]:
# 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.0150, 0.0170, 0.0190]
atol_fre_list =  [0.0003, 0.0003, 0.0003]

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.137 2.005
-ini_theta 0.136591 -ini_phi 2.005272 -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()
0.137 5.748
-ini_theta 0.136591 -ini_phi 5.748446 -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()
0.0 0.0
-ini_theta 0.000000 -ini_phi 0.000000 -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()
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()
frequency in the range (0.014700, 0.015300)
make folder ecoC01B05_T0.25_psi-0a/fre_separate/fre_0.015000
frequency in the range (0.016700, 0.017300)
make folder ecoC01B05_T0.25_psi-0a/fre_separate/fre_0.017000
frequency in the range (0.018700, 0.019300)
make folder ecoC01B05_T0.25_psi-0a/fre_separate/fre_0.019000
make folder ecoC01B05_T0.25_psi-0a/fre_separate/remainders

Out[17]:
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=