sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d8c17dc5e63a06b1c268b0bbeb10329e10395a1b911fc9b3388690413f1ef4d1 | MATLAB | 2,906 | 136 | % this is called internally by crabsort.consolidate
% this reads .crabsort files and pulls out spikes from nerves
function data = readData(thisfile, options, data)
load([thisfile.folder filesep thisfile.name],'-mat','crabsort_obj')
if isempty(crabsort_obj.dt)
corelib.cprintf('red',['Error when trying to read this... |
3844d5994d52989e1aae0f94bdec444b9a0f5863958b14e78dbee2c99c6d1aea | MATLAB | 2,907 | 133 |
% Single trial spectrograms: Load: group_TF_wholeTrial.mat
%% inputs
expt = 'TANoise'; % TANoise
user = 'kantian'; % for file path to save figures ß
saveFigs = 1; % saves .svg to current directory
plotSubjects = 0;
%% setup
[sessionNames,subjectNames,ITPCsubject,ITPCsession] = meg_sessions(expt);
targets = {'T1'... |
7c8a84df22c2ab72b9c8f0bcd407122700a112451921720fe4f95e06a0f80c75 | MATLAB | 2,907 | 90 | function E = rmse(F,A,varargin)
%RMSE Root-mean-square error.
% E = RMSE(F,A) computes the root-mean-square error between arrays F and
% A. F is the forecast (predicted) data, and A is the actual (observed)
% data. F and A must be double or single arrays.
%
% E = RMSE(F,A,"all") computes the root-mean-square er... |
aeb2e04cdd98032ba8e804d56db5e8445de8ac4c1bb2b23c21d9dc65cbef88ba | MATLAB | 2,907 | 94 | function [xopt, fval, samples, energies, acceptanceRate, temp] = simAnneal(target, x0, opts)
% Simulated annealing algorithm to find the global *minimum* of a function
%
% INPUTS (similar to fminunc)
% target is the energy function (*negative* unnormalized log posterior)
% called as 'E = target(x)'
% x0 is a 1xd vect... |
b1f462ba09a0018921a396c3e64faf15d53a34b072ea806e2b95e621e7a168ff | MATLAB | 2,907 | 89 | function dstackdr = cylinderRadialD(stack, sigma, order, varargin)
% Gaussian derivative with respect to cylindrical radial coordinate
%
% cylinderRadialD(stack, sigma, order)
% cylinderRadialD(stack, sigma, order, zind)
% cylinderRadialD(stack, sigma, order, zind, center)
%
% zind is the di... |
587984252b5b57cb6f4217acbf42861407e59836d0d3f6e2faaa0bcff3817fa3 | MATLAB | 2,909 | 96 | % formatEncoderData.m
% Sarah West
% 10/11/21
% Formats the encoder data so the time vector is regularized.
function [parameters] = formatEncoderData(parameters)
% Announce what stack you're on.
message = ['Formatting '];
for dispi = 1:numel(parameters.values)/2
message = [message ', ' parame... |
ffdddf23f600c7ee5ddef73866ed545562dbc0660d53bcf12a386295f6fd7916 | MATLAB | 2,909 | 85 | function varargout = getPrmDflt( prm, dfs, checkExtra )
% Helper to set default values (if not already set) of parameter struct.
%
% Takes input parameters and a list of 'name'/default pairs, and for each
% 'name' for which prm has no value (prm.(name) is not a field or 'name'
% does not appear in prm list), getPrmDflt... |
3affe3edb60451e5190cabd21f1033c65132f491bbd82bdb95ede6f91a932eaf | MATLAB | 2,911 | 87 | function plotstrain(s, xbar, ybar, options)
% plot a strain structure
%
% plotstrain(s, xbar, ybar, options)
%
% s is the strain structure
% with fields MajorAxisLength, MinorAxisLength, Rotation
% xbar, ybar are the coordinates of the position to draw the straincross
% options: 'Rotati... |
b4be682ef7ab00efd836d073728f90d5ccfb0d6f5d8e348cd5b432f258c49d13 | MATLAB | 2,913 | 135 | function fixedtrx2ann(trx,oldannname,newannname)
% open the annotation file for reading and writing
fin = fopen(oldannname,'rb');
if exist(newannname,'file'),
b = questdlg(sprintf('File %s exists. Overwrite?',newannname));
if ~strcmpi(b,'yes'),
return;
end
end
fout = fopen(newannname,'wb');
% find the end o... |
692dd18704a67ba8be90972f054c6204a8a87c6b21d8408e7bb9929782d70583 | MATLAB | 2,915 | 87 | function addClass(varargin)
% Create a class template from its possibly abstract superclasses
%
% INPUTS:
%
% '-className'
% '-superClasses'
% '-objName'
% '-allowOverwrite
% '-saveDir'
% This file is from pmtk3.googlecode.com
%
% EXAMPLE:
%
% createClass('MvnDist',fullfile(PMTKroot(),'models'),'MultivarDist','mo... |
b60a83beab3e2cd4049a3ea09b1eee827bfbd68da6ba67dbc8f53546dd367448 | MATLAB | 2,916 | 84 | function [varargout] = startsWith(varargin)
% STARTSWITH True if text starts with pattern.
% TF = startsWith(S,PATTERN) returns true if any element of string array S
% starts with PATTERN. TF is the same size as S.
%
% This is a compatibility function that should only be added to the path on
% MATLAB versions prio... |
694c2a908db0d6dc3eb583ad44d46c77a3eae9edd0947d4e5803e94d63fb58a2 | MATLAB | 2,918 | 79 | function bda_formatFigure( fh, lineWidth, fontSize, gridstate )
% BDA_FORMATFIGURE Function to modify figure appearence.
%
%
% ---
% Copyright (C) 2020 University Zurich, Sepp Kollmorgen
%
% Reference (please cite):
% Kollmorgen, S., Hahnloser, R.H.R. & Mante, V. Nearest neighbour... |
6dbfdc493af59818f706dccf749a2ee5c5474769c80b99a2cd1b040ee0f11bea | MATLAB | 2,918 | 85 | function all_PSD=parallel_extract_PSD(mode)
%performs extract_PSD over multiple channels in parallel
%total number of channels per core is equal to
%ceil(available channels/number of cores)
%channel numbers greater than the total number of channels (created by using the ceiling function)
%are given a value of NaN and ... |
e65b82af3b81dc3658e9d82bf089848f7640abd24c30afcbb202365241ff93aa | MATLAB | 2,918 | 91 | %resnet 101for feature extraction 26/3/2020
%acuracy data set of 10 printer
clc
close all
clear
%D:\Doaa_PHD\PHD2020\DataSets\jaffedbase,,,,,,D:\Fer,,,, D:\Doaa_PHD\PHD2020\DataSets\ck\CK48
%images=testreaddata();
images=imageDatastore('D:\Doaa_PHD\PHD2020\2nd paper\code\custom cnn48\KDEF','IncludeSubfolder... |
133999fa2d9e5124b49194eb1d4f9b72e3772b338e5288c19d6461a76e092f72 | MATLAB | 2,920 | 89 | %% bookendSignal
% (Non-normalized Nomeclature). Method to extend a signal by a given
% distance, using a reflected portion of the data.
%
% Used to extend signal without overly affecting the long-point mAVG
% filters.
%
% sig = [N_CHANNNELS x N_OBSERVATIONS] array to filter.
% N_POINTS = length of extension.
% TYP... |
293dcfa54e12f5f3038f7e35da6d35b4158edc9d5c1bb4167321a9c04a24017e | MATLAB | 2,920 | 92 | function EEG = FlagRTByTriggers(EEG, varargin)
% function EEG = FlagRTByTriggers(result, varargin)
% flag trials where RT (from triggers) is outside given limits. Will find
% RT in trial, even if outside the epoch
%
% Inputs:
% EEG = eeglab structure
% varargin: param-values of things to filter by:
% 'rtLimi... |
a5edb7a94e52314e2e0c5926a509093363f87335ad776f7575960ce44d82598b | MATLAB | 2,921 | 98 | function [hdr] = ft_fetch_header(data)
% FT_FETCH_HEADER mimics the behaviour of FT_READ_HEADER, but for a FieldTrip
% raw data structure instead of a file on disk.
%
% Use as
% hdr = ft_fetch_header(data)
%
% See also FT_READ_HEADER, FT_FETCH_DATA, FT_FETCH_EVENT
% Copyright (C) 2008, Esther Meeuwissen
%
% This fi... |
c330d71de1deaa9c9579b3e4066c42971b57e32056ba0a9b3102d23a66b8e3b8 | MATLAB | 2,922 | 95 | function model = dgmCreateTopo(G, varargin)
%% Create a directed graphical model , where nodes may not be topologically ordered
% The CPDs will be created by calling dgmTrainTopo
% This is a 'bare bones' version of dgmCreate
%
% Optional args:
% nodeNames
% nstates
% This file is from pmtk3.googlecode.com
Nnodes = si... |
381872fe90be3ab330e4e8193630b42ed462def2f39e71fe62c47d9eeca21d60 | MATLAB | 2,923 | 84 | function [result] = ft_test_report(varargin)
% FT_TEST_REPORT
% Copyright (C) 2017, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under the terms of the GNU... |
830aa30852497f2f6cb4e557aff5ed8ccb49fea2b127ce8db72a0d2d0f164db5 | MATLAB | 2,923 | 97 | function [Y,B,Z,E] = CBIG_RL2017_ar_mls(TS,p)
% [Y,B,Z,E] = CBIG_RL2017_ar_mls(TS,p)
% This function identifies an autoregressive (AR) model from multivariate time series using the multivariate least square approach
% Input
% 'TS' original time course encoded in a matrix of size (T=number of time points,k... |
073dd868246558e1de462bf8a9a04d6c7baae36aa4412ceb70a0bf9e31a091c9 | MATLAB | 2,925 | 68 | function y_detrend (ADataDir, CUTNUMBER)
%function y_detrend (ADataDir, CUTNUMBER)
% ADataDir where the 3d+time dataset stay, and there should be 3d EPI functional image files. It must not contain / or \ at the end.
% CUTNUMBER cut the data into pieces if small RAM memory e.g. 4GB is available on PC.... |
1500d7ad4af485169547a8e30eec676ee7b95575a139024d95ae17369c4995cb | MATLAB | 2,925 | 70 | function [model, loglikHist] = hmmFit(data, nstates, type, varargin)
%% Fit a hidden markov model (by default, we use EM)
%
%% Inputs
% data - data{i} is a d*seqLength(i) matrix of observations,
% where d = size of observation (d=1 if type = 'discrete')
%
% nstates - the number of hidden s... |
1e216c5cf1884cd342fa5affe586b6b84926b129f6e40f9bd5470fc38380fb1e | MATLAB | 2,928 | 66 | clear all
%%
%Define Parameters
[opt] = ParameterOptions();
%%
%Define Parameters for Oscillating gradients
opt.nOscillations=3; % Number of oscillations per TR
opt.Waveform='Sine'; % Type of Oscillating Gradient. Choose from Rect (conventional rectangular gradient), Rect_Sym (symmetric rectangular gradient) or S... |
3efb0b348936bb767a4be714ee7730b01f930969e58ca1ecb6e2cf61d94e9c5a | MATLAB | 2,928 | 52 | function [author_log_posterior_prob, author_classification_score] = CBIG_EM_AuthorPredictionScore_wc(corpus, paradigm_by_exp, params)
% [author_log_posterior_prob, author_classification_score] = CBIG_EM_AuthorPredictionScore_wc(corpus, paradigm_by_exp, params)
% Compute log posterior probability of the tasks (authors)... |
1f3f14ae08db1a9cba50d0d245a8f8862d9d8b39bbbe3000772681610a7f1f1b | MATLAB | 2,929 | 101 | function rbfDemo( dataType, noiseSig, scale, k, cluster, show )
% Demonstration of rbf networks for regression.
%
% See rbfComputeBasis for discussion of rbfs.
%
% USAGE
% rbfDemo( dataType, noiseSig, scale, k, cluster, show )
%
% INPUTS
% dataType - 0: 1D sinusoid
% 1: 2D sinusoid
% 2: ... |
7e775a442cb257122963827f4c8e976a5779d7a63dfe5c760c48f9439bbff703 | MATLAB | 2,931 | 99 | function dat = read_spmeeg_data(filename, varargin)
% read_spmeeg_data() - import SPM5 and SPM8 meeg datasets
%
% Usage:
% >> header = read_spmeeg_data(filename, varargin);
%
% Inputs:
% filename - [string] file name
%
% Optional inputs:
% 'begsample' first sample to read
% 'endsample' last sample to... |
ac9d2013e67c54cd703eefee25c28243c15a049d61f0e311bc825329a08a9ab0 | MATLAB | 2,931 | 67 | function ops = StandardConfig_KS2Wrapper(basepath)
%% Standard configuration for kilosort2 wrapper
% Remember that this configuration was optimized for striatal recordings,
% so make sure to adapt to your recordings
%
% Eliezyer de Oliveira 2020/03/02
%directory to write temporary file (should be a SSD for speed)
r... |
30f013eed614dcd89f1c55b3c63a59067350bef883852e379bf6a2d4983c70f6 | MATLAB | 2,932 | 105 | function CBIG_MFMem_rfMRI_DrawOverlap_WI_Desikan68_Yeo7_fsaverage5()
%--------------------------------------------------------------------------
% CBIG_MFMem_rfMRI_DrawOverlap_WI_Desikan68_Yeo7_fsaverage5
%
% show estimated W and I in Desikan68 parcellation of fsaverage5 with Yeo's 7-network boundary
%
% Written by Pe... |
3e2dfb2d4c692404ee21cf47c133edcc0debdfb94fa8d4c4cca109e47071fe8e | MATLAB | 2,932 | 103 | function result = makematrices(r, makeords)
import yaml.*;
result = recurse(r, 0, [], makeords);
end
function result = recurse(data, level, addit, makeords)
import yaml.*;
if iscell(data)
result = iter_cell(data, level, addit, makeords);
elseif isstruct(data)
result = iter_struct(data, level, addit,... |
e8e7f1cb7634490e47bf915ae932a758be852be59cb2978dcaa70d0def3eb72a | MATLAB | 2,932 | 96 | function Config = setConfig()
% Config = utils.setConfig();
%
% Creates struct with all project-level parameters
% Loads data paths from config.json
%
% Paths for the project should be defined only in setConfig() if they are
% relative paths, and in config.json if they are machine-specific paths.
%
% Relatives paths ar... |
0a9954fb99a85f10664223b397be9bde6d7c06454cfaff8daf11a36f05f9dbb8 | MATLAB | 2,933 | 98 |
load(fullfile(saveLoc, 'par_sess'))
load(fullfile(saveLoc, 'decoder_excl_SL'))
% Load: 'w_dec', 'pc_dec', 'se_dec', 'excl', 'exclName', 'winCenter','pc_whenC_sign_dec' % Calculated in calc_whatDecoder_fixed_time
load(fullfile(saveLoc, 'decoder_excluded_450'), 'pc450_dec', 'se450_dec') % Calculated in calc_... |
21ab93dbf5d5974278fe48fe8b268981675591861dcc6b08f5590914a7e1aede | MATLAB | 2,934 | 133 | % This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,... |
45d7f91962a3caa9383361bc2cf971671883a59ba2a9a67a96831450273f3c77 | MATLAB | 2,934 | 52 |
lc_channel_list = dir([images_folder, '/*']);
lc_channel_list = lc_channel_list(~startsWith({lc_channel_list.name}, '.'));
lc_channel_list = lc_channel_list(cell2mat({lc_channel_list.isdir})==1);
lc_x_list = dir([lc_channel_list(1).folder, '/', lc_channel_list(1).name, '/*']); lc_x_list = lc_x_list(~startsWith({... |
c8c8b30f0e91bcbd899bc2accd82efa55810e4b5917720a8947d930fa44ed440 | MATLAB | 2,935 | 78 | function [ titleStr, settings, results ] = createFeaturesFromLabels( dataview, settings )
% Creates coordinates from the selected labels.
%
% The current point-filter has no effect.
%
% Newly created features are stored as StandardFeatures, i.e. as a complete copy.
%
% See also dspace... |
457f534e77acacfdc61dfdd8c613d82e80369d1e441f6b5841439db3af38a1c3 | MATLAB | 2,936 | 97 | function [fnormhat,t]=func_instfreq(x,t,L,trace)
%INSTFREQ Instantaneous frequency estimation.
% [FNORMHAT,T]=INSTFREQ(X,T,L,TRACE) computes the instantaneous
% frequency of the analytic signal X at time instant(s) T, using the
% trapezoidal integration rule.
% The result FNORMHAT lies between 0.0 and 0.5.
%
% X : An... |
c262213937c88a1f007aeb8281ef44f0acc6d3092a9f5f40855ca17019084b75 | MATLAB | 2,936 | 87 | function ext = palm_checkprogs
% Test whether some external programs or toolboxes
% are available, namely, FSL, FreeSurfer, SPM and
% Jimmy Shen's NIFTI toolbox.
%
% ext = checkprogs
%
% 'ext' is a struct containing one field for each
% of these applications, each being containing
% a 0 (false) or 1 (true) depending o... |
6170b1cfd0039725aaee24d6849d61d91c73d6f63d7be7bac2c576b846e7b92b | MATLAB | 2,937 | 94 | function S = AS_Init(file)
%% Unload variables from file and initialize
[t_lim,L,div,s,D0,init] = readvars(file,'Range','A1:F2');
[N_neur,tpr,uprr,uprt,uprd,N_ax,r_ax,Kt,Kc,Kr] = readvars(file,'Range','G1:P3');
t = 0;
f = 0;
[X,Y] = meshgrid(1:div);
% Neuron matrix: [position mesh index ; cluster ; upr(-1) ; upr ; ax... |
0a7a94612e6e5c91d9533421c18dc11defe34a7d849e5412fe784e5d19630d08 | MATLAB | 2,938 | 77 | %-----------------------------------------------------------------------------------------
% Population sparseness of odor-modulated neurons across the PC & MTL
%
% Kehl et al. 2024 (DOI:XX)
% Single-Neuron Representations of Odors in the Human Brain
% Figure 3a
% Author: Marcel Kehl
% License: MIT License
%--------... |
82aa61fed71538641484df86cab59572163b25f46d7e35f917d3cc53341781f4 | MATLAB | 2,940 | 92 | classdef MoviesRemappedEventData < event.EventData
% Event data for moviesRemapped event which supports movie removal and
% reordering (but not addition)
properties
% containers.Map. mIdxOrig2New(mIdxOrig) gives mIdxNew, the new/updated
% movie index for mIdxOrig. If movie mIdxOrig is no longer presen... |
c0b5fcc6075d5c041805e00600e63f143f8622900f1aa3f0f1a3be084d1e50c8 | MATLAB | 2,940 | 85 | function [ROIdec]=decoding_roi(subject,roi)
% ROI decoding of Braille letter within-hand and across-hand
% Marleen Haupt and Monika Graumann
% 22-02-2024
% Input:
% subject: number, e.g. 1
% roi: string, e.g. 'EVC'
tic
% paths
addpath(genpath('../code/'));
addpath(genpath('../toolboxes/libsvm'));
% define class... |
d8d06fd6196ee1540d29e62b372d949aa2e2c5e5a08bcaf6f4ef9a07a4fb41fc | MATLAB | 2,940 | 101 | function Q=ModularityIM(A,IM)
%
% This function calculates the modularity of a matrix that is assumed to be
% Pearson correlation values. The structure of the matrix is described by
% the IM structure. The matrix, A, is assumed to be square,
% have both positive and negative values and be bound by +/-1.
% Calcu... |
2298468178353a4917b8aca10502e7f6be83e4a55c174a79b60984f310f8eb05 | MATLAB | 2,941 | 96 | function write_neuralynx_ncs(filename, ncs)
% WRITE_NEURALYNX_NCS writes continuous data to a NCS file
%
% Use as
% write_neuralynx_ncs(filename, ncs)
%
% The input data should be scaled in uV.
%
% See also READ_NEURALYNX_NCS
% Copyright (C) 2005-2007, Robert Oostenveld
%
% This file is part of FieldTrip, see http:... |
40e570e9570c2f886368880465702b80db5b49f5f373b693e9fc522d630e4558 | MATLAB | 2,941 | 98 | function [im,header] = ufmf_read_mean(header,varargin)
[meani,framei,dopermute] = myparse(varargin,'meani',[],'framei',[],'dopermute',true);
fp = header.fid;
meani = [meani,header.frame2mean(framei)];
if isempty(meani),
[im,header] = ufmf_read_mean_helper(fp,header);
else
if length(meani) > 1,
im = zeros([he... |
c613b0e386be64afd578268dedac24e4e9620027aa59ba4865aace8bbf5f4ccd | MATLAB | 2,941 | 90 | function [varargout] = contains(varargin)
% CONTAINS True if text contains a pattern.
% TF = contains(S,PATTERN) returns true if any element of string array S
% contains PATTERN. TF is the same size as S.
%
% This is a compatibility function that should only be added to the path on
% MATLAB versions prior to R2016... |
e9adb8f5aa4798ed1cf92b0632b41a4641ef5df7504c828c37f7a4928e8db8f8 | MATLAB | 2,944 | 120 | function write_ply(fn, pnt, tri, format)
% WRITE_PLY writes triangles, tetraheders or hexaheders to a Stanford *.ply format file
%
% Use as
% write_ply(filename, vertex, element)
%
% Documentation is provided on
% http://paulbourke.net/dataformats/ply/
% http://en.wikipedia.org/wiki/PLY_(file_format)
%
% See als... |
e72cd271113e4430c255193566d92942f404fadb141e1b4e7a4499820ebf3197 | MATLAB | 2,945 | 86 | function varargout = parseStruct(S, varargin)
% Description: Parse struct vector S
% Usage:
% parseStruct(S)
% parseStruct(S, sIndex)
% parseStruct(S, fieldName1, fieldName2, ...)
% parseStruct(S, sIndex, fieldName1, fieldName2, ...)
% [varName1, varName2, ...] = p... |
221b92fe0d53bcd6a9ac1a2a5b2416287ee17250537e618512e36353d0f078dd | MATLAB | 2,946 | 97 | %% SDO (3)
% 3rd Variant of the compute SDO Matrix.
%
% This is the 'original' definition of the SDO, which fits the identity:
% L*p(x,0) = dp(x,) --exactly--, but which may overestimate diffusion
% effects during combinations of multiple SDOs, but which maximizes
% observations from a single process
%
% Has been hyp... |
785e0b065b8de2e1563430c3922966353caaac2f4c5c3f132738cc4aea301b93 | MATLAB | 2,946 | 101 | % fir_filterdcpadded() - Pad data with DC constant and filter
%
% Usage:
% >> data = fir_filterdcpadded(b, a, data, causal);
%
% Inputs:
% b - vector of filter coefficients
% a - 1
% data - raw data (times x chans)
% causal - boolean perform causal filtering {default 0}... |
81321762b24387292c330a5845a7bb0705121c10c41f4e74033d295196c3e2ac | MATLAB | 2,946 | 96 | function [varargout] = mesh_volume_distribution(mesh, varargin)
% MESH_VOLUME_DISTRIBUTION Plots FEM mesh elements volume(3D)/surface(2D)
% distribution.
%
% SYNTAX:
% MESH_VOLUME_DISTRIBUTION(MESH)
% MESH_VOLUME_DISTRIBUTION(MESH,RESOLUTION)
% [V] = MESH_VOLUME_DISTRIBUTION(MESH)
% [V] = MESH_VOLUME_DISTRIBUTI... |
6bc13a41728586a0459ece53b57d7a67ce02910f7f89b9baa5b7b8dc58b2e999 | MATLAB | 2,947 | 89 | % Author: Birgit Nierula
% nierula@cbs.mpg.de
function esg_prepro_loop4(inspect_subjects, srmr_nr)
if srmr_nr == 1
subj_inspect = {
'sub-004' 'median' '2' 'S8'; % S8 noisy over whole block --> removed
'sub-004' 'tibial' '3' 'S8'; % S8 noisy over whole block --> removed
'sub-004' 'tibial' '... |
ca816470c796dcced032829335fecd184322693f115dce00474a7b5af4199210 | MATLAB | 2,948 | 113 | function asc = read_eyelink_asc(filename)
% READ_EYELINK_ASC reads the header information, input triggers, messages
% and all data points from an Eyelink *.asc file
%
% Use as
% asc = read_eyelink_asc(filename)
% Copyright (C) 2010-2015, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtrip... |
7d566df64af31d096550cee00204ce55004887f55a70aa59fe4e7d74417daebf | MATLAB | 2,949 | 86 | % Written by Einat Peled
% einatspeled@gmail.com
%
% Input: ImageArray_CorrAmp_norm: array with response images
% ImageArray_Labels: array with each image split to response labels.
% Output: An image array that shows only the top NumMaxPixels of each
% response
% For each input image: go over individaul respo... |
a96b10f607ca6347dd704a81c37d7c5a1835727e9d2ee81c4eb633e9343f59ba | MATLAB | 2,949 | 111 | %% Demonstrate density modelling with a PPCA mixture model
% Slightly modified version of demgmm5 from netlab
%%
% This file is from pmtk3.googlecode.com
function mixPpcaDemoNetlab()
if ~exist('gmm')
error('must install netlab from http://www.ncrg.aston.ac.uk/netlab/index.php')
end
%data = mkClusterData;
data =... |
3efa2b38725d297d8019ff94f07fb13d67fbaf7b8b69742d1e79b8696e9a5d87 | MATLAB | 2,950 | 48 | %% 基于IMFs的谱统计特征(函数输入通常是imfx而非X) | spectral statistical features (based on imfs)
% Spectral centroid 频谱质心: 信号频率分布和能量分布的重要信息,是频率成分的重心,是在一定频率范围内通过能量加权平均的频率
% Spectral variance 频谱方差: 反映频域能量变化的波动程度
% Spectral skewness 频谱偏度: 表征频谱在质心附近的不对称性
% Spectral kurtosis 频谱峰度: 表征频谱在质心附近的平坦度
% sum band power 频带能量
% EMD分解得到的IMFs通常具有窄带特点,每... |
dd494106339893f94952d5d98dc6af2b23c79b28b1386676db74531cf3ff5808 | MATLAB | 2,950 | 96 | function [cba] = HumanOdorRep_density_plot(spikes, idx)
%% function [cba] = HumanOdorRep_density_plot(spikes, idx)
%
% function to visualize the spike density of single neurons
% based on individual action potentials
%
% Inputs:
%
% spikes - Number of spikes x 64 time bins
% spike voltages in muV
% ... |
6113f13f4b9169eaadd551ec3f4ceb9102aaf89197ea3f8216aa8fa2aa019fa3 | MATLAB | 2,951 | 63 | classdef depositionCriteria
% List of criteria for when a photon's weight loss should be deposited in
% any output arrays. All the criteria have to be met simultaneously - there
% is an implied AND between them all.
% The minMediumIdxToConsider and maxMediumIdxToConsider are different in
% that they specify which medi... |
d2f0529d8544e64ae6a44c9f28d7099f624f751031af3642b5ae43639dfe5a6f | MATLAB | 2,951 | 92 | function mesh = fix_vertex_ordering( mesh )
% Written by William Warriner 22 Aug 2019
% from COMPUTE_mesh_normals by Adam H. Aitkenhead
% Inputs:
% - @mesh is either an FV-struct, or a real, finite, 3D double array with
% dimensions (:,3,3) representing face-vertex data with only triangular
% faces. The first dimens... |
ec06a124dcc7ac19f85980131e1af24c8b9445db47f789d8fc6bea1851c4a94e | MATLAB | 2,951 | 97 | function s = read_curry(filename)
% READ_CURRY reads and parses Curry V2 and V4 ascii files and returns the
% content in a structure that is similar to the block-structured layout of
% the file. This function does not interpret the content of the file, but
% is intended as a helper function for READ_CURRY_XXX function... |
fd700ee38192a2e9798b6807473a31385ad8bce14a07e37b1edb2fc3ef337bc3 | MATLAB | 2,952 | 95 | function [hax,hfig] = PlotLabeledReachOutliersPerMouse(labeldata,uniquedays,noutliers,varargin)
[hax,hfig,mousename,meanperday,Sperday] = myparse(varargin,'hax',[],'hfig',[],'mousename','',...
'muperday',{},'Sperday',{});
ndays = numel(uniquedays);
if isempty(hax),
if isempty(hfig),
hfig = figure;
else
... |
db10319f1dbc70f4d2e51509e5e816071c272b842146e4105d9a333481169b43 | MATLAB | 2,953 | 109 | % projected_thickness_plot.m
% calculate skull thickness, and interpolate the projection of this metric
% over some tissue.
%% clear and load engine
restoredefaultpath;
clear all;
addpath(fullfile('Engine'));
%% load meshes
file_INNER = fullfile('data/110411_wm_headreco.stl');
file_OUTER = fullfile('data/110411_gm_... |
f58f72dc915817435aed773a24a57e1ff82ec21c2c9990a5c5f2988a7da2ac70 | MATLAB | 2,953 | 115 | function newftevdata = wlFT_unTrimMetadata(trimmedftevdata, cropdefs)
% function newftevdata = wlFT_unTrimMetadata(trimmedftevdata, cropdefs)
%
% This function alters "sampleinfo" and "trialinfo" metadata for events
% extracted from trimmed trial data to use sample indices from the original
% un-trimmed trial data.
%
... |
0f7009d1bbced460b648bb6f145ef4295178840fe2dd12d0c94de637ad4a0329 | MATLAB | 2,956 | 123 | load('TrDC')
load('DC')
[NDC,Nt] = size(TrDC);
load('Speed')
load('MovT')
load('DCShift')
Speed = circshift(Speed,[0 -14]); %Delay btw ephy and image
Sp = Speed;
SpBlur=GaussBlur1d(Sp,Nt/10,2);
DCind=1:NDC;
d = cumsum(Sp)*0.1;
[~,xDel]=sort(ShiftDC);
TrB=TrDC(xDel,:);
TrBd=diff(GaussBlur1d(TrB,Nt/25,2),[],2); %Nt/20
fi... |
01f86198e1cd90ef380df7a5a5ae06b6a131a7c95a06752cfc295f526ff1d377 | MATLAB | 2,957 | 104 | %% Export calibration data (corners + 3D coordinates) to
%% text files (in Willson-Heikkila's format or Zhang's format)
%% Thanks to Michael Goesele (from the Max-Planck-Institut) for the original suggestion
%% of adding this export function to the toolbox.
if ~exist('n_ima'),
fprintf(1,'ERROR: No calibration dat... |
1a6d6b2002918f7c69199921e154e95b659e1cd532878aea559ea961435f08e6 | MATLAB | 2,957 | 113 | function asc = read_eyelink_asc(filename)
% READ_EYELINK_ASC reads the header information, input triggers, messages
% and all data points from an Eyelink *.asc file
%
% Use as
% asc = read_eyelink_asc(filename)
% Copyright (C) 2010-2015, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtrip... |
501dd5c97a353c185086d683fffe8497c700049f924dbe0bfd01aae4769af248 | MATLAB | 2,957 | 89 | classdef UFMFRecording < VideoRecording
properties
highlightForeground = false % TODO: expose a UI to set this
end
properties (Transient)
ufmfFile
haveImageToolbox
end
methods (Static)
function canLoad = canLoadFromPath(filePath)
... |
25232e810287129cfff6fdd21c4401a3090b7056f0245ed341e2027919b93f70 | MATLAB | 2,958 | 49 | function W=bspline_coefficients(u,v,w)
switch(nargin)
case 1
W = bspline_coefficients_1d(u);
case 2
W = bspline_coefficients_2d(u,v);
case 3
W = bspline_coefficients_3d(u,v,w);
end
function W=bspline_coefficients_1d(u)
W(:,1) = (1-u).^3/6;
W(:,2) = ( 3*u.^3 - 6*u.... |
d7dbfdf9162b3b166d0b3e79f6ff771eced1e6c1a4524f06060dfd96afab2c6f | MATLAB | 2,958 | 84 | function pvals = palm_datapval(G,Gvals,rev)
% Compute the p-values for a set of statistics G, taking
% as reference a set of observed values for G, from which
% the empirical cumulative distribution function (cdf) is
% generated, or using a custom cdf.
%
% Usage:
% pvals = palm_datapval(G,Gvals,rev)
%
% Inputs:
% G ... |
2835a48af50e1a5538b5c0e0e0daa9945293c0056df0dc33a9faa6e4f5b65391 | MATLAB | 2,959 | 56 | function selected_color = color_picker_3(object_type, data_dir)
% COLOR_PICKER_3 assigns all colors to be plotted in a synthetic image.
% Each object should have a representative color, a distribution, or
% alternative data to support color selection.
% In this version, color are randomly selected from croppings in a ... |
c1011934a4a7afe313b81942ef9ee8a34cf10f876845c4928a99d5eb20d29084 | MATLAB | 2,959 | 94 | function [tfr,t,f]=tfrideal(iflaws,t,N,trace)
%TFRIDEAL Ideal TFR for given instantaneous frequency laws.
% [TFR,T,F]=TFRIDEAL(IFLAWS,T,N,TRACE) generates the ideal
% time-frequency representation corresponding to the
% instantaneous frequency laws of the components of a signal.
%
% IFLAWS : (M,P)-matrix where each co... |
563d8088051c33ff97ab90d95a40692b9096e0785e026608f17b708f37118b10 | MATLAB | 2,962 | 107 | function varargout = pdftops(cmd)
%PDFTOPS Calls a local pdftops executable with the input command
%
% Example:
% [status result] = pdftops(cmd)
%
% Attempts to locate a pdftops executable, finally asking the user to
% specify the directory pdftops was installed into. The resulting path is
% stored for future refere... |
6e36c877535bb2f0f01f6073bfe866709f05d80a92f4931a267aff8dbc858f71 | MATLAB | 2,963 | 109 | function LAN = lan_cspec(LAN,cfg)
% NOT TESTED OR RECOMMENDED TO WORK WITH MULTIPLE TRIALS
% IMPORTANT: adaptation in progress of freq_lan.m. So far, only method
% thoroughly tested is Morlet Wavelets.
if nargin == 0
edit lan_cspec
help lan_cspec
return
end
wfile = false;
wfile4chan = false;
if isfield(c... |
b01be8c10ca21a8ac933805d12a0529999d7bfd4ad31233e8faa46b8c49e8bb2 | MATLAB | 2,964 | 111 | function Y = symmetrize(X,grps)
%SYMMETRIZE Symmetrize a tensor X in specified modes.
%
% Y = symmetrize(X) will symmetrize a tensor X with respect to all
% modes so that Y is symmetric with respect to any permutation of
% indices.
%
% Y = symmetrize(X,MODES) will symmetrize a tensor X with respect to the
% m... |
bf3a8b42ba3f41ec02086ba12dcc1a2f266e31279fb00be3b5e890c9c8844086 | MATLAB | 2,964 | 101 | function [w, f, exitflag, output] = stochgradSimple(objFun, w0, options, X, y, varargin)
% Stochastic gradient descent with averaging
% Interface is similar to minfunc except you must explicitly
% pass in X and y, which is needed for mini-batching
% Example:
% opt.batchsize = 10; opt.method = 'sgd'; w=stochgrad(objFn, ... |
f40d6236a6c5b32790decd4ed16092cccf3e1e69bc06a61f75dc786503cf8991 | MATLAB | 2,965 | 83 | %% An illustration of density estimation with k-nearest neighbours.
% Contrast this with parzenWindowDemo(), where rather than fixing the
% number of points, K, as we do here, we fix the window size.
%%
% This file is from pmtk3.googlecode.com
function knnDensityEstimationDemo()
setSeed(0);
mix = [0.35,0.65];
sigma ... |
8a2c50c13080ac0a59fe76c0c41f449f6ac0cdadf05996c3e09d2f8789fe20dc | MATLAB | 2,966 | 70 | function H = fhog( I, binSize, nOrients, clip, crop )
% Efficiently compute Felzenszwalb's HOG (FHOG) features.
%
% A fast implementation of the HOG variant used by Felzenszwalb et al.
% in their work on discriminatively trained deformable part models.
% http://www.cs.berkeley.edu/~rbg/latent/index.html
% Gives nearly... |
ec68b2029f72a81694424ed11b536c4affbfc7fcac149b6d2d5e42cc6a26f98b | MATLAB | 2,966 | 90 | % delete_brain_masks.m
% Sarah West
% 12/4/21
% Called from preprocessing pipeline. Calls on DeleteMasks.m to delete
% brain masks.
function [] = delete_brain_masks(parameters)
% Establish input and output folders
dir_in_rep_base=[parameters.dir_exper 'representative images\'];
dir_in=[parameters.... |
298042abbaf12613efa3bfb7203a4fa8cb9ecb0f4b1dec755e92b5cf82750dca | MATLAB | 2,967 | 103 | % This demo simulates the shape of the vmPFC fMRI response to value
% ratings, i.e. a truncated V (Mael Lebreton, personal com.).
% The underlying idea is as folows.
% Let us assume that subjects have a utility function defined over some
% continuous dimension x of the item they have to rate. This may be, for
% example... |
f06256f5013d7c09a37fa0e210e6258a5194c3ef2421f8959106ebaf0acde358 | MATLAB | 2,967 | 134 | function [ LAN H G ]= lan_laplace(LAN,cfg)
% v.0.0.4
% Compute laplace tranformation using CSD toolbox,
% see http://psychophysiology.cpmc.columbia.edu/Software/CSDtoolbox/
%
% cfg.H = precalulate H matrix
% cfg.G = precalulate G matrix
% cfg.head = heade radius =10
% cfg.lambda = smoot... |
b0a0488a946b8594fd447a2dda1a45a591682ed262291e183a1060b9756ce64f | MATLAB | 2,968 | 54 | clear all
%%
%Define default parameters
[opt] = ParameterOptions();
%%
%Create an oscillating gradient waveform (here consistent with definition in Aggarwal et al.)
opt.nOscillations=3; % Number of oscillations per TR
opt.Waveform='Sine'; % Type of Oscillating Gradient. Choose from Rect (conventio... |
f05589c9d88516801f6cde566279fb2cd6b3bf155649767d21771434732af52b | MATLAB | 2,968 | 105 | function logZ = dgmLogprob(dgm, varargin)
%% Logprob of data
% If every node is clamped, we just multiply all the CPDs.
% If we have missing data, we run inference.
% If using batch mode, all nodes must be fully observed
% and must have tabular CPDs.
%
% INPUTS
%
% Batch mode
% obs(n, t) = value of node t in case n
%
... |
b946b43f2cccadabc121e632f616f67d8a13ce4405a64799f32805cc341bf4d4 | MATLAB | 2,969 | 72 | %% ScanImageTiffReader for Matlab
%
% This is a Matlab package for extracting data from
% <https://en.wikipedia.org/wiki/Tagged_Image_File_Format Tiff> and
% <http://bigtiff.org/ BigTiff> files recorded using
% <http://scanimage.org ScanImage>. It is a very fast tiff reader and provides
% access to ScanImage-specific ... |
0906c249fa1d318bb43c7426efdcda3f09cbbb67856527c385c846c8c374e747 | MATLAB | 2,970 | 112 | % [param1,param2,...] = read_ann(filename,'param1','param2',...)
%
% params:
%
% version, bg_type, n_bg_std_thresh, n_bg_std_thresh_low, bg_std_min,
% bg_std_max n_bg_frames, min_nonarena, max_nonarena, arena_center_x,
% arena_center_y, arena_radius, do_set_circular_arena, bg_algorithm,
% background_median, bg_norm_typ... |
0e3b1e789c5758912f6f06b79504853c9386177d1d63608662cf231c7bf5a4d4 | MATLAB | 2,970 | 106 | function h = montageKPM(arg)
% montageKPM is like the built-in montage, but assumes input is MxNxK or filenames
%
% Converts patches (y,x,i) into patches(y,x,1,i)
% Also, adds a black border aroudn them
% This file is from pmtk3.googlecode.com
if iscell(arg)
h= montageFilenames(arg);
else
nr = size(arg,1); nc = ... |
35f86adc73693dc45918a75caa7aed019136fd775acd0cfa41bc3fee958b41cf | MATLAB | 2,972 | 59 | function data = roi_correlations(data,channels,dataset)
clear all_roi_corrs all_randroi_corrs collect_rois
for mouse_n = 1:length(data)
for cell_n = 1:length(data{mouse_n})
days = 1:length(data{mouse_n}(cell_n).day);
roi_corr_matrix = nan(days(end),days(end));
for day_1 = days
... |
bcab20615b74b1fa32f56f50fb7b4031b3f898f3d761cf13646e3d756552e8c6 | MATLAB | 2,972 | 124 | % This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,... |
f1316bf850bfd80221f97b6423217789a2c2df4a8b1f39d0e9b8ea015dc78dc7 | MATLAB | 2,973 | 86 | function View_Clear_Brain_ROI_Corr_Multi(Anat,IM,M,Pnn,Proi,C,Pmax,params,g)
%
% This function draws ROIs on the brain and connecting rods colored by sign
% of correlation values in C. This can be the fc correlation itself if that
% is passed, or it can be the correlation of brain fc with behavior if that
% matr... |
f887346cc60a8eb2be086f518885d2b5513477d929ba220bbd748f828e3a3ae6 | MATLAB | 2,973 | 112 | %%
addpath(genpath('Sceleton3D'));
addpath(genpath('Skel2Graph3D'));
cell_mask = ~imread('src/skeleton_test.bmp');
%% ---------------------------- Skeleton generation -----------------------------
disp('Skeleton generation:');
tic
skeleton = Skeleton3D(logical(cell_mask));
toc
% Save the skeleton as a TIF
% saveastif... |
6a0aa1507f5294ebdde61d3c69c3bf4608b92baa879a938fd717360f9ebe9ca2 | MATLAB | 2,974 | 68 | function EEG = DS_extract_ChOI(EEG,PARAM)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Function to extract only channels of interest for pipeline
%
% Part of detect_spindles toolbox:
%
% Authors: Stephane Sockeel, PhD, University of Montreal
% Stuart Fogel, PhD, University... |
66004d3c47bcbe1d977bac869fb8f32729c5aef6db303ac85cbe9fa80c518822 | MATLAB | 2,975 | 107 | %% normSDO
%// Utility to normalize SDO for cross-unit comparision or combination;
% Each element of the (diff) sdo tries to represent dp(x1|x0), but this
% is implicitly biased by p(x0), the distribution of spikes present at type
% of spikes.
%
% Normalization seeks to generalize the expected change in the pos-spik... |
9c29f97f974248ae243c19bdf3f57163b2174a324875605b47b8aea26cc82231 | MATLAB | 2,975 | 94 | function TF = instr(needle, haystack, flags)
%INSTR Returns true if (any) needle is in (any) haystack.
% Usage:
% TF = instr(needle, haystack)
% TF = instr(needle, haystack, flags)
%
% Args:
% needle: string or cell array of strings to look for.
% haystack: the string or cell array of strings to look in.
% fl... |
21402e3f5b927107b61596d3548078570831e09a3c6bacd0082506ba94f578fa | MATLAB | 2,977 | 101 | function reconstructfun = get_reconstruct_fcn(caldata,usegeometricerror)
% [XYZ,uv_re,err] = reconstructfun(uv)
% reconstructfun(uv) takes input uv which is [2 x nviews x n]
% and produces outputs:
% XYZ: [3 x n] 3-d reconstructed points
% uv_re: [2 x nviews x n] reprojections
% err: [1 x n] reprojection error per vie... |
5aab62cf42fe159afc2651461601348d4fb17aa9c9946f696838487462c3ae0c | MATLAB | 2,977 | 101 |
medA = load(fullfile(saveLoc, 'for_plots_mediation_norm_to_se'));
mediatedDimsA = [52 19 27]; dimTin = 27; % ramp, PC1, Tin
%% =======================================================================
%% Compare observed value to distribution of values in shuffled trial assignments
proj_type = 'PC1wei... |
dfe1dd55da75bb13755a1ab9fced1afd06279dece236fc441f19220a62f21b10 | MATLAB | 2,977 | 74 | % SOFA API - demo script
% Copyright (C) 2012-2013 Acoustics Research Institute - Austrian Academy of Sciences
% Licensed under the EUPL, Version 1.1 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "License")
% You may not use this work except in compliance with the ... |
170dbd52a9dbde88e38218855da950c2ce28869402fd44c586c5a7efdc3d646a | MATLAB | 2,978 | 79 | function Aout = h_loadDendriteTracingData3(handles, flag)
[currentInd, handles, currentStruct, currentStructName] = h_getCurrendInd3(handles);
currentFilename = get(handles.currentFileName,'String');
[pname, fname, fExt] = fileparts(currentFilename);
analysisNumber = currentStruct.state.analysisNumber.value;
... |
6db66b6f4caf018b9bb209554b2729022841c33a7af1e7ce8095b000a807aa2a | MATLAB | 2,978 | 94 | %{
## Example command locally:
workspace = getenv('WORKSPACE');
mappers_path_1 = [workspace, '/results/cme_mappers/mappers_cmev6kval_fast.json/SBJ01/'];
mappers_path_2 = [workspace, '/results/cme_mappers/mappers_cmev6kval_fast.json/SBJ19/'];
output_path = [workspace, '/results/cme_mappers/res.csv'];
## Run the with t... |
b3670014b5bdb7dbb99d84abee77596bb7adf3da7afcda815ff29bde74483092 | MATLAB | 2,978 | 104 | function CorrMatrix2(unit, varargin)
timeRange = [0 Inf];
plotRange = [-100 100];
binWidth = 1;
showAuto = false;
nSamp = 1000;
for i = 1:2:length(varargin)
switch lower(varargin{i})
case 'nsamp'
nSampTarget = varargin{i+1};
case 'timerange'
timeRange = varargin{i+1... |
d089a88e0e2b15c4d14c744f6bf344d98891ac3e88bd8106e6a0e25bed025773 | MATLAB | 2,979 | 97 | function [L1,L2,L3,V1,V2,V3] = eig3dkmex( Ixx, Iyy, Izz, Ixy, Ixz, Iyz, mode )
% EIG3DKMEX Multicore eigenvalues and eigenvectors computation in 3x3 symmetric real tensors
% of tomograms
% INPUT:
% Iij - Tomograms with the i, j discrete diferentials, input data must be single and double
% m... |
f0ffaab80859b01d275c841f05f5e4e1d3692239679f81a1a3efe8a7cbc12d5a | MATLAB | 2,979 | 90 | function out = check_preproc_data()
%%function [missing_files,missing_proc_files] = check_preproc_data()
%
% Helper function to check that the preprocessing has completed successfully
% Get study information
config = utils.get_studydetails();
% Preallocate bad file arrays
out = [];
out.missing_fi... |
58b32fe5cc732f41073cfcefed1632cb99d3929bffb303d3f40c99738896e59d | MATLAB | 2,981 | 93 |
clc; clear; eeglab; close all;
set(0, 'DefaultAxesFontSize',20)
%% do the cluster-permutation effects
timelock = 'readyBS';
topoTimes = [-100 300 650 1000 1350];
timelockName = 'preparation cue onset'; % time from...
load(sprintf('TrioEEGAnalyseByTrials_%s.mat',timelock), 'GNDEffects');
%% incentive
cmap = ... |
2bdcd7d35a62818cda1ce1ddb186bba5235ef7e4d9ad7a6ac01df82d74a2a47a | MATLAB | 2,982 | 73 | function cPPI_with_deconv(stat_path,exp_folder,N,N_ROIs,q_level,ground_truth)
% ========================================================================
% Ruslan Masharipov, October, 2023
% email: ruslan.s.masharipov@gmail.com
% ========================================================================
tic
for subji = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.