pyfaust.demo module

The module for pyfaust demos.

class pyfaust.demo.quickstart

The FAuST quickstart script, a good place to look at for a first tour.

static run()

Launches the quickstart demo.

class pyfaust.demo.fft

FFT demo: multiplication runtime comparison between DFT matrix-vector and Faust(FFT)-vector.

static fig_speed_up_fourier(input_dir='pyfaust_demo_output', output_dir='pyfaust_demo_figures')

Builds the speedup figure.

static speed_up_fourier(output_dir='pyfaust_demo_output')

Runs the multiplication benchmark.

class pyfaust.demo.runtimecmp

Runtime comparison demo: Faust-vector and dense matrix-vector multiplications, differents RCGs, transpose.

static fig(input_dir='pyfaust_demo_output', output_dir='pyfaust_demo_figures')

Renders in file the demo figure in file from the results of runtimecmp.run.

static run(output_dir='pyfaust_demo_output')

Runs the runtime comparision benchmark.

class pyfaust.demo.hadamard

The demo for the hierarchical factorization of Hadamard matrices.

static fig_fact(input_dir='pyfaust_demo_output', output_dir='pyfaust_demo_figures')

Renders in file the figure for the results produced by hadamard.run_fact.

static fig_norm_hadamard(input_dir='pyfaust_demo_output', output_dir='pyfaust_demo_figures')

Renders in file the figure for the results produced by hadamard.run_norm_hadamard.

static fig_speedup_hadamard(output_dir='pyfaust_demo_figures', input_dir='pyfaust_demo_output')

Renders in file the figure for the results produced by hadamard.run_speedup_hadamard.

static figs(input_dir='pyfaust_demo_output', output_dir='pyfaust_demo_figures')

Calls all hadamard.fig_* functions in a row.

static run_fact(output_dir='pyfaust_demo_output')

This demo hierarchically factorizes the Hadamard dictionary and then plots the results. This essentially reproduces figure 2 from [1].

[1] Le Magoarou L. and Gribonval R., “Flexible multi-layer sparse approximations of matrices and applications”, Journal of Selected Topics in Signal Processing, 2016.

static run_norm_hadamard(output_dir='pyfaust_demo_output')

This demo makes some time comparison between the 2-norm of the Hadamard matrix and its Faust representation for differents sizes of the Hadamard matrix.

static run_speedup_hadamard(output_dir='pyfaust_demo_output')

This demo makes some time comparison between (Hadamard matrix)-vector multiplication and (Hadamard factorisation i.e a FAuST)-vector multiplication for Hadamard matrices of different sizes.

class pyfaust.demo.bsl

Brain Source Localization demo.

static fig(input_dir='pyfaust_demo_output', output_dir='pyfaust_demo_figures')

Calls all fig*() functions of bsl demo. .. note:: Must be call after the bsl.run function.

static fig_convergence(input_dir='pyfaust_demo_output', output_dir='pyfaust_demo_figures')

This function builds a figure similar to the BSL figure (Fig 9) used in [1].

References:

[1] Le Magoarou L. and Gribonval R., “Flexible multi-layer sparse approximations of matrices and applications”, Journal of Selected Topics in Signal Processing, 2016. https://hal.archives-ouvertes.fr/hal-01167948v1

static fig_speedup(input_dir='pyfaust_demo_output', output_dir='pyfaust_demo_figures')

Builds the speedup comparison figure for the BSL with the differents Faust representations of the MEG matrix.

static fig_time_cmp(input_dir='pyfaust_demo_output', output_dir='pyfaust_demo_figures', use_precomputed_data=False)

Builds the time comparison figure for the BSL with the differents Faust representations of the MEG matrix.

static run(input_data_dir='/home/gitlab-runner/builds/miE7iDyU/0/faustgrp/faust/build/wrapper/matlab/data', output_dir='pyfaust_demo_output', on_gpu=False)

This function performs brain source localization. It uses several gain matrices [2], including FAuSTs, and OMP solver. It reproduces the source localization experiment of [1]. The results are stored in output_dir+”results_BSL_user.mat”.

Args:

on_gpu: if True the demo is ran on GPU (if cuda backend is available).

DURATION:

Computations should take around 3 minutes.

The MEG gain matrices used are the precomputed ones in get_data_dirpath()+”/faust_MEG_rcg_X.mat” (in the installation directory of the FAuST toolbox)

References:

[1] Le Magoarou L. and Gribonval R., “Flexible multi-layer sparse approximations of matrices and applications”, Journal of Selected Topics in Signal Processing, 2016. https://hal.archives-ouvertes.fr/hal-01167948v1

[2] A. Gramfort, M. Luessi, E. Larson, D. Engemann, D. Strohmeier, C. Brodbeck, L. Parkkonen, M. Hamalainen, MNE software for processing MEG and EEG data http://www.ncbi.nlm.nih.gov/pubmed/24161808, NeuroImage, Volume 86, 1 February 2014, Pages 446-460, ISSN 1053-8119

static sparse_coeffs(D, ntraining, sparsity)

Generates sparse coefficients. Gamma = sparse_coeffs(D, ntraining, sparsity) generates ntraining sparse vectors stacked in a matrix Gamma.

Each sparse vector is of size the number of atoms in the dictionary D, its support is drawn uniformly at random and each non-zero entry is iid Gaussian.

References:

[1] Le Magoarou L. and Gribonval R., “Learning computationally efficient dictionaries and their implementation as fast transforms”, submitted to NIPS 2014