In [2]:
import os
import sys
import random
import time
from random import seed, randint
import argparse
import platform
from datetime import datetime
import imp
import numpy as np
import fileinput
from itertools import product
import pandas as pd
from scipy.interpolate import griddata
from scipy.interpolate import interp2d
import seaborn as sns
from os import listdir
import scipy
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.interpolate import griddata
import matplotlib as mpl
sys.path.insert(0,'..')
from notebookFunctions import *
# from .. import notebookFunctions
%matplotlib inline
plt.rcParams['figure.figsize'] = (10,6.180) #golden ratio
# %matplotlib notebook
%load_ext autoreload
%autoreload 2
In [124]:
data = pd.read_feather("/Users/weilu/Research/server/may_2018/03_week/all_data_folder/second_start_extended_combined_may19.feather")
data = data.reset_index(drop=True)
# data["BiasedEnergy"] = data["TotalE"] + 0.2*data["AMH_4H"]
data["BiasedEnergy"] = data["Lipid"] + data["Rg"] + data["Membrane"] + data["AMH-Go"] + 0.2*data["AMH_4H"]
data["BiasEnergy"] = 0.02 * (data["BiasTo"] - data["DisReal"])**2
data["Energy_with_all_bias"] = data["BiasEnergy"] + data["BiasedEnergy"]
In [ ]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/second_start_extended_combined_2/_280-350//"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
path, f = shortest_path(location2, start=(1, 5), end=(28,20),save=False, xlabel="z_H6", ylabel="Qw", zmax=25,res=30)
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location3 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location3, zmax=120)
plt.plot(xi[path[:,1]], yi[path[:,0]], 'r.-')
# plt.savefig("/Users/weilu/papers/figures/2d_expected_dis.png", dpi=300)
plt.figure()
f_on_path = [zi[tuple(p)] for p in reversed(path)]
plt.plot(f_on_path)
# plt.savefig("/Users/weilu/papers/figures/shortest_path_expected_dis.png", dpi=300)
In [163]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/second_start_extended_combined_2/_280-350/2d_zAverage_dis/more_bins/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(18, 30), end=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", plot1d=False, zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [165]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/second_start_extended_combined_2/_280-350/2d_zAverage_dis/more_bins/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(18, 30), end=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", plot1d=False, zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
plt.ylim(-15, 0)
plt.xlim(50, 120)
# plt.clim(0, 20)
# plt.colorbar()
Out[165]:
In [193]:
t_pos = data.query("TempT == 373 and DisReal > 80 and DisReal < 100 and z_average > -8 and z_average < -4").reset_index(drop=True)
chosen = t_pos.query("Lipid1 < -0.5").sort_values("Energy_with_all_bias").head(n=20)
chosen.to_csv("/Users/weilu/Research/data/low_e_jun01_h56.csv")
In [197]:
t_pos.query("Lipid1 < -0.5").sort_values("Energy_with_all_bias").head(n=20)
Out[197]:
In [198]:
t_pos["chosen"] = (t_pos["Lipid1"] < -0.5) &(t_pos["z_h6"] < -10) & (t_pos["z_h3"] > -15)
a = t_pos["chosen"]
a.value_counts()
Out[198]:
In [194]:
t_pos.hist("z_h6",bins=50)
Out[194]:
In [186]:
t_pos.hist("Lipid1",bins=50)
Out[186]:
In [201]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/second_start_extended_combined_2/_280-350/2d_zAverage_dis/more_bins/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(18, 30), end=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", plot1d=False, zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
# plt.ylim(-15, 0)
# plt.xlim(50, 120)
In [203]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/second_start_extended_combined_2/_280-350/2d_zAverage_dis/more_bins/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(18, 30), end=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", plot1d=False, zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
plt.ylim(-20, -5)
plt.xlim(120, 200)
Out[203]:
In [208]:
t_pos = data.query("TempT == 373 and DisReal > 140 and DisReal < 180 and z_average > -14 and z_average < -8").reset_index(drop=True)
chosen = t_pos.sort_values("Energy_with_all_bias").head(n=20)
chosen.to_csv("/Users/weilu/Research/data/low_e_jun01_h34.csv")
In [213]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/second_start_extended_combined_2/_280-350/2d_zAverage_dis/higer_force_0.2/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, title="high_force_AverageZ_Dis", start=(11, 36), end=(26,0),save=False, plot1d=False, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [212]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/second_start_extended_combined_2/_280-350/2d_zAverage_dis/higer_force_0.2/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, title="high_force_AverageZ_Dis", start=(11, 36), end=(26,0),save=False, plot1d=False, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
plt.ylim(-20, -5)
plt.xlim(120, 300)
Out[212]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [5]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/second_start_extended_combined_2/_280-350/2d_zAverage_dis/more_bins/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(18, 30), end=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [28]:
data.columns
Out[28]:
In [ ]:
t = data.query("TempT == 373 and DisReal <56 and DisReal > 52")
In [19]:
t.plot.hexbin("z_average", "Qw", cmap="seismic", sharex=False)
Out[19]:
In [22]:
h1_out = t.query("Lipid1 > -0.5")
In [23]:
h1_out.shape
Out[23]:
In [24]:
t.shape
Out[24]:
In [25]:
h1_not_out = t.query("Lipid1 <= -0.5")
In [32]:
h1_not_out.plot.hexbin("BiasedEnergy", "Qw", cmap="seismic", sharex=False)
Out[32]:
In [62]:
t_pre = data.query("TempT == 373 and DisReal <56 and DisReal > 52").reset_index(drop=True)
t_pre.sort_values("BiasedEnergy").head(n=10).to_csv("/Users/weilu/Research/data/may28_pre_lowE2.csv")
In [66]:
In [30]:
h1_not_out_high_q = h1_not_out.query("Qw > 0.4")
In [31]:
h1_not_out_high_q.shape
Out[31]:
In [ ]:
h1_not_out_high_q.to_csv("/Users/weilu/Research/data/may28_pre_highQ.csv")
In [34]:
h1_not_out_low_energy = h1_not_out.query("BiasedEnergy < -820")
In [35]:
h1_not_out_low_energy.to_csv("/Users/weilu/Research/data/may28_pre_lowE.csv")
In [36]:
h1_not_out_low_energy.shape
Out[36]:
In [55]:
chosen = data.query("TempT == 373 and DisReal <56 and DisReal > 52 and TotalE < -780").reset_index(drop=True)
In [57]:
chosen["withoutGo"] = chosen["TotalE"] - chosen["AMH-Go"]
In [59]:
chosen.columns
Out[59]:
In [58]:
chosen.plot.hexbin("withoutGo", "Lipid1", cmap="seismic", sharex=False)
Out[58]:
In [53]:
data.query("TempT == 373 and DisReal <56 and DisReal > 52 and TotalE < -780").plot.hexbin("TotalE", "Lipid1", cmap="seismic", sharex=False)
Out[53]:
In [52]:
data.query("TempT == 373 and DisReal <56 and DisReal > 52 and AMH_4H < -320").plot.hexbin("TotalE", "Lipid1", cmap="seismic", sharex=False)
Out[52]:
In [51]:
data.query("TempT == 373 and DisReal <56 and DisReal > 52 and AMH_4H < -320").plot.hexbin("AMH_4H", "Lipid1", cmap="seismic", sharex=False)
Out[51]:
In [46]:
data.query("TempT == 373 and DisReal <56 and DisReal > 52 and BiasedEnergy < -850").to_csv("/Users/weilu/Research/data/may28_pre_lowE2.csv")
In [47]:
data.query("TempT == 373 and DisReal <56 and DisReal > 52 and BiasedEnergy < -850").plot.hexbin("BiasedEnergy", "Lipid1", cmap="seismic", sharex=False)
Out[47]:
In [40]:
data.query("TempT == 373 and DisReal <56 and DisReal > 52 and BiasedEnergy < -820").plot.hexbin("TotalE", "Qw", cmap="seismic", sharex=False)
Out[40]:
In [75]:
data.columns
Out[75]:
In [ ]:
t_middle = data.query("TempT == 373 and DisReal <64 and DisReal > 56")
In [82]:
t_middle.sort_values("Energy_with_all_bias").head(n=10)
Out[82]:
In [84]:
t_middle.sort_values("Energy_with_all_bias").head(n=10)
Out[84]:
In [83]:
t_middle.query("Lipid1 < -0.5").sort_values("Energy_with_all_bias").head(n=10)
Out[83]:
In [ ]:
# t_pre = data.query("TempT == 373 and DisReal <56 and DisReal > 52").reset_index(drop=True)
# t_pre.sort_values("BiasedEnergy").head(n=10).to_csv("/Users/weilu/Research/data/may28_pre_lowE2.csv")
In [68]:
t_middle.sort_values("BiasedEnergy").head(n=10)["Lipid1"]
Out[68]:
In [38]:
t_middle.shape
Out[38]:
In [39]:
t_middle.plot.hexbin("z_average", "Qw", cmap="seismic", sharex=False)
Out[39]:
In [45]:
t_middle.plot.hexbin("Lipid1", "Qw", cmap="seismic", sharex=False)
Out[45]:
In [91]:
t_middle.query("Lipid1 < -0.5").plot.hexbin("Lipid1", "Qw", cmap="seismic", sharex=False)
Out[91]:
In [136]:
t_pos = data.query("TempT == 373 and DisReal > 64 and DisReal < 70")
In [137]:
t_pos.plot.hexbin("DisReal", "z_average", cmap="seismic", sharex=False)
Out[137]:
In [145]:
t_pos.plot.hexbin("DisReal", "z_h6", cmap="seismic", sharex=False)
Out[145]:
In [151]:
t_pos.plot.hexbin("DisReal", "z_h3", cmap="seismic", sharex=False)
Out[151]:
In [152]:
t_pos = data.query("TempT == 373 and DisReal > 64 and DisReal < 70").reset_index(drop=True)
t_pos["chosen"] = (t_pos["Lipid1"] < -0.5) &(t_pos["z_h6"] < -10) & (t_pos["z_h3"] > -15)
a = t_pos["chosen"]
a.value_counts()
In [155]:
In [158]:
t_pos.groupby("chosen").mean()
Out[158]:
In [ ]:
In [157]:
Out[157]:
In [154]:
t_pos["chosen"].count()
Out[154]:
In [ ]:
t_pos.plot.hexbin("DisReal", "z_average", cmap="seismic", sharex=False)
In [87]:
t_pos.plot.hexbin("z_average", "Qw", cmap="seismic", sharex=False)
Out[87]:
In [88]:
t_pos.plot.hexbin("Lipid1", "Qw", cmap="seismic", sharex=False)
Out[88]:
In [90]:
t_pos.query("Lipid1 < -0.5").plot.hexbin("Lipid1", "Qw", cmap="seismic", sharex=False)
Out[90]:
In [92]:
t_pos.query("Lipid1 < -0.5").plot.hexbin("Energy_with_all_bias", "Qw", cmap="seismic", sharex=False)
Out[92]:
In [98]:
t_pos.query("Lipid1 < -0.5 and z_average < -4").sort_values("Energy_with_all_bias").head(n=10)["z_average"]
Out[98]:
In [ ]:
t_pos.query("Lipid1 < -0.5 and z_average < -4").sort_values("Energy_with_all_bias")
In [138]:
t_pos.query("z_average < -4").sort_values("AMH_4H").head(n=10)
Out[138]:
In [139]:
t_pos.query("z_average < -4").sort_values("BiasedEnergy").head(n=10)
Out[139]:
In [ ]:
t_pos["Energy_with_all_bias"] = t["Lipid"] + t["Rg"] + t["Membrane"] + t["AMH-Go"]
In [122]:
t_pos.columns
Out[122]:
In [115]:
t_pos.query("Lipid1 < -0.5 and z_average < -4").sort_values("Energy_with_all_bias").head(n=10)
Out[115]:
In [117]:
t_pos.query("Lipid1 < -0.5 and z_average < -4").sort_values("Energy_with_all_bias").head(n=5).to_csv("/Users/weilu/Research/data/may28_post_lowE.csv")
In [102]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/second_start_extended_combined_2/_280-350/2d_zAverage_dis/more_bins/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, start=(18, 30), end=(29,1),save=False, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [48]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/enhance_go/_280-350/2d_zAverage_dis/force_0.18/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, title="high_force_AverageZ_Dis", start=(10, 35), end=(28,1),save=False, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [ ]:
In [5]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/enhance_go/_280-350/2d_zAverage_dis/force_0.18/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, title="high_force_AverageZ_Dis", start=(10, 35), end=(28,1),save=True, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [114]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/enhance_go/_280-350/2d_zAverage_dis/force_0.2/"
location2 = location + f"perturbation-2-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, title="high_force_AverageZ_Dis", start=(10, 35), end=(28,1),save=True, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [104]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/enhance_go/_280-350/2d_zAverage_dis/force_0.2/"
location2 = location + f"perturbation-10-pmf-{temp}.dat"
zmax=25
res=40
path_origin, f_origin = shortest_path_2(location2, title="high_force_AverageZ_Dis", start=(10, 35), end=(28,1),save=True, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [110]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/enhance_go/_280-350/2d_zAverage_dis/force_0.2/"
location2 = location + f"perturbation-9-pmf-{temp}.dat"
zmax=30
res=40
path_origin, f_origin = shortest_path_2(location2, title="high_force_AverageZ_Dis", start=(10, 35), end=(28,1),save=True, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [111]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/enhance_go/_280-350/2d_zAverage_dis/force_0.1/"
location2 = location + f"perturbation-9-pmf-{temp}.dat"
zmax=30
res=40
path_origin, f_origin = shortest_path_2(location2, title="high_force_AverageZ_Dis", start=(10, 35), end=(28,1),save=True, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [112]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/enhance_go/_280-350/2d_zAverage_dis/force_0.2/"
location2 = location + f"perturbation-9-pmf-{temp}.dat"
zmax=30
res=40
path_origin, f_origin = shortest_path_2(location2, title="high_force_AverageZ_Dis", start=(10, 35), end=(28,1),save=True, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [113]:
pre = "/Users/weilu/Research/server/may_2018/03_week"
temp = 370
location = pre + "/enhance_go/_280-350/2d_zAverage_dis/force_0.18/"
location2 = location + f"perturbation-9-pmf-{temp}.dat"
zmax=30
res=40
path_origin, f_origin = shortest_path_2(location2, title="high_force_AverageZ_Dis", start=(10, 35), end=(28,1),save=True, xlabel="Distance", ylabel="AverageZ", zmax=zmax,res=res)
# print(getBound(location2, res=res, zmax=zmax))
xmin,xmax,ymin,ymax = getBound(location2, res=res, zmax=zmax)
In [ ]: