sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f939e57e9158c8490d0efb2bf606fa9ad942787c0c948330a35c1a53f2b00473
MATLAB
2,753
56
clear all close all addpath('/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/Hopf_model/TBI_homogeneous/outputs/Grange/HC/'); addpath('/Volumes/LASA/TBI_OpenNeuro/Shared_code/Hopf_TBI_ON/') addpath('/Volumes/LASA/TBI_OpenNeuro/Shared_code/Hopf_TBI_ON/helper_functions/') addpath('/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/Hop...
379dfbe0317e2cb9895e16790ba880fabc9a9a06f383221b0db52f243bc0d5bf
MATLAB
2,761
67
function [perfmet] = perfmet_maxclass_adaboostrounds(acts,targs,scratchpad,args) % % [PERFMET] = PERFMET_MAXCLASS_ADABOOSTROUNDS(ACTS,TARGS,SCRATCHPAD,ARGS) % % License: %===================================================================== % % This is part of the Princeton MVPA toolbox, released under % the GPL. See h...
3df55de72d7654fb50edac49bb216413817283ebf7d3c0f2d5f9e6f4cc5da037
MATLAB
2,761
56
clear all close all addpath('/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/Hopf_model/TBI_ON_Hopf_hc_tp2/outputs/Grange/'); addpath('/Volumes/LASA/TBI_OpenNeuro/Shared_code/Hopf_TBI_ON/') addpath('/Volumes/LASA/TBI_OpenNeuro/Shared_code/Hopf_TBI_ON/helper_functions/') addpath('/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/Hop...
dd1d10a40b8ad3f07578078c8681991929768683321d0737da565af25a03a21a
MATLAB
2,764
57
clear all close all addpath('/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/Hopf_model/TBI_homogeneous/outputs/Grange/HC/'); addpath('/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/Hopf_model/TBI_ON_Lesions_Hopf_mask1halfSD_bin_corr/outputs/Grange/'); addpath('/Volumes/LASA/TBI_OpenNeuro/Shared_code/Hopf_TBI_ON/') addpath('/Vol...
fd176c8b92dd8836d72f59fd9887722a37a733cad3180672549b0303ecaf5279
MATLAB
2,764
87
function [dataTree, procStreamConfigFile] = changeProcStream(datafmt, procStreamCfg, funcName, paramName, newval) global procStreamStyle dataTree = []; % Set globals if isempty(procStreamStyle) procStreamStyle = datafmt; end % Parse args if ~exist('datafmt','var') datafmt = 'nirs'; end if ~exist('procStreamC...
b5844cde602afe931be06a849ed2df466281efe36c26a19f14cab77e9d238b11
MATLAB
2,767
93
function [] = mr_fmontage(anat,func,mask,varargin) % Functional montage superimposed on anatomical montage % % [] = MR_FMONTAGE(ANAT,FUNC,MASK,SLICES) % % ANAT = anatomical information, in 3D form % % FUNCT = anatomical information, in 3D form % % MASK = booleans for which voxels to display, in 3D form % % SLICES (opt...
1a9f09fbd84ad7e98e349a20b1a1de087d76b1d6c395b3dd4e4a2c338c956df6
MATLAB
2,768
139
function typefiles = findTypeFiles(subdir, type, exclList) if ~exist('subdir','var') subdir = pwd; end if ~exist('exclList','var') exclList = {}; end if ~iscell(exclList) exclList = {exclList}; end typefiles = {}; if ~ispathvalid(subdir, 'dir') fprintf('Warning: folder %s doesn''t exist under %s\n', ...
86be5d6c0b925ef96ea977082f4b08d76d544d5c11fe8f7360bc582fd90f8c67
MATLAB
2,768
106
function L = CrossValidationSpatialCheck_HDInfo_Cells(S,lambda,X,Y,ep,ang,angHisto,B,varargin) nbEp = 10; dispBar = 1; binSize = 0.5; %in cms nbRand = 10; B = B(:); exDisp = 0; if ~isempty(varargin) exDisp = 1; end epV = regIntervals(ep,nbEp); L = NaN(nbEp,length(S),nbRand); aep = Restrict(ang,ep); da = Data(ae...
bb986b7acf8c7e38852224884c6a62da0e597d52c803a87c7b4e2aeed30b51b0
MATLAB
2,768
155
% cc heatmap and nodes for cytoscape(P<0.05,cc>0) clc clear [~,~,raw] = xlsread('/Users/luna/Downloads/data.xlsx'); data = brainregionISOKeta(:,3:2:57); data= cell2mat(data); ISOmean=mean(data,2) STD=std(data,0,2) dataI = cell2mat(dataI); dataK= cell2mat(dataK); cc = []; P_value = []; [cc,P_value] = c...
3ba621a7217b297c36270c01f889bd578c4ead3c6d881702971a1b4264c2f6e8
MATLAB
2,769
57
function [data_clean_artifacts] = artifact_rejection_auto(fname, data_seg, trl_visual_only,rd) % trl_visual_only= trl_visual_only(1:10,:); % trl_short = trl(1:10,:); %%%%%%%%%%%%%%%%%% detection of muscle artifacts in taks trials and rest trials %%%%%%%%%%%%%%%%% % http://www.fieldtriptoolbox.org/tutorial/autom...
e54a7e34ad1f1bb4f8d0e76268adf9e654aad33863a166867bc3ce15c542c8ac
MATLAB
2,770
72
%Fetches mni anatomy so can plot electrodes and other in MNI space. function mni=fetch_mni_anat(root_dir) mni.anat.fs_outputdir=[root_dir '/mni/mni-icbm152-t1-tal-nlin-asym-09b-hires_freesurfer-output']; mni.anat.fs_t1=ft_read_mri([mni.anat.fs_outputdir '/mri/orig.mgz']); mni.anat.pial=ft_read_headshape({[...
a4b6f6f627b07dcd54a65115dc0d187b1f9f3a2cbde8a12e7d5d3c2f1bc6f2e2
MATLAB
2,772
57
clear all close all addpath('/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/Hopf_model/TBI_ON_Hopf_hc_tp2/outputs/Grange/'); addpath('/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/Hopf_model/TBI_ON_Lesions_Hopf_mask1halfSD_bin_corr/outputs/Grange/'); addpath('/Volumes/LASA/TBI_OpenNeuro/Shared_code/Hopf_TBI_ON/') addpath('/Vol...
1620838057a08598ba218d294f6949e553236eb64c7ec8fc2ebbc0ac99f61666
MATLAB
2,774
35
% run from local pc and create gridscore, trajectory plot, and rate map plot cd .. initOAT cd gridscore preloaded_spk_reader=0; % save time of loading spike reader by using prior loaded one if preloaded_spk_reader==0 && ~exist('keep_vars','var') clear all; preloaded_spk_reader=0; end; clear keep_vars; use_hopper_data=0...
c3d4931ec0ecabed8fb46ed9837c832e96f7a013a73b38d60592119f5a714083
MATLAB
2,774
77
function [recon_energy,recon_FC_r]= homology_CC_rewired_digraphs_Human(W,zX_RS,RX_RS,n_null) % ========================================================================= % Generate 1000 random digraphs (degree-preserving surrogate connectoms) further calculate reconstruction accuracy % ============================...
a98f8508f84624218e1cd77cbda878a57f380d20fe6423b6ec816348c7566f0d
MATLAB
2,775
91
function [scratchpad] = train_ridge(trainpats,traintargs,in_args,cv_args) % Use ridge regression to predict your regressors % % [SCRATCHPAD] = TRAIN_RIDGE(TRAINPATS,TRAINTARGS,IN_ARGS,CV_ARGS) % % Uses Matlab's RIDGE function. Linear regression, but % penalises small weights (like weight regularization in % backprop),...
c79cd9669ce1cf049ba13aa92a05969375c4dd55734baa1a5aa197d91ffbc3c9
MATLAB
2,779
104
DataPath = '.\Data\Neuro\'; OutPath = '.\Data\Neuro\'; %% PSTH generation % Output should be a nTrials x nBin x nClu matrix % ==== PSTH parameters (TRANSITION) ===== minT = 0.5; maxT = 1.5; bins = 1./(2.^(1:10)); load([DataPath,'AMDSpks_Sal.mat'],'SpkT_all','cids_all','cpos_all','Mouse_all','SortedStim'); tic fp...
36c877f55cb17aad4ea8b0e95b7c7f57c29e2290e99524d85960f9a7981d7036
MATLAB
2,782
91
function [subj] = remove_object(subj,objtype,objname,varargin) % This removes an object permanently % % [SUBJ] = REMOVE_OBJECT(SUBJ,OBJTYPE,OBJNAME,...) % % This will remove the entire object permanently from the subj % structure - NOT RECOMMENDED % % There is no reason to remove the actual cell itself, since it % tak...
c84d89d073fc03eef8cb08da34e5e6417a635a2d38e4333b123869b5ec35f7e6
MATLAB
2,783
82
function net = glm(nin, nout, outfunc, prior, beta) %GLM Create a generalized linear model. % % Description % % NET = GLM(NIN, NOUT, FUNC) takes the number of inputs and outputs for % a generalized linear model, together with a string FUNC which % specifies the output unit activation function, and returns a data % stru...
d3767185abb7dbaf01bc271e83242b5e8433df81b30eac5f63e304595e2b7d9f
MATLAB
2,783
61
function [fx] = f_kToM_2modes(x,P,u,inF) % wrapper around recursive k-ToM evolution function % function [fx] = f_kToM(x,P,u,inF) % A k-ToM agent with k>0 learns the unknown parameters (theta) of her % opponent's learning and decision rules. Typically, theta includes her % opponent's prior volatility about herself ...
ad29439b31390e650e2032e26550006c979e8fc49f699c3b368a39cd27cf6e26
MATLAB
2,787
99
function [vol] = volumize_pattern(pat,mask,varargin) % Turns an nVox x nTimepoints pattern into a 4D XYZT matrix % % [VOL] = VOLUMIZE_PATTERN(PAT,MASK, ...) % % Returns a 4D XYZT matrix containing the pattern % data. Positions excluded from the mask are set to zero. % % The MASK must include the same number of dimensi...
b73f19ffd4ef911b590cf91d7f1a8319b16553493468e8f15ebd5b212e381692
MATLAB
2,787
59
clear,clc %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This script is used to perform CCA for brain-behavior analysis % % Jin % 11/3/2021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% set the file path current_path = pwd; working_path = current_pa...
e42d866c495b1686afff4dad72a03d5c9be0de937db8bc27be3b3451b51dbe23
MATLAB
2,788
103
function [gammaMod,gammaPh,goodEp] = GammaPhase(lfp,S,ep,freqBand) % [gammaMod,gammaPh] = GammaPhase(fbasename,channel,ep,freqBand) % INPUTS: % channel : LFP channel number (base 1) % ep : intervalSet object identifying where the signal should be looked at % freqBand : 2 value vector indicating low and hi...
2b929acce26395cb0aab0ab7e0e43a05c0ea77e14f67ffd58b19f1c5ea300389
MATLAB
2,793
83
function [data_dcAvg, data_dc, data_dod, snirf, procElem] = unitTest_SnirfBasicProcStream(filename) % Syntax: % [data_dcAvg, data_dc, data_dod, snirf, procResult] = unitTest_SnirfBasicProcStream(filename) % % Example1: % cd([fileparts(which('Homer3.m')), '/UnitTests/Example9_SessRuns']) % filename = './Simple_Pr...
56678bf19c4f4bdbfc15ce1cc5ea249481306979adf2c9a014570ea1585d12cc
MATLAB
2,806
88
folder = 'E-GEOD-46903.processed.1/'; files = dir(folder); fileNames = cell(length(files), 1); matchingFile = false(length(files), 1); for i = 1:length(files) fileNames{i} = files(i).name; matchingFile(i) = contains(files(i).name, '.txt'); end fileNames(not(matchingFile)) = []; sampleNames = strrep(fileNames, '_s...
1a90bb5f196531da1c7368e82a9c23b0f6472cee444467b1cd21b7396b9756cc
MATLAB
2,809
113
function [perfmet] = perfmet_xcorr(acts,targs,scratchpad,varargin) % Correlates the acts with the targets % % [PERFMET] = PERFMET_XCORR(ACTS,TARGS,SCRATCHPAD,...) % % Correlates each condition vector in ACTS with each % condition vector in TARGS - that's the 'CORRECTS' % % Outputs a NaN GUESSES matrix. % % License: %=...
1edf102a8c97790d2167472fef6f5728c42b9adb97cd982971b773d6b5617ffc
MATLAB
2,819
73
%Plots PSTH showing response of given neuronal unit to senosry flicker for %given condition. %2024/02/25 function plot_flicker_psth(psth_data,conditionIndex,condition,unit_label,max_spikerate) %determine condition color: temp=strsplit(condition,'-'); if strcmp(temp{2},'V') %visual in orange conditi...
177f80f0443c45de8a4cff07dbfa85902f7112d21b0e54c935995477c0cba7e9
MATLAB
2,820
86
function [subj] = peek_feature_select(subj,data_patname,regsname,selname,varargin) % Just like FEATURE_SELECT, except that it peeks % % [SUBJ] = PEEK_FEATURE_SELECT(SUBJ,DATA_PATNAME,REGSNAME,SELNAME,...) % % Only creates a single statmap pattern and mask because it runs the % statmap_anova on all the TRs in the data....
9465af3468e42276ab9ecc0c8c69e66aa0ef773cb7b2bc68b94c7d3f6c8784c9
MATLAB
2,823
117
%% Pursuit task clear [task_info,supPath] = loadDBAndSpecifyDataPaths('Floc'); figure req_params.grade = 7; req_params.cell_type = {'PC cs'}; req_params.num_trials = 50; req_params.remove_question_marks = 1; req_params.remove_repeats = false; req_params.task = 'rwd_direction_tuning'; req_params.ID = 3390:4000; l...
b6b4cc2f3e2f62ddd30452e7e5ff0f57e36ca5c8745c27256f7c073fec25172b
MATLAB
2,826
83
function [subj] = create_pattern_from_mask(subj,old_patname,maskin,new_patname,varargin) % Creates a new pattern by masking an old one % % SUBJ = CREATE_PATTERN_FROM_MASK(SUBJ,OLD_PATNAME,MASKIN,NEW_PATNAME,...) % % Creates a new pattern called NEW_PATNAME from an % existing one called OLD_PATNAME, including only the ...
443e903b8e2d266226e96fa55289983bd9791a309912dfdf5b428c8fafa48e37
MATLAB
2,828
91
function Image3_ColoredFlowImage(imageExportFolder, fileParams, flowFigureImageParams, vxMat, vyMat, relMat, numMicrons) %% Check exist fileName = 'WholeImage_WithColoredFlow.png'; %% Import parameters % File Params pxPerMicron = fileParams.pxPerMicron; thetaInDegrees = fileParams.thetaInDegrees; thetaInRadians = fil...
e1f10f6ac7cfdd12c3c580379db4fb1e88bdc56c9d725b129a67d22badf699e9
MATLAB
2,836
108
function L = CrossValidationSpatialCheck_HDInfo_CtrlSpkTimes_Cells(S,lambda,X,Y,ep,varargin) nbEp = 10; dispBar = 1; binSize = 0.5; %in cms nbRand = 10; exDisp = 0; if ~isempty(varargin) exDisp = 1; end epV = regIntervals(ep,nbEp); L = zeros(nbEp,length(S),nbRand); S = Restrict(S,ep); X = Restrict(X,ep); ...
91cff78ebe4ab19e80a356b65a1385b3e8ba32f27c517a432f2db1f5bba10b6a
MATLAB
2,837
77
%% load dataset % load('dataset_201.mat', 'df'); % load data of 201 brain regions % load('dataset_53.mat', 'df'); % or load data of 53 brain regions load('dataset_64.mat', 'df'); % or load data of 64 brain regions load('onto.mat', 'onto'); ivol = cat(1, df.Volume{:}); % get volume of each...
65da434e21e9360c44c051b22995bbef413150312062ece66ae2aac817080619
MATLAB
2,840
94
function [L,weights] = CrossValidationAssemblyPrediction_Cells(Starget,Qassembly,Qtarget,ep) % % [L,weights] = CrossValidationAssemblyPrediction_Cells(Starget,Qassembly,Qtarget,ep) % % computs the loglikelihood prediction of the spike train Starget from the % binned spike train matrix of its peers (Qassembly). The p...
ec015a68952ec9991000b869d4ec1a8cfadb88caeb14a5fcaf3ad9ed949bdc2a
MATLAB
2,840
83
function [p, Cost, kX_deltas, PF] = plotCost(fC_matfun, k0, i1, i2, zlims, klabels_plot, complex_on, best_fit_on) nplot = 151; apos = [1.5 1.5 .83 .83]; ha = gca; cla cs = linspace(-1,1, nplot); ds = linspace(-1,1, nplot); if i2==5 ds = linspace(-k0(5), k0(5),nplot); end [Cs,Ds] = meshgrid(cs,ds); Cost = NaN(nplo...
1e00c6e5eb741019e776a681d1310b778478f27e337dcbebdf0fb802bc8f3f48
MATLAB
2,841
94
function [L,weights] = CrossValidationAssemblyPrediction_Cells(Starget,Qassembly,Qtarget,ep) % % [L,weights] = CrossValidationAssemblyPrediction_Cells(Starget,Qassembly,Qtarget,ep) % % computs the loglikelihood prediction of the spike train Starget from the % binned spike train matrix of its peers (Qassembly). The p...
556f81604f10e9db1302aa4efc71f2acdd0f7a61aab60806d7a6749accca4af2
MATLAB
2,841
98
clear all [task_info,supPath,MaestroPath] =... loadDBAndSpecifyDataPaths('Vermis'); NUM_COND = 20; req_params.remove_repeats = 0; req_params.grade = 7; req_params.cell_type = 'CRB|PC|BG|SNR'; req_params.task = 'choice'; req_params.ID = 4000:5845; req_params.num_trials = 180; req_params.remove_question_marks =0; r...
fc593314acd37f13c59374867a1aef9b4a5c36c5e77af53372301375e2412292
MATLAB
2,842
89
function [scratch] = train_gnb(trainpats,traintargs, in_args, cv_args) % Use a Gaussian Naive Bayes classifier to learn regressors. % % [SCRATCH] = TRAIN_GNB(TRAINPATS, TRAINTARGS, IN_ARGS, CV_ARGS) % % The Gaussian Naive Bayes classifier makes the assumption that % each data point is conditionally independent of the ...
e2f51ceb34d802cfbabf422fb2530a045c153385f802d51b6b99bf268a80af7f
MATLAB
2,845
77
function net = mdn(nin, nhidden, ncentres, dim_target, mix_type, ... prior, beta) %MDN Creates a Mixture Density Network with specified architecture. % % Description % NET = MDN(NIN, NHIDDEN, NCENTRES, DIMTARGET) takes the number of % inputs, hidden units for a 2-layer feed-forward network and the % number of centre...
0335be32ac03a7036476a55d171d55985ea0c978f39499771e40f2a330970f10
MATLAB
2,847
95
function [cData] = get_cData(beh_dat,sess_list,RF) cData = []; for iSess = sess_list tempcData = extract_cData(beh_dat{iSess}); if(RF==1) tempcData = tempcData(tempcData(:,4) == 3 | tempcData(:,4) == 0,:); end cData = [cData;tempcData]; end end function cData = extract_cData...
3d5b0e3a80bbd70fc0d173a8670a4171fcd543b3468ae689adbc0eb9e577b964
MATLAB
2,849
89
% 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 plotHistISI(sbjNum) rawDataDir = ['C:\Users\mn0mn\Documents\ResearchProjects\spatailAttentionProject\RawDatafNIRS\Experiment' num2str(sbjNum)]; load([rawData...
287fec6278254e796060e94d955d3434c3ed462dbce89788d54908e46a4c63ea
MATLAB
2,850
100
function play_movie( x, varargin ) % *WAVE* % % PLAY MOVIE image/surface animation of the input datacube % % INPUT: % x - datacube (r,c,t) % % -- optional string-identified arguments: % % plot_method - choose either imagesc or surf plot % color_range - z-axis scale % time_range - sample numbers to plot % ydir - y-di...
079d664707faff75a10060aaaf812cbf61eeedd07b461642330d266ce79ed70b
MATLAB
2,851
100
clear [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); req_params.grade = 7; req_params.cell_type = {'PC ss', 'PC cs', 'CRB','SNR','BG msn'}; req_params.task = 'speed_2_dir_0,50,100'; req_params.num_trials = 90; req_params.remove_question_marks = 1; raster_params.align_to = 'targetMovementOnset'; raster_pa...
cae168b8be500584b21b230d9e049e3d73353ce13c28fb930f6d962749684f19
MATLAB
2,851
99
% Dependency of LoadPosition. % [CleanWhl GoodRanges] = CleanWhlFR(pos, StretchLen, JumpSize,Gap); % % "cleans up" a position file by interpolating missing stretches % up to StretchLen long (default 20), for which the endpoints % don't differ by more than JumpSize, (default 30). % % also returns the ranges where the w...
ca3f401744e7aaf03c42d0b9f7671df63ec12a677572968ef59fc93636c494ad
MATLAB
2,854
60
function msBatchAlignmentIntensity(dirName) %MSBATCHALIGNMENT Summary of this function goes here % Detailed explanation goes here %--------- Alignment parameters ---- [optimizer, metric] = imregconfig('monomodal');%'monomodal'); %filter templates for preprocessing alignment frames hLarge = fspecial(...
c38943ebc14fadb2005c28e48978c9e1710a3cba656f3ae29a7858983a347d7d
MATLAB
2,855
79
%{ Combined plot of multiple neuron groups' spikes %} % params Ts=500;%3000;%500; % start time to plot Te=Ts+2000;%2500;%size(SPKste,1); % end time to plot Ns=1; % starting index of spikes to plot Ne=1600;%1764; % ending index of principle cell spikes to plot Nei=833;%588; % ending index of interneuron spikes to plo...
e34c9dea716c9d58207371d5794790683f8b02a9d11973a9d2954788f3d5341b
MATLAB
2,856
86
function EcodeOverview % Prints out a pdf overview of the ecodes recorded in a cell % Morphys code is necessary for this to function % Bioinformatics toolbox is necessary for the suptitle function to work % Instruction: insert the filename to be saved (use the cell name) % Select the abf files % setups...
77f05c255e164ba3b1025f48c3b657322ad11df8a1b2e1dcbe2c84ceebbce955
MATLAB
2,861
87
function [I_si_h, I_ind_i, I_multi] = computeMultiSpinsInfo(eta_vals, eps_vals, j_vals) % computes the information that the set of spins {couplings j_vals} has about the % latent field % warning: number of terms computed goes at 2^length(j_vals) if length(j_vals) > 15 I_si_h = nan; I_ind_i = nan; I_multi =...
d663a48af67741ebfe4c4be681208d154ae03c74a4a6e0472df0005251e960d1
MATLAB
2,865
88
function [A,B]=platt(out,target,prior0,prior1) % find the coefficients A and B such that the posterior probability % of P(y=1|x) = 1/(1+exp(A*f(x)+B)), where f(x) is the output % of the SVM % % out: vector of outputs of the SVM on a validation set % target: validation labels % prior0: number of negative points ...
bb34459e62419473ae4d63cec713e3ded4b4cbc2fba794aaca0e928946741c74
MATLAB
2,866
98
function [errs warns] = unit_get_group_as_matrix() errs = {}; warns = {}; subj = init_subj(mfilename,'test'); nObjectsPerGroup = 4; nVox = 10; nTimepoints = 100; p_1 = ones(nVox,nTimepoints) * 10; p_2 = ones(nVox,nTimepoints) * 20; p_3 = ones(nVox,nTimepoints) * 30; p_4 = ones(nVox,nTimepoints) * 40; nConds = 3; r...
ff7c1d80632fa1ae7903da6100f734b350b9610cef3664fe55dc210b8120463a
MATLAB
2,867
75
function [G,h] = build_G_h_linear2d(b,delta_c,transformationModel) % BUILD_G_H_LINEAR2D Builds the equation system G*p = h % % INPUT ARGUMENTS % b - b = [b2 b1]' % delta_c - c_fixed - c_moving % transformationModel - Transformation model (translation or affine) % % OPTIONAL INPUT AR...
4c7fc6908145862c401f4b1b09ecc0d5ec31abe60a5fd7607c13fad107e6c313
MATLAB
2,872
88
function [subj, patstem] = ebc_tutorial_adv_optimize(subj, default_params, varargin) % Performs averaging to increase EBC generalization performance. % % [SUBJ] = EBC_TUTORIAL_ADV_OPTIMIZE(SUBJ, DEFAULT_PARAMS, ...) % % Performs spatial and temporal filtering on a given pattern, given % a set of default parameters fo...
6f7e2a5e2c5e2b3dc3036843c1c6849eaaf7eace4e6707472b9d4c5295ccb63d
MATLAB
2,873
71
function [sin_pred, cos_pred, ang_pred] = pSVR_predict(data_psvr, labels_psvr, mask_psvr, missing, p) % function [sin_pred, cos_pred, ang_pred] = pSVR_predict(data_psvr, labels_psvr, mask_psvr, missing, p) % % Initialize multitarget/periodic support vector regression (pSVR). First, % labels are transformed into a sinu...
64fb45bf7930014bf079228f87c438036abaff4273b98fdd248a3735df043d64
MATLAB
2,874
62
% function select_ind = select_peak(search_range,all_results) % % This function selects the index of search_range which is the largest % (same as max), but if several peaks exist it picks the most stable. The % function has a tendency to select values at the extremes which is % slightly corrected by switching a c...
efd3f3f1db44ed82699fcfd1282ae01461fcc2e5acd51bf57741ca45217f64ea
MATLAB
2,874
94
function multCond_chosen_action_val(cfg, i_sub, i_run, hbi_model_path, output_path) %% Load hbi model parameters cbm_hbi = load(hbi_model_path); hbi_output = cbm_hbi.cbm.output; winning_model = 1; hbi_params = hbi_output.parameters{winning_model,1}; %% Load behav_data .mat behav_...
7cfde32d74af8805b9df4dfc820010e10fa7fe1ff8d8d65d141f5ad8b4d0ca21
MATLAB
2,878
72
% util unit test % % mv_select_train_and_test_data tol = 10e-10; % Random data N = 100; ntime = 30; X = randn(N,40,ntime); clabel = randi(3, N, 1); train_indices = [1:N/4, 80:N]; test_indices = setdiff(1:N, train_indices); n_tr = numel(train_indices); n_te = numel(test_indices); cfg= []; cfg.preprocess_fun = []; % ...
f548eaed4be257ac3990a959280ba8babe9400862ff4977d312eec430c4d30a5
MATLAB
2,880
80
function combineOCTHistToOneImage(alignedImagesFolder,outputFolder) % This function takes image pairs and generates a nice overview image %% Inputs % Folder with aligned images (input folder) if ~exist('alignedImagesFolder','var') || isempty(alignedImagesFolder) alignedImagesFolder = [pwd '\dataset_oct_histo...
7c668f05fb37310453ff3fbd008a4dbec2f89a38e17b856995f4286720c622f6
MATLAB
2,882
77
% function warningv(msg_id,msg,varargin) % % This function makes sure that a warning is only printed once at each % level of execution. For example, in feature selection a warning message % should only be printed once. It is similar to warning.m, but does not % allow input similar to fprintf as would be possible ...
8a4f6bd69b2bfd00840dce2fc36c4c016432a8d85cd0c374a3f04e1e4bf48a3a
MATLAB
2,882
87
load('\\storage1.ris.wustl.edu\kerschensteinerd\Active\Emily\Noise\Analysis\ProcessedData\RFSpatialNL_04242023\Ai148_Grm6Cre_NoiseSpatialNonlinear_radius40_110818_1_5.mat') %% decide the targeting position figure; plot(mean(Rd_posi(:, 3, :), 3, 'omitnan')); %% decide the targeting ROIs figure; plot(squeeze(Rd_p...
8e6e12a77c51b46f435b793e0f48df56e09040a5297dfca1099ce6cf30919f87
MATLAB
2,883
112
% Filename : eegprocessor.m % Author : Andreas Seas % Created : 17-11-2021 % Edited : 21-11-2021 % Descr : *** % *** means fix me %% clear slate close all;clear;clc %% Set up Workspace disp("Set Up Workspace"); homedir=pwd; addpath(genpath('/Users/as822/Box/PST Project'));% add the path of al...
a28900922c4a56b8899262ebb4cab99debcb4603847aa8356b0d13ba27da17cf
MATLAB
2,889
79
% function [AUC, zAUC, p] = AUCstats(decision_values, true_labels, labels, plot_on) % computes the area unter the curve (AUC) and the corresponding z-value % zAUC for the n-by-1 vector of decision values, corresponding n-by-1 % vector of true labels. The order of assigned labels is given by the % variable "labels. ...
b364501f4e5cf869067c945375e19ec752832ae7e72f5349970c0644c72bb613
MATLAB
2,890
105
%% Pre-Post improvements clear all; clc; mdir=pwd; cd('../Data') load PrePost.mat cd(mdir); %% Performance pre-post 1) construct mat ExPP=PrePost; den=0; Exprs=[1:4]; avgFxs.PFs=[]; avgFxs.Crv=[]; PCEx=[]; for ex=1:4 expr=Exprs(ex); for fr=1:2 %%% fr =1 orientation, fr = 2 color ...
59ef07126e04362476999a648aa5c51dae3b403b8cadf30819c03180e02cf121
MATLAB
2,891
88
%% Plotting goodness-of-fit p-val, median split of sessions based on jackknife estimates of sensitivity and bias %% Code Trials = ["All","RF"]; split_sessions.parameter = ["sens_cued","LR_cued","sens_opp","LR_opp","sens_cued_mi","LR_cued_mi","sens_opp_mi","LR_opp_mi"]; sessions_list = {[4:15 18 20:24] , [34:45]};...
7473d0f273af04883ad538f4abba7a8a7798607a0333318dcedd6926d051db02
MATLAB
2,892
90
% function save_fig(filename, cfg, fighdl) % % This function serves to save a figure (the current axis) as % matlab-figure + other formats (if desired). % % INPUT % filename: name for the file to be saved to (extensions will be added % automatically) % % OPTIONAL INPUT % cfg.plot_design_formats: if ...
cec4aae2fb742a3c0164bbd5cc49a791a462bec51e1148a6e86ecd5bd8ba3451
MATLAB
2,892
77
function val = minc_variable(hdr,var_name,att_name) % Read a MINC variable inside a header % VAL = MINC_VARIABLE( HDR , [VAR_NAME] , [ATT_NAME] ) % % HDR (structure) a minc header read with MINC_READ % VAR_NAME (string, optional) the name of a variable. % ATT_NAME (string, optional) the name of an attribute. % VAL (va...
3eb5d57dd9847a6f02b17bfa0977f1fffbecbc72f41690cd222cb21b2a9faa5e
MATLAB
2,893
90
function transformationMatrix = create_transformation_matrix3d(varargin) % CREATE_TRANSFORMATION_MATRIX3D Create a 3D transformation matrix % % [transformationMatrix rotationMatrix shearMatrix scaleMatrix] = ... % create_transformation_matrix3d() % % INPUT ARGUMENTS % N/A % % Optional input arguments % 'phiX' ...
7c875e39cb161d7a4bdb4d97406f22879c717d34ba79a7b26a6be5f31d22e6e9
MATLAB
2,897
72
%This script converts JSON version to the latest version %File path to search for JSONS filePath = 's3://delazerdamatlab/Users/OCTHistologyLibrary/LB/'; %% Search for JSON files fprintf('%s Finding JSON Files\n',datestr(now)); folder = awsModifyPathForCompetability([fileparts(filePath) '/']); ds = fileData...
763f6c57246b6fbea662664d796af95312d6f751a5d48cf025bad5472ec8922d
MATLAB
2,898
100
% Script to calculate the split-half reliability of the BFCA as a neural % measure. delay = p.psvr.delay; % delay = 12; p.psvr.label = 'target'; all_results = pSVR_load_results(p, 'grid'); [bfca_cv, voxel_cv, fwhm_cv] = pSVR_nested_cv(all_results, p); n_perm = 1000; % Run analysis for i_sub = 1:numel(p.subjects) ...
a5c12f92d04c39f10498153f68fa45dc92ac9247b9211c119aa8e204f5929189
MATLAB
2,900
76
function [subj results] = ebc_tutorial_adv_xval(subj, patstem, default_params) % Perform cross-validation experiment for advanced EBC tutorial % % [SUBJ RESULTS] = EBC_TUTORIAL_ADV_XVAL(SUBJ) % % Performs one cross validation experiment for each regressor in % the group 'baseregs_grp'. The PATSTEM argument will hav...
c3fd1be46e2a54d358a294173a63da24de013481a7ff10f7053dea2b3907ff1b
MATLAB
2,900
96
function fig = plot_dff_fragments(step1, step2, Eventname) i1 = step2.(Eventname).i1; i2 = step2.(Eventname).i2; D = step2.(Eventname).D; x = step2.(Eventname).x; mean_frag_raw = step2.(Eventname).dff_PETA.matrix_mean; std_frag_raw = step2.(Eventname).dff_PETA.matrix_std; mean_frag_zscore =...
246597ac354b093f6856c0fd13507816b1369feec67eb589bef3cba7e9e25c3f
MATLAB
2,903
73
function FlowClusterTracksMovies(fileParams) %% File Parameters exportFolder = fileParams.exportFolder; pxPerMicron = fileParams.pxPerMicron; secBtwFrames = fileParams.secBtwFrames; thetaInRadians = fileParams.thetaInRadians; cmap = flipud(Rainbow(22)); cmap = cmap(3:end, :); %% Define folders flowExportFolder = [exp...
254baeebcdd1d7c55582fe31268a424434729b7efb1ac26734e9f6641e482261
MATLAB
2,903
108
% Visualization of spiking activity in our model %% generate latent process, random coupled spins, covariance matrix N_F = 5; N_neur = 128; J_if = randn(N_neur, N_F)/sqrt(N_F); % T = 150; dt = 0.003; % in seconds N_T = ceil(T/dt); % tau_F = 15 + 0*logspace(-1, 1, N_F); % in seconds h_F = zeros(N_T, N_F); for i_f =...
b53b157357fee771780217689fb70d8a2fad24eb9ab42f8a8b87d5daf8442e47
MATLAB
2,908
126
clear [task_info,supPath,~,task_DB_path] = loadDBAndSpecifyDataPaths('Vermis'); EPOCH = 'reward'; PLOT_CELL = false; req_params = reqParamsEffectSize("both","both"); lines = findLinesInDB (task_info, req_params); cells = findPathsToCells (supPath,task_info,lines); cellType = cell(length(cells),1); cellID = nan(le...
08686a4656853370f48310aba57ac9bdca658c5de745e567eba6857b79f491ad
MATLAB
2,910
88
% This script compares cross plane distance of algorithm vs fine alignment. %% Inputs libraryNames = {'LC','LD','LE','LF','LG'}; %% Load data st = loadStatusReportByLibrary(libraryNames); %% Filter goodI = computeOverallSectionQuality(st) == 2; % Pull data goodI = find(goodI); d_StackAlignment = st.se...
0a00819b8dddac7089140132aaf8cd26d39c9f99b5316846e3f2145929e597c1
MATLAB
2,912
110
function [varargout] = size2(x, dim, cellflag) % SIZE2 Size of cells in cell-array. % % Use as: % [varargout] = size2(x, dim, cellflag) % % Input arguments: % x = cell-array % dim = dimension argument, default [] % cellflag = true (default) or false. If false, size2 behaves as size, % otherwise the size...
38e91fe4955c7e6a4a647180db8e72de0cad3fc1207b8734fefbb23f58885e8b
MATLAB
2,913
73
function [flavorNameString, priorityStruct] = MachGetPriorityFlavor % OS X: ___________________________________________________________________ % % MachGetPriorityFlavor returns the priority flavor mode of the main % MATLAB thread, either 'THREAD_TIME_CONSTRAINT_POLICY' or % 'THREAD_STANDARD_POLICY'. % % The seco...
c9830096faf6190458f1a9ab12bdc5b3de520ca6d6a9eabb990d0a429f03259a
MATLAB
2,914
150
function [errmsgs warnmsgs] = test_perfmet_xcorr(varargin) % USAGE :[ERRMSGS WARNMSGS] = TEST_(type) % % This is a script that tests the cross correlation performance metric. % % INPUT ARGUMENTS: % % STDOUT (optional, default = true) If true, prints errors and % warnings to screen as they occur. % % OUTPUT ARGUMENTS:...
005894b75072e8abfe2a29d5dd02fa076aba80459814c48c39f19b0b1dcd5956
MATLAB
2,917
79
function allTracks_analyzed = analyzeTracks(allTracks,MotionThresh,obj) figure for i = 1:length(allTracks) %calc change in X coordinate between frames X = allTracks(i).centroids(:,1); dX = zeros(length(X),1); dX(2:end) = X(1:end-1); dX = dX - X; dX = dX(2:end); %remove frames when worm is s...
9b9b5380c1836e14f5d31e8c55a6918142af7b5ab62495b7f5318225a8571ebe
MATLAB
2,917
74
function pipeline_patdif_reward_at_cue_decoding() cfg = load('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_patdif_reward_at_cue_1st', ... strcat('sub-',sprintf('%0...
8504c1c5e242be58e85d495ba6f20c5e5e35d84bae56b730a36fd586173c93b0
MATLAB
2,921
79
function [results_data] = plot_cue_opp_indivSig_histo(cueMI, oppMI, cue_sig, opp_sig, iMonkey, xl, yl, bin_size, trial_type, prop_flag, plot_flag) %% Plots V4 f-MI cued and opp histos separately with overlaid shaded histograms showing individually significant units %% Code iWindow = 1; windows = ["cue_onset","pre_bla...
0c49e8fcb5ca6f3cbc2a9fa1156077e9273bd46b411bd5422b369f5091229baf
MATLAB
2,924
77
function [null_hom_ratio, null_hom_recon_FC_r]= homology_non_signals_Human(U,demean_signals,RX_signals,null_graph) % % ========================================================================= % % Generate 1000 random non-homology regions' signal further calculate reconstruction accuracy % % =====================...
31cd8736cd8b43ae3d97344cafca80ed11545c7dcf8023af083cc0537bb1c2f5
MATLAB
2,926
103
function demmet1(plot_wait) %DEMMET1 Demonstrate Markov Chain Monte Carlo sampling on a Gaussian. % % Description % The problem consists of generating data from a Gaussian in two % dimensions using a Markov Chain Monte Carlo algorithm. The points are % plotted one after another to show the path taken by the chain. % % ...
5542270d6c3f89782d915ed95da7748587266c70a13e328a8d516dd1da84ec4c
MATLAB
2,926
72
function plotScalingVerification(x_reps_T1, eta_T1_infTC, eps_T1_infTC, T1_tau_vals, T1_taurep_vals, gamma_fit_summary, ii_rep, jj_t, t1_codes) h_Fig = makeMyFigure(30, 10); tiledlayout(1, 4, 'TileSpacing','compact'); h_sp = zeros(4, 1); for ii =1 : 4 h_sp(ii) = nexttile; end data_color = [0.4940 0.1840 0.5...
20f0d4cc5667d15520c591ddee6650aaa2e3e8edc9436b0e082704430d48b822
MATLAB
2,937
85
% Preprocessing unit test % % oversample tol = 10e-10; N = 99; X = randn(N,1); % Get default parameters param = mv_get_preprocess_param('oversample'); %% if data is already balanced then oversampling should have no effect clabel = ones(N,1); clabel(N/3+1:2*N/3) = 2; clabel(2*N/3+1:end) = 3; [~, ~, clabel2] = mv_pr...
242d38addf3533a9b9c12074ef47fec06a32aa3058f3c313d223030127e6ba32
MATLAB
2,938
89
function guess=find_bpn2_2(neurons,coords,C,guessed) for i=1:size(coords,1) stds(i)=std(neurons(i).coords(:,5)); end [~, sorted_ids]=sort(stds,'descend'); guess=[]; selection=sorted_ids(1:50); num_neu=3; additional_factor=1; selection(ismember(guess(:),selection))=[]; combinations=nchoosek(selection,n...
3f2022a70856016570cd59a3bfe73d5ed1dae28d392475d6389dea455e5323ca
MATLAB
2,939
86
function params = ComputeCrossCorrPrediction(preTrain,postTrain,sPost,binT,varargin) % Finds the optimal gaussian window (s.d. and time-lag) that integrates pre-synaptic spikes to % predict post synaptic spike train. % % USAGE % % weights = ComputeCrossCorrPrediction(preTrain,postTrain,sPost,rg,binT,r,binT) % % ...
503113ce226e23463a25871035c601f5243d0942e04793330c0881dfa2fdf55d
MATLAB
2,939
105
function [A sizes] = fill_clusters(vol, adj_list) % Fills in all non-zero clusters with unique sequential integers. % % Usage: % [A] = FILL_CLUSTERS(VOL) % [A] = FILL_CLUSTERS(VOL, ADJ_LIST) % % Operates on a 3D mask volume. Iteratively searches out % connectivity for only the non-zero voxels in VOL, using the % a...
b81359b0ab8448d1d3ecc1682f0b192a0f34b1828692804d4e58f3dbd60aa75a
MATLAB
2,942
61
function RE = estimate_registration_error(fixedCoordinates,movingCoordinates,displacementField,spacing) % ESTIMATE_REGISTRATION_ERROR Estimates the target registration error % % RE = estimate_registration_error(... % fixedCoordinates,movingCoordinates,displacementField,spacing) % % INPUT ARGUMENTS % fixedCoordinates...
aa7a62d4834b17490b82fdc06152ee65a9d65d78bcbb14ff3240dad28608383f
MATLAB
2,943
64
function layer = classificationLayer( varargin ) % classificationLayer Classification output layer for a neural network % % layer = classificationLayer() creates a classification output layer for % a neural network. The classification output layer holds the name of the % loss function that is used for trai...
db30c2b2d5e6fb1a28d32fbd9a57ce0edd1581e14319397357b49339faf358d4
MATLAB
2,946
96
function [subj] = remove_timepoints(subj,objtype,objin,actives_selname,varargin) % Remove timepoints from an object or group % % [SUBJ] = remove_timepoints(SUBJ,OBJTYPE,OBJIN,ACTIVES_SELNAME,...) % % Feed in a selector ACTIVES_SELNAME with 1s for the timepoints that % you want to keep, and an object/group OBJIN name f...
ea40952c5e72c758a91ad5fb196647baf559f9402e4cd6888ef755e2c8cbe592
MATLAB
2,947
81
%% Plot Sel Fit ttl{1,1}=["Hits and False Alarms - Without MB"]; ttl{1,2}=["Misses and False Alarms - Without MB"]; ttl{2,1}=["Hits and False Alarms - With MB"]; ttl{2,2}=["Misses and False Alarms - With MB"]; rsq2=zeros(2,2); rsq2_err=zeros(2,2); rsq2_jk=zeros(1,64); fold = ["even","odd"]; subset=["hfa","...
7d7f0c79000d322bbe7ead8c53cc844693f6242a7ec985062d988bae91b8c95e
MATLAB
2,955
91
function bhvr = bhvr_load(p) % function bhvr = bhvr_load(p) % % Loads behavioral data from the MRI experiment for all subjects. % % Input: % - p: Structure with analysis parameters. % % Output: % - bhvr: Structure with all relevant behavioral variables. Fields % include: % resp_err: Matrix with respons...
7ca276024d3dc9f6e427645fd2905515dd965f175dd3a559331da050d69e6768
MATLAB
2,956
70
function [pparam, X, clabel] = mv_preprocess_oversample(pparam, X, clabel) % Oversamples the minority class(es) in unbalanced data. % %Usage: % [pparam, X, clabel] = mv_preprocess_oversample(pparam, X, clabel) % %Parameters: % X - [samples x ... x ...] data matrix % clabel - [samples x 1] vector of...
6270b842475d154994d8e09dd7ddee0411423c77fd717e629a376cac81c4bb16
MATLAB
2,961
69
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This script is meant to be used as part of a wrokflow aimed to calculate yap overal expression and YAP % nuc/cytoplasm ratio in fixed cells seeded on PAA gels. % Written by Sefora Conti % Affilition: Xav...
4cec6932bac00c4d0dd89c6e12364e21e716ec14b42301d4c341031442bdd178
MATLAB
2,962
99
% figure 2A: measuring sample dissimilarity matrix % last update: October 24 2022 % Amirhossein Farzmahdi clear close all clc % add path addpath(genpath('functions')) images_dir = 'mat_files/'; % loading data load (images_dir+"names") load(images_dir+"imgs") load(images_dir+"bw_masks") % setting nexemplar = 25; nvi...
7f61b256e5b16e9aba6d5aafa3a52464ff49182cadc4252a38cdceeb429b8745
MATLAB
2,963
46
function [ mask ] = ConnectPointsAlongPath( InputImg, StartPt, EndPt ) %ConnectPointsAlongPath: Traces path between two points while constrained to %path of pixels with value one. %Find the shortest path connecting the centroid and the endoiints. %This script duplicates the image, and finds the path (following o...
d6548b599807f23b4e3df4acdf9b12e32973c1c45893f092f1c83dc73bfb3797
MATLAB
2,963
108
function [thetaMod,thetaPh,thetaTrghs,thetaPks,goodEp] = ThetaPhase(fbasename,channel,ep,S,varargin) % [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...
e22a9ff2507bcf78279313acff424eef8267264e7429572aea875f98cc3d6ebf
MATLAB
2,965
68
function [decisionStumpClassifier initialweight] = decisionStumpInitialize(trainpats,traintargs,epsilonconstant,seed); % [DECISIONSTUMPCLASSIFIER INITIALWEIGHT] = DECISIONSTUMPINITIALIZE(TRAINPATS,TRAINTARGS,EPSILONCONSTANT,SEED); % % Implements decision stump weak learners. See weaklearnerinitialize_template.m f...
fce3a64c73d3eb96a90e61228bc5e96947779c3f87e7a78fcf29ce4f88e17eb1
MATLAB
2,965
83
function [subj] = shift_regressors(subj,old_regsname,runsname,nShift,varargin) % % [SUBJ] = SHIFT_REGRESSORS(SUBJ,OLD_REGSNAME,RUNSNAME,NSHIFT,...) % % Shifts regressors ahead in time to account for hemodynamic lag. % Modifies the regressors OLD_REGSNAME by shifting NTIMEPOINTS forward within % each run specified by ...
54cfcc8df8db50c4b469711f743fb6d24df795c8ed5afb266b4383d96577551a
MATLAB
2,966
84
function [analysis_complete, predictions, results, first_voxel, first_fwhm] = pSVR_check_progress_grid(sub_id, p) % function [analysis_complete, predictions, results, first_voxel, first_fwhm, first_tr] = pSVR_check_progress_grid(i_sub, p) % % Checks whether a final result file or temporary result file for the % curren...
c1d4eb0c33da675f1e3e1421554eaa202405c3c0a483e2bf6e664d5c0e17423b
MATLAB
2,967
97
function awsCopyFile_MW1(source, dest) %This function is a hack to copy files to the cloud from a Matlab Worker. %Matlab Parallel Computing Clusterdoes not have AWS CLI support (August 2019), so %we cannot use awsCopyFileFolder from a Matlab cluster. %But what if you did want to upload a file to AWS within a worke...