sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e833cfb631113df53a16f490a8ecd80ffb955b3049544779818b15fd8552de5e
MATLAB
5,192
144
%% clear all close all run(['..' filesep 'def_local']) addpath(path_fieldtrip) ft_defaults if ~exist(preproc_path, 'dir') mkdir(preproc_path) end %% manualRej = 0; % set flag to 1 in order to perform manual artefact rejection if manualRej ~=1 fprintf('Manual artifact rejection switched off...\n ... load...
fc927a5b53ed64f7b2fea8e1c7625b106cb59853326f940782873aa929b4f3bf
MATLAB
5,194
143
function step3bb_plot_validation_fmri_meg_combo(bids_dir, varargin) %% Function that plots the results of the combination analysis between fMRI and MEG % we are taking the univariate activation in V1 and FFA and use the % time-resolved MEG data to predict these % % @ Lina Teichmann, 2022 % %...
5c5f1b34f39bacf48e6482a46350453c7c485e0d8b1cd0ddc7119e491ab8968d
MATLAB
5,195
181
%function FM_sweep_testing() % close all; % Define RCX file handles.RPfile = 'C:\gits\epsych\UserFiles\SanesLab\RPVdsCircuits\Sandbox\KP\AM_jitter_Macro.rcx'; %Load in speaker calibration file pn = 'C:\gits\epsych\UserFiles\SanesLab\SpeakerCalibrations\'; fn = 'rig1012-CeilingB_Noise_Mar072016.cal'; fidx=1; % [fn,...
56fe4192a17091b5e996eab402fb8995e6062a857fb9ab7b7ef1f3896f6d2bf8
MATLAB
5,200
204
function [rectx,recty,area,perimeter] = minboundrect(x,y,metric) % minboundrect: Compute the minimal bounding rectangle of points in the plane % usage: [rectx,recty,area,perimeter] = minboundrect(x,y,metric) % % arguments: (input) % x,y - vectors of points, describing points in the plane as % (x,y) pairs. x and...
08acd30316cf012435dc676660633292a1c1b27f3e05efe2f24aedda3e8e1713
MATLAB
5,201
132
function [db,P] = processData_paper(db,P,recompute) if ~exist('recompute','var') recompute = 0; end % clean fields in case fnames = fieldnames(db); db = rmfield(db,fnames(contains(fnames,'Data'))); P.bins = P.proc.window(1)+P.proc.binSize/2:P.proc.binSize:P.proc.window(2); P.nBins...
96aacffb024ae3c3f0f1760c62ecd9214e03205d5dffa1a61f364a2758651657
MATLAB
5,204
208
% fresh start clearvars close all %% run config config_file='config_mammals_1.m'; addpath(strcat(pwd,'/config')) run(config_file); %% read in proc spreadsheet % filename = [ DD_PROC '/MamiNum_corrected_proc.txt' ] ; % ssheet = readtable(filename,'Delimiter','\t') ; % % animal_names = regexprep(ssheet.file_prefix,'...
8211f924978a452c7a2fd8339c3f83781d0869981c0f1b3282e3e63aea67e7e5
MATLAB
5,205
197
function [w, infos] = fista(problem, options) % Fast iterative soft (shrinkage)-thresholding algorithm (FISTA) for LASSO problem. % % Inputs: % problem function (cost/grad/hess) % options options % Output: % w solution of w % infos information % % This file is part of Spa...
5d7f9eed40dc10082d25e935a0ef6421a87711c8f0adf1209b72c35b02fac60e
MATLAB
5,209
207
function concat_temperature_csv_files(file_path) % Build cooling record % Add temperature to each trial % Add label (bilateral, right, left) % Request source directory from user if nargin == 0 file_path = uigetdir(); end % Load files files = dir( fullfile( file_path, '*.csv')); T = []; % For...
8d54b5b6571b7735a603fc9531f017ccec4d6ad875825e11649b12f42406257d
MATLAB
5,217
220
% fresh start clearvars close all %% run config config_file='config_mammals_1.m'; addpath(strcat(pwd,'/config')) run(config_file); VIZIT = 0 %#ok<NOPTS> %% big loop for tDx = 1:length(THRDENS) %% filename = [ DD_INTERM '/con_mat_gn_repani_stack_thr' num2str(THRDENS(tDx)) '_.mat' ] ; ll = load(filename) ; c_aCon...
5e326442402e0d204185b84671d048ea8a9d05da2b3dfdc1846b083df5681c8b
MATLAB
5,218
118
function compare_fasc_recruitment() model1 = select_and_load_model(); model2 = select_and_load_model(); Q = 0:120; [recrAbsPerAS_1, recrNormPerAS_1, numFiberPerFasc_1, ... activeSites_1, fascicles_legend_1] = load_recr(model1, Q); [recrAbsPerAS_2, recrNormPerAS_2, numFiberPerFasc_2, ... activeSites_2...
c7508c6af76181e4fd84933907f352c47dbb08024f0e32e928479af7d4c7df33
MATLAB
5,219
132
%% %%%%%% PREAMBLE %%%%%% clear Target = 'LONG'; warning ('off') if ispc pat = 'C:\Analysis\AssemblyAnalysis\raw\'; addpath(genpath('C:\Users\ad15419\Dropbox\MATLAB\PC MATLAB Path\AssemblyCode\Eleonora\Mic\programs')) else path(path,'/panfs/panasas01/phph/ad15419/MATLAB') addpath(genpath('/...
cc657996f7cc1ebf0964b8a11227ca44911c548a7c5f39283057249bcb7ba1df
MATLAB
5,219
163
function [NextTrialID,LastTrialID,Next_trial_type] = ... passive_trialselect_SanesLab(TRIALS,remind_row,... trial_type_ind,LastTrialID) %[NextTrialID,LastTrialID,Next_trial_type] = % aversive_trialselect_SanesLab(TRIALS,remind_row,... % trial_type_ind,LastTrialID) % %Custom function for SanesLab epsych % %S...
62d7de14fecebca79714eab4db04e36a75e919f60d4b1f52cb147b84875069e5
MATLAB
5,220
109
% ---------------------------------------------------------------------- % out = simPalamedes(stairParams,obsParams,simParams) % ---------------------------------------------------------------------- % % Purpose: Simulate (modified) Palamedes titration procedures. % All three inputs are required to run a si...
88903c2d48483b7624d6392f967e6e8de60228201040127549580c7d53e79caa
MATLAB
5,233
110
function [CVE, pClass1,CVEunits,pClassunits] =DecodeCVEdistance(FR,evt0,reg) % Leave-one out cross-validation error (CVE) Decoder % % (c) 2014, Daniel Durstewitz, Dept. Theoretical Neuroscience, CIMH % Mannheim/ Heidelberg University % Edited by Aleksander PF Domanski PhD UoB 2015 % aleks.domanski@bristol.ac.uk ...
4fb2a978bf80ac638bad3861b3e0f0245978dfdcbb3942107c4608c56854af9f
MATLAB
5,237
209
%function FM_sweep_testing() close all; handles.RPfile = 'C:\gits\epsych\UserFiles\SanesLab\RPVdsCircuits\KP\circuit_wav_stim_data.rcx'; % handles.RPfile = 'C:\gits\epsych\UserFiles\SanesLab\RPVdsCircuits\KP\FM_sweep_test_manualcircuit.rcx'; %Load in speaker calibration file % [fn,pn,fidx] = uigetfile('C:\gits\eps...
bf5c4bc51dcc1f260a79c565d2fbffa1968d8368733de596628ac44512bae42b
MATLAB
5,255
46
function out = qtipm_mcheck(model,D0) % function qtipm_mcheck() % % checks if condition (m-) is satisfied using SDP % % assumes model is [28,nvox] nvox = size(model,2); % get d and c and change units d = arrayfun(@(i)convert_1x6_to_3x3(model(2:7,i).*1e9), 1:nvox, 'UniformOutput', false); c = arrayfun(@(i)convert_1x21...
37b995ca630b9dcc911121ae23aee20497999736e17797f9055f894c5860f03d
MATLAB
5,256
174
function varargout = f_change_chan_name_GUI(varargin) % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @f_change_chan_name_GUI_OpeningFcn, ... 'gui_OutputFcn', @f_change_chan_name_GU...
b579d1654c1c2e4b30be334383ac85b3674a837aedefdbb287438d29aa8a3b8e
MATLAB
5,259
96
%% Model based on % Model : PMSM Field Oriented Control % Description : Set Parameters for PMSM Field Oriented Control % File name : mcb_pmsm_foc_sensorless_f28069MLaunchPad_datascript.m %% Gather the dataset %data = out.simout.signals.values; put in command window, then save array %%...
c6a4eeaefc4393b5afd810e58f618ec0757b36fb59f7700554bf7c86fbab7008
MATLAB
5,294
147
function [dr] = tpdriftcheck(dirname, channel, searchx, searchy, refdirname, refsearchx, refsearchy, howoften, avgframes, brightnesscorrect, roicorrect,subtractmean,brightnessartifact,writeit, doplotit) % TPDRIFTCHECK - Checks two-photon data for drift % % [DR] = TPDRIFTCHECK(DIRNAME,CHANNEL,SEARCHX, SEARCHY, % ...
51966a9e827987bd47367eb7a0e64e9925b6d5c4e2f5e6b4a0780b36f188745e
MATLAB
5,300
177
function RUNTIME = ep_TimerFcn_RunTime_SanesLab_aversive(RUNTIME, AX) %RUNTIME = ep_TimerFcn_RunTime_SanesLab(RUNTIME, AX) % %Custom function for SanesLab epsych % %Controls the timer box figure during runtime.Currently supports aversive %and appetitive go-nogo GUIs (Aversive_detection_GUI.m and %Appetitive_detecti...
ad7e5a1a69060218eb37e894b1e728b25d537bf16b17ee514bee30a9af819778
MATLAB
5,303
158
function [varargout] = BernoulliNoJump(s, priorpA, method, MemParam, OutPut, prior_data) % Ideal Observer that estimates the probability (frequency) generating % the observed outcomes. % % Usage: % [MAP, ... % m_hat, ... % s_hat, ... % pmY, ... % ] = BernoulliNoJump(s, priorpA, method, MemParam, OutPut) % %...
7d1a54fa6c64f23288f2da4172997fbae025dcccd0dd16e0fd87b404f96091bb
MATLAB
5,304
111
%% GMLM.computeMAPevidenceOptimization % optimizes the log-evidence (plus log hyperprior) of the GMLM using quasi-newton optimization & Laplace approximation for the evidence % % inputs: % params_init (OPTIONAL) :a param struct of the initial value of the optimization. If not given or empty, a random initiali...
c0ea61f42efab6fed4bd267721f013f98eab4a4e375be6ac69e4b61d791b69f5
MATLAB
5,306
177
%%ERPbindata contains the values for each point and it should be is column %%vector. e.g., ERPbindata = [1 2 4 5 3 2 5 6 3 2 5 6 6 ....] %%Time indexes for each time point e.g., timesrange = %%[-199.21875,-195.3125,-191.40625,-187.5,-183.59375,-179.6875,-175.78125,-171.875,-167.96875,....] %%if sampling rate is 256 ...
d75d9d06abe4e793304ca9a5490b9ac40ccf014a35cfc6e77ba3f2cee031a462
MATLAB
5,309
178
% PURPOSE : form the time points based on the defined time range and xtick range; % % FORMAT : % % [xtick_time, bindata] = f_get_erp_xticklabel_time(ERP, timerange,xtickrange) % % % INPUTS : %ERP - ERP structures (ERPsets) %timerange - time range where we want to display the wave e.g., [-200 800]...
0242a630e92a5cc1d5108699f95d2b48f5e6ca5341dae24d55a58981b4bb98cc
MATLAB
5,317
191
%function FM_sweep_testing() % close all; % Define RCX file handles.RPfile = 'C:\gits\epsych\UserFiles\SanesLab\RPVdsCircuits\Sandbox\KP\AM_jitter.rcx'; %Load in speaker calibration file pn = 'C:\gits\epsych\UserFiles\SanesLab\SpeakerCalibrations\'; fn = 'rig1012-CeilingB_Noise_Mar072016.cal'; fidx=1; % [fn,pn,fid...
57fca51ce514b4179c354eedffe68879a62f2eb01f226b5dd10e954b41215f67
MATLAB
5,323
133
% ======================================================================== function [tsp,sps,Itot,Istm] = run_sim(glmprs,verbose) % [tsp,sps,Itot,Istm] = run_sim(glmprs,verbose) % % Compute ongoing activity (multi-cell) coupled-glm. % % Uses time rescaling to sample conditionally Poisson process % For speed, ma...
1eff02c187d2b8984f1acc3ba31f8ead34f54a77fc3ff355d83c4d7154f5dfa4
MATLAB
5,331
161
function oimg = readTIFstack(path) % Copyright (c) 2012, YoonOh Tak % All rights reserved. % Redistribution and use in source and binary forms, with or without % modification, are permitted provided that the following conditions are % met: % % * Redistributions of source code must retain the above cop...
a7364cdbbc74b4bddd55bbfe1f8e29571c113b280cc5744d89dc467b86acbfe9
MATLAB
5,339
114
function [ev_half,z,p] = plotPredSingleTrial(predDat,mainFigP) %% Plot single trials % Parameters -- should be inputs!! k2plt = 1; trials2plt(1,:) = [4 5 6]; % videos trials2plt(2,:) = [1 1 1]; % repeats % what stimuli idxstimsubset = []; for idx = 1:numel(mainFigP.stimsubset) ...
6d6a386a00d58722f337ee6378f96adda7a35e5893202856ca6ab23616da6e51
MATLAB
5,340
175
% Function for calculating spike-triggered average. Also generates the % plus/minus average % Arguments: % file_id: patient ID + recording number % llfp_type: whitened or unwhitened % seizure_onset, seizure_end: start and stop times of seizure within recording % clip_length: length of STA clip to be calculated in...
91ab3fb2f1148c3b1a1d1ea3800a315eb902953f31e34c03c55a50c81a429a55
MATLAB
5,352
210
function [M,xp,yp,A,B,Base] = Cart2Pixel(Q,A,B) % [M,xp,yp,A,B,Base] = Cart2Pixel(Q,A,B) % % Q.data should be in no_of_genes x no_of_samples format % % Q.Method % n=10; % x = randn(n,1); % y = randn(n,1); % Method = 1) kpca for kernel pca % or 2) tSNE for t-Distributed Stochastic Neighbor Embedding % or 3...
131ff0c73529de6fb805bb95ab09fc2a2b4e692acd9a6a9514fec8269b64e522
MATLAB
5,353
139
function segments = cross_section(V, F, z_cross, z_step, roundPrec, ... live_plot) % IMPORT_ENDO_GEOM Extract the list of non ordered segments obtained from % the crosection the geometry composed by F facets and V vertices. % % [segments] = cross_...
8c10a86a6a8cf70724dc79b773b006569fec9c4682fc6789c94757d73d3cee97
MATLAB
5,357
171
% PURPOSE : subroutine for pop_export2text % % FORMAT : % % serror = mvpc2text(ERP, filename, time, timeunit, transpose,DecodingUnit,precision) % % % INPUTS : % % MVPC - MVPCset (ERPLAB structure) % filename - filename of outputted file % time' - 1=include time values; 0=don't include tim...
76829037a1146fcbdf34b719483fa5bd87ff9e5762e3845c270e1c11b3fc88fb
MATLAB
5,359
103
%% GMLM.computeMAP % optimizes the log-posterior of the GMLM given fixed hyperparameters using quasi-newton optimization % % inputs: % params_init (REQUIRED) :a param struct of the initial value of the optimization. % % optional key/value pairs % % alternating_opt (true/false; default = false...
8a641a659a3a79ee07466f99d4d5befa98cab85f481f07d694ef65ffea07b48b
MATLAB
5,365
168
function TRIALS = TrialFcn_IncrReward_LOMBER(TRIALS) % TRIALS = TrialFcn_IncrReward_LOMBER(TRIALS) % % Custom trial selection function for increasing reward size for % consecutive hits on a 2AFC task. Misses reset the reward size to minimum % specified amount. % % Strategy: Count the number of recent hits and update ...
ec45bcbdb086ec23085dcb2f704756ab6a16e495247e12a616dc68a0f84ec88e
MATLAB
5,365
186
%function FM_sweep_testing() % close all; % Define RCX file handles.RPfile = 'C:\gits\epsych\UserFiles\SanesLab\RPVdsCircuits\Sandbox\KP\AM_jitter_Macro_DurTest.rcx'; %Load in speaker calibration file pn = 'C:\gits\epsych\UserFiles\SanesLab\SpeakerCalibrations\'; fn = 'rig1012-CeilingB_Noise_Mar072016.cal'; fidx=1...
5b781095809378a8fd4e3175aafe908de3ce82b6dda2a4d1cbdcf459a9ab76dd
MATLAB
5,371
171
% PURPOSE: updates ERPset menu % % Format % % updatemenuerp(ALLERP, overw) % % INPUT: % % ALLERP - structure containing multiple ERPsets % overw - overwrite erpset menu? 0=no; 1=yes; -1=delete % % % *** This function is part of ERPLAB Toolbox *** % Author: Javier Lopez-Calderon % Center for Mind and Brain % Un...
4f53c7391c44bb016a94414bfdf494dcea0bf2526d9a8bcd0bf701eb0c4c7c9f
MATLAB
5,377
179
%BLP_rev_Fig2_FreezingCalc %NG... clear all animalN = 1; %1-8, blpgfp 1,2,3 FC = 0; % 0:Retrieval; 1:FC; %Thres=6200000; Thres=1.8; %load Thres switch animalN case 1 %blpretroarch2 if FC == 1 cd('.\Data\blpgfp2\blpgfp2_s01_fc\video\') folderN='blpgfp2_s01_fc'; elseif FC == 0 cd('.\Data\blpgf...
543c4a227ece912a7dd2ba731d9dd332c9d6d82c3ec5bbdee6d9bbbab56af1af
MATLAB
5,390
190
function model = qtipm_data2fit_SDPdcmSL(model,signal,bten,varargin) % function qtipm_data2fit_SDPdcmSL() % % flag is for define output size: % flag = 1 -> m is [nvox*28,1] (default); % flag = 0 -> m is [28,nvox] nmeas = size(bten,1); % retrieve optio...
ebb0da74ee97c56f585bae0680bd97a3b48e15bc1f8ec58da81065156cc1ac57
MATLAB
5,390
148
function step3e_validation_pairwise_decoding1854(bids_dir, toolbox_dir, participant, blocknr, n_blocks) %% Function to run pairwise decoding analysis for the 1854 object classes % % @ Lina Teichmann, 2022 % % Usage: % step3d_validation_pairwise_decoding200(bids_dir,participant, ...) % % In...
6a5f37a304da676ce1ea475ebb4e2787f422052922b795c2786f9d39641e5f89
MATLAB
5,393
133
function [r, beta_map, predicted_labels, p] = svr_cross_predict (train_data, train_labels, test_data, test_labels, clipping) % predict the scores using linear support vector regression % INPUTS: % data (#observations x #features) -- data matrix (ROI or voxelwise) % labels -- scores to predict (i.e. values of depend...
8bd10aaf0af8f6d0c34834dff49c622dcfd129397efa4c04d29df22dd6723df6
MATLAB
5,394
166
function handles = updateFArate_SanesLab(handles,variables,FAind,NOGOind,f) %handles = updateFArate_SanesLab(handles,variables,FAind,NOGOind,f) % %Custom function for SanesLab epsych % %This function calculates and displays the FA rate. FA rate can be %calculated for individual NOGO trial types separately, or as an agg...
6dc726c63345c1983554ddaf024ea31ffa7714d1bf7c4589a839936153c7739a
MATLAB
5,402
195
function [w, infos] = cd_lasso_elasticnet(problem, options) % Coordinate descent algorithm for LASSO problem. % % Inputs: % problem function (cost/grad/hess) % options options % Output: % w solution of w % infos information % % This file is part of SparseGDLibrary. % % Cr...
835c443a483809cd4f1965843d82b6912f2d3462ce36f641fe29b3b8f603f426
MATLAB
5,421
145
function [M, L, Y, C] = lmnn(X, labels) %LMNN Learns a metric using large-margin nearest neighbor metric learning % % [M, L, Y, C] = lmnn(X, labels) % % The function uses large-margin nearest neighbor (LMNN) metric learning to % learn a metric on the data set specified by the NxD matrix X and the % corresponding Nx1 ...
85bb0143f4662d9ef6abcfbceb7cab62c76a958152f7e35b219a261ef9a7fc8f
MATLAB
5,425
172
function [schedule,fail] = ep_AddTrial(schedule,varargin) % [schedule,fail] = ep_AddTrial(schedule,varargin) % % INPUTS: schedule should be empty or the returned structure from a % previous call to this function. % varargin inputs can be specified as follows: % % Define stimuli to use in schedule...
cfbaa087e890c1b3dd177834bf55e6df3979e1fe64c4a7c771505b8cca710d48
MATLAB
5,429
195
function [w, infos] = shooting_grouplasso(problem, options) % Shooting algorithm for Group LASSO problem. % % Inputs: % problem function (cost/grad/hess) % options options % Output: % w solution of w % infos information % % This file is part of SparseGDLibrary. % % Refere...
3931076b7b510f7b9518e9d2aa16c9a6e323de68894ac6813d27f663335d63cb
MATLAB
5,431
160
function [sacc] = detectSaccEp(EYESeSc) %detectSacc Detects saccades based on velocity in epoched data % Detailed explanation goes here % EYESeSc: Offset corrected eye signal (x and y) in degress of visual angle pxPerDeg = 27.854; % pixels per degree of visual angle at the center Fs = 1000; % 1kHz sampling rat...
9fb046740833c8508a814daacaad9f39ccffe7b1720e22c1179cf8cbfa0d0db4
MATLAB
5,436
177
function RUNTIME = ep_TimerFcn_RunTime_SanesLab_v2(RUNTIME, AX) %RUNTIME = ep_TimerFcn_RunTime_SanesLab_v2(RUNTIME, AX) % %Custom function for SanesLab epsych % %Controls the timer box figure during runtime.Currently supports aversive %and appetitive go-nogo GUIs (Aversive_detection_GUI.m and %Appetitive_detection_...
0671202e4db1b31935692bdeb405d9c4eaf5b0fb3ac1f9a9c1112f4eb8c24e5d
MATLAB
5,438
84
% NEED TO CHECK IF CORRECT (MODIFIED IT FOR THIS TASK % % ASK ANNABELLE IF WAY WE HAVE THIS RANDOMIZATION ORGANIZED OK % % study_conditions = PSEUDORANDOMIZATION(conditions,repeat_limit,number_trials_per_condition) % % Randomizes trials in a way that does not repeat a trial of a given % condition quality (for ex. moda...
9ddd9437ad3ee1c054d61d814d26d965552821808ac29362ea46837cfa67b6c9
MATLAB
5,439
133
clear all close all target= 'Task'; if ispc home = 'C:\'; % [getenv('HOMEDRIVE') getenv('HOMEPATH')]; pat = [home 'Analysis\AssemblyAnalysis\Sleep']; elseif ismac path(path,'/Users/aleksanderdomanski/Documents/Bristol_work/assembly_analysis/MichalDataAna') home = getenv('HOME'); cd ([home '...
bf665daa693d1643b56c3ee92a418741d86b4cf25a195acf160b91df7479e0f0
MATLAB
5,445
287
% two variable examples %% RDN Pxxy = zeros(2,2,2); Pxxy(1,1,1) = 0.5; Pxxy(2,2,2) = 0.5; fprintf(1,'RDN\n') compare(lattice2d(),Pxxy); %% W&B FIGURE 4A Pxxy = zeros(2,2,3); Pxxy(1,1,1) = 1/3; Pxxy(1,2,2) = 1/3; Pxxy(2,1,3) = 1/3; fprintf(1,'Williams and Beer Fig 4A\n') compare(lattice2d(),Pxxy); %% W&B FIGURE 4B ...
822070addcb237b98e5786721ead355638cdf996458879471bf17a4536def3c4
MATLAB
5,448
165
function [reg_corner,rho_c,eta_c,reg_param] = l_curve_modified(U,sm,b,method,plotCorner,L,V) %L_CURVE Plot the L-curve and find its "corner". % % [reg_corner,rho,eta,reg_param] = % l_curve(U,s,b,method) % l_curve(U,sm,b,method) , sm = [sigma,mu] % l_curve(U,s,b,metho...
7c26102f77a80aedd37bd405256396583e8c3ea0dffd7cda75b0320aced9ece1
MATLAB
5,450
163
% Quality control Q6 % Plot time series from fMRI images and head motion % Show their correlations before and after preprocessing % Xin Di, July 13, 2022 clear subjfolder = dir('F:\fMRI_QC\fmri-open-qc-rest_bias_corrected\sub*'); subjfolder = subjfolder([1:89 91:end]); % subji 90 CSF mask empty figure('position',[10...
a5711f48e24abbf4968628f20b0153e898e99b79f582d5232b34f4329e6bd424
MATLAB
5,481
193
function [realpos realneg]=get_cluster_permutation(data,montecarloalpha,clusteralpha,npermutation,sTime,averageelecFlag,dataPerm) % Input % - data: cell array (1 cell per condition: channels * times * subjects % - montecarloalpha % - clusteralpha % - npermutation % - sTime % - averageelecFlag Ncond=size(data,2);...
9066d9a319a9ca2a09ba826dd853c7254c6426fedfbf79c20d17bd5abc109d2a
MATLAB
5,499
166
function EEG = ve_update(EEG) udf=get(gcbf,'userdata'); if isfield(udf,'urdata'); EEG.data=get(findobj('tag','eegaxis','parent',gcbf), 'userdata'); end if isfield(udf, 'eventupdate'); for i=1:length(udf.eventupdate); if strcmp(udf.eventupdate(i).proc, 'new'); eventindex=length(EEG.event)+...
f5812c31d9808a76422dc1e9b3de77a8b6cf9982906ff728e44e2b5cf6001aaa
MATLAB
5,512
208
function [w, infos] = admm_trace_norm(problem, options) % The alternating direction method of multipliers (ADMM) algorithm for % minimization problem with trace norm. % % Inputs: % problem function (cost/grad/hess) % options options % Output: % w solution of w % infos inf...
2e1c0e1555b2f98b6497ff9271b79074ca70a04148342068b19ba2cabf25d73d
MATLAB
5,515
238
function varargout = Joystick2AFC_TRAINING(varargin) % Joystick2AFC_TRAINING % % Simple GUI for training Left/Right movements on a Joystick % % Daniel.Stolzberg@gmail.com 2016 % Last Modified by GUIDE v2.5 31-Jan-2016 22:30:20 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name'...
408e654f12f8aa1d32fcf3f4835718c3f017404f7632076608d9ce74600666ca
MATLAB
5,522
157
% red: 165, 33, 32 clear mainDir = fullfile('/Users/karimia/code/mvgc_grangercausality/Data/RectalDistension', 'Means'); animalDirStruct = dir(mainDir); % remove '.' and '..' dirs animalNames= {animalDirStruct(3:end).name}'; assert(~any(contains(animalNames,'.'))); numAnimals = length(animalNames); % Generate voiNames...
d1f238bb5bad68dbff83540697b6455b90123112b950c162e8c758aa8560eb32
MATLAB
5,525
164
function [hubs,hubfrag,hubprob,hubdista,susceptind] = ... hub_fragility_volatility(mat,distmat,hubmethod,Nreps,proprand,altdist) % from Gollo2018, get measures of hub fagility and measure the volatility % of the hub distance embedding % % INPUTS: % mat: connectivity data % distmat: dis...
f0d926c9f60b943e56156907309944eaf4e320e76652126176d9e47f4a84e4be
MATLAB
5,542
184
function [u, v, convergenceLoop] = opticalFlowStep(im1, im2, ... nanIndices, surroundLocs, alpha, beta,... showFlag, u0, v0, im0, im3, angleFlag) % Find the optical flow U, V between two images IM1 and IM2 from a video % sequence. % % Rory Townsend, Aug 2017 % rory.townsend@sydney.edu.au %% Fixed point iterati...
e00e5b85c5aac2df88937c86f25b803035ffa12bdb26b93a44b2ede4b476e33e
MATLAB
5,545
207
function Investigating_model_simulation_waveforms % Script recreates Figure 3 from the manuscript. This compares the wHVG from a % segment of model time series obtained using each optimisation method. We note, pseduo data is % applied for this script, and hence small devations from the data % in the paper will be...
e596a7e315098a4cf0064b99b1bb51e8dc2d644033f432ddd4e12d1c845eb3f3
MATLAB
5,545
99
function spikes = ss_default_params(Fs, varargin ) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % ss_default_params - initializes a spikes object with the default % parameters % % Usage: % spikes = ss_default_params(Fs, varargin ) % % Description: %...
ca2b575aa589a42506c46c87ffcecf4497b5e2f3a79d38301c83faa2f415eb88
MATLAB
5,549
207
% PURPOSE : Clears MVPCset(s) from MVPC menu % % FORMAT : % % >> ALLMVPC = pop_deletemvpc( ALLMVPC, index); % % EXAMPLE : % % >> ALLMVPC = pop_deletbestset( ALLMVPC, [3 5]); % % INPUTS : % % ALLERP - Includes all MVPCsets in workspace % Index - MVPCset(s) that you want to clear from the workspace % % OUTP...
303dd46b38fef66b95726de6b3360dd42e873751a305cb453ba503ec20a4b17e
MATLAB
5,559
117
function FEM = mesh_FEM(model) log = model.getLogger('mesh'); meshedPathLegacy = [get_conf().solutionsDir model.baseName '_mesh.mph']; if isfile(meshedPathLegacy) assert(~isfile(model.paths.mesh)); log.info('%s moved to %s...', meshedPathLegacy, model.paths.mesh); movefile(meshedPathLegacy, model.pa...
f0cf8e461c808044629bb7494046de506c8fc3cd714ad27383f6f8e96c4c7814
MATLAB
5,562
195
%quick and dirty tool for plotting out HMC sample progress % I didn't document this well, but it's not super imporant % This prints out stuff I want for the DMC task GMLM, but not every GMLM function [] = plotSamples(obj, samples, metrics, paramStruct, sample) clf; TotalSamples = size(samples.W, 2); if(nargin < 4 || i...
04fa30774a38c0182fb5f62ef5c21948cb9bee600e9bb63f02f8e096c1331bbf
MATLAB
5,566
223
function analyzetpstack_newautofilledstack(ds) % ANALYZETPSTACK_NEWAUTOFILLEDSTACK - Create an autofilled analyzetpstack record % % ANALYZETPSTACK_NEWAUTOFILLEDSTACK(DS) % % This function takes as input a DIRSTRUCT object for the directory of interest, % and prompts the user to help 'auto-fill' the stack. % % The u...
0cd8a6c2b77d01340f905ac0bc2d14d4c6f309f5f474e53695a614f1e8dca3ea
MATLAB
5,572
183
function handles = updateTrialHistory_SanesLab(handles,variables,reminders,HITind,FAind,GOind) %handles = updateTrialHistory_SanesLab(handles,variables,reminders,HITind,FAind,GOind) % %Custom function for SanesLab epsych % %This function updates the GUI Trial History Table. For each GO trial type, %d' values are calcul...
3eaa15beba44dd0b05d03dae8b0d7c29e5cd9f6b44166e676473a9af31e719d1
MATLAB
5,590
157
clc; clear all; close all subjects = [3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33]; %subjects = [3 4 5 6 7 8 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 27 28 29 30 31 32 33]; %subjects = [3 8 11 12 13 17 19 20 22 23 24 27 30 32 33]; %subjects = [4 5 6 7 9 14 15 16 18 21 25 26 2...
1a3b52e26e3731cbda49fd95ae2ae6943c969e000d1436ed51cfe9234a611349
MATLAB
5,591
160
clear all; close all; %Prepare_Data with DeepInsight % %Description of Datasets % 1. dataset1.mat is RNA-seq (1.5GB) % 2. dataset2.mat is ringnorm-DELVE (560KB) % 3. dataset3.mat is vowels (3.6MB) % 4. dataset4.mat is Madelon (2.1MB) % 5. dataset5.mat is Relathe (696KB) %Parm.fid=fopen('Results.txt','a+'); Parm.Metho...
86964ec302347c15482a131d9885f84aeaa4af22c6ff89f5aed11cebabb54b08
MATLAB
5,600
160
%% clear all close all run(['..' filesep 'def_local']) addpath(path_figs) timeCol=17; %% Loop on subjects subj_name=405:425; ns=0; for nS=1:length(subj_name) %%% load data behav_name=dir([behav_path filesep 'SWS_NVS_results_S' num2str(subj_name(nS)) '*.mat']); if isempty(behav_name) fprintf('.....
e73281e9faae82ef9fa5e764ae3d80f17dfadaefc118cf69187e897d224eaae7
MATLAB
5,601
163
function varargout = testFigure(varargin) % TESTFIGURE MATLAB code for testFigure.fig % TESTFIGURE, by itself, creates a new TESTFIGURE or raises the existing % singleton*. % % H = TESTFIGURE returns the handle to a new TESTFIGURE or the handle to % the existing singleton*. % % TESTFIGURE('CALL...
96dd25b6b623cc7274eb47f693334ef48377903225ef6a8691795104702730a0
MATLAB
5,602
126
function [quant,p,quant_sing] = plotPredResults(pred,sideTransec) if ~exist('sideTransec','var') sideTransec = -ones(1,numel(pred.ypred_test)); end ypred_test = pred.ypred_test; predP = pred.predP; getQuant = predP.getQuant; %% fnames = fieldnames(ypred_test); for...
18c51f89095658458a42514310c97b4aeffc021ac75eac6946d5d0d277977fdd
MATLAB
5,607
207
% PURPOSE : Clears BESTset(s) for BESTset menu % % FORMAT : % % >> ALLBEST = pop_deletebestset( ALLBEST, index); % % EXAMPLE : % % >> ALLBEST = pop_deletbestset( ALLBEST, [3 5]); % % INPUTS : % % ALLERP - Includes all BESTsets in workspace % Index - BESTset(s) that you want to clear from the workspace % %...
1d28d28914f92251ae7b166fa7f72d578d1d501e21e726c832ec719eed58d216
MATLAB
5,616
174
%% %%%%%% PREAMBLE %%%%%% clear TaskOnly = true; Epochs = {'PreSleep','Task','PostSleep'}; Epoch_ = 'PreSleep'; Target = 'LONG'; warning ('off') if ispc pat = 'C:\Analysis\AssemblyAnalysis\raw\'; addpath(genpath('C:\Users\ad15419\Dropbox\MATLAB\PC MATLAB Path\AssemblyCode\Eleonora\Mic\programs')...
3077e071d876ae67f333fd56ed4fae4b6c5df624b1c174a447641a7c665085a4
MATLAB
5,618
196
function [ outStruct ] = SpherePatch( numPts, radius, varargin) %UNTITLED Summary of this function goes here % Detailed explanation goes here FlipZ = false; optargin = size(varargin,2); if(optargin == 0) axis = [0 0 1]; hemisphere = False; elseif(optargin == 1) axis = varar...
176eb632c25f07d1de624b30a61ebbda9d7b269eef361e4c5fdf3324b5a51d0d
MATLAB
5,634
142
% Prototype function for calculating smoothed estimates of firing rate by % optimised kernel density smoothing. Also contains a bloc of code to calculate FR for error trials. % % (c) 2014 Daniel Durstewitz, Bernstein Center for Computational Neuroscience, CIMH/ Heidelberg University % Edited by Aleksander PF Domanski P...
02eb3de28c81d08370bf7833e3eb4c74d5c9b9036fa141b528137b198d65b37b
MATLAB
5,643
138
function [sigTissue,sigCSF,Dtissue] = estSigFracLowb(sigVals,bVals,D_CSF,opt) % % Estimate signal fractions of CSF and tissue assuming DTI model with 2 compartments. % i.e., free water elimination % % sigVals: [N_bval * Nx * Ny * Nz] matrix % bVals: [N_bval * 1] vector. [s/mm^2] % D_CSF: pre...
ee6e759ee700d78adbf57af465d1c09713c798a3bcd9b553fe9c69b447ac1295
MATLAB
5,658
119
%% GMLM.computeMLE_crossValidated % Fits the MLE using cross validation. Cross-validation is done over trials, not individual bins. % % inputs: % foldIDs (cvparition or array of length obj.dim_M) : the folds for cross validation (K folds) % if foldIDs is a vector, specifies the test set for ...
b73a76568bc54c59a3fdaf61913d1b48b560f20cfa787df77bbe2086a8930dde
MATLAB
5,667
115
%% GMLM.computeMAP_crossValidated % Fits the MAP using cross validation. Cross-validation is done over trials, not individual bins. % % inputs: % foldIDs (cvparition or array of length obj.dim_M) : the folds for cross validation (K folds) % if foldIDs is a vector, specifies the test set for ...
188d93e80bbf58ca726274678a4ad44e7e03c54e22157c98500a644f432c14c4
MATLAB
5,689
225
% PURPOSE: pop_duplicaterp.m % duplicate ERPset % % FORMAT: % [ERP, erpcom] = pop_duplicaterp( ERP, 'ChanArray',ChanArray, 'BinArray',BinArray,... % 'Saveas', 'off', 'History', 'gui'); % Inputs: % %ERP -ERP structure %ChanArray -index(es) of channels %BinArray -index(es) of bins ...
6c921fda9f728064dac10a0d20d6f3abd02d2d540690a8df02bc7cec8eea3dd0
MATLAB
5,689
213
%% DB2STA WAV pvar = 'BuID'; subselection = [1:12]; tadjustments = []; fullwin = [0 0.6]; clear opts opts.clustering_exponent = -2; opts.unoccupied_bins_strategy = -1; opts.metric_family = 0; % 0: Dspike; 1: Dinterval opts.parallel = 1; opts.possible_words = 'unique'; opts.start_time = 0; opts.end_time = 0.6; opts....
704580c4fb2504c161c0239b2ad93d3d99da2e75e58a3ec96c637f9ba243a44b
MATLAB
5,690
217
%% % clearvars setUpPaths for len=1:23 processData %% does the modelling n_Channels_Form=6; %number of channels in the form bank (range of pi radians) - must divide 180 Sigma_Form=30; %width of the channel (standard deviation of the Gaussian function) recoveryRatio=1.2;%1.2; ...
d1c17554c6ea4697133de032312996d14d990ddcd1d5416959342437e3f7be08
MATLAB
5,697
231
function step2_crossref_temp_and_behavior(rootDir) % Add temperature to each trial % Add label (bilateral, right, left) % Define paths if nargin == 0 % rootDir = Cloudstation('Vowels\Noise\Cooling\Data'); rootDir = Cloudstation('Vowels\Spatial_Unmasking\Cooling\Data'); end behavDir = fullfile(rootDir,'GoFer...
6c6957111d3f5e6928002f5b182697ba6f8cdcbf2d5f1742b4141e3d5ee872ef
MATLAB
5,698
111
%% GMLM.computeMLE % optimizes the log-likelihood of the GMLM using quasi-newton optimization % % inputs: % params_init (OPTIONAL) :a param struct of the initial value of the optimization. If not given or empty, a random initialization point will be generated by GMLM.getRandomParamStruct % % optional ke...
2140c39da7b567000f00f19dae1e6d20652dd0d19fc9589fbf82fe78e86ec123
MATLAB
5,699
139
function P1vsP2 = compareAssemPatterns(P1,P2,plotYN,PermittedTransitions,RankOrder) plotVerbose = false; if nargin <3 || isempty(plotYN); plotYN = true; end if nargin < 4 || isempty(PermittedTransitions) PermittedTransitions = 3; end if nargin <5 || isempty(RankOrder); RankOrder = true; end %% ...
99a079cae83495925b72df7c4cca11876271ab7204e9c862f23ec3c8ffd393ee
MATLAB
5,707
195
% Function to calculate STA using only a subset of randomly selected % channels. % Arguments % tb: table that contains all the metadata on recording files % index: row of table to run % llfp_type: whitened or unwhitened % n_channels_subset: n channels to randomly select to include in STA % clip_length: length of ST...
70e2393344ef0e496259ce6ff0a3ce670ae12fc51393ff056346f85140fdb2d2
MATLAB
5,713
167
function EEG=marks_epochs2continuous(EEG) evtcount=0; if ~isempty(EEG.event); % in case there are no events tmp.event=EEG.event; EEG.event=tmp.event(1); %rejints=[]; end sampdur=(1000/EEG.srate);%duration of each sample... relstrtt=EEG.xmin*1000;%relative (to lock event) start time of current window... %size(EEG.dat...
f2cdc1da8a8db4e94cdfa77160b73166a18d9613cbfe1b54315f986d389b4ad6
MATLAB
5,719
172
function varargout = vhdr2mat(vhdrfile, vhdrpath, srange, chans, plotOK, saveOK) % VHDR2MAT Convert BrainAmp Vis. Rec. (.vhdr) to Matlab (.mat) file format. % VHDR2MAT(vhdrfile, vhdrpath) % % Optional inputs: % vhdrfile - VHDR file name % vhdrpath - VHDR path name % srange - scalar first sample to re...
128f7b2377b5966a34cceeb40ce11440389cbe2c7f800f5c2ab80107b8878afd
MATLAB
5,740
116
% icadefs() - function to read in a set of EEGLAB system-wide (i.e. lab-wide) % or working directory-wide constants and preferences. Change the % way these are defined in the master icadefs.m file (usually % in dir eeglab/functions/sigprocfunc) or make a custom copy of % ...
692e69b0c624f13ad977bd32899afcaf895882eff176dd81a3e246f885a83b6b
MATLAB
5,742
101
function spikes = ss_default_params(Fs, varargin ) % UltraMegaSort2000 by Hill DN, Mehta SB, & Kleinfeld D - 07/12/2010 % % ss_default_params - initializes a spikes object with the default % parameters % % Usage: % spikes = ss_default_params(Fs, varargin ) % % Description: %...
3e38f65e2a57c2192852dcfd8c7ffc6c17dfb5400c75f8b86431b37522ef3a8d
MATLAB
5,744
213
function [w, infos] = admm_lasso(problem, options) % The alternating direction method of multipliers (ADMM) algorithm for LASSO problem. % % Inputs: % problem function (cost/grad/hess) % options options % Output: % w solution of w % infos information % % This file is part...
5a03cf737c49e3cc80d10ac67391493efbf30d8574a75d809644f07b3911d2d5
MATLAB
5,756
161
%% %%%%%% PREAMBLE %%%%%% clear Delays_ = {'Short','Medium','Long'}; Delays__ = {'4s','8s','16s'}; DelayTimes = [4,8,16]; Target = 'LONG'; AssemblyChoice = 2; % 1 - lever press cutouts % 2 - trial cutouts (cue to reward inclusive) % 3 - continuous time tlimsAll = [-5 5]; tlimsShort=[-4 10]; tlimsMedium=...
df1b83d0f29aae94cba7e0b4dadee40522dcfe9b42b970440767fcbaa845f1bd
MATLAB
5,771
247
% PURPOSE: centralize ERPLAB working-memory storage and migration % % FORMAT: % % value = erplab_memory_store(kind, action, varargin) function output = erplab_memory_store(kind, action, varargin) output = []; if nargin < 2 help erplab_memory_store return end kind = lower(kind); action = lower(action); paths...
a0a2e44f2c9cc8c7719b109479b4155d5f756ecf1f3b2835d2da257cb2955be9
MATLAB
5,772
143
% Group analysis for single unit / assembly decoding capability, activation % patterns for assemblies % % Aleksander PF Domanski PhD UoB 2016 % aleks.domanski@bristol.ac.uk %% Preamble, get file list clear all; close all set(0,'DefaultFigureWindowStyle','docked') flags.plotIndividualChanges = false; if ispc %...
7d3a27d3196728917cf3d342a4a9f124c414ea3bec2d7af0a1fb110d3fff7f7b
MATLAB
5,777
145
function encodedDIOdata = BitsPlusDIO2Matrix(mask, data, command, goggle, DAC) % encodedDIOdata = BitsPlusDIO2Matrix(mask, data, command [,goggle ,DAC]); % % Generates a Matlab matrix containing the magic code and data % required to set the DIO port of CRS Bits++ box in Bits++ mode. % % 'mask', 'data', and 'command' ha...
3539d90221897c786eb01b4b7c5c1242808403d610767805a576bcf6b314835d
MATLAB
5,799
202
function [stats,st] = SStat_CoxExt(sID_ext,X_ext,d_ext,t_ext,e) % [stats,st] = SStat_CoxExt(sID_ext,X_ext,d_ext,t_ext,e) % % Parameter estimation for the extended Cox model. This function uses as % input the output of SStat_X_ext but with X_ext having new time-dependent % columns added by the user (eg. the product of ...
b59b60cdcf6529d219419ed56e971970e3224c85f467166c1f798d3598d6f314
MATLAB
5,799
195
function varargout = f_EEG_suffix_gui(varargin) % F_EEG_SUFFIX_GUI MATLAB code for f_EEG_suffix_gui.fig % F_EEG_SUFFIX_GUI, by itself, creates a new F_EEG_SUFFIX_GUI or raises the existing % singleton*. % % H = F_EEG_SUFFIX_GUI returns the handle to a new F_EEG_SUFFIX_GUI or the handle to % the exis...
4dd31cbce8f3bcf1922da21775911e32d2fef73e36edefc932a4e64ef37d22f4
MATLAB
5,802
127
function FIGURE_FibrePerformance % This function plots the figure showing the performance of homogenisation % for the different extents of homogenisation and different densities of % fibrosis. % Velocity measuring information Lx = 5; % Length of fibres (cm) start_point = 0.3; % Pro...
4f75eeee817622e7302d1bb68bf9134b60833c2847ca088def68f70e2a5c81cf
MATLAB
5,803
115
function trial_label = AssignTrialLabel(trials,flag) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This function identifies the stimulus label % (target/distractor/target-distractor location/euclidean distance between % target and distractor location in trials) for the trials under trials. % An...
75fcdbb049c116302d13b9c536d1a3bbed9e2b0a66c407f443b9d7cd89844811
MATLAB
5,810
170
% Written by Sham Tlili and edited by Timothy Saunders % Code for performing optic flow analysis addpath('./useful_functions/') % Defining outputs screen_dpi = get(0, 'ScreenPixelsPerInch'); screen_display_factor = 100; % Input and output folders and files folder_image = './images/'; fol...
14d7299c3c562377bcd7b79101ad756af03a0fa4eb2be1d91150e0c17f79ec48
MATLAB
5,820
168
% PURPOSE: reads an EVENTLIST from a .xls file % % FORMAT: % % [EEG EVENTLIST] = f_readeventlist_excel(EEG, elfilename ); % % % *** This function is part of ERPLAB Toolbox *** % Author: Guanghui Zhang & Steven Luck % Center for Mind and Brain % University of California, Davis, % Davis, CA % 2024 %b8d3721ed219e65100184...