Skip to content
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

Refactor of LineList tables #409

Merged
merged 24 commits into from
Sep 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
207 changes: 103 additions & 104 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,126 +1,125 @@
language: python

# The apt packages below are needed for sphinx builds, which can no longer
# be installed with sudo apt-get.
addons:
apt:
packages:
- graphviz
- texlive-latex-extra
- dvipng

python:
- 2.7
- 3.5
- 3.6

# This is just for "egg_info". All other builds are explicitly given in the matrix
# We set the language to c because python isn't supported on the MacOS X nodes
# on Travis. However, the language ends up being irrelevant anyway, since we
# install Python ourselves using conda.
language: c

os:
- linux

# Setting sudo to false opts in to Travis-CI container-based builds.
sudo: false

env:
global:

# The following versions are the 'default' for tests, unless
# overidden underneath. They are defined here in order to save having
# overridden underneath. They are defined here in order to save having
# to repeat them for all configurations.
- NUMPY_VERSION=1.11
- FOLDERNAME='linetools'
- PYTHON_VERSION=3.6
- ASTROPY_VERSION=stable
- CONDA_INSTALL='conda install -c astropy-ci-extras --yes'
- PIP_INSTALL='pip install'
- NUMPY_VERSION=stable
- MAIN_CMD='python setup.py'
- SETUP_CMD='test'
- CONDA_DEPENDENCIES='scipy h5py pyyaml matplotlib'
- PIP_DEPENDENCIES=''
- EVENT_TYPE='pull_request push'
- TASK='test'

# Conda packages for affiliated packages are hosted in channel
# "astropy" while builds for astropy LTS with recent numpy versions
# are in astropy-ci-extras. If your package uses either of these,
# add the channels to CONDA_CHANNELS along with any other channels
# you want to use.
- CONDA_CHANNELS='astropy-ci-extras'

# If there are matplotlib or other GUI tests, uncomment the following
# line to use the X virtual framebuffer.
- SETUP_XVFB=True

matrix:
- SETUP_CMD='egg_info'
# Extra context is a way to override options that the user normally
# specifies during the questions phase of the cookiecutter setup. The keys
# being overridden here must exist in the cookiecutter.json
# See https://cookiecutter.readthedocs.io/en/0.9.1/advanced_usage.html#injecting-extra-context
#- EXTRA_CONTEXT=''
#- EXTRA_CONTEXT='include_example_cython_code=y'
#- EXTRA_CONTEXT="package_name=AstropyProject" FOLDERNAME='AstropyProject'
#- EXTRA_CONTEXT='_parent_project=sunpy'
#- TASK='render' EXTRA_CONTEXT='include_example_cython_code=y initialize_git_repo=n'
- PYTHON_VERSION=2.7 SETUP_CMD='egg_info'
- PYTHON_VERSION=3.6 SETUP_CMD='egg_info'

matrix:

# Don't wait for allowed failures
fast_finish: true

include:
# Try MacOS X
#- os: osx
# env: SETUP_CMD='test'

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

# Check for sphinx doc build warnings - we do this first because it
# may run for a long time. Add -w flag to fail on any warning.
#- python: 3.4
# env: SETUP_CMD='build_sphinx -w'

# Try Astropy development version
#- python: 2.7
# env: ASTROPY_VERSION=development SETUP_CMD='test'
#- python: 3.5
# env: ASTROPY_VERSION=development SETUP_CMD='test'

# Try all python versions with the latest numpy
- python: 2.7
env: SETUP_CMD='test'
- python: 3.5
env: SETUP_CMD='test'
- python: 3.6
env: SETUP_CMD='test'

# Try older numpy versions.
# - python: 2.7
# env: NUMPY_VERSION=1.9 SETUP_CMD='test'

before_install:

# Use utf8 encoding. Should be default, but this is insurance against
# future changes
- export PYTHONIOENCODING=UTF8
- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
- chmod +x miniconda.sh
- ./miniconda.sh -b -p $HOME/miniconda
- export PATH=$HOME/miniconda/bin:$PATH
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update --yes conda

# UPDATE APT-GET LISTINGS
#- sudo apt-get update

# DOCUMENTATION DEPENDENCIES
# - if [[ $SETUP_CMD == build_sphinx* ]]; then sudo apt-get install graphviz texlive-latex-extra dvipng; fi
# may run for a long time
#- os: linux
# env: SETUP_CMD='build_docs -w'

# Now try Astropy dev and LTS vesions with the latest 3.x and 2.7.
- os: linux
env: PYTHON_VERSION=2.7 ASTROPY_VERSION=development
EVENT_TYPE='pull_request push cron'
- os: linux
env: ASTROPY_VERSION=development
EVENT_TYPE='pull_request push cron'
#- os: linux
# env: PYTHON_VERSION=2.7 ASTROPY_VERSION=lts
#- os: linux
# env: ASTROPY_VERSION=lts

# Try all python versions and Numpy versions. Since we can assume that
# the Numpy developers have taken care of testing Numpy with different
# versions of Python, we can vary Python and Numpy versions at the same
# time.

- os: linux
env: PYTHON_VERSION=2.7 NUMPY_VERSION=1.11
#- os: linux
# env: PYTHON_VERSION=3.3 NUMPY_VERSION=1.8
#- os: linux
# env: PYTHON_VERSION=3.4 NUMPY_VERSION=1.9
#- os: linux
# env: PYTHON_VERSION=3.5 NUMPY_VERSION=1.10
- os: linux
env: NUMPY_VERSION=1.11

# Try numpy pre-release
- os: linux
env: NUMPY_VERSION=prerelease
EVENT_TYPE='pull_request push cron'

# Do a PEP8 test with pycodestyle
- os: linux
env: MAIN_CMD='pycodestyle packagename --count' SETUP_CMD=''

allow_failures:
# Do a PEP8 test with pycodestyle
# (allow to fail unless your code completely compliant)
- os: linux
env: MAIN_CMD='pycodestyle packagename --count' SETUP_CMD=''

install:

# CONDA
- conda create --yes -n test -c astropy-ci-extras python=$TRAVIS_PYTHON_VERSION pyqt=5 qtpy
- source activate test

# CORE DEPENDENCIES
- if [[ $SETUP_CMD != egg_info ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION pytest pip Cython jinja2; fi
- if [[ $SETUP_CMD != egg_info ]]; then $PIP_INSTALL pytest-xdist; fi

# ASTROPY
- if [[ $SETUP_CMD != egg_info ]] && [[ $ASTROPY_VERSION == development ]]; then $PIP_INSTALL git+http://github.com/astropy/astropy.git#egg=astropy; fi
- if [[ $SETUP_CMD != egg_info ]] && [[ $ASTROPY_VERSION == stable ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION astropy; fi

# OPTIONAL DEPENDENCIES
# Here you can add any dependencies your package may have. You can use
# conda for packages available through conda, or pip for any other
# packages. You should leave the `numpy=$NUMPY_VERSION` in the `conda`
# install since this ensures Numpy does not get automatically upgraded.
- if [[ $SETUP_CMD != egg_info ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION scipy; fi
- if [[ $SETUP_CMD != egg_info ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION h5py; fi
- if [[ $SETUP_CMD != egg_info ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION pyyaml; fi
- if [[ $SETUP_CMD != egg_info ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION matplotlib; fi

# DOCUMENTATION DEPENDENCIES
# build_sphinx needs sphinx and matplotlib (for plot_directive). Note that
# this matplotlib will *not* work with py 3.x, but our sphinx build is
# currently 2.7, so that's fine
- if [[ $SETUP_CMD == build_sphinx* ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION Sphinx=1.3; fi

# COVERAGE DEPENDENCIES
#- if [[ $SETUP_CMD == 'test --coverage' ]]; then $PIP_INSTALL coverage coveralls; fi
- if [[ $SETUP_CMD == 'test --coverage' ]]; then $PIP_INSTALL coverage==3.7.1 coveralls; fi

before_script: # Required for plotting tests
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3 # give xvfb some time to start
- git clone git://github.com/astropy/ci-helpers.git
- source ci-helpers/travis/setup_conda_$TRAVIS_OS_NAME.sh

script:
- python setup.py $SETUP_CMD
- $MAIN_CMD $SETUP_CMD


after_success:
# If coveralls.io is set up for this package, uncomment the line
# below and replace "packagename" with the name of your package.
# The coveragerc file may be customized as needed for your package.
- if [[ $SETUP_CMD == 'test --coverage' ]]; then coveralls --rcfile='linetools/tests/coveragerc'; fi
2 changes: 1 addition & 1 deletion docs/linelist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Which give us the information of all the 6 transitions of `MgII`::
262500000.0 0 0 0 1 MgII 2796 35760.848 ... 0.0 12 4 2 262500000.0 -- --
259500000.0 0 0 0 1 MgII 2803 35669.298 ... 0.0 12 2 2 259500000.0 -- --

In this case ``mgii`` is a QTable because more than 1
In this case ``mgii`` is a Table because more than 1
transition was found. In cases were only 1 transition
exists, the output of `all_transitions()` is a dictionary
with the same keywords as the columns of ``ism._data`` QTable::
Expand Down
18 changes: 1 addition & 17 deletions linetools/abund/ions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,6 @@
from linetools.abund import roman

########################## ##########################
########################## ##########################
def ion_name(ion, flg=0, nspace=None):
""" Wrapper to ion_to_name for backwards compatability
WILL BE DEPRECATED
Parameters
----------
ion
flg
nspace

Returns
-------

"""
warnings.warn("This method will be DEPRECATED. Use ion_to_name")
return ion_to_name(ion, flg=flg, nspace=nspace)

def ion_to_name(ion, flg=0, nspace=None):
""" Convert ion tuple into a string
Expand Down Expand Up @@ -66,7 +50,7 @@ def ion_to_name(ion, flg=0, nspace=None):
elm = ELEMENTS[ion[0]]
str_elm = elm.symbol
else:
return ion_name( (ion['Z'], ion['ion']) )
return ion_to_name((ion['Z'], ion['ion']))

# Ion state
if flg == 0: # Roman
Expand Down
2 changes: 1 addition & 1 deletion linetools/analysis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def gaussian_ew(spec, ltype, initial_guesses=None):
# Use only good values (i.e. with meaningful errors)
cond = (sig > 0.) & (np.isfinite(sig))
# Actual fit
g = fit_g(g_init, wv[cond], fx[cond], weights=1./sig[cond])
g = fit_g(g_init, wv[cond].value, fx[cond].value, weights=1./sig[cond].value)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 65: I think this function is actually tested through test_gaussew_absline

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't passing astropy 2.0.1 without this change.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my comment should have been inserted much higher and has nothing to do with your committed change. I was referring to your comment just below the docstring: "Note: Tested in test_absline_anly"


#Check whether the final fit is sensible
fit_info = fit_g.fit_info
Expand Down
12 changes: 6 additions & 6 deletions linetools/data/lines/EUV_lines.ascii
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
; Lines by hand from Tripp list
; Will update with atomic data before too long
; Ref column added by hand by N. Tejos (Dec 28, 2015)
| wrest | name | f | Z | ion | Ref |
| 551.3621 | ArVI 551 | 0.00 | 18 | 6 | Tripp |
| 562.711 | NeVI* 562a | 0.00 | 10 | 6 | Tripp |
| 562.803 | NeVI* 562b | 0.00 | 10 | 6 | Tripp |
| 569.758 | NeV* 659a | 0.00 | 10 | 5 | Tripp |
| 569.830 | NeV* 659b | 0.00 | 10 | 5 | Tripp |
wrest | name | f | Z | ion | Ref
551.3621 | ArVI 551 | 0.00 | 18 | 6 | Tripp
562.711 | NeVI* 562a | 0.00 | 10 | 6 | Tripp
562.803 | NeVI* 562b | 0.00 | 10 | 6 | Tripp
569.758 | NeV* 659a | 0.00 | 10 | 5 | Tripp
569.830 | NeV* 659b | 0.00 | 10 | 5 | Tripp