Skip to content

fixed cache dir bug - #452

Open
Little-Ryugu wants to merge 2 commits into
mainfrom
cache_dir-default-bug
Open

fixed cache dir bug#452
Little-Ryugu wants to merge 2 commits into
mainfrom
cache_dir-default-bug

Conversation

@Little-Ryugu

Copy link
Copy Markdown
Collaborator

Fixes #451 .

Changed cache_dir to default to str(pooch.os_cache("layup")) instead of None in LayupObservatory. Stops layup_furnish_spiceypy from searching for files in the Sorcha created cache.

Review Checklist for Source Code Changes

  • Does pip install still work?
  • Have you written a unit test for any new functions?
  • Do all the units tests run successfully?
  • Does Layup run successfully on a test set of input files/databases?
  • Have you used black on the files you have updated to confirm python programming style guide enforcement?

Changed cache_dir to default to str(pooch.os_cache("layup")) instead of None in LayupObservatory. Stops layup_furnish_spiceypy from searching for files in the Sorcha created cache.
@Little-Ryugu

Copy link
Copy Markdown
Collaborator Author

Don't accept/merge just yet. @mschwamb said there was a different bug before that caused a problem similar to this in orbitfit. I'm going to double-check everything first incase I missed something.

@Little-Ryugu
Little-Ryugu requested a review from mschwamb July 27, 2026 14:34
@Little-Ryugu

Copy link
Copy Markdown
Collaborator Author

@mschwamb, the fix was in pr #225 but missed the case where cache_dir is left as None. The call for Layup_observatory in orbitfit and predict was changed from:

Layup_observatory = LayupObservatory()

To:

Layup_observatory = LayupObservatory(cache_dir=cache_dir) 

This fixed the original bug in the main code, but the unit tests still have the bug as they call Layup_observatory= LayupObservatory()

There was another fix to a similar issue #286, but the fix was related to the observatory position and didn't change the unit tests calling the Sorcha cache.

@mschwamb

Copy link
Copy Markdown
Collaborator

I think you might want to make "layup" a global variable at the top of the file so it's clear that this is hardcoded - easier to spot if it needs to be changed.

@mschwamb mschwamb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see other comment about changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Layup checking Sorcha cache for files when cache_dir is None in LayupObservatory.

2 participants