sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
72dbd12f520898d722a893f0148da3f3021d99dd0a9c78fc0863d85034d74b01
MATLAB
3,408
84
function [Y,Y1] = VSH_spherical_integral(L,M,A) % L is the L value of the matrix % M is the M value of the matrix % A is the side of the cubic ROI - in metres if isempty(L) L = [8 8]; end if isempty(M) M = [5 5]; end if isempty(A) A = 0.1; end useV = 0; useX = 1; %%%%%%%%%%%%%%% TEST FOR ORTHONO...
19ee6b5d4a86b6472d0d15c5d9a7b35e62b984e1f645d0cf7743a4111813a523
MATLAB
3,409
119
DataPath = '.\Data\Neuro\'; OutPath = '.\Data\Neuro\'; %% Generate and collect KSDs load([DataPath,'AMDSpks_Sal.mat'],'SpkT_all','cids_all','cpos_all','Mouse_all','SortedStim'); % == KSD parameters === minT = -0.2; maxT = 2.2; tStep = 0.5e-3; bws = [1e-3,2e-3,5e-3,10e-3,25e-3,100e-3]; % bws = [10e-3]; tic fprin...
9eaaef3f66725dde8d71abd422764fbb9cf44c08135a775c1b47ef618cc35c6a
MATLAB
3,410
121
clear [task_info,supPath,MaestroPath] = ... loadDBAndSpecifyDataPaths('Vermis'); load('sessionMap.mat') K_FOLD = 10; DIRECTIONS = 0:45:315; req_params.grade = 7; req_params.cell_type = {'PC ss','PC cs', 'CRB','SNR', 'BG msn'}; req_params.task = 'pursuit_8_dir_75and25|saccade_8_dir_75and25'; req_params.num_trials ...
e0be0c4955e40bfeccff0d271882f74e7c4a0afe5d188b6b7873a9ecb6594413
MATLAB
3,413
109
% first stim mark is start of cue % second stim mark is start of movie % third stim mark is start of question % fourth stim mark is end of question function plotGrpHistISI(sbjList) ISI = []; for i = 1:length(sbjList) sbjNum = sbjList{i}; rawDataDir = ['C:\Users\mn0mn\Documents\ResearchProjects\spatailAt...
b17f6b40cfd30a3d1e0c00e1bf9126ed42b707641cbf94251cee5497649e0b18
MATLAB
3,414
112
function [scratchpad] = train_logreg(trainpats,traintargs,in_args,cv_args) % Uses logistic regression with regularization to predict your regressors % % [SCRATCHPAD] = TRAIN_RIDGE(TRAINPATS,TRAINTARGS,IN_ARGS,CV_ARGS) % % Logistic regression, but penalises small weights (like weight % regularization in backprop), so i...
1d6cf63192cca8b4abdf486a77178d2337714a18471eee264c6cc3c83d1148f5
MATLAB
3,416
124
% Architecture based on de Taillez, for stimulus reconstruction % Since we're using EEG along with audio waveform, trim EEG segments to % only active audio part. % Extract envelope part of audio and downsample to same fs rate as EEG. whichCond = 1; sbjNum = 'pk39'; numClasses = 3; nFolds = 5; audioDir = 'C:\Users\mn0...
27ed108086d15e1650a5ef831ef6c6eb359c87ae438c4fc6bbec335d5e25deb7
MATLAB
3,417
86
% output = transres_SVM_pattern(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 primal pr...
e96fa20305f8b03bb16457e26f427139d85a11379dd21eb029a5464269b27843
MATLAB
3,419
126
function SetAxesSDGCh(handles, eventdata) global maingui if ~exist('eventdata','var') eventdata = []; end hAxesSDG = handles.axesSDG; iCh = maingui.axesSDG.iCh; iSrcDet = maingui.axesSDG.iSrcDet; SD = maingui.dataTree.currElem.GetSDG('2D'); nDataBlks = maingui.dataTree.currElem.GetDataBlocksNum(); ml...
e98139a4a0b7dc8a44a11f28a8e4b551b90b08523ec305eb2effcf7b4559a1a4
MATLAB
3,420
103
function Process_ConvertBasler2Pos(fbasename,varargin) syncDatFile = [fbasename '_digitalin.dat']; syncSampFq = 20000; syncChan = 1; syncNbCh = 1; posSampFq = 60; %in Hz % Parse options for i = 1:2:length(varargin), if ~isa(varargin{i},'char'), error(['Parameter ' num2str(i+3) ' is not a property (typ...
2ace6a88bc22c224aff0eeea1f85ded453c8fcdafb50828f47f947caabb23b94
MATLAB
3,425
115
function [subj] = statmap_xcorr(subj,data_patname,regsname,selname,new_map_patname,extra_arg) % Creates statmap using cross correlation % % [SUBJ] = STATMAP_XCORR(SUBJ,DATA_PATNAME,REGSNAME,SELNAME,NEW_MAP_PATNAME,EXTRA_ARG) % % Creates a pattern containing every voxel for a single timepoint, % where the value of ...
711906f3b23d9aa3cd9b6598a88e390fb600e3e4a6ac2610f23e9315f1533174
MATLAB
3,426
92
function model = pp_slicetime(sub_id, p) % function model = pp_slicetime(sub_id, p) % % Runs SPM slice time correction on realigned fMRI images. % % Input: % - i_sub: ID of the current subject. % - p: Structure with analysis parameters. % % Output: % - model: Structure with all SPM settings used for this preproc...
92b46cf5f5fe1f33ad85982a8612b5c92a585fd6cc1a14dd71dd11566c5ac7ed
MATLAB
3,426
96
function behav = msExtractBehavoir(behav, trackLength) %MSEXTRACTBEHAVOIR Summary of this function goes here % Detailed explanation goes here ROI = uint16([behav.ROI(1) behav.ROI(1)+behav.ROI(3) behav.ROI(2) behav.ROI(2)+behav.ROI(4)]); %% Removes background % takes the median of each pixel from 100 frames spread...
873c638205d57ba492e6cb3e65072e66140bd4a4e4e2176e0eef972a55f26c50
MATLAB
3,427
132
function fig = plot_transients_fragments(step1, step2) i1 = step2.i1; i2 = step2.i2; D = step2.D; x = step2.x; zscored = step2.transients_PETA.zscored_matrix; baseline_period_start_msec = step2.baseline_period_start_msec; baseline_period_stop_msec = step2.baseline_period_stop_msec; evt_ts = step2.evt_ts; %% rename v...
556fd45f68ad4549a4adf069c6c667f5197c4aebad21881b3f155658ed39b7b7
MATLAB
3,429
127
% MY_XCORR3 3 signal cross correlation by cross bispectrum. % % compute the cross correlation between 3 stationary signals % % (1) Rxyz(m,n) = E[ x(k)y(k+m)z(k+m+n) ] % % for the 3 signals case, the extension of WK theorem is % % (2) Sxyz( wk, wl ) = sum sum Rxyz( m,n ) * exp( -j*wk*m ) * ex...
8327f2047448053c93204077ef81ff66b516ab9ded1837a8b74cfd0be6906a4f
MATLAB
3,430
82
%This analysis code was used in: %Mares I, Ewing L, Papasavva E, Ducrocq E, Smith FW, Smith MLS (in press). %Face recognition ability is manifest in early dynamic decoding of face-orientation %selectivity – evidence from multi-variate pattern analysis of the neural %response. Cortex. %The code was originally cre...
63623b7c72bcc342dedc92dff77a857586c63970a7e4cb5b7b33bfd5763320ba
MATLAB
3,435
83
function y=fDataROIset(targetpath,savepath,name_sub,name_epi,TR,TE,FA) %% Set CSF ROI on target slices (4th ventricle) for cnt=1:length(name_sub) cd(targetpath); cd(name_sub(cnt).name); epitemp = dir(['*' name_epi '*.nii*']); func = niftiread(epitemp(1).name); if length(epitemp)>2 && size...
4a586334ee839bec8081c18c1a86fd8eef0bf2dc04ffac16d7ad84e9a9ebfb23
MATLAB
3,436
91
function model = pp_normalize_func(sub_id, p) % function model = pp_normalize_func(sub_id, p) % % Runs SPM normalization on fMRI images that has been realigned and % slice-time corrected (prefix 'ar'). Uses the deformation fields that were % calculated with pp_segment.m. % % Input: % - i_sub: ID of the current subje...
93479ee759c51ffe98cbb86435dc23daa22eb4e02e589317719c391f8a845bab
MATLAB
3,437
84
function [hdr,vol] = mom_read_minc1_matlab(file_name,opt) % Read a MINC1 file in Matlab % To learn more about the MINC format : % http://en.wikibooks.org/wiki/MINC % % SYNTAX: % [HDR,VOL] = MOM_READ_MINC1_MATLAB(FILE_NAME) % % INPUTS: % FILE_NAME (string) the name of a minc file % % OUTPUTS: % HDR (structure) the...
ead3b43ab8b231b95ccd36081daee8967ded5e7a2f6df0c7c4efc3f33daac308
MATLAB
3,438
76
function [uMF,uMD,uInt,AUCs,dPrime,mice,HR,NTrl] = calcDPrimeFromLatency(RespLatTable,minRespDelay,maxRespDelay,respWin) % CALCHRDPRIME calculates dPrime, hit rates for AM sounds % Outputs unique values of the three stimulus parameters % uMF (modulation frequency) % uMD (modulation depth) % uInt (i...
f52b7f7359725b3aa4ce5d0f566b8696d96e89c3c0b1ce5bc92514fe99be50f8
MATLAB
3,439
95
run("/home/nmsutton/Dropbox/CompNeuro/gmu/research/sim_project/code/gc_can/scripts/initOAT.m"); addpath /comp_neuro/Software/Github/CMBHOME_github/ load("example_data/example_spk_x.mat") load("example_data/example_spk_y.mat") spikes = []; display_plot=0; save_plot=1; grid_size=30; shuffles=1000; binside = 3; std_smooth...
296d2f9a8747af78f44d8f885339ea0adabbabb00b4ff9375b38ef55f011bec1
MATLAB
3,441
141
function [err,ErrMessage, NameList] = zglobb (Identifiers, Opt) % % [err, ErrMessage, List] = zglobb (Identifiers, [Opt]) % %Purpose: % returns the list of files specified in Identifiers % % %Input Parameters: % Identifiers is a cellstr identifying which briks to use % Identifiers = {'ADzst2r*ir.alnd2AA...
24f5c68910a4770790f76152e47d68dab30210c74915714daa7d14feaa5349f7
MATLAB
3,443
116
function [d, c] = estimate_displacement(im1, im2, kernelsizes1, ... kernelsizes2, model, method, d0) % [D, C] = ESTIMATE_DISPLACEMENT(IM1, IM2, KERNELSIZES1, KERNELSIZES2, ... % MODEL, METHOD, D0) % % Estimate displacement according to the algorithms described in chapter 7 % of Gunna...
3aa8551b091bbe2fd40fe837d8edb47912f90a75ce3a3a55154b2fdbb565cba7
MATLAB
3,443
125
function output = model_postCAT(x,data) % Likelihood function for Q-learning on experiment postCAT v.3 with % parameters (1)learning rate, (2)inverse temperature, (3) % perseveration (4)start bias and (5)assignment rate % % USAGE: lik = model_postCAT(x,data) % % INPUTS: % x - parameters: % x(1) - learning rate...
198793f2906be75c18f303af8756f24fb76782c084d1c409fd49ac2e72d3cc73
MATLAB
3,445
119
function [subj] = create_sorted_mask(subj,map_patin,new_maskname,nkeep,varargin) % Create a boolean mask including only the top OR bottom NKEEP voxels % % SUBJ = CREATE_SORTED_MASK(SUBJ,MAP_PATIN,NEW_MASKNAME,NKEEP,...) % % Adds the following objects: % - mask object OR mask group (if PATGROUP == true) % % Takes the M...
fbb7d47f14383014a75ac78fe009a98b71fa45cb6cae096563d78bc08ff026bb
MATLAB
3,446
150
% mins = LocalMinima(x, NotCloserThan, LessThan) % % finds positions of all local minima in input array % in the case that it goes down, stays level, then goes up, % the function finds the earliest point of equality % % second optional argument gives minimum distance between % two minima - if 2 are closer than this, it...
d09c021d131936b1e56fc208ff14eadecefe002b4fc6ba5e82af32c8c23e80cf
MATLAB
3,448
96
%% Prepare data tables for R % Script to process file structure output from pairSyanpses.m to % make datatables ready for R and further analysis for % "Differential nanoscale organization of excitatory synapses onto excitatory vs. inhibitory neurons" % Poorna A Dharmasri, Aaron D Levy, Thomas A Blanpied, PNAS 2024 ...
d16af23f3ff6a5b4c5e70655208f1e184eb25b6d0c3731436bf4194d1384b73c
MATLAB
3,455
125
function this = qc(this) %QC qc an ACTI object % % $Author: Peng Li % $Date: Feb 07, 2022 % len = length(this.Data); qcMessage = ""; %% 1: consistant off-wrist during nighttime % time restrition mask between 21:00 and 7:00 [~, ind] = doMask2(len, this.Epoch, this.TimeInfo.StartDate, ... '21:00', ...
e1517844cd4872ce1f6c520e0a10a6963e4a8d0dcf31851e6ab5551cfcdd21ad
MATLAB
3,457
113
%DEMSOM1 Demonstrate SOM for visualisation. % % Description % This script demonstrates the use of a SOM with a two-dimensional % grid to map onto data in two-dimensional space. Both on-line and % batch training algorithms are shown. % % See also % SOM, SOMPAK, SOMTRAIN % % Copyright (c) Ian T Nabney (1996-2001) ...
f3d5d21dadb9668ff1edcef64f77650fe2aa48a4292d9d99643250a88c15d3a0
MATLAB
3,457
94
load('choice_vs_madc_RFTrials.mat') %% plot Choice Theory results cols = [[0 0.7 0.7];[1 0 0];[0.2 0 0.8];[0.2 0 0.8]]; f_cols = [[1 1 1];[1 1 1];[0.2 0 0.8];[1 1 1]]; % individual sessions choice theory cnt = 0; for iSess = [4:15 18 20:24] cnt = cnt +1 ; sens_choice_indiv.G(cnt,1:2) = theta_est_ch...
8b9ce6dca99e3554b0e4923c6052178836d670f1fb9f756e48b4aca8e738bb69
MATLAB
3,458
132
%% Comparison in time clear [task_info,supPath,MaestroPath] = ... loadDBAndSpecifyDataPaths('Vermis'); req_params.grade = 7; req_params.cell_type = {'PC ss', 'CRB','SNR', 'BG msn'}; req_params.remove_question_marks = 1; req_params.remove_repeats = false; epoch = 'cue'; req_params.num_trials = 120; req_params.t...
df154966e41648450b73ccda06554e20174573f763bd4ead1236ce0a417c395e
MATLAB
3,459
106
DataPathNeuro = '.\Data\Neuro\'; DataPathPCA = '.\Data\PCA_SIM\'; OutPath = '.\Data\PCA_SIM\'; addpath(genpath('.\functions\')) %% ########### MODEL ########### KSD_trl = matfile([DataPathNeuro,'AMKSDs_individual_Sal.mat']); % per-trial KSDs load([DataPathPCA,'PCAResTable_Sal.mat'],'PCARes') %% Estimate threshold cr...
fa31845a40968cb5cb1db28d90cc11c19536356060319cc5fe0397a23eb22a8c
MATLAB
3,463
93
%Code to generate T2 maps for a 140x100x9X15 MRI scan %This is done using method 3 where apply the ROI mask on the T2 scan and average the T2 values for %a given ROI and perform only one curve fit for the averaged values for each ROI %throughout this code, cx1,cy1,cz1,ck1 are the 4 counters for looping through the ...
2248f174582b73e54156b2264c384859ba861f2eb0c90e113f89a379e2154250
MATLAB
3,464
94
% shuffle local features function % October 26 2022 % Amirhossein Farzmahdi function [imgs_shuffled,fc6_unit_shuffeled_views_percents] = shuffle_feature(nview,n_repeat,n_shuffle,img_size,bckg,images,pixels,net,layer,unit) for i_view = 1:nview % insertion image img_ = images{i_view}; % shuffle...
0a8fb5c2438c9a42e8cd20042a046603cea7afd91bb130d61fb2808057363f89
MATLAB
3,467
132
% Compute border score as in Solstad 2008 (works with square matrix) % % USAGE % % Compute_BorderScore(pf,bx,by,<options>) % % pf place field (#by x #bx) % bx x-axis bins % by y-axis bins % <options> optional list of property-value pairs (see table below) % % ...
626641bbab13841991db6844faa89f2b641be930a747e1dcb9be1db2f8303e89
MATLAB
3,467
70
clear s=1; while ~isequal(s,0) fn = 1; GC=[]; c=1; %counter oldFolder=pwd; %records your active folder prompt = 'How long is your experiment(in frames)?'; exp_length = input(prompt); %input of how many frames of the dff files do you want to grab disp('select folder containing analysis files,...
214d0b0f9cf7c50515288adc6c5f4176e1cf654ea574e1beaf72333596eb1551
MATLAB
3,469
94
% function sim = pattern_similarity_fast(x,method,param) % % This function calculates pattern similarity for the desired similarity % metric (e.g. 'pearson' for pearson correlation or 'cov' for covariance). % This function is slightly faster than the more general version % pattern_similarity, because it assumes th...
8ab4d112bcf5f640204ae43165527ef992a9328d5c24d800209c47726871d8a8
MATLAB
3,469
67
% load all analyzed ccstep files and create analysis overviews for % inspection load('D:\Human inhibition\Cell classification\AllenClusterMethod\superclusterdata.mat') files={SuperCellSummary.File}; files=ChangeFilenameExts(files, 'mat'); users={SuperCellSummary.UserID}; for i=1:numel(files) fprintf('Open file %1....
08091ef9bd3d0a5d0f63521caabd445cfc8e7d6ae286b29365f8ddd5bd5b2820
MATLAB
3,474
81
function [Y, X, incrementalCertainty] = ... estimate_displacement_based_upon_vector_summation2d(solution,... filterDirection,... sizeImage,... numberOfFilterDirections,... dk,ck,... t11,t22,t12) % ESTIMATE_DISPLACEMENT_BASED_UPON_VECTOR_SUMMATION2D Estimates a displacement field based upon vecto...
ae74baafea7df040c6da7e4ffa28664a29e465054ec63c300ae854ea1903ed34
MATLAB
3,474
114
% function [res,run_number] = residuals_from_spm(SPM,masks,Y) % % Function to extract residuals from an SPM.mat in case they have not been % returned by SPM. You don't need SPM for that function to work. % However, AR(1) is not carried out! % INPUT: % SPM: Full path of SPM.mat containing relevant information t...
0dff37d329845b1da8ecb64e7f990e369275c81bc9ad1492afec6d19d65e71ec
MATLAB
3,480
119
function [d, c] = one_frame_motion(im, kernelsizes1, kernelsizes2, ... model, method, d0) % [D, C] = ESTIMATE_DISPLACEMENT(IM, KERNELSIZES1, KERNELSIZES2, ... % MODEL, METHOD, D0) % % Estimate displacement from a single interlaced frame according to the % algorithm described in sec...
22dd6a4a95f9d8e6e0034b0a86d28422647e3297a2636e29ccbd813e2354403a
MATLAB
3,480
119
function [perfmet] = perfmet_lda(acts,targs,scratchpad,varargin) % % function [perfmet] = perfmet_lda(acts,targs,scratchpad,varargin) % % The LDA classifier is considered to guess correctly if its % active row (the unit that it guessed) corresponds to the active % row of the targs (the unit that was desired) using cl...
22de6e223376b9cba1ba9b14dc6d9c51064aea2324825c3e470d0e29fa7e96e3
MATLAB
3,484
91
function [binCounts, NMI, xbin_ISI,b, keep_time ] = get_spike_delay_hist_210712(down_channel, up_channel, if_flip, if_hist, length_rec_sec) %creates ISI histogram between ISI of cw_channel and ccw_channel %Changed from 0.1 to 0.2 1/21/21 min_difference = 0.1; %ms ,ie, velocity = 2 m/s max_difference = 1; %ms ,ie, velo...
9bf845c13550ff9937971bd5e4c7314b7719287e059e5ad057bc8d1e833e8469
MATLAB
3,486
177
function [c, n2] = nancov(x, varargin) % [C] = NANCOV(X, NORMALIZEFLAG, DIM) computes the covariance, across all cells in x along % the dimension dim, accounting for NaNs % [C] = NANCOV(X, Y, NORMALIZEFLAG, DIM) computes the covariance between all cells in x and y % % X (and Y) should be linear cell-array(s) ...
0ce8a00574b8863103149403adcf7156c6887839d33f9d258d1a5fec2012d609
MATLAB
3,494
97
Condition_Name = cond_labels; Channels = cluster_labels; %% Load all data for sub = 1:length(subject_list) subject = subject_list{sub}; load([TFR_Data subject, '_tf_data_' int2str(1)]) % initialize matrices on 1st subject if sub == 1 tf_all_PT_Can = zeros([size(tf_data_1) l...
4988a3055769d25441ac7d16eee30c7605a7bd687d51f602abc0db33fcc86888
MATLAB
3,494
112
function new_data = feature_space_smoothing(data, labels, fwhm) % function new_data = feature_space_smoothing(data, labels, fwhm) % % Moves over a continuous feature-space and computes the average of the % signal of neighboring features, where neighboring features are weighted % using a Gaussian kernel. % % Input: %...
411f53de14f3a303c740e3f767c01d1b86505deae8838a8b216368b07a2f1db1
MATLAB
3,495
75
% function model = libsvm_train(labels_train,data_train,cfg) % % Wrapper function to use libsvm for classification/regression. % To speed up cross-validation, classification using a precomputed kernel % is possible. For classification, using a kernel could be implemented, but % has not been done yet. % % General...
f1c71f57ff8a07eda9df6da6ed9f4b50b8254c260cdb4685c415d5b25b315bc4
MATLAB
3,497
114
function [net, gamma, logev] = evidence(net, x, t, num) %EVIDENCE Re-estimate hyperparameters using evidence approximation. % % Description % [NET] = EVIDENCE(NET, X, T) re-estimates the hyperparameters ALPHA % and BETA by applying Bayesian re-estimation formulae for NUM % iterations. The hyperparameter ALPHA can be a ...
284c3501e6eeca24c3d48f34f4db44eb07cc38836844d37ab84bc20e97d93a19
MATLAB
3,500
76
function [ks_D, n_obs_tail, ks_stat] = computeKSStatPowerLaw(x_i, a_val, x_min, x_max_vals) % Computes the KS statistic (maximum absolute difference between % cumulative density function) for model and observations % ks_D is eqn 3.9 from Clauset: this is the KS statistic for x > x_min ONLY % max_n_possible = s...
dc047f7fd116324c1a1ada77ba61f415fc5c12897a4654fde327b5b82de880ba
MATLAB
3,503
135
function BEH_analysis_regression(exp_name) %load raw data load(sprintf('BEHdata-%s.mat',exp_name),'BEHdata') %load summary data load(sprintf('BEHsummary-%s.mat',exp_name),'BEHsummary') %% Regression: calculate regression and plot behavior wincrit = [40 60]; [fig1,mdl,ds] = calcswitch(exp_name,BEHdata,1,1,1,wincrit);...
30ec32007963f1d96e60eb11d8e08937ac47efe06a50a0240cf1d051a3a40c6a
MATLAB
3,505
152
function A = truc(A) % Find Upstate % Adapted from Muckovski, Cerebral Cortex, 2007 % Adrien Peyrache 2007 A = getResource(A,'PfcTrace'); A = getResource(A,'Sleep1DeltaEpoch'); A = getResource(A,'Sleep1SpindleEpoch'); A = getResource(A,'Sleep2DeltaEpoch'); A = getResource(A,'Sleep2SpindleEpoch'); A = getResource(A,...
6f27b81f21e7996f47cdd9671fcc3613bb6a1eb029872367c322ae3ffcec0f82
MATLAB
3,507
143
clear all; clc; mdir=pwd; cd('../Data') load AccuracyDATA.mat load BaseDATA.mat cd(mdir); %% Compare learning index of conjunction learning experiments (1,4) 1)Construct Mat for ftr_id=1:3 % ftr_id=1; % ori % ftr_id=2; % color % ftr_id=3; % joint Base=BaseDATA(:,ftr_id); DfCnd{1}=[1:6...
5254a1dc1cecf317c5144d1f91d285ab029480248b54da3c93f21f2933b1cf9e
MATLAB
3,513
127
%% Plot PC activity during VORD and cancellation function [fH_vord, fH_canc, P_gain_vor, P_gain_canc] =... plotVorCanc(I, K1, K2, K0, flag_gain_up) % Makes one complete figure for VORD, and one figure for VORC % One for gain up, and one for gain down %% Plotting parameters label_font = 6; lw = 1.5; fig_pos = [20...
84956fad631b548cc5561271f891c6e24c68dbf628c4119bff4ddce758807fab
MATLAB
3,513
108
clear all close all clc %% Group histogram data % Define an output folder - the folder which contains all of the % "exportFolders" outputFolder = ['D:\Google Drive\Optical Flow Analysis of Actin Waves\Output\HL60\']; % Include any folder or file names that should NOT be included in the data % grouping badNameList = ...
211e624859cfcbb3abcbb188d2c3306fa6fd727e166a9d1c0e366852f55dce00
MATLAB
3,515
92
n = size(Y,2); p = size(Y,1); s = nStates; ldim = size(Xm{1},1)-1; for subj = 1:nSubjs Gammas{subj} = QnsCell{subj}'; end for tt=1:s parfor ns=1:nSubjs XmState{ns}(:,:) = preprocess(Xm{tt}(2:end,n*(ns-1)/nSubjs+1:(n*ns/nSubjs))); end Ybar = data_arrange(XmState); if sum(sum(an...
3c892be22e977d1329457d1f088bed3a1bf2eeb4c63851aecfa949badde4b45f
MATLAB
3,517
134
% figure S3: mirror symmetric viewpoint tuning index for pool5 and fc6 % layers % last update: October 27 2022 % Amirhossein Farzmahdi clear close all clc % add path addpath(genpath('functions')) images_dir = 'mat_files/'; % load data load(images_dir+"imgs") load(images_dir+"bw_masks") % settings nexemplar = 25; nv...
9ff16f6a900fb525d5050674a6cf65fab56278050f10c5831116c88a7abaa665
MATLAB
3,518
124
function [centres, options, post, errlog] = kmeans(centres, data, options) %KMEANS Trains a k means cluster model. % % Description % CENTRES = KMEANS(CENTRES, DATA, OPTIONS) uses the batch K-means % algorithm to set the centres of a cluster model. The matrix DATA % represents the data which is being clustered, with ea...
923626473d62b2a4c7a184eb0425b12b3f9f72466d64b3f191469b68b654b384
MATLAB
3,520
102
function PlotDistributionRoseplotsOverTime(histExportFolder, filePrefix, distOption, dataBinWidth, showBinWidth, numSmoothedFrames, HistogramTimeData) %% Assign values rawCounts = HistogramTimeData.RawCounts; thrCounts = HistogramTimeData.ThreshCounts; relCounts = HistogramTimeData.RelCountsWeighted; magCounts = Histog...
4a50343db2ae426b6b4322b751b9b78815e6d6e4123a90b1a970936bd1b150c8
MATLAB
3,521
108
function [subj results] = tutorial_easy() % Tutorial script to accompany TUTORIAL_EASY.HTM % % [SUBJ RESULTS] = TUTORIAL_EASY() % % This is the sample script for the Haxby et al. (Science, 2001) 8- % categories study. See the accompanying TUTORIAL_EASY.HTM, the % MVPA manual (MANUAL.HTM) and then TUTORIAL_HARD.HTM. %...
113a593ec77553d9218f2ad758e2bb22ecbe78443db34494a6ab816064df78a9
MATLAB
3,522
109
% STATUS: Inactive(?) % % SYNTAX: % performanceLDA = calcCumSum_DiffStartT_SingleChn_NoSave(sbjNum,... % trialsTr,trialsTst,movieListTrain,movieListTest,numClasses,mlActAuto) % % DESCRIPTION: % Perform cross Validation where SS beta coefficients from training fold % is passed to test fold. Perform single-channel...
5c02e59da548286771694675e9fbdf29fb24cae4585051d50441414dca007ff8
MATLAB
3,522
138
function statDist = permVarFrac(response,match,statistic_func, varargin) permDims = size(match,2); p = inputParser; defaultPlot = false; defaultBootNum = 1000; defaultVarNames = string(1:permDims); defaultVarNames = {'total',defaultVarNames{:}}; defaultTimes = 1:size(response,2); addOptional(p,'plotCell',defaultPl...
78845c8e728a7f28084ba6afc42fcaf75c2bb423aabf0f857979f1dd988f80b9
MATLAB
3,526
78
if ~exist('index_to_run', 'var'), error('index_to_run needs to be specified'); end if ~exist('state', 'var'), state = rng(1, 'twister'); end % state of random number generator if ~exist('ndip', 'var'), ndip = 200; end % number of active dipoles if ~exist('snr', 'var'), snr = 0.5; en...
4f1aaad3d7ba794aa6a100a473821b7363c56f298103c6bf24561aa9daa0126b
MATLAB
3,536
104
function PlotDistributionHistogramsOverTime(histExportFolder, filePrefix, distOption, dataBinWidth, showBinWidth, numSmoothedFrames, HistogramTimeData) %% Assign values rawCounts = HistogramTimeData.RawCounts; thrCounts = HistogramTimeData.ThreshCounts; relCounts = HistogramTimeData.RelCountsWeighted; magCounts = Histo...
a7fa0a52087c43fcceae34c6907ee63203b791eb843e91ba336b98339ea36a27
MATLAB
3,537
135
%% Pursuit task clear [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); PROBABILITIES = [25,75]; OUTCOMES =[0,1]; figure req_params = reqParamsEffectSize("both"); % req_params.cell_type = {'PC cs'}; req_params.ID = 4153; lines = findLinesInDB (task_info, req_params); cells = findPathsToCells (supPath,...
2fcf7affe0335f1a82c0543aa2ebe5c50ad7c0ef806eeb32f8ee2a1bce3eebd7
MATLAB
3,539
121
function [subj] = hpfilter_runs(subj,patname,selname,cutoff,tr,varargin) % Uses spm_filter.m to high-pass filter the time series of each voxel % in each run % Adds the following objects: - pattern object % % This function creates a new patterns object (PATNAME + '_hp') to store % the filtered timeseries. % % ...
3d93559869b11942b345edee8522c1dab2af524d6fd9733134431b2691cd734d
MATLAB
3,546
97
function this = emd(this) %EMD Perform EMD analysis on an ACTI object % % $Author: Peng Li % $Date: Mar 09, 2022 % $Modif.: Mar 24, 2026 % Revise to enable per cycle output % Jul 06, 2026 % Add nadir output after LI_UPMEMD_CYCLE. Currently put nadir % t...
aedb73659a6aef950225b5deb4e16a77f061e513ac61bc0d893e02e1ae62ec0b
MATLAB
3,551
95
% to be run after preprocessFNIRS06_FInteraction_MultiOnly.m function plot_FInteraction(s,numClasses,fefOnlyOp,saveOp) fs = 50; timeLen = [0.1 0.2 0.5 1 1.5 2 3 4 5].*fs; nrept = 10; kFold = 5; sbjNum = s.name; processedDataDir = ['C:\Users\mn0mn\Documents\ResearchProjects\spatailAttentionProject\ProcessedDatafNIR...
d677ce447fb54a2afaead08b55d463a0290567e754225a7b6177bd7f07d7ad47
MATLAB
3,551
93
function pp_partition_rp_files(sub_id, p) % function pp_partition_rp_files(sub_id, p) % % Takes the rp*.txt files containing the realignment-parameters estimated % with pp_realign.m for each experimental session, and saves them for each % individual run. This is necessary to include them as regressors of no % interest...
348a9c38fc424a872142caee01c5112d935bf604ea1f2efeef9c9e6d26563894
MATLAB
3,556
122
function err = hdf5write_safe(fname, name, val, options) err = -1; if isempty(val) return; end if ~exist('options','var') options = ''; end force_scalar = false; force_array = false; if any(strcmp(options, 'array')) force_array = true; elseif any(str...
c82c5e025f142dd9a7990b2194dd2876a281aac76133d4de4ba7b39b654a7c79
MATLAB
3,557
97
%This script scans an OCT image of a target or flat surface for analysis %% Inputs % IMPORTANT: % Before running this script make sure target is at focus % What are we imaging switch(1) case 1 %Imaging a flat surface target but placing it on motorized stage so %we can take multiple imag...
950833f8e557e10dfb7c61e943d0c59f899b637fd0d370b7e485ac781380fc20
MATLAB
3,558
101
close all clearvars clc %get user input selpath=uigetdir('*.*','select MINFLUX directory for a single construct') %find result files files=dir(fullfile(selpath,'**','*reeval.xls')); %define model for fitting fitmodel=@(p,x)[p(3).*( exp(-x./p(2))./p(2) .* (x./(p(2)-p(1)) - (1-exp(-x.*(p(2)-p(1))./(p(1)*p(2...
c0d49faea7ced46504d8e7587af95a90fa79d41d78346d2c9642bf05a311342a
MATLAB
3,559
121
function h = plot(this, varargin) %PLOT plot an ACTI object % % $Author: Peng Li % $Date: Dec 02, 2020 % $Modif.: Dec 08, 2025 % Add Diary section. % Remove Nap as essentially it should be included in Sleep % Feb 15, 2026 % Enable showing primary sleep ...
90756fe8daa7a9be189e12b78d4f84e839f444cd3e1a88b698090562f7b300e4
MATLAB
3,561
133
function FindHDCells(varargin) % This function computes some Head Direction cell statistics % Must be launched from the folder containing data % Folder must have the same name as position file basename. % Adrien Peyrache 2012 epIx = []; if ~isempty(varargin) epIx = varargin{1}; end if length(varargin)==2 fn...
d4459131fdf9a067563ad5558213f7f7e50f034d670722b4e03400b94c72a7f0
MATLAB
3,562
98
function spots=bd3d_t_local_filtered(wholestack_local,sizes_local,thresholds_local,sigmas_local,zsizes_local,max_spotnum) % volume LOG filtering filtersize=[sizes_local sizes_local zsizes_local]; h=-fspecial3('log',filtersize,sigmas_local); % this can be taken out of the function If=imfilter(wholestack_local,h,'sym...
2b890b795606ec775fca1b65afd538cc4d2bd53247cf63cbd838f15a05bdf496
MATLAB
3,572
121
function this = fit(this) % FIT Fit a cosinor object based on LSE % % This can be done through minimizing the residual squared error % to solve normal equations -- RSS's first order derivatives w.r.t. each % parameter are zero % notation in Ref. [1] (check COSINOR) % y = M + Acos(w...
c8994d5db91a764ea14b2dae5816b81bf027daccf1b245ade6a15842583ab1a4
MATLAB
3,572
108
function [hit_rate,false_alarm_rate,p_val] = ... plot_psychometrics(sessions, beh_dat) % Initialize variables % cTab = cell(1,length(sessions)); % p_val = zeros(length(sessions_looped),num_of_iters); % hit_rate = cell(1,2); % false_alarm_rate = cell(1,2); RF=1; % RF = 0...
369b42a73003db9c6deac12034cfa061c96924691a0b08ffd497682d0f25c8ce
MATLAB
3,575
127
function [br_min, br_mid, br_max, num_evals] = minbrack(f, a, b, fa, ... varargin) %MINBRACK Bracket a minimum of a function of one variable. % % Description % BRMIN, BRMID, BRMAX, NUMEVALS] = MINBRACK(F, A, B, FA) finds a % bracket of three points around a local minimum of F. The function F % must have a one di...
fdf056612ca3cb659fae7722ce631f7d2ab1e2d77004113b797f79d52638b099
MATLAB
3,577
102
function onsets = lvl1_extract_onsets(run_log, experiment, analysis) % function onsets = lvl1_extract_onsets(run_log, experiment, analysis) % % Extract onset times of trial events for SPM first-level analysis. % % Input: % - run_log: Struct with one index per run. log.runNumber is adjusted so % that it counts ...
2f8fad94c51547d4e23453ba08ce066a8a88e3d62286ae4673e8c1c07c85a18e
MATLAB
3,579
97
function scanInfoAdvance(subjectPath) % This function advances scan info to the latest version written for LD % Written at March 25, 2020. if ~exist('subjectPath','var') subjectPath = s3SubjectPath('02','LD'); end isLoadConfigFromLog = true; %% Set paths volumeJsonPath_Operational = [subjectPath '/OCT...
e195b4814a9d15c93ae109bf9b380344e18d5b90915f9d6561e92907e7db76c5
MATLAB
3,579
129
% TEMPMATCH template matching for time series % % [ c, t, p ] = tempmatch( w, x, th ) % % w template (must be a vector) % x time series (can be matrix, works on columns) % th {0.9i} threshold: p-value (real) or corr (imag) % % c correlation coefficient % t decision (1/0: m...
83b75b0b14f7bd1bc50586165aefd17f56445305be791429855ca5cc0da8b752
MATLAB
3,580
119
function [subj] = detrend_runs(subj,patname,selname,varargin) % [SUBJ] = DETREND_RUNS(SUBJ,PATNAME,SELNAME,...) % % For each voxel in each run, detrend_runs removes trends % according to the order of the specified polynomial % i.e. 1 = linear, 2 = linear + quadratic, ... % % Adds the following objects: % - ...
d2942bbb093b47ebacf001036b679db4faa0b49fed949f32617a2a8b8390396c
MATLAB
3,581
90
function mv_print_classification_info(cfg, X, clabel, X2, clabel2) % Prints information regarding the classification procedure, including the % cross-validation procedure and the dimensions of the input data. This % function is called by mv_crossvalidate, mv_classify_across_time, and % mv_classify_timextime. % % Usage:...
f20e621a4157eca532758c45590efc818ed8fadae05c74dcde14c200d07fa9f0
MATLAB
3,588
106
function [interferogram, apodization,prof] = yOCTLoadInterfFromFile_ThorlabsSRRData(varargin) %Interface implementation of yOCTLoadInterfFromFile. See help yOCTLoadInterfFromFile %Reads SRR files % OUTPUTS: % - interferogram - interferogram data, apodization corrected. % Dimensions order (lambda,x,y,AScan...
31c9431f14a5596e58165ded8c0fb9acd46296b309bdc5ecff8f272277473fdd
MATLAB
3,589
124
function awsCopyFile_MW2(dest) %See awsCopyFile_MW1 for documentation %Will go over all folders in dest to get files out! %% Input check if awsIsAWSPath(dest) awsSetCredentials(1); %We need CLI end dest = awsModifyPathForCompetability(dest); %% Get all the files that need loving try ds = fileDatas...
e3177319058281c3c81420e569120fbdba75741f756509299b522d5dc3b8ff96
MATLAB
3,591
98
%% plot Choice Theory results cols = [[0 0.7 0.7];[1 0 0];[0.2 0 0.8];[0.2 0 0.8]]; f_cols = [[1 1 1];[1 1 1];[0.2 0 0.8];[1 1 1]]; % individual sessions choice theory cnt = 0; for iSess = [4:15 18 20:24] cnt = cnt +1 ; sens_choice_indiv.G(cnt,1:2) = theta_est_choice_indiv.G(iSess,1:2); sens_choi...
ac9747b6f292d590c8cf6f4bc239bd1ee2a3558cad66174b9c1d1f7b1f0415d5
MATLAB
3,592
107
function ret = aqua_export( options ) % AQUA_EXPORT Extract and save AQuA events from a dataset % ret = AQUA_EXPORT(options) % % Available keyword options: % * 'inputPath': Path to the folder with input aqua data % * 'outputPath': Path to the folder to place results % * 'experiment': Presets for uncaging sta...
fdad75d95604d222784ab54f8b4172943b34da372cf58d3edfa1882a4d9cd83a
MATLAB
3,595
71
function LinePlot_SummaryStat_IndData(mat2plot, TS, TITLE, condition, YLIMS, YLABEL, SUMMARY, stdOrsem, COLOR) %LinePlot_SummaryStat_IndData: % 1. Takes a matrix of values % 2. Plots each row of the matrix as a grey line plot (repeated measures as columns, ex: multiple imaging rounds) % 3. Plots a summary statist...
1d6053d3bfe6ceef3ee87c9e930644b4054b2b748728808af1ef30c22272d4be
MATLAB
3,601
94
function status = unitTest_DefaultProcStream(datafmt, dirname) global procStreamStyle global testidx global logger if isempty(procStreamStyle) procStreamStyle = datafmt; end if isempty(testidx) testidx=0; end testidx=testidx+1; status = -1; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
85623123099cf3ff266f4f59b81aa047be811dad9f10e8ba35a941659dfbeb7b
MATLAB
3,602
96
clear all; load matching_table_ccw.mat % loading order of raw data folders=["ECDGCA3CA1 19914 160127 160217 d21 5minspont000_mat_files",... "ECDGCA3CA1 19914 160127 160303 d37 5minspont000_mat_files",... "ECDGCA3CA1 19908 150729 150823 d25 5minspont000_mat_files",... "ECDGCA3CA1 24088 160127 160302 d36 5mi...
778348cfa74113fe22c9ccb1cf3dc27890f232d1a9f403a8aac72798ce202933
MATLAB
3,608
113
function [P, F, stats] = anova1_mvpa(mat,conds,sels,chunksize) % Performs a 1 way between-subjects anova % % [P F STATS] = ANOVA1_MVPA(MAT,CONDS,SELS,CHUNKSIZE) %% Performs a 1 way between-subjects ANOVA on a matrix MAT. Condition % membership is contained within CONDS, which must be a boolean matrix of % size [M, N]...
8c525fe84ec466a9adf81fe7d2419d9c3b4777056fac51b9369ef9c181c65408
MATLAB
3,609
113
function [X,clabel,Y] = simulate_spiral_data(nsamples, nrevolutions, nclasses, prop, scale, do_plot) % Creates spiral-shaped data in two dimensions. % Useful for testing non-linear classifiers eg SVM with RBF kernel. % % Usage: [X,clabel,Y,M] = simulate_spiral_data(nsamples, nrevolutions, nclasses, prop, scale, do_plo...
fcde01296b57330561366225b986760a00085bb6286991378a52b12ad2b95161
MATLAB
3,610
176
function O = intervalSet(varargin) % Constructor for intervalSet objects % % USAGE: % O = intervalSet(s, e, fixit, PropertyName, PropertyValue, ....) % % INPUTS: % if no inputs, return a null intervalSet object % s, e - vectors containing start and stop times for intervals % % 'PropertyName', Pr...
95a441e51306afd65a79944b3258627a7f73d284b4778bd6713a902825452e23
MATLAB
3,611
119
% function table = display_design(cfg) % or % function table = display_design(cfg.design) % % Displays the design matrices (train, test & label) in a nice(r) form. % % For a graphical representation, see plot_design.m % % See also PLOT_DESIGN % Potential improvements % % - Multiple blocks for long designs (e.g. afte...
5ea4640d1616e5374c11fee9360d5d82a6a7f2fa5043a576dbeaf939d484cd40
MATLAB
3,612
128
clear; % INT549:thr=7 prompt={'tau','threshold_scaling'}; answer=inputdlg(prompt); % set to folder with tiffs root = 'D:\McCormick_Data_May27_2021-\2021\Jun\4004_210610_E266_meso_am_1\2P'; file='4004_210610_E266_0_00012_00001.tif'; fs = dir(fullfile(root,file )); fname = fs(1).name; fname = fullfile(root, fn...
a6b43dbc898e143c86b7e4d5827d62f126cc5e0291240528e47cc23707d1dd86
MATLAB
3,618
175
function [c] = cellnancov(x, varargin) % [C] = CELLNANCOV(X, NORMALIZEFLAG, DIM) computes the covariance, across all cells in x along % the dimension dim, accounting for NaNs % [C] = CELLNANCOV(X, Y, NORMALIZEFLAG, DIM) computes the covariance between all cells in x and y % % X (and Y) should be linear cell-a...
d599c63eaa1424aebed2838eb69120485a5d294f03770092d8343c61513d1a28
MATLAB
3,621
98
function test_suite = test_file_utils %#ok<*STOUT> try % assignment of 'localfunctions' is necessary in Matlab >= 2016 test_functions = localfunctions(); %#ok<*NASGU> catch % no problem; early Matlab versions can use initTestSuite fine end initTestSuite; end function test_file_utils_basic() %% test to g...
f344b073d727b1c76bdda7468257b2f895949e067cebab005653d4e469b6cd93
MATLAB
3,621
107
function sortImagesTrainTest(baseFolder,trainSetSubjects) % This function sorts images to train & test folders % train_A, test_A contains OCT, _B contains histology. % baseFolder - main folder to sort % filesInTestingSet - cell array containing template of files to be % included in test set, all the rest wil...
dd177ebca753f3d1a97e9338e206a3b85cd5b3eaa417fb817d6b3d239a39221d
MATLAB
3,623
100
clear all; load matching_table_ccw.mat % loading order of raw data folders=["ECDGCA3CA1 19914 160127 160217 d21 5minspont000_mat_files",... "ECDGCA3CA1 19914 160127 160303 d37 5minspont000_mat_files",... "ECDGCA3CA1 19908 150729 150823 d25 5minspont000_mat_files",... "ECDGCA3CA1 24088 160127 160302 d36 5minspont0...
6d935f330d61694ffcc6bb051ffb213d3789ac59f16e22b9bd6fe202f2db838b
MATLAB
3,626
92
% This function tests knobes to and from transform %% Basic tests % 2 microns per pixel, no rotation, no shrinkage, x translation of 10 microns T = knobesToTransform(0,0,10,0,2,1); assert(all([0 0 1]*T==[10 0 1]),'Baseline translation'); assert(all([1 0 1]*T==[12 0 1]),'1 pixel translation x'); assert(all([0 ...
81e1acbd1b7529f1cba8873fa040bfbf02af212e218d372447c43eb5b7e6df97
MATLAB
3,628
114
function json = s3LoadAllSubjectSectionJSONs(varargin) % This function loads all JSONs to one structure for us to reference % json = s3LoadAllSubjectSectionJSONs(subjectPath [, sectionName, parameters ...) % INPUTS: % - subjectPath - path to subject. % - sectionName - example: 'Slide01_Section02'. If empty, ...
4ab1059098fbf30a3558def31232b2cab14484ce556b768c90d529497abf0ecb
MATLAB
3,637
99
function compute_NMI_210726(folder_name, parent_dir, if_cw) %Computes Normalized Matching Index matrix(NMI) for all output of wave_clus %tunnel pairs in the folder indicated by folder_name % %Normalized Matching Index(NMI) is used to indentify which using in %tunnel-1 corresponds to unit in tunnel-2 to form an axon, w...