Reduced a few lines of code and documented plot_spectra function.

This commit is contained in:
2023-08-22 15:09:18 +02:00
parent 3e9a26f147
commit e3225fff4b

View File

@ -15,10 +15,19 @@ def plot_image(dataframe,filter):
ax.imshow(meas['image'],extent = [x_min,x_max,y_min,y_max])
ax.set_xlabel('scientaEkin_eV')
ax.set_ylabel('Replicates')
ax.set_title(meas['name'][0]+ '\n'+meas['sample'][0]+ '\n' + meas['lastModifiedDatestr'][0])
ax.set_title(meas['name'][0] + '\n' + meas['sample'][0]+ '\n' + meas['lastModifiedDatestr'][0])
def plot_spectrum(dataframe,filter,):
def plot_spectra(dataframe,filter):
""" plot_spectra plots XPS spectra associated to 'dataframe' after row reduced by 'filter'.
When more than one row are specified by the 'filter' input, indivial spectrum are superimposed
on the same plot.
Parameters:
dataframe (pandas.DataFrame): table with heterogenous entries obtained by read_hdf5_as_dataframe.py.
filter (binaray array): binary indexing array with same number of entries as rows in dataframe.
"""
fig = plt.figure()
ax = plt.gca()
@ -32,13 +41,11 @@ def plot_spectrum(dataframe,filter,):
y_min, y_max = 0, rows
#for i in range(cols):
ax.plot(bindingEnergy_eV, spectrum_countsPerSecond,label = meas['name'][0])
#ax.plot(bindingEnergy_eV, np.mean(meas['image'],axis=0))
ax.set_xlabel('bindingEnergy_eV')
ax.set_ylabel('counts Per Second')
if len(meas)>1:
ax.set_title('\n'+meas['sample'][0]+ '\n' + meas['lastModifiedDatestr'][0])
else:
ax.set_title(meas['name'][0] + '\n'+meas['sample'][0]+ '\n' + meas['lastModifiedDatestr'][0])
ax.set_xlabel('bindingEnergy_eV')
ax.set_ylabel('counts Per Second')
ax.set_title('\n'+meas['sample'][0]+ '\n' + 'PE spectra')
#ax.set_title(meas['name'][0] + '\n'+meas['sample'][0]+ '\n' + meas['lastModifiedDatestr'][0])
ax.legend()