diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4bb3c1f..3b6f98f 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,9 +1,30 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + @@ -416,7 +440,21 @@ @@ -454,7 +492,8 @@ - @@ -478,10 +517,10 @@ - + - + @@ -496,29 +535,37 @@ - - + + + + - - + + + + - - + + + + - - + + + + @@ -557,9 +604,10 @@ - - + + + @@ -577,9 +625,10 @@ - - + + + diff --git a/README.md b/README.md index c83f743..742d916 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # REEPS -REEPS (Rare Earth Element Parameter Searcher) is a toolkit for estimating standard thermodynamic parameters for Gibbs minimization. -Extend a methodology for estimating standard thermodynamic parameters for Gibbs minimization in multiphase, multicomponent separations systems +LLEPE (Liquid-Liquid Extraction Parameter Estimator) is a toolkit for estimating standard thermodynamic parameters for Gibbs minimization. + ## Installation -To install REEPS, clone the repository with the command +To install llepe, clone the repository with the command ``` $ git clone https://xgitlab.cels.anl.gov/summer-2020/parameter-estimation.git @@ -19,16 +19,42 @@ and run the command below in your terminal ``` $ pip install -e. ``` +For docs and tests, run +``` +$ pip install -e .[docs,tests] +``` ### Dependencies -REEPS uses packages: cantera (https://cantera.org/), pandas, numpy, scipy, xml, seaborn, and matplotlib +llepe uses packages: cantera (https://cantera.org/), pandas, numpy, scipy, xml, seaborn, and matplotlib ## Usage Check out examples in docs/examples + +Readthedocs documentation are in docs/build/html/index.html ```python -from reeps import REEPS -searcher = REEPS(**REEPS_parameters_dictionary) -optimized_parameter_dictionary = searcher.fit() -searcher.update_xml(optimized_parameter_dictionary) -searcher.parity_plot() -print(seacher.r_squared()) +from llepe import LLEPE + opt_dict = {'Nd(H(A)2)3(org)_h0': {'upper_element_name': 'species', + 'upper_attrib_name': 'name', + 'upper_attrib_value': 'Nd(H(A)2)3(org)', + 'lower_element_name': 'h0', + 'lower_attrib_name': None, + 'lower_attrib_value': None, + 'input_format': '{0}', + 'input_value': -4.7e6}} + + searcher_parameters = {'exp_data': 'Nd_exp_data.csv', + 'phases_xml_filename': 'twophase.xml', + 'opt_dict': opt_dict, + 'phase_names': ['HCl_electrolyte', 'PC88A_liquid'], + 'aq_solvent_name': 'H2O(L)', + 'extractant_name': '(HA)2(org)', + 'diluant_name': 'dodecane', + 'complex_names': ['Nd(H(A)2)3(org)'], + 'extracted_species_ion_names': ['Nd+++'], + 'aq_solvent_rho': 1000.0, + 'extractant_rho': 960.0, + 'diluant_rho': 750.0} + searcher = LLEPE(**searcher_parameters) + est_enthalpy = searcher.fit() + searcher.update_xml(est_enthalpy) + searcher.parity_plot(print_r_squared=True) ``` diff --git a/data/csvs/PC88A_HCL_NdPrCeLaDySmY.csv b/data/csvs/PC88A_HCL_NdPrCeLaDySmY.csv index b2646d3..bd7991a 100644 --- a/data/csvs/PC88A_HCL_NdPrCeLaDySmY.csv +++ b/data/csvs/PC88A_HCL_NdPrCeLaDySmY.csv @@ -10,16 +10,16 @@ Lyon (2016),0.01,0.01,1,1,0.259983361,0.197587354,0.315789474,0.088710553,0.0718 Lyon (2016),0.05,0.05,1,1,0.259983361,0.207986689,0.25,0.088710553,0.07540397,0.176470588,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Lyon (2016),0.1,0.1,1,1,0.259983361,0.21578619,0.204819277,0.088710553,0.077178181,0.149425287,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Lyon (2016),0.3,0.3,1,1,0.259983361,0.244384359,0.063829787,0.088710553,0.08338792,0.063829787,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -Liu (2014),1.00E-05,1.00E-05,0.1,0.1,0.022739878,0.017097653,0.33,0.008303308,0.006642646,0.25,0,0,0,0.054425491,0.050393973,0.08,0,0,0,0,0,0,0,0,0 -Liu (2014),1.00E-05,1.00E-05,0.3,0.3,0.022739878,0.013298174,0.71,0.008303308,0.005462702,0.52,0,0,0,0.054425491,0.048594188,0.12,0,0,0,0,0,0,0,0,0 -Liu (2014),1.00E-05,1.00E-05,0.5,0.5,0.022739878,0.010932634,1.08,0.008303308,0.004537327,0.83,0,0,0,0.054425491,0.048164151,0.13,0,0,0,0,0,0,0,0,0 -Liu (2014),1.00E-05,1.00E-05,0.7,0.7,0.022739878,0.009396644,1.42,0.008303308,0.003972875,1.09,0,0,0,0.054425491,0.047326514,0.15,0,0,0,0,0,0,0,0,0 -Liu (2014),1.00E-05,1.00E-05,0.9,0.9,0.022739878,0.008209342,1.77,0.008303308,0.002997584,1.77,0,0,0,0.054425491,0.045735706,0.19,0,0,0,0,0,0,0,0,0 -Banda (2014),1.00E-05,1.00E-05,0.1,0.1,0.022739878,0.018928042,0.201385664,0.008303308,0.007354823,0.128960943,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -Banda (2014),1.00E-05,1.00E-05,0.3,0.3,0.022739878,0.014333115,0.586527247,0.008303308,0.005999476,0.384005473,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -Banda (2014),1.00E-05,1.00E-05,0.5,0.5,0.022739878,0.010952454,1.076235839,0.008303308,0.004805359,0.727926764,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -Banda (2014),1.00E-05,1.00E-05,0.7,0.7,0.022739878,0.008786058,1.588177405,0.008303308,0.003974007,1.089404412,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -Banda (2014),1.00E-05,1.00E-05,0.9,0.9,0.022739878,0.00700602,2.245762712,0.008303308,0.00322327,1.576050934,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +Banda (2014),1.00E-05,1.00E-05,0.1,0.1,0.022739878,0.017097653,0.33,0.008303308,0.006642646,0.25,0,0,0,0.054425491,0.050393973,0.08,0,0,0,0,0,0,0,0,0 +Banda (2014),1.00E-05,1.00E-05,0.3,0.3,0.022739878,0.013298174,0.71,0.008303308,0.005462702,0.52,0,0,0,0.054425491,0.048594188,0.12,0,0,0,0,0,0,0,0,0 +Banda (2014),1.00E-05,1.00E-05,0.5,0.5,0.022739878,0.010932634,1.08,0.008303308,0.004537327,0.83,0,0,0,0.054425491,0.048164151,0.13,0,0,0,0,0,0,0,0,0 +Banda (2014),1.00E-05,1.00E-05,0.7,0.7,0.022739878,0.009396644,1.42,0.008303308,0.003972875,1.09,0,0,0,0.054425491,0.047326514,0.15,0,0,0,0,0,0,0,0,0 +Banda (2014),1.00E-05,1.00E-05,0.9,0.9,0.022739878,0.008209342,1.77,0.008303308,0.002997584,1.77,0,0,0,0.054425491,0.045735706,0.19,0,0,0,0,0,0,0,0,0 +Liu (2014),1.00E-05,1.00E-05,0.1,0.1,0.022739878,0.018928042,0.201385664,0.008303308,0.007354823,0.128960943,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +Liu (2014),1.00E-05,1.00E-05,0.3,0.3,0.022739878,0.014333115,0.586527247,0.008303308,0.005999476,0.384005473,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +Liu (2014),1.00E-05,1.00E-05,0.5,0.5,0.022739878,0.010952454,1.076235839,0.008303308,0.004805359,0.727926764,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +Liu (2014),1.00E-05,1.00E-05,0.7,0.7,0.022739878,0.008786058,1.588177405,0.008303308,0.003974007,1.089404412,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +Liu (2014),1.00E-05,1.00E-05,0.9,0.9,0.022739878,0.00700602,2.245762712,0.008303308,0.00322327,1.576050934,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 Kim (2012),0.01023293,0.01023293,0.1,0.1,0.009359401,0.007999488,0.17,0.003371001,0.003064546,0.1,0.038539496,0.037783819,0.02,0.022461314,0.022020896,0.02,0,0,0,0,0,0,0,0,0 Kim (2012),0.01023293,0.01023293,0.3,0.3,0.009359401,0.006881912,0.36,0.003371001,0.002763116,0.22,0.038539496,0.035357336,0.09,0.022461314,0.021597417,0.04,0,0,0,0,0,0,0,0,0 Kim (2012),0.01023293,0.01023293,0.5,0.5,0.009359401,0.005813293,0.61,0.003371001,0.002340973,0.44,0.038539496,0.032386131,0.19,0.022461314,0.02060671,0.09,0,0,0,0,0,0,0,0,0 diff --git a/data/xmls/PC88A_HCL_NdPrCeLaDySmY_w_pitzer.xml b/data/xmls/PC88A_HCL_NdPrCeLaDySmY_w_pitzer.xml index d2ad522..b218c2a 100644 --- a/data/xmls/PC88A_HCL_NdPrCeLaDySmY_w_pitzer.xml +++ b/data/xmls/PC88A_HCL_NdPrCeLaDySmY_w_pitzer.xml @@ -33,7 +33,7 @@ 298.14999999999998 - -1376882.3191117246 + -1376882.0784583509 558.9824 0.0 @@ -50,7 +50,7 @@ 298.14999999999998 - -4925566.309854757 + -4924298.0880370205 1117.965 0.0 @@ -67,7 +67,7 @@ 298.14999999999998 - -4938249.845712334 + -4935685.119723228 1117.965 0.0 @@ -85,7 +85,7 @@ 298.14999999999998 - -4920387.823199008 + -4920369.042961768 1117.965 0.0 @@ -103,7 +103,7 @@ 298.14999999999998 - -4933548.865580005 + -4928639.61964031 1117.965 0.0 @@ -120,7 +120,7 @@ 298.14999999999998 - -4932560.171447597 + -4931991.722599618 1117.965 0.0 @@ -138,7 +138,7 @@ 298.14999999999998 - -4944840.781582316 + -4944682.264585918 1117.965 0.0 @@ -157,7 +157,7 @@ 298.14999999999998 - -4924696.189921901 + -4924669.3217661735 1117.965 0.0 @@ -245,10 +245,10 @@ - 0.05879108748614492, 0.0, 0.0, 0.0, 0.0 - 0.5448324180244323, 0.0, 0.0, 0.0, 0.0 + 0.058791091500561485, 0.0, 0.0, 0.0, 0.0 + 0.5448322248125199, 0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0, 0.0 - -0.02066999867229882, 0.0, 0.0, 0.0, 0.0 + -0.02066999867229882, 0.0, 0.0, 0.0, 0.0 2 0 @@ -261,10 +261,10 @@ - 1.2137222016802447, 0.0, 0.0, 0.0, 0.0 - 7.748226963005033, 0.0, 0.0, 0.0, 0.0 + 1.213717095858249, 0.0, 0.0, 0.0, 0.0 + 7.7481294675488375, 0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0, 0.0 - -0.01963615126026457, 0.0, 0.0, 0.0, 0.0 + -0.01963615126026457, 0.0, 0.0, 0.0, 0.0 2 0 @@ -277,10 +277,10 @@ - 1.022316535866388, 0.0, 0.0, 0.0, 0.0 - 0.5296311209773129, 0.0, 0.0, 0.0, 0.0 + 1.0223168335791355, 0.0, 0.0, 0.0, 0.0 + 0.5296306654103653, 0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0, 0.0 - -0.024339999997603376, 0.0, 0.0, 0.0, 0.0 + -0.024339999997603376, 0.0, 0.0, 0.0, 0.0 2 0 @@ -293,10 +293,10 @@ - 0.7646397332938777, 0.0, 0.0, 0.0, 0.0 - 7.849320590516409, 0.0, 0.0, 0.0, 0.0 + 0.7646372240575223, 0.0, 0.0, 0.0, 0.0 + 7.849276225207628, 0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0, 0.0 - -0.019699989216349984, 0.0, 0.0, 0.0, 0.0 + -0.019699989216349984, 0.0, 0.0, 0.0, 0.0 2 0 @@ -309,10 +309,10 @@ - 0.2035235053232368, 0.0, 0.0, 0.0, 0.0 - 21.120426174002823, 0.0, 0.0, 0.0, 0.0 + 0.20352350320923904, 0.0, 0.0, 0.0, 0.0 + 21.120419048363047, 0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0, 0.0 - -0.02618999999473301, 0.0, 0.0, 0.0, 0.0 + -0.02618999999473301, 0.0, 0.0, 0.0, 0.0 2 0 @@ -325,10 +325,10 @@ - 0.8852802073165494, 0.0, 0.0, 0.0, 0.0 - 9.334653075341238, 0.0, 0.0, 0.0, 0.0 + 0.8852797060008407, 0.0, 0.0, 0.0, 0.0 + 9.334636294454038, 0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0, 0.0 - -0.015467323909969704, 0.0, 0.0, 0.0, 0.0 + -0.015467323909969704, 0.0, 0.0, 0.0, 0.0 2 0 @@ -341,10 +341,10 @@ - 0.6989081585234721, 0.0, 0.0, 0.0, 0.0 - 6.877882600430561, 0.0, 0.0, 0.0, 0.0 + 0.6989083059080712, 0.0, 0.0, 0.0, 0.0 + 6.877881736471866, 0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0, 0.0 - -0.019920000110321332, 0.0, 0.0, 0.0, 0.0 + -0.019920000110321332, 0.0, 0.0, 0.0, 0.0 2 0 diff --git a/data/xmls/twophase.xml b/data/xmls/twophase.xml index 1d0d109..3520b33 100644 --- a/data/xmls/twophase.xml +++ b/data/xmls/twophase.xml @@ -50,7 +50,7 @@ 298.14999999999998 - -4704699.156668724 + -4704699.156668724 1117.965 0.0 diff --git a/docs/Examples/iterative_fitter_eval_grapher.py b/docs/Examples/iterative_fitter_eval_grapher.py index aaed7bd..8d997c4 100644 --- a/docs/Examples/iterative_fitter_eval_grapher.py +++ b/docs/Examples/iterative_fitter_eval_grapher.py @@ -10,6 +10,9 @@ font = {'family': 'sans serif', matplotlib.rc('font', **font) plt.rc('xtick', labelsize=18) plt.rc('ytick', labelsize=18) +plt.rcParams['lines.linewidth'] = 4 +matplotlib.rcParams['lines.markersize'] = 10 + def ext_to_complex(h0, custom_obj_dict, mini_species): linear_params = custom_obj_dict['lin_param_df'] @@ -24,7 +27,8 @@ def mod_lin_param_df(lp_df, input_val, mini_species, mini_lin_param): return new_lp_df -info_df = pd.read_csv('outputs/iterative_fitter_output2.csv') +info_df = pd.read_csv('outputs/iterative_fitter_w_mse_output.csv') +test_row = 3 pitzer_params_filename = "../../data/jsons/min_h0_pitzer_params.txt" with open(pitzer_params_filename) as file: pitzer_params_dict = json.load(file) @@ -33,6 +37,8 @@ species_list = 'Nd,Pr,Ce,La,Dy,Sm,Y'.split(',') pitzer_param_list = ['beta0', 'beta1'] labeled_data = pd.read_csv("../../data/csvs/" "PC88A_HCL_NdPrCeLaDySmY.csv") +labeled_data = labeled_data.sort_values(['Feed Pr[M]', 'Feed Ce[M]'], + ascending=True) exp_data = labeled_data.drop(labeled_data.columns[0], axis=1) xml_file = "PC88A_HCL_NdPrCeLaDySmY_w_pitzer.xml" lin_param_df = pd.read_csv("../../data/csvs" @@ -76,11 +82,11 @@ info_dict = {'(HA)2(org)_h0': {'upper_element_name': 'species', 'lower_attrib_value': None, 'input_format': '{0}', 'input_value': - info_df.iloc[-1, :]['best_ext_h0']}} + info_df.iloc[test_row, :]['best_ext_h0']}} for species in species_list: for pitzer_param in pitzer_param_list: pitzer_str = "{0}_{1}".format(species, pitzer_param) - value = info_df.iloc[-1, :][pitzer_str] + value = info_df.iloc[test_row, :][pitzer_str] pitzer_params_dict[pitzer_str]['input_value'] = value lin_str = "{0}_slope".format(species) inner_dict = {'custom_object_name': 'lin_param_df', @@ -91,7 +97,7 @@ for species in species_list: } info_dict[lin_str] = inner_dict lin_str = "{0}_intercept".format(species) - value = info_df.iloc[-1, :][lin_str] + value = info_df.iloc[test_row, :][lin_str] inner_dict = {'custom_object_name': 'lin_param_df', 'function': mod_lin_param_df, 'kwargs': {'mini_species': species, @@ -112,15 +118,52 @@ for col in exp_data.columns: if 'aq_i' in col: feed_cols.append(col) exp_data['total_re'] = exp_data[feed_cols].sum(axis=1) +label_list = [] +for index, row in exp_data[feed_cols].iterrows(): + bool_list = list((row > 0).values) + label = '' + for species, el in zip(species_list, bool_list): + if el: + label = '{0}-{1}'.format(label, species) + label = label[1:] + label_list.append(label) +r2s = "" for species in species_list: - save_name = 'outputs/parity_iterative_fitter_{0}_org_eq'.format(species) + # if species=='La': + # save_name = 'outputs' \ + # '/parity_iterative_fitter_{0}_org_eq'.format(species) + save_name = None + # fig, ax = estimator.parity_plot('{0}_org_eq'.format(species), + # c_data='z_i', + # c_label='Feed total RE ' + # 'molarity (mol/L)', + # print_r_squared=True, + # save_path=save_name) + r2s += str(estimator.r_squared('{0}_org_eq'.format(species))) + ',' + fig, ax = estimator.parity_plot('{0}_org_eq'.format(species), - c_data=exp_data[ - 'total_re'].values, - c_label='Feed total RE ' - 'molarity (mol/L)', + data_labels=label_list, print_r_squared=True, save_path=save_name) + ax.legend(loc=4) +pred_df = pd.DataFrame(estimator.get_predicted_dict()) +new_cols = [] +for col in pred_df.columns: + new_cols.append("pred_{0}".format(col)) +pred_df.columns = new_cols +new_cols = ['label', + 'h_i', + 'h_eq', + 'z_i', + 'z_eq' + ] +for species in species_list: + new_cols.append("{0}_aq_i".format(species)) + new_cols.append("{0}_aq_eq".format(species)) + new_cols.append("{0}_d_eq".format(species)) +labeled_data.columns = new_cols +total_df = labeled_data.join(pred_df) +# total_df.to_csv('if_mse_total_df.csv') # short_info_dict = {} # for key, value in info_dict.items(): # short_info_dict[key] = value['input_value'] diff --git a/docs/Examples/outputs/temp.xml b/docs/Examples/outputs/temp.xml index e292885..b218c2a 100644 --- a/docs/Examples/outputs/temp.xml +++ b/docs/Examples/outputs/temp.xml @@ -33,7 +33,7 @@ 298.14999999999998 - -1376882.3191117246 + -1376882.0784583509 558.9824 0.0 @@ -50,7 +50,7 @@ 298.14999999999998 - -4925566.309854757 + -4924298.0880370205 1117.965 0.0 @@ -67,7 +67,7 @@ 298.14999999999998 - -4938249.845712334 + -4935685.119723228 1117.965 0.0 @@ -85,7 +85,7 @@ 298.14999999999998 - -4920387.823199008 + -4920369.042961768 1117.965 0.0 @@ -103,7 +103,7 @@ 298.14999999999998 - -4933548.865580005 + -4928639.61964031 1117.965 0.0 @@ -120,7 +120,7 @@ 298.14999999999998 - -4932560.171447597 + -4931991.722599618 1117.965 0.0 @@ -138,7 +138,7 @@ 298.14999999999998 - -4944840.781582316 + -4944682.264585918 1117.965 0.0 @@ -157,7 +157,7 @@ 298.14999999999998 - -4924696.189921901 + -4924669.3217661735 1117.965 0.0 @@ -245,10 +245,10 @@ - 0.05879108748614492, 0.0, 0.0, 0.0, 0.0 - 0.5448324180244323, 0.0, 0.0, 0.0, 0.0 + 0.058791091500561485, 0.0, 0.0, 0.0, 0.0 + 0.5448322248125199, 0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0, 0.0 - -0.02066999867229882, 0.0, 0.0, 0.0, 0.0 + -0.02066999867229882, 0.0, 0.0, 0.0, 0.0 2 0 @@ -261,10 +261,10 @@ - 1.2137222016802447, 0.0, 0.0, 0.0, 0.0 - 7.748226963005033, 0.0, 0.0, 0.0, 0.0 + 1.213717095858249, 0.0, 0.0, 0.0, 0.0 + 7.7481294675488375, 0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0, 0.0 - -0.01963615126026457, 0.0, 0.0, 0.0, 0.0 + -0.01963615126026457, 0.0, 0.0, 0.0, 0.0 2 0 @@ -277,10 +277,10 @@ - 1.022316535866388, 0.0, 0.0, 0.0, 0.0 - 0.5296311209773129, 0.0, 0.0, 0.0, 0.0 + 1.0223168335791355, 0.0, 0.0, 0.0, 0.0 + 0.5296306654103653, 0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0, 0.0 - -0.024339999997603376, 0.0, 0.0, 0.0, 0.0 + -0.024339999997603376, 0.0, 0.0, 0.0, 0.0 2 0 @@ -293,10 +293,10 @@ - 0.7646397332938777, 0.0, 0.0, 0.0, 0.0 - 7.849320590516409, 0.0, 0.0, 0.0, 0.0 + 0.7646372240575223, 0.0, 0.0, 0.0, 0.0 + 7.849276225207628, 0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0, 0.0 - -0.019699989216349984, 0.0, 0.0, 0.0, 0.0 + -0.019699989216349984, 0.0, 0.0, 0.0, 0.0 2 0 @@ -309,10 +309,10 @@ - 0.2035235053232368, 0.0, 0.0, 0.0, 0.0 - 21.120426174002823, 0.0, 0.0, 0.0, 0.0 + 0.20352350320923904, 0.0, 0.0, 0.0, 0.0 + 21.120419048363047, 0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0, 0.0 - -0.02618999999473301, 0.0, 0.0, 0.0, 0.0 + -0.02618999999473301, 0.0, 0.0, 0.0, 0.0 2 0 @@ -325,10 +325,10 @@ - 0.8852802073165494, 0.0, 0.0, 0.0, 0.0 - 9.334653075341238, 0.0, 0.0, 0.0, 0.0 + 0.8852797060008407, 0.0, 0.0, 0.0, 0.0 + 9.334636294454038, 0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0, 0.0 - -0.015467323909969704, 0.0, 0.0, 0.0, 0.0 + -0.015467323909969704, 0.0, 0.0, 0.0, 0.0 2 0 @@ -341,10 +341,10 @@ - 0.6989081585234721, 0.0, 0.0, 0.0, 0.0 - 6.877882600430561, 0.0, 0.0, 0.0, 0.0 + 0.6989083059080712, 0.0, 0.0, 0.0, 0.0 + 6.877881736471866, 0.0, 0.0, 0.0, 0.0 0.0, 0.0, 0.0, 0.0, 0.0 - -0.019920000110321332, 0.0, 0.0, 0.0, 0.0 + -0.019920000110321332, 0.0, 0.0, 0.0, 0.0 2 0 diff --git a/docs/build/doctrees/environment.pickle b/docs/build/doctrees/environment.pickle index 176b86d..bfa0d33 100644 Binary files a/docs/build/doctrees/environment.pickle and b/docs/build/doctrees/environment.pickle differ diff --git a/docs/build/doctrees/guide/install.doctree b/docs/build/doctrees/guide/install.doctree index 3291873..46eb899 100644 Binary files a/docs/build/doctrees/guide/install.doctree and b/docs/build/doctrees/guide/install.doctree differ diff --git a/docs/build/doctrees/guide/quickstart.doctree b/docs/build/doctrees/guide/quickstart.doctree index 149c9f1..3f643f7 100644 Binary files a/docs/build/doctrees/guide/quickstart.doctree and b/docs/build/doctrees/guide/quickstart.doctree differ diff --git a/docs/build/doctrees/modules/reeps.doctree b/docs/build/doctrees/modules/reeps.doctree index 55a0dd7..e316e1a 100644 Binary files a/docs/build/doctrees/modules/reeps.doctree and b/docs/build/doctrees/modules/reeps.doctree differ diff --git a/docs/build/html/_images/quick_start_output.png b/docs/build/html/_images/quick_start_output.png new file mode 100644 index 0000000..eefb412 Binary files /dev/null and b/docs/build/html/_images/quick_start_output.png differ diff --git a/docs/build/html/_modules/llepe/llepe.html b/docs/build/html/_modules/llepe/llepe.html index 06aabe6..bf78f9b 100644 --- a/docs/build/html/_modules/llepe/llepe.html +++ b/docs/build/html/_modules/llepe/llepe.html @@ -159,7 +159,6 @@ from scipy.optimize import minimize # noinspection PyPep8Naming import xml.etree.ElementTree as ET -import seaborn as sns import matplotlib.pyplot as plt import shutil import copy @@ -169,9 +168,6 @@ import pkg_resources from .utils import set_size -sns.set() -sns.set(font_scale=1.6) -
[docs]class LLEPE: r""" @@ -285,7 +281,8 @@ :param extracted_species_list: (list) names of extracted species elements. If ``None``, extracted_species_list will be extracted_species_ion_names - without '+' i.e. 'Nd+++'->'Nd' + without '+' i.e. 'Nd+++'->'Nd' + :param aq_solvent_rho: (float) density of solvent (g/L) If ``None``, molar volume/molecular weight is used from xml @@ -413,12 +410,22 @@ 'function', 'kwargs', and 'independent_params. 'function' is a function of the form - ``function(independent_param__value_list, **kwargs)`` + + ``function(independent_param__value_list, custom_objects_dict, + **kwargs)`` + 'kwargs' are the extra arguments to pass to function + 'independent_params' is a list of parameter names in opt_dict that the dependent_param is a function of. + 'custom_objects_dict' is for accessing the estimator's internal + custom_objects_dict and must be included in the arguments, even if the + custom_objects_dict is not set and is None. + See example code for usage. + :param custom_objects_dict: (dict) dictionary containing custom objects + format: {<object_name_string>: <object>,...} """ def __init__(self, @@ -436,12 +443,13 @@ diluant_rho=None, opt_dict=None, objective_function='Log-MSE', - optimizer='SLSQP', + optimizer='scipy_minimize', temp_xml_file_path=None, dependant_params_dict=None, + custom_objects_dict=None ): self._built_in_obj_list = ['Log-MSE'] - self._built_in_opt_list = ['SLSQP'] + self._built_in_opt_list = ['scipy_minimize'] self._exp_data = exp_data self._phases_xml_filename = phases_xml_filename self._opt_dict = opt_dict @@ -463,6 +471,7 @@ temp_xml_file_path = r'{0}/temp.xml'.format(os.getenv('TEMP')) self._temp_xml_file_path = temp_xml_file_path self._dependant_params_dict = dependant_params_dict + self._custom_objects_dict = custom_objects_dict # Try and except for adding package data to path. # This only works for sdist, not bdist # If bdist is needed, research "manifest.in" python setup files @@ -474,7 +483,7 @@ except FileNotFoundError: self._phases_xml_filename = \ pkg_resources.resource_filename('llepe', - r'..\data\xmls\{0}'.format( + '../data/xmls/{0}'.format( phases_xml_filename)) shutil.copyfile(self._phases_xml_filename, self._temp_xml_file_path) @@ -485,7 +494,7 @@ self._exp_df = pd.read_csv(self._exp_data) except FileNotFoundError: self._exp_data = pkg_resources.resource_filename( - 'llepe', r'..\data\csvs\{0}'.format(self._exp_data)) + 'llepe', '../data/csvs/{0}'.format(self._exp_data)) self._exp_df = pd.read_csv(self._exp_data) else: self._exp_df = self._exp_data.copy() @@ -600,7 +609,7 @@ self._exp_df = pd.read_csv(self._exp_data) except FileNotFoundError: self._exp_data = pkg_resources.resource_filename( - 'llepe', r'..\data\csvs\{0}'.format(self._exp_data)) + 'llepe', '../data/csvs/{0}'.format(self._exp_data)) self._exp_df = pd.read_csv(self._exp_data) else: self._exp_df = exp_data.copy() @@ -654,7 +663,7 @@ except FileNotFoundError: self._phases_xml_filename = \ pkg_resources.resource_filename('llepe', - r'..\data\xmls\{0}'.format( + '../data/xmls/{0}'.format( phases_xml_filename)) shutil.copyfile(self._phases_xml_filename, self._temp_xml_file_path) @@ -998,7 +1007,7 @@ "optimizer must be a function " "with at least 2 arguments: " "f(objective_func,x_guess, kwargs)") - if optimizer == 'SLSQP': + if optimizer == 'scipy_minimize': optimizer = self.scipy_minimize self._optimizer = optimizer return None
@@ -1037,6 +1046,7 @@
[docs] def get_dependant_params_dict(self): """ Returns the dependant_params_dict + :return: dependant_params_dict: (dict) dictionary containing information about parameters dependant on opt_dict """ @@ -1045,12 +1055,32 @@
[docs] def set_dependant_params_dict(self, dependant_params_dict): """ Sets the dependant_params_dict + :param dependant_params_dict: (dict) dictionary containing information - about parameters dependant on opt_dict + about parameters dependant on opt_dict """ self._dependant_params_dict = dependant_params_dict return None
+
[docs] def get_custom_objects_dict(self): + """ + Returns the custom_objects_dict + + :return: custom_objects_dict: (dict) dictionary containing + information about custom objects from user + """ + return self._custom_objects_dict
+ +
[docs] def set_custom_objects_dict(self, custom_objects_dict): + """ + Sets the custom_objects_dict + + :param custom_objects_dict: (dict) dictionary containing information + about about custom objects from user + """ + self._custom_objects_dict = custom_objects_dict + return None
+
[docs] def update_predicted_dict(self, phases_xml_filename=None, phase_names=None): @@ -1143,6 +1173,7 @@ objective_function = self._objective_function opt_dict = copy.deepcopy(self._opt_dict) dep_dict = copy.deepcopy(self._dependant_params_dict) + custom_objects_dict = copy.deepcopy(self._custom_objects_dict) x = np.array(x) if len(x.shape) == 1: @@ -1158,6 +1189,8 @@ x[ind]): # if nan, do not update xml with nan opt_dict[param_name]['input_value'] *= x[ind] + if custom_objects_dict is not None: + self.update_custom_objects_dict(opt_dict) self.update_xml(opt_dict, temp_xml_file_path, dependant_params_dict=dep_dict) @@ -1228,8 +1261,8 @@ dependant_params_dict=None): """updates xml file with info_dict - :param info_dict: (dict) info in {species_names:{thermo_prop:val}} - Requires an identical structure to opt_dict + :param info_dict: (dict) Requires an identical structure to opt_dict + Ignores items with keys containing "custom_object_name" :param phases_xml_filename: (str) xml filename if editing other xml If ``None``, the current xml will be modified and the internal Cantera phases will be refreshed to the new values. @@ -1239,7 +1272,8 @@ if phases_xml_filename is None: phases_xml_filename = self._phases_xml_filename new_dict = copy.deepcopy(info_dict) - dep_dict = dependant_params_dict + dep_dict = copy.deepcopy(dependant_params_dict) + custom_objects_dict = copy.deepcopy(self._custom_objects_dict) if dep_dict is not None: new_dict.update(dep_dict) @@ -1257,10 +1291,12 @@ ind_vals = [new_dict[ind_param_name]['input_value'] for ind_param_name in ind_param_names] if mod_kwargs is None: - new_dict[param_name]['input_value'] = mod_func(ind_vals) - else: new_dict[param_name]['input_value'] = \ mod_func(ind_vals, + custom_objects_dict) + else: + new_dict[param_name]['input_value'] = \ + mod_func(ind_vals, custom_objects_dict, **mod_kwargs) tree = ET.parse(phases_xml_filename) root = tree.getroot() @@ -1268,6 +1304,8 @@ for key in list(new_dict.keys()): d = new_dict[key] now = datetime.now() + if 'custom_object_name' in list(d.keys()): + continue if (d['upper_attrib_name'] is not None and d['lower_attrib_name'] is not None): for child1 in root.iter(d['upper_element_name']): @@ -1324,6 +1362,31 @@ self.set_phases(self._phases_xml_filename, self._phase_names) return None
+
[docs] def update_custom_objects_dict(self, info_dict): + """ + updates internal custom_objects_dict with info_dict + + :param info_dict: Requires an identical structure to opt_dict + Ignores items with keys containing "custom_object_name" + + :return: None + """ + custom_objects_dict = copy.deepcopy(self._custom_objects_dict) + for key in list(info_dict.keys()): + d = info_dict[key] + if 'upper_element_name' in list(d.keys()): + continue + func = d['function'] + value = d['input_value'] + kwargs = d['kwargs'] + object_name = d['custom_object_name'] + new_object = func(custom_objects_dict[object_name], + value, + **kwargs) + custom_objects_dict[object_name] = new_object + self._custom_objects_dict = custom_objects_dict + return None
+
[docs] def parity_plot(self, compared_value=None, c_data=None, @@ -1388,6 +1451,11 @@ 'meas': meas, c_data: exp_df[c_data].values, 'feed_molarity': feed_molarity}) + elif c_data is not None: + combined_df = pd.DataFrame({'pred': pred, + 'meas': meas, + 'c_data': c_data, + 'feed_molarity': feed_molarity}) else: combined_df = pd.DataFrame({'pred': pred, 'meas': meas, @@ -1420,35 +1488,36 @@ default_title = '{0} complex eq. conc. (mol/L)'.format( compared_species) fig, ax = plt.subplots() + if isinstance(data_labels, list): unique_labels = list(set(data_labels)) for label in unique_labels: filtered_data = combined_df[combined_df['label'] == label] filtered_meas = filtered_data['meas'] filtered_pred = filtered_data['pred'] - ax.scatter(filtered_meas, filtered_pred, label=label) + if len(filtered_pred) != 0: + ax.scatter(filtered_meas, filtered_pred, label=label) if legend: ax.legend(loc='best') elif c_data is not None: if isinstance(c_data, str): c_data = combined_df[c_data].values + else: + c_data = combined_df['c_data'].values p1 = ax.scatter(meas, pred, c=c_data, alpha=1, cmap='viridis') c_bar = fig.colorbar(p1, format='%.2f') if c_label is not None: c_bar.set_label(c_label, rotation=270, labelpad=20) else: - sns.scatterplot(meas, pred, color="r", - legend=False) + ax.scatter(meas, pred, c="r", label="") + ax.plot(min_max_data, min_max_data, color="b", label="") if print_r_squared: ax.text(min_max_data[0], min_max_data[1] * 0.9, '$R^2$={0:.2f}'.format(self.r_squared(compared_value))) - # plt.legend(loc='lower right') - # else: - # plt.legend() ax.set(xlabel='Measured', ylabel='Predicted') if plot_title is None: diff --git a/docs/build/html/_sources/guide/install.rst.txt b/docs/build/html/_sources/guide/install.rst.txt index 8486537..ce1a1f9 100644 --- a/docs/build/html/_sources/guide/install.rst.txt +++ b/docs/build/html/_sources/guide/install.rst.txt @@ -8,7 +8,7 @@ Installation Prerequisites ============= -REEPS requires python3 (>=3.5) with the development headers. +LLEPE requires python3 (>=3.5) with the development headers. Stable Release diff --git a/docs/build/html/_sources/guide/quickstart.rst.txt b/docs/build/html/_sources/guide/quickstart.rst.txt index 2ccdbd8..8e2c250 100644 --- a/docs/build/html/_sources/guide/quickstart.rst.txt +++ b/docs/build/html/_sources/guide/quickstart.rst.txt @@ -9,28 +9,41 @@ Here is a quick example of how to fit an xml thermodynamic model to experimental This code fits Nd standard enthalpy in the "twophase.xml" cantera file to the experimental data in "Nd_exp_data.csv". +This code requires that you copy and paste the "elementz.xml" file in the llepe's data folder into +the Cantera's data folder located in your environments site-packages folder. + The code then produces a parity plot of the measured and predicted concentrations of Nd 3+ in the aqueous phase. .. code-block:: python - from reeps import REEPS + from llepe import LLEPE + opt_dict = {'Nd(H(A)2)3(org)_h0': {'upper_element_name': 'species', + 'upper_attrib_name': 'name', + 'upper_attrib_value': 'Nd(H(A)2)3(org)', + 'lower_element_name': 'h0', + 'lower_attrib_name': None, + 'lower_attrib_value': None, + 'input_format': '{0}', + 'input_value': -4.7e6}} - searcher_parameters = {'exp_csv_filename': 'Nd_exp_data.csv', + searcher_parameters = {'exp_data': 'Nd_exp_data.csv', 'phases_xml_filename': 'twophase.xml', - 'opt_dict': {'Nd(H(A)2)3(org)': {'h0': -4.7e6}}, + 'opt_dict': opt_dict, 'phase_names': ['HCl_electrolyte', 'PC88A_liquid'], 'aq_solvent_name': 'H2O(L)', 'extractant_name': '(HA)2(org)', 'diluant_name': 'dodecane', 'complex_names': ['Nd(H(A)2)3(org)'], - 'rare_earth_ion_names': ['Nd+++'], + 'extracted_species_ion_names': ['Nd+++'], 'aq_solvent_rho': 1000.0, 'extractant_rho': 960.0, 'diluant_rho': 750.0} - searcher = REEPS(**searcher_parameters) + searcher = LLEPE(**searcher_parameters) est_enthalpy = searcher.fit() searcher.update_xml(est_enthalpy) searcher.parity_plot(print_r_squared=True) The code should return something like this + +.. figure:: ../_static/img/quick_start_output.png \ No newline at end of file diff --git a/docs/build/html/_static/img/quick_start_output.png b/docs/build/html/_static/img/quick_start_output.png new file mode 100644 index 0000000..eefb412 Binary files /dev/null and b/docs/build/html/_static/img/quick_start_output.png differ diff --git a/docs/build/html/genindex.html b/docs/build/html/genindex.html index d1e1f7b..03c3e8d 100644 --- a/docs/build/html/genindex.html +++ b/docs/build/html/genindex.html @@ -182,6 +182,8 @@
  • get_aq_solvent_rho() (llepe.LLEPE method)
  • get_complex_names() (llepe.LLEPE method) +
  • +
  • get_custom_objects_dict() (llepe.LLEPE method)
  • get_dependant_params_dict() (llepe.LLEPE method)
  • @@ -192,11 +194,11 @@
  • get_exp_df() (llepe.LLEPE method)
  • get_extractant_name() (llepe.LLEPE method) -
  • -
  • get_extractant_rho() (llepe.LLEPE method)
    • +
    • set_extractant_name() (llepe.LLEPE method) +
    • set_extractant_rho() (llepe.LLEPE method)
    • set_extracted_species_ion_names() (llepe.LLEPE method) @@ -317,10 +321,12 @@

      U

      diff --git a/docs/build/html/guide/install.html b/docs/build/html/guide/install.html index 0eed037..f28dddc 100644 --- a/docs/build/html/guide/install.html +++ b/docs/build/html/guide/install.html @@ -166,7 +166,7 @@

      Installation

      Prerequisites

      -

      REEPS requires python3 (>=3.5) with the development headers.

      +

      LLEPE requires python3 (>=3.5) with the development headers.

      Stable Release

      diff --git a/docs/build/html/guide/quickstart.html b/docs/build/html/guide/quickstart.html index ed14293..948381e 100644 --- a/docs/build/html/guide/quickstart.html +++ b/docs/build/html/guide/quickstart.html @@ -160,29 +160,42 @@

      Here is a quick example of how to fit an xml thermodynamic model to experimental data.

      This code fits Nd standard enthalpy in the "twophase.xml" cantera file to the experimental data in "Nd_exp_data.csv".

      +

      This code requires that you copy and paste the "elementz.xml" file in the llepe's data folder into +the Cantera's data folder located in your environments site-packages folder.

      The code then produces a parity plot of the measured and predicted concentrations of Nd 3+ in the aqueous phase.

      -
      from reeps import REEPS
      -
      -searcher_parameters = {'exp_csv_filename': 'Nd_exp_data.csv',
      +
      from llepe import LLEPE
      +opt_dict = {'Nd(H(A)2)3(org)_h0': {'upper_element_name': 'species',
      +                      'upper_attrib_name': 'name',
      +                      'upper_attrib_value': 'Nd(H(A)2)3(org)',
      +                      'lower_element_name': 'h0',
      +                      'lower_attrib_name': None,
      +                      'lower_attrib_value': None,
      +                      'input_format': '{0}',
      +                      'input_value': -4.7e6}}
      +
      +searcher_parameters = {'exp_data': 'Nd_exp_data.csv',
                                                  'phases_xml_filename': 'twophase.xml',
      -                                           'opt_dict': {'Nd(H(A)2)3(org)': {'h0': -4.7e6}},
      +                                           'opt_dict': opt_dict,
                                                  'phase_names': ['HCl_electrolyte', 'PC88A_liquid'],
                                                  'aq_solvent_name': 'H2O(L)',
                                                  'extractant_name': '(HA)2(org)',
                                                  'diluant_name': 'dodecane',
                                                  'complex_names': ['Nd(H(A)2)3(org)'],
      -                                           'rare_earth_ion_names': ['Nd+++'],
      +                                           'extracted_species_ion_names': ['Nd+++'],
                                                  'aq_solvent_rho': 1000.0,
                                                  'extractant_rho': 960.0,
                                                  'diluant_rho': 750.0}
      -searcher = REEPS(**searcher_parameters)
      +searcher = LLEPE(**searcher_parameters)
       est_enthalpy = searcher.fit()
       searcher.update_xml(est_enthalpy)
       searcher.parity_plot(print_r_squared=True)
       

      The code should return something like this

      +
      +../_images/quick_start_output.png +
      diff --git a/docs/build/html/modules/reeps.html b/docs/build/html/modules/reeps.html index 7e84d0e..9275abb 100644 --- a/docs/build/html/modules/reeps.html +++ b/docs/build/html/modules/reeps.html @@ -163,7 +163,7 @@

      Parameters

      -class llepe.LLEPE(exp_data, phases_xml_filename, phase_names, aq_solvent_name, extractant_name, diluant_name, complex_names, extracted_species_ion_names, extracted_species_list=None, aq_solvent_rho=None, extractant_rho=None, diluant_rho=None, opt_dict=None, objective_function='Log-MSE', optimizer='SLSQP', temp_xml_file_path=None, dependant_params_dict=None)[source]
      +class llepe.LLEPE(exp_data, phases_xml_filename, phase_names, aq_solvent_name, extractant_name, diluant_name, complex_names, extracted_species_ion_names, extracted_species_list=None, aq_solvent_rho=None, extractant_rho=None, diluant_rho=None, opt_dict=None, objective_function='Log-MSE', optimizer='scipy_minimize', temp_xml_file_path=None, dependant_params_dict=None, custom_objects_dict=None)[source]

      Liquid-Liquid Extraction Parameter estimator

      Note

      @@ -277,10 +277,8 @@ i.e. Nd(H(A)2)3(org), Pr(H(A)2)3(org)

    • extracted_species_ion_names -- (list) names of extracted species ions in xml file

    • extracted_species_list --

      (list) names of extracted species elements.

      -
      -
      If None, extracted_species_list will be extracted_species_ion_names

      without '+' i.e. 'Nd+++'->'Nd'

      -
      -
      +

      If None, extracted_species_list will be extracted_species_ion_names +without '+' i.e. 'Nd+++'->'Nd'

    • aq_solvent_rho --

      (float) density of solvent (g/L)

      If None, molar volume/molecular weight is used from xml

      @@ -402,13 +400,19 @@ xml file

      about parameters dependant on opt_dict. Has a similar structure to opt_dict except instead of input values, it has 3 other fields: 'function', 'kwargs', and 'independent_params.

      -

      'function' is a function of the form -function(independent_param__value_list, **kwargs) -'kwargs' are the extra arguments to pass to function -'independent_params' is a list of parameter names in opt_dict that the +

      'function' is a function of the form

      +

      function(independent_param__value_list, custom_objects_dict, +**kwargs)

      +

      'kwargs' are the extra arguments to pass to function

      +

      'independent_params' is a list of parameter names in opt_dict that the dependent_param is a function of.

      +

      'custom_objects_dict' is for accessing the estimator's internal +custom_objects_dict and must be included in the arguments, even if the +custom_objects_dict is not set and is None.

      See example code for usage.

    • +
    • custom_objects_dict -- (dict) dictionary containing custom objects +format: {<object_name_string>: <object>,...}

    • @@ -469,14 +473,28 @@ optimized opt_dict: Has identical structure as opt_dict

      +
      +
      +get_custom_objects_dict()[source]
      +

      Returns the custom_objects_dict

      +
      +
      Returns
      +

      custom_objects_dict: (dict) dictionary containing +information about custom objects from user

      +
      +
      +
      +
      get_dependant_params_dict()[source]
      -

      Returns the dependant_params_dict -:return: dependant_params_dict: (dict) dictionary containing

      -
      -

      information about parameters dependant on opt_dict

      -
      +

      Returns the dependant_params_dict

      +
      +
      Returns
      +

      dependant_params_dict: (dict) dictionary containing +information about parameters dependant on opt_dict

      +
      +
      @@ -795,12 +813,28 @@ objective_function value

      +
      +
      +set_custom_objects_dict(custom_objects_dict)[source]
      +

      Sets the custom_objects_dict

      +
      +
      Parameters
      +

      custom_objects_dict -- (dict) dictionary containing information +about about custom objects from user

      +
      +
      +
      +
      set_dependant_params_dict(dependant_params_dict)[source]
      -

      Sets the dependant_params_dict -:param dependant_params_dict: (dict) dictionary containing information +

      Sets the dependant_params_dict

      +
      +
      Parameters
      +

      dependant_params_dict -- (dict) dictionary containing information about parameters dependant on opt_dict

      +
      +
      @@ -979,6 +1013,21 @@ xml file.

      +
      +
      +update_custom_objects_dict(info_dict)[source]
      +

      updates internal custom_objects_dict with info_dict

      +
      +
      Parameters
      +

      info_dict -- Requires an identical structure to opt_dict +Ignores items with keys containing "custom_object_name"

      +
      +
      Returns
      +

      None

      +
      +
      +
      +
      update_predicted_dict(phases_xml_filename=None, phase_names=None)[source]
      @@ -1005,8 +1054,8 @@ If None
      Parameters
        -
      • info_dict -- (dict) info in {species_names:{thermo_prop:val}} -Requires an identical structure to opt_dict

      • +
      • info_dict -- (dict) Requires an identical structure to opt_dict +Ignores items with keys containing "custom_object_name"

      • phases_xml_filename -- (str) xml filename if editing other xml If None, the current xml will be modified and the internal Cantera phases will be refreshed to the new values.

      • diff --git a/docs/build/html/objects.inv b/docs/build/html/objects.inv index b30397f..4f45eec 100644 Binary files a/docs/build/html/objects.inv and b/docs/build/html/objects.inv differ diff --git a/docs/build/html/searchindex.js b/docs/build/html/searchindex.js index b0d14de..d5abc95 100644 --- a/docs/build/html/searchindex.js +++ b/docs/build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({docnames:["guide/install","guide/quickstart","index","modules/reeps"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":2,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":2,"sphinx.domains.rst":2,"sphinx.domains.std":1,"sphinx.ext.viewcode":1,sphinx:56},filenames:["guide\\install.rst","guide\\quickstart.rst","index.rst","modules\\reeps.rst"],objects:{"":{llepe:[3,0,0,"-"]},"llepe.LLEPE":{fit:[3,2,1,""],get_aq_solvent_name:[3,2,1,""],get_aq_solvent_rho:[3,2,1,""],get_complex_names:[3,2,1,""],get_dependant_params_dict:[3,2,1,""],get_diluant_name:[3,2,1,""],get_diluant_rho:[3,2,1,""],get_exp_df:[3,2,1,""],get_extractant_name:[3,2,1,""],get_extractant_rho:[3,2,1,""],get_extracted_species_ion_names:[3,2,1,""],get_extracted_species_list:[3,2,1,""],get_in_moles:[3,2,1,""],get_objective_function:[3,2,1,""],get_opt_dict:[3,2,1,""],get_optimizer:[3,2,1,""],get_phases:[3,2,1,""],get_predicted_dict:[3,2,1,""],get_temp_xml_file_path:[3,2,1,""],log_mean_squared_error:[3,2,1,""],parity_plot:[3,2,1,""],plot_3d_data:[3,2,1,""],r_squared:[3,2,1,""],scipy_minimize:[3,2,1,""],set_aq_solvent_name:[3,2,1,""],set_aq_solvent_rho:[3,2,1,""],set_complex_names:[3,2,1,""],set_dependant_params_dict:[3,2,1,""],set_diluant_name:[3,2,1,""],set_diluant_rho:[3,2,1,""],set_exp_df:[3,2,1,""],set_extractant_name:[3,2,1,""],set_extractant_rho:[3,2,1,""],set_extracted_species_ion_names:[3,2,1,""],set_extracted_species_list:[3,2,1,""],set_in_moles:[3,2,1,""],set_objective_function:[3,2,1,""],set_opt_dict:[3,2,1,""],set_optimizer:[3,2,1,""],set_phases:[3,2,1,""],set_temp_xml_file_path:[3,2,1,""],update_predicted_dict:[3,2,1,""],update_xml:[3,2,1,""]},llepe:{LLEPE:[3,1,1,""]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method"},terms:{"1e1":3,"7e5":3,"7e6":[1,3],"7e7":3,"boolean":3,"case":[],"class":3,"default":3,"float":3,"function":3,"import":1,"new":3,"return":[1,3],"static":3,"true":[1,3],For:3,Has:3,Not:0,The:[1,2,3],Then:3,There:0,Use:3,Uses:3,Using:2,_aq_eq:3,_aq_i:3,_d_eq:3,_org_eq:3,about:3,abov:[],access:3,also:3,alwai:3,amount:3,ani:3,anl:0,anoth:2,appear:3,aq_solvent_nam:[1,3],aq_solvent_rho:[1,3],aqueou:[1,3],area:3,argument:3,assum:[],atom:3,attrib_nam:3,attrib_valu:3,avoid:3,axes:3,axi:3,baselin:0,baselines3:[],becom:3,befor:3,below:3,better:3,between:[2,3],bleed:2,bound:3,build:0,c_data:3,c_label:3,calc:3,call:3,can:3,cantera:[1,2,3],cel:0,chang:3,clone:0,closer:3,code:[1,3],color:3,color_axi:[],column:3,com:[],compar:3,compared_valu:3,complex:3,complex_nam:[1,3],composit:[],comput:3,conc:3,concentr:[1,3],constraint:3,contain:3,contribut:0,copi:3,core:3,correct:[],csv:[1,2,3],current:[0,3],d_mea:3,d_pred:3,data:[1,2,3],data_label:3,datafram:3,decim:3,default_kwarg:3,defin:3,denot:3,densiti:3,depend:3,dependant_params_dict:3,dependent_param:3,detail:[],develop:2,dict:3,dictionari:3,differ:3,diluant:3,diluant_nam:[1,3],diluant_rho:[1,3],diluent_nam:3,directli:3,directori:[],disp:3,displai:3,distribut:3,divid:3,dlr:[],doc:0,docker:2,docstr:3,document:0,dodecan:[1,3],doe:3,done:[],duplic:3,dure:3,each:3,earth:[],edg:2,edit:3,effect:3,element:3,ensur:[],enthalpi:1,equilibrium:[2,3],error:[2,3],es_1:3,es_2:3,es_n:3,est_enthalpi:1,estim:[0,3],etc:3,exampl:[1,3],except:3,exp_csv_filenam:[1,3],exp_data:3,exp_df:3,experi:3,experiment:[1,2,3],explan:3,explor:3,extra:3,extract:3,extractant_nam:[1,3],extractant_rho:[1,3],extracted_species_ion_nam:3,extracted_species_list:3,fals:3,fed:3,feed:3,feed_vol:3,field:3,fig:3,figur:3,file:[1,3],filenam:3,fill:3,first:3,fit:[1,3],fit_ver2:[],folder:3,form:3,format:3,found:3,fraction:3,frame:3,from:[1,3],ftol:3,func:3,further:3,gem:[],gener:3,get:[2,3],get_aq_solvent_nam:3,get_aq_solvent_rho:3,get_complex_nam:3,get_dependant_params_dict:3,get_diluant_nam:3,get_diluant_rho:3,get_exp_df:3,get_extractant_nam:3,get_extractant_rho:3,get_extracted_species_ion_nam:3,get_extracted_species_list:3,get_in_mol:3,get_objective_funct:3,get_opt_dict:3,get_optim:3,get_phas:3,get_predicted_dict:3,get_rare_earth_ion_nam:[],get_re_species_list:[],get_temp_xml_file_path:3,git:0,github:[],given:3,gov:0,guess1:[],guess2:[],guess:3,guess_valu:3,guessn:[],guid:[2,3],h2o:[1,3],h_eq:3,h_i:3,has:3,have:3,hcl_electrolyt:1,header:0,here:1,how:1,http:0,hydrogen:3,ident:3,imag:2,in_mol:3,independent_param:3,independent_param__value_list:3,index:[2,3],info:3,info_dict:3,inform:3,initi:3,input:3,input_format:3,input_valu:3,instal:2,instead:3,instruct:3,interest:3,intern:3,ion:3,just:3,kei:3,kwarg:3,label:3,last:3,latest:0,legend:3,len:3,like:1,liquid:3,list:3,local:3,locat:3,log10:3,log:3,log_mean_squared_error:3,lower_attrib_nam:3,lower_attrib_valu:3,lower_element_nam:3,mai:[],master:0,matter:3,maxit:3,mean:3,meas_df:3,measur:[1,3],measured_df:3,method:3,minim:[2,3],mixtur:3,model:[1,2,3],modifi:3,modul:2,mol:3,molal:[],molar:3,mole:3,molecular:3,more:3,mse:3,multipli:3,must:3,n_aq:3,n_org:3,name:3,nd_aq_eq:3,nd_aq_i:3,nd_d_eq:3,nd_exp_data:1,ndarrai:3,need:3,none:3,note:[],object:3,objective_funct:3,objective_kwarg:3,one:[],onli:[],opt_dict:[1,3],opt_valu:3,optim:3,optimizer_kwarg:3,option:3,order:3,org:[1,3],organ:3,origin:3,other:3,output:[],packag:2,page:2,panda:3,paper:3,param:3,param_lower_attrib_nam:3,param_lower_attrib_valu:3,param_lower_el:3,param_upper_attrib_nam:3,param_upper_attrib_valu:3,param_upper_el:3,paramet:0,parameter1:[],parameter2:[],parametern:[],pariti:[1,3],parity_plot:[1,3],pass:3,past:3,path:3,pc88a_liquid:1,perform:3,phase:[1,3],phase_nam:[1,3],phases_nam:3,phases_xml_fil:3,phases_xml_filenam:[1,3],pip:0,place:3,pleas:[],plot:[1,3],plot_3d_data:3,plot_titl:3,pr_aq_eq:3,pr_aq_i:3,pr_d_eq:3,predict:[1,2,3],predicted_dict:3,prerequisit:2,print:3,print_r_squar:[1,3],process:3,produc:1,pull:3,python3:0,python:2,pytorch:[],quantifi:3,quantiti:3,quick:1,r_squar:3,rare:[],rare_earth_ion_nam:1,ratio:3,re_1:[],re_2:[],re_aq:[],re_n:[],re_org:[],re_species_list:[],recommend:3,ree:[],reep:[0,1],referenc:3,refresh:3,releas:2,renam:3,replac:3,repres:3,requir:[0,3],row:3,run:[0,3],sai:3,same:3,save:3,save_path:3,scale:[],scipi:3,scipy_minim:3,search:2,searcher:[1,2],searcher_paramet:1,see:3,select:[],send:3,set:[0,3],set_aq_solvent_nam:3,set_aq_solvent_rho:3,set_complex_nam:3,set_dependant_params_dict:3,set_diluant_nam:3,set_diluant_rho:3,set_exp_df:3,set_extractant_nam:3,set_extractant_rho:3,set_extracted_species_ion_nam:3,set_extracted_species_list:3,set_in_mol:3,set_objective_funct:3,set_opt_dict:3,set_optim:3,set_phas:3,set_rare_earth_ion_nam:[],set_re_species_list:[],set_temp_xml_file_path:3,should:[1,3],shown:3,similar:3,simul:2,slsqp:3,slsqp_optim:[],solut:3,solvent:3,someth:1,sourc:3,speci:3,species1:[],species2:[],species_nam:3,speciesarrai:3,speciesn:[],specif:3,specifi:3,squar:3,stabl:2,standard:1,start:2,str:3,string:3,structur:3,sum:3,summer:0,support:0,system:2,take:[2,3],temp:3,temp_xml_file_path:3,temporari:3,tensorflow:[],test:0,thei:3,thermo_prop:3,thermodynam:[1,2],thi:[1,3],though:[],tied:[],titl:3,tupl:3,twophas:1,type:[],under:3,updat:3,update_predicted_dict:3,update_xml:[1,3],update_xml_ver2:[],upper_attrib_nam:3,upper_attrib_valu:3,upper_element_nam:3,usag:3,use:3,used:3,user:[2,3],user_defined_name_for_parameter_1:3,user_defined_name_for_parameter_2:3,uses:2,val:3,valu:3,variabl:3,version:2,volum:3,weight:3,where:3,whether:3,which:3,without:3,work:[],would:3,written:[],x_data:3,x_guess:3,x_label:3,xgitlab:0,xml:[1,2,3],y_data:3,y_label:3,yet:0,you:[],z_data:3,z_eq:3,z_i:3,z_label:3},titles:["Installation","Getting Started","Welcome to llepe's docs! - the Liquid-Liquid Extraction Parameter Estimator","LLEPE"],titleterms:{Using:0,bleed:0,develop:0,doc:2,docker:0,earth:[],edg:0,element:[],estim:2,extract:2,get:1,imag:0,indic:2,instal:0,liquid:2,llepe:[2,3],paramet:[2,3],prerequisit:0,rare:[],reep:[],releas:0,searcher:[],stabl:0,start:1,tabl:2,version:0,welcom:2}}) \ No newline at end of file +Search.setIndex({docnames:["guide/install","guide/quickstart","index","modules/reeps"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":2,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":2,"sphinx.domains.rst":2,"sphinx.domains.std":1,"sphinx.ext.viewcode":1,sphinx:56},filenames:["guide\\install.rst","guide\\quickstart.rst","index.rst","modules\\reeps.rst"],objects:{"":{llepe:[3,0,0,"-"]},"llepe.LLEPE":{fit:[3,2,1,""],get_aq_solvent_name:[3,2,1,""],get_aq_solvent_rho:[3,2,1,""],get_complex_names:[3,2,1,""],get_custom_objects_dict:[3,2,1,""],get_dependant_params_dict:[3,2,1,""],get_diluant_name:[3,2,1,""],get_diluant_rho:[3,2,1,""],get_exp_df:[3,2,1,""],get_extractant_name:[3,2,1,""],get_extractant_rho:[3,2,1,""],get_extracted_species_ion_names:[3,2,1,""],get_extracted_species_list:[3,2,1,""],get_in_moles:[3,2,1,""],get_objective_function:[3,2,1,""],get_opt_dict:[3,2,1,""],get_optimizer:[3,2,1,""],get_phases:[3,2,1,""],get_predicted_dict:[3,2,1,""],get_temp_xml_file_path:[3,2,1,""],log_mean_squared_error:[3,2,1,""],parity_plot:[3,2,1,""],plot_3d_data:[3,2,1,""],r_squared:[3,2,1,""],scipy_minimize:[3,2,1,""],set_aq_solvent_name:[3,2,1,""],set_aq_solvent_rho:[3,2,1,""],set_complex_names:[3,2,1,""],set_custom_objects_dict:[3,2,1,""],set_dependant_params_dict:[3,2,1,""],set_diluant_name:[3,2,1,""],set_diluant_rho:[3,2,1,""],set_exp_df:[3,2,1,""],set_extractant_name:[3,2,1,""],set_extractant_rho:[3,2,1,""],set_extracted_species_ion_names:[3,2,1,""],set_extracted_species_list:[3,2,1,""],set_in_moles:[3,2,1,""],set_objective_function:[3,2,1,""],set_opt_dict:[3,2,1,""],set_optimizer:[3,2,1,""],set_phases:[3,2,1,""],set_temp_xml_file_path:[3,2,1,""],update_custom_objects_dict:[3,2,1,""],update_predicted_dict:[3,2,1,""],update_xml:[3,2,1,""]},llepe:{LLEPE:[3,1,1,""]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method"},terms:{"1e1":3,"7e5":3,"7e6":[1,3],"7e7":3,"boolean":3,"case":[],"class":3,"default":3,"float":3,"function":3,"import":1,"new":3,"return":[1,3],"static":3,"true":[1,3],For:3,Has:3,Not:0,The:[1,2,3],Then:3,There:0,Use:3,Uses:3,Using:2,_aq_eq:3,_aq_i:3,_d_eq:3,_h0:1,_org_eq:3,about:3,abov:[],access:3,also:3,alwai:3,amount:3,ani:3,anl:0,anoth:2,appear:3,aq_solvent_nam:[1,3],aq_solvent_rho:[1,3],aqueou:[1,3],area:3,argument:3,assum:[],atom:3,attrib_nam:3,attrib_valu:3,avoid:3,axes:3,axi:3,baselin:0,baselines3:[],becom:3,befor:3,below:3,better:3,between:[2,3],bleed:2,bound:3,build:0,c_data:3,c_label:3,calc:3,call:3,can:3,cantera:[1,2,3],cel:0,chang:3,clone:0,closer:3,code:[1,3],color:3,color_axi:[],column:3,com:[],compar:3,compared_valu:3,complex:3,complex_nam:[1,3],composit:[],comput:3,conc:3,concentr:[1,3],constraint:3,contain:3,contribut:0,copi:[1,3],core:3,correct:[],csv:[1,2,3],current:[0,3],custom:3,custom_object_nam:3,custom_objects_dict:3,d_mea:3,d_pred:3,data:[1,2,3],data_label:3,datafram:3,decim:3,default_kwarg:3,defin:3,denot:3,densiti:3,depend:3,dependant_params_dict:3,dependent_param:3,detail:[],develop:2,dict:3,dictionari:3,differ:3,diluant:3,diluant_nam:[1,3],diluant_rho:[1,3],diluent_nam:3,directli:3,directori:[],disp:3,displai:3,distribut:3,divid:3,dlr:[],doc:0,docker:2,docstr:3,document:0,dodecan:[1,3],doe:3,done:[],duplic:3,dure:3,each:3,earth:[],edg:2,edit:3,effect:3,element:3,elementz:1,ensur:[],enthalpi:1,environ:1,equilibrium:[2,3],error:[2,3],es_1:3,es_2:3,es_n:3,est_enthalpi:1,estim:[0,3],etc:3,even:3,exampl:[1,3],except:3,exp_csv_filenam:3,exp_data:[1,3],exp_df:3,experi:3,experiment:[1,2,3],explan:3,explor:3,extra:3,extract:3,extractant_nam:[1,3],extractant_rho:[1,3],extracted_species_ion_nam:[1,3],extracted_species_list:3,extracted_speciesion_nam:[],fals:3,fed:3,feed:3,feed_vol:3,field:3,fig:3,figur:3,file:[1,3],filenam:3,fill:3,first:3,fit:[1,3],fit_ver2:[],folder:[1,3],form:3,format:3,found:3,fraction:3,frame:3,from:[1,3],ftol:3,func:3,further:3,gem:[],gener:3,get:[2,3],get_aq_solvent_nam:3,get_aq_solvent_rho:3,get_complex_nam:3,get_custom_objects_dict:3,get_dependant_params_dict:3,get_diluant_nam:3,get_diluant_rho:3,get_exp_df:3,get_extractant_nam:3,get_extractant_rho:3,get_extracted_species_ion_nam:3,get_extracted_species_list:3,get_in_mol:3,get_objective_funct:3,get_opt_dict:3,get_optim:3,get_phas:3,get_predicted_dict:3,get_rare_earth_ion_nam:[],get_re_species_list:[],get_temp_xml_file_path:3,git:0,github:[],given:3,gov:0,guess1:[],guess2:[],guess:3,guess_valu:3,guessn:[],guid:[2,3],h2o:[1,3],h_eq:3,h_i:3,has:3,have:3,hcl_electrolyt:1,header:0,here:1,how:1,http:0,hydrogen:3,ident:3,ignor:3,imag:2,img:[],in_mol:3,includ:3,independent_param:3,independent_param__value_list:3,index:[2,3],info:3,info_dict:3,inform:3,initi:3,input:3,input_format:[1,3],input_valu:[1,3],instal:2,instead:3,instruct:3,interest:3,intern:3,ion:3,item:3,just:3,kei:3,kwarg:3,label:3,last:3,latest:0,legend:3,len:3,like:1,liquid:3,list:3,llepe:[0,1],local:3,locat:[1,3],log10:3,log:3,log_mean_squared_error:3,lower_attrib_nam:[1,3],lower_attrib_valu:[1,3],lower_element_nam:[1,3],mai:[],master:0,matter:3,maxit:3,mean:3,meas_df:3,measur:[1,3],measured_df:3,method:3,minim:[2,3],mixtur:3,model:[1,2,3],modifi:3,modul:2,mol:3,molal:[],molar:3,mole:3,molecular:3,more:3,mse:3,multipli:3,must:3,n_aq:3,n_org:3,name:[1,3],nd_aq_eq:3,nd_aq_i:3,nd_d_eq:3,nd_exp_data:1,ndarrai:3,need:3,none:[1,3],noneoig:[],note:[],object:3,object_name_str:3,objective_funct:3,objective_kwarg:3,one:[],onli:[],opt_dict:[1,3],opt_valu:3,optim:3,optimizer_kwarg:3,option:3,order:3,org:[1,3],organ:3,origin:3,other:3,output:[],packag:[1,2],page:2,panda:3,paper:3,param:3,param_lower_attrib_nam:3,param_lower_attrib_valu:3,param_lower_el:3,param_upper_attrib_nam:3,param_upper_attrib_valu:3,param_upper_el:3,paramet:0,parameter1:[],parameter2:[],parametern:[],pariti:[1,3],parity_plot:[1,3],pass:3,past:[1,3],path:3,pc88a_liquid:1,perform:3,phase:[1,3],phase_nam:[1,3],phases_nam:3,phases_xml_fil:3,phases_xml_filenam:[1,3],pip:0,place:3,pleas:[],plot:[1,3],plot_3d_data:3,plot_titl:3,png:[],pr_aq_eq:3,pr_aq_i:3,pr_d_eq:3,predict:[1,2,3],predicted_dict:3,prerequisit:2,print:3,print_r_squar:[1,3],process:3,produc:1,pull:3,python3:0,python:2,pytorch:[],quantifi:3,quantiti:3,quick:1,quick_start_output:[],r_squar:3,rare:[],rare_earth_ion_nam:[],ratio:3,re_1:[],re_2:[],re_aq:[],re_n:[],re_org:[],re_species_list:[],recommend:3,ree:[],reep:[],referenc:3,refresh:3,releas:2,renam:3,replac:3,repres:3,requir:[0,1,3],row:3,run:[0,3],sai:3,same:3,save:3,save_path:3,scale:[],scipi:3,scipy_minim:3,search:2,searcher:[1,2],searcher_paramet:1,see:3,select:[],send:3,set:[0,3],set_aq_solvent_nam:3,set_aq_solvent_rho:3,set_complex_nam:3,set_custom_objects_dict:3,set_dependant_params_dict:3,set_diluant_nam:3,set_diluant_rho:3,set_exp_df:3,set_extractant_nam:3,set_extractant_rho:3,set_extracted_species_ion_nam:3,set_extracted_species_list:3,set_in_mol:3,set_objective_funct:3,set_opt_dict:3,set_optim:3,set_phas:3,set_rare_earth_ion_nam:[],set_re_species_list:[],set_temp_xml_file_path:3,should:[1,3],shown:3,similar:3,simul:2,site:1,slsqp:3,slsqp_optim:[],solut:3,solvent:3,someth:1,sourc:3,speci:[1,3],species1:[],species2:[],species_nam:[],speciesarrai:3,speciesn:[],specif:3,specifi:3,squar:3,stabl:2,standard:1,start:2,str:3,string:3,structur:3,sum:3,summer:0,support:0,system:2,take:[2,3],temp:3,temp_xml_file_path:3,temporari:3,tensorflow:[],test:0,thei:3,thermo_prop:[],thermodynam:[1,2],thi:[1,3],though:[],tied:[],titl:3,tupl:3,twophas:1,type:[],under:3,updat:3,update_custom_objects_dict:3,update_predicted_dict:3,update_xml:[1,3],update_xml_ver2:[],upper_attrib_nam:[1,3],upper_attrib_valu:[1,3],upper_element_nam:[1,3],usag:3,use:3,used:3,user:[2,3],user_defined_name_for_parameter_1:3,user_defined_name_for_parameter_2:3,uses:2,val:[],valu:3,variabl:3,version:2,volum:3,weight:3,where:3,whether:3,which:3,width:[],without:3,work:[],would:3,written:[],x_data:3,x_guess:3,x_label:3,xgitlab:0,xml:[1,2,3],y_data:3,y_label:3,yet:0,you:1,your:1,z_data:3,z_eq:3,z_i:3,z_label:3},titles:["Installation","Getting Started","Welcome to llepe's docs! - the Liquid-Liquid Extraction Parameter Estimator","LLEPE"],titleterms:{Using:0,bleed:0,develop:0,doc:2,docker:0,earth:[],edg:0,element:[],estim:2,extract:2,get:1,imag:0,indic:2,instal:0,liquid:2,llepe:[2,3],paramet:[2,3],prerequisit:0,rare:[],reep:[],releas:0,searcher:[],stabl:0,start:1,tabl:2,version:0,welcom:2}}) \ No newline at end of file diff --git a/docs/source/_static/img/quick_start_output.png b/docs/source/_static/img/quick_start_output.png new file mode 100644 index 0000000..eefb412 Binary files /dev/null and b/docs/source/_static/img/quick_start_output.png differ diff --git a/docs/source/guide/install.rst b/docs/source/guide/install.rst index 8486537..ce1a1f9 100644 --- a/docs/source/guide/install.rst +++ b/docs/source/guide/install.rst @@ -8,7 +8,7 @@ Installation Prerequisites ============= -REEPS requires python3 (>=3.5) with the development headers. +LLEPE requires python3 (>=3.5) with the development headers. Stable Release diff --git a/docs/source/guide/quickstart.rst b/docs/source/guide/quickstart.rst index 2ccdbd8..8e2c250 100644 --- a/docs/source/guide/quickstart.rst +++ b/docs/source/guide/quickstart.rst @@ -9,28 +9,41 @@ Here is a quick example of how to fit an xml thermodynamic model to experimental This code fits Nd standard enthalpy in the "twophase.xml" cantera file to the experimental data in "Nd_exp_data.csv". +This code requires that you copy and paste the "elementz.xml" file in the llepe's data folder into +the Cantera's data folder located in your environments site-packages folder. + The code then produces a parity plot of the measured and predicted concentrations of Nd 3+ in the aqueous phase. .. code-block:: python - from reeps import REEPS + from llepe import LLEPE + opt_dict = {'Nd(H(A)2)3(org)_h0': {'upper_element_name': 'species', + 'upper_attrib_name': 'name', + 'upper_attrib_value': 'Nd(H(A)2)3(org)', + 'lower_element_name': 'h0', + 'lower_attrib_name': None, + 'lower_attrib_value': None, + 'input_format': '{0}', + 'input_value': -4.7e6}} - searcher_parameters = {'exp_csv_filename': 'Nd_exp_data.csv', + searcher_parameters = {'exp_data': 'Nd_exp_data.csv', 'phases_xml_filename': 'twophase.xml', - 'opt_dict': {'Nd(H(A)2)3(org)': {'h0': -4.7e6}}, + 'opt_dict': opt_dict, 'phase_names': ['HCl_electrolyte', 'PC88A_liquid'], 'aq_solvent_name': 'H2O(L)', 'extractant_name': '(HA)2(org)', 'diluant_name': 'dodecane', 'complex_names': ['Nd(H(A)2)3(org)'], - 'rare_earth_ion_names': ['Nd+++'], + 'extracted_species_ion_names': ['Nd+++'], 'aq_solvent_rho': 1000.0, 'extractant_rho': 960.0, 'diluant_rho': 750.0} - searcher = REEPS(**searcher_parameters) + searcher = LLEPE(**searcher_parameters) est_enthalpy = searcher.fit() searcher.update_xml(est_enthalpy) searcher.parity_plot(print_r_squared=True) The code should return something like this + +.. figure:: ../_static/img/quick_start_output.png \ No newline at end of file diff --git a/llepe/llepe.py b/llepe/llepe.py index ba5e628..7a12f67 100644 --- a/llepe/llepe.py +++ b/llepe/llepe.py @@ -127,7 +127,8 @@ class LLEPE: :param extracted_species_list: (list) names of extracted species elements. If ``None``, extracted_species_list will be extracted_species_ion_names - without '+' i.e. 'Nd+++'->'Nd' + without '+' i.e. 'Nd+++'->'Nd' + :param aq_solvent_rho: (float) density of solvent (g/L) If ``None``, molar volume/molecular weight is used from xml @@ -255,11 +256,19 @@ class LLEPE: 'function', 'kwargs', and 'independent_params. 'function' is a function of the form - ``function(independent_param__value_list, **kwargs)`` + + ``function(independent_param__value_list, custom_objects_dict, + **kwargs)`` + 'kwargs' are the extra arguments to pass to function + 'independent_params' is a list of parameter names in opt_dict that the dependent_param is a function of. + 'custom_objects_dict' is for accessing the estimator's internal + custom_objects_dict and must be included in the arguments, even if the + custom_objects_dict is not set and is None. + See example code for usage. :param custom_objects_dict: (dict) dictionary containing custom objects format: {: ,...} @@ -883,6 +892,7 @@ class LLEPE: def get_dependant_params_dict(self): """ Returns the dependant_params_dict + :return: dependant_params_dict: (dict) dictionary containing information about parameters dependant on opt_dict """ @@ -891,8 +901,9 @@ class LLEPE: def set_dependant_params_dict(self, dependant_params_dict): """ Sets the dependant_params_dict + :param dependant_params_dict: (dict) dictionary containing information - about parameters dependant on opt_dict + about parameters dependant on opt_dict """ self._dependant_params_dict = dependant_params_dict return None @@ -900,6 +911,7 @@ class LLEPE: def get_custom_objects_dict(self): """ Returns the custom_objects_dict + :return: custom_objects_dict: (dict) dictionary containing information about custom objects from user """ @@ -908,8 +920,9 @@ class LLEPE: def set_custom_objects_dict(self, custom_objects_dict): """ Sets the custom_objects_dict + :param custom_objects_dict: (dict) dictionary containing information - about about custom objects from user + about about custom objects from user """ self._custom_objects_dict = custom_objects_dict return None @@ -1198,9 +1211,11 @@ class LLEPE: def update_custom_objects_dict(self, info_dict): """ updates internal custom_objects_dict with info_dict + :param info_dict: Requires an identical structure to opt_dict Ignores items with keys containing "custom_object_name" - :return: None. + + :return: None """ custom_objects_dict = copy.deepcopy(self._custom_objects_dict) for key in list(info_dict.keys()):