Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:jason-neal/spectrum_overloaded i…
Browse files Browse the repository at this point in the history
…nto develop
  • Loading branch information
jason-neal committed May 3, 2018
2 parents 8ad3a0c + 990a24f commit d169cb0
Show file tree
Hide file tree
Showing 12 changed files with 224 additions and 271 deletions.
8 changes: 1 addition & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
language: python
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"

before_install:
# http://conda.pydata.org/docs/travis.html
- travis_retry sudo apt-get update
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
travis_retry wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
else
travis_retry wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- travis_retry wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
Expand Down
25 changes: 20 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
# Spectrum Overload
## Changelog

Upcoming release:

Simplified overload operator function.

Handle all warnings as errors in testing.

Fix test parameters to avoid invalid values.

Drop support for python 2.7 due xaxis and flux keywords required with "*,".
Drop testing of python 3.4 also while at it.


0.2.1 14/01/2018
Patch try resolve pypi styling


0.2.0 14/01/2018

### October 2017
For next version
- Add hypothesis profiles for different test environments.
- Change header initialization from None to and empty dict
- Add normalization e.g.
- Spectrum.normalize("poly", degree=3)
- Add spectrum plot method.
- Standardize operations using a operator wrapper.
- Update documetation.
- Updated documetation.


Version 0..
Version <0.2.0
Before october 2017
Many changes that were unrecorded in this change log...
Spectrum object with interpolation and overloaded operators.


Started September 2016
Project started: September 2016
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ I would really appreciate user feedback or suggested improvements if you have an
Feel free to submit issues or create pull requests.


## Python 2.7
Python 2.7 is only supported in versions <0.2.1 (also available on pip) to make use of useful python3 features.


## Other Spectrum Classes

Expand Down
14 changes: 7 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
numpy==1.13.3
matplotlib==2.1.0
astropy==2.0.2
scipy==0.19.1
pyastronomy==0.11.0
hypothesis==3.31.2
pytest==3.2.2
numpy==1.14.3
matplotlib==2.2.2
astropy==3.0.2
scipy==1.0.1
pyastronomy==0.12.0
hypothesis==3.56.5
pytest==3.5.1
pytest-cov==2.5.1
python-coveralls==2.9.1
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@
'Topic :: Scientific/Engineering :: Astronomy',
'Topic :: Scientific/Engineering :: Physics',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Natural Language :: English',
Expand Down
4 changes: 1 addition & 3 deletions spectrum_overload/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,18 @@
"__author__", "__email__", "__license__", "__copyright__",
]


try:
base_dir = os.path.dirname(os.path.abspath(__file__))
except NameError:
base_dir = None


__title__ = "spectrum_overload"
__summary__ = "A spectrum class that overloads operators"
# __uri__ = "https://pypi.org/"
__uri__ = None

# The version as used in the setup.py and the docs conf.py
#The essence of semantic versioning is a 3-part MAJOR.MINOR.MAINTENANCE numbering scheme, where the project author increments:
# The essence of semantic versioning is a 3-part MAJOR.MINOR.MAINTENANCE numbering scheme, where the project author increments:

# MAJOR version when they make incompatible API changes,
# MINOR version when they add functionality in a backwards-compatible manner, and
Expand Down
9 changes: 3 additions & 6 deletions spectrum_overload/differential.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# -*- coding: utf-8 -*-

"""Differential Class which takes the difference between two spectra."""
from spectrum_overload import Spectrum

# Begin Feburary 2017
# Jason Neal

# TODO: Add in s-profile from
# Ferluga 1997: Separating the spectra of binary stars-I. A simple method: Secondary reconstruction
Expand All @@ -14,7 +11,7 @@ class DifferentialSpectrum(object):

def __init__(self, Spectrum1, Spectrum2):
"""Initalise lass with both spectra."""
if not(Spectrum1.calibrated and Spectrum2.calibrated):
if not (Spectrum1.calibrated and Spectrum2.calibrated):
raise ValueError("Input spectra are not calibrated.")

self.spec1 = Spectrum1
Expand All @@ -23,11 +20,11 @@ def __init__(self, Spectrum1, Spectrum2):
self.diff = None

def barycentric_correct(self):
"""Barycentic correct each spectra."""
"""Barycentric correct each spectra."""
pass

def rest_frame(self, frame):
"""Change restframe to one of the spectra."""
"""Change rest frame to one of the spectra."""
pass

def diff(self):
Expand Down
8 changes: 5 additions & 3 deletions spectrum_overload/norm.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-

import numpy as np
import logging

import numpy as np


def get_continuum_points(wave, flux, nbins=50, ntop=20):
"""Get continuum points along a spectrum.
Expand Down Expand Up @@ -57,7 +59,7 @@ def continuum(wave, flux, method='scalar', degree=None, nbins=50, ntop=20):
if method == "poly" and degree is None:
raise ValueError("No degree specified for continuum method 'poly'.")

if np.any(np.isnan(wave)) or np.any(np.isnan(flux)):
if np.any(np.isnan(wave)) or np.any(np.isnan(flux)):
raise ValueError("There are Nan values in spectrum. Please remove first.")

org_wave = wave[:]
Expand All @@ -70,7 +72,7 @@ def continuum(wave, flux, method='scalar', degree=None, nbins=50, ntop=20):
if method == "exponential":
z = np.polyfit(wave_points, np.log(flux_points), deg=1, w=np.sqrt(flux_points))
p = np.poly1d(z)
continuum_fit = np.exp(p(org_wave)) # Un-log the y values.
continuum_fit = np.exp(p(org_wave)) # Un-log the y values.
else:
z = np.polyfit(wave_points, flux_points, deg=poly_degree[method])
p = np.poly1d(z)
Expand Down
Loading

0 comments on commit d169cb0

Please sign in to comment.