sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
4594ff82d3656a4f4f230a9b98905215cec73170f1d42d817306d50dea99faa8
MATLAB
2,576
117
%first column = channel number on probe. Convention is ch. 1 is at top left of PCB %and number wrap around in counter-clockwise fashion. %second column = x coordinate, horizontal distance to reference electrode in microns. Convention is %for reference electrode to be at bottom left corner of array when array %points...
4ec686c3f13faa32059b3c178b04a85c0d41eb9ce81325e1a98376db5fb5f794
MATLAB
2,580
82
function info = LoadSBXinfo(inputPath) % input path can be .sbx or .mat % Make sure we're opening the info .mat file [inputDir, inputName, inputExt] = fileparts(inputPath); % Find the name of the info file and load it if ~isempty(inputDir), inputDir = [inputDir '\']; end basePath = [inputDir inputName]; infoP...
4fe012f430041f6df9b30a5b9ecc73f4d113af30e196c30fe0b56936a3a7e5a7
MATLAB
2,580
115
% op_takecoils.m % Jamie Near, McGill University 2014. % % USAGE: % out=op_takecoils(in,index); % % DESCRIPTION: % Extract the rf coil channels with indices corresponding to the 'index' input % array. % % INPUTS: % in = input data in matlab structure format. % index = vector indicating the indices of the rf ch...
69d3ae04d4d387b8e590c7189b6960a21488fb40eb9772ce2d67e5a1741c9864
MATLAB
2,581
71
function [PERFORMANCE, NETS, numfeatures] = ... nnSearchParams(DataRank,DataTestRank,y,yTest) % Now take the ranked features and test them in multiple neural network % architectures numfeatures = 5:5:size(DataRank,2); % number of inputs (features) u1 = 5:5:15; % number of units in the first hidden...
6191165203c79420970bd781c62d7807882f2d96d3934ee3f3be73f487c6bda6
MATLAB
2,582
62
function t2n_initModelfolders(folder) % This function initializes a new folder in which all necessary files and % folders are created to start a new a compartmental model featuring T2N % % INPUTS % folder (optional) path to the folder which should be % initialized/created. % % % *...
48588775a08ac8c1dd90d63af62704dbb661b149aeac2826ac7b237d159c8807
MATLAB
2,584
80
function result = doinheritance(r, tr) import zapit.yaml.*; if ~exist('tr','var') tr = r; end result = recurse(r, 0, {tr}); end function result = recurse(data, level, addit) import zapit.yaml.*; if iscell(data) && ~ismymatrix(data) result = iter_cell(data, level, addit); elseif isstruct(data...
6dba416e06e607066d15210890dbf95275b8311b1865709527ccfba65230c561
MATLAB
2,586
74
function [stilloffsets] = refs_align(stillimages, maxoffset) %takes a sequence of STILLIMAGES (numstils x N x N) and returns a matrix %containing the relative offsets between these images in X and Y based upon %the shift which gives the maximal cross correlational considered only over %a range (MAXOFFSET) of offsets ar...
9294d03edad410c3af4494c269e407aa47c4a893cc7f2d4cd3df4f7b631afc7b
MATLAB
2,589
86
% sim_press.m % Robin Simpson and Jamie Near, 2014. % % USAGE: % out = sim_press(n,sw,Bfield,linewidth,sys,tau1,tau2) % % DESCRIPTION: % This function simulates an ideal PRESS experiment with first echo time % "tau1" and a second echo time of "tau2". The function calls the function % 'sim_Hamiltonian.m' whi...
281b0d705553a4708af0402c1737c5192639aec884a7fa246f46981c85f43be3
MATLAB
2,590
67
function [ roiStruct ] = selectOrLoadROIs( basePath, flyInd, stackInd, ... imagingStruct, uiSelection, varargin ) % selectOrLoadROIs Load existent roiStruct from file or select ROIs (do not % choose overlapping regions!) % % Inputs % ------ % % basePath: the path up ...
875fae55aa5da739f268b897510918077de61a0c66fc4b4e1d3b0d9a983d6886
MATLAB
2,592
55
function stimConfigLoaded_Callback(obj,~,~) % Update the GUI when the model's stim config changes % % zapit.gui.main.controller.stimConfigLoaded_Callback % % Purpose % Runs whenever zapit.pointer.stimConfig is (re)assigned -- see buildListeners. This % makes the GUI react to a stim config be...
db37adc55c3dc8deeb02a67b1702e726d1554083c56b3dae9886844ff7df2e01
MATLAB
2,592
121
% ppc: data splitting with a per-class criterion % % [Xtr Ytr Xts Yts indices] = ppc(X,Y,ppc) % % This function splits the data in X according to the labels in Y and % returns train and test data, along with the indices in the original data % vector. % % Inputs: - X: data vector % - Y: labels vector...
f1ad01c7c39965372c3435871900fa3c6069511b1c8fd63ea213bb3de0c18c5a
MATLAB
2,592
88
function df = st_compute(df,stim,params) numFolds = df(1).numFolds; for fold = 1 :numFolds fprintf(1,'[%s]:Compute TC Prediction (fold %d) \n',mfilename,fold); testSet = df(fold).test_set; fold_stim = stim(:,:,testSet); x0 = df(fold).x0'; y0 = df(fold).y0'; sigma = df(fold)...
8706a1e6525b88f7722346ee4ccd76d27492f67749f6d862e5369b0114f4cbe8
MATLAB
2,599
73
%% power curve clc;clear;close all; %% % This code plots power curve % T-test, vary sample sizes % effect size Cohensf2 = 0.15; % SD for normal distribution that governs the correlations of % non-covariate-related edges sigma0 = 1; FWER_threshold = 0.05; % Number of repetitions M_rep = 100; % Number of per...
18831d927006d42bceb99a2d2ab504119d835967f5446896eb8368d524af220d
MATLAB
2,600
58
function [controlValues, sensorValues] = generatePoly3Data(varargin) % Generate a synthetic "semi-linear" laser power curve for testing % % function [controlValues, sensorValues] = generatePoly3Data(varargin) % % Purpose % Produce a synthetic laser calibration curve that follows a third order po...
efa232abcd2ffdfdbd992e4e3e84bfd621a5842c7a7c775f2a7b88d1c71e5004
MATLAB
2,600
50
function P_value = permutation_test_ttest(ctrl_mtx, case_mtx, Wp, CID, Clist, M, func, threshold_GT) % Conducts a permutation test using the t-test to assess the statistical significance % of a test statistic derived from control and case matrices compared to a permuted dataset. % Inputs: % ct...
877fecb5701d571d5a464852a715bc997a97d6e1ad46869ef43521cd2aaec129
MATLAB
2,603
72
%select_spec.m % % callback function used for uicontrol popup menu for choosing to select % MRSI specs to plot. Plots the closest clicked MRSI spec in spm_image GUI. % must be used with sim_CSIoverlayMRI and spm_image. See % https://www.mathworks.com/help/matlab/creating_plots/callback-definition.html % for more info ...
de1083d86c563fb8ab76cd28cca41b8822b5daf88071b838db4a9ed129520f8c
MATLAB
2,603
55
function h=subplot_tight(m,n,p,margins,varargin) %function subplot_tight(m,n,p,margins,varargin) % % Functional purpose: A wrapper function for Matlab function subplot. Adds the ability to define the margins between % neighbouring subplots. Unfotrtunately Matlab subplot function lacks this functionality, and the ma...
38f669a31521a34d8f53b0852122e7fe7f5683cb422b1094b6fa726be8951c9e
MATLAB
2,606
96
function [minShifts, probMat] = estimate_offset(chSeq, refImgs, ... framesPer30sec, maxShift, doPar, varargin) %% Preallocate offsets % need inputSequence, maxDx, maxDy, frameRate, doPar, doPlot, verbose %% Get supplied info % Image dimensions [nFrames, nLines, ~] = size(chSeq); % Parse optional arguments [verbose...
ee21ec90a29bab6d90210cdfdeb356947ab99e49a7557e3447dd3c22bec43122
MATLAB
2,607
89
%io_writelcm.m %Jamie Near, McGill University 2014. % % USAGE: % RF=io_writelcm(in,outfile,te); % % DESCRIPTION: % Takes MRS data in matlab structure format and writes it to a text file % that can be read by LCModel. % % INPUTS: % in = input data in matlab structure format. % outfile = Desired filename of ...
291e7530e00d6f0eb85161bbf52d64b6c669a4ce4eafbd2a89d8fe52e7a98795
MATLAB
2,608
63
%% Be here: % Overview script to create bar plots for all kinds of ROIs. % Johannes Algermissen, 2020. % % We are here: cd /project/3017042.02/Analyses/fMRI_Scripts/Run_ROI/Plot_PEs % Overview script for running all kinds of % Set directories: dirs.root = '/project/3017042.02'; dirs.scripts = fullfile(dirs...
60d64330a60a7078e6a7393a80b2459a532d754fe0cf3fafa3fbc5fa8ec56d33
MATLAB
2,612
76
% 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...
8e58093c5fa68f4d680fa19535a1aa3e649d88be7e02388ee379e87a30a67877
MATLAB
2,614
88
function make_docs_md(varargin) %make_docs - Publish the documentation as md files % % make_docs_md() publishes all m-files contained in the % CHIPS_rootdir/doc/m/ directory to markdown files, which are output in % the CHIPS_rootdir/docs directory. % % make_docs_md('outputDir', OUTPUTDIR) ouputs the published d...
5eb60250a569f7d4e781d399a1b5de53995d5e105fbeaf519825b758e2a20c26
MATLAB
2,616
92
function figureS5(dataFolder) if(nargin<1) error('Path to data required as input argument. Data can be downloaded from link in README file.'); end load(fullfile(dataFolder,'simulations','trend_peak_interactions','parameter_changes.mat')); f = 0.1:0.1:500; P3 = zeros(length(f),5,5); P3(:,:,1) = mean(P2(:,:,1:5),...
f4f1e3abd6a1bfe47277843297e2f9ef7c6689975a9f63db33bcc39275caca6c
MATLAB
2,619
47
load('figure_8_data.mat'); % plot thalamocortical and corticothalamic cross-frequency % information transfer against estimated largest Lyapunov exponents of % simulated thalamocortical electrodynamics figure( 'Position', [ 100 0 350 450]); hold on; scatter(simulated_anesthesia_lyap(1:end),symlog(simulated_anesthe...
74440784299edd94db27fd12ccf3a7d756efdd3401c0f7773e4614e3e18a5c05
MATLAB
2,620
149
clear close all force warning on load('a0_0_bhv2trialStrct.mat'); imSize = [733, 977]; load a7_2_createAvergedNOTMorphedHeatMapsLoad.mat hmAll2 = hmAll; NIm = [... 1 3 15 16 21 22 32 33 34 43 46 54 58 61 62]; %% clf NImFlip = [... 1,1 2,0 3,0 4,0 6,0 9,0 14,0 15,1 16,0 ...
a3a0bcad7f2d48f9b17bd3ee9a7f0a30f635e9947f0f00195f3f065eda74e0ec
MATLAB
2,622
76
function betas = taft_preprocess_fit_HRF_block(job, data_ups, i_ons) % betas = taft_preprocess_fit_HRF_trial(job, data_ups, i_ons) % % Take upsampled data of entire block (one long vector), fit HRF amplitude % for every trial within block with one single design matrix for entire % block. % % INPUTS: % job =...
df126efea9b64ee941a4ded92b2d9a9616b9fd9e39b9fed6f274b6c2ec8aa9a4
MATLAB
2,623
108
clear close all force %load tirals info load('a0_0_bhv2trialStrct.mat'); load('a1_1_averagingMorphedHeatmaps') %{ dataExp.sMuscimol' +1 {'Co_Left_10_M' } +2 {'Co_Left_10_S' } +3 {'Co_Left_5_M' } +4 {'Co_Right_10_M'} +5 {'Co_Right_10_S'} +6 {'Co_Right_5_M' } +7 {'Co_Right_5_S' } 8 {'ML_Bi...
44e46fc306cdc733665f40ccf0362ba7cbfc1e059fb306bf8b8970f541e9b7d5
MATLAB
2,625
64
function [ref_run, ref_scan] = DetermineReference(expt, Tscan, loco, eligible_runs, minStillDur) % refFrame % Find the longest epoch of stillness within the set of eligbile runs, and use that period as the reference point for registration if isempty(eligible_runs), eligible_runs = expt.runs; end %minStillDur = 30; ...
799e04c5ad418c182bb44244e36fbe0aa3effb84e00a88a459e8827f484bbed2
MATLAB
2,627
69
%% power curve clc;clear;close all; %% % This code plots power curve % Number subjects n = 50; % SD for normal distribution that governs the correlations of % non-covariate-related edges sigma0 = 1; FWER_threshold = 0.05; % Number of repetitions M_rep = 100; % Number of permutation tests in one repetition ...
aa84662e2b6c67e2a6f8e69c7eb2e62ca44a7594b3c3686d834abaa2513ec1f4
MATLAB
2,628
98
% SURF_TREE Surface values for tree segments. % (trees package) % % surf = surf_tree (intree, options) % ---------------------------------- % % Returns the surface of all tree segments using the X,Y,Z and D % coordinates and the adjacency matrix [in um2]. % % Input % ----- % - intree ::integer: index of tree in tr...
0bec4372292ca1e41d171570fe73f7350cb8312463ab5fc7ce3d1bd40e4583b9
MATLAB
2,631
102
% TYPEN_TREE Tree node B-C-T info. % (trees package) % % typeN = typeN_tree (intree, options) % ------------------------------------ % % Returns the BCT string in a vector. This is just the sum of the columns % in the adjacency matrix and >2 => 2. % 0 means terminal % 1 means continuation % 2 means branch. % % Inpu...
b5159c86113947ae55e0a9284fae2103ef2703a0c02c99a3ffa6e8347e2a9a45
MATLAB
2,633
62
function neuron = t2n_as(x,neuron) % This function adds all missing definition fields to each neuron structure % in a neuron cell array by telling T2N to use the same fields as those of % the xth neuron structure in this array. Alternatively it fills up missing % definitions in a single t2n structure. Useful if many ...
c5c0ebfce568ddaa6489c4c0fc6ee8b647d5ea4d1b1cd6be5d932c43b89f8f92
MATLAB
2,635
76
%% power curve clc;clear;close all; %% % This code plots power curve % T-test, vary sample sizes % Number subjects n = 50; % SD for normal distribution that governs the correlations of % non-covariate-related edges sigma0 = 1; FWER_threshold = 0.05; % Number of repetitions M_rep = 100; % Number of permutat...
89259e7a1a71271dbcdb51b42fe428b23c090e651dd4ce31ec8dd338575db08e
MATLAB
2,641
66
%% Read TDT Fiber Photometry Data into UnfoldToolbox Format % This example reads fiber photometry data and converts it to % (<https://www.unfoldtoolbox.org/index.html unfoldtoolbox.org>) format. % Artifact removal, detrending, dFF calculation is also included. %% Housekeeping close all; clear all; clc; BLOCK...
ff2792649d02c22fd45686587893565be3cc147e01a8a8e114c33711ffec13dd
MATLAB
2,645
102
% CHILD_TREE Attribute add-up child node values all nodes in a tree. % (trees package) % % child = child_tree (intree, v, options) % --------------------------------------- % % Returns a vector with the added up values in v of all child nodes % excluding itself. This is done for each node in the tree. This is a % ME...
1cb646fcbe4308aa502add958d6a969fbf0aff197e357c637fd399a4b40a605c
MATLAB
2,646
104
% IPAR_TREE Path to root: parent indices. % (trees package) % % ipar = ipar_tree (intree, options, ipart) % ----------------------------------------- % % Returns the matrix of indices to the parent of individual nodes following % the path against the direction of the adjacency matrix tocounter the root of % the tre...
7b351941264de3edb9b4f888658253fbce86cad2371359379d39db0a7a3e69c0
MATLAB
2,646
76
%%% sweep_2D_plots.m %%% Omkar N. Athavale, May 2023 %%% Plot results from 1D or 2D parameter sweeps %%% Run the data load section first, then the section of the figure to plot %% Data load data_path = '../data/2DSweep_230429201029'; load(data_path) if length(sweep_var) == 2 v1 = sweep_var(1); v2 = sweep_var...
aad126c0c1043357c35e3c9b593de7e9702dfd976204eaa3c438286147895448
MATLAB
2,649
53
function P_value = permutation_test_reg(Wm, X, Wp, CID, Clist, M, threshold_GT, Method) % This function performs a permutation test to evaluate the significance of % a statistic derived from regression between a matrix Wm and a vector X, % against permuted data. It uses a specified threshold to calculate...
459f345948db0333a569eb183693265e8fa36236414a131699e83b30cb80c515
MATLAB
2,650
91
function plot_peak_freq_tf(freqmat1, freqmat2, time_vec, plt,... structure1, structure2, dataset, freq_vec) %function plot_peak_freq_tf(freqmat1, freqmat2, time_vec, plt,... % structure1, structure2, dataset, freq_vec) % % This function plots the time course of the power spectrum of two signals % in a variety of...
3cda16662bdefb19e177b97637be3264772d1da9499a97364698304beda904bf
MATLAB
2,652
76
% Preprocessing unit test % % undersample tol = 10e-10; N = 120; X = randn(N,1); % Get default parameters param = mv_get_preprocess_param('undersample'); %% if data is already balanced then undersampling should have no effect clabel = ones(N,1); clabel(N/3+1:2*N/3) = 2; clabel(2*N/3+1:end) = 3; [~, ~, clabel2] = m...
ea9d60d366a5790dc81e0cb79ae0e56aa279c3d4d4d70e2e7508d62e683acbd8
MATLAB
2,653
113
function sff = sff_xyzt2strk(sff) %SFF_XYZT2STRK Summary of this function goes here % Detailed explanation goes here sff.stk = xyzt2strk(sff.xyzt,sff.prm); sff.xyztk = sff.stk.xyzti; end function strk = xyzt2strk(xyzt,prm) % build adjacency matrix strkKernel = determineStrkKernel(xyzt); adj = bui...
db8a1824b39ca745c5b05ef2517ff1e709a1e25d97ec5f2805f0de2c491d4e83
MATLAB
2,656
66
function fig = t2n_plotVoltSteps(targetfolder_data,neuron,steps,subtract_hv) % This function plots one or multiple voltage steps, which had been % previously simulated and saved with t2n_voltSteps. The exact loaded simulation % is defined by neuron.experiment. % % INPUTS % targetfolder_data destination of temporar...
102d1898269393d0e2edbf3f4406d72623ecc065561fd38a6bd85020214442aa
MATLAB
2,657
84
function settingsDirs = possibleSettingsLocations % Return all possible user settings locations of the Zapit optostim package % % function settingsDirs = zapit.settings.possibleSettingsLocations() % % Prurpose % Return all possible user settings directory locations for the Zapit optostim package...
cc2512853748b19a8b5776527e156e9b39072ae98e45a29efd4a6dd10f2b5a9a
MATLAB
2,660
92
function TMS_Waveform() %% Generate TMS pulse trains and write them in a file to be used in the % NEURON simulation. % Receive TMS parameters % 1: Monophasic, 2: Biphasic TMS_type = menu('Choose TMS pulse type:','Monophasic','Biphasic'); STEP_type = menu('Choose step time (us) :','5','25 (Default)'); %% prompt = {'...
ce8408566381c91962eb8d1ff44164a64b78594792c51cc2a86d86083b0c06eb
MATLAB
2,661
81
function R = simRcvrSens(Nimg,NrcvrXY,NrcvrZ) % Create receiver sensitivities with ~1/r^2 dependence and linear phase profile. % Some random fluctuations are introduced to make slightly more realistic. % Useful for reconstruction simulations. % % R = simRcvrSens(Nimg,NrcvrXY,NrcvrZ) % % Inputs: % Nimg: size of ...
0493eecfcc093ecb4183f7f15cacbe4896cbcf5cdbb22ec5adbe2ea947afc7be
MATLAB
2,662
95
function varargout = prfs(val, varargin) %prfs - Check that the value is a positive, real, finite, scalar number % % prfs(val) checks that val is a positive, real, finite, scalar number. % If it is, nothing else happens; if it is not, the function throws an % exception from the calling function. % % prfs(val, '...
4ec8c93a82602470fb6e3bcd6342d7e9203bc5f80aa81907dd03e0897ff8b9a4
MATLAB
2,663
96
function [ciu,Aall,anull,A,ciall,gam_range] = get_MRCC_mammals(K,sam1,sam2,maxC,r1,r2,tau) % % INPUTS: % K: mammals data -> [N*N*M] % sam1: samples communities first loop % sam2: samples communities second loop % maxC: max num communities % r1: initial gamma low %...
a34b70f6454b5913bef883579311d3650d9d1f7cd95e189663b517f129455e8d
MATLAB
2,663
81
% Let's load first the trees to be simulated wttrees = load_tree('../data/mtrs/wt_aligned.mtr');%{sample_tree}; % load sample tree tgtrees = load_tree('../data/mtrs/tg_aligned.mtr'); wteetrees = load_tree('../data/mtrs/wtee_aligned.mtr');%{sample_tree}; % load sample tree tgeetrees = load_tree('../data/mtrs/tgee_al...
11664999c1b186767a3be7058442d455af0f5ff52e8c061d33dd753cd33feb74
MATLAB
2,664
89
% Classifier unit test % % Classifier: ensemble rng(42) tol = 10e-10; % Random data X = randn(1000,100); clabel = randi(2, size(X,1),1); %% ensemble with 1 learner should be identical to testing the classifier directly [two-class LDA] cfg = []; cfg.feedback = 0; cfg.classifier = 'ensemble'; cfg.hyperpara...
2c17499df0fa399cd7aa43758cf7670719f043c235ccd5b2ae394a4bdc755b28
MATLAB
2,664
104
% Handle a couple of edge cases for tuning curve fitting % To refit an individual cell, the area and the cell number should be uncommented clear all; close all; %area = 'V1'; % max fitted spike rate exceeds measured max by a factor of %10, better fits acheived penalizing fits where the max fitted rate is more ...
4045723717261521f213355cfb889b61ce2fb2c2a638695b7dec2dd667dd02fb
MATLAB
2,664
84
function pac_plot_fun_spec(pacmat, ph_freq_vec, amp_freq_vec, measure, ... structure1, structure2, dataset, sig1, Fs, sig2) % function pac_plot_fun_spec(pacmat, ph_freq_vec, amp_freq_vec, measure, ... % structure1, structure2, dataset, sig1, Fs, sig2) % % This function plots a PACgram, with the frequency spectra ...
5cf90a456035e20c67c341529451ee11af09d4e3caf0e51be1f2d112d77512e6
MATLAB
2,664
80
function varargout = logTrialToFile(obj, filePath, stimIndex, laserPower, hardwareTriggered, stimDuration) % Write information on the current trial to the stimulus log file % % function fname = zapit.stimConfig.logTrialToFile(obj, filePath, stimIndex, laserPower, hardwareTriggered, stimDuration) % %...
a05d9342c0e5b58f17d72f0886e1fbd8297361c75e0c546255a209a74f248465
MATLAB
2,664
69
% Aggregates grand average waveform (GAW) results over all nodes and % subjects for activity on a slow time scale (< 0.1 Hz) % % USAGE: % GAW = computeGAWs_fast_timescale_agg(GAWnode_filenames) % % INPUTS: % GAWnode_filenames - cell array that contains filenames for results from % extract_statevar...
76d8664c0666cad76fe95d1cb6c05394bc0e133399fa7d18e020f93927fe061b
MATLAB
2,671
105
% ROOT_TREE Add tiny segment at tree root. % (trees package) % % tree = root_tree (intree, options) % ---------------------------------- % % Roots a tree by adding tiny segment in the root. % This function alters the original morphology! % % Input % ----- % - intree ::integer: index of tree in trees or structured...
7dfa57217794af133afd2dcebada2cddb6b9204680b93c27d2c7114d42bb5037
MATLAB
2,671
52
classdef test_regressor_export < matlab.unittest.TestCase methods (Test) function writesPackageCompatibleFiles(testCase) outDir = tempname; mkdir(outDir); cleanup = onCleanup(@() rmdir(outDir, 's')); result = struct(); result.regressors = reshape(...
82ec60aee1d5a981a8fbd185907377c6201112584d4f2fe6b5932372d9c1c23a
MATLAB
2,671
62
function [controlValues, sensorValues] = generateSigmoidData(varargin) % Generate a synthetic sigmoidal laser power curve for testing % % function [controlValues, sensorValues] = generateSigmoidData(varargin) % % Purpose % Produce a synthetic laser calibration curve that follows a logistic sigmo...
925530f055c1c6ee0d67046771229e62114699946246f839b495c919859e59ec
MATLAB
2,672
81
function varargout = even(val, varargin) %even - Check that all elements are even integers % % even(val) checks that all elements of val are even integers. If they % are, nothing else happens; if they are not, the function throws an % exception from the calling function. Integers stored in non integer % numer...
270b4e1f639b96ab1a46c106e94f41eeca7de5ea37bb0036d54b3e011d6fa8ed
MATLAB
2,674
72
function n = t2n_getref(n,neuron,field) % This function returns the neuron instance that is referenced in neuron % instance 'n' at field 'field'. If the neuron instance has own definitions % at 'field', n itsself is returned. The function t2n_as produces such references. % % INPUTS % n index of the neuro...
5cdab4d52d8c7e9d412c799ad53f981a89360a0880f9c5460238b0653e4a3503
MATLAB
2,674
86
% this is time inside eye boundary, see a0_13_insideFaceTiming2 clear close all force warning on imSize = [733, 977]; imSizeCent = fix([733, 977]/2); %% y1 = imSizeCent(1)+(-130:70); x1 = imSizeCent(2)+(-120:0); y2 = imSizeCent(1)+(-130:70); x2 = imSizeCent(2)+(0:120); y1 = [y1(1),y1(end)]; x1 = [x1(1),x1(end)]; y2 ...
0b432becbc69d236b6426a1947230a371644156f77ed121afe3bebc814a23167
MATLAB
2,675
79
function z = LK_CoactivityZScore_20220615(varargin) % % LK_CoactivityZScore_20220615 estimates a coactivity z-score between pairs % of cells during ripples. % % Use as: z = LK_CoactivityZScore_20220615(activityCellA, activityCellB) % or: z = LK_CoactivityZScore_20220615(N, nA, nB, nAB) % % Input version #1: % a...
e64a0deba7e11625c0761fa45508bcab8b0809351dc6e8e5920f3a5b270df9bf
MATLAB
2,676
65
%RunElectodesClassificationMatlabFunc clear all matlabImpute = true; imputeIters=20; NumTreesVec = [80]; substractMouseMean = true; %LeaveOut = 'Stimuli'; %LeaveOutVec = {'Stimuli','Session','mouse'}; LeaveOutVec = {'mouse'}; %ElectodesClassificationMatlabFunc(unifyContextClasses ,averageAllBoutsFromSession ,....
a1dd758369c1ec9847f83b155164c70878ec74de51aa03af3948ff5dd70568f0
MATLAB
2,678
88
% op_getSNR.m % Jamie Near, McGill University 2014. % % USAGE: % [SNR]=op_getSNR(in,NAAppmmin,NAAppmmax,noiseppmmin,noiseppmmax,suppressPlots); % % DESCRIPTION: % Find the SNR of the NAA peak in a spectrum. % % INPUTS: % in = input data in matlab structure format % NAAppmmin = min of frequncy range ...
beaba7bc54115c63d197b70bbc8a66321d271b6e9b2689db2de415b8cb708b7b
MATLAB
2,680
65
%RunElectodesClassificationMatlabFunc clear all matlabImpute = true; imputeIters=20; NumTreesVec = [80]; substractMouseMean = true; %LeaveOut = 'Stimuli'; %LeaveOutVec = {'Stimuli','Session','mouse'}; LeaveOutVec = {'mouse'}; %ElectodesClassificationMatlabFunc(unifyContextClasses ,averageAllBoutsFromSession ,....
b48893f89f685b6f2960efd226c1309d5a61e6e042fe3acca82051a2c5f8da3c
MATLAB
2,683
109
% FLIP_TREE Flips a tree around one axis. % (trees package) % % tree = flip_tree (intree, DIM, options) % --------------------------------------- % % Flips tree around dimension DIM. % % Input % ----- % - intree ::integer: index of tree in trees or structured tree % - DIM ::1, 2 or 3: dimension to be flipped %...
1623e043f0d7c3fffef868cc61b5451cc0c3842aa97c7dd4bc4d88409f006b9c
MATLAB
2,685
74
classdef DataDetectSigsDummy < DataDetectSigs %DataDetectSigsDummy - Data from dummy signal detection % % The DataDetectSigsDummy class is a data class that is designed to % contain all the basic data output from CalcDetectSignalsDummy. % % DataDetectSigsDummy public properties inherited from Data: % mask ...
7e7a0a110880a5a82b1879d704228bee5e098f7259e13b7ad6e11d405cdc074c
MATLAB
2,687
63
function ImgGroupObj = from_files(varargin) %from_files - Create an ImgGroup object from a list of files % % OBJ = ImgGroup.from_files() prompts for all required information and % creates an ImgGroup object from existing files. The resulting children % will be of the same type and have the same config. % % OBJ...
7008cde6f9668f2a7d18fdc57338032439b9ea77cf63ef9450b8cc1f77cb94c5
MATLAB
2,688
100
function respPhase = calculateRespPhase(pulset, time, doHilbert) % adapted from TAPAS verbose.level = 2; resp_max = inf; overshoot = find(abs(pulset) > resp_max); pulset(overshoot) = resp_max; rsampint = time(2) - time(1); % Compute normalized signal and the sign of the derivative % pulset = tapas_physio_filter_r...
bce1823b810eb3c561db26e1cf4909f42cbc9f440251e5df8b110347b3d70f93
MATLAB
2,688
67
function x = spatialPattern(DIM,BETA), % function x = spatialPattern(DIM, BETA), % % This function generates 1/f spatial noise, with a normal error % distribution (the grid must be at least 10x10 for the errors to be normal). % 1/f noise is scale invariant, there is no spatial scale for which the % variance pl...
f6c72876e50d5376cfd8b446cb53444469ff5ebd55fdbbeeb9a0b03a5c051662
MATLAB
2,691
73
function check_optList(self) % 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 version 3 of the License, or %...
6756d3aea3f8ffbdd8b63b67ed38158bf73945e22b7098b75698e89ed9b188ac
MATLAB
2,692
88
% op_blockAvg.m % Jamie Near, Sunnybrook Research Institute 2024. % % USAGE: % out=op_blockAvg(in,N); % % DESCRIPTION: % Compress a dataset along the averages dimension by combining the averages % into blocks of N averages. The N averages in each block are then averaged, % leaving a new dataset with Navg/N transien...
a49917ec121409ed5bd02116829ea20830210dd6271c037c18f65158c517dbe7
MATLAB
2,695
99
%% whiteness % % Durbin-Watson test for whiteness (no serial correlation) of VAR residuals % % <matlab:open('whiteness.m') code> % %% Syntax % % [dw,pval] = whiteness(X,E) % %% Arguments % % See also <mvgchelp.html#4 Common variable names and data structures>. % % _input_ % % X multi-tr...
bec762af1023497c4dc13e1f3e78d0073211d26dc99ba4cc9b67b3319a1b61e7
MATLAB
2,695
81
function aperiodic_sensitivity(iChunk) % baseFolder = 'E:\Research_Projects\004_Propofol\data\simulations\raw\aperiodic_interactions'; baseFolder = '/lustre04/scratch/nbrake/data/simulations/parameter_sensitivity_analysis_2'; addpath('/lustre04/scratch/nbrake/code/simulation_code'); load(fullfile(baseFolder,'paramete...
5893d54bc91394ebeddceb41e5ca359040f69d4a1a6dcac9e390dec3ac419bb9
MATLAB
2,698
69
function spm_TFCE % TFCE Toolbox wrapper to call TFCE functions % ______________________________________________________________________ % % Christian Gaser % Structural Brain Mapping Group (https://neuro-jena.github.io) % Departments of Neurology and Psychiatry % Jena University Hospital % ____________________________...
80c1412f2fefb259ae37412581b5ebde298181ee6a446c9537644c978f0f769d
MATLAB
2,704
93
function [loglik] = EEGfMRIPav_cbm_mod06(parameters,subj) % Standard Q-learning model with delta learning rule and with Go bias, % Pavlovian response bias, and separate learning rate for salient Gos % (action priming model). % ----------------------------------------------------------------------- % %% Retrieve param...
18ba55b508356a90573759af07dd5f37d80dc4e0a0fe4608d5b8f90aa6450952
MATLAB
2,709
79
function masksOut = choose_masks(self, imgTypes) %choose_masks - Protected class method to choose multiple masks % 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 ...
32c612889cd14da39fee884694078248422a564ec2af4680767c926b3095237c
MATLAB
2,711
95
clear clc file = '/home/.../.../'; % Load file containing the time series for each participant mut = -1; group = 'test'; studygroup = 'all'; ylab = 'age'; [id,y,study,fd,mutation] = load_data(file,mut,group,studygroup,ylab); if strcmp(group,'test') load TrainInfo_extra_new.mat end disp('selecting links ...') i...
39a3679cfa6e2bf50e85790be508bf717f637dc901a2a9437b47eceae367c898
MATLAB
2,711
98
% Classifier unit test % % Classifier: svm rng(42) %% do not change - might affect the results tol = 10e-10; mf = mfilename; %% check classifier on multi-class spiral data: linear classifier should near chance, RBF kernel should be near 100% % Create spiral data N = 500; nrevolutions = 2; % how often each cl...
66bfc9eb9d1b77f1e076f233304fcb78c65beb5af02fa66d7adddfaa9467e464
MATLAB
2,712
94
% BIN_TREE Binning nodes in a tree. % (trees package) % % [bi, bins, bh] = bin_tree (intree, v, bins, options) % ---------------------------------------------------- % % Subdivides the nodes into bins according to a vector v. This is simply % the histogram and can be applied for example on x-values, euclidean % dist...
9bf9c6362515585e5f9bd7182a541bc651b1cc72883641e15fd3bf84f066dca6
MATLAB
2,713
96
%% ICA for fMRI and QSM % % Independent component analysis used to see if we can separate breathing / % cardiac % fMRI presents the possibility of saving phase data, which can be used for % QSM or as input to other phase-sensitive MR imaging pipelines % 10 Aug 2022 % Editors (alphabetical order): % Alexander Jaffray...
9e8c3b84711535f969f669a934cc8812b8b098a187a7d7cdd6faf4bd7fdb651a
MATLAB
2,714
87
function subclasses = find_subclasses(superclass, varargin) %find_subclasses - Helper function to find subclasses % % 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 ...
d1807bbf622557ca3e929ac24e318fd0ab392be48d70b20de1e1f03249259d33
MATLAB
2,717
71
classdef Test_CalcFindROIsFLIKA_params < matlab.unittest.TestCase %Test_CalcFindROIsFLIKA Summary of this class goes here % Detailed explanation goes here % ================================================================== % properties (TestParameter) classCalc_FRF = utils.find_subc...
e3f27b583e76d5038940f66b2edef5c86778606fd7b9a55247fa5f3ae9dd4228
MATLAB
2,717
68
function [imp,freq] = t2n_resonance(neuron,tree,amp,holding_voltage,doerrorbar) % Perform a resonance test (impedance measurement using oscillating current % injections) on each cell and plot the result. % % INPUTS % neuron t2n neuron structure with already defined mechanisms % tree tree cell ar...
924519bb48076c4ab457c5766650126965b7069bc4c0101198e338373c579c49
MATLAB
2,719
78
% detecting the FWHM of a sigle beads % last modified 2022-05-25 function fullwidth = find_FWHM(new_img) %---------------------------find the FWHM------------------------------- %find the center of the intensity plot % BW = new_img > 0.1; % CH = bwconvhull(BW); % imshow(CH); % hhh = regionprops(CH,'Centroid')...
25b1783dfbe6538cab169d92cccee9eebd71c6d4504c445a0713c0fe427c1207
MATLAB
2,720
87
clear;clc; close all load([pwd,'\temporary data\Sub_score.mat']); Sub_score; % 30 subject *2 condition *60 frequency*3 score load([pwd,'\temporary data\fbcca_stime.mat']); ac_stime; % 30 subject *2 condition *3 frequency_band *50 data_length subs=30; condition=2; freq_band=3; frequency=[2 3 4 5 ;12 13 14...
b3b3ee20020f294b3cc2b4246ebd844dc3781779de6b468faa59fdedf9d30600
MATLAB
2,720
79
% the pattern separation toolbox: analyse spike train ensembles % Copyright (C) 2022 Alexander D Bird function [output_spiketimes] = spike_thinner_spatiotemporal(input_spiketimes,n_rep,filt_len) %SPIKE_THINNER_SPATIOTEMPORAL Removes spikes from input trains if they are within %'filt_len' of any other spike in th...
7c97c44b40adad14f0c00784098b7017f66006439ce895ef5b0ae1b0b95900a3
MATLAB
2,721
85
% SCALEBAR Add a scalebar to an axis. % (scheme package) % % HP = scalebar (unit, pos) % ------------------------- % % Adds a scalebar to the axis. % % Input % ----- % - unit ::string: {DEFAULT: micrometer, '\mum'} % - pos ::string: position {DEFAULT: southwest '-sw'} % '-sw' : southwest % '-se' : ...
2ade02186dfba5cae53601a6faa534fee809a0f25016c980502b0541396fd31f
MATLAB
2,727
87
function gain = find_gain(chSeq, streak, verbose) %find_gain - Calculate gain of the optical system % % [offsets, refImgs] = find_gain(CHSEQ, STREAK, VERBOSE) takes a movie % CHSEQ and calculates the GAIN of the optical systemon which the movie % was recorded by looking at the relationship between the standard %...
8ffd4c830663cd65aade1ae45b15955f6920ad4042e35e675168bc4cc352f4f6
MATLAB
2,731
103
function dataInterp = interp_masked(self, dataRaw) %interp_masked - Linearly interpolates data points that have been masked % 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 ...
d4be2cb355798df2066b22254dc5d36ccc72dda8a7bb80e540d2c8617a68096e
MATLAB
2,732
76
%% Define all relevant parameters and known number of tiles per round % This is the CA1 complete hippocampus acquired on July 9th-July 14th % Numbers are from metadata and examining the raw data folders numTiles = 170; numRows= 10; imgSizeXY = [2048, 2048]; imgResXY = .1625; % in um, Taken from the .ims properties re...
7edbd8bf186e47b00042fe388ace8a84f66743dd75d73c97d3abcb49d7e53182
MATLAB
2,733
86
inputname='Gi17547'; timepoint='wk7'; %detect stops(no=0, yes=1) stopdetect=1; inputname2=strcat(inputname, '_stimtb.mat'); load(inputname2) %time resolution for z-score analysis (+/- in sec) timeres=1 %extract value for control period d=0; for c=1:length(LocoSynth); if LocoSynth(c).time==timepoint; ...
f2a5df12c782db11c9e506e1866407b7ea1fbb28a750546bd84659fae10c4166
MATLAB
2,733
87
function varargout = plot_clsfy(self, hAxes, 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 vers...
ffff2663bb63f64d88d381e29b4710f3e9a61c41ac4687ccf160782634b26455
MATLAB
2,733
75
function varargout = num_dims(val, nDimIn, varargin) %num_dims - Check that the variable has the assumed dimensionality % % num_dims(val, nDimIn) checks that val has number of dimensions % specified with nDimIn. If it has, nothing else happens; if it has not, % the function throws an exception from the calling fu...
74ff68c23c4fc61377f6b9831d93929c5ad35f0fd0c6fbe3649226f5c933b2f0
MATLAB
2,739
93
function children = create_children(self, varargin) %create_children - Protected class method to create children to add % 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 Lice...
ce4739f4e274ede161a21ac6fb6e8f3de1dd94ebf54e4a67af04a99f8ccac28b
MATLAB
2,740
95
function [dataOut, varargout] = check_data(self, dataIn, varargin) %check_data - Check the data and do some other things here for convenience % % YY = check_data(OBJ, XX) % % MM = check_data(OBJ, XX, DOMEAN) % % MM = check_data(OBJ, XX, DOMEAN, DATANAME) % % [YY, SEM] = check_data(OBJ, ...) % Copyright (C) 2...
22306e373b87be679fff03e9e98a9c8cfbe880daf35a9dbccd1f12b1ff42ad46
MATLAB
2,741
88
outname='Gi17547'; outname2=strcat(outname, '_stimtb.mat'); %%last update october 21, 2020 nbpulse=1; %check the directory, count nb of file datalist=dir; nbfile=length(datalist); nbelem=0; LocoSynth=[]; %read directory. How many file do we have? create a database. for a=1:nbfile if datalist(a).isdir...
fab2b64d934b970872307d473d2269902f73bea9cac7127f82e4785e961522fc
MATLAB
2,742
84
function dirs = slice_display_set_dirs(dirs) % dirs = slice_display_set_dirs(dirs) % % Initialize directories, add paths to necessary toolboxes. % All diretories have defaults (none necessary). % % INPUT: % % dirs = structure with options (optional settings). % % OPTIONAL INPUTS: % .root = ...
45bbf0d87af99d31a11b2a8a200e7714414f747062752656a63628cca10d6256
MATLAB
2,743
71
function [probMat, subCoords] = fillProbMat( iFrame, ... chSeq, refImg, maxDy, maxDx, Ny, Nx, numLines) %fillErrMat - helper function conforming to parfor % This function calculates absolute error of all possible considered ... %vertical and horizontal shifts totLines = (numLines - 2*maxDy); subCoords = zeros(to...
8ea876b398d354d37605a050dccdaa2f8f5a4d272005ab8dd537163fdc89f91a
MATLAB
2,744
103
function varargout = plotStimuli(stim) % Plot stimulus locations associated with a stim config file % % function zapit.utils.plotStimuli(stim) % % Purpose % Plot stimulus conditions as numbered points on a top-down % atlas view. % % Inputs % stim - Either: 1) Relative or absolu...
5b49fdd5f811923f8d271b0f7e522b9bf7ba129d87e572804d95379c70eaf246
MATLAB
2,746
115
function A = adjacency(DATA, TYPE, PARAM, DISTANCEFUNCTION); % Compute the adjacency graph of the data set DATA % % A = adjacency(DATA, TYPE, PARAM, DISTANCEFUNCTION); % % DATA - NxK matrix. Data points are rows. % TYPE - string 'nn' or string 'epsballs'. % PARAM - integer if TYPE='nn', real number if TYPE='epsballs...
687975d2acc09d1954ccdc2ed95c535fb553843331b229cf490cdbd11ef44c51
MATLAB
2,747
120
% clear close all force warning on imSize = [733, 977]; pix2deg = 34.910; imSizeCent = fix([733, 977]/2); y1 = imSizeCent(1)+(-130:70); x1 = imSizeCent(2)+(-120:0); y2 = imSizeCent(1)+(-130:70); x2 = imSizeCent(2)+(0:120); y1 = imSizeCent(1)+(-70:70); x1 = imSizeCent(2)+(-120:0); y2 = imSizeCent(1)+(-70:70); x2 = i...