Skip to content

Commit

Permalink
fix small bug
Browse files Browse the repository at this point in the history
  • Loading branch information
debora-pe committed Jun 26, 2024
1 parent 0d6fbcf commit c117df3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pypeit/calibrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ def make_slitless_pixflat(self):

# Save the result
flatfield.write_pixflat_to_fits(pixflat_norm_list, detname_list, self.spectrograph.name,
self.calib_dir.parent, fname, cache=True)
self.calib_dir.parent, fname, to_cache=True)

# file is saved in the working directory, but it is also cached in the data/static_calibs folder
# therefore we update self.pixel_flat_file with the new file located in the cache
Expand Down
8 changes: 5 additions & 3 deletions pypeit/flatfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
from pypeit.spectrographs.util import load_spectrograph
from pypeit import slittrace
from pypeit import dataPaths
from pypeit import cache


class FlatImages(calibframe.CalibFrame):
"""
Expand Down Expand Up @@ -2041,7 +2043,7 @@ def merge(init_cls, merge_cls):
return FlatImages(**dd)


def write_pixflat_to_fits(pixflat_norm_list, detname_list, spec_name, outdir, pixelflat_name, cache=True):
def write_pixflat_to_fits(pixflat_norm_list, detname_list, spec_name, outdir, pixelflat_name, to_cache=True):
"""
Write the pixel-to-pixel flat-field images to a FITS file.
The FITS file will have an extension for each detector (never a mosaic).
Expand All @@ -2058,7 +2060,7 @@ def write_pixflat_to_fits(pixflat_norm_list, detname_list, spec_name, outdir, pi
Path to the output directory.
pixelflat_name (:obj:`str`):
Name of the output file to be written.
cache (:obj:`bool`, optional):
to_cache (:obj:`bool`, optional):
If True, the file will be written to the cache directory pypeit/data/static_calibs.
"""
Expand Down Expand Up @@ -2127,7 +2129,7 @@ def write_pixflat_to_fits(pixflat_norm_list, detname_list, spec_name, outdir, pi
f"Please consider sharing your Pixel Flat file with the PypeIt Developers.{msgs.newline()}" \

cache_path = (dataPaths.static_calibs / spec_name).path
if cache:
if to_cache:
# Check if the directory exists
if not cache_path.is_dir():
cache_path.mkdir(parents=True)
Expand Down

0 comments on commit c117df3

Please sign in to comment.