<jupyter_start><jupyter_text>Create XANES by passing spectrum energy and mu directly<jupyter_code>Fe2O3_spectrum_dataframe = pd.read_pickle('Fe2O3_computational_spectrum.pkl')
Fe2O3_spectrum_dataframe
spectrum_energy = Fe2O3_spectrum_dataframe['x_axis_energy_55eV'].values[0]
spectrum_mu = Fe2O3_spectrum_dataframe['interp_spectrum_55eV'].values[0]
Fe2O3_XANES_object1 = XANES(spectrum_energy, spectrum_mu, absorption_specie='Fe', edge='K')
Fe2O3_object1_CenvPred = CenvPrediction(Fe2O3_XANES_object1, energy_reference='lowest', energy_range=45)
##Plot interpolated spectrum used in coordination environment prediction
plt.plot(Fe2O3_object1_CenvPred.interp_energy, Fe2O3_object1_CenvPred.interp_spectrum)<jupyter_output><empty_output><jupyter_text>**Predict with random forest model**<jupyter_code>Fe2O3_object1_CenvPred.cenv_prediction()
print('Predicted coordination environment label: ', Fe2O3_object1_CenvPred.pred_cenv)<jupyter_output>INFO:veidt.rfxas.prediction:Loaded /Users/chenchi/repos/veidt/veidt/rfxas/./models/cnum/RandomForest_Fe_c_num.sav model
INFO:veidt.rfxas.prediction:Loaded /Users/chenchi/repos/veidt/veidt/rfxas/./models/cmotif/RandomForest_Fe_c_env_ex_CN_6.sav model<jupyter_text>**Predict with CNN** Similarly one can set `model` to `knn`, `mlp`, `svc` or the previous random forest `rf` (default)<jupyter_code>Fe2O3_object1_CenvPred = CenvPrediction(Fe2O3_XANES_object1, energy_reference='lowest', 
                                        energy_range=45, model='cnn')
Fe2O3_object1_CenvPred.cenv_prediction()
print('Predicted coordination environment label: ', Fe2O3_object1_CenvPred.pred_cenv)<jupyter_output>INFO:veidt.rfxas.prediction:Loaded /Users/chenchi/repos/veidt/veidt/rfxas/./ex_models/Model_share/CNN_model/cnum/CNN_Fe_c_num.h5 model
INFO:veidt.rfxas.prediction:Loaded /Users/chenchi/repos/veidt/veidt/rfxas/./ex_models/Model_share/CNN_model/cmotif/CNN_Fe_c_env_CN_6_env_label.h5 model<jupyter_text>Initiate XANES object from Materials Project website downloaded spectrum file (tsv)<jupyter_code>Fe2O3_XANES_object2 = XANES.from_K_XANES_MP_tsv('xas.XANES.K.Fe2O3.mp-24972.tsv')
Fe2O3_object2_CenvPred = CenvPrediction(Fe2O3_XANES_object2, energy_reference='lowest', energy_range=45)
##Plot interpolated spectrum used in coordination environment prediction
plt.plot(Fe2O3_object2_CenvPred.interp_energy, Fe2O3_object2_CenvPred.interp_spectrum)
Fe2O3_object2_CenvPred.cenv_prediction()
print('Predicted coordination environment label: ', Fe2O3_object2_CenvPred.pred_cenv)<jupyter_output>INFO:veidt.rfxas.prediction:Loaded /Users/chenchi/repos/veidt/veidt/rfxas/./models/cnum/RandomForest_Fe_c_num.sav model
INFO:veidt.rfxas.prediction:Loaded /Users/chenchi/repos/veidt/veidt/rfxas/./models/cmotif/RandomForest_Fe_c_env_ex_CN_6.sav model
{'fraction_non_alphanumeric': 0.09956709956709957, 'fraction_numerical': 0.031746031746031744, 'mean_word_length': 8.903571428571428, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '501940', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1082, 'n_words': 117, 'path': 'veidt/rfxas/notebooks/example_notebook.ipynb', 'repo_name': 'materialsvirtuallab/veidt', 'size': '2772'}