Skip to content

Commit 67b6b8b

Browse files
authored
Merge pull request #146 from kecnry/bg-single-trace
BUG: fix passing single Trace object to Background
2 parents f8c67a9 + 86d501c commit 67b6b8b

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

CHANGES.rst

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ API Changes
1010
Bug Fixes
1111
^^^^^^^^^
1212

13+
- Fixed passing a single ``Trace`` object to ``Background`` [#146]
14+
1315

1416
1.2.0
1517
-----

specreduce/background.py

+3
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ def _to_trace(trace):
9393
self.bkg_array = np.zeros(self.image.shape[self.disp_axis])
9494
return
9595

96+
if isinstance(self.traces, Trace):
97+
self.traces = [self.traces]
98+
9699
bkg_wimage = np.zeros_like(self.image, dtype=np.float64)
97100
for trace in self.traces:
98101
trace = _to_trace(trace)

specreduce/tests/test_background.py

+3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ def test_background():
3838
# test that creating a one_sided background works
3939
Background.one_sided(image, trace, bkg_sep, width=bkg_width)
4040

41+
# test that passing a single trace works
42+
bg = Background(image, trace, width=bkg_width)
43+
4144
# test that image subtraction works
4245
sub1 = image - bg1
4346
sub2 = bg1.sub_image(image)

0 commit comments

Comments
 (0)