-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add support for two new env vars for chandra_models
defaults + get_data info
#33
Conversation
chandra_models
defaultschandra_models
defaults
|
||
:returns: Path object | ||
Path to ``chandra_models`` repository | ||
""" | ||
for env_var in CHANDRA_MODELS_ROOT_ENV_VARS: | ||
if env_var in os.environ: | ||
return Path(os.environ[env_var]) |
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.
Feels a little odd to handle this via an "early" return
but it is a short function.
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.
From what I've read early returns are generally a good thing and encouraged to reduce code complexity. Here is an opinion from the internet that must therefore be true. http://www.itamarweiss.com/personal/2018/02/28/return-early-pattern.html
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.
It's worth saying that this is something new-ish to me and might not be reflected in earlier code / patterns.
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.
Changes make sense to me and unit and functional testing looks good.
I note that I think sot/ska_sun#31 needs to go at the same time. |
chandra_models
defaultschandra_models
defaults + get_data info
Description
This adds two new environment variables that impact the behavior:
CHANDRA_MODELS_REPO_DIR
as an alias forTHERMAL_MODELS_DIR_FOR_MATLAB_TOOLS_SW
:override the default root for the chandra_models repository. The name defined by FOT Matlab tools is impossible
to remember. 😄
CHANDRA_MODELS_DEFAULT_VERSION
: override the default repo version.Adding,
CHANDRA_MODELS_DEFAULT_VERSION
environment variable might be controversial but this greatly facilitates two important use cases:monkeypatch
)specifying a version would require a long chain of API updates.
This also adds a return dict of provenance information regarding the
get_data
call.Interface impacts
Changes return of
get_data
from just the data to a tuple (data, provenance information).Testing
Unit tests
Independent check of unit tests by Jean
Functional tests
@jeanconn extracted the FOT Matlab tools archive of
chandra_models
. This looks like below, where each directory is a shallow git repo with just the latest commit:Then I did the following in a dev ska with this repo installed: