Skip to content

Commit 82757fa

Browse files
committed
allow specification of FITS suffixes in ImageFileCollection
1 parent b9ec64d commit 82757fa

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

ccdproc/image_collection.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ class ImageFileCollection:
7878
The extension from which the header and data will be read in all
7979
files.Default is ``0``.
8080
81+
extensions: list
82+
A list of FITS extensions to search for. The default is ``['fit',
83+
'fits', 'fts']``.
84+
8185
Raises
8286
------
8387
ValueError
@@ -87,7 +91,8 @@ class ImageFileCollection:
8791

8892
def __init__(self, location=None, keywords=None,
8993
find_fits_by_reading=False,
90-
filenames=None, glob_include=None, glob_exclude=None, ext=0):
94+
filenames=None, glob_include=None, glob_exclude=None, ext=0,
95+
extensions=None):
9196
# Include or exclude files from the collection based on glob pattern
9297
# matching - has to go above call to _get_files()
9398
if glob_exclude is not None:
@@ -107,7 +112,7 @@ def __init__(self, location=None, keywords=None,
107112

108113
self._filenames = filenames
109114
self._files = []
110-
self._files = self._get_files()
115+
self._files = self._get_files(extensions=extensions)
111116

112117
if self._files == []:
113118
warnings.warn("no FITS files in the collection.",
@@ -432,7 +437,7 @@ def filter(self, **kwd):
432437
return ImageFileCollection(filenames=files,
433438
keywords=self.keywords)
434439

435-
def _get_files(self):
440+
def _get_files(self, extensions=None):
436441
""" Helper method which checks whether ``files`` should be set
437442
to a subset of file names or to all file names in a directory.
438443
@@ -448,7 +453,7 @@ def _get_files(self):
448453
else:
449454
files = self._filenames
450455
else:
451-
files = self._fits_files_in_directory()
456+
files = self._fits_files_in_directory(extensions=extensions)
452457

453458
if self.glob_include is not None:
454459
files = fnmatch.filter(files, self.glob_include)

0 commit comments

Comments
 (0)