In [26]:
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 [31]:
data = pd.read_feather("/Users/weilu/Research/server/apr_2018/twelve/force_0.02_rg_0.1_lipid_0.5_mem_1_go_0.8/rerun_0_01_May_025941.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[31]:
In [27]:
data = pd.read_feather("/Users/weilu/Research/server/apr_2018/twelve/force_0.02_rg_0.1_lipid_0.5_mem_1_go_0.8/rerun_1_27_Apr_215043.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 < 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[27]:
In [35]:
data = pd.read_feather("/Users/weilu/Research/server/apr_2018/twelve/force_0.02_rg_0.1_lipid_0.5_mem_1_go_0.8/rerun_2_01_May_025941.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])
rerun2 = 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[35]:
In [33]:
data = pd.read_feather("/Users/weilu/Research/server/apr_2018/twelve/force_0.02_rg_0.1_lipid_0.5_mem_1_go_0.8/rerun_3_01_May_025941.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])
rerun3 = 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[33]:
In [32]:
rerun0.query("Temp == 410 and Qw > 0.45").groupby("Step")["Qw"].count().reset_index().plot("Step", "Qw")
In [30]:
rerun1.query("Temp == 410 and Qw > 0.45").groupby("Step")["Qw"].count().reset_index().plot("Step", "Qw")
Out[30]:
In [36]:
rerun2.query("Temp == 410 and Qw > 0.45").groupby("Step")["Qw"].count().reset_index().plot("Step", "Qw")
Out[36]:
In [34]:
rerun3.query("Temp == 410 and Qw > 0.45").groupby("Step")["Qw"].count().reset_index().plot("Step", "Qw")
Out[34]:
In [37]:
rerun3.query("Temp == 470 and Qw > 0.45").groupby("Step")["Qw"].count().reset_index().plot("Step", "Qw")
Out[37]:
In [29]:
rerun1.query("Temp == 410 and Qw > 0.3").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[29]:
In [57]:
rerun3.query("Temp == 300").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[57]:
In [58]:
rerun3.query("Temp == 300 and Qw < 0.33 and DisReal < 80").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[58]:
In [59]:
t = rerun3.query("Temp == 300 and Qw < 0.33 and DisReal < 80")
t.groupby(["BiasTo", "Run"])["DisReal"].describe().query("count > 300")
Out[59]:
In [3]:
rerun1.query("Temp == 300").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[3]:
In [5]:
rerun1.query("Temp == 300 and Qw < 0.33 and DisReal < 80").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[5]:
In [8]:
rerun1.query("Temp == 300 and Qw < 0.33 and DisReal < 80").plot.hexbin("Lipid6", "Lipid1", cmap="seismic", sharex=False)
Out[8]:
In [11]:
t = rerun1.query("Temp == 300 and Qw < 0.33 and DisReal < 80")
t.groupby(["BiasTo", "Run"])["DisReal"].describe().query("count > 300")
Out[11]:
In [48]:
rerun3.query("Temp == 300").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[48]:
In [49]:
rerun1.query("Temp == 300").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[49]:
In [14]:
rerun1.query("Temp == 300").plot.hexbin("DisReal", "z_h6", cmap="seismic", sharex=False)
Out[14]:
In [16]:
rerun1.query("Temp == 300 and DisReal > 50 and z_h6 > -10").plot.hexbin("DisReal", "z_h6", cmap="seismic", sharex=False)
Out[16]:
In [29]:
rerun1.query("Temp == 300 and DisReal > 50 and z_h6 > -10").plot.hexbin("DisReal", "TotalE", cmap="seismic", sharex=False)
Out[29]:
In [36]:
rerun1.query("Temp == 300")["Lipid4"].hist(bins=50)
Out[36]:
In [ ]:
rerun1.query("Temp == 300")["Lipid4"].hist(bins=50)
In [33]:
rerun1.query("Temp == 300 and DisReal >50")["Lipid4"].hist(bins=50)
Out[33]:
In [35]:
t["Lipid4"].max()
Out[35]:
In [37]:
t.min()
Out[37]:
In [30]:
t.mean()
Out[30]:
In [26]:
def select(t, i=100):
return t.groupby(["BiasTo", "Run"])["DisReal"].describe().query(f"count > {i}")
In [27]:
t = rerun1.query("Temp == 300 and DisReal > 50 and z_h6 > -10")
b = select(t,300)
In [28]:
b
Out[28]:
In [ ]:
In [19]:
rerun1.query("Temp == 300").plot.hexbin("DisReal", "z_h4", cmap="seismic", sharex=False)
Out[19]:
In [20]:
pre = "/Users/weilu/Research/server/apr_2018/04_week"
temp = 340
location = pre + "/twelve/_280-350/2d_z_h56/force_0.0/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(24, 10), end=(5,24), save=False, xlabel="z_H6", ylabel="Qw", zmax=15)
# 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=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)
Out[20]:
In [38]:
pre = "/Users/weilu/Research/server/apr_2018/04_week"
temp = 300
location = pre + "/twelve/_280-350/2d_z_qw/force_0.0/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(4, 10), end=(25,24), save=False, xlabel="z_H6", ylabel="Qw", zmax=20)
# 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=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)
Out[38]:
In [44]:
pre = "/Users/weilu/Research/server/apr_2018/04_week"
temp = 280
location = pre + "/twelve/_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", zmax=30)
# 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=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)
Out[44]:
In [50]:
pre = "/Users/weilu/Research/server/apr_2018/04_week"
temp = 300
location = pre + "/twelve/_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", zmax=30)
# 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=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)
Out[50]:
In [56]:
b = rerun1.query("BiasTo == '92.0'").groupby(["Run", "Temp"])["Step"].count().reset_index()
c = b.pivot(index="Run", columns="Temp", values="Step").reset_index()
c
Out[56]:
In [53]:
r = (1000/300)**(1/11)
In [55]:
[round(300*r**i) for i in range(12)]
Out[55]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]: