forked from astropy/astropy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_docutil.py
More file actions
58 lines (42 loc) · 1.57 KB
/
Copy path_docutil.py
File metadata and controls
58 lines (42 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""
astropy.wcs-specific utilities for generating boilerplate in docstrings.
"""
from __future__ import division # confidence high
__all__ = ['TWO_OR_THREE_ARGS', 'RETURNS', 'ORIGIN', 'RA_DEC_ORDER']
def _fix(content, indent=0):
lines = content.split('\n')
indent = '\n' + ' ' * indent
return indent.join(lines)
def TWO_OR_THREE_ARGS(naxis, indent=0):
return _fix(
"""args : flexible
Either two or three arguments may be provided.
- 2 arguments: An *N* x *{0}* array of *x*- and
*y*-coordinates, and an *origin*.
- 3 arguments: 2 one-dimensional arrays of *x* and *y*
coordinates, and an *origin*.
Here, *origin* is the coordinate in the upper left corner of the
image. In FITS and Fortran standards, this is 1. In Numpy and C
standards this is 0.
""".format(naxis), indent)
def RETURNS(out_type, indent=0):
return _fix("""result : array
Returns the {0}. If the input was a single array and
origin, a single array is returned, otherwise a tuple of arrays is
returned.""".format(out_type), indent)
def ORIGIN(indent=0):
return _fix(
"""
origin : int
Specifies the origin of pixel values. The Fortran and FITS
standards use an origin of 1. Numpy and C use array indexing with
origin at 0.
""", indent)
def RA_DEC_ORDER(indent=0):
return _fix(
"""
ra_dec_order : bool, optional
When `True` will ensure that world coordinates are always given
and returned in as (*ra*, *dec*) pairs, regardless of the order of
the axes specified by the in the ``CTYPE`` keywords.
""", indent)