Skip to content

Commit bd0057f

Browse files
authored
Merge pull request #901 from EvelynMS1/fix814err
fix #814
2 parents e793d77 + 6599299 commit bd0057f

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Alphabetical list of code contributors
4646
* Pey Lian Lim (@pllim)
4747
* James McCormac (@jmccormac01)
4848
* Abigale Moen (@AbigaleMoen)
49+
* Evelyn Montes Sobal (@EvelynMS1)
4950
* Stefan Nelson (@stefannelson)
5051
* Alex Niemi (@AlexN1234)
5152
* Joe Philip Ninan (@indiajoe)

ccdproc/image_collection.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,12 @@ def filter(self, **kwd):
432432
A new collection with the files matched by the arguments
433433
to filter.
434434
"""
435+
435436
files = self.files_filtered(include_path=True, **kwd)
436-
return ImageFileCollection(filenames=files, keywords=self.keywords)
437+
438+
return ImageFileCollection(
439+
filenames=files, keywords=self.keywords, ext=self._ext
440+
)
437441

438442
def _get_files(self):
439443
"""Helper method which checks whether ``files`` should be set

ccdproc/tests/test_image_collection.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,3 +1152,17 @@ def test_filter_on_regex_escape_characters(self, triage_setup):
11521152
new_ic = ic.filter(regex_fl=kw)
11531153
assert len(new_ic.files) == 1
11541154
assert kw in new_ic.summary["regex_fl"]
1155+
1156+
def test_filter_on_check_ext(self, tmp_path):
1157+
"""
1158+
Testing the 814 error
1159+
"""
1160+
hdul = fits.HDUList(
1161+
[fits.PrimaryHDU(np.ones((10, 10))), fits.ImageHDU(np.ones((10, 10)))]
1162+
)
1163+
hdul.writeto(tmp_path / "mef.fits")
1164+
ifc = ImageFileCollection(tmp_path, ext=1)
1165+
assert len(ifc.summary) > 0
1166+
ifc2 = ifc.filter()
1167+
assert len(ifc2.summary) > 0
1168+
assert ifc2.ext == 1

0 commit comments

Comments
 (0)