sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ad90217441ae54612fec338065eecb22e1e03459feddda758444a5de6c0e6cf4
MATLAB
1,048
25
function mask = choose_mask_circle(self, imgType) %choose_mask_circle - Protected class method to choose an individual % circular mask % Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al. % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU Ge...
6ef1c24ca1ac20a81607808787578ad868a9cfbe27aff3536be38bfa6ad71ba1
MATLAB
1,049
44
%% check_dendrogram_tree %% test 1 clf; hold on; axis off dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 10 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; dendrogram_tree (tree, [], [], [], [], 1, '-p'); end end tprint ('./p...
0bca1c471840fc5ae9ab76a9ca5789599f8b5fdf4e305a31838055fd7b8afbe1
MATLAB
1,050
43
%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_CSIAverage(MRSIStruct) flag ...
efb8cc60014a5c9a9d689f3a0d2b219b530c51246b63f533446dad6b07eb622f
MATLAB
1,050
31
%function [EvtRes, EvtClu, EvtLabels, Labels] = LoadEvt(FileName,SampleRate, Labels) % loads event file (.evt) produced by neuroscope (see manual of neuroscope) into vectors of time (EvtRes) and type (EvtClu) of events, EvtLabels are stored in cell array EvtLabels. Labels contains unique set of all existing labels. ...
a3015544918897f978a02129cf9f48b24d1d82864b370970c7dda2f63a2f4a02
MATLAB
1,054
60
function [x, y]=bresenham(x1,y1,x2,y2) %Matlab optmized version of Bresenham line algorithm. No loops. %Format: % [x y]=bham(x1,y1,x2,y2) % %Input: % (x1,y1): Start position % (x2,y2): End position % %Output: % x y: the line coordinates from (x1,y1) to (x2,y2) % %...
0c7ac84c890163f6416fbd6df83d63170a3daa442a620ad1eb47b2f1d4c2afd4
MATLAB
1,056
35
%facePoint 1:16 around the face % 17:forehead up, 18:nose up, 19:nose down, 20: mouth middle % 21:left eye, 22:right eye, 23:left nose, 24:right nose 25:left mouth, % 26:right nose clear close all load('a0_3_0_extractingTheMorphingDataFromAnalyze1_facePoints.mat', 'facePointAll') %load('a0_0_bhv2tri...
38a4d5fb1000138f46315899966481dab1beffbc9ea3217b6b0d756f2312ce9d
MATLAB
1,056
25
% EEGfMRIPav_GLM3B_labels.m % Create labels for each contrast of GLM3B. % % EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN. % J. Algermissen, 2018-2023. % Should work in Matlab 2018b. % we are here: % cd /project/3017042.02/Analyses/fMRI_Scripts/Display_Results/ % clear all; close all; clc GLMlabels = { % sID, [filter ...
5c50d5fa7a83a1d9e1d7a2489f30b590009f77100f166d17968cd99f26dbb717
MATLAB
1,056
28
function [trajs, otherChs] = calc_trajs(self, varargin) % Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al. % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either ver...
8f7ba6371372b5d946ebdd474a438b4f6ef010462f88558a3b45f7851e17257b
MATLAB
1,056
30
function analyze_simulations(i) addpath('/lustre04/scratch/nbrake/code/simulation_code'); folder = '/lustre04/scratch/nbrake/data/simulations/trend_peak_interaction2'; [sa,X] = network_simulation_beluga.getHeadModel; locations = sa.cortex2K.in_from_cortex75K; for i = 1:5 for j = 1:5 saveFolder = fullfile...
b2283d9a3945b708990f6558ca4cf9c3aa166bfee58e815600e69f81b3c20a3a
MATLAB
1,057
33
%JET Variant of HSV colormap % % Examples: % map = jet; % map = jet(len); % B = jet(A); % B = jet(A, lims); % % Similar to MATLAB's jet function, but also able to return a concise % colormap table. % % The function can additionally be used to convert a real-valued array into % a truecolor array using the color...
dbf42e4d168f8e28de98aa10e142c23822d45150fbf6938aaf3e75bf2b8aef03
MATLAB
1,057
45
function st_recon_stprf(DT,params,roiList,channel,plotDir) saveName = sprintf('recon.mat'); saveName = [channel '_' saveName]; if ~isfile(fullfile((plotDir),saveName)) params.roiName2 = 'all'; df = tableRemove(DT,params); df = defaultThresh(df,0); params=[]; recon =[]; id = unique(df.subjID)...
3311a3198476248512ceaf9acdc11a0190ba2fcc4f4089c43aaed600b5eec1b7
MATLAB
1,058
25
% EEGfMRIPav_GLM3C_labels.m % Create labels for each contrast of GLM3C. % % EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN. % J. Algermissen, 2018-2023. % Should work in Matlab 2018b. % we are here: % cd /project/3017042.02/Analyses/fMRI_Scripts/Display_Results/ % clear all; close all; clc GLMlabels = { % sID, [filter ...
697728abf04142dc03482d25fde2da52b734f3cfe924951331af2291850949b2
MATLAB
1,060
17
function tree = t2n_testComp % This function returns a single compartment of region "soma" in TREES % toolbox format, which can be used for testing purposes. % % OUTPUT % tree The testing compartment tree structure % % ***********************************************************************************************...
e3a7e3c8b1b0cc41fc9ae99912055276c727c0c88f45e346c15e9bb19bfa5cf8
MATLAB
1,060
22
function [all_trials_activity_smoothed_mat position_active_frames activity_mat_active_frames legitimacy_vec]=... SmoothingAndThresholdingData(all_trials_position,all_trials_activity_mat,downsample_flag,ActvitySmoothingSize,ActivityThreshold) if downsample_flag==0 all_trials_activity_smoothed_mat=all_trials_ac...
2bd7a93d2f1ae51373b7492d0e8cc666e70e3d38da627ed8daf4292ed5a042e4
MATLAB
1,062
35
%% check_syncat_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 10 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; tree.Ri = 100; tree.Gm = 1 / 2500; tree.Cm = 1; syncat_tree ( ... ...
ef9aca60ce5ea20cc8c8fe160e952a1acdce88e934977b21270770380b79ee22
MATLAB
1,062
24
function CheckNansConsistency(DataMatrix,MouseIDs,StimuliLabels,Days,areaNames) uniqueSLabels = unique(StimuliLabels); uniqueMouseID = unique(MouseIDs); meanPerMouse = zeros(size(DataMatrix,1),length(uniqueMouseID)); for m=1:length(uniqueMouseID) ind = find(MouseIDs(:)==uniqueMouseID(m)); curMat = DataM...
36f4d703126edd55c1afc01c811b55d8dfbf78b5a01332e6d859b516b494e0cb
MATLAB
1,064
41
function phase = estimatePhase(signal, time, opts) %ESTIMATEPHASE Estimate respiratory phase from a respiratory timecourse. % % The default Hilbert method returns phase in radians on [0, 2*pi). arguments signal (:,1) double time (:,1) double opts.method (1,1) string = "hilbert" end if numel(signal) ~= num...
47d22eb5720ad86f2145d7a913f6953f7127e817c47851609284b2780a764534
MATLAB
1,067
35
function Write_4DStack(Stack, Filename, BitsPerSample) if nargin < 3 BitsPerSample = 16; end t = Tiff(Filename, 'w'); tagstruct.ImageLength = size(Stack, 1); tagstruct.ImageWidth = size(Stack, 2); tagstruct.Compression = Tiff.Compression.None; %tagstruct.Compression = Tiff.Compr...
52c252064235a213ad7fc7d1c133c6b760b69e5bb1d853b9853ddcd663b1c8ae
MATLAB
1,067
56
%% VisCorr clear all; close all; clc load('dataLick.mat') load('dataSlow.mat') load('dataVis.mat') % yLabs = {'d'' (day 1-10)','d'' (day 11-20)','d'' (day 1-20)'}; % ySets = {1:10,11:20,1:20}; yLabs = {'d-prime'}; ySets = {1:10}; nSets = length(ySets); lickAvg = mean(dataLick,1); slowAvg = mean(dat...
4fc3c40b3c55a33a2ff06a75eb793869b738080d7ba801acf64ba20bc2be66eb
MATLAB
1,068
42
function loop_sim() % loop_sim() % % Wrapper to call EEGfMRIPav_cbm_sim for model simulations and one-step-ahead predictions. % % INPUTS: % None, set settings for simulations interactively. % % OUTPUTS: % None, EEGfMRIPav_cbm_sim saves to disk. % % EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN. % J. Algermissen, 2018-20...
44461bcf7439c23d69ee71ed2b086d02f4db1140fee27c9c2e31732dc7de9359
MATLAB
1,070
47
function DPrime = CalculateDPrime(A,B,Dim) %% function DPrime = CalculateDPrime(A,B,Dim) % Calculate d' between A and B in the dimention of DIM % % A and B must have same sizes in all dimentions but DIM % DIM refers to the dimention of repetation, default = 3 % DPrime is the returned d' % % Note: DPrime = 0 when AMea...
f13d7ba7fb9e25f43de788fd009bd14224980c98d36e749ac83f96ce6b0f8385
MATLAB
1,071
35
%% check_quadfit_tree tree = resample_tree (sample2_tree, 1, '-d'); %% test 1 quadfit_tree (tree, '-s'); tprint ('./panels/quadfit1_tree', ... '-jpg -HR', [10 10]); %% test 2 clf; [~, qtree] = quadfit_tree (tree); HP = plot_tree ( ... tree, [0 0 0], [], [], [], ...
b50e893cf14ef8f6b20684873b1fc6c7e0df41c2cdf0f7f5935e33d26ff70f90
MATLAB
1,072
31
elName = {'Fz', 'Cz', 'Pz', 'C3', 'C4', 'CP3', 'CP4'}; filename = 'E:\Research_Projects\004_Propofol\manuscript\Nature Communications\_final_submission\source_data.xlsx'; % r = {'A','P','AE','AT','BI','BW','CK'}; figureNB(14,6); for i = 1:7 load(fullfile(dataFolder,'EEG_data','Eq6_fits',sprintf('electrode%d_%s.ma...
0faca70287741b9adece2ffd6f8fe418a5c24202fd4896ecefd0ad7cc93b9d06
MATLAB
1,074
42
function i = intgrtDynEqs(odefun, i0) % Integrates dynamical equations for the membrane potentials % and NMDAR gating variables until the membrane potential of a neuron % crosses the firing threshold. % % Input % odefun - r.h.s. of the dynamical equations for the membrane % ...
6926519c51b765b3184eb24c5533d4cba36ddf23b68bd5b85330e222b4b35720
MATLAB
1,074
37
function connectUnclockedAI(obj, chan, verbose) % connectUnclockedAO(obj) % % Create a task that is unclocked AI and can be used for misc tasks. % % function zapit.DAQ.dotNETwrapper.connectUnclockedAI % % Inputs % chan - which channel to connect. Must be supplied as an integer. % ver...
da686a50af4821c14ceae4001f984a782b2f5bf8aa344e33f8ee0c0fbe4066fe
MATLAB
1,075
41
classdef Mock_Config < Config & IMock %MOCK_CONFIG Summary of this class goes here % Detailed explanation goes here % ================================================================== % properties property1 = 'value1'; property2 = 2; specprop = [0 5 9]; end ...
96a05f45a8dc309483502a588e3e9e29f0c9ef736e9672e1f95399b0ffea28e2
MATLAB
1,076
27
function f = LK_PlotSigTimeForPrefVSUnprefObjects_20231008(dt) % % LK_PlotSigTimeForPrefVSUnprefObjects_20231008 plots the significant times % for preferred versus unpreferred objects, across object cells. % % Input is a structure with multiple fields. % % Output is a figure handle. % % Lukas Kunz, 2023 % create figur...
ca79b46000faa6e7daa4ba23f6d07914f77a557457f56cf1793e905f1d2aa37f
MATLAB
1,076
43
function H = goi_ent_g(x, biascorrect) % ENT_G Entropy of a Gaussian variable in bits % H = ent_g(x) returns the entropy of a (possibly % multidimensional) Gaussian variable x with bias correction. % Rows of x correspond to samples, columns to dimensions/variables. % (Samples first axis) % % biascorr...
78c7c022be005b6ca7288790b8e604a57709bc49b0fb48578a51999437e3498f
MATLAB
1,077
36
function success = WriteTiff(array, filename, typestr) %WRITETIFF Writes array as TIFF file % % Uses ImageJ code to do write % typestr is a matlab type name, supplied to the cast function % % array should be size [nRows,nCols,nFrames,nPlanes] where nPlanes is 1 % (indexed color) or 3 (RGB color) % % ...
40af8f55a0ab3c3b867a6d5e8b9eec25619723464e09fe6043de841389d85056
MATLAB
1,080
27
function [nPulses, pulseDurMilliSec, ISIseconds, nTrials, ledPowerLEDunits, stimDur, varargout] = parseStimStrOptogenetics(stimStr) splitStrCell = regexp(stimStr, '_','split'); if numel(splitStrCell) == 5 [pulse, pulseDur, ISI, repeats, ledPower] = deal(splitStrCell{:}); if nargout > 6; varargou...
5b695fce45fcf4edfe2ff85be5ac27677971b4be56636f89206b9ec7ec0f7dfb
MATLAB
1,082
32
function clear_worker_wngs() %clear_worker_wngs - Reset warnings on the parallel workers % % This function is not intended to be called directly. % Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al. % % This program is free software: you can redistribute it and/or modify % it under the terms of...
0367e829f6084fafe8f3d88f3924b93ff682afc6071c8aa83500289b8beb2e65
MATLAB
1,084
38
function [sigma, mu, AA] = mygaussfit(xx, yy, varargin) %fit_gauss - Gaussian peak fitting helper function % % [SIGMA, MU, A] = fit_gauss(X, Y) performs a fit to the function: % Y = A * exp( -(X - MU)^2 / (2*SIGMA^2) ). % Points where the value of Y is below zero are ignored. % % [SIGMA, MU, A] = fit_gauss(X,...
67aaab16fa52626d22e07d76526a021112c35761a67038383fa1452925576f50
MATLAB
1,086
42
%% check_gdens_tree %% test 1 clf; hold on; shine axis off dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 1 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; gdens_tree (tree, 20); end end tprint ('./panels/gdens_tree1', ... ...
73d6a1e4f99c5516b9167cc5bd33efb819e81852cfd6457fc1f813786e622ada
MATLAB
1,086
31
function varargout = plot_imgData(self, imgChannel, strFigTitle) % Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al. % % This program is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation, e...
4dca84007e05d569c4bb7566f10299ab0d0896539078a8fe6b9dbbe4282eef0a
MATLAB
1,087
40
function analyze_simulations(iChunk) baseFolder = '/lustre04/scratch/nbrake/data/simulations/parameter_sensitivity_analysis2'; addpath('/lustre04/scratch/nbrake/code/simulation_code'); [sa,X] = network_simulation_beluga.getHeadModel; locations = sa.cortex2K.in_from_cortex75K; filename = fullfile(baseFolder,['analyze...
5d0aebef8d564b8676f0b06fe9583df3c51ac6496bb5c6b9b591e68a4911f154
MATLAB
1,091
38
function paintArea_Callback(obj,~,~) % Paint brain area % % zapit.gui.main.controller.paintArea_Callback % % Purpose % Paint brain area onto sample if isempty(obj.model.stimConfig) obj.PaintareaButton.Value = 0; return end if nargin>1 % Only set GUI state i...
9f5b292120a5299690e188e2c180193be9bde7f00cfee5974d28ed50aa02ed84
MATLAB
1,095
39
function result = dosubstitution(r, dictionary) import zapit.yaml.*; if ~exist('dictionary','var') dictionary = {}; end result = recurse(r, 0, dictionary); end function result = recurse(data, level, dictionary) import zapit.yaml.*; if iscell(data) && ~ismymatrix(da...
6bd354e343b4e5b9590b2431b675a9b1b21dc3016fd9edc3f9f7ee5a9707bc69
MATLAB
1,096
51
clear all load('vAllData.mat') cell = VRData(:,4); HAll = VRData(:,1); vAll = VRData(:,3); nCell = 21; fitData = zeros(nCell,3); % plot angles hPlot = -180:1:180; pVar = zeros(nCell,1); figure(1) for i=1:nCell HFit = HAll(cell==i); vFit = vAll(cell==i); amp = 10; offSet = -50; ph...
045adeda6a13926a9b819d4b324f62f0dfebf582685d9ae9d3a278cc1996a96c
MATLAB
1,097
39
function datadump(data) import zapit.yaml.*; recurse(data, 0, []); end function result = recurse(data, level, addit) import zapit.yaml.*; indent = repmat(' | ',1,level); if iscell(data) && ~ismymatrix(data) result = iter_cell(data, level, addit); elseif isstruct(data) result = iter_struct(data, ...
2c172e256073791eaecf30c81977e2c6b3e4549e02b37a4b4d68e664a4b6e28c
MATLAB
1,098
42
function stim = getStim(params,doDown) if notDefined('doDown') doDown = 1; end %% downsample stimulus and reshape according to the temporal sampling rate if doDown == 1 downSampleRate = 1000/params.analysis.temporal.param.fs; stim = params.stim(1).images_unconvolved'; stim_all = zeros(size(stim,2),s...
19fde7c4e165d57451c30a810bf6bfb844214a9c8e774018270c57df62765724
MATLAB
1,100
33
% GABOR MODEL % r0 + a*exp(-(d-d0)^2 / (2*s^2)) * cos(2*pi*f*(d-d0)+phi) function[err] = errfun1DGabor( p, dat ) % evaluate 1D Gabor x = dat(:,1); g = p(1) + p(2)*exp( -(x-p(3)).^2 / (2*p(4)^2) ) .* cos(2*pi*p(5)*(x-p(3))+p(6)); % error err = mean( (dat(:,2) - g).^2 ); % following DeAngel...
3a0d9d8b7a2e8696a5898415abc8c59d113019451faa11e926ab4edcb57fd93d
MATLAB
1,100
26
% EEGfMRIPav_GLM1_labels.m % Create labels for each contrast of GLM1. % For GLM1without7, just copy and rename .mat output file. % % EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN. % J. Algermissen, 2018-2023. % Should work in Matlab 2018b. % we are here: % cd /project/3017042.02/Analyses/fMRI_Scripts/Display_Results/ %...
ceaf4b352977a2863194607efc1daf4ec866d969050060334619d9a380bad58c
MATLAB
1,100
34
%%% optim_SMC.m %%% Omkar N. Athavale, May 2023 %%% Solves a non-linear optimisation problem to identify best fitting %%% parameters for k_iCa50, k_iNSCC, and p_iSMC. addpath(genpath('../')); rng(0, 'twister') % constraint definition, see "help fmincon" lb = [0; 0; -5]; ub = [3; 1; 5]; % initial guess sampling n = ...
75ec436705e69024062b5d65777b2bcdb72936bb97ebf7647056e514b7a90412
MATLAB
1,101
42
% load ephys data load('2021110_AAV8_hsyn_ChR2_x6.mat') stim_firing = []; no_stim_firing = []; for i = 1:7 if i==1 stim_firing = firing.spikeRateMean_2ms10Hz_stim{i}'; no_stim_firing = firing.spikeRateMean_2ms10Hz_nostim{i}'; else stim_firing = [stim_firing firing.spikeRateMea...
45798606e29c674435b4de10e0f3b1b8b425e1ab105f037d078c7ab70f7a8694
MATLAB
1,103
37
function [loadList] = oriLoadList(listType) % Smaller load list to test the code if strcmp(listType,'short') loadList = {'210428_w32_2_outfile.mat' '210903_I151_3_outfile.mat' '210826_i151_3_outfile.mat' '210914_i151_3_outfile.mat' '210927_I154_2_outfile.mat' '211019_I156_1_outfile.mat' }; ...
df92df5ef5faa1c80730013e573aa7773e83aab587a9c090c65768a5b2ba7555
MATLAB
1,106
44
function [PO, CV, curves] = tuningByCircular(data) % remove the cell if its max is the catch % I think that keeping it in messes things up... (ie. not a circle) data = data'; % needs to be cells x oris [~,p] = max(data,[],2); data(p==1,:)=[]; % remove cellsif match is grey screen data(:,1)=[]; % remove the data from a...
5d4085e8c480b70eab7214bc6dcc0c9049fd07b5adede11f519baf75fd6c504b
MATLAB
1,108
27
% function of selecting the region of interesting function blackMaskedImage = ROI(ReferenceImage) h = drawfreehand();% confine a region binaryImage = h.createMask(); % xy = round(getPosition(h)); % x = xy(:, 2); % Columns. % y = xy(:, 1); % Rows % keep only the part of the image that's inside the mask, zero out...
f3b872bb564cebdeb039cabebc053dbc577328fc870612ae866e01188bad707f
MATLAB
1,109
46
% this code will read all the gaze files from the trials and covernt them % to the image coordinate. clear close all force imSize = [733, 977]; pix2deg = 34.910; hWB = waitbar(0,'checking the trials ...'); %load tirals info load('a0_0_bhv2trialStrct.mat'); I = arrayfun(@(x) isfield(x.analyze,mfilename), dataTrl);...
19f4885a1ed77ae30b81180f839d82d80aadaa12fe081c2898bc2d5835b3e5b0
MATLAB
1,110
25
function updatePreviouslyLoadedStimConfigList_Callback(obj,~,~) % Update drop-down of recently loaded files % % zapit.gui.main.controller.updatePreviouslyLoadedStimConfigList_Callback % % Purpose % The paths to the previously loaded stim config files are stored in the % property previouslyLo...
6a465a14cb931d8e75e2524d79819dd271c6f78b1a15302edd403cb3e238f307
MATLAB
1,111
44
%% check_morph_tree %% test 1 dLPTCs = load_tree ('dLPTCs.mtr'); for counterN = 1 : 10 for counter = 1 : length (dLPTCs{1}) tree = dLPTCs{1}{counter}; morph_tree (tree, [], 'none'); end end %% test 2 morph_tree (sample_tree, [], '-m'); %% test 3 morph_tree (samp...
3ed8650bc66bb356a51f4565fdd79bb62066238e946df7cf7bd58b1b337d45bd
MATLAB
1,121
44
function varargout = raster(trialNumber,spikeTime,fig) if(nargin<2) spikeTime = 0; end if(nargin<3) figureNB; else figure(fig); end if(sum(size(spikeTime)>1)>1) A = spikeTime; numspikes = sum(spikeTime(:)); spikeTime = zeros(numspikes,1); t...
a48e7064e0ca240080043c0a829ffc44a8b4d61a16aba76aa3ff1ed93367efff
MATLAB
1,121
39
classdef Test_CalibrationPixelSize_ui < matlab.unittest.TestCase % ================================================================== % methods (TestMethodSetup) function clear_persistent(~) utils.clear_persistent(); end end % ==============================...
001b4f05469287304d93deee6303f0d88563202ab34a193f8117e7e26f5db75d
MATLAB
1,123
31
function mask = choose_mask_altLines(self, isEven) %choose_mask_altLines - Protected class method to choose an individual mask % based on alternating lines in the image % Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al. % % This program is free software: you can redistribute it and/or modify % ...
4a177d38b493dbf8642ff17b85dd582489f2dddeec2de6aa861c06338e959a31
MATLAB
1,127
46
function [Amp1D,SF1D] = CalculateFFTAmp1D(A,SizePxl,Intv) %% function [Amp1D,SF1D] = CalculateFFTAmp1D(A,SizePxl) % Calculate 1D FFT amplitude % % A is an array with at leat 2 dimentions % SizePxl is the pixel size (mm) % Intv is the interval in SF1D (cyc/mm) % % Amp1D is the 1D amplitude % SF1D is the 1D sp...
0600bb59a2adeedcd08cc641d83dc490743b23400bf4e891f612b97a79d79c46
MATLAB
1,131
41
function outmat = normalize(inmat, lo, hi) % function outval = normalize(inmat, [lo=0], [hi=1]) % % Normalises the matrix in inmat to between lo (for example 0) % and hi (for example 1). % % Unlike rescale2, normalize does not round the values to the nearest % integer; therefore this is more useful for rescaling double...
1e123efdc16ccf8479a8605fc39ea46e25eee110d8404a361ba40a4827d8e94b
MATLAB
1,132
49
addpath './Tools'; load M28D20221026R0TS.mat fnTS = 'M28D20221026R0TS.mat'; %% gaFFT Message = gaFFT(fnTS,TS,DAVersion); %% XX = 100:1:360; %select ROI YY = 150:1:310; TotalTrial = 10; FramepTrial = 120; LowCutOff = 0.8; HighCutOff = 2.5; SizePxl = 0.0153; %/mm DataCond_filtered = Filter...
ba040a940933690fc376b99b8ec4b0b230c2f64dd6be8034ddf764ef569f015b
MATLAB
1,134
32
function status = export_data() % Export the SWC file, and the voltage data in the format compatible with % the calcium concentration simulations. % Results data are placed in Results\Calcium % Returns the status: missing input files = 0, incomplete voltage = 1, successful = 2 %% Create output folder output_folder = ['...
22aa43e39306eb48ff738823d56594c162f8db574eba6843b830d1bea3eb0b67
MATLAB
1,136
45
close all force %clear %load('a0_0_bhv2trialStrct.mat'); %% tAll = tic; hWB = waitbar(0,'checking the trials ...'); nTrialAllNext = 0; iTrialAll = 0; UMuscimol = [ 0, 12,9 ,4,1 ,14,11 ,6,3 ]; UMuscimol = [ 0, 12,9 ,4,1 ]; UMonkey = [1,3]; for iMonkey = 1:2 fo...
8acbfdadb45fd3a17101f5c03c09d5afa89e7abc4387c0b1485d020727dc3de8
MATLAB
1,136
59
function [b,c]=findInSorted(x,range) %findInSorted fast binary search replacement for ismember(A,B) for the %special case where the first input argument is sorted. % % [a,b] = findInSorted(x,s) returns the range which is equal to s. % r=a:b and r=find(x == s) produce the same result % % [a,b] = findInSor...
99eda2ffebad47024fc5080b6ca8c3bd062a77f43802188c2b0f64b77c8cb6e1
MATLAB
1,138
55
function st_recon_plot(DT,params,roiList,channel,plotDir) saveName = sprintf('%s_recon.mat',channel); load(fullfile((plotDir),saveName),'avgrecon') figure('position',[100 400 1300 200]) counter = 1; polar_radius = 12; polar_dim = 61; x = linspace(0,polar_radius*2,polar_dim); x = x - mean(x); y = x; for eachROI = ...
ab629d4ace0bbe95dfec0c295ff8d71e936b773a67be9687595c68b0d086b374
MATLAB
1,140
36
function pX = taft_pinv(X) % pX = taft_pinv(X) % % Compute pseudo-inverse using SPM's spm_sp function. % Check for rank deficiency. % % INPUTS: % X = 2D (trials x regressors) design matrix. % OUTPUTS: % pX = 2D pseudo-inverse calculated with SPM. % % EEG/fMRI STUDY, DONDERS INSTITUTE, NIJMEGEN. % J. Alg...
a262ebe28e98378ee53567b14518a799a0603ad97b09360ebe068c78c87124f5
MATLAB
1,149
30
function dir = CHIPS_rootdir() %CHIPS_rootdir - Return the CHIPS root directory % % DIR = CHIPS_rootdir() returns the root directory of CHIPS. % % See also utils.GetFullPath.GetFullPath, path, fileparts, filesep % Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al. % % This program is free softw...
3f9d5f9e1817fc73fd05ab93aa55d197ce02f0e26e65b65264626b9a47eb4864
MATLAB
1,150
32
classdef stimLocations % Class that defines the field names for the stimulus locations % % function stimLoc = zapit.stimConfig.stimLocations % % Purpose % The stimLocations property in the zapit.stimConfig class defines the coordinates % to which the beam will go in each condition and also ...
4e820bcb5ee6196c718597c082f917a8c8ebc8ec71b6cef01834628a7346ceb5
MATLAB
1,152
28
function saveFigureA4(hFigure, folderName, figureFileName, dpiResolution, fixLine, orientation) % saveFigureA4Landscape(hFigure, folderName, figureFileName, dpiResolution, fixLine, orientation) if ~exist(folderName, 'dir') mkdir(folderName); end switch orientation case 'Portrait' ...
3124f54b684160a1e3b26b1d946bc449862a3524dbac75af373790c637de55e4
MATLAB
1,153
34
function result = ReadYaml(filename, nosuchfileaction, makeords, treatasdata, dictionary) import zapit.yaml.*; if ~exist('nosuchfileaction','var') nosuchfileaction = 0; end if ~ismember(nosuchfileaction,[0,1]) error('nosuchfileexception parameter must be 0,1 or missing.'); end if ~exist(...
74580cc1bf78fddc75f06eb2f4c0c52d9983a6183b6d43dc38b008ae2aa5b4ad
MATLAB
1,154
27
% METRICS % % functions to obtain or alter metrics from a tree % % Files % angleB_tree - Angle values at branch points in a tree. % cvol_tree - Continuous volume of segments in a tree. % cyl_tree - Cylinder coordinates of all segments in a tree. % dstats_tree - Display tree statistics obtained by stats...
d7fbb06a7918de4306e3c03ffc3e965d2b3f375fa09800f3358a554c4eb7d983
MATLAB
1,154
35
function [full_model,AP_model] = fittingmodel(fitType) if(nargin == 0 || strcmp(fitType,'eq6')) fitAP = @(x,f) eq6(x(1),x(2),x(3),x(4),2*pi*f); full_model = @(f,x) fitAP(x(1:4),f) + fitPeaks(x(5:end),f); AP_model = @(f,x) fitAP(x(1:4),f); elseif(strcmp(fitType,'eq1')) fitAP = @(x,f) eq1(x(1),x(2),x(3),x(4),2*...
e207230bfe721c4c17723e0dd54a9842c4fd3da7eaabb06cdb169a89e8da1732
MATLAB
1,154
35
function [full_model,AP_model] = fittingmodel(fitType) if(nargin == 0 || strcmp(fitType,'eq6')) fitAP = @(x,f) eq6(x(1),x(2),x(3),x(4),2*pi*f); full_model = @(f,x) fitAP(x(1:4),f) + fitPeaks(x(5:end),f); AP_model = @(f,x) fitAP(x(1:4),f); elseif(strcmp(fitType,'eq1')) fitAP = @(x,f) eq1(x(1),x(2),x(3),x(4),2*...
454dab576ef7ba91e3127066e301178fa919104cbe75ac27e0faf9fdffca239f
MATLAB
1,155
27
%% Release Notes %% % <html><h2>v1.0.4 - First Public Release</h2></html> % % *Known Issues* % % * Bio-Formats in MATLAB R2013a: The current Bio-Formats Java library is % not compatible with the Java version included with MATLAB R2013a. Please % refer to the <system_requirements.html system requirements> page for th...
3d10e71dc8783171c2a7d581bd9aec4da9d165fc28f8ef6a7fb7eee480acb947
MATLAB
1,157
25
function add_stack(name) if (ispc == 1) filename = strcat('../Models/', name, '/Code/NEURON/TMS_script.ps1'); filename2 = strcat('../Models/', name, '/Code/NEURON/save_locations.ps1'); [~,outp] = system('where nrniv'); if isempty(outp) || ~isempty(regexp(outp,'not found','ONCE')) || ~isempty(regex...
51ab6a09110172e21d3665f80977d1d1bf661b542023a2c64da45679cea85922
MATLAB
1,160
48
%% clear clc %% set path addpath('...\fcn') addpath(genpath('...\ext')) %% set directories data_dir = '...\mammals_connectome'; out_dir = '...\output'; %% load data and set parameters thresholds = {'0' '0.05' '0.1' '0.15'}; curr_thresh = 1; load(fullfile(data_dir,... sprintf('cents_repani...
d92ba07f1629bf9a5a2dc4e7d6513c7294810f5ca8a09f66f79366d6cbf87d65
MATLAB
1,160
40
function varargout = DefaultArgs(Args, DefArgs) % auxillary function to replace argument check in the beginning and def. args assigment % sets the absent or empty values of the Args (cell array, usually varargin) % to their default values from the cell array DefArgs. % Output should contain the actuall names of argume...
8ea37af656fb15fc34316a8119d6745340acdfad38e768d5416dbcb119c39248
MATLAB
1,161
44
% CPOINTS Returns points on a contour. % (scheme package) % % [X, Y] = cpoints (c) % -------------------- % % Returns the point coordinates x and y from a contour c. A contour is % defined by: % c = [contour1 x1 x2 x3 ... contour2 x1 x2 x3 ...; % #number_of_pairs y1 y2 y3 ... #number_of_pairs y1...
a6ce77925ef85f5b2af01ac2a93867d5a123178fdd03f6833e9bf8f348a84a4a
MATLAB
1,162
42
function WriteTifStack(Stack, Filename, BitsPerSample) if nargin < 3 BitsPerSample = 16; end t = Tiff(Filename, 'w'); tagstruct.ImageLength = size(Stack, 1); tagstruct.ImageWidth = size(Stack, 2); tagstruct.Compression = Tiff.Compression.None; %tagstruct.Compression = Tiff.Compr...
795b7858965376fc3873ebbbecfa3f25aeed7f4f205a3ace7c728c229beab67a
MATLAB
1,163
36
clear close all force load('a0_0_bhv2trialStrct.mat'); %% nTrial = numel(dataTrl) ; NTrial = 1:nTrial; tAll = tic; hWB = waitbar(0,'checking the trials ...'); nTrialAllNext = 0; iTrialAll = 0; distAll = nan(nTrial, 1); %7 = downSizeRatio = (size(heatMapPixImgGaussFix)+[2,3])./round([733,977]/34.910*5); heatMapNew ...
be0c824ef6d84cf842fb19a6408ec3ae0db42f394cd2b6c929ed1f29bbd3bee8
MATLAB
1,163
42
function figOffscreenCheck(fig); % figOffscreenCheck([fig]): check that a figure % doesn't get moved off the edges of the screen. % % This function checks the figure fig [default gcf] % and, if it's running off the edge of the screen, moves / reshapes % it to fit within the screen. % % ras, 07/05/05. if ~exist('fig','v...
f3c6470470a5b18fbcff9b7ed7e6684f403d436951444743f66eae4f73cf823a
MATLAB
1,163
17
function [ smooth_maximum_likelihood_angle_per_sample_index ] = estimate_head_direction( spike_rate_mat_neuron_by_angle, full_neuron_firing_per_bin ) global TEMPORAL_TIME_BIN NUMBER_OF_ANGLE_BINS; % Perform decoding of neuronal data, based on wake data, to color data % points of the reduced data he...
5d9c8e70046c9e65d96e2d1b071f4d2ec5dc29a46346437b802b4f7ef75e6753
MATLAB
1,165
39
classdef Test_ProcessedImg_ui < matlab.unittest.TestCase % ================================================================== % methods (TestMethodSetup) function clear_persistent(~) utils.clear_persistent(); end end % ======================================...
630b74917490f941de769200c1a10db082ff95575d37556b8f93aa5144aff81c
MATLAB
1,168
31
function acq = get_acq(self) %get_acq - Get the image acquisition data % % ACQ = get_acq(OBJ) returns an acquisition structure ACQ that can be % used as an argument to the Metadata constructor to create a new % Metadata object. % % See also Metadata.Metadata % Copyright (C) 2017 Matthew J.P. Barrett, Kim Da...
731456983148bf734aea75b2d1bc915f2bc1a63e540bae0d0e889c98b59f8a06
MATLAB
1,168
42
clear; close all; maindir = pwd; warning off all sub = 1006; tasks = {'faceA', 'faceB', 'facesA', 'facesB', 'doorsA', 'doorsB', 'imageA', 'imageB'}; for t = 1:length(tasks) rawtask = tasks{t}; % rename task if strcmp(rawtask,'faceA') bidstask = 'socialdoors'; elseif strcmp (rawtask,'face...
29aa71bb07942335294ae1ed962fc7454b28630c125ec6dcc0e9367b26b7dc0c
MATLAB
1,171
38
%%% optim_ICC.m %%% Omkar N. Athavale, May 2023 %%% Solves a non-linear optimisation problem to identify best fitting %%% parameters for k_iAno1, k_iNSCC, and p_iICC. addpath(genpath('../')); rng(0, 'twister') % constraint definition, see "help fmincon" lb = [0; 0; -5]; ub = [1; 1; 5]; A = [10/9, 1, 0]; b = [253/180...
7426d470955c86e1a8203bd0a9f6efaea25e1f2b3dc9b1f29568b0e3867d75eb
MATLAB
1,171
31
function sortedCountries = sortByCorrelationWithAllPrev(DataMatrixObservationsInRows) DataMatrix = DataMatrixObservationsInRows; curCorrMat = corrcoef(DataMatrix); NCountries = size(curCorrMat,1); diagInd = find(eye(size(curCorrMat))); curCorrMat(diagInd) = -inf; [maxVal,maxInd] = max(curCorrMat(:)); [maxI,m...
2bbc55f24cab91a1b8e51f37eb26baa2ed4bedb50144a74d347b725ef44e93e3
MATLAB
1,172
38
function dimNumber = getDimension(MRSIStruct, dimLabel) arguments MRSIStruct (1,1) struct dimLabel char end switch(lower(dimLabel)) case 'x' dimNumber = MRSIStruct.dims.x; case 'y' dimNumber = MRSIStruct.dims.y; case 'z' dimNumber =...
524d5dd8fe5e493eab6addb62efd15b11caefca62eccf6724bc33286cd072ab1
MATLAB
1,175
32
function coordinates = getCoordinates(MRSIStruct, dimension) switch(lower(dimension)) case 'x' coordinates = MRSIStruct.coordinates.x; case 'y' coordinates = MRSIStruct.coordinates.y; case 'z' coordinates = MRSIStruct.coordinates.z; case 'kx' ...
dcd81f4eacd9886d735209682f7a00187273c817014eca2e52852d81fc3d37bd
MATLAB
1,177
58
function [params] = logParamsVis(logData,lickTh) %this code extract parameters from virmen logs on linear track % Output: %params.y:y position %params.lickIdx=licking indices %params.rewardIdx=the indices when the reward is delivered %% Read data a = logData; t = (a(:,1)-a(1,1))*24*60*60; % time r = a(:,...
ac72220ac703eb2a63926accd62cc0c4c2c7a92c3af216c7099258a42306567f
MATLAB
1,181
35
function [W_DSD_greedy, Clist, CID] = greedy_final(Wp, threshold_DSD, lambda) % a greedy version of the greedy peeling algorithm % the algorithm finds a cluster at each time until the average value in the % remainder adjacency matrix is below the mean of the input cluster % Chuan % initialize Wp_DSD = Wp; Wp_D...
2818ce6870b96d73e8f62f11ce27dcf94528062581f116a3b25c31b100e126c5
MATLAB
1,187
37
function [job, data] = TF_load_data(job) % [job, data] = TF_load_data(job) % % Loads time-frequency EEG data based on job settings. % % INPUTS: % job = cell, needs at least fields: % inputFileName = string, name of file to be loaded, created by % TF_update_job.m. % dirs.TFgroup = string, dir...
a40fffe56cf2c4124b2c8a2382d78c7ef08a5caf2383ca2917a028022e2a98bb
MATLAB
1,188
32
function clear_persistent() %clear_persistent - Helper function for clearing persistent variables % % Clears persistent variables by clearing the class/function that they % belong to. This seems to be the cleanest way, although it means % updating the list below for every new persistent variable. % Copyright ...
51ee0a1595b65d6f1630c6f12d482328f515259a7da82fab526568a2bdfee5fe
MATLAB
1,190
32
%RunElectodesClassificationMatlabFunc clear all matlabImpute = true; imputeIters=80; NumTrees = 80; substractMouseMean = true; LeaveOutVec = {'Session','Stimuli','mouse'}; %LeaveOut = 'Session' balanceClasses = false; %ElectodesClassificationMatlabFunc(unifyContextClasses ,averageAllBoutsFromSession ,... % ...
84390f05026de3c7147a7bd8286b781542efc9b36c138d649cb8e5d95c19b393
MATLAB
1,190
53
function Data = blkGetData(fnBLK,BLKHeader,iFrames) %% Get the data from a BLK imaging file % Return a 3-D array: Y,X,T % fnBLK is the BLK filename incliding pathname. % % % YC at ES lab % Created on Apr. 14, 2008 % Last modified on Apr. 14, 2008 %% Read header and set data type if ~exist('BLKHeader','var') BLKHead...
e277b1686fef49dc9c9c8b66504e9c8d52fac366ae7cedce45f1df4e8dd25b19
MATLAB
1,191
50
function [ ] = runSimulatorRound(spacing,rootdir) %RUNSIMULATORROUND R loadSimParams; loadParameters; simname = sprintf('simseq_spacingtest_%i',spacing); working_dir = fullfile(rootdir,simname); if ~exist(working_dir,'dir') mkdir(working_dir); end %Set the parameters for the simulator simparams.SIMULATION_NAME ...
f7ed9f97b62bf4aeacdceaf2eaccf58ce38ae68c82fa347d85c4fc4f8930bf20
MATLAB
1,191
49
%%%%% ---- PART 1: Avg of Whole data ---- %%%%% MI_avg = mean(MI, 3); %%%%% ---- PART 2: Avg of Time resoluved data ---- %%%%% %%% ---- Step 1: Initialize the result matrix ---- %%% MI_time = MI_out.MI3; %%% ---- Step 3: Process to sum n=600 data ---- %%% for i = 1:38 %i=time, 1 1~2sec block to 39~40sec blo...
4a6e5af086a1a617aabd8f2964cd5619a095f4c49fab87071ee5711190ebb17d
MATLAB
1,192
37
clear close all force load('a0_0_bhv2trialStrct.mat'); %% nTrial = numel(dataTrl) ; NTrial = 1:nTrial; tAll = tic; hWB = waitbar(0,'checking the trials ...'); nTrialAllNext = 0; iTrialAll = 0; sacAll{nTrial} = []; for iTrial = 1:nTrial cTrial = NTrial(iTrial); if dataTrl(cTrial).quality && dataTrl(cTrial).i...
967e8ab93cd5a3a0966efd1523e17cd0261e06e3d0ab03a18f6f656c7a72520b
MATLAB
1,192
32
elName = {'Fz', 'Cz', 'Pz', 'C3', 'C4', 'CP3', 'CP4'}; saveFolder = 'E:\Research_Projects\004_Propofol\data\experiments\scalp_EEG\analyzed\rescaled_time'; dataFolder = 'E:\Research_Projects\004_Propofol\manuscript\Version3\Data'; load(fullfile(dataFolder,'data_time_information.mat')); t0 = timeInfo.infusion_onset-time...
3793f73845fd43f9e7092776145ccfd75e102a47c6d6bb157a22a82189a55a27
MATLAB
1,193
43
function basis = designMatrix(mask, voxelSize, order) %DESIGNMATRIX Build real solid-harmonic-like polynomial basis terms. arguments mask voxelSize (1,3) double {mustBePositive} = [1 1 1] order (1,1) double {mustBeInteger, mustBePositive} = 3 end if order > 3 error('fmriPhase:harmonics:UnsupportedOrde...
5be83cfa282d65b02738f2385b303a67a3adc128aa14c5c134917937d319693f
MATLAB
1,193
40
function lims = get_limits(xx) %get_limits - Helper function for getting axis limits % % This function is not intended to be called directly. % Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al. % % This program is free software: you can redistribute it and/or modify % it under the terms of the...
f5e6edd34f94a206f4ca5ce7808c8b38817123c2b959167f9ece75a064b0d32f
MATLAB
1,193
43
function pointButton_Callback(obj,~,~) % Run on press of the Point button % % zapit.gui.main.controller.pointButton_Callback if nargin>1 % Only set GUI state if the *user* clicked the button % rather than than harmonizeGUIstate calling it. obj.GUIstate = mfilename; end ...
554cf06d1db7feb69aeea89e704deb12aacdbfe9365db96f02892462dfd6e7d8
MATLAB
1,195
37
function [job, data] = time_load_data(job) % [job, data] = time_load_data(job) % % Loads time-domain EEG data based on job settings. % % INPUTS: % job = cell, needs at least fields: % inputFileName = string, name of file to be loaded, created by % time_update_job.m. % dirs.timegroup = string, ...
5e4fab1b7fd14a9e88f8b3f17ef09aa361a88888af52c8df4f5d9d2b733ab50c
MATLAB
1,196
40
function full = fullpath(pth); % % full = fullpath(pth); % % Given a string specifying a path which may be an absolute path, % or a path relative to the current directory, always return % an absolute, full path string. Platform-independent. % % Ex: if the current directory is '/usr/me' and the pth string is % 'Inplan...
1fa0cee93c6a32da302b5ce577f338dba5ad984dff089dbb6f5b6d06c2c702a7
MATLAB
1,199
49
function y = nansem(x,dim) % FORMAT: Y = NANSEM(X,DIM) % % Standard error of the mean ignoring NaNs % % nanstd_nansuite(X,DIM) calculates the standard error of the mean along any % dimension of the N-D array X ignoring NaNs. % % If DIM is omitted nanstd_nansuite calculates the standard deviation along fi...