import numpy as np
from scipy.special import kl_div
import matplotlib.pyplot as plt
from matplotlib import gridspec
from jl_spectra_2_structure.plotting_tools import set_figure_settings

#######################################################################################
# set figure settings
# -------------------
#
# First we'll set up vectors to store the wasserstein loss of A1, A2, and A3, with respect to B.
# The kl-divergence loss does not change with these threee vectors.
# Second we'll set up the vectors to store the derivative of the loss with respect to the non-zero indices.

set_figure_settings('presentation')
a = np.linspace(0, 1, num=100, endpoint=True)
B = [0, 0, 0, 1]
Wl = np.zeros_like(a)
Wl2 = np.zeros_like(a)
Wl3 = np.zeros_like(a)
KL = np.zeros_like(a)
dEdO1 = np.zeros_like(a)
dEdO2 = np.zeros_like(a)
dEdO3 = np.zeros_like(a)
dEdO14 = np.zeros_like(a)
dEdO24 = np.zeros_like(a)
dEdO34 = np.zeros_like(a)
dKLdOi = np.zeros_like(a)
for i in range(len(a)):
    A = np.array([a[i], 0, 0, 1 - a[i]])
Example #2
0
@author: lansford
"""

from __future__ import division
import os
import json_tricks
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams
from jl_spectra_2_structure import get_default_data_paths
from jl_spectra_2_structure.plotting_tools import set_figure_settings
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline

set_figure_settings('paper')

#Folder where figures are to be saved
Downloads_folder = os.path.join(os.path.expanduser("~"), 'Downloads')

#Generate Primary Set of Data from DFT for CO

#Only change this code below if you wish to use a different set of adsorbates
#and metal atoms

Adsorbates_list = ['CO', 'NO', 'C2H4']
pipeline = Pipeline([('scaling', StandardScaler()),
                     ('pca', PCA(n_components=2))])
Xlim_list = [[1580, 2130], [1300, 1900], [-3, 3]]
xlabel = [
    'C-O frequency [cm$^{-1}$]', 'N-O frequency [cm$^{-1}$]',
@author: lansford
"""

from __future__ import division
import os
import json_tricks
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams
from jl_spectra_2_structure import get_default_data_paths
from jl_spectra_2_structure.plotting_tools import set_figure_settings
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
set_figure_settings('paper', **{'lines.markersize': 3})

#Folder where figures are to be saved
Downloads_folder = os.path.join(os.path.expanduser("~"), 'Downloads')

#Generate Primary Set of Data from DFT for CO

#Only change this code below if you wish to use a different set of adsorbates
#and metal atoms

Adsorbates_list = ['C2H4']
pipeline = Pipeline([('scaling', StandardScaler()),
                     ('pca', PCA(n_components=2))])
Xlim_list = [[-5, 17]]
xlabel = ['Frequency PC-1 [cm$^{-1}$]']
ylabel1 = ['Frequency PC-2 [cm$^{-1}$]']