Skip to content

Commit

Permalink
Merge pull request #79 from spacetelescope/0.9.9.x
Browse files Browse the repository at this point in the history
0.9.9 release
  • Loading branch information
pllim committed Mar 7, 2018
2 parents 621af3f + 72b9b60 commit 28e35ce
Show file tree
Hide file tree
Showing 10 changed files with 24,623 additions and 60 deletions.
24 changes: 24 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Spacetelescope Open Source Code of Conduct

We expect all "spacetelescope" organization projects to adopt a code of conduct that ensures a productive, respectful environment for all open source contributors and participants. We are committed to providing a strong and enforced code of conduct and expect everyone in our community to follow these guidelines when interacting with others in all forums. Our goal is to keep ours a positive, inclusive, successful, and growing community. The community of participants in open source Astronomy projects is made up of members from around the globe with a diverse set of skills, personalities, and experiences. It is through these differences that our community experiences success and continued growth.


As members of the community,

- We pledge to treat all people with respect and provide a harassment- and bullying-free environment, regardless of sex, sexual orientation and/or gender identity, disability, physical appearance, body size, race, nationality, ethnicity, and religion. In particular, sexual language and imagery, sexist, racist, or otherwise exclusionary jokes are not appropriate.

- We pledge to respect the work of others by recognizing acknowledgment/citation requests of original authors. As authors, we pledge to be explicit about how we want our own work to be cited or acknowledged.

- We pledge to welcome those interested in joining the community, and realize that including people with a variety of opinions and backgrounds will only serve to enrich our community. In particular, discussions relating to pros/cons of various technologies, programming languages, and so on are welcome, but these should be done with respect, taking proactive measure to ensure that all participants are heard and feel confident that they can freely express their opinions.

- We pledge to welcome questions and answer them respectfully, paying particular attention to those new to the community. We pledge to provide respectful criticisms and feedback in forums, especially in discussion threads resulting from code contributions.

- We pledge to be conscientious of the perceptions of the wider community and to respond to criticism respectfully. We will strive to model behaviors that encourage productive debate and disagreement, both within our community and where we are criticized. We will treat those outside our community with the same respect as people within our community.

- We pledge to help the entire community follow the code of conduct, and to not remain silent when we see violations of the code of conduct. We will take action when members of our community violate this code such as such as contacting conduct@stsci.edu (all emails sent to this address will be treated with the strictest confidence) or talking privately with the person.

This code of conduct applies to all community situations online and offline, including mailing lists, forums, social media, conferences, meetings, associated social events, and one-to-one interactions.

Parts of this code of conduct have been adapted from the Astropy and Numfocus codes of conduct.
http://www.astropy.org/code_of_conduct.html
https://www.numfocus.org/about/code-of-conduct/
2 changes: 1 addition & 1 deletion doc/rtd-pip-requirements
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ numpy
matplotlib
astropy-helpers
astropy
scipy
scipy>=0.18
70 changes: 35 additions & 35 deletions doc/source/appendixa.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Stellar models:
|:ref:`pysynphot-appendixa-ck04` |$PYSYN_CDBS/grid/ck04models |Yes |
+-------------------------------------+-------------------------------+ |
|:ref:`pysynphot-appendixa-kurucz1993`|$PYSYN_CDBS/grid/k93models | |
+-------------------------------------+-------------------------------+ |
|:ref:`pysynphot-appendixa-phoenix` |$PYSYN_CDBS/grid/phoenix | |
+-------------------------------------+-------------------------------+--------------+
|:ref:`pysynphot-appendixa-calspec` |$PYSYN_CDBS/calspec |No |
+-------------------------------------+-------------------------------+ |
Expand All @@ -45,8 +47,6 @@ Non-stellar models:
+-------------------------------------+-------------------------------+--------------+
|Atlas/Catalog |Installation Path |Interpolatable|
+=====================================+===============================+==============+
|:ref:`pysynphot-appendixa-phoenix` |$PYSYN_CDBS/grid/phoenix |Yes |
+-------------------------------------+-------------------------------+--------------+
|:ref:`pysynphot-appendixa-bc95` |$PYSYN_CDBS/grid/bc95/templates|No |
+-------------------------------------+-------------------------------+ |
|:ref:`pysynphot-appendixa-kc96` |$PYSYN_CDBS/grid/kc96 | |
Expand Down Expand Up @@ -77,7 +77,7 @@ The atlas data files are organized in a similar naming convention as
:ref:`pysynphot-appendixa-kurucz1993`, and are easily accessible using
`~pysynphot.catalog.Icat` (also see :ref:`pysynphot-spec-atlas`).

The example below generates a spectrum with metallicity :math:`\log Z = +0.1`,
The example below generates a spectrum with metallicity ``[M/H] = +0.1``,
temperature :math:`T_{\textnormal{eff}} = 10000 \textnormal{K}`, and gravity
:math:`\log g = 3.0`:

Expand Down Expand Up @@ -112,7 +112,7 @@ absolute flux is needed, the model spectrum must be

The following example shows the header from one of the atlas data files.
This file contains all the models for a star of metallicity
:math:`\log Z = 0.0` (``p00``) and effective temperature
``[M/H] = 0.0`` (``p00``) and effective temperature
:math:`T_{\textnormal{eff}} = 8000 \textnormal{K}` (``8000``), which cover a
range of gravities from :math:`\log g = +1.0` (``g10``) to
:math:`\log g = +5.0` (``g50``).
Expand Down Expand Up @@ -157,7 +157,7 @@ HISTORY and effective temperature but different gravity.

The example below shows you how to manually select the flux for a specific
model characterized by a given metallicity, effective temperature, and gravity.
The filename ``kp01_10000`` means :math:`\log Z = +0.1` (``p01``) and
The filename ``kp01_10000`` means ``[M/H] = +0.1`` (``p01``) and
:math:`T_{\textnormal{eff}} = 10000 \textnormal{K}` (``10000``). The column
name ``g30`` means :math:`\log g = 3.0`:

Expand All @@ -173,6 +173,36 @@ The easier way to to use `~pysynphot.catalog.Icat` (also see
>>> sp = S.Icat('k93models', 10000, 0.1, 3.0)


.. _pysynphot-appendixa-phoenix:

Phoenix Models
==============

The ``$PYSYN_CDBS/grid/phoenix`` directory contains models provided by
`F. Allard et al. <http://perso.ens-lyon.fr/france.allard/>`_
and can be found in the
`Star, Brown Dwarf, and Planet Simulator <http://phoenix.ens-lyon.fr/simulator/index.faces>`_. They use static, spherical symmetric, 1D simulations to completely
describe the atmospheric emission spectrum. The models account for the
formation of molecular bands, such as those of water vapor, methane, or
titanium dioxide, solving for the transfer equation over more than 20,000
wavelength points on average, producing synthetic spectra with 2 Angstroms
resolution. The line selection is repeated at each iteration of the model
until it has converged and the thermal structure obtained. The models here
are calculated with a cloud model, valid across the entire parameter range.
See
`Phoenix models README file <http://www.stsci.edu/hst/observatory/crds/SIfileInfo/pysynphottables/index_phoenix_models_html>`_
for more details.
The atlas data files are organized in a similar naming convention as
:ref:`pysynphot-appendixa-kurucz1993`, and are easily accessible using
`~pysynphot.catalog.Icat` (also see :ref:`pysynphot-spec-atlas`).

The example below generates a spectrum with metallicity ``[M/H] = +0.1``,
temperature :math:`T_{\textnormal{eff}} = 10000 \textnormal{K}`, and gravity
:math:`\log g = 3.0`:

>>> sp = S.Icat('phoenix', 10000, 0.1, 3.0)


.. _pysynphot-appendixa-calspec:

HST Calibration Spectra
Expand Down Expand Up @@ -398,36 +428,6 @@ The example below loads a source spectrum of spectral type G0V from the atlas:
>>> sp = S.FileSpectrum(filename)


.. _pysynphot-appendixa-phoenix:

Phoenix Models
==============

The ``$PYSYN_CDBS/grid/phoenix`` directory contains models provided by
`F. Allard et al. <http://perso.ens-lyon.fr/france.allard/>`_
and can be found in the
`Star, Brown Dwarf, and Planet Simulator <http://phoenix.ens-lyon.fr/simulator/index.faces>`_. They use static, spherical symmetric, 1D simulations to completely
describe the atmospheric emission spectrum. The models account for the
formation of molecular bands, such as those of water vapor, methane, or
titanium dioxide, solving for the transfer equation over more than 20,000
wavelength points on average, producing synthetic spectra with 2 Angstroms
resolution. The line selection is repeated at each iteration of the model
until it has converged and the thermal structure obtained. The models here
are calculated with a cloud model, valid across the entire parameter range.
See
`Phoenix models README file <http://www.stsci.edu/hst/observatory/crds/SIfileInfo/pysynphottables/index_phoenix_models_html>`_
for more details.
The atlas data files are organized in a similar naming convention as
:ref:`pysynphot-appendixa-kurucz1993`, and are easily accessible using
`~pysynphot.catalog.Icat` (also see :ref:`pysynphot-spec-atlas`).

The example below generates a spectrum with metallicity :math:`\log Z = +0.1`,
temperature :math:`T_{\textnormal{eff}} = 10000 \textnormal{K}`, and gravity
:math:`\log g = 3.0`:

>>> sp = S.Icat('phoenix', 10000, 0.1, 3.0)


.. _pysynphot-appendixa-bc95:

Bruzual-Charlot Atlas
Expand Down
4 changes: 2 additions & 2 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ References

.. _synphot-ref-greenfield2007:

* `Greenfield, P. & Jedrzejewski, R. 2007, Using Python for Interactive Data Analysis (Baltimore, MD: STScI) <http://stsdas.stsci.edu/perry/pydatatut.pdf>`_
* `Greenfield, P. & Jedrzejewski, R. 2007, Using Python for Interactive Data Analysis (Baltimore, MD: STScI) <http://ssb.stsci.edu/perry/pydatatut.pdf>`_

.. _synphot-ref-gunn2001:

Expand Down Expand Up @@ -301,7 +301,7 @@ References

.. _synphot-ref-laidler2009:

* `Laidler, V. 2009, TSR 2009-01: Pysynphot Commissioning Report (Baltimore, MD: STScI) <http://stsdas.stsci.edu/tsr/2009_01/>`_
* `Laidler, V. 2009, TSR 2009-01: Pysynphot Commissioning Report (Baltimore, MD: STScI) <http://ssb.stsci.edu/tsr/2009_01/>`_

.. _synphot-ref-laidler2008:

Expand Down
6 changes: 3 additions & 3 deletions doc/source/spectrum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ you want, as shown in the example above.
However, three of the atlases (:ref:`pysynphot-appendixa-ck04`,
:ref:`pysynphot-appendixa-kurucz1993`, and :ref:`pysynphot-appendixa-phoenix`)
have a grid of basis spectra which are indexed for various combinations of
effective temperature (:math:`T_{\textnormal{eff}}`) in Kelvin, log metallicity
(:math:`\log Z`), and log surface gravity (:math:`\log g`). They are best
effective temperature (:math:`T_{\textnormal{eff}}`) in Kelvin, metallicity
(``[M/H]``), and log surface gravity (:math:`\log g`). They are best
accessed with a special `~pysynphot.catalog.Icat` class.
You may specify any combination of the properties, so long as each is
within the allowed range, which differs from atlas to atlas. For example,
Expand All @@ -277,7 +277,7 @@ which means that no spectrum can be constructed for effective temperatures
below 3499 K or above 50001 K (i.e., an exception will be raised).
The example below obtains the spectrum for a
:ref:`pysynphot-appendixa-kurucz1993` model with
:math:`T_{\textnormal{eff}} = 6000 \; \textnormal{K}`, :math:`\log Z = 0`, and
:math:`T_{\textnormal{eff}} = 6000 \; \textnormal{K}`, ``[M/H] = 0``, and
:math:`\log g = 4.3`:

>>> sp = S.Icat('k93models', 6440, 0, 4.3)
Expand Down
11 changes: 8 additions & 3 deletions pysynphot/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
Spectra are constructed from basis spectra which are indexed for various
combinations of effective temperature (:math:`T_{\\textnormal{eff}}`),
metallicity (:math:`Z`), and log surface gravity (:math:`\\log g`).
metallicity (``[M/H]``), and log surface gravity (:math:`\\log g`).
The user may specify any combination of :math:`T_{\\textnormal{eff}}`,
:math:`Z`, and :math:`\\log g` so long as each parameter is within the range
``[M/H]``, and :math:`\\log g` so long as each parameter is within the range
for that parameter defined by the catalog.
For example, the :ref:`pysynphot-appendixa-ck04` catalog contains spectra for
Expand Down Expand Up @@ -96,7 +96,7 @@ def __init__(self,catdir,Teff,metallicity,log_g):
self.parameter_names = ['Teff','metallicity','log G']

filename = locations.CAT_TEMPLATE.replace('*',catdir)
self.name="%s(Teff=%g,z=%g,logG=%g)"%(catdir,Teff,metallicity,log_g)
self.name="%s(Teff=%g,metallicity=%g,logG=%g)"%(catdir,Teff,metallicity,log_g)

if filename in CATALOG_CACHE:
indices = CATALOG_CACHE[filename]
Expand Down Expand Up @@ -204,6 +204,11 @@ def _getSpectrum(self, parlist, basename):
os.path.join(basename,filename))
sp = spectrum.TabularSourceSpectrum(filename, fluxname=column)

totflux = sp.integrate()
if not N.isfinite(totflux) or totflux <= 0:
raise exceptions.ParameterOutOfBounds(
"Parameter '{0}' has no valid data.".format(parlist))

result = []
for member in parlist:
result.append(member)
Expand Down
Loading

0 comments on commit 28e35ce

Please sign in to comment.