-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from pllim/fix-tests
MNT: Modernize packaging, etc
- Loading branch information
Showing
14 changed files
with
123 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
include LICENSE | ||
include README.rst | ||
include CHANGES.rst | ||
|
||
include setup.cfg | ||
include pyproject.toml | ||
|
||
global-exclude *.pyc *.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
Experimental astronomy plugins for glue | ||
--------------------------------------- | ||
Astronomy plugins for glue | ||
-------------------------- | ||
|
||
.. image:: https://readthedocs.org/projects/glue-astronomy/badge/?version=latest | ||
:target: https://glue-astronomy.readthedocs.io/en/latest/?badge=latest | ||
:alt: Documentation Status | ||
|
||
.. image:: https://dev.azure.com/glue-viz/glue-astronomy/_apis/build/status/glue-viz.glue-astronomy?branchName=main | ||
:target: https://dev.azure.com/glue-viz/glue-astronomy/_build/latest?definitionId=9&branchName=main | ||
:alt: CI Status | ||
|
||
.. image:: https://codecov.io/gh/glue-viz/glue-astronomy/branch/main/graph/badge.svg | ||
:target: https://codecov.io/gh/glue-viz/glue-astronomy | ||
:alt: Coverage Status | ||
|
||
.. image:: https://img.shields.io/pypi/v/glue-astronomy.svg | ||
:target: https://pypi.org/project/glue-astronomy | ||
:alt: PyPI Status | ||
|
||
The glue-astronomy plugin for glue provides a collection of astronomy-specific | ||
functionality. It is currently under heavy development and is not ready for | ||
general use at this point. The documentation for this plugin can be found at | ||
functionality. It is currently under heavy development. | ||
The documentation for this plugin can be found at | ||
https://glue-astronomy.readthedocs.io. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 19 additions & 24 deletions
43
glue_astronomy/io/spectral_cube/tests/test_spectral_cube.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,52 @@ | ||
import os | ||
import numpy as np | ||
import pytest | ||
from astropy.utils.data import get_pkg_data_filename | ||
from glue.qglue import parse_data | ||
from spectral_cube import SpectralCube | ||
|
||
DATA = os.path.join(os.path.dirname(__file__), 'data') | ||
from glue_astronomy.io.spectral_cube.spectral_cube import is_spectral_cube, read_spectral_cube | ||
|
||
|
||
def test_identifier_fits(): | ||
from ..spectral_cube import is_spectral_cube | ||
assert is_spectral_cube(os.path.join(DATA, 'cube_3d.fits')) | ||
assert is_spectral_cube(get_pkg_data_filename('data/cube_3d.fits')) | ||
|
||
|
||
def test_identifier_casa(): | ||
pytest.importorskip('casatools') | ||
from ..spectral_cube import is_spectral_cube | ||
assert is_spectral_cube(os.path.join(DATA, 'cube_3d.image')) | ||
assert is_spectral_cube(get_pkg_data_filename('data/cube_3d.image')) | ||
|
||
|
||
def test_reader_fits(): | ||
from ..spectral_cube import read_spectral_cube | ||
data = read_spectral_cube(os.path.join(DATA, 'cube_3d.fits')) | ||
data['STOKES I'] | ||
data = read_spectral_cube(get_pkg_data_filename('data/cube_3d.fits')) | ||
assert isinstance(data['STOKES I'], np.ndarray) | ||
assert data.shape == (2, 3, 4) | ||
|
||
|
||
def test_reader_fits_4d(): | ||
from ..spectral_cube import read_spectral_cube | ||
data = read_spectral_cube(os.path.join(DATA, 'cube_4d.fits')) | ||
data['STOKES I'] | ||
data = read_spectral_cube(get_pkg_data_filename('data/cube_4d.fits')) | ||
assert isinstance(data['STOKES I'], np.ndarray) | ||
assert data.shape == (2, 3, 4) | ||
|
||
|
||
def test_reader_fits_4d_fullstokes(): | ||
from ..spectral_cube import read_spectral_cube | ||
data = read_spectral_cube(os.path.join(DATA, 'cube_4d_fullstokes.fits')) | ||
data['STOKES I'] | ||
data['STOKES Q'] | ||
data['STOKES U'] | ||
data['STOKES V'] | ||
data = read_spectral_cube(get_pkg_data_filename('data/cube_4d_fullstokes.fits')) | ||
assert isinstance(data['STOKES I'], np.ndarray) | ||
assert isinstance(data['STOKES Q'], np.ndarray) | ||
assert isinstance(data['STOKES U'], np.ndarray) | ||
assert isinstance(data['STOKES V'], np.ndarray) | ||
assert data.shape == (2, 3, 4) | ||
|
||
|
||
def test_reader_casa(): | ||
pytest.importorskip('casatools') | ||
from ..spectral_cube import read_spectral_cube | ||
data = read_spectral_cube(os.path.join(DATA, 'cube_3d.image')) | ||
data['STOKES I'] | ||
data = read_spectral_cube(get_pkg_data_filename('data/cube_3d.image')) | ||
assert isinstance(data['STOKES I'], np.ndarray) | ||
assert data.shape == (2, 3, 4) | ||
|
||
|
||
def test_qglue(): | ||
from spectral_cube import SpectralCube | ||
cube = SpectralCube.read(os.path.join(DATA, 'cube_3d.fits')) | ||
cube = SpectralCube.read(get_pkg_data_filename('data/cube_3d.fits')) | ||
data = parse_data(cube, 'x')[0] | ||
assert data.label == 'x' | ||
data['flux'] | ||
assert isinstance(data['flux'], np.ndarray) | ||
assert data.shape == (2, 3, 4) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[build-system] | ||
requires = ["setuptools>=30.3.0", | ||
"setuptools_scm", | ||
"wheel"] | ||
build-backend = 'setuptools.build_meta' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,6 @@ | ||
#!/usr/bin/env python | ||
|
||
from __future__ import print_function | ||
import os | ||
from setuptools import setup | ||
|
||
import sys | ||
from distutils.version import LooseVersion | ||
|
||
try: | ||
from setuptools import setup, __version__ | ||
assert LooseVersion(__version__) >= LooseVersion('30.3') | ||
except (ImportError, AssertionError): | ||
sys.stderr.write("ERROR: setuptools 30.3 or later is required by glue-plotly\n") | ||
sys.exit(1) | ||
|
||
setup(use_scm_version=True, setup_requires=['setuptools_scm']) | ||
setup(use_scm_version={'write_to': os.path.join('glue_astronomy', 'version.py')}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters