Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/ViCCo-Group/THINGS-data
02 March 2023, 06:01:16 UTC
  • Code
  • Branches (2)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/main
    • refs/heads/oli
    • 2d95c15d3a2cc5984ffd4a9a2c4ad3496847ca9d
    No releases to show
  • 103c132
  • /
  • MEG
  • /
  • step3bb_plot_validation_fmri_meg_combo.m
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge Iframe embedding
swh:1:cnt:bc301739f7b734608b510c416e4dce087b74e119
origin badgedirectory badge Iframe embedding
swh:1:dir:000e91241105269711aba9dceee5d5fb752db093
origin badgerevision badge
swh:1:rev:2d95c15d3a2cc5984ffd4a9a2c4ad3496847ca9d
origin badgesnapshot badge
swh:1:snp:4c1e0fab18d6e2d8038137bab93d0cb9721ba358

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 2d95c15d3a2cc5984ffd4a9a2c4ad3496847ca9d authored by Oliver Contier on 28 February 2023, 15:15:53 UTC
fixed howtocite
Tip revision: 2d95c15
step3bb_plot_validation_fmri_meg_combo.m
function step3bb_plot_validation_fmri_meg_combo(bids_dir, varargin)
    %% Function that plots the results of the combination analysis between fMRI and MEG
    % we are taking the univariate activation in V1 and FFA and use the
    % time-resolved MEG data to predict these
    %
    % @ Lina Teichmann, 2022
    %
    % Usage:
    % step3bb_plot_validation_fmri_meg_combo(bids_dir, ...)
    %
    % Inputs:
    %   bids_dir        path to the bids root folder 
    %
    % Returns:
    %   _               Figure in BIDS/derivatives folder


    %% folders
    res_dir         = [bids_dir '/derivatives/output/']; 
    figdir          = [bids_dir '/derivatives/figures/'];
    
    n_participants  = 4;


    % plotting parameters
    col_pp          = [0.21528455710115266, 0.5919540462603717, 0.3825837270552851;
                         0.24756252096251694, 0.43757475330612905, 0.5968141290988245;
                         0.7153368599631209, 0.546895038817448, 0.1270092896093349;
                         0.6772691643574462, 0.3168004639904812, 0.3167958318320575];

    col_pp_light    = [0.6020264172614653, 0.8666010337189269, 0.7198621708097467;
                        0.6329411764705883, 0.7552941176470587, 0.8572549019607842;
                        0.9347450980392157, 0.8266666666666667, 0.5554509803921569;
                        0.9019607843137256, 0.6803921568627451, 0.6803921568627451];

    x_size          = 0.19;
    y_size          = 0.15;
    x_pos           = linspace(0.1,0.9-x_size,4);

    %% load  results
    ffa_res = [];v1_res = [];
    for p = 1:n_participants
        tmp=table2array(readtable([res_dir,'/validation_fMRI-MEG-regression_ffa_P',num2str(p),'.csv'],'ReadVariableNames',1,'PreserveVariableNames',1));
        ffa_res(:,:,p) = tmp(:,2:end);

        tmp=table2array(readtable([res_dir,'/validation_fMRI-MEG-regression_v1_P',num2str(p),'.csv'],'ReadVariableNames',1,'PreserveVariableNames',1));
        v1_res(:,:,p) = tmp(:,2:end);

    end

    % load one example output file to get the time vector
    load([res_dir '/pairwise_decoding/P1_pairwise_decoding_1854_block1.mat'], 'res')
    tv = res.a.fdim.values{1}*1000;


    %% plot
    f = figure(1);clf
    f.Position=[0,0,600,700];
    for p = 1:n_participants
        [bci_ffa,~] = bootci(10000,{@mean,ffa_res(:,:,p)'},'alpha',.05,'type','per');
        [bci_v1,~] = bootci(10000,{@mean,v1_res(:,:,p)'},'alpha',.05,'type','per');

        % plot data with shaded bootci confidence intervals
        ax1 = axes('Position',[x_pos(p),0.5,x_size,y_size],'Units','normalized');hold on

        fill([tv,fliplr(tv)],[bci_ffa(1,:),fliplr(bci_ffa(2,:))],col_pp(p,:),'FaceAlpha',0.4,'EdgeColor',col_pp(p,:),'LineStyle','none')
        a(1)=plot(tv,movmean(mean(ffa_res(:,:,p),2),5),'Color',col_pp(p,:),'LineWidth',2);

        fill([tv,fliplr(tv)],[bci_v1(1,:),fliplr(bci_v1(2,:))],col_pp_light(p,:),'FaceAlpha',0.4,'EdgeColor',col_pp_light(p,:),'LineStyle','none')
        a(2)=plot(tv,movmean(mean(v1_res(:,:,p),2),5),'Color',col_pp_light(p,:),'LineWidth',2);

        plot(tv,tv*0,'k--')

        % make it look pretty
        xlim([tv(1),tv(end)])
        ylim([-0.1,.25])

        legend(a,[{'FFA'},{'V1'}],'box','off')

        % add subject title
        ax1_title = axes('Position',[x_pos(p)+0.001,0.5+y_size-0.01,0.03,0.03]); 
        text(0,0,['M' num2str(p)],'FontSize',12,'FontName','Helvetica');
        ax1_title.Visible = 'off'; 

        % add labels    
        if p ==1
            ax1.YLabel.String = 'r';
        else
            ax1.YTick = [];
        end
        ax1.XLabel.String = 'time (ms)';

        set(ax1,'FontSize',14,'box','off','FontName','Helvetica');

    end


    % Plot differences 
    clear('a')
    for p = 1:4
        toplot = v1_res(:,:,p)-ffa_res(:,:,p);
        [bci,~] = bootci(10000,{@mean,toplot'},'alpha',.05,'type','per');

        % plot data with shaded bootci confidence intervals
        ax1 = axes('Position',[x_pos(p),0.5-y_size*1.5,x_size,y_size],'Units','normalized');hold on

        fill([tv,fliplr(tv)],[bci(1,:),fliplr(bci(2,:))],'k','FaceAlpha',0.4,'EdgeColor',col_pp(p,:),'LineStyle','none')
        a(1)=plot(tv,movmean(mean(toplot,2),5),'Color','k','LineWidth',2);

        plot(tv,tv*0,'k--')

        % make it look pretty
        xlim([tv(1),tv(end)])
        ylim([-0.15,.25])

        % add labels
        if p ==1
            ax1.YLabel.String = 'V1 - FFA';
        else
            ax1.YTick = [];
        end
        ax1.XLabel.String = 'time (ms)';

        set(ax1,'FontSize',14,'box','off','FontName','Helvetica');

        [highest,idx] = max(movmean(mean(toplot,2),5));
        ah = annotation('textarrow','X',[tv(idx)+200,tv(idx)+25],'Y',[highest,highest],'String',[num2str(tv(idx)),' ms'],'HorizontalAlignment','left','FontName','Helvetica','FontSize',14);
        set(ah,'parent',ax1); 
    end


    %% save figure
    fn = [figdir,'/validation_fmri-meg-combo'];
    tn = tempname;
    print(gcf,'-dpng','-r500',tn)

    im=imread([tn '.png']);
    [i,j]=find(mean(im,3)<255);margin=0;
    imwrite(im(min(i-margin):max(i+margin),min(j-margin):max(j+margin),:),[fn '.png'],'png');


    print([fn '.pdf'],'-dpdf')

back to top

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API