diff --git a/RefRed/calculations/lr_data.py b/RefRed/calculations/lr_data.py
index 93f89aaf..6433a5ee 100644
--- a/RefRed/calculations/lr_data.py
+++ b/RefRed/calculations/lr_data.py
@@ -182,7 +182,6 @@ def __init__(
self.back: List[int] = [0, 0] # lower and upper boundaries for the first background
self.back2: List[int] = [0, 0] # lower and upper boundaries for the second background
self.back_flag: bool = True
- self.functional_background: bool = False
self.two_backgrounds: bool = False
self.all_plot_axis = AllPlotAxis()
@@ -202,7 +201,6 @@ def __init__(
self.low_res = [int(lconfig.data_low_res[0]), int(lconfig.data_low_res[1])]
self.low_res_flag = bool(lconfig.data_low_res_flag)
self.back_flag = bool(lconfig.data_back_flag)
- self.functional_background = bool(lconfig.data_functional_background)
self.two_backgrounds = bool(lconfig.data_two_backgrounds)
else:
self.peak = [int(lconfig.norm_peak[0]), int(lconfig.norm_peak[1])]
@@ -211,7 +209,6 @@ def __init__(
self.low_res = [int(lconfig.norm_low_res[0]), int(lconfig.norm_low_res[1])]
self.low_res_flag = bool(lconfig.norm_low_res_flag)
self.back_flag = bool(lconfig.norm_back_flag)
- self.functional_background = bool(lconfig.norm_functional_background)
self.two_backgrounds = bool(lconfig.norm_two_backgrounds)
elif reduction_table_cell is not None:
@@ -225,7 +222,6 @@ def __init__(
self.low_res = reduction_table_cell.low_res
self.low_res_flag = reduction_table_cell.low_res_flag
self.back_flag = reduction_table_cell.back_flag
- self.functional_background = reduction_table_cell.functional_background
self.two_backgrounds = reduction_table_cell.two_backgrounds
else:
diff --git a/RefRed/configuration/export_xml_config.py b/RefRed/configuration/export_xml_config.py
index 526149b5..97f1cb2b 100644
--- a/RefRed/configuration/export_xml_config.py
+++ b/RefRed/configuration/export_xml_config.py
@@ -89,7 +89,6 @@ def main_part(self):
data_back2 = _data.back2
data_low_res = _data.low_res
data_back_flag = _data.back_flag
- data_functional_background = _data.functional_background
data_two_backgrounds = _data.two_backgrounds
data_low_res_flag = bool(_data.low_res_flag)
data_lambda_requested = _data.lambda_requested
@@ -105,7 +104,6 @@ def main_part(self):
norm_back = _norm.back
norm_back2 = _norm.back2
norm_back_flag = _norm.back_flag
- norm_functional_background = _norm.functional_background
norm_two_backgrounds = _norm.two_backgrounds
norm_low_res = _norm.low_res
@@ -116,7 +114,6 @@ def main_part(self):
norm_peak = [0, 255]
norm_back = [0, 255]
norm_back_flag = False
- norm_functional_background = False
norm_two_backgrounds = False
norm_low_res = [0, 255]
norm_low_res_flag = False
@@ -126,9 +123,6 @@ def main_part(self):
str_array.append(' ' + str(data_peak[1]) + '\n')
str_array.append(' N/A\n')
str_array.append(' ' + str(data_back_flag) + '\n')
- str_array.append(
- ' ' + str(data_functional_background) + '\n'
- )
str_array.append(' ' + str(data_two_backgrounds) + '\n')
str_array.append(' ' + str(data_back[0]) + '\n')
str_array.append(' ' + str(data_back[1]) + '\n')
@@ -166,9 +160,6 @@ def main_part(self):
str_array.append(' ' + str(norm_peak[0]) + '\n')
str_array.append(' ' + str(norm_peak[1]) + '\n')
str_array.append(' ' + str(norm_back_flag) + '\n')
- str_array.append(
- ' ' + str(norm_functional_background) + '\n'
- )
str_array.append(' ' + str(norm_two_backgrounds) + '\n')
str_array.append(' ' + str(norm_back[0]) + '\n')
str_array.append(' ' + str(norm_back[1]) + '\n')
diff --git a/RefRed/configuration/load_reduction_table_from_lconfigdataset.py b/RefRed/configuration/load_reduction_table_from_lconfigdataset.py
index 36a7b4ac..829c7835 100644
--- a/RefRed/configuration/load_reduction_table_from_lconfigdataset.py
+++ b/RefRed/configuration/load_reduction_table_from_lconfigdataset.py
@@ -100,7 +100,6 @@ def update_lrdata(self, lrdata=None, lconfig=None, type='data', row=0):
back2_1 = int(lconfig.data_back2[0])
back2_2 = int(lconfig.data_back2[1])
back_flag = lconfig.data_back_flag
- functional_background = lconfig.data_functional_background
two_backgrounds = lconfig.data_two_backgrounds
low_res1 = int(lconfig.data_low_res[0])
low_res2 = int(lconfig.data_low_res[1])
@@ -115,7 +114,6 @@ def update_lrdata(self, lrdata=None, lconfig=None, type='data', row=0):
back2_1 = int(lconfig.norm_back2[0])
back2_2 = int(lconfig.norm_back2[1])
back_flag = lconfig.norm_back_flag
- functional_background = lconfig.norm_functional_background
two_backgrounds = lconfig.norm_two_backgrounds
low_res1 = int(lconfig.norm_low_res[0])
low_res2 = int(lconfig.norm_low_res[1])
@@ -130,7 +128,6 @@ def update_lrdata(self, lrdata=None, lconfig=None, type='data', row=0):
lrdata.back = [back1_1, back1_2]
lrdata.back2 = [back2_1, back2_2]
lrdata.back_flag = back_flag
- lrdata.functional_background = functional_background
lrdata.two_backgrounds = two_backgrounds
lrdata.low_res = [low_res1, low_res2]
lrdata.low_res_flag = low_res_flag
diff --git a/RefRed/configuration/loading_configuration.py b/RefRed/configuration/loading_configuration.py
index 390c0361..2bc97088 100644
--- a/RefRed/configuration/loading_configuration.py
+++ b/RefRed/configuration/loading_configuration.py
@@ -206,7 +206,6 @@ def get_item_boolean(item_name: str, default) -> bool:
# background settings for reflectivity data
iMetadata.data_back_flag = get_item_boolean("background_flag", default=True)
- iMetadata.data_functional_background = get_item_boolean("functional_background", default=False)
iMetadata.data_two_backgrounds = get_item_boolean("two_backgrounds", default=False)
_low_res_flag = str2bool(self.getNodeValue(node, 'x_range_flag'))
@@ -258,7 +257,6 @@ def get_item_boolean(item_name: str, default) -> bool:
# background settings for normalization data
iMetadata.norm_back_flag = get_item_boolean("norm_background_flag", default=True)
- iMetadata.norm_functional_background = get_item_boolean("norm_functional_background", default=False)
iMetadata.norm_two_backgrounds = get_item_boolean("norm_two_backgrounds", default=False)
_low_res_flag = str2bool(self.getNodeValue(node, 'norm_x_range_flag'))
diff --git a/RefRed/interfaces/background_settings.ui b/RefRed/interfaces/background_settings.ui
index 10fe4a40..39883264 100644
--- a/RefRed/interfaces/background_settings.ui
+++ b/RefRed/interfaces/background_settings.ui
@@ -7,7 +7,7 @@
0
0
260
- 160
+ 101
@@ -19,10 +19,10 @@
- 13
- 19
+ 10
+ 10
241
- 131
+ 81
@@ -63,40 +63,6 @@
- -
-
-
-
-
-
-
-
-
-
- -
-
-
- <html><head/><body><p>Fit the background region(s) with a linear function. Functional background is necessary when using two background regions. It is optional when using a single region. In that case, the background is estimated by simple averaging</p></body></html>
-
-
- Use functional background
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
-
-
diff --git a/RefRed/lconfigdataset.py b/RefRed/lconfigdataset.py
index 682d979a..b8eeeb9d 100644
--- a/RefRed/lconfigdataset.py
+++ b/RefRed/lconfigdataset.py
@@ -20,7 +20,6 @@ class LConfigDataset(object):
data_back2: List[int] = [0, 0] # lower and upper boundaries for the second background
data_low_res = [50, 200]
data_back_flag: bool = True
- data_functional_background: bool = False
data_two_backgrounds: bool = False
data_low_res_flag = True
data_lambda_requested = -1
@@ -38,7 +37,6 @@ class LConfigDataset(object):
norm_back = [0, 0]
norm_back2: List[int] = [0, 0] # lower and upper boundaries for the second background
norm_back_flag: bool = True
- norm_functional_background: bool = False
norm_two_backgrounds: bool = False
norm_low_res = [50, 200]
diff --git a/RefRed/plot/background_settings.py b/RefRed/plot/background_settings.py
index 1806e911..456e773e 100644
--- a/RefRed/plot/background_settings.py
+++ b/RefRed/plot/background_settings.py
@@ -15,13 +15,11 @@
class BackgroundSettingsModel(QObject):
signal_first_background = Signal(bool)
signal_second_background = Signal(bool)
- signal_functional_background = Signal(bool)
signal_two_backgrounds = Signal(bool)
def __init__(self):
super(BackgroundSettingsModel, self).__init__()
self._subtract_background = True
- self._functional_background = False
self._two_backgrounds = False
self.maingui = None
@@ -37,17 +35,6 @@ def subtract_background(self, value: bool):
self.signal_first_background.emit(value)
self.signal_second_background.emit(value and self.two_backgrounds)
- @property
- def functional_background(self) -> bool:
- return self._functional_background
-
- @functional_background.setter
- def functional_background(self, value: bool):
- previous = self._functional_background # backup
- self._functional_background = value
- if previous != value: # emit changes
- self.signal_functional_background.emit(value)
-
@property
def two_backgrounds(self) -> bool:
return self._two_backgrounds
@@ -60,13 +47,10 @@ def two_backgrounds(self, value: bool):
if previous != value: # emit changes
self.signal_second_background.emit(self.subtract_background and value)
- def update_all_settings(
- self, subtract_background: bool = True, functional_background: bool = False, two_backgrounds: bool = False
- ):
+ def update_all_settings(self, subtract_background: bool = True, two_backgrounds: bool = False):
# we access the private attributes to prevent emitting any of the signals that could be emitted by
# the setter functions of the associated properties
self._subtract_background = subtract_background
- self._functional_background = functional_background
self._two_backgrounds = two_backgrounds
def set_spinbox_visibilities(self, parent: QWidget, first_background: Tuple[str], second_background: Tuple[str]):
@@ -148,7 +132,7 @@ def update_from_table(self, active_row_index: int, is_data: bool):
if data is None: # the active row in the reduction table has no reflectivity and/or direct-beam data
return
updater = {True: self.data.update_all_settings, False: self.norm.update_all_settings}
- updater[is_data](data.back_flag, data.functional_background, data.two_backgrounds)
+ updater[is_data](data.back_flag, data.two_backgrounds)
def table_updater_factory(self, setting: str, data_type: str):
r"""Generate anonymous functions to serve as callback when any of the background settings
@@ -161,8 +145,7 @@ def table_updater_factory(self, setting: str, data_type: str):
Parameters
----------
setting
- the background setting in `big_table` to update. One of `back_flag`, `functional_background`,
- `two_backgrounds`
+ the background setting in `big_table` to update. One of `back_flag` and `two_backgrounds`
data_type
whether to update the reflectivity or the normalization `LRData` instances for the currently active
row in the reduction table
@@ -202,9 +185,9 @@ def _initialize_reduction_table_updaters(self):
`data` or `norm` BackgroundSettingsModel instances.
"""
# names of some of the signals emitted by self.data and self.norm
- signal_names = ["signal_first_background", "signal_functional_background", "signal_two_backgrounds"]
+ signal_names = ["signal_first_background", "signal_two_backgrounds"]
# names of the background settings attributes in the LRData instances of `big_table_data`
- setting_names = ["back_flag", "functional_background", "two_backgrounds"]
+ setting_names = ["back_flag", "two_backgrounds"]
# connect the signals to dedicated slots that will update the LRData instances
for signal_name, setting_name in zip(signal_names, setting_names):
signal = getattr(self.data, signal_name)
@@ -219,7 +202,7 @@ def _initialize_reduction_table_updaters(self):
class BackgroundSettingsView(QDialog):
# checkbox names as well as names for the model properties
- options = ["subtract_background", "functional_background", "two_backgrounds"]
+ options = ["subtract_background", "two_backgrounds"]
def __init__(self, parent: QWidget, run_type="data"):
super().__init__(parent)
@@ -229,7 +212,7 @@ def __init__(self, parent: QWidget, run_type="data"):
self._set_connections()
def _set_connections(self):
- for box_name in ["subtract_background", "functional_background", "two_backgrounds"]:
+ for box_name in ["subtract_background", "two_backgrounds"]:
checkbox: QCheckBox = getattr(self.ui, box_name)
# signal stateChanged emits `state`, which we pass to our anonymous `lambda`
# `option=box_name` in effect allows us to define a different lambda` function for each checkbox
diff --git a/RefRed/preview_config/preview_config.py b/RefRed/preview_config/preview_config.py
index 935f4112..d346d533 100644
--- a/RefRed/preview_config/preview_config.py
+++ b/RefRed/preview_config/preview_config.py
@@ -16,7 +16,6 @@ class PreviewConfig(QtWidgets.QMainWindow):
"to_peak_pixels",
"peak_discrete_selection",
"background_flag",
- "functional_background",
"two_backgrounds",
"back_roi1_from",
"back_roi1_to",
@@ -38,7 +37,6 @@ class PreviewConfig(QtWidgets.QMainWindow):
"norm_from_peak_pixels",
"norm_to_peak_pixels",
"norm_background_flag",
- "norm_functional_background",
"norm_two_backgrounds",
"norm_from_back_pixels",
"norm_to_back_pixels",
@@ -61,9 +59,7 @@ class PreviewConfig(QtWidgets.QMainWindow):
# may have default values. This way we will load configuration files missing these entries
# and preview them with the default values.
data_name_defaults = {
- "functional_background": False,
"two_backgrounds": False,
- "norm_functional_background": False,
"norm_two_backgrounds": False,
}
diff --git a/RefRed/reduction/individual_reduction_settings_handler.py b/RefRed/reduction/individual_reduction_settings_handler.py
index fe4ec05d..8e8ea7e3 100644
--- a/RefRed/reduction/individual_reduction_settings_handler.py
+++ b/RefRed/reduction/individual_reduction_settings_handler.py
@@ -67,7 +67,7 @@ def norm_setting(setting: str) -> Optional[Any]:
data_peak_range=self._data_peak_range,
subtract_background=self.data.back_flag,
two_backgrounds=self.data.two_backgrounds, # should we use both background regions?
- functional_background=self.data.functional_background,
+ functional_background=self.data.two_backgrounds, # should have same value as `two_backgrounds`
background_roi=self._data_back_range,
data_x_range_flag=self._data_low_res_flag,
data_x_range=self._data_low_res_range,
diff --git a/RefRed/reduction/live_reduction_handler.py b/RefRed/reduction/live_reduction_handler.py
index cb66c794..e990e26c 100644
--- a/RefRed/reduction/live_reduction_handler.py
+++ b/RefRed/reduction/live_reduction_handler.py
@@ -87,7 +87,7 @@ def run(self):
template_data,
info=True,
normalize=reduction_pars['apply_normalization'],
- functional_background=reduction_pars['functional_background'],
+ functional_background=reduction_pars['two_backgrounds'],
)
self.save_reduction(row_index, refl=[q, r, dr], info=info)
except: