Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Commit

Permalink
Merge pull request #241 from spacetelescope/loaders
Browse files Browse the repository at this point in the history
Enable units for cos and stis loaders
  • Loading branch information
stscieisenhamer authored Jan 5, 2017
2 parents ffe1ea5 + 3ef8400 commit 562ebb9
Show file tree
Hide file tree
Showing 17 changed files with 86 additions and 629 deletions.
53 changes: 21 additions & 32 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
language: python
language: c

python:
- 2.6
- 2.7
- 3.3
- 3.4
- 3.5
os:
- linux
- osx

# Setting sudo to false opts in to Travis-CI container-based builds.
sudo: false
Expand All @@ -27,45 +24,37 @@ env:
# The following versions are the 'default' for tests, unless
# overidden underneath. They are defined here in order to save having
# to repeat them for all configurations.
- NUMPY_VERSION=1.9
- ASTROPY_VERSION=stable
- SETUP_CMD='test'
- PIP_DEPENDENCIES=''
- PIP_DEPENDENCIES='sphinx_automodapi sphinx_rtd_theme'
# For this package-template, we include examples of Cython modules,
# so Cython is required for testing. If your package does not include
# Cython code, you can set CONDA_DEPENDENCIES=''
- CONDA_DEPENDENCIES='Cython'
- CONDA_CHANNELS='http://ssb.stsci.edu/astroconda astropy-ci-extras'
- CONDA_DEPENDENCIES='numpy scipy cython specutils qtpy pyqtgraph pyyaml six'

matrix:
# Make sure that egg_info works without dependencies
- SETUP_CMD='egg_info'
# Try all python versions with the latest numpy
- SETUP_CMD='test'
- PYTHON_VERSION=2.7 SETUP_CMD='install'
- PYTHON_VERSION=2.7 SETUP_CMD='test'
- PYTHON_VERSION=2.7 SETUP_CMD='egg_info'
- PYTHON_VERSION=3.5 SETUP_CMD='install'
- PYTHON_VERSION=3.5 SETUP_CMD='test'
- PYTHON_VERSION=3.5 SETUP_CMD='egg_info'


matrix:
include:

# Do a coverage test in Python 2.
- python: 2.7
env: SETUP_CMD='test --coverage'
- env: PYTHON_VERSION=2.7 SETUP_CMD='test --coverage'

# Check for sphinx doc build warnings - we do this first because it
# may run for a long time
- python: 2.7
env: SETUP_CMD='build_sphinx -w'
- env: PYTHON_VERSION=2.7 SETUP_CMD='build_sphinx -w'

# Try Astropy development version
- python: 2.7
env: ASTROPY_VERSION=development
- python: 3.4
env: ASTROPY_VERSION=development

# Try older numpy versions
- python: 2.7
env: NUMPY_VERSION=1.8
- python: 2.7
env: NUMPY_VERSION=1.7
- python: 2.7
env: NUMPY_VERSION=1.6
- env: PYTHON_VERSION=2.7 ASTROPY_VERSION=development

- env: PYTHON_VERSION=3.5 ASTROPY_VERSION=development

before_install:

Expand Down Expand Up @@ -93,7 +82,7 @@ install:
# As described above, using ci-helpers, you should be able to set up an
# environment with dependencies installed using conda and pip, but in some
# cases this may not provide enough flexibility in how to install a
# specific dependency (and it will not be able to install non-Python
# specific dependency (and it will not be able to install non-Python
# dependencies). Therefore, you can also include commands below (as
# well as at the start of the install section or in the before_install
# section if they are needed before setting up conda) to install any
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# SpecViz
[![astropy](http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat)](http://www.astropy.org/) [![Build Status](https://travis-ci.org/spacetelescope/specviz.svg?branch=loaders)](https://travis-ci.org/spacetelescope/specviz) [![Documentation Status](http://readthedocs.org/projects/specviz/badge/?version=latest)](http://specviz.readthedocs.io/en/latest/?badge=latest)

An gui-based interactive analysis tool for one dimensional astronomical data
using Python.

Expand Down
14 changes: 14 additions & 0 deletions docs/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: specviz
channels:
- http://ssb.stsci.edu/astroconda
dependencies:
- pyyaml
- cython
- numpy
- scipy
- astropy
- specutils
- pyqtgraph
- pip:
- sphinx_automodapi
- sphinx_rtd_theme
2 changes: 1 addition & 1 deletion docs/make.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if "%1" == "help" (
:help
echo.Please use `make ^<target^>` where ^<target^> is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. dirhtml to make HTML files named ndex.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
Expand Down
4 changes: 3 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.autosummary',
'sphinx.ext.pngmath',
'sphinx.ext.imgmath',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinx_automodapi.automodapi'
]

suppress_warnings = ['image.nonlocal_uri']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand Down
4 changes: 2 additions & 2 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Installation
============

SpecViz is distributed through the `Anaconda <https://anaconda.org>`_ package
SpecViz is distributed through the `Anaconda <https://anaconda.org>`__ package
manager. Specifically, it lives within Space Telescope Science Institute's
`AstroConda <https://astroconda.readthedocs.io/>`_ channel.

Expand Down Expand Up @@ -70,7 +70,7 @@ Please keep in mind that PyQt5 is the recommended PyQt implementation as
`Qt4 development and support has ended <http://blog.qt.io/blog/2015/05/26/qt-4-8-7-released/>`_.

Below are instructions for installing using *either* `Homebrew <http://brew
.sh/>`_ *or* `Anaconda <https://www.continuum.io/downloads>`_.
.sh/>`_ *or* `Anaconda <https://www.continuum.io/downloads>`__.

PyQt5
"""""
Expand Down
5 changes: 5 additions & 0 deletions readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
python:
setup_py_install: true

conda:
file: docs/environment.yml
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
--index-url https://pypi.python.org/simple/
-index-url https://pypi.python.org/simple/

pyyaml
cython
numpy
scipy
astropy
sphinx_automodapi
sphinx_automodapi
sphinx_rtd_theme
git+https://github.com/nmearl/specutils.git
git+https://github.com/nmearl/pyqtgraph.git
-e .
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
[build_sphinx]
source-dir = docs
source-dir = docs/source
build-dir = docs/_build
all_files = 1

[upload_docs]
upload-dir = docs/_build/html
show-response = 1

[pytest]
[tool:pytest]
minversion = 2.2
norecursedirs = build docs/_build
doctest_plus = enabled
doctest_plus = disabled

[ah_bootstrap]
auto_use = True

[metadata]
package_name = specviz
description = An interactive astronomical analysis tool.
description = An interactive astronomical analysis tool.
long_description = SpecViz is a tool for 1-D spectral visualization and analysis of astronomical spectrograms.
author = Nicholas Earl, Ivo Busko, Pey Lian Lim
author_email = [email protected]
Expand Down
Empty file.
15 changes: 15 additions & 0 deletions specviz/analysis/tests/test_statistics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import numpy as np

from ..statistics import stats

def test_simple_stats():
a = np.ones(10)
truth = {'mean': 1,
'median': 1,
'stddev': 0,
'total': 9,
'npoints': 10}

calc = stats(a)

assert calc == truth, "Crazy wrong stats"
4 changes: 2 additions & 2 deletions specviz/core/comms.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@


class EventNode(object):
"""
An event
"""An event
An event is defined by the arguments the listeners
of the event expect to be given.
Parameters
----------
args: [arg, ...]
The list of keyword arguments that the event
will provide to its listeners
Expand Down
9 changes: 7 additions & 2 deletions specviz/io/loaders/hstcos_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ def cos_spectrum_loader(file_name, **kwargs):

uncertainty = StdDevUncertainty(hdu[1].data["ERROR"].flatten())
data = hdu[1].data['FLUX'].flatten()
dispersion = hdu[1].data['wavelength'].flatten()
unit = Unit("erg/cm**2 Angstrom s")

return Spectrum1DRef(data=data, name=name,
uncertainty=uncertainty, unit=unit, meta=meta)
return Spectrum1DRef.from_array(data=data,
dispersion=dispersion,
dispersion_unit=Unit('Angstrom'),
uncertainty=uncertainty,
unit=unit,
meta=meta)
9 changes: 7 additions & 2 deletions specviz/io/loaders/hststis_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ def stis_spectrum_loader(file_name, **kwargs):

uncertainty = StdDevUncertainty(hdu[1].data["ERROR"].flatten())
data = hdu[1].data['FLUX'].flatten()
dispersion = hdu[1].data['wavelength'].flatten()
unit = Unit("erg/cm**2 Angstrom s")

return Spectrum1DRef(data=data, name=name,
uncertainty=uncertainty, unit=unit, meta=meta)
return Spectrum1DRef.from_array(data=data,
dispersion=dispersion,
dispersion_unit=Unit('Angstrom'),
uncertainty=uncertainty,
unit=unit,
meta=meta)
1 change: 0 additions & 1 deletion specviz/io/model_io/__init__.py

This file was deleted.

Loading

0 comments on commit 562ebb9

Please sign in to comment.