Skip to content

Instantly share code, notes, and snippets.

View Remi-Gau's full-sized avatar
💭
If someone asks for me, I am on GitHub

Remi Gau Remi-Gau

💭
If someone asks for me, I am on GitHub
View GitHub Profile
@Remi-Gau
Remi-Gau / transparency_color_map.m
Last active July 14, 2019 14:34
Plot matlab color map with transparency on x axis
G = figure('color', [.5 .5 .5], 'Units', 'Normalized', 'Position', [0.5, 0.4, 0.06, 0.35]);
CM = colormap;
% x represents the range in alpha (e.g abs(t-stats))
x = linspace(1, 1000, 256);
% y represents the range in hue (e.g power)
y = linspace(1, 1000, 1000);
[X,Y] = meshgrid(x,y); % Transform into a 2D matrix
@Remi-Gau
Remi-Gau / DummyBIDS.sh
Last active April 9, 2019 09:52
bash script to create a dummy BIDS data set to test the MP2RAGE JSON file naming
#!/bin/bash
# small bash script to create a dummy BIDS data set to test the MP2RAGE JSON file naming
# defines where the BIDS data set will be created
StartDir=`pwd` # relative to starting directory
echo $StartDir/../../../BIDS/7t_mp2rage/
StartDir=$StartDir/../../../BIDS/7t_mp2rage/
mkdir $StartDir
@Remi-Gau
Remi-Gau / print_SPM_results_to_csv
Created December 13, 2018 13:30
script that prints the results of an SPM contrats (obtained via the GUI on SPM) to a csv file
% script that prints the results of an SPM contrats (obtained via the GUI on SPM)
% to a csv file
%% Print a csv files of the results
Results_file = 'result.csv';
fid = fopen (Results_file, 'w');
fprintf (fid, '%s', xSPM.title);
fprintf (fid, '\n\n');
@Remi-Gau
Remi-Gau / p-hacking_increases_ power.m
Last active February 26, 2019 10:44
p-hacking "increases power"
% small matlab script to show how p-hacking "increases power" :
% number of false negatives drops as more studies are "p-hacked"
% from Iaonnidis 2005; table 2 ; DOI: 10.1371/journal.pmed.0020124
R = 0.1; % pre-study odds
u = 0:.02:1; % bias : proportion of study that should have given a
% negative but turn out positive (QRPs or other errors).
c = 100; %number of relationship tested
alpha = 0.05;
beta = 0.5;
% small script to show some basic way to render volume data on surfaces using SPM
clear
close all
clc
% which surface to use
% uses one of the default SPM surfaces but it should be doable to create you own
% from the results of a segmentation or from some freesurfer output to have
% a better group template
@Remi-Gau
Remi-Gau / stat_sig_filter.m
Created July 14, 2019 14:38
statistical significance filter
% small script to show how stat significance filters results and leads to
% overestimation of effect size if only positive findings are considered
clear;
clc;
STD = 1; % Standard deviation of the effect (true std of the population we are modelling)
UES = 0.1:.1:1; % Unstandardized Effect size (true mean of the population we are modelling)
SES = UES/STD; % Standardized effect size (for info)
@Remi-Gau
Remi-Gau / triggerSend.m
Created December 6, 2019 19:11
to send triggers the regular way or via a sound card
function [audio_config] = triggerSend(action, device, audio_config)
% a wrapper function to interact with psychport audio in case you are using a Fireface UC Mac / RME_RCAtrig
% external sound card.
%
% usage:
% [audio_config] = triggerSend('open', device, audio_config)
% Will open PsychPortAudio and return audio_config with the relevant
% field that are needed later (pahandle, dev_n_channels, devID). Will also set volume of trigger
% channel when using the external sound card.
%
@Remi-Gau
Remi-Gau / Dealing_with_submodule.md
Created July 25, 2020 05:59
Dealing with submodule

repo_with_submod

More details here:

https://git-scm.com/book/en/v2/Git-Tools-Submodules

Adding submodules in the repo

I add 2 dummy repo I created on my account as submodules

@Remi-Gau
Remi-Gau / update_submodules.yml
Created April 25, 2022 07:29
Github workflow to update submodules
name: update submodules
# requires sudmodules URL to be "https..." (no ssh)
#
# requires submodule to be specified to follow a specific branch (stored in .gitmodules)
#
# clone them with:
#
# git submodule add -b branch_to_follow https://github.com/... submodule_path
#
@Remi-Gau
Remi-Gau / extract_fmriprep_regressors_for_spm.m
Last active December 3, 2023 04:10
Extract fmriprep regressors for SPM model specification
% extracts confounds of interest from fmriprep timeseries.tsv
% and saves them for easier ingestion by SPM model specification
%
% the output should have a BIDS like structure too a bit like this
%
% spm12
% ├── CHANGES
% ├── dataset_description.json
% ├── README
% └── sub-01