-
Notifications
You must be signed in to change notification settings - Fork 3
Fix/gui cache dir #442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix/gui cache dir #442
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -240,7 +240,8 @@ def __init__( | |||||||||||||||
| run (int): run number | ||||||||||||||||
| source (tuple[str, str]): data source | ||||||||||||||||
| image_data (np.ndarray): 2D array | ||||||||||||||||
| use_cache (bool): try loading data from cache if True (default) | ||||||||||||||||
| use_cache (bool): try loading data from cache if True (default). | ||||||||||||||||
| If set to False, data will neither be loaded from nor written to cache. | ||||||||||||||||
| """ | ||||||||||||||||
| self.image_data = image_data | ||||||||||||||||
| if image_data is None: | ||||||||||||||||
|
|
@@ -359,9 +360,11 @@ def _load_data(proposal: int, run: int, source: tuple[str, str], use_cache: bool | |||||||||||||||
| data = kd.xarray().squeeze() | ||||||||||||||||
| mean_data = data.mean(dim="trainId") | ||||||||||||||||
|
|
||||||||||||||||
| # cache data for faster loading | ||||||||||||||||
| cache_path.mkdir(mode=666, exist_ok=True, parents=True) | ||||||||||||||||
| np.save(cache_path / fname, mean_data) | ||||||||||||||||
| # cache data for faster loading unless use_cache=False | ||||||||||||||||
| if use_cache: | ||||||||||||||||
| cache_path.mkdir(mode=666, exist_ok=True, parents=True) | ||||||||||||||||
| np.save(cache_path / fname, mean_data) | ||||||||||||||||
|
Comment on lines
+365
to
+366
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While we're changing this, I might be inclined to catch and ignore
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean something like this? Inside the
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, that's what I was thinking. I'd leave the |
||||||||||||||||
|
|
||||||||||||||||
| return mean_data | ||||||||||||||||
|
|
||||||||||||||||
| # Widget Initialization Methods | ||||||||||||||||
|
|
||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.