Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions astropy/config/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,9 @@ def reload(self):

Returns
-------
val
val : object
The new value loaded from the configuration file.

"""
self.set(self.defaultvalue)
baseobj = get_config(self.module, True, rootname=self.rootname)
Expand Down Expand Up @@ -406,14 +407,15 @@ def __call__(self):

Returns
-------
val
val : object
This item's value, with a type determined by the ``cfgtype``
attribute.

Raises
------
TypeError
If the configuration value as stored is not this item's type.

"""
def section_name(section):
if section == '':
Expand Down Expand Up @@ -599,7 +601,7 @@ def generate_config(pkgname='astropy', filename=None, verbose=False):
----------
pkgname : str or None
The package for which to retrieve the configuration object.
filename : str or file object or None
filename : str or file-like or None
If None, the default configuration path is taken from `get_config`.

"""
Expand Down
6 changes: 3 additions & 3 deletions astropy/constants/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@


class ConstantMeta(type):
"""Metaclass for the :class:`Constant`. The primary purpose of this is to
wrap the double-underscore methods of :class:`Quantity` which is the
superclass of :class:`Constant`.
"""Metaclass for `~astropy.constants.Constant`. The primary purpose of this
is to wrap the double-underscore methods of `~astropy.units.Quantity`
which is the superclass of `~astropy.constants.Constant`.

In particular this wraps the operator overloads such as `__add__` to
prevent their use with constants such as ``e`` from being used in
Expand Down
2 changes: 1 addition & 1 deletion astropy/constants/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _set_c(codata, iaudata, module, not_in_module_only=True, doclines=None,
If ``True``, constants that are already in the namespace
of ``module`` will not be modified.

doclines : list or `None`
doclines : list or None
If a list is given, this list will be modified in-place to include
documentation of modified constants. This can be used to update
docstring of ``module``.
Expand Down
2 changes: 1 addition & 1 deletion astropy/convolution/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from .core import * # noqa
from .kernels import * # noqa
from .utils import discretize_model # noqa
from .utils import discretize_model, KernelSizeError # noqa

from .convolve import convolve, convolve_fft, interpolate_replace_nans, convolve_models, convolve_models_fft # noqa

Expand Down
22 changes: 11 additions & 11 deletions astropy/convolution/convolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def convolve(array, kernel, boundary='fill', fill_value=0.,

Parameters
----------
array : `~astropy.nddata.NDData` or `numpy.ndarray` or array_like
array : `~astropy.nddata.NDData` or array-like
The array to convolve. This should be a 1, 2, or 3-dimensional array
or a list or a set of nested lists representing a 1, 2, or
3-dimensional array. If an `~astropy.nddata.NDData`, the ``mask`` of
Expand Down Expand Up @@ -196,7 +196,7 @@ def convolve(array, kernel, boundary='fill', fill_value=0.,
preserve_nan : bool
After performing convolution, should pixels that were originally NaN
again become NaN?
mask : `None` or `numpy.ndarray`
mask : None or ndarray
A "mask" array. Shape must match ``array``, and anything that is masked
(i.e., not 0/`False`) will be set to NaN for the convolution. If
`None`, no masking will be performed unless ``array`` is a masked array.
Expand Down Expand Up @@ -491,7 +491,7 @@ def convolve_fft(array, kernel, boundary='fill', fill_value=0.,
numerical value (default zero, see ``fill_value``) prior to
convolution. Note that if the kernel has a sum equal to zero, NaN
interpolation is not possible and will raise an exception.
normalize_kernel : function or boolean, optional
normalize_kernel : callable or boolean, optional
If specified, this is the function to divide kernel by to normalize it.
e.g., ``normalize_kernel=np.sum`` means that kernel will be modified to be:
``kernel = kernel / np.sum(kernel)``. If True, defaults to
Expand All @@ -503,7 +503,7 @@ def convolve_fft(array, kernel, boundary='fill', fill_value=0.,
preserve_nan : bool
After performing convolution, should pixels that were originally NaN
again become NaN?
mask : `None` or `numpy.ndarray`
mask : None or ndarray
A "mask" array. Shape must match ``array``, and anything that is masked
(i.e., not 0/`False`) will be set to NaN for the convolution. If
`None`, no masking will be performed unless ``array`` is a masked array.
Expand Down Expand Up @@ -538,20 +538,20 @@ def convolve_fft(array, kernel, boundary='fill', fill_value=0.,
allow_huge : bool, optional
Allow huge arrays in the FFT? If False, will raise an exception if the
array or kernel size is >1 GB.
fftn : functions, optional
fftn : callable, optional
The fft function. Can be overridden to use your own ffts,
e.g. an fftw3 wrapper or scipy's fftn, ``fft=scipy.fft.fftn``.
ifftn : functions, optional
e.g. an fftw3 wrapper or scipy's fftn, ``fft=scipy.fftpack.fftn``.
ifftn : callable, optional
The inverse fft function. Can be overridden the same way ``fttn``.
complex_dtype : numpy.complex, optional
complex_dtype : complex type, optional
Which complex dtype to use. `numpy` has a range of options, from 64 to
256.

Raises
------
ValueError:
If the array is bigger than 1 GB after padding, will raise this exception
unless ``allow_huge`` is True
If the array is bigger than 1 GB after padding, will raise this
exception unless ``allow_huge`` is True

See Also
--------
Expand Down Expand Up @@ -903,7 +903,7 @@ def convolve_models(model, kernel, mode='convolve_fft', **kwargs):

Returns
-------
default : CompoundModel
default : `~astropy.modeling.core.CompoundModel`
Convolved model
"""

Expand Down
29 changes: 16 additions & 13 deletions astropy/convolution/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Kernel:

Parameters
----------
array : `~numpy.ndarray`
array : ndarray
Kernel array.
"""
_separable = False
Expand Down Expand Up @@ -189,9 +189,10 @@ class Kernel1D(Kernel):
----------
model : `~astropy.modeling.FittableModel`
Model to be evaluated.
x_size : odd int, optional
Size of the kernel array. Default = 8 * width.
array : `~numpy.ndarray`
x_size : int or None, optional
Size of the kernel array. Default = ⌊8*width+1⌋.
Only used if ``array`` is None.
array : ndarray or None, optional
Kernel array.
width : number
Width of the filter kernel.
Expand Down Expand Up @@ -248,12 +249,14 @@ class Kernel2D(Kernel):
----------
model : `~astropy.modeling.FittableModel`
Model to be evaluated.
x_size : odd int, optional
Size in x direction of the kernel array. Default = 8 * width.
y_size : odd int, optional
Size in y direction of the kernel array. Default = 8 * width.
array : `~numpy.ndarray`
Kernel array.
x_size : int, optional
Size in x direction of the kernel array. Default = ⌊8*width + 1⌋.
Only used if ``array`` is None.
y_size : int, optional
Size in y direction of the kernel array. Default = ⌊8*width + 1⌋.
Only used if ``array`` is None,
array : ndarray or None, optional
Kernel array. Default is None.
mode : str, optional
One of the following discretization modes:
* 'center' (default)
Expand Down Expand Up @@ -319,9 +322,9 @@ def kernel_arithmetics(kernel, value, operation):
Parameters
----------
kernel : `astropy.convolution.Kernel`
Kernel instance
value : kernel, float or int
Value to operate with
Kernel instance.
value : `astropy.convolution.Kernel`, float, or int
Value to operate with.
operation : {'add', 'sub', 'mul'}
One of the following operations:
* 'add'
Expand Down
60 changes: 31 additions & 29 deletions astropy/convolution/kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np

from .core import Kernel1D, Kernel2D, Kernel
from .utils import has_even_axis, raise_even_kernel_exception
from .utils import has_even_axis, raise_even_kernel_exception, KernelSizeError
from astropy.modeling import models
from astropy.modeling.core import Fittable1DModel, Fittable2DModel
from astropy.utils.decorators import deprecated
Expand Down Expand Up @@ -36,8 +36,8 @@ class Gaussian1DKernel(Kernel1D):
----------
stddev : number
Standard deviation of the Gaussian kernel.
x_size : odd int, optional
Size of the kernel array. Default = 8 * stddev
x_size : int, optional
Size of the kernel array. Default = ⌊8*stddev+1⌋.
mode : str, optional
One of the following discretization modes:
* 'center' (default)
Expand Down Expand Up @@ -101,13 +101,13 @@ class Gaussian2DKernel(Kernel2D):
Standard deviation of the Gaussian in x before rotating by theta.
y_stddev : float
Standard deviation of the Gaussian in y before rotating by theta.
theta : float or :class:`~astropy.units.Quantity`
theta : float or `~astropy.units.Quantity`
Rotation angle. If passed as a float, it is assumed to be in radians.
The rotation angle increases counterclockwise.
x_size : odd int, optional
Size in x direction of the kernel array. Default = 8 * stddev.
y_size : odd int, optional
Size in y direction of the kernel array. Default = 8 * stddev.
x_size : int, optional
Size in x direction of the kernel array. Default = ⌊8*stddev + 1⌋.
y_size : int, optional
Size in y direction of the kernel array. Default = ⌊8*stddev + 1⌋.
mode : str, optional
One of the following discretization modes:
* 'center' (default)
Expand Down Expand Up @@ -563,8 +563,8 @@ class RickerWavelet1DKernel(Kernel1D):
width : number
Width of the filter kernel, defined as the standard deviation
of the Gaussian function from which it is derived.
x_size : odd int, optional
Size in x direction of the kernel array. Default = 8 * width.
x_size : int, optional
Size in x direction of the kernel array. Default = ⌊8*width +1⌋.
mode : str, optional
One of the following discretization modes:
* 'center' (default)
Expand Down Expand Up @@ -639,10 +639,10 @@ class RickerWavelet2DKernel(Kernel2D):
width : number
Width of the filter kernel, defined as the standard deviation
of the Gaussian function from which it is derived.
x_size : odd int, optional
Size in x direction of the kernel array. Default = 8 * width.
y_size : odd int, optional
Size in y direction of the kernel array. Default = 8 * width.
x_size : int, optional
Size in x direction of the kernel array. Default = ⌊8*width +1⌋.
y_size : int, optional
Size in y direction of the kernel array. Default = ⌊8*width +1⌋.
mode : str, optional
One of the following discretization modes:
* 'center' (default)
Expand Down Expand Up @@ -703,10 +703,10 @@ class AiryDisk2DKernel(Kernel2D):
----------
radius : float
The radius of the Airy disk kernel (radius of the first zero).
x_size : odd int, optional
Size in x direction of the kernel array. Default = 8 * radius.
y_size : odd int, optional
Size in y direction of the kernel array. Default = 8 * radius.
x_size : int, optional
Size in x direction of the kernel array. Default = ⌊8*radius + 1⌋.
y_size : int, optional
Size in y direction of the kernel array. Default = ⌊8*radius + 1⌋.
mode : str, optional
One of the following discretization modes:
* 'center' (default)
Expand Down Expand Up @@ -767,10 +767,10 @@ class Moffat2DKernel(Kernel2D):
Core width of the Moffat model.
alpha : float
Power index of the Moffat model.
x_size : odd int, optional
Size in x direction of the kernel array. Default = 8 * radius.
y_size : odd int, optional
Size in y direction of the kernel array. Default = 8 * radius.
x_size : int, optional
Size in x direction of the kernel array. Default = ⌊8*radius + 1⌋.
y_size : int, optional
Size in y direction of the kernel array. Default = ⌊8*radius + 1⌋.
mode : str, optional
One of the following discretization modes:
* 'center' (default)
Expand Down Expand Up @@ -832,8 +832,9 @@ class Model1DKernel(Kernel1D):
----------
model : `~astropy.modeling.Fittable1DModel`
Kernel response function model
x_size : odd int, optional
Size in x direction of the kernel array. Default = 8 * width.
x_size : int, optional
Size in x direction of the kernel array. Default = ⌊8*width +1⌋.
Must be odd.
mode : str, optional
One of the following discretization modes:
* 'center' (default)
Expand Down Expand Up @@ -896,10 +897,11 @@ class Model2DKernel(Kernel2D):
----------
model : `~astropy.modeling.Fittable2DModel`
Kernel response function model
x_size : odd int, optional
Size in x direction of the kernel array. Default = 8 * width.
y_size : odd int, optional
Size in y direction of the kernel array. Default = 8 * width.
x_size : int, optional
Size in x direction of the kernel array. Default = ⌊8*width +1⌋.
Must be odd.
y_size : int, optional
Size in y direction of the kernel array. Default = ⌊8*width +1⌋.
mode : str, optional
One of the following discretization modes:
* 'center' (default)
Expand Down Expand Up @@ -977,7 +979,7 @@ class CustomKernel(Kernel):
------
TypeError
If array is not a list or array.
KernelSizeError
`~astropy.convolution.KernelSizeError`
If array size is even.

See also
Expand Down
2 changes: 1 addition & 1 deletion astropy/convolution/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from astropy.modeling.core import FittableModel, custom_model

__all__ = ['discretize_model']
__all__ = ['discretize_model', 'KernelSizeError']


class DiscretizationError(Exception):
Expand Down
Loading