Skip to content

Commit

Permalink
Fix more docstring issues
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Sep 14, 2023
1 parent 788b4c2 commit 19f1675
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ repos:
rev: main
hooks:
- id: numpydoc-validation
files: ".*(high_level.*)$"
files: ".*(high_level|mosaicking).*$"
exclude: ".*(tests.*)$"

ci:
Expand Down
4 changes: 2 additions & 2 deletions reproject/interpolation/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ def test_auto_block_size():
wcs_out = WCS(naxis=2)

# When block size and parallel aren't specified, can't return as dask arrays
with pytest.raises(ValueError, match='Output cannot be returned as dask arrays'):
with pytest.raises(ValueError, match="Output cannot be returned as dask arrays"):
reproject_interp(
(array_in, wcs_in),
wcs_out,
Expand All @@ -982,7 +982,7 @@ def test_auto_block_size():
wcs_out,
shape_out=(300, 300),
return_type="dask",
block_size='auto',
block_size="auto",
)

assert array_out.chunksize == (350, 54, 54)
Expand Down
19 changes: 17 additions & 2 deletions reproject/mosaicking/background.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ def determine_offset_matrix(arrays):
"""
Given a list of ReprojectedArraySubset, determine the offset
matrix between all arrays.
Parameters
----------
arrays : list
The list of ReprojectedArraySubset objects to determine the offsets for.
Returns
-------
`numpy.ndarray`
The offset matrix.
"""

N = len(arrays)
Expand Down Expand Up @@ -59,9 +69,9 @@ def solve_corrections_sgd(offset_matrix, eta_initial=1, eta_half_life=100, rtol=
----------
offset_matrix : `~numpy.ndarray`
The NxN matrix giving the offsets between all images (or NaN if
an offset could not be determined)
an offset could not be determined).
eta_initial : float
The initial learning rate to use
The initial learning rate to use.
eta_half_life : float
The number of iterations after which the learning rate should be
decreased by a factor $e$.
Expand All @@ -71,6 +81,11 @@ def solve_corrections_sgd(offset_matrix, eta_initial=1, eta_half_life=100, rtol=
atol : float
The absolute tolerance to use to determine if the corrections have
converged.
Returns
-------
`numpy.ndarray`
The corrections for each frame.
"""

if offset_matrix.ndim != 2 or offset_matrix.shape[0] != offset_matrix.shape[1]:
Expand Down
15 changes: 12 additions & 3 deletions reproject/mosaicking/coadd.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def reproject_and_coadd(
shape_out=None,
input_weights=None,
hdu_in=None,
reproject_function=None,
hdu_weights=None,
reproject_function=None,
combine_function="mean",
match_background=False,
background_reference=None,
Expand Down Expand Up @@ -74,7 +74,7 @@ def reproject_and_coadd(
If one or more items in ``input_weights`` is a FITS file or an
`~astropy.io.fits.HDUList` instance, specifies the HDU to use.
reproject_function : callable
The function to use for the reprojection
The function to use for the reprojection.
combine_function : { 'mean', 'sum', 'median', 'first', 'last', 'min', 'max' }
The type of function to use for combining the values into the final
image. For 'first' and 'last', respectively, the reprojected images are
Expand All @@ -95,8 +95,17 @@ def reproject_and_coadd(
The final output footprint array. Specify this if you already have an
appropriately-shaped array to store the data in. Must match shape
specified with ``shape_out`` or derived from the output projection.
kwargs
**kwargs
Keyword arguments to be passed to the reprojection function.
Returns
-------
array : `~numpy.ndarray`
The co-added array.
footprint : `~numpy.ndarray`
Footprint of the co-added array. Values of 0 indicate no coverage or
valid values in the input image, while values of 1 indicate valid
values.
"""

# TODO: add support for saving intermediate files to disk to avoid blowing
Expand Down
8 changes: 3 additions & 5 deletions reproject/mosaicking/subset_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@


class ReprojectedArraySubset:
"""
The aim of this class is to represent a subset of an array and
footprint extracted (or meant to represent extracted) versions
from larger arrays and footprints.
"""
# The aim of this class is to represent a subset of an array and
# footprint extracted (or meant to represent extracted) versions
# from larger arrays and footprints.

# NOTE: we can't use Cutout2D here because it's much more convenient
# to work with position being the lower left corner of the cutout
Expand Down
6 changes: 3 additions & 3 deletions reproject/mosaicking/wcs_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ def find_optimal_celestial_wcs(
instance, specifies the HDU to use.
frame : str or `~astropy.coordinates.BaseCoordinateFrame`
The coordinate system for the final image (defaults to the frame of
the first image specified)
the first image specified).
auto_rotate : bool
Whether to rotate the header to minimize the final image area (if
`True`, requires shapely>=1.6 to be installed)
`True`, requires shapely>=1.6 to be installed).
projection : str
Three-letter code for the WCS projection
Three-letter code for the WCS projection.
resolution : `~astropy.units.Quantity`
The resolution of the final image. If not specified, this is the
smallest resolution of the input images.
Expand Down

0 comments on commit 19f1675

Please sign in to comment.