From b7ff82b31f6e4d0ed14eb797d4f83366a75c6d63 Mon Sep 17 00:00:00 2001 From: Elliot Oram <elliot.oram@stfc.ac.uk> Date: Wed, 6 Dec 2017 10:29:50 +0000 Subject: [PATCH] Add function set beam params Done in abstract class as it is common across all instruments in isis_powder Refs #21268 --- scripts/Diffraction/isis_powder/abstract_inst.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/Diffraction/isis_powder/abstract_inst.py b/scripts/Diffraction/isis_powder/abstract_inst.py index e66a43f7325..86e11fcbf1d 100644 --- a/scripts/Diffraction/isis_powder/abstract_inst.py +++ b/scripts/Diffraction/isis_powder/abstract_inst.py @@ -23,6 +23,7 @@ class AbstractInst(object): self._inst_prefix = inst_prefix self._output_dir = output_dir self._is_vanadium = None + self._beam_parameters = None @property def calibration_dir(self): @@ -60,6 +61,20 @@ class AbstractInst(object): return focus.focus(run_number_string=run_number_string, perform_vanadium_norm=do_van_normalisation, instrument=self, absorb=do_absorb_corrections, sample_details=sample_details) + def set_beam_parameters(self, height, width): + """ + Set the height and width of the beam. Currently only supports rectangular (or square) beam shapes. + Implementation should be common across all instruments so no need for overriding in instrument classes. + :param height: Height of the beam (mm). + :param width: Width of the beam (mm). + :return: + """ + if height <= 0 or width <= 0: + raise ValueError("Beam height and width must be more than 0.") + else: + self._beam_parameters = {'height': height, + 'width': width} + # Mandatory overrides def _get_run_details(self, run_number_string): -- GitLab