sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1452d80219b419733c0c856369bdb219a35c164a4ae96ab2319eb1df85257e94
MATLAB
1,024
35
function Find_RepPar(idxNE,idxEX,MSPoI,gr,respath,at_name,brainregs) % This function find the Representative partition across iteration of % the MLCD DataPar = {}; for gI = 1:length(gr) if gI == 1; idxgr = idxNE;elseif gI == 2; idxgr = idxEX;else; idxgr = [idxNE,idxEX];end for Reg = 1...
a099cd1bf15f9e2c30494d4e7dc58ce60d20f50451937e2f16a3ea5607779a62
MATLAB
1,024
41
function buttonBool = buttonRepeatContinue() % Create the buttons button1 = uicontrol('Style', 'pushbutton', 'String', 'Repeat', ... 'Position', [500 50 100 30], 'Callback', @pressbutton1); button2 = uicontrol('Style', 'pushbutton', 'String', 'Continue', ... 'Position', [650 50 100 30], 'Callback', @...
0e75794cf60b387306e435ab63b1c305c37d2ac9bc89fced48785daac6d1e2a7
MATLAB
1,025
41
anadir='/home/romain/data/spectro/PROTO_SPECTRO_DYST/anat/'; spec_nii_dir = '/home/romain/data/spectro/PROTO_SPECTRO_DYST/fid_pos_nii/'; jobs = {}; log_file='log_coreg.log'; d=dir(fullfile(anadir,'*_E*')); spm('defaults','FMRI'); for k=1:length(d) T2dir = dir(fullfile(anadir,d(k).name,'*T2_TSE*')); if length...
b19ba16e98132a642da5103dcf56d81f64a6c8a3cb7de32938b4b84de0a84338
MATLAB
1,025
27
function LFMm=hbf_LFM_B_LC(bmeshes,coils,TB,spos,sdir) % HBF_LFM_B_LC builds magnetic lead field matrix based % % LFM=HBF_LFM_B_LC(meshes,coils,TB,spos,sdir) % LFM=HBF_LFM_B_LC(meshes,coils,TB,spos) % meshes: BEM geometry, cell array of hbf structs % coils: coil description, hbf struct % TB: TB matrix built ...
2442db8753bc9c3a5105aacf559396c5472d06b086ef22f80f9986c6378d93da
MATLAB
1,026
41
function dist=KLDiv(P,Q) % dist = KLDiv(P,Q) Kullback-Leibler divergence of two discrete probability % distributions % P and Q are automatically normalised to have the sum of one on rows % have the length of one at each % P = n x nbins % Q = 1 x nbins or n x nbins(one to one) % dist = n x 1 if size...
74d871da788aab73452a963c9e3a034ad55a96571e41369d6518bf2f7a32f15f
MATLAB
1,027
37
classdef (Hidden) file_handle < handle % % Class: % adi.file_handle % % This class is simply meant to hold the reference to an open file. % When no one holds it the file will be closed. properties pointer_value %Pointer to the file object in the mex code. This gets ...
140f06e8b08d6dd146cde74746d0633b896526add39ffb94e543a29b5807b4bb
MATLAB
1,029
49
function [do subdir varargout] = get_parent_path(di,level) %level if level if exist('level') concat=0; if level<0, level=abs(level); concat=1; end do=di; for k=1:level [do subdir] = get_parent_path(do); if (nargout-1>k) varargout{nargout-1-k} = subdir; ...
9d4d7ee4cc0e2877f58f7f8f62f330b594e88d8d6f2ac7562366acb7d7e71d48
MATLAB
1,029
39
function reportrecipeName % Report the name of the sample in the recipe alongside the file name of the pStack file % % Purpose % Used to look for cases where the pStack file has the wrong recipe % Pulls all pStack files in the current directory and sub-dirs. % Run from directory in question. No ...
29c7bd188646424106b394889c44c4bbebdd813de41bb512a3840cf34c067145
MATLAB
1,030
29
% Copyright 2024 Eelke Spaak, Donders Institute. % See https://github.com/Spaak/rift-phase-and-visibility for readme/license. % Belongs with: % Spaak, E., Bouwkamp, F. G., & de Lange, F. P. (2024). Perceptual foundation and extension % to phase tagging for rapid invisible frequency tagging (RIFT). Imaging Neuroscie...
55189353ed4434ccdcd8d722c7018c3e69b7b3d79c6a3364bc2d51a7e85e82bf
MATLAB
1,030
36
function H=EntropyMarkov(P1,P2) number_states=size(P1,1); [V,D] = eig( P1' ); % eigendecomp of P' (P=transition matrix) [~,ii]= max(diag(D)) ; st = V(:,ii); p1 = abs(st)/sum(abs(st)); % p(i) (stationary!) % Remark: you could also get an estimate of p(i) directly from the observations % p(i) = sum( state =...
e78e9245b5d7d35dc8d06e89f27d206c5feb09f963d3a295d7d1904ce004b1eb
MATLAB
1,030
41
function buttonBool = buttonTrueFalse() % Create the buttons button1 = uicontrol('Style', 'pushbutton', 'String', 'BurstCheck', ... 'Position', [200 50 100 30], 'Callback', @pressButton1); button2 = uicontrol('Style', 'pushbutton', 'String', 'NoBurstCheck', ... 'Position', [350 50 100 30], 'Callback'...
ef4ecdfe2c1a51e3b41b37b0baf07f0826c8886d7e0deb22571bf7ddde9d73fd
MATLAB
1,030
33
function t = struct2table_open(s) % Initialize variables vars = fieldnames(s); n = length(vars); nested_vars = fieldnames(s.(vars{1})); m = length(nested_vars); t = table; % Iterate over each field of the structure for i = 1:n % Get the field name and its contents var_n...
3a3ca673f8e24a00b941a7afa75bab9e54b56973c56789f531dccbf8486fbeb0
MATLAB
1,034
29
%% code for saving images as jpeg with the actual size % Downloaded from here: http://www.mathworks.com/matlabcentral/answers/102382-how-do-i-specify-the-output-sizes-of-jpeg-png-and-tiff-images-when-using-the-print-function-in-mat function screen2jpeg(filename) %SCREEN2JPEG Generate a JPEG file of the current figure w...
7ed57e359ee9daac0ccb9416630300a55f3c1c40492a83d9fb706f8c52a39e03
MATLAB
1,035
30
function [node,link,cell] = OCY_filter_nodes(node,link,cell,cells,filterthr) disp 'changed' THR_DIST = filterthr; % same or shorter links will be joined to a node THR_BRANCH = filterthr; % same or shorter branches are removed w = size(cells,1); l = size(cells,2); h = size(cells,3); % filtering: remove links fr...
ec155eb69b814015145091eaeaa492cd941c4a8c8b9f80acb2e9f864c699f1e2
MATLAB
1,035
32
function [param_inds, param_ind_d] = compute_param_inds(... folder_fit,... subgroups,... idx_subgroups,... subgroup_names,... flag_log_mu) fit_r = load([folder_fit '/fit.mat']); nb_animals = 0; for idx_subgroup = 1:length(subgroups) nb_animals = nb_animals + length(subgroups(idx_subgrou...
8e927e49a8c50c258ff36c58e69887447c42e720a55e99c525bb149923237a35
MATLAB
1,037
37
% clear close all; % r = load('results_testProcessSeizureEEG10_Multiple_ICA_all_cases.txt'); % r = load('results_testProcessSeizureEEG10_Multiple_ICA_all_cases_with_angles.txt'); % r = load('results_ICA.txt'); r = data; % bins = 0:.01:1; % bins = -10:.5:50; bins = 30;%0:1:100; column = 4; subject = 1;%(r(:, 1) == 5);...
cdface6cd3cc0d160a5849d51c0d6fc7e16bf490d23a3b9c5da03e1a1d856472
MATLAB
1,037
35
Centroids=[1 2;1 8;2 2;3 8;4 1;4 5;4 6;7 1;8 4;9 7]; szCent=size(Centroids); NumPointsPerClust=25; AllPoints=nan(szCent(1)*NumPointsPerClust,szCent(2)); RealClusterIDs=nan(szCent(1)*NumPointsPerClust,1); NoiseSpread=0.333; for i=1:szCent tPoints=(randn(NumPointsPerClust,2).*NoiseSpread)+Centroids(i,:); %Squash ...
e566d2760109fe345af5e1455af1f139e6f3b91b6d8229b63e62c1834be62ff4
MATLAB
1,037
37
[cols,alpha] = chooseColors; rep_mean = squeeze(mean(mean_acc)); figure('Position',[100 100 300 300]) hold on plot(rep_mean'*100) xlim([0 31]) set(gca,'XTick',[0 5 10 15 20 25 30]) set(gca,'XTickLabel',[-1 0 1 2 3 4 5]) xlabel('Time (s)') ylabel('Accuracy (%)') % indicate tone start and action start plot([5 5],[40...
e6c86b38e7f8fc23978203b83cc9122fa5186a4ccaf1a84478bd04395c5e3a30
MATLAB
1,037
49
clc, clear; addpath('OTF'); addpath('XxUtils'); %% calculate OTF0 OTFPath = 'Detection_OTF_488.mrc'; OTFPath_Simul = '/media/zkyd/New Volume1/IsotropicRecon/B23/OTFs/OTF0.tif'; SaveOTF0 = '/media/zkyd/New Volume1/IsotropicRecon/B23/OTFs_Exp/OTF0.tif'; SaveOTF1 = '/media/zkyd/New Volume1/IsotropicRecon/B23/OTFs_Exp/OTF...
c56ecd689167861fd33dba1e7692a242c2dc7fa051b7060bd86f2b6dca231096
MATLAB
1,038
39
function [index1,index2] = angle_order(Nnum) % Auto angle order generation for tomographic reconstrcution % % The Code is created based on the method described in the following paper % [1] ZHI LU etc, % "A practical guide to scanning light-field microscopy with digital adaptive optics" % Nature ...
3822393df498af7a65c6e790ebbe646845f8175998e2dcc509b881dfe015525d
MATLAB
1,041
33
function h = RaguTanovaSubplot(nr,nc,r,c,Color) % Copyright 2009-2011 Thomas Koenig % distributed under the terms of the GNU AFFERO General Public License r_width = 0.5 / nc; r_height = 0.95 / nr; Position = [(0.05 + (c-1) * r_width) (0.05 + (nr-r) * r_height) (r_width - 0.04) (r_height - 0.08) ]; h = subplot('Pos...
73349d87c5e1dd33e3ea74790de6003c5395c1fe9dec38e67380604444bef71d
MATLAB
1,041
30
function [ outputImage,lfi ] = filterImage( image, cutoffFilter, padSize, fType ) %FILTERIMAGE performs frequency domain filtering % pad the array to remove edge effects inputImage = padarray(image,[padSize padSize],'symmetric'); % do fft inputImageFFT = fft2(inputImage); inputImageFFT = fftshift...
d6bdc49567175d2ca3b3e9a49f798026f52d1e869dfd688f6dd2c35ae3f0bdb6
MATLAB
1,041
35
clear clc %% %save only Intensity encoding + IR [file, path] = uigetfile('*.mat','MultiSelect','on');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path %% window_names = {'ON', 'Sustanied', 'OFF'}; for ...
3054ad924ccc99f65be81a2a23da45542ebb99577d695e1383b52dab8b03e99a
MATLAB
1,042
30
% ir_mex_build_table % run matlab's "mex" command to "compile" the table interpolation code % into mex files. % only users on unsupported systems, e.g., PCs, will need to do this dir_current = pwd; dir_nufft = path_find_dir('nufft'); dir_table = [dir_nufft filesep 'table']; cd(dir_table) % mex compile command with op...
7693d17eedf5dd2ffa3ee2aac93f020c4d3c5183c97cbbcfec332294df9956c0
MATLAB
1,042
30
% Convert and save data to HDF5 format for Domenico %load('Atlas_Model\10-2p5_Model\refpts_10-2p5.mat'); %posScalp = refpts_10_2p5; %load('Atlas_Model\10-2p5_Model\GMDownsampledMesh_DF_2_5.mat'); %posGM = GMSurfaceMesh.node(:,1:3); %nposGM = length(posGM); %h5create('posScalp.h5','/posScalp',size(posScalp)) ...
138ca05065db5bb94234e7ce7c0ce13c34755c22241e865031ca74892d85452b
MATLAB
1,043
27
function [deepnet,y,Testing_Frames,Testing_Classes]= Digit_Classigication_StackedAutoencoders_NN_Index() tmp = matlab.desktop.editor.getActive; cd(fileparts(tmp.Filename)); if isunix cd ../../..; else cd ..\..\..; end addpath(genpath(pwd)); Frame_Half_Size = 10; % 10 = 21X21 ; 12 = 25X25 ...
578de77b143ae521b16ff1df2ade1c871f01752fc451fe22302bcc8c0747841d
MATLAB
1,043
31
function [ err_trials ] = collect_full_error_trials_per_ses(p, traces, bvs, tis,speed_control) spd_dims = 18:22; %dlc pre_steps = 5; post_steps = 50+20; for sub = 1:p.nSubjects % collect error trials for ses = 1:p.nSessions err_trials{sub,ses} = []; if any(s...
aa05368fa8937a07bf027d62fd8497b9322c57fa943a9fb6e780afe8b14d1ad4
MATLAB
1,043
23
function newCoords = convert2Dto3D(coords2D, point1, point2, point3) % convert2Dto3D converts 2D coordinates to 3D coordinates using 3 reference points % in 3D space % % coords2D: a Nx2 matrix of 2D coordinates to be converted to 3D % point1: a 1x3 vector representing the 3D coordinates of the first reference point...
027a74b1c84f5c366eccc01d58af66e896f2c010d2976c1c08aed55e101bfa3e
MATLAB
1,045
40
function update_signal_popup(app) %UPATE_SIGNAL_POPUP updates the selection options for all popup menues %for the selection of specific signals. to be called after calulation of %derived signals % Detailed explanation goes here if ~isempty(app.data) name = vertcat(app.data.name); if length(app.data) < 2 ...
693b90dcb26bc17faa35dff76e2fd70cdce70d0859db6b2b83dae4c3e3c8d2f8
MATLAB
1,045
40
function run(obj) %RUN Run commands if obj.isError error(obj.errMsg); elseif obj.isCompleted warning('command ''%s'' completed successfully; to rerun, use rerun()', obj.cmd); return; end % DETECT SPIKES gpuDetect = obj.hCfg.useGPU; % save this in case useGPU is disable...
82c1dd57a878f9e68f2fb8ebae7108c614cf02a5c69ad0264b375ffd6fa38787
MATLAB
1,046
43
function y = fix_filter(x) % fix_filter (in case signal processing toolbox is not available). % filters data x with an eliptic passband between [300 3000] Hz. a = [1.0000 -2.3930 2.0859 -0.9413 0.2502]; b = [0.1966 -0.0167 -0.3598 -0.0167 0.1966]; x = x(:); len = size(x,1); b = b(:).'; a = a(:).'; nb = length(b)...
dc0bc75af9e073359442a13362966207d698f4620d471fae75e1d829fe2c3c18
MATLAB
1,047
47
% quick look at the decay times of calcium transients p = params_2DAA for sub = 1:p.nSubjects thisSub = p.subjects(sub); fpath = ['G:\E7_2DAA\miniscope\subject' num2str(thisSub) '\jointExtraction\sorted\eventData.mat']; load(fpath,'eventTraces') all_ev_mat = []; for c = 1:100 % only take first 1...
fedaa5a1c67672f94902db1491786b8ffaa54dab4f0b0e87536aabc4499b6fe4
MATLAB
1,047
32
% add ramp 2 all data clear clc %% run %load all data [file, path] = uigetfile('*.mat');%When the user clicks the load data button, a window should open to enable the user to select a file. datafile = fullfile(path, file); %save path load(datafile) if iscell(all_data) all_data = all_data{1,1}; end cells = fieldnam...
4aa2c8ac741767585df4eb4b62c8f6475dd495b372ea87a04a643dd5cea71922
MATLAB
1,048
46
function ind = ChannelIndex6(x,ff,th) % Channel selection based on peak-detection % % Reza Sameni % December 2008 L1 = size(x,1); L2 = size(x,2); rng = floor(1/(2*ff)); % prefiltering % load FiltCoefs Num % x = filter(Num,1,x')'; % x = x.^2; % + and - peaks are both acceptable x = abs(x); % + and ...
c5a5ae0ae94cfa2180c618895f8761a8d4e92682b30304adfb28ac22e5e6ef93
MATLAB
1,048
29
close all fs = 15000; %sampling rate (Hz) spk_count=[]; %gain duration = 40; %trial duration bin_duration = 0.2; n_bins = duration / bin_duration; bin_size = bin_duration * fs; name= ([current_p0;current_p200;current_p400;current_p600;current_p800;current_p1000]); % name=([current_p0_ser;current_p200_ser;curr...
43ebad3723c2f4c13487a9c7db3367998d97d0bbfb72a79216652a9c13eeec3d
MATLAB
1,049
33
if temps(end) < 500 plot(ax1, temps(1:diagnosis_index), Vp(1:diagnosis_index)) hold on plot(ax1, temps(diagnosis_index+1:end), Vp(diagnosis_index+1:end), '--') if k <= diagnosis_index plot(ax1, temps(k) - T1, Vp(k), 'or', 'MarkerFaceColor', 'r'); else plot(ax1, temps(k) - T1, Vp(k), ...
8d8b2d7ce61d7b0bab4b0456c649156f21d555eb639fa9052087277c7bb173d7
MATLAB
1,049
40
function update_signal_popup(app) %UPATE_SIGNAL_POPUP updates the selection options for all popup menues %for the selection of specific signals. to be called after calulation of %derived signals % Detailed explanation goes here if ~isempty(app.data) name = vertcat(app.data.name); if length(app.data) < 2 ...
5157dcddec40c370270121a9f845aaa5a9b2044aae2112721690bbdb6355a37b
MATLAB
1,050
42
function e = sph2euc_dist(s) %SPHE2EUC_DIST Convert spherical to Euclidean distance % %Syntax % e = sph2euc_dist(s); % %Description % E = SPHE2EUC_DIST (S) converts the spherical distance S to Euclidean % distance E, using a formula which is valid for the unit sphere in all % dimensions. % % The argument S must be a re...
1e6add99a0da0d9b1f8d75326f8199a52d45e78579c77413c319b1143b44a246
MATLAB
1,052
50
%Function to threshold the output of the Warnick model according to a %nominal false detection rate. function est_graph = bdfc_fdr_thresh(ryan,rate,plotting) %% Arguements %Inputs %ryan: the output from the warnick model. Should be a structure %rate: the nominal false detection rate with which to threshold %plotting...
25996bf69a71b66240b0dc5fdfae0de01ff2426d1b30d48e9b8957c5b87253c5
MATLAB
1,052
23
function exportTraces(obj) %EXPORTTRACES Export traces from selected cluster to workspace spikesFilt = obj.hClust.spikesFilt; spikesRaw = obj.hClust.spikesRaw; iCluster = obj.selected(1); clusterSpikes = obj.hClust.spikesByCluster{iCluster}; nSpikes = numel(clusterSpikes); shapeFilt = [size...
8d3f8870863a1854358a5392b98a59491e76471500b9bfce08289cc5ef7fe901
MATLAB
1,055
46
function mat = one_hot_encoding(A, device) % Define one-hot encoding based on A. % % Parameters: % A: vector % A vector of size (1 x N) % % % Examples % -------- % A = [1, 1, 1, 4, 5, 6, 1] % one_hot_encoding(A) % array([[1., 0., 0., 0.], % [1., 0., 0., 0.], % ...
e89b4c256e1d074b7e24147fdb6627446e936e785d2784941d716e9dfeafb296
MATLAB
1,058
34
%% Select_Raster Script and RASTER FEATURES ******************************** % INPUT: % fs, % Raster_Condition: Cell off ALL cells x Frames % XY: ALL Coordinates % Names_Conditions: Condition Names % Experiment: Experiment ID % ESTSIGNALS: Denoised Signals (Transients Com...
b8cc0966f1c362af3c3453cfc19fd49e597a62e87b065b49f4a2e4f1ff5d1ae3
MATLAB
1,059
44
function handle = XxWriteMRC_SmallEndian(handle, image, header) position=ftell(handle); switch header(4) case 6 dataclass='uint16'; case 4 dataclass='complex'; case 2 dataclass='single'; end if position==-1 fprintf('Invalid MRC file handle\n'); return; end if position>...
95b9a59b5ea837e7748833bfe69188b346783189cc8162d45333c61d62c93010
MATLAB
1,060
31
function Backprojection = backwardProjectGPU(psf,projection) %% Backprojection from 2D projetion to 3D volume (using GPU) %% Input: % @psf: the phase space PSF % @projection: the projection obtained from "forward project". %% Output: % Backprojection: estimate volume % % [1] JIAMIN WU, ZHI LU and DONG JIANG etc...
b21c847fd5c4d72e42c69991b0d6dfe5565adfcdc879d941e4a3f44aa1e5e159
MATLAB
1,060
28
%% plot right vs left form brain render table clear clc [file, path] = uigetfile('clusters.csv','MultiSelect','off');%When the user clicks the load psetion button, a window should open to enable the user to select a file. cd(path) datafile = fullfile(path, file); %save path T = readtable(datafile); %% %left_side L_IR ...
04732728000f90fe347837306f1caf0fe34deb4e77bc671812af7ee9cab3ec67
MATLAB
1,061
30
function matlab_time = unixToMatlab(unix_time,utc_offset) %unixTimeToMatlabTime Converts unix time to Matlab time % % matlab_time = sl.datetime.unixToMatlab(unix_time,*utc_offset) % % INPUTS % ======================================================================= % unixTime - (element or vector), unix time...
7614be50aebf376cce85549d283324fc01aa6f19a205018dfd2b02c48e1d34a2
MATLAB
1,061
37
function parsave (savefile,varargin) % parsave v1.0.0 (June 2016). % parsave allows to save variables to a .mat-file while in a parfor loop. % This is not possible using the regular 'save' command. % % SYNTAX: parsave(FileName,Variable1,Variable2,...) % % NOTE: Unlike 'save', do NOT pass the variable names to this fu...
609b32cdd046f7194b4686a44e7d2bb994e21639ce43f903086d01222776c294
MATLAB
1,062
36
function flag = recover(obj, ask) %RECOVER Inconsistent data recovery, with a hammer if nargin < 2 ask = 0; end flag = recover@jrclust.interfaces.Clustering(obj, ask); if flag < 1 return; end % update cluster centers if flag == 2 || ismember('clusterCenters', obj.incons...
9839b1b4fbabd718e1730460e49562c267e00b70a4a3e0e196403bc0733db0ef
MATLAB
1,062
38
% opens a Cartool electrode coordinates file (.els) % % Cartool: http://brainmapping.unige.ch/Cartool.htm % % author of this script: pierre.megevand@medecine.unige.ch % check whether filename exists if exist('filename')==0 error('filename is not defined') end % open filename for reading in text mode fid=fopen(op...
0a1a549a4a6a0a5ace63c930b2186e30213cdb07f4e11675a7e4ed67425ed59a
MATLAB
1,063
34
% Copyright 2024 Eelke Spaak, Donders Institute. % See https://github.com/Spaak/rift-phase-and-visibility for readme/license. % Belongs with: % Spaak, E., Bouwkamp, F. G., & de Lange, F. P. (2024). Perceptual foundation and extension % to phase tagging for rapid invisible frequency tagging (RIFT). Imaging Neuroscie...
bd6597c14a4996ea4befcc50bb0524eb56d702ba2525c6a3fcf82b18082e8515
MATLAB
1,063
34
clc clear close all; load('testdata.mat'); fs = 1000; % sampling frequency template_start = 3420; % beginning of reference beat segment template_stop = 3490; % end of reference beat segment wlen = round(0.05*fs); % averaging window length type = 'mean'; PP_diff_th = 50; PP_diff_wlen = 3; average_peak_det_rate = 1.0; p...
e67cf07bdcfc97fc371bc86f265b3405127d1db2e32c191b859326170a249dd1
MATLAB
1,063
39
function [data_strct] = makeFTstruct(data_mat,fs,ch_table,sens_info) % take info from tsv and data matrix and make fieldTrip friendly data % structure % % data_f...nchan x nsam x n trials data matrix % % fs...sampling frequency % % ch_table...table with fields: % name - containing n_chan x 1 cell array with % ...
31eb93de0aa888aed3f31f55fe499458a0f32f1770c259467e6f27e713437b1e
MATLAB
1,064
29
function [xy_long,xy] = Hough_Midline_Detection(closeBW) [H,T,R] = hough(closeBW); % imshow(H,[],'XData',T,'YData',R,'InitialMagnification','fit'); xlabel('\theta'), ylabel('\rho'); axis on, axis normal, hold on; P = houghpeaks(H,5,'threshold',ceil(0.3*max(H(:)))); x = T(P(:,2)); y = R(P(:,1)); plot(...
927de765cef9c919d6e98ab6930b846b0206ebaa6f314227f2b9df31b3763014
MATLAB
1,064
47
function [numberOfNeurons] = editor_precount1 (neuron, pathname, filename) if isempty(lasterror) == 0 %c'è errore [filename, pathname] = uigetfile({'*.jpg;*.tif;*.bmp;*.png;*.gif','All Image Files'}, 'Pick an image'); str = strcat(pathname, filename); %complete directory neuron ...
cb3ac00106ad006b5f99e39b97c379b9cc10b9a74f9dd10b27d74ac53411bb1e
MATLAB
1,065
41
%% [cols,alpha] = chooseColors; dc_mean = squeeze(mean(eval_accs,1)); rep_mean = squeeze(mean(dc_mean,4)); ae_mean = squeeze(mean(rep_mean,3)); figure('Position',[100 100 300 300]) hold on plot(ae_mean'*100) xlim([0 21]) set(gca,'XTick',[0 5 10 15 20]) set(gca,'XTickLabel',[-3 -2 -1 0 1]) xlabel('Time (s)') ylabel('...
fcaeeb6ad65f650355f7236669f658403c42d21624e5c693aa77d649cd66df69
MATLAB
1,065
29
% Settings start_time = 55; % seconds % Signal 1 fs1 = 10000; % Sampling frequency [Hz] f1 = 0.01; % Signal frequency [Hz] duration1 = 100; % Let's say 100 seconds duration t1 = start_time + (0:1/fs1:duration1-1/fs1); % timestamps signal1 = sin(2*pi*f1*(t1 - start_time)); % remove start offset for pure sine % Signa...
fd1a88d85a0f8adf2a176aacda5e2690d047aae248403404cfb77babe3846e0a
MATLAB
1,065
29
%Recursive Zonal Equal Area Sphere Partitioning: Illustrations % % Recursive Zonal Equal Area (EQ) Sphere Partitioning Toolbox. % Release 1.10 2005-06-01 % %Functions by category %===================== % % Illustration of EQ Partitions of S^2 or S^3 % show_s2_partition 3D illustration of an EQ partition of S^2 % ...
7e85892be57e1858fc6a6206ef333bcfa175e6f33895ea0864f75f2b3af6f3c0
MATLAB
1,066
38
%% TEST ILLLSUTRATE Nensambles=6; frame_ensembles=cluster(Tree,'maxclust',Nensambles); % START % Checking Redundant Ensembles NeuroVectors=zeros(20,Nensambles); for nn=1:Nensambles EnsembledNeurons{nn}=find(sum(Rclust(:,frame_ensembles==nn),2)); NeuroVectors(EnsembledNeurons{nn},nn)=1; end DistaVec=squareform(p...
6d39dd6fce142d1db958730e28e7fb5292aa36a069da2a08198264842fe4c62b
MATLAB
1,067
47
function plot_spectrum_increase(Data, Freqs, xLog, xLims, PlotProps, Labels) % plots spectrum changes of all participants, with mean change on top in % black. Based on chART plotMountains(). % Data is a P x 2 x F matrix. % xLog is either true or false, about whether the x axis should be logged. % Lapse-causes % plot ...
0f61e2ab2e36fa702801a3dc2aae30e2e43dd12ce530645658becdd4f9889422
MATLAB
1,069
32
function E = ECGModelErrorTimeBased(observations, params, time) % % A time-based version of ECGModelError() for generating a sum of Gaussian % model. % % Open Source ECG Toolbox, version 3.14, February 2019 % Released under the GNU General Public License % Copyright (C) 2019 Reza Sameni % reza.sameni@gmail.com % This...
e4cc7f10e8d8fe6d5eabd474ec1a257d9fea13f0b2e3969941a452c4fa0c7744
MATLAB
1,069
30
clear clc close all % Load the data file data_struct = load('../../../../../DataFiles/PhysioNetChallenges2023/Sample_files_new/BIDMC_updated/ICARE_0097_20000102_185034.mat'); % data_struct = load('../../../../../DataFiles/PhysioNetChallenges2023/Sample_files_new/ULB_updated/ICARE_0066_20000101_211200.mat'); % Extract...
e6dd6332943dd71f669267072d1daf50001a6721f33578d3a219b01d48c964bb
MATLAB
1,073
29
function [data,ts,name, unit] = current_signal(app, channel_index) %CURRENT_SIGNAL returns data, dt and max t , name and units for the current %interval for the selected signal. adapts for the different timescale of %derived signals % Detailed explanation goes here if app.data(channel_index).derived data = app.d...
6f7ed4b10d8895a02fafc8facb87941d0aef39674f80af84952a3002e90f1537
MATLAB
1,074
32
% test baseline wander removal by curve fitting % Status: UNDER TEST % Reza Sameni, 2005 clear; close all; % load LTE07102005_40s.txt -mat;data = LOUETTE_40s';clear LOUETTE_40s % load fortict_20-Jan-2006.datfortict_20-Jan-2006.dat_acq.mat; % load fortict5_20-Jan-2006.datfortict5_20-Jan-2006.dat_acq.mat;data = data'; %...
1ead7653bbfec07073c30638153ab91fc1bdd73ef6c06054b1dbe042016d7c22
MATLAB
1,075
42
function smodel(session, channel, unit) % Sparse variable generalized linear model framework % % Parameters % ---------- % - session: scalar % Session number with format: yymmdd % - channel: scalar % Channel number % - unit: scalar % Unit number fprintf('===== S-Model ...
541835245b2c8bdadb2d0162432f5a2b8822e3351999db20afe8cbd0f0fb7fa0
MATLAB
1,075
45
%% Inhibition suppresion % input: % LDEUseI I firing rates % Thrsld Threshold we start suppresion, i.e., below Thrsld should % be identity map % Highist [largestinput, largestoutput] % varargin1: hard bound % varargin2: Linear cap or constant cap % Using second order func...
9381c53638a1d546bb41119a5780c789f106bb3fbc491083186c87a59a1ab852
MATLAB
1,075
36
function DirListSelected = XxDir(path, DirType, OutType) % ------------------------------------------------------------------------ % XxDir: return subdirs of the input path % % usage: DirListSelected = XxDir(path, DirType, OutType) % where, % path -- root path % DirType -- type of file to glob, eg: ...
8322ad0c226e12cfbb069e05d257a2b01ef72637bfd6b277ef946c69573cac2d
MATLAB
1,076
34
function success = exportToCSV(obj, zeroIndex) %EXPORTTOCSV Export spike times, sites, and clusters to CSV if nargin < 2 zeroIndex = 0; end spikeTimes_ = double(obj.spikeTimes) / obj.hCfg.sampleRate; spikeSites_ = double(obj.spikeSites) - double(zeroIndex); filename = jrclust.utils.sub...
d6cc0ef8093291ce13a0d3d736345d73410be76d3ba62233c25e8832e0ce4caf
MATLAB
1,076
35
% save fieldtrip extracted brain project_dir = '.\Children'; % project_dir = '.\Adults'; fieldtrip_path = [project_dir,filesep,'fieldtrip-20220906']; if ~exist(fieldtrip_path,"dir") error("change 'fieldtrip_path' to valid path") else addpath(fieldtrip_path) end ft_defaults; for n=1:27 ...
a2609ad4c34292450e0fe2d1f47cb3a166cf7454da88921dbd53640c2792ec81
MATLAB
1,077
38
function [s, peaks] = PiCA2(dat,ref,refframe,th,wlen1,wlen2,Itr) % % % t0 = 90; % reference frame center % % % w = 5; % reference frame half width % % % wlen1 = 10; % exclusion averaging frame half width (should be more than the fetal expected effective width) % % % wlen2 = 50; % peak exclusion window hal...
a43c3513095b7b22bde1f857045a888ceb52b5abfb9bd1e3a7fe79b0431e98e0
MATLAB
1,077
36
function f = shepard_spear(trueDists,redDists,plotTitle,xaxisTitle,yaxisTitle) %UNTITLED Summary of this function goes here % Detailed explanation goes here if size(trueDists,1) == 1 trueDists = trueDists'; redDists = redDists'; end %disp is the isotonic regression mapping from pcaDists to trueDists dispari...
642b39de31b746d12d8921c8bd55a8adf7bf6552c51d66960a34c2efc7621e92
MATLAB
1,079
27
from npyx import * dp = 'C:\Users\elyashivz\Documents\code\electrophysiology\electrophysiology\analyze_electrophysiology_data\pl2kilosort\files\sequence\'; % load contents of .lf.meta and .ap.meta or .oebin files as python dictionnary. % The metadata of the high and lowpass filtered files are in meta['highpass']...
0d9a8e605cfda94c793f2f9b5acfff216b1cf6a79fa37c744cc027b00d003bdb
MATLAB
1,080
30
function y = lp_filter_zero_phase(x, fc) % lp_filter_zero_phase - Second-order zero-phase Lowpass filter. % % Syntax: y = lp_filter_zero_phase(x, fc) % % Inputs: % x: Vector or matrix of input data (channels x samples). % fc: -3dB cut-off frequency normalized by the sampling frequency. % % Output: % y: ...
3c7c9904ea8d01176ee63c82d9d98a52fa546fa9ec477ea4826599873326dbcb
MATLAB
1,082
45
%% plot raw frame and overlay figure('Position',[200 200 300 300],'Renderer','painters') hold on imagesc(frame_fil) %imagesc(frame_aligned) colormap gray for i=1:length(cvxHulls) % theres a shift when saving the image.. counteract here plot(cvxHulls{i}(:,1)-2,cvxHulls{i}(:,2)-2,'Color',[0 1 0 0.5]) end ...
e907502748840957109e38923151b22dca84990c9a48291243c0df16229929f7
MATLAB
1,082
50
%% Function of serotonin neuron firing. %Commented functions are different firing paradigms. % UNITS of f() in events/h, time variables in seconds. function f = fireht(t, i_factor) %Repeated stim. n=length(t); r = 8; repeat_time = 60*10; t_start = 5; t_flip = 7; t_end = 15; basal = 1; b = 2; max_f = 1.5; stim_bo...
0805ede6de47e12219371d1ee9e16ae01d9a4257ad7c6c672b05403424e5ba0c
MATLAB
1,083
32
%Recursive Zonal Equal Area Sphere Partitioning: EQ partitions % % Recursive Zonal Equal Area (EQ) Sphere Partitioning Toolbox. % Release 1.10 2005-06-01 % %Functions by category %===================== % % Partitions % eq_caps Partition a sphere into to nested spherical caps % eq_regions Re...
d5a625e50e679f1ccbab7b5ef90580c6f307cd94fb86125b0ed374199c931590
MATLAB
1,083
35
%% Checking Significant Peaks of the Clusteres Raster % require: Ensemble_Sorting; %% % Input: cond=2; % Condition N=4; % Significant level: non random coactivity % Raster=R_Dyskinesia_Analysis; % Analized Raster % Raster=R_Clozapine_Analysis; % Analized Raster Raster=R_Amantadine_Analysis; % Analized Raster Intervas...
4ed69448d59e04f23301f7932c66c2ea8c027f316cadc7e487fd942c9ef87e42
MATLAB
1,084
38
% % Test program for mean ECG extraction. % % By: % Reza Sameni, September 2006 % LIS-INPG, Grenoble, France - Sharif University of Technology, Tehran, Iran % reza.sameni@gmail.com clc clear close all; load('SampleECG2.mat'); data = data(1:15000,2)'; fs = 1000; t = (0 : length(data)-1)/fs; f = 1; ...
80643f6369aedeae6c590952ee936ca2b344b45e79d39f4929120e57a0bf6b86
MATLAB
1,084
36
function [sites, dists] = findSiteNeighbors(siteLoc, nNeighbors, ignoreSites, shankMap) %FINDSITENEIGHBORS Get the nearest neighbors for each site if nargin < 3 ignoreSites = []; end if nargin < 4 || numel(unique(shankMap)) <= 1 shankMap = []; end % set ignored sites infinitely ...
96d91f3bb0c0cd9675555a6725da9fa95e157586e43be0ce3980d600be09a6dd
MATLAB
1,084
17
cd('I:\My Drive\ELYASHIV\PFC_paper_results_after_revision\effect size\f4\h') control = importdata('responsive cells per exp_control.mat'); eopn3 = importdata('responsive cells per exp_eopn3.mat'); %% responsive = [control.reponsive_cells_expsT{:,2};eopn3.reponsive_cells_expsT{:,2}]; IE = [control.IR_sugnificant_...
a6be6506806a8f099c2a18bf0fb9fa2d640f1af4b7c53a3d338c8b58fea70497
MATLAB
1,085
28
% plotting one task - one plot for each session in a given time (CompLat) %gets its input from scalpmap_matrix clear all; %load('G:\BORI\bedrest\RENDEZETT\A) Bedrest_EEG\EEGÖsszes\5.P3a_P3b_abrak\GrandavgVisualP3aSkalphoz.mat'); % scalpMapMatrix_VisualNovel % scalpMapMatrix_SoundNovel % scalpMapMatrix_Visual...
e53091f83627322abb213040a8ace0cda78efe58bf231b2f9c22b18dd822b0d7
MATLAB
1,086
1
function [wv,g]=rst_winvar(x,percent) % function [wv,g]=winvar(x,percent) % returns the winsorized variance of x as wv % returns number of winsorized observations at each tail of sample as g % x must be a vector % percent must be between 0 and 100; the function winsorizes the lower and % upper extreme g values of x, w...
2fd033c938495162ab57ed7bc1c99380cfa96bed7999a776801f6c47ab5d6c82
MATLAB
1,087
30
%{ ---------------------------------------------------------------------------- Determine the time window for task relevant neurons %Start of task %Sound on %Sound off %Before choice %After choice (0sec) %After choice (1sec) %After choice (2sec) %Compare sound, choice prior during long sound (-100 ms to 150...
50918a3da1dac56f259a80900c39c7aa5d3e7fe91cfadb5cc5d6428597f4b8b8
MATLAB
1,087
26
function RasterData=raster(TimeStamp,TurnMarkerTime) %TurnMarkerTime‚ðStartTime,FinishTime“à‚ÉŒÀ’è‚·‚é‚© RasterData=[]; for n=1:length(TurnMarkerTime)-1 DataTemp=TimeStamp(TimeStamp>TurnMarkerTime(n) & TimeStamp<=TurnMarkerTime(n+1))-TurnMarkerTime(n); y_Temp=ones(length(DataTemp),1)*n; RasterData...
b3f60219959757cdfbf4590f830c30322e27fa50f6874c96fa1853d77c00a0a6
MATLAB
1,087
21
% HBF_TM_PHI_LC makes a BEM transfer matrix for potential using LC approach % % [T,startinds,endinds]=HBF_TM_PHI_LC(D,ci,co,zerolevel) % D: D matrix, cell [N(meshes) x N(meshes)] % ci: conductivity inside each boundary surface, [N(meshes) x 1] % co: conductivity outside each boundary surface, [N(meshes) x ...
bb0e0ef91c6f0887383988728c653e4b06194268c959618a1f20c7a9c1c65387
MATLAB
1,087
48
%% clear p = params_2DAA; fpath = fullfile(p.processed_data_dir,'allData.mat'); load(fpath,'evs','tis','bvs','traces') [cols,alpha] = chooseColors; fpath = fullfile(p.data_dir,'subspace_decomposition_one_subspace'); load(fpath,'all_dims','all_qs') fpath = fullfile(p.data_dir,'tone_dim_analysis'); saveFigs = 1; saveDa...
0710042e166e3d910615fd76df3c3e4399ec5e7e415674fe4ff306943a924acb
MATLAB
1,088
43
function [map, delay_bases, time_bases] = decide_bases_fast(session, channel, sigma) % Decide about resolution of bases % % Parameters % ---------- % - session: scalar % Session number with format: yymmdd % - channel: scalar % Channel number % - sigma: scalar % Scale standa...
2ccbc3bea23072c16ea5b7b53d55112e7b27c109320bb83f4ed9e397f2e3ce71
MATLAB
1,088
37
function f = ciplot(lower,upper,x,colour) %% ciplot % ciplot(lower,upper) % ciplot(lower,upper,x) % ciplot(lower,upper,x,colour) % % Plots a shaded region on a graph between specified lower and upper confidence intervals (L and U). % l and u must be vectors of the same length. % Uses the 'fill' function,...
158cdb3780457b29bbfb546cafa25f44335189f440a92824b4cd83ced427d7f0
MATLAB
1,089
28
function [scalpSubset, subsetInd] = getScalpSolSpaceSubset(gmSurfaceMesh,scalpSolSpace,ROIgmNodeList,maxRho) posGM = gmSurfaceMesh.node; posROI = posGM(ROIgmNodeList,1:3); nposROI = length(posROI); nScalpPos = length(scalpSolSpace); count = 1; for i = 1:nScalpPos %First find gmdepth [~, ~, gmDepth] = DOT...
66c1574820dbaf11ad1c7b53d1af61ea9d163753842ad3a157efd8be0615e712
MATLAB
1,089
28
function [] = writeNexVarHeader(fid, varHeader) % [] = writeNexVarHeader(fid, varHeader) -- write nexVarHeader structure % to the specified .nex file. % % INPUT: % fid - file id % % varHeader - nexVarHeader structure fwrite(fid, varHeader.Type, 'int32'); fwrite(fid, varHeader.Version, 'int32...
de4d02004896d2f603dc2a77027b318600b03710502fa5595eb9675bad3f504a
MATLAB
1,090
39
function properties_distributions(Structure) if isstruct(Structure) Labels = fieldnames(Structure); else Labels = Structure.Properties.VariableNames; end Labels(contains(Labels, 'Idx')) = []; % ignore fields that are indixes Labels(contains(Labels, 'Start')) = []; % ignore fields that are indixes Labels(contains(Labe...
1bef66b2d118b125cc9ce30f4c09166a6b611c7857112facca7c351736db8d0d
MATLAB
1,091
29
%% From neuron vector to spatial map of pixels % Input: FrE: Quantity vector for neurons, N*1 % NnE: Spatial mapping of neurons, struct with X and Y coordinate % info % NPxX/Y: Total Number of pixel on X dir and Y dir % % Output: SpaPixMat: Pixel Mat, averaging neurons in each pixel % NnEP...
0ae131b7aa80fad6d11eef11845605b336c73403fdb5e87b3f326cc68e9a450e
MATLAB
1,092
46
function s = euc2sph_dist(e) %EUC2SPH_DIST Convert Euclidean to spherical distance % %Syntax % s = e2s(e); % %Description % S = EUC2SPH_DIST(E) converts the Euclidean distance E to the spherical % distance S, using a formula which is valid for the unit sphere in all % dimensions. % % The argument E must be a real numb...
ac745093623cc70d612ccf996f0a72d262f1a07665f14591d661a63317747b68
MATLAB
1,092
23
function newCoords = convert2Dto3D3(coords2D, 2d_common, 3d_common) % convert2Dto3D converts 2D coordinates to 3D coordinates using 3 reference points % in 3D space % % coords2D: a Nx2 matrix of 2D coordinates to be converted to 3D % point1: a 1x3 vector representing the 3D coordinates of the first reference point ...
6940a75595b96495c3af500fadc25c65699a8b384619d417df5575f67c75043c
MATLAB
1,093
56
% pipepline to generate all figures addpath('/Users/tosot/Downloads/ASSR_newfig/pdf_fig/revisions/final/codes/functions/') % select path where to save figures Path_figures='/Users/tosot/Downloads/ASSR_newfig/pdf_fig/revisions/final/codes/figures'; % select path where data are stored Path_variables='/Users/tosot/Dow...
d67eefcb11a47b63ab8412a5cc4d65e72817ab7213907907c56981c3113ad889
MATLAB
1,093
41
% check the burst detection for a specific file clear clc close all Info = analysisParameters(); Paths = Info.Paths; %%%% Choose a file %%%% %%%% Task = 'LAT'; % Game, Standing, Fixation Session = 'Session2Beam1'; Participant = 'P08'; % P03 has almost no oscillations, P15 has tons %%%% %%%% %%%% Source_EEG = fullf...
30ab52f6ab295b6b0b7ccd67c0bd32fbafba9e0ae9be59f29550ded27f3d485b
MATLAB
1,095
29
function spmup % toolbox setting - run it once to set all paths % --------------------------------------------- % Copyright (c) SPM Utility Plus toolbox location = fileparts(which('spmup.m')); addpath(fullfile(location,'adaptative_threshold'), ... fullfile(location,'bids'), ... fullfile(location,'external'), ...
5c7334aeb5a5ee0e35f5c6bdbe1d4349908de1ddf5bb821c65f51b3eb0745454
MATLAB
1,096
45
function [Trace]=mnl_CalculateLengths(Trace,Scale) %Calculate how long each Trace is % % Inputs % Trace - Trace structure % Scale - The scale % % Outputs % Trace - Trace Structure with distances added szT=size(Trace); for i=1:szT(2) clear PointsList clear VoxList PointsList=Trace(i).Points; if isempty(...
d775c6400ccfed8085cc696ecdd3e4a02aacc6a038a20503f605bb2663cb9c8d
MATLAB
1,096
40
% Function to get the Indexs of B according to Sorting in A sorted as C: % such that C(1:end)==A(indxA)==B(indxB) as long as they are the same pair vectors % if not-> indx's & C are empty % Input % A: [EXPIDs;Condition] Size: Nx2 Categorical Vector % B: [EXPIDs;Condition] Size: Nx2 Categorical Vector % Output %...
2faced8e896d4929a33cb26a76e3fe339bf424dd67dd6d35678cdce3ee6f2382
MATLAB
1,097
35
function [isValid, errMsg] = validateReconPars(theseReconPars) % function validateReconPars(theseReconPars) % % Check that the current parameters have all the required fields defaultReconPars = getDefaultReconPars(); isValid = 1; onlyInDefault = setdiff(fieldnames(defaultReconPars),fieldnames(theseReconPars)); if ~...
f49ee985a78e410067bcfa7bb517b3ac1dac8142a2c71ba290438c36314d1eeb
MATLAB
1,099
30
function [zMean,qMean,zStd,qStd] = gamma_plus_minus_tuning_comm(A, gplusRange, gminusRange,repNum) nPlus = numel(gplusRange); nMinus = numel(gminusRange); zMean = zeros(nPlus, nMinus); zStd = zeros(nPlus, nMinus); qMean = zeros(nPlus, nMinus); qStd = zeros(nPlus, nMinus); for i = 1:nPlus for j = 1:nMinus gp...