sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
30011a06baf5196d2c73abd0b535a39fa9c1859aaee43a64c466e4d8c67811e7
MATLAB
1,379
62
function fig = PlotcmpECG(x, y, L,varargin) % Plot two multi channel ECG for comparison % % inputs: % x: first input data matrix % y: second input data matrix % L: number of panels per figure % fs: sampling rate (1 by default) % % The Open Source Electrophysiological Toolbox, % Released under the GNU Genera...
e3b4dc21529ca3f82cc779bc9d9a0aabf632e1117e493823de977ec164f7f076
MATLAB
1,379
32
%craete a clusters brain render file with the same cordinates of the all %cells cluster (and solve the fliping problem and jitter problem) %load clustering brain render table clear clc [file, path] = uigetfile('clustersing_data.csv','MultiSelect','off');%When the user clicks the load psetion button, a window should op...
be89162634a62880df36a8344c205908f85f28b4bf7c5758c2a0adfb522b3e53
MATLAB
1,381
50
function dsData = downsampleTLab(rawData,dsRate,dsType) % Tritsch Lab Downsample Data % % dsData = downsample_TLab(rawData,dsRate,dsType) % % Description: This function downsamples data based on the last argument % being the type (bin summation, bin averaging, and traditional % downsampling % % Input...
f16e7c58b72b39e359d7b7be6d875f15658d15fc133a5de8be83a2d5506a4d4c
MATLAB
1,381
37
function [INDEXES] = getINDEXES(t, tevents, window4mean) INDEXES = struct(); INDEXES.t_events = tevents; INDEXES.dt_instantaneous = diff(tevents); INDEXES.rate_instantaneous = 60./diff(tevents); if length(tevents) > 1 %INTERVALLO INDEXES.t = t(t > tevents(2)); wi...
c50100a3b315b1f4e0bbca3d80370e42168c4ce96ce180ed3b86bf3f8928db09
MATLAB
1,383
59
% This code was ported from the nipy project (http://nipy.org) and was % originally contrributed by Bertrand Thirion - returns gamma parameters function [shape, scale] = gam_param(data, weights) eps = 1.e-5; i = data > 0; szi = sum(weights(i)); if szi > 0 shape = compute_c(data(i), weights(i), ...
ed5abb5368ba4be058026c13f604ebe4c90664c351515c2eee842c7896434f32
MATLAB
1,383
47
% Function to evaluate Hierarchichal Clustering by means of % Naive Bayes Classifier % Input % Rclust: Raster of active frames % frames_labels: Labels at each frame of the raster % Output % Mdl: Classiffier % ECV: Error Cross Validation function [Mdl,ECV]=Nbayes_Ensembles(Rclust,FRAMES_LABELS) %% Setup % Nensem...
96c36f573b521ac4881c0359b9edf4564958776763027962055100e1d59d0ad2
MATLAB
1,385
41
% Function to plot ACtivity of Cells in 3 stacks of boxplots: % Facilitated % Depressed % Unchanged function plot_boxplots_cellgroups(GlobalRoA) figure; [bda_final,bdam_final]=pairedraincloud('paired',[0,1,0;0,1,0],0,0,... GlobalRoA.fac(:,1),GlobalRoA.fac(:,2)); [bda_final,bdam_final]=pairedraincloud('paired',...
eafabe7881c76f9162618018f8183f312e79fcf7acfc1bde162b0c3be655e6df
MATLAB
1,386
32
function [ output_args ] = runPreprocessing( p ) %RUNPREPROCESSING runs preprocessing for all subjects and sessions % loop through subjects and sessions for sub = 1:p.nSubjects for ses = 1:p.nSessions disp([char(datetime('now')) ' Starting preprocessing for Mouse ' num2str(sub) '/' num2str(...
32c862f2894c5b09620447ac886ea4ebb5a86c1d00d167cd67ad81fd263dd228
MATLAB
1,387
61
function [xhd CI] = rst_hdci(x,nboot,plotCI) % [xhd CI] = hdci(x,nboot,plotCI) % HDCI computes the 95% confidence interval % for the deciles of a distribution % using the Harrell-Davis estimate % See Wilcox p.130-134 % % GAR, University of Glasgow, Sep 2009 rand('state',sum(100*clock)); if nargin < 2;nboot=100;p...
cfdd8a331c478ecf500ab0365a56712709807d70ff8f5a7631ae36eabd39fa2a
MATLAB
1,389
29
function [av_trials,err_trials,iti_trials,iti_err_trials] = ... get_full_ae_trials_in_subspace(p, av_trials_all,err_trials_all,iti_trials_all,iti_err_trials_all,q,trial_idx_ses,sessions) %% collect A/E data av_trials_cat = {}; err_trials_cat = {}; for sub = 1:p.nSubjects av_trials...
dacfcf5cecf806d8bd2bbf68697c0f14ec9dfe0754295a9757ed804e0a7d58ad
MATLAB
1,391
53
function rst_boxplot(varargin) % routine to make box plots specifying several parameters for display % % FORMAT rst_boxplot(data,linewidth,boxcolors,boxfillcolors) % % INPUT data a matrix of data to plot using box plot % optional: % linewidth the thickness of box and wisker lines % boxcolors a RGB ma...
378ee95197c817c0474c19d05bd1eeb57687a64f111edbf511f55fc9023cc74e
MATLAB
1,393
51
function [sig, kernel, kernel_ft] = nufft_best_gauss(J, K_N, sn_type) %function [sig, kernel, kernel_ft] = nufft_best_gauss(J, K_N, sn_type) %| %| Return "sigma" of best (truncated) gaussian for NUFFT %| with previously numerically-optimized width %| %| in %| K_N K/N %| J # of neighbors used per frequency location %...
2bc34538e981f008d1e37b5bb85b90567104a824550a9788dd3fabfae29f4c59
MATLAB
1,394
32
% Obviously this needs to point to your data (Siemens MP(2)RAGE with 3D-FatNavs) rawDataFile = '/Volumes/WD2TB_Data2/data/2018_05_10_TracInnovTest/meas_MID00045_FID34860_MPRAGE_FatNavs_1mm_iso_movement.dat'; % And this needs to point to the folder containing the TCL data from the % same session: TCLdir = '/Volumes/WD2...
2aebc21f8ae71f2cb76580c11421fe174747f53652c8910232c7ff5443f035ad
MATLAB
1,396
56
function [Q, P] = polar_decomposition(A, varargin) % % Calculates the polar decomposition of a square (complex) matrix A: % A = QP in the right mode % A = PQ in the left mode % where Q is a unitary matrix and P is a positive-semidefinite Hermitian % matrix. % % Usage: % [Q, P] = polar_decomposition(A,...
608f1b64f94363fc4937cb6bafc8af7a5b69149e358f6e18cb5cfdb588b41fd5
MATLAB
1,396
49
%% sides per session ttest cd('I:\My Drive\ELYASHIV\PFC_paper_results_after_revision\figure1_stats\TTEST_SIDES') load("all_cells_sides_and_sessions.mat") %% G1 = grpstats(T,["sessions","side"],"mean","DataVars",["is_ir","is_responsive"]); R = G1{find(contains(G1.side,'R')), ["mean_is_responsive","mean_is_ir"]}...
171ddc2211b2fbce789e86ee93b2809a894b9084cfbd9a06e81621f92267a4fa
MATLAB
1,397
56
% NOTE: after fixing this once, the logic of the script doesn't work % anymore... % inspecting 2DAA M8S9 (subject10) % there were several problems with the recording: % - miniscope started too early % - miniscope stopped too late % - bcam started too early (since miniscope was already running, but not as early as mini...
4bdac6f0aa3b40c0dbc19affe400979e7225543412f58ae6316b3836d412dc49
MATLAB
1,397
40
function predcond = PID_DecodeFromSpikeCellArray_customTrainTest(tempUnits, tuningAxes) % temp units has the fields trainSpikeCell (learn tuning) and testSpikeCell % (spike counts to gen predictions from). Shapes are of the tuning shape. tuningShape = size(tempUnits(1).trainSpikeCell); numDims = sum(size(tempUnits(1...
321470f19c5951b8d1b230a78988048034002bcad6a649b2e0d44f6fd845a7b6
MATLAB
1,398
49
function S = mToStruct(filename) %MTOSTRUCT read and evaluate a .m script, convert workspace to struct S = struct(); lines = jrclust.utils.readLines(filename); lines = stripComments(lines); if isempty(lines) return; end try eval(cell2mat(lines')); wspace = whos(); ...
bd9debab565cf1a8d7dae32dae5445f209ad913aa42127a2f8e3494f0e9162af
MATLAB
1,398
52
function ALLCellKL20190618 global EnveRLPhaseTM EnveCCresultSpikePro meanKldistDiff KldistSame dpath tfile Oldcd=cd; FR=[dpath,'CCSFolder']; cd(FR); LS=ls; k=0; KldistSame=[]; KldistDiff=[]; for k=1:length(LS(:,1)) %%%%‚Ù‚©‚̍זE‚Ƃ̔äŠr cd(FR); FL=strtrim(...
575ebd7e8e8efdc112a04224122e764e9db876492daf3e607df537f8af28b2ef
MATLAB
1,399
51
% % Test program for automatic ECG model fitting % % By: % Reza Sameni, September 2010 % Shiraz University, Shiraz, Iran % reza.sameni@gmail.com % % modified June 2018 clc clear close all; load('SampleECG2.mat'); data = data(1:15000,2)'; fs = 1000; t = (0:length(data)-1)/fs; f = 1; ...
e84f24dd6d532a6ebc1ede476351c2741907d573bf207bffbf7915e8b51136e7
MATLAB
1,399
52
% % Test ECG Spectrum plot % % Dependencies: The baseline wander toolbox of the Open Source ECG Toolbox % % Open Source ECG Toolbox, version 2.0, March 2008 % Released under the GNU General Public License % Copyright (C) 2008 Reza Sameni % Sharif University of Technology, Tehran, Iran -- GIPSA-Lab, INPG, Greno...
391c12a39486d84b0bbe15b9610c5e22280119bc933a2b163369d448dccb70d1
MATLAB
1,402
61
function [gfp,p,AllP] = AnTop(data,n_iter,flags) % Copyright 2009-2011 Thomas Koenig % distributed under the terms of the GNU AFFERO General Public License ns = size(data,1); ne = size(data,2); quiet = 0; nrm = 0; if nargin > 2 if ~isempty(findstr(flags,'q')) quiet = 1; end if ~isempty(findstr(...
64a32dcc641d67bd3044e6e8c249caa7c5c33d2c50d31b2477dcc8ad5ca0ba6d
MATLAB
1,403
53
function plot_s_knl_stm_all_prbs(session, channel, unit, fold) % Plot stimulus kernel of specific s-model for all probes % % Parameters % ---------- % % - fold: integer scalar % Fold number info = get_info(); width = info.width; height = info.height; ...
c9233d7d68cff5f957a7f8dc066611ba6de03451d61693996ae01ae28517100f
MATLAB
1,403
62
% An implementation of Jacobi's algorithm for symmetric matrix % diagonalization: The cyclic by row algorithm. % Ref: Golub, Gene H., and Charles F. Van Loan. Matrix computations. % JHU Press, 1996, Sec 8.4 % % Reza Sameni 3/1/2019 % email: reza.sameni@gmail.com % function testJacobiDiagonalization01 clc; clear; close ...
035eb8462ff4cf99a2d65e90d08061944f78040b80657f7fc852dbd8a2a97d9e
MATLAB
1,405
46
function [ t_pool] = prepare_data_tone_decoding(p, traces, evs, bvs, tis) % prepare data for tone decoding % - here we align trials to tone end (we exclude avoid trials with early % shutoffs) % - we dont differentiate between avoid and error % - we directly pool over sessions %% calc scale factors per subject ...
48508fb075862a4a16518bde7111f9dfc7a4fe84b88e1d7ba43b91720ae2fba6
MATLAB
1,405
60
function e001_writeFileFromScratch % % adi.examples.e001_writeFileFromScratch % % In this file I wrote many more eus samples than presssure but the % Labchart loader didn't show all of the eus data % % I'm not sure why this is occuring but the big lesson seems to be that % the program doesn't completely freak out...
51f6912aeabdf3c6cda8dfbc90cd255dbca1833d0ce8bd1fd5bd4924c5b678a4
MATLAB
1,405
45
% combine two linked nodes into one, keeping the first one function [node,link] = combine_nodes(node,link,i,j) % remove all links between nodes from first and second node lk_i = find(node(i).conn == j); lk = node(i).links(lk_i); node(i).links(lk_i) = []; node(i).conn(lk_i) = []; lk2_i = find(node(j).conn == ...
de8949657db1b0943f5f00198b1724e7d05942ab8f64e853d99d3e446f916ff6
MATLAB
1,405
61
%% plot histograms this_cols = {[.7 .7 .7],'b'}; ring_col = [200 100 150]/255; figure('Position',[100 100 300 300]) hold on histogram(ccs,'FaceColor',this_cols{1}) histogram(ccs_nl,'FaceColor',this_cols{2}) xlabel('Corr. Coef.') ylabel('# Cells') legend({'w/ lowpass norm.','w/o lowpass norm.'}) ylim([0 120]) fpath ...
156fb948e6d2c0dcd1272fda6fbe80105b921669b1a909bf1c0c7ae25b27da8c
MATLAB
1,406
43
function [T0, T1] = calculate_time_lags(peaks, phase) % calculate_time_lags - Calculate time lags for the pseudo-periodic component % analysis algorithm (PiCA) using the R-peaks and the ECG phase signal. % % Usage: % [T0, T1] = calculate_time_lags(peaks, phase) % % Inputs: % peaks: Vector containing the ind...
5371a680c510fdd9b320ecd52c18487f39c4d6c9e37e778ea5fb9e4624692d3f
MATLAB
1,406
39
classdef Project_Class < handle properties Data GUI_Handles end methods function obj = Project_Class() % Constructor. obj.Data = struct('Segments',{},'Vertices',{},'Points',{},'Axes',{},'Parameters',{},'Info',{}); obj.GUI_Handles = struct(); end function S = project_init(o...
7cf51615cf178d623d2de3766b7241e6dbd8908a008eb3ebca14995d6d5b65ed
MATLAB
1,406
41
function r_regions = ideal_region_list(dim,N,c_polar,n_collars) %IDEAL_REGION_LIST The ideal real number of regions in each zone % % List the ideal real number of regions in each collar, plus the polar caps. % % Given dim, N, c_polar and n_collars, determine r_regions, % a list of the ideal real number of regions in ea...
b187d16f81cccb8b1c110540487a19e217e50d961333fa70bcc32b78e8649e9f
MATLAB
1,407
32
clc clear cd('I:\My Drive\ELYASHIV\PFC_paper_results_after_revision\effect size\f6\i') x = importdata("all_ints_with_tags.mat"); %% g1 = grpstats(x,["file_name", "tag"],"mean",DataVars=["Is_reponsive","Is_reponsive_and_IR"]); g1.t = grp2idx(g1.tag); % g2 = grpstats(g1,"tag","mean", DataVars=["mean_Is_reponsive...
b12776cee4480c98526e0f52969b2fe68c1051db974687cdb98793a03d553081
MATLAB
1,408
34
function [C1,C2] = lineEllipse(a,b,O,A,B) % Get points of intersection of line and Ellipse % INPUT : a - major axis of Ellipse % b - minor axis of Ellipse % O - center of ellipse i,e (h,k) % A, P - points of striaght line (x1,y1) and (x2,y2) % OUTPUT : C - Point of intersection of line an...
314e5102375d50dfc0de2465507d490f0bccf58ce2431ac2d65b0867c0d7514e
MATLAB
1,409
42
function data = RemoveChannels(data, I) % RemoveChannels has been deprecated. May be removed in future updates. warning('RemoveChannels has been deprecated. May be removed in future updates.'); % % y = RemoveChannels(x,I); % Eliminate unwanted channels % % inputs: % x: matrix of input data. Smaller dimension i...
49b2388e64f34b545532b93db11c62802d34bedc05ab1d24cb4197875519d291
MATLAB
1,409
43
function auto_min_vent(app) if ~isnan(app.settings.channel_idx.res_flow) if isempty(find(contains(vertcat(app.data.name),'min. vent.'))) [data,ts,~, ~] = current_signal(app, app.settings.channel_idx.res_flow); t= ts(1):ts(1):ts(2); sig_p = data; sig_p(sig_p<0) = 0; sig_n = d...
7b0d2d4e8577f29fc80c057e7c38ac416da2faea68fe6f2e6ce0afc26077d6c5
MATLAB
1,409
38
%% compare number of responsive cells per exp in 2 data sets clear clc %load responsive cells per exp (output of calculate IR responsive from data %set 1 (PFC) [PFC_file, path] = uigetfile('PFC_responsive cells per exp.mat'); cd(path) X1 = load(PFC_file); X1 = X1.responsvie_and_ie_table; %load responsive cells per e...
915be01e528f6decf077714caab1a38b34c89c36d41ba2a78efd03f955efe14c
MATLAB
1,409
48
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function Figure2a_Dual_maximize_reward_20210201_test20220316 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Noise is determined by gaussian %With different std and different decision boundary bin = 0.001; bin...
cd946adfa418b50b9528d41e5d9158fa1701cfe699a57bb7604c1efc8c7ac74a
MATLAB
1,409
50
function curOTF = XxReadOTF3D(OTFPath, nx, ny, nz, dkx, dky, dkz) addpath(genpath('../')); [headerotf, rawOTF] = XxReadMRC(OTFPath); nxotf = single(headerotf(1)); nyotf = single(headerotf(2)); nzotf = single(headerotf(3)); dkzotf = single(typecast(headerotf(11),'single')); dkrotf = single(typecast(headerotf(12),'singl...
94ea299555083fa1d697871a8ff6c69effce95e8bba2de2f8d4ce7431ab75f8f
MATLAB
1,410
36
function rr_intervals_ecg = em_interval_calc(ecg_rpeaks_index, thr_max, thr_fast_max,max_lag) if nargin<2 thr_max = 0.5; thr_fast_max = 0.4; max_lag= 20; elseif nargin<3 thr_fast_max = 0.4; max_lag= 20; end if size(ecg_rpeaks_index,2)==1 rr_intervals_ecg = diff(ecg_rpeaks_index); %...
9d2260007523c8edbc5582042a42fe0eaa3e4835957cb40a4dea14878332464c
MATLAB
1,411
52
%% plot all ramps clear clc norm = 1; %% add togethter meny WF files cd('E:\2022\ramp_psth') [filename 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. datafile = fullfile(path, filename); %save path %% AR = []; %ALL R...
a2022ab3bf04acdfd0688225e496c5ef9981d9a903a743dc7f7eaad7f8a3eced
MATLAB
1,412
26
function [test_indices train_indices ind]=cv_stratified_multilabel_DBP_speed(N,n_folds,bestmodel) % N is the label matrix % Stratifies by discretizing multiclass tracking data into one unique label % after binning individual classes. The final discretized label makes up a % combination of individual classes labels....
9cd887172f41871ae1aafb09ee88514fc81ae07ba27006b6bffbe863fefc217c
MATLAB
1,413
47
function adapt_lms_spec(app,event) %ADAPT_LMS_SPEC Summary of this function goes here % Detailed explanation goes here xl = event.AffectedObject.XLim; yl = [0 app.edt_amp.Value]; switch event.AffectedObject.Tag case app.ax_spect_1_1.Tag if ~isequal(app.ax_spect_2_1.XLim, xl) app.ax_spect_2_1...
ec408e1522e06308b4bec9214981ef741096b284c3e7cf2dc4b3d1ddfba80386
MATLAB
1,413
46
function burst_criteriaset_diagnostics(Bursts) % NarrowbandRanges = unique({Bursts.Band}); NarrowbandRanges = []; CriteriaSets = unique([Bursts.CriteriaSetIndex]); Signs = [-1, 1]; Total = zeros(1, numel(NarrowbandRanges)*numel(CriteriaSets)*numel(Signs)); TotalUnique = Total; Labels = cell(size(Total)); Index = 1; ...
f97b56523aa284166e7f1eb0a0c994aa8fac58b12e15b66cb598086824d6beaa
MATLAB
1,413
43
clc;clear; load 'gradient1-3 data' load 'subjects information' mod = [sex eTIV]; von_parc = load('vonEconomo index'); %% %**********************************************step1 : Caculate Between Dispersion for i=1:1790 for k=1:7 index = find(von_parc == k); gradientCen1(i,k...
0c658a0118fb448eb190e87eb71643bb95e81420fb0fe9892c1fd3c896bd6025
MATLAB
1,414
53
function [valindSQI, indSQI] = SQI6(x, peaks) % % [valindSQI, indSQI] = SQI6(x, peaks) % Channel selection based on measure of PICA periodicity % % Fahimeh Jamshidian Tehrani, % jamshidian.t@cse.shirazu.ac.ir, % fahimeh.jt@gmail.com % February 2020 % % input: % x: input fetal ECG record % peaks: R-peak impulse trai...
126b9daa79f7355ab9ed337ac702a1728353ae6841e28d212e76c44d04617543
MATLAB
1,414
47
function [R_max,R_min,C_max,C_min] = coordinate(R,C) % [最右端,最左端,最上端,最下端] = coordinate(横坐标集合,纵坐标集合) R_max = zeros(2,1); R_min = zeros(2,1); C_max = zeros(2,1); C_min = zeros(2,1); [R_max_R_value] = max(R); [R_Right,~] = find (R == R_max_R_value); if (rem(length(R_Right),2)) == 1 R_max_C_index = R_Right(fl...
1314c5b31f45530b3c710474e39e901a8ca32b28f02fa2af4667f7d94a715b01
MATLAB
1,414
36
function saveeph(savefilename,thedata,varargin) % saveeph: saves data as a Cartool evoked potential data file (.ep(h/sd/se)) % % inputs: full path and name of the file to save, data as a 2-D numeric % array where dimension 1 contains the timeframes, dimension 2 contains the % channels, (optional) samplingrate as 1-D nu...
46a9c1b3b381b7ec5eff7d73512c2d6d4daf5e164e3ad41e6326c2c011e482a3
MATLAB
1,416
52
%% Wavelet Anlysis for Calcium Imaging Signals % Input % xd: Signal % wname: Wavelet Name % level: Level of Analysis % Output % xdenoised: Denoised Signal function sigden=waveletdenoise(xd,wname,level) % level=1; % wname='sym8'; [coefs,longs] = wavedec(xd,level,wname); % siz = size...
930e7677246c433028c7d327501f0d889af3a4e1b9a5f718cd00a37e4abf8583
MATLAB
1,417
69
%%% Test the model addpath('~/matconvnet/matlab'); addpath('../../../Utils') addpath('../../../TestImages') vl_setupnn %Parameters sigma_true=50; sigma_min = 40; sigma_max = 60; showResult = 1; useGPU = 1; pauseTime = 0; %Select which network to use modelName = ['DnCNN_20Layer_sigma',num2...
be6c5ee4eb98d3ac011f0972dc0f8b5ec891fa856e47666b6404ab9223891560
MATLAB
1,417
48
function str = join(cellstr_input,varargin) %toString % % str = sl.cellstr.join(cellstr_input,varargin) % % INPUTS % ======================================================================= % cellstr : A cell array of strings to combine. % % OPTIONAL INPUTS % ============================================...
a1d57ea0ff98a510653945796429860468948901ebdca3d02ec33160cb628d4e
MATLAB
1,418
36
function parse_data_pl2(filename) % Requires Matlab Offline SDK (Plexon Inc) in the Matlab searchpath % Based in code written by Azriel Ghadooshahy, Jan 2016 %Gather relevant info pl2 = PL2GetFileIndex(filename); [unused, fname, ext] = fileparts(filename); %List of possible different continuous sources %query source...
3d3d8f802d702f8176fe4614ba1e3440c94fa25afcae6b082a2acb6edc1435d5
MATLAB
1,419
40
function generateProcessedModularData( trainFolder ) % trainFolder = 'trainRecord_anti_force/trainRecord_R_4_anti_force'; runDataPreparation; %%% module structure of a and h? % case 1: analysis cross multiple epochs winSize = 50; nWin = T/winSize; AmatCellSlidingWin = timeSeries2ACell(a,winSize); epochEa...
bfe7578d408edc1b0349e34f0b2d091db62f4c16f1d1e55a34feca68b2229b08
MATLAB
1,419
50
function [rr, arg] = nufft_r(om, N, J, K, alpha, beta, use_true_diric) %function [rr, arg] = nufft_r(om, N, J, K, alpha, beta, use_true_diric) %| %| make NUFFT "r" vector %| %| in %| om [M 1] digital frequency omega in radians %| N signal length %| J # of neighbors used per frequency location %| K FFT size (should ...
2afa9721de27f5b14d6cd8fc20fa441a2fb5f6f5346cb5eef0921bb572b77aa3
MATLAB
1,420
49
function thr = autothreshold(exp_id,proj,zscore) %% Filter noise from projection data % Fits a Gaussian curve through the projection data and determine a cutoff % point in terms of z-score. Default is -1. % % thr = autothreshold(exp_id,[proj],[zscore]) % % Input: % exp_id: experiment id (filename of mat file ...
343b401c9ab0eb9b40db1621b18095f07e1998f03fd30c565017f2de28e7137e
MATLAB
1,420
58
% 1-d example of leslie greengard's gaussian kernel-based nufft, % type 1. R = 4; % oversampling ratio Msp = 12; % spreading parameter - the number of neighbors to spread % to in each direction M = 512; % dimension of uniform grid on which we evaluate nufft tau = 1/M/M*pi/R/(R-0.5)*Msp; % width of gridding k...
4dbcf8511e808f8a7f6ff36d237bfcd79c8c9af16d93c0b7cfca24cb210e7306
MATLAB
1,420
40
function [StageData] = session2stage(T, WhichStageUserInput) %SESSION2STAGE Sorting sessions into stages. % SESSION2STAGE(T,WHICHSATGEUSERINPUT)Identifying the % WHICHSTAGGEUSERINPUT stages of the sessions of data T based on the % ratio of tone type 1 and type 2, presense of punishment and freewater. % P...
8526c0dd2cbb008159e02220b8f51c743536c24defacc4837b761b302ef28a38
MATLAB
1,420
68
%% this script can be used to generate coarse alignment coordinates % we do this if the automatic alignment fails because there are % large scale rotations or translations %% load maps p = params_2DAA; thisSub = 8; for ses = 1:p.nSessions fpath = fullfile(p.rootDir,'miniscope', ['subject' num2str(thisSub)],['sess...
bfadcd409a1f7fee687f890269d95e2bc8f7d3fea2c460b8c577e2263f7d5a06
MATLAB
1,420
37
% load coordinates of the nearons coords = struct2cell(CTP.coordinates); coords = cellfun(@(x) x{1},coords)'; std_devs = [40, 80, 40]; % Load your matrix of structure coordinates annotation_volume_location = 'C:\Users\elyashivz\Documents\analyzing_slices\annotation_volume_10um_by_index.npy'; structure_coords = readNPY(...
06ab047a7c677d91d36f49641d94ec5deda0e62a485ec0dc5eaca8987333be48
MATLAB
1,421
67
%% B4 V_max = 130/3; % mV V_min = 5; % mV % capacitance of B4 Cm_B4 = 0.01; % uF % leaky conductance of B4 gL_B4 = 0.1; % uS RL_B4 = 0; % uS % reversal potential of the leaky channel of B4 EL_B4 = -60; % mV % sodium currents to B4 % maximal conductance of the sodium channel of B4 gNa_B4 = 25; % uS RNa_B4 = 0; % uS ...
ec820e269aefdd4a80d92c3cc1d7bccd03ce372646449f1b1e262271f95dd223
MATLAB
1,422
41
function old_default = set_matlab_bgl_default(options) % SET_MATLAB_BGL_DEFAULT Sets a default option for the Matlab BGL interface % % old_default = set_matlab_bgl_default(options) % options.istrans: the input matrices are already transposed [{0} | 1] % options.nocheck: skip the input checking [{0} | 1] % options.full2...
336b63eff84903850ad6782c381dfcfa086f77bbf398e7b8a95bae14ca0effea
MATLAB
1,423
38
total_cells = zeros(1,3); IR_cell = zeros(1,3); responsive = zeros(1,3); [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 for i = 1:length(datafile) ...
d9c7857313c0a917aaef5a3e6ec749be9f7baa54d6ff897a7b7dde643e81a3fc
MATLAB
1,424
36
function [features1, features2, features3, spikeWindows] = computeFeatures(spikeWindows, hCfg, nSitesEvt) %COMPUTEFEATURES Compute features for spikes if nargin < 3 nSitesEvt = []; end [features2, features3] = deal(single([])); spikeWindows = single(permute(spikeWindows, [1, 3, 2])); % nSa...
46bf264ab1199d01f3820bc7f8d49613f1d074e70b11b1f8519e3c810fecc976
MATLAB
1,425
48
classdef weightedAdditionLayer < nnet.layer.Layer properties (Learnable) % Layer learnable parameters. % Scaling coefficients. Weights end methods function layer = weightedAdditionLayer(numInputs,name) % layer = weightedAdditionLayer(numInputs,n...
76fdd5b82c33c6c41f796443d7afab5f3ab3a52e58749711a1303bc5180f5c29
MATLAB
1,426
66
%% this script can be used to generate coarse alignment coordinates % we do this if the automatic alignment fails because there are % large scale rotations or translations %% load maps p = params_FC; sub = 5; % thisSub = 83 for ses = 1:p.nSessions thisSub = p.subjects(sub); fpath = fullfile(p.rootDir,'minisco...
33f681accdff857a7e41befbc91e14644ed6047af4f8063c21e0a7c58a6d5eab
MATLAB
1,427
47
function varargout = histnorm(varargin) % Function to compute normalized histogram. % Input: % varargin: Variable input arguments. Can contain data to be histogrammed % Output: % varargout: Variable output arguments. Contains the normalized histogram % and bin edges. % Note: If no output is...
493e2ca72201b35f91bc47ef27139c9976038a9c8dd7d015ff446e484f4251d5
MATLAB
1,428
63
%% this script can be used to generate coarse alignment coordinates % we do this if the automatic alignment fails because there are % large scale rotations or translations %% load maps clear p = params_2DAA; sub = 6; for ses = 1:p.nSessions thisSub = p.subjects(sub); fpath = fullfile(p.rootDir,'miniscope', ['...
50c6335120b7aea78b0bbbe89fd136dcd04d0f96512fc9b0b0c861fec0906122
MATLAB
1,428
47
function [nrgSig,MSD] = msd_calc_model(data,nMSD,rMSD,nTR) % Inputs % data = data organised at TIME x NODES % dsmtx = onsets for different events - list of TRs associated with each event type % nMSD = maximum MSD range % nTR = number of TRs to track %rMSD = range of msd % Outputs ...
636ce6451baf9700dbcb5efe4faf75e4399a64a6dcbb8e362cb91d5b129e7caa
MATLAB
1,431
37
function [outFiles] = convertMNI2FS(inFile,outFolder) % inFile is a path to file you want to convert (must be in 2mm MNI space) % outFolder is where you want to put the transformed output files (in fsaverage space) % % Written by Alex Teghipco if ispc == 1 slash = '\'; else slash = '/'; end toolboxPath = which...
796e41d9d4a02ed15155359d70e8b3c6c8976b73e52b2bb15a73e95834085831
MATLAB
1,431
47
function y = HRSmoother2(x, FilterHR, wlen, varargin) % % HR = HRSmoother2(x, FilterHR, wlen, mode), % Conditional heart rate smoothing % replaces outliers defined by threshold FilterHR with the median value % over window length wlen, or with NaN, depending on the selected mode. % % Open Source ECG Toolbox, vers...
53281682ee69bd90be81fc9be959ad5d45cc116b411fd7652e4ee6a187efc43d
MATLAB
1,434
33
% Get Adjacency Matrix from Activity Matrix Normalized by Time (Raster) % Fire together Wire together % Assuming having more frames than cells ALWAYS! % Input % R: Raster dim: Cells (in CLSUTER ANALYSIS) x Frames % Output % A: Adjacency Matrix dim: Cells x Cells where: % a_ij: percentage of time that ...
f3f3bbfdc19a20c52cbf47da8d88f64e3df2bbc8587888f5824e6c4be35d707d
MATLAB
1,434
43
function h = scatter_kde(x, y, varargin) % Scatter plot where each point is colored by the spatial density of nearby % points. The function use the kernel smoothing function to compute the % probability density estimate (PDE) for each point. It uses the PDE has % color for each point. % % Input % x <Nx1 double> po...
1adfc72eff58d184586254361f14dd9c16fb63ddec19ad5bd5b3f7a76fc816f9
MATLAB
1,435
53
% this script gets run by cluster_submitGRErecon.sh % % variable 'rawDataFile' should have been set if ~exist(rawDataFile,'file') disp(['File ' rawDataFile ' not found, trying locally instead.']) rawDataFile = fullfile(script_pwd,rawDataFile); if ~exist(rawDataFile,'file') disp(['Error: file ' rawD...
3613c6aeccb691d7a0690be1759453354ee5ef01c1c0a6c85b66b1fd3d0f7891
MATLAB
1,436
43
function [XData, YData] = ampToProj(YData, XData, bounds, maxPair, hCfg) %AMPTOPROJ Reshape feature data from nSpikes x nSites to display in an %nSites x nSites grid % input: YData, nSites x nSpikes, y-values for feature projection % input: XData, nSites x nSpikes, x-values for feature projection ...
a2ac7940dfcbcacdeefe7dc5098ef103b605bc95d2b93517721b51214e20e379
MATLAB
1,436
51
function burst_res = batch_bursts(data,ts_fs,varargin) app = struct(); app.edt_window.Value = 0.18; app.chkbx_detrent_rms.Value = false; app.edt_threshold.Value = 0.11; app.edt_threshold_abs.Value = 0.11; app.chkbx_manual.Value = false; app.chkbx_th_on_silent.Value = false; app.edt_outlier_threshold.Value = 100; while ...
62233dc939559fae0a5ec226ea18b78f58934e2d1d05be91f4e68ef9f2c48df8
MATLAB
1,437
51
function nRemoved = rmRefracSpikes(obj, iCluster) %RMREFRACSPIKES remove refractory spikes if obj.nEdits > obj.editPos % not at tip of edit history, back out warning('cannot branch from history; use revert() first'); return; end if nargin == 1 % recurse for each cluster nRemoved...
d908271d4a4efef667e9630d47dee742b3da97a716118a313341308d8c962ea0
MATLAB
1,438
54
function Statics cd('C:\Users\C238\Desktop\touchcellLtRt_Hirokane'); LtPositiveFR=load('RtLtFirngRate_AllCell.mat','LtPositiveFiringRateArray'); LtNegativeFR=load('RtLtFirngRate_AllCell.mat','LtNegativeFiringRateArray'); RtPositiveFR=load('RtLtFirngRate_AllCell.mat','RtPositiveFiringRateArray'); RtNegativeFR=l...
c1888efa9d8b64fbd2449101cfd7759d2f6f1eceb87f1384b2871da9f817615b
MATLAB
1,440
56
function x = polar2cart(s) %POLAR2CART Convert spherical polar to Cartesian coordinates % %Syntax % x = polar2cart(s); % %Description % X = POLAR2CART(S) sets X to be the Cartesian coordinates of the points % represented by the spherical polar coordinates S. % % S is assumed to be an array of size (dim by N) representi...
ca7e770d627e34c4591c91c2dd255b87b074486185af2d41a40dbd2985358b5a
MATLAB
1,440
65
clearvars -except mouseData final; close all; clc %% user variables uv.dT = .100; uv.behav{1} = 'groomingStart'; uv.preWin = [-5 0]; uv.postWin = [-1 5]; uv.timeAxis = [-10:uv.dT:10-uv.dT]; %% load data in % cd('C:\Users\1\Desktop\Data sets for Jesse') % load('unmatchedFinalAndFinalData','final'); %% d...
adb05d38056fbf92dbb152c3373d6de685a79175e6bf29526aade27fc1a7fbdd
MATLAB
1,441
51
function [s,peaksm,peaksf] = PiCA3(dat,refm,refframem,thm,wlen1m,wlen2m,reff,refframef,thf,wlen1f,wlen2f,Itr) % % % t0 = 90; % reference frame center % % % w = 5; % reference frame half width % % % wlen1 = 10; % exclusion averaging frame half width (should be more than the fetal expected effective width)...
e550573018d435693092021d4118f23de94b1ef99bf7f80b4b8d0897a62e7b01
MATLAB
1,441
51
function check_matlab_bgl(A,options) % CHECK_MATLAB_BGL Checks the input A for various properties % % check_matlab_bgl(A,options) throws an input error if... % A is not square % if options.values and A is not double valued % if options.sym = 1 and A is not symmetric % if options.flow_graph = 1 and A is not a fl...
d6ebb5c2e589aee5b4a9e31b28a5f3cd9728205a4e896cbb51a277e1e7fd4718
MATLAB
1,442
56
function wincov = rst_wincov(Data,Percent) % Computes the winsorized covariance between the columns of the matrix Data % % FORMAT wincov = rst_wincov(Data,Percent) % % INPUT Data is a vector % Percent is the anount of trimming (default is 20%) % % OUTPUT wincov is the winsorized covariance matrix (ie the covaria...
68510f4cc7bce60235e96d413f86d7529be414ce43c2a483b9a10013f6266fa3
MATLAB
1,447
38
%% compare number of responsive cells per exp in 2 data sets clear clc %load responsive cells per exp (output of calculate IR responsive from data %set 1 (PFC) [PFC_file, path] = uigetfile('PFC_responsive cells per exp.mat'); cd(path) X1 = load(PFC_file); X1 = X1.responsvie_and_ie_table; %load responsive ...
076291074dfcfa847a4bc766720b5ac6d913f44df9b7c2a9856fd4a981e259de
MATLAB
1,448
49
%% Function to plot boxplots % INPUT % RASTER_NAMES % RASTER_FEATURES % Names_Conditions % f % axis function plot_box(RASTER_NAMES,RASTER_FEATURES,Names_Conditions,f,axis,varargin) if isempty(varargin) %plot line plotlines=true; else plotlines=false; end NC=numel(Names_Condition...
f3cf6a28ab95abf4507bf68523cee556723509f2910f628e6576e14e61671d33
MATLAB
1,449
62
%% Function to plot raster % Input % R: Raster Matrix Cells x Frames % fs= sampling frequency % Output % Figure of the raster in MINUTES % Always creates a new figure function Plot_Raster_V(R,varargin) if isempty(varargin) fs=1/60; % frames else fs=varargin{1}; end figure ax1=subplot(3,1,[...
fe1b4f9987f1693b0496181f902549e465e4decead154ee41300a3f90904ca0b
MATLAB
1,449
61
function savesef(savefilename,thedata,samplingrate) % savesef: saves data as a Cartool simple EEG data file (.sef) % % inputs: full path and name of the file to save, data as a 2-D numeric % array where dimension 1 contains the timeframes, dimension 2 contains the % channels, samplingrate as 1-D numeric array % % outpu...
c7c68202565acc919b3963f7accc36710421119f7fbdd73a90baecda1a3774bb
MATLAB
1,450
37
% This program is to contrast between session 3 and session4. % % % % by Hiro Taiyo Hamada, Araya Inc. clear all; close all; % extract time series from session 3 visualizeAllTimeSeriesSession3rd % extract time series from session 4 visualizeAllTimeSeriesSession4th %%% statistical tests on differences %% Means of %B...
e2991680c932ae3010363b6b4b9a63944c7814beeb87cf96b8853e96d0d333d2
MATLAB
1,450
52
function epochs = DB_epoch_detection(data, threshold, sign) % Detects epochs in data based on given threshold and sign % Input: % data - Input data % threshold - Threshold value for epoch detection % sign - Sign flag (true for positive threshold, false for negative threshold) % Output:...
30adbb20c91c7917a0758938077d8408bd28b5a11f42d917dbe113142615fe3c
MATLAB
1,452
39
function [INDEXES] = getINDEXES(t, tevents, window4mean) INDEXES = struct(); INDEXES.t_events = tevents; INDEXES.dt_instantaneous = diff(tevents); INDEXES.rate_instantaneous = 60./diff(tevents); if length(tevents) > 1 %INTERVALLO INDEXES.t = t(t > tevents(2)); wi...
35acbc3a30cf5a7e891c9d7446fd35caebf52f36800ad9fecdd1a7b41a630cf5
MATLAB
1,452
49
close all; clear all; clc; load diff load diff2 load med_arr load med_arr2 load med_for_e load med_for_e2 %% Histogram for ISI (Fig 3C) bin_edges = 0:0.001:0.2; figure histogram((diff/15000),bin_edges,'Normalization','probability','facecolor','#1b7837','edgecolor','none') hold on; histogram((diff2/1500...
583835eadc82eb338fa7f8f38a795120b3929975038fec16187eef600b9cd8fd
MATLAB
1,452
42
function [map, cm] = supp_fig7_whiskermap(folder, save) %% Supplemental Figure 8: Connectivity in whisker sensorimotor system % Subplots/information: % - Connectivity matrix of sensorimotor map % - (not in Matlab) network cartoon figure %% Load and match data if nargin == 0 folder = 'All'; end load('whisker_nodes...
a0b0ee6daf9b13c68067f2e75e5e76f8c1092c8d2f88eb041b947d362a1cf5cf
MATLAB
1,452
50
% 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 Neuroscience,...
5108142ab126fa7a4e4183233fb8b3b87e8e6cfab01b823bf58c451dbcaae488
MATLAB
1,453
53
%% Generale REAL Poisson processes for each cell; % Input: N: Number of Neurons % lambda: Rates of Poisson; Can be N*1 vec or 1 number % T: Total time (Unit: ms) % Normal: boolean: normalization or not % Output: eventsN: N*X Mat containing the series time for each neuron. % EventTimeMat: N...
329288a0e869845f50da2280e4dd105b45ac881219c4b062d3ef86b9d0b2dad2
MATLAB
1,454
67
function response_check global CCresultDrinkOn MaxZ CCresultLtouchWon MaxZL MaxDrinkZL AmpLt CCresultRtouchWon MaxZR MaxDrinkZR AmpRt fname TrimStr dpath... CCresultRtouchWon2 CCresultLtouchWon2 CCRt = CCresultRtouchWon(251:750); CCLt = CCresultLtouchWon(251:750); CCRt2 = CCresultRtouchWon2(251:750); CC...
85d34ddf06bf7487acd3e4910a1e682bdb205dbb5e5950202d3c01c82abc7e3d
MATLAB
1,455
58
clear [file, path] = uigetfile('*.mat');%When the user clicks the load data button, a window should open to enable the user to select a file. datafile = fullfile(path, file); %save path load(datafile) close all cd(path) clc %% f1 = figure; set(f1,'color', [1 1 1]); dark_colors = {[0.3010 0.7450 0.9330] [0.4940 0.1840 ...
d7a30af25aa8a38e508ebf24aa8c6fbc0afdba4f400ccb5e68ebba8d9a127021
MATLAB
1,456
68
function plot_multichannel_data(data, L, varargin) % plot_multichannel_data - Plot multichannel signals in several panels and figures. % % Usage: % plot_multichannel_data(data, L, color, fs, title) % % Inputs: % data: The input data matrix % L: Number of panels per figure % color: The color of the plots: 'b', '...
19331d400d4197dab48ac9d922f98ff456af4a7850f0c97aa1d48a1b6b0938fd
MATLAB
1,457
57
clear all close all clc project_dir = './Children/'; for sub_i = 1:27 sub = sprintf('%3d',sub_i);sub(sub == ' ') = '0' ses_i = 1; ses = sprintf('%3d',ses_i);ses(ses == ' ') = '0' tic index_pinky_Tstat_func(sub,ses,project_dir) toc end % for sub_i = ...
2d340604f0eb533507201cf01b90c4a12ca2ebc94d9f5183ce4779c5f2b7daf7
MATLAB
1,457
70
addpath(genpath(pwd)) clear close all clc mydir = pwd; idcs = strfind(mydir,filesep); % second parent folder contains the datasets dataset_dir = [mydir(1:idcs(end-1)-1),'/DataSets']; results_dir = [mydir(1:idcs(end-1)-1),'/Results/',mydir(idcs(end-1)+1:end)]; results_dir = pwd; addpath([mydir(1:idcs(end-1)-1),'/chmm-...
526f39981a91db91c7f943dee2d3473b34421f6311ca39ebfcd01c1b28135098
MATLAB
1,457
62
function [gfp,p,AllP] = GAnTop(data,n_iter,flags) % Copyright 2009-2011 Thomas Koenig % distributed under the terms of the GNU AFFERO General Public License [ns,ne] = size(data); quiet = 0; nrm = 0; if nargin > 2 if ~isempty(findstr(flags,'q')) quiet = 1; end if ~isempty(findstr(flags,'n')) ...
53156ad97fdb196bac587f778679b5ac2c7cb3630535d1016ebb6c6e8f1d9e54
MATLAB
1,457
47
function rmOutlierSpikes(obj) %RMOUTLIERSPIKES Mahalanobis-distance based outlier removal if obj.nEdits > obj.editPos % not at tip of edit history, back out warning('cannot branch from history; use revert() first'); return; end if obj.hCfg.outlierThresh == 0 return; end ...
eca28d601fbcb9311dc2871793e8ff7846c7c03112e94e2ccf977f1219eaa6fb
MATLAB
1,457
57
function ph = psth(times, binsize, fs, ntrials, triallen, varargin) % PSTH Computes the peri-stimulus time histogram from spike times. % The routine plots the trial averaged spike rate as a function of time. % H = PSTH(TIMES, BINSIZE, FS,NTRIALS,TRIALLEN) % H = PSTH(TIMES, BINSIZE, FS,NTRIALS,TRIALLEN ,AXESHANDLE) % T...