sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9c84e1f6b563cd0ec53a90f28fc6d04496731a0018b7a6333b6a3bf991806942
MATLAB
1,857
75
% GM_TREE Membrane conductances of the segments of a tree. % (trees package) % % gm = gm_tree (intree, options) % ------------------------------ % % Returns the membrane conductance of all elements [in Siemens]. % % Input % ----- % - intree ::integer: index of tree in trees or structured tree % - options ::string...
ef8ace747156d60f4dd9846b9984b516b3015fc74f8898a78acf02a7298fa1c1
MATLAB
1,858
49
%Define paramters simparams.IMAGE_RESOLUTION_XY = .165; %microns simparams.IMAGE_RESOLUTION_Z = .165; %microns simparams.IMAGE_FOVSIZE_XY = 150; simparams.IMAGE_FOVSIZE_Z = 50; %puncta size (I think u=10 and s=3.5 is correct but it's slow) simparams.PUNCTA_SIZE_MEAN = 8; %FWHM simparams.PUNCTA_SIZE_STD = 3; simparams...
46ee619b2a0d32b2450920e78607d57c07b3f7f4e954217d6052dd3dc57eadc6
MATLAB
1,859
48
function hFig = createPrintFig(figSize) % Defaults for this fig. width = figSize(1); % Width in centimeters height = figSize(2); % Height in centimeters alw = 0.75; % AxesLineWidth fsz = 11; % Fontsize lw = 2; % LineWidth msz = 6; % MarkerSize ...
7e0c72c2812e17a7f18cb82ab498d2949cbd8cd1551cef299ff0c6eb573fe2f5
MATLAB
1,860
51
function t2n_showNetState(neuron,trees,out,tim) for t = 1:numel(trees) if ~isfield(trees{t},'artificial') || ~trees{t}.artificial trees{t} = rot_tree(tran_tree(trees{t}),[],'-m3dY'); else trees{t}.X = 0; trees{t}.Y = 0; trees{t}.Z = 0; trees{t}.dA = sparse(1); end en...
1821224887870e11d0ce2039ee9ef48557951cb91de38f06bba7b2ce8c0400ef
MATLAB
1,862
33
function [ spike_rate_mat_neuron_by_angle ] = calculate_spike_rate_neuron_by_angle( T, G, Ang, wake ) global BEHAVIORAL_SAMPLE_RATE NEURONAL_SAMPLE_RATE NUMBER_OF_ANGLE_BINS CENTER_OF_ANGLE_BINS; number_of_neurons = max(G); wake_start_behavior_sample_index = ceil(wake(1) * BEHAVIORAL_SAMPLE_RA...
521d681f9e3e378c4b476688fc8489f504105510a2208934f0ddede919c8d69f
MATLAB
1,864
54
function varargout = plot(self, varargin) %plot - Plot a figure for each child object % % plot(OBJ) sequentially loops through the elements of the ImgGroup % object and calls the plot_fig method for each of the ImgGroup children. % % plot(OBJ, ...) passes any additional arguments to the child method. % % H = pl...
808ece0b57ef15c6cab74f2ccb21b67b57af15f6b9ae2712aeb113b9bbd20929
MATLAB
1,864
82
clear close all force warning on 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); if any(I) I(I) = arrayfun(@(x) x.analyze.(mfilename) , dataTrl(I)); end nTrialAllNext...
3934e19d34ef196c220da4c94f8fcea4c160f2594a250296e29c38d1242f8de6
MATLAB
1,865
39
% This produces an analog output waveform .mat for generating a single % stimulation pulse train with a particular duty cycle.p on all channels. % An analog output waveform .mat file must contain two variables: % rate - int. samples per second, must match handles.s.Rate % waveform - (N x 4) vector of voltage valu...
ce597fa3814be2c3a5dfede3fd6852318de6e3460dbbeff158432ec4d9e42204
MATLAB
1,865
52
function id = defaultId % DEFAULTID returns a string that can serve as warning or error identifier, % for example 'FieldTip:ft_read_header:line345'. % % See also WARNING, ERROR, FT_NOTICE, FT_INFO, FT_DEBUG % Copyright (C) 2017, Robert Oostenveld % % This file is part of FieldTrip, see http://www.fieldtriptoolbox.org...
7e29a8d646e70b37d7db897c5d764bc06848f6a495c9d65fb75b8a77ea85317e
MATLAB
1,866
89
clear all close all currentdiectoryLocation=pwd; addpath(strcat(currentdiectoryLocation,'/functions/')) [decoder.preprocessing.bandPassFilter.b,decoder.preprocessing.bandPassFilter.a]=butter(2,[8 30]/(512/2)); dataLocation = 'expertMIData'; allRunsInfo = dir(fullfile(dataLocation, '*.gdf')); nRuns=size...
e03088cfcde6a17da524e68e3e3625f3f251a4bf93399e12b5afcf805cc69d7a
MATLAB
1,869
54
function varargout = opt_config(self) %opt_config - Optimise the parameters in Config objects using a GUI % % opt_config(OBJ) opens a GUI that allows interactive adjustment of the % parameters in each Config object of each child. The GUI can also be % used to reprocess the object, and produce various plots, which...
8a0d8f1fda068ffa85bb7e5ddd61ab3de3f8e859f9bf29a9fca52ca44ad136c5
MATLAB
1,872
52
classdef (ConstructOnLoad) ED_NewRawImg < event.EventData %ED_NewRawImg - Event Data for IRawImg.NewRawImg event % % ED_NewRawImg public properties: % wasEmpty - Whether or not the rawImg property was previously empty % % ED_NewRawImg public methods: % ED_NewRawImg - ED_NewRawImg class constructor % % See also ev...
fcfbac4015a2ffed6a7d7b23737b5348a240a849d9140ebfc2178f1d9aa76bd4
MATLAB
1,872
42
function MakeCatSbxz(sbxPath, sbxInfo) % Check if the sbxz file already exists [~, sbxzPath] = FileFinder( sbxInfo.dir, 'type','mat', 'type','sbxz' ); if isempty(sbxzPath) % Load interpolation results [~, zinterpPath] = FileFinder( sbxInfo.dir, 'type','mat', 'contains','zinterp' ); if ~isempty(zinterpPath)...
e1e10328722b8aff5e8efdea61fc78bb2b45865ccac9cbc0825b8fdc6fedb541
MATLAB
1,878
41
function [T0_vec, score_max] = custom_statistic(Wp, Clist, CID, threshold_GT) % calculate test statistics from permutation test all_pvec = squareform(Wp); % get number of clusters cluster_len = length(CID); % define test statistic for each ...
2b116ff75641cbb6f9f092edbeb80ec4692761e903d53f52c76470cfbaa3a08b
MATLAB
1,879
63
% the pattern separation toolbox: analyse spike train ensembles % Copyright (C) 2022 Alexander D Bird function [hamming_obj] = hamming_sparsity(input,output,num_params) %HAMMING_SPARSITY Records Hamming distance (corrected for sparsity) between spike trains if nargin<3 || isempty(num_params) num_params=st...
4c13c1c30f31b607e2faa99c1b6ccad254fcc0e5192d690f5c311090e1937c60
MATLAB
1,880
78
cd ..\ load('foldersAllIndvFOV.mat'); cd('runingLocationConsistency'); load('E:\ID20211030\20211123Loc1Old\loc1Old\pcaica\cueAnalysisNew_sig\tempL.mat'); load('E:\ID20211030\20211123Loc1Old\loc1Old\pcaica\cueAnalysisNew_sig\tempR.mat'); tempLO=tempL; tempRO=tempR; load('E:\ID20211030\20211123New\loc1New\pcai...
67125e563659af782f7c4913dcc630453062d80a84e1a073546ecb482b54a685
MATLAB
1,880
56
tfce = tfceMex_maxtree_batch(T, E, H, calc_neg, geom, n_threads) % Apply exact TFCE to many maps at once, one map per thread % FORMAT tfce = tfceMex_maxtree_batch(T, E, H, calc_neg, geom, n_threads) % T - N x B matrix, one T map per column % E - TFCE parameter for extent % H - TFCE parameter for...
6722a0fca94ea6dfbb373def465c5480e07423d35b46b52f7229e8e36198db36
MATLAB
1,880
48
%RunElectodesClassificationMatlabFunc clear all matlabImpute = true; imputeIters=20; %NumTreesVec = [10,20,40,80]; NumTreesVec = [80]; substractMouseMean = true; %LeaveOut = 'Stimuli'; %LeaveOutVec = {'Stimuli','Session','mouse'}; LeaveOutVec = {'mouse'}; %ElectodesClassificationMatlabFunc(unifyContextClasses...
6763793a21dd3c702bd2f8fb7bf63bbd9fa4ab3a97a14376bc01ab8eb5b16be2
MATLAB
1,881
69
function ReducedDataArray=DimentionalityReduction_LEM(activity_mat_active_frames,p_neighbors_vec) %Inputs: %activity_mat_active_frames: N-by-T activity matrix, N is number of neurons %and T is number of time frames (includes only active frames) %p_neighbors_vec: 1-by-2 vector of portion of neighbors that are consider...
877a514175c29f9befb2bbf74d9865f114d2027c0c1b8950227a85be485e0923
MATLAB
1,882
42
function hSubAx = plotLasagnaTracesFromCell(hFig, allNeuronsOnOffTraces, colors, varargin) timePoints = (0: size(allNeuronsOnOffTraces{1}, 2)-1) /10; if ~isempty(varargin) timePoints = varargin{1}; end cLims = ZeroCenteredBounds(cat(1, allNeuronsOnOffTraces{:}), [0 100]); figure(hFig) nNeurons = numel(allN...
94c77fe068097871a66a9698096a837f1537b521f49dfb722bcc2aef32bdbcf0
MATLAB
1,882
69
function WriteDigOutSingleChannel(devID) % Flip Port0/Line0 of named device on and off at random intervals until ctrl-c is hit % % function nidaqmx.DO.WriteDigOutSingleChannel(devID) % % Purpose % Example showing how to write to a single digital channel using software time commands. % This is the most basic possible th...
1c93c8aa2f539dd6a821b29312a583c640208d999ed784f0f7f8385888b04097
MATLAB
1,886
48
%RunElectodesClassificationMatlabFunc clear all matlabImpute = true; imputeIters=20; %NumTreesVec = [10,20,40,80]; NumTreesVec = [80]; substractMouseMean = true; %LeaveOut = 'Stimuli'; %LeaveOutVec = {'Stimuli','Session','mouse'}; LeaveOutVec = {'mouse'}; %ElectodesClassificationMatlabFunc(unifyContextClasses...
b9808ce0b25f449113cdf564a7530ccbd38522e0ffbe672c2276a19900989722
MATLAB
1,887
86
%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...
e83f1ce8cde1ca4c49ae5261cd39fc3eee9da83177add10307c2cd1f799ef009
MATLAB
1,887
66
function plot_ref(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 % (a...
a1b33127f9b1c3e301658498f1fba2fe17ebf405f6fb2035153b31dd9a28d388
MATLAB
1,889
57
function self = choose_channels(self, varargin) %choose_channels - Protected class method allowing the user to manually % specify/create the channels structure % 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 unde...
b18aae9062dbcad8a971e5ab6d8dcc6f4dd55e81f8113e63d51d11e27dc4da0d
MATLAB
1,889
66
% MotionCalc.m % Inputs: % (1) Demeaned motion file from volume registration % (2) Right hand force trace (downsampled, normalized, demeaned, pre-HRF convolution) % (3) Left hand force trace (downsampled, normalized, demeaned, pre-HRF convolution) % % Outputs: % (1) Average FD % (2) Percent censored volumes at FD > 0....
ff32cb2bb705b89c42cccb8b8e6f7095f63d7978e7c31007ae891e5631440526
MATLAB
1,889
60
classdef Test_CompositeImg_ui < matlab.unittest.TestCase % ================================================================== % methods (TestMethodSetup) function clear_persistent(~) utils.clear_persistent(); end end % ======================================...
b3119407b3b7b180ab57f020563e12f36bba2a00a3b276b3562ef8374597346b
MATLAB
1,890
48
%RunElectodesClassificationMatlabFunc clear all matlabImpute = true; imputeIters=20; %NumTreesVec = [10,20,40,80]; NumTreesVec = [80]; substractMouseMean = true; %LeaveOut = 'Stimuli'; %LeaveOutVec = {'Stimuli','Session','mouse'}; LeaveOutVec = {'mouse'}; %ElectodesClassificationMatlabFunc(unifyContextClasses...
30cc1eb47a20f2377cc0ccba73811da9d8e97b870edc2ddcaedd25797df74e01
MATLAB
1,891
44
function rawImg = from_files(varargin) %from_files - Create a SCIM_Tif object from a list of files % % OBJ = SCIM_Tif.from_files() prompts for all required information and % creates a SCIM_Tif object. % % OBJ = SCIM_Tif.from_files(FILENAME) creates an object from the % specified filename(s). FILENAME must be a...
5f3469174a96a2bb121a87bad1a618ff5177a7ba6dc821cae9978ee4eb50dce3
MATLAB
1,894
60
function peakData = analyse_peak(trace, frameTime, pk, idx, width, ... prom, pType, numPeaks) % 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 % ...
7976ec4606b8a6f1e2e62e33ef4cc1448eda6e342662d555adb4e305454ee42d
MATLAB
1,894
54
function drawBrainOutlineOnSample(obj) % Run the beam around around the brain outline % % zapit.pointer.drawBrainOutlineOnSample() % % Purpose % Draw the brain outline onto the sample using the laser and scanners. % Once started you can stop it with zapit.DAQ.stopAndDeleteAOTask. % This...
32b696a489843d1b819f215fec845029a0f604371d863948a77555cefe584161
MATLAB
1,898
51
% op_CSIaddPhase.m % Brenden Kadota, Sunnybrook 2022 % % CSI version of op_addPhase. Takes in MRSI structure, zeroth order phase, % second order phase, and pivot to apply phase corrections. Adds phase to either % time domain or frequency domain depending on the data dype in the data field. % % Input: % MRSIStuct ...
13e6f309f94a3618b4462053624152a9d2636684937c0bb36bebbf3705514d39
MATLAB
1,900
51
function SaveAllSingleAndMultiFromAllTetrodes_25_5_2017() ClusterToAdd=1; bins=0:1:5400000; SpikesAlongTimeInMilliSec=[]; [SpikesfileList, SpikesFilesPath] = uigetfile('*.mat','Select neural spikes data files','MultiSelect', 'on'); prompt = {'Vector of clusters numbers:','Vector the ident...
809c3c8a9479188f05fd594c4f767d81beb6ed711fe8a6367435811d768babdf
MATLAB
1,900
54
%op_CSIIntegrate.m % Brenden Kadota, Sunnybrook 2021. % % USAGE: % in=op_CSIintegrate(in); % % DESCRIPTION: % Integrates the spectrum from ppmmin to ppmmax in all csi voxels. % % INPUTS: % MRSIStruct = CSI FID-A data structure % pmmmin = lower integration bounds % ppmmax = upper integration bounds % mode ...
de5bf8c99410236b6adcf3fac11484e8999babef689d3e7b3dd36ec57fe3fb3e
MATLAB
1,901
42
%% Train mouse-specific models mainDir = 'D:\2photon\'; mouse = {'DL112'}; % {'DL102','DL89','DL115','DL118','DL68','DL75','DL112','DL117','DL72','DL67','DL122'}; % D:\2photon\DL102 Nmouse = numel(mouse); mouseLoco = cell(1,Nmouse); tic; for m = 1:Nmouse mouseDir = strcat(mainDir, mouse{m},'\'); [~,mou...
ce8c2e77e05ab974ff10f6d965593f9dc605c33603e352dad562ff50ff1fa21d
MATLAB
1,905
84
%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...
7ec8ac8a6e5c3011e704a05e982c5154728b09083478afe981f41766ff09aa64
MATLAB
1,907
46
classdef Test_ConfigFrameScan < matlab.unittest.TestCase %TEST_CONFIGFRAMESCAN Summary of this class goes here % Detailed explanation goes here % ================================================================== % properties end % ===================================================...
674cf07d84b87ec31f9d84a88dc7e4b9a872b491590d7878a2e9f7cd7e4e5a19
MATLAB
1,909
44
function rawImg = from_files(varargin) %from_files - Create a BioFormats object from a list of files % % OBJ = BioFormats.from_files() prompts for all required information and % creates a BioFormats object. % % OBJ = BioFormats.from_files(FILENAME) creates an object from the % specified filename(s). FILENAME m...
710808b33d8c90622ab191ff4b78d127c767f16ec60fa0ab2626c685632213ac
MATLAB
1,915
80
% the pattern separation toolbox: analyse spike train ensembles % Copyright (C) 2022 Alexander D Bird function [orth_obj] = orthogonalisation(input,output,num_params) % ORTHOGONALISATION Records normalised dot product of the spike trains if nargin<3 || isempty(num_params) num_params=struct; end if ~isfie...
cbedd8b19e0e655d93fc9e51d8bdf1cd1a2e2ed6df91ae633dfa6bcfa3e97bdd
MATLAB
1,919
63
clear all close all dataFileName = 'C:\David\Phd2020\ElectordesClassification\Data.xlsx'; NumTrees = 20 [DataMatrix, Labels] = GetDataMatrix(dataFileName); %each column in DataMatrix is a single example valid = sum(~isnan(DataMatrix))>0; %examples that are all nans are removed DataMatrix = DataMatrix(:,val...
a16d2f5ff1ab9f1ff7a1990b49671b3e15e2196fa63b5c354926498a960356c9
MATLAB
1,920
56
function classlist = find_classlist() %find_classlist - Return the list of non-default classes on the path % % 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 ...
01b4abe1b4e1010d4f7933a93c51ebe753aeee31628a4e37ad9b8822b123d881
MATLAB
1,923
71
function [status, errmsg] = ensureDirExists(pth) % Make sure a directory exists, creating parent directories if needed % % [status, errmsg] = ensureDirExists(pth); % % Status = 1 if the path exists or is successfully created, 0 otherwise. % % ras 06/06. if ~ischar(pth), help(mfilename); error('Need a path string'); ...
2107e417ee3b221924f9717cbae4cea58e8c5430c3e255969d24935b2c4e8f73
MATLAB
1,925
63
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); hWB = waitbar(0,'checking the trials ...'); %load tirals info load('a0_0_bhv2trialStrct.mat'); NTrial = find([d...
5662806574aba42bf079a04245647cb21aeb3e0e5b2ba19e3866ce3df0f69e66
MATLAB
1,925
75
function y = nanmedian(x,dim) % FORMAT: Y = NANMEDIAN(X,DIM) % % Median ignoring NaNs % % This function enhances the functionality of NANMEDIAN as distributed % in the MATLAB Statistics Toolbox and is meant as a replacement (hence % the identical name). % % NANMEDIAN(X,DIM) calculates the mean along a...
6d534bbe11294cd02cd49e864382782fd585aa108e114a91512bf79fa38fa2f3
MATLAB
1,926
60
function Downsdata=Downsampling(sub) subnum=sub; home_path=[pwd,'\dataset_mat\']; blocknum=12; condition=2; frequency=1:1:60; channum=64; %channel_index=[48,54,55,56,57,58,61,62,63];%Pz¡¢PO5¡¢PO3¡¢POz¡¢PO4¡¢PO6¡¢O1¡¢Oz¡¢O2 datas=[]; rawdata=[];downsdata=[];Downsdata=[]; filename=[home_path,'data_s',num2str(su...
e4fb298149a07892d6794fff701cb533f5f8930450e209c9278fb6a5233e8f76
MATLAB
1,926
66
function imgTypes = choose_imgtypes(varargin) %choose_imgtypes - Protected class method to choose image types % 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 pub...
eecfbbcb8a84b16dfad10fbf8cd39e8b972928e33ee472122ea9d98e354c95aa
MATLAB
1,927
60
function isDark = choose_dark_light(rawImg, strObject) %choose_dark_light - Helper function for choosing dark or light plasma % % 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 an...
f25cd497114f3ef9cf6819125b1f4d4adf9aff44b508e6c8962fa579b5488946
MATLAB
1,930
35
function [ blankBool ] = HasBlankEpoch( dataStruct ) % if dataStruct is a stimParams struct, evaluates whether the stimParams % struct contains a blank bout. there is a blank bout by definition when % randomize is set to 1. there is also a blank bout when the first % condition specified is a blank. % % if dataStr...
24a5ae203a1f8c414ca052dd90d316dd26370a537083b3b9bc745e46b7419a7d
MATLAB
1,931
42
function t2n_plotCurrSteps(targetfolder_data,neuron,steps) % This function plots one or multiple current steps, which had been % previously simulated and saved with t2n_currSteps. The exact loaded simulation % is defined by neuron.experiment. % % INPUTS % targetfolder_data destination of temporary results file % n...
ba6cb94b0c29e625f27d1b32a87edaeea2e6534d68694b89d8dd9771484189b5
MATLAB
1,940
60
function [roiImg, nROIs] = plot_ROI_layers(self, roiMask, 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...
058a4b425f568faa48fe3650776cd851e9a3f6c34743578191319b3a35198fb9
MATLAB
1,944
58
function pointBeamToLocationInImage(obj,~,~) % Obtain mouse cursor position and point beam here % % function zapit.gui.main.controller.pointBeamToLocationInImage(obj,~,~) % % Purpose % This callback function obtains the mouse position in the % image and uses this to point the scanners to thi...
b1551e3956b93665c32a441f2e483071d200a422e9abe16dad6b0c9b9775481f
MATLAB
1,945
90
clear all close all currentdiectoryLocation=pwd; addpath(strcat(currentdiectoryLocation,'/functions/')) [decoder.preprocessing.bandPassFilter.b,decoder.preprocessing.bandPassFilter.a]=butter(2,[8 30]/(512/2)); dataLocation = 'expertMIData'; allRunsInfo = dir(fullfile(dataLocation, '*.gdf')); nRuns=size...
d027a58c7c5187e20032a8374a76a7c2ca8b52879320b1c7a62352ee4d4a41c0
MATLAB
1,945
77
% IN_C Applies inpolygon on contour. % scheme package % % [IN, ON] = in_c (X, Y, c, dx, dy) % --------------------------------- % % If c is a contour obtained from a single isoline contourc, checks if % points X and Y are located IN the largest contour or ON the outer % boundaries of the largest contour (using inpoly...
6a84093fdc2b81acd3a0532149fc54e0e9a36d05cbdf17d5aafbdfa84c34dc01
MATLAB
1,946
63
function Problem_figures(Y1_pred,Y1,Y2_pred,Y2,E,Em,EE) figure plot(1:length(EE),EE,'Color',[0.4660 0.6740 0.1880]) hold on plot(1:length(E),E,'Color',[0.4940 0.1840 0.5560]) plot(find(E==Em),Em,'h','Color',[0.9290 0.6940 0.1250],... 'MarkerSize',12) xlabel('Iteration');ylabel('MAE %');xlim([1 length(E)]) ...
0f65100640c9bc68b56ff20c50aee22d04cf0003b0012943547a6480e9e0cc16
MATLAB
1,950
48
function [pixelShift, estSNR, windowCorrAvg] = ... calc_pixel_shift(windowCorrImg, nPixelsToFit) % 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 publishe...
58868aac5eed155f90224efb45cb9170e0509dbf209801ffcd3e4045c9f390ba
MATLAB
1,950
72
function d = euclidean(a,b,df) % EUCLIDEAN - computes Euclidean distance matrix % % E = euclidean(A,B) % % A - (DxM) matrix % B - (DxN) matrix % df = 1, force diagonals to be zero; 0 (default), do not force % % Returns: % E - (MxN) Euclidean distances between vectors in A and B % % % Description : % T...
a359f9606ff6e237e5e5019064cba2e2b85269f9b9314a985aa1f8df369ebe77
MATLAB
1,950
84
function sff = sff_extractCalibrationTrajectories(sff) %SFF_EXTRACTCALIBRATIONTRAJECTORIES % % RS, 05/2022 xyt1 = sff.gp1.cln.xyt; xyt2 = sff.gp2.cln.xyt; dk = sff.clb.dk; sff.clb.calPoints = extractCalibrationPoints(xyt1,xyt2,dk); sff.clb.calPoints = spreadCalPoints(sff.clb.calPoints,1000,sff.prm.mov.f...
2a81ab2860a2ebb3c3dc983e60f668a1044fbb75de5848744e85a12f014d18c4
MATLAB
1,952
80
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_sta...
eb631ab7c6f7d3d1fe4396e49b0628f5524639c25b74d813b2e3e40ca2479d4c
MATLAB
1,954
54
% Needs to be run from the code directory clear; close all; [pathstr,~,~] = fileparts(pwd); usedir = pathstr; [pathstr2,name,ext] = fileparts(usedir); maindir = [pathstr2 '/ISTART-DataInBrief/bids/sourcedata/']; cd ../bids/ outputdir = pwd; cd ../code/ warning off all subs = [1001, 1002, 1003, 1004, 1006, 1007,...
b4a65e06efc8d8d191699b40daf7077349ac5a6f88e242720f6e907a57c7229b
MATLAB
1,958
74
% DEMOs reference %% scale1_tree clf; shine; for ward = 1:5, HP = plot_tree(scale_tree(sample2_tree,[1+(ward-1)/8 1 1]),[],[],[],32); set(HP,'facealpha',ward/10); end axis off tight tprint ('DEMO_scale1_tree','-tif -HR',[20 20]); %% sholl_tree clf; shine; sholl_tree (sample2_tree, 20,'-s'); title ('');legend...
59a7f9caa573b8a7478da3334c07ca1b5970b4bf3ab9921285f525e46c560c58
MATLAB
1,960
90
%% good = 1; bad = 0; use = good; if use cd('Z:\labMembers\YG\data\learningAnalysis\summaryManyMice_includingOldEnvGoodMoreMice\commonUniqueCells') outFolder = 'D:\Novelty_Analysis\clusterMan\good'; else cd('Z:\labMembers\YG\data\learningAnalysis\summaryManyMice_includingOldEnvBadMoreMice\comm...
01167a93ff3246e48e8813365cdfb1b289112e911459292cc2cf939abbb8c78b
MATLAB
1,963
64
function trialmat = sim_trials_tf(reg_f, diff_f, num_trials, Fs, num_sec, noise_ratio, amp_ratio1, amp_ratio2) % function trialmat = sim_trials_tf(reg_f, diff_f, num_trials, Fs, num_sec, noise_ratio, amp_ratio1, amp_ratio2) % % This function creates a single matrix of trial data, with each trial as a % separate column....
6c16ce8a1397ccac13e8f01769908b73c7040830db31e459b2a912d29e089506
MATLAB
1,963
68
function [keep,msStim] = st_keepWindowStim(pm,keepAllPoints) if notDefined('keepAllPoints') keepAllPoints = 1; end % irf_file = [pm.Temporal.IRFpath '/' pm.Temporal.Name '_irf.mat']; try % tmpSeq = load(fullfile(pm.Stimulus.DataPath, [pm.Stimulus.Name '.mat'])); tmpSeq = load(pm.Stimulus.values,'sequ...
2b6c22c5ddb8d074e5d3b34db8ba2f9622c48f5124877394606d656a46e6dca7
MATLAB
1,964
69
function gatherCheckpoints(vw,params,wProcess) %% checkdate = Constants.getDir.sessionDate; tm = params.analysis.temporal.model; tm = strrep(tm,'-','_'); checkDir = getAllFiles(sprintf('./checkpoint/%s',checkdate),... 'checkpoint.mat',1); checkDir = checkDir(contains(checkDir,tm)); checkDir = checkDir(~contains(ch...
9c2c5d226e17ea0d137c66f4ed90fc8451f62b2578a7ab038c9a2b0632e8e2ff
MATLAB
1,964
96
function [t1, t2, wl, spectra1, spectra2] = InsRead2DT_v6(file) % [t wl spectra1 spectra2] = InsRead2('file.ins') % Reads a 2 channel ins file % t = time vector in sec % wl = wavelength vector % spectra1 and spectra2 = transmission spectra for the two channels ID = fopen(file); for i = 1:3 a = fgetl(ID); end wl...
67b7245991910a50aad65f3c404b3d942971c4d32551e296825006ce0f4f9d6c
MATLAB
1,966
53
function maskOut = dilate_erode(self, maskIn, pixelSize, frameRate) %dilate_erode - Dilate and erode ROI 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 General Public License as pub...
48295dd1c457f2af28fff471dbd01316829098cdca4d5cc37b39038ab0ce8cde
MATLAB
1,970
62
% ROTATION_MATRIX Calculates rotation matrix for given angles. % (scheme package) % % M = rotation_matrix (degx, degy, degz, hand) % -------------------------------------------- % % Treats the different rotations in order x then y then z. In other words % it's the rotation_matrix R = Rz*Ry*Rx. Degrees of rotation are...
704ac45156ab5fb307860fd137d7b27d1eeb48e9ceded5d830eba26d8dfed3e4
MATLAB
1,974
61
function out = LK_SpikeDensityPlot(wavs, sr) % % LK_SpikeDensityPlot plots the spike waveforms of a given unit as a % density plot. % % Input: % wavs: n x m matrix with waveforms from n spikes % sr: sampling rate % % Output: % spikeDensity: p x m matrix with waveform density % spikeTime: 1 x m vector with time ...
339ac6a6bfa5628a348347aec79c7618cb47fe8461ef8ee9997c90d2ca06f65d
MATLAB
1,976
52
% Step 4: deconvolution % Reference: A. Orth, etc.,Optical fiber bundles: Ultra-slim light field imaging probes % last modified 2022-08-20 % by Peisheng Ding (peisheng.ding@mpi-halle.mpg.de, peisheng.ding@mail.utoronto.ca) clear addpath('files') load('R_E_psf') % stimulated psf, psf in center, 5D matrix with ...
69ca264a2f258ea6c17b0f4c24957a5e8c121c48c4144bd68a4392f4669722db
MATLAB
1,982
76
%sim_onepulse.m %Robin Simpson and Jamie Near, 2014. % % USAGE: % out=sim_onepulse(n,sw,Bfield,linewidth,sys) % % DESCRIPTION: % This function simulates a pulse-acquire experiment with an ideal % (instantaneous) excitation pulse and an assumed lorentzian lineshape. % The function calls the function 'sim_Hamiltonian'...
3d6b9642a3309324c1dcdc7a122dba171a68c5729a28231038ac71ddd9de9361
MATLAB
1,984
69
function writeRandomSingleChan(devID) % Write random numbers to AO0 of device devID using DAQmx .NET % % function nidaqmx.AO.writeRandomSingleChan(devID) % % Purpose % Example showing how to write random numbers to AO0 of device devID using DAQmx .NET % This code plays out 1000 random numbers then stops and resets the ...
85795c41b436ea3df72598b0e8ac33782eb102815e520637ab5430f1d87ef82f
MATLAB
1,986
79
function B = FilterFermi2D(A,LowCutOff,HighCutOff,SizePxl) %% Filter A with 2D Fermi filter % A is an array with at leat 2 dimentions % LowCutOff and HighCutOff are the low an high cut-off frequency (cyc/mm) % SizePxl is the pixel size (mm) % % B is an array with same size as A % % % YC at ES lab % Created ...
ea3e98ba3edcf543808a21c372e1bd78779679c6d2ebd8556a963fa2a15c28bd
MATLAB
1,986
95
%% visPlotSum clear all; close all; clc load('dataVis.mat') useDays = 1:10; cats = {[1 3:5 8 10:14],[2 6 7 9]}; catNames = {'Good Learners','Bad Learners'}; catCols = {[0 1 0],[1 0 1]}; yLab = 'd-prime'; %% Plot time course figure; hold on for ii = 1:2 dataCur = dataVis(useDays,cats{ii});...
2c07c7d5e94d103e076bb167e090e0514ef548355bb2b462922dcd9c0c44c5e5
MATLAB
1,989
51
function varargout = funRawDummy(zoomIn, varargin) %funRawDummy - A dummy function % % PXSIZE = funRawDummy(ZOOM) returns an array of ones the same % size as ZOOM. This is useful when there is no calibration defined as % means that the final results will be in units of pixels rather than % units of length (e.g...
4ccccff4bbbc2dfe29de9ff9b89f44403e6759ca60ca2a124fbe78d3e94eff0b
MATLAB
1,990
77
function d = L2_distance(a,b,df) % L2_DISTANCE - computes Euclidean distance matrix % % E = L2_distance(A,B) % % A - (DxM) matrix % B - (DxN) matrix % df = 1, force diagonals to be zero; 0 (default), do not force % % Returns: % E - (MxN) Euclidean distances between vectors in A and B % % % Description : ...
0b869abac1eb13583576c98bb08bcd99364595fbb5115fe6d77e23970273d676
MATLAB
1,991
41
% Organise Scan Data % for Zapit eLife paper 2026 % Michael Lohse 2026 % loadRawData (in .../MiLo_20211201_DMDM_CausalCortex_fromwinstor/Behavioural_Inactivation_Sessions/Main/Cortex_Wide_Scanning_Grid/) clear Trials TFStimuli for M=1:5 % Mouse Counter % Session Info Trials{M}(1,:)=zeros(1,length(Full_Beh(M).Ra...
bf944c2b7cb080450a5d51ec64d4af4b2b73d4b9256dda5746f37da06be65732
MATLAB
1,992
84
% BOUNDARY_TREE Produces spanning boundary of a tree. % (trees package) % % [bound] = boundary_tree(intree,c,options) % -------------------------------------- % % returns a boundary structure in two- or three- dimensions. % % Input % ----- % - intree ::integer: index of tree in trees or structured tree % - options::...
8ba435736a773cd3c56f63747aa780dc3c79c0efd4ed89beb192b1ae9bebfe87
MATLAB
1,994
49
function f = LK_PlotCoactivity_20231015(dt) % % LK_PlotCoactivity_20231015 plots a coactivity map. % % Input is a structure with multiple fields. % Output is a figure handle. % % Lukas Kunz, 2023 % create figure f = figure('units', 'centimeters', 'position', [2, 2, 7.4, 6]); % plot data for this data group axes('uni...
6f177ddaa1f2b14dcee1127c1806e97b0f2f2778c73f0fc38dce0d78f023e809
MATLAB
1,996
72
% op_creFit.m % Jamie Near, McGill University 2014. % % USAGE: % parsFit=op_creFit(in,ph0,ph1); % % DESCRIPTION: % Perform a Lorentzian lineshape fit to the creatine resonance in a brain % proton MRS dataset. % % INPUTS: % in = input data in matlab stucture format. % ph0 = zero order phase to add to the input...
eaf3c486aeb16a4fcd3c5f9192775fbe6129419593c530992a12f6282aaf87a1
MATLAB
1,997
56
function varargout = parse_opt_args(argsDef, argsIn) %parse_opt_args - Parse optional arguments & replace w/user-supplied values % % 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...
6ea3cdf33bc832ba24debc9a6c4634a51f8c2a5ce1ec55d7bdc56f502619a661
MATLAB
1,999
73
function draw_top_down_ccf_outline(atlas_data) % Draw a top-down view of the Allen Atlas in coords from bregma % % function nte.utils.draw_top_down_ccf(atlas_data) % % Inputs [Optional] % atlas_data - output of aratopdown.prep_data_for_top_down % % Supplying atlas_data will speed up app...
ef9116c89145a17662c887db50e9034f5231e3e7e1a7a7452c70039fccd5c057
MATLAB
1,999
52
function pixelSizeOut = calc_pixel_size(self, zoomIn, imgSizeIn) %calc_pixel_size - Calculate the pixel size % % PXSIZE = calc_pixel_size(OBJ, ZOOM, IMGSIZE) calculates the pixel size % (PXSIZE) for a given calibration object (OBJ), zoom values (ZOOM) and % image size (IMGSIZE). ZOOM must be an array of positive ...
c6e1f4234a0455da0212a004f3aaa184f000e5c97296c002a2cd77031dc8639d
MATLAB
2,000
81
%%% baseline_plot.m %%% Omkar N. Athavale, May 2023 %%% Run and plot simulation for 120 s with stimulation at varying levels addpath('../matlab_common/') % run simulations with stim for 60 seconds [t01, T01, Vm_ICC01, Vm_SMC01] = run_sim_stim(0, 10); [t10, T10, Vm_ICC10, Vm_SMC10] = run_sim_stim(10, 0); [t11, T11, Vm...
005182d45af1fc62a42e2ec40422de4ac086cbb8361768755bf5a21c063a5e39
MATLAB
2,002
71
function [loglik] = EEGfMRIPav_cbm_mod01(parameters,subj) % Standard Q-learning model with delta learning rule. % ----------------------------------------------------------------------- % %% Retrieve parameters: % 1) Feedback sensitivity: nd_rho = parameters(1); % normally-distributed rho rho = exp(nd_r...
0128dc549977a2281422911debceee10d76623abcf2c5ed112a79667a119fe7c
MATLAB
2,002
67
clear close all force imSize = [733, 977]; hWB = waitbar(0,'checking the trials ...'); %load tirals info load('a0_0_bhv2trialStrct.mat'); I = arrayfun(@(x) isfield(x.analyze,mfilename), dataTrl); if any(I) I(I) = arrayfun(@(x) x.analyze.(mfilename), dataTrl(I)); end NTrial = find(~I | true); nTrial = numel(NTr...
253fc8601c2d2ecbb311e8cdf5b0090ac241cc18ce869d45c5c0a4785c361326
MATLAB
2,004
58
function varargout = cell_array(val, varargin) %cell_array - Check that the value is a cell array % % cell_array(val) checks that val is a cell array. If it is, nothing % else happens; if it is not, the function throws an exception from the % calling function. % % cell_array(val, 'VarName') includes VarName in...
2b0b6bf42869eb60912b3653d389a58cdc99ebfbdb1425b181ea2644b1153167
MATLAB
2,004
263
%first column = numbering of channels on probe PCB connectors looking from %the top. %second column = numbering of channels on head stage amplifiers. headstagewiring=[ 1 26 2 27 3 28 4 29 5 30 6 31 7 32 8 25 9 24 10 23 11 22 12 21 13 20 14 19 15 18 16 17 17 16 18 15 19 14 20 13 21 12 22 11 23 10 24 9 25 8 26 7 27 6 2...
d00869e7fd5486191b3210c204c646b4be00e7b0e19df93ba840a94e44e016ee
MATLAB
2,012
53
load(fullfile(dataFolder,'EEG_data','data_sample_time_series.mat'),'time','eeg','ptID'); load(fullfile(dataFolder,'EEG_data','data_time_information.mat')); t0 = timeInfo.infusion_onset-timeInfo.object_drop; red = clrsPT.qualitative_CM.red; CM = clrsPT.iridescent(1e3); black = CM(end,:); marsh_model_analysis; fig =...
a32a73020a320451dd79bc84abcf06f35655b84a1c81358191fb72bd03062e77
MATLAB
2,014
51
function self = post_process_velocity(self, pixelSize, lineTime) % 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...
1fdc7883b77c3c7f36e459513977f4de4082d0ec6c656bf38649428b30f56cff
MATLAB
2,015
49
function vec_gKa = range_conductanceKa(kainfo,tree) % nainfo: gka, slope, proximal_limit, % proximal limit: calculation comes from the Jarsky et al., 2005 model % the maximum path length of Jarsky tree is 818.3232um, therefore, 100um % (which is the proximal limit they set) corresponds to the 12% of that % maximum pat...
4de828c5622f8fef27b415bc302b74f441fab05084da3c24a6337e2c8ec6361f
MATLAB
2,018
63
function ha = tightSubplot(Nh, Nw, gap, marg_h, marg_w, parent) % tightSubplot creates "subplot" axes with adjustable gaps and margins % % ha = tightSubplot(Nh, Nw, gap, marg_h, marg_w) % % in: Nh number of axes in hight (vertical direction) % Nw number of axes in width (horizontaldirection) % ...
cac7f27c86555143e85c3d380c06ef5b4bce553f4a12350a0dd3cdd7a7181fd4
MATLAB
2,018
69
% op_autophase.m % Jamie Near, McGill University 2015. % % USAGE: % [out,phaseShift]=op_autophase(in,ppmmin,ppmmax,ph,dimNum); % % DESCRIPTION: % Search for the peak located between ppmmin and ppmmax, and then phase the % spectrum so that that peak reaches the desired phase. % % INPUTS: % in = input data in ...
045815dc14bf528c264f96c9f34bfd5b024975b2ae334220d8d83a3705e665c1
MATLAB
2,019
58
function varargout = char_array(val, varargin) %char_array - Check that the value is a character array % % char_array(val) checks that val is a character array. If it is, % nothing else happens; if it is not, the function throws an exception % from the calling function. % % char_array(val, 'VarName') includes ...
3481be545419dd9f81a4b241f43a3f0058cb326ac32f983b6b5ab6d1ce3c9edc
MATLAB
2,020
68
% for i = 1:10 [eeg1,eeg2,eeg3] = oscillation_types; % [psd1(:,i),f] = pmtm(detrend(eeg1,'constant'),2,[],1e3); % [psd2(:,i),f] = pmtm(detrend(eeg2,'constant'),2,[],1e3); % [psd3(:,i),f] = pmtm(detrend(eeg3,'constant'),2,[],1e3); % end return; clrs = clrsPT.lines(3); figureNB; subplot(3,1,1); plot(...
3e0b14fe4b75c16281f57ccff88a70753ed6b033a14840b021ac4527ddde32a2
MATLAB
2,025
80
function y = nanvar(x,dim,flag) % FORMAT: Y = NANVAR(X,DIM,FLAG) % % Variance ignoring NaNs % % This function enhances the functionality of NANVAR as distributed in % the MATLAB Statistics Toolbox and is meant as a replacement (hence the % identical name). % % NANVAR(X,DIM) calculates the standard dev...
c1a191ab2e69345b28db28566ffbfb9b3f90aba2b92b8101587282f1c7fe6165
MATLAB
2,027
54
function mv_print_regression_info(cfg, X, Y) % Prints information regarding the regression procedure, including the % cross-validation procedure and the dimensions of the input data. This % function is called by mv_regress. % % Usage: % mv_print_regression_info(cfg, <X, Y, X2, Y2>) % %Parameters: % cfg - configur...
f6159af231398b4d5d8f25a463722ef3ea569bb8e32bd3998298a49dd337490f
MATLAB
2,031
60
function [settings,allValid] = checkSettingsAreValid(settings) % Check that all settings that are read in are valid % % function [settings,allValid] = zapit.settings.checkSettingsAreValid(settings) % % Purpose % Attempt to stop weird errors that could be caused by the user entering a weird setti...
0d498ec8845fddbf1cb0aa87d77a965869a3be067614031f6233094eecea7c90
MATLAB
2,037
55
function strOut = varName(varargin) %varName - Supply a default or user-specified variable name for error msgs % % str = varName() supplies a default variable name ('value') for use in % error messages. % % str = varName('VarName') returns VarName as the variable name. If % VarName is empty, the default variab...
d8423701265dd0c5fc550c66c6121cec7ca1196b2f67419342a9a0e93c3c96db
MATLAB
2,037
66
function make_docs(varargin) %make_docs - Publish the documentation as html files % % make_docs() publishes all m-files contained in the CHIPS_rootdir/doc/m/ % directory to html files, which are output in the CHIPS_rootdir/doc/html % directory. % % make_docs('outputDir', OUTPUTDIR) ouputs the published document...
356a8a088d9e3408cf5521855d1c939d5b23b4a03daac2091774a64fadeb1982
MATLAB
2,038
28
% Example callback function for analog input logging. Converted from csv to binary using Matlab example logData.m % Copyright 2011 The MathWorks, Inc. % This funcion is called once the number of acquired time points exceeds % src.NotifyWhenDataAvailableExceeds. % The latest analog input data will be written to the ...