예제 #1
0
from methods import isnotebook
isnotebook_i = isnotebook()
if isnotebook_i:
    from tqdm.notebook import tqdm
    verbose = True
    show_plot = True
else:
    from tqdm import tqdm
    verbose = False
    show_plot = False

# ### Read Data

# +
from methods import get_df_features_targets
df_features_targets = get_df_features_targets()

from methods import get_df_slab
df_slab = get_df_slab()

from methods import get_df_SOAP_AS, get_df_SOAP_MS, get_df_SOAP_ave
df_SOAP_AS = get_df_SOAP_AS()
df_SOAP_MS = get_df_SOAP_MS()
df_SOAP_ave = get_df_SOAP_ave()

# #########################################################
df_i = df_features_targets

# Getting phase > 1 slab ids
df_slab_i = df_slab[df_slab.phase > 1]
phase_2_slab_ids = df_slab_i.slab_id.tolist()
예제 #2
0
import pickle

import numpy as np

import plotly.graph_objs as go

from sklearn.linear_model import LinearRegression

# #########################################################
from methods import get_df_features_targets
# -

# ### Read Data

# +
df_mine = get_df_features_targets()

# #########################################################
path_i = os.path.join(
    os.environ["PROJ_irox_oer"],
    "workflow/seoin_irox_data/featurize_data",
    "out_data/df_features_targets.pickle")
with open(path_i, "rb") as fle:
    df_seoin = pickle.load(fle)
# #########################################################

# +
data = []

elec_or_gibbs = "g"
# Pickling data ###########################################
directory = os.path.join(
    os.environ["PROJ_irox_oer"],
    "workflow/feature_engineering",
    "out_data")
file_name_i = "df_features_targets.pickle"
path_i = os.path.join(directory, file_name_i)
if not os.path.exists(directory): os.makedirs(directory)
with open(path_i, "wb") as fle:
    pickle.dump(df_features_targets, fle)
# #########################################################

# +
from methods import get_df_features_targets

df_features_targets_tmp = get_df_features_targets()
df_features_targets_tmp.head()
# -

# #########################################################
print(20 * "# # ")
print("All done!")
print("Run time:", np.round((time.time() - ti) / 60, 3), "min")
print("combine_features_targets.ipynb")
print(20 * "# # ")
# #########################################################

# + active=""
#
#
#
예제 #4
0
def old_get_ORR_PLT():
    """
    """
    #| - get_ORR_PLT

    # #########################################################
    # df_ads = get_df_ads()

    # df_ads = df_ads[~df_ads.g_oh.isna()]
    # df_m = df_ads

    # #########################################################
    df_dft = get_df_dft()

    # #########################################################
    df_job_ids = get_df_job_ids()

    # #########################################################
    df_features_targets = get_df_features_targets()



    smart_format_dict = [
        [{"stoich": "AB2"}, {"color2": "black"}],
        [{"stoich": "AB3"}, {"color2": "grey"}],
        ]

    ORR_PLT = ORR_Free_E_Plot(
        free_energy_df=None,
        state_title="ads",
        free_e_title="ads_g",
        smart_format=smart_format_dict,
        color_list=None,
        rxn_type="OER")

    # # df_m.g_ooh = 1.16 * df_m.g_oh + 2.8
    # df_m["g_ooh"] = df_m.g_oh + 2.8

    # df_m = df_m.set_index(["compenv", "slab_id", ], drop=False)

    new_col = (df_features_targets["targets"]["g_oh"] + 2.8)

    new_col.name = ("targets", "g_ooh", "", )

    df_features_targets = pd.concat([
        new_col,
        df_features_targets,
        ], axis=1)


    paths_dict = dict()
    # for name_i, row_i in df_m.iterrows():
    for name_i, row_i in df_features_targets.iterrows():

        #| - Loop through data and add to ORR_PLT

        # #####################################################
        g_o_i = row_i[("targets", "g_o", "", )]
        g_oh_i = row_i[("targets", "g_oh", "", )]
        g_ooh_i = row_i[("targets", "g_ooh", "", )]
        slab_id_i = row_i[("data", "slab_id", "")]
        active_site_i = row_i[("data", "active_site", "")]
        job_id_o_i = row_i[("data", "job_id_o", "")]
        job_id_oh_i = row_i[("data", "job_id_oh", "")]
        # #####################################################

        # #####################################################
        df_job_ids_i = df_job_ids[df_job_ids.slab_id == slab_id_i]

        bulk_ids = df_job_ids_i.bulk_id.unique()

        mess_i = "SIJFIDSIFJIDSJIf"
        assert len(bulk_ids) == 1, mess_i

        bulk_id_i = bulk_ids[0]

        # #########################################################
        row_dft_i = df_dft.loc[bulk_id_i]
        # #########################################################
        stoich_i = row_dft_i.stoich
        # #########################################################


        data_dict_list =  [
            {"ads_g": g_o_i, "ads": "o", },
            {"ads_g": g_oh_i, "ads": "oh", },
            {"ads_g": g_ooh_i, "ads": "ooh", },
            {"ads_g": 0., "ads": "bulk", },
            ]
        df_i = pd.DataFrame(data_dict_list)

        df_i["stoich"] = stoich_i


        prop_name_list = [
            "stoich",
            ]

        # #########################################################
        # name_i = "IDSJFISDf"
        name_i = slab_id_i + "__" + str(int(active_site_i))
        ORR_PLT.add_series(
            df_i,
            plot_mode="all",
            overpotential_type="OER",
            property_key_list=prop_name_list,
            add_overpot=False,
            name_i=name_i,
            )
        #__|

    return(ORR_PLT)