From 926c8ced97797945f5c3c502d88dc09f7e5d922f Mon Sep 17 00:00:00 2001
From: Robert Stein <rdstein@caltech.edu>
Date: Wed, 7 Dec 2022 00:10:46 -0800
Subject: [PATCH] Maintain option for both cache/non-cache

---
 winterdrp/data/image_data.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/winterdrp/data/image_data.py b/winterdrp/data/image_data.py
index 69ebb0d07..db82a8765 100644
--- a/winterdrp/data/image_data.py
+++ b/winterdrp/data/image_data.py
@@ -57,6 +57,7 @@
 """
 import hashlib
 import logging
+from pathlib import Path
 
 import numpy as np
 from astropy.io.fits import Header
@@ -89,12 +90,16 @@ def __init__(self, data: np.ndarray, header: Header):
             self.cache_files.append(self.cache_path)
         self.set_data(data=data)
 
-    def get_cache_path(self):
+    def get_cache_path(self) -> Path:
+        """
+        Get a unique cache path for the image (.npy file).
+        This is hash, using name and time, so should be unique even
+        when rerunning on the same image.
+
+        :return: unique cache file path
+        """
         base = "".join([str(Time.now()), self.get_name()])
         name = f"{hashlib.sha1(base.encode()).hexdigest()}.npy"
-        # cache_dir = get_cache_dir()
-        # if not cache_dir.exists():
-        #     cache_dir.mkdir(parents=True)
         return CACHE_DIR.joinpath(name)
 
     def __str__(self):