sesameeg.EmpPdf¶
- class sesameeg.EmpPdf(n_parts, n_verts, lam, dip_mom_std=None, prior_locs=None, fixed_ori=False, hyper_q=False, verbose=False)[source]¶
Empirical probability density function (pdf) class for SESAME.
- Parameters:
- n_parts
int The number of particles forming the empirical pdf.
- n_verts
int The number of the points in the given brain discretization.
- lam
float The parameter of the prior Poisson pdf of the number of dipoles.
- dip_mom_std
float The standard deviation of the prior of the dipole moment.
- hyper_q
bool If True, use hyperprior in dipole strength
- n_parts
- Attributes:
- particles
ndarrayof instances ofParticle, shape(n_parts,) The EmpPdf’s particles.
- logweights
ndarrayoffloat, shape(n_parts,) The logarithm of the weights of the particles forming the empirical pdf.
- ESS
float The Effective Sample Size
- exponents
ndarrayoffloat Array whose entries represent points in the space of artificial distributions. It is used to keep track of the path followed by SESAME.
- model_sel
ndarrayoffloat Marginal posterior probability of the number of sources.
- est_n_dips
float Estimated number of sources.
- pmap
ndarrayoffloat, shape(est_n_dips x n_verts) Intensity measure of the point process.
- est_locs
ndarrayofint Estimated sources locations
- particles
- compute_exponent(noise_std)[source]¶
The choice for the sequence of artificial distributions consists in starting from the prior distribution and moving towards the posterior by increasing the exponent of the likelihood function with the iterations.
This method computes the exponent to be used in the next iteration in an “adaptive” manner in order to optimize the trade-off between the computational speed and the quality of the approximation. Moreover, the method updates the particle weights.
- Parameters:
- noise_std
float The standard deviation of the noise distribution.
- noise_std
- point_estimate(D, max_n_dips, n_sources=None)[source]¶
Computes a point estimate for the number of active dipoles and their locations from the posterior pdf.
- Parameters:
- resample()[source]¶
Performs a systematic resampling step of the whole empirical pdf in which the particles having small normalized importance weights are most likely discarded whereas the best particles are replicated in proportion to their importance weights. This is done in order to prevent the degeneracy of the sample (namely the circumstance in which all but one particle have negligible weights).
- sample(n_verts, r_data, lead_field, neigh, neigh_p, noise_std, lam, max_n_dips)[source]¶
Perform a full evolution step of the whole empirical pdf.
- Parameters:
- n_verts
int The number of the points in the given brain discretization.
- r_data
ndarrayoffloat, shape (n_sens, n_ist) The real part of the data; n_sens is the number of sensors and n_ist is the number of time-points.
- lead_field
ndarrayoffloat, shape (n_sens x n_comp*n_verts) The leadfield matrix. (n_comp = 1, if fixed orientation, 3, if free orientation)
- neigh
ndarrayofint The neighbours of each point in the brain discretization.
- neigh_p
ndarrayoffloat The neighbours’ probabilities.
- noise_std
float The standard deviation of the noise distribution.
- sigma_q
float The standard deviation of the prior of the dipole moment
- lam
float The parameter of the prior Poisson pdf of the number of dipoles.
- max_n_dips
int The maximum number of dipoles allowed in a particle.
- n_verts