sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
bd013f3749d9defd102472f12e63a6de9ccba6b3d96af1647ce54e4a70f024b1
MATLAB
671
32
% SaveFet(FileName, Fet, BufSize) % % Saves a feature file function SaveFet(FileName, Fet, BufSize); if nargin<3 | isempty(BufSize) BufSize = inf; end nFeatures = size(Fet, 2); formatstring = '%d'; for ii=2:nFeatures formatstring = [formatstring,'\t%d']; end formatstring = [formatstring,'\n']; outputfile = fo...
f24d57bb9f5fb01ea2251918f95d1477fa27549df194d3fadad9157c7d4d0e07
MATLAB
671
19
function figure6(dataFolder) if(nargin<1) error('Path to data required as input argument. Data can be downloaded from link in README file.'); end % Add paths for function execution myPath = mfilename('fullpath'); basePath = fileparts(fileparts(myPath)); addpath(fullfile(basePath,'auxiliary')); addpath(fullfile(ba...
8c6ebf56fb1ea1ea8b785541c454719251ee24f1d9efb28e5170f0a671300eac
MATLAB
672
20
function [h,p] = my_sig_test(pacval, pac_shf_values, alpha) % function [h,p] = my_sig_test(pacval, pac_shf_values, alpha) % % Returns a binary value for significance 'h' and a p-value 'p', given a % value under analysis 'pacval', a distribution of values for comparison % 'pac_shf_values' and a significance level 'alpha...
f68c75dc9a852573e241732a7308f0d0bc8fa4b7f95d97ef3f67706951d26fd1
MATLAB
672
21
[sa,X] = network_simulation_beluga.getHeadModel; % Import example simulation load(fullfile(dataFolder,'simulations','synthetic_spikes','example_simulation','simulation','simulation_data.mat')); i = sa.cortex2K.in_from_cortex75K(263); eeg = network_simulation_beluga.getEEG(dipoles,sa,i); x = time(32e3:80e3); y = eeg...
f3263a427b094587e7ef2dfeb593f472fff98943df2005f96b9265741e96d25b
MATLAB
673
18
function [ensemblesToUse, outVars] = removeRepeatsFromEnsemblesToUse(ensemblesToUse,outVars) subRepeats = outVars.repeatIdentifier(ensemblesToUse); ensToUseList = find(ensemblesToUse); [a,b]=histc(subRepeats,unique(subRepeats)); removedRepeats = zeros(size(ensemblesToUse)); for i = 2:numel(a); if a(i)>1 pro...
9bfdb3d60d8f96b949fce810661378b9040564aae841c466bcbff5d4e3e68fe2
MATLAB
674
24
function [ classificationModel ] = trainCSPModel(riemannianCovarainces, final_labels, spatialFilters) %% Estimation of class prototypes features = []; for i=1:size(riemannianCovarainces,3) transformedMatrix = spatialFilters * riemannianCovarainces(:,:,i) * spatialFilters'; diago...
fe0ab3a8befc2b7094abdcd2b96070317a547407c2a5592f139e3da85a71061f
MATLAB
674
15
function [minval,idx] = mesh_get_closest_triangle_from_point(m, point, varargin) % Gives the linear index to the closest triangle of the surface specified by triangle_regions to the point. % USAGE: idx=MESH_GET_CLOSEST_TRIANGLE_FROM_POINT(m, point[, triangle_regions=1]) % Mirko Windhoff, 2010 % $Id: mesh_get_cl...
6ccee35f166cd394f07a5690a8f0516e41341af8d970c014ce123ea21fa96cde
MATLAB
676
25
%% check_repair_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 10 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; repair_tree (tree, 'none'); end end %% test 2 repair_tree (sample2_tree, '-s'); tprint ('./panels/r...
89d2a5c35ff705fd9919358788ee03ed95c9b155504ef0c5453e11ac659aa881
MATLAB
678
17
function [h,p,e1,e2]=McNemar_test(P,Y) % null hypothes: the predicted class labels P1 and P2 have equal accuracy % for predicting the true class labels Y. % h = 1 indicates to reject the null hypothesis at the 5% significance level. % h = 0 indicates to not reject the null hypothesis at 5% level. % A result is s...
e4c357009e5f9966b0ec7d213e0b1826e77f7018aacde6cac72cbd7ae7d3911d
MATLAB
678
18
function figure7(dataFolder) if(nargin<1) error('Path to data required as input argument. Data can be downloaded from link in README file.'); end % Add paths for function execution myPath = mfilename('fullpath'); basePath = fileparts(fileparts(myPath)); addpath(fullfile(basePath,'auxiliary')); addpath(fullfile(ba...
eacab48e9e446237e6858dc845133d394edcde69b6a5d84d221f23217b369286
MATLAB
678
27
%{ clear close all force warning on %load tirals info load('a0_0_bhv2trialStrct.mat'); load('a0_3_0_extractingTheMorphingDataFromAnalyze1.mat') load a0_11_insideFace load a0_15_timeOnImageAll %} IFace = isFaceImg([dataTrl.iImage])'; UMonkey = [1,3]; UMuscimol = [0]; clear inFaceTimeSumAllSum for iMonkey = 1:2 f...
2bde0b66792d9fbd84cf37d7688958b7f47f5b6a4168d248c14e8f631fcc9b66
MATLAB
679
40
function vargargout = add_DAQmx_Assembly % Add NI DAQmx .NET assembly and return true if successful % % function isAdded = nidaqmx.add_DAQmx_Assembly % % Inputs % None % % Outputs % isAdded - true if NI DAQmx assembly has been added. false otherwise % % % Rob Campbell - SWC 2022 isAdded = nidaqmx.isDAQmx_Assembly_ad...
4b987fbadb983d1a11823db48d536289d4b637570bac1c81ebad473fb14dc7e1
MATLAB
679
19
% the pattern separation toolbox: analyse spike train ensembles % Copyright (C) 2022 Alexander D Bird function [input_spiketimes] = temporally_correlated(max_time,n_trial,rate,regularity) %TEMPORALLY_CORRELATED Generates a set of spike times with correlations within trains. input_spiketimes=cell(n_trial,1); f...
0365908bc32907f47fcc9ce949addb21ff11f118df45593b96fe6bcad4f02f7a
MATLAB
680
27
%% check_Pvec_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 100 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; Pvec_tree (tree); end end %% test 2 Pvec_tree (sample_tree, [], '-s'); tprint ('./panels/Pvec_tree1', ......
594180745cdbe48579494590cab18422037eb20e2b16d2c513b8754c68a32ef6
MATLAB
680
23
function plotSlice(phas,uphas,fl,harmfields,selectedSlice) % Plot 3 Images Side by Side figure(); subplot(2,2,1); imagesc(phas(:,:,selectedSlice,5)); xlabel('x-position [voxels]'); ylabel('y-position [voxels]'); subplot(2,2,2); imagesc(uphas(:,:,selectedSlice,5));colormap(gray) xlab...
515340b46b9ffed534010777c384462d94aa317353606ec130f14c3a1e782914
MATLAB
681
25
%% check_insert_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 10000 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; insert_tree (tree, [... 1 1 30 -10 0 1 3; ... 2 1 30 0 0 1 3], 'none'); end end %% test 2 [~, ...
18eb62c8ddf72a21379292e1aa9f5ba4d1210fb32c2782f0b68c4cd33161a41d
MATLAB
683
32
% BEZAHLT Make string from number. % (scheme package) % % str = bezahlt (zahl, num) % ------------------------- % % Pads string from number num with zeros to make zahl length string. % % Input % ----- % - zahl ::integer: length of string % - num ::integer: number to be stringed % % Output % ------ % - str ...
abb98962ba4f9a53fd0fe5739dbbd76e6272811268b39d2c11bc8714ca2b77f4
MATLAB
683
28
function result = osi(curve) % do not include catch condition! % should be condition x cell % % try % assert( size(curve,1) < size(curve,2)) % catch % warning('Dim 1 of tuning curve is not greater than dim 2 of tuning curve. Make sure tuning curve is ori x cell.') % end curve = curve - min(curve); curve =...
e7a4a885f4f2055deb69fcd111cdcd1d085e78b68402855f4800a4d025692597
MATLAB
683
16
function saveFileListCache(obj) % Save the GUI recently loaded file list cache to the settings file % % zapit.gui.main.controller.saveFileListCache % % Purpose % The recently loaded file list is saved to settings YML file so it will % persist across sessions. % Updating is sufficient to...
378f0abf8cb904cac8cfb68dce5928c33250260ad63f854b4e7abd0b041b6a9d
MATLAB
688
25
function coefficients = projectTimecourse(image4d, mask, voxelSize, order) %PROJECTTIMECOURSE Project 4-D field data onto harmonic basis terms. arguments image4d mask voxelSize (1,3) double {mustBePositive} = [1 1 1] order (1,1) double {mustBeInteger, mustBePositive} = 3 end if ndims(image4d) ~= 4 ...
4de44fa79ad933286d5d8ab45b1acd45e65bf033efab2ed6bfd35096453a0fbf
MATLAB
689
24
% the pattern separation toolbox: analyse spike train ensembles % Copyright (C) 2022 Alexander D Bird function [sparsity_obj ] = calculate_sparsity(input,output) % CALCULATE_SPARSITY Calculates relative sparsity between input and output % spike ensembles n_spike_in=0; for sooth=1:size(input,1) n_spike_in=...
4fd36ba48ac0f93618cbbdf69d504e851107fbd32d7f66fafc0d9b2e8c8ce5a6
MATLAB
689
12
function fid = FilePrepDigData(logDigFile, Fs, handles) fid = fopen(logDigFile, 'wb'); % % Version 1: % fwrite(fid, 1, 'uint32'); % File version number % fwrite(fid, sum(strcmp('InputOnly', {handles.s.Channels.MeasurementType})), 'uint32'); % Num digital channels % Version 2: fwrite(fid, 2, 'uint32'); % File version ...
156b0bb57d855d2aaf8ab7dc71181cd3e64c8c2ee27327e9c9c5c79c7da8074f
MATLAB
690
16
% the pattern separation toolbox: analyse spike train ensembles % Copyright (C) 2022 Alexander D Bird function [spiketimes]=voltage2times(voltage_trace) % Converts a voltage trace to a vector of spike times using the findpeaks function of the signal processing toolbox. warning('off','all'); ts=voltage_trace(1,:...
0a22284b22dd48d22a06a1af37ca4895d28a88e97c5f9276ed8b33d2f87a9fea
MATLAB
691
28
%% check_sort_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 10 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; sort_tree (tree, '-LO'); end end %% test 2 sort_tree (sample2_tree, '-s'); tprint ('./panels/sort_tree1', ...
6e705627927a9c4c1672fbbc4506def63be6d1f0159aed38ae68c6a78c2344b4
MATLAB
693
24
function setWindowTitle(obj) % Set Zapit window title text and report here if a new version is available % % function zapit.gui.main.setWindowTitle % % Purpose % This function can be run not only at startup but also regularly % to report to the user when a new version is available. % ...
0fcc975c4d0b7be41e7f01c1225d7e35f60a5bbe4364692d891972262a45b15a
MATLAB
694
18
function f = LK_RippleRatesHistogram_20220321(cfg) % % LK_RippleRatesHistogram_20220321 creates a histogram figure showing the % ripple rates across channels. % % Output is a figure handle. % % Lukas Kunz, 2023 % create figure f = figure('units', 'centimeters', 'position', [2, 2, 6, 6]); axes('units', 'centimeters', '...
22d2c2ac0e1be9abd229fddacf7a101ff5efdc7a19f48dff10b67f6814792acb
MATLAB
695
26
clear; clc; simDir = pwd; % set path... addpath(genpath('./code')) % download required toolboxes download_toolboxes('toolbox_urls.txt', 'code/toolbox') %% download results file from OSF % https://osf.io/3gwhz/files/osfstorage %% set project name simName = 'paperSim'; resultsDir = fullfile('results',simName); sessio...
d1944343defe6126add23c692104de4736de984726595300eab1af00f66bd451
MATLAB
698
30
function save3DImage_uint16(vol,path) if max(vol(:))>intmax('uint16') fprintf('Warning: some values to be saved at %s are over uint16 maxval\n',path) end if min(vol(:))<0 fprintf('Warning: some values to be saved at %s less than 0\n',path) end if endsWith(path,'.tif') %This is a wrapper function around...
e5cfaa298efe6c7ed0efa648c8673a60ccfbbb6093693c7f48cda81bdb4c9218
MATLAB
699
18
function loadRecentConfig_Callback(obj) % Load stim config on button press % % zapit.gui.main.controller.loadRecentConfig_Callback % % Purpose % Loads stim config from list of previously loaded files. % Will run loadStimConfig_Callback, so there are not issues with redundant code. % ...
7e5be9b6dec1c019f626e8054d1a8eec4c39ed7a46355d952fe596def3815f17
MATLAB
700
23
% Used to permute back from pervious permutation from permute_dims % INPUT % in: MRSI structure that was permuted % prev: prev array from premute_dims % % OUTPUT % out: permuted MRSI structure function MRSIStruct = reshapeBack(MRSIStruct, prevPermute, prevSize) data = getData(MRSIStruct); data = reshape(data, ...
308f478459ceb11ff73d1539b30097239b7d87a965834cdabff8fd7338ef614a
MATLAB
705
17
% Set the path of the 'GT Masks' folder, which contains the manual labels in 3D arrays. dir_Masks = '..\demo\data\GT Masks\'; %% dir_all = dir(fullfile(dir_Masks,'*FinalMasks*.mat')); for ind = 1:length(dir_all) filename = dir_all(ind).name; if ~contains(filename,'_sparse') disp(filename) load(...
49405ca35e3ba3e89b30cc0fcb4fe3899e0879db91c9a316b87e5de04cf0fb9a
MATLAB
712
20
function [baselines] = baseline_creator_v3(slices,avg_factor) for i = 1:length(slices) D = diff(slices{i}(:,4)); CV = abs([D ; 0]) >= 0.01; % change vector, marks the position where the changes in hydrogen concentration occur (marks the last point before the change) j = 1; while CV(j) == 0 j =...
3d99c90e9e0011fbe3c502ad0d94cd871cbda46943a0fd416815d5568829318d
MATLAB
715
21
% EDIT ONLY THIS % filename='m4_social_nostim'; load(strcat('E:\Dropbox\MATLAB\DEISSEROTH\mfp_fear\data\20150811\',filename,'_000_signal.mat')); load(strcat('E:\Dropbox\MATLAB\DEISSEROTH\mfp_fear\data\20150811\',filename,'_000_reference.mat')); sig_plot=sig(1:end-1,:); ref_plot=ref(1:end-1,:); figure(1); subplot(2,1...
f299d60f8ef369fb678e06e62849bb10caee27c5727ea0992bc9ffe7e85b795a
MATLAB
715
27
%% check_loop_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 100 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; tree.Ri = 100; tree.Gm = 1 / 2500; tree.Cm = 1; loop_tree (tree, 1, 100...
f5e02186bfceca36526fdc91265eb2690fd11b8ef54e0704c24c451c1ee15bbe
MATLAB
723
20
function figure6(dataFolder) if(nargin<1) error('Path to data required as input argument. Data can be downloaded from link in README file.'); end % Add paths for function execution myPath = mfilename('fullpath'); basePath = fileparts(fileparts(myPath)); addpath(fullfile(basePath,'auxiliary')); addpath(fullfile(ba...
b954cf5d467780863e85f588a6e93cb789e5eb063989731fb6f5bbf11e097ec2
MATLAB
725
20
% Set the path of the 'GT Masks' folder, which contains the manual labels in 3D arrays. dir_in = 'D:\ABO\20 percent 200\complete\output_masks\'; dir_out = 'D:\ABO\20 percent 200\SUNS_complete Masks\'; if ~exist(dir_out,'dir') mkdir(dir_out) end %% dir_all = dir(fullfile(dir_in,'*Output_Masks*.mat')); for ind = 1:l...
cdd54d91bb6c4af7bfd1213333b8ce91d1f30ac8777694451404b674c8354c33
MATLAB
725
19
% remove callbacks sendsetup = arrayfun(@(x) strcmp(x.UserFcnName,'live2pSendSetup'), hSI.hUserFunctions.userFunctionsCfg); if any(sendsetup) hSI.hUserFunctions.userFunctionsCfg(sendsetup) = []; end acqdone = arrayfun(@(x) strcmp(x.UserFcnName,'live2pAcqDone'), hSI.hUserFunctions.userFunctionsCfg); if any(acqdone)...
73be5517a29fc1f154f14b3fe451314eeafff857986188038dfc4eb40b81ffc5
MATLAB
727
31
function B = RemovePhaseDiscontinuity(A) %% Remove phase discontinuity in matrix A from center % A is a matrix with phase in a range of -pi to pi % B is a matrix without phase discontinuity % % % YC at ES lab % Created on Jan. 27, 2020 % Last modified on Jan. 27, 2020 %% Parameters Width = size(A,2); Hei...
d9a1da5abc254ff7c7a89f3496d58d553f4369753ecae51b6061fd1ab2ad1da3
MATLAB
727
15
function [ valid_neurons_indices ] = find_head_direction_neurons(spike_rate_mat_neuron_by_angle) global CENTER_OF_ANGLE_BINS FIRING_RATE_THRESHOLD RAYLEIGH_VECTOR_LENGTH_THRESHOLD; number_of_neurons = size(spike_rate_mat_neuron_by_angle, 1); max_firing_rate_per_neuron = max(spike_rate_mat_neuron_by_an...
9da84cfae3150be475ef11b7db1446370c2c312e1dfcbc2c30a0491c36c24fc4
MATLAB
729
34
function saveLaserFit(obj) % Save the laser fit object to the user settings directory % % zapit.pointer.saveLaserFit() % % Purpose % Saves the laser fit to a .mat in the settings directory. % % Inputs % none % % Outputs % none % % Rob Campbell - SWC 2022 % ...
50e9b42392d2dd530eab23042a40427b78e91c0211ab8a841f079a081044da6e
MATLAB
730
46
function a = fftnc(a, N, doShift, doScale); % Calculates the multidimensional fft of a matrix with DC at the % center of the matrix. % % Inputs: % a: input matrix % N: do fft's along first "N" dims % % Outputs: % A: output matrix % % (c) Corey Baron if(nargin<4) || isempty(doScale) doScale = 1; end if(nargi...
45a79b0d9ac16e8f0d51424dd043fcede006eee225a4779cd01c12b92bb4bb09
MATLAB
731
71
%% 2022-2023 % sub-MC14 % sub-MC15 % sub-MC16 % sub-MC18 % sub-MC23 % sub-MC24 % sub-M12 % sub-M13 % sub-M14 % sub-M20 % sub-M23 % sub-M32 % sub-M35 % sub-M36 % sub-M38 % sub-M39 % sub-M40 %% 2021-2022 % sub-M01 % sub-M02 % sub-M03 % sub-M04 % sub-M05 % sub-M06 % sub-M07 % sub-M08 % sub-M09 % sub-M10 % sub-M11 % sub-M...
2eb7bea7bf5b32a2f3c2a29b1205a248ea4887ab5cc4e598323d799b59d41fe5
MATLAB
732
22
%% Example MATLAB v2 fMRI phase pipeline. repoRoot = fileparts(fileparts(mfilename('fullpath'))); addpath(fullfile(repoRoot, 'matlab')); addpath(fullfile(repoRoot, 'matlab', 'vendor', 'tapas_physio')); cfg = fmriPhase.config(); cfg.phaseFile = "/path/to/sub-01_task-rest_part-phase_bold.nii"; cfg.magnitudeFile = "/pat...
b627da9e40cfab261a648f3d89741ed096322162aaf1011f4ce62194ea1fdc32
MATLAB
732
15
function pEffect = BoutEffectPval(periBout, periStat, periParam, fieldName) pEffect = nan(size(periStat.(fieldName).effect)); tempEffect = nan([size(periStat.(fieldName).effect), periParam.Nshuff]); for s = 1:periParam.Nshuff tempStat = BoutEffect(cellfun(@ScrambleColumns, periBout.(fieldName)...
84d9235b6b89c6554bf18621a84e41da0e889956d9cb4aceb5fb15518dbafb3d
MATLAB
733
45
function a = ifftnc(a, N, doShift, doScale); % Calculates the multidimensional ifft of a matrix with DC at the % center of the matrix. % % Inputs: % a: input matrix % N: do fft's along first "N" dim % % Outputs: % A: output matrix % % (c) Corey Baron if(nargin<4) || isempty(doScale) doScale = 1; end if(narg...
81b12a5326aa73b3242d19fbf18ed4af51fba09e638f7a9fdd208a59e6251ae7
MATLAB
743
27
% Rather than two runs of 50 trials, let's do one run of 75 trials % This script generates that input. % load run1 load('run1.mat') ntrials = length(run.isi1); % 50 trials to start newtrials = 25; % adding 25 trials % keep uniform distribution of conditions cond = [1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5]';...
8b73585794c15a278a3f85c85c27304d64213f23b05afd24db64209640ae9367
MATLAB
743
19
function f = LK_ArtifactFractionHistogram_20220321(cfg) % % LK_ArtifactFractionHistogram_20220321 creates a histogram figure showing % the artifact fractions across channels. % % Input is a structure with multiple fields. % % Output is a figure handle. % % Lukas Kunz, 2023 f = figure('units', 'centimeters', 'position'...
71bc3a5e4f13a3389576f8784c8c27e1f32fcd4a644b7caccd8d297528b5897f
MATLAB
744
26
function result = merge_struct(p, s, donotmerge, deep) import zapit.yaml.*; if ~( isstruct(p) && isstruct(s) ) error('Only structures can be merged.'); end; if ~exist('donotmerge','var') donotmerge = {}; end if ~exist('deep','var') deep = 0; elseif strcmp(deep, 'deep') ...
c5a375ba2d1b93ba463f01aea0f3a395417d630d656bfb3545039312986b5c92
MATLAB
746
42
function sff = sffTrack(sff) %SFFTRACK track and clean % input and output: sff structure % % Raphael Sarfati % raphael.sarfati@aya.yale.edu %% launch tracking if ~sff.prm.flag.trk disp([datestr(now,31) ' -- Tracking started...']) sff = sff_fffabc(sff); % flag; return to workspace ...
95015a6f664ad751e38eec6b111b0803a47d8509d4321d3d71f1bc9ba4482833
MATLAB
747
18
% EDIT TREE % % functions to edit a tree % % Files % cat_tree - Concatenates two trees. % delete_tree - Delete nodes from a tree. % elim0_tree - Eliminates zero-length segments in a tree. % elimt_tree - Replace multifurcations by multiple bifurcations in a tree. % insert_tree - Insert a number ...
e6b257b8723ed53b2d2ad10cbb2778ebe9c4ffc34e75662d0f2dd725d11b2532
MATLAB
747
46
%% secs2hms % % Convert time in seconds to hours/minutes/seconds % % <matlab:open('secs2hms.m') code> % %% Syntax % % [h,m,s] = secs2hms(t) % %% Arguments % % _input_ % % t time in seconds % % _output_ % % h hours % m minutes % s seconds % %%...
314bb325b2f001df1e98003038b94e5a3e06e72181fee191b2f4a27ba3f155ee
MATLAB
748
21
function MakeDeformPlot( deformData, deformName, TL, Xticks, Yticks, varargin ) if nargin == 6 deformLims = varargin{1}; else deformLims = [min(deformData(:)), max(deformData(:))]; end if size(deformData,2) == 1 plot( deformData ); ylabel(deformName); ylim(deformLims) else imagesc( de...
516d56fb5bb7f3512bd4f31752a6265e7d6936dc0a26309edf3412760cb01059
MATLAB
750
20
% Path to the SBX file to be z-projected input_sbx = 'D:\2photon\Simone\Simone_Neutrophils\NaVAi6-1\211008\009\NaVAi6-1_211008_009.sbxfix'; % which planes to project? zProj = {11:15, 19-23}; % max or mean projection? (default = 'mean') projType = 'mean'; % which channels? ('both' will try to project both separatley...
44dd17f61b7b234b5296a2496f02d9c47cd9426cc964d1e119965a20e2326f01
MATLAB
751
35
function dff = grabCommonVoxels(DT,targetTmodel) % need 3 models for now % grab common voxels across all three models and filter it out df = []; params=[]; sj = unique(DT.subjID); for tm = 1:3 params.tmodel = targetTmodel{tm}; df{tm} = tableFilter(DT,params); end %% tmp=[]; for tm = 1:3 tmp{tm} = table(...
91f5bc1abe07c5cb8cd6f383c90ebdf87bba5a7eec53b17aeaef77cba6c8ff0d
MATLAB
751
32
%% check_lego_tree %% test 1 clf; hold on; shine axis off dLPTCs = load_tree ('dLPTCs.mtr'); for counter = 1 : length (dLPTCs{1}) display (counter); tree = dLPTCs{1}{counter}; lego_tree (tree, 15); end %% test 2 clf; lego_tree (sample_tree, 15); plot_tree ...
c70b6a338e854b232c637ebaa0205c9d52bae7351f03cbc68cbc144440ea8f11
MATLAB
751
19
function spmGlobalVariable = addMRSIOverlayToSPMCallback(spmGlobalVariable, functionName) arguments spmGlobalVariable (1, 1) struct functionName(:, 1) char end spmCallbackList = spmGlobalVariable.callback; if(ischar(spmCallbackList)) %create cell array and add overaly() callback ...
3db8714cfdee25a0013a946f57013df1468b91ddc8b26b48a681dae5b750d8e6
MATLAB
753
30
%% Documentation and Examples %% % % <html><h2>Image data</h2></html> % % * <./id_md.html Image metadata quick start guide> % * <./id_ri.html Raw images quick start guide> % * <./id_pp.html Preprocessing quick start guide> %% % % <html><h2>Processed Images</h2></html> % % * <./pi_CellScan.html |CellScan| quick start ...
d04a5c140821bc61787551f4b0d4d13f05fbb02b3a5a12ef5276b006429b565c
MATLAB
753
26
function [All, results] = cellExcluder(All,opts); if ~isfield(opts, 'peakThreshold') opts.peakThreshold =0; end numExp = numel(All); for ind = 1:numExp dat = All(ind).out.exp.dataToUse; sz=size(dat); dat = reshape(dat,[sz(1) sz(2)*sz(3)]); meanDat = mean(dat,2); maxDat = max(dat,[],2); ...
a985aaa4c6196f777172b5a2563de35b2a4085fe89631671cce54357de115147
MATLAB
755
33
function setExperimentPath_Callback(obj,~,~) % Set the experimentPath property in zapit.pointer % % zapit.gui.main.controller.setExperimentPath_Callback % % Purpose % Set the experimentPath property in zapit.pointer. Whilst this variable % is set, the zapit.pointer.sendSamples command will l...
0159aec277b5c840a661c4584c621deaa17be1926aacfad88febecf73a710ec8
MATLAB
758
32
% msave - save an integer matrix in an ascii file % % msave(filename,matrix,writemode) % function msave(filename,matrix,writemode) if (nargin<3) writemode = 'w'; end [m,n] = size(matrix); bufsize = 1000; if m > bufsize nblocks = ceil(m/bufsize); for i=1:nblocks ind = [(i-1)*bufsize+1: min(m,i*bufs...
2ccbac062cf2fde7b30812006da3131745c9e917bea67889d7402c346426c635
MATLAB
759
29
function Y = gampdf(X,A,B) assert((isequal(size(A),size(X)) && isequal(size(B),size(X))),'X, A and B must be of common size or scalars'); sz = size(X); Y = zeros(sz); k = find(~(A > 0) | ~(B > 0) | isnan(X)); if any(k) Y(k) = NaN; end k = find((X > 0) & (A > 0) & (A <= 1) & (B > 0)); if any(k) if isscalar(A...
345b9e0e6d9a9bfd355695321f2d51169fb00c43a98825320c2d8f733ab23a6c
MATLAB
759
30
function [W,Em,N,c,E,EE]=MWASD(X,Y,p,nmax) % function for finding the optimal hidden-layer neurons weights of the % neuronet % Initialization N=[]; c=[];% the neurons number of the hidden layer (i.e., hidneurons) Em=inf; E=zeros(nmax+1,1); Ev=zeros(4,1); EE=zeros(nmax+1,1); [G,M]=size(X); G1=round(p*G); % size ...
50fb4344cdc2b541b708d5839855a7d2bcb03de1117a81043444f182efefe4a3
MATLAB
759
23
function vec = LK_idx2vec(mat) % % LK_idx2vec converts an m x 2 matrix of start and end indices (first and % second column of the matrix, respectively) into an 1 x n vector % containing all indices between the respective start and end indices. % % LK_idx2vec is different from LK_idx2log. % % Lukas Kunz, 2021 % check i...
c578db7221f50b5f87534a458a68e5c6762ad29f3e20574d2b2490c7233e7f26
MATLAB
759
19
% IO FUNCTIONS % % input and output % % Files % load_tree - Loads a tree from the swc/neu/Trees format. % neurolucida_tree - Loads a tree from the neurolucida ASCII format. % neuroml_tree - Export tree to NeuroML format. % neuron_template_tree - Export tree as NEURON file. % neuron_tree...
1545e71b2178929e0a9a523772937ee527a2584632cc391f7d9613200afb0767
MATLAB
760
22
% the pattern separation toolbox: analyse spike train ensembles % Copyright (C) 2022 Alexander D Bird function [input_spiketimes] = phase_locked(max_time,n_trial,rate,amplitude,num_phase) %PHASE_LOCKED Generates a set of spike times with sinusoidally varying rates. dt=0.001; input_spiketimes=cell(n_trial,1); f...
83bfe37803bc394ae441a2c33a7ea51ffee9180718208639784b85378b8c6792
MATLAB
760
25
function [intra_conn, inter_conn, intra_conn_av, inter_conn_av, intra_conn_norm_av] =... get_InterIntraModulesDensity(net, comm) N = size(net, 1); NC = length(unique(comm)); clust_lab = unique(comm); intra_conn = zeros(NC, 1); inter_conn = zeros(NC, 1); for i=1:NC intra_nodes = find(comm==clust_...
4a579cfa77fc96e6075f66159d6d919001ae50952ec8ee30d07194c4c18a0b9c
MATLAB
761
38
% HISTAX Corrected histogram counts. % (scheme package) % % yax = histax (x, xax) % --------------------- % % Produces correct edges for binning in order to plot yax against xax. % % Input % ----- % - x ::vector: x values % - xax ::vector: x values of bin centers % % Output % ------ % - yax ::vector:...
beb9ee8ed16821ff6ab380d8b118fa9dd2f475c3e628cb30301263f366f3875e
MATLAB
761
29
function setLaserInMW(obj,mW) % Set laser to a value specified by the user in mW % % function zapit.pointer.setLaserInMW(mW) % % % Purpose % User supplies value in mW. This is converted to a control value % and applied to the laser. % % Inputs % mW - (scalar) laser power in m...
de5305ce8c93b6c468dd14993978a51f5b5ccc545364b6a84132c1312ea19199
MATLAB
761
16
function keysForLeaveOut = GetKeyLeaveOut(StimuliLabel,contextLabel,MouseIDs,sessionNum,LeaveOut) LeaveOut = lower(LeaveOut); if strcmp(LeaveOut,'mouse') keysForLeaveOut = MouseIDs; elseif strcmp(LeaveOut,'session') keysForLeaveOut = cell(1,length(MouseIDs)); for k=1:length(keysForLeaveOut) ...
3bd0a70028f1ccc3c9d60b3da4d6be936f013dca1b54aea76803bc57a72f8e8f
MATLAB
763
1
% List of rect functions in PsychToolbox % % AdjoinRect.m % AlignRect.m % ArrangeRects.m % CenterRect.m % CenterRectOnPoint.m % ClipRect.m % InsetRect.m % IsEmptyRect.m % IsInRect.m % OffsetRect.m % RectBottom.m % RectCenter.m % RectHeight.m % RectLeft.m % RectRight.m % RectTop.m % RectWidth.m % ScaleRect.m % SetRect.m...
0d235fba83d9f424328cb87d39ab4182789bf8badbc11fe93e22ee664ae2fe0e
MATLAB
766
27
function DT= tableRemoveHRFDuplicateCoords(hrfTable) DT=[]; for s = unique(hrfTable.subj)' for r = unique(hrfTable.name)' params.subj=s; params.name=r; newDT = tableFilter(hrfTable,params); tmpDT = []; tmpDT.subj = repmat(params.subj,length(cell2mat(newDT.coords)),...
b82c4079e3025ebcc8d4bace814d745da5df8769e280b05e27f7f93dbb00ce74
MATLAB
766
24
% interpolate the blank cladding between cores % last modified 2022-08-20 % by Peisheng Ding (peisheng.ding@mpi-halle.mpg.de, peisheng.ding@mail.utoronto.ca) function [Xq, Yq, vq] = Interpolant_cladding(getX, getY,pppp) %-----------------------------------sacttered Interpolation-------------------------------...
31e98ca479891511e26108ee5592182815b9f7f885e001f776a76ade4f666259
MATLAB
767
29
%% check_cplotter %% test 1 clf; HP = plot_tree (sample2_tree, [0 0 0], [], [], [], '-b1'); for counter = 1 : 3 c = hull_tree (sample2_tree, 4 * counter, [], [], [], '-2d'); HP = cplotter (c, rand (1, 3), ... [(1.5 * counter) (2 * counter) counter]); set (HP, 'linewid...
40fc3cdbc0a0caa0bdc288e83fcc78622afd51b32a20136b4997a2fc4460a1da
MATLAB
769
30
function plotScatterRmse(y,r,t) if size(y,2)>size(y,1) y = y'; end if size(r,2)>size(r,1) r = r'; end figure; hold on; mn = floor(0.9*min([y;r])); mx = ceil(1.1*max([y;r])); % plot the prediction plot(mn:mx,mn:mx,'b--'); plot(y,r,'r.','MarkerSize',10); xlabel('a...
1bed1a39c585b33a4004392871d888d70b65d043b8a10b0ccade852f03c486da
MATLAB
776
32
NFig = [2,5,13,28,29,31, 41,45,60,63,65,72,90,104,107,115,122,34,38, 12]; nFig = numel(NFig); figFinal = figure(100); clf NAx = [3, 2, 5]; iSubPlot = 0; for iFig = 1:nFig fig1 = figure(NFig(iFig)); for iAx = 1:3 iSubPlot = iSubPlot + 1; if mod(iSubPlot,7) == 4 iSubPlot = iSubPl...
5e683d965661c2c6aaeaab5ec2653461019ad3ef01702b86d0e69b39f6698576
MATLAB
781
1
function [cnt, err] = checkRange(in,small,large) % %AUTHOR: Wandell, Baseler % %ARGUMENTS: % in: vector of values to check % small: Either a number or a vector of length equal to in % large: Either a number or a vector of length equal to in %RETURNS: % % cnt: number of values out of range % err: 2 x length(in) mat...
c42046f193123f61d88b97805367b0ba1fe642748048c492a10dfb47dde23be5
MATLAB
782
36
function exportWaveforms_Callback(obj,~,~) % Export all the DAQ waveforms for this stim config file as a .mat file % % zapit.gui.main.controller.exportWaveforms_Callback % % Purpose % Allows users to present stimuli in a piece of external softare and % not use the Zapit API at all for prese...
a1f2f77a6acd253ab986b2a9232485bcbbb3417e42d4baf40219f34e2b7a799d
MATLAB
784
34
function out = bload(fname, arg1, startpos, datasize, skip) % loads a binary file % % usage: bload(fname, [NumChannels SamplesToLoad], startpos, datasize, skip) % starts reading from startpos BYTES into the file (not samples) % datasize defaults to 'short=>double' % % final argument "skip" allows you to repeatedly ski...
2de1638ba4aadde2bea2d13e273d47d8391e2c183d09a324c3e1522608af49fc
MATLAB
785
25
function removeMissingRecentConfigs(obj,~,~) % Remove from previously loaded stim config list any files that no longer exist % % zapit.gui.main.controller.removeMissingRecentConfigs % % Purpose % Searches through the list of previously loaded configuration files. % Removes any that are no lo...
bc2b7903b324e1131645f4ea04efa4071a6587a4d80a6733ed874c609c7b66e7
MATLAB
785
33
% test out the nidaq by driving TTL pulses on a digital clock fs = 2000; framerate = 20; devices = daq.getDevices(); dev = devices(1); s = daq.createSession('ni'); s.Rate = fs; s.IsContinuous = true; camCh = s.addCounterOutputChannel(dev.ID, 1, 'PulseGeneration'); disp(camCh.Terminal); camCh.Frequency = framerate; ...
361f6eaad462097c5cf8b7c727c164f098c2eb60b90db0bcf2b763ca464fd188
MATLAB
786
28
function y = energyvec(f,s,Fs,width) % function y = energyvec(f,s,Fs,width) % % Returns a vector 'y' containing the power of signal 's' filtered for % frequency 'f' (via convolution with a complex Morlet wavelet described % by 'width') % % INPUTS: % f - frequency to filter at % s - signal to be filtered % Fs - sampli...
8055dae28a8020557079cb5d91552263706509d150c1e5ddcdefad8d700b4332
MATLAB
789
21
function [blurriness blurFlag] = checkBlurriness(imgNeuron_store,blurThresh) % % This function checks if the input neuron image is blurry % % Input 16-bit neuron image and return 1 if the blurriness of the image(calculated by % % taking fft of the input image and taking the average of the 45% ((2/3)^2) highest fre...
00cbf982e777ca4232988864d82035fe2202aff60e214e70b80852347d5e0c65
MATLAB
792
21
function [new_img_R, new_img_B] = background_sub(Image, vq_R, vq_B) figure(10) imshow(vq_R,[],'InitialMagnification','fit') title('circle a region for background substraction') %function of selected interested region for background substraction Selected_background_Region = ROI(vq_R); back_mean_R = mean2(vq_R(log...
07a39dd87e6be84e05445aaec87b5872f7cbb84dba51f74d54d676128bf46bc1
MATLAB
792
25
function res = listMetRxnsWithFluxes(model, sol, met, consumption, lowerLimit) if nargin < 5 lowerLimit = 0; end mets = strcmp(model.metNames,met); SMultFlux = model.S(mets,:) .* sol.x.'; if (consumption) rxns = sum(SMultFlux < -lowerLimit, 1) > 0; SMultFluxNeg = SMultFlux(:,rxns); SMultFluxNeg(SMultFlu...
4bc7b7c6b001e8c9fc7a6963e3b90bcd0bf7227d64528d11089d2bad7e41b9a8
MATLAB
792
28
#!/usr/bin/env octave # Script to generate PALM permutation indices for HCP data # ======================================================== # # cf: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/PALM/ExchangeabilityBlocks#EBs_for_data_of_the_Human_Connectome_Project # # Requires: # - hcp2blocks.m # - PALM # - restricted HCP d...
b5839060cfb781f594bdfabb89ac771128d39e2c2cb4074b493b131e740b6d7a
MATLAB
806
30
%% check_asym_tree %% test 1 Tasym = []; Lasym = []; dLPTCs = load_tree ('dLPTCs.mtr'); for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; Tasym = [ ... Tasym; (asym_tree (tree, T_tree (tree), 'none'))]; Lasym = [ ... ...
655750cf5fd404cfcb840476f47cec10e8fd7e2ac6fe57bb179e21ad631722ae
MATLAB
807
36
clear load('../data/2020_07_connectomes90_AllFC.mat') rng(42) ss = readtable('../data/subs_pop_release3.csv'); ss = table2cell(ss); is_sub = zeros(1,size(sub,2)); tes = zeros(1,size(ss,1)); for i = 1:size(sub,2) if any(strcmp(ss(:,1),sub{i})) && any(strcmp(ss(:,2),ses{i})) tes(fi...
cfec9af0651d99a14a2293950a9d047b7f6bcc1494570c9a8cf7b3db5f571580
MATLAB
807
27
clear all close all unifyContextClasses = false averageAllBoutsFromSession = false TakeJustTheta = false TakeJustGamma = false matlabImpute = false imputeIters = 80 NumTrees = 80 usedMouseId=[] substractMouseMean = false LeaveOut = 'mouse' balanceClasses = false; classes6 = {'Social','Object','Isolated...
70820ee77b360c5126b790e60c16fff3602fdc71051bb99dfb2cf99532c20a43
MATLAB
808
31
function desktopPath = getDesktopPath % Return absolute path to user's Desktop folder % % function desktopPath = zapit.utils.getDesktopPath % % Purpose % Return the user's desktop path. Used for example and demo code. % Cross-platform. Returns home directory if for some reason it can % n...
af383e95f19048cb05de167dd5efe65ebb2f3f8a03e2ca041f724ecbdaf1a1d7
MATLAB
808
33
%op_CSIAverage.m %Brenden Kadota, Sunnybrook, 2021 % % USAGE: % [out]=op_CSIAverage(in); % % DESCRIPTION: % Averages CSI FID-A structure along average dimension. % % INPUTS: % in = Input CSI FID-A structure % % OUTPUTS: % out = Averaged CSI FID-A structure function MRSIStruct = op_CSIaddNoise(MRSIStruct, sdnoise, n...
9460e35410038f7d4309e0c54a17bb778f4ab71ae491e8d78fc33bd8794998fe
MATLAB
809
26
dblist=dir('Database_*.mat') Data_Succ=zeros(length(dblist), 3); Data_Dur=zeros(length(dblist), 3); Data_pval=zeros(length(dblist), 2); for i=1:length(dblist) load(dblist(i).name); for j=1:length(MotorSynth) temp=[]; cnt=1; for k=1:length(MotorSynth(j).LTAdur(:,1)) ...
524a219f14388d0b0705ef59fde3c8e28d038ed8e4ecd3cf30891c4dbfaec988
MATLAB
811
28
function zPaths = findZapitPathsInMATLABpath % Find all paths associated with Zapit in the MATLAB path % % zapit.updater.findZapitPathsInMATLABpath() % % Purpose % Search through the MATLAB and return all paths associated with zapit. This is % to look for multiple installs and also to look f...
f8e1bbf6c812a71677f51419f03bc8f5364741d2e413549a5a31d460b3d2e69d
MATLAB
813
24
function fov = getFov(MRSIStruct, dimension) switch(lower(dimension)) case 'x' fov = MRSIStruct.fov.x; case 'y' fov = MRSIStruct.fov.y; case 'z' fov = MRSIStruct.fov.z; case 'kx' xCoordinates = getCoordinates(MRSIStruct, 'x'); ...
8258031d06aec1a12515eb2e6be795b3efeb5e5577760dcec437a65cd7fea3ff
MATLAB
814
27
function installPath = getInstallPath % Get the install path for the Zapit package % % zapit.updater.getInstallPath % % Purpose % Return the path to the package install. This is used for reporting to the % user this information and also for house-keeping tasks related to keeping % the in...
351ba4c485333c06c73012b041f50bffa5a18da248883dd775d0d8eb59223fe5
MATLAB
815
23
function prettifyAxes(hAxes) switch hAxes.Type case 'colorbar' set(hAxes, ... 'Box' , 'off' , ... 'TickDir' , 'out' , ... 'TickLength' , [.02 .02] , ... 'XColor' , [.3 .3 .3], ... 'YColor' , [.3 .3 .3], ... ...
b35098af5f0fe18d4d72c56580c7a15032ffe93091d8012a53181e4369c58f55
MATLAB
816
36
%% check_child_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 100 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; child_tree (tree); end end %% test 2 child_tree (sample_tree, [], '-s') tprint ('./panels/child_tree1', ......
aa804f5f45a08f330ef056982c7e1c9ce2861868f19f2a18783f154392874f8b
MATLAB
817
25
function res = listMetRxnsWithFluxes(model, sol, met, consumption, lowerLimit) if nargin < 5 lowerLimit = 0; end mets = strcmp(model.metNames,met); SMultFlux = model.S(mets,:) .* sol.x.'; if (consumption) rxns = sum(SMultFlux < -lowerLimit, 1) > 0; SMultFluxNeg = SMultFlux(:,rxns); SMultFluxNeg...
bf8b86070eb7285b5caf915cb4eb265a0aa65731bcbd7ba8e1cf93f5b00133b0
MATLAB
818
29
function testFiltering % Test a convolution for generating the smoothed scanner waveforms instead of the % ad-hoc linspace thing nSamples = 100; wavForm = [ones(1,nSamples), ... ones(1,nSamples)*2, ... ones(1,nSamples)*1.5]'; clf kernelLength = 8; filtWav ...
172fe08535fcd95ce7c8849a15d484bb1c6ac2f507067943f446190c1e9363a1
MATLAB
819
39
function analogOutput_Finite % Play one cycle of a waveform out of an analog output using the on-board clock % % function daqtoolbox.AO.analogOutput_Finite % % Instructions % Connect AO0 of NI device Dev1 to an oscilloscope and run this function. % % % % Rob Campbell - Basel 2016 % % See also; % vidrio.AO.hardwareFini...
6844d6be00f8642ad8b5f82ec2559addc2dfc230711190d387f7d933c63b7d63
MATLAB
819
26
function CSPMatrix = estimate_spatial_filters(riemannianCovarainces,final_labels, numSpatialFilters) unique_labels=unique(final_labels); Nclass=size(unique_labels, 2); Ntrials = zeros(1, Nclass); %% Estimation of class prototypes classPrototype = cell(Nclass,1); tic for i=1:Nclass ...