From 8b0a5bcff77ce2481f2784fa914832842fe51788 Mon Sep 17 00:00:00 2001 From: rasmusthog Date: Sun, 9 Oct 2022 18:41:30 +0200 Subject: [PATCH] Add multiplication and drawdown for diffs --- nafuma/xrd/io.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nafuma/xrd/io.py b/nafuma/xrd/io.py index 78375d2..3ba5d82 100644 --- a/nafuma/xrd/io.py +++ b/nafuma/xrd/io.py @@ -720,7 +720,7 @@ def read_data(data, options={}, index=0): diffractogram['I_org'] = diffractogram['I'] diffractogram['2th_org'] = diffractogram['2th'] - diffractogram = apply_offset(diffractogram, wavelength, index, options) + diffractogram = adjust_intensities(diffractogram, wavelength, index, options) @@ -729,7 +729,7 @@ def read_data(data, options={}, index=0): return diffractogram, wavelength -def apply_offset(diffractogram, wavelength, index, options): +def adjust_intensities(diffractogram, wavelength, index, options): if 'current_offset_y' not in options.keys(): options['current_offset_y'] = options['offset_y'] @@ -748,6 +748,10 @@ def apply_offset(diffractogram, wavelength, index, options): if options['normalise']: diffractogram['I'] = diffractogram['I'] / diffractogram['I'].max() + diffractogram['I'] = diffractogram['I'] * options['multiply'] + + if options['drawdown']: + diffractogram['I'] = diffractogram['I'] - diffractogram['I'].mean() diffractogram['I'] = diffractogram['I'] + index*options['offset_y']