Skip to content

Commit

Permalink
Merge pull request #102 from mileslucas/master
Browse files Browse the repository at this point in the history
Small Docs Updates
  • Loading branch information
iancze authored Dec 7, 2018
2 parents 8fd86dc + 8082d58 commit 87279e6
Show file tree
Hide file tree
Showing 8 changed files with 578 additions and 25 deletions.
24 changes: 24 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[packages]

numpy = "*"
scipy = "*"
cython = "*"
scikit-learn = "*"
astropy = "*"
"h5py" = "*"
corner = "*"


[dev-packages]

sphinx = "*"
pyyaml = "*"
sphinx-rtd-theme = "*"
graphviz = "*"
504 changes: 504 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

9 changes: 2 additions & 7 deletions Starfish/grid_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,6 @@ def process_flux(self, parameters):
:param parameters: the model parameters.
:type parameters: 1D np.array
.. note::
:raises AssertionError: if the `parameters` vector is not
the same length as that of the raw grid.
Expand Down Expand Up @@ -1122,9 +1120,6 @@ class Instrument:
:type wl_range: 2-tuple (low, high)
:param oversampling: how many samples fit across the :attr:`FWHM`
:type oversampling: float
Upon initialization, calculates a ``wl_dict`` with the properties of the
instrument.
'''
def __init__(self, name, FWHM, wl_range, oversampling=4.):
self.name = name
Expand Down Expand Up @@ -1157,12 +1152,12 @@ def __init__(self, name="KPNO", FWHM=14.4, wl_range=(6250,6650)):
super().__init__(name=name, FWHM=FWHM, wl_range=wl_range)

class SPEX(Instrument):
'''SPEX Instrument'''
'''SPEX Instrument at IRTF in Hawaii'''
def __init__(self, name="SPEX", FWHM=150., wl_range=(7500, 54000)):
super().__init__(name=name, FWHM=FWHM, wl_range=wl_range)

class SPEX_SXD(Instrument):
'''SPEX Instrument short mode'''
'''SPEX Instrument at IRTF in Hawaii short mode (reduced wavelength range)'''
def __init__(self, name="SPEX", FWHM=150., wl_range=(7500, 26000)):
super().__init__(name=name, FWHM=FWHM, wl_range=wl_range)

Expand Down
2 changes: 1 addition & 1 deletion Starfish/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from itertools import zip_longest

def grouper(iterable, n, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
"""Collect data into fixed-length chunks or blocks"""
# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx"
args = [iter(iterable)] * n
return zip_longest(*args, fillvalue=fillvalue)
Expand Down
14 changes: 7 additions & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,27 @@
# The full version, including alpha/beta/rc tags.
# release = '0.1'

# 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.
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))

print("sys.path is", sys.path)

import Starfish
version = Starfish.__version__
release = version
print("imported Starfish version {}".format(version))

# 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.
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))

# -- General configuration -----------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.pngmath',
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.imgmath',
'sphinx.ext.mathjax', 'sphinx.ext.viewcode', 'sphinx.ext.graphviz', 'sphinx.ext.inheritance_diagram']

#Autodocs parameters
Expand Down
3 changes: 0 additions & 3 deletions docs/emulator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,5 @@ Once optimized, the optimal parameters will be written into the HDF5 file that c
Model spectrum reconstruction
=============================

.. autoclass:: WeightEmulator
:members:

.. autoclass:: Emulator
:members:
45 changes: 39 additions & 6 deletions docs/grid_tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ All of these reductions can be achieved using the :obj:`HDF5Creator` object.
.. autoclass:: HDF5Creator
:members:

Here is an example using the :obj:`HDF5Creator` to transform the raw spectral library into an HDF5 file with spectra that have the resolution of the *TRES* instrument.
Here is an example using the :obj:`HDF5Creator` to transform the raw spectral library into an HDF5 file with spectra that have the resolution of the *TRES* instrument. This process is also located in the ``scripts/grid.py`` if you are using the cookbook.


.. code-block:: python
Expand All @@ -168,7 +169,6 @@ Here is an example using the :obj:`HDF5Creator` to transform the raw spectral li
creator.process_grid()
Once you've made a grid, then you'll want to interface with it via :obj:`HDF5Interface`. The :obj:`HDF5Interface` provides `load_file` similar to that of the raw grid interfaces. It does not make any assumptions about how what resolution the spectra are stored, other than that the all spectra within the same HDF5 file share the same wavelength grid, which is stored in the HDF5 file as 'wl'. The flux files are stored within the HDF5 file, in a subfile called 'flux'.

.. autoclass:: HDF5Interface
Expand Down Expand Up @@ -214,18 +214,24 @@ For example, if we would like to generate a spectrum with the aforementioned par
Instruments
===========

In order to take the theoretical synthetic stellar spectra and make meaningful comparisons to actual data, we need to convolve and resample the synthetic spectra to match the format of our data. ``Instrument`` s are a convenience object which store the relevant characteristics of a given instrument.
In order to take the theoretical synthetic stellar spectra and make meaningful comparisons to actual data, we need
to convolve and resample the synthetic spectra to match the format of our data. :class:`~Instrument` s are a
convenience object which store the relevant characteristics of a given instrument.

.. inheritance-diagram:: Instrument KPNO TRES Reticon
.. inheritance-diagram:: Instrument KPNO TRES Reticon SPEX SPEX_SXD IGRINS_H IGRINS_K ESPaDOnS DCT_DeVeny WIYN_Hydra
:parts: 1

.. autoclass:: Instrument
:members:
:special-members: __str__

.. attribute:: self.wl_dict

A wl_dict that fits the instrumental properties with the correct oversampling.
List of Instruments
-------------------

It is quite easy to use the :class:`~Instrument` class for your own data, but we provide classes for most of the
well-known spectrographs. If you have a spectrograph that you would like to add if you think it will be used by
others, feel free to open a pull request following the same format.

.. autoclass:: TRES
:members:
Expand All @@ -239,6 +245,33 @@ A wl_dict that fits the instrumental properties with the correct oversampling.
:members:
:show-inheritance:

.. autoclass:: SPEX
:members:
:show-inheritance:

.. autoclass:: SPEX_SXD
:members:
:show-inheritance:

.. autoclass:: IGRINS_H
:members:
:show-inheritance:

.. autoclass:: IGRINS_K
:members:
:show-inheritance:

.. autoclass:: ESPaDOnS
:members:
:show-inheritance:

.. autoclass:: DCT_DeVeny
:members:
:show-inheritance:

.. autoclass:: WIYN_Hydra
:members:
:show-inheritance:

Utility Functions
=================
Expand Down
2 changes: 1 addition & 1 deletion docs/scripts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Scripts
=======

StellarSpectra is accompanied by a number of helper scripts that can be useful for formatting and exploration of the
Starfish is accompanied by a number of helper scripts that can be useful for formatting and exploration of the
data.

You may want to add the following location to your `PATH` in order to make frequent use of these scripts.
Expand Down

0 comments on commit 87279e6

Please sign in to comment.