Biskit :: ProfileMirror :: ProfileMirror :: Class ProfileMirror
[hide private]
[frames] | no frames]

Class ProfileMirror

source code


Access only part of an underlying ProfileCollection from a MultiModel.

Instance Methods [hide private]
  __init__(self, parentProfiles, map2model)
str version(self)
Class version.
int __len__(self)
Returns number of profiles in the collection
  keys(self)
  has_key(self, k)
list __iter__(self)
Iterate over profile keys:
dict getInfo(self, name)
Use:
  get(self, name, default=None)
  setInfo(self, name, **args)
Add/Override infos about a given profile:
  set(self, name, prof, mask=None, default=None, asarray=1, comment=None, **moreInfo)
Add/override a profile.
ProfileMirror take(self, indices, *initArgs, **initKw)
Take from profiles using provided indices:
ProfileCollection / subclass concat(self, *profiles)
Concatenate this with the given ProfileMirror(s).:
  remove(self, *key)
Profiles can only be removed by the parent ProfileCollection
ProfileCollection clone(self)
Clone profile mirror:
  clear(self)
Profiles can only be cleared by the parent ProfileCollection
int profLength(self)
Length of profile:

Instance Variables [hide private]
  map
feature -> model map from parent feature
  default
default value to use if profile is removed / changed by set()
  _viewSignal
support CrossView de-activation

Method Details [hide private]

__init__(self, parentProfiles, map2model)
(Constructor)

source code 
Parameters:
  • parentProfiles (ProfileCollection) - profiles of the MultiModel
  • map (N.array of int) - map positions in this ProfileCollection to positions in the parent profile

version(self)

source code 

Class version.
Returns: str
class version number

__len__(self)
(Length operator)

source code 
Returns: int
number of profiles in the collection

keys(self)

source code 

has_key(self, k)

source code 

__iter__(self)

source code 

Iterate over profile keys:
 for k in self  <==>  for k in p.keys()
Returns: list
list of items

getInfo(self, name)

source code 

Use:
  getInfo( name ) -> dict with meta infos about profile::
Guaranteed infos: 'version'->str, 'comment'->str, 'changed'->1|0
Parameters:
  • name (str) - profile name
Returns: dict
dict with infos about profile
Raises:

get(self, name, default=None)

source code 

setInfo(self, name, **args)

source code 

Add/Override infos about a given profile:
 e.g. setInfo('relASA', comment='new', params={'bin':'whatif'})
Raises:

set(self, name, prof, mask=None, default=None, asarray=1, comment=None, **moreInfo)

source code 

Add/override a profile. The two info records 'version', 'changed' and 'isarray' are always modified but can be overridden by key=value pairs to this function. If the profile does not yet exist in the parent ProfileCollection, a new profile is created for the whole MultiModel and the values not covered by this ProfileMirror are set to <default>.
Parameters:
  • name (str) - profile name (i.e. key)
  • prof ([any] OR None) - list of values OR None
  • mask ([int]) - list 1 x N_items of 0|1, if there are less values than items, provide mask with 0 for missing values, N.sum(mask)==N_items
  • default (any) - value for items masked and for new parent profile (default: None for lists, 0 for arrays]
  • asarray (0|1|2) - store as list (0), as array (2) or store numbers as array but everything else as list (1) (default: 1)
  • comment (str) - goes into info[name]['comment']
  • moreInfo (key=value) - additional key-value pairs for info[name]
Raises:
  • ProfileError - if length of prof != length of other profiles
  • ProfileError - if mask is given but N.sum(mask) != len(prof)

take(self, indices, *initArgs, **initKw)

source code 

Take from profiles using provided indices:
 take( indices ) -> FeatureProfiles mapping to subset of parent
Parameters:
  • indices ([int]) - list of indices into this profile (not the MultiModel)
Returns: ProfileMirror
new instance that maps to a new subset of positions

concat(self, *profiles)

source code 

Concatenate this with the given ProfileMirror(s).:
 p0.concat( p1 [, p2, ..]) -> single ProfileMirror with the
 same number of profiles as p0 but with the length of p0+p1+p2..
Note: it's not yet clear what meaning this will have for ProfileMirrors
Parameters:
  • profiles (ProfileCollection(s)) - profile(s) to concatenate
Returns: ProfileCollection / subclass
concatenated profile(s)

remove(self, *key)

source code 

Profiles can only be removed by the parent ProfileCollection
Raises:

clone(self)

source code 

Clone profile mirror:
 clone() -> ProfileMirror (or sub-class)
Returns: ProfileCollection
profile mirror

clear(self)

source code 

Profiles can only be cleared by the parent ProfileCollection

profLength(self)

source code 

Length of profile:
 profLength() -> int; length of first non-None profile or 0
Returns: int
length of first non-None profile or 0

Instance Variable Details [hide private]

map


feature -> model map from parent feature

default


default value to use if profile is removed / changed by set()

_viewSignal


support CrossView de-activation