Skip to content

DOCTEST: Use legacy float array printing for now #556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 5, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions nibabel/affines.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# 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

.. testsetup::

>>> from distutils.version import LooseVersion
>>> if LooseVersion(np.__version__) > LooseVersion('1.13.1'):
... np.set_printoptions(sign='legacy')
"""

import numpy as np
Expand Down
6 changes: 6 additions & 0 deletions nibabel/casting.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Most routines work round some numpy oddities in floating point precision and
casting. Others work round numpy casting to and from python ints

.. testsetup::

>>> from distutils.version import LooseVersion
>>> if LooseVersion(np.__version__) > LooseVersion('1.13.1'):
... np.set_printoptions(sign='legacy')
"""

from numbers import Integral
Expand Down
5 changes: 5 additions & 0 deletions nibabel/nicom/dwiparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

B ~ (q_est . q_est.T) / norm(q_est)

.. testsetup::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put this in a separate docstring? See comment below.


>>> from distutils.version import LooseVersion
>>> if LooseVersion(np.__version__) > LooseVersion('1.13.1'):
... np.set_printoptions(sign='legacy')
'''
import numpy as np
import numpy.linalg as npl
Expand Down
6 changes: 6 additions & 0 deletions nibabel/nifti1.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
''' Read / write access to NIfTI1 image format

NIfTI1 format defined at http://nifti.nimh.nih.gov/nifti-1/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this two separate strings, so the user doesn't get this testsetup in the docstring help?

.. testsetup::

>>> from distutils.version import LooseVersion
>>> if LooseVersion(np.__version__) > LooseVersion('1.13.1'):
... np.set_printoptions(sign='legacy')
'''
from __future__ import division, print_function
import warnings
Expand Down
6 changes: 6 additions & 0 deletions nibabel/quaternions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
>>> M = quat2mat(q) # from this module
>>> vec = np.array([1, 2, 3]).reshape((3,1)) # column vector
>>> tvec = np.dot(M, vec)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

.. testsetup::

>>> from distutils.version import LooseVersion
>>> if LooseVersion(np.__version__) > LooseVersion('1.13.1'):
... np.set_printoptions(sign='legacy')
'''

import math
Expand Down