sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
6dbf017e14b4bd30594554bf6ab42bb10907e18df9f060780afb5effe46ad8a9
MATLAB
714
31
function dRes = detect(obj) %DETECT Detect spikes in recording obj.res = []; % reset obj.res obj.isDetect = 1; % clear GPU memory and set random seeds obj.clearMemory(); % start the parallel pool if obj.hCfg.useParfor obj.startParPool(); end obj.hCfg.updateLog('detectStep'...
ae0a3f0e78ac4c84c2fedf6ced4f818b24408412d2b57e341f9bd071a104f113
MATLAB
715
37
% A naive implementation of Householder's 1958 algorithm for nulling % all but one vector entry % Ref: Householder, Alston S. "Unitary triangularization of a nonsymmetric % matrix." Journal of the ACM (JACM) 5.4 (1958): 339-342. % % Reza Sameni 3/1/2019 % email: reza.sameni@gmail.com clc; clear; close all; % an arbi...
ee41b3f168a938e3a2edfb8970502d01f9cbbc4e5878191fc1feb71fd1e0a5eb
MATLAB
715
29
function [ImB,XY] = Neuron_To_Blob(Im) BW_Threshold = 0.5; if(islogical(Im)) Im_BW = Im; else Im_BW = imbinarize(Im,BW_Threshold); end Im_BW = bwareafilt(Im_BW,[50,inf]); se = strel('disk',20); ImD1 = imdilate(Im_BW,se); ImB = imdilate(ImD1,se); % The Blob. ImB = imc...
4bbb94e4a36929f9d7d17e0aecc379c73e5e905082b2b45dcf1218982cd00c6d
MATLAB
717
25
function [O, logdet] = matrix_cholesky_solve(A, B, compute_logdet) % Decompose a symmetric, positive definite matrix A as follows L L' = A and % use this to solve A O = B. Estimate the logarithm of the determinant as % well. if nargin < 2 || isempty(B); error('Please specify B'); end if nargin < 3 || isempty(compute_l...
5647c72f86be678c17c52b109a65e4e3defbc2d93341cdce1803c4c85727a12b
MATLAB
717
22
% Copyright 2024 Eelke Spaak, Donders Institute. % See https://github.com/Spaak/rift-phase-and-visibility for readme/license. % Belongs with: % Spaak, E., Bouwkamp, F. G., & de Lange, F. P. (2024). Perceptual foundation and extension % to phase tagging for rapid invisible frequency tagging (RIFT). Imaging Neuroscie...
02c3d1f2c37bb6ed0d4f5a6e00bed854f04b0260002280a8e126c38d8a19db9a
MATLAB
718
25
function roi = readFiltROI(obj, rows, cols) %READFILTROI Get a region of interest by rows/cols from the filtered file rowPred = jrclust.utils.ismatrixnum(rows) && ~isempty(rows) ... && all(rows > 0) && max(rows) <= obj.dshape(1); colPred = jrclust.utils.ismatrixnum(cols) && ~isempty(cols) ... ...
2b2096146f3aa9875cbf8c0d8285d2d3ea9fdc7689370f9de38139d360999c0c
MATLAB
720
24
function mouseClickFigWav(obj, xyPos, clickType) %MOUSECLICKFIGWAV Handle callbacks for mouse clicks in main view if obj.isWorking return; end iCluster = obj.showSubset(max(1, min(obj.nShown, round(xyPos(1))))); % floor of x position if iCluster < 1 || iCluster > obj.hClust.nClusters ...
2fe3c162a5144bccb405afdde7d1e272d407fe1138ba6dcd38762c9c3cea9d9d
MATLAB
720
24
function result = x2eqarea(x) %X2EQUAREA Equal area projection of 3D Euclidean points % % result = x2eqarea(x); % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. % $Revision 1.10 $ $Date 2005-06-01 $ % Documentation files renamed % $Revision 1.00 $ $Date 2005-02-12 $ % % For licensing, see COP...
53a3747751e7d5cc36a28548fde11cb9017a003d9724950b2d62d5b171480e82
MATLAB
720
31
function [AllTimeSeries] = extGroupTSROI(listing, StimType, GroupType) % This program is intended to visualize mean ROI-based time series. % % input: % listing: % StimType: % GroupType: % % output: % AllTimeSeries: nSub % % By Hiroaki Hamada, Araya Inc., 2019/08/29th nSub = length(listing); sample = load(listi...
a6cb417c97841ba3a7d6c66d1ec8c0aeb083aad0b298647f78fe3851a7abd842
MATLAB
720
28
function [x,y,z] = VAsph2cart(Channel) % Copyright 2009-2011 Thomas Koenig % distributed under the terms of the GNU AFFERO General Public License tmp = Channel(1); if isfield(tmp,'CoordsTheta') %if exist('Analyzer','var') % Analyzer 2 for i = 1:numel(Channel) Theta(i) = Channel(i).CoordsTheta; P...
089e250e2e5d5ceda357fdfc567b78d14cd6975d7e9bdbb73b5aa19aaede92be
MATLAB
721
25
function amplsig = get_sig_ampl(sig,fs,ms_akern,expon,yes_verbose) % function amplsig = get_sig_ampl(sig,fs,[ms_akern],[expon],[yes_verbose]) % for example: % ms_akern = 30; % milliseconds (the default) % expon = 2 (the default) if nargin < 5 || isempty(yes_verbose) yes_verbose = 0; end if nargin < 4 || isempty(expo...
eafb09b642201639a2c352541c3f8d767c868aecbe19a55c7497af5e46b62e34
MATLAB
722
23
function coords3D = convert2Dto3D(coords2D, coords2D_common, coords3D_common) % Extract the number of points nPoints = size(coords2D,1); % Preallocate the 3D coordinates matrix coords3D = zeros(nPoints,3); % Fit a transformation from the 2D common points to the 3D common points tform = fitgeotrans(coords2...
f4da7b29ea4c36b43a3602c71df667406fd576b1cffee7c3d9d14d2926e7f629
MATLAB
722
25
function [coef, arg] = nufft_coef(om, J, K, kernel) %function [coef, arg] = nufft_coef(om, J, K, kernel) %| %| NUFFT interpolation coefficient vectors for a given kernel function. %| %| in %| om [M 1] digital frequency omega in radians %| J # of neighbors used per frequency location %| K FFT size (should be >= N, th...
56d95aaa3922cfe4ee76013d1caeb40fc0978ff6e6cbbe7301b201d0093bf7d1
MATLAB
723
21
function y = group_vector_soft(x,tau,groups) % "groups" is vector indicating the group stucture % for the group-vector-soft thresholding operation % The size of groups must be the same as x. % Each set of elements that are mutually equal % define a group. % Example: if groups = [1 1 1 2 2 2 3 3 2 2 1 1 3 3], % there ...
6f5b6516f69422487924dc6b1db4eb251e30e63ebde72ece21f75bcc93622cca
MATLAB
723
20
%% plot right vs left form brain render table OF CLUSTERS clear clc [file, path] = uigetfile('clusters_brain_render_table.csv','MultiSelect','off');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path T = readtable...
9053b53e427bb735f6b7d925bd9ec30ae1c5a0e15b87278c854671b6907138dc
MATLAB
723
21
function paths = Choose_Paths_Generalized(X,Y,Min_Peak_Prominence,Min_Peak_Distance,SP) % Curve Fitting: fitobject = fit(X,Y,'smoothingspline','SmoothingParam',SP); xvf = linspace(min(X),max(X),1000); % Angles. yvf = fitobject(xvf); % Scores. [yp,xp,pw,pp] = findpeaks(yvf,xvf,'SortStr','descend','MinPeakPromin...
a05fb5f727c129046ed9a8455199f5e1b6b1763a9ad5cc952465aab089b8907f
MATLAB
723
33
function DI=dunns(clusters_number,distM,ind) %%%Dunn's index for clustering compactness and separation measurement % dunns(clusters_number,distM,ind) % clusters_number = Number of clusters % distM = Dissimilarity matrix % ind = Indexes for each data point aka cluster to which each data point % belongs i=...
b82311e9260c81b61c2b67b9e56f77a35a04e029126013d4994dbe45a8be353e
MATLAB
723
27
function [ t_pool ] = project_trial_set_into_one_subspace(p,trials,trial_idx,q) %% project trials into subspace % project trials into joint subspace t_pool = []; for sub = 1:p.nSubjects % project avoidance trials if isempty(trial_idx) if ~isempty(trials{sub}) ...
96055c6d0bbdca71905f38a1ba16ddd17515c0ef86f7699a0f8b88c73791f96d
MATLAB
724
24
function gfp=computegfp(thedata) % computegfp: calculates the global field power of a data set % % inputs: data as a 2-D numeric array where dimension 1 contains the % timeframes, dimension 2 contains the channels % % outputs: global field power as a 1-D numeric array that contains the % global field power at each time...
dad584649d73372ba8fd9f04c736e18d0f86be1b60758314daaef258eea89c70
MATLAB
724
21
function [mBkgVals,sBkgVals,Thresh]=mnl_CalculateBackgroundValules(SampleBkgVxList,cData,Th) %Function to calculate the background values for an image % Inputs % SampleBkgVxList - The list of x,y, and z points of the background % cData - The image (x*y*c*z) % Th - The number of Sd above the mean to use as the thr...
eed6c00dde0cb458e02a9d1f91908c718bb446d8f2d507a307c06557bfa5159a
MATLAB
724
20
function auto_bp(app) %auto_Bb checks if bb is already detected and runs if %not % Detailed explanation goes here if isempty(app.bp_res) if ~isnan(app.settings.channel_idx.bldp) [data,ts,~, ~] = current_signal(app, app.settings.channel_idx.bldp); data = lowpass(data,3,1/ts(1)); [ footIn...
30696ff5892b1805f4fb6b83ef9faaafde0b329b6064ebf89d4a4744249560a4
MATLAB
725
24
function Total_shuffled_spiketime = allShuffle(SpikeTime, t,surrogate) if nargin<3 || strcmp(surrogate,''), surrogate = 5; end Spikes = zeros(length(SpikeTime), length(t)); for n = 1:length(SpikeTime) Spikes(n,:) = ismember(t,SpikeTime{n}); end cell_count = size(Spikes,1); num_images = size(Spikes,2); Total_shuffle...
0f89f0ad4947de492616fe852506ede0609aea7b1d402cccf875082acd0a1c4c
MATLAB
726
28
% Funtion To Deconvolve pair of Funtions % x=d*r % Input % x: Signal % r: Response Signal % lambda: Sparse Parameter % Output % d: Driver Signal % x_est: Estimated Sparse Signal % MSEE: Mean Squared Error function [d,x_est,MSEE]=magic_sparse_deconvolution(x,r,lambda) L...
206230bbdee1702d32c62e452db21ea5a43ad9e18d74b7198a1c6ff1be9dae7f
MATLAB
726
27
function [Pvalues_cope] = COPEComp(COPE1,COPE2, ROInames) % This program is intended to extract constrast of parameter estimate and comparison between two contrasts. % % input: % COPE1: contrast datasets1 % COPE2: contrast datasets2 % ROInames: a list of name of ROI list. % % output: % Pvalues_cope: comparison between...
3e91df990827a3b996b3936c53ec687e5ab066f603c8b10bf12b7e26d0d97789
MATLAB
727
17
function siteThresh = computeThreshold(obj, samplesIn) %COMPUTETHRESHOLD Compute sitewise threshold for samplesIn maxSample = 1e5; try samplesIn = jrclust.utils.tryGpuArray(samplesIn, obj.hCfg.useGPU); siteThresh = jrclust.utils.estimateRMS(samplesIn, maxSample)*obj.hCfg.qqFactor; [...
4181dc50fb66ce2ee6aeeecb929913bf25e86cc9f4685b06cfd77e0137dd7c82
MATLAB
727
22
function y = group_vector_soft(x,tau,groups) % "groups" is vector indicating the group stucture % for the group-vector-soft thresholding operation % The size of groups must be the same as x. % Each set of elements that are mutually equal % define a group. % Example: if groups = [1 1 1 2 2 2 3 3 2 2 1 1 3 3], % there ...
77b9e330987e897fca8c3fac62fd655400b6b9cfe990b4fcbb6d160da0240a5b
MATLAB
727
23
function Vertices = Match_CB_Vertices(Vertices,CB_Vertices) for i=1:numel(CB_Vertices) Vxy = [Vertices.Coordinate]; Vx = Vxy(1:2:end-1); Vy = Vxy(2:2:end); D = ((Vx-CB_Vertices(i).Coordinate(1)).^2 + (Vy-CB_Vertices(i).Coordinate(2)).^2).^.5; % Distances of vertices from the i-th CB branch outset. ...
efcba49ed2fe7458cb91fcca04d905c4745e8564a4afab208ac6c46fe8656d39
MATLAB
727
36
function Pattern=PegPattrn(fname) Name=fname(end-7:end-4); if strcmp(Name,'A___'); Pattern=1; elseif strcmp(Name,'B___'); Pattern=2; elseif strcmp(Name,'98__'); Pattern=3; elseif strcmp(Name,'89__'); Pattern=4; elseif strcmp(Name,'Agra'); Pattern=5; elseif strcmp(Name,'Bgra'); P...
8d563230e6aaefb22112b970d03d8217772bfcabbe9505c0112ff06b2ffcca5f
MATLAB
728
25
function [rho, mov_rho, sd1, sd2, rr] = sqi_hr_dynamics(peak_indexes, fs, wlen) rr = diff(peak_indexes)./fs; wlen_half = round(wlen/2); % baseline = movmedian(rr, [wlen_half, wlen_half]); % rr_move_removed = rr - baseline; % % figure % plot(rr); % hold on % plot(baseline); % grid rr_move_removed = rr ...
2118c012ca2ddb820b4d492d48ea4e25489aabb80c928cd060fdb033b4e5e7fd
MATLAB
729
31
function ypr = my_preemph(y,yes_preemph) [leny,yes_rowvec] = get_len_yvec(y); ypr = y; if yes_preemph sign_preemph = sign(yes_preemph); preemph_coff = abs(yes_preemph); n_complete_stages = floor(preemph_coff); final_preemph_coff = preemph_coff - n_complete_stages; stage_preemph_coff = 0.99; for istage = 1...
34b47501407cc2c5848fb253c61cce6116a93cca59586eb29dcdc8a6924ba59d
MATLAB
730
27
%LFP STATSITICS clc clear %% load all files [file, path] = uigetfile('*.mat','MultiSelect','on');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path %% %in case of selcting only one file if ~iscell(datafile) da...
904e2b685a66648da95ac1395811b5cadcf6863cfb622d41450b8ed6d6e8677e
MATLAB
730
43
%Function to relabel simulation results for easier comparison function [st_out, map] = relabel_results2(map_states, true_states) %% k = max(max(true_states)); N = max(size(map_states)); frob_dist = zeros(k,k); map = zeros(k,1); for i = 1:k for j = 1:k matched = (map_states==i) & (true_states==j); ...
add7609ddc17582a88d3cd53c2d6070fb7821942f95b4ad71a00af51303a3aa2
MATLAB
730
16
clc clear InputPicBG = 'E:\MuliImageSS_ResNet50_SeriesClass_ResAttention\*.png';% 背景原图的存放位置里的tif文件 InputPicPath = 'E:\MuliImageSS_ResNet50_SeriesClass_ResAttention\';% 背景原图的存放位置 FilePic=dir(InputPicBG);% 找到文件夹中符合要求的图片 Input_Pic=cell(1,length(FilePic)); Dis_statistics = cell(length(FilePic),2); for i=1:length(Fil...
4565541690f4936095470f8b974ea41acd94042cf24b1e206f3d77dd3195da93
MATLAB
731
41
clc clear close all %% load('Normal_Image.mat'); Im_Origin = images(:,:,4612); Im = Im_Origin; %% Im_Sensor = MCA_Sensor(Im); %% Im = imrotate(Im,270); figure; subplot(121); imagesc(Im); colorbar ('Ticks', []);colormap jet; ax=gca ax.XAxis.Visible='off'; ax.YAxis.Visible='off'; subplot(122); imagesc(Im_Sensor); colorba...
c183add57e31ff5572574f38a3488afbd7dcf8f856620833aec0c6fffe2ed0f5
MATLAB
731
25
%% Doing Gaussian blur to inputs: L6, lgn, etc... % For new version of network for paper2 % Input: OD_SMap (n_S_HC * N_HC)^2 matrix, representing the spatial ord dom % L6S_Drive: Input to each domain % FiltSig: Spatial sigma, should be proportional to mat size % FigOn: boolean, export a figure or n...
c0540201f30a0eadf53d070d357c2570b18e41ef707837068356fba6163be992
MATLAB
732
28
classdef FourierEmbeddingLayer < nnet.layer.Layer % ... properties numFourierComponents end properties (Learnable) end methods function obj = FourierEmbeddingLayer(numFourierComponents) obj.numFourierComponents = numFourierComponents; end function [Z ...
87e98c4e119c42d18255507fe828f41fcae24edbc5ca7884964b0e5eff478297
MATLAB
733
27
function auto_derived(app) %AUTO_DERIVED Summary of this function goes here % Detailed explanation goes here if ~isempty(app.data) if isempty(app.burst_ints) [~, idx] = max(vertcat(app.data.tic_multipl)); [~,ts,~, ~] = current_signal(app, idx); bords = [ts(1), ts(2)-ts(1)]; app.bu...
8fa286d3630e384f058e8664dde8da19b16428d9a244dbb896263b2812216834
MATLAB
733
25
clear clc %% %save only Intensity encoding + IR [file, path] = uigetfile('*.mat','MultiSelect','on');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path %% to_delete = 'corpus callosum'; %delete corpus coloosum cel...
3a50423229d9bbdf3e7984c93c5062b0e80d1bb84286b6ba2a57d7f07eb49d2f
MATLAB
734
38
%This is a function to generate a random sequence of states function[state_seq] = gen_seq(N, num_states, avg_run) %% %%%%%Inputs: %N (integer): Length of the time series to be returned %num_states (integer): Number of total states to be considered %avg_run (integer) : Average run of consecutives state selection. %%%%...
867fe190fb9f65a173092abdbc7c98bb57f2f6b19b40e6d3bf6b035fd44a9513
MATLAB
735
33
function [h,rval,pval] = plotLinearFitWithCorr(X,Y,varargin) if size(X,2) > 1 X = X'; end if size(Y,2) > 1 Y = Y'; end vIdx = ~any(isnan(X),2) & ~any(isnan(Y),2); X = X(vIdx); Y = Y(vIdx); h = plot(X,Y,'.'); xlim([min(X),max(X)]); ylim([min(Y), max(Y)]); axis square; xlabel(inputname(1)); ylabel(inputname(2)); ...
7fb96f78c72a1e1582e8f65df3f09fa8fc00d6368e17c03a2cd622c8162d7a2a
MATLAB
736
24
function TrialData = chop_trials(Data, SampleRate, TriggerLatencies, Window) % chop up Data into trials, based on TriggerLatencies, centering Windows to % cut out. Window is in seconds. % Data is a ch x t matrix TriggerLatencies(isnan(TriggerLatencies)) = []; ChannelCount = size(Data, 1); Starts = round(TriggerLat...
97850990296662be76968e49a29dcccb80d334fa2b800a5dd2daf0fc218ef9bd
MATLAB
736
21
function prVecs = getPVSamples(samplesIn) %GETPVSAMPLES Get top 3 principal vectors for spike waveforms % samplesIn is nSamples x nSpikes MAX_SAMPLE = 10000; % select at most MAX_SAMPLE spikes to estimate the covariance matrix samplesIn = jrclust.utils.subsample(samplesIn, MAX_SAMPLE, 2); sam...
0a801b9392b97a799b714c7dd65333405f8aa6c0ee94d9528e78d7bd198c25dd
MATLAB
737
31
function y = fatrix2_maskit(mask, x) %|function y = fatrix2_maskit(mask, x) %| %| Apply mask to x (replicating if needed via bsxfun). %| If mask is empty, then y := x. %| %| Used as part of many "back" (adjoint) methods to comply with fatrix2 %| requirement that "back" method apply the mask. if nargin < 2, help(mfil...
0e83b12a6021985ba8956a120b74c16511a61f885f1abf6eafa74b16d56c783d
MATLAB
737
30
% Retrieve Single Directory % Input: number; output: sufix for: % 1: Processed % 2: Resume % 3: Raster Features % 4: Ensembles Features % 5: Signal Features Tables % 6: NetworksCSVs % 7: Experimental Dataset function DirectorySufix=DirectorySelector(numDir) DirectorySufix=pwd; Load_Default_Directories; switch numDir ...
55c10b942a8803c401c075cb654e2a8bd54e822434cc0a122e3e944fc039cd38
MATLAB
737
17
function [artifacts] = get_bad_segments(data_mat,thresh_val) Ntrials = size(data_mat,3); std_data_mat = squeeze(std(data_mat,[],2)); std_data_mat_cent = std_data_mat - repmat(mean(std_data_mat,2),1,size(std_data_mat,2)); std_trials = std(std_data_mat_cent,[],2); threestd_trials_mat = repmat(thresh_val.*std_trials,1,siz...
1c9ede57aca61d14873efc5fd36364f59adda85cec3b8c5fb27fa7f16bc662b4
MATLAB
738
26
function h = bluered(m) %HOT Black-red-yellow-white color map. % HOT(M) returns an M-by-3 matrix containing a "hot" colormap. % HOT, by itself, is the same length as the current colormap. % % For example, to reset the colormap of the current figure: % % colormap(hot) % % See also HSV, GRAY, PINK,...
af28daedc7f094c52a4a8ed2da81037fa3e1913271fab083ba8c7dd6279d106b
MATLAB
738
17
function Output_Vector = Convert_Range(Input_Vector,Input_Range,Output_Range); % Demo - Assigin a color to each value in the range [0,1] using a 64-color colormap, % and a maximum value of 0.9: % Input_Vector = rand(1,10); % ColorMap1 = jet; % for i=1:length(Input_Vector) % Output_Vector = Convert_Range(In...
b18cac663585c68952432dc9aefd823b0fc1fd0564a70e46ab3c8a580faa918b
MATLAB
738
28
function [pathname] = uigetdir(start_path, dialog_title) % Pick a directory with the Java widgets instead of uigetdir import javax.swing.JFileChooser; if nargin == 0 || isempty(start_path) start_path = pwd; end jchooser = javaObjectEDT('javax.swing.JFileChooser', start_path); jchooser.setFileSelectionMode(JFile...
c30b2eaa8bb845f592c94af0ffcfc3cf71711cf7c17caaff298ce1f5d3c71270
MATLAB
738
25
% Finder Spiker for Calcium Imaging % Initial interface to select % - Multiple-Condition Experiment % - - Detect Spikes from original .AVI videos and % - - List of Coordinates (ImPatch) or % - - ROI coordinates (ImageJ) % - Single-Condition Experiment % - - Detect Spikes from Fluorescence Traces (.CSV) %% S...
12f2cee9d0c032a55a4bd5f7e0a5dcf9f48fa95b19f9c6ea858251a853cc5fba
MATLAB
741
31
function plot_s_knl_stm(session, channel, unit, fold, prb) % Plot stimulus kernel of specific s-model for given probe % % Parameters % ---------- % % - fold: integer scalar % Fold number % - prb: 2-by-1 integer vector % [x, y] postion of a probe if nargin < 5 plot_s_knl_stm_all_prbs(session, channel, unit, fol...
e194a7967e11f0862c51220bf8f5c91968a3c53713ad53d188790a384d8dc689
MATLAB
742
18
function [WaterOn_percent]=Water_percentage(WaterOnArray,WaterOffArray,StartTime,FinishTime) % global WaterOnArray WaterOffArray StartTime FinishTime if StartTime>0;TotalTime=FinishTime-StartTime; else StartTime=0;TotalTime=FinishTime;end % disp(['StartTime=' int2str(StartTime)]); % disp(['TotalTime=' int2str(...
61429e18af32110aaff2914f16696f92e67434da1562b578f56d2793a11f61c0
MATLAB
744
35
function stim = code2stim(stimcode) % Convert stimcode to stim % % Parameters % ---------- % - stimcode: integer matrix(trial, time) % Coded stimuli % % Returns % ------- % - stim: boolean array(trial, width, height, time) % Stimulus info = get_info(); width = in...
ffa93140a171a26a4e854fd03db2b15f8a93779f751fe77e2a8e618138e55b10
MATLAB
745
23
function removeEmptyClusters(obj) %REMOVEEMPTYCLUSTERS Find and remove empty clusters keepClusters = obj.unitCount > 0; if all(keepClusters) return; end % subset all fields indexed by cluster obj.subsetFields(keepClusters); if min(obj.spikeClusters) < 1 % noise or garbage clusters ...
42e25fc949cb8c632a3c42fde3f7ac399ba7ec70da46092cc7ae45571151f542
MATLAB
746
29
function fwrite3(fid, val) % % fwrite3.m % % Original Author: Bruce Fischl % % Copyright © 2011 The General Hospital Corporation (Boston, MA) "MGH" % % Terms and conditions for use, reproduction, distribution and contribution % are found in the 'FreeSurfer Software License Agreement' contained % in the file 'LICENSE'...
633b76389eb5e5267e7459bb0787904f84c95e653e5fb558a3b5f8ac58f8af9c
MATLAB
746
21
function [info,smap,map]=map_helper(x1,y1,frB,dmap) N=size(frB,2); % dmap=2; xbins=0:dmap:70; xbins(1) = []; [X,Y]=meshgrid(round(xbins/dmap)); % x1r=round(x1/dmap); % y1r=round(y1/dmap); x1r=ceil(x1/dmap); %Xiang uses ceil y1r=ceil(y1/dmap); gw=1; occ=cell2mat(arrayfun(@(z) sum((x1r==X(z) & y1r==Y(z))),1:numel(X),'U...
9e0fe49d0a4ae5d7a42db3e246ff6b9bdad45b998633e146868360f2b7a91848
MATLAB
746
23
function F = D2LorentianFunction(x,xdata) % F = x(1)*pi*(1/2*x(3)./((xdata(1,:,1).^2 -x(2)).^2 + (1/2*x(3))^2))+x(6); % F = x(1)*pi/2*(x(3)+x(5))/2*(1/2*x(3)./((xdata(:,:,1)-x(2)).^2 + (1/2*x(3))^2))... % .*(1/2*x(5)./((xdata(:,:,2)-x(4)).^2 + (1/2*x(5))^2))+x(6); F = x(1)*(x(3)*x(5))/4*(1/2*x(3)./((xdata...
8b449999570f6c8e33535226a6c5fccd0407a54a004e1837bd9bf5341c62836b
MATLAB
748
20
function Backprojection = backwardProjectACC(psf,projection) %% Backprojection from 2D projetion to 3D volume (using CPU) %% Input: % @psf: the phase space PSF % @projection: the projection obtained from "forward project". %% Output: % Backprojection: estimate volume % % [1] JIAMIN WU, ZHI LU and DONG JIANG etc...
d5535401d84b854fc762f3202c6adbb2d94dc430d7c3be0c5f1b240774d4e9d1
MATLAB
748
29
classdef file_read_options < handle % % Class: % adi.file_read_options % % Contains reading options. Currently this is for all file formats. properties %All file formats: %adi.file remove_empty_channels = true; %If true, channels without data for %all records are...
543ce40dc4371c64060ef06850a2235ff412fa860a61c79aeef588acae78c99b
MATLAB
750
32
function [sig,mixedsig]=demosig(); % % function [sig,mixedsig]=demosig(); % % Returns artificially generated test signals, sig, and mixed % signals, mixedsig. Signals are row vectors of % matrices. Input mixedsig to FastICA to see how it works. % 2 Apr 1998 Aapo Hyvärinen %create source signals (independen...
d6d0e90f775c090ab4c6d2a5c1e1363e445745b5329989bbb36e5ce98bb67fd2
MATLAB
751
35
function test_all_nufft %function test_all_nufft %| %| Test all NUFFT routines, including private ones. %| This must be a function, not a script, to call private functions, %| although 2016b on a Mac seems to allow call to private from a script. % test private routines - must be called from this script try nufft_T t...
22db54a2dd08bbc2534a892103c0f2f76ec783553f381efc6d77c0ba23aebfde
MATLAB
755
22
function updateHistMenu(obj) %UPDATEHISTMENU Update the history menu if obj.hasMenu('HistMenu') hClust = obj.hClust; hHistMenu = obj.hMenus('HistMenu'); endAt = hClust.nEdits; startAt = max(0, endAt - 4); % show at most 5 (most recent) entries in hist menu delete(hHistM...
4d92b5bd54bf6f8ae7c4645b3da24ef5c3fc25a1c321e3fc1cf50607a19d7b48
MATLAB
756
38
% Create a new one sp = mbsSpectrum; fname = 'M:\prj\MRS_for_gosia\MR-SE017-laser_te45_ref-TC-30\MR-ST002-SE017-0001.dcm'; sp = readSiemens(sp, fname); plotSpec(sp); figure(4) plotFid(sp); % Modifying sp_phased = aph0(sp); figure(2) plotSpec(sp_phased); % Chaining togehter figure(3) plotSpec(lineBroa...
cc46cbb2ad1e3dc37063f6049d965e20a0b40567541a4acbd88bce5f9d17db8f
MATLAB
756
23
function [layers, loss] = initder(layers, params, y) n = numel(layers); assert(strcmp(layers{n}.function, 'sigm') || strcmp(layers{n}.function, 'soft'), ... 'The last layer function must be either "soft" or "sigm"'); batchsize = size(y, 1); % number of examples in the minibatch if (strcmp(params.lossfun, 'logreg')...
de3d81493a903c1da856425e16edb48dc0cf5ca368a09211cf866b91a58f52df
MATLAB
757
27
function pseudo_region = pseudo_region_for_diam(region) %PSEUDO_REGION_FOR_DIAM Two points which maximize the vertex diameter of a region % % pseudo_region = pseudo_region_for_diam(region) % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. % $Revision 1.10 $ $Date 2005-06-01 $ % Documentation f...
a1957ee911a3c0ca168fd81321ad2a1f495d25b45f54d578d47a2cc201216c02
MATLAB
758
26
%% PCA analysis script written by Laura Ylä-Outinen %Data organisation X1=readtable('PCA_table.xlsx'); X1(1:36,1)=table({'hPSC_20517_MEA1and2'}); %merging MEA1 and MEA2 data as belonging to the same experiment X2=X1(:,4:end); X3=table2array(X2); Xstandard=zscore(X3); expressions=Xstandard; %% subtipes selection subt...
b46350b4fede0c29274284cb47f5fa13e976428286ac3c058b56485ead5f31df
MATLAB
758
24
function String = disp_stats_descriptive(Data, String, Unit, Roundedness) % String = disp_stats_descriptive(Data, String, Unit, Roundedness) % Roundedness is precision of numbers ('%.0f') % Data is P x 1 matrix. if isnumeric(Roundedness) Roundedness = ['%.', num2str(Roundedness), 'f']; end IQ = quantile(Data, [.2...
49f2026b8719d24aae9cdb22c23f59ba232105f837fd20b994d80b857e834b36
MATLAB
759
28
classdef FourierEmbeddingLayerExponential < nnet.layer.Layer % ... properties numFourierComponents end properties (Learnable) end methods function obj = FourierEmbeddingLayerExponential(numFourierComponents) obj.numFourierComponents = numFourierComponents; end ...
d6b8ecdcea750e1401fde3eacb3ef2b2665a28b6d86119beac1f411d265fd352
MATLAB
759
22
% for each participant, plots the burst criteria used to evaluate bursts, % to determine if any of them are redundant Parameters = analysisParameters(); Paths = Parameters.Paths; Task = Parameters.Task; Participants = Parameters.Participants; Sessions = Parameters.Sessions.LAT; Sessions = {'Session2Beam1'}; Source_Bu...
cd552076b7bf6e7f44aed246a5d8f32f1975badd74560baae0a61c4f7bc3e553
MATLAB
760
35
function createFolderStructure(p) miniDir = fullfile(p.rootDir,'miniscope'); mkdir(miniDir) currDir = pwd; cd(miniDir) for i = 1:length(p.subjects) dirName = ['subject' num2str(p.subjects(i))]; mkdir(dirName) cd(dirName) for j = 1:p.nSessions dirName = [...
829a596e25039c70c7c628f4227e9a0b2b24ddf91df117102a2d3c3f298934cb
MATLAB
761
24
function prediction_cleaned = remove_edges_not_in_gs(prediction,G) %% prediction is the three column edge list %% G is the gold graph with {1, -1} positive, negative %% remove predictions that are not in the gold standard prediction_cleaned = ones(size(prediction,1),3)*NaN; regulators = unique(prediction(:,1)); target...
0f846262dc5471fc99dec7c8fa5de8a39b23306fc79e731655a66283f2f8d05a
MATLAB
762
20
% load n-NRF magnitude data for Exeter both_sites_magnitudes = readtable('both_sites_magnitudes.csv'); both_sites_magnitudes_hyp1 = both_sites_magnitudes(both_sites_magnitudes.hypothesis1_include == 1, :); %% Exeter exeter_magnitudes_hyp1 = both_sites_magnitudes_hyp1(both_sites_magnitudes_hyp1.Site == "Exeter",:); exe...
afba87fa93f7eaea36c41edd1dff40a7ca5eab3400682160ac64775e490aa67d
MATLAB
763
12
disp('select brain region folder about combined files'); Folder_region = uigetdir('E:\Wang_combined files\mat\'); for no_lick = 1:42 decode_liquid_type_singlemouse if contains(session_str,'wq') save(strcat('E:\Wang_decoding_matrices\',region_str,'_quinine_accuracy_average\trial',num2str(no_lick,'%0...
58dd0e4611648dd3f7765fc8666f5febb3e0c9c15754c13598c77c157edc0035
MATLAB
764
20
function xout = ModifiedVanDerPol(x) % An implementation of the modified van Der Pol equation w0 = 1; alpha = .75; a = .1; b = .5; c = .9; % % % xout = [0 1 ; -w0^2 -2*alpha]*x(:); % % % xout = [0 1 ; -w0^2 -2*(x(1)^2-1)*(x(1)^2-3)*(x(1)^2-5)]*x(:); % % % xout = [0 1 ; -w0^2 -2*alpha*(x(1)^2-1)]*x(:); % %...
a8505e00262ff0dd0688ffe6a4f3c9948a3867dd050e0483e879198c6a8965fe
MATLAB
764
27
function edit_regressor_table(app,action,varargin) table_data = app.tbl_regressor.Data; if ~isempty(varargin) tbl_beta = varargin{1}; end switch action case 'add' idx = find(strcmp(app.popup_regressor.Value, table_data)); if isempty(idx) table_data{end+1,1} = app.popup_regressor.Val...
acfeeddd67552ccf1d024515353ab50be342674f169eaddf45981e99dffc26a1
MATLAB
764
28
function [Include]=mnl_CheckBrightnessOfBead(Im,th) szI=size(Im); for c=1:szI(3) tempChan(:,:,:)=Im(:,:,c,:); t=isnan(tempChan); if sum(tempChan(:))==0 %if it is all zeros Chk(c)=1; elseif sum(t)>=1 %If there are NaNs Chk(c)=1; else %Because the image size may be big, m...
321182310f1280da19bfe814873cfc12309e7adb3f434c6cf6e295eab35060e8
MATLAB
765
37
function [COPE] = extCOPE(ContrastList,ROIlist) % This program is intended to extract COPE. % % input: % ContrastList: % ROIlist: % % output: % COPE: nSub x nROI % % % by Hiroaki Hamada, Araya Inc., 2019/Oct/21st % check No. Subjects nSub = length(ContrastList); % check No. ROIs nROI = length(ROIlist); COPE = ...
6218cc0ece60340e6249ef0ef134c5fb692a2c73834cdc3dfb627d223c633eb2
MATLAB
766
37
function cout = get_all_correlation(conc) if iscell(conc) for k=1:length(conc) cout{k} = get_all_correlation(conc{k}); end return end for npool = 1:length(conc) aan = getfield(conc(npool),'met'); aa = getfield(conc(npool),'cormat'); for nm=1:length(aan) ...
cfbe017979615383ece6c62ee56b2f4ad39b72897695c3ef4204691c7efccb59
MATLAB
766
40
function Eye = check_eye_dataquality(Eyes, DQ, ConfidenceThreshold, TaskTime) arguments Eyes DQ ConfidenceThreshold = 0.5; TaskTime = ones(size(1, Eyes)); end % checks that the data quality for the chosen eye meets acceptable criteria % returns a blank if it's not ok % if no chosen eye, quit right now ...
03b6ded4e0b3f90d81a13807cfb8ec7e041a2556f03675289ec656ef65b436ff
MATLAB
767
20
Dir1 = uigetdir; % Let the user choose a directory. Files_List = dir(Dir1); % List of files names. Files_List(find([Files_List.isdir])) = []; i = 4; for d=1:numel(Files_List) F1 = strfind(Files_List(d).name,'Source'); F2 = strfind(Files_List(d).name,'Annotated'); if(length(F1)) New_Name = [num2str(i...
905d6b11419f271ad3582bd8e3a6dce1b74d22e9e181f68d337974f8283f9e97
MATLAB
768
26
% Count if labels were missclassified in N models % Input % Ymany: Predicted Labels Matrix, size=Nobservation x Nmodels % Y: Ground Truth Labels % Output % Yclass: Vector with well-classified in ALL models % ClassRate: Rate of well classified function [Yclass,ClassRate]=getrightclass(Ymany,...
c35520147321018da8ac2b87cc880ed247c7551a8dd3c04299403c0f77486ff7
MATLAB
768
22
function distributions(h,data,index) %% Draw distributions of energy mean and volume mean in line plot % autocorrelatemap() and crosscorrelatemaps() depend on this function. % % ind: indices of targets that will be counted if isempty(index) data = [data.energy data.volume]; else data = [data.energy(i...
3d360999d1f0020670726c6ef286dbc3fc93065ac87e88d4de795514922ade38
MATLAB
769
30
function saveStruct(S, filename) %#ok<INUSL> %SAVESTRUCT Save a struct to file in a robust way nRetries = 3; verYear = version('-release'); verYear = str2double(verYear(1:end-1)); if verYear >= 2017 for iRetry = 1:nRetries try save(filename, '-struct', 'S', '-v7....
d8a9ca48f46bb4ede82b481670d8965cb2c02f3950759bcf928715726f1dff28
MATLAB
769
28
function [success, errmsg] = openFiltForWriting(obj) %OPENFILTFORWRITING Open filtered file for writing success = 0; errmsg = ''; % first check we're not already open if obj.filteredFid > 2 success = 1; return; end % next check we have the free space freeSpace = java.io...
e5e17e2f20efc23144ea3e3a04d1269879fc2e0b768f9bfc70c3523cce659f8e
MATLAB
769
25
close all %% Select the correct folder load bza.mat load hex.mat load LN_hex.mat load LN_bza.mat %% fs = 15000; %sampling rate (Hz) name = LN_bza; % CHANGE THE NAME TO A FILE YOU WANT TO PLOT duration =40; %% figure(1) for i=1:16 time = 1/fs:1/fs:duration; %define time from 0 to 40s windows = f...
ef1eabcf22c06baf5faea004c4912872b6b32b3c632eee41b9ff7317cb4e6c0c
MATLAB
769
24
function xf_detect = spike_detection_filter(x, par) %this function filter the signal, using the detection filter. Is used in the %readInData class. sr = par.sr; fmin_detect = par.detect_fmin; fmax_detect = par.detect_fmax; % HIGH-PASS FILTER OF THE DATA if par.detect_order>0 if exist('ellip','file') ...
f5a3fdb376405513d8d3fa9a633c3c6dd2bd6dbc1a396ef08a4d320952aa27e3
MATLAB
772
26
function [ output_args ] = extractSignals( p, moviePath,saveDir ) %EXTRACTSIGNALS % load and crop movie movie = loadMovie(moviePath); zeroMask = squeeze(max(movie == 0,[],3)); [N, S, W, E] = getCropCoords(zeroMask); movie = movie(N:S,W:E,:); disp(['cropCoords are ' num2str(N) ' ' num2str(S) ...
a5a1268ad62b8962628b705afaeb9734e0efba5a54d3fc4f3c5f04949d7615a5
MATLAB
775
32
function cm = get_cmap(limits, discrete) cm.cm = flipud(colormap(gca, 'pink')); if nargin == 0 return; end mn = min(min(limits)); mx = max(max(limits)); cm.lims = [mn mx]; if mn < 0 % Bipolar tmp = max([abs(mn) abs(mx)]); mn = -tmp; mx = tmp; cm.lims = [mn mx]; cm.cm = cm.cm(1:41,:); cm....
0e37cb6d3dcf7346ca774a458388d5b05d2ebc5248e037bebcb73d8886adcf51
MATLAB
776
28
function out = tukeyfilt3d(data,kc,w,isRadial) % function W = tukey(n,kc,w,isRadial) % % Tukey windowing function, as described on p496 of Bernstein2004 if nargin < 4, isRadial = 0; end if nargin < 3, w = 0.15; end if nargin < 2, kc = 0.85; end nx = size(data,1); ny = size(data,2); nz = size(data,3); sz = size(data)...
9d285521ef6cff728dd4a50078baf94bfcf9c92c6b0821d839e25382e9961855
MATLAB
776
21
function Bursts = assign_band_label(Bursts, Bands, NewFieldname) % given specific bands, assign each burst to that band based on the mean % cycle frequency. Bands is a struct, with each field indicating the name % of the band, and assigned a 1 x 2 array with the edges of the band. BandLabels = fieldnames(Bands); Burst...
a197967b2bb12a933aba799cd17386182296141214c329f89ce66306ba414b8d
MATLAB
776
38
% test IIR notch filter in C++ and in Matlab clear; close all; x = load('testinput.txt')'; y = load('testoutput.txt')'; hparams = fopen('notchfilterparams.txt','r'); params = fscanf(hparams,'%g'); f0 = params(1); fc = params(2); fs = params(3); fclose(hparams); [b,a] = iirnotch(f0/(fs/2),fc/(fs/2)); ...
c42716701ac45a651ba91d028fbc5d5c1f07f6e250e8019c3b20fe4dc759b86a
MATLAB
776
19
% Authors : Tatjana Schmitt & Simon Wadle 2019-2023 %function reads tiff stacks and scales pixels down to end size function image = tiff_stack_import2(tiff_fullpath, file_cnt, num_of_files) info = imfinfo(tiff_fullpath); stack_size = size(info,1); rows = info(1).Height; columns = info(1).Width; % preallocate...
fa7b52e388e38f8a69bacb668527b99c2a3322d2b41d784c1c1d944c13c2e8ad
MATLAB
776
27
function coords3D = convert2Dto3D(coords2D, coords2D_common, coords3D_common) % Extract the number of points nPoints = size(coords2D,1); % Preallocate the 3D coordinates matrix coords3D = zeros(nPoints,3); % Solve for the transformation equations using the 2D and 3D common points A = [coords2D_common ones...
d5026a305d4e6fb273f689ca0379c3d8973cb2079221f9e4743bd46b1867b4b6
MATLAB
777
33
% load aligned cell maps and quantify MSE clear p = params_2DAA; %% load maps for sub = 1:p.nSubjects for ses = 1:p.nSessions thisSub = p.subjects(sub); fpath = fullfile(p.rootDir,'miniscope', ['subject' num2str(thisSub)],['session' num2str(ses)],'extracted','cellMap.mat'); load(fpath) ...
dd8b0555bc4d6a5db6671dea272eb36f769933da1721aabaac36b284ae5c67c3
MATLAB
777
30
function newlist = addprefixtofilenames(filelist,prefix) % filelist must be a cell array where each element is a char-array % containing a list of file names. nocell=0; if ~iscell(filelist) filelist={filelist}; nocell=1; end newlist=cell(1,length(filelist)); for i=1:length(filelist) wfiles...
550aaa0ef44109137c8287c6073aa4afce99ab30b789f69440b8d844762813c4
MATLAB
778
19
function ln=localnormalize(IM,sigma1,sigma2) %LOCALNORMALIZE A local normalization algorithm that uniformizes the local %mean and variance of an image. % ln=localnormalize(IM,sigma1,sigma2) outputs local normalization effect of % image IM using local mean and standard deviation estimated by Gaussian % kernel with s...
0295be5d7bb9e3a9f18b77601208d9a7c94a08bc36862d6f14236f3235e7cc2f
MATLAB
779
21
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function lme = fitlme_analysis_20210520_0(data,all_subject) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %make table tbl = table(data,all_subject,'VariableNames',{'value','random1'}); lme0 = fitlme(tbl,'value ~ 1 + random1'); %linear re...
1ec4587c4b22f31f4f16f6620ebc26df28711cfae5a4b08b7c4eeb20636af683
MATLAB
779
24
function st = getNUFFTobjFromCoords(nkx,nky,nkz,dataDims_mm,fullMatrixDims,oversampFactor,useTable,bUseParfor) if nargin < 8 bUseParfor = 0; end crds = [nkx(:).'*dataDims_mm(1); nky(:).'*dataDims_mm(2); nkz(:).'*dataDims_mm(3)]; om = [crds.']*pi; % trajectory coords from -pi to pi % Nd = [Nx Ny Nz]; % image dime...
57a04469e1772746ff43e0b4c25f2266e6fab67c2379fe323f5613f1ee4e007d
MATLAB
779
27
function [gold_complete G] = edgelist_2_D5C4_gs(gold_positives) regulators = unique(gold_positives(:,1)); targets = unique(gold_positives(:,1:2)); %% lookup matrix for positive edges A = edgelist2sparse(gold_positives(:,1:2)); %% build gold standard matrix for positives (1) AND negatives (-1) G = zeros(length(regula...
667b1cfea42dd2697e7a85fc406ee4b37d0a7a9ccc6360fa2802600e3edd769d
MATLAB
779
27
function shrinkage = compute_shrinkage(... folder_fit,... subgroups,... idx_subgroups) fit_r = load([folder_fit '/fit.mat']); nb_animals = 0; for idx_subgroup = 1:length(subgroups) nb_animals = nb_animals + length(subgroups(idx_subgroup)); end rand_effs = zeros(nb_animals, length(fit_r.beta))...
e0c671d6df35e19c99c935aaa55d9b3ec29e7d2844e4525004a8bea063fb6981
MATLAB
779
28
classdef FourierEmbeddingLayerExponentialSqrt < nnet.layer.Layer % ... properties numFourierComponents end properties (Learnable) end methods function obj = FourierEmbeddingLayerExponentialSqrt(numFourierComponents) obj.numFourierComponents = numFourierComponents; ...