<jupyter_start><jupyter_text>Silver data analysisBased on the data for the refractive index for silver obtained from [<NAME> Christy, 1972](https://journals.aps.org/prb/pdf/10.1103/PhysRevB.6.4370) we dicide to dig deeper on the option for interpolation. * Data interpolation decision* Experimental data analysis   Data interpolation desicionWe try linear and a spline interpolation. We use the module `scipy.interpolate` in particular [`interp1d`](https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.interpolate.interp1d.html) for the linear interpolation and, [`splrep`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.splrep.html) and [`splev`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.splev.html) for the splines .<jupyter_code>import numpy 
%matplotlib inline
from matplotlib import rcParams
rcParams['font.family'] = 'serif'
rcParams['font.size'] = 16
from scripts.data_analysis_helper import plot_refrac , linear_interp, spline, spline_eval, plot_interpolation
#Importing silver data
#Format: wavelength, refrac_index_real (n), refrac_index_complex (k) 

lambda_s , n_s , k_s = numpy.loadtxt('silver_water_raw-data/silver_JC72_nm.txt', unpack=True)<jupyter_output><empty_output><jupyter_text>Plot of the raw data<jupyter_code>plot_refrac(lambda_s, n_s, k_s)
#linear interpolation
silver_real_linear , silver_imag_linear = linear_interp(lambda_s, n_s, k_s)

#get spline 
silver_real_tuple, silver_imag_tuple = spline(lambda_s, n_s, k_s)

#spline evaluation
lambda_x = numpy.linspace(min(lambda_s), max(lambda_s), num=500, endpoint=True)
silver_real_spline, silver_imag_spline = spline_eval(lambda_x, silver_real_tuple, silver_imag_tuple)
#Need this for convergence test input data. 
ref_silver_380 = silver_real_linear(380) + 1j * silver_imag_linear(380)
diel_silver_380 = ref_silver_380 * ref_silver_380
diel_silver_380
plot_interpolation(lambda_s, n_s, k_s, lambda_x, silver_real_linear, 
                   silver_imag_linear, silver_real_spline, silver_imag_spline)<jupyter_output><empty_output><jupyter_text>Plot difference between linear and splineLet's plot the difference between each interpolation and compare this difference with the experimental errors reported in the paper.<jupyter_code>silv_diff_real = abs(silver_real_linear(lambda_x) - silver_real_spline) 
silv_diff_imag =  abs(silver_imag_linear(lambda_x) - silver_imag_spline)

plot_refrac(lambda_x, silv_diff_real, silv_diff_imag)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0926887734718338, 'fraction_numerical': 0.01997602876548142, 'mean_word_length': 7.346666666666667, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '175399', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 919, 'n_tokens_neox': 864, 'n_words': 181, 'path': 'repro_packs/repro_exec_files/repro_dielectrics_data/notebooks_analysis_and_diel_generation/silver_data_analysis.ipynb', 'repo_name': 'barbagroup/pygbe_lspr_paper', 'size': '2508'}