sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
3ab98e3f7032907757524215881642460f0747c0c6168b473d93f9321764166e | MATLAB | 3,265 | 55 | function [corr_kern, varargout] = checkCorrKern(data_obj, corr_kern, varargin)
% corr_kern = checkCorrKern(data_obj,corr_kern)
%
% Check the correlational kernel and make sure that everythign is correct.
%
% 2019 - Adam Charles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Input Par... |
03957752ee900acab9201b1de0e4e5e007e2f1a3da48bac9ee1cee8abdbf7e0c | MATLAB | 3,268 | 75 | function [config] = addparts(config)
temp = dir(config.rawdir);
temp = temp([temp.isdir]);
temp(1:2) = []; % remove . and ..
clear flist
for i = 1 : size(temp, 1)
flist(i, :) = temp(i).name;
end
[~, locb] = ismember(config.directorylist{3}{end}, flist, 'rows');
flist = flist(locb+1... |
b1fb372ba6c9f7658065d595ed81df0be25df505a0c951b1b44f9f653338846b | MATLAB | 3,276 | 91 | %% Compare the minimal RMSE trajectory
clc,clear all;close all;
ls = dir('../embedding/sub*.mat');
%
MCMC_folder = '../data/Inference/MCMC_sub';
% corresponds to MCMC_sub16
fig = figure('Position',[316 131 1050 600]);
for idx = 1:length(ls)
subplot(4,5,idx)
load(['../embedding/',ls(idx).name]);
MCMC_... |
3b9f06ca20fc19ccac8249e0bbc69774b90e113eb07c0c6ed5629409f0cf7fcf | MATLAB | 3,277 | 77 |
% This is a master script that runs the spike sorting algorithm klusta
% (https://klusta.readthedocs.io/en/latest/) in a format that is friendly
% to the neuralynx format and the way we save our recordings
%% load experiments and make animals (instead of experiment) the unit on which to sort
clear all
klusta = 1;
... |
446a398d1837781b8ff74e5536a9910e60e8ecc873a0049e0b06d9f61884de3f | MATLAB | 3,284 | 63 | % main_additional_analysis.m
%% PI Similarity of Holdout Test
holdoutPISimilarityList = mouseConnectomeDataAnalysis.OverallModelAndResults.calculateHoldoutPISimilarityList();
%% Calculate Cosine Similarity between Wiring PIs
wiringPIdata = mouseConnectomeDataAnalysis.OverallModelAndResults.FullAnalysisModel.WiringPI... |
72347ea543557ccca6659e571bd4dc20333cc2a14059c3e3ff3684d8c7e3c54b | MATLAB | 3,286 | 112 | function clusterInfo = cluster_data(locAll,varargin)
% the returned index contains noise data with idx=1
% locAll %um
prmAll = varargin{2};
prmAll.cluster = set_default_parameters(varargin{:});
prm = prmAll.cluster;
for ll=1:numel(locAll)
if ~isempty(locAll{ll})
locAll{ll} = locAll{ll}*1e3;
... |
a9fc5f1704dcbc57c04d4e7d9258e1dbfef24b6f1756591ed33f3e39ef533c95 | MATLAB | 3,286 | 102 | function [x_out] = gradient_descent_backtrack(funfcn, x_init, options)
% Gradient descent optimization with backtracking search. All options must be explicitly defined.
% Also see backtracking_linesearch().
%
% funfcn - function handle which returns [fval grad]
% x_init - Initial estimate of unknown parameters
%
% ... |
aca7cab88f66683b1f717c54d547c6fcecab05e68e2a96d4358811d11b93ede7 | MATLAB | 3,288 | 90 | %% ==================== Figure 1 (Locust) ====================
clear all; close all; clc;
% Load data
load('data1_locust_PN66.mat');
% Fig1b: PSTH for each PN overlay on single plot w offset w gap btwn odors
close all; clc;
colorPalette = [226, 208, 251; 255, 235, 179; 254, 220, 205; 255, 204, 226]/255;
figu... |
02c5f51265e6d216d9380f7536f90c7a76975005a02942c087c4083538d656a2 | MATLAB | 3,290 | 100 | clc,clear all;close all;
sub_folder = ['../data/EEG/'];
ls = dir([sub_folder,'ds*mat']);
% Focus on the first half hours
fs = 100;
t_start = 1*fs;
t_end = 1800*fs;
t = linspace(t_start,t_end,(t_end - t_start + 1)) / fs;
% Wavelet parameter
wavelet_name = 'cmor1-1.5';
central_freq = centfrq(wavelet_name);
freq_start ... |
f72f02a8dc3db9e33b3aadb901b7c09cadff139b677d766784860cd23743f97d | MATLAB | 3,303 | 86 | function skeletons = normalizeSkeletons(filenames, spacing)
% Let's start with filenames as an cell array of strings specifying the .mat
% files
% calling function must supply the value of 'spacing' which is the node
% spacing on the 'standardized' skeleton
% The purpose of this function is normalize the lengths of ... |
9a039866e5c37f125a51ba141661954addbb55a7a6edf9e16482a70db95b8e08 | MATLAB | 3,304 | 66 | function PPC = getPPC_PLV(LFP, MUA, fs, fsMUA, bands, threshold)
% by Mattia: compute Pairwise Phase Consistency (PPC) and Phase Locking Value (PLV)
% read Vinck et al. (2010) for why PPC is preferrable over PLV
%
% input:
% LFP : entire signal
% MUA : not do... |
ab6839c3b24004f65b503b1660d7be455c0b7e47bde3e7a00ec9136a839a64b1 | MATLAB | 3,307 | 114 | function [ax] = subplotXmanyY_er(m,p,Listener)
%SUBPLOTXMANYY_ER Creates subplot axes with common x-axis and minimizes the
%white space between the different axes. The white space removal is
%performed when the figure's 'SizeChangedFcn' callback is
%initiated. Initiates after first figure resize or first time figure
%b... |
6504e0a89347f4f4c77ac02ab2cd61addd0144f970fb6fcc8fa0581772c66087 | MATLAB | 3,311 | 76 | function [sv,sp,fm] = spsvd(data,params,mdkp)
% Space frequency SVD of input data - continuous processes
% Usage: [sv,sp,fm] = spsvd(data,params,mdkp)
% Inputs:
% data (data matrix in timexchannels form)-required
% params structure containing parameters - params has the
% following fields: tapers... |
2cd7fc80bde37c7aeba98f03dd8e1823817fb9150eaf5dc20c1b1a6c543afc5c | MATLAB | 3,313 | 63 | function [cortical_labels, bipolar_labelold, bipolar_labelnew, bipolar_tra, channelInfoNew] = generate_reref_matrix(channelInfo)
%% Sort all channels by group, then channel number
channelInfoSorted = sortrows(channelInfo,{'Group', 'Channel'});
%% Find all depth electrodes
depth_electrodes = contains(lower(channel... |
3e494aacb8421d02f78761474d9399a4abb315331b95f15f5e0d72a6dcc0bec4 | MATLAB | 3,315 | 114 | % main_for_gene_analysis.m
%% Make Files for GSEA
genes = geneInfo.getGeneAcronyms();
for d = 1:dimPI
scores = abs(relatedGeneAnalysisResults.CorrCoefMatrixSource(:,d));
fileNameStr = strcat("geneRanking_PI",num2str(d),"_source.rnk");
write_rnk(fileNameStr,genes,scores);
scores = abs(relatedGeneAnalysi... |
3babf2dc5f00036064db937853acae3d0ba5eba9f47533bec0974d7cf34ab8f2 | MATLAB | 3,319 | 78 | function bestSeed = CBIG_AuthorTopic_ComputeBestSolution(rootDir, K, ...
seeds, alpha, eta)
% bestSeed = CBIG_AuthorTopic_ComputeBestSolution(rootDir, K, ...
% seeds, alpha, eta)
%
% Return the index of the initialization (seed) of the Collapsed
% Variational Bayes (CVB) algorithm run that returned the highest
% ... |
464440fd27e97213323a10f137d6914e3f4d9e16f77d6cece9f00dc2d7bb6bfb | MATLAB | 3,329 | 85 | function PNactivity = generate_PN_odor_responses_NadasResampling()
%candidates for arguments to be integrated into function call
numtrainingSamples=15;
% noiseLevels=[0.5,1,2];
noiseLevel = 1;
K_odors = 200;
numTrials = 30;
% the odors we used in Fig2, 3 and 4, stored in this .mat file.
load('Data_submitted_fly_wNo... |
9869e712cecdc706b51d0d4577be35435cc51425f738746e79aef7c36de03683 | MATLAB | 3,332 | 114 | clear
close
%% REPRESENTATIVE TRAJECTORIES FOR REGIONS 1–7 SHOWN IN FIG. 1b
diagram_name = 'gCa=12_Id=0_example_orbits';
% each row is: Is, Id
points = [30 0; 22.5 0; 18.1 0; 10 0; 3.5 0; -1.5 0; -15 20];
% each row is: transient length, timespan length, IC index
points_data = [3000 100 1; 3000 100 1; 1000 500 1; 1... |
e235e79f3caad0b3a11f95d0f26ff7bc2424893a8e55b75e4ccb2a1e835667de | MATLAB | 3,334 | 121 | function rempict = thresholdinpaint(bg,mode,mask,fold,method)
% THRESHOLDINPAINT(INPICT, MODE, MASK, {FOLD}, {METHOD})
% use PDE inpainting to estimate deleted pixel values
%
% INPICT is a I/RGB image
% MASK is a 2-D logical pixel mask
% MODE specifies where image elements should be deleted
% and r... |
6f02731f9aa8b1e41023a4e613307f0d733914adc1d3fb743a53074da1d9e635 | MATLAB | 3,339 | 73 | function [mask, cluster_p] = run_clustering(LIMO_paths, significance_threshold, channeighbstructmat, tf, paired)
%% Prepare data and calls LIMO cluster correction
%
% **Usage:** [mask, cluster_p] = run_clustering(LIMO_paths, significance_threshold, channeighbstructmat, tf, paired)
%
% Input(s):
% - LIMO_paths = path... |
4f0f82d36d7e16521d3c35b85d495634850ed4fd392736617e6c4b6bcd4b773c | MATLAB | 3,355 | 92 | function fLocAnalysisWrapper(sessions, clip, stc, QA)
% Automated group analysis of fMRI data from fLoc localizer experiment
% using vistasoft functions (https://github.com/vistalab/vistasoft). If
% there is an error, the code terminates the analysis of that session but
% then continues on to the next session.
%
% IN... |
7ec56a04e5dfd91631944957e4b066d04f41e07d19898cebe4d06838fc2e223f | MATLAB | 3,360 | 83 | function [interictalSinglePeaks,positiveEvent,negativeEvent]=EventsGrouping(interictalPeaks)
% USAGE
%
% [interictalSinglePeaks,positiveEvent,negativeEvent]=EventsGrouping(interictalPeaks)
%
% Groups events that belong to the same activity. if there are several detected
% events for the same activity... |
1a42a5abe281fd1a1cac1fa247cc75a1d92f516ed4cd545e0361d8e11d9bec51 | MATLAB | 3,365 | 116 | function [A,score,AA]=nt_mcca(C,N)
%[A,score,AA]=nt_mcca(C,N) - multi-set cca
%
% A: transform matrix
% score: commonality score (ranges from 1 to N)
% AA: array of subject-specific MCCA transform matrices
%
% C: covariance matrix of aggregated data sets
% N: number of channels of each data set
if nargin<2; erro... |
a91533b729fd12e4e3830b2c78ca64ea0c74cf890fd6efaf6f1b4588125947c1 | MATLAB | 3,367 | 103 | function [inaddr,ints,tick]=aemonseq2(usb_seq,usb_mon,addr,ts,monitortime)
%[inaddr,ints_us,tick]=aemonseq(usbinterface,addr,ts,monitortime)
%
% function to sequence and monitor events with one USBAERmini2 device
%
% parameters:
%
% usbinterface: reference to USBAERmini2 device. get a reference to a
% ... |
da40080f2b79b2ec054dc62ff47f5d6d173f9fc22adbb0eb7fb7e6a9a0df9d4f | MATLAB | 3,367 | 91 | function cortical_SCT_measures(sub_surf,atlas_surf,NLevels,thickness_surf, SCT_outfile)
if ~exist('NLevels','var')
NLevels=5;
end
if ~exist('thickness_surf','var')
thickness_surf=sub_surf;
end
s=readdfs(sub_surf);
s=smooth_cortex_fast(s,.1,1000);
% compute principal curvatures, mean curvature, gaussian curva... |
1ed1b57db635bc9804e032df5dc290fee0aebeb312e1329d44ea79e8dde3ee2f | MATLAB | 3,369 | 67 | function [S,f,Serr]=mtspectrumc(data,params)
% Multi-taper spectrum - continuous process
%
% Usage:
%
% [S,f,Serr]=mtspectrumc(data,params)
% Input:
% Note units have to be consistent. See chronux.m for more information.
% data (in form samples x channels/trials) -- required
% params: structure with fields... |
4646104924735caa4c36d8849c063443ee12fbb28ea0ebfa75465b850923cf73 | MATLAB | 3,369 | 94 | classdef Meta
methods (Access = public, Static)
function meta = from_string(str)
meta = containers.Map();
if ~strlength(deblank(str)), return; end
db = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder();
... |
70513bb8eeb1c6cc1e124846037e0ea7ae8e4f09a3f6a141129417bd7bd2302d | MATLAB | 3,369 | 116 | clc; clearvars; close all;
T = readmatrix('source_data_file.xlsx','Sheet', 6);
ChR_before = T(1,2:6);
ChR_after = T(1,10:end);
nostim_before = T(2,2:6);
nostim_after = T(2,10:end);
ctrl_before = T(3,2:6);
ctrl_after = T(3,10:end);
% Group data into a matrix: rows = groups, columns = subjects
data = {
ChR_before... |
b9df2157b4006fcaab4de4fde81e0b42fff225c3a110ca5c6200019837095058 | MATLAB | 3,372 | 134 | function outpict = bwareafiltFB(inpict,varargin)
% OUTPICT=BWAREAFILTFB(INPICT,SIZERANGE,{CONN})
% OUTPICT=BWAREAFILTFB(INPICT,NUMGROUPS,{WHICHGROUPS},{CONN})
% Extract selected groups from a binary image based on group size.
%
% INPICT is a 2D binary image.
% Numeric inputs will be thresholded at 50% gra... |
9a142be4997dfa35ce6493baf4dba51f6557506b6bab4d66aa27603e663ee056 | MATLAB | 3,373 | 86 |
% This example script computes some information theory parameters based on
% spike trains. Among other things, it can be used to assess the
% "complexity" of a spike train (its entropy) or the communication
% (mutual information) between different spike trains.
% In this example script, two spike matrices from two d... |
9bc5f12b2ea034090363bff5e5ebd5dc3ada44d0dceadfcf134f411db99a8313 | MATLAB | 3,375 | 142 | function [c0,c1,A,todss,pwr0,pwr1]=nt_bias_cluster(x,dsr,flags)
%[c0,c1,A,todss,pwr0,pwr1]=nt_bias_cluster(x,dsr,flags) - cluster covariance
%
% c0,c1: covariance matrices of clusters
% A: map of cluster ownership
% todss,pwr0,pwr1: result of DSS
%
% x: data (time*channels)
% dsr: downsample ratio for cross produc... |
b6efa4a183f0f3a7eeddad8040ffc00003a8eb9ab96c2ec11bba8ac11ebd50d7 | MATLAB | 3,377 | 116 | clc; clearvars; close all;
T = readmatrix('source_data_file.xlsx','Sheet', 2);
ConFoff_before = T(1,2:7);
ConFoff_after = T(1,10:end);
nostim_before = T(2,2:7);
nostim_after = T(2,10:end);
ctrl_before = T(3,2:7);
ctrl_after = T(3,10:end);
% Group data into a matrix: rows = groups, columns = subjects
data = {
Co... |
30badd36b43719b656e6e1986a5ca2b0a32f0d45b80a5aa8fbada923abc31866 | MATLAB | 3,379 | 98 | %% IMAGENAN Patch-based image display with nonuniform binning and NaN values represented with a special color
% [hValid, hNaN, xEdges, yEdges] = imagenan(axs, x, y, C, nanColor, colorLim, colorMap, ...)
function varargout = imagenan(axs, x, y, C, nanColor, colorLim, colorMap, varargin)
%% Default arguments
... |
d2b3f5248e6c07dc80f54ffc169a23d0aa51c19cc48693e9ab219670074895ed | MATLAB | 3,391 | 116 | % Example script to run a simple pRF analysis on a voxel-by-voxel basis
% and view the results. You may wish to run this script section by section
% to get a feel of how it works.
%
% Neuronal model: Single Gaussian function
% Receptive field: Circular (isotropic)
% Input specification: Polar coordinates
%
% ... |
10b9a36d6d496d12d80b098883ec6469a3d0ac4c874d3f038681fb0b4fc5abed | MATLAB | 3,392 | 86 | function outpict = jpegslur(inpict,sluramt,preshift,quality,source)
% JPEGSLUR(INPICT, SLURAMOUNT, PRESHIFT, QUALITY, SOURCE)
% exploits jpeg compression error to reduce the reversibility
% of a pixel shift operation. Performs a vector shift on INPICT
% based on the difference of vector averages o... |
169180583ba962d0a66d808b5808a6b407544d00dc6134a9ab69ca2399c76861 | MATLAB | 3,394 | 88 | function coupleLFP(suffix)
% Phase Amplitude Coupling LFP
%
% Import Parameters from temp file
Params = read_params(suffix);
pass_band_1 = [Params.freq_start_1, Params.freq_end_1, Params.freq_step_1];
pass_band_2 = [Params.freq_start_2, Params.freq_end_2, Params.freq_step_2];
% Read lfp d... |
f2da9881c282426bcad0a22a9235ad60102ed722075e1ef2b43117569b028540 | MATLAB | 3,400 | 78 | function [DF_norm, DF_MAD] = FP_DEBLEACHED(DeltaFlour,Window, ITERATIONS)
%% By David Estrin & David Barker for the Barker Laboratory
% Code is written for ____ et al., 2020
% The purpose of this code is to take a calcium trace from fiber
% photometry and detrend/debleach the trace.
%% The following are Inputs:
... |
7bf7a58af0289d8d02e876ee9c1543338cf4fcf7f925cfa8d278386ef7735d5f | MATLAB | 3,401 | 117 | function plotBayes(result,plotOptions)
% this function creates the plot with the bayesian Posterior distributions
%function plotBayes(result,plotOptions)
% displayed are two dimensional marginal distributions of each parameter
% against each other parameter
% You may then enlarge each panel by clicking on it.
if ~exis... |
99e92df4b687caf65a64bb7772995469e1872548b2d9d2d3d493ead613833e07 | MATLAB | 3,405 | 107 | function [outnii, outFile] = add_sform(dataIn, outFile, force_flag)
% Adds sform parameters using the exisiting qform parameters, only if sform is unset or zero
% matrix in the standard NIFTI file. Saves the data in .gz file. It does not alter image matrix
% or the qform parameters.
%
% dataFile - .nii or .nii.gz fil... |
0bc26fbb5bcc9b597ea9d57d28587281b3926230cba6a8ce40098662c550de35 | MATLAB | 3,406 | 113 | function outpict = shuffle(inpict,tiles,varargin)
% SHUFFLE(INPICT, TILES, {OPTIONS})
% Subdivides the input image into tiles and shuffles
% them in a random or specified permutation
%
% INPICT is an I/IA/RGB/RGBA image of any standard image class
% Multiframe images are supported
% TILES is a 2... |
3d2b030f86a55cafb6e0974db8fa7ed2c6de4c3ffa93236572f6e9d77b0386bb | MATLAB | 3,406 | 139 | function fname = spm_prf_plot_entropy(PRF,fields,name,doplot)
% Computes and optionally displays a negative entropy map. More positive
% values (in units of nats) correspond to more confident parameter
% estimates.
%
% PRF - estimated PRF structure
% fields - cell array of field names to include (default: 'all')
% n... |
68538aacba190fd637ceb5316d4d2f9c1bc718f800cf01374b478311d875e9c7 | MATLAB | 3,407 | 89 |
% This is a sample main file that reads two grayordinate fmri files generated by bfp and outputs the synced files.
clc;clear all;close all;
addpath(genpath('/home/ajoshi/coding_ground/svreg'));
addpath(genpath('../'));
g2=load('/home/ajoshi/Downloads/sub10186/func/sub10186_rest_bold.32k.GOrd.mat');
g1=load('/home/ajo... |
dbba7349dbad2c39a95d37bf3499ab7b576a1de9f8aead0d83b4476a58e7d31a | MATLAB | 3,410 | 87 | function [config] = pnh_setparams_seizures
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% [config] = pnh_setparams
%
% This function outputs all the settings of a study, to be defined below
%
% Note the consideration of the operating system, because the pointers to
% the file server is d... |
0afb968cde5123685267ea10d1f0583c7fe88d2599f71825fe48c95e7d0443b2 | MATLAB | 3,412 | 98 | %% =========================================================
% VMD-based runoff point prediction visualization (test set)
% This script generates smoothed prediction curves and
% local enlarged views consistent with journal figure style.
%% =========================================================
clear; clc;... |
ed7ef205cef6e6662f7690c116a42c7619db65e3237c11957302ca9972d351ca | MATLAB | 3,412 | 94 | % 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 ... |
1cb5f3824a85f0f460863f173f19baa1fb93666def33e7b1ab47a4efc17f62f8 | MATLAB | 3,413 | 62 | %% Analysis script
%
% (c) Stephen Whitmarsh, stephen.whitmarsh@gmail.com
%
% requires bandpassFilter.m from Mario
% requires releaseDec2015 from Neuralynx website
addpath /network/lustre/iss01/charpier/analyses/stephen.whitmarsh/scripts/epilepsy/shared/
addpath /network/lustre/iss01/charpier/analyses/stephen.whitmarsh... |
8b957d2984a5fde3f18c0ca90eea7e5d7192ba224709a7131db373e6820891b6 | MATLAB | 3,414 | 100 | function sakCompile(lazy, varargin)
%% Allow string flag for forcing recompilation
if nargin < 1
lazy = true;
elseif strcmp(lazy, '-F')
lazy = false;
elseif ischar(lazy)
varargin = [{lazy}, varargin];
lazy = true;
end
%% Depende... |
cfedc7bbb06b475eec09545e46d0f6d7f15c1b0241f7a9e5c4be3e746b6ea28a | MATLAB | 3,414 | 86 |
%% Load data
clear, clc, close all
addpath('..')
path_DWI = 'D:\Projects\2023_multib\MK_multi_b\Stats_group_level_297_subjs\Mediation_analysis\';
list_phys_variables = {'slow_ADC'; 'fast_ADC'; 'slow_signal_portion'; 'tissueFraction'; 'meanDiffusivity'};
list_phys_variables_long_name = { ...
'Slow DC (a... |
a14d03669c9d954c2285032e44d0e08eb996902d524a0cbcdb5019690cd34852 | MATLAB | 3,419 | 81 | function slope = getSlope(result, stimLevel)
% function slope = getSlope(result, stimLevel, unscaled)
% This function finds the slope of the psychometric function at a given
% stimulus level.
%
% result is a result struct from psignifit
%
% stimLevel is the stimuluslevel where to evaluate the slope
%
% This function ca... |
c8fe3527fb664870e476da46dd85f62d3cb0c1df2def6237cc633c411e006f69 | MATLAB | 3,422 | 119 | function outpict = blockify(inpict,amount,mode)
% BLOCKIFY(INPICT, PIXELSIZE, {MODE})
% does a simple spatial downsampling of the image (pixelation)
% with support for independent axis and channel scaling
%
% INPICT is an I/RGB image of any standard image class
% multiframe images are supporte... |
5048c603629ad567f5f0318f7d3ad33c7a6cb376990bfd40ad3721b54dd81c55 | MATLAB | 3,423 | 92 | function spikes_by_trials = get_raster(spike_times, trial_begin_times, varargin)
%
% raster_gdf(spike_times,cell_specification,trigger,varargin)
%
% Plots spike rasters
%
% Inputs:
% spike_times List of spike times
% trial_begin_times List of times at which each new trial begins
%
% Output... |
50d78153db0d236466b5897685f0d0331c7186a07a7b86b34e4a2045eaaccd68 | MATLAB | 3,430 | 83 | function CBIG_SPGrad_upsample_embed_matrix(mesh,medial_mask,num_component,output_dir)
% This function upsample the downsampled diffusion embedding matrix to the original resolution
%
% Input:
% - mesh:
% resolution of surface mesh, e.g. 'fsaverage6', 'fs_LR_32k'
%
% - medial_mask: (#num_vertices x 1 bina... |
fd3a1f3d12db0e9bfff2cd846c7ce62548cf3c840d6eeb42c3a60cf8751e6ce7 | MATLAB | 3,433 | 124 | function spm_int_speedup()
% Speed up of spm int.
% ---------------------------------------------------------------------
% Copyright (C) 2023 Simon R. Steinkamp, Iyadh Chaker
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public Licens... |
c4f5753c58cb171d0d46ba3aa5a82eab6060968027a977969fb1c720e5799098 | MATLAB | 3,434 | 42 |
function headers = decode_image_headers(bytes, dims)
bytes = reshape(bytes, 198, []);
N = size(bytes, 2);
dims = num2cell(dims);
headers.version = reshape(typecast(reshape(bytes( 1: 2, :), 1, 2 * N), 'uint16'), 1, dims{:});
headers.data_type = ... |
5a127e4d2fe2c2c9a25f9acbae16847c05b8c8a1d65a340af4a486a396dba809 | MATLAB | 3,441 | 76 | function [trialinfo,dat] = writemicrostimforspykingcircus(cfg, markerdat, micromed_markers)
%% WILL ONLY RETURN TRIALINFO OF 50Hz
for stimrate = [1, 50]
fname_output = fullfile(cfg.datasavedir,[stimrate,'_SC_trialinfo.mat']);
% fname_output = fullfile(cfg.datasavedir,'SC_stim_trialinfo.mat');
if... |
6b59c2df4e60bd2eb3c2929a9381a639cc2ed88aba5c1e010299b89cf54b3c31 | MATLAB | 3,441 | 96 | function S = RenameField(S, Old, New)
% RenameField - Rename a field of a struct
% T = RenameField(S, Old, New)
% INPUT:
% S: Struct or struct array.
% Old, New: CHAR vectors or cell string. In the M-Version of this function
% strings are allowed also. The names must be valid Matlab symbols:
% <= 63 chara... |
36475078e6a00866c380fa001785357fb9bf9241fb9758c489a30c94625dff7e | MATLAB | 3,442 | 97 | function [aic,waic] = getInformationCriteria(result)
%getInformationCriteria(result) compute Akaike Information Criterion (AIC) and Watanabe-Akaike
%(Widely-Applicable) Information Criterion (WAIC) for use in model comparison with other
%psychometric models. See [1] for details of each. See also @getDeviance.
%
%[aic,w... |
9aa552f69361cfc09e53da837df791d734a92c4ecaf71a4a0359c1db6fc4652b | MATLAB | 3,449 | 94 |
% This is a sample main file that reads two grayordinate fmri files generated by bfp and outputs the synced files.
clc;clear all;close all;
addpath(genpath('/home/ajoshi/coding_ground/svreg'));
addpath(genpath('../'));
subid='sn7915';%'sn5895';%'sn7602';
g2=load(['/deneb_disk/from_Todd_Constable_Epilepsy_Processed/'... |
295b6713f94f3ac488a3722e67dedbdaa5c5c1048a7e1ed2d3390f63d52c8a24 | MATLAB | 3,451 | 109 | function swave=smoothwavelet(wave,dt,period,dj,scale)
% Smoothing as in the appendix of Torrence and Webster "Inter decadal changes in the ENSO-Monsoon System" 1998
%
% used in wavelet coherence calculations
%
%
% Only applicable for the Morlet wavelet.
%
% (C) Aslak Grinsted 2002-2014
% http://www.glaciology.net/wavel... |
2772a431c5fb3740c5ab78f9fbd61ec45a9a7c1891f83ce197a0101bda7a09db | MATLAB | 3,456 | 134 |
close all
%
load([pwd '/init_data/var_combos.mat'],'var_combos');
numPerBlock = 1000;
[lpp, ~] = size(var_combos);
maxNumBlocks = ceil(lpp/numPerBlock);
%
Sim_results = [];
for i = 1:maxNumBlocks
resultsi = load([pwd '/result/Sim_results' num2str(i) '.mat']).Sim_results;
Sim_results = [Sim_results, results... |
ca03702cefb6f5fe54d16b100f0adb9c71fbce76ed0f95808ca75468d1b39610 | MATLAB | 3,460 | 98 | %% =========================================================
% IVMD-based runoff point prediction visualization (test set)
% This script generates smoothed prediction curves and
% local enlarged views consistent with journal figure style.
%% =========================================================
clear; clc... |
a016851db340615008845570c5bd045f29bb27041b220578ce1b5a3204029991 | MATLAB | 3,463 | 90 | function [fileFlag, outFile] = check_nifti_file(nifti_file, file_workdir)
% Check input files for following:
% - If it exists on disk
% - does it has the right extension: .nii/.nii.gz/.img/.hdr
% - Defined header transforms
% - when only qform present, then add sform (if file_workdir is defined)
%
% fileFl... |
bef47e6b8d99e0e388db7ebd14d29364e865947231024b8a700aaca36b76f012 | MATLAB | 3,481 | 81 | %% function to generate place field table by applying the masks.
%% main function to create a table with the most important field informations
MaxRZRadius = 5; % measured in bins
main_path = "C:\Users\ewell\Desktop\TestCodeGitHub\"; % change this only
rootdir = strings(2,1);
rootdir(1) = strcat(main_path, ... |
dfbd7ba3d2cd83bbc6e4a5ad28fbee59dee59d4c4c116f06bd7f29d3fa947f1b | MATLAB | 3,483 | 83 | function [pred_stats,loss] = CBIG_compute_prediction_acc_and_loss(y_pred,y_test,metric,y_train)
% [pred_stats,loss] = CBIG_compute_prediction_acc_and_loss(y_pred,y_test,metric,y_train)
%
% This function computes the prediction accuracy and loss defined by the
% metric passed in.
%
% Inputs:
% - y_pred
% Vector o... |
ac3e6d341b60570adac93af6b7193cb5bf1d38f6368ce9c049b5d747b557f62a | MATLAB | 3,484 | 85 | function CBIG_WriteSurfaceData(output_file, surf_data, data_struct, data_size)
% CBIG_WriteSurfaceData(output_file, surf_data, data_struct, data_size)
%
% This function writes surface data to a file.
%
% Input:
% - output_file:
% The output file name (full path). The output file should be either
% in ... |
aa575235d0bd928c8d3e5fb29a78f294021e012c0e84225929e93c6ca5366729 | MATLAB | 3,485 | 83 | % Draw a histogram of the given quantity, with a subset of the population (e.g. statistically
% significant effects) highlighted using an overlay. This can also be done using Matlab's
% histogram(), but I prefer using noon-transparent patches because transparency is broken in PDF
% exports under mysterious condition... |
497fa5e6ffe67d6fbaa553b43003f637c50ef85c0c4c3fd440a2c38a091d488d | MATLAB | 3,490 | 100 | function [LIMO_path] = run_t_tests_and_clustering(unique_name, paired, tf, data1, data2, options)
%% Creates a placeholder cell with the datasets of all participants for plotting of results
%
% **Usage:** [erp_data, ams, nams] = preprocess_erp_data(erp_data, paired, min_num_trials)
%
% Input(s):
% - unique_name = fol... |
516e22e96759b9d9ddb497ab52169c65279db8079fe2e1adac0e9500608c9856 | MATLAB | 3,491 | 93 | function r = bfGetReader(varargin)
% BFGETREADER return a reader for a microscopy image using Bio-Formats
%
% r = bfGetReader() creates an empty Bio-Formats reader extending
% loci.formats.ReaderWrapper.
%
% r = bfGetReader(id) where id is a path to an existing file creates and
% initializes a reader for the in... |
c35168a7a1716c6e853a5503ae9dade3abbee900e5fbca3bb9567ccf61725583 | MATLAB | 3,497 | 118 | function chk = testfun_nsx(fnh)
% Test function for ARBSORT, NATSORT, NATSORTFILES, and NATSORTROWS. Do not call!
%
% (c) 2012-2024 Stephen Cobeldick
%
% See also ARBSORT_TEST NATSORT_TEST NATSORTFILES_TEST NATSORTROWS_TEST
chk = @nestfun;
wrn = warning('off','SC:natsort:rgx:SanityCheck');
cnt = 0;
itr = 0;
... |
0aaa0a7a88034458d94de157b9a677ce252a8bef61066324be8288b5fa63f782 | MATLAB | 3,498 | 122 | function [b,z]=nt_regw(y,x,w)
%[b,z]=nt_regw(y,x,w) - weighted regression
%
% b: regression matrix (apply to x to approximate y)
% z: regression (x*b)
%
% y: data
% x: regressor
% w: weight to apply to y
%
% w is either a matrix of same size as y, or a column vector to be applied
% to each column of y
%
% NoiseT... |
c2e8b7c4a63d7ac64f7565fc9296b8be27560027e05202d7732b370fea99d854 | MATLAB | 3,504 | 130 | function outpict = pseudoblurmap(map,inpict,varargin)
% OUTPICT=PSEUDOBLURMAP(MAP,INPICT,{OPTIONS})
% This tool applies a simple multipass opacity blended image blur; no actual
% map analysis or segmentation is performed. The focal distance corresponds
% to MAP=0; maximum blur occurs at MAP=1.
%
% MAP ... |
441ff5f45f51fb1eb3bdae1ca16fc38ba2242a634b64330d5fa379a7d18da2e4 | MATLAB | 3,507 | 109 | function outpict = rgb2hsy(inpict,mode)
% RGB2HSY(INPICT, {MODE})
% Convert an rgb image to a normalized polar adaptation of YPbPr
% This is offered as an unconventional alternative to HuSL or
% LCH for general image editing without causing large perceived
% brightness distortions when changin... |
46803d49c795224ff599b8a50d10092ce8f5c99322887b74e6f55ddb6aebea24 | MATLAB | 3,508 | 76 | function [nct_regions nct_global]=nct_analysis_global_regional(A,T,rho,x0,xf)
% function computes control energy and stability for two states within an
% task; fist for the whole network, then after iteratively prohibiting each
% node from exhibiting control
% Sebastian Markett (2022),
% using code from Urs Braun... |
0d335dc5b52434402e7a0ee04624843abb0b150eecb102b43d44cd1ad6af7e88 | MATLAB | 3,517 | 131 | function outpict = imbcg(inpict,varargin)
% OUTPICT = IMBCG(INPICT,{OPTIONS})
% Simple tool to adjust image brightness, contrast, and gamma.
% This is less flexible than imcurves(), imlnc(), or imadjust()/imadjustFB(),
% but may be convenient for users who are accustomed to interpreting the
% process of i... |
9c47c0f39d4228916914253cd9612038084d197ef3b47d5952e3fee281388e91 | MATLAB | 3,541 | 114 | tic
%% read in data of KC activities
data = readtable('all KC values.csv');
allKCvalues = data(3:end,2:end); % remove header rows, and first column
allKCvalues = table2array(allKCvalues);
linearized = allKCvalues(:); % linearize the array
linearized(isnan(linearized)) = []; % remove NaNs
numOdors = 7;
numSamples = leng... |
8f9277632b551d83644d3d260165966a1ecd751f973084d2ac9c6667bef4e707 | MATLAB | 3,546 | 84 | function [hypnogram] = PSG2table(cfg, MuseStruct, force)
% HYPNOGRAM outputs table of hypnogram
%
% use as
% [hypnogram] = PSG2table(cfg, MuseStruct, force)
% This file is part of EpiCode, see
% http://www.github.com/stephenwhitmarsh/EpiCode for documentation and details.
%
% EpiCode is free software: you can red... |
3ade52a557bc073979f4aba5dc018bbe1c78c8fc981f73b648a2f5bfaf75182e | MATLAB | 3,551 | 50 | %% WOR DATA : find WOR peak per channel, and normalize time per channel
%Antoine
%+ normaliser le temps que selon la 1ere wod/wor, pour toutes les électrodes du rat ? pour
%mieux voir le délai entre électrodes
for ichan= 1 : size(LFP_trial_... |
9a7414b66815d39a5078a957bd0f717e69af238fb976d84f85fed1706b579600 | MATLAB | 3,553 | 105 | function outpict = uniquant(inpict,nlevels,varargin)
% OUTPICT = UNIQUANT(INPICT,NLEVELS,{INRANGE},{MODE})
% Convert an array (e.g. a grayscale image) to an indexed image
% by simple uniform quantization.
%
% INPICT is a numeric array
% For 'default' and 'cdscale' modes, INPICT can have any dimensionality.
% ... |
90566416277414eec9793c2cc08511719a574327b050d8e71ee179ee837e758e | MATLAB | 3,554 | 41 | function check_nr_crises_startend(cfg, MuseStruct, ipart)
%displays infos in case of missing markers (i.e. 'Crise_Start' without
%'Crise_End'), or, 'long' marker instead of punctual marker (i.e.
%'SlowWave__START__ and SlowWave__END__ instead of only SlowWave).
for idir = 1:length(MuseStruct{ipart})
marker.synctim... |
98dd4d4f0784fcf78504f14664d4e383ab2e493fc51ea5dedf9cb00d9b2b6e61 | MATLAB | 3,557 | 128 | function [y,yy,yyy]=nt_dsample(x,dsr,method)
%[y,yy,yyy]=nt_dsample(x,dsr,method) - downsample by averaging neighboring samples
%
% y: downsampled data
% yy: instantaneous power of residual
% yyy: original minus downsampled
%
% x: data to downsample (2 or 3D)
% dsr: downsampling ratio (must be integer)
% method:... |
e61ac8f7468975c96eb822494006201fffe8d3a1c9e1b45ee52f1f6d6a55ecc4 | MATLAB | 3,559 | 80 | function params = CBIG_AuthorTopic_InitializeParams(params, alpha, eta)
% params = CBIG_AuthorTopic_InitializeParams(params, alpha, eta)
%
% Initialize the parameters of the Collapsed Variational Bayes (CVB)
% algorithm for the author-topic model
%
% Input:
% - params : struct containing parameters of the author-t... |
f58645a7887f73dffa626cdc421cdd1b54419466fdc889e51b64e66abd4adf3a | MATLAB | 3,560 | 104 | % Coupling of the KNDy network model with MePD outputs during restraint
% stress
function dx = KNDyXMePD_stress(t,x,par)
dx=zeros(6,1);
%% KNDy model parameters
d1 = par.d1; % Dyn degradation rate
d2 = par.d2; % NKB degradation rate
d3 = par.d3; % Firing rate reset rate
k1 = par.k1; % Maximum Dyn secretion rate
k... |
fda80b6f7d6182cde671519b76ed5a4595f105e7fd7cb027a6236bb4dd3091ee | MATLAB | 3,560 | 95 | function CBIG_compute_LRR_fitrlinear_PFM(feature_file, LRR_dir, sub_fold_file, score_ind, outstem, outdir)
% CBIG_compute_LRR_fitrlinear_PFM(feature_file, LRR_dir, sub_fold_file, score_ind, outstem, outdir)
%
% This function computes the predictive network features of linear
% ridge regression (under <CBIG_CODE_DIR>/u... |
7bcfa0a28c5ce3e155755cf3f54784e2cf80699a74735a847ae33af9f9d30b5b | MATLAB | 3,564 | 59 | % Load neuralynx file (.nlx) to matlab (.mat)
% Sebastian Bitzenhofer 2017-10
function [TimeStamps, Samples, fs] = load_nlx_Modes(File,ExtractMode,ExtractModeArray)
%Input
%file: file path and name as string
%ExtractModeArray: []-full trace; [start_time end_time] in milliseconds
%Output
%TimeStamps: TimeStamps of ... |
3de36544cdeba49b7379406d4e2542e2b05be760873ff238b006df511efa42e7 | MATLAB | 3,569 | 81 |
%% load experiment info and set a few variables for analysis
clear
% load experiments and generic stuff
experiments = get_experiment_redux;
repeatCalc = 0;
save_data = 1;
% the number of CPU cores to use to load signal. Unless you are doing
% nothing else on your computer, do not use all of them. Otherwise you will
%... |
d260d14d535f036a2227d9b96f0765191609e1e5c44f64225ce208391d71078f | MATLAB | 3,575 | 117 | clc,clear all;close all;
%selected subject with clear wake-to-sleep transition
sub_folder = ['..\data\EEG\'];
ls = dir([sub_folder,'ds*mat']);
fs = 100;
t_start = 1*fs;
t_end = 1800*fs;
t = linspace(t_start,t_end,(t_end - t_start + 1)) / fs;
% Wavelet parameter
wavelet_name = 'cmor1-1.5';
central_freq = centfrq(wav... |
d57d7046d85403893e6076200817c54312d7be69b85214872a7824a9d870f750 | MATLAB | 3,575 | 125 | function cdiff = colordiff(Argb,Brgb,varargin)
% DE = COLORDIFF(A,B,{CSPACE},{DETYPE})
% Calculate the Delta-E color difference between two images.
%
% A and B may be RGB images, Mx3 color tables, or 1x3 color tuples of
% any standard image class. Tables and tuples are expected to be
% properly-scaled for... |
e6dca1e4baa0d45a446d565c67799be2cb92bba954a83c90cf7b3591fdf427dd | MATLAB | 3,575 | 103 | function powBurstLFP(suffix)
% LFP POWER - BURSTS
% Find bursts in power.
% Criteria: Must exceed 2 sd of trial mean for 3+ cycles.
% Burst def: Half-max to half-max.
%
% AUTHOR: Charles D Holmes
% EMAIL: chuck@eye-hand.wustl.edu
%
% Turn off warnings
%warning off all
% Import Paramet... |
74bb08f604f170a2de8de3e55707603355a812b612dc8509a6b7ed7e01409c5e | MATLAB | 3,579 | 84 | classdef slider < handle & varMenus
properties
var % name of the varibles
val % vector of possible values
sliderstep
main_slider
min_text
max_text
var_text
val_text
end
methods
function obj = slider(fig, var, val)
... |
1f0c76035a34197b28662f8946a072bdb42adeeb068f601ce13e7c9e434b1709 | MATLAB | 3,585 | 112 | function outpict = hsy2rgb(inpict,mode)
% HSY2RGB(INPICT, {MODE})
% Extract an rgb image from a normalized polar adaptation of YPbPr
% This is offered as an unconventional alternative to HuSL or
% LCH for general image editing without causing large perceived
% brightness distortions when chang... |
51db042b132c40b3c4e6d546b58da662b06273e9de21e8fef9239c9e43bda3fd | MATLAB | 3,585 | 101 | function [cfg, MuseStruct] = alignTemplates(cfg, MuseStruct, LFP)
cfg.orientation = ft_getopt(cfg, 'orientation', 'landscape');
t = [-0.15 0.10];
for ipart = 1 : size(LFP, 2)
% t-zero LFPs
fig = figure;
papersize = 800;
set(fig, 'PaperPositionMode', 'auto');
if strcmp(cfg.orientati... |
986ffc0f5441739cf35b0ac5ed1aba54a44a2aa703b8ff56079c9f9ef6eecffb | MATLAB | 3,588 | 69 | % ConnectomeDataAnalysis Script Template
% This script performs full + holdout analysis on an arbitrary connectome dataset
%% === Step 1: Load or prepare connectome data ===
connectomeMatrix = ConnectionMatrix(connectionMatrixOhP005_sorted); % <-- input matrix
brainInfo = BrainRegionInformation(structureInfoTableOh20... |
d025d0ff4d8d0b976fa61d1a1079fe641a03adbfaa79b09de3dc4867f5aba1bb | MATLAB | 3,593 | 74 | function [data, X_vol, Y_vol, Z_vol, res, Tvol, vol] = get_original_grid_data(vol)
% Returns the actual sampling grid points (in real-world coordinate) and the data at those grid
% points. This function only uses information from sform matrix of nifti header. qform matrix
% is ignored, even if present. No reslicing or ... |
b9a667d4e0607c2ff9d72013eb59077b8a2af55e7a2a1f642488d7b89ddfe482 | MATLAB | 3,594 | 95 | function BatchResults = Batch_SpikeDetection(filename,threshold,channel,toDenoise)
% USAGE
%
% BatchResults = Batch_SpikeDetection(filename,threshold,channel,toDenoise)
%
% Main function for the spikes detection. Filter the signal, receive
% the spikes peaks, group the peaks to detect an event once and recei... |
583255318db7d651700af67dfdbc7e78105f969af9b87a9dcff9a6cc545f043e | MATLAB | 3,596 | 95 | function [X_out, alpha, cntr] = backtracking_linesearch(funfcn, X, fval, gradX, search_dir, params)
% Backtracking with Armijo-condition. No computation of gradients.
%
% funfcn - function handle which returns function evaluation
% X - current estimate of solution
% fval, gradX - value & derivative of func... |
1912af60fe1914f7258ba5ace3203468a01db24c85b63209879d97cc9b12d236 | MATLAB | 3,601 | 83 | function CBIG_AuthorTopic_ComputeBIC(allKs, maskPath, bestSolutionDir, ...
outputDir)
% CBIG_AuthorTopic_ComputeBIC(allKs, maskPath, bestSolutionDir, ...
% outputDir)
%
% Compute Bayesian Information Criterion (BIC) measure of the author-topic
% model's parameter estimates across different numbers of components.
... |
16760d1f367cae291231a75fe498fdd7025d977d4bd49962aa439f3933739087 | MATLAB | 3,604 | 93 |
%% Add path
if isunix
addpath /network/lustre/iss01/charpier/analyses/stephen.whitmarsh/EpiCode/projects/hspike/
addpath /network/lustre/iss01/charpier/analyses/stephen.whitmarsh/EpiCode/shared/
addpath /network/lustre/iss01/charpier/analyses/stephen.whitmarsh/EpiCode/external/
addpath /network... |
ac486a2cf779f47890b8c4fec68f9dafec67c077d237bd2c579acfe8115ccb5b | MATLAB | 3,609 | 110 | function ROIs = clickCircles(figHandle, axHandle, circleSize, varargin)
% clickCircles: Interactively specify multiple circles
% varargin is if you want to give existing ROIs
% note the existing mask must be 3d (x, y, # ROIs)!
%
% Overlays an imfreehand ROI on an image.
% Gives the ability to tweak the ROI by adding a... |
9212322575ddff2cd72576ea1864bd5e8249a731628a95f211e08ab4ad32ea0b | MATLAB | 3,610 | 116 | function cm = bipolar(m, n, interp)
%bipolar: symmetric/diverging/bipolar colormap, with neutral central color.
%
% Usage: cm = bipolar(m, neutral, interp)
% neutral is the gray value for the middle of the colormap, default 1/3.
% m is the number of rows in the colormap, defaulting to copy the current
% colormap, ... |
101e193f80b3c70552a21b0609cbddcae1884ba7882d3def479c30ae238a6e88 | MATLAB | 3,614 | 72 | %% Import data from text file
txtfileFullName = ['.txt']; % Text File location
OutputSaveLocation = ['\dataStruct.mat']; % Enter location of folder where output is desired
% import .txt. file (lick times and state)
opts = delimitedTextImportOptions("NumVariables", 5);
% Specify range and delimiter
opts.DataLines = [1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.