SMICA  1.0
Public Member Functions | Public Attributes | Properties | List of all members
smica.model.Model Class Reference
Inheritance diagram for smica.model.Model:
smica.model.ModelI

Public Member Functions

def add_comp
 
def get_comp_by_number
 
def get_comp_by_name
 
def __init__
 
def get_dim
 
def check_covmat_dim
 
def check_bin_dim
 
def dim
 
def get_theta
 
def set_theta
 
def printp
 
def fim
 
def covariance
 
def covariance4D
 
def mixmat
 
def powspec
 
def autopowspec
 
def noise
 
def set_mixmat
 
def set_powspec
 
def set_noise
 
def error_model
 
def mismatch
 
def close_form
 
def joint_diag
 
def ortho_subspace
 
def quasi_newton
 
def wiener
 
def winf
 
def mismatch_penalty
 
def __cg_mismatch__
 
def cg_mismatch
 
def cg_score
 
def cg_fim
 
def cg_ifim
 
def conjugate_gradient
 
def plot_mixmat
 
def plot_powspec
 
def plot_noise
 
def plot_power
 
def plot_em
 
def plot_mismatch
 
def full_fim
 
def error_model_full_fim
 

Public Attributes

 ncomp
 
 nbin
 
 ndet
 

Properties

 dim = property(dim)
 

Detailed Description

A model.

A model is made of several components which share the same
dimensions (number of detectors, number of bins). Each of the
component contribute to its covariance, which is adjusted to the
empirical one.

Constructor & Destructor Documentation

def smica.model.Model.__init__ (   self,
  complist = None,
  ndet = 0,
  nbin = 0,
  ncomp = 0 
)
Set content and/or dimension of object.

Parameters
----------
ndet : number of detectors
nbin : number of bins
ncomp : number of components
complist : list of Component object instance (dimensions have to be compatible).
If None, an arbitrary list of ncomp-1 source components and one
noise component is created.

Member Function Documentation

def smica.model.Model.__cg_mismatch__ (   self,
  theta,
  stats,
  nmodes 
)
Todo:
Find a way to avoid re-set of free parameters for mismatch, score and FIM evaluation.
def smica.model.Model.add_comp (   self,
  component 
)
Add a component to model.

Parameters
----------
component : instance of component object.
def smica.model.Model.autopowspec (   self,
  bin = None 
)
Return source auto power spectra array.

Parameters
----------
bin : bin number. If None, complete array is returned.

Returns
-------
array, shape (dim, nbin).
def smica.model.Model.cg_fim (   self,
  theta,
  stats,
  nmodes 
)
Set model with new parameters and return Fisher Information Matrix.

Parameters
----------
theta : array-like, shape (N, 1), where N is the number of free parameters.
stats : array-like, shape (ndet, ndet, nbin).
Second order statistics ie empirical covariance matrices of
the observations.
nmodes : array-like, shape (nbin,1).
Number of modes of each bin.

Returns
-------
array-like, shape (N, N), where N is the number of free parameters.
def smica.model.Model.cg_ifim (   self,
  theta,
  stats,
  nmodes 
)
Set model with new parameters and return inverse of Fisher
Information Matrix.

Parameters
----------
theta : array-like, shape (N, 1), where N is the number of free parameters.
stats : array-like, shape (ndet, ndet, nbin).
Second order statistics ie empirical covariance matrices of
the observations.
nmodes : array-like, shape (nbin,1).
Number of modes of each bin.

Returns
-------
array-like, shape (N, N), where N is the number of free parameters.
def smica.model.Model.cg_mismatch (   self,
  theta,
  stats,
  nmodes 
)
Set model with new parameters and return integrated
mismatch between model and stats.

Parameters
----------
theta : array-like, shape (N, 1), where N is the number of free parameters.
stats : array-like, shape (ndet, ndet, nbin).
Second order statistics ie empirical covariance matrices of
the observations.
nmodes : array-like, shape (nbin,1).
Number of modes of each bin.

Returns
-------
scalar.
def smica.model.Model.cg_score (   self,
  theta,
  stats,
  nmodes 
)
Set model with new parameters and return score.

Parameters
----------
theta : array-like, shape (N, 1), where N is the number of free parameters.
stats : array-like, shape (ndet, ndet, nbin).
Second order statistics ie empirical covariance matrices of
the observations.
nmodes : array-like, shape (nbin,1).
Number of modes of each bin.

Returns
-------
array-like, shape (N, 1), where N is the number of free parameters.
def smica.model.Model.check_bin_dim (   self,
  bins 
)
Check dimension compatibility between bins and model.

Parameters
----------
bins : array-like, shape (1, nbin).
def smica.model.Model.check_covmat_dim (   self,
  stats 
)
Check dimension compatibility between stats and model.

Parameters
----------
stats : array-like, shape (ndet, ndet, nbin).
Second order statistics ie empirical covariance matrices of
the observations.
def smica.model.Model.close_form (   self,
  stats 
)
Update local parameters using a close form algorithm.

Parameters
----------
stats : array-like, shape (ndet, ndet, nbin).
Second order statistics ie empirical covariance matrices of
the observations.
def smica.model.Model.conjugate_gradient (   self,
  stats,
  nmodes,
  maxiter = 10,
  avextol = 1e-3,
  plot = False,
  print_param = False 
)
Update model parameters with Kullback divergence minimum
using conjugate gradient algorithm.

Parameters
----------
stats : array-like, shape (ndet, ndet, nbin).
Second order statistics ie empirical covariance matrices of
the observations.
nmodes : array-like, shape (nbin,1).
maxiter : maximum number of iterations.
avextol : convergence is assumed when the gradient falls below this amount.
plot : boolean. If True, output a plot of the line search state and criterion convergence.
def smica.model.Model.covariance (   self,
  bin = None 
)
Return the covariance matrix(ces).

Parameters
----------
bin : bin number. If None, return all matrices in a three dimensional array.

Returns
-------
array, shape (ndet, ndet, nbin).
def smica.model.Model.covariance4D (   self)
Return the covariance matrix(ces) of each component.

Parameters
----------
bin : bin number. If None, return all matrices in a three dimensional array.

Returns
-------
array, shape (ndet, ndet, nbin, ncomp).
def smica.model.Model.dim (   self)
Return total sources dimension.

This comprises uncorrelated and correlated sources.
def smica.model.Model.error_model (   self,
  nmodes 
)
Return a model object which parameter values are equal to
error bars derived from the FIM.

Parameters
----------
stats : array-like, shape (ndet, ndet, nbin).
Second order statistics ie empirical covariance matrices of
the observations.
nmodes : array-like, shape (nbin,1).
Number of modes of each bin.

Returns
-------
model object instance.
def smica.model.Model.error_model_full_fim (   self,
  nmodes 
)
Return a model object which parameter values are equal to
error bars derived from the full FIM.

Parameters
----------
nmodes : array-like, shape (nbin,1).
Number of modes of each bin.

Returns
-------
model object instance.
def smica.model.Model.fim (   self,
  nmodes 
)
Return Fisher Information Matrix for global parameters.

Only a subset of parameters is used in this FIM, ignoring
those which varies from bin to bin.

Parameters
----------
nmodes : array-like, shape (1, nbin). number of modes for each bin.

Returns
----------
array-like, shape (N, N), where N is the number of free global parameters.
def smica.model.Model.full_fim (   self,
  nmodes 
)
Return full Fisher Information Matrix, ie global and local
parameters with coupling

Parameters
----------
nmodes : array-like, shape (1, nbin). number of modes for each bin.

Returns
----------
A tuple of three element. The first on is an array-like, shape
(N, N), where N is the number of parameters. This is the
FIM. The second is a list of label for each line / column of
the previous return.

The last is a list of information describing each subbloc of
the FIM. Each element of the list is a list containing
- the name of the component
- the class fot the component
- the number of parameters
- a list of two elements : the start and end index in the FIM
def smica.model.Model.get_comp_by_name (   self,
  name 
)
Return component object.

Parameters
----------
name : component name.

Returns
-------
Instance of component object.
def smica.model.Model.get_comp_by_number (   self,
  c 
)
Return component object.

Parameters
----------
c : component number

Returns
-------
Instance of component object.
def smica.model.Model.get_dim (   self)
Return the number of free parameters of the model.

This is the sum of all components free parameters.
def smica.model.Model.get_theta (   self)
Return model parameters as a vector.

Returns
----------
array-like, shape (N, 1), where N is the number of free parameters.
def smica.model.Model.joint_diag (   self,
  stats,
  nmodes 
)
Update mixing matrix using joint diagonalisation algorithm.

Parameters
----------
stats : array-like, shape (ndet, ndet, nbin).
Second order statistics ie empirical covariance matrices of
the observations.
nmodes : array-like, shape (nbin,1).
Number of modes of each bin.
def smica.model.Model.mismatch (   self,
  stats,
  nmodes,
  bin = None,
  exact = False 
)
Return integrated mismatch between model and stats.

Parameters
----------
stats : array-like, shape (ndet, ndet, nbin).
Second order statistics ie empirical covariance matrices of
the observations.
nmodes : array-like, shape (nbin,1).
Number of modes of each bin.
bin : bin number. If None, mismatch is integrated over bins.
def smica.model.Model.mismatch_penalty (   self)
Prior contribution to the mismatch.

Default is 0. Extend get_penalty function of one component to
set a prior contribution.

Returns
-------
scalar.
def smica.model.Model.mixmat (   self)
Return mixing matrix.

Returns
-------
array, shape (ndet, dim).
def smica.model.Model.noise (   self,
  bin = None 
)
Return noise power spectra array.

Parameters
----------
bin : bin number. If None, complete array is returned.

Returns
-------
array, shape (ndet, nbin).
def smica.model.Model.ortho_subspace (   self,
  stats,
  nmodes,
  col,
  qmin = None,
  qmax = None 
)
Update mixing matrix with a matrix orthogonal to its first
column.

Parameters
----------
stats : array-like, shape (ndet, ndet, nbin).
Second order statistics ie empirical covariance matrices of
the observations.
nmodes : array-like, shape (nbin,1).
Number of modes of each bin.
col : array-like, shape (ndet, 1).
First column of the mixing matrix.
def smica.model.Model.plot_em (   self,
  nmodes,
  freqlist = None,
  figfile = None 
)
Plot components electro-magnetic spectra.

Parameters
----------
nmodes : array-like, shape (nbin,1).
Number of modes of each bin.
freqlist : array-like, shape (ndet, 1), x axis values.
figfile : string, filename where to save the plot.
def smica.model.Model.plot_mismatch (   self,
  stats,
  nmodes,
  figfile = None,
  xaxis = None 
)
Plot spectral mismatch between model and stats.

Parameters
----------
stats : array-like, shape (ndet, ndet, nbin).
Second order statistics ie empirical covariance matrices of
the observations.
nmodes : array-like, shape (nbin,1).
Number of modes of each bin.
figfile : string, filename where to save the plot.
xaxis:  array-like, shape (nbin,1). the multipole range.
def smica.model.Model.plot_mixmat (   self,
  freqlist = None,
  compname = None,
  figfile = None 
)
Plot mixing matrix.

Parameters
----------
freqlist : array-like, shape (ndet, 1), x axis values.
compname : list, length (dim), column labels.
figfile : string, filename where to save the plot.
def smica.model.Model.plot_noise (   self,
  freqname = None,
  figfile = None 
)
Plot noise power spectra.

Parameters
----------
freqname : list, length (ndet), plot labels.
figfile : string, filename where to save the plot.
def smica.model.Model.plot_power (   self,
  figfile = None,
  xaxis = None 
)
Plot components power spectra.

Parameters
----------
figfile : string, filename where to save the plot.
xaxis:  array-like, shape (nbin,1). the multipole range.
def smica.model.Model.plot_powspec (   self,
  compname = None,
  figfile = None 
)
Plot power spectra.

Parameters
----------
compname : list, length (dim), plot labels.
figfile : string, filename where to save the plot.
def smica.model.Model.powspec (   self,
  bin = None 
)
Return source power spectra array.

Parameters
----------
bin : bin number. If None, complete array is returned.

Returns
-------
array, shape (dim, dim, nbin).
def smica.model.Model.printp (   self,
  theta 
)
Print component parameters
def smica.model.Model.quasi_newton (   self,
  stats,
  nmodes 
)
Update local parameters by direct resolution of the system.

Power spectra matrices are diagonal (no correlation between sources).

Parameters
----------
stats : array-like, shape (ndet, ndet, nbin).
Second order statistics ie empirical covariance matrices of
the observations.
nmodes : array-like, shape (nbin,1).
Number of modes of each bin.
def smica.model.Model.set_mixmat (   self,
  mixmat 
)
Set mixing matrix.

Parameters
----------
mixmat : array-like, shape (ndet, dim).
def smica.model.Model.set_noise (   self,
  N,
  bin = None,
  fixed = None 
)
Set noise power spectra.

Parameters
----------
powspec : array-like, shape (ndet, nbin).
bin : bin number. If None, all bins are set.
fixed : array-like, shape (ndet, nbin)
Entries which are not equal to zero point to
fixed indices.  It is also possible to use keywords 'all' and
'null' to fix (respectively) all parameters or none.
def smica.model.Model.set_powspec (   self,
  powspec,
  bin = None,
  diag_opt = 0 
)
Set source power spectra.

Parameters
----------
powspec : array-like, shape (dim, dim, nbin).
bin : bin number. If None, all bins are set.
diag_opt : if true set cross spectra of correlated component
to zero (powspec is then (dim, nbin)).
def smica.model.Model.set_theta (   self,
  theta,
  verbose = False 
)
Set new values for model parameters.

Parameters
----------
theta : array-like, shape (N, 1), where N is the number of free parameters.
def smica.model.Model.wiener (   self,
  stats,
  diag_opt = 0 
)
Update local parameters with Wiener approximation.

The Wiener filter is computed from mixing matrix and noise
values.

Parameters
----------
stats : array-like, shape (ndet, ndet, nbin).
Second order statistics ie empirical covariance matrices of
the observations.
diag_opt : if true set cross spectra of correlated component
to zero.
def smica.model.Model.winf (   self)
Compute multi-components wiener filter in the high snr limit.

Returns
-------
array-like, shape (nccomp-1,m,m,N).

The documentation for this class was generated from the following file: