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_partsint

The number of particles forming the empirical pdf.

n_vertsint

The number of the points in the given brain discretization.

lamfloat

The parameter of the prior Poisson pdf of the number of dipoles.

dip_mom_stdfloat

The standard deviation of the prior of the dipole moment.

hyper_qbool

If True, use hyperprior in dipole strength

Attributes:
particlesndarray of instances of Particle, shape(n_parts,)

The EmpPdf’s particles.

logweightsndarray of float, shape(n_parts,)

The logarithm of the weights of the particles forming the empirical pdf.

ESSfloat

The Effective Sample Size

exponentsndarray of float

Array whose entries represent points in the space of artificial distributions. It is used to keep track of the path followed by SESAME.

model_selndarray of float

Marginal posterior probability of the number of sources.

est_n_dipsfloat

Estimated number of sources.

pmapndarray of float, shape(est_n_dips x n_verts)

Intensity measure of the point process.

est_locsndarray of int

Estimated sources locations

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_stdfloat

The standard deviation of the noise distribution.

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:
Dndarray of float, shape (n_verts x n_verts)

The Euclidean distance between the points in the brain discretization.

max_n_dipsint

The maximum number of dipoles allowed in a particle.

n_sources: :py:class:`~int` | None

If not None, manually set the number of sources of the dipole configuration.

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_vertsint

The number of the points in the given brain discretization.

r_datandarray of float, 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_fieldndarray of float, shape (n_sens x n_comp*n_verts)

The leadfield matrix. (n_comp = 1, if fixed orientation, 3, if free orientation)

neighndarray of int

The neighbours of each point in the brain discretization.

neigh_pndarray of float

The neighbours’ probabilities.

noise_stdfloat

The standard deviation of the noise distribution.

sigma_qfloat

The standard deviation of the prior of the dipole moment

lamfloat

The parameter of the prior Poisson pdf of the number of dipoles.

max_n_dipsint

The maximum number of dipoles allowed in a particle.