sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f2cf7d24174bd219e8fc7a47a1c2f67c2ebc9f55d6ab8eae75512587ec56df35
MATLAB
3,211
96
function Image1and2_WholeImageWithFlow_and_WithFlowColoredByDirection(imageExportFolder, fileParams, flowFigureImageParams, imageA, vxMat, vyMat, relMat, numMicrons, imageNumber) %% Check exist if imageNumber == 1 fileName = 'WholeImage_WithFlow.png'; elseif imageNumber == 2 fileName = 'WholeImage_WithFlow_Colo...
b3ab99bfb701935cd9db7986bf584442c450074c024ae6625224f66cd797071a
MATLAB
3,212
115
function [subj neighbor_idx] = create_spatial_avg_pat(subj, patname, maskname, varargin) % Creates spatially averaged version of a given pattern. % % % License: %===================================================================== % % This is part of the Princeton MVPA toolbox, released under % the GPL. See http://w...
b531d9c37ed927b605ec04a8f5e2aed0a1aeb49404d76aba089499e9b35813db
MATLAB
3,214
95
% script to render surfaces for video addpath(genpath('C:\Users\yonis\Documents\Laburo\PostDoc\Turbulence\RenderSurface\render_utils\')) make_it_tight = true; subplot = @(m,n,p)subtightplot(m, n, p, [0.01 0.05], [0.1 0.01], [0.1 0.01]); if ~make_it_tight, clear subplot; end % load surfaces for rendering on basedir=...
e73b4610abb19742266c8288a934ec9bd71f91b1508d1a5abdeaa393e07ec7e6
MATLAB
3,226
89
% function model = ldatrain(labels,data,param) % % Compute Fisher LDA. Currently, only binary classification is implemented. % INPUT (n = n_samples, p = n_features): % labels: nx1 vector of labels % data: pxn matrix of data % param: struct variable with the following optional fields % .shrinkag...
fff1aa45091ac5d3724239c2eea535d684dbc13ac9bc5b87d46b6754225f6fdc
MATLAB
3,226
114
function [p1, p2, err] = extractButtondownPoints() p1 = get(gca,'CurrentPoint'); % button down detected finalRect = rbbox; % return figure units p2 = abs(get(gca,'CurrentPoint')); fprintf('Initial ...\n'); dispSelectedPts(p1, p2, finalRect); [err, p1, p2] = errorCheck(p1, p2, finalRect); if err<...
07728ba77acbb61ef5a9d689066d62f2f465ba12a7a549a24af2e9b433034f0d
MATLAB
3,227
99
function Wbf=BF_type_cleaningFilt(X, L, A, alpha,gamma, Acomp, ncomp, typeReg, conds, smoothWithL) % This function creates a beamforming-based data cleaning matrix, which can be used to filter out artifacts from EEG data provided that the topographies of the artifacts are known %Input: % %X - input data (3D: chan...
4f14f9b368358a20f83f04f59dea31d0e57748afeeba4a8b84687b8bfde896dc
MATLAB
3,227
122
%% FF all_cor=[]; region=["EC-DG","DG-CA3","CA3-CA1","CA1-EC"]; cd 'graph' if ~exist('tunnel_cor', 'dir') mkdir('tunnel_cor'); end cd 'tunnel_cor' Anova_cor=[]; Anova_name=[]; titl=region; for regi = 1:4 all_n(regi)=0; corr=[]; for fi=1:9 temp_corr=[]; temp=tab.rspin{1, fi}(1+(regi-1)*...
86b08e4432d3f5c9465a2beef8e1ff2fcdb89e779eb5c42d203466f39be8dc37
MATLAB
3,227
83
DataPath = '.\Data\Neuro\'; OutPath = '.\Data\PCA_SIM\'; addpath(genpath('.\functions\')) %% === PCA === AMKSDs = matfile([DataPath,'AMKSDs_Sal.mat']); % trial-averaged KSDs AMPSTHs = matfile([DataPath,'AMPSTHs_full_Sal.mat']); % single trial PSTHs bws = AMKSDs.bws; nBW = length(bws); bins = AMPSTHs.bins; nBins = le...
3b9d2222e28363b0fd017e01f057487e98a510fb0330cb86f72b443d9fa02c78
MATLAB
3,234
131
function stats = tmass_permutation(all_results, all_predictions, p) %% Parameters n_sim = 1000; win_size = 1; % 1 equals no smoothing % 50 for EEG n_sub = numel(all_predictions); n_run = size(all_predictions(1).ang_pred,2); n_tr = size(all_predictions(1).ang_pred,3); parallel_pool(22) %% Find significant clusters...
542e74673ddde08aad3abf32ab891e07089f9cc1c4ed3e731eb3eaafb8bbdb5d
MATLAB
3,237
77
function visualize_contents() % visualize_contents Render the Bo 2026 amygdala FIR temporal clusters % into png_images/. See contents_description.md. % % Writes: % Bo2026_AmygdalaFIR_4clusters_montage.png standard CANlab atlas montage % Bo2026_AmygdalaFIR_4clusters_isosurface.png 3-D isosurface % Bo2026_A...
e189282d44764abd32e40fb4e5148d04f8ce41e8ba1d910451b80b0a022eb210
MATLAB
3,237
123
clear; % INT549:thr=7 prompt={'tau','threshold_scaling'}; answer=inputdlg(prompt); % set to folder with tiffs root = 'D:\McCormick_Data_May27_2021-\2021\Jun\4004_210610_E266_meso_am_1\2P'; file='4004_210610_E266_0_00012_00001.tif'; fs = dir(fullfile(root,file )); fname = fs(1).name; fname = fullfile(root, fn...
56fda7f0496e2b58dbbf93554279e4734d71370995d1aa25855c42dfab187952
MATLAB
3,238
93
function [transformationMatrix] = ... optical_flow_linear_registration3d(moving, fixed, varargin) % OPTICAL_FLOW_LINEAR_REGISTRATION3D Estimates a transformation matrix using optical flow % % INPUT ARGUMENTS % moving - Moving iamge % fixed - Fixed image % % OUTPUT ARGUMENTS % transfor...
c71f4f0d963d42a9961a60f445e062a152e7bd7aaaa4b6b9f3e8d94c96400f59
MATLAB
3,238
75
function mv_print_regression_info(cfg, X, Y, X2, Y2) % 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 - ...
e54ad53cc73e834e10ee643d5d403bb9be17c0b382251865c1c007450b6515e6
MATLAB
3,238
170
%% clear REPEATS = 10000; T = 100; L = 2; for ii = 1:REPEATS response = randn(1,T); group = mod(1:T,L); if mean(response(find(group)))>mean(response(find(~group))) pos = 1; else pos = 0; end [~,~,~,AUC(ii)] = perfcurve(group,response,pos); end figure;plotHistForFC(AUC,0:0...
2efa506ebed5f97878fa337a926fe520cfba312e3c87c469edcd2ff8842f5718
MATLAB
3,240
96
% Regression unit test % % Model: ridge regression rng(42) tol = 10e-10; mf = mfilename; % Generate regression data nfeatures = 100; X = randn(1000, nfeatures); y = X * rand(nfeatures, 1) + 10.01*randn(1000,1); % univariate model Y = X * rand(nfeatures, 10) +10.01*randn(1000,10); % multivariate model %...
c677fa5c31aa4343b218d36ed237b3f0c1d673f879f2675bc50ea59b43edf74a
MATLAB
3,246
120
function create_quadrature_filters_for_phase_difference_registration3d(varargin) % CREATE_QUADRATURE_FILTERS_FOR_PHASE_DIFFERENCE_REGISTRATION3D Creates 3D quadrature filters for usage in linear phase-difference registration % % create_quadrature_filters_for_phase_difference_registration3d() % % INPUT ARGUMENTS % N/A %...
08f99eba6fd57530a55165331717b1a3f448636c436aae433a59ab50ddeba21d
MATLAB
3,251
124
% Clean red and blue LEDs position of a 'led' file % % USAGE % % Process_DetectLED(videoFile,<options>) % % videoFile path to Basler video file, including the '.avi' % extension or not % <options> optional list of property-value pairs (see table below) % % ============...
089d9303c7d2c4c629a31c604bbdf40c2b8370a8fad4599e4aaf5b836f87f17e
MATLAB
3,253
128
%% [~, sids] = sort(Quality(Quality.^2>0.3), 'ascend'); x = dtest(sids, :); x = x./max(x, [], 2); figure; imagesc(x); colorbar title(sprintf('%d-%d %d', ii, f, bctype)); % time Fz = 9.47; StmDur = 3; % in second BasDur = 0.5; StmDurFrm = round(StmDur*Fz); BasDurFrm = round(BasDur*Fz); SpnDurFrm = StmDurFr...
92ab33ed697b4d0636abeaca890c5f3c956f6d7d6ce2487583de83528ee26245
MATLAB
3,255
79
%% Plotting alpha and tau paramaters of line fitting tuning curve analysis %% Code load('tuning_curve_line_fitting_params.mat') % load('tuning_amplitude.mat') %% load('MI_split_RFTrials.mat') split = ["sens cued","LR cued"]; mySplit = ["cuedSens","cuedBias"]; fig_id = ["g","f"]; COL(1,:) = [1,0,0]; COL(2...
df054dca7da876c93f5cb8505db3e34c79a67527d5d66c34e2c2237c65267cbe
MATLAB
3,257
91
function this = isivAnalysis(this) %ISIVANALYSIS Perform nonparametric ISIV analysis on an ACTI object % % $Author: Peng Li % $Date: Jun 15, 2020 % $Modif.: Mar 8, 2026 % Revise to enable multiscale and max IS calculation % Default output will be max IS at scale 60 or first scal...
ab0b43957fd0f5e21113cb7a01c07e6949dc647f20dafec12b58c5a165849118
MATLAB
3,258
83
% function p = stats_binomial(n_correct,n_samples,chancelevel,tail) % % Fast function to calculate multiple binomial tests, but only for discrete % values of n (otherwise please use myBinomTest on Matlab file exchange). % This function does not require the Statistics Toolbox. % % INPUT: % n_correct: how...
07da147a16718f4e7bef4b4163f1766aec17dc68caaa5e0a4df674e2d62b02b4
MATLAB
3,261
110
% Clean red and blue LEDs position of a 'led' file % % USAGE % % Process_DetectLED(videoFile,<options>) % % videoFile path to Basler video file, including the '.avi' % extension or not % <options> optional list of property-value pairs (see table below) % % ============...
3f91d6e1c9597eaf6269029672c085efe684a345d094148c7c3ff81943a2dccc
MATLAB
3,262
105
close all labelIO = true; modelName = 'ligandScreen'; network = IO([modelName '-Model.tsv']); annotation = readtable([modelName '-Annotation.tsv'], 'FileType', 'text'); inputNodes = annotation.code(ismember(annotation.ligand, 'True')); outputNodes = annotation.code(ismember(annotation.TF, 'True')); uniprot2gene = conta...
95585f958e45fe9bb6fc6f5746f1ff011fca5a0b09c7de35476445c4a1ac2036
MATLAB
3,262
105
% Classifier unit test % % Classifier: kernel_fda rng(42) %% do not change - might affect the results %%% Create Gaussian data nsamples = 80; nfeatures = 10; nclasses = 2; prop = []; scale = 0.0001; do_plot = 0; [X_gauss,clabel_gauss] = simulate_gaussian_data(nsamples, nfeatures, nclasses, prop, scale, do_plot); ...
3488e437949c8c78a76fe5b17f6675b96117b61dac72d95baf1f0d8bad709467
MATLAB
3,263
76
function [accumulatedField,accumulatedCertainty] = ... add_update_field_to_acc_field_with_cert(... updateField,accumulatedField,updateCertainty,accumulatedCertainty,... accumulationMethod,interpolation) % ADD_UPDATE_FIELD_TO_ACC_FIELD_WITH_CERT Accumulates the update field to the accumulated field % % [accu...
62c6ac227a84af743e9f15362f62d710b89f820acb883a8d533835809088c799
MATLAB
3,265
90
%ACTIGRAPHY % % Descriptions tba % % $Author: Peng Li, Ph.D. % $Date: Dec 23, 2019 % % +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % (C) Peng Li 2019 - % +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ % classdef actigraphy < handle ...
cef12150cd3016bd21ba56630575dbb9e7e383f88d17122101defa774a6efa25
MATLAB
3,266
97
function make_video_sch1000(enstrophy1,outname) % script to render surfaces for video addpath(genpath('C:\Users\yonis\Documents\Laburo\PostDoc\Turbulence\RenderSurface\render_utils\')) make_it_tight = true; subplot = @(m,n,p)subtightplot(m, n, p, [0.01 0.05], [0.1 0.01], [0.1 0.01]); if ~make_it_tight, clear subplot...
606511450f2aeed6f7210552ec7f667ea2230efb10af92588cd5cc8e4ac42576
MATLAB
3,267
113
% @title Test script for 3 RS neurons % @file RS_x3.m % @author Romain Beaubois % @date 18 Feb 2020 % @copyright % SPDX-FileCopyrightText: © 2020 Romain Beaubois <refbeaubois@yahoo.com> % SPDX-License-Identifier: GPL-3.0-or-later % % @brief Test script for 3 RS neurons % % @details % > **18 Feb 20...
bb211062d49fbc95bb4afeb6fe2254fb90acf5472bea516785819c6cbb23dfb5
MATLAB
3,270
113
% @title Test script for 3 FS neurons % @file FS_x3.m % @author Romain Beaubois % @date 18 Feb 2020 % @copyright % SPDX-FileCopyrightText: © 2020 Romain Beaubois <refbeaubois@yahoo.com> % SPDX-License-Identifier: GPL-3.0-or-later % % @brief Test script for 3 FS neurons % % @details % > **18 Feb 20...
1dd60a038c32ce5e9c2bc4b4ea018d7ad3c5d6d548d1be3975b54c30ea69d96b
MATLAB
3,275
84
function [dHandle, sHandle] = plotFreq(frequencies, gains, phases,... linespec,color,fillcolor, sHandle, newplot) % Make bode plots with data and model output % plotFreq(RL_data.freqs, RL_data.gains1, RL_data.phases1+180, % linespec, I.learn_color(2,:), I.learn_color(2,:)); lw = 1.2; msize = 3; phases = unwrap(wrapTo1...
523368897583ad7a4c5e5b772d85a2aa2c79e58ca4fb32e46a0ead46ea95a23b
MATLAB
3,279
78
% function decoding_out = get_decoding_out_from_passed_data(cfg,labels_test,passed_data,i_decoding,curr_mask_index,i_step) % % Helper function used to get data from passed_data if only result % transformations (e.g. AUC) should be calculated using previously stored % results. % % Kai, 2014-07-31 function decoding_ou...
e57763fc2fe4dfbf99e994b19f43dace2f668ff30debb219c6cd4e3fd839423a
MATLAB
3,280
115
data = importdata('C:\Users\Noga\Documents\Vermis Data\saccade_8_dir_75and25\\4243 PC ss.mat') data = importdata('C:\Users\Noga\Documents\Vermis Data\saccade_8_dir_75and25\\4814 CRB.mat') figure; raster_params.time_before = -399; raster_params.time_after = 1200; raster_params.smoothing_margins = 100; raster_params.SD...
8c34e22371880466ed561157009f44aac4a913bb385d4b653555dbabc0d49c95
MATLAB
3,282
119
%% RT XOR vs Tests clear all; clc; mdir=pwd; cd('../Data') load XORrespTimes; cd(mdir); %% XORs=[5 15]; RTMat=[]; for ex=1:length(XORrespTimes) for st=1:length(XORs) RTxst=XORrespTimes{ex}; RTxst=RTxst(RTxst(:,2)==XORs(st),:); for sb=unique(RTxst(:,1))' RTsb=R...
fdef2fa63e57c99a6b2ac440f8620ecc60aaf6f3760ab01b561523d70843a42f
MATLAB
3,286
99
close all; clc; Fz = 52; SelectedClip = 1:11; %% Simple testing Copy "a" from excel sheets if exist('a') Frms = a(:, 1); MarkX = a(:, 3); PhysX = [a(1, 5) a(end, 5)]; PhysX = MarkX*(PhysX(end)-PhysX(1))/(MarkX(end)-MarkX(1)); iFrms = Frms(1):Frms(end); iPhysX = interp1(Frms, PhysX, iF...
0d69dd8d114de789439ed3e44f511eaed7d20996895353daec152ee8184a6d2f
MATLAB
3,287
72
function [taskStruct, dispStruct] = runPractice(taskStruct, dispStruct) fireEvent(taskStruct.LPT, taskStruct.ePRACTICE_START); % a few practice trials Screen('TextSize', dispStruct.wPtr, 30); Screen('TextColor', dispStruct.wPtr, dispStruct.textColor); text1 = 'Before we start, let''s try 5 pra...
b155ecf168de7e4632afaf6df67939b572d556901087069a36165904e5b3b3e9
MATLAB
3,288
65
% function check_datatrans(caller_function_name, cfg) % % Check that no transformation (e.g. scaling, feature_transformation) of % the initial data occured, or if transformations occur that the user % knows that the data transformations will change the output of this % function. % These checks are here to ensure that...
36e74c2474787cf324178a0df35d6ca3c4a820a0c8beb74889798dd650349fcd
MATLAB
3,291
104
function [subj] = set_objfield(subj,objtype,objname,fieldname,newval,varargin) % Replace or add a field to an object % % [SUBJ] = SET_OBJFIELD(SUBJ,OBJTYPE,OBJNAME,FIELDNAME,NEWVAL,...) % % Replaces/adds the FIELDNAME field in OBJNAME object of type OBJTYPE % with NEWVAL. Will create the field if it doesn't exist, but...
d0bc832249b3c882c75df4c9a37c76d86ebeae3c246ae38db24e108114454a70
MATLAB
3,292
95
%% Loop through all the clip and generate the traces and evaluation (correlation) radius_c = 50; % in um radius_s = 300; pixel2um = 2; FolderPath = '\\storage1.ris.wustl.edu\kerschensteinerd\Active\Emily\NaturalSceneVideo\Preprocessed\Blue\'; nClip = 11; MovieSize = nan(nClip, 3); SharedVar = nan(nClip, 1); cl...
988d19c6c578277f62224af807addeff6e8396f81714a5335425844ab6234845
MATLAB
3,298
112
function [hit_rate,false_alarm_rate,p_val] = ... plot_psychometrics_boxplot( sessions, beh_dat) % Initialize variables % cTab = cell(1,length(sessions)); % p_val = zeros(length(sessions_looped),num_of_iters); % hit_rate = cell(1,2); % false_alarm_rate = cell(1,2); monkeys = {'Mo...
87a006a5d65aa4456fef3ead8458abbf23b124cd76b8c049c775544ac4e82edd
MATLAB
3,299
84
function info_v = minc_hdr2info(hdr) % Convert a MINC header into a simplified structure % This is called internally by MINC_READ and not meant to be used by itself. % % SYNTAX: % INFO_V = MINC_HDR2INFO(HDR) % % Copyright (c) Pierre Bellec, Centre de recherche de l'institut de % gériatrie de Montréal, Département d'inf...
07967adf23053ad9679e932be06fb874a6265bd29ce4e7b1108d2ac50be0ba1a
MATLAB
3,300
115
function this = fit(this) % FIT Fit a cosinor object based on LSE % % This can be done through minimizing the residual squared error % to solve normal equations -- RSS's first order derivatives w.r.t. each % parameter are zero % notation in Ref. [1] (check COSINOR) % y = M + Acos(w...
4c137a986860e83e943789c335775711abba076848471becfea0242f79b2edec
MATLAB
3,302
70
% GROUP LEVEL ANALYSIS TO SEE WHICH BRAIN AREAS SURVIVE DURING NAV > MATH TASK (Nav-Math Experiment) %% Set up the environment clc clear restoredefaultpath SPMPath = '/Applications/spm12'; addpath(SPMPath); spm('defaults', 'fMRI'); spm_jobman('initcfg'); pmDataPath='/Users/federica/data/GridMagination/3Iso/Script/0...
a19e9abcff7ff6b33adb1a6dbf3f1ea2c1edce9fc716b3f89eb0520d7ef184d4
MATLAB
3,303
121
function [burstCell,burstLim,Burst] = BurstSpikes(S) dispFig=0; Burst = cell(length(S),1); burstCell = zeros(length(S),1); burstLim = zeros(length(S),1); disp('Cell #:') for c=1:length(S) fprintf([num2str(c) ' ']); if ~mod(c,10) fprintf(...
d4cf5d7657ca9d0fa8e19564a522626d56f4da6c6958b7ac6cfe57f9f1bd3f98
MATLAB
3,303
75
% This script is a template for people who are interested in carrying out % between-subject decoding of brain imaging data. This is the case when you % have multiple conditions *within* each subject that you want to % decode across subjects. If you have multiple different groups of % subjects, see decoding_template_bet...
f13fbd9e3e510535c9d54593783337d3a9aec3b7300ee68f1da17365e66fb300
MATLAB
3,303
90
function output = betaBurstFeatures(cfg, input) %if ~isfield(cfg,'channel'); cfg.channel = input.label(1) ; end if isfield(cfg,'iTrial'); trials = cfg.iTrial; else trials = 1: size(input.trial,2); end fs = input.fsample; idxChan=find(strcmp(input.label, 'LFP_cl')); thresh = cfg.thresh; for iTrial=trials dat...
12c304afb6b21e4f23013d459beabe88eed518651ded78ff9892b569b8df3d62
MATLAB
3,305
85
function [update] = optical_flow_registration(... moving, fixed, transformationModel, multiModal,varargin) % OPTICAL_FLOW_REGISTRATION Estimates a displacement field using optical flow % % [update] = optical_flow_registration(moving,fixed,transformationModel,multiModal) % % INPUT ARGUMENTS % moving ...
40504371e11538d0850ea3d19332647c1ab871ea05a94bee42a0385ca9c9aa0b
MATLAB
3,305
126
function val = RasterPlot(S, varargin) % RasterImagePlot2(S, height, bar, tstart, tend) % % Plot a continuous function in a spike raster like form. % RasterImagePlot2 plots all waveforms in a matrix form. % INPUT: % S: tsdArray of ts objects, spike trains % OPTIONS: % Height: the height allocated to each cell (incl...
bd2b154adaf2d2c9ae31d2056424b0d6172a2796e3b5cdfd186c17d52582b415
MATLAB
3,306
114
function create_scatterhist(data1, data2, X1, Y1, figure_handle, meth, stim, coh, save_flag) % _ % Function to create the figure of a scatterplot with histograms on each % axis % % function CREATEFIGURE(DATA1, DATA2, X1, Y1) % IN: % DATA1: histogram data % DATA2: histogram data % X1: vector of x data % ...
4fae6f38e9a8386b21e893b6b73522287523ab47868f12948298afffa96120cc
MATLAB
3,310
116
function plot_cue_opp_moving(cueMI, oppMI, iWindow, iMonkey, yl, window, trial_type, sum_metric, slide) %% Plots V4 f-MI cued vs opp moving window plot (onset) %% Code cueMI_med = []; oppMI_med = []; for iBin = 1:length(cueMI{1}.(trial_type){iWindow}) if(iMonkey==1) cueMI_med = [cueMI_med;(...
56c9cfb4d41a865b74643d6f047e638905daae19c16c5aa4ec717672547f46a6
MATLAB
3,310
98
function KLd = KLdivergence(x, y, method) % Compute the Kullback-Leibler divergence between two multivariate samples. % Parameters % ---------- % x : 2D array (n,d) % Samples from distribution P, which typically represents the true % distribution. % y : 2D array (m,d) % Samples from distribu...
5b3d26a30d4ff0119c4d0b453c492fe978e04dadd86f4fa5620092ef2a6f263e
MATLAB
3,312
106
function [h] = crosshair(pos, varargin) % CROSSHAIR adds a crosshair at position (x,y[,z]) to the current axes % additional options are passed to the builtin line function % the handles of the lines are returned % % h = crosshair([x,y]) or crosshair([x,y,z]) % % You can specify the handle to the axes in which to pl...
cb63d164773a7a139056f5587a98c9c014729628446b3986c7e7e4e2a23f46b8
MATLAB
3,314
109
function [t, outind] = tensorprod(varargin) % TENSORPROD - Multiply two or more arrays while summing over repeated % indices. The indices for each array are indicated by strings. % % For example, % % C = tensorprod(A, 'ij', B, 'jk'); % % computes a normal matrix product. The names of the indices are limite...
e7e517f01936ec0ad98fc59d19c580c6ddc01e9106cfef01d6bc171cb59b9c5e
MATLAB
3,315
91
% function sim = pattern_similarity(x,y,method,param) % % This function calculates pattern similarity for the desired similarity % metric (e.g. 'pearson' for pearson correlation or 'cov' for covariance). % Importantly, it returns a similarity metric or a dissimilarity metric, % depending on the type of output (a c...
8a1c5c2828135c71d981a1b0e9c2de2bcc6e18b8880afa5ffe7c16069e56a7b2
MATLAB
3,324
132
clear [task_info,supPath,~,task_DB_path] = loadDBAndSpecifyDataPaths('Vermis'); EPOCH = 'targetMovementOnset'; DIRECIONS = 0:45:315; PROBABILITIES = [25,75]; PLOT_CELL = false; TASK = "pursuit"; req_params = reqParamsEffectSize(TASK); %req_params.cell_type = {'BG msn'}; lines = findLinesInDB (task_info, req_params)...
4f3d00ae6ff8955e782b7b62ba7ab194ab3b87e7ea908445d3c6aba1714bd689
MATLAB
3,327
72
% This script is a template that can be used for a decoding analysis on % brain image data. It is for people who don't have betas available to do % their classification and who need to enter their image names, labels and % decoding chunks (e.g. run numbers) separately. % Make sure the decoding toolbox and your f...
20d6881cd57665e3f0a77b74b4ab5d95d052ae73fd2f4c2becedcb4283fc6a1d
MATLAB
3,328
113
% % [Sout,SNout] = Sout_vsh_fast(r_sphere,R,EX,EY,EZ,ch_types,Lout) % % Calculate the outer SSS basis Sout using % vector spherical harmonics % function [Sout,SNout] = Sout_vsh_fast(r_sphere,R,EX,EY,EZ,ch_types,Lout) % Copyright (c) 2016, Elekta Oy % --------------------------------------- % % Redistribution and use ...
ea8e778c8a3902e8fa3d9c133d62dd03a56cb8f84f58e4955e7a02b22b32af1a
MATLAB
3,330
76
function trialStruct = runSummary(taskStruct, dispStruct, trialStruct) % clear the screen for 1 second tSummaryStart = Screen(dispStruct.wPtr, 'Flip'); Screen('TextSize', dispStruct.wPtr, 40); Screen('TextColor', dispStruct.wPtr, dispStruct.textColor); [~, ny] = DrawFormattedText(dis...
8951b55e46409d51b5fc8092ec5de94c4019f5288c48a5b73a9db3dd1eb0d287
MATLAB
3,331
94
% script to render surfaces for video addpath(genpath('C:\Users\yonis\Documents\Laburo\PostDoc\Turbulence\RenderSurface\render_utils\')) make_it_tight = true; subplot = @(m,n,p)subtightplot(m, n, p, [0.01 0.05], [0.1 0.01], [0.1 0.01]); if ~make_it_tight, clear subplot; end % load surfaces for rendering on ...
2365dc5784ca859ad9f3d6f63f276e9bdebae22eb7ac9e1d797b57484263b4d3
MATLAB
3,335
101
function [scratch] = train_lda(trainpats,traintargs,in_args,cv_args) % USAGE : % function [scratch] = train_lda(trainpats,traintargs,in_args,cv_args) % % This is a support vector machine training function. It train the % classifier and makes is ready for testing. % NOTE : This classfier currently does only two catego...
5457db47c977b65aea2c809a739f217f33253781825d5cbedd714e883b62fb09
MATLAB
3,336
51
%Evaluate flicker LFP phase locking value significance and amplitude. %2024/02/25 function evaluate_ssep_plv(fnames) %create parent output dir if does not exist: if ~exist([fnames.analysis_folder,'/LFP/static_ent'],'dir') mkdir([fnames.analysis_folder,'/LFP/static_ent']); end for ref_...
3b43a6639d47ce0ba89f9fb54048f9c564706e2de101c5aaa0a0a700487f12aa
MATLAB
3,339
105
% This script generates images for understanding the pathology utility and % predictive power %% Inputs modelName = 'paper v2'; % Part of the model name isCorrectAspectRatio2To1 = true; outputFolder = [pwd '\tmp\']; scaleBar = 100; % Plot scale bar [um] % Notice that total number of images to be rated b...
ae6d8457d4e767fc2ba19a8a669b7e17302a5c878decf364c23abcbef6f479aa
MATLAB
3,339
90
% beta is (#coefficients x HbX x #Channels x #conditions) % bvar is #coefficients x # Channels x #HbX % bvar is square of standard error, not SD % sigAct is HbX x #Channels x #conditions % sigDiff is HbX x #Channels x #pairs % For sbj 12, # of coefficients is 16. % use welch t-test % Average beta % Use Wald's test for...
05c88076469e74481c8d1bb6595d26485e0b3f519f60ad9792062814632c1f3e
MATLAB
3,340
102
function vidObjMoving = msAlignBetweenSessions(vidObjFixed, vidObjMoving) %MSALIGNBETWEENSESSIONS Summary of this function goes here % Detailed explanation goes here hLarge = fspecial('average', 80); hSmall = fspecial('average', 5); refFrame = vidObjFixed.meanFrame{vidObjFixed.selectedAlignment}; ...
1ff0a611c45d841b9160f14989b479853fea5dba25412f935bc478dce1b9f029
MATLAB
3,340
94
function coord_v = minc_world2voxel(coord_w,mat,opt); % Convert coordinates in the world space into coordinates in the voxel % space. % % SYNTAX: % COORD_V = MINC_WORLD2VOXEL(COORD_W,MAT,OPT) % % _________________________________________________________________________ % INPUTS: % % COORD_W % (matrix N*3) each r...
6d522d36cd291fa7af9b7b583373ef59485fd0247b956387e5b6cc12bb50e1d7
MATLAB
3,340
161
function status = keep_file_for_query(file_struct, options) % % USAGE:: % % status = keep_file_for_query(file_struct, options) % % returns ``false`` if the file is to be kept when running ``bids.query`` % % (C) Copyright 2021 BIDS-MATLAB developers status = true; % prefix, suffix, extensions ...
f42f973a76099e34c91d82a034f3f10d6b3d4ae021062b2a875d870dbe93c5e7
MATLAB
3,340
91
function violinplot_STATS(DIST_STRUCT, NORMBY, TITLE, YLABEL,... cmap, cmap_num, STATS) % violinplot_STATS plots a violin plot for each field of DIST_STRUCT and % carries out a one-way ANOVA and multiple comparisons analysis to test % differences between groups (fields in DIST_STRUCT) or a rank sum test, writin...
9d8e61b0ca03fe832724584897caa27bf6e368da8fd3487bd3f68c414fde856d
MATLAB
3,341
94
function mix = gmminit(mix, x, options) %GMMINIT Initialises Gaussian mixture model from data % % Description % MIX = GMMINIT(MIX, X, OPTIONS) uses a dataset X to initialise the % parameters of a Gaussian mixture model defined by the data structure % MIX. The k-means algorithm is used to determine the centres. The % p...
06b05e3509c190862f2002222cd2da69b02993b04c7b0ee24bc8e672f0075ecc
MATLAB
3,348
135
function [alltests] = run_unit_tests(varargin) % [ALLTESTS] = RUN_UNIT_TESTS(...) % % This is the main function for the test suite. It goes % through the TESTSDIR, looking for test_*.m files. Then, it % runs all those test functions and tells you how they % did. Each one returns an 'errors' cell array of strings, whic...
ddc54cf7b8ccbd6eb9c82a43544d4cc290f5ff2de51b115eb12e32ec6d5479fb
MATLAB
3,351
92
function net = mlp(nin, nhidden, nout, outfunc, prior, beta) %MLP Create a 2-layer feedforward network. % % Description % NET = MLP(NIN, NHIDDEN, NOUT, FUNC) takes the number of inputs, % hidden units and output units for a 2-layer feed-forward network, % together with a string FUNC which specifies the output unit % ac...
48659bdfd5d0340639c838cb0737a7b9f5295aa222b5008a8f18d013dd858313
MATLAB
3,352
112
%% Add path addpath(genpath('../../Ionnic Channel'),genpath('../../Tools'), genpath('../../Synapses'), genpath('../../Datas')); %% Import data from neuron (FS) dt = 0.01; Vmem = -90:0.01:60; SplineVmem = -90:1:60; l_V = length(Vmem); Spline_lV = length(SplineVmem); ...
721dde09d78475d4f96512d7e523169c88b8d489c99aea40bb589c82d7df708d
MATLAB
3,353
90
% to be run after preprocessFNIRS06_FInteraction_MultiOnly.m function plot_Subset_CumsumNDelta(s,numClasses,fefOnlyOp,saveOp) fs = 50; timeLen = [0.06 0.1 0.2 0.5 1 1.5 2 3 4 5].*fs; deltaLen = [5 11 25 49]; nrept = 10; kFold = 5; sbjNum = s.name; processedDataDir = ['C:\Users\mn0mn\Documents\ResearchProjects\spat...
f9059dbac946bde938752f1573c7b2b83d1cc201bbc84fb52ecca5b54522a705
MATLAB
3,354
62
function PlotTSMean_PreVPost( TS_mean_preVpost, TS_idx, TITLE, YLABEL, YLIMS, stdOrsem ) % Michelle Cahill 20200601 %PlotTSMean_PreVPost plots the mean value of each t-series pre-stim and % post-stim & the mean+-std or +- sem of all t-series. A paired t-test is carried % out for identified pre/post pairs % %...
cd728bfff167df7b21dce3a26313026ccb924de30585cd7ebed7be2996271a12
MATLAB
3,356
78
% function [predicted_labels decision_values opt] = ens_bal_te(labels,data,model,cfg) % % Testing part of ensemble approach that is used for balancing data. All % models that have been trained are combined and tested and decision values % are averaged together for each sample to generate an overall vote (this % is...
f2818345b280f1c68e4f8fb5fa6ea4ffe21a10f1305a5662686c1f940351b679
MATLAB
3,356
116
function Cr = CrossCorr(tsa, tsb, binsize, nbins, varargin) % Computes cross-correlation between TSD objects % % USAGE: % C = CrossCorr(tsa, tsb, binsize, nbins, options) % % INPUTS: % tsa - the triggering time series % tsb - the triggered time series % binsize - the size of the bins % nbins - the total...
c53ead414e3f540c8e917c7ea88542fba27a147ccbed2e0507db662f91729752
MATLAB
3,357
107
function ImportImage(importFolder, exportFolder, fileName) info = imfinfo([importFolder, fileName]); info = info(1).ImageDescription; automateFlag = 1; %changed if automateFlag == 1 %% Automated % ChLoc = strfind(info, 'channels'); % FrLoc = strfind(info, 'frames'); % numChannels = str2double(info(ChLo...
3c914f79f6bfad5576b38fc6befc3f37ef9046caced8a201e121b39b2e52d2f4
MATLAB
3,362
96
%% Well processing % Sam Lassers % Processes and computes spiking dynamics of MCS MEA wells %% Directory Setup clear clc recorded_date=date; parent_dir='D:\Brewer lab data\HFS'; %nostim mcd_dir='D:\Brewer lab data\HFS\No Stim'; % well_dir='D:\Brewer lab data\HFS\No Stim\Wells_5SD_500maxSD'; well_dir='D:\Brewer lab d...
b9530028cbe7d5803ed4ac18d3b2b51b8cf75642d09d133de1f22e3bc820c975
MATLAB
3,366
66
%Plots PSDs for all flicker conditions (except random and occluded), %all electrodes (1 depth electrode per figure), and saves the figure. %The following colors correspond to: %*orange: visual modality. %*blue: auditory modality. %*green: audio-visual modality. %2024/02/25 function plot_depthelectrode_PSDs(PSD_result...
a2106c1b75c071b6d761334a822f2951756719f067be785f7fd0ed432d15ce00
MATLAB
3,370
95
%% Loop through all the clip and generate the traces and evaluation (correlation) radius_c = 50; % in um PassHz = 4; pixel2um = 2; FolderPath = '\\storage1.ris.wustl.edu\kerschensteinerd\Active\Emily\NaturalSceneVideo\Preprocessed\Blue\'; nClip = 11; MovieSize = nan(nClip, 3); SharedVar = nan(nClip, 1); clea...
6add85a18b47840039387807b7b178ec4f3440b3560b9c424e225a6cbf68c5dc
MATLAB
3,371
104
function [subj] = statmap_template(subj,data_patname,regsname,selname,new_map_patname,extra_arg) %todo title % This is the sample/template statmap generation function % %todo synopsis % % [SUBJ] = STATMAP_TEMPLATE(SUBJ,DATA_PATNAME,REGSNAME,SELNAME,NEW_MAP_PATNAME,EXTRA_ARG) % %todo func...
751d28a331dade906c2f4e116d08a51a08d83a8ad793e06c26a99255552772f1
MATLAB
3,371
70
% Convert the frame and the mask to uint8 RGB. frame = im2uint8(frame); mask = uint8(repmat(mask, [1, 1, 3])) .* 255; minVisibleCount = 8; if ~isempty(tracks) % Noisy detections tend to result in short-lived tracks. % Only display tracks that have been ...
4d530f784504159bc473c6a3e9f634ae35ac2f3a41b7b2e1fac02aa98ea52224
MATLAB
3,372
47
function [z] = mtimes4x4(x, y) % compute x*y % and dimensionatity is 4x4xN, or Nx4x4 % if N==4 it is treated as Nx4x4 siz = size(x); z = complex(zeros(siz)); if siz(2)==siz(3) z(:,1,1)=x(:,1,1).*y(:,1,1)+x(:,1,2).*y(:,2,1)+x(:,1,3).*y(:,3,1)+x(:,1,4).*y(:,4,1); z(:,2,1)=x(:,2,1).*y(:,1,1)+x(:,2,2).*y(:,2,1)+x(...
640c98b77480688e43b349f9db9461fbaa36ef3a14cd8b808d94179f2df3e7fe
MATLAB
3,373
69
function [movingRegistered, transform] = register3D_intensity_multiscale_affine(im1,im2, initial_transform, initialise, downsample_factor, mode, iterations, type, min_I) % iterate through the downsampling: n_scales = length(downsample_factor); % set up the basic registration settings [optimizer, ...
9c524ae42ff02ed1bd356ad8095234051cff01cd47003ba21f4483a5cd80047a
MATLAB
3,374
147
clearvars; clc; close all; datapaths load([SumPath,filesep,'unitList_all.mat']); ResPath = [SpkPath,'\']; units = units(units(:,4)==1,:); mice = unique(units(:,1)); nUnits = size(units,1); nMice = length(mice); SRate = nan(nUnits,13); cnt = 1; for k=1:nMice load([ResPath 'M' num2str(mice(k)) '\M' num2str(mice(k))...
19d206df3d64c8b2b90eb41d1e5025605b39a000f8f14c08cbe5a7c01191d2bd
MATLAB
3,379
69
function [movingRegistered, transform] = register2D_intensity_multiscale_affine(im1,im2, initial_transform, initialise, downsample_factor, mode, iterations, type, min_I) % iterate through the downsampling: n_scales = length(downsample_factor); % set up the basic registration settings [optimizer, ...
86768151fc6a139ad0846fbb122bad979fd58885bf96525d6a1757ebe317bb79
MATLAB
3,380
84
function [conds, nConds_JR, tts, head, target, hevel, ... PC, sines, light, dt, RR_data] = ... loadJR_RR_combined(I, data_path) % ------------ J. RAYMOND & LISBERGER DATA ----------------- [conds, tts, head, target, hevel, PC, sines, light, dt, cond_inds] = ... loadJR(data_path, I.t_step_jr); nConds_JR =...
04472e32341d565856b8e99f1f95747a5c34ecc978e17ab432a7bc332b5e8214
MATLAB
3,385
74
function AssertOSX % AssertOSX % % OS X: ___________________________________________________________________ % % Call AssertOSX at the head of scripts which use functions unique to the % OS X Psychtoolbox. AssertOSX will exit with an error if called from % MATLAB running on any OS other than OS X, providing an explan...
ddd16fb1c75e95a44b2e5c08cd8a249bed33adecef6f3b39b4671963b1994a86
MATLAB
3,386
111
% % [Sin,SNin] = Sin_vsh_fast(r_sphere,R,EX,EY,EZ,ch_types,Lin) % % Calculate the internal SSS basis Sin using % vector spherical harmonics % function [Sin,SNin] = Sin_vsh_fast(r_sphere,R,EX,EY,EZ,ch_types,Lin) % Copyright (c) 2016, Elekta Oy % --------------------------------------- % % Redistribution and use of the...
f671f3ad346d13de0f7c0800ced3a2c72255b204e0e88417f1e2276557068495
MATLAB
3,387
92
function [SC_recon_ratio, SC_recon_FC_r,... SC_rewired_ratio,SC_rewired_FC_r,... SC_moran_ratio,SC_moran_FC_r]= SC_recon_marmoset_activity(zX_RS,n_ROI,n_null) SC = load('Data/marmoset_invivo_SC_Order.mat'); SC = SC.matrix_sc; % only analysis 55 regions SC = SC(1:n_ROI,1:n_ROI); %% Threshold SC matrix...
8e5656b0ff3b91800c859fc368f5f34ab1c603c0ab76f5eb0102a40ee5e34cb6
MATLAB
3,388
118
clear all [task_info,supPath,MaestroPath] = ... loadDBAndSpecifyDataPaths('Vermis'); req_params.grade = 7; req_params.cell_type = 'PC ss|CRB|SNR|BG'; req_params.task = 'choice'; req_params.ID = 4000:5845; req_params.num_trials = 80; req_params.remove_question_marks = 0; req_params.remove_repeats = 0; lines = find...
a3a391b6dcee84a7ac8c02936a37263f42c709aa55d6fb5413c543dc4c69bc90
MATLAB
3,390
117
function [perfmet] = perfmet_maxclass(acts,targs,scratchpad,varargin) % This is the most basic performance metric. % % [PERFMET] = PERFMET_MAXCLASS(ACTS,TARGS,SCRATCHPAD,...) % % The classifier is considered to guess correctly if its maximally % active row (the unit that it guessed) corresponds to the most active % ro...
d4453b25a350d098b7bbebb8e94970654aebd5c4e19609bca391d3eddd19dca0
MATLAB
3,392
111
function [zval, p, w] = mv_stat_wilcoxon_signrank(X, X2) % Two-tailed Wilcoxon signed rank test (one sample or two samples). % Unlike Matlab's signrank function, it also works for multi-dimensional % arrays. % % Usage: % [stat, p] = mv_stat_wilcoxon_signrank(X, <X2>) % %Parameters: % X - [samples x ... x ...
3166b4244c4af52ae99bf59d7290dac379c5322e794b6b5d633eb65554866a5c
MATLAB
3,397
116
function RasterPlot(PH, varargin) % RasterPlot(S, height, bar, tstart, tend) % % Plot spike trains as rasters. % INPUT: % S: tsdArray of ts objects, spike trains % OPTIONS: % Height: the height allocated to each cell (includes spacing), default 1 % BarFraction: the fraction of height occupied by a cell, default 0.8 %...
a2320dca31b8dc17e972be4cdef91564cb36a7134a476672e6d543d9b1dc459e
MATLAB
3,397
114
%DEMNS1 Demonstrate Neuroscale for visualisation. % % Description % This script demonstrates the use of the Neuroscale algorithm for % topographic projection and visualisation. A data sample is generated % from a mixture of two Gaussians in 4d space, and an RBF is trained % with the stress error function to project th...
b797e1913baf93ba18c864b2c3a555bacf09f43a93d80fe3443a09227ba21acc
MATLAB
3,397
106
function [subj] = load_matrix_pattern(subj,new_patname,maskname,mat) % Loads a 4D matrix into the SUBJ structure as a pattern % % [SUBJ] = LOAD_MATRIX_PATTERN(SUBJ,NEW_PATNAME,MASKNAME,MAT) % % Adds the following objects: % - pattern object called NEW_PATNAME masked by MASKNAME % % Creates a pattern object in the subj...
d4a1cf3e67af43672c899f2a20a9b863ea9f5ef4eacd477577ef2cbc51cc5e3d
MATLAB
3,397
104
% Extract the brain activity computed in the GLM2_Test Grid orientation in % the EC %% Set up the environment clc clear restoredefaultpath SPMPath = '/Applications/spm12'; addpath(SPMPath); %% Enter % Work Path WorkingDirectory='/Users/federica/data/GridMagination/3Iso/CONT'; %SubjectList pmDataPath='/Users/feder...
0566ff66c20fa8c7ed4d8cc8593202fee31f7a50f00b5de097c3955af52a9ec0
MATLAB
3,399
90
% STATUS: active % % SYNTAX: % plot_Corr_CAvsBeh(numClasses) % % DESCRIPTION: % Plot correlation between behavioral score and decoding performance at % 2-3s window. % % RESTRICTION: % None. % % INPUTS: % numClasses - int: number of classes to classify % 2 - classify between left & right % 3 - classify...
c7d38c7b1c60703bda1169e0903850ac4aa5861b5995adb9e087f5f0c493d43e
MATLAB
3,399
91
% [working, libsvmdir] = check_libsvm(cfg, display_path) % % Checks whether libsvm is working with the parameters in cfg % An error will be thrown when libSVM is not working, and nargout == 0 % % IN % model_parameters: the model parameters to be used with libSVM % display_path: if 1, the path to libSVM will be show...
0965cf612aaebf1cd485a4c468b945c7597b7cb37cf4238c5346e6fbdc346752
MATLAB
3,400
100
function [val scratch] = statmap_classify(pat,regs,scratch) % Create a statmap based on cross-validation performance % % [VAL SCRATCH] = STATMAP_CLASSIFY(PAT,REGS,SCRATCH) % % This contains the logic for running classification on each % voxel/sphere and creates a statmap of their % results. Should work equally for a s...
3b168084f1bb7950f4139f373c69a870fb387ca750f9761bd6f40b407d3358e0
MATLAB
3,404
118
%This script incorporates deltaF/F calculations from Jenna Sternberg and %members of the Wyart lab, and temperature measurements from Harry Bell in %the Sengupta lab. clear all; close all disp ('Choose image acquisition file') [image folder] = uigetfile('*.*'); imagefile = strcat(folder, image); disp ('Choose image t...
2489f29d0bbc47c334049c85e9dd6f1457d72ff4047888ae224ffcd3b728e7fb
MATLAB
3,406
101
function FlowClusterTracksData(fileParams, mainAnalysisParams) %% File Parameters exportFolder = fileParams.exportFolder; pxPerMicron = fileParams.pxPerMicron; secBtwFrames = fileParams.secBtwFrames; thetaInDegrees = fileParams.thetaInDegrees; thetaInRadians = fileParams.thetaInRadians; minBtwFrame = secBtwFrames/60; ...