Skip to content

Commit

Permalink
Compress test fits spectra and create script to unzip them.
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-neal committed Sep 7, 2018
1 parent 2d454a5 commit 137cc89
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions .shippable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ build:
- export MPLBACKEND="AGG" # Non-interactive
- mv tests/config.yaml config.yaml
# Generate data
- unzip_testdata.py
- make_test_data.py
# Prepare atmosphere models
- make atmos
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ before_script:
- mv tests/config.yaml config.yaml

# Generate data
- unzip_testdata.py
- make_test_data.py

# Prepare atmosphere models
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ install:
- cmd: "move tests\\config.yaml config.yaml"

# Generate data
- cmd: "%PYTHON%\\python.exe eniric_scripts\\unzip_testdata.py"
- cmd: "%PYTHON%\\python.exe eniric\\obsolete\\make_test_data.py"

# Prepare atmosphere models
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
31 changes: 31 additions & 0 deletions eniric_scripts/unzip_testdata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""This extracts the test data compressed fits.tar.gz files.
May not be needed if Starfish is able to handle .tar.gz files.
"""
import eniric
import tarfile
from os.path import exists, join


def unzip(dir: str, filename: str, overwrite: bool = False):
joint_name = join(dir, filename)

if (not exists(joint_name)) or (overwrite is True):
with tarfile.open(join(joint_name + ".tar.gz"), "r") as tar:
tar.extractall(dir)
else:
print("Did not overwrite file: {0}".format(joint_name))

if __name__ == "__main__":
path = eniric.paths["phoenix_raw"]

unzip(path, "WAVE_PHOENIX-ACES-AGSS-COND-2011.fits")

aces_spec = [
"lte02600-4.50-0.0.PHOENIX-ACES-AGSS-COND-2011-HiRes.fits",
"lte02800-4.50-0.0.PHOENIX-ACES-AGSS-COND-2011-HiRes.fits",
"lte03500-4.50-0.0.PHOENIX-ACES-AGSS-COND-2011-HiRes.fits",
"lte03900-4.50-0.0.PHOENIX-ACES-AGSS-COND-2011-HiRes.fits",
]
for aces in aces_spec:
unzip(join(path, "Z-0.0"), aces)
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"packages": ["eniric", "eniric_scripts", "eniric.obsolete"],
"scripts": [
"eniric_scripts/phoenix_precision.py",
"eniric_scripts/unzip_testdata.py",
"eniric_scripts/split_atmmodel.py",
"eniric_scripts/bary_shift_atmmodel.py",
"eniric/obsolete/make_test_data.py",
Expand Down

0 comments on commit 137cc89

Please sign in to comment.