Update upstream source from tag 'upstream/2.0'
Update to upstream version '2.0'
with Debian dir f10f81134eed1768c8d759c665efcb64cc908289
Ole Streicher
5 years ago
0 | 0 | Metadata-Version: 2.1 |
1 | Name: aplpy | |
2 | Version: 2.0rc2 | |
1 | Name: APLpy | |
2 | Version: 2.0 | |
3 | 3 | Summary: The Astronomical Plotting Library in Python |
4 | 4 | Home-page: http://aplpy.github.io |
5 | 5 | Author: Thomas Robitaille and Eli Bressert |
6 | 6 | Author-email: thomas.robitaille@gmail.com, elibre@users.sourceforge.net |
7 | 7 | License: MIT |
8 | Description: The Astronomical Plotting Library in Python | |
8 | Description: |Build Status| |CircleCI| |codecov| |Documentation Status| | |
9 | ||
10 | About | |
11 | ----- | |
12 | ||
13 | APLpy (the Astronomical Plotting Library in Python) is a Python module | |
14 | aimed at producing publication-quality plots of astronomical imaging | |
15 | data in FITS format. | |
16 | ||
17 | PyPI: https://pypi.python.org/pypi/APLpy | |
18 | ||
19 | Website: http://aplpy.github.io | |
20 | ||
21 | Documentation: http://aplpy.readthedocs.io | |
22 | ||
23 | APLpy is released under an MIT open-source license. | |
24 | ||
25 | Installing | |
26 | ---------- | |
27 | ||
28 | The following dependencies are required: | |
29 | ||
30 | - `Numpy <http://www.numpy.org>`__ 1.11 or later | |
31 | - `Matplotlib <http://www.matplotlib.org>`__ 2.0 or later | |
32 | - `Astropy <http://www.astropy.org>`__ 3.1 or later | |
33 | - `reproject <http://reproject.readthedocs.org>`__ 0.4 or later | |
34 | ||
35 | and the following are optional: | |
36 | ||
37 | - `PyAVM <http://astrofrog.github.io/pyavm/>`__ 0.9.4 or later | |
38 | - `pyregion <http://pyregion.readthedocs.org/>`__ 2.0 or later | |
39 | - `pillow <https://pypi.org/project/Pillow/>`__ 4.0 or later | |
40 | - `scikit-image <https://pypi.org/project/scikit-image/>`__ 0.14 or | |
41 | later | |
42 | ||
43 | You can install APLpy with: | |
44 | ||
45 | :: | |
46 | ||
47 | pip install aplpy | |
48 | ||
49 | If you want to install all optional dependencies, you can do: | |
50 | ||
51 | :: | |
52 | ||
53 | pip install aplpy[all] | |
54 | ||
55 | .. |Build Status| image:: https://travis-ci.org/aplpy/aplpy.svg?branch=master | |
56 | :target: https://travis-ci.org/aplpy/aplpy | |
57 | .. |CircleCI| image:: https://circleci.com/gh/aplpy/aplpy/tree/master.svg?style=svg | |
58 | :target: https://circleci.com/gh/aplpy/aplpy/tree/master | |
59 | .. |codecov| image:: https://codecov.io/gh/aplpy/aplpy/branch/master/graph/badge.svg | |
60 | :target: https://codecov.io/gh/aplpy/aplpy | |
61 | .. |Documentation Status| image:: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat | |
62 | :target: https://aplpy.readthedocs.io/en/latest/ | |
63 | ||
9 | 64 | Platform: UNKNOWN |
10 | 65 | Requires-Python: >=3.5 |
66 | Provides-Extra: all | |
11 | 67 | Provides-Extra: docs |
12 | Provides-Extra: all | |
13 | 68 | Provides-Extra: test |
0 | [![Build Status](https://travis-ci.org/aplpy/aplpy.svg?branch=master)](https://travis-ci.org/aplpy/aplpy) | |
1 | [![CircleCI](https://circleci.com/gh/aplpy/aplpy/tree/master.svg?style=svg)](https://circleci.com/gh/aplpy/aplpy/tree/master) | |
2 | [![codecov](https://codecov.io/gh/aplpy/aplpy/branch/master/graph/badge.svg)](https://codecov.io/gh/aplpy/aplpy) | |
3 | [![Documentation Status](https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat)](https://aplpy.readthedocs.io/en/latest/) | |
4 | ||
5 | ||
6 | About | |
7 | ----- | |
8 | ||
9 | APLpy (the Astronomical Plotting Library in Python) is a | |
10 | Python module aimed at producing publication-quality plots | |
11 | of astronomical imaging data in FITS format. | |
12 | ||
13 | PyPI: https://pypi.python.org/pypi/APLpy | |
14 | ||
15 | Website: http://aplpy.github.io | |
16 | ||
17 | Documentation: http://aplpy.readthedocs.io | |
18 | ||
19 | APLpy is released under an MIT open-source license. | |
20 | ||
21 | Installing | |
22 | ---------- | |
23 | ||
24 | The following dependencies are required: | |
25 | ||
26 | * [Numpy](http://www.numpy.org) 1.11 or later | |
27 | * [Matplotlib](http://www.matplotlib.org) 2.0 or later | |
28 | * [Astropy](http://www.astropy.org) 3.1 or later | |
29 | * [reproject](http://reproject.readthedocs.org) 0.4 or later | |
30 | ||
31 | and the following are optional: | |
32 | ||
33 | * [PyAVM](http://astrofrog.github.io/pyavm/) 0.9.4 or later | |
34 | * [pyregion](http://pyregion.readthedocs.org/) 2.0 or later | |
35 | * [pillow](https://pypi.org/project/Pillow/) 4.0 or later | |
36 | * [scikit-image](https://pypi.org/project/scikit-image/) 0.14 or later | |
37 | ||
38 | You can install APLpy with: | |
39 | ||
40 | pip install aplpy | |
41 | ||
42 | If you want to install all optional dependencies, you can do: | |
43 | ||
44 | pip install aplpy[all] |
0 | |Build Status| |CircleCI| |codecov| |Documentation Status| | |
1 | ||
2 | About | |
3 | ----- | |
4 | ||
5 | APLpy (the Astronomical Plotting Library in Python) is a Python module | |
6 | aimed at producing publication-quality plots of astronomical imaging | |
7 | data in FITS format. | |
8 | ||
9 | PyPI: https://pypi.python.org/pypi/APLpy | |
10 | ||
11 | Website: http://aplpy.github.io | |
12 | ||
13 | Documentation: http://aplpy.readthedocs.io | |
14 | ||
15 | APLpy is released under an MIT open-source license. | |
16 | ||
17 | Installing | |
18 | ---------- | |
19 | ||
20 | The following dependencies are required: | |
21 | ||
22 | - `Numpy <http://www.numpy.org>`__ 1.11 or later | |
23 | - `Matplotlib <http://www.matplotlib.org>`__ 2.0 or later | |
24 | - `Astropy <http://www.astropy.org>`__ 3.1 or later | |
25 | - `reproject <http://reproject.readthedocs.org>`__ 0.4 or later | |
26 | ||
27 | and the following are optional: | |
28 | ||
29 | - `PyAVM <http://astrofrog.github.io/pyavm/>`__ 0.9.4 or later | |
30 | - `pyregion <http://pyregion.readthedocs.org/>`__ 2.0 or later | |
31 | - `pillow <https://pypi.org/project/Pillow/>`__ 4.0 or later | |
32 | - `scikit-image <https://pypi.org/project/scikit-image/>`__ 0.14 or | |
33 | later | |
34 | ||
35 | You can install APLpy with: | |
36 | ||
37 | :: | |
38 | ||
39 | pip install aplpy | |
40 | ||
41 | If you want to install all optional dependencies, you can do: | |
42 | ||
43 | :: | |
44 | ||
45 | pip install aplpy[all] | |
46 | ||
47 | .. |Build Status| image:: https://travis-ci.org/aplpy/aplpy.svg?branch=master | |
48 | :target: https://travis-ci.org/aplpy/aplpy | |
49 | .. |CircleCI| image:: https://circleci.com/gh/aplpy/aplpy/tree/master.svg?style=svg | |
50 | :target: https://circleci.com/gh/aplpy/aplpy/tree/master | |
51 | .. |codecov| image:: https://codecov.io/gh/aplpy/aplpy/branch/master/graph/badge.svg | |
52 | :target: https://codecov.io/gh/aplpy/aplpy | |
53 | .. |Documentation Status| image:: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat | |
54 | :target: https://aplpy.readthedocs.io/en/latest/ |
13 | 13 | import numpy as np |
14 | 14 | |
15 | 15 | from astropy import log |
16 | from astropy.extern import six | |
17 | 16 | from astropy.wcs import WCS |
18 | 17 | from astropy.wcs.utils import proj_plane_pixel_scales |
19 | 18 | from astropy.io import fits |
150 | 149 | else: |
151 | 150 | self.grid_type = 'lines' |
152 | 151 | |
153 | if (isinstance(data, six.string_types) and | |
152 | if (isinstance(data, str) and | |
154 | 153 | data.split('.')[-1].lower() in ['png', 'jpg', 'tif']): |
155 | 154 | |
156 | 155 | try: |
300 | 299 | def _get_hdu(self, data, hdu, north, convention=None, |
301 | 300 | dimensions=[0, 1], slices=[]): |
302 | 301 | |
303 | if isinstance(data, six.string_types): | |
302 | if isinstance(data, str): | |
304 | 303 | |
305 | 304 | filename = data |
306 | 305 | |
723 | 722 | smooth=smooth, |
724 | 723 | kernel=kernel)) |
725 | 724 | else: |
725 | extent = -0.5, self._wcs.nx - 0.5, -0.5, self._wcs.ny - 0.5 | |
726 | 726 | convolved_data = convolve_util.convolve(self._data, smooth=smooth, kernel=kernel) |
727 | 727 | self.image = self.ax.imshow(convolved_data, cmap=cmap, |
728 | 728 | interpolation=interpolation, |
729 | 729 | origin='lower', norm=normalizer, |
730 | aspect=aspect) | |
730 | aspect=aspect, extent=extent) | |
731 | 731 | |
732 | 732 | xmin, xmax = self.ax.get_xbound() |
733 | 733 | if xmin == 0.0: |
1714 | 1714 | called. This defaults to `True` if and only if APLpy is being used |
1715 | 1715 | from IPython and the Matplotlib backend is interactive. |
1716 | 1716 | """ |
1717 | self._figure._auto_refresh = refresh | |
1718 | 1717 | if refresh is None: |
1719 | 1718 | if matplotlib.is_interactive(): |
1720 | 1719 | try: |
1727 | 1726 | refresh = False |
1728 | 1727 | elif not isinstance(refresh, bool): |
1729 | 1728 | raise TypeError("refresh argument should be boolean or `None`") |
1729 | self._figure._auto_refresh = refresh | |
1730 | 1730 | |
1731 | 1731 | def refresh(self, force=True): |
1732 | 1732 | """ |
1780 | 1780 | explicitly. Should be one of 'eps', 'ps', 'pdf', 'svg', 'png'. |
1781 | 1781 | """ |
1782 | 1782 | |
1783 | if isinstance(filename, six.string_types) and format is None: | |
1783 | if isinstance(filename, str) and format is None: | |
1784 | 1784 | format = os.path.splitext(filename)[1].lower()[1:] |
1785 | 1785 | |
1786 | 1786 | if dpi is None and format in ['eps', 'ps', 'pdf']: |
1793 | 1793 | dpi = nx / width |
1794 | 1794 | log.info("Auto-setting resolution to %g dpi" % dpi) |
1795 | 1795 | |
1796 | artists = [] | |
1797 | 1796 | if adjust_bbox: |
1798 | 1797 | self._figure.savefig(filename, dpi=dpi, transparent=transparent, |
1799 | 1798 | bbox_inches='tight', format=format) |
9 | 9 | |
10 | 10 | from astropy import units as u |
11 | 11 | from astropy.wcs.utils import proj_plane_pixel_scales |
12 | from astropy.extern import six | |
13 | 12 | |
14 | 13 | from .decorators import auto_refresh |
15 | 14 | |
98 | 97 | except Exception: |
99 | 98 | pass |
100 | 99 | |
101 | if isinstance(corner, six.string_types): | |
100 | if isinstance(corner, str): | |
102 | 101 | corner = corners[corner] |
103 | 102 | |
104 | 103 | self._scalebar = AnchoredSizeBar(self._ax.transData, length, label, |
377 | 376 | See the matplotlib documentation for more details. |
378 | 377 | """ |
379 | 378 | |
380 | if isinstance(major, six.string_types): | |
379 | if isinstance(major, str): | |
381 | 380 | major = self._header[major] |
382 | 381 | |
383 | if isinstance(minor, six.string_types): | |
382 | if isinstance(minor, str): | |
384 | 383 | minor = self._header[minor] |
385 | 384 | |
386 | if isinstance(angle, six.string_types): | |
385 | if isinstance(angle, str): | |
387 | 386 | angle = self._header[angle] |
388 | 387 | |
389 | 388 | if isinstance(major, u.Quantity): |
425 | 424 | except Exception: |
426 | 425 | pass |
427 | 426 | |
428 | if isinstance(corner, six.string_types): | |
427 | if isinstance(corner, str): | |
429 | 428 | corner = corners[corner] |
430 | 429 | |
431 | 430 | self._beam = AnchoredEllipse(self._ax.transData, width=minor, |
0 | 0 | from __future__ import absolute_import, print_function, division |
1 | 1 | |
2 | from astropy.extern import six | |
3 | 2 | from astropy import log |
4 | 3 | from astropy import wcs |
5 | 4 | |
90 | 89 | raise ImportError("The pyregion package is required to load region files") |
91 | 90 | |
92 | 91 | # read region file |
93 | if isinstance(region_file, six.string_types): | |
92 | if isinstance(region_file, str): | |
94 | 93 | rr = pyregion.open(region_file) |
95 | 94 | elif isinstance(region_file, pyregion.ShapeList): |
96 | 95 | rr = region_file |
4 | 4 | import warnings |
5 | 5 | |
6 | 6 | import numpy as np |
7 | from astropy.extern import six | |
8 | 7 | from astropy import log |
9 | 8 | from astropy.io import fits |
10 | 9 | from astropy.coordinates import ICRS |
128 | 127 | except ImportError: |
129 | 128 | raise ImportError("The Python Imaging Library (PIL) is required to make an RGB image") |
130 | 129 | |
131 | if isinstance(data, six.string_types): | |
130 | if isinstance(data, str): | |
132 | 131 | |
133 | 132 | image = fits.getdata(data) |
134 | 133 | image_r = image[indices[0], :, :] |
237 | 236 | to the same projection. |
238 | 237 | |
239 | 238 | Two files are produced by this function. The first is a three-dimensional |
240 | FITS cube with a filename give by `output`, where the third dimension | |
239 | FITS cube with a filename give by ``output``, where the third dimension | |
241 | 240 | contains the different channels. The second is a two-dimensional FITS |
242 | image with a filename given by `output` with a `_2d` suffix. This file | |
241 | image with a filename given by ``output`` with a `_2d` suffix. This file | |
243 | 242 | contains the mean of the different channels, and is required as input to |
244 | 243 | FITSFigure if show_rgb is subsequently used to show a color image |
245 | 244 | generated from the FITS cube (to provide the correct WCS information to |
0 | 0 | from __future__ import absolute_import, print_function, division |
1 | 1 | |
2 | import pytest | |
2 | 3 | import numpy as np |
4 | ||
5 | try: | |
6 | import skimage # noqa | |
7 | except ImportError: | |
8 | SKIMAGE_INSTALLED = False | |
9 | else: | |
10 | SKIMAGE_INSTALLED = True | |
3 | 11 | |
4 | 12 | from .. import FITSFigure |
5 | 13 | |
6 | 14 | |
15 | @pytest.mark.skipif("not SKIMAGE_INSTALLED") | |
7 | 16 | def test_numpy_downsample(): |
8 | 17 | data = np.arange(256).reshape((16, 16)) |
9 | 18 | f = FITSFigure(data, downsample=2) |
232 | 232 | f.tick_labels.hide() |
233 | 233 | f.ticks.hide() |
234 | 234 | return f._figure |
235 | ||
236 | @pytest.mark.remote_data | |
237 | @pytest.mark.mpl_image_compare(style={}, savefig_kwargs={'adjust_bbox': False}, baseline_dir=baseline_dir, tolerance=5) | |
238 | def test_downsample(self): | |
239 | data = np.arange(256).reshape((16, 16)) | |
240 | f = FITSFigure(data, downsample=2) | |
241 | f.show_grayscale() | |
242 | return f._figure |
1 | 1 | |
2 | 2 | import os |
3 | 3 | import sys |
4 | from astropy.extern import six | |
5 | 4 | |
6 | 5 | from io import BytesIO as StringIO |
7 | 6 | |
15 | 14 | |
16 | 15 | |
17 | 16 | def is_format(filename, format): |
18 | if isinstance(filename, six.string_types): | |
17 | if isinstance(filename, str): | |
19 | 18 | f = open(filename, 'rb') |
20 | 19 | else: |
21 | 20 | f = filename |
0 | # Autogenerated by Astropy-affiliated package aplpy's setup.py on 2018-12-31 21:31:30 UTC | |
0 | # Autogenerated by Astropy-affiliated package aplpy's setup.py on 2019-02-17 11:50:54 UTC | |
1 | 1 | from __future__ import unicode_literals |
2 | 2 | import datetime |
3 | 3 | |
186 | 186 | |
187 | 187 | |
188 | 188 | _packagename = "aplpy" |
189 | _last_generated_version = "2.0rc2" | |
190 | _last_githash = "80493a087c524582c35f4f9159da6ee515d170a3" | |
189 | _last_generated_version = "2.0" | |
190 | _last_githash = "a3f9352a73debc7a0f9be1205c4c028873529f96" | |
191 | 191 | |
192 | 192 | # Determine where the source code for this module |
193 | 193 | # lives. If __file__ is not a filesystem path then |
210 | 210 | version_info = (major, minor, bugfix) |
211 | 211 | |
212 | 212 | release = True |
213 | timestamp = datetime.datetime(2018, 12, 31, 21, 31, 30) | |
213 | timestamp = datetime.datetime(2019, 2, 17, 11, 50, 54) | |
214 | 214 | debug = False |
215 | 215 | |
216 | astropy_helpers_version = "2.0" | |
216 | astropy_helpers_version = "3.1" | |
217 | 217 | |
218 | 218 | try: |
219 | 219 | from ._compiler import compiler |
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
Binary diff not shown
0 | # Autogenerated by Astropy-affiliated package astropy_helpers's setup.py on 2017-07-29 16:14:44.427577 | |
0 | # Autogenerated by Astropy-affiliated package astropy_helpers's setup.py on 2019-02-17 11:49:47 UTC | |
1 | 1 | from __future__ import unicode_literals |
2 | 2 | import datetime |
3 | 3 | |
4 | version = "2.0" | |
5 | githash = "ed2e7897862ae9e979b336df670d7a5541cdd8f0" | |
4 | version = "3.1" | |
5 | githash = "9f82aac6c2141b425e2d639560f7260189d90b54" | |
6 | 6 | |
7 | 7 | |
8 | major = 2 | |
9 | minor = 0 | |
8 | major = 3 | |
9 | minor = 1 | |
10 | 10 | bugfix = 0 |
11 | 11 | |
12 | version_info = (major, minor, bugfix) | |
13 | ||
12 | 14 | release = True |
13 | timestamp = datetime.datetime(2017, 7, 29, 16, 14, 44, 427577) | |
15 | timestamp = datetime.datetime(2019, 2, 17, 11, 49, 47) | |
14 | 16 | debug = False |
17 | ||
18 | astropy_helpers_version = "" | |
15 | 19 | |
16 | 20 | try: |
17 | 21 | from ._compiler import compiler |
0 | Metadata-Version: 1.1 | |
0 | Metadata-Version: 1.2 | |
1 | 1 | Name: astropy-helpers |
2 | Version: 2.0 | |
2 | Version: 3.1 | |
3 | 3 | Summary: Utilities for building and installing Astropy, Astropy affiliated packages, and their respective documentation. |
4 | 4 | Home-page: https://github.com/astropy/astropy-helpers |
5 | 5 | Author: The Astropy Developers |
8 | 8 | Description: astropy-helpers |
9 | 9 | =============== |
10 | 10 | |
11 | * Stable versions: https://pypi.org/project/astropy-helpers/ | |
12 | * Development version, issue tracker: https://github.com/astropy/astropy-helpers | |
11 | .. image:: https://travis-ci.org/astropy/astropy-helpers.svg | |
12 | :target: https://travis-ci.org/astropy/astropy-helpers | |
13 | ||
14 | .. image:: https://ci.appveyor.com/api/projects/status/rt9161t9mhx02xp7/branch/master?svg=true | |
15 | :target: https://ci.appveyor.com/project/Astropy/astropy-helpers | |
16 | ||
17 | .. image:: https://codecov.io/gh/astropy/astropy-helpers/branch/master/graph/badge.svg | |
18 | :target: https://codecov.io/gh/astropy/astropy-helpers | |
19 | ||
20 | **Warning:** Please note that version ``v3.0`` and later of ``astropy-helpers`` | |
21 | requires Python 3.5 or later. If you wish to maintain Python 2 support | |
22 | for your package that uses ``astropy-helpers``, then do not upgrade the | |
23 | helpers to ``v3.0+``. We will still provide Python 2.7 compatible | |
24 | releases on the ``v2.0.x`` branch during the lifetime of the ``astropy`` | |
25 | core package LTS of ``v2.0.x``. | |
26 | ||
27 | About | |
28 | ----- | |
13 | 29 | |
14 | 30 | This project provides a Python package, ``astropy_helpers``, which includes |
15 | 31 | many build, installation, and documentation-related tools used by the Astropy |
16 | 32 | project, but packaged separately for use by other projects that wish to |
17 | 33 | leverage this work. The motivation behind this package and details of its |
18 | implementation are in the accepted | |
34 | implementation are in the accepted | |
19 | 35 | `Astropy Proposal for Enhancement (APE) 4 <https://github.com/astropy/astropy-APEs/blob/master/APE4.rst>`_. |
20 | ||
21 | The ``astropy_helpers.extern`` sub-module includes modules developed elsewhere | |
22 | that are bundled here for convenience. At the moment, this consists of the | |
23 | following two sphinx extensions: | |
24 | ||
25 | * `numpydoc <https://github.com/numpy/numpydoc>`_, a Sphinx extension | |
26 | developed as part of the Numpy project. This is used to parse docstrings | |
27 | in Numpy format | |
28 | ||
29 | * `sphinx-automodapi <https://github.com/astropy/sphinx-automodapi>`_, a Sphinx | |
30 | developed as part of the Astropy project. This used to be developed directly | |
31 | in ``astropy-helpers`` but is now a standalone package. | |
32 | ||
33 | Issues with these sub-modules should be reported in their respective repositories, | |
34 | and we will regularly update the bundled versions to reflect the latest released | |
35 | versions. | |
36 | 36 | |
37 | 37 | ``astropy_helpers`` includes a special "bootstrap" module called |
38 | 38 | ``ah_bootstrap.py`` which is intended to be used by a project's setup.py in |
39 | 39 | order to ensure that the ``astropy_helpers`` package is available for |
40 | build/installation. This is similar to the ``ez_setup.py`` module that is | |
41 | shipped with some projects to bootstrap `setuptools | |
42 | <https://bitbucket.org/pypa/setuptools>`_. | |
43 | ||
44 | As described in APE4, the version numbers for ``astropy_helpers`` follow the | |
45 | corresponding major/minor version of the `astropy core package | |
46 | <http://www.astropy.org/>`_, but with an independent sequence of micro (bugfix) | |
47 | version numbers. Hence, the initial release is 0.4, in parallel with Astropy | |
48 | v0.4, which will be the first version of Astropy to use ``astropy-helpers``. | |
40 | build/installation. | |
41 | ||
42 | As described in `APE4 <https://github.com/astropy/astropy-APEs/blob/master/APE4.rst>`_, the version | |
43 | numbers for ``astropy_helpers`` follow the corresponding major/minor version of | |
44 | the `astropy core package <http://www.astropy.org/>`_, but with an independent | |
45 | sequence of micro (bugfix) version numbers. Hence, the initial release is 0.4, | |
46 | in parallel with Astropy v0.4, which will be the first version of Astropy to | |
47 | use ``astropy-helpers``. | |
49 | 48 | |
50 | 49 | For examples of how to implement ``astropy-helpers`` in a project, |
51 | see the ``setup.py`` and ``setup.cfg`` files of the | |
50 | see the ``setup.py`` and ``setup.cfg`` files of the | |
52 | 51 | `Affiliated package template <https://github.com/astropy/package-template>`_. |
53 | 52 | |
54 | .. image:: https://travis-ci.org/astropy/astropy-helpers.svg | |
55 | :target: https://travis-ci.org/astropy/astropy-helpers | |
56 | ||
57 | .. image:: https://coveralls.io/repos/astropy/astropy-helpers/badge.svg | |
58 | :target: https://coveralls.io/r/astropy/astropy-helpers | |
53 | What does astropy-helpers provide? | |
54 | ---------------------------------- | |
55 | ||
56 | Astropy-helpers' big-picture purpose is to provide customization to Python's | |
57 | packaging infrastructure process in ways that the Astropy Project has found to | |
58 | help simplifying the developint and releasing packages. This is primarily | |
59 | build around ``setup.py`` commands, as outlined below, as well as code to help | |
60 | manage version numbers and better control the build process of larger packages. | |
61 | ||
62 | Custom setup.py commands | |
63 | ^^^^^^^^^^^^^^^^^^^^^^^^ | |
64 | ||
65 | The main part of astropy-helpers is to provide customized setuptools commands. | |
66 | For example, in a package that uses astropy-helpers, the following command | |
67 | will be available:: | |
68 | ||
69 | python setup.py build_docs | |
70 | ||
71 | and this command is implemented in astropy-helpers. To use the custom | |
72 | commands described here, add:: | |
73 | ||
74 | from astropy_helpers.setup_helpers import register_commands | |
75 | ||
76 | to your ``setup.py`` file, then do:: | |
77 | ||
78 | cmdclassd = register_commands(NAME, VERSION, RELEASE) | |
79 | ||
80 | where ``NAME`` is the name of your package, ``VERSION`` is the full version | |
81 | string, and ``RELEASE`` is a boolean value indicating whether the version is | |
82 | a stable released version (``True``) or a developer version (``False``). | |
83 | Finally, pass ``cmdclassd`` to the ``setup`` function:: | |
84 | ||
85 | setup(..., | |
86 | cmdclass=cmdclassd) | |
87 | ||
88 | The commands we provide or customize are: | |
89 | ||
90 | **python setup.py test** | |
91 | ||
92 | This command will automatically build the package, install it to a temporary | |
93 | directory, and run the tests using `pytest <http://pytest.org/>`_ on this | |
94 | installed version. Note that the bulk of this command is actually defined | |
95 | in ``astropy.tests.command.AstropyTest``, because that allows the test | |
96 | machinery to operate outside a setuptools command. This, here we | |
97 | simply define the custom | |
98 | setuptools command. | |
99 | ||
100 | **python setup.py sdist** | |
101 | ||
102 | We redefine ``sdist`` to use the version from distutils rather than from | |
103 | setuptools, as the setuptools version requires duplication of information | |
104 | in ``MANIFEST.in``. | |
105 | ||
106 | **python setup.py build_docs** | |
107 | ||
108 | This command will automatically build the package, then run sphinx to build | |
109 | the documentation. This makes development much easier because it ensures | |
110 | sphinx extensions that use the package's code to make documentation are | |
111 | actually using the in-development version of the code. Sphinx itself | |
112 | provides a custom setuptools command, which we | |
113 | expand with the following options: | |
114 | ||
115 | * ``-w``: set the return code to 1 if there are any warnings during the build | |
116 | process. | |
117 | ||
118 | * ``-l``: completely clean previous builds, including files generated by | |
119 | the sphinx-automodapi package (which creates API pages for different | |
120 | functions/classes). | |
121 | ||
122 | * ``-n``: disable the intersphinx option. | |
123 | ||
124 | * ``-o``: open the documentation in a browser if a build finishes successfully. | |
125 | ||
126 | In addition, ``build_docs`` will automatically download and temporarily install | |
127 | sphinx-astropy (which is a meta-package that | |
128 | provides standardized configuration and documentation dependencies for astropy | |
129 | packages) if it isn't already installed. Temporary installation means that the | |
130 | package will be installed into an ``.eggs`` directory in the current working | |
131 | directory, and it will only be available for the duration of the call to | |
132 | ``build_docs``. | |
133 | ||
134 | **python setup.py build_ext** | |
135 | ||
136 | This is also used when running ``build`` or ``install``. We add several features | |
137 | compared to the default ``build_ext`` command: | |
138 | ||
139 | * For packages with C/Cython extensions, we create a ``packagename._compiler`` | |
140 | submodule that contains information about the compilers used. | |
141 | ||
142 | * Packages that need to build C extensions using the Numpy C API, we allow | |
143 | those packages to define the include path as ``'numpy'`` as opposed to having | |
144 | to import Numpy and call ``get_include``. The goal is to solve the issue that | |
145 | if one has to import Numpy to define extensions, then Numpy has to be | |
146 | installed/available before the package is installed, which means that one | |
147 | needs to install Numpy in a separate installation step. | |
148 | ||
149 | * We detect broken compilers and replace them with other compilers on-the-fly | |
150 | unless the compiler is explicitly specified with the ``CC`` environment | |
151 | variable. | |
152 | ||
153 | * If Cython is not installed, then we automatically check for generated C files | |
154 | (which are normally present in the stable releases) and give a nice error | |
155 | if these are not found. | |
156 | ||
157 | Version helpers | |
158 | ^^^^^^^^^^^^^^^^ | |
159 | ||
160 | Another piece of functionality we provide in astropy-helpers is the ability | |
161 | to generate a ``packagename.version`` file that includes functions that | |
162 | automatically set the version string for developer versions, to e.g. | |
163 | ``3.2.dev22213`` so that each developer version has a unique number (although | |
164 | note that branches an equal number of commits away from the master branch will | |
165 | share the same version number). To use this, import:: | |
166 | ||
167 | from astropy_helpers.git_helpers import get_git_devstr | |
168 | ||
169 | in your ``setup.py`` file, and you will then be able to use:: | |
170 | ||
171 | VERSION += get_git_devstr() | |
172 | ||
173 | where ``VERSION`` is a version string without any developer version suffix. | |
174 | ||
175 | We then also provide a function that generates a ``version.py`` file inside your | |
176 | package (which can then be imported as ``packagename.version``) that contains | |
177 | variables such as ``major``, ``minor``, and ``bugfix``, as well as | |
178 | ``version_info`` (a tuple of the previous three values), a ``release`` flag that | |
179 | indicates whether we are using a stable release, and several other complementary | |
180 | variables. To use this, import:: | |
181 | ||
182 | from astropy_helpers.version_helpers import generate_version_py | |
183 | ||
184 | in your ``setup.py`` file, and call:: | |
185 | ||
186 | generate_version_py(NAME, VERSION, RELEASE, uses_git=not RELEASE) | |
187 | ||
188 | where ``NAME`` is the name of your package, ``VERSION`` is the full version string | |
189 | (including any developer suffix), ``RELEASE`` indicates whether the version is a | |
190 | stable or developer version, and ``uses_git`` indicates whether we are in a git | |
191 | repository (using ``not RELEASE`` is sensible since git is not available in a | |
192 | stable release). | |
193 | ||
194 | Collecting package information | |
195 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
196 | ||
197 | The ``setup`` function from setuptools can take a number of options that indicate | |
198 | for example what extensions to build, and what package data to include. However, | |
199 | for large packages this can become cumbersome. We therefore provide a mechanism | |
200 | for defining extensions and package data inside individual sub-packages. To do | |
201 | this, you can create ``setup_package.py`` files anywhere in your package, and | |
202 | these files can include one or more of the following functions: | |
203 | ||
204 | * ``get_package_data``: | |
205 | This function, if defined, should return a dictionary mapping the name of | |
206 | the subpackage(s) that need package data to a list of data file paths | |
207 | (possibly including wildcards) relative to the path of the package's source | |
208 | code. e.g. if the source distribution has a needed data file | |
209 | ``astropy/wcs/tests/data/3d_cd.hdr``, this function should return | |
210 | ``{'astropy.wcs.tests':['data/3d_cd.hdr']}``. See the ``package_data`` | |
211 | option of the :func:`distutils.core.setup` function. | |
212 | ||
213 | It is recommended that all such data be in a directory named ``data`` inside | |
214 | the package within which it is supposed to be used. This package data | |
215 | should be accessed via the ``astropy.utils.data.get_pkg_data_filename`` and | |
216 | ``astropy.utils.data.get_pkg_data_fileobj`` functions. | |
217 | ||
218 | * ``get_extensions``: | |
219 | This provides information for building C or Cython extensions. If defined, | |
220 | it should return a list of ``distutils.core.Extension`` objects. | |
221 | ||
222 | * ``get_build_options``: | |
223 | This function allows a package to add extra build options. It | |
224 | should return a list of tuples, where each element has: | |
225 | ||
226 | - *name*: The name of the option as it would appear on the | |
227 | commandline or in the ``setup.cfg`` file. | |
228 | ||
229 | - *doc*: A short doc string for the option, displayed by | |
230 | ``setup.py build --help``. | |
231 | ||
232 | - *is_bool* (optional): When `True`, the option is a boolean | |
233 | option and doesn't have an associated value. | |
234 | ||
235 | Once an option has been added, its value can be looked up using | |
236 | ``astropy_helpers.setup_helpers.get_distutils_build_option``. | |
237 | ||
238 | * ``get_external_libraries``: | |
239 | This function declares that the package uses libraries that are | |
240 | included in the astropy distribution that may also be distributed | |
241 | elsewhere on the users system. It should return a list of library | |
242 | names. For each library, a new build option is created, | |
243 | ``'--use-system-X'`` which allows the user to request to use the | |
244 | system's copy of the library. The package would typically call | |
245 | ``astropy_helpers.setup_helpers.use_system_library`` from its | |
246 | ``get_extensions`` function to determine if the package should use | |
247 | the system library or the included one. | |
248 | ||
249 | * ``get_entry_points()``: | |
250 | This function can returns a dict formatted as required by | |
251 | the ``entry_points`` argument to ``setup()``. | |
252 | ||
253 | With these files in place, you can then add the following to your ``setup.py`` | |
254 | file:: | |
255 | ||
256 | from astropy_helpers.setup_helpers import get_package_info | |
257 | ||
258 | ... | |
259 | ||
260 | package_info = get_package_info() | |
261 | ||
262 | ... | |
263 | ||
264 | setup(..., **package_info) | |
265 | ||
266 | OpenMP helpers | |
267 | ^^^^^^^^^^^^^^ | |
268 | ||
269 | We provide a helper function ``add_openmp_flags_if_available`` that can be used | |
270 | to automatically add OpenMP flags for C/Cython extensions, based on whether | |
271 | OpenMP is available and produces executable code. To use this, edit the | |
272 | ``setup_package.py`` file where you define a C extension, import the helper | |
273 | function:: | |
274 | ||
275 | from astropy_helpers.openmp_helpers import add_openmp_flags_if_available | |
276 | ||
277 | then once you have defined the extension and before returning it, use it as:: | |
278 | ||
279 | extension = Extension(...) | |
280 | ||
281 | add_openmp_flags_if_available(extension) | |
282 | ||
283 | return [extension] | |
284 | ||
285 | Using astropy-helpers | |
286 | --------------------- | |
287 | ||
288 | The easiest way to get set up with astropy-helpers in a new package is to use | |
289 | the `package-template <http://docs.astropy.org/projects/package-template>`_ | |
290 | that we provide. This template is specifically designed for use with the helpers, | |
291 | so using it avoids some of the tedium of setting up the heleprs. | |
292 | ||
293 | However, we now go through the steps of adding astropy-helpers | |
294 | as a submodule to a package in case you wish to do so manually. First, add | |
295 | astropy-helpers as a submodule at the root of your repository:: | |
296 | ||
297 | git submodule add git://github.com/astropy/astropy-helpers astropy_helpers | |
298 | ||
299 | Then go inside the submodule and check out a stable version of astropy-helpers. | |
300 | You can see the available versions by running:: | |
301 | ||
302 | $ cd astropy_helpers | |
303 | $ git tag | |
304 | ... | |
305 | v2.0.6 | |
306 | v2.0.7 | |
307 | ... | |
308 | v3.0.1 | |
309 | v3.0.2 | |
310 | ||
311 | If you want to support Python 2, pick the latest v2.0.x version (in the above | |
312 | case ``v2.0.7``) and if you don't need to support Python 2, just pick the latest | |
313 | stable version (in the above case ``v3.0.2``). Check out this version with e.g.:: | |
314 | ||
315 | $ git checkout v3.0.2 | |
316 | ||
317 | Then go back up to the root of your repository and copy the ``ah_bootstrap.py`` | |
318 | file from the submodule to the root of your repository:: | |
319 | ||
320 | $ cd .. | |
321 | $ cp astropy_helpers/ah_bootstrap.py . | |
322 | ||
323 | Finally, add:: | |
324 | ||
325 | import ah_bootstrap | |
326 | ||
327 | at the top of your ``setup.py`` file. This will ensure that ``astropy_helpers`` | |
328 | is now available to use in your ``setup.py`` file. Finally, add then commit your | |
329 | changes:: | |
330 | ||
331 | git add astropy_helpers ah_bootstrap.py setup.py | |
332 | git commit -m "Added astropy-helpers" | |
333 | ||
334 | Updating astropy-helpers | |
335 | ------------------------ | |
336 | ||
337 | If you would like the Astropy team to automatically open pull requests to update | |
338 | astropy-helpers in your package, then see the instructions `here | |
339 | <https://github.com/astropy/astropy-procedures/blob/master/update-packages/README.md>`_. | |
340 | ||
341 | To instead update astropy-helpers manually, go inside the submodule and do:: | |
342 | ||
343 | cd astropy_helpers | |
344 | git fetch origin | |
345 | ||
346 | Then checkout the version you want to use, e.g.:: | |
347 | ||
348 | git checkout v3.0.3 | |
349 | ||
350 | Go back up to the root of the repository and update the ``ah_bootstap.py`` file | |
351 | too, then add your changes:: | |
352 | ||
353 | cp astropy_helpers/ah_bootstrap.py . | |
354 | git add astropy_helpers ah_bootstrap.py | |
355 | git commit ... | |
59 | 356 | |
60 | 357 | Platform: UNKNOWN |
61 | 358 | Classifier: Development Status :: 5 - Production/Stable |
70 | 367 | Classifier: Topic :: Software Development :: Build Tools |
71 | 368 | Classifier: Topic :: Software Development :: Libraries :: Python Modules |
72 | 369 | Classifier: Topic :: System :: Archiving :: Packaging |
370 | Requires-Python: >=3.5 |
2 | 2 | MANIFEST.in |
3 | 3 | README.rst |
4 | 4 | ah_bootstrap.py |
5 | ez_setup.py | |
6 | 5 | setup.cfg |
7 | 6 | setup.py |
8 | 7 | astropy_helpers/__init__.py |
8 | astropy_helpers/conftest.py | |
9 | 9 | astropy_helpers/distutils_helpers.py |
10 | 10 | astropy_helpers/git_helpers.py |
11 | astropy_helpers/openmp_helpers.py | |
11 | 12 | astropy_helpers/setup_helpers.py |
12 | astropy_helpers/test_helpers.py | |
13 | 13 | astropy_helpers/utils.py |
14 | 14 | astropy_helpers/version.py |
15 | 15 | astropy_helpers/version_helpers.py |
20 | 20 | astropy_helpers.egg-info/top_level.txt |
21 | 21 | astropy_helpers/commands/__init__.py |
22 | 22 | astropy_helpers/commands/_dummy.py |
23 | astropy_helpers/commands/_test_compat.py | |
24 | 23 | astropy_helpers/commands/build_ext.py |
25 | astropy_helpers/commands/build_py.py | |
26 | 24 | astropy_helpers/commands/build_sphinx.py |
27 | astropy_helpers/commands/install.py | |
28 | astropy_helpers/commands/install_lib.py | |
29 | astropy_helpers/commands/register.py | |
30 | 25 | astropy_helpers/commands/setup_package.py |
31 | 26 | astropy_helpers/commands/test.py |
32 | 27 | astropy_helpers/commands/src/compiler.c |
33 | astropy_helpers/compat/__init__.py | |
34 | astropy_helpers/extern/__init__.py | |
35 | astropy_helpers/extern/setup_package.py | |
36 | astropy_helpers/extern/automodapi/__init__.py | |
37 | astropy_helpers/extern/automodapi/autodoc_enhancements.py | |
38 | astropy_helpers/extern/automodapi/automodapi.py | |
39 | astropy_helpers/extern/automodapi/automodsumm.py | |
40 | astropy_helpers/extern/automodapi/smart_resolver.py | |
41 | astropy_helpers/extern/automodapi/utils.py | |
42 | astropy_helpers/extern/automodapi/templates/autosummary_core/base.rst | |
43 | astropy_helpers/extern/automodapi/templates/autosummary_core/class.rst | |
44 | astropy_helpers/extern/automodapi/templates/autosummary_core/module.rst | |
45 | astropy_helpers/extern/numpydoc/__init__.py | |
46 | astropy_helpers/extern/numpydoc/docscrape.py | |
47 | astropy_helpers/extern/numpydoc/docscrape_sphinx.py | |
48 | astropy_helpers/extern/numpydoc/linkcode.py | |
49 | astropy_helpers/extern/numpydoc/numpydoc.py | |
50 | 28 | astropy_helpers/sphinx/__init__.py |
51 | 29 | astropy_helpers/sphinx/conf.py |
52 | astropy_helpers/sphinx/setup_package.py | |
53 | astropy_helpers/sphinx/ext/__init__.py | |
54 | astropy_helpers/sphinx/ext/changelog_links.py | |
55 | astropy_helpers/sphinx/ext/doctest.py | |
56 | astropy_helpers/sphinx/ext/edit_on_github.py | |
57 | astropy_helpers/sphinx/ext/tocdepthfix.py | |
58 | astropy_helpers/sphinx/ext/tests/__init__.py | |
59 | astropy_helpers/sphinx/local/python2_local_links.inv | |
60 | astropy_helpers/sphinx/local/python3_local_links.inv | |
61 | astropy_helpers/sphinx/themes/bootstrap-astropy/globaltoc.html | |
62 | astropy_helpers/sphinx/themes/bootstrap-astropy/layout.html | |
63 | astropy_helpers/sphinx/themes/bootstrap-astropy/localtoc.html | |
64 | astropy_helpers/sphinx/themes/bootstrap-astropy/searchbox.html | |
65 | astropy_helpers/sphinx/themes/bootstrap-astropy/theme.conf | |
66 | astropy_helpers/sphinx/themes/bootstrap-astropy/static/astropy_linkout.svg | |
67 | astropy_helpers/sphinx/themes/bootstrap-astropy/static/astropy_linkout_20.png | |
68 | astropy_helpers/sphinx/themes/bootstrap-astropy/static/astropy_logo.ico | |
69 | astropy_helpers/sphinx/themes/bootstrap-astropy/static/astropy_logo.svg | |
70 | astropy_helpers/sphinx/themes/bootstrap-astropy/static/astropy_logo_32.png | |
71 | astropy_helpers/sphinx/themes/bootstrap-astropy/static/bootstrap-astropy.css | |
72 | astropy_helpers/sphinx/themes/bootstrap-astropy/static/copybutton.js | |
73 | astropy_helpers/sphinx/themes/bootstrap-astropy/static/sidebar.js | |
74 | licenses/LICENSE_COPYBUTTON.rst | |
75 | licenses/LICENSE_NUMPYDOC.rst⏎ | |
30 | licenses/LICENSE_ASTROSCRAPPY.rst⏎ |
148 | 148 | |
149 | 149 | edit_on_github_source_root = "" |
150 | 150 | edit_on_github_doc_root = "docs" |
151 | ||
152 | # Use nitpicky mode to avoid broken links in docs | |
153 | nitpicky = True | |
154 | nitpick_ignore = [('py:class', 'aplpy.layers.Layers'), | |
155 | ('py:class', 'aplpy.regions.Regions')] |
11 | 11 | latitudes, and arbitrary scalar values, APLpy keeps track of the axis |
12 | 12 | coordinate 'type' for each axis, and will try and guess these based on the |
13 | 13 | header. However, it is possible to explicitly specify the coordinate type with |
14 | the :meth:`~aplpy.aplpy.FITSFigure.set_xaxis_coord_type` and :meth:`~aplpy.aplpy.FITSFigure.set_yaxis_coord_type` methods in the | |
15 | :class:`~aplpy.aplpy.FITSFigure` object:: | |
14 | the :meth:`~aplpy.FITSFigure.set_xaxis_coord_type` and :meth:`~aplpy.FITSFigure.set_yaxis_coord_type` methods in the | |
15 | :class:`~aplpy.FITSFigure` object:: | |
16 | 16 | |
17 | 17 | f = FITSFigure('2MASS_k.fits') |
18 | 18 | f.set_xaxis_coord_type('scalar') |
57 | 57 | |
58 | 58 | When plotting images in sky coordinates, APLpy makes pixel square by default, |
59 | 59 | but it is possible to change this, which can be useful for non-sky |
60 | coordinates. When calling :meth:`~aplpy.aplpy.FITSFigure.show_grayscale` or | |
61 | :meth:`~aplpy.aplpy.FITSFigure.show_colorscale`, simply add ``aspect='auto'`` | |
60 | coordinates. When calling :meth:`~aplpy.FITSFigure.show_grayscale` or | |
61 | :meth:`~aplpy.FITSFigure.show_colorscale`, simply add ``aspect='auto'`` | |
62 | 62 | which will override the ``aspect='equal'`` default.⏎ |
10 | 10 | f = aplpy.FITSFigure('example.jpg') |
11 | 11 | f.show_rgb() |
12 | 12 | |
13 | Note that no filename is required for :meth:`~aplpy.aplpy.FITSFigure.show_rgb` | |
13 | Note that no filename is required for :meth:`~aplpy.FITSFigure.show_rgb` | |
14 | 14 | in this case. |
15 | 15 | |
16 | If PyAVM is installed, :func:`~aplpy.rgb.make_rgb_image` can embed AVM | |
16 | If PyAVM is installed, :func:`~aplpy.make_rgb_image` can embed AVM | |
17 | 17 | meta-data into RGB images it creates, although only JPEG and PNG files support |
18 | 18 | this:: |
19 | 19 | |
28 | 28 | f.show_rgb() |
29 | 29 | |
30 | 30 | In other words, this means that when creating an RGB image with APLpy, it is |
31 | no longer necessary to initialize :class:`~aplpy.aplpy.FITSFigure` with a FITS | |
32 | file and then use :meth:`~aplpy.aplpy.FITSFigure.show_rgb` with the RGB image | |
33 | filename - instead, :class:`~aplpy.aplpy.FITSFigure` can be directly | |
31 | no longer necessary to initialize :class:`~aplpy.FITSFigure` with a FITS | |
32 | file and then use :meth:`~aplpy.FITSFigure.show_rgb` with the RGB image | |
33 | filename - instead, :class:`~aplpy.FITSFigure` can be directly | |
34 | 34 | initialized with the AVM-tagged image. |
35 | 35 | |
36 | 36 | To disable the embedding of AVM tags, you can use the ``embed_avm_tags=False`` |
37 | option for :func:`~aplpy.rgb.make_rgb_image`. | |
37 | option for :func:`~aplpy.make_rgb_image`. | |
38 | 38 | |
39 | 39 | These features require `PyAVM 0.9.1 <http://astrofrog.github.io/pyavm/>`_ |
40 | 40 | or later. Please report any issues you encounter `here |
0 | 0 | Creating subplots |
1 | 1 | ----------------- |
2 | 2 | |
3 | By default, :class:`~aplpy.aplpy.FITSFigure` creates a figure with a single | |
3 | By default, :class:`~aplpy.FITSFigure` creates a figure with a single | |
4 | 4 | subplot that occupies the entire figure. However, APLpy can be used to place a |
5 | 5 | subplot in an existing matplotlib figure instance. To do this, |
6 | :class:`~aplpy.aplpy.FITSFigure` should be called with the ``figure=`` | |
6 | :class:`~aplpy.FITSFigure` should be called with the ``figure=`` | |
7 | 7 | argument as follows:: |
8 | 8 | |
9 | 9 | import aplpy |
8 | 8 | this page, these are given in the form of example values. In |
9 | 9 | addition, not all of the optional keywords are mentioned here. |
10 | 10 | For more information on a specific command and all the options |
11 | available, type ``help`` followed by the method name, e.g. ``help | |
12 | fig.show_grayscale``. When multiple optional arguments are given, | |
13 | this does not mean that all of them have to be specified, but | |
11 | available, use the ``help()`` function, e.g. | |
12 | ``help(fig.show_grayscale)``. When multiple optional arguments are | |
13 | given, this does not mean that all of them have to be specified, but | |
14 | 14 | just shows all the options available. |
15 | 15 | |
16 | 16 | Introduction |
144 | 144 | fig.add_colorbar() |
145 | 145 | fig.remove_colorbar() |
146 | 146 | |
147 | Once :meth:`~aplpy.aplpy.FITSFigure.add_colorbar` has been called, the ``fig.colorbar`` object is created and the following methods are then available: | |
147 | Once :meth:`~aplpy.FITSFigure.add_colorbar` has been called, the ``fig.colorbar`` object is created and the following methods are then available: | |
148 | 148 | |
149 | 149 | * Show and hide the colorbar:: |
150 | 150 | |
195 | 195 | fig.add_grid() |
196 | 196 | fig.remove_grid() |
197 | 197 | |
198 | Once :meth:`~aplpy.aplpy.FITSFigure.add_grid` has been called, the ``fig.grid`` object is created and the following methods are then available: | |
198 | Once :meth:`~aplpy.FITSFigure.add_grid` has been called, the ``fig.grid`` object is created and the following methods are then available: | |
199 | 199 | |
200 | 200 | * Show and hide the grid:: |
201 | 201 | |
228 | 228 | fig.add_scalebar() |
229 | 229 | fig.remove_scalebar() |
230 | 230 | |
231 | Once :meth:`~aplpy.aplpy.FITSFigure.add_scalebar` has been called, the ``fig.scalebar`` object is created and the following methods are then available: | |
231 | Once :meth:`~aplpy.FITSFigure.add_scalebar` has been called, the ``fig.scalebar`` object is created and the following methods are then available: | |
232 | 232 | |
233 | 233 | * Show and hide the scalebar:: |
234 | 234 | |
290 | 290 | fig.add_beam() |
291 | 291 | fig.remove_beam() |
292 | 292 | |
293 | Once :meth:`~aplpy.aplpy.FITSFigure.add_beam` has been called, the ``fig.beam`` object is created and the following methods are then available: | |
293 | Once :meth:`~aplpy.FITSFigure.add_beam` has been called, the ``fig.beam`` object is created and the following methods are then available: | |
294 | 294 | |
295 | 295 | * Show and hide the beam:: |
296 | 296 |
19 | 19 | |
20 | 20 | import aplpy |
21 | 21 | |
22 | To start off, use the :class:`~aplpy.aplpy.FITSfigure` class to create a | |
22 | To start off, use the :class:`~aplpy.FITSFigure` class to create a | |
23 | 23 | canvas to where your data will be plotted:: |
24 | 24 | |
25 | 25 | gc = aplpy.FITSFigure('fits/2MASS_k.fits') |
48 | 48 | gc.show_colorscale(cmap='gist_heat') |
49 | 49 | |
50 | 50 | to show the image showing a 'heat' map. You can find more information in the |
51 | :meth:`~aplpy.aplpy.FITSFigure.show_grayscale` and | |
52 | :meth:`~aplpy.aplpy.FITSFigure.show_colorscale` documentation. For | |
51 | :meth:`~aplpy.FITSFigure.show_grayscale` and | |
52 | :meth:`~aplpy.FITSFigure.show_colorscale` documentation. For | |
53 | 53 | example, you can control the minimum and maximum pixel values to show and the |
54 | 54 | stretch function to use. |
55 | 55 | |
73 | 73 | |
74 | 74 | gc.show_contour('fits/mips_24micron.fits', colors='white') |
75 | 75 | |
76 | There are a number of arguments that can be passed to :meth:`~aplpy.aplpy.FITSFigure.show_contour` to | |
76 | There are a number of arguments that can be passed to :meth:`~aplpy.FITSFigure.show_contour` to | |
77 | 77 | control the appearance of the contours as well as the number of levels to |
78 | show. For more information, see the see the :meth:`~aplpy.aplpy.FITSFigure.show_contour` documentation. | |
78 | show. For more information, see the see the :meth:`~aplpy.FITSFigure.show_contour` documentation. | |
79 | 79 | |
80 | 80 | Display a coordinate grid using:: |
81 | 81 | |
90 | 90 | or numpy arrays that are already defined:: |
91 | 91 | |
92 | 92 | import numpy |
93 | data = numpy.loadtxt('data/yso_wcs_only.txt') | |
94 | ra, dec = data[:, 0], data[:, 1] | |
93 | ra, dec = numpy.loadtxt('data/yso_wcs_only.txt', unpack=True) | |
95 | 94 | gc.show_markers(ra, dec, edgecolor='green', facecolor='none', |
96 | 95 | marker='o', s=10, alpha=0.5) |
97 | 96 | |
98 | For more information, see the :meth:`~aplpy.aplpy.FITSFigure.show_markers` | |
97 | For more information, see the :meth:`~aplpy.FITSFigure.show_markers` | |
99 | 98 | documentation. |
100 | 99 | |
101 | 100 | It's often the case that you might want to change the look of a contour or |
102 | markers, but if you run :meth:`~aplpy.aplpy.FITSFigure.show_contour` or :meth:`~aplpy.aplpy.FITSFigure.show_markers` a second time, it | |
101 | markers, but if you run :meth:`~aplpy.FITSFigure.show_contour` or :meth:`~aplpy.FITSFigure.show_markers` a second time, it | |
103 | 102 | will overplot rather than replacing. To solve this problem APLpy has 'layers' |
104 | 103 | which can be manipulated in a basic way. Type:: |
105 | 104 | |
112 | 111 | -> contour_set_1 |
113 | 112 | -> marker_set_1 |
114 | 113 | |
115 | You can use :meth:`~aplpy.aplpy.FITSFigure.remove_layer`, :meth:`~aplpy.aplpy.FITSFigure.hide_layer`, and :meth:`~aplpy.aplpy.FITSFigure.show_layer` to manipulate | |
114 | You can use :meth:`~aplpy.FITSFigure.remove_layer`, :meth:`~aplpy.FITSFigure.hide_layer`, and :meth:`~aplpy.FITSFigure.show_layer` to manipulate | |
116 | 115 | the layers, and you can also specify the ``layer=name`` argument to |
117 | :meth:`~aplpy.aplpy.FITSFigure.show_contour` or :meth:`~aplpy.aplpy.FITSFigure.show_markers`. Using the latter forces APLpy to name | |
116 | :meth:`~aplpy.FITSFigure.show_contour` or :meth:`~aplpy.FITSFigure.show_markers`. Using the latter forces APLpy to name | |
118 | 117 | the layer you are creating with the name provided, and can also be used to |
119 | 118 | replace an existing layer. For example, let's change the color of the markers |
120 | 119 | from green to red:: |
123 | 122 | facecolor='none', marker='o', s=10, alpha=0.5) |
124 | 123 | |
125 | 124 | Note the presence of the ``layer='marker_set_1'`` which means that the |
126 | current markers plot will be replaced. To view active layers, you can use the :meth:`~aplpy.aplpy.FITSFigure.list_layers` documentation. | |
125 | current markers plot will be replaced. To view active layers, you can use the :meth:`~aplpy.FITSFigure.list_layers` documentation. | |
127 | 126 | |
128 | 127 | To wrap up this tutorial, we will save the plot to a file. Type the following:: |
129 | 128 | |
148 | 147 | |
149 | 148 | gc.show_contour('fits/mips_24micron.fits', colors='white') |
150 | 149 | |
151 | data = numpy.loadtxt('data/yso_wcs_only.txt') | |
152 | ra, dec = data[:, 0], data[:, 1] | |
150 | ra, dec = numpy.loadtxt('data/yso_wcs_only.txt', unpack=True) | |
153 | 151 | |
154 | 152 | gc.show_markers(ra, dec, layer='marker_set_1', edgecolor='red', |
155 | 153 | facecolor='none', marker='o', s=10, alpha=0.5) |
5 | 5 | |
6 | 6 | APLpy supports extracting a slice from n-dimensional FITS cubes, and |
7 | 7 | re-ordering dimensions. The two key arguments to |
8 | :class:`~aplpy.aplpy.FITSFigure` to control this are ``dimensions`` and | |
9 | ``slices``. These arguments can also be passed to :meth:`~aplpy.aplpy.FITSFigure.show_contour`. | |
8 | :class:`~aplpy.FITSFigure` to control this are ``dimensions`` and | |
9 | ``slices``. These arguments can also be passed to :meth:`~aplpy.FITSFigure.show_contour`. | |
10 | 10 | |
11 | 11 | The ``dimensions`` argument is used to specify which dimensions should be used |
12 | 12 | for the x- and y-axis respectively (zero based). The default values are ``[0, |
43 | 43 | |
44 | 44 | When plotting images in sky coordinates, APLpy makes pixel square by default, |
45 | 45 | but it is possible to change this. When calling |
46 | :meth:`~aplpy.aplpy.FITSFigure.show_grayscale` or | |
47 | :meth:`~aplpy.aplpy.FITSFigure.show_colorscale`, simply add ``aspect='auto'`` | |
46 | :meth:`~aplpy.FITSFigure.show_grayscale` or | |
47 | :meth:`~aplpy.FITSFigure.show_colorscale`, simply add ``aspect='auto'`` | |
48 | 48 | which will override the ``aspect='equal'`` default. The ``aspect='auto'`` is |
49 | 49 | demonstrated below. |
50 | 50 |
9 | 9 | If you are starting from three images with different projections/resolutions, |
10 | 10 | the first step is to reproject these to a common projection/resolution. The |
11 | 11 | following code shows how this can be done using the |
12 | :func:`~aplpy.rgb.make_rgb_cube` function:: | |
12 | :func:`~aplpy.make_rgb_cube` function:: | |
13 | 13 | |
14 | 14 | aplpy.make_rgb_cube(['2mass_k.fits', '2mass_h.fits', |
15 | 15 | '2mass_j.fits'], '2mass_cube.fits') |
23 | 23 | Producing an RGB image from images in a common projection |
24 | 24 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
25 | 25 | |
26 | The :func:`~aplpy.rgb.make_rgb_image` function can be used to produce an RGB | |
26 | The :func:`~aplpy.make_rgb_image` function can be used to produce an RGB | |
27 | 27 | image from either three FITS files in the exact same projection, or a FITS cube |
28 | 28 | containing the three channels (such as that output by |
29 | :func:`~aplpy.rgb.make_rgb_cube`). The following example illustrates how to do | |
29 | :func:`~aplpy.make_rgb_cube`). The following example illustrates how to do | |
30 | 30 | this:: |
31 | 31 | |
32 | 32 | aplpy.make_rgb_image('2mass_cube.fits','2mass_rgb.png') |
58 | 58 | |
59 | 59 | On the other hand, if you are not able to use PyAVM, or need to use a format |
60 | 60 | other than JPEG or PNG, then you need to instantiate the |
61 | :class:`~aplpy.aplpy.FITSFigure` class with a FITS file with exactly the same | |
62 | dimensions and WCS as the RGB image. The :func:`~aplpy.rgb.make_rgb_cube` | |
61 | :class:`~aplpy.FITSFigure` class with a FITS file with exactly the same | |
62 | dimensions and WCS as the RGB image. The :func:`~aplpy.make_rgb_cube` | |
63 | 63 | function will in fact produce a file with the same name as the main output, but |
64 | 64 | including a ``_2d`` suffix, and this can be used to instantiate |
65 | :class:`~aplpy.aplpy.FITSFigure`:: | |
65 | :class:`~aplpy.FITSFigure`:: | |
66 | 66 | |
67 | 67 | # Reproject the images to a common projection - this will also |
68 | 68 | # produce 2mass_cube_2d.fits |
21 | 21 | [metadata] |
22 | 22 | package_name = aplpy |
23 | 23 | description = The Astronomical Plotting Library in Python |
24 | long_description = The Astronomical Plotting Library in Python | |
25 | 24 | author = Thomas Robitaille and Eli Bressert |
26 | 25 | author_email = thomas.robitaille@gmail.com, elibre@users.sourceforge.net |
27 | 26 | license = MIT |
30 | 29 | github_project = aplpy/aplpy |
31 | 30 | install_requires = numpy, astropy>=3.1, matplotlib>=2.0, reproject>=0.4 |
32 | 31 | # version should be PEP440 compatible (https://www.python.org/dev/peps/pep-0440/) |
33 | version = 2.0rc2 | |
32 | version = 2.0 | |
34 | 33 | |
35 | 34 | [options.extras_require] |
36 | 35 | docs = sphinx-astropy |