sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
da90e73672a675ea87874a6156bdf0fd5a08a66ff27292291534d6d1a999c42e
MATLAB
6,014
149
function make_Figure3bcd(plotVariables, options) subjectListEEG = [16 18:21, 24, 26, 27, 28, 29, 31, 33, 34, 35, 42, 43, 47, 50, 51, 52, 54, 55, 57, 58]; %32 taken out EEGpreproc = options.path.preproc.behaviour; % path to behav data all subjs load_name = fullfile(EEGpreproc,'behav_data_all_subjs_all3'); load(load...
36e18fd19cc56becf3c07216b7aa1669e4ba5e34fe61897adfd7aaf482ae4656
MATLAB
6,015
144
function [self] = getBaselineKinematicsEarlyLate(self,border,condNdx,key) % getBaselineKinematicsEarlyLate calculates the kinematics when flies % are at baseline firing. This is split into before first entry, the % first 2 state instances after each exit, and lateral state instances % after each exit % % ...
519f85772cd58da3785aeca02a8d02665a99f598f7535529ec8204f5a5573076
MATLAB
6,015
163
function [mbMask] = ellipse2mask(strType, vnImageSize, varargin) % ellipse2mask - FUNCTION Make an ellipse mask % % Usage: [mbMask] = ellipse2mask('bounds', vnImageSize, [fX1 fY1 fX2 fY2]) % ellipse2mask('majoraxis', vnImageSize, [fX1 fY1 fX2 fY2], fAspectRatio) % ellipse2mask('ce...
d29e2bd08f6e1cae85e826439674819aed29c7b3d0c62d1c6c0205dd325adfcf
MATLAB
6,015
182
function SBJ09b_TFR_plot_stats(SBJ,conditions,proc_id,an_id,plt_id,save_fig,fig_vis) % Plots TFRs computed in SBJ09a_TFR_stats % 3 TFRs in a row: (1) con; (2) inc; (3) inc-con with stats % clear all; %close all; error('not adapted to stat_id yet'); %% Check which root directory if exist('/home/knight/hoycw/','dir');...
39ef07a4b8f8390886959596913940bf119530210477b0430626090e47a7ce9c
MATLAB
6,016
137
function [new_response_matrix,nResponsesDiscarded] = return_new_response_matrix(observed_stimulus_stream,orig_response_matrix) %make a copy of the original response matrix response_matrix = orig_response_matrix; % Remove all rows of response matrix where choice (3rd column)==2 (get rid of missed trials) response_matr...
f5520517ed69305d25a24e586f8ca1c8f3097c209f219bb5e0ba83ba374a7412
MATLAB
6,021
220
%% mri_example_3d.m %| %| Example illustrating 3D regularized iterative reconstruction for MRI %| from nonuniform k-space samples. %| %| This example does not include field inhomogeneity or relaxation %| or sensitivity maps. All of those are possible extensions using %| existing capabilities of MIRT. %| % Copyright 20...
be75e95e8843aacde1ef53e459a76a4c61cb09df25d285a41e88fb09c7633cc8
MATLAB
6,031
164
function trigSDFandMI_M2(sesID,tsDir,trigDir,algTrigDir,rrmDir,analDir) % function trigSDFandMI_M1(sesID,tsDir,trigDir,algTrigDir,rrmDir,analDir) % % input: % sesID session ID % tsDir path to dir of preprocessed data for RRM % trigDir path to dir of triggerTimes for (no-)movement ons...
106657ba9e193bf5fe4bfe81c53505d5c6428863ae3c4b2d5f659c86d3754446
MATLAB
6,033
181
function [xY, XYZmm, j] = spm_ROI(xY, XYZmm) % Region of Interest specification % FORMAT xY = spm_ROI(xY) % xY - VOI structure % xY.def - VOI definition [sphere, box, mask, cluster, all] % xY.rej - cell array of disabled VOI definition options % xY.xyz - centre of VOI {mm} % xY.spec -...
9d8df86bc654b0fdf2b785409bc8159f3cd7ca6d43a094f277e0f1e5c65c125b
MATLAB
6,036
174
%% Convert the vessel segments to a graph (nodes + vertices) %{ This script takes the output of the script ~\vasculature\vesSegment\vesSegment and then creates a graph. %} %% Add top-level directory of code repository to path % Print current working directory mydir = pwd; % Find indices of slashes separating director...
be5581ca3331e2842c7d6cf04b3324009f648c225422f13baa6e92bb8f81b484
MATLAB
6,038
162
function normCSC_data = plot_timeWarpedStabilityScoreCurves(cells) % Load Params if ~exist('paramsPath','var') params = readtable('./UniversalParams.xlsx'); else params = readtable(paramsPath); end samplingRate = params.TimeBin; ds_factor = params.ds_factor; secsInMin = 60; conversionFactor = secsInMin/(ds_f...
176f063b70d2293aa78a32f186ccc1d7384a52d810084a0cd694c1ad9ff8689a
MATLAB
6,039
184
%% PANEL FIGURE 3 %Figure description: IC medial prefrontl maps and ERPs from SS v US and %TFUS (none) 1st row and TFUS (STOP) 2nd row. %ERP PLOT: Columns are groups (rIFG, S1, and control); Rows are TFUS %conditions; Color: blue is SS and orange is US %% Gather IC MAPS and plot central IC addpath '/Users/user/Library...
22d7506f6b84ce245ca58198133b0797eb4fbe600f032ecb63dd055c21e0ba8f
MATLAB
6,039
175
function [] = DataGeneration() addpath(genpath([fileparts(which(mfilename)) '\matlab'])); addpath(genpath([fileparts(which(mfilename)) '\util'])); s=dir('Videos/*video.ufmf'); filelist={s.name}; for i = 1:length(filelist) [readframe,~,~,~] = get_readframe_fcn(['Videos/' filelist{i}]); end close all clear...
de7251eb862ec9fb4c0d26b21e07e115606cc574bf0f081d1f1f3b41db377db2
MATLAB
6,045
178
% interactive tps - streamlined version clear; close all; delta = 0.05; %grid size bounds=[-0.5 1.5 -0.5 1.5]; disp_force = 1; maxpnts = 30; %Maximum number of control points [gridrefx, gridrefy] = meshgrid(0:delta:1, 0:delta:1); %define inital grids [gridholx, gridholy] = meshgrid(0:delta:1, 0:delta:1); figure(1); ...
45d491fb0e43656156681715e8d4b5a6cf3cf8ee073eebe48669187144371efd
MATLAB
6,046
190
function fig3A(analDir,rrmDir,tsDir,figDir) % function Fig3A(analDir,rrmDir,tsDir,figDir) % % plot Fig3A: the spike-density-functions averaged across all the sessions, % separated by movement and attention condition % save figure as *fig and pdf % % input: % analDir path to directory of results for model-fre...
691520e94f9b05ac76309e9e1d5d2f13b80174ef6facc8bc2584fe39c8a257c1
MATLAB
6,047
246
function [opt, extra] = vararg_pair(opt, varargs, varargin) %function [opt, extra] = vararg_pair(opt, varargs, [options]) %| %| Process name / value pairs, replacing the "default" field values %| of the opt structure with the user-specified values. %| This allows flexible argument order and "named arguments" somewhat ...
b07414b3d0e3ec890b2c7b80ede0fd73f273b0ca6adf0413944e3f6d117fae2e
MATLAB
6,049
160
function [outData] = TransformPaths(Data) %% TransformPaths % Andrea Castegnaro, UCL, 2022 uceeaca@ucl.ac.uk % Transform all the paths so they are all facing the positive x-axis and % starting from (0,0). Mirrors all the right turns in the outbound % so that all paths are left turns. % Once flipped calculate the OoB pr...
33e4812eb3866ecacf0fa99b8001f9167cc1177daeacdc45072b813f9d72479d
MATLAB
6,051
147
function SBJ06b_ERP_plot_stats(SBJ,conditions,proc_id,an_id,plt_id,save_fig,fig_vis) % Plots ERPs computed in SBJ07a_ERP_stats % clear all; %close all; fig_filetype = 'png'; if ischar(save_fig); save_fig = str2num(save_fig); end %% Data Preparation % Set up paths if exist('/home/knight/hoycw/','dir');root_dir='/home/...
86a274e3372060188d2c17bdc75662c3f3a29dd338190dd1e283a0572c9fb7fc
MATLAB
6,051
204
classdef spm_file_template % Text file template engine % % Example: % >> tpl = spm_file_template; % >> tpl = file(tpl,'myfile','template.txt'); % >> tpl = var(tpl,'TITLE',spm('Ver')); % >> tpl = var(tpl,'DATE',date); % >> tpl = parse(tpl,'OUT','myfile'); % >> get(tpl,'OUT') %____________________________________________...
0ddf497444939430f0f696cf3d05e0148bec57ca3f07a189ddcc779749c6a96b
MATLAB
6,064
133
function [significantVarWei,significantVarMax,pValWei,pValMax] = rsa_weighted_cluster_perm_stats(subjects,rdm_cat_flattened,rdm_dis_flattened,true_correlation,tail,if_save,numPermutations) %RSA_WEIGHTED_CLUSTER_PERM_STATS Perform weighted cluster permutation stats to calculate the %significance of the timepoints for th...
9063077f45be467b04b74b8d38bc948000d9b0607eee6f319c2c875e1e180934
MATLAB
6,066
150
function SBJ08a_corrRT_regressRT_ANOVA_terms(SBJ,an_id,stat_id) %% Run ANOVA with potential RT regression before % Set up paths % Set up paths if exist('/home/knight/hoycw/','dir');root_dir='/home/knight/hoycw/';ft_dir=[root_dir 'Apps/fieldtrip/']; else root_dir='/Volumes/hoycw_clust/';ft_dir='/Users/colinhoy/Code/Apps...
7c08020467394fe4af7c87e87a75915ae7ebb4c67ca4ebedaffc8fb6f284588f
MATLAB
6,070
175
%% Manually scoring the participants trajectory % In order to the model to fit the data the participant had to demonstrate % a clear intention of completing the triangle. % This did not happen all of the time and therefore we had to exclude some % data. Also we noticed by looking at the tracking data that participants ...
a0fd0497c81be6a293c1f06f2732e0e445b639c7be613adc91e2f23f34ec0c96
MATLAB
6,071
188
% Code responsible for generated the expression versis PI data displayed in "Ciliary % localization of a light activated neuronal GPCR shapes behavior", PNAS, % 2023 % Written and annotated by Krisha Aghi and Amy Winans % Sections 1.1 and 2 by KA, sections 1.2 and 3 by AW %% Run this first close all clear al...
5d5c6916cd4ae7a8900fe9ebc0060b2587d522a504c893f235a898347a59c679
MATLAB
6,073
160
function [Best_pos,Best_score,CHIO_curve]=ICHIO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj) %¿ªÊ¼ÓÅ»¯ if(max(size(ub)) == 1) ub = ub.*ones(1,dim); lb = lb.*ones(1,dim); end PopSize=SearchAgents_no; MaxAge = 100; C0 = 1; % number of solutions have corona virus M...
8324bd98cec3217240ded4469f8b72061adfd8409966fd92329822e9d569dbe5
MATLAB
6,079
269
function ob = fatrix2_vertcat(blocks, varargin) %function ob = fatrix2_vertcat(blocks, [options]) %| vertcat: B = [A1; A2; ...] %| %| in %| blocks {cell} cell array of the (fatrix2) blocks %| all blocks must have same idim and imask %| %| option %| 'dim_cat' dimension along which to concatenate odims %| all other ...
a3b28a24811672545f2049eff607a96712fded35b46612c8a44ef1fd4934d12a
MATLAB
6,085
139
function [nll_pair,nll_ind,pfit_pair,gof_pair,gof_ind,gof_diff] = fitRogCrfNFoldCv(nFold,spikes,cont,mu_eta,cov_eta,optional) %% fitRogCrfNFoldCv N-fold Cross Validated Fit for the Ratio of Gaussians model using the contrast response function parametrization. Fits both the pairwise and independent models. % INPUT ...
a7b18872fcc5d8684f98b6c97ca4f46a15084d52c6ba1dbd53de8b8d9e3d3ca4
MATLAB
6,087
146
function handles = updateWire(handles) %%%%% Start: Recalculate Wire Image %---- Start: Reset Previous Version Marker handles.editVariables.previousBackupState = 0 ; %---- End: Reset Previous Version Marker %---- Start: Create Vectors Necessary for Proper Neighbor Tallying row = handles.basePic.ySize; col = ...
c3d8a7db5c27a5b9d77d5d64376d83f08289a1e9df546f19edfa9f17dd16e1b2
MATLAB
6,088
162
function make_figure7(plotVariables,options) glmFlag = 'vertical_jumps_absolute'; % subject list subjectList = [62:64,66,68,70]; % vertical motion only csdFlag = 0; % 1 for csd transformed data if csdFlag %temporary fix for bug in first subjects' CSD transform subjectList(1) = []; end reference = 'LMRM'; nS =...
e16b58ba3c0361fff7fed720f189a4df403a4b2495b6f70a8707410ba26cac4f
MATLAB
6,093
199
%% PSD on Raw Data during HLL and BR % ######################################################################## % Steps: % 1. Load Raw Data % 2. Perform PSD using IRASA % 3. Save PSD for each subject % ######################################################################## %% clear ft_defaults %% Subjects % ID 1...
1582b18171c43486055f679d6d5822241f254c781b90e46eeaaa22713b9d0aa3
MATLAB
6,094
160
%% Regular wave score clear all close all rec_data_path = 'C:\Users\xscogno\MATLAB\Flavio2\Preprocessed_data\'; dpath='C:\Users\xscogno\MATLAB\Flavio2\Preprocessed_data\'; save_data_path = 'C:\Users\xscogno\MATLAB\Flavio2\Preprocessed_data\'; clusters=10; mice_number=12; mice=['L08M1';'L08M2';'L08M3';'L08M4';'L09M1';...
75b8c309b0c4dee9860a5ad03e6a70fa59008e57df3e6823d902860baeae89e4
MATLAB
6,095
185
function [xBF] = spm_get_bf(xBF) % Fill in basis function structure % FORMAT [xBF] = spm_get_bf(xBF) % % xBF.dt - time bin length {seconds} % xBF.name - description of basis functions specified % 'hrf' % 'hrf (with time derivative)' % 'hrf (with time and dispersion deri...
ef95782ff8e706166a97eb58859fd18798c626557d0ced2725aa2dd26f3ecb21
MATLAB
6,095
227
function [sino, orbits, used] = rebin_helix(cg, ig, proj, varargin) %function [sino, orbits, used] = rebin_helix(cg, ig, proj, varargin) %| %| A single-slice rebinning (SSRB) method for cone-beam tomography data %| collected with a helical source trajectory. %| %| in %| cg ct_geom() %| ig image_geom() %| proj [ns ...
43c0b0832016669a3a0a03b224409e8a5aa5b2895fae1aa79f32c9cfb0dc56e5
MATLAB
6,097
161
function [classification, pca_r, knn, clusterMap, mv, tmdMap ] = spectralSpatialMV(model, hsCube) % SPECTRALSPATIALMV Performs spectral-spatial classification. % % [classification, pca_r, knn, segmentation, mv, tmd] = % spectralSpatialMV(model, hsCube) % % This function takes a hyperspectral data cube (hsCu...
0f5b4a83ff020a1ba78c24e4446e8bda25594ca559ef52ac2e776c8a161a438f
MATLAB
6,098
192
function [r,err] = mTRFevaluate(y,pred,varargin) %MTRFEVALUATE Evaluate the performance of a regression model. % R = MTRFEVALUATE(Y,PRED) returns the correlation between the predicted % output of a regression model PRED and the ground truth Y, based on % Pearson's linear correlation coefficient. % % If Y or PR...
3d5c39f07979d9364a6404271f29c756ab5c758de2b7d660505c4433a09cb44a
MATLAB
6,103
250
% xiayq @ 12/01/2022 % xiayq0121@zufe.edu.cn % refered to Z. Yao and Y. Xia, Manifold Fitting under Unbounded Noise, arXiv:1909.10228 clear; %clc % parameters for data D = 3; NumTrials = 20; a = 2/3; b = 1/3; tau = b; sigma = 0.01; % 0.04 n = 500; %% hyper parameter if n == 500 switch sigma case 0.09 ...
0d25b6226cace788baedb8d829786099289e65ef8d0f8131a73e1ca06b53337f
MATLAB
6,110
130
function [patch_Vrange, patch_Irange, numtoelim, spikevoltage, spikeiter, spikeelectrode] ... = burst_wc(thesespikes,fileloc,chunknum,filtereddata,chunksize,spikevoltage,spikeiter,spikeelectrode) %rename inputs filtchunk = filtereddata; chunkN = chunknum; rawfileloc = fileloc; chunkspikes = thesespikes; ...
39ef012c27ad64d2869a0dccb80722be48be2d3886a892f4a076d09fb3101bc6
MATLAB
6,111
189
function im = nodeGrps_vesSegment( nodePos,nodeEdges ) %%%%%%%%%% % TO DO: % correct eLen (segLength) to be in um (non-cubical voxels problem) - easy % correct segDiam to be in um (non-cubical voxels problem) - more % complicated - we already have calculated diameters in imView in voxels %%%%%%%%%% % if ~isfield(im,...
b6301e51424263f75e5f2959474941f4e43baae58a4d392cdfce4bf7d83cc530
MATLAB
6,115
191
function [fNum,stateFigure] = plotTurnOpt2(f_orcoAll,state2Cons,tim2Cons,plotType,... colortype,plotAdaptation,plotInterp,fNum) k=ones(1,numel(state2Cons)); nGen_per_page = 3; nPage_all_gen = ceil(numel(f_orcoAll)./nGen_per_page); fNum_byState = fNum:nPage_all_gen:numel(state2Cons).*nPage_all_gen; nGen = nu...
beb9c5d1ed424ac7e8e1e075cea78a3cd00d54e4dd301b86db894e3eb1ec6fdb
MATLAB
6,119
193
function [Dvol,I]=check_ROI_dir(Dirname, th_pval) % % For all the subjects in a directory: % check if the size of 20 ROIs is within the normal range % The 20 following ROIs are checked: Left-Lateral-Ventricle Right-Lateral-Ventricle % Left-Hippocampus Right-Hippocampus Left-Thalamus-Prop...
d26ffc7711ccc343207d9f9d2526b22876629b92ba412c23a61d75b355265a2f
MATLAB
6,120
170
%% Convert the vessel segments to a graph (nodes + vertices) %{ This script takes the output of the script ~\vasculature\vesSegment\vesSegment and then creates a graph. %} %% Add top-level directory of code repository to path % Print current working directory mydir = pwd; % Find indices of slashes separating director...
6db8eec51793294b5f154487af100f869ae401b0fa8972719eab5f68b66e9f9d
MATLAB
6,123
166
function [M, I] = permn(V, N, K) % PERMN - permutations with repetition % Using two input variables V and N, M = PERMN(V,N) returns all % permutations of N elements taken from the vector V, with repetitions. % V can be any type of array (numbers, cells etc.) and M will be of the % same type as V. If V is ...
17b9ce65096c45e28905f903d23203d8f481cfa125c7674bd83bb1b44292b4f0
MATLAB
6,127
176
%% --- Generate functional connectivity profiles and estimate initialization parameters % Adapted by M.-Y. Wang, 16-Nov.-2022 %% 1.initial parameters clear all clc project_dir ='/Users/wang/Desktop/Research_projects/BBSC/Functional/Parcellation/1_generate_profiles_and_ini_params'; cd (project_dir) addpath(genpat...
5a3aa1622bf6001f271cb24a99be4eabbe6edfeb0525b62e307369e6825f7f60
MATLAB
6,128
192
function[]=ref_vol_stitch(id,datapath) % mosaic parameters Xsize=1000; Ysize=1000; Xoverlap=0.15; Yoverlap=0.15; % add path of functions addpath('/projectnb/npbssmic/s/Matlab_code/PSOCT_code'); addpath('/projectnb/npbssmic/s/Matlab_code/ThorOCT_code'); addpath('/projectnb/npbssmic/s/Matlab_code/NIfTI_20140122'); %% ...
21a0c83d14d0335e070a76e445182f6861d813dac0dd72ca3f5a04581797c402
MATLAB
6,129
155
function SBJ08h_HFA_plot_grp_mLME_cat_recon(SBJ_id, proc_id, an_id, model_id, stat_id, cat_id,... atlas_id, roi_id, rcn, varargin) %% Plot a reconstruction with electrodes colored according to statistics % This version uses categories based on EpnRPE model % INPUTS: % SBJ_id [str] - ID o...
1b4005a89d4e2c8c990db8f2bba491ed181b6bc5635558155eb5695070c83454
MATLAB
6,135
123
% LAP DECODING ERRROR % MH, 05.2020 % Based on van der Meer et al(2017,Hippocampus). Optimizing for Generalization in the Decoding of Internally Generated Activity in the Hippocampus % Calculate track decoding error by calculating the error for each lap and then averaging. Each lap is decoded using the ratemaps of all ...
a8b0416e319e26c4f289b5f8d41d1eb59779fb2edd459e05aadd295dac7104dd
MATLAB
6,135
138
function [input_graph, varargout] = fun_graph_pruning_internal_short_hairs_masked(input_graph, th_hair_length, internal_offset, ep_not_to_ind) % fun_graph_pruning removes all the short links that connected to % internal endpoints from the graph % Input: % input_graph: structure, generated by fun_skeleton_to_graph % ...
ea05105fbcecb51c2732489da6d4cb5abed7ab95164d8012cf34c8446506c859
MATLAB
6,141
125
%% CP24 Processing Variables [root_dir, app_dir] = fn_get_root_dir(); ft_dir = [app_dir 'fieldtrip/']; if isempty(strfind(path,'fieldtrip')); addpath(ft_dir); ft_defaults; end %-------------------------------------- % Basics %-------------------------------------- SBJ_vars.SBJ = 'CP24'; SBJ_vars.raw_file = {'...
e5ea28427bf1e3c580dd8f91ccc444bde1c80c95e593d5135f3bc9ed658413a2
MATLAB
6,143
163
function Optical_fitting_TDE(co, cross, s_seg, z_seg, datapath) % Fitting code for the data shared by Hui. % I: volume data for 1 tile % s_seg: slice number % Z_seg: tile number % datapath: datapath for original data % zf: focus depth matrix, X*Y dimension I=sqrt(co.^2+cross.^2); cd(datapath); opts = optimset('Display...
01fc8391a3dd226f0aea311620b492a69337b78ad4bfe6674a785fcf4b8d7986
MATLAB
6,149
201
function [isValid, validatedMesh] = c_mesh_isValid(mesh,varargin) % c_mesh_isValid - checks if a mesh struct is valid % % Mesh must at minimum specify vertices and face/volume elements. Other fields are optional % E.g. % mesh.Vertices: [N,3] matrix % mesh.Faces: [M,3] matrix for triange surface mesh % (or mesh.Eleme...
b36b8afbe3d7f9bea092d90ff3cd9122c2f7a7884012f11bb0d53c522b2d2cea
MATLAB
6,153
179
function plot_topography_searchlight_dth_ak(subjects,task_distance,task_RT,with_stats) %PLOT_TOPOGRAPHY_SEARCHLIGHT_DTH_AK Plot the distance-to-hyperplane searchlight results %at peak. % %Input: subject IDs, task_distance and task_rt (1 for categorization, 2 for distraction), %with or without stats (1/0) % %Output: on...
4aec4006e42768b59577bbb70a92480da58c9c3b0e71c042a15eebac50fc8191
MATLAB
6,154
166
function PlotAllFiguresSynth(genAll,meta,currDelay,currDur) cond = ['_CWdur' strrep(num2str(currDur),'.','') ... '_CWdelay' strrep(num2str(currDelay),'.','')]; plotFolder = char(meta.syntheticPlotFold); %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% plotting...
ed55a0ac783e6ab27f96b08a8956d20c761b921225df70cc3c9ae05225a63438
MATLAB
6,155
186
clc;clear;close all root='..\'; addpath(genpath([root,'NeuralCorrelateEvidenceAcc'])) %% rootpath='..\dataset\Mice\spike\result\'; rootpath2=[rootpath,'total_clusterArea_paper_results_kernel_0\']; selectivePath=[rootpath2,'_auroc\selectiveUnits\']; firingRatePath=[rootpath,'total_clusterArea_paper_results_kernel_0\_Fir...
6cdb21382403a4dd87ee637a5daf5af9ebab9529c5313443676605ab2323d696
MATLAB
6,158
208
function [SharpCurv,CurvTrack,err2] = modelCurvedWalks(s,curv,Cstarts,Cstops,pltInf) % This function takes start and end positions of sharp turns and creates an % model of the track using sharp turn and curved walk abstractions % % Inputs: % s: Cell array with s.x and s.y (x and y positions of each track) % curv:...
9a2972ba9d7172301974454f108d6b16c1f581d887471d6a1bc0afb6179df7c9
MATLAB
6,159
162
function [str, tag, cind, ccnt] = gencode_item(item, tag, tagctx, stoptag, tropts) % function [str, tag, cind, ccnt] = gencode_item(item, tag, tagctx, stoptag, tropts) % Generate code to recreate a generic item. This code should be suitable % for all derived classes. Derived classes that add their own fields should % ...
358da39219511684c4d8b9d9ec85274530226076de51d0c508296a05646959b0
MATLAB
6,167
124
%% IR85 Processing Variables [root_dir, app_dir] = fn_get_root_dir(); ft_dir = [app_dir 'fieldtrip/']; if isempty(strfind(path,'fieldtrip')); addpath(ft_dir); ft_defaults; end %-------------------------------------- % Basics %-------------------------------------- SBJ_vars.SBJ = 'IR85'; SBJ_vars.raw_file = {'IR85_erro...
bb5e0891994063e3d2984077973d0eeb18c458d27c65b53b1e07d8bd21e9aa49
MATLAB
6,169
218
function hdr = load_nifti_hdr(niftifile) % hdr = load_nifti_hdr(niftifile) % % Changes units to mm and msec. % Creates hdr.sform and hdr.qform with the matrices in them. % Creates hdr.vox2ras based on sform if valid, then qform. % Does not and will not handle compressed. Compression is handled % in load_nifti.m, which ...
6b826730cf89a0c7ade8462a21674b59ff4ea3a756d9062a52eee060d8856231
MATLAB
6,170
134
%Generates the spike matrix clear all dini_path = 'C:\Users\xscogno\MATLAB\Flavio2\Preprocessed_data\'; snr_path = 'C:\Users\xscogno\MATLAB\Flavio2\Preprocessed_data\SNR_H\SNR_flavio_new_L8\'; spath = 'C:\Users\xscogno\MATLAB\Flavio2\Preprocessed_data\'; mouse='L8M2'; %Name of the animal thr_SNR=4; res=1.5; count=0;...
18f188a2717b661ec860a8856a279977c751284171694fe8c0a8adfd7ec75261
MATLAB
6,187
178
function labels = spm_vb_graphcut(labels,index,I,W,depth,grnd_type,CUTOFF,DIM) % Recursive bi-partition of a graph using the isoperimetric algorithm % % FORMAT labels = spm_vb_graphcut(labels,index,I,W,depth,grnd_type,CUTOFF,DIM) % % labels each voxel is lableled depending on whihc segment is belongs % index ...
1d3868e149a9d4ed839c4e83a60bd0c46205e42ec39fcffdb36ad6d83ac322d1
MATLAB
6,189
213
% Execute a toy pulse design problem to illustrate fast small- and % large-tip-angle parallel RF pulse design. % The key objects used here are Gmri_SENSE (small-tip) and % Gocrf (large-tip). % % Copyright 2009-3-17, Will Grissom, Stanford University % (based on work he initiated at University of Michigan) % modified sl...
7cb63211269e6c59025e9e37d16dfad86a183e8c7f1feb8e336be86b7ef14ed0
MATLAB
6,194
171
%% Script to check the age and education difference in MCI+ and MCI- % Zilong Ji, UCL, 2022 zilong.ji@ucl.ac.uk % Preparing the data GLAMPI_PrepareBaseConfig % Preprocessing the data GLAMPI_PreprocessData %load('Data/HowettBrain2019_Dataset.mat'); %% ColorPattern; MCINeg_ID = {'A093863_13', 'A093863_35', 'A093863...
ee6ed62d0f2ab8ea1152520dfe31072a05588351cb88f6df0e2f3960a1ddaedd
MATLAB
6,194
162
function population_vector_analysis_figure % POPULATION VECTOR ANALYSIS FOR OVERALL PROTOCOLS AND FOR PROTOCOL SEPARATE cd 'X:\BendorLab\Drobo\Lab Members\Marta\Analysis\HIPP\Chapter 1\Population_vector_analysis\figures\PPV_shuffles_RAW-PlField_BAYESIAN' overall = openfig('Shuffle vs Real Cummulative frequency distr...
aea300fc89c6d15781ccca714453fcd3445e3a23d31a6a3e4c1f2d71d7d5eee9
MATLAB
6,195
167
%% Compare Freesurfer summaries of MRIs % % Vinding, M. C., & Oostenveld, R. (2022). Sharing individualised template MRI data for MEG source reconstruction: A solution for open data while keeping subject confidentiality. NeuroImage, 119165. https://doi.org/10.1016/j.neuroimage.2022.119165 % % Read Freesurfer output st...
d179e0dfc34ecaf8e4450e6aa8eaa579b2dfe4eadff1eaf8419badc5f0592ecf
MATLAB
6,198
221
function matrixCalculation(calibrationResults,row, col,val) % This function is used in conversionMatrixCreator_Human and conversionMatrixCreator_Birds % to process the resulting tracking data in a way that it can be used later % by getMouseTracking % % INPUTS % * calibrationResults : output from dotPresentationBirds...
5bca4c93ed17de3ca1adfbd0a8ce7289382e21014f9f27ff1c6b3c85e094c200
MATLAB
6,199
157
% Loads in all the trained concatenation models from `semantic_master_modelling_concatTasks_repo.m` % Calculates various group and group*task stats % Model comparison % % Matthew Nour, London, 2021 clear close all clc % -------------------------------------------------------------------------- % Paths %--------------...
6981cea9e870ea4c8170f4a0e47ef409bfb6f653c434ee2a9dca2a52402b2960
MATLAB
6,199
232
function [arclen,seglen] = arclength(px,py,varargin) % arclength: compute arc length of a space curve, or any curve represented as a sequence of points % usage: [arclen,seglen] = arclength(px,py) % a 2-d curve % usage: [arclen,seglen] = arclength(px,py,pz) % a 3-d space curve % usage: [arclen,seglen] = arc...
d8b54d57c2aeb944ec168c411238501bea9210171c23db9adae9854a15132d9a
MATLAB
6,200
200
function err = MRIwrite(mri,fstring,datatype) % err = MRIwrite(mri,fstring,datatype) % % Writes an MRI volume based on the fstring. fstring can be: % 1. MGH file. Eg, f.mgh or f.mgz % 2. BHDR file Eg, f.bhdr. Result will be written to a bfloat % volume, eg f_000.bfloat. % 3. NIFIT file, Eg, f.nii, f.nii.gz (unco...
33b36ab9e33596642a7012e4895aa138fc6e51647becffa7980057f0ff839756
MATLAB
6,206
230
% hole_example1.m % % 2D example showing the "hole in sphere" effect for OSEM SPECT % and various regularization methods that may help overcome it. % % Copyright 2004-5-13, Jeff Fessler, University of Michigan if ~has_aspire, return, end if ~isvar('A0'), printm 'generate system matrix' f.dir = test_dir; f.dsc0 = [f...
4c627810102ba1f92589fab104cc35e51b9cb1452cfbefa7eb555fe87442e684
MATLAB
6,210
124
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % generating lipofuscin distribution based on 2PM images % using channel2 of 2PM addpath('/projectnb/npbssmic/s/Matlab_code/fitting_code'); addpath('/projectnb/npbssmic/s/Matlab_code/PostProcessing'); addpath('/projectnb/npbssmic/s/Matlab_code/PSOCT_code'); addpath('/projectn...
57fe801b5ee5f9aa5cf01c27d133875422c25592e773bc891aee3ed97451fb5a
MATLAB
6,210
171
function c=segregate(d,varargin) % segregate - extracts synchronous start and end points of fields/spike events % c=segregate(d,varargin) Reads through spike data and extracts % start and end points of fields/spike events coherent on all % channels. % % Following 'segTime', the maximal allowed intervall in ms ...
e4c73bec052fb2c5e5bd79d4897c4638155ac3db425cd47f591c8f0a2c43279f
MATLAB
6,211
166
function fn_elec_compile_man_reref(SBJ,proc_id,view_space,reg_type,atlas_id) %% Compile manually adjusted ROI and tissue info (adjust for BP reref) % Main logic is by fn_combine_ROI_bipolar_logic % INPUTS: % SBJ [str] - name of subject % proc_id [str] - name of analysis pipeline % view_space [str] - {'pat','mni...
cd0fd1752aa25fa00c9e4c4c628ca29f916e724412be242907440a4257fea43c
MATLAB
6,214
153
function Optical_fitting_Hui_SupFrontal(ref, s_seg, z_seg, datapath) % Fitting scattering and retardance of brain tissue % co: volume data for co pol % cross: volume data for cross pol % s_seg: slice number % Z_seg: tile number % datapath: datapath for original data cd(datapath); opts = optimset('Display','off...
8c55e266a30077bd765510b727c3753de5eb0dd12b71b4bdaf293a2b21bb9b55
MATLAB
6,216
153
function Optical_fitting_Hui_0530(ref, s_seg, z_seg, datapath) % Fitting scattering and retardance of brain tissue % co: volume data for co pol % cross: volume data for cross pol % s_seg: slice number % Z_seg: tile number % datapath: datapath for original data cd(datapath); opts = optimset('Display','off','Tol...
22eb4d9d82d7148e55263b3a29a679b1807840a25bec643c5089ba9d6cd145f4
MATLAB
6,217
145
%% Thomas_Yang_et al, 2023 @Nuo Li lab %% Fig. 4c norm. FR, SC photoactivation, ALM record clear all close all addpath('../func/') load Figure_4_c_data sig_selective(isnan(sig_selective))=0; FR_pref = spk_count_yes_screen-spk_count_no_screen; i_selective = (sig_selective(:,2)) & cellType_all(:,1)=...
d0a2b0c38a0df64a6828dc9e192c40f3f35a558d76d042b6e417da6d8620afb7
MATLAB
6,221
180
function [cond1,cond2,cond3,cond4, cond5, cond6] = GetCondData(subj,exp_type, lock, DS, fn_nm, ref) % output: trial data in time domain for each condition % go to ptnt dir cd(['/mnt//yassamri/iEEG/sandra/subj_' subj]) % load trial data if strcmp('yes',DS) load(['trial_data_subj_' lock '_' subj '_ref_' ref '_selec...
13117a1e23bf961afd7acff356973b35278e59ffd51daa3dd6de577dd884e6fd
MATLAB
6,223
206
function [xs, precon] = eml_osem(x, Gb, yi, ci, ri, varargin) %function xs = eml_osem(x, Gb, yi, ci, ri, [options]) % E-ML-OSEM algorithm for image reconstruction from Poisson emission data % (ordered subsets expectation maximization) % model: Y_i ~ Poisson(c_i [G x]_i + r_i) % in % x [np,1] initial estimate % Gb [nd,...
5f1dd064bc60ef9d4622a940b2999cba3946b15ac8dda99ccb80144dd7e408dc
MATLAB
6,223
135
function [Class_results_merged,Class_results_category,predictResults] = NuCLearPRED(model,classNet,ClassDef,predictResults,VarNam) % Run prediction for each nuclei for each model predictResultsOrig = predictResults; for xx = 1:size(model,2) nmx = model(xx).split("."); nmx = nmx(2); if ClassDef(st...
ad8306b7ec62a182eacb997bce15b4d0a4e61c9ab79d0f8be71277cf7a58d19d
MATLAB
6,225
139
% INFER_STRUCTURE Infers the structure of MRF of binary variables based on samples % % Input % samples: logical matrix where each row is a sample and each column a node % lambda: regularization factor % options: % 'graph_build_method': ['and', 'or', 'average', 'raw']. How to conciliate % the fact...
38bd91d673d3e4835c168cdaf659803338a20014d59f635169c1d6ed944662ed
MATLAB
6,226
191
% Load NIFTI or ANALYZE dataset, but not applying any appropriate affine % geometric transform or voxel intensity scaling. % % Although according to NIFTI website, all those header information are % supposed to be applied to the loaded NIFTI image, there are some % situations that people do want to leave the origi...
be26a3f66054355b1005800d8caa30c67b4c6f89239823f7dd0a6452a9477291
MATLAB
6,229
148
function figurehandle= errorfill(x, y, varargin) % Usage: figurehandle= errorfill(x, y, E1, E2, ..., LineSpec) % % Use this function to draw a curve and its areas of confidence. % Draws the line y(x), then draws the areas E1(x), E2(x), ... % (Well actually it's done in the opposite order, to minimize overlap.) ...
e2b5c14c878c5656eb136600d6273677eae6b07096b9b39492dd60306240a10b
MATLAB
6,241
153
function Optical_fitting_Hui_0415(ref, s_seg, z_seg, datapath) % Fitting scattering and retardance of brain tissue % co: volume data for co pol % cross: volume data for cross pol % s_seg: slice number % Z_seg: tile number % datapath: datapath for original data cd(datapath); opts = optimset('Display','off','Tol...
f28923e994b7388c124cfd8f03aca897d4b9799af42a93730bb5dad2fcf370f0
MATLAB
6,241
152
ROI_list={'M2L1.tif', ... %Secondary Motor Cortex - Left Hem. 'MBL1.tif', ... %Primary Barrel Cortex - Right Hem. 'MFL1.tif', ... %Retrosplenial Cortex - Left Hem. 'FLL1.tif', ... %Forelimb Associated Motor Cortex - Right Hem. 'HLL1.tif', ... %Primary Barrel Cortex - Left Hem. 'BCL1.tif', ... %...
09712da140c6e8fd7021dec15c95bc93d29ca022fb19ca7f105c0f87c823cafe
MATLAB
6,242
144
%% Travelling Salesman Problem % Adapted from the TSP Example, Matlab Optimization Toolbox (https://mathworks.com/help/optim/ug/travelling-salesman-problem.html) % by Santhanakrishnan Narayanan (n.santhanakrishnan@gmail.com) % Use this code to solve both symmetrical and asymmetrical TSPs based on binary integer progra...
6fa6adcaa6df325aa4f7ec7009d2baabc64ff9cbed7fa4ba237f3cfc33509f1f
MATLAB
6,243
167
% Determine PREICTAL Recruitment Times - Individual traces %this script takes a matrix of calcium traces (cells by row, time by column) %and a vector of seeds time for an event (e.g. pre-ictal spikes) and finds %the point of recruitment by finding where the integral of first deriviate of %the trace is largest (select...
3a14c01f3a2df6f78c8314c92b01dce0a597300b792a627b4bbf2480b888f806
MATLAB
6,246
157
function Optical_fitting_Hui_0505(ref, s_seg, z_seg, datapath) % Fitting scattering and retardance of brain tissue % co: volume data for co pol % cross: volume data for cross pol % s_seg: slice number % Z_seg: tile number % datapath: datapath for original data cd(datapath); opts = optimset('Display','off','Tol...
bafcc7cf2b5c55162c88e4343a07656e729f09486f7c94bf651d2934d6cebe1a
MATLAB
6,246
142
function [timing] = control_fixation (dat, display, timing, radius, duration) fprintf('fixation control\n') %% get fixation radius rad=angle2pix(display, radius); %% get fixation information for every whole trial % NaN out the interpolated data, because this obscures the fixation % det...
d5a7f08ed19bfc6112a0c922a4c276e58aa1b01b16461dc6a105861fde50e778
MATLAB
6,246
144
%% Thomas_Yang_et al, 2023 @Nuo Li lab %% Fig. 5b norm. FR, SC photoactivation, ipsi ALM record clear all close all addpath('../func/') load Figure_5_b_data sig_selective(isnan(sig_selective))=0; FR_pref = spk_count_yes_screen-spk_count_no_screen; i_selective = (sig_selective(:,2)) & cellType_all(:,1)==1 ...
d6ff5b3448121bae60a7033a00198b12adde9c06ff5c636cb89a54e9bb9de3c9
MATLAB
6,249
178
function EEG = c_EEG_addEvents(varargin) p = inputParser(); p.addRequired('EEG',@isstruct); p.addParameter('events',struct(),@isstruct); p.addParameter('eventLatencies',[],@c_isinteger); % in indices (assume non fractional indices, though could remove this restriction) p.addParameter('eventPositions',[],@isnumeric); p...
5146ffb032735394fbb153236131f4797e7066f397638a5ff62a3a04e8ed0323
MATLAB
6,254
182
function fmodel = mTRFtransform(bmodel,resp,varargin) %MTRFTRANSFORM Transform a backward model into a forward model. % FMODEL = MTRFTRANSFORM(BMODEL,RESP) transforms a backward decoding % model (stimulus to neural response) into the corresponding forward % encoding model (neural response to stimulus) as per Hau...
e6400429186c1a8e3fecf5a5dcd2fdff8a6f47a374b550f727155cf2c4975d33
MATLAB
6,255
145
clear all;close all;clc subj_list = {'87'} iSubj = 1 subj = subj_list{iSubj} phase_list = { 'tuning_correct'}; %encoding, tuning_correc reg_list = {'OFC' 'FRO' 'TEMP' 'INS' 'CING' 'EC' 'HC' 'CA3'} lock = 'onset' %onset response ref = 'LM' fs = 500; baseline ...
d51cb1b59e468f218519cca75b83b2e3f969cf0449ea6b67a2e3deaa3ffdda09
MATLAB
6,266
225
% Gtomo2_wtmex_test.m % Test the Gtomo2_wtmex object % and the Gtomo2_dscmex object % todo: test both Fatrix and fatrix2 versions if ~has_aspire return end if 1, printm 'thread timing of Gtomo2_dscmex with large case' igl = image_geom('nx', 512, 'ny', 496, 'dx', 1); sgl = sino_geom('par', 'nb', 600, 'na', 100, 'dr...
826944a1c5c184eb4fd9bb6206a26449282ff9818e52b5367198aa42a11584be
MATLAB
6,267
157
% Script to generate the EEG vector of all the 115 s blocks % concatenated in one tall vector. A vector is generated for each phase % (phase 1 and phase 2) of MODA. % A NaN is added between each 115 s block. % % * warning : a block has not been presented to the scorers % * then the subject 01-02-13 has only 2 ...
0dd0e9cc3e96462a46693b8540ef8a89de1bfc2356172b75f3b90ba8ed2bda70
MATLAB
6,270
102
% THETA SEQUENCE DECODING ERRROR % MH, 2020 % Finds real position at the time of the theta sequence, and calculates the decoding error during the theta sequence % INPUTS: % decoded_thetaSeq - uses decoded theta sequences that have passed velocity and number of active units thresholds. % If em...
4860d6033e9aef170b925c3db3a088a61d89c79a74697b0b52a9f19a14ee5b1b
MATLAB
6,272
138
function [input_graph, varargout] = fun_graph_pruning_internal_short_hairs_masked(input_graph, th_hair_length, internal_offset, ep_not_to_ind) % fun_graph_pruning removes all the short links that connected to % internal endpoints from the graph % Input: % input_graph: structure, generated by fun_skeleton_to_grap...
dc5fab4ffa976c7187e05fc09789d3e372d7c3760fa7f60988420f8dbc3286cd
MATLAB
6,274
175
function spm_uw_show(mode,p1,p2,p3,p4,p5,p6) % Manage graphical output for spm_uw_estimate % % FORMAT spm_uw_show(mode,p1,...) % % mode - Verb specifying action. % p1-p6 - Depends on mode. % % FORMAT spm_uw_show('FinIter',SS,beta,fot,sot,ref,q) % %_______________________________________________________________...
336342491ac9b10ff382b40a3e42f343d9bc57ccd70a6b4cc9984e756ed0b35c
MATLAB
6,279
160
function strOut = createSetRequestString(dataIDString,varargin) %CREATESETREQUESTSTRING creates the XML string to set data via the % infoserver based on inputs. The first required input is a dataIDString. % The other input will determine what information is set. Depending on what % needs to be set, a parameter/value in...
4592b1e6dd65df5b2325daa257cdbeec55a5af52f3dedd27b3c54347a15b0a46
MATLAB
6,282
127
function [FieldAssignmentsAll, OrganoidStencilAll, Wells] = Iris_GetOrganoidFields(InPath, MetaData, CoordinatesAll, illustrate) %extract organoid IDs from CV8000 first pass and second pass integration % author: Paul Antony 20210213 % Coordinates: example: readtable([InPath, filesep, 'Encoding.csv'], 'ReadVariableN...
49a6fab594b6dcc3c717def5733bd20b53d096778daeb0469f4c5b91df3e45b7
MATLAB
6,282
184
function mappedArray = c_struct_mapToArray(structToMap,fieldMap) % c_struct_mapToArray - extract fields from a struct (or struct array) into an array % % Examples: % a_struct = struct('X',1,'Y',2,'Z',3); % a = c_struct_mapToArray(a_struct,{'X','Y','Z'}) % b_struct = struct('X',{1 4},'Y',{2 5},'Z',{3 6}); % b = c_struct...
7cd5c07acd94c5df165da2af477b8ff5ca860973833ab4d27330dc5cc945baf4
MATLAB
6,286
145
function [cgm, glucose, insulinBolus, correctionBolus, insulinBasal, CHO, hypotreatments, mealAnnouncements, vo2] = replayScenario(data,modelParameters,draws,environment,model,sensors,mcmc,dss) % function replayScenario(data,modelParameters,draws,environment,model,sensors,mcmc,dss) % Replays the given scenario defined...
be266fb0624a690b67c889e2d24970f5993eb64337dad9ac79344835d7b5fd03
MATLAB
6,288
261
function [pmf xs ys] = kde_pmf2(x, y, varargin) %function [pmf xs ys] = kde_pmf2(x, y, varargin) %| %| Compute a 2D empirical joint probability mass function (PMF) %| using interpolation that is similar to a kernel density estimate. %| This joint PMF (interpolated / smoothed histogram) is useful for %| computing joint...
261ab483d831ac964244171a13192d16b40e19b80fad9fbfd0068a0189ee5cc0
MATLAB
6,290
198
function Preprocessing_PDM_full_experiment(subn,task) % PREPROCESSING_PDM_full_experiment Preprocess the EEG data for the PDM experiment (post-pilot data) for one % participant and one task. % %Input: subject ID (e.g., 1), task (1=categorization, 2=distraction) % %Steps include: %-removing extra EEG data %-removing th...
03dc17860a06659109c285c9c93568826807fea6eb61b2b94d57415eebafb588
MATLAB
6,292
148
% % introSVC.m $%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % introSVC.m: a script what runs the introduction to SVC tasks %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % dependencies: % getSubInfo.m (function to collect subject info) % %%%%%%%%%%%%%%%%%%%%%...