MUSIC#

class invert.solvers.music.SolverFLEXMUSIC(name='FLEX-MUSIC', **kwargs)#
Class for the RAP Multiple Signal Classification with flexible extent

estimation (FLEX-MUSIC).

References

This method is of my own making (Lukas Hecker, 2022) and soon to be published.

make_flex(y, n, k, stop_crit, truncate)#

Create the FLEX-MUSIC inverse solution to the EEG data.

Parameters
  • y (numpy.ndarray) – EEG data matrix (channels, time)

  • n (int/ str) – Number of eigenvectors to use or “auto” for l-curve method.

  • k (int) – Number of recursions.

  • stop_crit (float) – Criterion to stop recursions. The lower, the more dipoles will be incorporated.

  • truncate (bool) – If True: Truncate SVD’s eigenvectors (like TRAP-MUSIC), otherwise don’t (like RAP-MUSIC).

Returns

x_hat – Source data matrix (sources, time)

Return type

numpy.ndarray

make_inverse_operator(forward, mne_obj, *args, alpha='auto', n_orders=3, n='auto', k='auto', stop_crit=0.95, truncate=True, verbose=0, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (float) – The regularization parameter.

  • n_orders (int) – Controls the maximum smoothness to pursue.

  • n (int/ str) – Number of eigenvectors to use or “auto” for l-curve method.

  • k (int) – Number of recursions.

  • stop_crit (float) – Criterion to stop recursions. The lower, the more dipoles will be incorporated.

  • truncate (bool) – If True: Truncate SVD’s eigenvectors (like TRAP-MUSIC), otherwise don’t (like RAP-MUSIC).

Returns

self

Return type

object returns itself for convenience

prepare_flex(n_orders)#

Create the dictionary of increasingly smooth sources.

Parameters

n_orders (int) – Number of neighborhood orders to include to the dictionary. The higher, the smoother the sources can be.

class invert.solvers.music.SolverMUSIC(name='MUSIC', **kwargs)#
Class for the Multiple Signal Classification (MUSIC) inverse solution

[1].

References

[1] Baillet, S., Mosher, J. C., & Leahy, R. M. (2001). Electromagnetic brain mapping. IEEE Signal processing magazine, 18(6), 14-30.

make_inverse_operator(forward, mne_obj, *args, alpha='auto', n='auto', stop_crit=0.95, verbose=0, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (float) – The regularization parameter.

  • n (int/ str) – Number of eigenvectors to use or “auto” for l-curve method.

  • stop_crit (float) – Criterion to stop recursions. The lower, the more dipoles will be incorporated.

Returns

self

Return type

object returns itself for convenience

make_music(y, n, stop_crit)#

Apply the MUSIC inverse solution to the EEG data.

Parameters
  • y (numpy.ndarray) – EEG data matrix (channels, time)

  • n (int) – Number of eigenvectors to use.

  • stop_crit (float) – Criterion at which to select candidate dipoles. The lower, the more dipoles will be incorporated.

Returns

x_hat – Source data matrix (sources, time)

Return type

numpy.ndarray

class invert.solvers.music.SolverRAPMUSIC(name='RAP-MUSIC', **kwargs)#

Class for the Recursively Applied Multiple Signal Classification (RAP-MUSIC) inverse solution [1].

References

[1] Mosher, J. C., & Leahy, R. M. (1999). Source localization using recursively applied and projected (RAP) MUSIC. IEEE Transactions on signal processing, 47(2), 332-340.

make_inverse_operator(forward, mne_obj, *args, alpha='auto', n='auto', k='auto', stop_crit=0.95, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (float) – The regularization parameter.

  • n (int/ str) – Number of eigenvectors to use or “auto” for l-curve method.

  • k (int) – Number of recursions.

  • stop_crit (float) – Criterion to stop recursions. The lower, the more dipoles will be incorporated.

Returns

self

Return type

object returns itself for convenience

make_rap(y, n, k, stop_crit)#

Apply the RAP-MUSIC inverse solution to the EEG data.

Parameters
  • y (numpy.ndarray) – EEG data matrix (channels, time)

  • n (int) – Number of eigenvectors to use.

  • k (int) – Number of recursions.

  • stop_crit (float) – Criterion to stop recursions. The lower, the more dipoles will be incorporated.

Returns

x_hat – Source data matrix (sources, time)

Return type

numpy.ndarray

class invert.solvers.music.SolverTRAPMUSIC(name='TRAP-MUSIC', **kwargs)#
Class for the Truncated Recursively Applied Multiple Signal

Classification (TRAP-MUSIC) inverse solution [1].

References

[1] Mäkelä, N., Stenroos, M., Sarvas, J., & Ilmoniemi, R. J. (2018). Truncated rap-music (trap-music) for MEG and EEG source localization. NeuroImage, 167, 73-83.

make_inverse_operator(forward, mne_obj, *args, alpha='auto', n='auto', k='auto', stop_crit=0.95, **kwargs)#

Calculate inverse operator.

Parameters
  • forward (mne.Forward) – The mne-python Forward model instance.

  • mne_obj ([mne.Evoked, mne.Epochs, mne.io.Raw]) – The MNE data object.

  • alpha (float) – The regularization parameter.

  • n (["auto", int]) – Number of eigenvectors to use.

  • k (int) – Number of recursions.

  • stop_crit (float) – Controls the percentage of top active dipoles that are selected (i.e., sparsity).

Returns

self

Return type

object returns itself for convenience

make_trap(y, n, k, stop_crit)#

Apply the TRAP-MUSIC inverse solution to the EEG data.

Parameters
  • y (numpy.ndarray) – EEG data matrix (channels, time)

  • n (int) – Number of eigenvectors to use.

  • k (int) – Number of recursions.

  • stop_crit (float) – Criterion to stop recursions. The lower, the more dipoles will be incorporated.

Returns

x_hat – Source data matrix (sources, time)

Return type

numpy.ndarray