sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f43ab4c2ad5a9be5d832d87e7f81e991e6553e548d1aae6fd5985eafdf0e85bc
MATLAB
4,331
199
function output = ILT(sig,gradechoinv,options) %Dicretized inverse Laplace transform for arbitrary kernal and contrast %encondings %solve S = KF for F % S is the signal % K is the matrix of kernals % F is the spectrum %gradechoinv - values of the MR contrast encodings %e.g. gradient direction, b-values, echo t...
c207d548c7303fffcdd8bd3bc52f3364b5f92f142a349b03900e59fae1ece786
MATLAB
4,333
124
function [] = SomatotopyGradientPlotting(sm, smData, pd, projectionFields, arrayInfo, arrayOfInterest) numDigits = 5; numChannels = 192; % Use 3 for C1, 1 for P2 and P3 if arrayOfInterest == 1 motChanMask = sm.motorChannel<129; elseif arrayOfInterest == 3 motChanMask = sm.motorChannel>128; end filtSize = 1; ...
d2a2b0f1c447cbd6fcc8f7d8625aad8889d3f0798f3bd0a7cf6941836777a57b
MATLAB
4,334
152
function [nodePos,nodeDiam,nodeEdges] = pruneGraph_Loops4( im ); nNodes = size(im.nodePos,1); nE0 = size(im.nodeEdges,1); nB=zeros(1,nNodes); for ii=1:nNodes nB(ii)=length(find(im.nodeEdges(:,1)==ii | im.nodeEdges(:,2)==ii)); end nBtmp = nB; nE0 = size(im.nodeEdges,1); nodeFlag = zeros(nNodes,1); ...
3d87a58010c5511441987519af788173c2c77e6072fded9f37f7cdd897658592
MATLAB
4,335
159
%% Script to visualize the distribution of l1 l2 and theata2 in different groups % Zilong Ji, UCL, 2022 zilong.ji@ucl.ac.uk % Preparing the data GLAMPI_PrepareBaseConfig % Preprocessing the data GLAMPI_PreprocessData %% % Model fitting config.ModelName = "beta_k_g2_g3_m3_sigma_nu"; config.ParamName ...
fa4f01f3c71006606faf4e47eae0cf58fb90a4db93c026254996abe898fd8303
MATLAB
4,336
105
% compile % % Builds the trigger counter for the parallel port (triggerCounter3.m) into % a standalone Windows program with the MATLAB Compiler. % % Run it in MATLAB, from any folder. Needs the MATLAB Compiler and % PsychToolbox; from the toolbox it needs parchat only, which it takes from % the IO folder of this toolbo...
f5a6c64a72e99bf89a6e95ccf5bf21218fdd066a2effde0c4a49ff323609b2a8
MATLAB
4,337
148
% 0.Load data session_v1=load('C:\Users\xscogno\MATLAB\Flavio2\Waves\Semi final scripts\Final scripts\Outputs\locking_ensemble_Pearson_V1\locking_ensembles_Pearson_V1.mat'); session_pas=load('C:\Users\xscogno\MATLAB\Flavio2\Waves\Semi final scripts\Final scripts\Outputs\locking_ensemble_Pearson_PaS\locking_ensembles_P...
483cee18f0832e14b1fbd468c687c9040cac9c36e8f3cb7b8589b036caa06672
MATLAB
4,339
129
function EEG = c_TMSEEG_findTMSPulses(EEG,varargin) % assuming no events available for TMS pulses, try to find based on artifacts p = inputParser(); p.addRequired('EEG',@isstruct); p.addParameter('filterMethod','median',@ischar); p.addParameter('maxPulseRate',100,@isscalar); % in Hz p.addParameter('addEventsOfType','Pu...
d5d1fd1edeea29b5fce99b1bf407f79fdcc7c3c67859e1fd192ccbd4387f1865
MATLAB
4,343
126
function [wmap, wconv] = call_fmap(yik, etime, func_name, varargin) % This function is a wrapper for fmap_est_qm.m and fmap_est_pcg_ls.m to % make them callable in a similar fashion as mri_field_map_reg.m %| inputs: %| yik [(N) nset ncoil] complex images at different echo times %| (these should be undistorted) %| ...
5df0ae1bb8a24781ecf8ec1233d9d90372c5c8955543c0d6fbb8de3f1c2dff78
MATLAB
4,344
191
function ob = Gmatrix(matrix, varargin) %function ob = Gmatrix(matrix, [options]) %| %| Construct fatrix2 object from an object (such as a matrix) that can do %| multiplication and transpose. The point of this would be to endow %| the matrix with the masking features provided by fatrix2. %| %| in %| matrix [M N] cou...
68308e1e41725895f4e84f092a748f8c96de8d01c0a312694aefca23a0229ab1
MATLAB
4,345
194
% Run all sessions and create 'AnalyzedData.mat' containing all data function AnalyzeAllData(Filename) RunAllSessionsTimeVsDistance load('Summary.mat'); clear R; Cnt = 0; Mx = size(R,2)+2; for i=1:size(R1,1) if R1(i,1)~=0 Cnt=Cnt+1; ...
71ae265f9a22ed75ef32446fe6a674b85d63a8fc94656b5154987ad33081d42b
MATLAB
4,345
117
function [negloglikelihood] = Estimate_g2_m3_sigma_nu(g2, m3, sigma, nu, Input, config) % Zilong Ji, UCL, 2022, zilong.ji@ucl.ac.uk % Find the likelihood with parameters specified in the model function name % Args (in common between all estimates functions): % beta: decay factor for the mental distance (calculation err...
944eb653aaa5ce7f8c3ec51b189c0c18cfcc0cd9ee5655bed9051986f5a74158
MATLAB
4,345
108
function [WC,T] = LeG_autoElecs(app) Img = app.CTImg; MaxElecs = app.detect.maxelecs; ElecRad = 2; %total radius of standard ad-tech grid electrode (4mm dia, 2.3mm exposed) XYZScale = app.XYZScale; %need to swap x/y if comparing with connected components MRInfo = app.MRInfo; ProjSurfRaw = app.ProjSurfRaw; ...
5f2fc310d387ac981ca3b59259328f7429c082fbfcdd40ded25beaf6c1b0dd2f
MATLAB
4,346
97
function fn_plot_ts_errbr(plot_info, data, var, event, cond) % Plot mean time series with shaded error bars on given plot handle % INPUTS: % plot_info [struct] - contains general plotting details % .fig [figure handle] - handle of the figure where the plot should appear % .ax [axis handle] - handle of the...
df884b38c6dc3a510029662b5d55c002839348de9dc3b57e405b2fffacfe6ab0
MATLAB
4,346
143
%% define dataset path datapath = '/projectnb/npbssmic/ns/191103_PSOCT_small_blade/'; addpath('/projectnb/npbssmic/s/Matlab_code'); %% define grid pattern % displacement parameters xx=199; xy=-4; yy=197; yx=10; % mosaic parameters numX=24; numY=24; Xoverlap=0.5; Yoverlap=0.5; % tile parameters Xsize=...
b59e5cf56bed1b84724cd59089be9b17538ab96081e31c934635752eb56f58f3
MATLAB
4,349
154
%% Analyzing Neural Time Series Data % Matlab code for Chapter 16 % Mike X Cohen % % This code accompanies the book, titled "Analyzing Neural Time Series Data" % (MIT Press). Using the code without following the book may lead to confusion, % incorrect data analyses, and misinterpretations of results. % Mike X Cohen...
50e88ac037525a75017d2a92b35e11e100c602d9bf1745423f580314005fb748
MATLAB
4,350
132
function cdf = spm_read_netcdf(fname) % Read the header information from a NetCDF file into a data structure. % FORMAT cdf = spm_read_netcdf(fname) % fname - name of NetCDF file % cdf - data structure % % See: http://www.unidata.ucar.edu/packages/netcdf/ % _____________________________________________________________...
d00593c4853e0ad422575c02edf37f5c2c355fc04271270c3babc420eb393f70
MATLAB
4,351
130
function recon_im = sense_recon(smap, reduced_fft, reduced_dim, np, regularizer, mask, figs_on) % function recon_im = sense_recon(smap, reduced_fft, reduced_dim, np, % regularizer, figs_on) % in: % smap [N M nc] complex sensitivity maps % reduced_fft [N/np M] or [N M/np] undersamp...
b485d96ae196b7571e31884376439ba7b77a61decb1fb5f18762313913a323cb
MATLAB
4,353
117
function [negloglikelihood] = Estimate_beta1_beta2_g2_g3_sigma_nu(beta1, beta2, g2, g3, sigma, nu, Input, config) % Zilong Ji, UCL, 2022, zilong.ji@ucl.ac.uk % Find the likelihood with parameters specified in the model function name % Args (in common between all estimates functions): % beta: decay factor for the mental...
38b14fb15995ce99b4777bbc31c939f042fbb24ad0d96f17cf8e1b54186f7d8f
MATLAB
4,355
114
function[]=ref_vol_stitch_from_AB(id,datapath, depth, thickness) Xsize=1000; Ysize=1000; Xoverlap=0.15; Yoverlap=0.15; resize_factor=0.5; % 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...
63677419c342f5e95bfea4f01021b5e01109ec87e7e4e98644d617eb450e1f48
MATLAB
4,356
119
function [sliding_mean] = plottingProbInside(empFlys,border,numfliesEmp,fs,startPts,type) if strcmpi(type,'during') [bin_inside_rim_sliding_SEM,bin_inside_rim_sliding_mean,inside_rim,framesinBin] = analysisFunc(empFlys,border,numfliesEmp,startPts,type); endPts = size(empFlys.rHead,2)-startPts+1; plottin...
b0011e1a30ef5e08cc807e515f43ee62ef207fe29316929b47b70417d8b46b94
MATLAB
4,356
102
% KMEANS K-means clustering. % IDX = KMEANS(X, K) partitions the points in the N-by-P data matrix % X into K clusters. This partition minimizes the sum, over all % clusters, of the within-cluster sums of point-to-cluster-centroid % distances. Rows of X correspond to points, columns correspond to % variables. KMEANS ...
55629162c16e801ddeabc90c169aa4ce8d491a8eebea586a78f07c99f2c3ef69
MATLAB
4,357
155
x_reg = 'INS' y_reg = 'CA3' % get regional elecs [fro_chan_idx,MTL_chan_idx,temp_chan_idx,insula_chan_idx,cingulate_chan_idx,OFC_chan_idx,CA3_chan_idx,... CA1_chan_idx,HC_chan_idx, ACC_chan_idx] = get_elecs(subj); if strcmp('OFC',x_reg) x_elecs = OFC_chan_idx; elseif strcmp('FRO',x_reg) x_elecs = fro_chan...
7b5b896d8ca4a6c9050848aa329553f86202cea1b61ca25cc060806d95ed59fd
MATLAB
4,358
175
% mri_r2_fit_ist1.m %| Fit R2=1/T2 and "pd" image using ODWT regularization %| and iterative soft thresholding (IST), with alternating updates. %| Use interactive sliders to select soft threshold value. %| Copyright 2012-05-20, Jeff Fessler, University of Michigan %| in %| mask %| yi [(N) nt] data %| telist [nt] echo...
f23ec362b3814d83e5512f325db0df38b35338f7a243e6cb8fa11ec57aca372a
MATLAB
4,365
92
function input_graph = fun_graph_relabel(input_graph) % fun_graph_relabel computes the labels for the links and nodes, update all % graph structure after graph pruning. % Input: % input_graph: structure created by fun_skeleton_to_graph. Required % field: % num.skeleton_voxel need to be updated. % ...
b1f211153c82d87b051de017dddab1d6022952a8ca2c6c50b4cb7d10c118fba6
MATLAB
4,367
185
function centers = lloyd_max_hist(data, centers, MM, tol, max_iter, chat) %function centers = lloyd_max_hist(data, centers, MM, tol, max_iter, chat) %| %| "improved" version of the lloyd-max algorithm for scalar quantizer design %| that saves computation by histogramming the data first. %| Before using this, try using...
d9b4fbaae15bc6bc8f78d1e0901c4cfafb4ac512e1905047a9c48cad67d03ae5
MATLAB
4,367
150
clc;clear;close all root='..\'; addpath(genpath([root,'NeuralCorrelateEvidenceAcc'])) %% subdir='total'; clusterName='clusterArea_paper'; regCluster=1; if(regCluster) subdir=[subdir,'_',clusterName]; end all_units=1; postfix=''; if(all_units) postfix='_allUnits'; end rootpath='..\dataset\Mice\spike\result\'; ...
c5620d3c53a1904cbf653545df41a80d9dda7f916ad213fd620e38e426bfeea3
MATLAB
4,368
97
function [outSpectrogram,outTimes,outFrequencies] = IPEMCalcSpectrogram (varargin) % Usage: % [outSpectrogram,outTimes,outFrequencies] = ... % IPEMCalcSpectrogram(inSignal,inSampleFreq,inFrameSize,inFrameInterval, % inWindowType,inFFTSize,inPlotFlag,inPlotTreshold) % % Description: ...
ee65caeadc4485069770bea3da495333ec191c5b0435651c8bfe790dc90dad6a
MATLAB
4,369
124
function plot_rate_map_longitudinal(neuronIndividualsf,behavIndividualsf,firingrateAll,cellnumber,thresh,dataType,scale,savefigure) %% This function is used to plot firing rate map of longitudinally tracked neurons % Inputs: % (1) neuronIndividualsf: a cell array of neuron data across different days, each cell is a sou...
ba93a922051160198429b23636d762d12ec4cda378d53f1ac032f5c1988a4e10
MATLAB
4,370
113
% bjli @ Feb 11 2023. % bjlistat@nus.edu.sg % refered to Z. Yao, J. Su, B. Li, and S.T., Yau, Manifold Fitting Jobs = { 1, 'Visualization of the Calabi-Yau';... 2, 'Visualization of the Performance';... 3, 'Boxchart asymptotic property S';... }; i_job = 3; job = Jobs{i_job,2}; swit...
40b2822b0a69fe7ac6e46c7f9a6afaf043cf015cdc965ddc1ec06ebceb4f8f50
MATLAB
4,371
155
clear all; %% define grid pattern % add subfunctions for the script addpath('/projectnb/npbssmic/s/Matlab_code'); % displacement parameters xx=20; xy=0; yy=20; yx=0; % mosaic parameters numX=33; numY=29; Xoverlap=0.5; Yoverlap=0.5; % tile parameters Xsize=40; Ysize=40; numTile=numX*numY; g...
c6f24406722b7c9cbd3c842391d5820c815f15b2d539df6a13452a8c8d07858b
MATLAB
4,371
142
function [peakAll,SpikesAllV,Stimulus,IdxInCluster,window,fs] = SpikeClustering(voltageTrace,Stimulus,fs,vis) % this function will calculate the spike rate of a given given signal and % index of spiking % voltageTrace: Vector of the Baseline subtracted voltage (mV) % Stimulus: Vector of the Stimulus associated wi...
d2c3bc0b56f3a44ac86e5ca5ea34df8b50acf98024cfcc3624aaef536055df51
MATLAB
4,371
142
%% Curve fitting - estimate effective Reylaigh range and focus depth clear all; datapath = strcat('C:\Users\jryang\Desktop\30-s3\'); % add subfunctions for the script addpath('C:\Users\jryang\Desktop\Data\code\'); opts = optimset('Display','off','TolFun',1e-10); % fitting options % get the directory of all i...
7d3cb87f6db26a7d3f0e747ae15e10471551d51dc0d0fe9a6cf230dcb9e5ea4c
MATLAB
4,376
149
function y = Gtomo_nufft_filter(omega, ob, do_phase) %function y = Gtomo_nufft_filter(omega, ob, do_phase) %| %| build the sinogram-spectrum-sized matrix %| that is .* multiplied after 2D FT, before iFFT or NUiFFT %| %| in %| omega [M 2] frequency sample locations (radians) %| out %| y [M 2] filter %| %| Copyright 200...
b758fe133883fdec4e50705fa0423f8df4ef02fd5cf95e28e44dea533a8fb860
MATLAB
4,377
152
clear all;close all;clc % this script saves the behavior log data into matrices % output: testing_behav_matrix, training_behav_matrix subj = 7 patient_num = [ 39 57 66 63 44 83 84 85 87] ; addpath('/mnt/yassamri/iEEG/sandra/analysis_pipeline_final') cd(['/mnt/yassamri/iEEG/sandra/subj_' num2str(patient_num(subj))]) ...
40148717a789fc59576398e6ac0b854d95d4ecae74cf880afc73fe0c76d05a55
MATLAB
4,378
162
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Population data analysis for the local retinotopy of RGC axons / local % SC neurons % % This script generates Figure 4 of the following paper: % % Molotkov D., Ferrarese L., Boissonnet T. and Asari H. (2023) % Topographic axonal projection at s...
fa4352a162ee792c4d621b03f24aa29999bcf9598601e8a2f52f1ebcfa717a86
MATLAB
4,379
155
function y = embed_mult(fun, arg, is_transpose, x, istart, nblock, ... mask, np, odim, is_array, varargin) %function y = embed_mult(fun, arg, is_transpose, x, istart, nblock, ... %| mask, np, odim, is_array, varargin) %| %| The matrix-vector versions of the linear forward models used herein %| expect an input x of si...
f91e8e3db43075bfae53cf3b267a25d5874b4d912f34d6a3311a5680fd69c9ea
MATLAB
4,381
101
%% Create conversion matrix % This script creates a conversionMatrix which translates tracked coordinates of the cameras % to touched positions on the screen. This script is necessary to use camera tracking in a Skinner Box, to register % screen packs and touches on a setup without a touchscreen. % CameraTracking_Bird...
09af8761c49dbe7ee69476812f852aa28d70c0285b4fc2bb1176b510da3c809c
MATLAB
4,382
83
function connect_link_str = fun_graph_shortest_path_between_points(metric, point_sub_1, point_sub_2, connectivity) % fun_graph_shortest_path_between_points finds the shortest path between % two point, with distance measured by the metric array % Input: % metric: 3D numerical array, specify the distance between n...
945d9aeb892cf8a592b78283a4d86f49cd7dfd1083d298c9138e6d31c6a7d6ad
MATLAB
4,382
118
function [negloglikelihood] = Estimate_g3_sigma_nu(g3, sigma, nu, Input, config) % Zilong Ji, UCL, 2022, zilong.ji@ucl.ac.uk % Find the likelihood with parameters specified in the model function name % Args (in common between all estimates functions): % beta: decay factor for the mental distance (calculation error) % k...
9810d664beb2165979747c79b4b360233621f54d4bcbf56137cc9b8f69bd1f3b
MATLAB
4,382
164
% This function takes Dans experimental fits for the different % ages, and tries to find which function matchIterationToAgeSegregationExperiment(obj,injectionType,nRep) switch(injectionType) case {'MLfix','AP'} axisDir = 'AP'; case {'APfix','ML'} axisDir = 'ML'; otherwise fprintf('Unk...
b01a9223668c9ff7b2a98e0de3a1e459f4ad7a59e1918b6112458ee82f97cc1b
MATLAB
4,383
124
function x = spm_invFcdf(F,v,w) % Inverse Cumulative Distribution (CDF) of F (Fisher-Snedecor) distribution % FORMAT x = spm_invFcdf(F,df) % FORMAT x = spm_invFcdf(F,v,w) % % F - CDF (lower tail p-value) % df - Degrees of freedom, concatenated along last dimension % Eg. Scalar (or column vector) v & w. Then df=[v...
3ee6b78aef70601985e496fed1d9a897209bd3e0872db3fe83dda582b5fc0619
MATLAB
4,384
118
%% Plot Supplementary Figure 8 a, b, e % Plot single-trial spectrogram of an ROI to compare different regression % steps %% Define Paths of Loading Files and Save Files currentFolder = mfilename('fullpath'); % determine the filepath based on where the script locates scriptFN = mfilename; filePath = erase(erase(current...
f3e9c7d56f3b73b8b9340a159c760386e37b160792015eb18b1186545c8cf936
MATLAB
4,384
205
function Fatrix_test_basic(A, mask, varargin) %|function Fatrix_test_basic(A, mask, [option]) %| %| perform basic tests of Fatrix objects %| in %| A [nd *N] Fatrix object %| mask [(N)] logical support %| option %| 'x' [(N)] optional input test image %| 'multi' 0|1 if 1, test multiple rhs: A * [x x]. default: 1 %|...
1fbd7f54c6a19890553be3d7577e158e730ed89e95525010112cb8be597b00df
MATLAB
4,385
112
function tsc_STA(mainPath, animal, session, ch, isstim, neuron_n) %TSC_STA Spike triggered average analysis during theta cycles with tSCs % TSC_STA(MAINPATH,ANIMAL,SESSION,CH,ISSTIM,NEURON_N) performs spike % triggered average analysis on LFP and on the Wavelet power and phase of % the LFP. The analysis is re...
599552f9e542abf16727e14ccbe0217e97252cb031d1d38378e7270ceaad97de
MATLAB
4,386
150
function handle = c_plotSurface(varargin) p = inputParser(); p.addRequired('nodes',@isnumeric); p.addRequired('faces',@isnumeric); p.addParameter('nodeData',[],@isnumeric); p.addParameter('faceData',[],@isnumeric); p.addParameter('elemData',[],@isnumeric); p.addParameter('renderingMode',0,@isscalar); p.addParam...
7a28322e68b230d87e97784948103b390e6e31c45de4d063fa80a48097b9887f
MATLAB
4,386
105
function [timing]= get_traces(dat, event, behavior) fprintf('separate interesting periods\n') type={event.type}; run_mess=find(strcmp(type,'Run:')==1); value={event.value}; a=strfind(value,'Trail:'); trial_message=find(cellfun(@isempty,a)==0); %...
f8c0640d869a8bef47766f12710c4073259848f483ff096a4cfd0ab475f974a0
MATLAB
4,386
98
function SVM_object_decoding_full_experiment(subject,task) %SVM_OBJECT_DECODING_FULL_EXPERIMENT Perform object decoding (average of pairwise object decoding) using the SVM classifier. % %Input: subject ID, task (1=categorization, 2=fixation) % %Output: NxNxP vector of accuracies in %, where N is the number of conditi...
87cfc0c01f51026a4044714162b6186cbcaab21db9fb43edb18ba4c05ae948b0
MATLAB
4,390
142
%% Goals: input smoothed and aligned data from script 1 in order to evaluate %signal changes surrounding epocs %revise to add outputs for group averaging %revise with if/then statements indicating where to look for TTL epocs if %manual times are not provided. function [] = Epoc_Alignment_CF(savedata, savefigs,...
37bb80723313c6e8352ab7eed1893bb2c2ea10d5ebc60de8cd11b8bc31a64d57
MATLAB
4,391
145
function plot_spatialinfo_before_and_after_dchPeriod(cells) % function constants plotWidth = 500; plotHeight = 1000; spatialBinNum = 200; MPP = 0.125; %Minimum Peak Prominence numCells = size(cells.metadata,1); drawFig = true; % declare global vaariables all_Ispike_cntrl = NaN(numCells,1); all_Ispike_dch = NaN(num...
d09518c9c412e58f1d4918f8a6a4396552d2f464319602cb703839e3ae66801a
MATLAB
4,393
111
function [OFC_chan_idx,fro_chan_idx,temp_chan_idx,insula_chan_idx,cingulate_chan_idx,... ACC_chan_idx,EC_chan_idx, HC_chan_idx ,CA3_chan_idx,CA1_chan_idx, MTL_chan_idx] = get_elecs_clean(subj) %UNTITLED2 Summary of this function goes here % Detailed explanation goes here if strcmp('57', subj) fro_chan_idx ...
cad31e866970b84399d624267f4f9a78a1453d1c1cb9484c24d92f3b7518ad0b
MATLAB
4,396
79
% EXTRACT THETA SEQUENCES SCORES FOR TRACK AND SESSION % MH 2020 % Takes the averaged theta sequence score for each session and track calculated in the theta pipeline and saves it in a structure. Within each % method structure, each row is a track and each column is a session. It's ordered from 16x8 to 16x1 sessions. ...
b8892b172c60cd8135401c9d45a58786b6d60836c0911c4fb280844f66f27a8f
MATLAB
4,398
134
% [footblur, radii] = blob_li_blur(R, dR, alpha, kb_m, blur, du, dy, Ny, chat) % Calculate line integrals of a radially symmetric Kaiser-Bessel blob % and blur them with each one of a set of 2D blur PSF's % % R: Radius of blob support [mm] (default = 2*dy) % dR: Sample spacing [mm] in radial direction % of p...
f85bd35b6e9e373936c80bc94375c21442f9158b633bf1f87ad6dc4d54342862
MATLAB
4,402
116
function IPEMPlaySoundWithCursor(varargin) % Usage: % IPEMPlaySoundWithCursor(inSignal,inSignalFreq,inAxisHandles,inTimeRange, % inTimeOffset,inSpeedFactor) % % Description: % Plays the given sound signal while showing a moving cursor in the given axes. % % Input arguments: % in...
fb47c5ee161a376d5bfb6f0ea7e4576135fce06da31aa023aa656bd1c2586785
MATLAB
4,403
127
function SPM = spm_vb_contrasts(SPM,XYZ,xCon,ic) % Compute and write posterior standard deviation image of given contrast % FORMAT SPM = spm_vb_contrasts(SPM,XYZ,xCon,ic) % % SPM - SPM data structure % XYZ - voxel list % xCon - contrast info % ic - contrast number % % Get approximate posterior covariance for gi...
2ed68b1a2c21b6ed188f69755151be8c26c9b830950b50ae2a7c8584cd3ebf63
MATLAB
4,404
155
function [C,B,phi,varargout] = ir_circ_zeroed_reg(order, maskR, sparseR) %function [C,B,phi,varargout] = ir_circ_zeroed_reg(order, maskR, sparseR) % Input: order - order of regularizer % maskR - [nx,ny] - mask of regularizer (changes C,B,and phiR) % sparseR - binary flag for a sparse output (varargout) instead of Fa...
585a600b83d2dfa103716c1853f5323744fb88fd1cef09af0e8c22969468c003
MATLAB
4,404
126
function varargout = spm_update(update) % Check (and install) SPM updates from the FIL server % FORMAT spm_update % This function will contact the FIL server, compare the version number of % the updates with the one of the SPM installation currently in the MATLAB % path and display the outcome. % % FORMAT spm_update(up...
b34e74796e237da664e59ce19c08eed4f3f8488d01ca67cdb6e087d0985732b4
MATLAB
4,410
150
% create design matrix for GLME with criterion predictor % clear % close all ; clc % paths cd D:\Exp_noInstruction\ resOut = [pwd '\results\']; outdir = [pwd, '\data\'] % load data load([resOut,'Exp6_SDTscores.mat']) % templates conditionTemplate = categorical(repmat({'periodic','aper...
88c4ec971e3ad9d33d89c68ad6467159e900cb9e5c0f4fda4733a031128b0157
MATLAB
4,411
122
%APPEND_PDFS Appends/concatenates multiple PDF files % % Example: % append_pdfs(output, input1, input2, ...) % append_pdfs(output, input_list{:}) % append_pdfs test.pdf temp1.pdf temp2.pdf % % This function appends multiple PDF files to an existing PDF file, or % concatenates them into a PDF file if the output fi...
17ab7cd897a4836ebd22b6cb80bea5c33742cc5e9a075d090bc48907c45d6381
MATLAB
4,412
91
function [DEF, stampFileName, dateFormated] = createStructFolder4PackageA( genPathPackage,... packageName, packageRev, dateFormatedRev) % Function to create the structure needed to save all the analysis package % and generate the name of the stamp text file to identify the package used % as input. % % Input % gen...
38939e1555555c19e822885231642b498d92379d0869577688e0b12e052d32cd
MATLAB
4,413
89
function [vessel_graph, varargout] = fun_graph_mask_to_graph(vessel_mask, vessel_image, opt) % fun_graph_mask_to_graph is a wrap up function for converting the vessel % mask to vessel graph. % Input: % vessel_image: 3D numerical array of vessel image stack % vessel_mask: 3D logical array of the vessel mask,...
3e9e8b0dfd43850761be7310471e93cd759d3ddcf87d614fcc1d6138a840bb8e
MATLAB
4,414
142
%% create design matrix for GLME with criterion predictor % clear % close all ; clc % paths cd D:\Exp_withInstruction\ resOut = [pwd '\results\']; outdir = [pwd, '\data\'] % load data load([resOut,'Exp7_SDTscores.mat']) % templates conditionTemplate = categorical(repmat({'periodic','ape...
9513d885d4e8b35319f33c17931f1f8cb824fb6d25b7bfcd7d1b250872803688
MATLAB
4,414
130
function Experiment_Fiji = ReadFijiStitchingResults10x(pathname, folder, Experiment) Experiment_Fiji = Experiment; m = max(Experiment.Z_tile,Experiment.Z_tile*Experiment.NbSlices); for zz = 1:m MapIndex = squeeze(Experiment_Fiji.MapIndex_Tot(:,:,zz)); fid = fopen([pathname folder 'Mosaic_depth' sprintf...
207f0c4032d02582b0cd1bb4f4bd4fd32317ea889edcd17d895c96a76c47b39d
MATLAB
4,416
142
function y = weighted_prctile(x,p,w,dim,issorted) % WEIGHTED_PRCTILE Percentiles of a sample. % Y = WEIGHTED_PRCTILE(X,P,W) returns percentiles of the values in X. P is a scalar % or a vector of percent values. When X is a vector, Y is the same size % as P, and Y(i) contains the P(i)-th percentile. When X is a...
3a9f2ae5bb8219235a56324d9672eda175bb458845da4b55726c7856a425e4dc
MATLAB
4,416
150
% feldkamp_example.m % Example of how to use feldkamp.m for cone-beam CT reconstruction % Copyright 2004-8-28, Nicole Caparanis, Patty Laskowsky, Taka Masuda, % and Jeff Fessler, University of Michigan if ~isvar('cg'), printm 'cg: cone-beam CT geometry' % see book chapter section (ask me) on cone-beam CT recon for no...
63dfb4afe9a261110905695be8afd60888fefb89d0530bbbf19a7666f7eba9ed
MATLAB
4,421
148
function [kb, alpha, kb_m] = kaiser_bessel(x, J, alpha, kb_m, K_N) %function [kb, alpha, kb_m] = kaiser_bessel(x, J, alpha, kb_m) %function [kb, alpha, kb_m] = kaiser_bessel(x, J, 'best', 0, K_N) %| %| generalized Kaiser-Bessel function for x in support [-J/2,J/2] %| shape parameter "alpha" (default 2.34 J) %| order p...
096f66bd5f48f9a4faba834fecee9b026ea59aad3a36c1e18fd1ab512295ee6f
MATLAB
4,423
184
function xs = epl_inc(x, Gb, yi, ci, ri, R, varargin) %function xs = epl_inc(x, Gb, yi, ci, ri, R, [options]) %| Incremental optimization transfer version of EM algorithm for %| penalized log-likelihood emission image reconstruction from Poisson data. %| see eql_sps_os.m for arguments %| in %| Gb cell array or block...
a3ccdb9f49b259cb1096556ae7633075d81aace3b76c3ded4711e0a612e2bd4e
MATLAB
4,423
129
function mip = spm_mip(Z,XYZ,M,units) % SPM Maximum Intensity Projection % FORMAT mip = spm_mip(Z,XYZ,M,units) % Z - vector point list of SPM values for MIP % XYZ - matrix of coordinates of points (mip coordinates) % M - voxels - > mip matrix or size of voxels (mm) % units - defining space [defaul...
c0412af38d4c8d83621366e3d7361cbe7e18242da9ff134558fd35e2465b31e0
MATLAB
4,423
171
function ob = Gtomo2_dscmex(arg1, varargin) %function ob = Gtomo2_dscmex(sg, ig, options) %function ob = Gtomo2_dscmex(file, options) %function ob = Gtomo2_dscmex(arg_pairs, options) %| %| Tomographic system model based on aspire's wtfmex() routine, using its %| dsc,proj and dsc,back commands for on-the-fly forward an...
e0067f78fa344469e7af09d0e718e329a0cfd416655392e3c1221efb4a95a60d
MATLAB
4,423
161
function [K0,K1,K2,H1] = spm_kernels(varargin) % returns global Volterra kernels for a MIMO Bilinear system % FORMAT [K0,K1,K2] = spm_kernels(M,P,N,dt) - output kernels % FORMAT [K0,K1,K2] = spm_kernels(M0,M1,N,dt) - state kernels % FORMAT [K0,K1,K2] = spm_kernels(M0,M1,L1,N,dt) - output kern...
ce7474bc563df697a676bc393acc0f6eb296317889ead54fdb9780d440eb3b48
MATLAB
4,426
179
% eml_osem_example.m % % a complete example m-file illustrating E-ML-OSEM. % showing faster "convergence" compared to E-ML-EM % % Copyright 1998-1, Jeff Fessler, University of Michigan % generate data if ~isvar('yi'), printm 'set up' f.count = 1e6; im clf, em_test_setup f.clim = [0 6]; prompt end % ML-EM iterati...
ffad49e4b60d00c71e153e4993b7e1734b9d61c289e4a50b7ddb4de4bc9f82b5
MATLAB
4,427
146
% plot condition traces as a function of delay (either normalize or subtraction plots) clear all lock = 'onset' %lock = 'response' phase = 'encoding' %phase = 'retrieval' reg1_list = {'OFC' 'FRO' 'TEMP' 'CING' 'INS'}; %' reg2_list = {'HC'}; addpath('/tmp/yassamri/iEEG/sandra/analysis_pipeline_final') cd (['/tmp/...
48048b444cd9812813acdfe9cf761baa38247e557d6f0bd3888ba14668cb5013
MATLAB
4,428
117
function [fNum] = plotKNNFormulation(f_orco,fNum) xGrid = -150:15:150; yGrid = 0:1:55; % use curved walk as an example param = 2; m = f_orco.model.params{param}; allSpk = m.allSpk; alldSpk = m.alldSpk; allDat = m.allDat; % get the KNN parameters ratio = m.KNN.ratio(1:2);% not counting time K = m.KNN.K;...
63760c4ed111313f34b79034cc2c3206a9e67ce570124ab12eaaa07d90f6baae
MATLAB
4,428
117
function [negloglikelihood] = Estimate_beta1_beta2_g2_g3_m3_sigma_nu(beta1, beta2, g2, g3, m3, sigma, nu, Input, config) % Zilong Ji, UCL, 2022, zilong.ji@ucl.ac.uk % Find the likelihood with parameters specified in the model function name % Args (in common between all estimates functions): % beta: decay factor for the...
5e624910775337b6eb17766956161be8483bae093b259df79e12cf40ad4b6d8b
MATLAB
4,430
99
function fn_compile_einfo(SBJ,proc_id) %% Compile ROI info from single electrodes into bipolar pairs % Goes from smallest to largest (ELEC1-ELEC2, ELEC2-ELEC3, etc.) % Pairs are drawn from preprocessed data labels % % new_labels = cell array of strings with combined labels % can be used with ft_preprocessing as c...
2caba52964b72a4f4dd63ad1f042fb955f1781c6539ff7a512f673eddbab0ce7
MATLAB
4,431
169
% clc; close all; clear; %% OPTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TIME PARAMETERS: t0 = 0; % Initial Time tb = 20000; % Final Time for Bifurcation % INITIAL CONDITIONS: u0 = [35000; % (C) Tumor Cells 0; % (T) T-Cells 0]; % (M) MDSCs...
fff012de6d158cf3896175a4c450e632f08c05aea0cbb14c0dadc6f4ecbcd75d
MATLAB
4,432
129
function [acc_rand] = RandomForest_HRV_chance(data, numrand, train1, train2, test1, test2) % This function performs a Random Forest classification using arbitrary % patients label. This function performs several classifications to obtain a % chance accuracy distribution for unbalanced datasets. This function uses % Ran...
05e3c160ba5b847e86d9ed0503e9994cae385cbf07b830c9891c6668bbea8367
MATLAB
4,436
129
function [] = plotTimeInsideLightZoneVsBorderRegion(genAll,meta) close all %radialProb = cell(numel(genAll),1); percentTimeSpentInA_before = cell(numel(genAll),1); percentTimeSpentInA_during = cell(numel(genAll),1); ttInA = @(x) sum(x<=1); ttInB = @(x) sum(x>1 & x<=1.3); for gen = 1:numel(genAll) load(strcat(...
d800dc7875d963d55704e95544bbd33e4d6a434edd0b32c5848e298ef82e3b89
MATLAB
4,436
224
function out = jf(varargin) %function out = jf(varargin) %| various personalization routines %| 'mv var_old var_new' %| 'ncore' # of cores this machine has %| add optional 2nd argument to over-ride, e.g., jf('ncore', 4) %| 'whos' %| 'clf' %| 'nobar' preclude toolbar and menubar from figures to render faster! %| 'nome...
5cf00e37ae66f5d1fbf8bd3a84e27cae2d7f3f8f724d130b18b397d604e38d7b
MATLAB
4,439
119
function cnd = cndDownsample(cnd,downFs) %CNDDOWNSAMPLE Downsamples the neural data (e.g., EEG) in CND format. % CND = CNDDOWNSAMPLE(CND,TYPE) downsamples the contant of a CND data % structure. For time-series of impulses (e.g., word-onset vector) % the function does its best to preserve all impulses, i...
32b1ccd8f5f693ea9a1f1c244e1ede36a26d7e3c2aa55686797c277a8952411f
MATLAB
4,444
97
function [x_pair] = fitRogCrf(spikes,cont,mu_eta,cov_eta,tuning,opts) arguments spikes (2,:,:); cont (1,:); mu_eta (2,1); cov_eta (2,2); tuning function_handle = @contrastResponse; opts optim.options.Fmincon = optimoptions(@fmincon,... 'Algorit...
e00a78d5375aa128a581eb2dcd1b2a0e2de61013de67c38be4185817f492c135
MATLAB
4,445
176
function plot_fig_1c(path) % load data tbl = readtable(fullfile(path.data, 'SourceData.xlsx'), 'sheet', 'Fig_1c'); %% Plot Reaction Time avg_RT_0 = tbl.Var1(2:end); avg_RT_25 = tbl.Var2(2:end); avg_RT_75 = tbl.Var3(2:end); % create cell array plotRT = {avg_RT_0, avg_RT_25, avg_RT_75}'; % colors use for plotting ...
f4a61e85f2ee41180d7a47c1e6eb7c9b3190b4fe609c5c623f345892a6d37ae2
MATLAB
4,448
106
%% Find a bipolar colormap, linear in grayscale, close to a template map. %% % Linearity in gray is important for a colormap to look reasonable when % printed in grayscale ("black and white"), but note that precise linearity % depends on the particular (non-unique) choice for conversion from RGB % values to grayscal...
bba66d60be0943c59ef8e647fa2bca3af2b2a9fdb6f3e7258c58357593a2e6d7
MATLAB
4,450
128
function make_figure8(plotVariables,options) glmFlag = 'jumps_absolute'; % subject list subjectList = [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 csdFlag = 0; % 1 for csd transformed data if csdFlag %temporary fix for bug in first subjects' CSD transform ...
c5370f11897c1438b87866b42625ade745f55d2be53ab3ab6e317765f862a683
MATLAB
4,450
158
function [Cxx,Cxy,folds] = olscovmat(x,y,lags,type,zeropad,verbose) %OLSCOVMAT Covariance matrices for ordinary least squares estimation. % [CXX,CXY] = OLSCOVMAT(X,Y,LAGS) returns the covariance matrices for % ordinary least squares (OLS) estimation using time-lagged features of % X. X and Y are matrices or cell...
606fb051c825d86e46b843905b1d7a3b6df456340e07fd7cd88a97b184dff23b
MATLAB
4,452
98
function pipeline_03_behavior(study_info) pipeline='NEARICA_behav'; % behavior exe_df=readtable(fullfile(study_info.data_dir,'behavior_exe.csv')); obs_df=readtable(fullfile(study_info.data_dir,'behavior_obs.csv')); % Number of subjects n_subjects=size(study_info.participant_info,1); epoch_types={'OBM','LOBS','FTGO'...
9eab73bab3d9b1d2bb26ea15fe157215ddcd2c65edfb072f4061dd8f9c9501fc
MATLAB
4,452
64
function sensors = initSensors(cgmModel, model, environment) % function initSensors(cgmModel, model, environment) % Initializes the 'sensors' core variable. % % Inputs: % - cgmModel: a vector of characters that specifies the glucose; % - model: a structure that contains general parameters of the % physiological ...
223efe6501d01067d452b27d903962f7ea6be30f48ee8babbc6bda114332b72a
MATLAB
4,453
207
function [SignificantVariables, clusters,clustersize,StatMapPermPV] = permutation_cluster_1sample_alld(data, nperm, cluster_th, significance_th,tail,StatMapPermPV) % function [SignificantVariables, clusters,clustersize,StatMapPermPV] = permutation_cluster_1sample_alld(data, nperm, cluster_th, significance_th,tail,S...
e52ca24f6a58114797aaf3669b24b400fff9f99521e8cc35464ec8175e1ba5e7
MATLAB
4,453
164
function hdr = load_analyze_hdr(hdrfile) % hdr = load_analyze_hdr(hdrfile) % % hdrfile is the header file (eg, f001.hdr) or a basename (eg, f001). % % hdr.dime.dim(1) = number dims % hdr.dime.dim(2) = number of items in first dim % hdr.dime.dim(3) = number of items in second dim % ... % % hdr.dime.datatype: % 0 unk...
99f69d792f784882666b75ab5074c2a4926bfc3e6e303766f0c66c94bb7588fa
MATLAB
4,456
92
function input_graph = fun_graph_relabel(input_graph) % fun_graph_relabel computes the labels for the links and nodes, update all % graph structure after graph pruning. % Input: % input_graph: structure created by fun_skeleton_to_graph. Required % field: % num.skeleton_voxel need to be updated. % ...
f912754397c0263937da80ac88aa4dda2b03be30064523b81869b67ddcca8ec5
MATLAB
4,458
97
folder='/projectnb2/npbssmic/ns/Ann_NC/'; datapath=strcat(folder,'dist_corrected/'); % add subfunctions for the script. Change directory if not running on BU SCC addpath('/projectnb/npbssmic/s/Matlab_code/fitting_code'); addpath('/projectnb/npbssmic/s/Matlab_code/PostProcessing'); addpath('/projectnb/npbssmic/s/Matlab_...
828549f93ce25834725a71672053086d255bf46c8377410ee6e9fa7948402bb4
MATLAB
4,459
129
% initialize Psychtoolbox AssertOpenGL; PsychDefaultSetup(2); if IsOctave page_screen_output(0) end % INITIALIZE SCREEN % ================= screenNumber = max(Screen('Screens')); % Open a window for display if isunix && strcmp(getenv('USER'), 'meyniel') % for my Linux HP [w_px, h_px] = Screen('WindowSize',...
d97051364fe118675c3553d433763930a3a31d0f46e25221677732ecaa601867
MATLAB
4,460
213
%% - PLOT FIGURES - %% % This script plots all figures found in the manuscript "Ramping dynamics and theta oscillations % reflect dissociable signatures during rule-guided human behavior". % All necessary data can be found within the subfolder "source_data". % Data exceptions % % Fig. 1a: This figure is an illustr...
beb110d3004e21964e4e1556134ba7294ff6f59bc87e67ddb4dc0abbae754837
MATLAB
4,464
100
function [outSegments,outActualWidth,outActualInterval] = IPEMGenerateFrameBasedSegments(varargin) % Usage: % [outSegments,outActualWidth,outActualInterval] = ... % IPEMGenerateFrameBasedSegments(inSignalOrDuration,inSampleFreq,... % inFrameWidth,inFrameInterval,... % ...
1b818a8d9a643645c5f37939d0d64f56d32a590d697a630604dcfcf5bb0302f9
MATLAB
4,465
112
function [] = send2ClientPanel(varargin) % function [] = send2ClientPanel(varargin) % % Use this function to send information from an experimental setup to a % network computer. Remote computer uses a clientPanel object to monitor % the incoming data. Refer to clientPanel documentation for a description % of the data ...
32b7c6489ef9262aca6a9ec544c7b7406ad0c9f58e193ce907d16e856a022dd8
MATLAB
4,465
161
function [b, d, f, z, mm] = compute_rf_spsp_mgh(kp,rfp,gz,kz,kf) %function [b, d, f, z, mm] = compute_rf_spsp_mgh(kp,rfp,gz,kz,kf) %Function that computes the complex-valued SPSP RF pulse waveform, %using parameters specified in structure rfp. %Inputs: %kp: k-space trajectory parameter structure, generated by kparamet...
e3244593e87fa46a51fd69eab148ed05c24fce7710265901638584178ccb32be
MATLAB
4,465
96
function [] = BackGroundSubtraction() addpath([pwd '\matlab']); addpath([pwd '\util']); clear s=dir('Videos/*video.ufmf'); filelist={s.name}; for i = 1:length(filelist) filename = filelist{i}; [readframe,frames,~,headerinfo] = get_readframe_fcn(filename); % create background newvidname = ['Videos/...
02d6ff026de9365fa597baa022dd45f5304ae21ff1ef5f48ae6d4537d300ea66
MATLAB
4,467
118
function [] = plotTime2FirstStateTransition(f_orco,plotFig) % calculate smoothed change in firing rate dF = f_orco.calcDeltaFR;%gradient(f_orco.spk); dF(:,end-1:end) = repmat(dF(:,end-2),1,2); thresh =50; crossingtype = 'exit'; [~,transitionProb_exit,transProbRand_exit,rast_exit,~] = getExitTrajectory(f_orco,crossingt...
9de9183b45f6a604546a3e75e2a6ecf8f0d520bf26fba2077e01c45ef7ebe4be
MATLAB
4,467
160
function [C,B,phi,varargout] = ir_circ_zeroed_reg_3d(order, maskR, sparseR) %function [C,B,phi,varargout] = ir_circ_zeroed_reg_3d(order, maskR, sparseR) % Input: order - order of regularizer % maskR - [nx,ny] - mask of regularizer (changes C,B,and phiR) % sparseR - binary flag for a sparse output (varargout) instead...
d0df7a23868184bf7a8d0506de16db8eb440515b2165d3abc443f83ed12f028c
MATLAB
4,467
152
function weights = inspect_map_weights_update(allimg,currentweights,Fcomp,Kalpha,gradechoinv,options) % % Weight update step for inspect continuous mapping version. % Given canonical spectra, estimates voxelwise spectral weightings. % INPUTS: % % allimg - image data in voxelwise form, typically output from % inspect...
a159ac22d86b17c17be1a73c61c9c1b54d0b260d93dda9a775f875d2d6e055f8
MATLAB
4,468
152
function Train_Batch(k,Coding,DealyTime) setGlobalOpts() global Opts alpha = Opts.alpha; beta = Opts.beta; gamma = Opts.gamma; C_M1 = Opts.C_M1; C_V = Opts.C_V; C_S1 = Opts.C_S1; C_EBA = Opts.C_EBA; C_TPJ = Opts.C_TPJ; C_AI = Opts.C_AI; N = size(Coding,2); MoveNum = Opts.MoveNum; Time = Opts.Time; Con...