sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
d9c78c71c2db9fc1b7923e7a9cb8f9752cc29265ffc9cd1ad90bcdf1201ce2f4 | MATLAB | 1,397 | 42 | function safepict = alphasafe(thispict,bsf)
% SAFEPICT = ALPHASAFE(INPICT,{BSF})
% Reduce an IA/RGBA/RGBAAA image to an I/RGB image by composing it with
% a simple gray checkerboard background. This is intended primarily
% for the purposes of visualizing the image with tools (e.g. imshow())
% which have no suppor... |
045f55a526aea4dadf9da55235a59bee391abaf6c95a04ee1a0206efe0a45b44 | MATLAB | 1,399 | 45 | % FIG. 2a
diagram_name = 'transients_IsId';
fig1 = openfig('./../figures/Is_Id_diagram_gCa=12.fig', 'invisible');
ax1 = get(fig1, 'CurrentAxes');
objects2 = allchild(ax1);
fig = figure;
copyobj(objects2(3:end), gca);
xlim([-25 45]); xticks(-25:10:45)
ylim([-25 45]); yticks(-25:10:45)
set(gca,'DataAspectRatio',[1,1,1]... |
c6bce74a3ff2b9d2bedffc7726499f07d4f5095ffbf62644bc21db93292c50b1 | MATLAB | 1,400 | 19 | function headers = decode_waveform_headers(bytes, dims)
bytes = reshape(bytes, 40, []);
N = size(bytes, 2);
dims = num2cell(dims);
headers.version = reshape(typecast(reshape(bytes( 1: 2, :), 1, 2 * N), 'uint16'), 1, dims{:});
% Following version there's 6 ... |
1c710c0c2bc262961cd60403159f45f1b372eff130cbf6a306e0d4bf8e3f554b | MATLAB | 1,404 | 34 | % 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
% mo... |
f1e3a13a6c534e2ac296ba1332acb80ad88a47dff764c3c04504df41c209ce51 | MATLAB | 1,405 | 37 | function matches = findpixels(inpict,color,mode)
% FINDPIXELS(INPICT, COLOR, MODE)
% returns a logical map of all pixels in INPICT which match COLOR.
%
% INPICT is an RGB image of any standard image class
% if INPICT is multiframe, output will also be multiframe
% COLOR is a 3-element row vector
% M... |
5ceffc069f992d17737855dd920e8701f256a78eab2e570ae83b603da93a3b3c | MATLAB | 1,406 | 62 | function outpict = rgb2hsl(inpict)
% RGB2HSL(INPICT)
% performs an HSL conversion on an RGB image
%
% INPICT is an RGB image of any standard image class
%
% Note that when S=0, H is undefined. Output may contain NaNs.
% If you prefer to avoid these, fill them with your preferred value.
% Example:
% ... |
7de3e970812922a31a76aad036c8c3ae1a8d16465327dae6f2076a5154756cdf | MATLAB | 1,409 | 27 | function SDR = getSDR(PSD1, PSD2, freqs, freq_bins)
% calculates Spectral Dependency Ratio according to Shajarisales et
% al., 2015, and as in Ramirez-Villegas et al., 2020
% inputs: - PSD1 & 2: two power spectral density
% - freqs : a frequency vector corresponding to PSD1 & 2.
% ... |
da0969838fe4f115d2901212b3685e49aa06d3dfa9d35e1962da232d1818e603 | MATLAB | 1,409 | 84 | clc; clf; clear variables
% this script does a bunch of blends and times them
% then it makes a bar chart showing relative timing
% HSV modes are typically fast, since it gets to make use of MATLAB builtins
% LCH modes are typically slowest, but the expense brings benefits
% requires R2016b or newer for local functio... |
a4d4747bf8b946cc8dcb3560d7580a9143062ba81561f77fec4ddf01389be624 | MATLAB | 1,411 | 28 | function [s_i,s_d,taps] = get_ams_nam(bs_to_tap_predictions)
%% Get ams, nams and tap locations for all participants
%
% **Usage:** [s_i,s_d,taps] = get_ams_nam(bs_to_tap_predictions)
%
% Input(s):
% - bs_to_tap_predictions = cell placeholder cell with the bs_to_tap data of all participants
%
% Output(s):
% - s_i =... |
aa15943f4a883b29f3c19629f36a37b60b66c85b3614eab08835000e409661a7 | MATLAB | 1,412 | 45 | function out=pkfndW(im,th,sz)
% to detect the local maximum intenity in a particle image
% input , im : particle image
% th : threshold value for recognizing as particle.
% sz : minimum distance to neighbor particle ( if repeats the one
% with lower intenisty will not be detected.
% output... |
cda61db41ee68f35903e8dbe06d0194e92876bbd318b8f0fea3a848ee408704e | MATLAB | 1,412 | 51 | function [Delta490, DeltaFlour] = DeltaF(Ch490,Ch405,Smoothing_Value,varargin)
% Smooth and process 490 channel and control channel data for fiber
% photometry.
%Inputs:
% 1--Ch490-GCamp Channel
% 2--Ch405-isosbestic control channel
% 3--Start time- Set a specific sample to start at
% 4--End time-specify a sp... |
432f1659b8481dee973d26fb7ac252911e0eaf969cbfaef90507767896fee1d1 | MATLAB | 1,415 | 38 | %
% 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... |
11158bed62379b5846efe0e5e972318aabfbfd2f4b5f2a98d52cea637208c6a0 | MATLAB | 1,416 | 28 | function nspx = mnspx(spxtimes,trigtimes,pre,post)
% nspx = mnspx(spxtimes,trigtimes,pre,post)
% function simply returns the distribution of spike counts within a specific interval relative to a trigger
% IMPORTANT: all timestamp inputs (spxtimes, trigtimes) must be seconds and will be converted to ms in the script!
%
... |
34467565346ec549b6e867a1c57e7a750602c9580a1cb941800c489febbc6bae | MATLAB | 1,418 | 30 | %% Demo 12 - Multiple dependent variables in one call
% Research questions often span several outcomes at once; kbstat can run the whole
% pipeline for each in a single call. Shown on the iris dataset (R base; Fisher
% 1936): the four flower measurements of 150 plants, with setosa excluded so only
% versicolor and virg... |
423ff83fe94b1971b3d0d5fad0df4807426f325f2d2ca4a11d19ba0bfab1ca9c | MATLAB | 1,418 | 47 | function [ancova, indx] = linear_model(EEG_epoch,EEG_data, participant, indx, all_data, options)
%% Run GLM
%
% **Usage:** [model] = linear_model(all_eeg,epoch_window)
%
% Input(s):
% - all_eeg = all EEG structs
% - epoch_window = epoch window
%
% Output(s):
% - model = LIMO model
%
ancova = {};
if options.type_... |
1c219d0dfbbca5534c0de88b24fe2ba81471b71b9e4f2f6955b462560371e5dc | MATLAB | 1,419 | 51 | %% main script to measure how many cells were excluded or labelled as threshold needed
rootdir(1) = "F:\Included miniscope Mice\";
folders(:,1) = ["\M119\TrainingD11\" "\M120\GroupingD6\" "M319\TrainingD7\" "M292\GroupingD3\" "M210\TrainingD17\"];
rootdir(2) = "D:\Grouping First\";
folders(:,2) = ["\M231\Group... |
1521a14730a840cbddd78ab120bc8d415e419e964ade5f52ad2f16fb5b3b7e26 | MATLAB | 1,420 | 41 | function [h,p,X2] = chi2cont(x,varargin)
% chi2cont chi-square test of contingency table
% h = chi2cont(x) performs a chi-square test on the data in the
% m-by-n contingency table x. The null hypothesis is that there is no difference
% in the row variable distribution ('outcomes') between the columns
% ('treat... |
3a589d9e3be6170da6dd90c36277207e908ab244e8cb7036ee00f8a2e7a5d828 | MATLAB | 1,421 | 52 | function r=nt_sns0(c,nneighbors,skip,wc)
% r=nt_sns0(c,nneigbors,skip,wc) - sensor noise suppression
%
% r: denoising matrix
%
% c: full covariance of data to denoise
% nneighbors: number of channels to use in projection
% skip: number of neighbors to skip [default: 0]
% wc: weighted covariance
%
%
n=size... |
f52fe6c39141b88288805585346e443a0d436018c537c853f6f97374ec3b017e | MATLAB | 1,422 | 47 | clear, clc;
outputFolder = fullfile(pwd,'prt');
%% PRT Parameters
PRTParameters = struct();
PRTParameters.FileVersion = 2;
PRTParameters.Resolution = 'Volumes';
PRTParameters.ExperimentName = 'MusicNF_Localizer';
PRTParameters.BackgroundColor = [0 0 0];
PRTParameters.TextColor = [255 255 255];
PRTParameters.TimeCour... |
72e63b5db3dd3da63987a50711066cda94d61217f83ce27465c0578e9c216b4b | MATLAB | 1,424 | 42 | function [ITI_jit, delay, trial_start, checksum1, checksum2, checksum3] = StimulusTimingvWMfMRI(TR, n_trials)
%% jitter = TR * (1/16);
ITI = 6;
fixed_trial_durations = 0.5 + 0.1 + 1 + 1.7;
% = fixation + stimulus + mask + max_RT ==> 3.5
time_limit = 0;
count_runs =0;
trial_per_block = n_trial... |
e4dabcbb5017e7372f739ded45e2e55a9a02918e1e61a27dd686a4def5e58632 | MATLAB | 1,425 | 49 | function [B, R2, y_pred, y_fit, bint, R2_CI, r, p_value, R2_boot] = performRegression(X, y, n_boot)
% Perform robust regression (robustfit adds intercept internally)
[B, stats] = robustfit(X, y,"huber");
% Use a custom tuning constant (larger = more permissive)
% Predicted values
X_aug = [one... |
2521e29a868d2c9e5cc5f554a4a143b1059763caaae3fc8a05e9320de0fe2ff8 | MATLAB | 1,426 | 31 | function output = cpm_grid_samsrf(freeparams, fixedparams, data)
% Creating a grid to precompute responses for retinotopy example. Essentially,
% it is a look up function.
% ---------------------------------------------------------------------
% Copyright (C) 2024 Simon R. Steinkamp
% This program i... |
97770f5b635a54ee1933f274eff820e021218ecb989474d4aec0423d28417cb6 | MATLAB | 1,428 | 42 | % Concatenates inputs along dimension dim, padding input arrays if necessary to match the largest size
function Y = catpad(dim, padValue, varargin)
%% Special case with no inputs
if numel(varargin) < 1
nil = [ones(1,dim-1), 0, 1];
Y = zeros(nil);
return;
end
... |
a8d3f85fb7e30e140db37011d24e4bd89aba095350c06df78f94449cc1c61098 | MATLAB | 1,428 | 56 | function I = gccmi_ccc(x, y, z)
% GCCMI_CCC Gaussian-Copula CMI between three continuous variables.
% I = gccmi_ccc(x,y,z) returns the CMI between two (possibly multidimensional)
% continuous variables, x and y, conditioned on a third, z, estimated via a
% Gaussian copula.
% If x and/or y are multivariate rows... |
2adfa5961abd5439e5e70a986379fa2f98fe83ec8cab95047354966c5b988673 | MATLAB | 1,432 | 56 | classdef Image
properties (Access = public, Hidden, Constant)
% Image constants
USHORT = uint16(1);
SHORT = uint16(2);
UINT = uint16(3);
INT = uint16(4);
FLOAT = uint16(5);
DOUBLE = uint16(6);
CXFLOAT = uint... |
04643fe0f7737018215a90f8c2c14ea7abf4a8585b770112278b0abfe2d2b8cd | MATLAB | 1,433 | 46 | clear, clc;
outputFolder = fullfile(pwd,'prt');
%% PRT Parameters
PRTParameters = struct();
PRTParameters.FileVersion = 2;
PRTParameters.Resolution = 'Volumes';
PRTParameters.ExperimentName = 'MusicNF_Localizer';
PRTParameters.BackgroundColor = [0 0 0];
PRTParameters.TextColor = [255 255 255];
PRTParameters.TimeCour... |
2b2d2ad66191604d93edb98e98df0ca7df86c491f83e1d068dfe1f1c84a51c3c | MATLAB | 1,433 | 43 | function image_array = read_image_array(socket)
image_array = gadgetron.types.ImageArray( ...
read_data(socket), ...
read_headers(socket), ...
read_meta_container(socket), ...
read_optional_waveforms(socket), ...
read_optional_acq_headers(socket) ...
);
end
funct... |
2c31009a9aca718a0d00c187729b661468776f4caa9d498eb4c49fff47601d9d | MATLAB | 1,433 | 36 | function rebinned = rebin(data, grouping, dimensions, aggregateFcn, varargin)
if nargin < 3 || isempty(dimensions)
[~,dimensions] = max(size(data));
end
if nargin < 4 || isempty(aggregateFcn)
aggregateFcn = @mean;
end
for dim = dimensions
original = size(data... |
b06db2c14464bea7b7875a552f535818a5c9396f3f7b4b2c6caa294deb919fcd | MATLAB | 1,435 | 48 | %
% [dataSmL, dataSmR] = laplaceBeltramiSmoothFMRI(dataL, dataR, LBOL, LBOR, sigmaLB)
%
% Description:
% Laplace Beltrami filtering for fMRI data
%
% Input:
% dataL - data to be smoothed on left hemisphere
% dataR - data to be smoothed on right hemisphere
% LBOL - Laplace Beltrami operator structure o... |
2db0c67b0c9378c1c070aeba128af82c3ec146fd5e547363814cddedbaeb8fa1 | MATLAB | 1,441 | 48 | function [ind,inbound]=getImLocalWindowInd_v3msk(xy,imsz,wndra,msk)
% convert the locations in images to indice matrice of regional windows.
% Input : xy; n by 2 vectors of centroid location
% imsz: 1 by 2 vector represent image size (i.e. =size(image))
% wndra: local window size (in radius)
% ... |
7aa37791b842ce385378620255ad8b0e211562cb82d154b0dafa6d83fbff868d | MATLAB | 1,442 | 53 | function m = CBIG_nanstd(x, norm, dim)
% m = CBIG_nanstd(x, norm, dim)
%
% Compute the std values of a matrix/vector excluding NaN entries.
% It has the same functionality as nanstd.m, but avoid to use statistics
% toolbox.
%
% - Inputs
% x : the data matrix/vector you want to compute the mean.
% norm: t... |
aaaedaf7f07eef3283e9fc85405ab777cb6cfaa5df9306559aefe4374262a089 | MATLAB | 1,443 | 51 | function outpict = mixchannels(inpict,A,normalize)
% OUTPICT = MIXCHANNELS(INPICT,MAT,{NORMALIZE})
% Mix the color channels of an image. This is equivalent to
% the GIMP plugin of the same name.
%
% INPICT is an RGB/RGBA image of any standard image class.
% Multiframe images are not supported. Alpha content ... |
140d3de99184261024c51143df5ca2b57297b42157fc819e240fede71e820eb5 | MATLAB | 1,444 | 51 | function outpict = hwb2rgb(inpict,varargin)
% HWB2RGB(INPICT,{MODE})
% Convert a HWB (Hue, Whiteness, Blackness) image to RGB
% This is a variant of HSV proposed by Alvy Ray Smith (1996)
% http://alvyray.com/Papers/CG/HWB_JGTv208.pdf
%
% INPICT is an HWB image of any standard image class
% The expec... |
4a7e6af2133bfafe9c1e2a5996b46f34384f588454a7cd2d1460c00d8526cfb2 | MATLAB | 1,444 | 41 | function result = getPNStdevBhandawat(PNs)
% for a numPNs x numOdors matrix, returns the estimated
% standard deviation for each response, based on Bhandawat et
% al 2007 Fig 1e.
numPNs = size(PNs,1);
numOdors = size(PNs,2);
result = z... |
333a45563b87dabdd80ea4a230fd9dee9421f5188f1647d11ae69646b1f37b77 | MATLAB | 1,445 | 74 | function y = impow(x,p,n)
% OUTPICT = IMPOW(INPICT,P,{N})
% simple gamma/power function replacement for use on unit-scale data.
% conditionally uses various methods to improve speed, including:
% bypass for null parameter
% fast path for sqrt(), integer powers
% lookup table interpolation for large arrays
% this ... |
5df23c67e022e8fe234a5ae16e06f1654083bc968a96de6e6755c59792558d22 | MATLAB | 1,445 | 50 | % this script reads the nifti images for correction and feed them to the batch job of mc_job.m
% parameters for motion correction and estimation are adjusted in mc_job.m
clear;
close all;
batchDir='/media/yuhui/LCT/Batch'; % where the mc_job.m is located
subjDir='/media/yuhui/LCT/subj_folder/';
folderList={'mt.sft' 'b... |
e00d35fb65c69a616d57a74c6607d4dd71ba0093e94d1fe21f93c423d700764f | MATLAB | 1,447 | 50 | % FAST1DSLOPEFIT Analytical solution of a 1st-order linear model y ~ intercept + slope * x.
%
% Inputs
% ========
% y : dependent variable, modeled to have a linear relationship to x
% x : independent variable
% weight : optional weight per data point
%
% Outp... |
bc8ce426f551029dff5f02b2d93a578a37db25fb0da3f4afdc12f19450375170 | MATLAB | 1,449 | 39 | function [dat_micro_clean,dat_macro_clean,c] = removeartefacts_corr(cfg,dat_micro, dat_macro)
chanindx = 0;
for ichan = 1 : size(dat_micro.label,1)
if strcmp(cfg.channel,dat_micro.label{ichan})
chanindx = ichan;
end
end
if chanindx == 0
fprintf('Can not find channel %s! \n',cfg.channel);
end
datrms... |
45d292d8026ff87caee5bf44c597042baf1e25feb007ddd8366d67ae9d0ebc2c | MATLAB | 1,452 | 59 | %% function to plot random examples of tuning curves
close all
binCenter = deg2rad(-157.5:45:157.5);
k = 10;
y = randsample(length(All_d.TunedCurves(:,1)),k);
figure
t= tiledlayout("flow");
for j = 1:k
i = y(j);
%i = j;
ctxt = find(All_d.TunedCurves(i,:) == 1);
curve = All_d.Curves(i,:,ct... |
cd6e3ceed94a1c3def164ac1c763e5f21981ca9e09ccaa6b3c808c32367db74c | MATLAB | 1,452 | 41 | %% function to get heading-direction cells and create table
function HD_table = GetHDCells(RV,RVL_distribution_events,RVL_distribution_HDir, CaMatrix, cellID, VectorRemap, Pearsons_stability, thresh)
IsActive = sum(CaMatrix, 2) > thresh.event;
IsSignificant = TestSignificantRV(RVL_distribution_events, RV, ... |
0d8dd691549c48d58154995ef5751016d963339b3b3a58b18105b6ae401b8235 | MATLAB | 1,453 | 46 | function [Phone, Transitions, idx] = get_phone_data(EEG, indices)
%% Get smartphone data based on different alignment rules
%
% **Usage:** [Phone, Transitions, idx] = get_phone_data(EEG, indices)
%
% Input(s):
% - EEG = EEG data from one participant
% - indices =
% - If 0 use uncorrected phone indices
% ... |
003d7ddd6fb95cea37ccfed90b24784f244b4a7f9b51a484a2823c09c05403e6 | MATLAB | 1,455 | 39 | %
%putRawEV_verify
%
%reads an event file, and write its back out to verify content is written
%correctly.
%
%urut/Dec15
%% read an event file
filenameIn='/home/urut/data/p27CS_011713/Events.nev';
% FieldSelectionFlags(1): Timestamps
% FieldSelectionFlags(2): Event I... |
3e1c93c47dbc49ffd209eb65bd02be10c2005957f2832627e9f74465aab0805f | MATLAB | 1,455 | 29 | %% Demo 9 - Partial interaction (test one interaction, not all)
% With three or more factors you often want to test one specific interaction
% without assuming the others - a partial interaction. Shown on the npk dataset
% (R base; Venables & Ripley 2002): pea yield under three binary treatments -
% nitrogen (N), phosp... |
60e60429c6a75a164aac5098cf72d3653a3756cffb3d23532041f42fc922701f | MATLAB | 1,457 | 51 | function [output_val] = plhg(input_data, fs)
% On-Demand Seizures Facilitate Rapid Screening of Therapeutics for Epilepsy
% Authors: Yuzhang Chen, Brian Litt, Flavia Vitale, Hajime Takano
% DOI: https://doi.org/10.7554/eLife.101859
% Calculate Phase locked High Gamma.
% Input Variables
% input_data - data for calcul... |
c63fb8b2a84e239f0f174f567355bbb86a7de3544d0ff6f8bbe43866392e15f3 | MATLAB | 1,458 | 38 |
% 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('/big_disk/ajoshi/coding_ground/bfp/'));
g1=ft_read_cifti('/big_disk/ajoshi/sample_from_andrew/100307/rfMRI_1_LR/rfMRI_1_LR_LNLM_p72.dtseries.nii');
g2=ft_read_ci... |
5a116f31ce6045f7cfb4e0898976941340e4be28f336706216c2503ff0814e29 | MATLAB | 1,459 | 46 | %% Clear workspace and close all figures
clear all
close all
%% Load data
inData = xlsread('hankou/luoshan.xlsx');
%% VMD decomposition settings
alpha = 2153/2146; % Balance parameter for data-fidelity constraint (penalty factor)
tau = 0; % Time-step of the dual ascent (tau = 0... |
8d294edb7ad52bd45bf2c31bdf75cca3ffce235703fbc8f4067bf6fbaef2f2bd | MATLAB | 1,460 | 41 | function [edge] = findBinEdge(x, xCenters, direction)
% FINDBINEDGE Returns the lower or upper edge of the bin in xCenters in
% which the given x coordinate falls.
%
% This function always succeeds, returning a guesstimated edge if
% necessary.
direction = sign(direction);
% If th... |
3536811e929a6795aa1e567eba990d5e6aa23d2a545311c3f50d8403ad122781 | MATLAB | 1,465 | 44 | function [EEG] = add_events(EEG,data,num,type)
%% Adds identified events to EEG.event and EEG.urevent
% In this case the events are predicted peak locations or tap locations
%
% **Usage:** [EEG] = add_events(EEG,data,num,type)
%
%
% Input(s):
% - EEG = EEG struct
% - data = the event indices
% - num = number of e... |
6a5c36d067427d16d90535851ef4911ff1b07c8be9e428cfbadb0833c25a1d4a | MATLAB | 1,465 | 37 | load('Masks.mat');
figure(1),
set(gcf,'unit','centimeters','position',[10 10 16 5.12]);
set(gcf,'ToolBar','none','ReSize','off');
set(gcf,'color','w');
tiledlayout(1,3,"TileSpacing","compact",'Padding',"compact");
nexttile(2);
imagesc(Diff_Projection);colormap gray;axis off;hold on;
Soma_Num=max(Soma_Location1(... |
044face12138ba65e9de743e20d8c3b37c00bd0afdc00255d25007951bec3ba2 | MATLAB | 1,469 | 38 | function timeLFP(suffix)
% TIME LFP - Write out raw lfp and spike data for each trial.
%
% Read parameters file.
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
% Load lfp ... |
fc11fef43594ca21474e1ee4ec30aea15969d0a8c126bfbb889b3f057aa56297 | MATLAB | 1,470 | 62 | ext_path = pwd;
ext_default_path = fullfile(ext_path, 'default_packages');
if(strcmp(mexext, 'mexmaci64'))
path_to_add = fullfile(ext_default_path, 'matlab_bgl_mac64');
else
path_to_add = fullfile(ext_default_path, 'matlab_bgl');
end
if(exist(path_to_add, 'dir'))
addpath(path_to_add);
end
path_to_add = fullfile... |
f450b6b21e1c050e46a100d58d26adfe8cc866491598683423d1d330e731f33a | MATLAB | 1,471 | 56 | function varargout = deinterleave(inpict,dim,varargin)
% [A B C ... ]=DEINTERLEAVE(INPICT,DIM,{WIDTH})
% Disassemble an image created by interleaving two or more images.
%
% INPICT is an image or array of any class
% May have up to 4 dimensions, but size along DIM must be divisible by
% the number of i... |
5337cd5ff1a56c58a1dafa6a16ead02bca004c90e4299a232194dbb30500076c | MATLAB | 1,473 | 56 | % Author: Woojae Jeong
%% ASR routine
% EEG file
fileName = dir([sDirectory,'/*.vhdr']);
% Load data
dat = pop_loadbv(sDirectory, fileName.name, [], [1:64]);
% Clean_rawdata: automated artifact detection
EEG = pop_clean_rawdata(dat, 'FlatlineCriterion',4,'ChannelCriterion',0.8,'LineNoiseCriterion','off','Highpass',... |
c5f2137e2929cc01b8d391869b9fe5bfcd059b93c11f18debcde61a41da4d6d4 | MATLAB | 1,473 | 32 | %% function to get splitted heading tuning curve
function [Pearsons_stability, Pearsons, HDir_Rate_splitted, HDirOccupancy_splitted] = GetSplittedTuningCurve(EventTime, framesSplitted, binned_HDir, Nbins, framerate, CaMatrix, binCenter,edges)
HDir_Rate_splitted = cell(4,1);
for s =1:4 % loop on splitted dataset: 1st... |
5365d98ce121c4ab17f65a51af74c6584fc02d6b04933d7bb95269a05a6e56e0 | MATLAB | 1,474 | 70 | function i=nt_idx(x,scale,i)
%i=nt_idx(x,scale,i) - index a data matrix
%
% i: index structure
%
% x: data
% scale: scale
% i: already populated structure
%
% The 'i' argument can be used to control which statistics are calculated, e.g.
% i.min=[]; i.max=[]; i=nt_idx(x,n,i); % creates min and max indexes
%
% No... |
745bc89b7e8147bb07624322615bc4eb67215cf2512c657b1ad9a9151c8aa43a | MATLAB | 1,474 | 42 | function newPhi = CBIG_AuthorTopic_NormalizePhi(phi, params)
% newPhi = CBIG_AuthorTopic_NormalizePhi(phi, params)
%
% Normalize the parameters phi of the variational distribution.
%
% Input:
% - phi : current estimate of the parameters of the variational
% distribution.
% - params: struct containing par... |
5e97fd2cfe6ccaaef25691d657a8f79d7b846f71486d5a549934745dfb673cf7 | MATLAB | 1,478 | 44 | load(".../Results/AlphaExt.mat");
load(".../Results/AlphaMST.mat");
load('.../Results/MainAnalysis.mat');
%%
% Within significant cycles set, test whether the alpha_MST and the
% alpha_Extra are also significantly different between groups
demographics = readtable('.../DemTable.xlsx');
HC_ind = (demographics.Diag == 2... |
b4dcd7009cfb9cc75626c1e743748fb25220c6152de8ca3bd053edeeeff52eac | MATLAB | 1,480 | 68 | function [array_equal] = compare_cell_arrays(array1,array2)
if istable(array1)
array1 = table2array(array1);
end
if istable(array2)
array2 = table2array(array2);
end
[m1,n1] = size(array1);
[m2,n2] = size(array2);
if m1 == m2 % Check if both arrays have the same number of rows
if n1 > 1 ... |
709d32672b3859ebba2b5806bf7c0f4bfd59187a94c671adc235c1811bbacd4f | MATLAB | 1,487 | 52 | function [vol_interp, file_out] = interp3_nii(datafile, target_file, file_out, method)
% Wrapper around myreslice_nii to interpolates nifti file DATAFILE to the image-matrix space of
% TARGET_FILE. It uses information from nifti header. No successive interpolation is applied.
% Usage:
% [vol_interp, file_out] = int... |
ca05aaa33bf8b0645db43d6235c00b0353d91b11676fbee2f90fc717776e07c0 | MATLAB | 1,487 | 60 | function [dt, X, Y, label] = plot_hyp_lines(h)
% plot hypnogram lines
X = [];
Y = [];
label = [];
for im = 1 : height(h)
X = [X, h.starttime(im), h.endtime(im)];
% height in hypnogram is based on order of cfg.hyp.contains
switch cell2mat(h.hyplabel(im))
case 'NO_SCORE'
y = 5;
... |
1f99586466b858b9318e31d234df84572329bebcf9711d0a2c885c520f284943 | MATLAB | 1,488 | 56 | function varargout = dealternate(inpict,dim,varargin)
% [A B C ... ]=DEALTERNATE(INPICT,DIM,{WIDTH})
% Disassemble an image created by interleaving two or more images using
% alternate().
%
% INPICT is an image or array of any class
% DIM specifies the dimension along which the array is to be divided
% WID... |
715c3db4710bd779e759708e7582688a433248c1fd1de02f0bb3d171d905d0b9 | MATLAB | 1,493 | 47 | % 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 ... |
dac1beed7bbe201e7842b7e9f015d043f78d5ea0b46e6cd5b4a42442d6debb0b | MATLAB | 1,493 | 31 |
% 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('../'));
sl=readdfs('/home/ajoshi/coding_ground/bfp/supp_data/bci32kleft.dfs');
sl=smooth_cortex_fast(sl,.1... |
1d41345809a82b7de1147286e463d6cdae23c2a9a59d010fab7f6161c6cab174 | MATLAB | 1,498 | 50 | %% Alamar Blue SAP experiment
%%
clc;
close all;
clear all;
%% Analysis folder
analysis_folder = '/Users/sofiaperessotti/Library/CloudStorage/OneDrive-ImperialCollegeLondon/PhD_project/Cell_Experiments/SAP_stim/Alamar Blue';
addpath(genpath(analysis_folder));
matlab_folder = '/Users/sofiaperessotti/Library/CloudStor... |
25cf1e712974a45868011f0e665e664feb860a885fe078a8520d6580bcf07eb6 | MATLAB | 1,498 | 38 | function contrastNifti = contrastMap2Nii(map,fileName,functionalNifti)
%
% Conversion of a contrast map stored as an array to a nifti structure
%
% contrastNifti = contrastMap2Nii(map,fileName,functionalNifti)
%
% INPUTS
% 1) map: contrast map to be stored as a nifti, for instance from hidden
% inplane hi.map{... |
33f5159c780058cc26f1c5b2acb0cc7e575915996c5d7d1bc51a5f4a8ed3bed8 | MATLAB | 1,499 | 44 | function [fmri, vol, vol_size] = CBIG_SPGrad_read_fmri(fmri_name)
% [fmri, vol, vol_size] = CBIG_SPGrad_read_fmri(fmri_name)
% Given the name of functional MRI file (fmri_name), this function read in
% the fmri structure and the content of signals (vol).
%
% Input:
% - fmri_name:
% The full path of input fi... |
eb83eee491541640b79cf6a83487a395084502a27c4492394ac9835980562d8c | MATLAB | 1,503 | 41 | function writeProbeFile(nb_channels, fname)
% WRITEPROBEFILE writes a SpykingCircus probe file
% use as
% writeProbeFile(nb_channels, fname)
% 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... |
39f66e3bf385b063e479db7a7a9859a755da8e258a539c94c5259f4a2c15e21c | MATLAB | 1,504 | 49 | function [answer, anstime]=get_mouse(wait)
%[answer, anstime]=get_mouse(boxrects, wait)
%
%Checks if an option box has been clicked and returns the answer and the time
%Or waits for an option box to be clicked.
%
%INPUTS
%window window pointer to main display
%boxrects matrix of rects for each option bo... |
7456e8f19eb79918f63fa353ffb89b0818111ed1c1703d112e22477c63237769 | MATLAB | 1,505 | 40 | % main_import_processed_data
%% Import processed data
load('structureInfoTableOh2014Sorted.mat')
load('connectionMatrixOhP005_sorted.mat')
load("regionDistanceMatrixOh_sorted.mat")
% data for using specific genes (from Developing Mouse Brain)
load('geneInfoListTable_intersectP28E115.mat')
load('geneInfo_intersectDev... |
aee6bfb58f81b148733bb153640bd5326e7700b8b20996aa7bd1a9be64bd86e6 | MATLAB | 1,506 | 46 | %% Modified Gram-Schmidt procedure for numerical stability (see e.g. https://www.math.uci.edu/~ttrogdon/105A/html/Lecture23.html)
function Q = gramSchmidt(A, n, pairSim)
szA = size(A);
A = remould(A,2); % orthogonalize columns of A
%% In case of an explicit dimensionality specifi... |
cf8e8d550db4e2a154e1b89678b37ea3d16a3316c04b3a91bdaa16e3d2592155 | MATLAB | 1,507 | 53 | function inpict = fmedfilt(inpict,wsz,tol)
% OUTPICT = FMEDFILT(INPICT,{WSZ},{TOL})
% Apply simple fixed-window median noise removal filter. This is useful
% for removing impulse (salt & pepper) noise from an image.
%
% INPICT is an array of any standard image class. Multipage images
% are supported. Mult... |
6f72cb2a2d0619cc95d722503d964f1b32ed59eac18eed267f4e3ecbd86dc0db | MATLAB | 1,508 | 47 | function [mask, cluster_p, one_sample] = t_test_linear_mod(model, model_num, path)
% model num: 2 (model 1) or 3 (model 3)
load('expected_chanlocs.mat')
load('channeighbstructmat.mat')
cd(path)
%% LIMO Step 2
x = model{1,2}{1,1}.betas;
n_betas = size(x, 1);
epoch_size = size(x, 2);
% Dimensions: electrodes * frames ... |
08861aa7a679f4c5e7b6daa74989777e769628fe1c0aa9fddd740e3b7912738b | MATLAB | 1,510 | 54 | function [tot_pow,gamma_pow,low_pow, freq, PSD] = compute_power(signals, fs, f_range)
% signals: Matrix of input signals (each signal is a column)
% fs: Sampling frequency
% f_range: Frequency range for analysis
num_signals = size(signals, 2);
params.tapers=[3,5];
for i = 1:num_signals
... |
c1e5f6ede6fa74d53b33eaf21827c3a06f573d7d4c85587b337b2e2eee0b6fd2 | MATLAB | 1,510 | 45 | function [model_predictions] = predict_MA(BS,net)
% Prepare data for prediction and predict in batches
%
% **Usage:** [model_predictions] = predict_MA(BS,net)
%
% Input(s):
% - BS = preprocessed bendsensor data
% - net = keras imported network
% Output(s):
% - model_predictions = model output
%% prep... |
9b04c130109f25f5be8d4dabf7d46897e11acfb3bc4b89f66514d5120a870a89 | MATLAB | 1,513 | 45 | function [results_to_plot] = normalise_data(results, biom_1, biom_2,results_folder, cat_disp,normalise_to_ctrl_rep, normalise_to_ctrl, name, coloc)
if normalise_to_ctrl_rep
results_to_plot=[];
for i =1:(size(results,1)/3)
ctrl_mean = mean(results(i*3-2:i*3,4),'omitnan');
... |
3cba6f63c617e053e95f6b99ebe0c285aacd692f873ea4d8b1ad749ac9b8a8df | MATLAB | 1,514 | 44 | function evokedLFP(suffix)
% EVOKED LFP
% Output:
% Writes out evoked LFP.
%
% Import 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
% Load lfp data
[lf... |
6ff7b235964ec2d8d05605bfe7e3f5dbdaecb737d875abee9eb8deca439fb2e5 | MATLAB | 1,514 | 38 | %% Condensed format of numbers, nearest 1000 -> 1k, 1000000 -> 1M, etc. Non-numeric inputs will be included as prefix/postfix.
function name = num2scale(varargin)
%% Locate the numbers to convert
iNumber = find(cellfun(@isnumeric, varargin), 1);
if isempty(iNumber)
error('At least one of the inputs... |
5cd97b8d9e45b45447e13d9acb768b6e888dfcf7a265e99bd85f3537c60284a9 | MATLAB | 1,516 | 38 | function [Xcorr_surr99, Xcorr_surr1] = getXcorr_surrogates(spike_matrix, max_lag, jitter, nboots)
%% By Mattia 10.18
% computes surrogate (n=nboots) spike trains with the jittering method and the xcorr relative value
% inputs:
% - spike_matrix: neurons * spiketimes in ms
% - max_lag: in ms (20-30 ms is a meaningful ... |
36d5695e817c669f7b402420b9129385ed4ee21d0e9a54aac91330ada04ba525 | MATLAB | 1,517 | 67 | % bsearch(x,var)
% Written by Aroh Barjatya
% Binary search for values specified in vector 'var' within data vector 'x'
% The data has to be pre-sorted in ascending or decending order
% There is no way to predict how the function will behave if there
% are multiple numbers with same value.
% returns the index values o... |
eabe42b01a08ef3b129c9bc745241c154e4b8b71bc374a99adfb51b128d748e7 | MATLAB | 1,520 | 39 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Analysis script for Hypconn project %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Add correct paths
if isunix
restoredefaultpath % clean path to avoid overloading functions
addpath /network/lustre/iss01/charpier/analyses/stephen.whitmarsh/EpiCode/projects/hypconn... |
a01fb30f543e7d1e28439fad1e8cdf1789b3cd303766e447743add6ba3be3422 | MATLAB | 1,523 | 59 | function outpict = rbdetile(inpict,nblocks,varargin)
% OUTPICT = RBDETILE(INPICT,NBLOCKS,{BLOCKSIZE})
% Random blockwise detiling. Extract a number of randomly-positioned
% blocks of a specified geometry from an image.
%
% INPICT is an I/IA/RGB/RGBA/RGBAAA image of any standard image class
% NBLOCKS specifies... |
ed4ceb840e7a60e2da0e6bb41c7edc9f50b6396ea606f943cb7b718e293e5d25 | MATLAB | 1,526 | 51 | clc;clear all;close all;restoredefaultpath;
%addpath(genpath('/big_disk/ajoshi/coding_ground/bfp/supp_data'))
addpath(genpath('/home/ajoshi/Projects/bfp/src'));
% 1050345 rest 2
s = dlmread('/home/ajoshi/Downloads/sub_0903_finger_tapping_time_series.csv');
activation = s(:,2);
plot(activation)
gord = '/home/ajosh... |
43922ec5cba417c6e4ed17a3e5ed6f12a244d1470b315a261b06de2a31e95646 | MATLAB | 1,530 | 43 | %% CLEAR EVERYTHING
restoredefaultpath %Remove all extra paths
clear all; close all; clc; %Clear All
addpath('F:\MORALES_LAB\LH_VTA_PROJECT\MATLAB_SCRIPTS_AND_FUNCTIONS\FUNCTIONS') % Path with local functions
addpath('F:\BARKER_LAB\PHOTOMETRY_FUNCTIONS') % Path with local functions
%% GET PHOTOMETRY DATA
GroupF... |
a4893f9b7c347983b3da5f7b17e871cc6023274e1c0374c7239ac4a4261ef786 | MATLAB | 1,530 | 59 | %%%% create threshold and adjacency matrices
%%
%%%% CHANGE TO YOUR PATH
cd /your/path/here
individualClust = table2array(readtable('clusters_leave1out.txt', 'Delimiter', ' '));
%%
originalClust = individualClust(:,1); %%% first column is cluster labels
individualClust = individualClust(:,2:end); %%% ... |
8f43a228cb39e77083f56ab34b6f6346f5130f2a7fb62b302d1f4de0b84eae64 | MATLAB | 1,531 | 46 |
function generateGOrdSCT(subbasename, GOrdSurfIndFile)
% Tells the compiler that parallel processing is required
%#function gcp
NLevels=5;
GordSize=96854;
GOrdFile=[subbasename,'.SCT.GOrd.mat'];
%% process left hemisphere
sub_surf = [subbasename,'.left.mid.cortex.svreg.dfs'];
subdir = fileparts(subbasename);
atlas_s... |
67c9a562b2c47aa62b738c6f105e20b7dd69e98650a3956642d3b894256e0279 | MATLAB | 1,532 | 38 | classdef NullConnectomeGeneratorModel
% Generates randomized connectome matrices using a specified method
properties
OriginalConnectionMatrix ConnectionMatrix
CrossRegionInfo CrossRegionInformation
RandomizationMethod function_handle
UseBlockwise logical
Randomizer MajorR... |
9b47611a2723b3a33f3c392b123985ce13e5c3ebc3a58daeffe5dbea2e6c28d0 | MATLAB | 1,532 | 39 | function varargout = batchloader(path,imgnums,basename)
% BATCHLOADER(PATH, IMNUMBERS, BASENAME)
% [RGB ALPHA]=BATCHLOADER(PATH, IMNUMBERS, BASENAME)
% a convenience script for loading arbitrary subsets
% of files from a sequence of individual image files
% Assumes filenames formatted with a lead... |
ddfd6c7b42701e4d918af6cd0edb44b98bc79279600afea06f6054a7bbb95c46 | MATLAB | 1,537 | 49 | % LFP SINGLE TRIAL POWER
function powerTrialsLFP(suffix)
%
%
% Turn off warnings
%warning off all
% Import Parameters
Params = readParams(suffix);
% Parse relevant params
freqArray = Params.freqStart1:Params.freqStep1:Params.freqEnd1;
timeWindow = double(Params.time1);
timeStep = timeWindow/4;
e... |
eb1dc7a9a43ba2e59a6304e089e11b1e176d068f275eb4d9850f69deb4d44df5 | MATLAB | 1,539 | 64 | classdef LinkedList
properties (Access = private)
nxt;
elm;
end
methods (Access = public, Static)
function nil = empty()
nil = gadgetron.lib.Nil;
end
end
methods (Access = public)
function list = LinkedList(tail, elm)
... |
5feef01f87b19e343e974ec837347d608df17dc0c8b2dd9f194bef28913c4f14 | MATLAB | 1,543 | 45 | %putRawEV.m
%Demo file on how to write EV files
%
%exportMode: 1 all fields, 2 only timestamps and TTLs (usually only this is
%needed)
%
%urut/Dec15
function putRawEV( exportMode, filenameOut, Timestamps, TTLs, headerLine, EventIDs, Extras, EventStrings )
if exportMode==1
FieldSelection(1) = 1; %timestamps
Fie... |
3be71168a46eb2f718fd7a6f5abca454779c4503a865253a66d880ae8994b1e6 | MATLAB | 1,545 | 48 | function spectral_slope = compute_spectral_slope(signals, fs, f_range)
% signals: Matrix of input signals (each signal is a column)
% fs: Sampling frequency
% f_range: Frequency range for analysis
num_signals = size(signals, 2);
spectral_slope = zeros(1, num_signals);
params.tapers=[3,5];
... |
783798b211fd4ea546e22d6a2c7dde103a6f896f9cc61c97a70980ebc5e89056 | MATLAB | 1,547 | 60 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Short-Time Fourier Transform %
% with MATLAB Implementation %
% %
% Author: M.Sc. Eng. Hristo Zhivomirov 12/21/13 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
f83f2a0233e66101d79a587e31a1c3097e684480940239861fa616db63c47eb3 | MATLAB | 1,547 | 55 | %% Gergely Tarcsay, 2024 Ewell lab. Script to generate struct for individual mice to assess behavior for the lesion experiments.
%% Struct contains the followings: mouse ID, group, Sex, first day of retesting w/ lesion, eventFile and position data
rootdir = "H:\HPC lesion\";
lesion_struct = struct;
ID = ["M94", "M1... |
07d5ca000ee9820c2c433950dab925fada1f6398247ef28baa6fe6483b733a52 | MATLAB | 1,548 | 47 | function CBIG_Smooth4DVolume(input_file, output_file, mask_file, outside_mask_type, method, filter_size, arg)
% CBIG_Smooth4DVolume(input_file, output_file, mask_file, outside_mask_type, method, filter_size, arg)
% This function is used to smooth a 4D data with filter_size.
% outside_mask_type = SMOOTH => Everything o... |
998e1ac62a5c5ec9349baadb7f975e08bc36e615b4db56b29c90b765df4fea87 | MATLAB | 1,549 | 55 | classdef GeneInformation < handle
% GeneInformation
% Manages gene metadata including acronym, full name, and unique ID.
properties
GeneTable table % Table must include: acronym, name, id
end
methods
function obj = GeneInformation(tbl)
arguments
tbl ta... |
6d747292d7e2448ae16a06e995d2bee803533fbbf0939003fdf98944fb26ba03 | MATLAB | 1,551 | 37 | function P=ar1spectrum(ar1,period)
%% AR1 power spectrum.
%
% power=ar1spectrum(ar1,period)
%
%
% (c) Aslak Grinsted 2002-2014
%
% -------------------------------------------------------------------------
%The MIT License (MIT)
%
%Copyright (c) 2014 Aslak Grinsted
%
%Permission is hereby granted, free of charge, to a... |
854c6d9348fedd6c66fa9e6154a51393fda66b52e50f54c5470e626e7d79a0ad | MATLAB | 1,552 | 42 | %%
%
function [handle] = legendbar(colors, descriptions, name, width)
colors = reshape(colors, size(colors,1), 1, size(colors,2));
handle = image(colors);
origUnit = rset( gca, 'Units', 'pixels' );
pos = get(gca, 'Position');
if nargin < 4 || isempty(width)
width = min(3... |
98740ec040b0c2a902e780bf1216629831b12fa6c5987a4fce73a222c829af55 | MATLAB | 1,553 | 43 | %%
% Optimal number of rows and columns for a given figure aspect ratio.
function [numRows, numCols] = optimalGrid(numSubplots, varargin)
if nargin > 1 && ishandle(varargin{1})
position = get(varargin{1}, 'Position');
aspectRatio = position(3) / position(4);
elseif nargin > 1 && isnumeric(v... |
c1ce38975d9498acf146ca3802353bf9d8ccbaf9923570b652e755b4d629670d | MATLAB | 1,553 | 49 | function G = patbinchart(G,varargin)
% OUTPICT = PATBINCHART(PATGROUPS,{OPTIONS})
% Visualize the output of impatsort() by tiling all the patterns into a single
% large image. The members of each bin are tiled horizontally. The bins are tiled
% vertically. The patterns should range from dark on top to light... |
d3b109991f45f8f3a67a72b4895b54dcb30e97acee40c9098f0afd4aa994f62c | MATLAB | 1,553 | 60 | function addaxisset(yl2,axisnumber)
% addaxisset(new_ylim, axisnumber)
%
% new_ylim = two element vector with the new y-limits
% axisnumber = number of axis to be scaled (parent axis = 1)
%
% Example
% x = 0:10;
% plot(x,x)
% addaxis(x,x.^2,'-o');
% addaxisplot(x,x.^1.5,2,'-s','linewidth',2);
% 'p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.