In [1]:
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 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 [85]:
data = pd.read_feather("/Users/weilu/Research/server/apr_2018/fourth/force_0.04_rg_0.15_lipid_1.0_mem_1_go_0.8/rerun_0_20_Apr_001224.feather")
dic = {"T0":280, "T1":290, "T2":300, "T3":310, "T4":320, "T5":335, "T6":350, "T7":365, "T8":380, "T9":410, "T10":440, "T11":470}
a = data
a["Temp"] = a["Temp"].apply(lambda x: dic[x])
rerun0 = data
t = a.query("Temp < 400").groupby(["BiasTo","Temp"])[["DisReal","Run"]].mean().reset_index()
t["Diff"] = t["DisReal"]-t["BiasTo"].apply(pd.to_numeric)
t["BiasTo"] = t["BiasTo"].apply(pd.to_numeric)
fg = sns.FacetGrid(data=t, hue='Temp', size=8, aspect=1.61)
fg.map(plt.scatter, 'BiasTo', 'Diff').add_legend()
Out[85]:
In [145]:
data = pd.read_feather("/Users/weilu/Research/server/apr_2018/fourth/force_0.04_rg_0.15_lipid_1.0_mem_1_go_0.8/rerun_1_20_Apr_001224.feather")
dic = {"T0":280, "T1":290, "T2":300, "T3":310, "T4":320, "T5":335, "T6":350, "T7":365, "T8":380, "T9":410, "T10":440, "T11":470}
a = data
a["Temp"] = a["Temp"].apply(lambda x: dic[x])
rerun1 = data
t = a.query("Temp < 450").groupby(["BiasTo","Temp"])[["DisReal","Run"]].mean().reset_index()
t["Diff"] = t["DisReal"]-t["BiasTo"].apply(pd.to_numeric)
t["BiasTo"] = t["BiasTo"].apply(pd.to_numeric)
fg = sns.FacetGrid(data=t, hue='Temp', size=8, aspect=1.61)
fg.map(plt.scatter, 'BiasTo', 'Diff').add_legend()
Out[145]:
In [35]:
rerun1.columns
Out[35]:
In [148]:
rerun1.query("Temp == 410").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[148]:
In [132]:
rerun1.query("Temp == 350").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[132]:
In [175]:
t = rerun1.query("Temp == 350 and Qw < 0.3 and DisReal > 80").plot.hexbin("z_h6", "z_h4", cmap="seismic", sharex=False)
In [182]:
rerun0.query("Temp == 350").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[182]:
In [186]:
rerun1.query("Temp == 350").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[186]:
In [188]:
rerun1.query("Temp == 350").plot.hexbin("AMH-Go", "Qw", cmap="seismic", sharex=False)
Out[188]:
In [197]:
rerun0.query("Temp == 350 and DisReal > 70").plot.hexbin("AMH-Go", "Rg", cmap="seismic", sharex=False)
Out[197]:
In [196]:
rerun0.query("Temp == 350 and DisReal > 70").plot.hexbin("AMH-Go", "Lipid1", cmap="seismic", sharex=False)
Out[196]:
In [184]:
rerun0.columns
Out[184]:
In [191]:
t.hist("Lipid1", bins=50)
Out[191]:
In [192]:
t = rerun0.query("BiasTo=='98.0' and Run == '0'").plot("Step", "Lipid1")
In [199]:
t = rerun1.query("Temp == 350 and DisReal > 80")
# t.plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
t.groupby(["BiasTo", "Run"])["DisReal"].describe().query("count > 100")
Out[199]:
In [131]:
rerun1.query("Temp == 300").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[131]:
In [ ]:
In [127]:
t = rerun1.query("Temp == 300 and DisReal > 70 and z_h6 < -10")
t.plot.hexbin("DisReal", "z_h6", cmap="seismic", sharex=False)
# t.mean()
# t.groupby(["BiasTo", "Run"])["TotalE"].describe().query("count > 100")
Out[127]:
In [108]:
t = rerun1.query("BiasTo == '76.0' and Run == 11")
In [109]:
t.plot("Step", "Lipid10")
Out[109]:
In [84]:
t.plot("Step", "Qw")
Out[84]:
In [111]:
t = rerun1.query("Temp == 300 and DisReal > 70 and z_h6 > -10 and Qw < 0.35")
# t.plot.hexbin("DisReal", "TotalE", cmap="seismic", sharex=False)
t.hist("TotalE", bins=50)
t["TotalE"].mean()
# t.mean()
t["AMH-Go"].mean()
# t.groupby(["BiasTo", "Run"])["TotalE"].describe().query("count > 100")
Out[111]:
In [115]:
t = rerun1.query("Temp == 300 and DisReal > 70 and z_h6 < -10 and Qw > 0.35")
t.plot.hexbin("DisReal", "TotalE", cmap="seismic", sharex=False)
t.hist("TotalE", bins=100)
t["TotalE"].mean()
t["AMH-Go"].mean()
# t.mean()
# t.groupby(["BiasTo", "Run"])["TotalE"].describe().query("count > 100")
Out[115]:
In [113]:
t = rerun0.query("Temp == 300 and DisReal > 70 and z_h6 > -10")
t.plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
print(t.shape)
t.groupby(["BiasTo", "Run"])["Qw"].describe().query("count > 50")
Out[113]:
In [116]:
t = rerun1.query("Temp == 300 and DisReal > 70 and z_h6 > -10")
t.plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
print(t.shape)
t.groupby(["BiasTo", "Run"])["Qw"].describe().query("count > 50")
Out[116]:
In [16]:
rerun1.query("Temp == 300").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[16]:
In [168]:
rerun1.query("Temp == 300").plot.hexbin("AMH-Go", "Qw", cmap="seismic", sharex=False)
Out[168]:
In [170]:
rerun1.query("Temp == 300").plot.hexbin("Lipid", "Qw", cmap="seismic", sharex=False)
Out[170]:
In [169]:
rerun1.columnsumns
Out[169]:
In [167]:
rerun1.query("Temp == 300").plot.hexbin("TotalE", "Qw", cmap="seismic", sharex=False)
Out[167]:
In [17]:
rerun1.query("Temp == 300").plot.hexbin("DisReal", "z_h6", cmap="seismic", sharex=False)
Out[17]:
In [23]:
rerun1.query("Temp == 300").plot.hexbin("DisReal", "TotalE", cmap="seismic", sharex=False)
Out[23]:
In [5]:
rerun1.query("Temp == 300").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[5]:
In [13]:
rerun1.query("Temp == 300 and Qw < 0.5").plot.hexbin("DisReal", "z_h1", cmap="seismic", sharex=False)
Out[13]:
In [9]:
rerun1.query("Temp == 300 and Qw < 0.5").plot.hexbin("DisReal", "Lipid1", cmap="seismic", sharex=False)
Out[9]:
In [ ]:
pre = "/Users/weilu/Research/server/apr_2018/02_week"
temp = 400
location = pre + "/fourth/_280-350/2d_z_qw/k_0.2_force_0.2_temp410/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(4, 14), end=(25,24), save=False, xlabel="z_H6", ylabel="Qw")
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location2 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location2, zmax=150)
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 [150]:
pre = "/Users/weilu/Research/server/apr_2018/02_week"
temp = 400
location = pre + "/fourth/_280-350/2d_z_qw/k_0.2_force_0.2_temp410/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(4, 14), end=(25,24), save=False, xlabel="z_H6", ylabel="Qw")
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location2 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location2, zmax=150)
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)
Out[150]:
In [144]:
pre = "/Users/weilu/Research/server/apr_2018/02_week"
temp = 350
location = pre + "/fourth/_280-350/2d_z_qw/k_0.2_force_0.2_temp350/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(4, 14), end=(25,24), save=False, xlabel="z_H6", ylabel="Qw")
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location2 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location2, zmax=150)
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)
Out[144]:
In [155]:
pre = "/Users/weilu/Research/server/apr_2018/02_week"
temp = 310
location = pre + "/fourth/_280-350/2d_z_qw/k_0.2_force_0.5/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(4, 14), end=(25,24), save=False, xlabel="z_H6", ylabel="Qw")
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location2 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location2, zmax=150)
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)
Out[155]:
In [162]:
pre = "/Users/weilu/Research/server/apr_2018/02_week"
temp = 340
location = pre + "/fourth/_280-350/2d_z_qw/k_0.2_force_0.5_temp350/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(4, 14), end=(25,24), save=False, xlabel="z_H6", ylabel="Qw")
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location2 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location2, zmax=150)
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)
Out[162]:
In [143]:
pre = "/Users/weilu/Research/server/apr_2018/02_week"
temp = 350
location = pre + "/fourth/_280-350/2d_z_qw/k_0.2_force_0.5/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(4, 14), end=(25,24), save=False, xlabel="z_H6", ylabel="Qw")
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location2 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location2, zmax=150)
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)
Out[143]:
In [130]:
pre = "/Users/weilu/Research/server/apr_2018/02_week"
temp = 320
location = pre + "/fourth/_280-350/2d_z_qw/k_0.2_force_0.0/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(4, 14), end=(25,24), save=False, xlabel="z_H6", ylabel="Qw")
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location2 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location2, zmax=100)
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)
Out[130]:
In [128]:
pre = "/Users/weilu/Research/server/apr_2018/02_week"
temp = 300
location = pre + "/fourth/_280-350/2d_z_qw/force_0.0/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(4, 14), end=(25,24), save=False, xlabel="z_H6", ylabel="Qw")
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location2 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location2, zmax=100)
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)
Out[128]:
In [33]:
pre = "/Users/weilu/Research/server/apr_2018/02_week"
temp = 300
location = pre + "/fourth/_280-350/2d_z_qw/force_0.02/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(4, 14), end=(25,24), save=False, xlabel="z_H6", ylabel="Qw")
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location2 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location2, zmax=100)
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)
Out[33]:
In [95]:
pre = "/Users/weilu/Research/server/apr_2018/sixth/rg_0.15_lipid_1.0_mem_1_go_0.8/simulation/dis_32.0/1/DMPC_0/"
new = pd.read_csv(pre+"lipid.dat")
new.columns = new.columns.str.strip()
In [94]:
pre = "/Users/weilu/Research/server/apr_2018/sixth/rg_0.15_lipid_1.0_mem_1_go_0.8/simulation/dis_32.0/1/original_0/"
old = pd.read_csv(pre+"lipid.dat")
old.columns = old.columns.str.strip()
In [99]:
new["Lipid"].head()
Out[99]:
In [104]:
new.mean()
Out[104]:
In [105]:
old.mean()
Out[105]:
In [106]:
new.mean() - old.mean()
Out[106]:
In [100]:
old["Lipid"].head()
Out[100]:
In [98]:
(new["Lipid"] - old["Lipid"]).hist()
Out[98]:
In [101]:
-3.98164e-6*5
Out[101]:
In [102]:
6.21541e-4*4
Out[102]:
In [103]:
-3.5558475e-2*3
Out[103]:
In [ ]: