diff --git a/nibabel/affines.py b/nibabel/affines.py index 59b52e768..05fdd7bb5 100644 --- a/nibabel/affines.py +++ b/nibabel/affines.py @@ -1,7 +1,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -"""Utility routines for working with points and affine transforms -""" +"""Utility routines for working with points and affine transforms""" from functools import reduce import numpy as np @@ -100,7 +99,7 @@ def apply_affine(aff, pts, inplace=False): def to_matvec(transform): - """Split a transform into its matrix and vector components. + """Split a transform into its matrix and vector components The transformation must be represented in homogeneous coordinates and is split into its rotation matrix and translation vector components. @@ -312,8 +311,7 @@ def voxel_sizes(affine): def obliquity(affine): - r""" - Estimate the *obliquity* an affine's axes represent. + r"""Estimate the *obliquity* an affine's axes represent The term *obliquity* is defined here as the rotation of those axes with respect to the cardinal axes. diff --git a/nibabel/arraywriters.py b/nibabel/arraywriters.py index 5a0b04925..bdd2d548f 100644 --- a/nibabel/arraywriters.py +++ b/nibabel/arraywriters.py @@ -28,7 +28,6 @@ def __init__(self, array, out_dtype=None) something else to make sense of conversions between float and int, or between larger ints and smaller. """ - import numpy as np from .casting import ( diff --git a/nibabel/brikhead.py b/nibabel/brikhead.py index f375b541d..ee5f76672 100644 --- a/nibabel/brikhead.py +++ b/nibabel/brikhead.py @@ -6,8 +6,7 @@ # copyright and license terms. # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## -""" -Class for reading AFNI BRIK/HEAD datasets +"""Class for reading AFNI BRIK/HEAD datasets See https://afni.nimh.nih.gov/pub/dist/doc/program_help/README.attributes.html for information on what is required to have a valid BRIK/HEAD dataset. diff --git a/nibabel/data.py b/nibabel/data.py index 42826d2f6..7e2fe2af7 100644 --- a/nibabel/data.py +++ b/nibabel/data.py @@ -1,8 +1,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" -Utilities to find files from NIPY data packages -""" +"""Utilities to find files from NIPY data packages""" import configparser import glob import os diff --git a/nibabel/deprecated.py b/nibabel/deprecated.py index c35307195..092370106 100644 --- a/nibabel/deprecated.py +++ b/nibabel/deprecated.py @@ -1,5 +1,4 @@ -"""Module to help with deprecating objects and classes -""" +"""Module to help with deprecating objects and classes""" from __future__ import annotations import typing as ty diff --git a/nibabel/deprecator.py b/nibabel/deprecator.py index 3ef6b4506..779fdb462 100644 --- a/nibabel/deprecator.py +++ b/nibabel/deprecator.py @@ -1,5 +1,4 @@ -"""Class for recording and reporting deprecations -""" +"""Class for recording and reporting deprecations""" from __future__ import annotations import functools diff --git a/nibabel/dft.py b/nibabel/dft.py index c80512895..7a49d49f5 100644 --- a/nibabel/dft.py +++ b/nibabel/dft.py @@ -7,8 +7,7 @@ # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # Copyright (C) 2011 Christian Haselgrove -"""DICOM filesystem tools -""" +"""DICOM filesystem tools""" import contextlib diff --git a/nibabel/ecat.py b/nibabel/ecat.py index f1a40dd27..23a58f752 100644 --- a/nibabel/ecat.py +++ b/nibabel/ecat.py @@ -42,7 +42,6 @@ GPL and some of the header files are adapted from CTI files (called CTI code below). It's not clear what the licenses are for these files. """ - import warnings from numbers import Integral diff --git a/nibabel/environment.py b/nibabel/environment.py index 6f331eed5..09aaa6320 100644 --- a/nibabel/environment.py +++ b/nibabel/environment.py @@ -1,9 +1,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" -Settings from the system environment relevant to NIPY -""" - +"""Settings from the system environment relevant to NIPY""" import os from os.path import join as pjoin diff --git a/nibabel/eulerangles.py b/nibabel/eulerangles.py index b1d187e8c..13dc05964 100644 --- a/nibabel/eulerangles.py +++ b/nibabel/eulerangles.py @@ -82,7 +82,6 @@ ``y``, followed by rotation around ``x``, is known (confusingly) as "xyz", pitch-roll-yaw, Cardan angles, or Tait-Bryan angles. """ - import math from functools import reduce diff --git a/nibabel/filebasedimages.py b/nibabel/filebasedimages.py index 556d8b75e..6e4ea8613 100644 --- a/nibabel/filebasedimages.py +++ b/nibabel/filebasedimages.py @@ -6,7 +6,7 @@ # copyright and license terms. # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## -"""Common interface for any image format--volume or surface, binary or xml.""" +"""Common interface for any image format--volume or surface, binary or xml""" from __future__ import annotations import io diff --git a/nibabel/fileholders.py b/nibabel/fileholders.py index f2ec992da..691d31ecf 100644 --- a/nibabel/fileholders.py +++ b/nibabel/fileholders.py @@ -7,7 +7,6 @@ # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## """Fileholder class""" - from copy import copy from .openers import ImageOpener diff --git a/nibabel/filename_parser.py b/nibabel/filename_parser.py index 77949a679..c4e47ee72 100644 --- a/nibabel/filename_parser.py +++ b/nibabel/filename_parser.py @@ -7,7 +7,6 @@ # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## """Create filename pairs, triplets etc, with expected extensions""" - import os import pathlib diff --git a/nibabel/fileslice.py b/nibabel/fileslice.py index 87cac05a4..fe7d6bba5 100644 --- a/nibabel/fileslice.py +++ b/nibabel/fileslice.py @@ -1,6 +1,4 @@ -"""Utilities for getting array slices out of file-like objects -""" - +"""Utilities for getting array slices out of file-like objects""" import operator from functools import reduce from mmap import mmap diff --git a/nibabel/fileutils.py b/nibabel/fileutils.py index da44fe51a..1defbc62f 100644 --- a/nibabel/fileutils.py +++ b/nibabel/fileutils.py @@ -6,8 +6,7 @@ # copyright and license terms. # # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## -"""Utilities for reading and writing to binary file formats -""" +"""Utilities for reading and writing to binary file formats""" def read_zt_byte_strings(fobj, n_strings=1, bufsize=1024): diff --git a/nibabel/imageclasses.py b/nibabel/imageclasses.py index ac27a6eca..e2dbed129 100644 --- a/nibabel/imageclasses.py +++ b/nibabel/imageclasses.py @@ -7,7 +7,6 @@ # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## """Define supported image classes and names""" - from .analyze import AnalyzeImage from .brikhead import AFNIImage from .cifti2 import Cifti2Image diff --git a/nibabel/imageglobals.py b/nibabel/imageglobals.py index 81a174280..551719a7e 100644 --- a/nibabel/imageglobals.py +++ b/nibabel/imageglobals.py @@ -23,7 +23,6 @@ Use ``logger.level = 1`` to see all messages. """ - import logging error_level = 40 diff --git a/nibabel/imagestats.py b/nibabel/imagestats.py index 6f1b68178..38dc9d3f1 100644 --- a/nibabel/imagestats.py +++ b/nibabel/imagestats.py @@ -6,10 +6,7 @@ # copyright and license terms. # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## -""" -Functions for computing image statistics -""" - +"""Functions for computing image statistics""" import numpy as np from nibabel.imageclasses import spatial_axes_first diff --git a/nibabel/loadsave.py b/nibabel/loadsave.py index 6c1981ca7..f12b81b30 100644 --- a/nibabel/loadsave.py +++ b/nibabel/loadsave.py @@ -8,7 +8,6 @@ ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # module imports """Utilities to load and save image objects""" - import os import numpy as np diff --git a/nibabel/mriutils.py b/nibabel/mriutils.py index d993d26a2..09067cc1e 100644 --- a/nibabel/mriutils.py +++ b/nibabel/mriutils.py @@ -6,9 +6,7 @@ # copyright and license terms. # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## -""" -Utilities for calculations related to MRI -""" +"""Utilities for calculations related to MRI""" __all__ = ['calculate_dwell_time'] diff --git a/nibabel/nifti2.py b/nibabel/nifti2.py index 9c898b47b..8d9b81e1f 100644 --- a/nibabel/nifti2.py +++ b/nibabel/nifti2.py @@ -12,7 +12,6 @@ https://www.nitrc.org/forum/message.php?msg_id=3738 """ - import numpy as np from .analyze import AnalyzeHeader diff --git a/nibabel/onetime.py b/nibabel/onetime.py index 7c723d4c8..e365e81f7 100644 --- a/nibabel/onetime.py +++ b/nibabel/onetime.py @@ -1,5 +1,4 @@ -""" -Descriptor support for NIPY. +"""Descriptor support for NIPY Utilities to support special Python descriptors [1,2], in particular the use of a useful pattern for properties we call 'one time properties'. These are diff --git a/nibabel/openers.py b/nibabel/openers.py index d75839fe1..5f2bb0cde 100644 --- a/nibabel/openers.py +++ b/nibabel/openers.py @@ -6,9 +6,7 @@ # copyright and license terms. # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## -"""Context manager openers for various fileobject types -""" - +"""Context manager openers for various fileobject types""" import gzip import warnings from bz2 import BZ2File diff --git a/nibabel/orientations.py b/nibabel/orientations.py index f9e1ea028..075cbd4ff 100644 --- a/nibabel/orientations.py +++ b/nibabel/orientations.py @@ -7,8 +7,6 @@ # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## """Utilities for calculating and applying affine orientations""" - - import numpy as np import numpy.linalg as npl diff --git a/nibabel/parrec.py b/nibabel/parrec.py index 7c594dcb4..22219382c 100644 --- a/nibabel/parrec.py +++ b/nibabel/parrec.py @@ -8,7 +8,7 @@ ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # Disable line length checking for PAR fragments in module docstring # flake8: noqa E501 -"""Read images in PAR/REC format. +"""Read images in PAR/REC format This is yet another MRI image format generated by Philips scanners. It is an ASCII header (PAR) plus a binary blob (REC). @@ -121,7 +121,6 @@ utility via the option "--strict-sort". The dimension info can be exported to a CSV file by adding the option "--volume-info". """ - import re import warnings from collections import OrderedDict diff --git a/nibabel/processing.py b/nibabel/processing.py index c7bd3888d..d634ce708 100644 --- a/nibabel/processing.py +++ b/nibabel/processing.py @@ -6,15 +6,16 @@ # copyright and license terms. # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## -"""Image processing functions for: +"""Image processing functions -* smoothing -* resampling -* converting sd to and from FWHM +Image processing functions for: -Smoothing and resampling routines need scipy -""" + * smoothing + * resampling + * converting SD to and from FWHM +Smoothing and resampling routines need scipy. +""" import numpy as np import numpy.linalg as npl diff --git a/nibabel/quaternions.py b/nibabel/quaternions.py index 04c570c84..ec4066060 100644 --- a/nibabel/quaternions.py +++ b/nibabel/quaternions.py @@ -7,7 +7,7 @@ # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## """ -Functions to operate on, or return, quaternions. +Functions to operate on, or return, quaternions The module also includes functions for the closely related angle, axis pair as a specification for rotation. @@ -25,7 +25,6 @@ >>> vec = np.array([1, 2, 3]).reshape((3,1)) # column vector >>> tvec = np.dot(M, vec) """ - import math import numpy as np diff --git a/nibabel/rstutils.py b/nibabel/rstutils.py index cb40633e5..625a2af47 100644 --- a/nibabel/rstutils.py +++ b/nibabel/rstutils.py @@ -2,7 +2,6 @@ * Make ReST table given array of values """ - import numpy as np diff --git a/nibabel/spaces.py b/nibabel/spaces.py index d06a39b0e..e5b87171d 100644 --- a/nibabel/spaces.py +++ b/nibabel/spaces.py @@ -19,7 +19,6 @@ mapping), or * a length 2 sequence with the same information (shape, affine). """ - from itertools import product import numpy as np diff --git a/nibabel/tmpdirs.py b/nibabel/tmpdirs.py index 3074fca6f..7fe47e651 100644 --- a/nibabel/tmpdirs.py +++ b/nibabel/tmpdirs.py @@ -6,8 +6,7 @@ # copyright and license terms. # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## -"""Contexts for *with* statement providing temporary directories -""" +"""Contexts for *with* statement providing temporary directories""" import os import tempfile from contextlib import contextmanager diff --git a/nibabel/tripwire.py b/nibabel/tripwire.py index d0c3d4c50..fa45e7338 100644 --- a/nibabel/tripwire.py +++ b/nibabel/tripwire.py @@ -1,5 +1,4 @@ -"""Class to raise error for missing modules or other misfortunes -""" +"""Class to raise error for missing modules or other misfortunes""" from typing import Any diff --git a/nibabel/viewers.py b/nibabel/viewers.py index 9dad3dd17..f2b32a1fd 100644 --- a/nibabel/viewers.py +++ b/nibabel/viewers.py @@ -3,7 +3,6 @@ Includes version of OrthoSlicer3D code originally written by our own Paul Ivanov. """ - import weakref import numpy as np @@ -14,7 +13,7 @@ class OrthoSlicer3D: - """Orthogonal-plane slice viewer. + """Orthogonal-plane slice viewer OrthoSlicer3d expects 3- or 4-dimensional array data. It treats 4D data as a sequence of 3D spatial volumes, where a slice over the final diff --git a/nibabel/xmlutils.py b/nibabel/xmlutils.py index 8e0b18fb6..31637b5e0 100644 --- a/nibabel/xmlutils.py +++ b/nibabel/xmlutils.py @@ -6,10 +6,7 @@ # copyright and license terms. # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## -""" -Thin layer around xml.etree.ElementTree, to abstract nibabel xml support. -""" - +"""Thin layer around xml.etree.ElementTree, to abstract nibabel xml support""" from io import BytesIO from xml.etree.ElementTree import Element, SubElement, tostring # noqa from xml.parsers.expat import ParserCreate