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 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 [10]:
data = pd.read_feather("/Users/weilu/Research/server/may_2018/second/rerun_7_19_May_155517.feather")
dic = {"T0":300, "T1":335, "T2":373, "T3":417, "T4":465, "T5":519, "T6":579, "T7":645, "T8":720, "T9":803, "T10":896, "T11":1000}
a = data
a["Temp"] = a["Temp"].apply(lambda x: dic[x])
rerun7 = 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[10]:
In [18]:
rerun7 = pd.read_feather("/Users/weilu/Research/server/may_2018/second/rerun_7_19_May_155517.feather")
rerun6 = pd.read_feather("/Users/weilu/Research/server/may_2018/second/rerun_6_19_May_155517.feather")
data = pd.concat([rerun6, rerun7])
dic = {"T0":300, "T1":335, "T2":373, "T3":417, "T4":465, "T5":519, "T6":579, "T7":645, "T8":720, "T9":803, "T10":896, "T11":1000}
data["TempT"] = data["Temp"].apply(lambda x: dic[x])
chosen = data.query("TempT < 420")
chosen.reset_index().to_feather("/Users/weilu/Research/server/may_2018/03_week/all_data_folder/second_may19.feather")
In [19]:
data
Out[19]:
In [3]:
data = pd.read_feather("/Users/weilu/Research/server/may_2018/second/rerun_7_14_May_124103.feather")
dic = {"T0":300, "T1":335, "T2":373, "T3":417, "T4":465, "T5":519, "T6":579, "T7":645, "T8":720, "T9":803, "T10":896, "T11":1000}
a = data
a["Temp"] = a["Temp"].apply(lambda x: dic[x])
rerun7 = 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[3]:
In [54]:
rerun7.columnsmns
Out[54]:
In [60]:
data = pd.read_feather("/Users/weilu/Research/server/may_2018/second/rerun_6_10_May_222655.feather")
dic = {"T0":300, "T1":335, "T2":373, "T3":417, "T4":465, "T5":519, "T6":579, "T7":645, "T8":720, "T9":803, "T10":896, "T11":1000}
a = data
a["Temp"] = a["Temp"].apply(lambda x: dic[x])
rerun6 = 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[60]:
In [2]:
data = pd.read_feather("/Users/weilu/Research/server/may_2018/second/rerun_7_10_May_222655.feather")
dic = {"T0":300, "T1":335, "T2":373, "T3":417, "T4":465, "T5":519, "T6":579, "T7":645, "T8":720, "T9":803, "T10":896, "T11":1000}
a = data
a["Temp"] = a["Temp"].apply(lambda x: dic[x])
rerun7 = 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[2]:
In [3]:
data = pd.read_feather("/Users/weilu/Research/server/may_2018/second/rerun_5_09_May_225324.feather")
dic = {"T0":300, "T1":335, "T2":373, "T3":417, "T4":465, "T5":519, "T6":579, "T7":645, "T8":720, "T9":803, "T10":896, "T11":1000}
a = data
a["Temp"] = a["Temp"].apply(lambda x: dic[x])
rerun5 = data
t = a.query("Temp < 600").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[3]:
In [196]:
data = pd.read_feather("/Users/weilu/Research/server/may_2018/02_week/all_data_folder/second.feather")
In [8]:
data.query("Temp == 417").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[8]:
In [9]:
data.query("Temp == 417 and z_h6 < -10").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[9]:
In [4]:
data.query("Temp == 373").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[4]:
In [202]:
data.query("Temp == 373 and z_h6 < -10").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[202]:
In [208]:
t = data.query("Temp == 373 and z_h6 < -10")
select(t)
Out[208]:
In [197]:
data.query("Temp == 300").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[197]:
In [130]:
rerun7.query("Temp == 300").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[130]:
In [206]:
t = data.query("Temp == 300 and Qw < 0.31 and z_h6 > -10")
t.plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[206]:
In [207]:
select(t)
Out[207]:
In [129]:
rerun7.query("Temp == 335").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[129]:
In [135]:
t = rerun7.query("Temp == 335 and z_h6 < -10 and Qw > 0.3").reset_index()
t["BiasTo"] = t["BiasTo"].apply(pd.to_numeric)
In [136]:
t.plot.hexbin("DisReal", "BiasTo", cmap="seismic", sharex=False)
Out[136]:
In [ ]:
In [138]:
select(t)
Out[138]:
In [139]:
t.groupby("BiasTo").mean()
Out[139]:
In [ ]:
rerun7.query("Temp == 335 and z_h6 < -10").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
In [127]:
rerun7.query("Temp == 335 and z_h6 < -10").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[127]:
In [126]:
rerun7.query("Temp == 300 and z_h6 < -10").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[126]:
In [140]:
rerun7.query("Temp == 300").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[140]:
In [141]:
rerun7.query("Temp == 300 and z_h6 > -10").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[141]:
In [148]:
rerun7.query("Temp == 300").plot.hexbin("TotalE", "Qw", cmap="seismic", sharex=False)
Out[148]:
In [143]:
rerun7.query("Temp == 300").plot.hexbin("AMH", "Qw", cmap="seismic", sharex=False)
Out[143]:
In [123]:
rerun7.query("Temp == 300").plot.hexbin("AMH-Go", "Qw", cmap="seismic", sharex=False)
Out[123]:
In [ ]:
rerun7.query("Temp == 300 and z_h6 > -10").plot.hexbin("AMH", "Qw", cmap="seismic", sharex=False)
In [156]:
t = rerun7.query("Temp == 300 and z_h6 < -10 and Qw < 0.5 and Qw > 0.3")
t2 = rerun7.query("Temp == 300 and z_h6 > -10 and Qw < 0.5 and Qw > 0.3")
In [157]:
t.mean() -t2.mean()
Out[157]:
In [171]:
t = rerun7.query("Temp == 300")
t.plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[171]:
In [172]:
t = rerun7.query("Temp == 335")
t.plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[172]:
In [173]:
t = rerun7.query("Temp == 373")
t.plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[173]:
In [169]:
t = rerun7.query("Temp == 300 and z_h6 < -10 and Qw < 0.5 and Qw > 0.3")
t.plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[169]:
In [155]:
select(t)
Out[155]:
In [160]:
t = rerun7.query("Temp == 335 and z_h6 < -10 and Qw < 0.5 and Qw > 0.3")
t.plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[160]:
In [161]:
select(t)
Out[161]:
In [153]:
t = rerun7.query("Temp == 300 and z_h6 < -10 and Qw < 0.3")
t.plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[153]:
In [145]:
select(t)
Out[145]:
In [151]:
t = rerun7.query("Temp == 335 and z_h6 < -10 and Qw < 0.3")
t.plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[151]:
In [152]:
select(t)
Out[152]:
In [117]:
t.columns
Out[117]:
In [118]:
t.plot.hexbin("Lipid1", "AMH", cmap="seismic", sharex=False)
Out[118]:
In [108]:
select(t)
Out[108]:
In [62]:
rerun7.query("Temp == 335").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[62]:
In [102]:
t = rerun7.query("Temp == 335 and z_h6 > -10 and Qw < 0.3")
t.plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[102]:
In [103]:
select(t)
Out[103]:
In [67]:
rerun7.query("Temp == 335").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[67]:
In [96]:
rerun7.query("Temp == 335").plot.hexbin("z_h6", "TotalE", cmap="seismic", sharex=False)
Out[96]:
In [98]:
rerun7.query("Temp == 335 and (z_h6 < -10 or Qw > 0.5)").plot.hexbin("Qw", "TotalE", cmap="seismic", sharex=False)
Out[98]:
In [99]:
rerun7.query("Temp == 335").plot.hexbin("Qw", "TotalE", cmap="seismic", sharex=False)
Out[99]:
In [58]:
rerun7.query("Temp == 300 and z_h6 < -10").plot.hexbin("AMH", "AMH-Go", cmap="seismic", sharex=False)
Out[58]:
In [66]:
rerun7.query("Temp == 335 and z_h6 < -10").plot.hexbin("AMH", "AMH-Go", cmap="seismic", sharex=False)
Out[66]:
In [83]:
rerun7.columns
Out[83]:
In [84]:
rerun7["enhanced"] = rerun7["AMH"]*0.1 + rerun7["TotalE"]
In [87]:
rerun7["enhanced2"] = rerun7["AMH"] + rerun7["TotalE"]
In [94]:
rerun7.query("Temp == 335").plot.scatter("Lipid1", "AMH")
Out[94]:
In [92]:
rerun7.query("Temp == 335").plot.scatter("Qw", "AMH")
Out[92]:
In [88]:
rerun7.query("Temp == 335").plot.scatter("TotalE", "enhanced2")
Out[88]:
In [86]:
rerun7.query("Temp == 335").plot.scatter("TotalE", "enhanced")
Out[86]:
In [72]:
data = pd.read_table("/Users/weilu/Research/server/may_2018/02_week/second_enhance_n/_280-350/data_7/t_335_dis_100.0.dat", sep="\s+", names=["a1","a2","a3","a4", "a5", "a6", "a7", "a8"])
In [81]:
data
Out[81]:
In [82]:
data.plot.scatter("a1", "a7")
Out[82]:
In [ ]:
rerun7.plot()
In [ ]:
rerun7.query("Temp == 335").plot.hexbin("AMH", "AMH-Go", cmap="seismic", sharex=False)
In [65]:
rerun7.query("Temp == 335").plot.hexbin("AMH", "AMH-Go", cmap="seismic", sharex=False)
Out[65]:
In [55]:
rerun7.query("Temp == 300").plot.hexbin("AMH", "AMH-Go", cmap="seismic", sharex=False)
Out[55]:
In [14]:
rerun5.query("Temp == 300").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[14]:
In [17]:
rerun7.query("Temp == 300").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[17]:
In [20]:
rerun7.query("Temp == 300 and (z_h6 < -10 or Qw > 0.5) ").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[20]:
In [22]:
t= rerun7.query("Temp == 300 and z_h6 < -10")
select(t)
Out[22]:
In [23]:
rerun7.query("Temp == 335 and (z_h6 < -10 or Qw > 0.5) ").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[23]:
In [27]:
t= rerun7.query("Temp == 335 and z_h6 < -10 and Qw > 0.25")
select(t)
Out[27]:
In [18]:
rerun7.query("Temp == 300").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[18]:
In [15]:
rerun5.query("Temp == 300 and z_h6 < -10 and Qw > 0.25").shape
Out[15]:
In [16]:
rerun7.query("Temp == 300 and z_h6 < -10 and Qw > 0.25").shape
Out[16]:
In [ ]:
In [4]:
rerun5.query("Temp == 335").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[4]:
In [5]:
rerun7.query("Temp == 335").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)
Out[5]:
In [10]:
rerun5.query("Temp == 335 and z_h6 < -10 and Qw > 0.25").shape
Out[10]:
In [9]:
rerun7.query("Temp == 335 and z_h6 < -10 and Qw > 0.25").shape
Out[9]:
In [12]:
rerun7.query("Temp == 335 and z_h6 < -10").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[12]:
In [13]:
rerun5.query("Temp == 335 and z_h6 < -10").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)
Out[13]:
In [50]:
pre = "/Users/weilu/Research/server/may_2018/01_week"
temp = 320
location = pre + "/second_combine/_280-350/2d_z_qw/force_0.1/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(1, 10), 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)
Out[50]:
In [40]:
pre = "/Users/weilu/Research/server/may_2018/01_week"
temp = 310
location = pre + "/second_rerun2/_280-350/2d_z_qw/force_0.1/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(1, 10), 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)
Out[40]:
In [ ]: