NIPY logo

Site Navigation

NIPY Community

Table Of Contents

Previous topic

neurospin.glm.glm

This Page

neurospin.glm_files_layout.contrast_tools

Module: neurospin.glm_files_layout.contrast_tools

Inheritance diagram for nipy.neurospin.glm_files_layout.contrast_tools:

Set of utilities to handle contrasts Some naming conventions are related to brainvisa environment.

Author : Lise Favre, Bertrand Thirion, 2008-2010

Classes

Contrast

class nipy.neurospin.glm_files_layout.contrast_tools.Contrast(indict=None, verbose=0)

Bases: dict

Class used to define contrasts besides being a dictiornay, it allows basic algebra on contrasts (multiplication, addition, subtraction)

Methods

clear
copy Generic (shallow and deep) copying operations.
fromkeys
get
has_key
items
iteritems
iterkeys
itervalues
keys
pop
popitem
setdefault
update
values
viewitems
viewkeys
viewvalues
__init__(indict=None, verbose=0)
clear

D.clear() -> None. Remove all items from D.

copy

D.copy() -> a shallow copy of D

static fromkeys()

dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v. v defaults to None.

get

D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.

has_key

D.has_key(k) -> True if D has a key k, else False

items

D.items() -> list of D’s (key, value) pairs, as 2-tuples

iteritems

D.iteritems() -> an iterator over the (key, value) items of D

iterkeys

D.iterkeys() -> an iterator over the keys of D

itervalues

D.itervalues() -> an iterator over the values of D

keys

D.keys() -> list of D’s keys

pop

D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised

popitem

D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.

setdefault

D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D

update

D.update(E, **F) -> None. Update D from dict/iterable E and F. If E has a .keys() method, does: for k in E: D[k] = E[k] If E lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values

D.values() -> list of D’s values

viewitems

D.viewitems() -> a set-like object providing a view on D’s items

viewkeys

D.viewkeys() -> a set-like object providing a view on D’s keys

viewvalues

D.viewvalues() -> an object providing a view on D’s values

ContrastList

class nipy.neurospin.glm_files_layout.contrast_tools.ContrastList(misc_info_path=None, contrast_path=None, model='default', misc=None, verbose=0)

Bases: object

Class to handle contrasts when in a brainvisa-like envrionment. See ./glm_tools for more details on this framework

Methods

get_dictionnary
save_dic
__init__(misc_info_path=None, contrast_path=None, model='default', misc=None, verbose=0)

Automatically generate some contrasts from a ‘misc’ file

Parameters :

misc_info_path, string, optional :

path of a ConfigObbj file

contrast_path: string, optional, :

path of a contrast file where contrast are written

model, string, optional, :

identifier of the model that corresponds to the contrasts

misc: dictionary, optional :

dictionary that contains the misc info. Note that misc_info_path or misc have to be defined

verbose: boolean, optional, :

verbosity mode

get_dictionnary()
save_dic(contrast_file, verbose=0)

Instantiate a contrast object and write it in a file

Parameters :

contrast_file: string, :

path of the resulting file

verbose, bool: :

verbosity mode

Returns :

the contrast object :