gwcs-0.12.0/ 0000755 0007322 0002007 00000000000 13600427270 014705 5 ustar dencheva STSCI\science 0000000 0000000 gwcs-0.12.0/.bandit.yaml 0000644 0007322 0002007 00000000061 13600426757 017116 0 ustar dencheva STSCI\science 0000000 0000000 exclude_dirs:
- gwcs/tests
- gwcs/tags/tests
gwcs-0.12.0/.gitignore 0000644 0007322 0002007 00000001117 13600426757 016706 0 ustar dencheva STSCI\science 0000000 0000000 # Compiled files
*.py[co]
*.a
*.o
*.so
__pycache__
# Ignore .c files by default to avoid including generated code. If you want to
# add a non-generated .c extension, use `git add -f filename.c`.
*.c
# Other generated files
*/version.py
*/cython_version.py
htmlcov
.coverage
MANIFEST
.pytest_cache
# Sphinx
docs/api
docs/_build
docs/generated
# Eclipse editor project files
.project
.pydevproject
.settings
# Packages/installer info
*.egg
*.eggs
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
distribute-*.tar.gz
# Other
.*.swp
*~
# Mac OSX
.DS_Store
.idea
gwcs-0.12.0/.gitmodules 0000644 0007322 0002007 00000000154 13600426757 017073 0 ustar dencheva STSCI\science 0000000 0000000 [submodule "astropy-helpers"]
path = astropy_helpers
url = https://github.com/astropy/astropy-helpers.git
gwcs-0.12.0/.rtd-environment.yml 0000644 0007322 0002007 00000000266 13600426757 020656 0 ustar dencheva STSCI\science 0000000 0000000
dependencies:
- python>=3
- numpy
- pip:
- astropy
- sphinx_astropy
- sphinx-automodapi
- stsci_rtd_theme
- asdf
- sphinx_rtd_theme
- sphinx-asdf
gwcs-0.12.0/.travis.yml 0000644 0007322 0002007 00000006474 13600426757 017042 0 ustar dencheva STSCI\science 0000000 0000000 language: python
os: linux
# Setting sudo to false opts in to Travis-CI container-based builds.
sudo: false
# 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:
- 3.7
- 3.8
env:
global:
# The following versions are the 'default' for tests, unless
# overidden underneath. They are defined here in order to save having
# to repeat them for all configurations.
- NUMPY_VERSION=1.16
- ASDF_GIT='git+https://github.com/spacetelescope/asdf.git#egg=asdf'
#- CONDA_DEPENDENCIES='scipy'
#- ASTROPY_GIT='git+https://github.com/astropy/astropy.git@v3.1.x'
- ASTROPY_GIT='git+https://github.com/astropy/astropy.git#egg=astropy
- PIP_DEPENDENCIES=".[all]"
matrix:
# Don't wait for allowed failures
fast_finish: true
include:
# Do a security check
- env:
- TEST_COMMAND="bandit -r gwcs -c .bandit.yaml"
- PIP_DEPENDENCIES="bandit"
# Do a coverage test.
- python: 3.7
env:
- TEST_COMMAND='pytest --cov-config=gwcs/tests/coveragerc --cov=gwcs'
- PIP_DEPENDENCIES='.[test] coveralls pytest-cov'
# Check for sphinx doc build warnings - we do this first because it
# may run for a long time
- python: 3.7
env: #PIP_DEPENDENCIES="$ASTROPY_GIT $ASDF_GIT sphinx sphinx-automodapi sphinx-rtd-theme stsci-rtd-theme sphinx-astropy -sphinx-asdf"
PIP_DEPENDENCIES=".[docs]"
TEST_COMMAND="make --directory=docs html"
- python: 3.6
env:
- NUMPY_VERSION=1.17
- PIP_DEPENDENCIES='.[test]'
- TEST_COMMAND="pytest"
- python: 3.7
env:
- NUMPY_VERSION=1.17
- PIP_DEPENDENCIES='.[test]'
- TEST_COMMAND="pytest"
- python: 3.8
env:
- NUMPY_VERSION=1.17
- PIP_DEPENDENCIES='.[test]'
- TEST_COMMAND="pytest"
# Do a PEP8 test with flake8
- python: 3.6
env:
- TEST_COMMAND="flake8 gwcs --count --select=F, E101, E111, E112, E113, E401, E402, E711, E722, E30 --max-line-length=110"
- PIP_DEPENDENCIES="flake8"
- python: 3.6
env:
- TEST_COMMAND='flake8 gwcs --count --max-line-length=110'
- PIP_DEPENDENCIES="flake8"
- python: 3.7
env:
- PIP_DEPENDENCIES="$ASTROPY_GIT $ASDF_GIT .[test]"
allow_failures:
- python: 3.6
env:
- TEST_COMMAND='flake8 gwcs --count --max-line-length=110'
- PIP_DEPENDENCIES="flake8"
- python: 3.7
env:
- PIP_DEPENDENCIES="$ASTROPY_GIT $ASDF_GIT .[test]"
install:
- pip install numpy~=$NUMPY_VERSION
- pip install $PIP_DEPENDENCIES
script:
- $TEST_COMMAND
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 [[ $TEST_COMMAND == *--cov* ]]; then
coveralls --rcfile='gwcs/tests/coveragerc';
fi
gwcs-0.12.0/CHANGES.rst 0000644 0007322 0002007 00000012535 13600426764 016524 0 ustar dencheva STSCI\science 0000000 0000000 0.12.0 (2019-12-24)
-------------------
New Features
^^^^^^^^^^^^
- ``gwcs.WCS`` now supports the ``world_axis_object_components`` and
``world_axis_object_classes`` methods of the low level WCS API as specified by
APE 14.
- Removed astropy-helpers from package. [#249]
- Added a method ``fix_inputs`` which rturns an unique WCS from a compound
WCS by fixing inputs. [#254]
- Added two new transforms - ``ToDirectionCosines`` and ``FromDirectionCosines``. [#256]
- Added new transforms ``WavelengthFromGratingEquation``, ``AnglesFromGratingEquation3D``. [#259]
- ``gwcs.WCS`` now supports the new ``world_axis_names`` and
``pixel_axis_names`` properties on ``LowLevelWCS`` objects. [#260]
- Update the ``StokesFrame`` to work for arrays of coordinates and integrate
with APE 14. [#258]
- Added ``Snell3D``, ``SellmeierGlass`` and ``SellmeierZemax`` transforms. [#270]
API Changes
^^^^^^^^^^^
- Changed the initialization of ``TemporalFrame`` to be consistent with other
coordinate frames. [#242]
Bug Fixes
^^^^^^^^^
- Ensure that ``world_to_pixel_values`` and ``pixel_to_world_values`` always
accept and return floats, even if the underlying transform uses units. [#248]
0.11.0 (2019/07/26)
-------------------
New Features
^^^^^^^^^^^^
- Add a schema and tag for the Stokes frame. [#164]
- Added ``WCS.pixel_shape`` property. [#233]
Bug Fixes
^^^^^^^^^
- Update util.isnumerical(...) to recognize big-endian types as numeric. [#225]
- Fixed issue in unified WCS API (APE14) for transforms that use
``Quantity``. [#222]
- Fixed WCS API issues when ``output_frame`` is 1D, e.g. ``Spectral`` only. [#232]
0.10.0 (12/20/2018)
-------------------
New Features
^^^^^^^^^^^^
- Initializing a ``WCS`` object with a ``pipeline`` list now keeps
the complete ``CoordinateFrame`` objects in the ``WCS.pipeline``.
The effect is that a ``WCS`` object can now be initialized with
a ``pipeline`` from a different ``WCS`` object. [#174]
- Implement support for astropy APE 14
(https://doi.org/10.5281/zenodo.1188875). [#146]
- Added a ``wcs_from_[points`` function which creates a WCS object
two matching sets of points ``(x,y)`` and ``(ra, dec)``. [#42]
0.9.0 (2018-05-23)
------------------
New Features
^^^^^^^^^^^^
- Added a ``TemporalFrame`` to represent relative or absolute time axes. [#125]
- Removed deprecated ``grid_from_domain`` function and ``WCS.domain`` property. [#119]
- Support for Python 2.x, 3.0, 3.1, 3.2, 3.3 and 3.4 was removed. [#119]
- Add a ``coordinate_to_quantity`` method to ``CoordinateFrame`` which handles
converting rich coordinate input to numerical values. It is an inverse of the
``coordinates`` method. [#133]
- Add a ``StokesFrame`` which converts from 'I', 'Q', 'U', 'V' to 0-3. [#133]
- Support serializing the base ``CoordinateFrame`` class to asdf, by making
a specific tag and schema for ``Frame2D``. [#150]
- Generalized the footrpint calculation to all output axes. [#167]
API Changes
^^^^^^^^^^^
- The argument ``output="numerical_plus"`` was replaced by a bool
argument ``with_units``. [#156]
- Added a new flag ``axis_type`` to the footprint method. It controls what
type of footprint to calculate. [#167]
Bug Fixes
^^^^^^^^^
- Fixed a bug in ``bounding_box`` definition when the WCS has only one axis. [#117]
- Fixed a bug in ``grid_from_bounding_box`` which caused the grid to be larger than
the image in cases when the bounding box is on the edges of an image. [#121]
0.8.0 (2017-11-02)
------------------
- ``LabelMapperRange`` now returns ``LabelMapperRange._no_label`` when the key is
not within any range. [#71]
- ``LabelMapperDict`` now returns ``LabelMapperDict._no_label`` when the key does
not match. [#72]
- Replace ``domain`` with ``bounding_box``. [#74]
- Added a ``LabelMapper`` model where ``mapper`` is an instance of
`~astropy.modeling.core.Model`. [#78]
- Evaluating a WCS with bounding box was moved to ``astropy.modeling``. [#86]
- RegionsSelector now handles the case when a label does not have a corresponding
transform and returns RegionsSelector.undefined_transform_value. [#86]
- GWCS now deals with axes types which are neither celestial nor spectral as "unknown"
and creates a transform equivalent to the FITS linear transform. [#92]
0.7 (2016-12-23)
----------------
New Features
^^^^^^^^^^^^
- Added ``wcs_from_fiducial`` function to wcstools. [#34]
- Added ``domain`` to the WCS object. [#36]
- Added ``grid_from_domain`` function. [#36]
- The WCS object can return now an `~astropy.coordinates.SkyCoord`
or `~astropy.units.Quantity` object. This is triggered by a new
parameter to the ``__call__`` method, ``output`` which takes values
of "numericals" (default) or "numericals_plus". [#64]
API_Changes
^^^^^^^^^^^
- Added ``atol`` argument to ``LabelMapperDict``, representing the absolute tolerance [#29]
- The ``CoordinateFrame.transform_to`` method was removed [#64]
Bug Fixes
^^^^^^^^^
- Fixed a bug in ``LabelMapperDict`` where a wrong index was used.[#29]
- Changed the order of the inputs when ``LabelMapperArray`` is evaluated as
the inputs are supposed to be image coordinates. [#29]
- Renamed variables in read_wcs_from_header to match loop variable [#63]
0.5.1 (2016-02-01)
------------------
Bug Fixes
^^^^^^^^^
- Added ASDF requirement to setup. [#30]
- Import OrderedDict from collections, not from astropy. [#32]
0.5 (2015-12-28)
----------------
Initial release on PYPI.
gwcs-0.12.0/CODE_OF_CONDUCT.md 0000644 0007322 0002007 00000006207 13600426757 017522 0 ustar dencheva STSCI\science 0000000 0000000 # 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/
gwcs-0.12.0/CONTRIBUTING.md 0000644 0007322 0002007 00000001321 13600426757 017144 0 ustar dencheva STSCI\science 0000000 0000000 Please open a new issue or new pull request for bugs, feedback, or new features you would like to see. If there is an issue you would like to work on, please leave a comment and we will be happy to assist. New contributions and contributors are very welcome!
New to github or open source projects? If you are unsure about where to start or haven't used github before, please feel free to contact the package maintainers.
Feedback and feature requests? Is there something missing you would like to see? Please open an issue or send an email to the maintainers. This package follows the Spacetelescope [Code of Conduct](CODE_OF_CONDUCT.md) strives to provide a welcoming community to all of our users and contributors.
gwcs-0.12.0/MANIFEST.in 0000644 0007322 0002007 00000000576 13600426757 016464 0 ustar dencheva STSCI\science 0000000 0000000 include README.rst
include ez_setup.py
include ah_bootstrap.py
include setup.cfg
recursive-include docs *
exclude docs/generated
recursive-include licenses *
recursive-include cextern *
recursive-include scripts *
prune docs/_build
prune build
recursive-include astropy_helpers *
exclude astropy_helpers/.git
exclude astropy_helpers/.gitignore
exclude *.pyc *.o
prune docs/api
gwcs-0.12.0/PKG-INFO 0000644 0007322 0002007 00000000557 13600427270 016011 0 ustar dencheva STSCI\science 0000000 0000000 Metadata-Version: 2.1
Name: gwcs
Version: 0.12.0
Summary: Generalized World Coordinate System
Home-page: https://gwcs.readthedocs.io/en/latest/
Author: gwcs developers
Author-email: help@stsci.edu
License: BSD
Description: Tools for managing the WCS of astronomical observations in a general (non-FITS) way
Platform: UNKNOWN
Provides-Extra: test
Provides-Extra: docs
gwcs-0.12.0/README.rst 0000644 0007322 0002007 00000006732 13600426757 016415 0 ustar dencheva STSCI\science 0000000 0000000 ..
GWCS - Generalized World Coordinate System
==========================================
.. raw:: html
GWCS - Generalized World Coordinate System
Generalized World Coordinate System (GWCS) is an `Astropy`_ affiliated package providing tools for managing the World Coordinate System of astronomical data.
GWCS takes a general approach to the problem of expressing transformations between pixel and world coordinates. It supports a data model which includes the entire transformation pipeline from input coordinates (detector by default) to world coordinates. It is tightly integrated with `Astropy`_.
- Transforms are instances of ``astropy.Model``. They can be chained, joined or combined with arithmetic operators using the flexible framework of compound models in `astropy.modeling`_.
- Celestial coordinates are instances of ``astropy.SkyCoord`` and are transformed to other standard celestial frames using `astropy.coordinates`_.
- Time coordinates are represented by ``astropy.Time`` and can be further manipulated using the tools in `astropy.time`_
- Spectral coordinates are ``astropy.Quantity`` objects and can be converted to other units using the tools in `astropy.units`_.
For complete features and usage examples see the `documentation`_ site.
Note
----
Beginning with version 0.9 GWCS requires Python 3.5 and above.
Installation
------------
To install::
pip install gwcs # Make sure pip >= 9.0.1 is used.
To clone from github and install the master branch::
git clone https://github.com/spacetelescope/gwcs.git
cd gwcs
python setup.py install
Contributing Code, Documentation, or Feedback
---------------------------------------------
We welcome feedback and contributions to the project. Contributions of
code, documentation, or general feedback are all appreciated. Please
follow the `contributing guidelines `__ to submit an
issue or a pull request.
We strive to provide a welcoming community to all of our users by
abiding to the `Code of Conduct `__.
Citing GWCS
-----------
.. image:: https://zenodo.org/badge/29208937.svg
:target: https://zenodo.org/badge/latestdoi/29208937
If you use GWCS, please cite the package via its Zenodo record.
.. _Astropy: http://www.astropy.org/
.. _astropy.time: http://docs.astropy.org/en/stable/time/
.. _astropy.modeling: http://docs.astropy.org/en/stable/modeling/
.. _astropy.units: http://docs.astropy.org/en/stable/units/
.. _astropy.coordinates: http://docs.astropy.org/en/stable/coordinates/
.. _documentation: http://gwcs.readthedocs.org/en/latest/
gwcs-0.12.0/conftest.py 0000644 0007322 0002007 00000000666 13600426757 017125 0 ustar dencheva STSCI\science 0000000 0000000 import os
import pkg_resources
from astropy.tests.helper import enable_deprecations_as_exceptions
# Uncomment the following line to treat all DeprecationWarnings as
# exceptions
#enable_deprecations_as_exceptions()
entry_points = []
for entry_point in pkg_resources.iter_entry_points('pytest11'):
entry_points.append(entry_point.name)
if "asdf_schema_tester" not in entry_points:
pytest_plugins = ['asdf.tests.schema_tester']
gwcs-0.12.0/convert_schemas.py 0000644 0007322 0002007 00000027723 13600426757 020466 0 ustar dencheva STSCI\science 0000000 0000000 # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
from collections import OrderedDict
import io
import json
import os
import sys
import textwrap
import yaml
def write_if_different(filename, data):
""" Write ``data`` to ``filename``, if the content of the file is different.
Parameters
----------
filename : str
The file name to be written to.
data : bytes
The data to be written to `filename`.
"""
if not os.path.exists(os.path.dirname(filename)):
os.makedirs(os.path.dirname(filename))
if os.path.exists(filename):
with open(filename, 'rb') as fd:
original_data = fd.read()
else:
original_data = None
if original_data != data:
print("Converting schema {0}".format(
os.path.basename(filename)))
with open(filename, 'wb') as fd:
fd.write(data)
def write_header(o, content, level):
"""
Write a reStructuredText header to the file.
Parameters
----------
o : output stream
content : str
The content of the header
level : int
The level of the header
"""
levels = '=-~^.'
if level >= len(levels):
o.write('**{0}**\n\n'.format(content))
else:
o.write(content)
o.write('\n')
o.write(levels[level] * len(content))
o.write('\n\n')
def format_range(var_middle, var_end, minimum, maximum,
exclusiveMinimum, exclusiveMaximum):
"""
Formats an mathematical description of a range, for example, ``0 ≤
x ≤ 2``.
Parameters
----------
var_middle : str or None
The string to put in the middle of an expression, such as
the ``x`` in ``0 ≤ x ≤ 2``.
var_end : str or None
The string to put at one end of a single comparision, such as
the ``x`` in ``x ≤ 0``.
minimum : number
The minimum value.
maximum : number
The maximum value.
exclusiveMinimum : bool
If `True`, the range excludes the minimum value.
exclusiveMaximum : bool
If `True`, the range excludes the maximum value
Returns
-------
expr : str
The formatted range expression
"""
if minimum is not None and maximum is not None:
part = '{0} '.format(minimum)
if exclusiveMinimum:
part += '<'
else:
part += '≤'
part += ' {0} '.format(var_middle)
if exclusiveMaximum:
part += '<'
else:
part += '≤'
part += ' {0}'.format(maximum)
elif minimum is not None:
if var_end is not None:
part = '{0} '.format(var_end)
else:
part = ''
if exclusiveMinimum:
part += '> {0}'.format(minimum)
else:
part += '≥ {0}'.format(minimum)
elif maximum is not None:
if var_end is not None:
part = '{0} '.format(var_end)
else:
part = ''
if exclusiveMaximum:
part += '< {0}'.format(maximum)
else:
part += '≤ {0}'.format(maximum)
else:
return None
return part
def format_type(schema, root):
"""
Creates an English/mathematical description of a schema fragment.
Parameters
----------
schema : JSON schema fragment
root : str
The JSON path to the schema fragment.
"""
if 'anyOf' in schema:
return ' :soft:`or` '.join(
format_type(x, root) for x in schema['anyOf'])
elif 'allOf' in schema:
return ' :soft:`and` '.join(
format_type(x, root) for x in schema['allOf'])
elif '$ref' in schema:
ref = schema['$ref']
if ref.startswith('#/'):
return ':ref:`{0} <{1}/{2}>`'.format(ref[2:], root, ref[2:])
else:
basename = os.path.basename(ref)
if "tag:stsci.edu:asdf" in ref or "tag:astropy.org:astropy" in ref:
return '`{0} <{1}>`'.format(basename, ref)
else:
return ':doc:`{0} <{1}>`'.format(basename, ref)
else:
type = schema.get('type')
if isinstance(type, list):
parts = [' or '.join(type)]
elif type is None:
parts = ['any']
else:
parts = [type]
if type == 'string':
range = format_range('*len*', '*len*', schema.get('minLength'),
schema.get('maxLength'), False, False)
if range is not None or 'pattern' in schema or 'format' in schema:
parts.append('(')
if range is not None:
parts.append(range)
if 'pattern' in schema:
pattern = schema['pattern'].encode('unicode_escape')
pattern = pattern.decode('ascii')
parts.append(':soft:`regex` :regexp:`{0}`'.format(pattern))
if 'format' in schema:
parts.append(':soft:`format` {0}'.format(schema['format']))
parts.append(')')
elif type in ('integer', 'number'):
range = format_range('*x*', '', schema.get('minimum'),
schema.get('maximum'),
schema.get('exclusiveMinimum'),
schema.get('exclusiveMaximum'))
if range is not None:
parts.append(range)
# TODO: multipleOf
elif type == 'object':
range = format_range('*len*', '*len*', schema.get('minProperties'),
schema.get('maxProperties'), False, False)
if range is not None:
parts.append(range)
# TODO: Dependencies
# TODO: Pattern properties
elif type == 'array':
items = schema.get('items')
if schema.get('items') and isinstance(items, dict):
if schema.get('uniqueItems'):
parts.append(':soft:`of unique`')
else:
parts.append(':soft:`of`')
parts.append('(')
parts.append(format_type(items, root))
parts.append(')')
range = format_range('*len*', '*len*', schema.get('minItems'),
schema.get('maxItems'), False, False)
if range is not None:
parts.append(range)
if 'enum' in schema:
parts.append(':soft:`from`')
parts.append(json.dumps(schema['enum']))
return ' '.join(parts)
def reindent(content, indent):
"""
Reindent a string to the given number of spaces.
"""
content = textwrap.dedent(content)
lines = []
for line in content.split('\n'):
lines.append(indent + line)
return '\n'.join(lines)
def recurse(o, name, schema, path, level, required=False):
"""
Convert a schema fragment to reStructuredText.
Parameters
----------
o : output stream
name : str
Name of the entry
schema : schema fragment
path : list of str
Path to schema fragment
level : int
Indentation level
required : bool
If `True` the entry is required by the schema and will be
documented as such.
"""
indent = ' ' * max(level, 0)
o.write('\n\n')
o.write(indent)
o.write('.. _{0}:\n\n'.format(os.path.join(*path)))
if level == 0:
write_header(o, name, level)
else:
if name != 'items':
o.write(indent)
o.write(':entry:`{0}`\n\n'.format(name))
o.write(indent)
if path[0].startswith("tag:stsci.edu:asdf"):
o.write(format_type(schema, path[0]))
else:
o.write(":soft:`Type:` ")
o.write(format_type(schema, path[0]))
o.write('.')
if required:
o.write(' Required.')
o.write('\n\n')
o.write(reindent(schema.get('title', ''), indent))
o.write('\n\n')
o.write(reindent(schema.get('description', ''), indent))
o.write('\n\n')
if 'default' in schema:
o.write(indent)
o.write(':soft:`Default:` {0}'.format(
json.dumps(schema['default'])))
o.write('\n\n')
if 'definitions' in schema:
o.write(indent)
o.write(":category:`Definitions:`\n\n")
for key, val in schema['definitions'].items():
recurse(o, key, val, path + ['definitions', key], level + 1)
if 'anyOf' in schema and len(schema['anyOf']) > 1:
o.write(indent)
o.write(':category:`Any of:`\n\n')
for i, subschema in enumerate(schema['anyOf']):
recurse(o, '—', subschema, path + ['anyOf', str(i)], level + 1)
elif 'allOf' in schema and len(schema['allOf']) > 1:
o.write(indent)
o.write(':category:`All of:`\n\n')
for i, subschema in enumerate(schema['allOf']):
recurse(o, i, subschema, path + ['allOf', str(i)], level + 1)
if schema.get('type') == 'object':
o.write(indent)
o.write(':category:`Properties:`\n\n')
for key, val in schema.get('properties', {}).items():
recurse(o, key, val, path + ['properties', key], level + 1,
key in schema.get('required', []))
elif schema.get('type') == 'array':
o.write(indent)
o.write(':category:`Items:`\n\n')
items = schema.get('items')
if isinstance(items, dict):
recurse(o, 'items', items, path + ['items'], level + 1)
elif isinstance(items, list):
for i, val in enumerate(items):
name = 'index[{0}]'.format(i)
recurse(o, name, val, path + [str(i)], level + 1)
if 'examples' in schema:
o.write(indent)
o.write(":category:`Examples:`\n\n")
for description, example in schema['examples']:
o.write(reindent(description + "::\n\n", indent))
o.write(reindent(example, indent + ' '))
o.write('\n\n')
def convert_schema_to_rst(src, dst):
"""
Convert a YAML schema to reStructuredText.
"""
with open(src, 'rb') as fd:
schema = yaml.safe_load(fd)
with open(src, 'rb') as fd:
yaml_content = fd.read()
o = io.StringIO()
id = schema.get('id', '#')
name = os.path.basename(src[:-5])
if 'title' in schema:
name += ': ' + schema['title'].strip()
recurse(o, name, schema, [id], 0)
#o.write(".. only:: html\n\n :download:`Original schema in YAML <{0}>`\n".
#os.path.basename(src)))
write_if_different(dst, yaml_content)
write_if_different(dst[:-5] + ".rst", o.getvalue().encode('utf-8'))
def construct_mapping(self, node, deep=False):
"""
Make sure the properties are written out in the same order as the
original file.
"""
if not isinstance(node, yaml.MappingNode):
raise yaml.constructor.ConstructorError(None, None,
"expected a mapping node, but found %s" % node.id,
node.start_mark)
mapping = OrderedDict()
for key_node, value_node in node.value:
key = self.construct_object(key_node, deep=deep)
try:
hash(key)
except TypeError as exc:
raise yaml.constructor.ConstructorError(
"while constructing a mapping", node.start_mark,
"found unacceptable key (%s)" % exc, key_node.start_mark)
value = self.construct_object(value_node, deep=deep)
mapping[key] = value
return mapping
yaml.SafeLoader.add_constructor(
'tag:yaml.org,2002:map', construct_mapping)
def main(src, dst):
for root, dirs, files in os.walk(src):
for fname in files:
if not fname.endswith(".yaml"):
continue
src_path = os.path.join(root, fname)
dst_path = os.path.join(
dst, os.path.relpath(src_path, src))
convert_schema_to_rst(src_path, dst_path)
def decode_filename(fname):
return fname
if __name__ == '__main__':
src = decode_filename(sys.argv[-2])
dst = decode_filename(sys.argv[-1])
sys.exit(main(src, dst))
gwcs-0.12.0/docs/ 0000755 0007322 0002007 00000000000 13600427270 015635 5 ustar dencheva STSCI\science 0000000 0000000 gwcs-0.12.0/docs/Makefile 0000644 0007322 0002007 00000011164 13600426757 017311 0 ustar dencheva STSCI\science 0000000 0000000 # Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
#This is needed with git because git doesn't create a dir if it's empty
$(shell [ -d "_static" ] || mkdir -p _static)
help:
@echo "Please use \`make ' where is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
-rm -rf $(BUILDDIR)
-rm -rf api
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Astropy.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Astropy.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/Astropy"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Astropy"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
gwcs-0.12.0/docs/_templates/ 0000755 0007322 0002007 00000000000 13600427270 017772 5 ustar dencheva STSCI\science 0000000 0000000 gwcs-0.12.0/docs/_templates/autosummary/ 0000755 0007322 0002007 00000000000 13600427270 022360 5 ustar dencheva STSCI\science 0000000 0000000 gwcs-0.12.0/docs/_templates/autosummary/base.rst 0000644 0007322 0002007 00000000372 13600426757 024037 0 ustar dencheva STSCI\science 0000000 0000000 {% extends "autosummary_core/base.rst" %}
{# The template this is inherited from is in astropy/sphinx/ext/templates/autosummary_core. If you want to modify this template, it is strongly recommended that you still inherit from the astropy template. #} gwcs-0.12.0/docs/_templates/autosummary/class.rst 0000644 0007322 0002007 00000000373 13600426757 024233 0 ustar dencheva STSCI\science 0000000 0000000 {% extends "autosummary_core/class.rst" %}
{# The template this is inherited from is in astropy/sphinx/ext/templates/autosummary_core. If you want to modify this template, it is strongly recommended that you still inherit from the astropy template. #} gwcs-0.12.0/docs/_templates/autosummary/module.rst 0000644 0007322 0002007 00000000374 13600426757 024414 0 ustar dencheva STSCI\science 0000000 0000000 {% extends "autosummary_core/module.rst" %}
{# The template this is inherited from is in astropy/sphinx/ext/templates/autosummary_core. If you want to modify this template, it is strongly recommended that you still inherit from the astropy template. #} gwcs-0.12.0/docs/conf.py 0000644 0007322 0002007 00000015072 13600426757 017152 0 ustar dencheva STSCI\science 0000000 0000000 # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy documentation build configuration file.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this file.
#
# All configuration values have a default. Some values are defined in
# the global Astropy configuration which is loaded here before anything else.
# See astropy.sphinx.conf for which values are set there.
# 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('..'))
# IMPORTANT: the above commented section was generated by sphinx-quickstart, but
# is *NOT* appropriate for astropy or Astropy affiliated packages. It is left
# commented out with this explanation to make it clear why this should not be
# done. If the sys.path entry above is added, when the astropy.sphinx.conf
# import occurs, it will import the *source* version of astropy instead of the
# version installed (if invoked as "make html" or directly with sphinx), or the
# version in the build directory (if "python setup.py build_sphinx" is used).
# Thus, any C-extensions that are needed to build the documentation will *not*
# be accessible, and the documentation will not build correctly.
import datetime
import os
import sys
try:
from sphinx_astropy.conf.v1 import * # noqa
except ImportError:
print('ERROR: the documentation requires the sphinx-astropy package to be installed')
sys.exit(1)
# Get configuration information from setup.cfg
try:
from ConfigParser import ConfigParser
except ImportError:
from configparser import ConfigParser
conf = ConfigParser()
conf.read([os.path.join(os.path.dirname(__file__), '..', 'setup.cfg')])
setup_cfg = dict(conf.items('metadata'))
# -- General configuration ----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.2'
# To perform a Sphinx version check that needs to be more specific than
# major.minor, call `check_sphinx_version("x.y.z")` here.
# check_sphinx_version("1.2.1")
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns.append('_templates')
# This is added to the end of RST files - a good place to put substitutions to
# be used globally.
rst_epilog += """
"""
# Top-level directory containing ASDF schemas (relative to current directory)
asdf_schema_path = '../gwcs/schemas'
# This is the prefix common to all schema IDs in this repository
asdf_schema_standard_prefix = 'stsci.edu/gwcs'
asdf_schema_reference_mappings = [
('tag:stsci.edu:asdf',
'http://asdf-standard.readthedocs.io/en/latest/generated/stsci.edu/asdf/'),
]
# -- Project information ------------------------------------------------------
# This does not *have* to match the package name, but typically does
project = setup_cfg['name']
author = setup_cfg['author']
copyright = '{0}, {1}'.format(
datetime.datetime.now().year, setup_cfg['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.
from pkg_resources import get_distribution
release = get_distribution(project).version
# for example take major/minor
version = '.'.join(release.split('.')[:2])
# -- Options for HTML output ---------------------------------------------------
# A NOTE ON HTML THEMES
# The global astropy configuration uses a custom theme, 'bootstrap-astropy',
# which is installed along with astropy. A different theme can be used or
# the options for this theme can be modified by overriding some of the
# variables set in the global configuration. The variables set in the
# global configuration are listed below, commented out.
# Add any paths that contain custom themes here, relative to this directory.
# To use a different custom theme, add the directory containing the theme.
#html_theme_path = []
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. To override the custom theme, set this to the
# name of a builtin theme or the name of a custom theme in html_theme_path.
#html_theme = None
# See sphinx-bootstrap-theme for documentation of these options
# https://github.com/ryan-roemer/sphinx-bootstrap-theme
html_theme_options = {
'logotext1': 'g', # white, semi-bold
'logotext2': 'wcs', # orange, light
'logotext3': ':docs' # white, light
}
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = ''
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = ''
# The name for this set of Sphinx documents. If None, it defaults to
# " v documentation".
html_title = '{0} v{1}'.format(project, release)
# Output file base name for HTML help builder.
htmlhelp_basename = project + 'doc'
# -- Options for LaTeX output --------------------------------------------------
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
#latex_documents = [('index', project + '.tex', project + u' Documentation',
# author, 'manual')]
# -- Options for manual page output --------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [('index', project.lower(), project + u' Documentation',
[author], 1)]
## -- Options for the edit_on_github extension ----------------------------------------
if eval(setup_cfg.get('edit_on_github')):
extensions += ['astropy.sphinx.ext.edit_on_github']
versionmod = __import__(setup_cfg['name'] + '.version')
edit_on_github_project = setup_cfg['github_project']
if versionmod.version.release:
edit_on_github_branch = "v" + versionmod.version.version
else:
edit_on_github_branch = "master"
edit_on_github_source_root = ""
edit_on_github_doc_root = "docs"
sys.path.insert(0, os.path.join(os.path.dirname('__file__'), 'sphinxext'))
extensions += ['sphinx_asdf']
gwcs-0.12.0/docs/gwcs/ 0000755 0007322 0002007 00000000000 13600427270 016600 5 ustar dencheva STSCI\science 0000000 0000000 gwcs-0.12.0/docs/gwcs/ifu-regions.png 0000644 0007322 0002007 00000033357 13600426757 021561 0 ustar dencheva STSCI\science 0000000 0000000 PNG
IHDR , d ( sBIT|d pHYs a a?i IDATxu uU<8f T`O&U :)N\\$݄tϕ- Kzr5c@ejq0Geݮky^tySST* (Pj V P, K , @ P, K , @ P, K , @ P, K , @ P, K , @ P, K , @ P, K , @ P, K , @ P, K , @ P, K , @ P, K , @ P, K , @ P, K , @ P, @uYihhȾÇgO `um//O|"w~駟/P!j*JC ysQG墋.
7Pq\ @ke֬Y%a =ƍ vX=I۶m/~y4hPUfxꩧ+tȰa:?C8p`~eĉY~}ry+_Je3pI@q뭷//=.r-'?SOe]:O>dh1bD{>ꪫ8>hyᇻ|.z> '?;iY^sIw2tsiٳ35^|iY&Y^Oy#V&
~?wwWɐbmLr.w߿r^`_'ko\{˓$zjYYޥw:HM80O?t