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 / files_in_pr.py
Last active March 2, 2023 13:20
Script to get all files touched by PRs
"""Script to get all files touched by PRs."""
import shutil
from pathlib import Path
from warnings import warn
import requests
from rich import print
@Remi-Gau
Remi-Gau / cmd_example.m
Created June 29, 2022 07:22
multidimensional scaling example in matlab
X = [ normrnd(0,1,10,3) normrnd(0,.1,10,1) ]; % generate data
D = pdist(X, 'euclidean'); % compute euclidiant distance
% do multidimensional scaling
% find a configuration with those inter-point distances
% If the first k elements of E are much larger than the remaining (n-k), then you
% can use the first k columns of Y as k-dimensional points, whose interpoint
% distances approximate D. This can provide a useful dimension reduction for
% visualization, e.g., for k==2.
@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
@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 / 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 / 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 / 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)
% 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 / 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;
@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');