sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
d8b064219df72d29b90c07e44365e982d40e2c62ccaf4848e8994d61865bc145 | MATLAB | 2,133 | 53 | function plotTFRcontinuous(cfg, TFR)
% PLOTTFRCONTINUOUS creates statistics based on hypnogram and markers in MuseStruct
%
% use as
% plotTFRcontinuous(cfg, TFR)
% This file is part of EpiCode, see
% http://www.github.com/stephenwhitmarsh/EpiCode for documentation and details.
%
% EpiCode is free ... |
e4464d48b71a885faeb198122935399cee656619e39f6eecc64a6c97eac4d390 | MATLAB | 2,133 | 52 | function plotTFR(cfg, TFR)
% PLOTTFR creates statistics based on hypnogram and markers in MuseStruct
%
% use as
% plotTFR(cfg, TFR)
% This file is part of EpiCode, see
% http://www.github.com/stephenwhitmarsh/EpiCode for documentation and details.
%
% EpiCode is free software: you can redistribute... |
65f6529ffb2eb8af098eb8450d7b5215efc12f89da1f2102a87eedc6d5d452d8 | MATLAB | 2,135 | 78 | %
% strLen = progressTracker(counter, totalNum, prevStrLen, barLen)
%
% Description:
% tracking a progress of a for loop
%
% Input:
% counter - current iteration counter
% totalNum - total number of iterations
% prevStrLen - previous output of PROGRESSTRACKER
% barLen - the length of progress bar ... |
9d72b828b5190c2ee18510399a644be7d048af15fcc6042b172bbbc939a6cf98 | MATLAB | 2,137 | 67 | function [filtered, BS, base] = preprocess(EEG, bandpass_upper_range)
%% Preprocess force sensor data and prepare bendsensor data
%
% **Usage:** [filtered, BS, base] = preprocess(EEG, bandpass_upper_range)
%
% Input(s):
% - EEG = EEG struct from one participant
% - bandpass_upper_range = int maximum frequenc... |
4e5f9b61feffe81cc0f881b9b23eac12aa53f37ddeb9be6f0bb5d284661732d7 | MATLAB | 2,141 | 84 | function [s,f,t]=nt_sgram(x,window,noverlap,nfft,sr,flags)
%[s,f,t]=nt_sgram(x,window,noverlap,nfft,sr,flags) - spectrogram
%
% Without output arguments: plot cubic root of power spectrogram.
% With output arguments: return power spectrogram.
% s: spectrogram matrix (frequency X time)
% f: array of frequencies
% t: ... |
7ba084650e3ec5ffcd09c24243d4ce96d1493396f4800273b1324514fb8567b4 | MATLAB | 2,147 | 42 | function hspike_cluster_FFT(ipatient)
%% Analysis script for SLURM cluster
%
% (c) Stephen Whitmarsh, stephen.whitmarsh@gmail.com
%
%% Analysis script for Spike x Sleep x SUA project
%
% (c) Stephen Whitmarsh, stephen.whitmarsh@gmail.com
%
hspike_setpaths;
feature('DefaultCharacterSet', 'CP1252') % To fix bug for we... |
93df9954d4c72c0f0ef9d6f3ad55bf1ada53d1ef0122c399c297f1a0137d301f | MATLAB | 2,148 | 75 | function R = imerror(A,B,varargin)
% R=IMERROR(IMAGEA,IMAGEB,{SCALING},{TYPE})
% Calculate the RMS or mean-square value of the difference of two arrays.
%
% IMAGEA, IMAGEB are two arrays of the same size
% SCALING optionally specifies how the inputs should be treated
% 'native' treats the inputs as-is. This ma... |
9a9c0127275e4c057375c13820b9e613daf6eae04e5fa31c8da50d2aadbec8ff | MATLAB | 2,148 | 53 | function pinv_sens = morse_pseudoinvert_sensitivities(sens, regu, accPE, acc3D)
%**************************************************************************
%
% morse_pseudoinvert_sensitivities
% input sens: sensitivity estimates [RO, PE1, PE2, N_order, N_coils]
% regu: regularisation maps [RO, ... |
843cf9c6e3c2b025c800dbf8c1d52d05ae5d9f854f0f56e4b5255dc0d61c96fe | MATLAB | 2,153 | 60 | %% axes only
figure('name','Normal');
subplot(3,2,1);plot(randn(9,3));set(gca,'XTickLabel',{},'YTickLAbel',{},'Box','on')
subplot(3,2,[2 4]);plot(randn(9,3));set(gca,'XTickLabel',{},'YTickLAbel',{},'Box','on')
subplot(3,2,3);plot(randn(9,3));set(gca,'XTickLabel',{},'YTickLAbel',{},'Box','on')
subplot(3,2,[5 6]);plot(ra... |
4aa2c8af658c00f151012e50cf31d96a625e90f1fc45b103b6c10ceacbaa6b00 | MATLAB | 2,159 | 96 | function [phi, rho, gamma, SNR] = ind(psi, a, ev, k, p)
%IND Indicator function method for periodic IOI data.
%
% Inputs:
% psi - spatial PCA vectors [M x numComp]
% a - temporal PCA coeffs [N x numComp]
% ev - PCA eigenvalues [numComp x 1]
% k - frames per cycle (conditions)
% p - noise weight ... |
641f25994c477f686632570337ca475fd97e66ace50958b52bf315d51eb287fd | MATLAB | 2,159 | 78 | function outpict = alternate(dim,A,B,varargin)
% OUTPICT=ALTERNATE(DIM,A,B,{C},{D},...,{WIDTH})
% Combine multiple images by interleaving them along a given dimension,
% alternating in the given order. Compared to interleave(), this tool
% produces an image equal in size to the inputs. Because of this, stripes... |
3db7e76e1044f29b51499141993f8175caa6077d57518267c96e79c4259d6a5f | MATLAB | 2,161 | 46 | %% Function to count Ca events in individual fields
function [EventCounter, FieldEventTime, FieldEventPercentage] = CountFieldEvents(FieldMap_full, onset, Field_tbl, p)
EventCounter = [];
FieldEventTime = {};
FieldEventPercentage = []; % percentage of events that happened within the field
field_counter = 1;
... |
199e55d5c85a11131a27fb1b362f1860fcc50d80aace2368807458c90b83c466 | MATLAB | 2,162 | 71 | function [t_trial, t_muse, idir] = find_muse_marker_in_trial(data, MuseStruct, itrial, markername, time_from_start, time_from_end, ipart)
% find the first marker after the start of the trial. If no marker is
% found before the end of the trial, return empty values.
%
% Required :
% - data.trialinfo.idir
% - data.trial... |
cd4c07c050a7a92801f36a08669ea143d14730dcc2708f1423bee2ee1a178edc | MATLAB | 2,167 | 56 | function [dataset,base_indices] = seperate_FS_sets(filtered, BS, base)
%% Extracts bendsensor values when force sensor data is present
%
% **Usage:** [dataset,base_indices] = seperate_FS_sets(filtered, BS, base)
%
% Input(s):
% - filtered = preprocessed force sensor data
% - BS = preprocessed BS dataset
% ... |
def4ccea9e34bb897fc00248a2420294a93dbff941d02aacf4132775b41b9c58 | MATLAB | 2,169 | 76 | %%
% nudge([x, y])
% nudge([x, y, w, h])
% nudge([x, y, w, h], 'legend')
% nudge(handle, ...)
%
function [varargout] = nudge(varargin)
%----- Default settings
handles = [];
%----- Parse special inputs
narginchk(1, inf);
iArg = 1;
% if all( ishandletype(vara... |
531c4f74d392dac85434be6b11282959e869275906f269f8362700622b79af04 | MATLAB | 2,172 | 46 | function [spike_matrix, clusters] = ...
getSpikeMatrixBaseline(animal_name, experiments, resultsKlusta, save_data, repeatCalc, output_folder)
% by Mattia 02.19
% computes sparse spike_matrix on baseline data only, starting from the output of sorted Klusta
% file. doesn't cuts periods of silence (> 500 ms of no spi... |
f8bfab2edf44e2cf4bbe1069eef9901678f014f5f39ed26725f3ba6fa55021ec | MATLAB | 2,175 | 56 | function hPan = panExtended(fig, axs)
% Pan service
zoom(fig, 'off');
hPan = pan(fig);
set(hPan, 'Enable', 'off');
% Menu layout
hMenu = uicontextmenu;
hItem = uimenu( 'Parent' , hMenu ...
, 'Label' , 'End inte... |
c603e1c47f37168c2b99d14f8c95d4275400742c0b59761a8aec657b045abf3d | MATLAB | 2,176 | 50 | function [newPhi, newVarBound] = ...
CBIG_AuthorTopic_EstimateVariationalDistribution(params, ...
newVarBound, varBoundFlag)
% [newPhi, newVarBound] = ...
% CBIG_AuthorTopic_EstimateVariationalDistribution(params, ...
% newVarBound, varBoundFlag)
%
% Update the parameters of the variation distribution phi of th... |
f4e910f76e6f3d59546f7a0315a522207f9de2469c83f153b890a1e306781d0b | MATLAB | 2,179 | 78 | function [d,e]=nt_dprime(x,y,jd_flag)
%[d,e]=nt_dprime(x,y,jd_flag) - calculate d' (discriminability) of two distributions
%
% d: discriminablity index
% e: error rate for linear discrimination
%
% x, y: data (observtions X features) - if cell arrays do xvalidation
% jd_flag: apply JD first
%
% See nt_dprime_old f... |
1ee987fb7ebc62daeb2d344e1bf96cc2843d99de24cbffd3213b842b44e5789f | MATLAB | 2,185 | 82 | function I = mi_model_gd(x, y, Ym, biascorrect, demeaned)
% MI_MODEL_GD Mutual information (MI) between a Gaussian and a discrete
% variable in bits bits based on ANOVA style model comparison.
% I = mi_model_gd(x,y,Ym) returns the MI between the (possibly multidimensional)
% Gaussian variable x and the disc... |
3638a0f751d30d58139a144c6cfdc1605f1d1b8460903dd86ebd9c2707095133 | MATLAB | 2,185 | 61 | function writer = write_image()
writer.accepts = @(item) isa(item, 'gadgetron.types.Image');
writer.write = @write_image_header_and_data;
end
function write_image_header_and_data(socket, image)
write(socket, gadgetron.Constants.IMAGE);
write_header(socket, image.header, image.attribute_string);
wri... |
5a44c59b95fd9bcffda1e9fb2d60a38a804818f71a85b792d46f7aab29d20574 | MATLAB | 2,185 | 56 | function preictal_writeSpykingCircus(slurm_task_id)
if ispc
addpath (genpath('\\lexport\iss01.charpier\analyses\vn_preictal\scripts\EpiCode\shared'))
addpath (genpath('\\lexport\iss01.charpier\analyses\vn_preictal\scripts\EpiCode\external'))
addpath (genpath('\\lexport\iss01.charpier\analyses\vn_preictal\s... |
8a6c38482a6c45f07377b2c93a61e280820ec2940b6d714e0c39bda7bbf0af52 | MATLAB | 2,186 | 48 | function U = cpm_prepare_input_direct_model(data, fixedparams, model, constraints)
% cpm_prepare_input_direct Creates an input structure for direct models of CPM,
% Mostly re-allocating onsets etc. to the required U structure.
% INPUTS:
% -data: stimulus data to be used for computing neuronal si... |
655457c7f0c2daf4036e87aab851fba4913e77eaaef9c67b5c248d64ff756073 | MATLAB | 2,187 | 76 | % D = Ashamn Coefficients
% S = Binomial Seperration Coefficient
% BF = Bimodality Coefficient
% um = mean of male
% uf = mean of female
% sm = standard deviation male
% sf = standard deviation female
%
data= readtable('Male+Female.csv');
y_names = {'SCN5A', 'CACNA1C', 'KCNH2', 'KCNQ1', 'KCNJ2', 'ATP1A1', 'SLC8A1', '... |
cc3d8a29b6fddfb5687514b378079db00d6a165ceda3db76b77e0ea9265a367d | MATLAB | 2,189 | 70 | function varargout = colorquant(inpict,maxmapsize)
% MAP=COLORQUANT(INPICT,{MAXMAPSIZE})
% [IDXPICT MAP]=COLORQUANT(INPICT,{MAXMAPSIZE})
% Color quantization using octree decomposition
%
% INPICT is an RGB image
% MAXMAPSIZE specifies the maximum map size (default 256)
% actual map may be shorter t... |
805fb41777708e43a640cf5d0319a1ea6864a7dcd5dfc78adb738a9f4f5bd3f0 | MATLAB | 2,192 | 52 | % Contact ythomas@csail.mit.edu or msabuncu@csail.mit.edu for bugs or questions
%
%=========================================================================
%
% Copyright (c) 2008 Thomas Yeo and Mert Sabuncu
% All rights reserved.
%
%Redistribution and use in source and binary forms, with or without
%modification, a... |
9d9f2ef12e6a82d417759028e79c76997307a1a7ddea1c0a90ede83cef8b934d | MATLAB | 2,192 | 86 |
function func_plot(func_name)
[LB,UB,Dim,F_obj]=fun_info(func_name);
switch func_name
case 'F1'
x=-100:2:100; y=x; %[-100,100]
case 'F2'
x=-100:2:100; y=x; %[-10,10]
case 'F3'
x=-100:2:100; y=x; %[-100,100]
case 'F4'
x=-1... |
22c64d6db56a413a1f0243622fc203edd0da18d30df11bdf7c22239ac4f73649 | MATLAB | 2,199 | 61 | clear;
load('lights=27.mat');
nClass = length(unique(gnd));
%Normalize each data vector to have L2-norm equal to 1
fea = NormalizeFea(fea);
%Clustering in the original space
rand('twister',5489);
label = litekmeans(fea,nClass,'Replicates',10);
MIhat = MutualInfo(gnd,label);
disp(['kmeans use all the features. MIha... |
ffffaf002d9044f641bd6a327bafff6bfcede154c4a06002cdc5cad0b1beff6a | MATLAB | 2,205 | 62 | %% Setting parameters
%
% cfg.patientdir = [path to patient data, one above /eeg and /eegmicromed]
% cfg.hyp.micromedchannel = [micromed channel to use for alignment]
% cfg.imagesavedir = [path to directory in which to save plots]
% cfg.prefix = [string to prefix output figure, e.g... |
6c8501705f7789bf780fad34daaa0fee3c48d23ca0230fbd38c6bcf5ab7a289c | MATLAB | 2,208 | 84 | function hexc = uint2hex(CT,varargin)
% HEXCT = UINT2HEX(UINTCT,{OPTIONS})
% Convert a numeric array of integers to hexadecimal representation.
% This is primarily useful for converting RGB tuples.
%
% UINTCT is a color table represented as a numeric matrix of integers.
% Each row is considered as a color tupl... |
dc8675cfccb7923d91b16823ea59a2a6a97ccf29fb9d1209cec02b07acc5e686 | MATLAB | 2,209 | 77 |
%% load relevant code base paths
addpath(genpath('.../phototagging_functions/')); %path to matlab/code/lab folder
%% load data
load('.../testdatarun.mat')
%% Run ReaChR classification
%Depending on the dataset you will need to use a different method to
%determine ReaChR cell IDs. Generally three methods have wo... |
af37ff7c7e742101fe0c4dfe9a6322e9a902a16561881b956993f8aef5f80ca0 | MATLAB | 2,211 | 75 | % Author: Woojae Jeong
%% Automated BrainStorm preprocessing pipeline
% EEG file
fileName = dir([sDirectory,'/*.set']);
% File name
name = fileName.name;
% Subject name (for BrainStorm)
SubjectNames = {erase(name,'_EEG.set')};
% EEG data in *.eeg format
RawFiles = {[sDirectory,'/',name]};
% Protocol name (for Bra... |
c348fcbee4307a9723004d103e6e6ee2ff2fe65c818650eae0bcec609c3cccff | MATLAB | 2,211 | 74 | function [idx,d]=nt_find_outlier_trials(x,criterion,disp_flag,regress_flag)
%[idx,d,mn,idx_unsorted]=nt_find_outlier_trials(x,criterion,plot,regress_flag) - find outlier trials
%
% idx: indices of trials to keep
% d: relative deviations from mean
%
% x: data (time * channels * trials)
% criterion: keep trials les... |
9a523c77412db79262e37899135abd61e98304d835d9e93cf855b65e5564f35e | MATLAB | 2,214 | 65 | % Programmatically urn on lazy creation of parallel pools, or restore an stored state by providing an input autoCreate.
function [autoCreate, progressBar, workerDir, hCleanup] = lazyParallelPool(autoCreate, progressBar, title)
%% Default arguments
if nargin < 1
autoCreate = [];
end... |
a1cf9cfc7b0fc9b4333739f4c9a13928e29fc49d93516d395c8df3694ceb5680 | MATLAB | 2,215 | 55 | function [bic, logLikelihood, complexityCost] = ...
CBIG_AuthorTopic_ComputeBICFromATParams(params, freeDimensionsCount)
% [bic, logLikelihood, complexityCost] = ...
% CBIG_AuthorTopic_ComputeBICFromATParams(params, freeDimensionsCount)
%
% Compute Bayesian Information Criterion (BIC) measure of the estimates of
% ... |
eb11a05b1543331b15089ae7d3cd356c73f6ce25366e32b74c49ad794c0e3845 | MATLAB | 2,216 | 63 | function rgb = vals2colormap(vals, colormap, crange)
% Take in a vector of N values and return and return a Nx3 matrix of RGB
% values associated with a given colormap
%
% rgb = AFQ_vals2colormap(vals, [colormap = 'jet'], [crange])
%
% Inputs:
% vals = A vector of values to map to a colormap or a cell array of
% ... |
971adb85938db6533769bd39a9bdcb2b678e31012d270b6744537f035abbbb2d | MATLAB | 2,217 | 77 | function mask = createCirclesMask(varargin)
%xDim,yDim,centers,radii)
% Create a binary mask from circle centers and radii
%
% SYNTAX:
% mask = createCirclesMask([xDim,yDim],centers,radii);
% OR
% mask = createCirclesMask(I,centers,radii);
%
% INPUTS:
% [XDIM, YDIM] A 1x2 vector indicating the size of the desired
% ... |
490960dc8bb340ee693a4869f5e11c5d3f8e7c588c57fa04cdc4934306b0a739 | MATLAB | 2,220 | 55 | function [nct_subset]=nct_analysis_subset(A,T,rho,x0,xf,subset_ids)
% function computes control energy and stability for two states within an
% task, when a subset of regions is as a network prohibited from control
% Sebastian Markett (2022),
% using code from Urs Braun (2021)
% adapted by Alina Podschun (2024)
... |
8a3ffc15ea0cac4b40ef46076de9b61f2b959f84b2c9961e0dc156ca1af13891 | MATLAB | 2,225 | 59 | %**************************************************************************
%
% tukey_filter applies a filter in 3D given windowFactor
% input "data" contains:
% a global header in .reference
% k-space in .data as [N_coils, RO, PE1, PE2, echoes, sets]
%
% output "data" contains... |
191fd5f08bfb4e0fa0752ae897888eb80efb680269cb45bf2f3aea93a59e713d | MATLAB | 2,226 | 96 | function out = agm(a,g,varargin)
% AM = AGM(X,Y,{OPTIONS})
% Calculate the arithmetic-geometric mean (AGM) of the absolute values
% of two variables. Optionally, calculate the weighted AGM
%
% X,Y are of any numeric class or size (must be the same size)
% OPTIONS includes the key-value pairs:
% 'weig... |
3960dee578c9e729e9efa17cf77b65dc78451491912f18da20825415db4f419c | MATLAB | 2,227 | 56 | function phasePairLFP(suffix)
% Phase Pair LFP:
% LFP-LFP Pairwise Phase Consistency
%
% Read parameters
Params = read_params(suffix);
freq = Params.freq_start_1 : Params.freq_step_1 : Params.freq_end_1;
time_window = Params.time_1;
time_step = time_window / 4;
TW = Params.freq_star... |
5f68e908d81a9faf87393a8a45faf484d22a9e19ec8e8aa84d99ff479ba616d5 | MATLAB | 2,230 | 50 |
ipatient = 3;
ipart = 1;
datafile{1} = '\\lexport\iss01.charpier\analyses\stephen.whitmarsh\data\hspike\2660\p1\mHa2g\2660-p1-multifile-mHa2g_3.ncs';
datafile{2} = '\\lexport\iss01.charpier\analyses\stephen.whitmarsh\data\hspike\2660\p1\mHa2g\2660-p1-multifile-mHa2g_4.ncs';
datafile{3} = '\\lexport\iss01.charpier\ana... |
c65e92ac482af3c5328f4e773ec3ef6880d508832b8015f9547ce7c2a34bb9c5 | MATLAB | 2,230 | 59 | function [total_cells] = concatenate_cohort_results(settings)
%%% Concatenate results for each cohort for each experimenter/slice - V1 (MGG) %%%
analysis_folder = settings.analysis_folder;
ROI_analysed = settings.ROI_analysed; % Area analysed (e.g. DG)
analysis_by = settings.analysis_by; % Person initials, for na... |
838333e77821d89d071b0d2d9a4ba757f46bd8613217d49c8d681339e22ca689 | MATLAB | 2,231 | 75 | function outpict = glasstiles(inpict,tiles,permutation)
% GLASSTILES(INPICT, TILES, {PERMUTATIONS})
% using SHUFFLE(), create a glass tiles/lens effect
%
% INPICT is an I/RGB image of any standard image class
% TILES is a 2-element vector specifying the number of tiles
% [tilesdown tilesacross]
% PE... |
c5c97bfcc267cff76ef2c2f292208f7ed27bfd80b06f6490e301773d073ab175 | MATLAB | 2,232 | 57 | function [TFR] = TFR_seizures(cfg, Trialdata, force)
% This file is part of EpiCode, see
% http://www.github.com/stephenwhitmarsh/EpiCode for documentation and details.
%
% EpiCode is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% ... |
fe56ef61a951dc0288552e931639896d7f122139141d15f0ebd8ac491609b673 | MATLAB | 2,232 | 57 | function [TFR] = TFRtrials_new(cfg, Trialdata, force)
% This file is part of EpiCode, see
% http://www.github.com/stephenwhitmarsh/EpiCode for documentation and details.
%
% EpiCode is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% ... |
77f6a42785c49cc825f4322f47132ba7d89a9032fac62632be137af6eeda4022 | MATLAB | 2,233 | 52 |
function [MuseStruct_micro, MuseStruct_macro] = MuseMarkers_update_filepath(cfg,MuseStruct_micro, MuseStruct_macro)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function readMuseMarkers
%
% Crawls and searches through patient- and recording-directories to
% extracts marker timings (t... |
74f97368a7439e05cb0d90b4f04ab0b83d4451b5f89132e9428ea6ace757e1f1 | MATLAB | 2,234 | 48 | % Mathematical Model of MePD with UCN3 input immitating restraint stress
function xdot=MePD_stress(t,x,par)
% initialise the system
xdot=zeros(3,1);
% PARAMETERS
dl = par.dl; % Time Scaling Constant Glut
di = par.di; % Time Scaling Constant GABA int
de = par.de; % Time Scaling Constant GABA eff
cll = par.cll; % Gl sel... |
31a42335259c0c46db8daa0cb23d46e2ddf5b3b5ae5442678093aef381d1e530 | MATLAB | 2,235 | 51 | % SVReg: Surface-Constrained Volumetric Registration
% Copyright (C) 2017 The Regents of the University of California and the University of Southern California
% Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy
%
% This program is free software; you can redistribute it and/or
% modify ... |
72ac89956b785f18f9d75cc722202d1f9931c5aeafb780b989b08fcd4a7656f3 | MATLAB | 2,236 | 60 | %
% BDP BrainSuite Diffusion Pipeline
%
% Copyright (C) 2019 The Regents of the University of California and
% the University of Southern California
%
% Created by Chitresh Bhushan, Divya Varadarajan, Justin P. Haldar, Anand A. Joshi,
% David W. Shattuck, and Richard M. Leahy
%
% This program is free sof... |
fc698fff6fae888b50ecee7b2a371026a3c0ad1e6bec77e1939c94d8636223c8 | MATLAB | 2,238 | 57 | function finalInterictalSinglePeaks = removePositiveNegative(interictalSinglePeaks,positiveEvent,negativeEvent)
% USAGE
%
% finalInterictalSinglePeaks = removePositiveNegative(interictalSinglePeaks,positiveEvent,negativeEvent)
%
% Remove the positives events if there are more negatives events than
% p... |
0d94ed6b999131059866acf13bf87fc0a5962c5fb616c28a2e9451d461edbb15 | MATLAB | 2,240 | 66 | % SVReg: Surface-Constrained Volumetric Registration
% Copyright (C) 2019 The Regents of the University of California and the University of Southern California
% Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy
%
% This program is free software; you can redistribute it and/or
% modify ... |
b807d32ab6e7860e4b743ed307ad14ad8afa61e5d29b897d0732979488fc326d | MATLAB | 2,244 | 55 | function PPC = getPPC_spectrum(animal_name, folder4Klusta, LFP, filters, fs, save_data, repeatCalc, output_folder)
% by Mattia 10/20
% computes PPC starting from LFP (CAR or not) and output of Klusta. PPC is
% computed with respect to the LFP of the same channel where the spike is
% detected.
% this script is thought t... |
c23cf08fc5a899c81d4bbf21b996b3de29f1ea0f249eb6e3265a779a6c581ac3 | MATLAB | 2,244 | 49 | % This file is a helper function. It takes grayordinates for the volume
% part from one sample cifti file. They grayordinates are specified in 2mm
% MNI space. They are transferred to the BCI space. For this purpose, first
% we coregistred BrainSuiteAtlas1 to BCI atlas and then used the svreg map.
clear all;close all;c... |
1e98b95cb97098570edc1d6c1039eeccbdd2fd1f4d19e55591b1b5bf8a559d8b | MATLAB | 2,252 | 56 | function params = CBIG_AuthorTopic_SetupParameters( ...
seed, K, baseDirectory, dataPath, burnin)
% params = CBIG_AuthorTopic_SetupParameters( ...
% seed, K, baseDirectory, dataPath, burnin)
%
% Set up the basic parameters of the Collapsed Variational Bayes (CVB)
% algorithm for the author-topic model.
%
% Input:... |
c91841c837b103d1b7626fbb1ae119122a39b49754253fd05a828c4be59fa3a5 | MATLAB | 2,254 | 100 | %
% [x, output] = fastNNLS(AtA, Atb, optNNLS)
%
% Description:
% fast non-negative least square implementation of Bro's paper.
% Bro et al. A fast non-negativity-constrained least squares algorithm.
% Journal of chemometrics, 11(5), pp.393-403, 1997.
%
% Input:
% AtA - A' * A
% Atb - A' * b
% ... |
5025c80d16cd22db0523298b9e8253256b3528bd0c5bef5c88b6da165fcb298c | MATLAB | 2,256 | 68 | function [y, x] = cpm_simulate(P, PRF, noise_sd, is_latent)
% % cpm_simulate
%
% P - parameters of PRF model
% PRF - subject's estimated pRF model
% noise_sd - standard deviation of noise to add to outputs
% is_latent - If the submitted parameters are in latent space already (i.e.
% ... |
e236387c9923a641551ee4cb534f0a514618dff2604b766b7446220c5ab65ee9 | MATLAB | 2,259 | 76 | function outpict = color2alpha(inpict,color)
% OUTPICT=COLOR2ALPHA(INPICT,{COLOR})
% Generate transparency from a specified color, adjusting the remaining
% color content accordingly. This is based on the corresponding GIMP
% plugin by Seth Burgess.
%
% INPICT is a I/IA/RGB/RGBA image of any standard im... |
4a6cea360857f53da72e09ad4ec1983c5fb3f6a6b5b3969f3627bf1c12864f14 | MATLAB | 2,261 | 63 | function [v, outname] = cpm_write_to_nifti(image_file, coordinates, values, ...
outname, set_dtype)
% % cpm_write_to_nifti, utility function, to easily write arrays to niftis.
%
% http://andysbrainblog.blogspot.com/2013/06/creating-nifti-images-from-scratch.html
... |
7c694b72d1f74be064caf96fd4a5ab0836659a71679d0c85f2805dadaf4060e4 | MATLAB | 2,265 | 62 | function Tcoeff = getSTTC_global(animal_name, ...
spike_matrix, lags, repeat_calc, save_data, output_folder)
%% By Mattia 04.21
% this function computes the GLOBAL (standard) STTC, not the directed
% version that is computed by other similar functions
% inputs:
% - animal_name (string): to save/loda stuff
% - spi... |
84289cca99a0da2470b9eae8374d87dd0a4a09dd9df9c1e92714e93eca62317b | MATLAB | 2,265 | 69 | function [spectral_slope, freq, amplitude, bw, num_peaks] = compute_spectral_slope_fooof(signals, fs, f_range)
num_signals = size(signals, 2);
spectral_slope = zeros(1, num_signals);
freq = zeros(1, num_signals);
amplitude = zeros(1, num_signals);
bw = zeros(1, num_signals);
num_peaks = zeros(1... |
a2809c0cfdb828b9bdf26df5dc5eb12eabb26a3ac8f7a6215f9b2234503b7ef6 | MATLAB | 2,265 | 94 | clear
path = '.\derivatives\sub-01\sub-01_acq-MW2_eeg.mat'; % change path
%% Eye blink data plot
load(path)
event = struct2table(data.EB.event);
task = data.EB.raw;
srate = data.EB.srate;
starttask = event.latency(2); % start task point
fintask = event.latency(23); % end task point
figure
plot(task,'k... |
60dec1fc05a7f00583c913a14d165f645c8969f098e64304cfb124105d1b7ffc | MATLAB | 2,268 | 60 | %% save map examples - stability and place cell examples
rootdir = strings(2,1);
folders = strings(9,2);
rootdir(1) = "F:\Included miniscope Mice\";
folders(:,1) = ["\M119\TrainingD11\" "\M119\GroupingD6\" "\M120\TrainingD11\" "\M120\GroupingD6\" "\M292\TrainingD6\" "\M292\GroupingD3\" "M319\TrainingD7\" "M319\Gro... |
94e733e287b73aec2930a00761b613031c5bc706574bc8fc1c719f75f4cba3ac | MATLAB | 2,270 | 51 | classdef HoldoutTestMetrics
properties
TestPairData ConnectomeGenePairDataSet
TestPseudeCCAResults CCAResults
TestPseudeReconstructionResults ReconstructionResults
end
methods
function obj = HoldoutTestMetrics(testPairData)
arguments
testPairData ... |
28ac10489ac083441e8f155e5272e1e43a026a88f97310ac0b8582c157cc9bef | MATLAB | 2,275 | 76 | function spm_prf_import_label(label_fn, glm_dir)
% Imports a Freesurfer label into Nifti format.
% Requires an existing lh_Srf.mat or rh_srf.mat to exist in the subject's
% GLM directory (created by spm_prf_import_surface.m)
%
% label_fn - filename of the Freesurfer label
% glm_dir - Directory containing surface .mat... |
ea4a0928e87cea769067b2ed45a647c5b0ba116d172a22b0d5ae865f85a373e3 | MATLAB | 2,275 | 81 | %
% BDP BrainSuite Diffusion Pipeline
%
% Copyright (C) 2019 The Regents of the University of California and
% the University of Southern California
%
% Created by Chitresh Bhushan, Divya Varadarajan, Justin P. Haldar, Anand A. Joshi,
% David W. Shattuck, and Richard M. Leahy
%
% This program is free sof... |
08ec68531396aa61cf4572ca54ee2387d35c29383b5cd63a9788bdbb07c2e25a | MATLAB | 2,279 | 56 | function corLFP(suffix)
% CORRELATE LFPs
%
% Read parameters
Params = read_params(suffix);
pass_band = [Params.freq_start_1, Params.freq_end_1, Params.freq_step_1];
if not(all(pass_band > 0))
pass_band = [];
end
% Read lfp data
[lfps_1, fs, trial_type] = ...
... |
f3d52631797d4046c73211e59fa1f7ebec701c5f33b9667ee9121b40dd75ef2f | MATLAB | 2,282 | 68 | % SVReg: Surface-Constrained Volumetric Registration
% Copyright (C) 2017 The Regents of the University of California and the University of Southern California
% Created by Anand A. Joshi, Chitresh Bhushan, David W. Shattuck, Richard M. Leahy
%
% This program is free software; you can redistribute it and/or
% modify ... |
53eb9432261dc82fe71ed2400f43a09b19947446a4ed6d14643f02c214d482e7 | MATLAB | 2,283 | 67 | function [emm] = relevel_table(emm, var2relevel, varargin)
% Re-level categorical variables in the estimated marginal means table
% Copyright 2019, J. Hartman, Cornell University
% written using Matlab version R2016a
%
% INPUTS:
% emm is output from emmeans.m
% var2relevel is 1 x N cell array of strings corresponding... |
d05755f3cc31ffd875992b925163020a707f1a4b9246f12e27e0658d110c5565 | MATLAB | 2,284 | 46 | function hspike_cluster_SpikeStats_window(ipatient)
%% Analysis script for SLURM cluster
%
% (c) Stephen Whitmarsh, stephen.whitmarsh@gmail.com
%
%% Analysis script for Spike x Sleep x SUA project
%
% (c) Stephen Whitmarsh, stephen.whitmarsh@gmail.com
%
hspike_setpaths;
feature('DefaultCharacterSet', 'CP1252') % To ... |
3d50ad17dfe3c9a753755985882dd091b0d97a07da5c292508028fc50d7b4065 | MATLAB | 2,285 | 51 | function p = CBIG_corrected_resampled_ttest_kfoldCV(accuracy_vec, threshold)
% p = CBIG_corrected_resampled_ttest_kfoldCV(accuracy_vec, threshold)
%
% This function tests whether an accuracy vector (obtained from repeated K-fold cross-validation)
% is statistically different from a threshold. The accuracy vector can... |
c7307d5532fec0f2d7b2d068de38a366b551758b72fc2619ba7470226cab9bdb | MATLAB | 2,286 | 72 | %% Gergely Tarcsay, 2022. Function to get outcome of individual trials - correct/incorrect/time out. Correct port belonging to each trial is also saved,
%% moreover the time that was necessary to find the reward + Training trials when the port LED was on.
function [Correct, Incorrect, Timeout, port,time, TrainingTr... |
d253d82966473f0f7224430fd8f01773c66e0ffd81bc3bcbd6e3900a9b2bbe13 | MATLAB | 2,288 | 70 | function C = C_matrix_3D(x, varargin)
% Function that calculates the C matrix.
%
% Input parameters:
% --x: N1 x N2 x N3 x Nc Nyquist-sampled k-space data, where N1,
% N2, and N3 are the data dimensions, and Nc is the number
% of channels in the array.
%
% --tau: ... |
a484233bfb2de6b234ebde11bcc3ae743eb9c300bd07dd569a9d61c3c47338c4 | MATLAB | 2,289 | 55 |
%% clean up and set global variables
clear
% variables for loading mouse stuff
klusta = 1;
experiments = get_experiment_redux(klusta); % whatever function you use to load your experiments
repeatCalc = 0;
save_data = 0;
folder2save = 'YourFolderHere'; % folder in which to save stuff
% variables for oscillation detec... |
9ed70b2af7e9025198a19ffa760464ae335d4ef17f7116278d24a2720b1034ef | MATLAB | 2,294 | 77 | % Evaluate n-way one-shot classification task,
% requiring a cost function that measures pairwise didstances
%
% Input
% trainset: [ntrain x 1 cell] training examples
% testset: [ntest x 1 cell] test examples
% fcost: [function] fcost(trainset{i},testset{j}) returns the cost
% where small values indicate ... |
4a7242ec50ee98a62782c657ae57faa8a4b54a41c4d1df1270fd42eb5a5263bc | MATLAB | 2,303 | 89 | function varargout = cstructdecode(buf, varargin)
% CSTRUCTDECODE decodes a structure from a uint8 buffer
%
% See READ_NEURALYNX_NEV for an example
% Copyright (C) 2007, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is f... |
d00e3128e40cff7a7b3e7a3215f300b6c19dfa6c1585cedfad2be9e9df8da64c | MATLAB | 2,305 | 61 | function outpict = imrescale(inpict,ca,cb)
% OUTPICT=IMRESCALE(INPICT)
% OUTPICT=IMRESCALE(INPICT,OUTRANGE)
% OUTPICT=IMRESCALE(INPICT,INRANGE,OUTRANGE)
% Rescale data based on the assertion of the nominal input and output
% data range.
% Unlike common tools, IMRESCALE allows the use of class names for... |
36374e29e0e2375504649ffe36cae42afcc6f093f8c3070f3c7bd08a1a17b8e1 | MATLAB | 2,313 | 47 | %% Demo 10 - Principled outlier removal (pre-fit IQR + post-fit residual)
% Influential outliers can dominate a fit, so removing them on a principled basis
% - and seeing how much they mattered - is part of a careful analysis. Shown on
% the stackloss dataset (R base; Brownlee 1965): the percentage of ammonia lost
% du... |
9d622a7b2ae9ecb84d06cb0c5b0b754641ca5184d55d3b0c708f713f039039d1 | MATLAB | 2,314 | 98 | function [PL,xX,zZ,logsem,f]=bootstrapPL1(Xt,Yt,Zt,maxk,plotflag,bootstrapflag,Lmed,pix,mode)
%
% Xt=Xt1;
% Yt=Yt1;
% maxk=maxk1;
% bootstrapflag=0;
% plotflag=1;
%%
global nameofdataset
if bootstrapflag==1
[Xt3,Zt3,maxk3] = generate_bootstrap_PF_set(Xt,Yt,Zt,maxk);
else
Xt3=Xt;
Yt3=Yt;
... |
535798f777ca82dd02f8e0eb18700476dd422f6ffda56f3d686b570922550615 | MATLAB | 2,317 | 67 | function c = linewrap(s, maxchars)
%LINEWRAP Separate a single string into multiple strings
% C = LINEWRAP(S, MAXCHARS) separates a single string into multiple
% strings by separating the input string, S, on word breaks. S must be a
% single-row char array. MAXCHARS is a nonnegative integer scalar
% speci... |
33859bb76373f54da2870466454aac1db99f94042d85b5d65f0108c60dca17f9 | MATLAB | 2,322 | 78 | function [tosquares,quads,D]=nt_qca0(x,npcs,nsmooth,nquads)
%[tosquares,quads,D]=nt_qca0(x,npcs,nsmooth,nquads) - maximize induced power using quadratic component analysis
%
% tosquares: matrix to most reproducible induced component
% quads: most reproducible quadratic component(s)
% D: eigenvalues sorted by absolut... |
d7389301f6aa961595349e89bdd405925db9130704abd9870dd52d03f029b9c1 | MATLAB | 2,327 | 71 | function [slope, CI, marginal] = getSlopeMarginal(result, mode, varargin)
% getSlopeMarginal(result, mode, ...) approximate error bars and marginal
% distribution over fit 'slope'.
%
% getSlopeMarginal(result, 'stimLevel', stimLevel) uses the 'getSlope'
% function.
%
% getSlopeMarginal(result, 'pc', pCorrect, [unscaled... |
a7e0aa7229f976ce79240a634582c8719c4e41e9ebc85367944a4bb53a25ac71 | MATLAB | 2,333 | 85 | %% function to plot random examples of tuning curves
close all
binCenter = deg2rad(-157.5:45:157.5);
all_curves = All_d.Curves;
all_angles = All_d.Angle;
all_L = All_d.Length;
k = 5;
ctxtA = find(All_d.TunedCurves(:,1) == 1 & All_d.TunedCurves(:,2) == 0);
ctxtB = find(All_d.TunedCurves(:,1) == 0 & All_d.T... |
3e28e11d8ab1f57e2cee9bb3b76e18b81f86677dfe7c906e867887362f46918e | MATLAB | 2,334 | 108 | %% clustering place fields v2
close all;
rng(1);
for n =100:100%154
%% detect local peaks on map
I = ActivityMap_full{n};
framed_I = zeros(size(I) + [2 2]);
framed_I(2:end-1, 2:end-1) = I;
[TF, P] = islocalmax2(framed_I, MinProminence=2);
%% find peaks where prominence is higher than cut off - use t... |
2968befbb08b699ec9de1a88f13a64f6bbb655a6a1f5ae29a11ba3ce53a4a8ba | MATLAB | 2,341 | 57 | % Compute a downsampled matrix by collecting the specified number of pixels into an output block.
% Inputs:
% grouping : number of pixels to collect into a single output bin
% dimensions : list of dimensions along which to rebin
% aggregateFcn : how to transform data from the block to a single ... |
89e8870f13e5b0615709b424b960446772e96cc19dcf4587131807241aab54bb | MATLAB | 2,342 | 47 | function hspike_cluster_spikestats(ipatient)
%% Analysis script for SLURM cluster
%
% (c) Stephen Whitmarsh, stephen.whitmarsh@gmail.com
%
hspike_setpaths;
%% General analyses
config = hspike_setparams;
[MuseStruct{ipatient}, ~, ~] = detectTemplate(config{ipatient}... |
372816a7a726c1b5e5f78846ce9fa2ac65d6d82c3470bbd9f05246c3abc713fa | MATLAB | 2,343 | 87 | %%
%
function [varargout] = tounit(unitInfo, unitName, data)
% Apply and collect unit scales
scaled = cell(numcells(data), 2);
[scaled{1,:}] = doScale(unitInfo, atcell(unitName,1), atcell(data,1));
for iA = 2:numcells(data)
[scaled{iA,:}]= doScale(unitInfo, atcell(unitName,iA), atcell(d... |
c57090c4038f8115648f9286b0ab61afca8af5f80fc931f8f0468ce4715e26ef | MATLAB | 2,346 | 112 | function ta = acf(y,p)
% ACF - Compute Autocorrelations Through p Lags
% >> myacf = acf(y,p)
%
% Inputs:
% y - series to compute acf for, nx1 column vector
% p - total number of lags, 1x1 integer
%
% Output:
% myacf - px1 vector containing autocorrelations
% (First lag computed is lag 1. Lag 0 not computed)
%
%... |
ba6d6f2ab72df1e9d4a552565da92c79830a32441da9cd4ab939640f4ea5762d | MATLAB | 2,347 | 56 | %% Gergely Tarcsay, 2024. Script to generate struct for individual mice to assess behavior for learning curves
%% Struct contains the followings: mouse ID, Sex, day of discrimination passed, day of grouping passed, eventFile and position data
%% For the learning curves we use control mice from the lesion
rootdir = "... |
127990adafa7423f3bf54a23ca8922f171e1049ef54703512b0f715b40180f9d | MATLAB | 2,348 | 75 | function [K, nnData] = calcAffinityMat(X, configParams)
% calculate affinity matrix of data matrix X, size N by M
% N - length of feature vector, M - number of vectors
% affinity matrix is calculated for kNN nearest neighbors, resulting in
% sparse matrix. This saves on runtime.
% the scale for the affinity matrix can... |
d873562a6cade9e4e74f5ae6de6a391a5d5177f6dc0c75e86dcbf2cf4accbc58 | MATLAB | 2,349 | 73 | %
% BDP BrainSuite Diffusion Pipeline
%
% Copyright (C) 2019 The Regents of the University of California and
% the University of Southern California
%
% Created by Chitresh Bhushan, Divya Varadarajan, Justin P. Haldar, Anand A. Joshi,
% David W. Shattuck, and Richard M. Leahy
%
% This program is free sof... |
e3efbc2ff9e2d2c92ceaf9d697f73e4ca753ed08316979963d09a4e8e811cc57 | MATLAB | 2,350 | 64 | function header = create_image_header(data, reference)
header.version = 1;
header.data_type = select_data_type(data);
header.flags = 0;
header.measurement_uid = reference.measurement_uid;
header.matrix_size = [size(data, 2) siz... |
952541fa2efb6de27236bdd955d1ca44b7a972bba0494006b6d0e5a392e809e2 | MATLAB | 2,360 | 69 | function PET_project
restoredefaultpath
if ispc
addpath (genpath('\\lexport\iss02.charpier\analyses\vn_pet\EpiCode\shared'))
addpath (genpath('\\lexport\iss02.charpier\analyses\vn_pet\EpiCode\external'))
addpath (genpath('\\lexport\iss02.charpier\analyses\vn_pet\EpiCode\templates'))
addpath (genpath('\... |
089f445acd11fbb65c8163cd8891a4bbb1a2c67fa72f4f412e8f82bb980b7c94 | MATLAB | 2,366 | 75 | %% clear workspace, close figures, and clear command window
clearvars; close all; clc
%% load and process stimulation data
data = readtable('G16stim.csv', 'TextType', 'string');
time = data.Var1; % extract time column
% define time window for stimulation analysis
t.start = 1202;
t.end = 2403;
time_stim = time(t.start... |
2d9836ee29e3a1bbb76993d5f56a7bf4e402bb31dfab2f3732f211728acf5571 | MATLAB | 2,366 | 69 | function VI = interpnNNboundary(X1,X2,X3, V, Y1,Y2,Y3, method, extrapval, nbr_dist_thr)
% NOT a generic function. Should be used carefully!
% X1,X2,X3, MUST be ndgrid type grid starting from 0 to (size(V)-1). X1<0 and X1>(size(V)-1) are
% outside the volume V. Also, only intended to work with 3D images (no 2D or ... |
42d30c2c665c7e858709e7803f0b5547e500d57568b0a6bef40a8be8d8bdcf20 | MATLAB | 2,366 | 56 | function Coh = SpikeTimeCoh(animal_name, spike_matrix, maxLag, repeatCalc, save_data, output_folder)
% by Mattia, 05/20
% as in Jang et al., 2020 Sciance Advances
% input:
% spike_matrix : single units x time (assumed to be in ms)
% maxLag : max lag for which coherence will be computed. In this
% ... |
649ad7022876dfaa31a71f98667cfb138c7435a9348c6fb43792d8ee60d043e9 | MATLAB | 2,366 | 57 | % Average data into bins as specified by the bin index.
%
% bin should be an n-by-m matrix where n = size(data,dim) and m = numel(numBins). Each of the m
% columns of bin is assumed to be one indexing dimension. The output will thus replace the dim
% dimension of data with an m-dimensional binned aggregate.
functi... |
7dfb4b6a9431692e5a2f46c6f2343cab247f48a67229257169bbba81c1ea6929 | MATLAB | 2,370 | 75 | function [rp ci ai ncol]=sparse_to_csr(A,varargin)
% SPARSE_TO_CSR Convert a sparse matrix into compressed row storage arrays
%
% [rp ci ai] = sparse_to_csr(A) returns the row pointer (rp), column index
% (ci) and value index (ai) arrays of a compressed sparse representation of
% the matrix A.
%
% [rp ci ai] = ... |
ea007c7fb58e789ffbd70d22279a45851af5b7e9145f19cdde50923f61b6a8e8 | MATLAB | 2,370 | 91 | function outpict = imadjustFB(inpict,inrange,outrange,gamma)
% outpict=imadjustFB(inpict,{inrange},{outrange},{gamma})
% passthrough to imadjust() with internal fallback
% for systems without IPT installed.
%
% Not all features are available in the fallback implementation
% IPT methods exploit precomp... |
0254be0613719de47457b63d5e644b8b74433d66de1873070d5e78f93de81511 | MATLAB | 2,371 | 89 | function ColorSet=varycolor(NumberOfPlots)
% VARYCOLOR Produces colors with maximum variation on plots with multiple
% lines.
%
% VARYCOLOR(X) returns a matrix of dimension X by 3. The matrix may be
% used in conjunction with the plot command option 'color' to vary the
% color of lines.
%
% Yellow an... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.