sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
6510d8f7a0aa8202c9a5bd85a67db612e56895995d3e30ae1458dad593bbb421
MATLAB
4,674
154
%% LCMV virtual channels % % Vinding, M. C., & Oostenveld, R. (2022). Sharing individualised template MRI data for MEG source reconstruction: A solution for open data while keeping subject confidentiality. NeuroImage, 119165. https://doi.org/10.1016/j.neuroimage.2022.119165 % % Calculate virtual channels in a set of pr...
c97dcdc4295a2b93967f978015bc828fc4555ed32adfebb2f5c560caf0376115
MATLAB
4,674
161
%% compute average JND across all participants cd D:\Exp_noInstruction\ resOut = [pwd '\data\']; outdir = [pwd, '\results\'] load([resOut,'Exp_noInstruction_JNDblockXSub'],'JNDblockXSub')%% plot GroupMean = mean(JNDblockXSub,2); GroupSE = std(JNDblockXSub')/sqrt(length(JNDblockXSub)); figure hold ...
ca4b627ec5d499d965d6b92f104536ac9ac0bd1aa84f75b0ac8ed8ea9bb27425
MATLAB
4,675
152
clc clear close all data_name = 'Confocal_BPAE_B'; addpath('./code') addpath('../utils') dir_avg1 = ['../../dataset/', data_name, '/raw/19/']; % 50 images dir_avg2 = ['../../dataset/', data_name, '/avg2/19/']; % 50 images dir_avg4 = ['../../dataset/', data_name, '/avg4/19/']; % 50 images dir_avg8 = ['../../dataset/',...
a8d48daafd02aee832b583271b006054b7a8b8e8cdc20dcbdd7640cf83eaf833
MATLAB
4,678
125
function [ens_nodes, results] = find_core_ext_IDs(best_model,data,UDF,num_controls) % Input % best_model: Trained CRF model to analyze. % data: Expected to be a timeframes by neurons binary matrix. % stimuli: Expected to be a timeframes by stimuli binary matrix. % num_controls: Optional. Number of random ensemb...
ec1e3efedae8dd90cae90bc02bc97c18c1a51b8685a7633de6ffdd8006ed9526
MATLAB
4,678
147
function [g,tt,params,err,errF,errP] = getModelParams(val,XX,YY,lambda,plotFig) badNdx = isnan(squeeze(nanmean(val,[1,2]))); val(:,:,badNdx) = []; XX(:,:,badNdx) = []; YY(:,:,badNdx) = []; xlims = [min(XX(:)) max(XX(:))]; ylims = [min(YY(:)) max(YY(:))]; tt = (0:size(val,3)-1).*300./30; zmin = floor(min(v...
93d0f1b21c61daf15539463c45755700661cd2fa2eb6b519945e63bf754d814f
MATLAB
4,679
117
function Find_Grid_Distortion(folder, folder_curve) %this is for finding grid distortion at different z depth cd(folder); files=dir('*.dat'); num_files=length(files); if num_files>1 display('more than one files found, only need one file') else file_split=strsplit(files(1).name,'.'); file_split2=str...
c78e61b4c59eaa2bab1251b811edcda2d16ba962b4f8bf8ffc4e5533cbb3c8e2
MATLAB
4,679
122
function varargout = spm_shoot_greens(varargin) % Build and apply FFT of Green's function (to map from momentum to velocity) % FORMAT v = spm_shoot_greens(m,K,prm) % m - Momentum field n1*n2*n3*3 (single prec. float) % K - Fourier transform representation of Green's function % - either size n1*n2*n3 or n1*...
8efba174d33968b413eab9de3568d25f6fd0dc85ba83cafe2d5e9a019d209311
MATLAB
4,680
141
function [mu, xi, twoMargs, energy, complexity, exact, logZ] = run_junction_tree(theta, W, varargin) % [mu, xi, twoMargs, energy, complexity, exact, logZ] = run_junction_tree(theta, W, varargin) % % Same interface as solveBetheExact. % solveDAI Find marginals of problem in Eq 1 by libDAI's methods % [ logZ, joint,...
c1c4f0e930ad60b41f0f7de29205451f2acab9c6722f3d9090a314c752536400
MATLAB
4,680
123
function [cde] = getCode(funNme) % Read the source of an *.m file into a numeric vector. % % Together with saveCode this is a way to store the code that produced a % data set next to the data set itself, so a result can still be traced back % to the exact version of the script that created it. % % Usage: cde = getCode(...
2d52a028e9cc55e1f724f3863a2ee3b141bf315aff2d93315887183fc30d80dc
MATLAB
4,684
172
clear all close all rng(9) %% initialization of parameters/matrices run('param_init2.m') %% creation of presynaptic inputs run('input_init.m') %% trial loop for l = 1:num_trials %choose a cue cue_given = cues{l}; pos_map = PF_map; temp = PF_map; %induction protoc...
27a107e78210b9c9a12a95eefa204d8828354be3b6a35d9376e7d931afc0a4b7
MATLAB
4,689
143
% Here we calculate the optical flow change by eccentricity % % this script % (1) reads in the stimulus image then calculate the optical flow % from one frame to another using modules in matlab simulink. % (2) The optical flow vector will be drawn on the original images. % (3) We calcualte the overall magtitute of t...
18710d5544fc730342d9d703df7bec6eb3deb4f48de3ea4a17740e952afd769a
MATLAB
4,693
166
function st = nufft2_init_kb(om, N1, N2, J1, J2, K1, K2, n_shift, kernel, useloop) %function st = nufft2_init_kb(om, N1, N2, J1, J2, K1, K2, n_shift, kernel, useloop) % Initialize structure for 2D NUFFT using KB interpolator, % particularly the interpolation matrix in sparse format. % in % om [M,2] frequencies in rad...
948ac0e9a14bc84f10b8a7dd56b48d74d6fa23cdeb842d0ec3efe66a2ff92741
MATLAB
4,693
111
%computes the (normalised) flow field in a Drosophila embryo and %plots the streamlines + heat map shown in Fig. 4d N = 14; %number of modes kept in truncation of spheroidal harmonics series %spheroid geometry bx = 110; bz = 270; ...
f2bebce6f7eea785e6d23be567fb61600d915db92eb5f1f8dbc5033944e2f563
MATLAB
4,695
125
function openNetworkIO % Opens the network connection to the network IO device. % % Usage: openNetworkIO % % % Copyright: Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) % Contact: OTBR-Toolbox@ruhr-uni-bochum.de % Source Code: https://gitlab.ruhr-uni-bochum.de/ikn/OTBR % % Please cite the OTBR Toolbox wh...
2b6476c594098c6dcd11ee02246df69dab38e2cf20988636159d0d64d4f82002
MATLAB
4,697
111
% compile % % Builds the trigger counter for the network IO box (triggerCounter3.m) % into a standalone Windows program with the MATLAB Compiler. % % Run it in MATLAB, from any folder. Needs the MATLAB Compiler and % PsychToolbox; from the toolbox it needs the network functions of % IO\Interface7 only (openNetworkIO, b...
b0a13d09533ba8a15433a04e963c0609bd9202a23f7d40d292db014a9a5e9931
MATLAB
4,697
104
function bootstrap_decoding_peak_difference(subjects,analysis) %BOOTSTRAP_DECODING_PEAK_DIFFERENCE Calculate the confidence intervals of the difference between peak %latencies of categorization and distraction decoding. % %Input: subject IDs, analysis ('object_decoding' or 'category_decoding') % %Output: confidence int...
e41316ee66381f0f414e3e35239898b7bf4efa349afd12d40069f5ae864d26c8
MATLAB
4,697
136
%% Combined: load rerun (/data/Technion_analysis/zebrafish/zf_scratch_nocls_combined.m) close all clear all clc %% disp('zf_sc') direct='/data/Technion_analysis/zebrafish/sc_100410/comparative/COMBINED';% SLC17A6A % SLC32A1 cd(direct) load([direct,'/rerun.mat'],'data_orig_all','sample','geneid_all','cellid','all_flags...
2c4338b8c6e2807943b6b487be653f79f4927e8e1d7f4e959eb3868a59fded75
MATLAB
4,698
136
function [] = find_crf_ensemble(param) % parameters expt_name = param.expt_name; ee = param.ee; ge_type = param.ge_type; data_path = param.data_path; result_path_base = param.result_path_base; ccode_path = param.ccode_path; rwbmap = param.rwbmap; num_expt = length(expt_name); qnoise = 0.7; load(ccode_path); load(rwb...
cda280a492058076c8dddc915c1735714d03ec1bf2b61309909c73fc6b430730
MATLAB
4,705
124
%% Thomas_Yang_et al, 2023 @Nuo Li lab %% Fig. 7c selectivity of tagged glutamatergic neurons clear all close all addpath('../func') load Figure_7_c_data %% plot contra selectivity i_sel_unit = (sig_selective(:,1)==1 | sig_selective(:,2)==1); i_t = find(t(1,:)<-.1); figure; hold on psth1 = PSTH_yes_...
b499e3685c1a878b300a8979ee53719bd473630a96241db00e7a66965bfe18b5
MATLAB
4,706
154
function make_figure5(plotVariables, options) glmFlag = 'all_regressors'; % subject list subjectList = [16 18:21, 24, 26, 27, 28, 29, 31, 33, 34, 35, 42, 43, 47, 50, 51, 52, 54, 55, 57, 58]; %32 taken out %subjectList = [62:64,66,68,70]; % vertical motion only csdFlag = 0; % 1 for csd transformed data if csdFlag %...
ed95ec150e12bfd8a90d913144fd472f3d9cf14ac7da041938bc7baf8116fc66
MATLAB
4,707
176
function R = Rbuild(ctype, kappa, nbrs, beta, potential, delta, ... match_aspire, dist_power) %function R = Rbuild(ctype, kappa, nbrs, beta, potential, delta, ... % match_aspire, dist_power) % % build a regularization "object" for penalized-likelihood reconstruction. % % general form of nonquadratic penalty functio...
0cde754ba32ea676e81ed5ff1d3a8186c5f908a8dbb9f38421920f37bdf639fd
MATLAB
4,709
108
function cc = fun_cc_in_sparse_matrix(idx_list, mask_size) %#codegen % This function collect the connected components in a mask % The mask is specified by two inputs: % idx_list: N-by-1 double precision array. List of mask voxel indices % mask_size: size of the mask % Output: % cc: cell array, each contain...
5f9081386b1c6f951583b6b92bbd4eaf55feed8a2f8221278e3ba2f743b07915
MATLAB
4,711
101
function fn_plot_ts_errbr_sig(plot_info, data, var, sig, event, cond) % Plot mean time series with shaded error bars on given plot handle % INPUTS: % plot_info [struct] - contains general plotting details % .fig [figure handle] - handle of the figure where the plot should appear % .ax [axis handle] - hand...
81938317e5ff3b23c4a327219ab1be4747172b69959e7d63dfe62e1814af44d5
MATLAB
4,716
139
function x = spm_invGcdf(F,h,l,tol) % Inverse Cumulative Distribution Function (CDF) of Gamma distribution % FORMAT x = spm_invGcdf(p,h,l,tol) % % F - CDF (lower tail p-value) % h - Shape parameter (h>0) % l - Scale parameter (l>0) % x - Gamma ordinates at which CDF F(x)=F % tol - tolerance [default 10^-6] %___...
dfad79c276c31027af8b0ef91934d4937eeabba3454e68b3acbfa787195bc071
MATLAB
4,716
148
function [K,U,s] = splitclust(M) % Given a matrix M, split its columns into two subsets % % See Section 3 in % % Gillis, Kuang, Park, `Hierarchical Clustering of Hyperspectral Images % using Rank-Two Nonnegative Matrix Factorization', arXiv. % % % ****** Input ****** % M : m-by-n data matrix (or a H-by-L...
f840d826952332ae48c2fb0a5a137f9416379829c3612f5f064142cadbda2ef6
MATLAB
4,716
129
function analysis_04_sort_tf(study_info, varargin) % Parse optional arguments defaults=struct(); params=struct(varargin{:}); for f=fieldnames(defaults)', if ~isfield(params, f{1}) params.(f{1})=defaults.(f{1}); end end pipeline='NEARICA_behav'; exe_epoch_types={'EBM','LEXT','FTGE','EXGC','EXEND'}; obs...
e0697a8b29c2202e803b05f01eac8a7458f84046d33c4134e6fdc1d432253bd4
MATLAB
4,718
136
function [acc_rand] = RandomForest_HER_chance(set_avg, set_var, numrand, train1, train2, test1, test2, time_onset, time_offset) % This function performs a Random Forest classification using arbitrary % patients label. This function performs several classifications to obtain a % chance accuracy distribution for unbalanc...
07df1a2819b7c465297ebab0545fac71efdb7dfca72cb63221be5bb354c8c7c8
MATLAB
4,723
177
function R = Rbuild(ctype, kappa, nbrs, beta, potential, delta, ... match_aspire, dist_power) %function R = Rbuild(ctype, kappa, nbrs, beta, potential, delta, ... % match_aspire, dist_power) % % build a regularization "object" for penalized-likelihood reconstruction. % % general form of nonquadratic penalty functio...
e9b5a5a50dd7fe01290073673c2ad6ef9fe677f777c0525cb52c8aa37783e71d
MATLAB
4,724
137
function load_excel_file_proboscis_heads(files) % loads -csv files with the animal data in the following format: X, Y % coordinate of the following points in this order: % proboscis, head, thorax, proboscisbase, left antenna, right antenna, outline of the flower, pattern 1, pattern 2 % outline of the flower are 4 p...
3f91f71fcc745336de5bb66c2e396d577bbffdd4044ec7e85b4508ca35348b91
MATLAB
4,727
142
function [model] = spm_vb_models(SPM,factor) % Specify models for ANOVAs % FORMAT [model] = spm_vb_models(SPM,factor) % % SPM - SPM structure % factor - Structure specifying factors and levels % factor(i).name Name of ith factor % factor(i).levels Number of levels % ...
ff8235ee8084384e1bb291ae0a50baeb5f0cf24ce11c0afca07210149089f21a
MATLAB
4,730
169
function [Dice, Pval, Isubj]=wm_seg_dir_adf(dirname, th_pval) % For all the subjects in the directory "dirname": % Computes the Dice coefficients D=2Nab/Na+Nb % where: % Na is the volume of the WM obtained trough the volume-based labeling % Nb is the volume of the WM ...
a18c85f4b1b61897be0f68e8f8259f1e1673355879308bcd4098d72eb671be7a
MATLAB
4,735
116
close all; clear; clc; figX.fig = figure(); set(figX.fig, 'Units', 'pixels', 'Position', OSScreenSize([15 6]), 'NumberTitle', 'off'); figX.active(1) = axes('Position', [.04 .075 .175 .275]); figX.active(2) = axes('Position', [.04 .35 .175 .275]); figX.active(3) = axes('Position', [.04 .625 .175 .275]); figX.grasp(1) =...
23cc22d869ee5116b307461ff5d04d5eda79033408d356e044a1ffc037562c81
MATLAB
4,736
136
%% Analyzing Neural Time Series Data % Matlab code for Chapter 5 % Mike X Cohen % % This code accompanies the book, titled "Analyzing Neural Time Series Data" % (MIT Press). Using the code without following the book may lead to confusion, % incorrect data analyses, and misinterpretations of results. % Mike X Cohen ...
e722302d893d12743a51bbf6557294f4bcfff5c9347e253266f0c2c804b2b997
MATLAB
4,742
135
function [] = plotDistributions(self,stateDistBefore,stateDistEarly,stateDistLate,earlyNdx,lateNdx,nMin,fNum) % define basic paramters lims = []; % y limits to set (example: [0 1]) isPaired = 'N'; % equivalent to paired t-test circleSize = 60; % size of scatter pl...
71fbd1b7fb37021cd923053e0e1478cb30b078d3eff24d9148ddc0cd6c2cfa2e
MATLAB
4,743
143
function outSet = simHawkesNetDemo(ratefwd, parsMdl) % Simulate a linear Hawkes process with ring structure. % ratefwd is the firing rate in a time bin of the feedfoward input % This code is nearly all the same as simHawkesNet.m but outputs urec % Wen-Hao Zhang, % University of Pittsburgh % Feb 3, 2020 % Release hea...
17d97eb31c332aad062f65a308aaa928e54dfd98fc4fdb4f1c2cdd8e5798acdf
MATLAB
4,744
99
function link_info = fun_graph_get_free_link(vessel_graph, internal_offset, sortQ) % % % % % Note: % Link with two endpoints can appear in the list of link_info.ep1, because % one of the endpoint can be out of the internal_offset and therefore the % link effectively has only one internal endpoint if nargin < 2 in...
86022c49a2809b739ae76065b4f54cd6cbda5870a86c72fcab4712417571abcb
MATLAB
4,747
117
function cnd = cndReref(cnd,type) %CNDREREF Re-referencing of neural data (e.g., EEG) in CND format. % CND = CNDREREF(CND,TYPE) re-referencing of the neural data contained in % the variable CND. The re-referencing can be to one particular set of % external channels (e.g., 'Mastoids') or to the global average...
da1c5627022632f2437361832ed2627647356684f302ec584b3a51d04195c34b
MATLAB
4,750
159
function [W Wgx Wgy Wgz] = makeW(Bcell, Acell) %function [W Wgx Wgy Wgz] = makeW(Bcell, Acell) % % Create a Fatrix W operation of deformation based on rect basis % % in: % 'Bcell' array of cells of fatrix operation B for warping {x}{y}{z} % 'Acell' array of cells of warping coefficients Alpha {x}{y}{z} % % out: %...
3aab19f027ac802fb9de362afabc356514b84a0e046b9344dc4e6986cb14e3d3
MATLAB
4,751
121
function [Best_pos,Best_score,CHIO_curve]=CHIO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj) %¿ªÊ¼ÓÅ»¯ PopSize=SearchAgents_no; MaxAge = 100; C0 = 1; % number of solutions have corona virus Max_iter=Max_iteration; %/*The number of cycles for foraging {a stopping criteria}*/ Spreading...
4b8404ae960505105da88cbfafc6bb3284b47fc2e3d6c236f6c2a8b6cc246ff7
MATLAB
4,751
169
function varargout=shadedErrorBar_anna(x,y,errBar,lineProps,transparent,logscale) % slightly altered version of the original code https://de.mathworks.com/matlabcentral/fileexchange/26311-raacampbell-shadederrorbar % % Purpose % Makes a 2-d line plot with a pretty shaded error bar made % using patch. Error bar color i...
746b58d95da893cab98427c788d6ee4220cc75db53047883c447c2a040ab35c9
MATLAB
4,751
98
folder='/projectnb2/npbssmic/ns/Ann_7694/'; datapath=strcat(folder,'dist_corrected/'); % add subfunctions for the script. Change directory if not running on BU SCC addpath('/projectnb/npbssmic/s/Matlab_code/fitting_code'); addpath('/projectnb/npbssmic/s/Matlab_code/PostProcessing'); addpath('/projectnb/npbssmic/s/Matla...
82feac13265cf165e71135fb96c2c328127183023c8f8cc85d6969679610f152
MATLAB
4,753
117
function doPCA(matPath) addpath(genpath('/Volumes/groups/giocomo/export/data/Users/KMasuda/Neuropixels/MalcolmFxn/')); addpath(genpath('/Users/KeiMasuda/Documents/MATLAB/Add-Ons/Functions/gramm (complete data visualization toolbox, ggplot2_R-like)/code')); addpath(genpath('/Volumes/groups/giocomo/export/data/Projects/...
fafaf50673d6dfa7511fcc35db147f1572330dab30ee8dee67f681f2e03f4f9b
MATLAB
4,754
168
function [block] = spm_vb_glmar (Y,block) % Variational Bayes for GLM-AR modelling in a block of fMRI % FORMAT [block] = spm_vb_glmar (Y,block) % % Y - [T x N] time series with T time points, N voxels % % block - data structure containing the following fields: % % .X [T x k] the design matri...
05b0aee566be0018d885523dbd32c9fe30379df3a308f85ee6559620463f3043
MATLAB
4,757
133
if ~exist('conId_orig', 'var') clear conId patId participant_list_module_repo % re-laod the sample info (conId, patId) conId_orig = conId; patId_orig = patId; end distances_1 = []; distances_all = []; for iss = 1:length(id_log) if ismember(iss, [conId_orig patId_orig]) this_distance_mat...
29c207ab91426ae661d2937dc2da146fe8f720439d3157cdb08db652f7854398
MATLAB
4,757
133
optDesPath=genpath('/vxfsvol/home/research/dsnlab/matlab/CanlabCore/CanlabCore'); %scnPath=genpath('/Users/wem3/matlab/grimoire/SCN_Core_Support/'); addpath(optDesPath); clear Models, clear MM GA.conditions = [1 2 3 4 5 6]; %affect|neutral x equal|loss to share|loss to private % ...
ac534f64c611bf6467eeba40cbd4f89b19a226bea6cfa92eb1aeee917dc9eb94
MATLAB
4,757
145
%%% define variables for loading data, plotting & computing ITR values %%% fileName = "C:\Users\Anna\surfdrive\Marble\publication\testAccuracies.xlsx"; % accuracy matrix: nsubj x ntrials pathToViolinPlotFunc = "C:\Users\Anna\Downloads\brainAR-main"; chanceLev = 50; % chance-level value, in % % variables for ITR com...
3bba900d361ad793f6e7ac2cee11cd4740110adad8b0bff0347435b3777dafcf
MATLAB
4,761
159
function [y,w,S,Gu,Gn] = spm_csd_fmri_mtf(P,M,U) % Spectral response of a DCM (transfer function x noise spectrum) % FORMAT [y,w,S,Gu,Gn] = spm_csd_fmri_mtf(P,M,U) % % P - model parameters % M - model structure % U - model inputs (expects U.csd as complex cross spectra) % % y - y(nw,nn,nn} - cross-spectral density for ...
68ecb3ca856cf407336c287be18c1596a2f6a2014792f9f8094a9bf847f6c3bc
MATLAB
4,761
166
function [Cxx,Cxy,Cxz,folds] = mlscovmat(x,y,z,lags,type,zeropad,verbose) %MLSCOVMAT Covariance matrices for multisensory least squares estimation. % [CXX,CXY,CXZ] = MLSCOVMAT(X,Y,Z,LAGS) returns the covariance matrices % for multisensory least squares (MLS) estimation using time-lagged % features of X. X, Y and...
3df8e3ea29d3adc4fd2f5e8604ba506bd7f7fe058da5ab9feb81a43da1db5619
MATLAB
4,762
126
function [outOnsetSignal, outOnsetFreq] = IPEMCalcOnsetsFromANI(varargin) % Usage: % [outOnsetSignal,outOnsetFreq] = % IPEMCalcOnsetsFromANI(inANI,inANIFreq,inPlotFlag) % % Description: % This function calculates the onsets for a given signal represented by its % auditory nerve image, using an integra...
c6ec2478bee6dfbde59a91852641b57a42d56e2cc33fe6f819786e6afe093cd3
MATLAB
4,762
124
function launchJobs( exePathInFwHome, scriptPathOnFw, nodeMatlabName,... batchId, nTask, varargin ) % Launch a job on the FwGrid cluster % % Each node function must be defined as: % function fwNode( ind, batchId, savePath ) % and end with: % save( [ savePath batchId sprintf('-%05d',ind) ], 'var1' ); % exit % ...
f873457fcf5f32d754c63f9fdb242fc72e5e6b093fe2e50c1ed7263158358df8
MATLAB
4,765
105
% tSC_coupling_epprops_comp %Compar differnt electrophysiological properties of tSC coupled and not %coupled neurons from preprocessed porperty data. % Properties: firing rate, theta coupling, intra-burst spike % number, intra-burst frequency, burst-skip ratio, Inter spike interval histgorams, % speed correlation,...
82eb7b707b06682676a0efda4594e230809487a437568bc9f5aaeb76e8f86b96
MATLAB
4,768
123
function IPEMExportFigures(varargin) % Usage: % IPEMExportFigures(inInputPath,inOutputPath,inFormat,inUseIPEMLayout) % % Description: % Exports figures to specified graphics format. % % Input arguments: % inInputPath = path to scan for .fig files % if empty or not specified, the currently...
6665409e60e327bd0402647edd0a9e229f4a85085b243976f8b12e6189e66846
MATLAB
4,770
129
function Vi = spm_get_vc(I,factor) % Generate error covariance components for factorial designs % FORMAT Vi = spm_get_vc(I,factor) % I - n x m matrix of factor level indicators % I(n,i) is the level of factor i for observation n % factor(i) - structure array of sphericity assumptions for each factor...
f9dda6d02c44c5dff1cab08eabd5e8d7c4148fff996ff5249a4fe0dfd7a207df
MATLAB
4,770
197
function [pmf xs] = kde_pmf1(x, varargin) %|function [pmf xs] = kde_pmf1(x, varargin) %| %| Compute an empirical probability mass function (PMF) using interpolation %| that is similar to a kernel density estimate. %| This routine is useful for making PMFs (interpolated / smoothed) histograms %| for computing entropy ...
f5607c48378ba1a9361f379bc03c90e7e073abb67bb1c932f9e8d7c07db6fc06
MATLAB
4,771
120
%% Thomas_Yang_et al, 2023 @Nuo Li lab %% Fig. 1f, lick behavior, unilateral SC photoactivation clear all close all load Figure_1_f_data %% licking temporal histogram, all mice figure n_plot = 0; for i_aom = [0 0.1 0.3 0.4 0.5] for i_SC_side = 1:2 n_plot = n_plot+1; ...
e93d1ce907de7b9baeb32a77e5417a91e2cdf7cc43274553053f68504485b4e2
MATLAB
4,773
113
function SVM_artificial_vs_natural_decoding_PDM_full_experiment(subject,task) %SVM_ARTIFICIAL_VS_NATURAL_DECODING_PDM_FULL_EXPERIMENT Perform category decoding (artificial vs natural) using the SVM classifier. % %Input: subject ID, task (1=categorization, 2=fixation) % %Output: NxNxP vector of accuracies in %, where ...
35c479ff9fffa2ef8ce70f70bea1d18db516f1555a73b6dc0a9d11a5a8598c80
MATLAB
4,774
156
%% Curve fitting - estimate effective Reylaigh range and focus depth clear all; datapath = strcat('/projectnb/npbssmic/ns/190626_Thorlabs/2x/50um/'); % add subfunctions for the script addpath('/projectnb/npbssmic/s/Matlab_code/fitting_code/'); % get the directory of all image tiles cd(datapath); opts = optimset('Di...
338737ca6fd73714a4f7836c482a5875cd3a1040062979b2b6bd65ecd66e31b1
MATLAB
4,778
138
function IPEMSetup % Usage: % IPEMSetup % % Description: % This function sets up the Matlab environment for working with the % IPEM Toolbox. % % Example: % IPEMSetup; % % Authors: % Koen Tanghe - 20011204 % ------------------------------------------------------------------------------ % ------...
fc1b0045d06f74ccd4ff42ae56947ba1cbabfaca5b7bd778226a5d64adc382fa
MATLAB
4,782
90
% BAYESIAN DECODING ERROR WITHIN EXPOSURES % Looks at place cell remapping between different and same track exposures by calculating bayesian decoding error. % For each track exposure, calculates the decoding error using as template the other exposure to the same track. The template can be the whole session, first hal...
71ccbdf53d1ccd7e1722213163ac9abcef5189f4986940ddf084e521e285a5d9
MATLAB
4,788
132
function plot_RT_full_experiment(subjects,with_stats) %PLOT_RT_FULL_EXPERIMENT Create a scatterplot of reaction times. % %Returns a scatterplot of reaction times in the categorization task vs %reaction times in the distraction task, for each participant. %Different colours represent different participants and differen...
005eed076b53d01862528d7f2fb9112d083e4c2dd03b2d288dc108b68f8ba2e2
MATLAB
4,790
155
% The script is used to perform 8-way frequency-resolved decoding % on EEG data (theta and high-gamma bands) % add toolbox addpath('fieldtrip-20191213/'); addpath(genpath('CoSMoMVPA-v.1.1.0/')); addpath(genpath('libsvm-3.25/')); ft_defaults; %% frequency analysis % set input and output paths data_path = '../../eeg_d...
492770ed1e618312532597b3611675841ada1e2d631a342995287f09f64ad004
MATLAB
4,791
141
%% Curve fitting - estimate effective Reylaigh range and focus depth datapath = 'E:\Jiarui\Data\code\fitting_code\'; % add subfunctions for the script addpath('E:\Jiarui\Data\code\fitting_code'); % load('/projectnb/npbssmic/s/Matlab_code/Matlab_batch/Zf.mat'); % get the directory of all image tiles cd(datapath); fi...
4ae841fcf24aea533e1fd8f7737e81a5fb6913780872275a8151b60c0dfb6697
MATLAB
4,792
141
function [DCM] = spm_dcm_mdp(DCM) % MDP inversion using Variational Bayes % FORMAT [DCM] = spm_dcm_mdp(DCM) % % Expects: %-------------------------------------------------------------------------- % DCM.MDP % MDP structure specifying a generative model % DCM.field % parameter (field) names to optimise % DCM.U % c...
916b8f8b06797523a77aa5ac4fc400aea505c473a7acc7f289f527866664e486
MATLAB
4,796
209
% pwls_gca_test.m % Test 2d penalized weighted least-squares with nonquadratic penalty % % Copyright Mar 1999, Jeff Fessler, University of Michigan % generate data if ~isvar('xtrue'), printm 'xtrue' ig = image_geom('nx', 12, 'ny', 10, 'dx', 1); ig.mask = ig.circ > 0; xtrue = ig.circ(2); im plc 3 2 im(1, xtrue, 'x...
12cb95cb35b46cd3ac5a20bf1aca9f9cfe26b539767a6962d2a2bd29cfd2a733
MATLAB
4,797
167
function [Dnew]=spm_eeg_simulate_frominv(D,prefix,val,whitenoise,SNRdB,trialind) % Project a source inversion solution back out to the sensor level plus some noise % D - original dataset % prefix - prefix of new dataset % val - use solution (and lead fields) corresponding to this index % whitenoise ...
e630da0ce51b791bd5a81dc3cadcc2a398f47cf3af540f61e7ef706e5f4c1359
MATLAB
4,798
130
%% Thomas_Yang_et al, 2023 @Nuo Li lab %% Fig. 7b selectivity of tagged GABAergic neurons clear all close all addpath('../func') load Figure_7_b_data sig_selective = sig_selective_p<.01; %<------- user defined %% plot contra selectivity i_sel_unit = (sig_selective(:,1)==1 | sig_selective(:,2)==...
0ab180ff6a0f49c9c4868ffe289c2203a196922a87c0831514d3a77049fb4281
MATLAB
4,800
199
% xiayq @ 12/11/2022 % xiayq0121@zufe.edu.cn % refered to Z. Yao and Y. Xia, Manifold Fitting under Unbounded Noise, arXiv:1909.10228 clear; %clc % parameters for data D = 3; NumTrials = 20; tau = 1; sigma = 0.04;%0.04 % method setup algos = {'ours','cf18','km17'}; switch sigma case 0.09 r1 = 2*sqrt(s...
4aca734f51b9b74aa96a59450918950ed5bb76a7ce2a7830852309f7f6ea9157
MATLAB
4,800
102
%generating macro scripts to unwarp XY plane pathname='C:\Projects\serialsectioningOCT\Data\Griddistortion\test\macros\'; macropath=[pathname,'Macro.ijm']; z_step_size=3; macro_depth=20; z=10; fid_Macro = fopen(macropath, 'w'); file_path='C:\\Projects\\serialsectioningOCT\\Data\\Griddistortion\\test\\'; matrix_...
fcc881cd0126cca2a5540c4c72170a48956f6f324e31d606614c76a4c509f628
MATLAB
4,800
142
function [xCon,SPM] = spm_vb_logbf(SPM,XYZ,xCon,ic) % Compute and write log Bayes factor image % FORMAT [xCon,SPM] = spm_vb_logbf(SPM,XYZ,xCon,ic) % % SPM - SPM data structure % XYZ - voxel list % xCon - contrast info % ic - contrast number %__________________________________________________________________...
ad4db8d952ef75038cbce9c4e94083592b39220eaf7c3e8830858f399d5cdb99
MATLAB
4,803
108
%% Plot Figure 4a, EKG and imaging example traces %% Define Paths of Loading Files and Save Files currentFolder = mfilename('fullpath'); % determine the filepath based on where the script locates scriptFN = mfilename; filePath = erase(erase(currentFolder, scriptFN), strcat('scripts', filesep)); searchPath = strcat(fil...
2cd5032a7057665e6c98c7494194e17c616a142619a0d033c7cce840ce859dcd
MATLAB
4,804
168
% The script is used to perform EEG data perprocessing % To run this script, please first download the raw data from https://osf.io/57ryb/, % and put the data in /eeg_data/raw_data/ folder. % add fieldtrip addpath('fieldtrip-20191213/'); ft_defaults; % set input and output paths data_path = '../../eeg_data/...
5ce431a86132ce7acd15d6141780fb97c456e0a3be0014677723714f63964643
MATLAB
4,805
132
%% Thomas_Yang_et al, 2023 @Nuo Li lab %% Fig. 2e ALM selectivity map clear all close all addpath('../func/'); load Figure_2_e_data im_CCF = imread(['..\CCF_alignment\ARA_template\AllenRefVolCoronal_100275.tif']); im_CCF_anatomy = imread(['.\ALM2x_mergedRGB_slice300_cltr1247_P55_NL09.tif']); im_CCF_an...
a9f932c2cc82e15ca4adce24830674d63358d94773ace22043020b85727b3742
MATLAB
4,806
176
function st = nufft2_init(om, N1, N2, J1, J2, K1, K2, n_shift, useloop, alpha, beta) %function st = nufft2_init(om, N1, N2, J1, J2, K1, K2, n_shift, useloop, alpha, beta) % initialize structure for 2D NUFFT % particularly the interpolation matrix in sparse format % in: % om [M,2] frequencies in radians % N1,N2 imag...
49bc01b0fb1281529c80c485bcadf0f3c52b1c810f726a0840ea78f27b14626d
MATLAB
4,807
142
function [reg_corner,rho,eta,reg_param] = l_curve(U,sm,b,method,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,method,L,V) % % Plots the L-s...
c0a679130863d8305a8729463207a87acd8dfbbd5be667713e9cf9cd9bf38a36
MATLAB
4,807
161
% cfsWriteRL64c.m % an example of writing a cfs file for data as RL4, RL8 % must have CFS64c.dll in matlab path % calls matcfs64c.mexw64 % note: this is by far the easiest way to write from Matlab % stays in native format, not problems with Y scaling (or offset) % 20.02.09: JG Colebatch initial version % 24.0...
61b348a6a3a797942036e372f9312868af1d338924241996300887773d84d5ed
MATLAB
4,808
152
%% Analyzing Neural Time Series Data % Matlab code for Chapter 20 % Mike X Cohen % % This code accompanies the book, titled "Analyzing Neural Time Series Data" % (MIT Press). Using the code without following the book may lead to confusion, % incorrect data analyses, and misinterpretations of results. % Mike ...
6b3dc80656d91db0a09e1cff9ef360408e6661433db4124ae284bdd0a31b7101
MATLAB
4,808
199
% ir_test_sf1_sf2.m % % Compare versions of separable footprint (sf1, sf2, sf3) % for the case of large voxels and small rays. % % In this case, SF1 (ray-dependent scaling) is better than SF2, % except in one region!? % % Copyright 2017-02-01, Jeff Fessler, University of Michigan %% small system if ~isvar('cg'), prin...
57022f90fb51b885953926f90c34358bd0d597b33a2c622ccb05d2e5702780bf
MATLAB
4,814
137
function plot_RT_rnn_vs_human(model_type) %PLOT_RT_RNN_VS_HUMAN Create a scatterplot of reaction times. % %Returns a scatterplot of human reaction times in the categorization task vs %RNN reaction times. % %Input: model_type ('b', b_d' or 'bl') % %Author: Agnessa Karapetian, 2021 % %% Add paths addpath(genpath('/home...
58dfae76ea6e45f9028aeccadfd66ee8dd84d97eb4de46e47d754b07b8b7edd5
MATLAB
4,821
105
% Sets the default values for the FieldMap toolbox % % FORMAT pm_defaults % %__________________________________________________________________________ % % This file is intended for site and/or scanner and/or % sequence-specific customisations. %__________________________________________________________________________...
4d45b224a805a82b7c179bfd3afbca181be54e85307f82572a7982cb74d90474
MATLAB
4,826
160
% This function simulates a virtual injection and calculates how % large the resulting projection zone is % function [TZspreadInj,nRGCLabeled,nSCLabeled] = ... calculateTerminationZoneSizeInjection(obj,nRep,percentile,plotFlag) debugFigures = false; %true; nRGCLabeled = zeros(nRep,1); nSCLabeled = zeros(n...
4827e20193b0b5a58e9cbad05c3bc04918ebe79878ec088599d266b4a97e3a93
MATLAB
4,832
107
function pearson_object_decoding_full_experiment_sl(subject,task) %PEARSON_OBJECT_DECODING_FULL_EXPERIMENT Perform object decoding (average of pairwise object decoding) using 1-Pearson's correlation. % %Input: subject ID, task (1=categorization, 2=fixation) % %Output: NxNxP vector of correlations, where N is the number...
2a8c3ed5e55c5ad765865f822ff4e5a36bc4e3055e383d3d54d2310f6f0ce3ee
MATLAB
4,833
168
function img = easyhelix(cg, ig, proj, varargin) %| %| FBP reconstruction of cone-beam tomography data collected with %| a circular source trajectory. %| See feldkamp_example.m for example. %| %| in %| cg ct_geom() %| ig image_geom() %| proj [ns nt na] cone-beam projection views (line integrals) %| %| %| out %| i...
208e7bfaa735e0412cf24c2942eaa47aac6682ac4b15118bacb749ca87711496
MATLAB
4,840
103
%% IR66 Processing Variables [root_dir, app_dir] = fn_get_root_dir(); ft_dir = [app_dir 'fieldtrip/']; if isempty(strfind(path,'fieldtrip')); addpath(ft_dir); ft_defaults; end %-------------------------------------- % Basics %-------------------------------------- SBJ_vars.SBJ = 'IR66'; SBJ_vars.raw_file = {'...
eae8cae028bb8ca309bfda23f0212d425887a5b8b342c7e8d09aea1246d5a55c
MATLAB
4,842
99
function link_info = fun_graph_get_free_link(vessel_graph, internal_offset, sortQ) % % % % % Note: % Link with two endpoints can appear in the list of link_info.ep1, because % one of the endpoint can be out of the internal_offset and therefore the % link effectively has only one internal endpoint if nargin <...
1db0502319570b113024d7baf520421a254330b76c213b105e6888cfeaaef98d
MATLAB
4,844
147
function[]=ref_vol_stitch_high_res(id,datapath) % mosaic parameters Xsize=1000; Ysize=1000; Xoverlap=0.15; Yoverlap=0.15; % add path of functions addpath('/projectnb/npbssmic/s/Matlab_code/PSOCT_code'); addpath('/projectnb/npbssmic/s/Matlab_code/ThorOCT_code'); addpath('/projectnb/npbssmic/s/Matlab_code/NIfTI_2014012...
3bf48a2b2279bd8ca47330ef501871d861d7fd24e65a433a9f0f22859ff5a66e
MATLAB
4,845
103
function for_stats = all_subjects_for_stats(subjects,task,analysis) %ALL_SUBJECTS_FOR_STATS Gather the subject x time matrices needed to perform cluster-based permutation tests. % %Input: subject IDs, task (1=categorization,2=distraction), analysis %('object_decoding', 'category_decoding', 'time_object_decoding', 'time...
cb43588883db39a851ea3076f59e7332e2db50388b78d31b2a494a6413f5d37d
MATLAB
4,846
189
%% mri_pixel_size_example.m %| %| Show the effects of small pixels on iterative reconstruction for MRI. %| (Diminishing returns as number of pixels increase for quadratic reg.) %| %| Copyright 2003-7-23, Jeff Fessler, University of Michigan %| create k-space samples, in units of 1/mm if ~isvar('kspace'), printm 'setup...
061130f7b5dd7f87cb43e0f2ad6731b044e16eb87ca0fb8e31c8275965358d80
MATLAB
4,849
140
function img = feldkamp_helix(cg, ig, proj, varargin) %|function img = feldkamp_helix(cg, ig, proj, varargin) %| %| FBP reconstruction of cone-beam tomography data collected with %| a circular and ''helical'' source trajectory. %| See ir_fdk_helix_example.m for example. %| %| in %| cg ct_geom() %| ig image_geom()...
20eaaae89283db36f4829c46f66334d22dc399f285dabc53653033d9a50c806d
MATLAB
4,856
173
function out = cfg_justify(varargin) % CFG_JUSTIFY Justifies a text string % OUT = CFG_JUSTIFY(N,TXT) justifies text string TXT to % the length specified by N. % % OUT = CFG_JUSTIFY(OBJ,TXT), where OBJ is a handle to a 'listbox' style % uicontrol, justifies text string TXT to the width of the OBJ in % ch...
9cf07d11111eba239b44f56d6589a33d725661bec89e482d3ee5dbafea0d89b4
MATLAB
4,857
133
clear; clc; subjectID = 'P3'; sessionDate = 20230831; stimElectrode = [2:30, 32:61, 63,64]; motorChannel = [1:64, 97:192, 225:256]; %[177, 236, 237, 253, 255]; freqId = 100; sortedSpikes = 0; saveData = 1; plotFigures = 0; % Permutation Params alpha = 0.001; numReps = 1000; numDraws = 20; % Baseline Folds numFolds =...
f62c2ab5b624b87f7cffdbf996dabedc6f7c898b8f35d9e0c34699850faafabe
MATLAB
4,859
135
function glm_eeg_rnn_rt(conditions) %GLM_EEG_RNN_RT Perform the GLM analysis to determine how much variance in %human RT is explained by EEG data and rCNN RTs. % %Input: conditions ('artificial','natural' or 'both') % %Output: results from the GLM analysis. % %Performs the GLM analysis on the selected scenes, using EE...
0a28d06474ef5c5733d2ecf974cd8170bd1deb855011b7587a0d7e804bf22fd6
MATLAB
4,867
156
function [Dsubj, nf, r, thdemean, M] = surf_registration_stats(dirname, arg2, arg3) % % surf_registration_stats.m % % Original Author: Laurence Wastiaux % CVS Revision Info: % $Author: nicks $ % $Date: 2007/01/10 22:55:10 $ % $Revision: 1.2 $ % % Copyright (C) 2002-2007, % The General Hospital Corporation (B...
602fdf4c351fe69c4f199b1142406f74eca07020806a8b4dc4272b66ed19e921
MATLAB
4,867
205
% pwls_sps_os_test.m % Test 2d PWLS-SPS-OS with nonquadratic penalty % % Copyright 2002-2-13, Jeff Fessler, University of Michigan % generate data if ~isvar('yi'), printm 'generating data for pwls_sps_os_test' f.dir = test_dir; f.wtf = [f.dir 't.wtf']; f.yi = [f.dir 'yi.fld']; f.wi = [f.dir 'wi.fld']; f.wtr = str...
1dc0161633a8a0002487e2b6e3c5ad3de39160fdc92f183ea00076cbaaa1060a
MATLAB
4,878
86
%% Run this files to compute the network-human main effect and interactions for all for the VISION experiments %% Must specify the paths to the required network data mat files. function [] = run_anova_stats_matlab_network_human_results(EXP_NUM) rng(517) addpath('../matlab_statistics_functions') NUM_BOOTSTRAPS = 1000...
5155f6dd5bacc2e841449a40b7f57d64a8551851c46393ea3d4e8687eb950605
MATLAB
4,879
120
function [outWidth,outWidthFreq] = IPEMCalcCentroidWidth (varargin) % Usage: % [outWidth,outWidthFreq] = % IPEMCalcCentroidWidth(inWeights,inWeightFreq, % inFrameWidth,inFrameInterval, % inDistances,inCentroid, % inPlotFlag) % %...
a567c600ee3bc043c3b1d3a23d25da35646a0bb5bea139e08070264a1cb800da
MATLAB
4,879
164
function [y]=check_ROI(SubjectDir,th_pval) % % For one subject: check if the size of 20 ROIs is within the normal range % The 20 following ROIs are checked: Left-Lateral-Ventricle Right-Lateral-Ventricle % Left-Hippocampus Right-Hippocampus Left-Thalamus-Proper Right-Thalamus-Proper % Left-Caudate Right-Cauda...
9524fd329ca3ec1bbfb7740217f659bd87e08c4424f780e08d65e17d0ecbfd5f
MATLAB
4,880
157
function [edofimg, varargout] = fstack(img,varargin) %FSTACK merging images of mutiple focal planes into one in-focus image. % % edofimg = fstack(img) merges img, an img array containing grayscale or % color images acquired at mutiple focal distance, into one all-in-focus % image. % % edofimg = fstack(img, option...
fa02070df21ce4eee812ed800fcf120deda522fd44dc094af31124aaf1a5fd82
MATLAB
4,881
173
function [peaks indices] = maxPeaksCircDist(x, dist, varargin) %MAXPEAKSCIRCDIST Find the maximum peaks in a circular vector. The peaks %are separated by, at least, the given distance. % % [PEAKS INDICES] = MAXPEAKSCIRCDIST(X, DIST) % % [PEAKS INDICES] = MAXPEAKSCIRCDIST(X, DIST, CHAINCODELENGTHS) % % Inputs: % ...
648cca7b72fcf7778e1e2044b3684a97c68cb6dc1ae01dac6ba1b74d05f4303c
MATLAB
4,882
173
function [peaks indices] = minPeaksCircDist(x, dist, varargin) %MINPEAKSCIRCDIST Find the minimum peaks in a circular vector. The peaks %are separated by, at least, the given distance. % % [PEAKS INDICES] = MINPEAKSCIRCDIST(X, DIST) % % [PEAKS INDICES] = MINPEAKSCIRCDIST(X, DIST, CHAINCODELENGTHS) % % Inputs: % ...
b04f2172a3da3cb0ff8b1edae490e21314bd499cd24d28f87afc31c35bf5a2b7
MATLAB
4,882
128
%this script reads the tracking points from DeepLabCut, which are packaged %in an .h5 file, and extracts the x/y positions of the points, as well as %their labels, to feed them into a .csv file which we can further process %with the Hedrick's Lab's dltv tracking software for post processing clear all close all ...