sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c7c2dcebdf1abd3d9e5c18d59822300f94db21d2e1a1e3e9d34c765974bf1a4e
MATLAB
4,468
186
% 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 NumTrials = 20; tau = 1; sigma = 0.01; %0.01 D = 2; switch sigma case 0.06 r1 = 1.6*sqrt(sigma); r2 = 1.8*sqrt(sigma); ...
3d0b5103f440280ffca8c799c25f98f49d7721b0eca3b78a9088c192a3d79768
MATLAB
4,470
162
function [A,C] = FEM(surf) % %function [A C] = FEM(surf) % % Performs the finite element method (FEM) on a surface % and computes A and C matrices. % % surf is a given as the default MATLAB surface mesh format % A, C are sparse matrices. See references [1]-[3] for the definition of % matrices and how they are mathemat...
4599a7986659305893690621bc88636c6b5095327cb9831f408ce4433352cc98
MATLAB
4,471
142
function M1 = spm_eeg_inv_datareg(S) % Co-registration of two sets of fiducials according to sets of % corresponding points and (optionally) headshapes. % rigid co-registration % 1: fiducials based (3 landmarks: nasion, left ear, right ear) % 2: surface matching between sensor mesh and headshape % ...
70d6551bcdd96352cb10bd17a3add1ca4a04b6c9fab4c35c9201ea7052a90ca1
MATLAB
4,480
125
function out = bIO(varargin) % Use this function to read or write data to the network io device % % bIO(inputNumber) returns the status of the selected input % bIO(outputNumber, status) sets the selected output to either 1 or 2 % bIO([], [], event) sets a 9 bit event to the IO device (only for CED 1401 hardware) % bIO ...
5ed596140b4d2f4c2776f59db4ffb8523cb8b01f8f462c02cc18d6e09ea19559
MATLAB
4,482
139
%%% Motor Task % Authors: Esra Al & Tilman Stephani, September 2019 fclose all; close all; cd D:\USER\Esra addpath('D:\USER\Tilman\Other_toolboxes\Palamedes\Palamedes'); rand('state', sum(100*clock)); %% parameters % Duration t_resting_state_minutes = 3; % minutes t_resting_state = t_resting_state_minute...
a26cbaa036f85389f2388c3d71c271968ba9f331de6c0ab79cc7a00be41f936a
MATLAB
4,483
87
function gap_linking_str = fun_graph_connect_gap_ep2skl(vessel_image, vessel_mask, vessel_skl, ep_1_sub, ep_all_sub) % fun_graph_connect_gap_ep2skl search the shortest path betwwen the % endpoint and the skeleton within the masked found by threshold % relaxation. % Input: % vessel_image: 3D numercal array, image % ...
2b9eddfdb4991a616cb54a712239cc4cebe2fb1da8e3c6d109a5fe17cd008bb9
MATLAB
4,489
96
plotVariables.conditions = {'frequent', 'rare', 'short', 'long'}; plotVariables.originalConditions ={ 'short & frequent', 'long & frequent', 'short & rare', 'long & rare'}; plotVariables.diffWavesLabels = {'frequent - rare', 'short - long'}; %% plotVariables.figure1.paperSize = [200 100]; plotVariables.figure1.posit...
09051cc670a66cafd2f02bf89037496fb816d157246dc2661bf2bc541aef6b67
MATLAB
4,492
198
function [coef codes] = ir_odwt1(x, varargin) %function [coef codes] = ir_odwt1(x, varargin) %| %| 1D orthonormal discrete wavelet transform (ODWT) of (each column of) x %| %| in %| x [N L] L signals of length N %| %| option %| 'level' int default: 1 %| 'wname' char default: 'haar' %| 'ortho' 0|1 default: 1 %| 'adj' 0...
d034a91ab888d47c75748b1283357319f41415a56fdfd9e6462e50ec690d9578
MATLAB
4,492
132
function [img, proj_out] = feldkamp(cg, ig, proj, varargin) %function [img, proj_out] = feldkamp(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 [...
308726bb7f18dfdf3a73ca2389d2abaa87d3947b886ed491c5adb180c3458411
MATLAB
4,495
113
%% load data % load('../data/simulations/RhoFitVTrue.mat'); %% Seeting up Data % Rho_N,Rho_D rhoBoot = fitParametersBoot(:,:,13:14); rhoFit = fitParametersAll(:,13:14); rhoTrue = trueParameters(:,13:14); medCorr = abs(median(allCorr,2,'omitnan')); [nPairs,nBoots,~] = size(rhoBoot); rhoBootCI = prctile(rhoBoot,[5,95...
7675600997a951e7776ccd873ed9a6307ec670f621d1119c351a6febfd4afdd2
MATLAB
4,495
97
folder='/projectnb2/npbssmic/ns/Ann_7688/'; 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...
a454ff57a55a706c88a6361a369c788425d44a6f6938fa642cf983feec39f30c
MATLAB
4,496
145
function c_plot_setEqualAxes(varargin) % c_plot_setEqualAxes - set axis limits equal across multiple plots % By default, this included color scales, and also links the axes so that changes to one plot % affect all linked plots % % Example: % figure; % h1 = c_subplot(1,2); % plot(rand(10,2)); % h2 = c_subplot(2,2);...
4dadffd65865b34287b4f552ae6564193f840274e589c56940e3f1eb5300362a
MATLAB
4,506
152
%% Imports addpath(genpath('../libraries/phastimate')); addpath('../libraries/neurone_tools_for_matlab_1.1.3.11_mod'); addpath(genpath('../src')); %% lowColor = [20, 0, 255] / 255; highColor = [1, 0, 0]; gold = [255, 179, 0] / 255; alpha = 0.5; dlDir = fullfile(getenv('USERPROFILE'), 'Downloads'); OUT_ = dlDir; IN ...
58c78f79daa8881733945e31017490bc1fc28d395cc035012db9b499a7a2349f
MATLAB
4,506
129
function [] = linearFilterStateKinematics(gen,meta) close all if ~exist(strcat(string(meta.plotFold),'/LinearFilterAnalysis/'), 'dir') mkdir(strcat(string(meta.plotFold),'/LinearFilterAnalysis/')); end psFileName = strcat(string(meta.plotFold),'/LinearFilterAnalysis/LinearFilterStateKinematics.ps'); pdfFileName = ...
597d6ad91f27e4b97621f27ddbc575fa87e8c03f18a844b724d41443564ebcd9
MATLAB
4,508
102
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/JohnKei_NPH3/Uni...
54215b7f7c1b6ec098bc4319c7bdba8b6d47df8ef311e8f0033d6526ce7f2cec
MATLAB
4,511
141
function plot_topography_searchlight (varargin) %Author: Siying Xie (2022) % default obj = 'ctg'; % popu = 'ift'; chan = 'whol23c'; % meas = 'lda'; % custom setting % for i = 1:2:length(varargin) % param = varargin{i}; % value = varargin{i+1}; % if ~ischar(param) % error('Flag arguments must be st...
7ed49b2d6c53fe59e69829c693baadf032cb25d59fa27ce8fdf2755a1b240477
MATLAB
4,511
115
function plot_decoding_full_experiment(subjects,task,analysis) %PLOT_DECODING_FULL_EXPERIMENT Plot the results from decoding, averaged over %all participants and subject-specific. % %Input: subject IDs, task (1=categorization,2=distraction), analysis %('object_decoding' or 'category_decoding') % %Output: curve of decod...
aa737c07247c6ae962ecadb9665a1a076606d0c31f4bec9d935452394167be3f
MATLAB
4,512
157
function [proba, pinf]=talmat(filename, th_pval, DirTable) % % Computes the probability of the Talairach transform matrix % 'filename/mri/transforms/talairach.xfm'. % Uses the mean vector and covariance matrix obtained with talairachin_table.m from % the data set (default data set: /space/neo/2/recon/buck...
ff0a216a15f4aaaba6057785b85b1c9ee86fcedb1412dc961d4879959b0b2da5
MATLAB
4,516
99
glmFlag = 'all_regressors'; doReg = false; %apply regularisation? lambda = 17.6; %4 * value used in Gonclaves et al 2014 (as our regularisation matrix is same as theirs, divided by 4) vertical = 0; options = continuous_RDK_set_options('LTHiMac'); % load all_responses,stim_streams, mean_stim_streams load_name = fullfile...
6313e14c6562b77be9186950e1cbc00fbc532ae6a1655e5f13f908d36beb195d
MATLAB
4,519
133
function outSet = simHawkesNet(ratefwd, parsMdl) % Simulate a linear Hawkes process with ring structure. % ratefwd is the firing rate in a time bin of the feedfoward input % Wen-Hao Zhang, % University of Pittsburgh % July 2, 2019 % Release heavily used parameters from parsMdl Ne = parsMdl.Ne; Ni = parsMdl....
54c07bd23109f4e7354719c324afdabf66187702f0afe60ea07f561ce38bf5b5
MATLAB
4,521
120
function makeSummaryFig(SUMMARY_STRUCT,EXIT_STRUCT,POKE_STRUCT,stat_int,titlestr) %makeSummaryFig.m This function generates a summary figure from a %summary_struct close all; figure(); timenow = datestr(now,'mm_dd_yy'); tracklen = stat_int(2)-stat_int(1); OK_frames_inlawn = SUMMARY_STRUCT.OK_FRAMES_IN_LAWN; timevec = ...
2f82db11b647895252b1e94a4f55541280b40f0c0d935f125196e580eecfc24b
MATLAB
4,522
101
cd('X:\BendorLab\Drobo\Lab Members\Marta\Analysis\HIPP\P-ORA\P-ORA_Day5_16x8\Bayesian controls\One track norm_track good cells') load('significant_replay_events_wcorr.mat'); load('extracted_place_fields_BAYESIAN.mat'); load('decoded_replay_events.mat'); one_track = significant_replay_events; one_track_place_cells = pl...
3739cb6fc352f6c827c3f0306b4265f65d32792b8edacda5f1cfd1b8beb9847c
MATLAB
4,522
151
function analyze_behavior_Fig1_Fig3_Sfig1 rootdir = 'C:\TKlab_agingPFC\'; cd(rootdir) load Learning_values figure( ... 'Position', [0 100 1000 1200 ], ... 'PaperOrientation', 'landscape', ... 'PaperUnit', 'inches', ... 'PaperPositi...
3cfc6718463c2a51a567a36c5a89fa8de35f2592ec4735ffd95b14f2bba36bf2
MATLAB
4,523
162
function [D, Isubj]=pons_cut_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 Cerebellum obtrained trough the volume-based labeling % Nb is the volume "filled" ...
0ce3520f9437d6b03c2cf83209aed27dac7acf886eedd471901e1ee2ea3bd6df
MATLAB
4,527
135
%MATLAB code to define peaks and troughs from waves in data from %optogenetic stimulation of myofibers. %Created by David Hardman, Usher Institute, University of Edinburgh clear; prompt = {'Input Filename:','Time Frame Length (s):','Pixel Width (um):','No. Rows;', 'Local max/min separation (Frames):','Output Filena...
8a804a7e007ffede27ee736d3e14130df22f9825b5ca44357c0071be1446fb15
MATLAB
4,532
142
function rnn_dth_all_layers(with_stats) %RNN_DTH_ALL_LAYERS Performs distance-to-hyperplane using %the distances-to-hyperplane using RNN dats. Plots all layers. % %Input: with stats (1 or 0) % %Saves the plot and correlation values. % %Author: Agnessa Karapetian, 2021 %% Add paths addpath(genpath('/home/agnek95/SMST/...
6556f48a9c9b6ffbd408aff66766195a54c9857883106f178375787555c43c4e
MATLAB
4,533
130
function out = BO_IIS_Detect_Power_Rolston_v5(data,S_thresh,Fs,winW,plot_flag) %adjusted version of John Rolston's (Rolston 2010 Epilepsia) interictal spike detection algorithm: %now incorporates MATLAB's findpeaks function with a heuristic about spike %frequency to improve robustness and avoid over-detecting tiny spi...
c131ca25d754437967c2739757c9a538e6735f6c57813ce1b21e92595572b895
MATLAB
4,543
131
function Ch1_place_field_stability_example_figure load('X:\BendorLab\Drobo\Lab Members\Marta\Analysis\HIPP\Q-BLU\Q-BLU_Day8_16x8\extracted_lap_place_fields.mat') load('X:\BendorLab\Drobo\Lab Members\Marta\Analysis\HIPP\Q-BLU\Q-BLU_Day8_16x8\extracted_position.mat') figure; c=1; t = 3; y_vector=[]; col = parula(lengt...
0abd4f8e0da55858e19f7bec15d654ba1d9be00581cb3f7ca0e28653a5b58acd
MATLAB
4,545
149
function [RGB] = fn_roi2color(roi) %% Returns the RGB color code to plot a given ROI % INPUTS: % roi [str or cell] - name (or list of names) of the ROI % can be specific or general (e.g., DLPFC or LPFC) % OUTPUTS: % RGB [3 floats] - RGB for this ROI % % Values taken from: https://www.w3schools.com/colors/colo...
da94ab075344a501fd7d3364f3b59f91ac9a6ec73428ed9a629d31a90ffe7dc7
MATLAB
4,546
188
function [xs, info] = ir_inpaint_admm1(yi, samp, varargin) %function [xs, info] = ir_inpaint_admm1(yi, samp, varargin) %| %| Image in-painting by cost function %| cost(x) = 1/2 | y - diag(samp) x |_2^2 + beta * pot(C x) %| minimized via ADMM algorithm (cf split Bregman) with v = C x split. %| %| in %| yi [(N)] image ...
3b6e89356b330d8de43629ea4a8c05219884977b5fa059ae356e919435f7d70a
MATLAB
4,548
177
function [fw, angle, rad] = fwhm2(psf, varargin) %|function [fw, angle, rad] = fwhm2(psf, [options]) %| %| compute 2d fwhm of point-spread function using contourc() %| %| in %| psf [nx ny] 2D psf image %| %| option %| 'dx' pixel size (default 1) %| 'dy' pixel size (default dx) %| 'level' default 0.5 (for "half" ma...
8ac33c9d38eebcd44a9f89f7473208661a87bcd4388d95eafdebd0f35244ee01
MATLAB
4,548
95
function [ieegStructAll, phonemeTrialAll, channelNameAll] = poolChannelWithMinTrial(ieegHGStruct, trialInfoStruct) % Combines channels with minimum trials for a specific token across subjects. % % Arguments: % - ieegHGStruct: Array of structures containing ephys data for each subject. % - trialInfoS...
440b33d3ae3c267c668b6406bc260993c806b1abbc47c1dd575b0ae61458bfd5
MATLAB
4,550
122
function neuron_spectra(mainPath, animal, session, ch, isstim, neuron_n) %NEURON_SPECTRA Spectral analysis of spike trian data % NEURON_SPECTRA(MAINPATH, ANIMAL, SESSION, CH, ISSTIM, NEURON_N) % transforms spike train data to a pseudo-continous signal, and computes % the Furier spectrum, the burst triggered a...
461f19ddd799759d94d80f0e0c32f0299629c64398f1ea08276da2ba9df2f99e
MATLAB
4,556
117
%% Thomas_Yang_et al, 2023 @Nuo Li lab %% Fig. 5d norm. FR, SC photoactivation, contra ALM record clear all close all addpath('../func/') load Figure_5_d_data sig_selective(isnan(sig_selective))=0; FR_pref = spk_count_yes_screen-spk_count_no_screen; i_selective = (sig_selective(:,2)) & cellType_...
1a52309b8fc49a7645fcc079ccd6d97d29a804364766fe78634a42a46c028a91
MATLAB
4,557
119
function [ filteredData ] = knnFilter_window( classificationResult, guideImage, lambda, knn ) % KNNFILTER_WINDOW Applies a k-Nearest Neighbors (kNN) filter to enhance an image. % filteredData = KNNFILTER_WINDOW(classificationResult, guideImage, lambda, knn) % % INPUTS: % classificationResult - The probab...
5283caf8e04b56f489b615524a85318c7b99321cf6a874b6d3bea8d426226bb6
MATLAB
4,557
154
% h = myscatter(x,y,scale,color,[ncolors],[cm],['filled'],marker,...) % % MYSCATTER Scatter/bubble plot. % MYSCATTER(X,Y,S,C) displays colored circles at the locations specified % by the vectors X and Y (which must be the same size). This function % is similar to the SCATTER function. Instead of plotting ...
f0b0aa823a296e4e8f7a8464025614d8468600665b0f7cc4cee43fa29b4d08a6
MATLAB
4,558
171
function [xs, info] = pl_pcg_qs_ls(x, A, data, dercurv, R, varargin) %|function [xs, info] = pl_pcg_qs_ls(x, A, data, dercurv, R, varargin) %| %| Unconstrained generic penalized-likelihood minimization, %| for arbitrary negative log-likelihood with convex non-quadratic penalty, %| via preconditioned conjugate gradien...
4a4d5e83491886e108236b698bd97b2f77cd85bb93cf5fdf2bc53a1771537a72
MATLAB
4,559
116
clc; clear; fprintf('\nProgram started\n'); % Much of program is copied from seizures.m %filename = '6well speakers-Trial 20'; filename = 'Raw data-Acquisition 2013 SAHA habituation retracking carolina-Trial 67'; %% Read data velArray = []; for(iTad=1:6) % a = xlsread(['C:\Users\AizenmanLab\Docum...
7d70dcf8a6bfcc00ba19b0661c27a9dd255515dad1732dcf8f17a737ecabd970
MATLAB
4,560
96
function [] = BackGroundSubtraction() addpath([pwd '\matlab']); addpath([pwd '\util']); clear s=dir('Videos/*video.ufmf'); filelist={s.name}; for i = 1:length(filelist) filename = filelist{i}; [readframe,frames,~,headerinfo] = get_readframe_fcn(filename); % create background newvidname...
12c3344f40c88c82b9e7e7dfe7bfd694317656c911dc20df963e5334b8e7eccc
MATLAB
4,561
183
% This shows all synapses! % For example: RGCX = RGCnt, SCY = SCap, nBins = 100 % % SCrange allows us to limit the part of SC included in analysis % % axisRange = [1/3 2/3], uses middle third of retina function plotAxisMap(obj, axisDir, nBins, axisRange, colorbarFlag, plotFlag) disp('plotAxisMap deprecated, please ...
e83854f6a22d73a38056d786bf260e3189bf732dce02137ac774d2c7f8bb02d5
MATLAB
4,561
85
% CELL CLASSIFICATION PER TRACK % MH, 05.2020 % Classify cells in: % Unique cells in each track % Common cells between exposures % Cells that remap between exposures % Cell that global and rate remap between tracks (both during first and second exposure) function cell_class = cell_classification(comput...
557261f0262810327f27ab6c0cc807c558c0601c4eba474c3583d200008d16bf
MATLAB
4,565
172
function preview_data(pre,post,index) % pre=0.5; % post=1.5; data_pre_trigger = pre;%sec data_post_trigger = post;%sec bin_size = 0.01;% sec 0.01 % bin_size = 1;% for 1min stim path = uigetdir; cd(path); disp(path); filenames = dir(); num_prefile = filenames(3).name(1:3); if exist('data_trigger.mat','file')==0 ...
6c61aaca70391a5936a12a637394013f2ccd6a1b5e0c677cb686afbb49ed8e35
MATLAB
4,567
163
function fig3B(analDir,rrmDir,tsDir,figDir) % function Fig3b(analDir,rrmDir,tsDir,figDir) % % plot Fig3b: Movement Index and Attention Index for each unit % save figure as *fig and pdf % % input: % analDir path to directory of results for model-free analysis % rrmDir path to directory of preprocessed data ...
04c001ceebf9ec3a9534fb90321e01d9b5c77845e062b49996cdbc0bd39e4341
MATLAB
4,568
142
function [outMean,outVariance,outFreq] = IPEMCalcMeanAndVariance (varargin) % Usage: % [outMean,outVariance,outFreq] = % IPEMCalcMeanAndVariance(inSignal,inSampleFreq, % inFrameWidth,inFrameInterval, % inPlotFlag,inPlotTitle) % % Description: % Ca...
f485f761cf1aeaecc26058f2ba393569d8b68ed1c251564fee1ad315ef533910
MATLAB
4,568
183
% This experiment does a set of injections, to determine the % mapping from retina to SC, NT to AP, or DV to ML. % % Retina -> SC function fig = virtualInjectionMappingExperiment(obj,axisDir) nInj = 10; x = linspace(0,1,nInj) + 0.1*rand(1,nInj); x = min(max(x,0),1); switch(axisDir) case {'AP','ap','...
0b3e7949e6bd936263af75ad7726eb307589e36afca6fa0eed763a5177d51881
MATLAB
4,569
87
function gap_linking_str = fun_graph_connect_gap_ep2skl(vessel_image, vessel_mask, vessel_skl, ep_1_sub, ep_all_sub) % fun_graph_connect_gap_ep2skl search the shortest path betwwen the % endpoint and the skeleton within the masked found by threshold % relaxation. % Input: % vessel_image: 3D numercal array, imag...
5489e61a120a27471495444abe21e37e63738b080500fb4774ada85137cbfc90
MATLAB
4,570
165
function spm_DEM_qP(qP,pP) % reports on conditional estimates of parameters % FORMAT spm_DEM_qP(qP,pP) % % qP.P - conditional expectations % qP.V - conditional variance % % pP - optional priors %__________________________________________________________________________ % Copyright (C) 2008 Wellcome Trust Centre...
0b0cfb2e96f04b6d5fca594ec57c5cf299aa4e904904efb86014368796a02de7
MATLAB
4,572
87
function save_individual_subj_region_data(cue_responsive,ref,baseline, exp_type, lock, subj,removeERP, ... norm_freq_acrs_chan_cond_1, norm_freq_acrs_chan_cond_2,norm_freq_acrs_chan_cond_3,norm_freq_acrs_chan_cond_4) % [will save an spec per chan for each sub when run thru A003_condition_wise_spectral_analysis.m]...
918471973bae360136a5332d544c746df601708ed041364c24adcd10bc894f69
MATLAB
4,572
169
function [xs, precon] = eml_osem(x, Gb, yi, ci, ri, varargin) %|function xs = eml_osem(x, Gb, yi, ci, ri, [options]) %| E-ML-OSEM algorithm for image reconstruction from Poisson emission data %| (ordered subsets expectation maximization) %| model: Y_i ~ Poisson(c_i [G x]_i + r_i) %| %| in %| x [np 1] initial estimat...
60fe1a1a9cd1ea0d6c25575cec138bad08aedf17f3cfa7f488495f4e443b8535
MATLAB
4,577
127
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % PLEASE REFER TO README.txt FOR MORE INFORMATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [] = demo_mp(segment_id) % segment_id (starting from 0) can be given as a parameter; % it does not matter for the example file as there is only one se...
78524c5c34f516d5659338c7e7db37395c494a3491fa5642af77c22c9d7a2152
MATLAB
4,583
101
%% Update Assigned Tracks % The |updateAssignedTracks| function updates each assigned track with the % corresponding detection. It calls the |correct| method of % |vision.KalmanFilter| to correct the location estimate. Next, it stores % the new bounding box, and increases the age of the track and the total % visible co...
53ecaa70f9d3c68119b50e012c816275c9b2e986b77ad7187012b6f973b83974
MATLAB
4,590
168
function hdr = load_nifti(niftifile,hdronly) % hdr = load_nifti(niftifile,hdronly) % % Loads nifti header and volume. The volume is stored % in hdr.vol. Columns and rows are not swapped. % % Handles compressed nifti (nii.gz) by issuing a unix command to % uncompress the file to a temporary file, which is then deleted. ...
a7b0425e21f7572c4888fcefc2dff5e04b639bedc4762811dd25c189b2de1de5
MATLAB
4,590
125
%% Run scripts for SfN 2019 abstract if exist('/home/knight/hoycw/','dir');root_dir='/home/knight/hoycw/';ft_dir=[root_dir 'Apps/fieldtrip/']; else root_dir='/Volumes/hoycw_clust/'; ft_dir='/Users/colinhoy/Code/Apps/fieldtrip/';end %% addpath(genpath([root_dir 'PRJ_Error/scripts/'])); addpath(genpath([root_dir 'PRJ_Er...
c1274f861f60456416e1599f3ac962190f02468861a4c96e8843676e5d6bb495
MATLAB
4,591
213
function yn = jf_equal(a, b, varargin) %|function yn = jf_equal(a, b, varargin) %| %| verify that the two arguments are equal. %| if not, print informative error message. %| See also: equivs %| note: to compare objects, use jf_equal(struct(a), struct(b)) %| %| option %| 'what' 'warn' 'fail' 'silent' %| default: ...
23b85b56b5e64264659de2e55c24d1351ac00d91cd5bb63fc14f66bd853d0e52
MATLAB
4,593
120
function [negloglikelihood] = Estimate_beta_k_m3_sigma_nu(beta, k, m3, sigma, nu, Input, config) % Zilong Ji, UCL, 2022, zilong.ji@ucl.ac.uk % Find the likelihood with parameters specified in the model function name % Args (in common between all estimates functions): % beta: decay factor for the mental distance (calcul...
962cf3500a2a3a3a18bb223e3341cb3fc95494ccf1996a50a84cb31028d7650a
MATLAB
4,594
139
% Estimate the Fisher information of stimulus in the neuronal responses of a single % recurrent network % Some simplifications is used in this Hawkess process: % 1). No temporal kernel % Wen-Hao Zhang % July 22, 2021 % University of Chicago if ~exist('Path_RootDir', 'var') setWorkPath; end addpath(fullfile(Path_...
098a25390c41054c6e5efd23f5e8b0a9f5c7c7a5f662bc74529e3637f4f42ced
MATLAB
4,597
141
function img = fbp_fan_flat(sino, G, window, varargin) %function img = fbp_fan_flat(sino, G, window, varargin) %| %| FBP reconstruction of fan-beam tomography data for a flat detector. %| (Equidistant case.) Extracts parameters from Gtomo2_dsc object. %| See fbp_fan_flat_example.m for example. %| %| in: %| sino [nb,n...
a0ac98b5e48cb6e70766a502ac4604d5c744df07326245e759523ace45bec910
MATLAB
4,598
114
function [empiric_mean_angular_error, null_mean_angular_error, pvalue, empiric_angular_error, null_angular_error] = calculate_angular_error_across_trials(predicted_class, actual_class, varargin) % calculate_angular_error_across_trials Generates mean angular error % across trials and also generates null distribution f...
8082a1e5954089d2809216d70ef65453fdef9d34d5718b776c52435992e60c02
MATLAB
4,601
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 contains the ...
00ab2dcc25c63ea0986bd2bd442776fca9faf8b53e1bfc292ce9f43229d0a909
MATLAB
4,603
111
% Defines the class ROITimeFrequencyGrid for visualization of time frequency stats on ROI space. % % Author: Alejandro Ojeda, NEATLABS/UCSD, Sep-2019 classdef ROITimeFrequencyGrid < vis.headModelViewer properties hCortex end methods function obj = ROITimeFrequencyGrid(hm, data, timeStamps,...
410a9288307f46f0e31ddc8112238c16a5fa9bf7aa9cd0b3649e2e30fd25067c
MATLAB
4,606
95
% Calculates rate of replay (events/min) for each track during sleep periods. To do so divides periods in 30min chunks. Plots rates for each % 30min chunk and compares it between tracks. % INPUT: % data_type: 'main' for using data from main HIPP replay project; 'speed' for using speed protocol data; and 'ctrl' for ...
3978f0d31671921b7cfa3cb7914a6253be45a8c3f045fde7f04c501e50795db7
MATLAB
4,607
102
function [outANI,outANIFreq,outANIFilterFreqs] = IPEMCalcANIFromFile (varargin) % Usage: % [outANI,outANIFreq,outANIFilterFreqs] = ... % IPEMCalcANIFromFile (inFileName,inFilePath,inAuditoryModelPath,... % inPlotFlag,inDownsamplingFactor,... % inNumOfChannels...
274efae9f4d7f60a9f9171853188f672117c1f370910a5681dcc41d0c761f81a
MATLAB
4,610
197
function ob = Gwave2(varargin) %|function ob = Gwave2([args]) %| %| Construct object that performs wavelet analysis of a 2D image, %| for regularization based on sparsity such as in compressed sensing. %| %| option %| 'mask' logical [nx ny] image-domain mask, often: true(nx,ny) %| 'wname' wavelet name (default: 'haa...
bb866a6651800197476ec237852d767494035c4545ba96b976bb666f14e0588c
MATLAB
4,612
106
function [ratemap, ratemap_trim] = smooth_trim_ratemap(firingrateAll, trim_direct, countTime, edgeFilter, edgeFilterThresh) % this function aims to trim nans outside the actuall ratemap and apply % smoothing to the raw ratemap firingrateAll. In addition, this function % also further trim the unequal size ratemap across...
e341c60de64d6d7e153a98771cfccfab839e50db60b12f88340b144da10d6a9d
MATLAB
4,612
202
% Gtomo2_moj_test2 % Test the Mojette case of the Gtomo2_table object % for fan-beam forward projection % Copyright 2005-12-14, Jeff Fessler, University of Michigan redo = 0; im pl 2 3 % analytical sino if redo || ~isvar('ya'), printm 'ya' down = 2; ig = image_geom('nx', 512, 'ny', 504, 'fov', 500, 'down', down); s...
19598c806e6957ac55356508e1aa79db780a19f318ecb13e46ca1e666684168d
MATLAB
4,613
156
function x = splsqr(A,b,lambda,Vsp,maxit,tol,reorth) %SPLSQR Subspace preconditioned LSQR for discrete ill-posed problems. % % x = splsqr(A,b,lambda,Vsp,maxit,tol,reorth) % % Subspace preconditioned LSQR (SP-LSQR) for solving the Tikhonov problem % min { || A x - b ||^2 + lambda^2 || x ||^2 } % with a precond...
0b2e9dc9b48210de654578acb86dc69490d5bb1dfd40cfba83f7289085785b8b
MATLAB
4,614
120
%% Plot virtual channel source results % % 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 % % Plot results of LCMV beamf...
7e6cad87fba890eda563685a12ef1d36559f680cfb61a3a2270cee2530667ca2
MATLAB
4,614
101
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% ################################################################# %% DESCRIPTION % Script to analyse data for: % Grieves et al. (2020) % Disorientation in HD cells % % This script % NOTE: This script is dependent on disoritest to load and prep...
8951a0e25dc774822133a5e87fc4af957264d9c48e81af70bc63e78d75a01d11
MATLAB
4,614
120
%% Thomas_Yang_et al, 2023 @Nuo Li lab %% Fig. 7d direct photoinhibition of SC GABAergic neurons % flex-ArchT in left SC of gad2- or vgat-cre mice, left SC fiber implantation clear all close all load Figure_7_d_data perf_Raw_all = []; n_mice = 0; n_plot = 0; for i_mice = unique(Session_type_allSessio...
1958e865a66d830ad518dd5aed877c81f7693a5b52fde982c9cf84499f665fad
MATLAB
4,616
139
%% MNE source reconstruction % % 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 % % Do MNE source reconstruction on evoke...
0bcae908e30d353219ddd23cfac1f88a2638a1ae5fca3cd08e56f0ebd87c2b24
MATLAB
4,620
129
function [qf, qfTree, fig]=run_QfTree(trainingSet, trainingIds, ttl, varargin) % Class for Hi-D matching with merging of data subsets using QF match or % F-measure or both. % AUTHORSHIP % Primary Developer: Stephen Meehan <swmeehan@stanford.edu> % Math Lead & Secondary Developer: Connor Meehan <connor.gw.m...
040c1c6eab9053adbe95f459555f3bdd7b0858eb11e73c2bf2ee20c71176f496
MATLAB
4,626
75
function [] = fun_saveGUIstate(handles) %UNTITLED Summary of this function goes here % Detailed explanation goes here [filename, filepath] = uiputfile({'*.mat'},'Save the current state of the GUI.','state_name'); fullname = [filepath filename]; if filename~=0 state.a = 1; ...
25693cbf0768e8f8594156ef2feab9ea9784a505af6a28fda2b6c03f425f76e6
MATLAB
4,626
163
%| ir_mri_dce_sim1 %| %| Generate DCE k-space data for parallel MRI %| %| 2014-08-25 Jeff Fessler and Mai Le, University of Michigan if ~isvar('Ncoil') % parameters Ncoil = 8; Nframe = 12; % increase this for better time resolution; % keep small for quick debugs end if ~isvar('dyn_obj') % dynamic object with 'fi...
e417a48980d25fed451cce7b8bed5e53b5b52232ca435db2ec44121e491b6376
MATLAB
4,626
125
function [negloglikelihood] = Estimate_g3_m3_sigma_nu(g3, m3, sigma, nu, Input, config) % Zilong Ji, UCL, 2022, zilong.ji@ucl.ac.uk % Find the likelihood with parameters specified in the model function name % Args (in common between all estimates functions): % beta: decay factor for the mental distance (calculation err...
700a7fcc3964af3fd9bece099ca0c0e4610fa81d41b6b4f40e9f7f155982e411
MATLAB
4,627
125
function [MI_vec, MI_th, all_fr, spatial_cells] = ... getMIAllCells(matPath, ds_factor, smoothSigma, fr_bins, spatial_binsize, trackLength) % Calculate mutual information for all cells in file specified by matPath % % INPUTS % matPath: path to .mat file after running sync_vr_to_np.m. Specify as % string. e...
d7f6ce836174adc45c415df601beecb4da5f1e5d6acd9e3dd0ebe66929440f18
MATLAB
4,627
109
function [outNoteNr,outOctaveNr,outExactFrequency,outNoteString] = IPEMFindNoteFromFrequency (varargin) % Usage: % [outNoteNr,outOctaveNr,outExactFrequency,outNoteString] = % IPEMFindNoteFromFrequency(inFrequency,inRefNoteNr,inRefOctaveNr, % inRefFreq,inNotesPerOctave,inOctaveR...
4f20f26d478fc6a79da5d34e87495e289732c235d6748a6f5d44d4f2c936a5cf
MATLAB
4,632
115
clc; clear; %addpath('/data/hu_esraal/Documents/FastICA_25') addpath('/data/hu_esraal/Documents/eeglab2019_0/') addpath('/data/hu_esraal/Documents/TMSEEG-4.0') eeglab % EEGpath= '/data/p_02186/TMS_ECG2/analyses/EEGtms/'; eegfolder = [EEGpath 'merge//old_analyses_tmseeg']; cd(eegfolder); subj_names = {'VP01', 'VP02', '...
4c47728663a3c3ee05c05b3af2de97215ca1bf7b28537dd63b4d04e7b00a1429
MATLAB
4,637
130
function [outAmpl,outPhase,outFreqs] = IPEMCalcFFT (varargin) % Usage: % [outAmpl,outPhase,outFreqs] = IPEMCalcFFT (inSignal, inSampleFreq, ... % inFFTSize, inPlotFlag, ... % inUseLogScale, inShowPhase) % % Description: %...
95ee7d6e9b9be1aa1f6b17cf600b50207dd9f33cd3ef51006da22a171b0d6ff0
MATLAB
4,638
142
function [dch_idx, time_idx, dchTimeSec,dchStartDelaySec,Fs, trialClust,trialBasedClustIdentifiers]... = identifyUmapDecoherenceTimeBand(clusterIdentifiers, cells, ds_factor) % Threshold Variables % return cluster of dchTime is longer than 1 min and % if it starts within 10 min of the ketamine injection dchTimeThr...
5e44fd06cc2fde99d15c9bbf02454ebfa1fcc9f7640204a310ebc5c8190c7d89
MATLAB
4,639
121
function [negloglikelihood] = Estimate_beta_k_g2_m3_sigma_nu(beta, k, g2, m3, sigma, nu, Input, config) % Zilong Ji, UCL, 2022, zilong.ji@ucl.ac.uk % Find the likelihood with parameters specified in the model function name % Args (in common between all estimates functions): % beta: decay factor for the mental distance ...
7e9728dc50b2b35aa79cc62c7b989e634d4b53c6531bf372736917c6c584ee67
MATLAB
4,640
121
function [negloglikelihood] = Estimate_beta_k_g3_sigma_nu(beta, k, g3, sigma, nu, Input, config) % Zilong Ji, UCL, 2022, zilong.ji@ucl.ac.uk % Find the likelihood with parameters specified in the model function name % Args (in common between all estimates functions): % beta: decay factor for the mental distance (calcul...
877246645ea5c2d0e995beee1f41cccd7950fcd73d065b54c4248af8590d6d17
MATLAB
4,640
112
function [] = saveCode(fName, cde) % Write code read with getCode back into an *.m file. % % The counterpart of getCode: it turns the byte vector stored next to a data % set back into a runnable script, so the exact version of the code that % produced a result can be recovered from the result itself. % % Usage: saveCod...
5601ca6f839d49b0b08fd7ead060223af01361d95a7ae7d1dc67c7ba9897ea23
MATLAB
4,641
139
function [block] = spm_vb_set_priors(block,priors,vxyz) % Set up precision parameters and optimisation options to correspond to priors % FORMAT [block] = spm_vb_set_priors(block,priors,vxyz) % % block - VB-GLM-AR data structure (see spm_vb_glmar) % priors - For regression coefficients: % % .W= 'Spatial - U...
e66e2dabbe2570e1e10fc43135354214a7b9ac39210b5031079854fc951aad1f
MATLAB
4,643
125
function [negloglikelihood] = Estimate_beta_k_g2_g3_sigma_nu(beta, k, g2, g3, sigma, nu, Input, config) % Zilong Ji, UCL, 2022, zilong.ji@ucl.ac.uk % Find the likelihood with parameters specified in the model function name % Args (in common between all estimates functions): % beta: decay factor for the mental distance ...
3dc5c51ca5db1c62ebd9526e02b41ef9ef8d2e20e05678644dd13d5d67f2356b
MATLAB
4,644
128
function fig = plotQuantificationPanel(obj, report,fontsize) if(obj.plotFigures == 0) disp('plotParameters: plotFigures = 0, hiding figures!') visFlag = 'off'; else visFlag = 'on'; end fig = figure('visible',visFlag); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
4a6257fac399c2d4e52ac79bbfdea1f8e5486928e1651b350cfe25784a105b92
MATLAB
4,644
125
function [negloglikelihood] = Estimate_g2_g3_m3_sigma_nu(g2, g3, m3, sigma, nu, Input, config) % Zilong Ji, UCL, 2022, zilong.ji@ucl.ac.uk % Find the likelihood with parameters specified in the model function name % Args (in common between all estimates functions): % beta: decay factor for the mental distance (calculat...
a7ead15ff37eadefeff6677662a6665e97c44ead879413cdf9eb456794eb2475
MATLAB
4,644
103
% REPLAY DECODING % Extracts spikes for each replay event and decodes it. Saves in a % structure called decoded_replay_events. Inside each field (each track) the replay events are saved. % Loads: extracted_replay_events, extracted_clusters and extracted_place_fields_BAYESIAN function decoded_replay_events = final_lap_...
0d294627689caf9a1635bfab400d359be6b06a93d04b9030510642c381492db1
MATLAB
4,647
133
%% This script shows you how to compute "frequency sliding," % time-varying changes in the peak frequency of an oscillation. % This script corresponds to a paper: % This script assumes that your data are in eeglab format. However, the % eeglab toolbox is not necessary and it should be fairly straight forward % to ad...
1e51dd568e0101bdf5d1d1bd3432cf8ce04d7d9a39768ce2c04f9cc624f56a11
MATLAB
4,647
119
function SBJ00a_cleaning_prep(SBJ,plot_psd) %% SBJ00a_cleaning_prep % Load raw data, extract channel labels, downsample, bandstop line noise, % and save the result for visual cleaning inspection. % Inputs: % SBJ [str]- name of the subject % plot_psd [str]- name of function to plot+save PSDs of raw channels % ...
cb4b8902527497f5376b30707b22d2c6e1033efedea34f8a4d48430a3b7afde5
MATLAB
4,649
152
function[choice, T, Delta, x] = simDDM_one_trial(task_type, stim_type, hist_effect, bias, bound, bound_crate, lambda, sigma_sens, mu, mus, dt) %{ This function simulates the DDM trajectory for 1 trial following Euler-Maruyama method given: task type: free_choice or interrogation stim_type: continuous or discrete hist...
7e96074cfb135a8c9ee72ed2df888ccb5307bc8c4ff8b9fea1d40ca52e2ea81b
MATLAB
4,650
150
function recon_im = SENSE_recon(smap, reduced_fft, np, varargin) % function recon_im = SENSE_recon(smap, reduced_fft, np, varargin) % inputs: % smap [N M nc] complex sensitivity maps % reduced_fft [N/np M nc] or [N M/np nc] undersampled fft % np degree of undersampling % optiona...
8993c390c4ccb81b8bf4b7fd525b195eb60832d998875983b0f1c56ec42b86b4
MATLAB
4,651
149
% The script is used to perform frequency analysis at each frequency (4-100Hz) % and frequency-resolved decoding analysis (sliding-window, 5Hz) on EEG data. % add toolbox addpath('fieldtrip-20191213/'); addpath(genpath('CoSMoMVPA-v.1.1.0/')); addpath(genpath('libsvm-3.25/')); ft_defaults; %% frequency analysis % set ...
80afa6c2912cd3aef353ae73861e405918bcaddfcfabd39b955f4f27cf8b8571
MATLAB
4,652
101
function control_plots_phase_precession_relative_location(track) % Sanity check plots at different time points of theta phase precession extraction code % Uses output from main code 'phase_precession_relative_location', which is a structure called TPP load('extracted_phase_precession.mat') load('extracted_position.ma...
9c47131a084fc4b8df09ce9dc247381dec85fa82f232e4079c012f83fd347104
MATLAB
4,656
118
% HARRIS - Harris corner detector % % Usage: cim = harris(im, sigma) % [cim, r, c] = harris(im, sigma, thresh, radius, disp) % [cim, r, c, rsubp, csubp] = harris(im, sigma, thresh, radius, disp) % % Arguments: % im - image to be processed. % sigma - standard...
31d2d07e014515a07bd923112ef1c347bd82b0ed2b1ea2e371dc0373fcb53cde
MATLAB
4,657
154
function [potk, wpot, dpot] = penalty_funcs(type, beta, delta) %function [potk, wpot, dpot] = penalty_funcs(type, beta, delta) % % Define roughness penalty functions via inline functions. % % If beta is numeric, then the penalty will have the form % R(x) = sum_k beta * potential([Cx]_k, delta) % If beta is empty, then...
38b71aea55fdde1d5355e6bc23f174edfde721a32b81336c910ff9ccc161ed87
MATLAB
4,660
136
% The script plots the averaged max firing rate of each run vs the % velocity, in Fixed-Time and Fixed-Distance experiments close all clear global Dir='G:\Dropbox (Personal)\Brain\Project'; Animals = {'BK49','BK41','BK35','BK45','BK33','BK26'}; NumOfAnimals = 6; % Use 1 only for a short validity test, other...
2b8bb157c4309ea44c13a6f4bfd9aa2ee67a8170d07c961e1b55ade4c40af2fb
MATLAB
4,663
200
% xct_bh_example.m % % illustrate X-ray CT iterative reconstruction of an object % consisting of water and bones, for a polyenergetic spectrum. % % Copyright 2008-12-05, Jeff Fessler, University of Michigan warn 'work in progress' if ~isvar('ssino'), printm 'ssino' ig = image_geom('nx', 128, 'ny', 120, 'dx', 0.4); ...
adae7bdf9c53314e3a7179e2fb20c426be7ba6f5455410e010887eded98f9512
MATLAB
4,668
149
function simpleChoice % This is a simple example program where you can distinguish between stimuli presenting humans and % stimuli presenting other objects. % Tobias Otto % 1.0 % 16.11.2021 % 16.01.2021, Tobias: first draft %% Init toolbox and experiment initOTBR; startExperiment; % Not necessary for human experi...
b176db8ce19f4c220655d8252fc07de7ec282cfdf6b96e699907d9e132815e35
MATLAB
4,668
126
function [mg,nu,sig,info] = spm_rice_mixture(h,x,K) % Fit a mixture of Ricians to a histogram % FORMAT [mg,nu,sig] = spm_rice_mixture(h,x,K) % h - histogram counts % x - bin positions (plot(x,h) to see the histogram) % K - number of Ricians % mg - integral under each Rician % nu - "mean" parameter of each ...
6a08068ec4efde6e34fbbc3a10e00c97b47eca0848d9744d1a29b386cded56ba
MATLAB
4,672
135
function [AA,BB,RR,iBest,accMM]=nt_cca_crossvalidate_mm(xx,yy,shifts,windowSize,ncomp,A0,B0) %[AA,BB,RR,iBest]=nt_cca_crossvalidate(xx,yy,shifts,ncomp,A0,B0) - CCA with cross-validation % % AA, BB: cell arrays of transform matrices % RR: r scores (3D) for all components, shifts and trials % iBest: index of best shif...