diff --git a/RefRed/configuration/export_xml_config.py b/RefRed/configuration/export_xml_config.py index 97f1cb2b..e5d320fe 100644 --- a/RefRed/configuration/export_xml_config.py +++ b/RefRed/configuration/export_xml_config.py @@ -209,6 +209,10 @@ def main_part(self): ) str_array.append(' True\n') + + # Dead time correction + dead_time = o_general_settings.dead_time + str_array.append(' ' + str(dead_time) + '\n') str_array.append(' \n') str_array.append(' \n') diff --git a/RefRed/configuration/loading_configuration.py b/RefRed/configuration/loading_configuration.py index 2bc97088..ee523faa 100644 --- a/RefRed/configuration/loading_configuration.py +++ b/RefRed/configuration/loading_configuration.py @@ -179,6 +179,9 @@ def populate_main_gui_general_settings(self): o_scaling_factor_widget.checkbox(status=scaling_factor_flag) o_scaling_factor_widget.set_enabled(status=scaling_factor_flag) + use_dead_time = str2bool(self.getNodeValue(node_0, 'dead_time_correction')) + self.parent.ui.deadtime_checkbox.setChecked(use_dead_time) + def getMetadataObject(self, node) -> LConfigDataset: r"""Populate an instance of type LConfigDataset using the information contained in one of the 'RefLData XML blocks within a configuration file.""" diff --git a/RefRed/gui_handling/gui_utility.py b/RefRed/gui_handling/gui_utility.py index 109256a0..b791f81a 100644 --- a/RefRed/gui_handling/gui_utility.py +++ b/RefRed/gui_handling/gui_utility.py @@ -34,7 +34,7 @@ def init_widgets_value(self): _gui_metadata = self.parent.gui_metadata # event tof bins - _tof_bin = _gui_metadata['tof_bin'] + _tof_bin = int(_gui_metadata['tof_bin']) self.parent.ui.eventTofBins.setValue(_tof_bin) # q bin diff --git a/RefRed/initialization/gui.py b/RefRed/initialization/gui.py index f059140d..5ee1eebb 100644 --- a/RefRed/initialization/gui.py +++ b/RefRed/initialization/gui.py @@ -108,8 +108,8 @@ def set_gui_size(self): self.parent.setGeometry( 50, 50, - self.gui_size_coeff * screen.width(), - self.gui_size_coeff * screen.height(), + int(self.gui_size_coeff * screen.width()), + int(self.gui_size_coeff * screen.height()), ) def set_statusbar(self): diff --git a/RefRed/interfaces/mplwidgets.py b/RefRed/interfaces/mplwidgets.py index ecadcd34..31bd7898 100644 --- a/RefRed/interfaces/mplwidgets.py +++ b/RefRed/interfaces/mplwidgets.py @@ -2,7 +2,6 @@ import os import tempfile from qtpy import QtCore, QtGui, QtWidgets -import matplotlib.cm import matplotlib.colors from matplotlib.colors import LogNorm, Normalize from RefRed.config import plotting @@ -17,11 +16,6 @@ def _set_default_rc(): _set_default_rc() -cmap = matplotlib.colors.LinearSegmentedColormap.from_list( - "default", ["#0000ff", "#00ff00", "#ffff00", "#ff0000", "#bd7efc", "#000000"], N=256 -) -matplotlib.cm.register_cmap("default", cmap=cmap) - # set the default backend to be compatible with Qt in case someone uses pylab from IPython console def set_matplotlib_backend(): diff --git a/RefRed/interfaces/refred_main_interface.ui b/RefRed/interfaces/refred_main_interface.ui index ed8651fe..0d3f370b 100644 --- a/RefRed/interfaces/refred_main_interface.ui +++ b/RefRed/interfaces/refred_main_interface.ui @@ -38,8 +38,8 @@ 0 0 - 1540 - 1319 + 1544 + 1317 @@ -603,15 +603,6 @@ - - - - 0 - 0 - 0 - - - @@ -749,15 +740,6 @@ - - - - 0 - 0 - 0 - - - @@ -895,15 +877,6 @@ - - - - 0 - 0 - 0 - - - @@ -1032,6 +1005,16 @@ p, li { white-space: pre-wrap; } + + + + Use dead time correction + + + true + + + @@ -1040,6 +1023,9 @@ p, li { white-space: pre-wrap; } + + + @@ -1993,15 +1979,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 255 - 0 - - - @@ -2013,15 +1990,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 255 - 0 - - - @@ -2033,15 +2001,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 0 - - - @@ -2064,15 +2023,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 255 - 0 - - - @@ -2084,15 +2034,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 255 - 0 - - - @@ -2104,15 +2045,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 0 - - - @@ -2197,15 +2129,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 15 - 29 - - - @@ -2217,15 +2140,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 15 - 29 - - - @@ -2237,15 +2151,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 0 - - - @@ -2268,15 +2173,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 15 - 29 - - - @@ -2288,15 +2184,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 15 - 29 - - - @@ -2308,15 +2195,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 0 - - - @@ -2404,15 +2282,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 165 - 0 - - - @@ -2424,15 +2293,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 165 - 0 - - - @@ -2444,15 +2304,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 0 - - - @@ -2478,15 +2329,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 120 - 0 - - - @@ -2498,15 +2340,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 120 - 0 - - - @@ -2518,15 +2351,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 0 - - - @@ -2734,15 +2558,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 255 - - - @@ -2754,15 +2569,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 255 - - - @@ -2774,15 +2580,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 255 - - - @@ -2834,15 +2631,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 255 - - - @@ -2854,15 +2642,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 255 - - - @@ -2874,15 +2653,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 255 - - - @@ -3084,15 +2854,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 255 - 0 - - - @@ -3104,15 +2865,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 255 - 0 - - - @@ -3124,15 +2876,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 0 - - - @@ -3173,15 +2916,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 255 - 0 - - - @@ -3193,15 +2927,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 255 - 0 - - - @@ -3213,15 +2938,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 0 - - - @@ -3280,15 +2996,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 15 - 29 - - - @@ -3300,15 +3007,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 15 - 29 - - - @@ -3320,15 +3018,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 0 - - - @@ -3369,15 +3058,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 15 - 29 - - - @@ -3389,15 +3069,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 15 - 29 - - - @@ -3409,15 +3080,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 0 - - - @@ -3476,15 +3138,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 120 - 0 - - - @@ -3496,15 +3149,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 120 - 0 - - - @@ -3516,15 +3160,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 0 - - - @@ -3565,15 +3200,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 120 - 0 - - - @@ -3585,15 +3211,6 @@ p, li { white-space: pre-wrap; } - - - - 255 - 120 - 0 - - - @@ -3605,15 +3222,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 0 - - - @@ -3809,15 +3417,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 255 - - - @@ -3829,15 +3428,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 255 - - - @@ -3849,15 +3439,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 255 - - - @@ -3909,15 +3490,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 255 - - - @@ -3929,15 +3501,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 255 - - - @@ -3949,15 +3512,6 @@ p, li { white-space: pre-wrap; } - - - - 0 - 0 - 255 - - - @@ -4296,12 +3850,12 @@ p, li { white-space: pre-wrap; } true - - 25 - 50 + + 25 + false @@ -5328,7 +4882,7 @@ p, li { white-space: pre-wrap; } 0 0 1560 - 22 + 28 diff --git a/RefRed/reduction/global_reduction_settings_handler.py b/RefRed/reduction/global_reduction_settings_handler.py index 6af1236d..a20bac74 100644 --- a/RefRed/reduction/global_reduction_settings_handler.py +++ b/RefRed/reduction/global_reduction_settings_handler.py @@ -24,6 +24,7 @@ def retrieve(self): self.angle_offset_error = self.get_angle_offset_error() self.tof_steps = self.get_tof_steps() self.apply_normalization = self.parent.ui.useNormalizationFlag.isChecked() + self.dead_time = self.parent.ui.deadtime_checkbox.isChecked() def to_dict(self): """ @@ -40,6 +41,7 @@ def to_dict(self): "angle_offset_error", "tof_steps", "apply_normalization", + "dead_time", ] return {k: getattr(self, k) for k in keys} diff --git a/RefRed/reduction/live_reduction_handler.py b/RefRed/reduction/live_reduction_handler.py index e990e26c..3aca48fc 100644 --- a/RefRed/reduction/live_reduction_handler.py +++ b/RefRed/reduction/live_reduction_handler.py @@ -87,7 +87,6 @@ def run(self): template_data, info=True, normalize=reduction_pars['apply_normalization'], - functional_background=reduction_pars['two_backgrounds'], ) self.save_reduction(row_index, refl=[q, r, dr], info=info) except: diff --git a/RefRed/sf_calculator/sf_calculator.py b/RefRed/sf_calculator/sf_calculator.py index b8a2ffa9..3b3ac277 100644 --- a/RefRed/sf_calculator/sf_calculator.py +++ b/RefRed/sf_calculator/sf_calculator.py @@ -195,7 +195,7 @@ def runSequenceLineEditEvent(self): def updateProgressBar(self, progress): self.event_progressbar.setVisible(True) - self.event_progressbar.setValue(progress * 100) + self.event_progressbar.setValue(int(progress * 100)) self.event_progressbar.update() if progress == 1: time.sleep(2) diff --git a/environment.yml b/environment.yml index 6b533372..3bb64c09 100644 --- a/environment.yml +++ b/environment.yml @@ -1,19 +1,19 @@ name: refred channels: - - mantid/label/main + - mantid/label/nightly - conda-forge - defaults dependencies: - - python=3.8 - - mantid=6.7.0 - - qt>=5.12.9,<6 - - pyqt>=5.12.3 + - python=3.10 + - mantid>6.9.20240318 + - qt==5.15.8 + - pyqt>=5.15,<6 - qtpy>=1.9.0 - configobj - matplotlib - pip - pip: - - git+https://github.com/neutrons/LiquidsReflectometer.git@v2.0.18#egg=lr_reduction + - git+https://github.com/neutrons/LiquidsReflectometer.git@v2.0.21#egg=lr_reduction # documentation - sphinx - sphinx_rtd_theme diff --git a/requirements.txt b/requirements.txt index 83e77793..ca1902d7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,5 +6,5 @@ numpy PyQt5 qtpy setuptools -lr_reduction@git+https://github.com/neutrons/LiquidsReflectometer.git@v2.0.18#egg=lr_reduction +lr_reduction@git+https://github.com/neutrons/LiquidsReflectometer.git@v2.0.21#egg=lr_reduction diff --git a/test/unit/RefRed/configuration/test_loading_configuration.py b/test/unit/RefRed/configuration/test_loading_configuration.py index 8105fef4..f4d1d912 100644 --- a/test/unit/RefRed/configuration/test_loading_configuration.py +++ b/test/unit/RefRed/configuration/test_loading_configuration.py @@ -83,6 +83,7 @@ def test_populate_main_gui_general_settings(self): 'scaling_factor_file': 'scaling_factor_file', 'incident_medium_index_selected': 5.005, 'scaling_factor_flag': 6.006, + 'dead_time_correction': False, } def side_effect(node, arg):