sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e79f64e307d568cfc34f5f2d88710579928f617b803150ffe806acce15da58b0
MATLAB
641
24
function plot_a_knl_stm(session, channel, unit, prb) % Plot average of stimulus kernels of specific a-model for given probe % % Parameters % ---------- % % - prb: 2-by-1 integer vector % [x, y] postion of a probe knl = get_a_knl_stm(session, channel, unit); % time-delay map map = squeeze(knl(prb(1), prb(2), :, :));...
87d9366395b1055d16c4ff989bfc740402f12794a559c6f03dabf9d5b7d20c3f
MATLAB
642
19
function CriteriaLabels = get_criteria_labels(CycleTable, CriteriaSet) % selects the fieldnames from CriteriaSet that are also present in Cycles, % and ignores criteria that are not specific to a signle cycle. if isempty(CriteriaSet) CriteriaLabels = {}; return end CyclePropertyLabels = CycleTable.Properties....
89c10f1a74eaa0787f3bcfb09897d1650fa3dfc94d251fb354bd67b6b68d67c1
MATLAB
642
11
function Bursts = simple_burst_detection(Signal, SampleRate, BurstRange, CriteriaSet) % Bursts = simple_burst_detection(Signal, SampleRate, BurstRange, CriteriaSet) % % from Matcycle, Snipes, 2024 DataNarrowband = cycy.utils.highpass_filter(Signal, SampleRate, BurstRange(1)); % if you want, you can specify other aspec...
502bb91daee9df6270f71a375f0b614ab1547d7b7cbd4479d649caae061ad28a
MATLAB
643
19
%% flip 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); midline = 5700; %% T.side(contains(T.e...
ad5e94fc944e3cd86bb5322ae87a5d7d15c1504676a45ad1bc28b794f50e9c34
MATLAB
643
23
classdef BootstrapTest %BOOTSTRAPTEST Summary of this class goes here % Detailed explanation goes here properties Property1 end methods function obj = BootstrapTest(inputArg1,inputArg2) %BOOTSTRAPTEST Construct an instance of this class % Detaile...
fb9115979387cbd3d9589864800d99040c19fb2653bbd0d459c1fc0aeb1df951
MATLAB
643
29
function NewData = close_small_gaps(Data, MaxSize) % identify gaps [Starts, Ends] = data2windows(isnan(Data)); if isempty(Starts) || all(isnan(Data)) NewData = Data; return end Gaps = (Ends-Starts); % if any gap is too large, return only nans if any(Gaps>MaxSize) NewData = nan(size(Data)); return end ...
230a434f2b4ca7370fa0733914124a3935c992722fa94164c92e5a7313b7f718
MATLAB
644
21
[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 %% for i = 1:length(datafile) load(datafile{i}) cells = fieldnames(all_data); for j = 1:length(c...
41f50df006bd990ce62f192bfb3e1d85bd18c789a19f2fe03cbdf508afafcaf0
MATLAB
645
27
function w_deg = convert3D_to_angV(pos0_x, pos0_z, eyePos_x, eyePos_z, vel_x, vel_z) %% % Based on Rokers et al., 2018 derivations. %% example inputs. Unit is arbitrary but must be consistent. % pos0_x = 100; % pos0_z = 100; % % vel_x = 0; % vel_z = 135; % % eyePos_x = 0; % eyePos_z = 0; % get intial angle of obje...
01ade668e66d69af257caf516e377ef5a2806887b4d4cc49a4dd94428e8c0a8b
MATLAB
649
33
%% Error plot % errorplot(x, y, va, col, alp) % Roger Koenig function handle = errorplot(x, y, va_max, va_min, col, alp, linewidth) if nargin == 5 linewidth = 1; end if size(x,1) ~= 1 x = x'; end if size(y,1) ~= 1 y = y'; end if size(va_max,1) ~= 1 va_max = va_max'; end if size(va_min,1) ~= 1 va_...
0f16ee8aac99fa296f043f6ff9b7b65c4a43e114e00a9c7a5153ebb0cf3d04e2
MATLAB
649
16
% 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...
a2a230bea76274811fae669581696437ebd8522c06616b34fc58b9fb1f493fcc
MATLAB
649
26
% delete non relevant nds [datafile, path] = uigetfile('*.mat','MultiSelect','on'); cd(path) nds = [10,8,6,4,3,2,1]; for i = 1:length(datafile) load(datafile{1,i}); if iscell(all_data) all_data = all_data{1,1}; end cells = fieldnames(all_data); for j = 1:length(cells) c = all_d...
a4a99fb1846d961da1469b01f9205c867c667d4df6830a507adf47ac888bf971
MATLAB
649
18
% add retroMoCoBox subfolders to the path (without including all the git % subfolders!) retroMoCoPath = which('addRetroMoCoBoxToPath.m'); [retroMoCoPath, ~] = fileparts(retroMoCoPath); addpath(retroMoCoPath); addpath([retroMoCoPath '/export_fig']); addpath([retroMoCoPath '/fatnavtools']); addpath([retroMoCoPath '/gen...
a92466db2a9227400ea98c685752cb1a435c3286b8a7ce657ea355989f291c88
MATLAB
650
17
% 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...
dbbb187139d232f8587042dfe29708215902bdcb6c6257d67bfda5b3b839c3f1
MATLAB
650
11
function X = dtft_mex(varargin) disp('This dtft_mex.m is a dummy m-file that is included to provide') disp('a reminder that you must have the Mex file "dtft_mex.mex???" that') disp('is appropriate for your system. For pc-linux (32bit), the mex file is') disp('called "dtft_mex.mexglx", which is provided in the "mex" ...
2bec41a090c1148cc6a0584259a6f2c564776fdc724662b19ac935ba5a316a7d
MATLAB
652
15
function Binary_Image = Update_Binary_Image(Im_CNN,Binary_Image,Min_Object_Size,Reset_Flag) if(Reset_Flag) Binary_Image = zeros(size(Im_CNN)); Binary_Image(Im_CNN == "Neuron") = 1; % Set to 1 pixels that are above the preset threshold. end % Delete sub-threshold objects from the binary image: CC = bwconncom...
9d8ecdb487eff34c43ce4336beddf23c2c813a48359b9df2bdaaf32cd80ea585
MATLAB
652
23
function setCustomProp(obj, propname, val) %SETCUSTOMPROP Set a property not included in the defaults if ismember(propname, obj.deprecatedParams.unsupported) return; end % ignore property if it's Dependent propData = ?jrclust.Config; propNames = {propData.PropertyList.Name}; depende...
739c592c71064819a030ba620124d2f6c57207e7b63f5911d026c0e9c7d1b83a
MATLAB
653
15
function [ output_args ] = runApplyFiltersJoint( p ) % joint extraction was run already, here we only apply warping, % normalization etc. to the session videos and use the spation filters to % obtain the temporal traces for sub = 1:p.nSubjects disp([char(datetime('now')) ' Starting applyFiltersJoint for Mo...
2ae9b613df93cbd108413a1bf5e7d360ff522832c905936be40457a0fb6633f0
MATLAB
654
16
function WindowedStim = average_windows(ProbTrialStim, TrialTime, Windows) % average timepoints into windows. PropTrialStim is a P x TT x Ch x t % matrix. TrialTime is a vector of the trial timepoints in seconds. Windows is a W x 2 % array in seconds WindowsCount = size(Windows, 1); ParticipantCount = size(ProbTrialSt...
eb1908659d878236a34712b271fe4c434cb67dce19879d31bed250d513fd81f1
MATLAB
655
19
%% flip brain render table of clusters 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); midline = 5700; %% T.side(...
53ae15e452d468f064f70219de04cc547a5300b23458416dabbce8f5779c8857
MATLAB
656
28
%Basic implementation of HIO algorithm %Fienup, James R. "Phase retrieval algorithms: a comparison." Applied optics 21.15 (1982): 2758-2769. %Adapted from work by Prasanna Rangarajan function x = HIO( y, A, At, support, beta, iters, x_init ) %Assumes x is real if isnumeric(A) A=@(x) A*x(:); At=@(z) A'*z(:); end...
a98369e2438d801e3ff276bdf90ca0757bf8bfd8a174dafb2b6db7fa99e86c1b
MATLAB
658
15
function [params model er] = ECGOptimizeModel(x, indexes, meanphase) tetai = meanphase(indexes); alphai = 1*x(indexes); bi = .01*ones(size(alphai)); % options = optimset('TolX',1e-4,'TolFun',1e-4,'MaxIter',100); options = optimset('TolX',1e-4,'TolFun',1e-4,'MaxIter',100,'Display','off'); InitParams = [alphai bi...
48db0fdfff3efd3afaa0ca7e63878dada12757d18ea5f2c5d82f52a3e3d6b80f
MATLAB
660
27
function fVis = toggleVisible(obj, plotKey) %TOGGLEVISIBLE Toggle visibility of plot by key if isempty(plotKey) return; end if iscell(plotKey) cellfun(@(pKey) obj.toggleVisible(pKey), plotKey); return; end if ~obj.hasPlot(plotKey) return; end hPlot = ob...
653385b2568374f7c597d82f393e8aac0741e2c553b44ec6491551f5393b3646
MATLAB
660
25
function [po, fs] = get_PSD(data,f) S = []; eD = []; S.trialength = 5*f; for n = 1:floor(length(data)/S.trialength) eD(:,:,n) = data(:,((n-1)*S.trialength) + 1:n*S.trialength); end % set flattop window nepochs = size(eD,3); F = [0:.1:600]'; pow = zeros(size(F,1),size(eD,1),nepochs); wind = window(@flattopwin,size...
70184783a1c2dcf57311425a6e6a877712feb41c72827c8e56cf0840b063f89b
MATLAB
660
27
function x = fatrix2_do_back(ob, y) %function x = fatrix2_do_back(A, y) %| %| implement 'back' function: A' * x %| in array mode, accounting for idiag, odiag, scale %| %| trick: conj() of idiag odiag scale already done in ctranspose.m y = fatrix2_apply_diag(y, ob.odiag); % [odim *L] x = ob.handle_back(ob.arg, y); % [...
79760932415b64cbd26dbb021b5d80cc01cbeac6bfb3ea22012a68eb668ecc72
MATLAB
660
22
function c_polar = polar_colat(dim, N) %POLAR_COLAT The colatitude of the North polar (top) spherical cap % % Given dim and N, determine the colatitude of the North polar spherical cap. % % c_polar = polar_colat(dim, N); % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. % $Revision 1.10 $ $Dat...
25752a2e110b95f651a608cec9b8ab64b08f316d2575be1ba20115d4dc1ca762
MATLAB
661
27
function tf = streq(a, b, n) %|function tf = streq(a, b [,n]) %| %| return 1 if two strings "a" and "b" are equal %| (optionally checking only up to 1st n chars) %| caution: whereas strcmp allows comparisons of cell arrays, %| this routine allows only two strings. %| %| Jeff Fessler if nargin == 1 && strcmp(a, 'test...
8e1f4154c4ee583cf144acf720d506465c67e366ac783ab6bb4c4c5397a31ddf
MATLAB
661
31
function animal_sorted_BF = extract_animals_SW (BF) % puts data after the SPL analysis into a format for IQR analysis. BF_animals = BF; BF_animals_numbers = num2str(BF_animals(:,6)); BF_animals_numbers = BF_animals_numbers(:,1:end-7); BF_animals_numbers = str2num(BF_animals_numbers); BF_animals(:,6) = BF_a...
e043107ca5b58a21cc99a8c8b648cedcf34d3a510279c85fc502dbf54b5fb918
MATLAB
663
12
function updateNoteMenu(obj) %UPDATENOTEMENU Update menu entry to indicate selected clusters if numel(obj.selected) > 1 && obj.hasMenu('InfoMenu') menuLabel = sprintf('Unit %d "%s" vs. Unit %d "%s"', obj.selected(1), ... obj.hClust.clusterNotes{obj.selected(1)}, obj.selected(...
0a1e476238c5862d0b1182de0d66697ecd1264bab2aa0f4e5bc2714506683324
MATLAB
664
24
function [xv4,yv4] = rotate_vector_origin(xv1,yv1,origin1,angle1) % xv, yv are the rectangle vectors. xv1 = [px1 px2 px3 px4 px1]. yv1 = [py1 py2 py3 py4 py1]. % origin1 is the origin coordinates. origin1 = [x,y]. % angle1 is the rotation angle in degrees. % Translation to the axis origin: xv2 = xv1 - origin1(1)...
51d8eb2f93a98d8d0b5ffab14352b948b09c9a4835cbb52669796d7bdccd77e3
MATLAB
664
31
function [ espec ] = compute_shared_eigspec( fa_model ) % % computes the shared eigenspectrum % % Input: % fa_model - (struct), factor analysis model parameters % % Output: % espec - (list), eigenspectrum of the shared covariance matrix % % @ Akash Umakantha, 2021. See https://www.biorxiv.org/content/10.1101/2020.1...
804a8d0ce06bdba89ad09faa9c61acd30874c680129af9d893b6063e20b3f900
MATLAB
665
24
function region = sphere_region(dim) %SPHERE_REGION The sphere represented as a single region of an EQ partition % % An array of two points representing S^dim as a region. % % region = sphere_region(dim); % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. % $Revision 1.10 $ $Date 2005-06-01 $ %...
0224d16f5c5c259cb441a0d189cd7970740cc9082758c0cfeb0cc92732b2fcb4
MATLAB
666
18
function FinalTable=metrotable(METRICS,labelconditions) FinalTable=table; for c=1:numel(METRICS) % Multiclass Binary Complete * * * * * * * * * * * * * * * * * * * * * MCmetrics=METRICS{c}; MetricsNames=fieldnames(MCmetrics); RowName{c}=char(labelconditions(c)); RowString=cell(1,numel(MetricsNames))...
29ef2d525d882ba2174867782ec50ff7baa1518627bcb8e89fb03776257f85eb
MATLAB
666
31
% clone thid first: https://github.com/alphanumericslab/OSET/tree/staging clear close all clc fs = 250; x = lp_filter_zero_phase(randn(1, 100000), 1.5/fs); x = x - lp_filter_zero_phase(x, 1.49/fs); sign_changes = x(1:end-1) < 0 & x(2:end) >= 0; % case I % sign_changes = x(1:end-1) .* x(2:end) <= 0; % case II I_sign_...
7545a74d41901602e112d064dcc675f6d5b48c729fb4fc7e5c9b918d2f6258ed
MATLAB
666
22
function [selectwl, selectint] = spectralInterpolationSpectrometer(tr, wl, int) %interpolate intensity values to a 0.1 nm interval for k = 1:size(int,2) xi = 300:0.1:800; pp = interp1(wl(:,k),int(:,k),'linear','pp'); yi(:,k) = ppval(pp,xi); plot(wl(:,k),int(:,k),'ko'), hold on, plot(xi,yi(:,k),'r:'),...
8d6edfa8fef8f06be31df3aabc6e960cfefcc9c05916298504c385dd6b5dfc16
MATLAB
668
17
% this function is used to insert the spike traces inferred from the % rescaled traces into the typical pipeline Fall.mat files base_dir = 'xxxx'; all_Fall_files = dir([base_dir, '\**\complete_data_Fall_rescaled_0.86.mat']); all_Fall_files_spk = dir([base_dir, '\**\complete_data_Fall_rescaled_spks.mat']); fo...
0fd790468bd44747d562d33c3765c0ab78c5c9df89540ffa1d68c8dd4b2e2d82
MATLAB
669
20
%% IR+responsive left_vs_right L_T = T(T.side == "Left","cluster"); L = groupcounts(L_T, "cluster"); L.GroupCount(4) = sum(L.GroupCount); clusters_text = ["early+stedy"; "early"; "steady"; "total"]; L.cluster = clusters_text; R_T = T(T.side == "Right","cluster"); R = groupcounts(R_T, "cluster"); R.GroupCount(4) = sum(...
4508c32a87a9729afb1f351525b4d17d00ee601c64d8c0bb801c079caaf57de4
MATLAB
670
21
%% Rate of production of bh4 from bh2. % UNITS in uM and uM/h % b = BH2 % c = NADPH % d = BH4 % e = NADP function a = VDRR(b,c,d,e) k1 = 100; %Km for BH2 (BRENDA) (6-650) k2 = 75; %Km for NADPH (BRENDA, values 770,110,29) (schumber 70-80) V1 = 5000; % Vmax forward k3 = 10; %Km for BH4 (BRENDA) (1.1 to 17) k4 = 75;...
6622d9aa707f6c02b797141351d500699f404aa09c8a6c21dde2f2a33b9f23d3
MATLAB
670
23
% fig_taper_cos3 % compare 3 different interpolation kernels: % min-max kernel with uniform scaling factors % min-max kernel with optimized scaling factors % cos^3-tapered dirichlet kernel of magnusson J = 6; N = 1000; K = 2 * N; k = linspace(-J/2,J/2,101)'; fm = diric(2*pi*k/J, J) .* cos((2*pi*k/J)/2).^3; % tapered f...
9ee973deb9417f35af4c2e53fb50939b8479ddbe5bd19931fe0534c02a4f5f7a
MATLAB
670
36
%%%%%ANALISI DELLE COMPONENTI PRINCIPALI%%%%% load datamatrixPCA.mat str={'objects PCA', 'variables PCA'}; [var,v] = listdlg('PromptString','Select PCA:',... 'SelectionMode','single',... 'ListString',str); if var == 1 %PCA sugli oggetti DMp1 = [DMp, ones(7,1)]; ...
18ad2a448796f6eb6f46df49e367db12f1f6693b9607c85456f743a63d4a7bf7
MATLAB
671
26
function [D] = meshdot(q,X,Y,Z) %meshdot - returns dot product of q with meshgrid input at each point %on the grid. siz = size(X); assert(length(siz) == 3,'Meshgrid dimensions != 3'); assert(siz(1) == siz(2)); assert(siz(2) == siz(3)); assert(siz(3) == siz(1)); D = zeros(siz); %Iterate through all x, y, z values, m...
8894367fdbcae247e970a222ae44abb534fa87ea3a85dafdb6fd667aef24cf26
MATLAB
671
15
function [RisingEdgeCrossings, FallingEdgeCrossings] = detect_crossings(Signal, CrossingValue) % finds all the timepoints in which the signal goes: % - from greater than CrossingValue to less than CrossingValue (falling edge crossing) % - and from less than CrossingValue to greater than CrossingValue (rising edge cros...
aa07497b4c4b4c4eb9b5db738780611c7095c7345b0f40576e87aa6579e3ca45
MATLAB
671
18
% HBF_LFM_B_LC_DIR builds magnetic lead field matrix based on directed % current dipoles. % % LFM=HBF_LFM_B_LC_DIR(meshes,coils,TB,spos,sdir) % meshes: BEM geometry, cell array of hbf structs % coils: coil description, hbf struct % TB: TB matrix built with the hbf BEM solver % spos: source pos...
e3cd6604e63860dcf142736323e30b83d89c48b6120ddc6a60c192998e0d8730
MATLAB
671
27
function p = circ_iqr(alpha) % CIRC_IQR - estimates the interquartile range of circular data % % INPUT & OUTPUT % ------------- % alpha - input data (in radians, not binned) % p - estimated iqr % % METHOD % ------------- % For normal distributions IQR can be estimated from the % standard deviation of the sample, ...
73557d51fe8fc9179a90955de49d7a8f16454e427605a905950f157db2accd4b
MATLAB
674
18
function [hAxes] = plotADOutputText(AD,varargin) % Manage Inputs ############################### varInputs = inputParser; addParameter(varInputs,'hAxes','',@ishandle); parse(varInputs,varargin{:}); varInputs = varInputs.Results; if isempty(varInputs.hAxes) hAxes = gca; else hAxes = varInputs.hAxes; end outpu...
f42f0913530324c616a421648579c04b7dcb2f6394f93087af058f800c5420cc
MATLAB
674
25
function [sigma_xy, sigma_z] = XxGuassianFitting3D(psf) addpath(genpath('../')); [Ny, ~, Nz] = size(psf); y = double(1:Ny); z = double(1:Nz); psf_z = squeeze(max(max(psf,[] , 2), [], 1)); [~, I] = max(psf_z); psf_xy = psf(:, :, round(I)); % calculate psf_y [~, I] = max(sum(psf_xy,2)); psf_y = XxNorm(psf_xy(I,:),0,10...
b8a37e5618ab9c6d2f1ba20620209f599950b6b537988be864959ad862fd5f50
MATLAB
675
25
function generated_states = states_from_exo(X,k,Q) %Function to generate states from task data for simulation purposes %% Input %X: NxC matrix of task conditions where N is the number of time points and %C is the number of conditions %k: the number of states to be drawn %Q: kxkxC array of transition kernels associated ...
45c1c959a186ed12ac33b55ad14ef5102e0681bbd06be1a67dced6fb35fb5268
MATLAB
676
25
function [ areas,centroids,cvxHulls,cvxAreas,outlines ] = getFilterProps( filters ) thresh = 0.6; for i = 1:size(filters,3) pic = filters(:,:,i); pic = pic > thresh*max(pic(:)); % get biggest connected component bwcc = bwconncomp(pic); [~,maxIdx] = max(cellfun(@(x) length(x),bwcc.PixelIdxLi...
2047b62ee1a476c8bb21a6fb568721510008bf033e519d1256d5cf828f60c7a6
MATLAB
677
26
function plot_f_knl_stm(session, channel, unit, fold, prb) % Plot stimulus kernel of specific f-model for given probe % % Parameters % ---------- % % - fold: integer scalar % Fold number % - prb: 2-by-1 integer vector % [x, y] postion of a probe knl = get_f_knl_stm(session, channel, unit, fold); % time-delay map ...
4fbef43daee62f2f2c55832f9847008592a99420d8832dc6119caee3e9f4007e
MATLAB
677
18
function save_processeddata(FolderNamePD,ESTSIGNALS,SNRwavelet,TAUSall,isSIGNALS,notSIGNALS) % Call Global Variables: global DETSIGNALS; global preDRIVE; global preLAMBDAS; global RASTER global Responses global SIGNALSclean; global SNRlambda; global Experiment; global RasterAlgorithm; % Direcotry to Save: Up from this...
f2b26d639a247c5e523068bf8cd4e21dcce7ee6890dad4128d70e56ff1089247
MATLAB
678
29
[file, path] = uigetfile('all_areas_per_exp.mat','MultiSelect','off'); cd(path) load(file) mkdir("spect") cd("spect") %% fs = 100; t = 0:1/fs:20-1/fs; earias = fieldnames(meanLFP); for i = 1:length(earias) f1 = figure; f1.Position = [100, 100, 800, 800] for j = 1:7 subplot(4,2,j) x = meanL...
a05eb77bf960771943efc53ab97d4dbffc0ff50e324d45d0415a6575240fc4af
MATLAB
679
19
function MIDstr = getMIDstr(thisFile) % function MIDstr = getMIDstr(thisFile) % % From a filename of the standard Siemens TWIX form, e.g. % meas_MID00100_FID03307_MPRAGE_motion_FatNavs_1mm_iso.dat % this function should return the number after the letters MID. This is % useful to keep track of separate datasets in the ...
133573d2f386569d5d74118e1ee7019aa81f6910c0d2341207e0548ebf14f2b3
MATLAB
680
20
%% Clustering Setups % SimmEnsTH=0.8; % Ensemble simmilarity MaxEnsembles=10; TimeDommEns=55; % Portion of presence of one ensemble parseq=3/4; % Portion in a ensemble is activated RatioHebb=10; % Minimum % Of the Hebbian Ratio ActiveNeuronsRatio=0.75;% Ratio of Active Neurons Ac...
488a9755c5564b64444e11c700ef83f307674f110a168d6d5c614a3f55b4d5ee
MATLAB
681
15
global Vinj V0 gamma Vinj = 1; % (mm^3) 1e+06 cells lambda_iv = 0.837; %(day^-1) based on in vitro fit to the average DT_invitro = log(2)/lambda_iv*24; % (hours) convPhotCell = 10; % 1 cell \simeq convPhotCEll photons/seconds convPhotMm = convPhotCell*1e6; % 1 mm3 \simeq convPhotMm photons/seconds phot2...
890165dcfe1126b0c36baaa848cb10dd811b01d14a729f1142cd381b7f2f2d93
MATLAB
681
23
function avgref=computeavgref(thedata) % computeavgref: computes the average reference of a data set % % inputs: data as a 2-D numeric array where dimension 1 contains the % timeframes, dimension 2 contains the channels % % outputs: average reference as a 1-D numeric array that contains the % average reference at each ...
2934056abb7f482a9839ccf81d0b9dc7168a1ebfb914f967a90208f7537ac216
MATLAB
682
17
function samplesIn = ndiffFilter(samplesIn, nDiffOrder) %NDIFFFILTER if isempty(intersect(nDiffOrder, [1 2 3])) return; end if nDiffOrder == 1 samplesIn(1:end-1,:) = diff(samplesIn); samplesIn(end, :) = 0; elseif nDiffOrder == 2 samplesIn(2:end-2, :) = 2*diff(samples...
d4c7c23341731df4dcc5dd68c513eadae8d20fb9a8ad45939b60ac5b3d599d44
MATLAB
682
29
function ind = ChannelIndex1(x, varargin) % Channel selection based on wavelet decomposition onto ECG bands, or % equivalently using a filter that is customized to the fetal ECG frequency % band % % Reza Sameni % December 2008 if nargin > 3 && ~isempty(varargin{1}) ranking_mode = varargin{1}; if ~is...
86782d88f24c86eb3e2263774e4b2ed6fb513d2d2add2fc07034eb7ac5fd0237
MATLAB
685
18
function save_rawdata(FolderNamePD,NumberofVideos,XY,r,PathName,RADroi,dyename,FN) % Call Global Variables global SIGNALS; global Names_Conditions; global fs; global Experiment; % Directory to Save: Up from this one (pwd) FileDirSave=getDir2Save(); % Creata Folder: if ~isdir([FileDirSave,FolderNamePD]) fprintf('Fo...
601d6cacaa1adee2ea7df7debced1f511da41c7c673851aa485b7b0161c919d9
MATLAB
686
22
function y = group_l2norm(x,groups) % "groups" is vector indicating the group stucture % for the group-vector-soft thresholding operation % The size of groups must be the same as x. % Each set of elements that are mutually equal % define a group. % Example: if groups = [1 1 1 2 2 2 3 3 2 2 1 1 3 3], % there are 3 gro...
94854c9731d70adb13ec285544e52f315ff1ed3444e29b7a6381c78b216871ed
MATLAB
687
23
function curOTF = XxReadOTF2D(otfPath, nx, ny, dkx, dky) addpath(genpath('../')); [headerotf, rawOTF] = XxReadMRC(otfPath); nxotf = single(headerotf(1)); dkrotf = single(typecast(headerotf(11),'single')); dkr = min(dkx,dky); diagdist = ceil(sqrt((nx/2)^2+(ny/2)^2)+1); OTF = complex(rawOTF(1:2:end),rawOTF(2:2:end)); x...
c08c172c1f1298d6374814471bb89943eac1349580cdb335432af37f533552e8
MATLAB
687
21
function utc_offset = getTimeZone %getTimeZone Returns the time zone of the operating system. % % utc_offset = sl.datetime.getTimeZone % % Uses a Java call. This function is necessary for converting between % Matlab time which is local based, and many other time codes which are % all UTC based. % % OUTPUTS %...
fd86198c82d4e94d4a768871bbd410ed680e44f2fd8e8c844431ef8dee5c7ab9
MATLAB
687
24
function printm(varargin) %function printm(varargin) %| %| like printf except that it puts the mfilename in front of it %| so that you know where the message originated. [caller, line] = caller_name; if ~isempty(line) && line ~= 0 caller = [caller sprintf(' %d', line)]; caller = strrep(caller, 'LiveEditorEvaluation...
6533fa6cf33d5cc140d3fc5961860182e648715ba3d987a0efc58c4db6ace0b5
MATLAB
688
26
function recomputeWaveforms(obj, computeAll) %RECOMPUTEWAVEFORMS Recompute mean waveforms for a cluster or all %clusters hBox = jrclust.utils.qMsgBox('Recomputing... (this closes automatically)', 0, 1); obj.isWorking = 1; try if nargin < 2 || computeAll == 0 obj.hClust.updateWa...
91c9400260439798771261020c996acfa2bcf3aa77a21720d187c2827f50a639
MATLAB
688
25
function plot_PCA(x,k) % triplot plots a triangular diagram % points on it are plotted by tripts % written by Gerry Middleton, 1995 xscale = 2/sqrt(3); x = [0 xscale/2 xscale 0]; % define coordinates of apices y = [-1 0 -1 -1]; plot(x,y); axis('equal'); axis off; % turn off rectangular axes hold on; % hol...
d7f1a082270fecde40e0a516cc8a7fa6767a2397fb923160be3f3b8a9b9609e2
MATLAB
688
23
function region = top_cap_region(dim,a_cap) %TOP_CAP_REGION North polar (top) cap region of EQ partition % % An array of two points representing the top cap of radius a_cap as a region. % % region = top_cap_region(dim,a_cap); % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. % $Revision 1.10 $...
72e5967d9e3813173e1883ea8d5d8b1d31c79c0352b57050205897da6d347702
MATLAB
689
23
function y = group_l2norm(x,groups) % "groups" is vector indicating the group stucture % for the group-vector-soft thresholding operation % The size of groups must be the same as x. % Each set of elements that are mutually equal % define a group. % Example: if groups = [1 1 1 2 2 2 3 3 2 2 1 1 3 3], % there are 3 gro...
26ad047d088bed0dba68c46e4ac1f43c533d287467aa49bf9890d65f6ceed4f4
MATLAB
690
32
function Stats = ttest_timefrequency(Data, StatsParameters) % runs a simple t-test on data to see which points in a P x F x t matrix % deviates significantly from 0. Dims = size(Data); tValues = nan(Dims(2), Dims(3)); N = nnz(~isnan(Data(:, 1, 1))); pValues = tValues; for FrequencyIdx = 1:Dims(2) for TimeIdx = 1...
06f6a9076680e5b6fc36566cdd003ee6d60f59c4e4e87ab5033dedb7af48bfc6
MATLAB
691
15
mmf = memmapfile(params.filename, 'Format', {params.dataType, [nChInFile nSamp], 'x'}); st = readNPY('spike_times.npy'); % these are in samples, not seconds clu = readNPY('spike_clusters.npy'); theseST = st(clu==19); % spike times for cluster 19 extractST = theseST(1:min(100,length(theseST))); %extract at most th...
72e3ddbc2415410c1bbe6b635c004ca22520d4214bcaaf779911d4c30e808f51
MATLAB
692
20
% A self contained function to present pixel connectivity % Input: C_mat: Matrix of pixel connectivity % PixId: the pixel I care about % PixNum, N_HC, NPixX, NPixY: Basic quantities. Scalars % Crange: range of connnectivity, 1*2 vec % AXrange: range of the axis to present, 1* 4 vec % ...
0472485c1bb5da3e578f8ccf0ba84b868bebab69a4dc330be2c47328a9d7d856
MATLAB
693
19
function [fk] = recompStableFeats(probs,selVars,nfp) % This function is used to recompute stable features using a new number of % false positives than originally used when calling stabSel.m. % % Inputs: % probs -- empirical probability of feature selection (n x 1 where % n is the number of features). This is fsc ...
27bb21ece9cbad421d6d6a3675fa2fa9e13660cd2c89800ebc7314240b5d7589
MATLAB
693
20
function [newD, C] = LDAreduce_ehStandAlone(D,dims) %LDAREDUCE Internal function for LDA % LDAREDUCE(D,DIMS) returns a structure of the same form as D, except the % data has been reduced with LDA. All conditions and trials are % considered together to get the best joint reduction. conds = length(unique({D.con...
d4475612271d9df19a1b424876874b41dd122473e7e3deb937e98b2b1a25c556
MATLAB
693
35
function y = nufft_sinc(x) %function y = nufft_sinc(x) %| %| my version of "sinc" function, because matlab's sinc() is in a toolbox %| %| Copyright 2001-12-8, Jeff Fessler, University of Michigan if nargin < 1, help(mfilename), error(mfilename), end if streq(x, 'test'), nufft_sinc_test, return, end iz = find(x == 0)...
707c02b29e11a82f1f7d61e2ee72c955e4ff3bbbfe2537df0edefdd84119df50
MATLAB
695
19
function coords3D = convert2Dto3D5(points2D, indices, points3D) % points2D: Nx2 matrix of 2D coordinates % indices: Nx1 vector of indices into points2D % points3D: Mx3 matrix of 3D reference points % % coords3D: Nx3 matrix of 3D coordinates corresponding to the 2D points % Extract the 2D points...
19ed2764bab4b58772e3ffd41cea0866819da65ce035cb3cbc9697c7c810520d
MATLAB
696
35
function time_frequency(Data, Frequencies, tMax, PlotType, FreqRange, ColorAxisLimits, Levels) arguments Data Frequencies tMax PlotType = 'imagesc'; FreqRange = [1 40]; ColorAxisLimits = [min(Data(:)), max(Data(:))]; Levels = 40; end % Data is Freqs x time Time = linspace(0, tMax, size(Data...
5b94428b60378089a92678086d392e3e709974cd9e5b939f2cb3333134e6b9b9
MATLAB
696
20
function exportToWorkspace(vals, verbose) %EXPORTTOWORKSPACE Export a values in a struct to local workspace fieldNames = fieldnames(vals); varsAssigned = cell(numel(fieldNames), 1); for i = 1:numel(fieldNames) fn = fieldNames{i}; if ~isempty(vals.(fn)) assignin('base', fn, v...
1944558550c918d12d16b7b23bc6a665dc54bda2fcb4c4b0aaa7b927a0c3c0b3
MATLAB
697
28
function ct = getcentrality(paths) %% Get betweenness centrality % For every node calculate the betweenness centrality, a measure to % determine how important the role of a node is in the global network % structure. % % ct = get_centrality(paths) % % Input: % paths (optional): Cell array with shortest paths, obtained...
4f7eb5776d41f26599b721fe054a104687a9e21f0caaf08cd377d7866eee840c
MATLAB
697
30
function [ avg_psv ] = compute_perc_shared( fa_model ) % % computes the percent shared variance % % Input: % fa_model - (struct), factor analysis model parameters % % Output: % avg_psv - (scalar), percent shared variance % % @ Akash Umakantha, 2021. See https://www.biorxiv.org/content/10.1101/2020.12.04.383604v1 % ...
62175c1a603b7fc455a259c3d648627aa278b7d2415926efc8d8b751b1d9f0e5
MATLAB
697
21
function [consensus_VI,consensus_simm_VI ,VIm, consensus_idx,ALL_consensus_idx] = Find_Consensus_VIn(C) npart = size(C,2); % number of partitions VIm = partition_distance(C); VIsim = VIm + VIm'; % Average pairwise similarity average_pairwise_simm = sum(VIsim,2)/(npart-1); % EXTRACT PARTITION MOST SIMILAR TO THE OT...
6bf6ba22ee21cdc857dc3e89e54e9bf61ead93947e1086fd11ad4b48b8692960
MATLAB
697
28
function ob = cat(dim, varargin) %|function ob = cat(dim, varargin) %| %| called for ob = cat(dim, ob1, ob2, ...) where any of them is a fatrix2 %| %| vertcat(ob1,ob2) = [ob1; ob2] = cat(1, ob1, ob2) %| horzcat(ob1,ob2) = [ob1, ob2] = cat(2, ob1, ob2) %| %| dim > 2 is also supported thanks to 'odim' % purge any empt...
8810b07d2abf806dd99144b2c43dc5c925d20bf0d8b06d1b29e42d39a0bc5044
MATLAB
697
26
% organization of tracking data for E7 2DAA experiment clear p = params_2DAA; for sub = 1:p.nSubjects sub for ses = 1:p.nSessions thisSub = p.subjects(sub); % load centroids trackPath = fullfile(p.rootDir,'results','behavior','tracks',['subject' num2str(thisSub)],['session' num2str(ses)...
1bc66ec76af961faa26dde72d45e25819584930b7d8f3a7419e6af5db7d081d4
MATLAB
698
34
function trials = get_trials(session, channel, unit, fold, type) % Get trials of specific neuron % % Parameters % ---------- % % - fold: integer scalar % Fold number % - type: char vector % - Contains 'trn', 'crs', or 'tst' % % Returns % ------- % - resp: 2D matrix % (trial x time) response result = load_result(se...
73c2660a219387d742bdd347be286973e764df6e6eca76625648386ebd24a7e2
MATLAB
698
32
function [x_msc]=msc(x,xref) % Multiplicative Scatter Correction % % [x_msc]=msc(x,xref) % % input % x (samples x variables) spectra to correct % xref (1 x variables) reference spectra (in general mean(x) is used) % % Output % x_msc (samples x variables) corrected spectra % % By Cleiton A. Nunes % UFLA...
38838184db86d9ee9b235947c027a62fd9ddcb308add302264a1dd6f7ec5ade4
MATLAB
699
20
function [X,fs] = readdeltaFzero(filename) X=table2array(readtable(filename,'ReadVariableNames',false,'HeaderLines',4))'; delimiter = ','; fileID = fopen(filename,'r'); fprintf('\n> Reading CSV file: ') fsamples = textscan(fileID, '%f',1, 'Delimiter', delimiter, 'HeaderLines', 0, 'ReturnOnError', true); if isempty(fs...
3ca35b10b5c975f772bbcbbab88a3ab6a5f2de8fb8c96649c24822ef2184e318
MATLAB
700
21
function [ shuttles,no_shuttles, shuttle_times,trial_nums,trial_spds ] = get_t2_d1_shuttles(p, traces, evs, bvs, tis, speed_control,action_aligned) %% calc scale factors per subject for sub = 1:p.nSubjects all_tr = cat(2,traces{sub,:}); vars(sub) = nanstd(all_tr(:)); end scale_factors ...
5a0b5b5312ef1a43be2785632da75bd2b64a8cf53261261fd19b184bc2d24edb
MATLAB
700
29
function write_fid_to_csv(f,file_text) fid = fopen(file_text,'a+'); fprintf(fid,'\nSujet,Serie,TR,TE,NEX,FOV,dwell,nbpts,mega_ws,vapor_ws'); if isfield(f(1),'water_width') fprintf(fid,',water_width,water_integral\n'); else fprintf(fid,'\n'); end for k=1:length(f) fprintf(fid,'%s,%s,%d,%d,%d,[%d %d %d],...
c3c401cd0f88a0c5aac05a9125540f8148b8c61246939af9cf69761296ff1a1a
MATLAB
701
33
function Ycs = cosmoother_pca(Y, params) % % Ycs = cosmoother_pca(Y, params) % % Performs leave-neuron-out prediction for PCA. % % INPUTS: % % Y - test data (# neurons x # data points) % params - PCA parameters fit to training data % % OUTPUTS: % % Ycs - leave-neuron-out prediction (# neurons x #...
618bfb858b0db51e0486f3da9dc68da796de109090ae3bb015eea093cf69415b
MATLAB
702
22
function [] = writeStringPaddedWithZeros(fid, theString, totalLength) % [] = writeStringPaddedWithZeros(fid, theString, length) -- write the % string padded with zeros to the specified file. % % INPUT: % fid - file id % theString - string to write % totalLength - total number of bytes to be wr...
3a66dc96bfd98bb029089fe8c84041485b84ae6e12ec6938f57ac35080646024
MATLAB
703
25
function roi = readRawROI(obj, rows, cols) %READRAWROI Get a region of interest by rows/cols from the raw file rowPred = jrclust.utils.ismatrixnum(rows) && ~isempty(rows) ... && all(rows > 0) && max(rows) <= obj.dshape(1); colPred = jrclust.utils.ismatrixnum(cols) && ~isempty(cols) ... && a...
505cce3c75639920fc797c7b9385859c1dfb406381dfec07f47f4fff617ae205
MATLAB
703
22
function projection = forwardProjectACC(psf,Xguess) %% Forward projection from 3D volume to 2D projetion (using CPU) %% Input: % @psf: the phase space PSF % @Xguess: the projection obtained from "forward project" %% Output: % projection: estimate volume % % [1] JIAMIN WU, ZHI LU and DONG JIANG etc, % Iter...
9254c9788ff82fcbeb956a49d0c07942333a4abee6dd405169c289e28ed8d549
MATLAB
704
40
% nufft1_time.m % examine time spent in nufft1 sub-routines if 1 N1 = 1024 * 128; J1 = 6; n_shift = 0; Nlist = 2 .^ [8]; Jlist = [8]; [NN,JJ] = ndgrid(Nlist, Jlist); for ii=1:numel(NN) N1 = NN(ii); J1 = JJ(ii); K1 = 2*N1; x = [1:N1]'; % test signal x = x(:,ones(1,1000)); gam = 2*pi/K1; o1 = l...
133cb31c4c60d08e95119bb97e87a787376a3002b506c4a08cfaaa1de75d0e56
MATLAB
706
13
function [amin] = get_amin(par,nSites) % GET_AMIN Minimum significance level. % AMIN = GET_AMIN(PAR,NSITES) returns the minimum significance level in Equ. 19 % as a function of the treshold PAR.THRESH and number of observable components % NSITES without the reference variable s_ref. % % From: "Correlati...
bec5c74b7c8e4bd5c2c5bba342c10f35a8f7183cd520ebd41fb9246ef357b601
MATLAB
706
18
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...
46c75dbd4a9c06ab28121cc97bdc261c2f81b08bd8e5859bb0294db2b9367d31
MATLAB
707
24
function region = bot_cap_region(dim,a_cap) %BOT_CAP_REGION South polar (bottom) cap region of EQ partition % % An array of two points representing the bottom cap of radius a_cap as a region. % % region = bot_cap_region(dim,a_cap); % Copyright 2004-2005 Paul Leopardi for the University of New South Wales. % $Revision ...
6d9e674925159d61d53301cef311e4c539c16dd9b95aba8fcd8a3b56982aa74b
MATLAB
707
29
%% Rate of synthesis of 5-HTP from tryptophan with bh4 as co-substract. % b = tryptophan % d = BH4 % UNITS IN uM and uM/h. function a = VTPH(b, d) k1 = 40; % Km for tryptophan Haavik05 (homo sapiens) (rats in same range) k2 = 20; % Km for BH4 Haavik05 k4 = 1000; % (Ki is 970 in Haavik...
a93d33541ec1a60c33bec39d2da644174400ebc9d6eab7ef6d4b42e448b54257
MATLAB
708
20
% 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...
c69366199007ff1de9049e5021250c59dc84a6a71727e16edcb8ad33521e36f3
MATLAB
708
19
% Authors : Tatjana Schmitt & Simon Wadle 2019-2023 %function reads tiff stacks and scales pixels down to end size function image = tiff_stack_import(tiff_fullpath) info = imfinfo(tiff_fullpath); stack_size = size(info,1); rows = info(1).Height; columns = info(1).Width; % preallocate resized_image image = ze...
53871e2df82dd2b9925915e02c915c63c5af2940b192c72cf4881273248af7d0
MATLAB
709
22
function n_collars = num_collars(N,c_polar,a_ideal) %NUM_COLLARS The number of collars between the polar caps % % Given N, an ideal angle, and c_polar, % determine n_collars, the number of collars between the polar caps. % % n_collars = num_collars(N,c_polar,a_ideal); % Copyright 2004-2005 Paul Leopardi for the Unive...
88abd17af7450419afd31d6bcf6d15af10ad21f2b81541c2e7641e8c6bde7673
MATLAB
709
23
function [I, end_of_beat_indexes] = ECGPhaseToMatrix(phase, N) % Converts ECG phase signal of length T into a matrix of N phase bins with the same length % (used to calculate a binary image/matrix representation of the cardiac phase) % % Copyright Reza Sameni, 2021 % The Open-Source Electrophysiological Toolbox % https...
32ead9c2f5861bb36fd1a012fd073ee0f9149004fd00f2ea59eac25f55d1bddb
MATLAB
713
22
% An example script for extracting features from ECG signals % Authors: % Seyedeh Somayyeh Mousavi % Reza Sameni % bmemousavi@gmail.com % Aug 2026 % Emory University, Georgia, USA % ==================================================================== clc clear close all % ============================================...
8078b6007fcf1b627df6ffed1b84c2e4977d50ed5cd9bb32e67241a82b13b717
MATLAB
713
16
%% Example 4: Visualize trial-averaged neural trajectories of maze data % The dataset corresponds to Section 3.3 in the DataHigh JNE paper. It % provides many conditions (27) than the center-to-out reach task. % For the maze task, the monkey had to make arm movements % around barriers to obtain the target. % These n...
d298f8ad2dca72cf5ba73b431dcd8267483b903f9528e0e07bd2b275aa8036a5
MATLAB
713
22
% 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 Neuroscience,...