Skip to content

Commit

Permalink
Merge pull request #392 from Allonck/updateDCRparams
Browse files Browse the repository at this point in the history
Add test for relative path in flats and fix reduced path basename
  • Loading branch information
Allonck authored Mar 21, 2024
2 parents 1ede463 + 7d55b40 commit 5ea0d32
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions goodman_pipeline/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def create_master_bias(bias_files,
"""Create Master Bias
Given a :class:`~pandas.DataFrame` object that contains a list of compatible bias.
This function creates the master flat using ccdproc.combine using median
This function creates the master bias using ccdproc.combine using median
and 3-sigma clipping.
Args:
Expand Down Expand Up @@ -1430,7 +1430,7 @@ def get_best_flat(flat_name, path):
master_flat_name (str): Full path to the chosen master flat.
"""
flat_list = glob.glob(os.path.join(path, flat_name))
flat_list = glob.glob(os.path.join(path, os.path.basename(flat_name)))
log.debug('Flat base name {:s}'.format(flat_name))
log.debug('Matching master flats found: {:d}'.format(len(flat_list)))
if len(flat_list) > 0:
Expand Down Expand Up @@ -4108,6 +4108,7 @@ def __init__(self):
['1200', 'm5', '49.6', '24.8', 'GG455', 'GG455'],
['1200', 'm6', '54.8', '27.4', 'GG495', 'GG495'],
['1200', 'm7', '60.2', '30.1', 'OG570', 'OG570'],
['1200', 'CaNIR', '60.2', '30.1', 'OG570', 'OG570'],
['1800', 'Custom', 'None', 'None', 'NO_FILTER', '<NO FILTER>'],
['2100', 'Custom', 'None', 'None', 'NO_FILTER', '<NO FILTER>'],
['2400', 'Custom', 'None', 'None', 'NO_FILTER', '<NO FILTER>']
Expand Down
10 changes: 8 additions & 2 deletions goodman_pipeline/core/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1387,8 +1387,6 @@ def tearDown(self):
self.assertFalse(os.path.isfile(norm_flat))

def test_get_best_flat(self):
# print(self.flat_name_base)

master_flat, master_flat_name = get_best_flat(
flat_name=self.flat_name_base,
path=self.flat_path)
Expand All @@ -1405,6 +1403,14 @@ def test_get_best_flat_fail(self):
self.assertIsNone(master_flat)
self.assertIsNone(master_flat_name)

def test_get_best_flat_relative_path(self):
master_flat, master_flat_name = get_best_flat(
flat_name=os.path.join(self.flat_path,self.flat_name_base),
path=self.flat_path)
self.assertIsInstance(master_flat, CCDData)
self.assertEqual(os.path.basename(master_flat_name),
self.reference_flat_name)

def test_normalize_master_flat(self):
methods = ['mean', 'simple', 'full']
for method in methods:
Expand Down

0 comments on commit 5ea0d32

Please sign in to comment.