def fit_spectrum(epos, pk_data, peak_height_fraction, bg_rois): import initElements_P3 import peak_param_determination as ppd # Define peaks to range ed = initElements_P3.initElements() # Define which peaks to use for CSR calcs Ga1p_m2qs = [ed['Ga'].isotopes[69][0], ed['Ga'].isotopes[71][0]] Ga2p_m2qs = [ed['Ga'].isotopes[69][0] / 2, ed['Ga'].isotopes[71][0] / 2] Ga1p_idxs = [np.argmin(np.abs(m2q - pk_data['m2q'])) for m2q in Ga1p_m2qs] Ga2p_idxs = [np.argmin(np.abs(m2q - pk_data['m2q'])) for m2q in Ga2p_m2qs] # Determine the global background glob_bg_param = ppd.get_glob_bg(epos['m2q'], rois=bg_rois) # Range the peaks pk_params = ppd.get_peak_ranges(epos, pk_data['m2q'], peak_height_fraction=peak_height_fraction, glob_bg_param=0) return (pk_params, glob_bg_param, Ga1p_idxs, Ga2p_idxs)
Spyder Editor This is a temporary script file. """ # Need to put the functions in the path # Probably not necessary if I understood Python/Git/modules better import os import sys parent_directory = os.getcwd().rsplit(sep='\\',maxsplit=1)[0] if parent_directory not in sys.path: sys.path.insert(1, parent_directory) import initElements_P3 ed = initElements_P3.initElements() import numpy as np def In_doped_GaN(): # N Ga In Da # Define possible peaks pk_data = np.array( [ (1, 0, 0, ed['N'].isotopes[14][0]/2), (1, 0, 0, ed['N'].isotopes[14][0]/1), (1, 0, 0, ed['N'].isotopes[15][0]/1), (1, 0, 0, ed['N'].isotopes[15][0]+ed['H'].isotopes[1][0]), (0, 1, 0, ed['Ga'].isotopes[69][0]/3), (0, 1, 0, ed['Ga'].isotopes[71][0]/3), (2, 0, 0, ed['N'].isotopes[14][0]*2), (2, 0, 0, ed['N'].isotopes[14][0]+ed['N'].isotopes[15][0]), (2, 0, 0, ed['N'].isotopes[14][0]+ed['N'].isotopes[15][0]+ed['H'].isotopes[1][0]),