sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
fc4f6f0d1f3f538bbbc2ed55f9faafb595cb95d675f2d92bca111c9e981f0d47
MATLAB
1,229
38
function [pat_idx] = convert_mask_coords_to_pat_idx(mask,coords) % [PAT_IDX] = CONVERT_MASK_COORDS_TO_PAT_IDX(MASK,COORDS) % % MASK = X x Y x Z boolean matrix, i.e. a normal mask matrix % % COORDS (optional) = nVox x 3 matrix of x,y,z % coordinates. By default, assumes you want all the active % voxels in the mask. Oth...
5cae01dc9bdccf3e6d35338bf852d0eb2af66760701ac978dc304c47085f4631
MATLAB
1,231
42
% read in a sample image -- also see letters.png, bagel.png img = imread('mushroom.png'); figure;imshow(img); % the standard skeletonization: figure;imshow(bwmorph(img,'skel',inf)); % the new method: figure;imshow(bwmorph(skeleton(img)>35,'skel',Inf)); testE= skeleton(skel); testfigE = bwmorph(testE>35,...
1cf674526950a504b1fba08263674cb499b99666bcec02373917e920ba5f9e27
MATLAB
1,232
37
function [subj] = add_created(subj,objtype,objname,new_creat) % Makes it easier to add the object-creation data easier % % [SUBJ] = ADD_CREATED(SUBJ,OBJTYPE,OBJNAME,NEW_CREAT) % % Basically, you can feed it an entire NEW_CREAT structure, and % it will add any fields that didn't already exist, overwrite any % that did,...
8adb677c17f4153e7dab59683b80847a34103285e56d9a35cbefc8fbc22b93af
MATLAB
1,233
37
% Y = spharm(theta,phi,l,m) % % Orthonormal spherical harmonic function (Arfken, p. 681) for quantum % numbers l and m. Angles theta and phi should be given in radians. % function Y = spharm(theta,phi,l,m) % Copyright (c) 2016, Elekta Oy % --------------------------------------- % % Redistribution and use of the Soft...
8d94986bb82ee247da481d7bd1aa38cd5deb0aa4a0f53171ff1db0113ebf4adf
MATLAB
1,233
37
% A simple demo of the NetworkMonitor functionality % add Offline Analysis Toolbox to path initOAT; % init NetworkMonitor NM = NetworkMonitor('../results/sim_gc can.dat'); % plot network activity disp('NetworkMonitor.plot') disp('-------------------') disp('Press ''p'' to pause.') disp('Press ''q'' to qu...
ba9207ff4362e66864065e1542a714eb55d85ae4ccf7d8c78ddece3dbe5a4442
MATLAB
1,234
46
%% Plot V4 MI Fano factor d' and bias split at cued and cue-opposite locations (histogram) %% Code loc = ["cued","opp"]; loc_flag = input('neural data at cued location or cue-opposite location: 1-cued, 2-opp: '); % loc_flag = 1 for SI Fig 6G % cue epoch win_start = 500; win_end = 2500; win_str = num2str(win_start)+"...
82d27bf9b11407d28fdc821c07959cfeebe2c78c20aaa05a241bf30c66330ff9
MATLAB
1,235
22
function model = liblinear_train(labels_train,data_train,cfg) if isstruct(data_train), error('This method requires training vectors in data_train directly. Probably a kernel was passed method is use. This method does not support kernel methods'), end switch lower(cfg.decoding.method) case 'classification' ...
ebb00a20ca4c1977aae74b62bbd92f49596c66bf40f018a7c3b4b07d4424f581
MATLAB
1,236
60
function data = Concatenate(transformer, data) % % Concatenate columns together. % % % Arguments: % % :param Input: **mandatory**. Column(s) to concatenate. Must all be of the same length. % :type Input: array % % :param Output: Optional. Name of the output column. % :type Output: char % % ...
d0549ce146d5a8c499b812ecf183b6b126bd5e4bc725ab3936f465ba3c7a24f4
MATLAB
1,237
48
function [h2,Bt,Bs] = HeadDirectionField_Speed(tsa1,ang,GoodRanges,varargin) % USAGE % [h,d,mu,p,kappa] = HeadDirectionField(tsa,ang,GoodRanges) % % Inputs: % tsa: a ts object (typically a cell!) % ang: a tsd object of head orientation % GoodRanges: an intervalSet object defining the time of va...
0df44f4c1d4149e2ccb9cfcd60e9deb2bed4a988c4f6a59fae9753e5969c172c
MATLAB
1,238
51
function [h X Y] = hist2(Data, XBins, YBins) % out = hist2(Data, XBins, YBins) % % Makess a 2d histogram of the data. % XBins and YBins are optional arguments % which give the number of grid segments. % - default is 50. if length(XBins) == 1 MinX = min(Data(:,1)); MaxX = max(Data(:,1)); else MinX = XBins(1...
bc322814f88080e736375e919ce29c8518e56c345f82c98a6ba01349c91e71c5
MATLAB
1,238
33
function a_MLE = powerLawMLEClauset(x_i, x_min) % returns the MLE of a power law exponent for the observations x_i, % restricted to observations larger than x_min. If x_min is empty, % estimates x_min using the Clauset methods % x_i are assumed to be DISCRETE % UPDATE 1/18/22: uses a look-up table (as a global variabl...
c6a740033a11e4dfda2ab900356a49f617b25d56eecf7e68f952d29ac2606c51
MATLAB
1,238
45
function bar_GOenrich(data,Y_label,title_label,top_num,output_name) figure; % J = customcolormap(linspace(0,1,10), {'#cf1619','#d87323','#e8b52c','#f9fc35','#4fa019','#85fb27','#6a70b1','#422450','#430e32','#000000'}); % colormap(J) J = colormap; [ranked_b ind]= sort(data.b,'ascend'); h=barh(ranked_b(1:top_num),'LineW...
4cc935882208094d1a3221cb0d93887b3704db5679104811678dcacb0134a69b
MATLAB
1,239
57
ndim = size(Y, 2); % ndim = 3; %% x = SimpleCSRio; ev_s = nan(ndim, 1); for i = 1:ndim y = Y(:, i); ev_s(i) = corr(x, y).^2; end x = SimpleTemporalRio; ev_t = nan(ndim, 1); for i = 1:ndim y = Y(:, i); ev_t(i) = corr(x, y).^2; end %% % close all figure; subplot(1, 2, 1); hold on ...
c5691f8704ea346f9620d3691660e8bc5c773c3af30a8d957f8793d4fd295a67
MATLAB
1,239
42
function [ output ] = shear3DinDim2(inArray, angle, bReverse, dz, xypixelsize, trans, fillVal) %shear3DinDim2 -- deskew inArray about the 1st dimension (y in image terms) %x in sheet-scan terms) % inArray -- input 3D array % angle -- skewing angle % bReverse -- is skewing in reverse direction ? (like in Bi-C...
ebe63cb14c85777e02430774e82bc91ab419d51657133b373d9ea0cae9a8ad49
MATLAB
1,240
38
function trans = headcoordinates_mne(nas, lpa, rpa) % Returns the homogenous coordinate transformation matrix % that converts the specified fiducials in any coordinate system (e.g. MRI) % into the rotated and translated headccordinate system. % % M1 = headcoordinates(nas, lpa, rpa) % % The headcoordinate system in Elek...
f1aa30f1d2f5da869b9069d6ba37fc341376d711eaae4361421f182a3479ee2e
MATLAB
1,240
27
classdef dfaPlot < actigraphy properties (Access = public) dfaAxis dfaShallowAxis end %% construction and deletion methods (Access = public) function app = dfaPlot(varargin) app@actigraphy(varargin{:}); % change position ...
f831194a2e3634fa3ce61fe662728a5eeeb2b1edd6d97de7e3feee908fece006
MATLAB
1,240
52
function C = corrcoefLocal(q,T,varargin) % This function computes correlation coefficient getting rid of the global % fluctuation. Inspired by Renart et al., Science, 2010 % Input: % q: matrix of binned spike trains % T: smoothing window. The spk trains will be convolved with a mexican % hat of T positive wid...
0e9885f6a602f5a678a036b46bb17e590dc808d9008bb2c411b4e1918e213fcf
MATLAB
1,241
39
function [SpatialInfo] = spatial_information(binActivity,neuronSL_inlap) %SPATIAL_INFORMATION ´Ë´¦ÏÔʾÓйش˺¯ÊýµÄÕªÒª % Default neuronSL_inlap is extracted from binActivity if nargin ==1 && isstruct(binActivity) neuronSL_inlap = binActivity.neuronSL_inlap; end [n, nbin, lapNum] = size(binActi...
3523963691ff8d189ae2d8ddb49863b66f236f507712b6eb8bfb66ae71159492
MATLAB
1,241
76
clear all N = 10000; %total N1 = 4000:1:5000; N2 = N-N1; K = 1:1:1000; snr_ratio = nan(length(N1),length(K)); for i = 1:length(N1) x(i) = N1(i)/N; for j = 1:length(K) % s = ALPHA*((N1(i)-N2(i))/(N1(i)+N2(i)))^2; % n = (1-ALPHA)*(1/K(j)); snr_ratio(i,j) = K(j)*((N1(i)-N2(i))^2/(N1(i)...
cdd0d09cb0d17af39226ee3dea5f0d3f90a5b50ddadac19e30782e12d0584383
MATLAB
1,241
52
function L = CrossValidationSpatialCheck_Cells(S,lambda,X,Y,ep) nbEp = 10; dispBar = 0; binSize = 0.5; %in cms epV = regIntervals(ep,nbEp); L = NaN(nbEp,length(S),length(lambda)); fprintf('Launching Cross-validated spatial info\n') for ii=1:nbEp fprintf('.') ix = (1:nbEp); ix(ii)=[]; testEp = epV{ii...
56872eb161dca2f7ec350773bd924e9a26f17354bed742d51642e1e4960d73d5
MATLAB
1,242
34
function [Traj_down] = DownSample(Traj,down, ChHome) % Downsampling to 6msec per sample. % some trajectories are too short and have only 1 entry after downsampling % these trajectories will be deleted here to allow the next step % (interpolation to 200 points) numTraj = length(Traj); if numTraj == 0 Traj...
69ea22c6c1d1b27b8386fdb61fb0a7409039f469b74bd4ef3003f4072a775f46
MATLAB
1,242
59
function [cellMod,cellPh] = OscillationPhase_Ripples(lfp,S,ep) % [thetaMod,thetaPh,thetaTrghs,thetaPks] = ThetaPhase(fbasename,channel,ep) % optional: % [thetaMod,thetaPh,thetaTrghs,thetaPks] = ThetaPhase(fbasename,channel,ep,folder) % to indicate another folder where the lfp file is located % % Adrien Peyrache, 2013...
8d642809bd6e4a04a2c58d1f12d5cc38f93d83bd32fe67181fa0120e1fdc7aec
MATLAB
1,244
43
function beh_corr_scatter_NKI(x,y,Xlabel1,Xlabel2,Xlabel3,Ylabel,pic_title,output_path) dotcolor = [231 223 202]./255; linecolor = [182/255 180/255 194/255]; shadecolor = [154/255 154/255 154/255]; [xData, yData] = prepareCurveData(x, y); ft = fittype( 'poly1' ); opts = fitoptions( ft ); opts.Lower = [-Inf -Inf]; op...
8994979379874365993004161571fe931f148ce8534013fddba0d0c9a2685ef7
MATLAB
1,245
40
function niiFiles = select_nii_func(cfg, subject, runs, prefix, doMergeRuns) %SELECT_NII Select functional EPI images of several runs % Detailed explanation goes here if doMergeRuns %% Merge Runs i_index = 1; for i_run = 1:length(runs) c_run = runs(i_run); ...
655f6bb25abf5f3220dc905173963b3cba771b0a94a2a1c150400bb041e1d0f0
MATLAB
1,246
50
function [theta_est, data_fit, eta, b] = choice_theory_dcest_pos(pobs) % Luce's choice theory analysis to estimate d'(eta) and c(b) % for comparison with mADC predictions % % last row/col taken to be nogo/nostim response, all biases rel to this % Sridhar Devarajan, Jan 2013 p = pobs'; % such that stim in col a...
17edbadc193993fb86868dda37a875224f76bbe79ceaddfafcc637ba95e7e675
MATLAB
1,247
32
% number of different conditions numCond = 6; % number of source-detector channels numChn = 42; % HbO, HbR, HbT numConc = 3; sizeOneCond = numChn*numConc; procDataDir = 'C:\Users\mn0mn\Documents\ResearchProjects\spatailAttentionProject\ProcessedDatafNIRS\Experiment08'; homer3GroupDir = 'C:\Users\mn0mn\Documents\Resear...
a31ebbfe8ee742ac04b65fc480466b7a9f0a5e119424fd33f22880510e0e04d0
MATLAB
1,248
41
addpath('src') T = readtable('raw/E-GEOD-46903.sdrf.txt'); sourceName = strrep(T.SourceName, ' 1', ''); cellType = T.Comment_Sample_description_; time = T.FactorValue_TIME_; stimulation = T.FactorValue_ACTIVATIONSTIMULI_; stimulation = strrep(stimulation, ' 100U/ml', ''); stimulation = strrep(stimulation, ' 800 u/ml...
5f3f0fbb09c040018570e6f3d91aaf6abf1132f56968678e6e6002ea3f1140a3
MATLAB
1,249
60
function [l,d,perm] = mchol(A,mu) % [l,d,perm] = mchol(A,mu) % Compute the Gill-Murray modified LDL factorization of A, if nargin < 2 mu = 1e-12; end n = size(A,1); l = eye(n); d = zeros(n,1); perm = 1:n; for i = 1:n c(i,i) = A(i,i); end % Compute modification parameters gamma = max(abs(diag(A))); xi = max(...
aae3ce76613320eb2ce4b11a293977ce4b3aa9fc177d150b24a41f5d80205ce5
MATLAB
1,249
38
function EV = expVar(r_w,r_pre,r_post) % ========================================================================= % expVar % ========================================================================= % % USAGE: EV = expVar(r_w,r_pre,r_post) % % DESCRIPTION: Computes explained var...
2853b9db9c3244c1e52cd6e606245c5e20d3e81567a4e9195a591a493e66674d
MATLAB
1,252
38
function post_scan = post_scan_load(p) % function post_scan = post_scan_load(p) % % Load data of the post scan questionnaires, including the VVIQ, the OSIQ % and a strategy questionnaire. % % Output: % - post_scan: Table of questionnaire data. % % Simon Weber, sweber@bccn-berlin.de, 2021 post_scan = []; post_scan_...
4cba5765e419e2e28b79a008940c1e3ffbe30a6fc911af8cac6610e05679ea3c
MATLAB
1,252
53
function [x] = compress(x) % Recursively converts datatypes to save memory. % % [X] = COMPRESS(X); % % Compress converts numeric matrices to single precision and binary % numeric matrices to logical matrices. Runs recursively on cell % arrays and all fields of structures. % License: %==================================...
3eb4b15af617b3440b30460be1457c3bcc16a5c32bc5cb903c2443fd2d9c86a5
MATLAB
1,255
53
function L = CrossValidationGLM_Cells(Q,Pred,ep) nbEp = 10; dispBar = 0; binSize = 0.5; %in cms epV = regIntervals(ep,nbEp); L = NaN(nbEp,length(S),length(lambda)); fprintf('Launching Cross-validated spatial info\n') for ii=1:nbEp fprintf('.') ix = (1:nbEp); ix(ii)=[]; testEp = epV{ii}; training...
ae4789bce4dff1b2fb58cef2783d0ad2ea7dea54ea45003fb3e2a4bd50e897c0
MATLAB
1,255
46
%% Plot V4 MI Firing Rate d' and bias split at cued and cue-opposite locations (histogram) %% Code loc = ["cued","opp"]; loc_flag = 2;%input('neural data at cued location or cue-opposite location: 1-cued, 2-opp: '); % loc_flag = 1 for Fig 2D, loc_flag = 2 for Fig 3B % cue epoch win_start = 500; win_end = 2500; win_st...
18e0284116f06ee19740b15aa5a981cf29051e46b1f9897d7839a7b08d415f79
MATLAB
1,256
35
function pipeline_svm_state_at_cue_decoding() cfg = load('/projects/crunchie/moehring/neurovar_v2/BIDS/code/neurovar_cfg.mat').cfg; for i_sub = 1:44 fprintf(strcat('Decoding Sub_', string(i_sub),'\n')); pipeline_dir = fullfile(cfg.global.deriv_dir, 'pipeline_svm_state_at_cue_1st',...
22f6ad685c661f7c2d1f6351dc79dcd7977d30739aa95602794cae7a98724727
MATLAB
1,256
35
function [z] = sandwichMx2(x, y) % z = sandwichMx2(x, y) % compute x*y*x' provided y = hermitian % and dimensionality is 2x2xN, x should be Mx2xN %FIXME build in check for hermitianity z = complex(zeros(size(x,1),size(x,1),size(x,3))); xconj = conj(x); xabs2 = abs(x).^2; for k = 1:size(x,1) z(k,k,:,:) = xabs2(...
9f72ec7ba87fb9bbc21067dd086283d9b602daa41db887a209b1d30cc194f65d
MATLAB
1,256
46
%% Plot V4 MI Firing Rate d' and bias split at cued and cue-opposite locations (histogram) %% Code loc = ["cued","opp"]; loc_flag = 1;% input('neural data at cued location or cue-opposite location: 1-cued, 2-opp: '); % loc_flag = 1 for Fig 2D, loc_flag = 2 for Fig 3B % cue epoch win_start = 500; win_end = 2500; win_s...
bd6aa76d6b7f4c822419bf6efe1a4e8d6abcc2a46884525885e4c84b55ae6c21
MATLAB
1,256
24
function model = correlation_classifier_train(labels_train,data_train,cfg) if isstruct(data_train), error('This method requires training vectors in data_train directly. Probably a kernel was passed method is use. This method does not support kernel methods'), end switch lower(cfg.decoding.method) case ...
e200bc374fd16eb9d70d3a62968883d4078be6e42ad35b6e7940d69400aa5bae
MATLAB
1,256
46
%% Plot V4 MI Firing Rate d' and bias split at cued and cue-opposite locations (histogram) %% Code loc = ["cued","opp"]; loc_flag = 1;%input('neural data at cued location or cue-opposite location: 1-cued, 2-opp: '); % loc_flag = 1 for Fig 2D, loc_flag = 2 for Fig 3B % cue epoch win_start = 500; win_end = 2500; win_st...
142346df7bda5304b3076c3b74d07b618b57a2d562091a8807a5ea3838e4a98c
MATLAB
1,257
36
function [goodness ondiags_val offdiags_val] = onoff_metric(mat) % [GOODNESS ONDIAGS_VAL OFFDIAGS_VAL] = ONOFF_METRIC(MAT) % % Calculate the OnOff metric, as in pg 12 of the supporting % materials of Polyn et al (2005). Subtracts the mean of the % off-diagonals from the mean of the on-diagonals. % License: %=========...
42159c6d01491e71452546419ff9179678489a839619592b55d96c81ce227c19
MATLAB
1,257
42
% plot average of ss coefficients across all subjects for each channel sbjList = {'12','13','14','15','16','17'}; figSaveDir = ['C:\Users\mn0mn\Documents\ResearchProjects\spatailAttentionProject\ProcessedDatafNIRS\GroupResultAll\Figures']; % hardcoded ssBetaTotal = zeros(49,36,2); ssBetaList = zeros(length(sbjList)...
6da12797cc544742d4e60a88ff6498e823106889f33597305e96d3efc4676c39
MATLAB
1,257
60
function transients = get_transients(t, dff, debug) lowPassTh_Hz= 0.1; highPassTh_Hz= 2; filterType = 'bandpass'; fc = [lowPassTh_Hz highPassTh_Hz]; fs = 1/median(diff(t)); [b,c] = butter(4,fc/(fs/2)); filtered_sig = filtfilt(b, c, dff); two_MAD_th = median(filtered_sig) + (2*mad(filtered_sig)); one_MAD_th = median(...
117a3f389e2f10cf087b89e9ea36127d950133df24a6e4cd25e8a3e96dda3248
MATLAB
1,258
33
function h = plotEnv(ax,env,tt,yOffset,yScale,Color) % h returns handle of the plotting % ax: handle of axis in which to plot % env: 1D vector the (positive) magnitude of the envelope % tt: 1D vector; time axis for env; must be same dimension % yOffset: how much to offset the envelope in y-axis ...
3a6a65455f27a82e944a53e45f5df66cf82c5f7dd09e1a2b873adebdde29b95f
MATLAB
1,258
75
function t = threshold(tsa, thr, varargin) % Threshold crossings % % USAGE: % t = threshold(tsa, OptionName, OptionValue) % % INPUTS: % tsa - a tsd object % thr - a threshold value % % OPTIONS: % 'Crossing' - type of crossing, possible values are: % 'Rising' (default) % 'Falling' % c...
7335d8621ab37b429b0c05b0ad034e6d240b86018faf7526639ae171500f376e
MATLAB
1,259
39
function analyse_mri(p) % Run the preprocessing, modeling and reconstruction of the fMRI data, and % plot the results. % Run preprocessing of fMRI data mri_preprocessing(p); % Create binary Region of Interest (ROI) masks from probability maps in MNI % space create_rois_from_prob_maps(p, 'V1-3'); % Warp ROIs into sub...
c0b5bcfc4c07068fd7f146037f26fea4a945dfb44c72331572147c59588148e4
MATLAB
1,259
40
clear all load('../data/opt.mat') load([opt.intermediate_data_path 'clab_arti.mat']) for pair = 1:length(opt.participant_pair) clear data_pair EEG fprintf('Computing ICA for pair session %d: %s - %s \n',... pair,opt.participant_pair{pair,1},opt.participant_pair{pair,2}) pair_sessio...
bf028af81c0eacb3ba72f29825c4e36659b26d3c7c173b71a8080c7b923d7fbe
MATLAB
1,260
41
%% Plot V4 MI Firing Rate d' and bias split at cued and cue-opposite locations (moving window plots locked to cue onset/offset) %% Code loc = ["cued","opp"]; loc_flag = 1; %('neural data at cued location or cue-opposite location: 1-cued, 2-opp: '); % loc_flag = 1 for Fig 2C, loc_flag = 2 for Fig 3A load('V4_FR.mat')...
9439617efa14dc7085bf75ec97f97eb2c25bd94918274e6291990f3e100f02b6
MATLAB
1,261
48
function awsWriteJSON(json,fp) %This function write a JSON file from AWS or locally %json - configuration file %fp - file path, can be local or in AWS %% Checks if (awsIsAWSPath(fp)) %Load Data from AWS isAWS = true; fpToSave = 'tmp.json'; else isAWS = false; fpToSave = awsModifyPathFor...
24109c1792eaed936b4e130c9b9631fcc61a45062baab84d89c22019fef13d24
MATLAB
1,262
58
function V = saveMRImage(data, filename, mat, descrip) % saves a 3d-matrix to an MR image file, using SPM routines % % V = saveMRImage(data, filename, mat = eye(4), descrip = 'saveMRImage') % % data: image data to be written, 3d matrix % filename: name of the file to write to % mat: transformation...
7398247ca7a48c50153f61a90fe319b9d5c11bb4f1179439a4a0b1e21ea70f79
MATLAB
1,262
47
function [v] = nanvar(x, normalizeflag, dim, flag) % [V] = NANVAR(X, NORMALIZEFLAG, DIM, FLAG) computes the variance, % across all cells in x along the dimension dim, accounting for NaNs. % Normalizeflag = 1 normalizes by N, normalizeflag = [] or 0 normalizes by N-1. % % X should be an linear cell-array of matrices...
d26b044ac4ca0f3278894a22496561a7a2bf668fccc8bda4f43fb0396b708ddb
MATLAB
1,262
32
%% This script specifies the path to the data % Please make sure the folder "Data" from the source data is extracted % directly at the root directory of the github code, so that it contains: % github_dir\Data\ % github_dir\Data\Neuro\ % github_dir\Data\Behavior\ % etc. % and from the code repository: % github_dir\ru...
5b269fd20f17110843a92f8c1c30cd3a994959c8201db9af12044973aec536aa
MATLAB
1,263
61
function [ang,GoodRanges,ep] = HeadDirection_Wrapper(fbasename,varargin) % loads head-direction from a position file file (ending in .whl) % % USAGE % [ang,GoodRanges] = HeadDirectionWhl(fbasename) % % INPUT: % fbasename: session file basename % % OUTPUT % ang: a tsd object of angular values % G...
d8ab9fa07835f389d336cfd8ac977e29d27e2b51947db2e870418d89a0de1188
MATLAB
1,264
45
function data_averaged = moving_average(data, winsize) % function data_av = moving_average(data, winsize) % % Computes moving average across TRs, which serves as temporal smoothing. % % Input: % - data: [n_tr, n_voxel, n_run] array with data. % - winsize: Size of moving average window, i.e. number of subsequent T...
d71fb3e0676c97881902c4dbc647743affd999a979776e09c7fde0d9d8454fa6
MATLAB
1,265
41
%% Plot V4 MI Firing Rate d' and bias split at cued and cue-opposite locations (moving window plots locked to cue onset/offset) %% Code loc = ["cued","opp"]; loc_flag = 2; %input('neural data at cued location or cue-opposite location: 1-cued, 2-opp: '); % loc_flag = 1 for Fig 2C, loc_flag = 2 for Fig 3A load('V4_FR....
99b8932ee4ec11380eda4249024c00bc9338ab8d54d951c10612fa6d43f277fc
MATLAB
1,266
44
function [type_matches_str type_matches_vec] = find_obj(subj,objname) % Auxiliary function % % [TYPE_MATCHES_STR TYPE_MATCHES_VEC] = FIND_OBJ(SUBJ,OBJNAME) % % Zips through the SUBJ structure looking for objects of any type that % match OBJNAME. % % It returns a string with the name of the types that contain an % OBJN...
cc75de2301784538c159f517bd11a87ab7936b0e4dd874f95f056d06e2f86284
MATLAB
1,266
58
% Binary search. % Search 'sval' in sorted vector 'x', returns index of 'sval' in 'x' % % INPUT: % x: vector of numeric values, x should already be sorted in ascending order % (e.g. 2,7,20,...120) % sval: numeric value to be search in x % % OUTPUT: % index: index of sval with respect to x. If sval is not found ...
28d0001ea63ea519506b0ea926111e5946ce77a3f5fd49832bdb7848556fe9f2
MATLAB
1,267
64
clear [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); PLOT_INDIVIDUAL = 0; runningWindow = -300:300; %ms req_params = reqParamsEffectSize("both"); lines = findCspkSspkPairs(task_info,req_params); for ii = 1:length(lines) cells = findPathsToCells (supPath,task_info,[lines(1,ii),lines(2,ii)]); ...
52c7934486a99cbc48585d370ad7a43ec2bfd6a2ece61967bc959efd5a86fe5b
MATLAB
1,267
45
function url = awsGenerateTemporarySharableLink(s3Path ,isUseCash) % This function generates a temprary sharable link to an object in s3 % INPUTS: % - s3Path - s3 object path: 's3://bucketname/...' % - isUseCash, if set to true, and in case this object was already % generated recently, pull it from cash ...
65403b0e88130ac6bdba950b3c0a8de0511715c2a1dcab187f2a1ebea6686d0a
MATLAB
1,267
38
function draw_text(Experiment, whichText, response) % Draw Text % Input: Struct 'Experiment' with fields 'Display', string 'drawText' with % text. % Gets flipped on screen directly. mainPath = Experiment.mainPath; Display = Experiment.Display; Subject = Experiment.Subject; if ~exist('response','var') || isempty(resp...
94654bf1cddd14d77087872bf925ad5e5f512f42c0b6c9e4e8d5ce478991c747
MATLAB
1,268
33
function [xdx, xdy, xdz, ydx, ydy, ydz, zdx, zdy, zdz] = jacobian_matrix3d(vectorField) % JACOBIAND_MATRIX3D Estimates the elements of the jacobian matrix % % function [xdx xdy xdz ydx ydy ydz zdx zdy zdz] = jacobian_matrix3d(vectorField) % % INPUT ARGUMENTS % vectorField - Vectorfield to estimate the Jacobian fo...
17576533ee826eebe60d1ac8e4ab1da40c5c1e77bba44cdb7ec4d603ad4487a7
MATLAB
1,270
29
%% Plots a raster plot of spikes for correlations %% Load prerequisite data clear clc load("D:\Brewer lab data\HFS\Temporal Analysis\40 HFS\dataInfo.mat") load("D:\Brewer lab data\HFS\Temporal Analysis\40 HFS\full_idx_allregion_unit_matched_stim.mat") data_folder_addr="D:\Brewer lab data\HFS\HFS stim\full_index_pseudo...
008441923bec31cfbe06f3c1db8502af5681825059d15b8ca82b195e3e720c0e
MATLAB
1,271
52
function O = realign(tsa, varargin) % Realign timestamps % % USAGE % tso = realign(tsa, OptionName, OptionValue) % % INPUTS: % O: a tsd object % % OUTPUTS: % O: the realigned tsd % % OPTIONS: % 'ZeroFirst' - if set to non-zero, the timestamp will be realigned so % that the first t...
5bf07618f3287fedb4f54398097f126fe1dd2dbf1ceb57bb80fc93c436b58c0b
MATLAB
1,271
40
function layer = softmaxLayer( nameValueArgs ) % softmaxLayer Softmax layer % % layer = softmaxLayer() creates a softmax layer. This layer is % useful for classification problems. % % layer = softmaxLayer('PARAM1', VAL1) specifies optional parameter % name/value pairs for creating the layer: % % ...
e80bc089beb1da7be53e524619cedaeb639f91d0a05d3480d26c7986e053d3a3
MATLAB
1,273
76
function O = diff(varargin) % Computes the set difference of intervalSet's % % USAGE: % O = diff(O1, O2) % % INPUTS: % O1, O2 - intervalSet objects % % OUTPUTS: % O - intervalSet object corresponding to O1 - O2 % copyright (c) 2004 Francesco P. Battaglia % This software is released under the GNU...
ed9bd73e64b89b55b98299281058b2a8ac68806de91af88c9e1d30432e89d20a
MATLAB
1,273
37
function varargout = arrayloop(varargin) % ARRAYLOOP Implicit loop over some of the array dimensions. % % Example: % [x, dx] = arrayloop(2, a, b, 'lscov', v); % % is equivalent to, but differently implemented than, % % for i = 1:size(a, 1) % for j = 1:size(a, 2) % [x(i, j, :) dx(i, j, :)] = ... % lscov(squeez...
14efa8f443974fb17098f9a33d357f12a0b5d0cf49db5aa907fbcf09b6d0587e
MATLAB
1,274
33
function [sfe] = spatialfilter(V,x,y,dscale) % - V: voltage in indexes for spatial filtering (electrodes) % for simplicity, just have one timepoint rn % - x, y: x and y coordinates of these data % - dscale: scale of the distance value % https://www.frontiersin.org/articles/10.3389/fneur.2019.00325/full % • Fo...
3df56165e7469e31024baa6d5ec9d8704cf4b1e60584b4d4cc4554a4d5786f17
MATLAB
1,274
33
function black=BlackIndex(windowPtrOrScreenNumber) % color=BlackIndex(windowPtrOrScreenNumber) % Returns the CLUT index to produce black at the current screen depth, % assuming a standard color lookup table for that depth. E.g. % black=BlackIndex(w); % Screen(w,'FillRect',black); % % See WhiteIndex. % % When the scre...
70c458c2eaf5540c796b4609666b1ce7cb0485a600a8eaae6638c404241e124b
MATLAB
1,275
49
function [e, edata, eprior] = errbayes(net, edata) %ERRBAYES Evaluate Bayesian error function for network. % % Description % E = ERRBAYES(NET, EDATA) takes a network data structure NET together % the data contribution to the error for a set of inputs and targets. % It returns the regularised error using any zero mean ...
07aa6628e0e229ee7a5f252aaaba70faa0150534c928489f2f29fa772f1ae1e1
MATLAB
1,276
68
function Errors = TestSelf; % Errors = tsd/TestSelf; adrlib; Errors = {}; t = 1:10; xd = reshape(1:60, 10, 2, 3); x = tsd(t, xd); % Data if Data(x) ~= xd Errors = [Errors, {'Data(x) failed.'}]; end if reshape(Data(x, [5 6]), 1,12) ~= [5 6 15 16 25 26 35 36 45 46 55 56] Errors = [Errors, {'Data(x, []) failed....
2714573df4d02acd80c0e07bacc145bd265c1d10b77a592078e535036ece857a
MATLAB
1,277
49
function [subj] = set_type(subj,objtype,objcell) % Replace the entire cell array of this objtype with a new one % % [SUBJ] = SET_TYPE(SUBJ,OBJTYPE,OBJCELL) % % Recommended for internal use only % % See the discussion in the manual about memory efficiency for why % this isn't an incredibly costly way to do things % Li...
86b41af28960e0c93c125502fa9a768025085154c2f1a224d5aec4a6d179a8ff
MATLAB
1,277
59
function t = thresholdHysteresis(tsa, thr1, thr2, varargin) % Hysteresis thresholding % % USAGE: % t = thresholdHysteresis(tsd, thr1, thr2, varargin) % % returns the crossings of thr2 that are associated to crossing of thr1 % % INPUTS: % tsa - a tsd object % thr1 - the "high threshold" % th...
02fb8ecc3baa1d022c73a3720e2a061b82707190805cc9738346110fad12d0e0
MATLAB
1,279
41
%% Plot V4 MI Firing Rate d' and bias split at cued and cue-opposite locations (moving window plots locked to cue onset/offset) %% Code loc = ["cued","opp"]; loc_flag = 1; %('neural data at cued location or cue-opposite location: 1-cued, 2-opp: '); % loc_flag = 1 for Fig 2C, loc_flag = 2 for Fig 3A load('V4_FR_input...
77e750698c9f469cfc2315d5ee61a453759c8715368ea48da4d092cf0952753a
MATLAB
1,279
48
clear clc %% mat_idx = 7; t1_idx = 2; t2_idx = 3; t3_idx = 4; t4_idx = 5; % toplot_co = []; for fn = 1:size(fn_idx1,1) %load load(fn_idx1{fn,mat_idx}); tmp = sum(recordingFile.emg,1); figure win = [fn_idx1{fn,t1_idx}:fn_idx1{fn,t4_idx}]; % tmp = smooth(eegRatio,50); tmp = t...
2f0bfa15c82e6c74bae15fbe3fb30df2454d2aa4a250ffddaf62608cfa6bd853
MATLAB
1,280
37
function [payoff,dichot] = doWalk(options) start = (options.upperBound-options.lowerBound).*rand(options.nB,options.nS) + options.lowerBound; dichot = []; %draw from P(rew|correct) reward_pre = start; payoff = nan(options.nB,options.nS,options.nT); payoff(:,:,1) = start; for iB = 1:options.nB for iS = 1:options...
891d51fed6c41754983b0e95169c312079382442da53e182cf3153c8388f3542
MATLAB
1,280
48
function [Ehat, Phat, varargout] = getFreq(KF, I, freqs) % function [Ehat, Phat, E_gain, E_phase, P_gain, P_phase] = getFreq(K/F, I, RL_data) % Get impulse response if needed if I.impulse_or_closedloop if isfield(KF,'Kb_eye') F = getImpulse(KF, I, 1); else F = KF; end else K = KF; end ...
b3214c6db851fa4f3a5e48eb766405ef5f1bf7811743a8d996138ace1fe92b7e
MATLAB
1,281
37
function links=LAP_linker_local_s(framenum_id,non_linking_cost,spots_s,xy_pixel_size,z_pixel_size) try movement_correction_factor=0.45; z_pixel_size=z_pixel_size*movement_correction_factor; % Subpixel centroid extraction in previous frame (t-1), (xc_t0,yc_t0,zc_t0) xc_t0 = xy_pixel_size .* spots_...
e4b49df17c3be060a0ef5c7cdec2c11aba76efe6a1262ed1c4b3d1bd69eb8351
MATLAB
1,281
48
function [sigma] = wincov(x, y, percentx, percenty, dim) % Compute the %percent Winsorized covariance across dimension dim, between % the rows or columns of matrices x and y. % Implementation according to Wilcox; Robust Estimation % and Hypothesis Testing. As opposed to matlab's implementation % the percent is taken ...
69d145d485f833c6adbb170228e92dd650cc91a1183941eca83d433ddb7ae0b4
MATLAB
1,282
43
function theImage = MaximizeContrast(matrix) %MaximizeContrast Normalize an image to 0..1 where 0 is the minimum, 1 the maximum % theImage = MaximizeContrast(matrix) % % Used by Matrix2Grayscale % %See also Matrix2Grayscale % %History % % 8/20/2002 bds part of matwave package, D.R.Williams' lab % 8/2...
23c9fb26b8e8661d4b4718875c630e737e940f94ef9916327355d6e132ce589c
MATLAB
1,284
38
%% EXAMPLE OF DATA FORMATTING % This script shows how to create files should be MAT-files with a % defined structure called RecordingMatfiles (see files in 'Test data' % folder). %% Add path to class and functions addpath(genpath('../Toolbox/')); %% Output file path %% Prepare fake recording data ...
2f4089f52df6190b82a82d28373cb7784a294e8c387d883bc3cc051f06be17ea
MATLAB
1,285
41
function p = ME_vMMM_pdf(y, r, mu, ka, Ik) % _ % Probability Density Function for a von Mises Mixture Model % FORMAT p = ME_vMMM_pdf(y, r, mu, ka, Ik) % % y - an N x 1 vector of response deviations % r - a 1 x K vector of mixture frequencies % mu - a 1 x K vector of means % ka - a 1 x K vector of ...
2086f6483d4004fd9fac2e9ce8979f1722efc136c82a4467d94be62f3db071ad
MATLAB
1,287
49
%% Plot V4 MI Firing rates cued vs cue-opp for superficial and deep layers (histogram) %% Code % cue epoch win_start = 500; win_end = 2500; win_str = num2str(win_start)+"_to_"+num2str(win_end); layer_id = 1:2; fig_id = ["a","b"]; layer_labels = {'superficial','deep'}; for layer_flag = layer_id ...
8ef8cbae2e7eb779224f07a2fbcedc398694f5ed25d7bea310d7e7ce52cbbd15
MATLAB
1,287
36
function cca_mode_beh_weight(x,label,output_path) figure('position',[100,100,350,450],'PaperPositionMode','auto') % J = customcolormap(linspace(0,1,11), {'#ff8200','#fdad31','#e7b62b','#fcda70','#fefec2','#ffffff','#d0fefe','#b3f7fe','#7ce2fe','#33b0fc','#007bf3'}); % J = customcolormap(linspace(0,1,11), {'#7abace','#...
5b3d216ca1319f8d8d2e6b4d7dbc7877359619112010f2993b8d4e1fb6a5ee27
MATLAB
1,288
42
%% Plot V4 MI Firing Rate d' and bias split at cued and cue-opposite locations (moving window plots locked to cue onset/offset) %% Code loc = ["cued","opp"]; loc_flag = 1;%input('neural data at cued location or cue-opposite location: 1-cued, 2-opp: '); % loc_flag = 1 for Fig 2C, loc_flag = 2 for Fig 3A load('V4_FR.m...
b45e2cae6251be22384dc29e157642d75461fe228abd67fd64190cd6f094e629
MATLAB
1,289
28
function [z] = mtimes4xN(x, y) % MTIMES4XN computes x*y where x = 4x4xM (or Mx4x4) and y = 4xNxM (or % Mx4xN), and output dimensionatity is 4xNxM (or Mx4xN). % if M==4 it is treated as Mx4x4 siz = size(x); sizy = [size(y) 1]; z = complex(zeros(sizy)); %xconj = conj(x); if siz(2)==siz(3) for k = 1:sizy(3) ...
9b379b26a442127d045366d984d2a9a65fe7ab296bf92ae05b4dc80c9d63f1ff
MATLAB
1,290
29
function T = remove_isotropic(T) % T = remove_isotropic(T) % % T is assumed to be an MxNx3x3 tensor field, where each 3x3 matrix is % assumed to be symmetric. The function computes the smallest eigenvalue of % each 3x3 matrix and subtracts this eigenvalue times the identity matrix. % The algorithm follows appendix G of...
a116e68b9774b45be8aae0c6d6572b750c8197376fc00cea72fb13196446d08d
MATLAB
1,290
49
function jac = rbfjacob(net, x) %RBFJACOB Evaluate derivatives of RBF network outputs with respect to inputs. % % Description % G = RBFJACOB(NET, X) takes a network data structure NET and a matrix % of input vectors X and returns a three-index matrix G whose I, J, K % element contains the derivative of network output K...
c187492b30eec75abc0b358c7f9da0ac4f082de611bac1ff4db4566651d85238
MATLAB
1,290
72
function O = tsdArray(varargin) % Constructor for the tsdArray class % % USAGE: % O = tsdArray(varargin) constructor for the tsdArray class % % CALLING CONVENTIONS: % O = tsdArray(m, n), with m and n two integers, makes an empty 2-dimensional tsdArray of size m x n % O = tsdArray(S), where S is one ts(d) ...
daca98dedf23034072a6748c99c6a5006ad8c1d4ef5ad853ee8eb1833756aef7
MATLAB
1,292
33
function [processedEMG] = processEMG(EMG, SR, epochLen) % processEMG Compute the RMS in each epoch of the EMG signal % Zeke Barger 100119 % % Arguments: % EMG - a 1-D matrix of EMG data % SR - sampling rate, in Hz % epochLen - length of each epoch, in seconds % % Output: % processedEMG - the proc...
e1cff25f3bda4369c19ee8210bda4650c2b412f542e8b8707a1ce8c85e5109fd
MATLAB
1,292
52
function [val x] = getpropval(x, property, default) % GETPROPVAL - In-line propval. % % Usage: % % [VALUE VARARGIN] = GETPROPVAL(VARARGIN, PROPERTY, DEFAULT) % % GETPROPVAL is for obtaining property-value pairs from a VARARGIN % cell array without requiring the strict PROPVAL format. This % looks for the first instance...
0600db930473c74972f4095668485546b52fb97a85187343e5211f0bfa705817
MATLAB
1,293
46
function [merged] = mergestructs(s1, s2, prefix) % Merges two structures together. % % [MERGED] = MERGESTRUCTS(S1, S2) % % Merges the fields of two structures, S1 and S2. Conflicts are % resolved by overwriting any S2 field with the S1 field. % % [MERGED] = MERGESTRUCTS(S1, S2, PREFIX) % % This usage prepends the strin...
70b056e698d6a231ee1124560b54fbded3db1b362b57e424df4ebb4421d8c249
MATLAB
1,294
25
filepath = "F:\Data Lola PAVLOV Doric\M_58665\58665_20221117_sess03_rec1_def_nac.csv" % This function take a path to a doric csv file and return the headers % of the columns in header_raw as well as all the data n_line_header = 2; % In 2021 Doric csv file has two lines of header fp = fopen(filepath,'r'); % Open ...
78ff6936782a0b0bdeefd53a94e7bcd8dca0b184e68acd278e5b7065fdd68327
MATLAB
1,295
48
function [x] = winsorize(x, percent, dim) % WINSORIZE winsorizes sample x in dimension dim setting the % percent percent observations in each of the tails % to the value of the observation at threshold. % Implemented according to Wilcox Robust estimation % and hypothesis testing. If percent is a 2 element vector, it ...
a4eea930176406a01a84d31dd688a90f9994768b2c721037e184c9f9e7a83d88
MATLAB
1,295
36
function y=fProcess3(targetdata,targetpath,savepath,calendar) %% isDir=0; realtargetdata0 = targetdata; realtargetpath = targetpath; realcalendar0 = calendar; for sbjl0=1:length(realtargetdata0) dataset0 = realtargetdata0(sbjl0).name; cd([savepath '\' dataset0]); analysis_list0 = dir(['*' num...
1c3c2732bb86860e8853201779a0604f0e9bd7e2d111d7228723676741c0c732
MATLAB
1,296
36
fn='D:\Allen Data\Ephys\Human\H19.29.144\H19.29.144.11.41\H19.29.144.11.41.01\H19_29_144_11_41_01.nwb'; info=h5info(fn); swps={info.Groups(1).Groups(2).Groups.Name}; stimswps={info.Groups(6).Groups(1).Groups.Name}; swpstimnames={}; for i=1:numel(swps) swpstimnames(i)=h5read(fn, [swps{i} '/stimulus_description']); ...
b07e9537b34333425710443c9fbbdd5925274f3a6d21f39b96538c442aba0b50
MATLAB
1,299
44
function y=cut(X,pre,at,post,varargin); % function y=cut(X,pre,at,post,varargin); % at: at which frame will be cut % pre: how many frames before % post: How many frames after % varargin: % 'padding': padding when time that is not available % 'nan': pad with nans % 'zero': pad with z...
5746c3d760838dfd255eb31ed4275584e15d5b11d1d4bd513dfb2eb8ae28da2f
MATLAB
1,301
53
% DEMO_RPROP_2 Compare the four Rprop methods % % % Copyright (c) 2011 Roberto Calandra % $Revision: 0.55 $ %% Init funcgrad = @costfunction; % Function to optimize a.max = 3; a.min = 0; x0 = Utils.rrand([5000,1],a); p.verbosity = 1; % Increase verbosity to print something p.MaxIter ...
4e568c1626861bafa0200027556ea2b634058b7150f79e56047b5e9a4414d11e
MATLAB
1,302
46
load ('C:\noga\TD complex spike analysis\task_info'); req_params.grade = 7; req_params.cell_type = 'CRB'; req_params.task = 'pursuit_8_dir_75and25'; req_params.ID = 4000:5000; req_params.num_trials = 50; req_params.remove_question_marks = 1; lines = findLinesInDB (task_info, req_params); pursuitIDs = [task_info(lines...
79d16026915bf6ff45b4970ded2c9a7081850968172245f4db58d96d5aba1285
MATLAB
1,304
35
function [stats_group, stats_subj] = vector_autoregressive_model(data, group_model, subject_model, n_iter, p_ref_value) %Inputs: % data : {data_subj1, data_subj2,...,data_subjS}, data_subj1 is a D-by-N matrix where D is dimension % group_model : BSDS group_model % subject_model : mod...
fc74dc0fdbaf008325bafe1b2bd9ffeb839c8090999c3176d3ca74cf1024e0dc
MATLAB
1,304
37
function [h,theImage] = MakeGrayImageFigureForMatrix(matrix,figname,figScale) %MakeGrayImageFigureForMatrix Make a grayscale image figure out of a matrix % [h,theImage] = MakeGrayImageFigureForMatrix(matrix,figname,figScale) % matrix = 2D matrix to make a gray image of % figname = name of figure % figScal...
a377782fc4ee5379670cb36894ee4ab90828c72e658dfe0a4ca59fe167eb7278
MATLAB
1,305
40
function [pat_idx] = convert_mask_to_pat_idx(mask,mask_idx) % [PAT_IDX] = CONVERT_MASK_TO_PAT_IDX(MASK,MASK_IDX) % % MASK_IDX = a vector of indices into 3D boolean matrix % mask. [I don't remember how it works if MASK_IDX only % indexes into a subset of the active voxels in mask.] % % Returns PAT_IDX, a vector of indi...
7abed34a212f9565377b9f5d851de0111fdd76a2ba72da76ca166963f241328f
MATLAB
1,306
45
% @author Farad Khoyratee % @date 16 Apr 2019 % @copyright % SPDX-FileCopyrightText: © 2021 Farad Khoyratee <farad.khoyratee@gmail.com> % SPDX-License-Identifier: GPL-3.0-or-later function [Cm, I_stim, Vinit, GVal, EVal, TauMax, Sm] = NeuronTypeVtest() %% RS Hodgkin-Huxley parameter %Size of neuron ...