Skip to content

Commit

Permalink
Merge branch 'Docs' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-neal committed Apr 21, 2017
2 parents 89108ab + 0dced37 commit a715e39
Show file tree
Hide file tree
Showing 8 changed files with 406 additions and 176 deletions.
72 changes: 60 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,81 @@
# spectrum_overload [![Build Status](https://travis-ci.org/jason-neal/spectrum_overload.svg)](https://travis-ci.org/jason-neal/spectrum_overload) [![Coverage Status](https://coveralls.io/repos/github/jason-neal/spectrum_overload/badge.svg?branch=develop)](https://coveralls.io/github/jason-neal/spectrum_overload?branch=develop)
Learn to use Classes by creating a Spectrum class to use in my Phd work.

## Overview
The purpose of this was project was to learn how to use and create Classes, and to create a Spectrum object to use within my Phd work.

Ideas to include:
The main goals of this project are basically complete.

Variables pixel, flux, wavelength
- create a class to contain spectrum
- automatic interpolation
- overloaded operators
especially
- Spectral division (SpectrumA / SpectrumB )
- Spectral subtraction (SpectrumA - SpectrumB)
- Powers/exponents (Spectrum ** x)

Spectral slicing method. (wav_selector)
## Installation
Currently to install and use Spectrum class for your own projects.

Radial velocity shifts
clone the git repository where you want it:

https://github.com/jason-neal/spectrum_overload.git

Wavelength calibration method. pixel->wavelength
cd into the downloaded directory:

Spectral subtraction: SpectrumA - SpectrumB
cd spectrum_overload

Spectral division SpectrumA/SpectrumB
and install using:

python setup.py install


## Other Spectrum Classes:
## Usage
To use import the class using :

from spectrum_overload import Spectrum
...
my_spectrum = Spectrum.Spectrum(flux, xaxis)

There are many other spectrum classes around but None (sofar) that overload the operators
or :

from spectrum_overload.Spectrum import Spectrum as spec
...
my_spectrum = spec(flux, xaxis)

or how ever else you would like to import it.

A tutorial is provided [here](Notebooks/Tutorial.ipynb) to show an example of how to use this class.


## Contributions
Contributions are very welcome.

I would really appreciate user feedback or suggested improvements if you have any.

Feel free to submit issues or create pull requests.



## Other Spectrum Classes

There are many other spectrum classes around but I didn't see any that overload the operators. (I could be blind).

One of these may better suit your needs

I will list them here as I find them
- https://github.com/crawfordsm/specreduce
- https://github.com/crawfordsm/pyspectrograph/tree/master/PySpectrograph/Spectra
- http://pyspeckit.bitbucket.org/html/sphinx/spectrum.html#pyspeckit.spectrum.classes.Spectrum
- https://github.com/cokelaer/spectrum
-https://github.com/astropy/specutils
- https://github.com/astropy/specutils

Wow A lot. I probably should not reinvent the wheel too much then...

It turns out that astropy/specutils is very similar to what I have created but its direction is uncertain at the moment and they do not use overloaded operators and will not implement in the foreseeable future.

## TO DO
Some tasks still to do:

- Improve Documentation
- Generate Calibration solution (outside spectrum class)?
- Push a version to pypi

81 changes: 50 additions & 31 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Spectrum documentation build configuration file, created by
# Licensed under the MIT Licence

# spectrum_overload documentation build configuration file, created by
# sphinx-quickstart on Sun Sep 11 23:45:23 2016.
#
# This file is execfile()d with the current directory set to its
Expand All @@ -13,9 +14,21 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
# import sys
import os

try:
import sphinx_rtd_theme
except ImportError:
sphinx_rtd_theme = None


base_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")

about = {}
with open(os.path.join(base_dir, "spectrum_overload", "__about__.py")) as f:
exec(f.read(), about)

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
Expand All @@ -37,6 +50,7 @@
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinx.ext.napoleon'
]

# Add any paths that contain templates here, relative to this directory.
Expand All @@ -54,18 +68,18 @@
master_doc = 'index'

# General information about the project.
project = 'Spectrum'
copyright = '2016, Jason Neal'
author = 'Jason Neal'
project = 'spectrum_overload'
copyright = about["__copyright__"]
author = about["__author__"]

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.1'
version = about["__version__"]
# The full version, including alpha/beta/rc tags.
release = '0.1'
release = about["__version__"]

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -117,7 +131,12 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'alabaster'
#html_theme = 'alabaster'
if sphinx_rtd_theme:
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
else:
html_theme = "default"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand All @@ -129,7 +148,7 @@

# The name for this set of Sphinx documents.
# "<project> v<release> documentation" by default.
#html_title = 'Spectrum v0.1'
#html_title = 'spectrum_overload v0.1'

# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
Expand All @@ -138,9 +157,9 @@
# of the sidebar.
#html_logo = None

# The name of an image file (relative to this directory) to use as a favicon of
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
# The name of an image file (relative to this directory) to use as a favicon
# of the docs. This file should be a Windows icon file (.ico) being 16x16 or
# 32x32 pixels large.
#html_favicon = None

# Add any paths that contain custom static files (such as style sheets) here,
Expand Down Expand Up @@ -211,31 +230,31 @@
#html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'Spectrumdoc'
htmlhelp_basename = 'spectrum_overloaddoc'

# -- Options for LaTeX output ---------------------------------------------

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Additional stuff for the LaTeX preamble.
#'preamble': '',

# Latex figure (float) alignment
#'figure_align': 'htbp',
}
# Latex figure (float) alignment
#'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'Spectrum.tex', 'Spectrum Documentation',
'Jason Neal', 'manual'),
]
(master_doc, 'spectrum_overload.tex', 'spectrum_overload Documentation',
author, 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
# the title page.
Expand Down Expand Up @@ -263,9 +282,9 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'spectrum', 'Spectrum Documentation',
(master_doc, 'spectrum_overload', 'spectrum_overload Documentation',
[author], 1)
]
]

# If true, show URL addresses after external links.
#man_show_urls = False
Expand All @@ -277,10 +296,10 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'Spectrum', 'Spectrum Documentation',
author, 'Spectrum', 'One line description of project.',
(master_doc, 'spectrum_overload', 'spectrum_overload Documentation',
author, 'spectrum_overload', 'One line description of project.',
'Miscellaneous'),
]
]

# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
Expand Down
23 changes: 12 additions & 11 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,30 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
=============================================
Welcome to spectrum_overload's documentation!
====================================
.. image:: https://travis-ci.org/jason-neal/spectrum_overload.svg?branch=master
=============================================
.. image:: https://travis-ci.org/jason-neal/spectrum_overload.svg?branch=develop
:target: https://travis-ci.org/jason-neal/spectrum_overload

.. image:: https://coveralls.io/repos/github/jason-neal/spectrum_overload/badge.svg?branch=master
:target: https://coveralls.io/github/jason-neal/spectrum_overload?branch=master
.. image:: https://coveralls.io/repos/github/jason-neal/spectrum_overload/badge.svg?branch=develop
:target: https://coveralls.io/github/jason-neal/spectrum_overload?branch=develop


Contents:
spectrum_overload contains a spectrum class which contains overloaded operators.
This means that you can easily divide and subtract spectra from each other.

If the spectra are do not have the same wavelenght axis then it is automatially interpolated so that they are the same.


.. toctree::
:maxdepth: 2

.. automodule:: spectrum_overload

Spectrum Class
==============
quickstart
installation

A python class to contain a spectrum. The operators have been overloaded so that you can easily combine spectra.

.. autoclass:: spectrum_overload.Spectrum
:members:

Indices and tables
==================
Expand Down
Loading

0 comments on commit a715e39

Please sign in to comment.