Ejemplo n.º 1
0
def test_not_raise_at_run_time():
    """ Check that SkipTest is not raised at run time 
    """
    try:
        skip_if_running_nose()
    except nose.SkipTest:
        # We need to raise another exception, as nose will capture this
        # one
        raise AssertionError
Ejemplo n.º 2
0
The main purpose of these classes is to have auto adjust of axes size to
the data with different layout of cuts.
"""

import operator

import numpy as np
from nipy.utils.skip_test import skip_if_running_nose

try:
    import matplotlib as mpl
    import pylab as pl
    from matplotlib import transforms
except ImportError:
    skip_if_running_nose('Could not import matplotlib')


# Local imports
from .coord_tools import coord_transform, get_bounds, get_mask_bounds, \
        find_cut_coords
from .edge_detect import _edge_map
from . import cm
from ..datasets import VolumeImg

################################################################################
# Bugware to have transparency work OK with MPL < .99.1
if mpl.__version__ < '0.99.1':
    # We wrap the lut as a callable and replace its evalution to put
    # alpha to zero where the mask is true. This is what is done in
    # MPL >= .99.1
Ejemplo n.º 3
0
# Standard library imports
import warnings
import operator

# Standard scientific libraries imports (more specific imports are
# delayed, so that the part module can be used without them).
import numpy as np

# Import pylab
from nipy.utils.skip_test import skip_if_running_nose

try:
    import pylab as pl
except ImportError:
    skip_if_running_nose('Could not import matplotlib')

from .anat_cache import mni_sform, mni_sform_inv, _AnatCache
from .coord_tools import coord_transform

from .slicers import SLICERS, _xyz_order
from edge_detect import _fast_abs_percentile

################################################################################
# Helper functions for 2D plotting of activation maps
################################################################################


def plot_map(map,
             affine,
             cut_coords=None,
Ejemplo n.º 4
0
The main purpose of these classes is to have auto adjust of axes size to
the data with different layout of cuts.
"""

import operator

import numpy as np
from nipy.utils.skip_test import skip_if_running_nose

try:
    import matplotlib as mpl
    import pylab as pl
    from matplotlib import transforms
except ImportError:
    skip_if_running_nose("Could not import matplotlib")


# Local imports
from .coord_tools import coord_transform, get_bounds, get_mask_bounds, find_cut_coords
from .edge_detect import _edge_map
from . import cm
from ..datasets import VolumeImg

################################################################################
# Bugware to have transparency work OK with MPL < .99.1
if mpl.__version__ < "0.99.1":
    # We wrap the lut as a callable and replace its evalution to put
    # alpha to zero where the mask is true. This is what is done in
    # MPL >= .99.1
    from matplotlib import colors
Ejemplo n.º 5
0
"""
Test the test skip utilities.
"""

import nose
from nipy.utils.skip_test import skip_if_running_nose

# First we must check that during test loading time, our skip_test does
# fire
try:
    skip_if_running_nose()
    skip_test_raised = False
except nose.SkipTest:
    skip_test_raised = True


def test_raise_at_load_time():
    """ Check that SkipTest was raised at load time
    """
    nose.tools.assert_true(skip_test_raised)


def test_not_raise_at_run_time():
    """ Check that SkipTest is not raised at run time 
    """
    try:
        skip_if_running_nose()
    except nose.SkipTest:
        # We need to raise another exception, as nose will capture this
        # one
        raise AssertionError