sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
462adb3958c9658008cced7d74d84040cd7b3597325a4b0d42bffecfbe8f158f
MATLAB
2,398
85
clear [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); req_params.grade = 7; req_params.cell_type = {'PC ss', 'PC cs', 'CRB','SNR','BG msn'}; req_params.task = 'choice'; req_params.remove_question_marks = 1; req_params.remove_repeats = false; req_params.num_trials = 120; epoch = 'cue'; lines = findLinesI...
54415e21db745244f8b150374b8575a9531563d3fd026a92a62e5826a4b41cec
MATLAB
2,401
69
function [X_RS,zX_RS,Vlow,Vhigh]= find_filter_cut_off(mypath,U) % % ========================================================================= % % (1) In main text: The cut-off of CC eigenmodes using the graph spectrum dichotomy approach % % =======================================================================...
16bf26ecb00d8f1a59417927d612331383961cd5cd1111f6c0dbaeede33f8759
MATLAB
2,402
82
function labels = load_labels(sub_id, p, sorting, includenans) % labels = load_labels(sub_id, p, sorting, includenans) % % Load labels for reconstruction. % % Input: % - i_sub: ID of the current subject. % - p: Structure with analysis parameters. % - sorting: Wheteher labels should be sorted. Set to 'sorted' if ...
ea0090da0a12d187b8e12bf7e56d5014184c527ccd6e6568cec621203aa340fc
MATLAB
2,402
78
clear all close all format compact clc % script to calculate distances have been measured for all included scans (UsedSets) % gt_dataPath = '/disk1/dan/datasets/mvs-data/SampleSet/MVS_Data' gt_dataPath = '/mnt/raid/scanpb/datasets/SampleSet/MVS_Data' % gt_dataPath = '/Users/randing/work/data_demo' [dataPath,resultsPa...
69c666fddcab6c65981725a4f4f108f037fbe644fe94638100796a4f044633f8
MATLAB
2,403
72
function g = rbfbkp(net, x, z, n2, deltas) %RBFBKP Backpropagate gradient of error function for RBF network. % % Description % G = RBFBKP(NET, X, Z, N2, DELTAS) takes a network data structure NET % together with a matrix X of input vectors, a matrix Z of hidden unit % activations, a matrix N2 of the squared distances ...
f83994dc64781fcb32597d24c6ae616b066b5afcf9d553f37f5ff64de1101ec3
MATLAB
2,403
75
function bullseyeChild = createBullseye(data) % CREATEBULLSEYE creates a bullseye, with the main function of creating % an AHA 17 segment bullseye. Each row in "data" should have the % following structure: % % [rho1, rho2, nSegs, thetaStart] % % where % -rho1 is the...
0a2c7cb1c3cf55308bccfd0fc5b48275a3405dd39188040ae02ea058486d76c9
MATLAB
2,404
102
function [tout,rout] = rose(varargin) %ROSE Angle histogram plot. % ROSE(THETA) plots the angle histogram for the angles in THETA. % The angles in the vector THETA must be specified in radians. % % ROSE(THETA,N) where N is a scalar, uses N equally spaced bins % from 0 to 2*PI. The default value for N is 2...
8371f5abc080c7277f4873ee73f85a08a2bb2e4f92917ac851a1b8798a76d20a
MATLAB
2,413
65
function directional_pie_chart_210413(areas) % Make sure input is a cell array where cells contain a singular table with % fields: Subregion, Electrode Pairs, Spike Area, Conduction Time, Unit % Pairs, Direction, Recording Name, and fid. This function from that % creates pie charts of the direction of each channel. sub...
c802fa1f2aecab6170a3e5f11cd276febe0e6b28f265fd74508d4e4e2ea5a249
MATLAB
2,413
51
function [vectorField] = lie_bracket(vectorField,updateVectorField) % LIE_BRACKET Computes the Lie bracket of vector fields % % [vectorField] = lie_bracket(vectorField,updateVectorField) % % INPUT ARGUMENTS % vectorField - First vector field % updateVectorField - Second vector field, assumed to be small %...
ef744b367346310b60ab87cb71bba286df4132cebf88e8acd36bb3d91ec4da82
MATLAB
2,417
55
%% %% Script to load trajectory of animal movement %% c_ts: firing times, root.cel_x{1,1}: spike x coordinates, %% root.cel_y{1,1}: spike y coordinates %% references: https://github.com/hasselmonians/CMBHOME/wiki/Tutorial-2:-Apply-an-epoch-and-get-theta-signal %% https://www.mathworks.com/matlabcentral/answers/432322-r...
652eabff570b3d9dc8dbae3e4aa5a867b79e336ec3a61a614c1bd9a16c35257d
MATLAB
2,419
58
function links=gap_closer(A_time,segmentlists_time,segmentlists,max_interframe_distance,max_gap_closing_distance,xy_pixel_size,z_pixel_size) xy_ratio=xy_pixel_size; z_ratio=z_pixel_size; % time matrix segment_start_times=cellfun(@(cell_variable) cell_variable(1), segmentlists_time); segment_end_times=cellfun(@(c...
e01a1a066195f943f3eb1c2126140e54c568f8443239ab09855fbc6cc5f6fa80
MATLAB
2,422
84
function lambda = LedoitWolfEstimate(X, form) % Calculates the Ledoit-Wolf estimate for the shrinkage parameter used in % the estimation of covariance matrices. % % Usage: lambda = LedoitWolfEstimate(X) % % X - [samples x features] matrix of training samples % form - 'primal' uses the standard formul...
9f73fc6a55116c99a9e85299fcc01015a77267a0173f67a39e059e1e544cf5e7
MATLAB
2,424
67
function [null_W_energy, null_W_FC_r]= CC_rewired_digraphs(W,zX_RS,null_graph) % ========================================================================= % Generate 1000 random digraphs (degree-preserving surrogate connectoms) further calculate reconstruction accuracy % ==========================================...
b9637c4069b06f48ab64ebd7159485e5db771b30040cdeb460d13c25e9482e05
MATLAB
2,426
59
function display_results_registration3d(moving,fixed,... displacementField,originalSize,gamma) % DISPLAY_RESULTS_REGISTRATION3D Displays registration results for 3D % % display_results_registration3d(moving,fixed,displacementField,originalSize,gamma) % % INPUT ARGUMENTS % moving - Moving image % fixe...
4e42341d34efed93bcae57ad02b5904d5c0fdea3c9012acc6847a081823f04f1
MATLAB
2,427
110
function Y = SIMLR_embedding_tsne(P, do_init,DD, Y0) %%%compute 2-D coordinates by approximae t-SNE % % Y = SIMLR_embedding_tsne(P, do_init) % % Input: % P: N x N, pairwise (sparse) similarities or network (weighted) adjacency matrix % do_init: boolean, do over-attraction initialization or not, default=false ...
5cc828687fc49d86b4aed2d80dd299a92d24c6eaa043158542b723f3715d27b2
MATLAB
2,427
80
function [transformationMatrix] = ... compute_transformation_matrix_from_coordinates(newCoord,oldCoord,varargin) % COMPUTE_TRANSFORMATION_MATRIX_FROM_COORDINATES % % Computes a transformation matrix that that transforms old coordinates to new % coordinates % % [transformationMatrix] = ... % compute_transformati...
9a2b0e33cffb088d7669ee0b61cdab6cb6064413dce3edbcf54d9a0c33f72865
MATLAB
2,428
77
function Experiment = set_up_timing(Experiment) % Set Up Timing % Input: Struct 'Experiment' with fields 'Display' % Output: Struct 'Experiment' with field 'Timing' % 'Timing' contains fields: 'waitSecs' - number of seconds to wait % after certain operations 'frameFeq' - screen refresh frequency % 'imageSe...
ec0cb521ef41843e119bd3eea5882105cb0612fc6c423c2c1d4cc53b6cef95ab
MATLAB
2,430
74
function neurons_bv=create_neurons_bv(coords_t,reconstructed_links) new_tracks{1}=[]; if ~isempty(reconstructed_links) new_tracks{numel(reconstructed_links)}=[]; for i=1:numel(reconstructed_links) new_tracks{i}.coords=[]; for j=1:numel(reconstructed_links{i}) segment=squeeze(c...
82b05ad4d6d43bf5048d8dc09b3d9f77dc8f8a1eadcb636870e584cd4fb5a83f
MATLAB
2,432
70
function [recon_energy, recon_FC_r]= SC_rewired_undigraphs(W,zX_RS,n_null); % ========================================================================= % Generate 1000 random undigraphs£º[W0, R] = null_model_und_sign(W) % further calculate reconstruction accuracy % ==============================================...
e6245b23b3a28873af4a7a21a881b22c6d3cf035cee9df8561ca21d095a37458
MATLAB
2,432
128
function O = dictArray(varargin) % O = dictArray(inp) constructor for the dictArray class, inspired to % Python dict class. % % Input could either be another dictArray object (copy constructor) or a % cell array like the following % { { Key1, Value1}, % { Key2, Value2}, % Key3, % ... % { KeyN, ValueN} } % ...
b97ec2bf8f3e9d2b175cfa765e0507e0dac9d8544895201426b3b4ea79c9250d
MATLAB
2,436
75
%function [y, ARmodel] = WhitenSignal(x, window,CommonAR,ARmodel, ARorder) % whitens the signal % if window specified will recompute the model in each window of that size % (window is in samples,e,g, 300sec*1250 samples % if CommonAR is set to 1, then will use model from first channel for all % if ARmodel is specified...
3055b3ba5db6c018d2bcb50255f1754f286f3160866fb9e88ac2f87d9d151d9d
MATLAB
2,440
102
% Probability Tuning curves clear; clc; close all [task_info, supPath ,~,task_DB_path] = loadDBAndSpecifyDataPaths('Vermis'); req_params.grade = 7; req_params.cell_type = 'PC cs'; req_params.task = 'saccade_8_dir_75and25'; req_params.num_trials = 100; req_params.remove_question_marks = 1; req_params.ID = 4000:6000; ...
b488bfe60343f468dce9c4cfaa62a4a513de0a1debd4ccb0d5b545738732cc3d
MATLAB
2,440
59
function [I_cr] = TrackWorms() prompts = {'Min Size','Max Size','Background Probability','Min Run Length','Motion Threshold'}; prompts = inputdlg(prompts); MinSize = str2double(prompts{1}); MaxSize = str2double(prompts{2}); bkgProb = str2double(prompts{3}); MinRun = str2double(prompts{4}); MotionThresh = str2double(pro...
30804c520d5b541b739be797c4c9b480371ec0328a340094b578dca4b7ec337f
MATLAB
2,443
71
% load path file % nex_idx = 8; % mat_idx = 7; t1_idx = 2; t2_idx = 4; t3_idx = 5; t4_idx = 6; % summary_co = []; summary_ex = []; toplot_co = []; toplot_ex = []; for fn = 1:size(fn_idx1,1) %load load(fn_idx1{fn,mat_idx}); dff = 25/size(recordingFile.eeg,1); idx_theta = round([6 10]/...
5c0580b43ac3c27c9d042675ee1832594fa7cbf9f0b57f0f2755ef7679061172
MATLAB
2,443
70
function [acts,scratch] = test_gnb(testpats,testtargs, scratch) % Use a Gaussian Naive Bayes classifier to predict regressors. % % [ACTS, SCRATCHPAD] = TEST_GNB(TESTPATS, TESTTARGS, SCRATCH) % % See TRAIN_GNB for more info. % License: %===================================================================== % % This is...
be851cb271ed317bae5338fc43b22a11d8234f7621e60e19ab4c54d6dcc86f9f
MATLAB
2,443
59
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This script is meant to be used as part of a wrokflow aimed to calculate yap overal expression and YAP % nuc/cytoplasm ratio in fixed cells seeded on PAA gels. % It is the first one to use in order to seg...
c784f922253884b5e54d0bdbceff69760c2db621fd7f40fbce16306c181026b3
MATLAB
2,447
94
%% Add path addpath(genpath('../Ionnic Channel'),genpath('../Tools'), genpath('../Synapses'), genpath('../Datas')); %% Import data from neuron (FS) dt = 0.01; Vmem = -90:dt:60; l_V = length(Vmem); %% Matrix Initialization rinf = zeros(1, l_V); taur = zero...
d33fd8852c07bd6c0a30f58d54d1b9024cc854cc7eef1193c106679ee6645639
MATLAB
2,447
94
%% Add path addpath(genpath('../../Ionnic Channel'),genpath('../../Tools'), genpath('../../Synapses'), genpath('../../Datas')); %% Import data from neuron (FS) dt = 0.01; Vmem = -50:dt:50; l_V = length(Vmem); %% Matrix Initialization qinf = zeros(1, l_V); tauq ...
1d8299787f52199fb0f9c9187299606e9486000e4854656529cfec4399a3c205
MATLAB
2,448
61
%initialize matlab close all clearvars clc % Determine where your m-file's folder is. folder = fileparts(which(mfilename)); % Add that folder plus all subfolders to the path. addpath(genpath(folder)); %user input selpath = uigetdir('Select MINFLUX directory'); if isequal(selpath,0) disp('User se...
3269df392720fbb514ef29458cc42f59be9a72ed0c5810973ae7c41e210098d0
MATLAB
2,449
95
%DEMGLM1 Demonstrate simple classification using a generalized linear model. % % Description % The problem consists of a two dimensional input matrix DATA and a % vector of classifications T. The data is generated from two % Gaussian clusters, and a generalized linear model with logistic % output is trained using it...
45ee88730490f2b327275c819d97a2b6bd1245468cd3f5beee2461d8f71e7834
MATLAB
2,451
103
%DEMKNN1 Demonstrate nearest neighbour classifier. % % Description % The problem consists of data in a two-dimensional space. The data is % drawn from three spherical Gaussian distributions with priors 0.3, % 0.5 and 0.2; centres (2, 3.5), (0, 0) and (0,2); and standard % deviations 0.2, 0.5 and 1.0. The first figure ...
fde7f13d3e6b43555df23760bb517489abad861214bc657f9c4dd9d687adcfa8
MATLAB
2,454
77
function [subj] = separate_regressors(subj, regsname, varargin) % Separate regressors matrix into row vectors % % [SUBJ] = SEPARATE_REGRESSORS(SUBJ, REGSNAME, ...) % % Given a regressors matrix, creates new regressors objects with % appropriate names (from 'condnames' property) that consist of the % individual rows of...
60802f041f0432918f254a89e419745c090bc00a908d19c97e13450392b6ef34
MATLAB
2,455
77
clear all; addpath('/Volumes/LASA/TBI_OpenNeuro/TBI_openneuro/timeseries/inputs/'); addpath('/Volumes/LASA/TBI_OpenNeuro/Shared_code/Hopf_TBI_ON_personalized/'); load tseries_openneuro_tbi_tp123_sch1000.mat; % Load your data % Parameters of the data TR=2; % Repetition Time (seconds) NSUB=12; NPARCELLS=1000; Tmax=144;...
570223556e7306e483012a1b794d9c7fabff2898f05667a0cea4eb4e3f5e2f01
MATLAB
2,459
81
function [subj] = initset_object(subj,objtype,objname,newmat,varargin) % Calls init_object then set_mat (and set_objfield optionally) % % [SUBJ] = INITSET_OBJECT(SUBJ,OBJTYPE,OBJNAME,NEWMAT,...) % % This is for lazy people who want to init their object and then % put the mat inside it, all in one go % % You can also s...
069ed82b8cc65e39bd43733dd9a4952017f91482af2c22cb401bb39e0a211a33
MATLAB
2,464
97
function [pat] = get_full_pattern(subj, patname, varargin) % Retrieves a pattern in volume or padded matrix form. % % This is useful for saving patterns to AFNI or for computing % statistics for patterns in +tlrc space, where voxels have a 1:1 % correspondence. % % Usage: % % [PAT] = GET_FULL_PATTERN(SUBJ, PATNAME, .....
f8af63bb26fa501e370a8d64806c2e4a9c5caecd829089b35426b397722c89db
MATLAB
2,464
83
function pSVR_plot_bfca_vviq_correlation(p) % Get relevant variables from 'p' delay = p.psvr.delay; p.psvr.label = 'target'; %%% Prepare data %%% % Load results stats_file = dir(fullfile(p.dirs.data, 'analysis', 'all', 'results', ['pSVR_' p.psvr.event '_' p.psvr.label '_' p.psvr.roi '_stats.mat'])); if isempty(stats...
6aea3996e434bcea057bf75ed0d273d8b208f5b91a2957a0f77837f87b9443b7
MATLAB
2,465
53
function [FirstFrame_AboveBelowBaseline, IncDecNoChange] = FirstFrame_AboveBelowBaselineMean(FluorescenceTrace, BaselinePeriod, z, STDorSEM, SearchAfterFrameX) %FirstFrame_AboveBaselineMean finds the first frame greater than or equal %to Z STD or SEM above the baseline mean % Michelle Cahill 202111202 adapted from F...
1904405c8579020f2d8d865696cb50b238d9e18e5fadf9c19c3f6ba8836c1d23
MATLAB
2,466
75
function [Xavecorr, Tavecorr]=removeShamBF(data_corr, iR, iRsham, iRcov, lambda, GaussEnv, widthCov, widthArtifact, U) % % This function removes the from one condition (active TMS) the signal % produced by the sources activated by sham condition (the second % condition). Data from both condtions are given as input ...
b764cf80374bab6ecd1481c9856252335a10b9d155a4d25336ccd529614c49e8
MATLAB
2,468
77
function [subj] = load_pattern_from_hd(subj,patname,varargin) % Reverse of MOVE_PATTERN_TO_HD % % [SUBJ] = LOAD_PATTERN_FROM_HD(SUBJ,PATNAME,...) % % Reloads a pattern that was saved to the harddisk. Uses the MOVEHD % field stored in the pattern to retrieve things, and then removes it % afterwards % % LEAVE_ON_HD (opt...
3e00bde1a7a65685795e19ebae77c41212a8d06f43be97c7a5dd473568de9fc8
MATLAB
2,469
53
function ec2RunStructure = awsEC2BuildRunStructure ... (ami,pemFilePath,IAMRole,securityGroup,region,userName) %This function builds a structure used to initialize EC2 instance %To initialize EC2 instance we will need to define: %INPUTS: % - AMI (image id, pem name, pem file path) that defines: operational s...
fc89bf90e7ea4d7f30c853c6b10364a7e2fe66d7d42c43067ee538c0e9d2823d
MATLAB
2,474
77
function [combined_table]=combine_similar_times_nowobble_210719(table) if all(~ismember({'Subregion','Electrode Pairs','Spike Area','Conduction Time','Unit Pairs','Direction'}, table.Properties.VariableNames)) error('This table does not have the appropriate variables: Electrode Pairs,Spike Area,Conduction Time,Uni...
3361f898abdc8fe63da9c6c370f6cd75b5c2960b2d9aa7550d9d8d79215880db
MATLAB
2,476
72
% SYNTAX: % [stim, tRange] = hmrR_StimRejection(data, stim, tIncAuto, tIncMan, tRange) % % UI NAME: % Stim_Exclude % % DESCRIPTION: % Excludes stims that fall within the time points identified as % motion artifacts from HRF calculation. % % INPUT: % data: SNIRF data object % stim: SNIRF stim object % tIncAu...
a41c49791cdc3870711ca6efb57e3174fcbc301de84d970727d09e6db75660b1
MATLAB
2,477
70
function model = lvl2_2samplettest_specify(p) % Exptract relevant variables from p data_dir = p.dirs.data; title = p.lvl1.title; % Initialize output variable model = {}; files = {}; for i_sub = 1:numel(p.subjects) sub_str = num2str(p.subjects(i_sub),'%02i'); list = spm_select...
c7371a5d23dccfb5ca0abf834d8198f6dad8b4e6cb64ecf73b33adf166ff17cb
MATLAB
2,477
104
% Figure S1 Van den Berg*, Wong* et al, 2024, iScience % FigS1A - Salicylate Concentration vs Time close all; clear; clc; datapaths load([ConcPath,filesep,'salicylate_concentration_data.mat']); % F = figure; % a=gca; % plot(a,T,C,'ko','MarkerFaceColor','k'); p = polyfit(T,C,1); % [fitresult, gof] = expfit(T, C); a=...
3711eddacdcb7e35d6d03e43ec2e2fe58d80997d65ab95f4f9a3127395a7ff48
MATLAB
2,479
89
function Par = LoadPar(FileName, varargin) % LoadPar(FileName) % loads the specified par file and returns a structure with these elements: % % .FileName -> name of file loaded from % .nChannels -> number of total channels % .nBits -> number of bits of the file % .SampleTime -> time, in microseconds,...
108a40c3abeeb2612c7ebf39b7b16d616d64100579364c24ae7ec65bbe50a4c1
MATLAB
2,480
67
function [actives_bal] = balance_active_selector(conds,actives) % [ACTIVES_BAL] = BALANCE_ACTIVE_SELECTOR(CONDS,ACTIVES) % % Takes in a single boolean actives selector ACTIVES, as well as the % conditions regressor CONDS, and returns a whittled actives selector % ACTIVES_BAL that balances the number of timepoints in e...
b8906eabef14ac81a6464c73d71291082bcdfa99e447a60c37b9baf607cfe167
MATLAB
2,480
77
% Create a table that will mean the EC activation across iterations and % fold %% Set Up the environment clear all clc %% Add the pm_data path pmDataPath='/Users/federica/data/GridMagination/3Iso/Script/00_pm_data'; addpath(pmDataPath) WorkingDirectory='/Users/federica/data/GridMagination/3Iso/CONT'; %Subject Lsi...
d788a0c734b6e317b0c805944bf0b1edd8c338938dfeb9848eb10dec9f0fc345
MATLAB
2,480
93
function CalibrateCamera(varargin) % CalibrateCamera - Calibrate camera, from pixel to cms % % USAGE % % CalibrateCamera(<options>) % % <options> optional list of property-value pairs (see table below) % % ========================================================================= % Properties Valu...
5b77aaa1b559b63b201544c70682ca2d6e3ec946fc7313001b71f5d4cca0da30
MATLAB
2,481
76
function [fx] = f_Hampton_2games_cinq(x,P,u,in) if VBA_isWeird (u) % e.g., 1st trial fx = x; return; end o = u(1); % opponent's last choice (o) a = u(2); % agent's last choice (a) p0_game1 = VBA_sigmoid(x(1)); % previous estimate of P(o=1|game1) p0_game2 = VBA_sigmoid(x(2)); % previous estimate of P...
9dc4197f1d89a494c3bb738883e76abfcb1e2a4121ecee919f03061d832eedcc
MATLAB
2,484
88
%% Movement clear [task_info,supPath] = loadDBAndSpecifyDataPaths('Vermis'); req_params.grade = 7; req_params.cell_type = {'PC ss', 'PC cs', 'CRB','SNR','BG msn'}; req_params.task = 'speed_2_dir_0,50,100'; req_params.ID = 4000:6000; req_params.num_trials = 70; req_params.remove_question_marks = 1; raster_params.ali...
4bb0ce074fccd315e410bf5633618df7b2feb62f08f2900d30ad56aca193a5a8
MATLAB
2,485
56
function [spike_burst_dyn_table]=well_compute_spike_burst_dynamics_axons_240703(allregion_unit_matched) %despite the name, this function computes spike dynamics for the wells % This folder contains the contains the mea structs %load(strcat(parent_dir,'\','allregion_unit_matched')) % Parameters fs = 25e3; % Initial...
5765bf6780cd1bf007d222ba627a10d298dc4b2cd4df1c14a53a64b5d4c30019
MATLAB
2,488
89
clear [task_info,supPath,MaestroPath] = ... loadDBAndSpecifyDataPaths('Vermis'); %load('sessionMap.mat') K_FOLD = 10; EPOCH = 'targetMovementOnset'; req_params = reqParamsEffectSize("saccade"); raster_params.align_to = EPOCH; raster_params.time_before = 0; raster_params.time_after = 800; raster_params.smoothing_...
593da9f742dac55bdcac6d819052dd14e25d65075a3eb60989943c7589269b30
MATLAB
2,489
90
%This analysis code was used in: %Mares I, Ewing L, Papasavva E, Ducrocq E, Smith FW, Smith MLS (in press). %Face recognition ability is manifest in early dynamic decoding of face-orientation %selectivity – evidence from multi-variate pattern analysis of the neural response.Cortex. %The code was originally create...
301aa0cf404f384996944a3ba0d2efc10cf77c8cb72fc87088787e7b9d4f260d
MATLAB
2,492
89
function [hf, hp] = plotFilters(K) % function [hf, hp] = plotFilters(K) plot_all = 1; color = 'k'; nCols = 3; dt = K.dt; %% 5. Plot resulting filter hp = []; hf = figure; tf = (0:length(K.PH)-1)*dt; tf_EP = (0:length(K.EP)-1)*dt; tf_vis = (0:length(K.PR_vel)-1)*dt; tf_tar_sine = (0:length(K.PT_vel)-1); % TODO: Ch...
6e8f7914a70f612d744bbcd5b1a9443b73475255bf7e789f50c43930435f50c5
MATLAB
2,492
70
function chnName = getChnName(numChn) if numChn == 30 chnName = {'S1D1 Middle Posterior FEF Left',... 'S1D2 Posterior to sPCS/tgPSC Left',... 'S1D3 Middle FEF Left',... 'S1D4 sPCS/tgPCS Left',... 'S2D1 Posterior FEF Left',... 'S2D2 Inferior to FEF Left',... 'S3D3 Ant...
9aef8b8cc0e54c2eae9a488e14c4d7334793aeba83ec6b6a65427734805fb89f
MATLAB
2,492
53
function vidObj = msAlignment(vidObj) %MSALIGNMENT Aligns frames from a single experiment. Aligns using the %middle frame as reference. %First click and drag to select ROI. %Algorithm runs in a parfor loop to speed up alignment hShift = nan(vidObj.numFrames,size(vidObj.alignmentROI,2)); wShift = nan(vidObj.nu...
06beba62cf459fe0b71b08c564a8d6523f1ec9baed61dede9e3b9ebb57266f06
MATLAB
2,494
113
function [out1] = getAppDir(inp1) out1 = []; ns = getNamespace(); if isempty(ns) return; end if strcmp(ns, 'AtlasViewerGUI') if nargin == 0 [out1] = getAppDir_AtlasViewerGUI(); elseif nargin == 1 [out1] = getAppDir_AtlasViewerGUI(inp1); end elseif strcmp(ns, 'Homer3') if nargin == 0 ...
49ad4cd00bd53bc201651c2b34b70c300ca837731fa0adcd1bb1d28ac01b6b4b
MATLAB
2,494
63
%% Plot indirect pathway nuclei coloured according to fMRI-MIC LME coefficients (Figure 4B) repo_path = 'Path_to\Manuscript_repository'; funcs_fpath = fullfile(repo_fpath, 'plotting\matlab_funcs'); addpath(funcs_fpath); addpath('Path_to\wjn_toolbox_tsbinns'); addpath(genpath('Path_to\spm12')); addpath(genpath('Path_to...
0248fbde60a8f97e7b719eed15b6f9b0c68523d85d398ad617edb9758bb075ad
MATLAB
2,496
67
function [displacementField] = create_nonrigid_displacement_field3d(fieldSize,varargin) % CREATE_NON_RIGID_DISPLACEMENT_FIELD3D Creates a 3D non-rigid displacement field % % [displacementField] = create_nonrigid_displacement_field3d(fieldSize) % % INPUT ARGUMENTS % fieldSize - [rowSize colSize rodSize], ass...
b956489197194a6fc644b87f71b860968e38b8b5dc542c97c6fcec0ee213c2bd
MATLAB
2,501
84
function [binActivity] = difine_bin_activity(NeuronSL,traj,Lap,binNum,thetaR) %DIFINE_BIN_ACTIVITY % Default bin number: 48 % Default starting postition(theta) 0.8634 % if nargin <=4 % thetaR = 0.8634; % if nargin <=3 % binNum = 48; % end % end if floor(binNum)~=ceil(binNum) di...
29ad86870ca6c6ac9e782589d720171f4ae54fd45a2fcf08fc46f93f9a886eb3
MATLAB
2,502
88
%DEMMLP1 Demonstrate simple regression using a multi-layer perceptron % % Description % The problem consists of one input variable X and one target variable % T with data generated by sampling X at equal intervals and then % generating target data by computing SIN(2*PI*X) and adding Gaussian % noise. A 2-layer network ...
443e3896582fc8aeaa709e17e29353255d477673c438c1a0a328adddc7092eaa
MATLAB
2,505
82
function epoch_movie( ... x, row, col, color_axis, plot_axis, Fs, save_option, normalized_flag, bound ) % *WAVE* % % EPOCH MOVIE image/surface animation of a wave propagation epoch % % INPUT: % x - datacube (r,c,t) % row - row in x for channel plot % col - column in x for channel plot % color_axis - caxis for im...
b9e41c928171a5eeb47d9f8432a1a4038216480ffbc0139209efbc9783e41254
MATLAB
2,507
112
%function [ptab,map] = MultimodalTest(data, max_k, Verbose) %Silverman's method for testing succesive hypotheses %that a dataset has 1, 2, 3,..., max_k modes. % from A Sirota toolbox, changed by Adrien Peyrache, 2011 function [ptab,htab] = MultimodalTest(data,max_k) hrange = [0.001:0.001:1]; boot_iterations=200; %ma...
f15acef9cf447b4be8b43f23f9e1cb7082525e9e0c4825d687a01ca2b833d322
MATLAB
2,509
99
%% Figure 1A - Parametric stimulus sheet % - Size: 12x9 % % - Horizontal grating background % - Target rotates from 0 to 90 deg in phase in 15 deg steps TCONT = 12/100; BGCONT = 12/100; BGCONT2 = 24/100; TORI = [0 15 30 45 60 90]; yy = (0:360*8)'; canvas = repmat(BGCONT *cosd(yy),1,numel(yy)*num...
e362df299f5c494a724b1e66fb30b87a98f101ac31214f3b08cc6eb820f9286e
MATLAB
2,511
78
function [d, state, num, val, mindist] = analyze_cluster(clus, dim, inside, targetindx, sgn) % ANALYZE_CLUSTER analyzes the array of clusters clus and returns for each element % the following quantities: % d = the euclidean distance between the pair of voxels closest to the target pair, % and the target pai...
014f719c61745907057694c32f8af7f278c6c1e88804a6d2527d30c4fb84d6f5
MATLAB
2,515
101
function [err,v, typ] = BrikInfo_SectionValue (BRIKinfo, sSection) % % [err,s, typ] = BrikInfo_SectionValue (sHead, sSection) % %Purpose: % Get the values of a section in the .HEAD string % This function is dedicated for BrikInfo function % %Input Parameters: % sHead, a string vector containing the .HEAD inf...
0c0d85ded7502e0afc90847d1f3a21b6b991fb311e49619433ee927e9127e646
MATLAB
2,515
80
function [R,EX,EY,EZ] = fiff_getpos(file,coord_system,calfile,z_offset) % Copyright (c) 2016, Elekta Oy % --------------------------------------- % % Redistribution and use of the Software in source and binary forms, with or without % modification, are permitted for non-commercial use. % % The Software is provided "...
a85e6d2c668232aef8503a50174574ecbebcdcd9eaaac18fe04fac0017e2de52
MATLAB
2,515
81
% @title Generate optogenetic stimulation pattern % @file gen_opto_stim.m % @author Romain Beaubois % @date 14 Aug 2021 % @copyright % SPDX-FileCopyrightText: © 2021 Romain Beaubois <refbeaubois@yahoo.com> % SPDX-License-Identifier: GPL-3.0-or-later % % @details % > **06 Aug 2021** : file creation...
9e42ab3787803b20fe5d0242e30ace79e3bd828be6fa1713aa9fe8fb4869d76d
MATLAB
2,521
82
function [groups, group_names] = createGroups(data,epoch,ind,... prevOut,velocityInsteadReward,numCorrectiveSaccadesInsteadOfReward) PROBABILITIES = 0:25:100; if strcmp(data.info.task,'rwd_direction_tuning') % FLOCCULUS TASK! [~,match_d] = getDirections (data,ind,'omitNonIndexed',true); [~,match_p] = get...
a93d4b635ad21ce6984ac0cadec0f0fc51baaad626883e03b0832f70fcb74876
MATLAB
2,521
90
clear [task_info,supPath,~,task_DB_path] = loadDBAndSpecifyDataPaths('Vermis'); WAVEFORMS_PATH = [supPath '\waveforms']; WINDOW_SIZE_BEFORE_PEAK = 40; WINDOW_SIZE_AFTER_PEAK = 40; BASELINE = 10; % 10 sample from min point Fs = 40; % kHz PLOT_CELL = 0; req_params = reqParamsEffectSize("both"); req_params.cell_type =...
cd830c4aa32792c4bbecc3463df5a94d8226de7b790f9ff46138026ff1a005f6
MATLAB
2,521
80
function [R,EX,EY,EZ] = origheader_getpos(info,coord_system,calfile,z_offset) % Copyright (c) 2016, Elekta Oy % --------------------------------------- % % Redistribution and use of the Software in source and binary forms, with or without % modification, are permitted for non-commercial use. % % The Software is prov...
65c9a294b7cf1ca84ef8199a5248e8a9a762e2d21b5c44e431b93d2648c2b06c
MATLAB
2,523
56
% Extract single HRF from dcNew variable, the output of GLM fitting function % save to mat file. % For experiment 08 and 10 % For allSSingle and allSMultiple, numClasses is predetermined. % stimTr % stimTr(1,1) = leftOnsetSTr; % stimTr(1,2) = rightOnsetSTr; % stimTr(1,3) = centerOnsetSTr; % stimTr(1,4)...
d4f56e3185a621119adfe89efd186add498247f37872cdfe5527c9d40b7dd7f3
MATLAB
2,524
84
function [guess, combinations]=find_bpn1(sv_var,coords,C,final_time) % OPTION 2: % std of the whole trace % for i=1:size(coords,1) % stds(i)=std(sv_var(i).coords(:,5)); % end % [~, sorted_ids]=sort(stds,'descend'); % % % sort according to highest stds % guess=[]; % selection=sorted_ids(1:60); % sort a...
d61a4fbec4bfa0259db144af772cf34b476f57f21c6bcecc6ddac23e5e647873
MATLAB
2,529
47
function [cTable,angles] = generate_cTab_loc(cData) %% NOTE: This version is after correcting the error in classifying invalid responses angles = unique(cData(:,6)); if angles(1,1) == 0 angles = angles(2:end,1); end cTable = zeros(5,5,size(angles,1)); resp = [3 4 1 2]; for tr = 1:size(cData,1) ...
a64ac60e6ef04cf8de9df1a9b8d0558930dfeb752db7700137f1ca2ec5f0fb4f
MATLAB
2,532
143
function [xy, c_lo, c_hi] = nancorrcoef(varargin) %[xy, clo, chi] = nancorrcoef(x,y, alpha) Correlation coefficients. % NANCORRCOEF(X) is a matrix of correlation coefficients formed % from array X whose each row is an observation, and each % column is a variable. % NANCORRCOEF(X,Y), where X and Y are column vec...
b648e7d8abc7cf197aa9a96376ab2e1053f9b7d49d71b7775854df5ec4bbbe18
MATLAB
2,534
83
%close all; clear all; clc; Act = @(MaxAmp, Alpha, Tau_r, Tau_f, t) MaxAmp * Alpha * (exp(- t/Tau_f) - exp(- t/Tau_r)) /(Tau_f - Tau_r); % Act = @(MaxAmp, Alpha, Tau_r, Tau_f, t) MaxAmp * Alpha * (exp(- t/Tau_f) - exp(- t/Tau_r)); SamplingRate = 1000; % times per second % T = (0:TimeLength-1)/SamplingRate; T = -...
573978c5878c6b1f230a7ac844cbcdad0bc4d3feb9c454de10f4896233eafba8
MATLAB
2,536
91
function [nb_corr,nb_significance] = NBCorrFunction(data,... raster_params, bin_sz, task, varargin) DIRECTIONS = 0:45:315; PROBABILIES = [25,75]; OUTCOMES = [0,1]; ii = inputParser; defaultShiftControl = false; defaultPlotZScores = false; defaultSeperateByPrev = false; addOptional(ii,'shiftControl',defaultShiftCo...
dad8f9870940f859194001000fee148f7d5550242098051402546feaa064297f
MATLAB
2,537
102
% MA_CORR moving average correlation between multiple signals. % % CC = MA_CORR( X, M ) % % pearson correlation computed in a moving average window of M samples % % 1. if input is matrix, works on columns % 2. NaNs are NOT taken care of % 3. zero phase lag % % calls firfilt % 09-sep-13 ES % work...
1d2b992709c4f068b92b5a1138322059470aa0c518942b5776eed0dfd55c6327
MATLAB
2,542
96
function PrintSystemInfo(logger, appname, varargin) if ~exist('logger','var') logger = []; end if ~exist('appname','var') || isempty(appname) appname = {'Untitled'}; end logger = InitLogger(logger, 'SystemInfo'); platform = ['R', version('-release')]; if ~iscell(appname) appnames = [appname; getLibnames(a...
6636c71f9990d3761e3c1b7d6fb2fef4450cd40262d38102cc8a729efb4a0e2c
MATLAB
2,543
79
% Runs various limited-memory solvers on 2D rosenbrock function for 25 % function evaluations maxFunEvals = 25; fprintf('Result after %d evaluations of limited-memory solvers on 2D rosenbrock:\n',maxFunEvals); fprintf('---------------------------------------\n'); fprintf('x1 = %.4f, x2 = %.4f (starting point)\n',0,0)...
0d59444171e9c931e1bccaf70d0c08f2226cd6cbbf4d4e0cb3921ce2c0d8908a
MATLAB
2,544
63
function [cfg, Xtrain, Ytrain, Xtest, Ytest] = mv_select_train_and_test_data(cfg, X, Y, train_indices, test_indices, is_kernel_matrix) % Splits the data into training and test set. % Also selects data provided as preprocessing parameters if the .data field % in cfg.preprocess_param is not empty (e.g. .signal and .nois...
c7ae70c5fa7f6a8b31ffe685d3b6fc6a20fcee9c6eb28ef1efaa388b8846dc06
MATLAB
2,548
83
function r = MD_vmrnd(mu, ka, N) % _ % Random Numbers from a von Mises Distribution % FORMAT r = MD_vmrnd(mu, ka, N) % % mu - the mean of the von Mises distribution % ka - the precision of the von Mises distribution % N - the number of samples to be drawn % % r - an N x 1 vector of von Mises random ...
5c2978e5d811fc33da2e224ce2ad9d7b4273faf3c209a71274d3806e030a5487
MATLAB
2,550
73
function [analysis_complete, predictions, results, first_perm] = pSVR_check_progress_permute(sub_id, p) % function [analysis_complete, predictions, results, first_perm, first_tr] = pSVR_check_progress_permute(sub_id, p) % % Checks whether a final result file or temporary result file for the % current subject has alrea...
42d56dce7cdacd497082da922d94e693249bee35b0ae27d7b8c80914968fa364
MATLAB
2,552
103
%DEMGLM2 Demonstrate simple classification using a generalized linear model. % % Description % The problem consists of a two dimensional input matrix DATA and a % vector of classifications T. The data is generated from three % Gaussian clusters, and a generalized linear model with softmax output % is trained using i...
d75f4a7343b7b416c7b8495fb97538952de6515bff7f55384d198466bae6dd28
MATLAB
2,552
78
function bhvr = bhvr_analyse(bhvr, p) % function bhvr = bhvr_analyse(bhvr, p) % % Runs an analysis on the behavioral data of the MRI experiment, by fitting % a von Mises mixture model (vMMM) to the distribution of the response % errors. The vMMM consists of 3 components: detections (response to the % target), swap err...
705cdda9e3ff4c5e3e0e2ce8f247c48da163dfc2e2865baa819ca3d0e8d80c0d
MATLAB
2,554
66
function varargout = iif(varargin) % out = iif(conditions_actions) % % This is an inline form of "if", allowing one to use "if" as a function. % Generally, the form looks like: % % iif(<if this>, <then that>, ... % <else if this>, <then that>); % % That is, the odd inputs are treated as conditions and the ev...
27b8a23f1ed1e81ec3a236a3f162fc08d9b8fc96c5739523ecb2db5b589d5ada
MATLAB
2,563
77
function [subj] = load_spm_mask(subj,new_maskname,filename,varargin) % Loads an NIFTI dataset into the subj structure as a mask % % [SUBJ] = LOAD_ANALYZE_MASK(SUBJ,NEW_MASKNAME,FILENAME,...) % % Adds the following objects: % - mask object called NEW_MASKNAME % % License: %==============================================...
9e1e49a9cdd1f56b0216aedd289ae918fac3b58c82b08dfdeb91436555fc0cec
MATLAB
2,563
82
%% Plotting goodness-of-fit p-val, median split of sessions based on jackknife estimates of sensitivity and bias %% Code Trials = ["All","RF"]; split_sessions.parameter = ["sens_cued","LR_cued","sens_opp","LR_opp","sens_cued_mi","LR_cued_mi","sens_opp_mi","LR_opp_mi"]; sessions_list = {[4:15 18 20:24] , [34:45]};...
b4f7e24129873fe6e5fa235a802b066efb0e1e29a21182bc9d3c3777af0cbf76
MATLAB
2,563
81
function [objno] = get_number(subj,objtype,objname,varargin) % Internal function - find the cell index of an object % % OBJNO = GET_NUMBER(SUBJ,OBJTYPE,OBJNAME,...) % % % Looks into the subj structure for the object cell called % OBJNAME and return its index. Returns an error if no % pattern with this name is found (u...
c721ba19e6ff41dc1bfff3c9906695ecf03154bfe5ded4a895d32116a49a33af
MATLAB
2,564
86
function [same,errmsgs,warnmsgs] = compare_struct(s1,s2,errmsgs,warnmsgs,struct_name) % Are two structs equal? % % [SAME,ERRMSGS,WARNMSGS] = COMPARE_STRUCT(S1,S2,[ERRMSGS],[WARNMSGS],[STRUCT_NAME]) % % Feed in two structs, S1 and S2 to see if they're % equal. % % ERRMSGS and WARNMSGS are cell arrays, as per standard u...
e6279771b868f586ea9897a6029c3aedd5c4e5280c2be976620aaa0341404c6b
MATLAB
2,564
66
function ec2Instance = awsEC2RunstructureToInstance(ec2RunStructure, id, dns) % This function converts ec2Runstructure to ec2Instance, setting up pem and % permissions. % USAGE: % awsEC2RunstructureToInstance(ec2RunStructure, id, dns) % INPUTS: % - ec2RunStructure - see awsEC2BuildRunStructure for details % ...
73c6f557de1aaed2f15031052cb041ebc02cd0bf61a28dd76e01a3d61ec4814f
MATLAB
2,566
68
function skullstrip() clear cfg cfg = load('neurovar_cfg.mat').cfg; for i_sub = 1:44 fprintf(strcat('Skullstrip Sub_', string(i_sub),'\n')); %% DARTEL apply to rc1 clear matlabbatch matlabbatch{1}.spm.tools.dartel.mni_norm.data.subj(1).flowfield = ... {select_nii_anat(cfg, i_sub, 'u_rc1')};...
f66bfa76d8ca7e4d30ff8ed0e2f810787a96521ddcd3e580247bf52ce5077c2b
MATLAB
2,569
72
sbjGrp = 1; if sbjGrp == 1 sbjGrpStr = 'HighPerf'; elseif sbjGrp == 2 sbjGrpStr = 'All'; end % For GrpAsSbj % number of different conditions numCond = 3; % number of source-detector channels numChn = 36; numChnWOSS = 30; % HbO, HbR, HbT numConc = 3; sizeOneCond = numChn*numConc; procDataDir = 'C:\Users\mn0...
6abd38323b3d543fe70e3507d42d8caeeaff7353e41146f8a43f971091b80e2f
MATLAB
2,571
89
function axh = PlotISet(IS, varargin) opt_varargin = varargin ; defined_options = dictArray({ {'MarkerSize', {10, {'numeric'} } } {'Marker', {'k.', {'char'} } } {'MarkerMultiColor', {0, {'numeric'} } } ...
99425a2f35fb7719d95c904f6809ef7acea6778fdd21cb7d58e25de7e2b66891
MATLAB
2,571
83
function [ zfilt ] = gaussfilt( t,z,sigma) %Apply a Gaussian filter to a time series % Inputs: t = independent variable, z = data at points t, and % sigma = standard deviation of Gaussian filter to be applied. % Outputs: zfilt = filtered data. % % written by James Conder. Aug 22, 2013 % convolution for u...
3aff73c8eda81b46cd1c7ac146485ddb6cd81a6263dc943bd112d31985b3e40f
MATLAB
2,575
76
function warp_rois_to_subject_space(p, roi_name) % function warp_rois_to_subject_space(p, roi_name) % % Warps ROI probability maps into subject space, thresholds at 0.1 and % creates binary masks. Please note: the output files in subject space will % be prefixed with 'w' according to SPM convention. % % Input: % -...
4bd23d7002045535a6a3d5238dd5449b666983c560f7bbd9f86a312ce7e675bb
MATLAB
2,575
57
function [regFrame,dv0,cx] = return_offsets_phasecorr_batch(frame,ops) % Do phase correlation registration (sub-pixel with kriging) on a single % frame using pre-calculated registration variables (ops) % use with setup_registration_phasecorr.m % e.g: % [ops] = setup_registration_phasecorr(refImg) % [dv0,cx] = return_o...
a9eab1103ab953a56f58b6aaf5df8f197822ef5910a7609cc65e2d260feafa50
MATLAB
2,575
91
%function thrun = thetarun(FileBase,Periods,frin,frout,ch2use) % runs automatic Gaussian HMM segmentation of the period of recording % given by Periods in seconds function thrun = thetarun(FileBase,varargin) load([FileBase '.eegseg.mat']); Par = LoadXml([FileBase '.xml']); [Periods,frin,frout,ch2use] = DefaultArgs(vara...
def450968bc33adf5ceaef280095074acbcef82123bb4895a8120e49f25d00cf
MATLAB
2,577
64
function [nwbAll, importLog] = NWB_importFromFolder_SBCAT(datasetPath, importRange) %NWB_importFromFolder Returns a cell array containing all imported nwb %files in the specified folder and import range. % pathIn: Path to desired folder % importRange: Range of SB/SC IDs to import. % % mkyzar 4/15/2023 %% Compil...
3c8d85655ea8fe153aaeb320659e334895adc3f5bfa30587453c6d168e01c1f4
MATLAB
2,578
76
% MY_XCORR compute the column-wise cross-correlation between real matrices. % % call CC = MY_XCORR( X, Y, MLAG, NORMF ) % % gets X matrix, trials in columns % Y {X}; another matrix of same dimensions; if % l...