sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d612391399096edf2083d1daf95e9998cf0443e1f39335d780f48b8191b42bdc
MATLAB
2,968
99
function multCond_pe(cfg, i_sub, i_run, hbi_model_path, output_path) %MULTCOND_PE Summary of this function goes here% Detailed explanation goes here %% Load behav_data .mat behav_data_path = fullfile('/projects/crunchie/moehring/neurovar_v2/log_files',... strcat('sub-', sprintf('%02d',i_sub)),'be...
667629faf85f68b847c37694a980f03ac014baecd74beeb825b2a72e157315ed
MATLAB
2,976
87
function MakeAverageSpkWaveF(fbasename) % This function has to be launched from root data folder and will load the % different dat files in each of the fbasename-xx folders rootname = [fbasename filesep fbasename]; xmlFname = [rootname '.xml']; analysisDir = [fbasename filesep 'Analysis']; if ~exist(analysisDir,'di...
3f29e793b61ca96215f2652eebd73853870edfafd8f98e2774904e462caf9eb1
MATLAB
2,978
85
% Preprocessing unit test % % undersample tol = 10e-10; N = 120; X = randn(N,1); % Get default parameters param = mv_get_preprocess_param('undersample'); %% if data is already balanced then undersampling should have no effect clabel = ones(N,1); clabel(N/3+1:2*N/3) = 2; clabel(2*N/3+1:end) = 3; [~, ~, clabel2] = m...
5228333599700e75a5b3faa588098f115e0e6f2ae0822433859e47d70d8921af
MATLAB
2,978
78
function coord_w = minc_voxel2world(coord_v,mat,opt); % Convert coordinates in the voxel space into coordinates in the world % space. % % SYNTAX: % COORD_W = MINC_VOXEL2WORLD(COORD_V,MAT,OPT) % % _________________________________________________________________________ % INPUTS: % % COORD_V % (matrix N*3) each r...
00ebe3f232be4cc90b581c3eafc45ddb7160cbaa6ef17ad4cca9578bbb804547
MATLAB
2,982
86
function output_filename = create_participants_tsv(varargin) % % Creates a simple participants tsv for a BIDS dataset. % % USAGE:: % % output_filename = bids.util.create_participants_tsv(layout_or_path, ... % 'use_schema', true, ... % ...
aa91eca7e53d799d1be7557678313e6a4fb8eed01bb38460b146e4adc4f6c50a
MATLAB
2,982
69
% function [msg_length] = display_progress(cfg,cnt,n_decodings,start_time,msg_length) % % Function to display progress and the estimated time to go in The Decoding % Toolbox (i.e. how far is the analysis?). % MH 2015/06/18: introduced prev_time to get more accurate estimation of % time to go if other processes s...
8577842fe8e8e561860efe66fc355206c3aed8df6a8e97e998f407f7157c845e
MATLAB
2,983
101
%% Find beta bursts for each subject % Import ROI time series. Filter and find bursts. % The tool for finding bursts are found herE: https://github.com/mcvinding/beta_bursts % % Vinding, M. C., Eriksson, A., Low, C. M. T., Waldthaler, J., Ferreira, D., Ingvar, M., Svenningsson, P., & Lundqvist, D. (2021). Different fea...
5aa53eb2ea20c112a49371d3d485130b1557ad463f25e5f90dd79ecdce287872
MATLAB
2,985
86
%% Bar Plot of d' and LR Bias (Pooled + JK errorbars) %% Code monkey = ["G","B"]; global Trials Trials = ["All","RF"]; sessions_list = {[4:15 18 20:24], [34:45]}; flag_scatter = 0; for RF = 1 eval(sprintf("load('data/high_low_split/split_%sTrials.mat')",Trials(RF+1))); par_all = cell(1,2);...
1bd782a4e7d0484f0ea2ba65b6829274bfea011fd060c4baf638cd8d942067c7
MATLAB
2,987
75
% this script changes the voxel size and keeps the bounding box of images % (you can change the bounding box easily too). % % it creates all result files in a new directory % % this version is especially tailored if you like to reduce the file size % of beta estimates from SPM and use it for TDT later. % % use ...
99638e7e0795e31ceff5eae0c1fe1f9ee354455e5d1ea3431e11c96e0be9e472
MATLAB
2,988
97
function multCond_svm_state_at_cue(cfg, i_sub, i_run, hbi_model_path, output_path) %% Load behav_data .mat behav_data_path = fullfile('/projects/crunchie/moehring/neurovar_v2/log_files',... strcat('sub-', sprintf('%02d',i_sub)),'behav',... strcat('sub-',string(i_sub),'_run-',string(i_run),'...
ff38c343e91dd02856936c4c177de0bd4d14f325a062d6707c45921247e7db9c
MATLAB
2,989
91
function [optionsOUT]=DSC_mri_getOptions() % OPZIONI DI VISUALIZZAZIONE optionsOUT.display=2; % 0:off, 1:notify (text), 2:notify (images), 3:debug optionsOUT.waitbar=1; % 0:off, 1:on % OPZIONI PER LA PREPARAZIONE DEI DATI optionsOUT.mask.npixel=300; % rappresenta il numero di pixel minimi di una componente conness...
2e9635340e4d8f4861f92ba7ecde85c237cbf9bba4f1743e7412def7dab56767
MATLAB
2,992
68
% Example script - provides a simulated real-world use case for the code % found packaged together with this example file. % % For more information, see: % Z. Kaposzta, A. Czoch, O. Stylianou, K. Keumbi, P. Mukli, A. Eke, % and F. Racz, % Real-Time Algorithm for Detrended Cross-Correlatio...
265f71d0945ba279d364e28a801da75fcb2a38a087e1e657f7d464a2e46841ca
MATLAB
2,997
84
function srf = bv_readsrf(fname,upto_neighbors) % srf = bv_readsrf(fname,upto_neighbors) % % :description % % Reads in a version 3 (BrainVoyager 2000 4.4, QX) SRF file. % % :inputs % % fname file to read, e.g. 'mysurface.srf' % upto_neighbors set to 1 if you only want to read in vertices, normals, % ...
5da87a451c5c39882d553e1729201a5b3f58af9b6c15a75819d5ffe207a7a27b
MATLAB
2,998
102
function [label_1, label_2, label_3] = gen_rp(data, SEGMENTATION, file, tw, fs, img_dim, delay, dE, rp) % GEN_RP Generates recurrence plots (RPs) from segmented ECG data. % % [label_1, label_2, label_3] = gen_rp(data, SEGMENTATION, file, tw, fs, % img_dim, delay, dE, rp) processes ECG data to generate RPs, saving t...
88dba0fad7a475ac9f0a3158f2cc3e54cd7f5f6a38a6c6b91020a1f6619648f5
MATLAB
3,003
81
function param = mv_tune_hyperparameters(param, X, y, train_fun, test_fun, eval_fun, tune_params, k, is_kernel_matrix) % Generic hyperparameter tuning function using a search grid with % cross-validation. % % Usage: % ix = mv_tune_hyperparameters(param, X, y, train_fun, test_fun, tune_params) % %Parameters: % param ...
b1c40dff8abf72daa894b598838237fb258a218ceeb2c0f6b6cefcc97de7b55a
MATLAB
3,003
107
function [] = plot_stability(subj,raw_patname,runsname,varargin) % Visualize the stability of your signal % % [] = PLOT_STABILITY(SUBJ,RAW_PATNAME,RUNSNAME, ...) % % Takes in an existing init'ed SUBJ structure, imports the % raw (just motion-corrected) and the despiked data, and % plots the mean activity (throughout t...
3c9cccac84d59aa3fae9a3cebafaf48fe38689524affba34111c58af537680b1
MATLAB
3,009
91
function [transformationMatrix] = ... optical_flow_linear_registration2d(moving, fixed, varargin) % OPTICAL_FLOW_LINEAR_REGISTRATION2D Estimates a transformation matrix using optical flow % % INPUT ARGUMENTS % moving - Moving iamge % fixed - Fixed image % % OPTIONAL INPUT ARGUMENTS % ...
a974f005e546ae7f160bb5bf34e16c3d29260cd86c52a2454b28776fa5f4befb
MATLAB
3,009
70
function univ_chosen_action_val_1st() cfg = load('neurovar_cfg.mat').cfg; pipeline_name = 'pipeline_chosen_action_val_'; for i_sub = 1:44 fprintf(strcat('1st Level PEs Sub_', string(i_sub),'\n')); pipeline_dir = fullfile(cfg.global.deriv_dir, strcat(pipeline_name, '1st'), ...
f190681ca3eaa9fb4616278eae54c3b235a03604411ec86470fa563762138e38
MATLAB
3,010
95
clear,clc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This script is used to perform CCA for brain-behavior analysis % % Jin % 11/20/2023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% set the file path current_path = pwd; working_path =...
d9682da9076cc853e769acd7065ddb47cd6dcdf7fe8821bca17e6400e2eaf3c9
MATLAB
3,013
107
function [f,YTick,YTickLab] = plotraster(f, EventT,Var, Colour,yinc,ticklevel) %RASTER creates a raster plot of aligned time-events (spikes, licks etc). % Inputs: % f = handle of axes for plotting raster plot % EventT = 1-D cell array of NStim/NTrl x 1, each cell containing % e...
625d7deaa66475554db1b138d0c0ca23111e7972b8aa969e4a77c29afdce034a
MATLAB
3,016
104
function [thetaEst,thetaP,thetaMat] = BayesReconstruction_1D(pf,Q,thetaVec,tau,varargin) % Bayesian reconstruction of a one dimensional signal (e.g. head-direction) % based on neuron tuning curves and instantaneous firing. % % USAGE % % [thetaEst,p,thetaMat] = HeadDirectionReconstruction(allPF,binnedSpk,binVal,t...
a14460a81ca111f0e29e64721f6803adac68c6e6d6d1c529c2196ae465385ab6
MATLAB
3,023
109
clear; clc [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); POPULATIONS = {'BG|SNR','BG|SNR';... 'BG|SNR','PC ss|CRB';... 'PC ss|CRB','PC ss|CRB'}; BIN_SIZE = 10; DIRECTIONS = 0:45:315; PROBABILIES = [25,75]; PLOT_PAIR = false; raster_params.time_before = 199; raster_params.time_after = 800; raster_...
96edc36d39da62bff0750039ade14fe8ec4441ecb01ed3eed7d531baa9a026e3
MATLAB
3,025
51
%% Align EEG and video codes % Check if variable EEG_timingtest_video_align exists already. If yes, load it. if exist([output_dir output_general 'VideoBasedMarkers\EEG_timingtest_video_align.mat']) == 2 load([output_dir output_general 'VideoBasedMarkers\EEG_timingtest_video_align'],'EEG_timingtest_video_align'...
1cf78ca6f2fc6e68a2861f04f7fb3820e5aa08029cc55850cfd63cc74c0e4020
MATLAB
3,026
78
% Classifier unit test % % Classifier: logreg rng(42) tol = 10e-10; mf = mfilename; % Random data N = 500; nfeatures = 100; X = randn(N, nfeatures); X(2:2:end,:) = X(2:2:end,:) + 0.5; clabel = ones(N, 1); clabel(2:2:end) = 2; %% check "prob" parameter: all returned values must be probabilities % Get classifier par...
7c77cefb0ad7e6761314ebacc7f42e0340c0c2309a9201a53559f701edff3081
MATLAB
3,027
110
function RunAnalysis(fction,datasets,overwrite,varargin) % USAGE: % RunAnalysis(fction,datasets,overwrite,arguments) % INPUTS: % fction: name of the function to be called % datasets: a cell array of directories % overwrite: will overwrite, even if function already done. % % Adrien Peyrache 2011 % Par...
c4d452fcdecb7116ca0f9f2ed244f92f43d728848778da68b653ec3b4d2ce243
MATLAB
3,028
100
function plot_RT_over_Coh(performance, id, meth, save_flag) % _ % This function is written to plot the reaction times % for the different stimuli and coherence levels. % % IN: performance: structre, containing the recorded behavior for every % subject % id: structure, identi...
5a25a55b876bfe214cb27c3d4d61d92ef6bf55d5b2d8c8bae07ec4010c41fcb2
MATLAB
3,032
106
% Preprocessing unit test % % ssd tol = 10e-10; % Generate oscillatory data cfg = []; cfg.n_sample = 50; cfg.n_channel = 16; cfg.n_time_point = 512; cfg.fs = 256; cfg.n_narrow = 3; cfg.freq = [1 2; 4 8; 8 12]; cfg.amplitude = [10 13 11]; cfg.narrow_class = [1 0; 0 1; 1 1]; [X, clabel] = simulate_oscillatory_data(cfg)...
54ed054c9c3c8c444342bee86e3259a1789945a088ed8d85b2c572b56e2f06ba
MATLAB
3,033
72
function [ccabf, chs] = isccstep(abf) %ISCCSTEP determine if abf file was created with a current step protocol % Returns logical value ccabf % Return chs which gives the channelnumbers for which it is true that a % ccstep protocol was applied chs=[abf.channel(:).number]; ccabf=logical(false); %% Abf level % Num...
db661346e2d3e735311f551e8e8564e62234f03c084c05bdb6173593d2bf913c
MATLAB
3,036
71
function pipeline_svm_state_at_cue_1st() cfg = load('/projects/crunchie/moehring/neurovar_v2/BIDS/code/neurovar_cfg.mat').cfg; for i_sub = 1:44 fprintf(strcat('1st Level Sub_', string(i_sub),'\n')); %% Prepare folder pipeline_dir = fullfile(cfg.global.deriv_dir, ...
df761f8a7d19a7c85d64796bbc4b86dc3f1c20f2be7753c5e783a59e07e50179
MATLAB
3,037
86
function model = pp_smooth(sub_id, p) % function model = pp_smooth(sub_id, p) % % Runs SPM smoothing on fMRI images that has been realigned, slice-time % corrected and normalized (prefix 'war'). % % Input: % - i_sub: ID of the current subject. % - p: Structure with analysis parameters. % % Output: % - model: Str...
95bf7f7a438c536830780279fe6ee7fa0892cb3a309b39088d1336ecd67046b1
MATLAB
3,038
104
function hhh=vline(x,in1,in2) % function h=vline(x, linetype, label) % % Draws a vertical line on the current axes at the location specified by 'x'. Optional arguments are % 'linetype' (default is 'r:') and 'label', which applies a text label to the graph near the line. The % label appears in the same color as ...
80d2c16ffbbd10ee244404baeb8e59dba7dee45b2ab6ef81f558865c4f0d75e5
MATLAB
3,039
111
%DEMKMEAN Demonstrate simple clustering model trained with K-means. % % Description % The problem consists of data in a two-dimensional space. The data is % drawn from three spherical Gaussian distributions with priors 0.3, % 0.5 and 0.2; centres (2, 3.5), (0, 0) and (0,2); and standard % deviations 0.2, 0.5 and 1.0. ...
0bd7a1dc9a538f7679ca379b0633cd6f22a95237641cf18b3ebcda656df60de9
MATLAB
3,040
104
function yOCTUnzipOCTFolder(OCTFolderZipFileIn,OCTFolderOut,isDeleteOCTZippedFile) %This function unzips .oct file (OCTFolderZipFileIn) into OCTFolderOut, and %deletes OCTFolderZipFileIn (default) %% Make sure we have AWS Cridentials if (strcmpi(OCTFolderZipFileIn(1:3),'s3:')) awsSetCredentials (1); %Write c...
cbcd4fa3c7bc84d042f2e368fb27c45458eda908e30936d419a27c51e7f66daa
MATLAB
3,042
118
function [Ehat, Phat] = modelImpulse(F, I, head_vel, target_vel, light, sine, debug_on) head_vel = head_vel(:); target_vel = target_vel(:); if ~exist('debug_on','var') debug_on= 0; end nt = length(head_vel); % Create target acc and pos in case needed for predictive target signal target_vel(isnan(target_vel))...
934346944c0d56473f09f038c902db581ca60caa618548d41680c09e1f783d71
MATLAB
3,045
95
function status = compareDcAvg(group_h2, dataTree, datatype) global DEBUG1 DEBUG1=0; status = 0; if ~exist('datatype','var') datatype = 'dcAvg'; end dataTreeFile = [dataTree.groups(1).path, dataTree.groups(1).outputDirname, dataTree.groups(1).outputFilename]; group_h3 = load(dataTreeFile); if isempty(group_h3) ...
3b736f91c1adc408fc0f131463c477f9cd34791e78855f6cba66fc6ac57f5914
MATLAB
3,047
80
function model = pp_coregister(sub_id, p) % function model = pp_coregister(sub_id, p) % % Runs SPM coregistration. Aligns a high-res anatomical image with a fMRI % image (the 'meansub*' image from the realignment is used as reference). % % Input: % - sub_id: ID of the current subject. % - p: Structure with analysi...
60d19894e85f2dcbc2e241fbca433e2f297158f64dad8dd882877c25ee2de0cb
MATLAB
3,047
113
clear [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); req_params = reqParamsEffectSize("both"); %req_params.cell_type = {'SNR'}; lines = findLinesInDB (task_info, req_params); cells = findPathsToCells (supPath,task_info,lines); EPOCHS = {'cue','targetMovementOnset'}; for ii = 1:length(cells) data = ...
105eceacbb774df5cb19defdd6b6241a4815ce5d53c0a294335ee53d8a990ff0
MATLAB
3,052
83
function [displacementField] = create_nonrigid_displacement_field2d(fieldSize,varargin) % CREATE_NON_RIGID_DISPLACEMENT_FIELD2D Creates a 2D non-rigid displacement field % % [displacementField] = create_nonrigid_displacement_field3d(fieldSize) % % INPUT ARGUMENTS % fieldSize - [rowSize colSize], assumed to ...
1af2ac65cd09b896097f6448983c5636514493afef4b59207dd54a7a26330d52
MATLAB
3,052
83
function Experiment = set_up_display(Experiment) % Set Up Display % Input: Struct 'Experiment' with fields 'mode' % Output: Struct 'Experiment' with field 'Display' % 'Display' contains fields: % 'nScreen' - list of available output screens % 'externalScreen' - screen where expeiment is displayed % ...
80610f10348ad093a09b3b68b3f8bdb96baa85edaba0aadcc27dcb64bc778592
MATLAB
3,055
82
function [update] = polynomial_expansion_registration(... moving, fixed, multiModal, transformationModel, varargin) % POLYNOMIAL_EXPANSION_REGISTRATION Estimates a displacement field using polynomial expansion % % INPUT ARGUMENTS % moving - Moving image % fixed - Fixed image %...
e773fef7aa496803631eed9d1ec39ad17c95051a0aa078fad92a5d890c87a2d1
MATLAB
3,056
108
function [proj] = elproj(pos, method); % ELPROJ makes a azimuthal projection of a 3D electrode cloud % on a plane tangent to the sphere fitted through the electrodes % the projection is along the z-axis % % [proj] = elproj([x, y, z], 'method'); % % Method should be one of these: % 'gnomic' % 'stereographic' % 'o...
2d1e9c728b40df36e0d068525aeaeb69892308937276f83923d1f3fa64e01dee
MATLAB
3,059
108
function RasterPlot(S, pos, varargin) % RasterPlot(S, height, bar, tstart, tend) % % Plot spike trains as rasters. % INPUT: % S: tsdArray of ts objects, spike trains % OPTIONS: % Height: the height allocated to each cell (includes spacing), default 1 % BarFraction: the fraction of height occupied by a cell, default 0...
d9289b153b8ee42c5ffa7bbe959d458f5bd3ad49b9108251956d8917e15f7763
MATLAB
3,066
103
clear [task_info,supPath,MaestroPath] = ... loadDBAndSpecifyDataPaths('Vermis'); DIRECTIONS = 0:45:315; req_params = reqParamsEffectSize("pursuit"); lines_pursuit = findLinesInDB (task_info, req_params); req_params = reqParamsEffectSize("saccade"); lines_saccade = findLinesInDB (task_info, req_params); raster_p...
5ab7b9ff3dd356a7af92172a73221d10cd05adc8961c3e46769de8f80b3fdd6e
MATLAB
3,068
86
% output = transres_SVM_pattern_alldata(decoding_out, chancelevel, cfg, data) % % Calculates the pattern according to Haufe et al (2014), Neuroimage. This % is done by first getting the weights in source space (primal problem), if % a linear SVM was used (for non-linear methods no weights can be % calculated for the pr...
825e4918ffd8ffcfaafd28cff2a9e9a8e792535bdd68ba395b8bf6cccda791a8
MATLAB
3,076
90
function [L,weights] = CrossValidationSpikePrediction_Ensembles(qPre,qPost,sPost,binT,ep) % [L,params] = CrossValidationCrossCorrPrediction_Cells(qPre,qPost,sPost,ep) % % computes the loglikelihood prediction of an ensemble of target spike trains given another ensemble of (predictor) spike trains % The prediction is ...
d3ced8a03f73d229edd9c497c30471c868a3caf8457174400e792ec68a6d0560
MATLAB
3,078
91
%% Parameters and data % parameters nbins = 360; smoothTh = 3; velTh = 2; % velocity threshold mergeTh = 0; % threshold for merging run epochs (0 = no merging) lagVec = [-0.5:0.01:0.5]; %load data load(fullfile('Data','BehavEpochs')); load(fullfile('Data','SpikeData'),'S'); load(full...
4b6a1e68e0f8cb1ed8db7ba6648a7c08596e89dab7c518cca58850a73fa9f371
MATLAB
3,083
71
% plot correlation between time of trial and CA performance at 2-3s % window % do the same thing for var of beta coeff. function plot_Corr_CAvsAvgTime(numClasses) sbjList = {'08','12','13','14','15','16','19','21','22','23','24','25'}; figSaveDir = 'C:\Users\mn0mn\Documents\ResearchProjects\spatailAttention...
bc940233bc5333de655f24efd1af3d3d7183dfb9b76cf6791f2944e80ff3a8c2
MATLAB
3,089
117
function val = RasterImagePlot2(S, varargin) % RasterImagePlot2(S, height, bar, tstart, tend) % % Plot a continuous function in a spike raster like form. % RasterImagePlot2 plots each waveformin a 3D landscape style % INPUT: % S: tsdArray of ts objects, spike trains % OPTIONS: % Height: the height allocated to each...
fc6c8719958aed4f4c94a03e4de441c90783f4b9719e87493b4c41619dd0db66
MATLAB
3,089
93
function [ops] = setup_registration_phasecorr(refImg) % Setup variables necessary for phase correlation registration % Marius Pachitariu/Carsen Stringer Suite2P (2017) % Modified by Henry Dalgleish for online image registration (2018) [ops.ly,ops.lx] = size(refImg); ops.yx_px = [1:ops.ly ; 1:ops.lx]'; % Paramet...
a0ae87440b06ae1c42798a61bb184987e42958ff7d052f4f9b42f53534543c06
MATLAB
3,090
89
function [labels] = AccuSleep_classify(EEG, EMG, net, SR, epochLen, calibrationData, minBoutLen) % AccuSleep_classify Classify brain states % Zeke Barger 081120 % % Arguments: (note that these are data, not paths to files) % EEG - a 1-D matrix of EEG data % EMG - a 1-D matrix of EMG data % net - a train...
5d4974e424268ca4c2bbde00c5b0b90d2cb145c94c7935105db5fc5bf9cb90e9
MATLAB
3,095
72
function plot_hist_scatter(performance, id, meth, save_flag) % _ % This function produces the scatterplot of responses and true directions. % The color represent the absolute deviation from the correct direction. % % IN: performance: a structure obtained by the function rdk_extract that % must include the cells...
0254ce47abb6fb22289a34b1e568cae18788310a7cdaa3db1ada75a55f0604c0
MATLAB
3,096
102
function hhh=hline(y,in1,in2) % function h=hline(y, linetype, label) % % Draws a horizontal line on the current axes at the location specified by 'y'. Optional arguments are % 'linetype' (default is 'r:') and 'label', which applies a text label to the graph near the line. The % label appears in the same color a...
898674491273a6ea70e0cef03ae489210a353903a51f4e88aea33cd575bbba7a
MATLAB
3,097
124
% Preprocessing unit test % % pca tol = 10e-10; % Generate data nsamples = 100; nfeatures = 20; nclasses = 2; prop = []; scale = 1; do_plot = 0; [X, clabel] = simulate_gaussian_data(nsamples, nfeatures, nclasses, prop, scale, do_plot); %% 2D example - check whether sizes are correct X = randn(30,40); n = 5; % Get d...
38ece32bd97c681162397d5735f12bc4be1b2d5d3e15c4ea4a353f494bb19367
MATLAB
3,098
101
function data = Scale(transformer, data) % % Scales the values of one or more columns. % % Semantics mimic scikit-learn, such that demeaning and % rescaling are treated as independent arguments, % with the default being to apply both % (i.e., standardizing each value so that it has zero mean and unit SD)....
45832305e52836caad2cdba0e64611336ab7d15ef22171b97aeceae8a5a350aa
MATLAB
3,098
101
function [name_vs_id,directions]=automatic_identity(neurons,chosen_point,voxel_size,fixed_time) name_vs_id=[]; % variables initialization y_scale_factor=voxel_size(2)/voxel_size(1); z_scale_factor=voxel_size(3)/voxel_size(1); % signal correlation matrix and coordinates matrix creation C=correlation_matrix(neu...
c8fe289de34941b30c7a575e03f6c5ad4541dc6cbf120a23518c0e8fc20d2544
MATLAB
3,100
64
function [spike_burst_dyn_table]=compute_spike_burst_dynamics_axons_220822(allregion_unit_matched) % This folder contains the contains the mea structs %load(strcat(parent_dir,'\','allregion_unit_matched')) % Parameters fs = 25e3; % Initializaing ISI_cell={}; IBI_cell={}; IBSR_cell={}; spnb_cell={}; bd_cell={}; chan...
2a3fc18e2858137a3f93435a9e1f0853b7389428bdbaf5be86dd0b4937e75656
MATLAB
3,103
84
% Preprocessing unit test % % mnn tol = 10e-10; % Generate oscillatory data cfg = []; cfg.n_sample = 50; cfg.n_channel = 16; cfg.n_time_point = 80; cfg.fs = 256; cfg.n_narrow = 3; cfg.freq = [1 2; 4 8; 8 12]; cfg.amplitude = [10 13 11]; cfg.narrow_class = [1 0; 0 1; 1 1]; cfg.narrow_weight = []; [X, clabel] = simulat...
f9e0e783102530a1b122742beaec510eb3b8b7539587ac19bc84796fb78fc035
MATLAB
3,104
99
%% BCTypelabels = {'BC5o', 'BC5i', 'BC5t', 'XBC', 'BC6', 'BC7', 'BC89'}; %% dazure = @(n) [linspace(0, 255, n); linspace(254, 0, n); linspace(255, 151, n)]'/255; cqualthr = qualthr; % cqualthr = 0; close all figure; hold on ctyp = typ(any(Qual > cqualthr & Rept > 1, 2)); targetD = BSctr; targetD(Qual < cqua...
27c081795007cc33a0db34514b441a4b5e5f1cdb8fd2664553d5937bbf1b830c
MATLAB
3,105
102
function [X,clabel,Y] = simulate_radial_data(nsamples, prop, separation, do_plot) % Creates two-class radial-shaped data in two dimensions. % The first class is confined to the unit circle. The second class is % confined to a ring around the first class. The ring has the same area as % the unit circle. % % Useful for t...
342880a0f2051d9c2c7ba6a2d88f21dc6c7191d1f659a9df4dbea2bca0a9e6bb
MATLAB
3,108
72
function [IncDec, fitresult, gof, SigFitTrace] = createFit_sigmoid(XVals, fluorescence_trace) %CREATEFIT(XVals,FLUORESCENCE_TRACE) % Create a fit to a sigmoidal curve. Equation is modified from Boltzmann % charge-voltage equation % % Data for fit: % X Input : XVals (1:length(fluorescence_trace)) % Y...
0fe3c5dd02ed32f41909329e8a26784342180f731cce2733ded77d34e28b2b38
MATLAB
3,112
80
%% Create intepolated SSD patterns and plot raw points (Figures 2B & S1) repo_path = 'Path_to\Manuscript_repository'; addpath('Path_to\wjn_toolbox_tsbinns'); addpath(genpath('Path_to\spm12')); addpath(genpath('Path_to\leaddbs')); folderpath_analysis = 'Path_to\Project\Analysis\Results\BIDS_01_Berlin_Neurophys\sub-mul...
bcc6c1ad4b63a9920f9b4dd938fa8ce9821015c94603a48fa915d0ce07477488
MATLAB
3,112
83
clear all load('../data/opt.mat') for typeName = opt.epoch_type players = {}; observers = {}; %% define epoch if strcmp(typeName,'DecisionMaking') event_name ='showCard'; time_interval = [-0.5, 3]; elseif strcmp(typeName,'Feedback') event_name ='result_obsCor'...
c2e65a143bc59e7b00731588ed9cb66a37d2f7afc57e30761a0bf0ffec432dcf
MATLAB
3,113
80
%% Create interpolated SSD patterns and plot raw points (Figures 2B & S1) repo_path = 'Path_to\Manuscript_repository'; addpath('Path_to\wjn_toolbox_tsbinns'); addpath(genpath('Path_to\spm12')); addpath(genpath('Path_to\leaddbs')); folderpath_analysis = 'Path_to\Project\Analysis\Results\BIDS_01_Berlin_Neurophys\sub-mu...
72ad38ac0ef89744902fa22d59684829da266d0289a0f9d65a5f3ce83707b9c7
MATLAB
3,114
80
% @title Convert .mat of neuron types into .txt file % @file mat_to_ntypematrixf.m % @author Romain Beaubois % @date 06 Aug 2021 % @copyright % SPDX-FileCopyrightText: © 2021 Romain Beaubois <refbeaubois@yahoo.com> % SPDX-License-Identifier: GPL-3.0-or-later % % @details % > **08 Mar 2021** : file...
d4d02fbf35b9df9fcead42f4e04f22e3dcb28ed16b1ada40487a9796efe72024
MATLAB
3,128
88
function cube_integral_test % This function creates a cube based in spherical co-ordinates and then % plots in cartesian co-ordinates. The cube is divided into 4 pyramid. % Each pyramid has a top, middle and bottom component as per the figure. % The script also uses a quadrature based method to verify the volume (ele...
c27a148a220b8613c865516681df67e86f845630b2501f76f05e6570b3e73275
MATLAB
3,129
98
% Sub-sampling script: analysis of avalanche size distributions with fewer % samples for a simulation with scaling at high sample count % example parameters: N_F = 1, eps = -18, eta = 4 param_str = 'e-6.0et6.0'; uf_files = dir(['avalanches_code/data/fields1ultrafinesweep/sweep*' param_str '*tstat.mat']); uffr_files = ...
de6ed22c9d74bfabbeed4dda5e5a6dc58c34f774e18172879876f8136178de07
MATLAB
3,134
80
% About % % Descriptions tba % % $Author: Peng Li, Ph.D. % $Date: May 16, 2018 % $Modif.: Nov 15, 2022 % % +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % (C) Peng Li 2016 - % +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
737c0bb8f55087d14d457b67138feb36ef75fe70884310c9a10d85b7c070a111
MATLAB
3,135
80
function TrackOFxMovie(origIm, flowTracks, vxMat, vyMat, clusterIm, fileName) close all; %% INITIALIZE OBJECTS % Padding padSize = 1; vxMat = padarray(vxMat, [padSize, padSize, 0], 0); vyMat = padarray(vyMat, [padSize, padSize, 0], 0); clusterIm = padarray(clusterIm, [padSize, padSize, 0], 0); % Save movie vv = ...
fbfe73bbefafee06d465f2b780e7847de47e54368b36a43c50834518cadd648b
MATLAB
3,135
80
% About % % Descriptions tba % % $Author: Peng Li, Ph.D. % $Date: May 16, 2018 % $Modif.: Nov 15, 2022 % % +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % (C) Peng Li 2016 - % +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ...
562057ddb13ca3d5a2a52edfdce6375640d1604e9c4810c889fdfed142cbbda4
MATLAB
3,138
91
function [h, hdata] = rbfhess(net, x, t, hdata) %RBFHESS Evaluate the Hessian matrix for RBF network. % % Description % H = RBFHESS(NET, X, T) takes an RBF network data structure NET, a % matrix X of input values, and a matrix T of target values and returns % the full Hessian matrix H corresponding to the second deriva...
88fed66580cdb40644ef3b6d1762a442d9ec2bb644e6c61a5f8a822d5e55dc99
MATLAB
3,147
71
function hf_canc = plotCancellationVisTuning(I, K1, K2, K0, K1_vis, K2_vis, K0_vis) hf_canc = figure; sine_on = 0.5; % (Hz) light_on = 1; dt = K1.dt; tt = (1:2/dt)'*dt-dt; head_curr = sin(2*pi*.5*tt); target_curr = head_curr; % if I.impulse_or_closedloop % [E...
90c81ae7a3e0bceba71290837abaf48f23ba6a6f9b326e117c97416332e7c8d7
MATLAB
3,147
93
function [mixparams, y, z, a] = mdnfwd(net, x) %MDNFWD Forward propagation through Mixture Density Network. % % Description % MIXPARAMS = MDNFWD(NET, X) takes a mixture density network data % structure NET and a matrix X of input vectors, and forward propagates % the inputs through the network to generate a structure ...
c742a9b98ed2b8c183e923067ccaab5eea5c8dd2295adae2e9bd0b53a7235131
MATLAB
3,147
136
function [linSpd,angSpd, GoodRanges] = LoadSpeed_Wrapper(fbasename,varargin) % LoadSpeed_Wrapper loads linead and angular speed from whl or pos files % USAGE: % [linSpd,angSpd] = LoadSpeed_Wrapper(fbasename) % Adrien Peyrache 2015 if ~isempty(varargin) w = varargin{1}; if ~isa(w,'struct') error('arg...
ccb4734890c345a1383e16c8c16fc9c2699234a80f6cd8efd1c065285cfabe58
MATLAB
3,147
99
% This software converts moves into cpp and csv files. % There are speed_limit and speed_mult options. anim_angles = readmatrix('output/animal_angles.csv'); anim_speeds = readmatrix('output/animal_speeds.csv'); use_speed_limit = 0; % turn speed limit on or off speed_limit = 25; % maximum speed allowed alt_data = 0; % ...
640fdd15e918d49c4f2e67d6f299117331b7982df5babb8596fad5cfabef04fd
MATLAB
3,150
87
function [results_data] = plot_split_histo(cueMI, oppMI, sessionDist, iMonkey, xl, yl, split_sessions, iSplit, bin_size, trial_type, loc_flag, plot_flag) %% Plots V4 f-MI cued vs opp moving window plot (onset) %% Code cols = [0,0,1;0,0,1;1,0.5,0;1,0.5,0]; cols = [cols;cols]; cols(9:10,:) = [0,0,1;1,0.5,0]; cols_othe...
8e04eeb760d651e7ee6558a5f32b545260422e149917f568902d3e135d40386a
MATLAB
3,151
67
function mutual_position_based_links=get_mpbl(distmatrix_s,coords_t,tmax_local,xy_pixel_size,z_pixel_size,max_gap_closing_mutual_distance) distmatrix_s_mean=squeeze(mean(distmatrix_s,3,'omitnan')); taken=[]; h = waitbar(0, 'Merging tracks based on mutual distance ...'); for i=1:size(coords_t,3) waitbar(i./si...
129ebadb0b8f48f671105a0f2f6a6127f91941f54f7b8f4383008d28f2b69995
MATLAB
3,156
79
% This script generates dataset for ML models %% Inputs - set defaults magnificationName = '4x'; tagName = ''; octBScanToUseAroundCenter = []; isAverageOCTBScans = []; % Which libraries to take images from libraryNames = {'LC','LD','LE','LF','LG'}; %% Jenkins %This function updates all input varible n...
8c3d9fc00d159c40af2307411ebdc89e46ca725bab321d83f4882a4910f88b9f
MATLAB
3,160
83
function transfer_data(p) if isempty(p.dirs.source), return; end %%% Transfer DICOM files %%% fprintf('Trasferring DICOM ... \n') for i_sub = 1:numel(p.subjects) % Get subject ID sub_id = p.subjects(i_sub); % Get subject ID as string sub_str = num2str(sub_id,'%02i'); for i_ses = 1:p.n_session ...
122f089ecede357f6798876a56de8cdbdca832897aa151b9531eceb3a77152c4
MATLAB
3,162
125
function fixticks(scale) % FIXTICKS(scale) % Put tick marks outside figure, sizes them according to full figure if ~exist('scale','var') scale = 1; end npoints = 2; h = findall(gcf,'Type','axes'); % Get length of current axes % pos = get(h(1),'Position'); % Based only on maximum VISIBLE axis, use special fun...
c5ee47e35c8ed093a8611df80c7de7ca5a3daa7cef0e14b9f70f79742e815c42
MATLAB
3,164
90
function PlotDistributions(histExportFolder, filePrefix, distOption, dataBinWidth, showBinWidth, HistogramData, plotType) %% Assign values rawCounts = HistogramData.RawCounts; thrCounts = HistogramData.ThreshCounts; relCounts = HistogramData.RelCountsWeighted; magCounts = HistogramData.MagCountsWeighted; %% Check vari...
c6faf019f74472ea053b34227eb14c9b754a89b22cc75e4ffb761c7ac7c844c0
MATLAB
3,168
98
%% Load data % input parameters binsize = 0.1; % bin size for decoding in seconds nBins = 360; % number of angular bins for tuning curves sdSmoothTC = 3; % smoothing widnow for tuning curves sdSmoothBD = 2; % smoothing window for spike trains velTh = 2; % velocity threshold % load session files l...
f6f5508e095dbd0c2977071bb1fbe150b29ebf335eade84bcaa62b3dfbb7d6ed
MATLAB
3,168
93
function net = gp(nin, covar_fn, prior) %GP Create a Gaussian Process. % % Description % % NET = GP(NIN, COVARFN) takes the number of inputs NIN for a Gaussian % Process model with a single output, together with a string COVARFN % which specifies the type of the covariance function, and returns a % data structure NET....
1a9bbeeb57d0843d08fe920b8132c25009fa29b7a70adb2c339fe72d3af7c889
MATLAB
3,181
105
function Q = MakeQfromS(S, DT, varargin) % Spike train binning on % % USAGE: % Q = MakeQfromS(S, DT, parameters) % % INPUTS: % S - a cell array of ts objects % DT - timestep for tsd (measured in timestamps!) % % OUTPUTS: % Q - a ctsd in which the main structure is a |t| x nCells histogram of firing...
c361d65c212af9c9a419f2d87f42ade18eee9806d2999c6757c35098628bc333
MATLAB
3,184
85
function [Y, pValue, Rsquare, Component, varargout] = CosAna(y, tsec, FitFreq) %COSANA Cosinor fitting % % Inputs: % y --- data to be fitted % tsec --- time axis in seconds % FitFreq --- target frequency (in hours), use vector for % multipe compone...
4634e3e008af51a92efd2d283bf7e39921db003a608691f0be97815d0cadc0aa
MATLAB
3,186
118
function create_quadrature_filters_for_phase_difference_registration2d(varargin) % CREATE_QUADRATURE_FILTERS_FOR_PHASE_DIFFERENCE_REGISTRATION2D Creates 2D quadrature filters for usage in linear phase-difference registration % % create_quadrature_filters_for_phase_difference_registration2d() % % INPUT ARGUMENTS % N/A %...
846bb64198d57d94737632f129fbb702ec038c40f7ae2d4eef090bc7749f539f
MATLAB
3,187
118
clc; close all; warning off all; clearvars; % preparation fileScript = matlab.desktop.editor.getActiveFilename; [pathProject,name,ext] = fileparts(fileScript); % path to working directory/current folder addpath (pathProject); pathData = ([pathProject '/data']); pathFT = ([pathProject '/fieldtrip-20220...
5bdd8b3dd7dd942b688ff04cb33f4c8bb670d14df6b1536a9ab903b7aafa7cba
MATLAB
3,188
122
% [CleanWhl GoodRanges] = CleanWhl(Whl, StretchLen, JumpSize); % % "cleans up" a wheel file by interpolating missing stretches % up to StretchLen long (default 20), for which the endpoints % don't differ by more than JumpSize, (default 30). % % also returns the ranges where the whl file is valid (in .whl units) % Good...
d3368889fb612d2b2be20b9f28d7f9bedcf8e0ab17c2263fb9001e41750f671d
MATLAB
3,188
101
function [conds, tts, head, target, hevel, PC, sines, light, dt, cond_inds] =... loadJR(data_path, t_step) % [conds, tts, head, target, hevel, PC, sines, light, dt, cond_inds] = ... % loadJR(data_path, t_step) % % t_step indicates the time at which step data is cropped % ------------ JR DATA FOR MODEL FIT -------...
2d77f66fafe097472320c5542f7ba1782a7e7e44e879e933654fb6df1c2e3124
MATLAB
3,189
80
function [update] = phase_registration(... moving, movingCertainty, fixed, fixedCertainty, ... transformationModel, currentScale) % PHASE_REGISTRATION Estimates a displacement field using phase-difference % % [update] = phase_registration(... % moving, movingCertainty, fixed, fixedCertainty, ... % trans...
22cafc3327bc00ae3cf0187548ad43710dbca342e25125329ff79f5417d57175
MATLAB
3,190
85
%% Whole-brain modelling in the homogeneous case %This model is based on Stuard-Landau oscillators, the local dynamics of single brain %regions using the normal form of a Hopf bifurcation. %The dynamics of the N brain regions were coupled through the connectivity matrix, %which was given by the connectome of healthy s...
2b686175479cfcf94dba64a17b63febb6c4f7aa7cf1a430ce6bcb926bd26da5d
MATLAB
3,190
85
%% Whole-brain modelling in the homogeneous case %This model is based on Stuard-Landau oscillators, the local dynamics of single brain %regions using the normal form of a Hopf bifurcation. %The dynamics of the N brain regions were coupled through the connectivity matrix, %which was given by the connectome of healthy s...
aeb7c3ba5b337240e2b261251932625d060239f4203a020ac2e40dea5bbd4a9f
MATLAB
3,190
31
% run from local pc and create gridscore, trajectory plot, and rate map plot cd .. initOAT cd gridscore preloaded_spk_reader=0; % save time of loading spike reader by using prior loaded one if preloaded_spk_reader==0 && ~exist('keep_vars','var') clear all; preloaded_spk_reader=0; end; clear keep_vars; use_supcomp_data=...
9516fad67a0efb570804fa6d4317a8fbcbfc70dec04797062eeaf7e9cb8db7c0
MATLAB
3,193
117
function [rgb cmap clim] = cdata2rgb(data, cmapname, clim) % CDATA2RGB - Converts indexed image data to RGB with a specific colormap. % % This function converts a 1-D or 2-D indexed color image DATA % (with colormap CMAPNAME) into a true color RGB image. It can also % apply caxis limiting as specified by CLIM in the p...
f5f87fad359b07a9e56041232486c304fdebf4f6115fe5b7a8b2246ef1bd53d5
MATLAB
3,196
118
clear all [task_info,supPath,MaestroPath] =... loadDBAndSpecifyDataPaths('Vermis'); req_params.remove_repeats = 0; req_params.grade = 7; req_params.cell_type = {'PC ss','CRB','SNR','BG msn'}; req_params.task = 'choice'; req_params.ID = 5000:6000; req_params.num_trials = 100; req_params.remove_question_marks =0; ...
62737c6c89d35ef3cccd7ca504933e5d8787d88efdb802a4afaf274769f6cf33
MATLAB
3,198
94
function [modelBasePath, resultsPath] = s3GetPathToModelResults (modelName,executerName,otherIdentifier) % This function will return a link to ml dataset % Inputs (Option 1): s3GetPathToModelResults (modelName,executerName,otherIdentifier) % modelName - name of the model trained (pix2pix, oct2hist etc). Can be % ...
fe79e59558952fe5a1690dd6975ec276170d0ec575c2f3ef16cece8699f5a874
MATLAB
3,203
98
function res_str = consolidateAlphaTauFits(p_fit_arr, eps_val, eta_val, exp_field) % res_str has fields [alpha_est, se_alpha_est, x_min_est, ks_min] for all % simulations with specified eps_val and eta_val % consolidation: looks at all k_min vs x_min, then picks a single x_min. % Pulls the fitted exponents from each ru...
bf4976be5c09573167e03b74f3c3d1e5f9886fad68692acb35e7be872555b16b
MATLAB
3,204
95
%ACTOGRAM % % Descriptions tba % % $Author: Peng Li, Ph.D. % $Date: Jan 01, 2022 % % +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % (C) Peng Li 2019 - % +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % classdef actogram < ha...
c22ac57c79bc694820c1ee0fd5713270dd3614eb5a0ae261a5341f2e753980fd
MATLAB
3,206
124
function SID = parse_imetronic_data(data) SID(1).name = 'LIGHT'; SID(1).num(1).name = 'HLED'; SID(1).num(2).name = 'LED1'; SID(1).num(3).name = 'LED2'; SID(1).num(4).name = 'LED3'; SID(1).num(5).name = 'LED4'; SID(1).num(6).name = 'LED5'; SID(1).num(7).name = 'LED6'; SID(2).name = ...
dd64d015cb433e071c7b0bd4b6e5c77b7e40f424ea9c24aa48ca5f76654a664b
MATLAB
3,207
105
function glm = bv_readglm(fname) % glm = bv_readglm(fname) % % :description % % Reads in a version 2 (BrainVoyager 2000 4.4, QX) GLM file. % % :inputs % % fname file to read, e.g. 'mymodel.glm' % % :outputs % % glm glm structure. List this function to see the field % names. %...
325baddefb941fbbf6899c7bc1ba6dc078aade029c156827b9e39ed31004c327
MATLAB
3,211
83
function model = pp_normalize_anat(sub_id, p) % function model = pp_normalize_anat(sub_id, p) % % Runs SPM normalization on a high-res anatomical image that has been % coregistered and bias-field corrected (prefix 'mr'). Uses the image and % deformation fields that were calculated with pp_segment.m. % % Input: % - i...