Add normalisation of diffractograms (default: True=
This commit is contained in:
parent
06753ab6b2
commit
0fb8883d19
2 changed files with 9 additions and 1 deletions
|
|
@ -300,6 +300,10 @@ def read_data(data, options={}, index=0):
|
||||||
diffractogram, wavelength = read_xy(data=data, options=options, index=index)
|
diffractogram, wavelength = read_xy(data=data, options=options, index=index)
|
||||||
|
|
||||||
|
|
||||||
|
if options['normalise']:
|
||||||
|
diffractogram['I'] = diffractogram['I'] / diffractogram['I'].max()
|
||||||
|
|
||||||
|
|
||||||
diffractogram = translate_wavelengths(data=diffractogram, wavelength=wavelength)
|
diffractogram = translate_wavelengths(data=diffractogram, wavelength=wavelength)
|
||||||
|
|
||||||
return diffractogram, wavelength
|
return diffractogram, wavelength
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ def plot_diffractogram(data, options={}):
|
||||||
data (dict): Must include path = string to diffractogram data, and plot_kind = (recx, beamline, image)'''
|
data (dict): Must include path = string to diffractogram data, and plot_kind = (recx, beamline, image)'''
|
||||||
|
|
||||||
# Update options
|
# Update options
|
||||||
required_options = ['x_vals', 'y_vals', 'ylabel', 'xlabel', 'xunit', 'yunit', 'line', 'scatter', 'xlim', 'ylim',
|
required_options = ['x_vals', 'y_vals', 'ylabel', 'xlabel', 'xunit', 'yunit', 'line', 'scatter', 'xlim', 'ylim', 'normalise',
|
||||||
'reflections_plot', 'reflections_indices', 'reflections_data', 'plot_kind', 'palettes', 'interactive', 'rc_params', 'format_params']
|
'reflections_plot', 'reflections_indices', 'reflections_data', 'plot_kind', 'palettes', 'interactive', 'rc_params', 'format_params']
|
||||||
|
|
||||||
default_options = {
|
default_options = {
|
||||||
|
|
@ -28,6 +28,7 @@ def plot_diffractogram(data, options={}):
|
||||||
'ylabel': 'Intensity', 'xlabel': '2theta',
|
'ylabel': 'Intensity', 'xlabel': '2theta',
|
||||||
'xunit': 'deg', 'yunit': 'a.u.',
|
'xunit': 'deg', 'yunit': 'a.u.',
|
||||||
'xlim': None, 'ylim': None,
|
'xlim': None, 'ylim': None,
|
||||||
|
'normalise': True,
|
||||||
'line': True, # whether or not to plot diffractogram as a line plot
|
'line': True, # whether or not to plot diffractogram as a line plot
|
||||||
'scatter': False, # whether or not to plot individual data points
|
'scatter': False, # whether or not to plot individual data points
|
||||||
'reflections_plot': False, # whether to plot reflections as a plot
|
'reflections_plot': False, # whether to plot reflections as a plot
|
||||||
|
|
@ -55,9 +56,12 @@ def plot_diffractogram(data, options={}):
|
||||||
|
|
||||||
for index in range(len(data['path'])):
|
for index in range(len(data['path'])):
|
||||||
diffractogram, wavelength = xrd.io.read_data(data=data, options=options, index=index)
|
diffractogram, wavelength = xrd.io.read_data(data=data, options=options, index=index)
|
||||||
|
|
||||||
data['diffractogram'][index] = diffractogram
|
data['diffractogram'][index] = diffractogram
|
||||||
data['wavelength'][index] = wavelength
|
data['wavelength'][index] = wavelength
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if not isinstance(data['diffractogram'], list):
|
if not isinstance(data['diffractogram'], list):
|
||||||
data['diffractogram'] = [data['diffractogram']]
|
data['diffractogram'] = [data['diffractogram']]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue