Exemple #1
0
from scipy.spatial.distance import squareform
from scipy.stats import ttest_1samp
import seaborn as sns
import matplotlib.pyplot as plt
from nltools.stats import (correlation_permutation, one_sample_permutation,
                           two_sample_permutation, summarize_bootstrap,
                           matrix_permutation)
from nltools.stats import regress as regression
from nltools.plotting import (plot_stacked_adjacency, plot_silhouette)
from nltools.utils import (all_same, attempt_to_import, concatenate,
                           _bootstrap_apply_func)
from .design_matrix import Design_Matrix
from joblib import Parallel, delayed

# Optional dependencies
nx = attempt_to_import('networkx', 'nx')

MAX_INT = np.iinfo(np.int32).max


class Adjacency(object):
    '''
    Adjacency is a class to represent Adjacency matrices as a vector rather
    than a 2-dimensional matrix. This makes it easier to perform data
    manipulation and analyses.

    Args:
        data: pandas data instance or list of files
        matrix_type: (str) type of matrix.  Possible values include:
                    ['distance','similarity','directed','distance_flat',
                    'similarity_flat','directed_flat']
Exemple #2
0
__author__ = ["Luke Chang"]
__license__ = "MIT"

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from nltools.stats import two_sample_permutation, one_sample_permutation
from nilearn.plotting import plot_glass_brain, plot_stat_map, view_img, view_img_on_surf
from nltools.prefs import MNI_Template, resolve_mni_path
from nltools.utils import attempt_to_import
import warnings

# Optional dependencies
ipywidgets = attempt_to_import('ipywidgets',
                               name='ipywidgets',
                               fromlist=['interact', 'fixed', 'widgets'])


def plot_interactive_brain(brain,
                           threshold=1e-6,
                           surface=False,
                           percentile_threshold=False,
                           anatomical=None,
                           **kwargs):
    """
    This function leverages nilearn's new javascript based brain viewer functions to create interactive plotting functionality.

    Args:
        brain (nltools.Brain_Data): a Brain_Data instance of 1d or 2d shape (i.e. 3d or 4d volume)
        threshold (float/str): threshold to initialize the visualization, maybe be a percentile string; default 0
import matplotlib.pyplot as plt
import numpy as np
from numpy.fft import fft, fftfreq
from nltools.stats import two_sample_permutation, one_sample_permutation
from nilearn.plotting import plot_glass_brain, plot_stat_map, view_img, view_img_on_surf
from nltools.prefs import MNI_Template, resolve_mni_path
from nltools.utils import attempt_to_import
import warnings
import sklearn
import os

# Optional dependencies
ipywidgets = attempt_to_import(
    "ipywidgets",
    name="ipywidgets",
    fromlist=[
        "interact", "fixed", "widgets", "BoundedFloatText", "BoundedIntText"
    ],
)


def plot_interactive_brain(
    brain,
    threshold=1e-6,
    surface=False,
    percentile_threshold=False,
    anatomical=None,
    **kwargs,
):
    """
    This function leverages nilearn's new javascript based brain viewer functions to create interactive plotting functionality.
Exemple #4
0
__license__ = "MIT"

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from nltools.stats import two_sample_permutation, one_sample_permutation
from nilearn.plotting import plot_glass_brain, plot_stat_map, view_img, view_img_on_surf
from nltools.prefs import MNI_Template, resolve_mni_path
from nltools.utils import attempt_to_import
import warnings
import os

# Optional dependencies
ipywidgets = attempt_to_import("ipywidgets",
                               name="ipywidgets",
                               fromlist=["interact", "fixed", "widgets"])


def plot_interactive_brain(brain,
                           threshold=1e-6,
                           surface=False,
                           percentile_threshold=False,
                           anatomical=None,
                           **kwargs):
    """
    This function leverages nilearn's new javascript based brain viewer functions to create interactive plotting functionality.

    Args:
        brain (nltools.Brain_Data): a Brain_Data instance of 1d or 2d shape (i.e. 3d or 4d volume)
        threshold (float/str): threshold to initialize the visualization, maybe be a percentile string; default 0