Skip to content

Commit

Permalink
cdbs path update if doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
JarronL committed Feb 7, 2024
1 parent 884e9cd commit d7a1bde
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,20 @@ jobs:
pip install pytest pytest-cov>=4.0
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Get WebbPSF Data
- name: WebbPSF Data
run: | # Get WebbPSF data files (just a subset of the full dataset!) and set up environment variable
wget https://stsci.box.com/shared/static/0ojjfg3cieqdpd18vl1bjnpe63r82dx8.gz -O /tmp/minimal-webbpsf-data.tar.gz
tar -xzvf /tmp/minimal-webbpsf-data.tar.gz
echo "WEBBPSF_PATH=${{github.workspace}}/webbpsf-data" >> $GITHUB_ENV
- name: WebbPSF Extensions Data
run: | # Set up webbpsf_ext data environment variable
echo "WEBBPSF_EXT_PATH=${{github.workspace}}/webbpsf_ext_data" >> $GITHUB_ENV
- name: CDBS Data Path
run: | # Set up pycdbs environment variable
echo "PYSYN_CDBS=${{github.workspace}}/cdbs" >> $GITHUB_ENV
- name: Check conda info
run: conda info

Expand Down
8 changes: 7 additions & 1 deletion webbpsf_ext/synphot_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ def download_cdbs_data(cdbs_path=None, verbose=False):
if cdbs_path is None:
cdbs_path = os.environ.get('PYSYN_CDBS', None)
if cdbs_path is None:
raise ValueError("Environment variable PYSYN_CDBS is not set.")
# Set default path
cdbs_path = os.path.join(os.environ.get('WEBBPSF_EXT_PATH'), 'cdbs')
os.environ['PYSYN_CDBS'] = cdbs_path
cdbs_path = os.environ.get('PYSYN_CDBS', None)
if not os.path.exists(cdbs_path):
os.makedirs(cdbs_path, exist_ok=True)
# raise ValueError("Environment variable PYSYN_CDBS is not set.")

# Download synphot data files
res = download_data(cdbs_path, verbose=False)
Expand Down

0 comments on commit d7a1bde

Please sign in to comment.