Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix template #50

Merged
merged 1 commit into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions reduction/data/template_fbck.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<to_peak_pixels>147</to_peak_pixels>
<peak_discrete_selection>N/A</peak_discrete_selection>
<background_flag>True</background_flag>
<two_backgrounds_flag>True</two_backgrounds_flag>
<two_backgrounds>True</two_backgrounds>
<back_roi1_from>133</back_roi1_from>
<back_roi1_to>150</back_roi1_to>
<back_roi2_from>0</back_roi2_from>
Expand Down Expand Up @@ -62,7 +62,7 @@
<to_peak_pixels>147</to_peak_pixels>
<peak_discrete_selection>N/A</peak_discrete_selection>
<background_flag>True</background_flag>
<two_backgrounds_flag>True</two_backgrounds_flag>
<two_backgrounds>True</two_backgrounds>
<back_roi1_from>133</back_roi1_from>
<back_roi1_to>150</back_roi1_to>
<back_roi2_from>0</back_roi2_from>
Expand Down Expand Up @@ -110,7 +110,7 @@
<to_peak_pixels>147</to_peak_pixels>
<peak_discrete_selection>N/A</peak_discrete_selection>
<background_flag>True</background_flag>
<two_backgrounds_flag>True</two_backgrounds_flag>
<two_backgrounds>True</two_backgrounds>
<back_roi1_from>133</back_roi1_from>
<back_roi1_to>150</back_roi1_to>
<back_roi2_from>0</back_roi2_from>
Expand Down Expand Up @@ -158,7 +158,7 @@
<to_peak_pixels>147</to_peak_pixels>
<peak_discrete_selection>N/A</peak_discrete_selection>
<background_flag>True</background_flag>
<two_backgrounds_flag>True</two_backgrounds_flag>
<two_backgrounds>True</two_backgrounds>
<back_roi1_from>133</back_roi1_from>
<back_roi1_to>150</back_roi1_to>
<back_roi2_from>0</back_roi2_from>
Expand Down Expand Up @@ -206,7 +206,7 @@
<to_peak_pixels>147</to_peak_pixels>
<peak_discrete_selection>N/A</peak_discrete_selection>
<background_flag>True</background_flag>
<two_backgrounds_flag>True</two_backgrounds_flag>
<two_backgrounds>True</two_backgrounds>
<back_roi1_from>133</back_roi1_from>
<back_roi1_to>150</back_roi1_to>
<back_roi2_from>0</back_roi2_from>
Expand Down Expand Up @@ -254,7 +254,7 @@
<to_peak_pixels>147</to_peak_pixels>
<peak_discrete_selection>N/A</peak_discrete_selection>
<background_flag>True</background_flag>
<two_backgrounds_flag>True</two_backgrounds_flag>
<two_backgrounds>True</two_backgrounds>
<back_roi1_from>126</back_roi1_from>
<back_roi1_to>131</back_roi1_to>
<back_roi2_from>153</back_roi2_from>
Expand Down Expand Up @@ -302,7 +302,7 @@
<to_peak_pixels>148</to_peak_pixels>
<peak_discrete_selection>N/A</peak_discrete_selection>
<background_flag>True</background_flag>
<two_backgrounds_flag>True</two_backgrounds_flag>
<two_backgrounds>True</two_backgrounds>
<back_roi1_from>131</back_roi1_from>
<back_roi1_to>151</back_roi1_to>
<back_roi2_from>0</back_roi2_from>
Expand Down Expand Up @@ -350,7 +350,7 @@
<to_peak_pixels>148</to_peak_pixels>
<peak_discrete_selection>N/A</peak_discrete_selection>
<background_flag>True</background_flag>
<two_backgrounds_flag>True</two_backgrounds_flag>
<two_backgrounds>True</two_backgrounds>
<back_roi1_from>131</back_roi1_from>
<back_roi1_to>151</back_roi1_to>
<back_roi2_from>0</back_roi2_from>
Expand Down
4 changes: 2 additions & 2 deletions reduction/lr_reduction/reduction_template_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def to_xml(self):
_xml += "<to_peak_pixels>%s</to_peak_pixels>\n" % str(self.data_peak_range[1])
_xml += "<peak_discrete_selection>N/A</peak_discrete_selection>\n"
_xml += "<background_flag>%s</background_flag>\n" % str(self.subtract_background)
_xml += "<two_backgrounds_flag>%s</two_backgrounds_flag>\n" % str(self.two_backgrounds)
_xml += "<two_backgrounds>%s</two_backgrounds>\n" % str(self.two_backgrounds)
_xml += "<back_roi1_from>%s</back_roi1_from>\n" % str(self.background_roi[0])
_xml += "<back_roi1_to>%s</back_roi1_to>\n" % str(self.background_roi[1])
_xml += "<back_roi2_from>%s</back_roi2_from>\n" % str(self.background_roi[2])
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions reduction/test/test_reduction_template_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<two_backgrounds_flag>True</two_backgrounds_flag>" in redparms.to_xml()
assert "<two_backgrounds>True</two_backgrounds>" 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 "<use_emission_time>True</use_emission_time>" in redparms.to_xml()

redparms.use_emission_time = False
Expand All @@ -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
Expand Down
Loading