Skip to content

Commit

Permalink
Merge pull request #14 from LCOGT/fix/removing-ffsspec-caching
Browse files Browse the repository at this point in the history
removed ffspec module from get_hdu util along with caching
  • Loading branch information
LTDakin authored May 10, 2024
2 parents bdebb11 + 0866120 commit a874463
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 468 deletions.
6 changes: 1 addition & 5 deletions datalab/datalab_session/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,14 @@ def get_hdu(basename: str, extension: str = 'SCI') -> list[fits.HDUList]:
# use the basename to fetch and create a list of hdu objects
basename = basename.replace('-large', '').replace('-small', '')

if cache.get(f'{basename}-{extension}') is not None:
return cache.get(f'{basename}-{extension}')

archive_record = get_archive_from_basename(basename)

try:
fits_url = archive_record[0].get('url', 'No URL found')
except IndexError:
RuntimeWarning(f"No image found with specified basename: {basename}")

hdu = fits.open(fits_url, use_fsspec=True)
cache.set(f'{basename}-{extension}', hdu[extension])
hdu = fits.open(fits_url)
return hdu[extension]

def create_fits(key: str, image_arr: np.ndarray) -> fits.HDUList:
Expand Down
Loading

0 comments on commit a874463

Please sign in to comment.