Commit c2e49db2 authored by Thomas Vincent's avatar Thomas Vincent

Add snip background with a really large window

parent b8019b2d
......@@ -192,10 +192,13 @@ class FitWidget(Qt.QWidget):
"Select background subtraction mode:<br><br>"
"<b>-</b>: No background<br>"
"<b>Constant</b>: Shift data so that min is 0<br>"
"<b>Linear</b>: Linear background from first to last data")
"<b>Linear</b>: Linear background from first to last data<br>"
"<b>Snip</b>: Snip background estimation"
"(Statistics-sensitive Non-linear Iterative Peak-clipping algorithm)")
self.__bgComboBox.addItem('-', BackgroundTypes.NONE)
self.__bgComboBox.addItem('Constant', BackgroundTypes.CONSTANT)
self.__bgComboBox.addItem('Linear', BackgroundTypes.LINEAR)
self.__bgComboBox.addItem('Snip', BackgroundTypes.SNIP)
self.__bgComboBox.setCurrentIndex(0)
layout.addRow('Background:', self.__bgComboBox)
......
......@@ -36,6 +36,7 @@ import ctypes
import multiprocessing as mp
from threading import Thread
import multiprocessing.sharedctypes as mp_sharedctypes
from silx.math.fit import snip1d
import numpy as np
......@@ -73,6 +74,10 @@ def background_estimation(mode, data):
# Simple linear background
return np.linspace(data[0], data[-1], num=len(data), endpoint=True)
elif mode == BackgroundTypes.SNIP:
# Using snip background
return snip1d(data, snip_width=len(data))
elif mode == BackgroundTypes.NONE:
return np.zeros_like(data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment