From e13b2a3fedc663d00090ef77200a7a9f1287c47b Mon Sep 17 00:00:00 2001 From: Mathieu Doucet Date: Sun, 29 Sep 2024 15:54:38 -0400 Subject: [PATCH] fix template --- reduction/data/template_fbck.xml | 16 ++++++++-------- .../lr_reduction/reduction_template_reader.py | 4 ++-- reduction/test/test_reduction_template_reader.py | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/reduction/data/template_fbck.xml b/reduction/data/template_fbck.xml index 41dbdd0..beb2353 100644 --- a/reduction/data/template_fbck.xml +++ b/reduction/data/template_fbck.xml @@ -14,7 +14,7 @@ 147 N/A True - True + True 133 150 0 @@ -62,7 +62,7 @@ 147 N/A True - True + True 133 150 0 @@ -110,7 +110,7 @@ 147 N/A True - True + True 133 150 0 @@ -158,7 +158,7 @@ 147 N/A True - True + True 133 150 0 @@ -206,7 +206,7 @@ 147 N/A True - True + True 133 150 0 @@ -254,7 +254,7 @@ 147 N/A True - True + True 126 131 153 @@ -302,7 +302,7 @@ 148 N/A True - True + True 131 151 0 @@ -350,7 +350,7 @@ 148 N/A True - True + True 131 151 0 diff --git a/reduction/lr_reduction/reduction_template_reader.py b/reduction/lr_reduction/reduction_template_reader.py index 67253f6..d8a064c 100644 --- a/reduction/lr_reduction/reduction_template_reader.py +++ b/reduction/lr_reduction/reduction_template_reader.py @@ -108,7 +108,7 @@ def to_xml(self): _xml += "%s\n" % str(self.data_peak_range[1]) _xml += "N/A\n" _xml += "%s\n" % str(self.subtract_background) - _xml += "%s\n" % str(self.two_backgrounds) + _xml += "%s\n" % str(self.two_backgrounds) _xml += "%s\n" % str(self.background_roi[0]) _xml += "%s\n" % str(self.background_roi[1]) _xml += "%s\n" % str(self.background_roi[2]) @@ -206,7 +206,7 @@ def from_xml_element(self, instrument_dom): default=self.subtract_background) # use two backgrounds flag - self.two_backgrounds = getBoolElement(instrument_dom, "two_backgrounds_flag", + self.two_backgrounds = getBoolElement(instrument_dom, "two_backgrounds", default=self.two_backgrounds) # background from/to pixels diff --git a/reduction/test/test_reduction_template_reader.py b/reduction/test/test_reduction_template_reader.py index 222f821..57358dd 100644 --- a/reduction/test/test_reduction_template_reader.py +++ b/reduction/test/test_reduction_template_reader.py @@ -11,14 +11,14 @@ def test_two_backgrounds(self): r"""verify the xml dump writes what we want""" redparms = ReductionParameters() redparms.two_backgrounds = True - assert "True" in redparms.to_xml() + assert "True" in redparms.to_xml() def test_emission_delay(self): r"""verify the xml dump writes the emission delay option""" redparms = ReductionParameters() # Default should be True - assert redparms.use_emission_time == True + assert redparms.use_emission_time is True assert "True" in redparms.to_xml() redparms.use_emission_time = False @@ -32,7 +32,7 @@ def test_from_dict(self): redparms.from_dict(dict(two_backgrounds=True)) assert redparms.two_backgrounds # invalid data dictionary and not permissible - with pytest.raises(ValueError) as excinfo: + with pytest.raises(ValueError, match="data_dir contains invalid entries") as excinfo: redparms.from_dict(dict(nonsense=True), permissible=False) assert "data_dir contains invalid entries" == str(excinfo.value) # invalid data dictionary and permissible