Stage 19: band-limited power in source space ============================================ ``19-kit_source_band_power.py`` localises oscillatory activity that is not phase-locked to an event: alpha between a cue and the stimulus it announces, beta around a movement. Such activity has a different phase in every trial, so it cancels in the average and is absent from the evoked estimates of stage 18. Its *power* does not cancel. This stage computes the power trial by trial in source space, then averages it. .. code-block:: bash python 19-kit_source_band_power.py -c pipeline_config_files/attentionworden_config.yml [--overwrite] [--no-plots] [--no-movies] It runs after stage 18 and reuses its work: the inverse operator of every recording (same forward model, noise covariance, ``loose`` / ``depth`` and ``method``) and the morph to ``fsaverage``. It adds outputs of its own and changes nothing of the other stages. The group stages (21 and 22) work on the evoked estimates only; the outputs of this stage are per subject. Inputs: the stage-10 epochs (``*_ev_epo.fif``), the stage-18 inverse operators (``*_desc-_inv.fif``) and the condition names of ``events.conditions``. Outputs, under ``derivatives/19-kit_source_band_power/sub-/``: - ``_cond-_band-_desc-power_space-fsaverage-{lh,rh}.stc``: the power over time of one condition in one recording, averaged over the trials and the frequencies of the band, on ``fsaverage`` (not baseline-corrected); - ``_band-_desc-power_trials.tsv``: one row per trial with the power of the left and the right region in the analysis window and their lateralisation index; - ``sub-_cond-_band-_desc-powerchange_space-fsaverage-{lh,rh}.stc``: the subject's map of a condition (recordings averaged with nave weights), as the percent change from the baseline window; - ``sub-_contrast-_band-_desc-powermodulation_space-fsaverage-{lh,rh}.stc``: the modulation index 100 (a - b) / (a + b) of a contrast; - ``sub-_band-_desc-regions.tsv`` and ``figures/sub-_band-_desc-regions.png``: the time course of the power in the two regions per condition, and the lateralisation index over time; - ``sub-_contrast-_band-_desc-lateralisation.json``: the comparison of the trial-wise lateralisation index between the two sides of the contrast; - for every subject map: ``*_frames/``, ``*_slider.html``, ``*_movie.mp4`` (or ``.gif``) and ``*_desc-peakframe.png``, rendered by the functions of stage 24 with the ``source.movies`` settings; - ``source_band_power_summary.csv``: one row per subject, band and condition or contrast. What it does ------------ 1. **Power per trial, per recording** (``mne.minimum_norm.source_band_induced_power``). Every epoch is convolved with Morlet wavelets at the frequencies of the band (``freq_step_hz`` apart, ``n_cycles`` cycles each), the result is projected through the inverse operator with ``lambda2 = 1 / snr**2``, the power of the three source orientations is summed, and the power is averaged over the frequencies and over the trials. ``snr`` is lower than in stage 18 (1 instead of 3) because single trials are noisier than their average. With ``subtract_evoked: true`` the average response is removed from every trial first, which leaves the induced power only; by default the power is the total power, evoked part included. The first and last ``crop_edges_s`` of the epoch, where the wavelets reach beyond the data, are dropped. The estimate is morphed to ``fsaverage``. 2. **One map per subject and condition.** The recordings of a subject are averaged with nave weights, as stages 21 and 24 do for the evoked estimates. The map is then expressed as the percent change from the mean power in ``baseline.window``, at every source. Without a baseline window no condition map is written (the contrasts do not need one). 3. **Contrasts within the subject.** For each contrast ``a`` minus ``b`` (``contrasts``, or ``source.group.contrasts`` when ``null``) the modulation index 100 (a - b) / (a + b) is computed from the power itself. It is zero where the two conditions have the same power and needs no baseline, which matters when the question is about the period *before* an event. 4. **Two regions and their lateralisation.** ``lateralisation.labels`` names labels of the parcellation ``source.inverse.labels.parc``; they are merged into one region per hemisphere. The figure shows the power of each region over time and the lateralisation index LI = (R - L) / (R + L). For the statistics the power of the two regions is computed for every trial in ``lateralisation.window`` (``mne.minimum_norm.compute_source_psd_epochs`` on the cropped epochs, in the anatomy of the subject, averaged over the band and over the vertices of the region), which gives one LI per trial. The trials of ``a`` and of ``b`` of all recordings are then compared: Welch t-test, a permutation test of the difference of the means (``n_permutations``, ``seed``) and Cohen's d. The log power of each region is compared in the same way, which shows which hemisphere carries a difference. These are tests over the trials of one subject; they say nothing about a population. 5. **Movies.** Each subject map is rendered over time by the functions of stage 24, with a diverging colour scale because the maps are signed (red: more power than at baseline, or more in ``a`` than in ``b``). Configuration ------------- .. code-block:: yaml source: band_power: enabled: true conditions: [cue_left, cue_right] # [] = every condition with stage-10 epochs contrasts: null # null = source.group.contrasts bands: {alpha: [8, 14]} freq_step_hz: 1.0 n_cycles: 4 snr: 1.0 decim: 20 subtract_evoked: false crop_edges_s: 0.1 baseline: {window: [-0.4, -0.1]} lateralisation: enabled: true labels: [lateraloccipital, cuneus, pericalcarine, lingual] window: [0.775, 1.025] n_permutations: 5000 seed: 97 movies: true save_plots: true n_jobs: 1 Reuse: a recording is recomputed when its epochs or its inverse operator changed, when the settings changed, or with ``--overwrite``. The subject maps are rebuilt from the recordings at every run; the movies are re-rendered only when the maps or the ``source.movies`` settings changed. Reading the result ------------------ - The condition maps answer "where does the power rise or fall after the event, relative to before it". Expect a decrease over the sensory cortex that processes a stimulus. - The contrast map answers "where does the power differ between the two conditions". It is noisy with few trials: individual sources are not tested, so read the regions and the trial-wise comparison for a decision. - A wavelet of 4 cycles at 8 Hz is about a quarter of a second long, so the maps are smooth in time by that much: a change that seems to start before an event is partly this smoothing.