sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
20885278415e3e59199380d2fca6efa4242f8e27c0763e753114384ec53142d3
MATLAB
2,497
37
function DrawFixation(display) fixcolor1 = [255 255 255]; fixcolor2 = [255 255 255]; fixcolor = [255 255 255]; offsetfix = 5; %px to compensate on lcd %right and left lines of box %left Screen('SelectStereoDrawBuffer',display.windowPtr, 1); Screen('Drawline',display.windowPtr, fixcolor, display.resoluti...
8bd8aa0ce0c359995ea8a293026e9eaaaa3259870838c97d30e67ebe9312f1b0
MATLAB
2,497
187
function [img,coords] = makeMontage(imgCube, sliceList, fileName, numAcross, backVal) %img = makeMontage(imgCube, [sliceList], [fileName], [numAcross], [backVal]) % % Compiles a montage image from the images in imgCube. % (imgCube is x by y by sliceNum) % sliceList, if specified, determines which slices to extract. ...
d3efb8c6fa4dfdcbb933ec2e71cb14669d5d005377f8fdbabb7021c8f6309b32
MATLAB
2,497
78
function [logp, yhat, res] = tapas_beta_obs(r, infStates, ptrans) % Calculates the log-probability of responses representing probabilities on the unit interval % % -------------------------------------------------------------------------------------------------- % Copyright (C) 2013-2016 Christoph Mathys, TNU, UZH & ET...
e9e33e784d2e2c3b4a8a81894086f9da034d23f944275e4f90a737fb1575d5eb
MATLAB
2,497
70
function [Xsol, S0] = rasr_nonlinear_eigenspace(L, k, alpha) % Example of nonlinear eigenvalue problem: total energy minimization. % % L is a discrete Laplacian operator: the covariance matrix % alpha is a given constant for optimization problem % k determines how many eigenvalues are returned % % This example is moti...
3ba145a4a2d451c41ec83a71ecddad71476c99636be181257c9e76c64f0a4cd1
MATLAB
2,498
69
function this = MrAffineTransformation_constructor(this, testVariants) % Unit test for MrAffineTransformation Constructor % % Y = MrUnitTest() % run(Y, 'MrAffineTransformation_constructor') % % This is a method of class MrUnitTest. % % IN % % OUT % % EXAMPLE % MrAffineTransformation_constructor % % See also MrU...
52417b20612c841a00badf7294ede07b66137f66ee2a0c22763cf73025456d98
MATLAB
2,498
91
function [traj, infStates] = tapas_rw_binary_dual(r, p, varargin) % Calculates the trajectories of v under the Rescorla-Wagner learning model for dual updates. % % This function can be called in two ways: % % (1) tapas_rw_binary_dual(r, p) % % where r is the structure generated by tapas_fitModel and p is the pa...
cf989ee64b15777575b50e3777517a2adedb132a1c2ad9a22413a218808424d4
MATLAB
2,498
68
function frameMovie(fde,cfg,varargin) % Display animation of the frame data % % function frameMovie(fde,cfg,varargin) % % This function shows the evolution of FrameStream data over time. It % visualizes the data at each time point as a surface over the 2D array of % channels, in the same way as the plot function...
036fc75ae5f9297a87d36bff41f8ce34d3005e422a98ae44077d2864bd9b1c7d
MATLAB
2,499
73
function this = load_par(this, filename) % Loads Par (Philips)-Header information referring to geometry into object % % Y = MrAffineTransformation() % Y = Y.load_par(fileName) % % This is a method of class MrAffineTransformation. % % NOTE: This is based on the header read-in from GyroTools ReadRecV3 % % IN % % OUT ...
0f5f1dcd2cec22d22b45f9bb27a2c78ab9cb1e85003d10c5c6528d8eabc101c9
MATLAB
2,499
101
function [WUinit] = init_template(ops,Nchan) nt0 = ops.nt0; Nfilt = ops.Nfilt; Nrank =ops.Nrank; tps = [1 5 10 25 40 50 61]; tps = round(tps * nt0/61); vs = [0 0 0 -2 1 0 0]; fs= interp1(tps, vs, 1:nt0, 'linear', 'extrap'); W(:,1,1) = my_conv(fs, 2); tps = [1 5 10 25 40 50 61]; tps = round(tps * nt0/61); vs = [...
41e11cb367434345f60f83b376fb3e6b3997cdfb7b85d26b67b02004e646cd60
MATLAB
2,500
71
function [data_high,pks_frame,pks] = findHighactFrames(data,pks) % find high activity frame using a threshold determined from shuffled data % INPUT: % data: N-by-T spike matrix % pks: significant level of frame activity; if left empty ([]), this % function will determine its value using shuffled data % ...
b8187ef392d5201d719551da67d7479acb1f859da1cf6cadbd3b056d0f499939
MATLAB
2,501
93
% op_filter.m % Jamie Near, McGill University 2014. % % USAGE: % [out,lor]=op_filter(in,lb); % % DESCRIPTION: % Perform line broadening by multiplying the time domain signal by an % exponential decay function. % % INPUTS: % in = input data in matlab structure format. % lb = line broadening factor in Hz. % ...
0f2c2f6f7b02d5becd47e65eaf47b8fa936f02b0ad13cffe47ab2f1d9cca186b
MATLAB
2,502
76
function this = compute_tissue_probability_maps(this) % Computes tissue probability maps % % Y = MrSeries() % Y.compute_tissue_probability_maps(inputs) % % This is a method of class MrSeries. % % IN % % OUT % % EXAMPLE % compute_tissue_probability_maps % % See also MrSeries MrImage segment spm_preproc % Author...
2446e2e58354738e2213d9506a0d602022762cdd9bcebd059abb8099f990e7f6
MATLAB
2,502
90
function [ subject ] = nmri_stamp_subject( subject, stamp_item, params ) %[ subject ] = nmri_stamp_subject( subject, stamp_item, params ) % This will add a "stamp" to subject struct to mark a processing step has % been sucsessfully completed. If the same stamp is there, a warning will % be issued but overwritten ...
29d909774edcd06ff5f8416450c6e769cc2f64a8c1246254418ed085644c86ac
MATLAB
2,502
91
function [b, tau, er, exp_t_1_coeff, stats, bestfit, bint, rint] =... regress_latency_vs_rew(A, nback, z_arg, hit_arg, blk_arg, varargin) if isfield(A, 'pd') %if it's an S struct. [A, ~, ~] = parse_data_from_mysql(A); end if isempty(varargin) usethese = true(size(A.block)); else usethese = varargin{1}...
3b8398b5f82013a953c8fe351cce3e02d87b961c2fcbe15e4454032b136db295
MATLAB
2,502
97
%{ monet.Fit (computed) # fitting RFs for computing significance -> monet.CleanRF ----- x : float # (degrees) RF location away from center y : float # (degrees) RF location away from center radius : float # (degrees) geometric mean of major and minor axes aspect : float # aspect ratio orientation : float #(degr...
61ef3e5dccebd8fa9aac6ab5357114081e6a5fd4018c47776820fc4fb3e9b6bf
MATLAB
2,502
123
function [imo,rois] = fast_rcnn_eval_get_batch(images, imdb, batch, opts) % FAST_RCNN_GET_BATCH_EVAL Load, preprocess, and pack images for CNN % evaluation % opts.numFgRoisPerImg = 128; % opts.numRoisPerImg = 64; % opts.maxScale = 1000; % opts.bgLabel = 21; % opts.visualize = 1; % opts.scale = 600; % opts.interpolatio...
1f4f06b576650df25db5c7f6e3ba16b65e6a61957a05da47e37466e4de041360
MATLAB
2,504
95
function mesh = fixpos(mesh, recurse) % FIXPOS helper function to ensure that meshes are described properly if nargin==1 recurse = true; end if isa(mesh, 'delaunayTriangulation') % convert to structure, otherwise the code below won't work properly ws = ft_warning('off', 'MATLAB:structOnObject'); mesh = struc...
3a68ce85c8422963da81e9a9658b526cdea80daa5ca140008d139e13850d9874
MATLAB
2,504
93
function mdot(mmat, dotfile,f) %MDOT - Export a dependency graph into DOT language % MDOT(MMAT, DOTFILE) loads a .mat file generated by M2HTML using option % ('save','on') and writes an ascii file using the DOT language that can % be drawn using <dot> or <neato> . % MDOT(MMAT, DOTFILE,F) builds the graph containing...
57c2bde9eaf84e052eec2a1c30d0dc992078751eac1cf7a7d7e288be8580a0ee
MATLAB
2,504
125
%% chi = FANSI_4sepia(phase,magn,spatial_res,alpha,mu,noise,options,B0_dir) % % Description: Wrapper to use FANSI under Sepia % % Kwok-shing Chan @ DCCN % k.chan@donders.ru.nl % Date created: 1 April 2019 % Date modified: 17 Feb 2022 % % function chi = FANSI_4sepia_v1(phase,magn,spatial_res,alpha,mu,noise,options,B0_d...
0d0fe54889a025835d87002f33c2ca834d837b105aad2129ce59fca674f5e7b2
MATLAB
2,505
59
function [weights] = create_cosine_weights(channels, srate, epoch_size, fullshift) %cosine weights to avoid overlaps for seamless re-contruction %% Creative Commons License % % Credits: Abele Michela & Tomas Ros % NeuroTuning Lab [ https://github.com/neurotuning ] % Center for Biomedical...
f1f063990f3fcdfa88a3a3748bfc23828d9dafce7f3f051e61fbf3156756b7a5
MATLAB
2,508
80
function [ balancedPurity ] = tapas_huge_bpurity( labels, estimates ) % Calculate balanced purity (see Brodersen2014 Eq. 13 and 14) for a set of % ground truth labels and a set of estimated labels % % INPUTS: % labels - Vector of ground truth class labels. % estimates - Clustering result as array of assignment...
1abbd2ad87702fe41bb633c2ed22bda6433f2f518eb5cc9877c32a91fc904a83
MATLAB
2,509
74
function croppedImages = crop_all(this, rangeIndexArray, otherImages) %Crops all given images to same range as this image % % Y = MrDataNd() % Y.crop_all(rangeIndexArray, otherImages) % % This is a method of class MrDataNd. % % IN % rangeIndexArray cell(1,2*nDimsToCrop) of pairs of % dim...
e989717a994298eeb65d534f9dd169b39c51a71bd79fc3a9c51b51098c5178ac
MATLAB
2,509
84
function y = vl_nnsoftmaxloss(x,c,dzdy) %VL_NNSOFTMAXLOSS CNN combined softmax and logistic loss. % **Deprecated: use `vl_nnloss` instead** % % Y = VL_NNSOFTMAX(X, C) applies the softmax operator followed by % the logistic loss the data X. X has dimension H x W x D x N, % packing N arrays of W x H D-dimensional...
b91e259c3a7cf14ec97f82c20bf3e759b3b82321ba8248d99e3d0b1afa947f86
MATLAB
2,511
93
function phiBC = cellBoundaryRadial2D(phi, BC) % function phiBC = cellBoundary2D(MeshStructure, BC, phi) % It creates the matrix of coefficient based on the BC structure provided % by the user. It also generates the right hand side vector of the linear % system of equations % % SYNOPSIS: % phiBC = cellBoundary2D(Mesh...
c99eedd8a207e146127f3d0e61eac538ea7cc0c60880c4c6ce205c5d36640c8c
MATLAB
2,511
78
% op_lorentz.m % Jamie Near, McGill University 2014. % % USAGE: % y=op_lorentz(pars,ppm); % % DESCRIPTION: % Generate a parametrized lorentzian peak. % This function is fed into fitting tools to enable fitting of peaks using % lorentzian lineshapes. % % INPUTS: % pars = The parameters of the Lorentizan funct...
769428e81d71b025fc44cf79307eb6db6f84f7f988c4a8ea58c237f95ec1046a
MATLAB
2,512
49
%% library thangs run('set_library_paths.m'); addpath(SPM_PATH); % per spm docs, do not genpath it addpath(genpath(CANLABTOOLS_PATH)); addpath(genpath(CANLABMASKS_PATH)); %% variables that must be specified before the script is called % region: a cell of 1 or more ROI names in NeuroimagingPatternMasks syntax. will all...
2396c6b71aa8983520314bb0632562d468e1c02f47606d2fc5a4856e30d286d8
MATLAB
2,513
93
clear; close all; !chmod +x sor06 !make clean !make %% load in output from fluids model Qdat = dlmread('DP1_inflow.dat'); % inflow_param = Qdat(13:end,:); % get_inflow(Qdat,16385,inflow_param); dlmwrite('inflow.dat',Qdat,'delimiter','\t') %% Define the nominal parameters f1 = 2000000; f1p1 = f1; f1p2 = f1; f1p3...
4d1d8c515d6b8a8438367d5f89abbc56668057f60914a46b667ca24103c48bd8
MATLAB
2,513
65
function [ output_args ] = findICAAssemblies( deltaFoF , KS_significance ) %FINDICAASSEMBLIES( deltaFoF , KS_significance ) % % % === Jan Moelter, The University of Queensland, 2018 =================== % narginchk(1,2); if( nargin == 1 ) KS_significance = 0.1; end if( size( deltaFoF , 1 ) >= size( deltaFoF , 2 ...
546cfe26ca6a0b1cdc75a5b671780b78ae331e7f322d783cfbbc1917ea15af0b
MATLAB
2,513
69
function [isPhysioVisibleForSpmBatchEditor, pathSpm, pathPhysIO] = ... tapas_physio_check_spm_batch_editor_integration(isVerbose) % Checks whether PhysIO-configuration file for matlabbatch is in subfolder % of SPM/toolbox and returns a warning, if not % % [isPhysioVisibleForSpmBatchEditor, pathSpm, pathPhysIO] = ...
eb9565b47e6551d76c58543595c0253da580a86c67d960eb9f7527b37d034a72
MATLAB
2,513
80
function new = copyobj(obj, varargin) % This method acts as a copy constructor for all derived classes. % % new = obj.copyobj('exclude', {'prop1', 'prop2'}); % % IN % 'exclude' followed by cell(nProps,1) of property % names that should not be copied % NOTE: Proper...
b397de2280c74e4f5997a47ecdfbdd3c54f29e16877229867ae9c60c59d4e733
MATLAB
2,514
83
function T16 = computeDisruptionsAfterInst(T, assessmentValue, ageCutYears, doPlot) if nargin < 2 || isempty(assessmentValue), assessmentValue = '16-year assessment'; end if nargin < 3 || isempty(ageCutYears), ageCutYears = 16; end mustHave = {'ID','assessment','age_days_enter_inst','age...
bad2794a82d36b5e30a4247cb4228283c9048af1982c4552da5884161ae458fd
MATLAB
2,514
61
function [timeSeriesGroup,classLabels,groupLabelsInteger,numGroups] = TS_ExtractGroupLabels(TimeSeries) % TS_ExtractGroupLabels Extract group labels from a TimeSeries table %---INPUT: % TimeSeries, the input TimeSeries table in HCTSA format. % %---OUTPUT: % % -------------------------------------------------------...
133eafb31b51773e7f7f8827d684b160389a2a104a98f3557a462eab05aafb66
MATLAB
2,515
74
%% get_set_swismwi_smwi(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input should be f...
28aec7b3cd4b1bbdefd805c8975edca4ab090e9efeb5569282efcdd586352c62
MATLAB
2,515
63
%% ============================= % PALM Analysis: re-reextinction CS × TUS % ============================= % --- Locate repo root (relative to this script) thisfile = mfilename('fullpath'); [scriptdir, ~, ~] = fileparts(thisfile); cd(scriptdir); % Ensure consistent working dir % Navigate up to FEARTUS root % palm_c...
4b261b23538e2b931313972a6036cbbedd0aa3dc567bcea38175722a56379c2e
MATLAB
2,515
99
function run_conductance_hcp(varargin) % Compute conductance maps from tensors computed with DSIstudio % Adapt paths and file names to your own % % Example: run_global_connectivity_hcp(100307) % % Author: Aina Frau-Pascual %%% Load folders and code % Add code folders to path folder='Code/FVT4DWI'; addpath(genpath(fo...
afcb4eadd3e7f23e247af7c520d8aa0a0d93e4cfed0e4575edb88a34ab451616
MATLAB
2,515
58
function selectionIndexRangeCell = tapas_uniqc_convert_selection_array_to_range(... selectionIndexArrayCell) % Converts array of single element selection cells (name/value pairs) into % single cell of name / range pairs % % selectionIndexRangeCell = tapas_uniqc_convert_selection_array_to_range(selectionIndexArray...
d856e6c08b476e25d91726808c3efc04f658c9011d9d8babba5bb0746af05fda
MATLAB
2,515
63
%% ============================= % PALM Analysis: re-reextinction CS × TUS % ============================= % --- Locate repo root (relative to this script) thisfile = mfilename('fullpath'); [scriptdir, ~, ~] = fileparts(thisfile); cd(scriptdir); % Ensure consistent working dir % Navigate up to FEARTUS root % palm_c...
eeba3a06b7efd5f0e31821efc4895a65c5a05490e440502b4c10efb1774b31c0
MATLAB
2,515
87
function data = eventLockDataSmooth(R, M, eventName, tPts, varargin) % data = eventLockDataSmooth(R, M, eventName, tPts [, smoothSD] [, rois] [, field]) % % Similar to eventLockData() and eventLockDataFluor(), but smooths the % data. % % Like eventLockData() and eventLockDataFluor(), this function returns data % that...
81bb786f9895003170392fc58bcf5366212b3c0ee248b4a42c977b23dbd7c6e1
MATLAB
2,518
55
function fit = extract_fit(fit,FitResults,Model,x,y) %extract_fit(fit 'struct', FitResults 'struct', Model 'string', x 'double', y 'double') %transform fit results to "human readable" variables % % fit : struct containing fitting results % FitResults : fitting results % Model : "Biexp", "Biexp_T1c...
1156491f28627544fa7201888e4c156135739e3d29e3323bcec348fdcc5cdec2
MATLAB
2,520
103
% op_takesubspec.m % Jamie Near, McGill University 2014. % % USAGE: % out=op_takesubspec(in,index); % % DESCRIPTION: % Extract the subspectra with indices corresponding to the 'index' input % array. % % INPUTS: % in = input data in matlab structure format. % index = vector indicating the indices of the subspec...
7dd2c717c6edc01f0f0d8439e1bc0e1f26e23e1d6935dee5a1ab37e3aa531f5b
MATLAB
2,520
71
function update_properties_from(obj, input_obj, overwrite) % Updates properties of obj for all non-empty values of inputpobj recursively ... % % Y = MrCopyData() % Y.update_properties_from(input_obj, overwrite) % % This is a method of class MrCopyData. % % IN % input_obj either MrCopyData or a struct with the s...
9c4e20b37d51ab09c1c5f3331c41654dde9a4e0614c2ca5c53ccf2f30d5cc0d4
MATLAB
2,520
84
% Call the 1D model with the given parameters and return pressure and flow % signals function [p_out,q_out] = call_1D_model(pars,par_ids,par_baseline) % NOTE: assume we are log-scaled here, so exponentiate out pars = exp(pars); % tot_ves = C_inputs(1); % tot_term = C_inputs(2); % num_pts = C_inputs(3); in...
af1ac9c108998df464701f15fc73ce3fa990f9c86b590f270aad78a702f339c3
MATLAB
2,520
63
function h = arg_guipanel(varargin) % Create a uipanel that displays an argument property inspector for a Function. % Handle = arg_guipanel(Options ...) % Handle = arg_guipanel(Parent, Options ...) % % The handle supports the method .GetPropertySpecification(), by means of which the edited argument % specification can ...
796d1549344aef4eabfb0ebbb5e210e3599b3305e14f33a3ea052c432a8c4ac4
MATLAB
2,521
73
function [C,C2] = iem_trialwise_interp_double(data,angs,angs2,foldvar,angspace,angspace_targ,angspace2) % [C,C2] = iem_trialwise_interp_double(data,angs,angs2,foldvar,angspace,angspace_targ,angspace2) nChan = length(angspace); nChan2 = length(angspace2); nChan_targ = length(angspace_targ); ntime = size(data,3...
2c9a248183894a0e12ddfb6aabc43eeb1270884fcaccd87fc2a2d3b0fd15c606
MATLAB
2,522
97
%{ aod_monet.Fit (computed) # fitting RFs for computing significance -> aod_monet.CleanRF ----- x : float # (degrees) RF location away from center y : float # (degrees) RF location away from center radius : float # (degrees) geometric mean of major and minor axes aspect : float # aspect ratio orientation : floa...
5dd538e03b6f5579fc0b307c363aa90c9236ddc0c14c88cb8011af4a7acf346e
MATLAB
2,523
102
function [inference] = tapas_sem_hier_inference(inference, pars) %% % % aponteeduardo@gmail.com % copyright (C) 2016 % if ~isfield(inference, 'estimate_method') inference.estimate_method = @tapas_mcmc_blocked_estimate; end if ~isfield(inference, 'initialize_states') inference.initialize_states = @tapas_sem_h...
86ea2a6aa4c7e36d665118af7ffcaad3b08866a9687e1570c94a0b8c41c00ecd
MATLAB
2,523
92
function tapas_sem_trapp_int_check_input(u, theta, ptheta) % Check whether the input is compatible with mpdcm. If not an error is % returned. % % Input: % u -- Structure. Inputs to DCM in mpdcm format. % theta -- Structure. Model parameters in mpdcm format. % ptheta -- Structure. Priors of the model in...
ee3684d1c6e3d0ad20c8620f38cc75652e0a3e7f56987bbc77cad490f1f324d8
MATLAB
2,523
111
function x = perform_histogram_equalization(x,y,options) % perform_histogram_equalization - perform histogram equalization % % x = perform_histogram_equalization(x,y,options); % % Change the values of x so that its ordered values match % the ordered values of y. % % You can set % options.cols=1 to operat...
f4c079d4e2b7f3afc224bd70d5b28db1a25cc385c9a140bfd113a89d8c0c2ea0
MATLAB
2,525
73
%% [unwrappedField] = Wrapper_Unwrap_ROMEO_singleEcho(wrappedField,mask,matrixSize,voxelSize,algorParam, headerAndExtraData) % % Input % -------------- % totalField : total field map (background + tissue fields), in Hz % mask : signal mask % matrixSize : size of the input image % voxelSize : spatial ...
3c8bc3571375a8fe7cea9d4d182c13a66eec0c5d530a47d0f176f783f86e696c
MATLAB
2,526
75
% Main script for resamping subject-specific laminar SANDI surface overlays to the fsaverage surface % using FreeSurfer mri_surf2surf % % Reference: % Lee H, ..., Huang S, Communications Biology, 2026 % % Requirements: % - FreeSurfer installed and configured % - FreeSurfer recon-all completed for each subject % - Subj...
f9393c79d2d99d65bf5c8e0b79e27b2ac71914df01a7e37960d7dcfafee6b58c
MATLAB
2,526
50
% function performance = get_performance_rh(ensmat_gt,enscells_gt,ensmat_det,enscells_det) function perf = get_performance_rh(ensmat_gt,enscells_gt,ensmat_det,enscells_det) % Computes the performance of detection algorithm based on ROC AUC and % Jaccard index. % Reference paper: Herzog et al. 2020 "Scalable and accurat...
159041ebfeb0019dd74ee81f10267385b5ed5c888eb479b8e8fb3e022ac22b3e
MATLAB
2,527
77
function [ output_args ] = bestmatch_expectation( N , numelA , numelB , nA_dist , nB_dist ) %BESTMATCH_EXPECTATION( N , numelA , numelB , nA_dist , nB_dist ) % % % === Jan Moelter, The University of Queensland, 2017 =================== % % N = 20; % numelA = 2; numelB = 3; % % mA = 10; wA = 6; % mB = 15; wB = 4; % ...
5e8dfeb1863c3e52916916d20fc5f660c9758749cb0d53f67b60ecd53aaa6e4b
MATLAB
2,527
92
% % 'overseer' function for performing & logging subtraction with sliding % windows. % % % [data,cfg]=m_do_slidingwindow(data,cfg) function [data,cfg]=m_do_slidingwindow(data,cfg) cwregression=cfg.cwregression; if isfield(cwregression,'do_logging'); do_logging = cwregression.do_logging; else do_logging = 0...
6470f27766c5c05cfef69470bed00a18d1a72799e9a2edf1ea46d8327ee97834
MATLAB
2,527
92
function [ DCM ] = tapas_ceode_testData_cmc() % [ DCM ] = tapas_ceode_testData_cmc() % % THIS IS A SCRIPT SOLELY FOR TESTING THE SPM/TAPAS SETUP. DO NOT CHANGE! % % Sets parameters and function handles to create a synthetic DCM % structure. The resulting structure can then be used to generate % artificial data with tap...
fbdb35ac35d906edb6e441097c414ff1dc51eb02220ce30de757d2d86b79e68d
MATLAB
2,527
67
% NEWTIMEFPOWERUNIT - Find power unit for y-axis based on input structure. % % Usage: % >> str = newtimefpowerunit(paramstruct); % % Inputs: % paramstruct - [structure] structure with fields . % % Outputs: % str - string containing the % % Authors: Arnaud Delorme, SCCN, INC, UCSD, August 2016 % Co...
30f8dfcdfd18ddb28696b00d48bbf0512995e0ad400bb2531a7e1d6a15ed0725
MATLAB
2,528
69
% Performs discrete correlated total variation denoising (CTVD) using a % primal-dual interior-point solver. It minimizes the following discrete % functional: % % E=(1/2)||y_0-ay_1-x||_2^2+lambda*||Dx||_1, % % over the variable x, given the input signal y, according to each % value of the regularization parameter lamb...
4e9f64b29b0189a44e1b6ed08978f3f9caf60e5511bc64d89b0ba620dfb40a9d
MATLAB
2,528
83
function [dimLabels, resolutions, nSamples, units, firstSamplingPoint] = ... read_par(~, filename) % Reads dimInfo for Philips par/rec format. % TODO: extend to ND-data (so far, only 4D time series supported) % % Y = MrDimInfo() % Y.load_par(filename) % % This is a method of class MrDimInfo. % % NOTE: The outpu...
1745dd943b604c1d0348da38a759dd94ec54b6871071d01284e887d22fe00003
MATLAB
2,529
72
function [] = plotBetasSwarmGroup(beta, groups) % This code reproduces the analyses in the paper % Urai AE, Braun A, Donner THD (2016) Pupil-linked arousal is driven % by decision uncertainty and alters serial choice bias. % % Permission is hereby granted, free of charge, to any person obtaining a % copy of this softwa...
1a8799d968750a386f758acaad0bfb4e026c3d1aec1bfc383e6cd724001e7ba6
MATLAB
2,529
70
function plotJointAnglesVertical(kinematics, joints) % Plots the time series of a specified set of joint angles % Figure fig; axis off hold on; % Params ntPts = length(kinematics(1).tPts); liftBin = find(kinematics(1).tPts == 0); tPts = 1:length(kinematics(1).tPts); alpha = 0.2; lw = 0.5; yspace = -30; xspace = 3; xo...
739247fe208b377b7d75a63a11742fc882d01d18256417db4fc89e0b57cbb2cf
MATLAB
2,529
65
function [corrMatrix,pMatrix,psr] = CorrInIntervals(spikes, intervals, varargin) % Computes Pearson's correlation for each pair of neuron's spikes within % the intervals provided. For each interval, the spikes emitted by each % unit are counted, and if units M and N fire in a correlated manner within the % provided wi...
bdf7569e084f0c4df7f601565aa77759aa18f43b7d484e4438812c8142bb6ba8
MATLAB
2,529
66
function out = SY_StdNthDer(y, n) % SY_StdNthDer Standard deviation of the nth derivative of the time series. % % Based on an idea by Vladimir Vassilevsky, a DSP and Mixed Signal Design % Consultant in a Matlab forum, who stated that You can measure the standard % deviation of the nth derivative, if you like". % % cf....
7abc0c0154e974e8516359716209079a6373d3987868aa1ab726296f26bae906
MATLAB
2,530
65
% demonstrate usage of likelihood functions % % See also likFunctions.m. % % Copyright (c) by Carl Edward Rasmussen and Hannes Nickisch, 2022-04-04. % File automatically generated using noweb. clear all, close all n = 5; f = randn(n,1); % create random latent function values ...
f244e4c4934efd8343d0e3ebe5e27255c3f39882713917684600175090b185fc
MATLAB
2,530
90
function [output]=getStimEpoch(Data,TTL,Fs,varargin) % [output]=getStimEpoch(Data,TTL,Fs,'baselinePrePost',2,'getShuffle',true) % output arrays : time x trials x channels/pixels % % OPTIONS: % options.baselinePrePost=1; % 1sec baseline % options.getShuffle=false; % % OUTPUT: % output.arrayRaw=arrayRaw; % output.arraySh...
548ca9f2f7e037a75555dd2fb41dc946dcac8a2b16539d7688340a8759c58cef
MATLAB
2,531
74
function res = arg_tovals(spec,direct) % Convert a 'rich' argument report into a 'vals' report. % Vals = arg_tovals(Rich) % % In: % Rich : a 'rich' argument report, as obtained via arg_report('rich',some_function) % % Direct : whether to endow the result with an 'arg_direct' flag set to true, which indicates to %...
00fe1a63e05b03e41a8e4545f2301f1ab80afba399607e6110afce98bc9548f7
MATLAB
2,533
79
function plotApertureTimeSeries(data) % Plots the time series for a single trial of aperture and z velocity % Params liftCol = [130, 235, 118]/255; collectCol = [72, 188, 255]/255; extendCol = [230, 40, 151]/255; aperturecol = [248, 147, 83]/255; velocitycol = [0,0,0]; tPts = [-50:10:150]; bins = find(ismember(data.tP...
724abaf4fd120ab129d471696ace14e842532760b24c2003ee8e96ccf1302fc1
MATLAB
2,533
82
function fh = tapas_physio_plot_results_comparison(actPhysio, expPhysio) %Compares two physio output structures in terms of their %processing/modeling results % % fh = tapas_physio_plot_results_comparison(actPhysio, expPhysio) % % IN % % OUT % % EXAMPLE % tapas_physio_plot_results_comparison % % See also % Autho...
e754d0a2013d3003a9bba95e4d05c114e0a6bfce9e33bfb4373132f81cc2c71f
MATLAB
2,534
83
function ylims = jointsReconPlot(output, joints, field, ylims) % Plot joint angle time series and their reconstructions if nargin < 3 field = 'jointAngles'; end if nargin < 4 ylims = zeros(2 * length(joints), 2); end reconField = [field 'Recon']; jointNames = {'SHLDf', 'SHLDa', 'SHLDr', 'ELBOf', 'WRSTf', 'W...
e788bb3231181f75bb53a34e5cb657e0b36a1e9da1e3cc1fdd19679ada77409f
MATLAB
2,534
94
%{ tuning.MonetFit (computed) # fitting RFs for computing significance -> tuning.MonetCleanRF ----- x : float # (degrees) RF location away from center y : float # (degrees) RF location away from center radius : float # (degrees) geometric mean of major and minor axes aspect : float # aspect ratio orientation : ...
15fc87ccd1915a5ae2de8ec750c07a547c4fdcc43101c1583a5c49d2cff102d6
MATLAB
2,535
56
function addCh = ch2roi_getSelCh_add(i_ch_trials, ch_inds, chGroups, nn, cName) % whether to add this channel to the selected ones or not % !!! works only for 2 NN !!! % 1) check if 'i_ch_trials' NOT already among the ch_inds % 2) for NN = 2 (works only for 2 NN !!!) % 3) in case a channel was assigned to the 1st gro...
38c96f0aa5d8b14eee73143fba0cbd16892fa099e0e94ff169f1560c46ad38f3
MATLAB
2,535
85
function directories = getProjectDirectories(varargin) % GETPROJECTDIRECTORIES Get or set project directory paths % % Syntax: % dirs = getProjectDirectories() % dirs = getProjectDirectories('Name', 'path', ...) % % Description: % Manages project-specific directory paths with platform awareness. % % Inputs: % Na...
4694c67e1b69b5671d37b37fc8c3c2884ec10d65213eb0deb30d80ed5b6fb61d
MATLAB
2,535
83
% LLE ALGORITHM (using K nearest neighbors) % % [Y] = lle(X,K,dmax) % % X = data as D x N matrix (D = dimensionality, N = #points) % K = number of neighbors % dmax = max embedding dimensionality % Y = embedding as dmax x N matrix %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [Y,DiMatrix] = lle...
5daae2e01a67f5375d638a0eeb4e0dab320a0b6358211a506633eb26061d4555
MATLAB
2,536
75
function MS = createMeshRadial2D(varargin) % MeshStructure = createMeshRadial2D(Nr, Ntetta, Lr, Tetta) % MeshStructure = createMeshRadial2D(facelocationR, facelocationTetta) % builds a uniform 2D mesh on a Radia coordinate: % imagine a top view slice of pie % Nr is the number of cells in r (radial) direction % Ntetta i...
68045bb9b7abbf2d1e7e303898b530c6f8020f4cc17d3b276e1f7a1e2fca195f
MATLAB
2,536
61
%{ monet.OriMap (imported) # responses to directions of full-field drifting gratings -> monet.OriDesign -> pre.AlignMotion --- regr_coef_maps : longblob # regression coefficients, width x height x nConds r2_map : longblob # pixelwise r-squared ...
91fefd12ecd63e471cee046e44f26dc8f165c0d7fade233a8eab443624d671b4
MATLAB
2,536
39
%{ vis2p.Scans (manual) # Scans$ -> vis2p.Experiments scan_idx : smallint unsigned # scan number within this experiment, forms the _%03u suffix of the scan files --- file_name : varchar(61) # m) file prefix if different from the default YYMMDD scan_prog="MPScan" :...
4a6725b6d197ec95abb627b4fcd2577fa1006b52cef5c7147e820f6b21bd3f8e
MATLAB
2,539
86
function imdb = add_bboxreg_targets(imdb) % add bbox regression targets % % Copyright (C) 2016 Hakan Bilen. % All rights reserved. % % This file is part of the VLFeat library and is made available under % the terms of the BSD license (see the COPYING file). bgid = numel(imdb.classes.name) + 1; imdb.boxes.ptarget = cel...
8c2c8079360ebc581b5d524c62c1a0a44b07d6b16728c550fe11cbc5d2d6df55
MATLAB
2,540
87
function fear_tripleCoactTimestamps(basename,varargin) % basename='~/data/Fear/triple/hoegaarden181115/hoegaarden181115'; load([basename '.basicMetaData.mat']) load([basicMetaData.AnalysesName '-tripleCCG.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) param.minPeak=125...
dd4db2312f26be52fd2f2c9598cd310adb7da345d6f0e70b2532a5349b1ccfbc
MATLAB
2,540
82
function [bpFilter]=findBestFilterParameters(filePath) disps('Start findBestFilterParameters Function') % % m=load(allPaths.metadataPath); % metadata=m.metadata; [~,~,ext]=fileparts(filePath); if strcmpi(ext,'.h5') meta=h5info(filePath); disp('h5 file detected') dim=meta.Datasets.Dataspace.Size; ...
e39dffff6571e4a1a62c444ad65ecebd28591557feaf46e885ba8a3be50bf92e
MATLAB
2,540
70
function [M, Mx, My] = diffusionTermRadial2D(D) % This function uses the central difference scheme to discretize a 2D % diffusion term in the form \grad . (D \grad \phi) where u is a face vactor % It also returns the x and y parts of the matrix of coefficient. % % SYNOPSIS: % % % PARAMETERS: % % % RETURNS: % % % EXAMPL...
25f4643c136b2bafc17a322ff097f21fa2e32ef62c89002e3a9a69446b23b8d5
MATLAB
2,541
79
function [xx] = tapas_ceode_compute_xtau(tn, xhist, itau) % [xx] = tapas_ceode_compute_xtau(P, M, U) % % Computation of delayed states according to the continuous extension for % ODE methods. Delayed states are computed as a linear interpolation % between sampled time points % % xhat(t-tau) = x_{i-1} + (t-tau)/dt * (...
34dcf29c3456480ae6c3214e5de9409fea04f86fd2c87b33bb2c0da3795999ea
MATLAB
2,541
87
function [PrincipalCurvatures,PrincipalDir1,PrincipalDir2]=getPrincipalCurvatures(FV,VertexSFM,up,vp) %% Summary %Author: Itzik Ben Shabat %Last Update: July 2014 %{ %getPrincipalCurvatures calculates the pincipal curvatures and their %directions from the second fundemental tensor %INPUT: FV - mesh face-vertex...
94c2a13765d7ba2f1a3b069bca358ce45f3182e7ccae878700ec8882f34318be
MATLAB
2,541
80
function [hdr] = neuralynx_getheader(filename) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % SUBFUNCTION for reading the 16384 byte header from any Neuralynx file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Copyright (C) 2007, Robert Oostenve...
0a67a811fae90ee01075b13ef0c5bea448aea3dca8205bf6c2d66d4c8c0ce8bc
MATLAB
2,544
82
function fear_cueTrigCoact_opt_meanShift(basename,varargin) load([basename '.basicMetaData.mat']) fprintf('%s start %s with data of %s\n',datestr(now),mfilename,basicMetaData.SessionName) param.binSize=0.02; param.halfWindow=5; param.targetHC=3; param.targetSes=2; param.varName='cueTrigCoactChamber'; param.saveFile=[...
e3696fbaed9caefad2adedc2f89b5cc5ea223980c36e49c899cd81064f116f6d
MATLAB
2,544
68
function out = DN_ProportionValues(x, propWhat) % DN_ProportionValues Proportion of values in a data vector. % % Returns statistics on the values of the data vector: the proportion of zeros, % the proportion of positive values, and the proportion of values greater than or % equal to zero. % % ---INPUTS: % x, the inpu...
dd386a41469e825266887a0f6322c54580a6f615feba2839628755f3c4978b2f
MATLAB
2,545
76
function [data_out, bad_channels] = interpolate_bad_channels(rdir, channels, data, channel_layout, channel_name) % add missing channel to the bad channel list % channel_layout.label = channel_layout.label(1:275); % [notmissing, dummy] = match_str(channel_layout.label, data.label); % newtrial = cell(size(data.trial));...
174aa2f4e2f0a2019fb79c1f9bc2673fcd566d42131ed23ee77855cb6fba5d4f
MATLAB
2,547
95
% Fig2b_RawTraces.m % Plots average traces ± SEM for multiple sensor variants and AP conditions. % % Usage: % 1. Place this file in the same folder as Traces_All.mat % 2. In MATLAB, cd into that folder % 3. Run: Fig2b_RawTraces % % Tested with MATLAB R2023b close all; clear; %% Load data (expects Traces_All.mat...
5b0322eb8de7aab9abe3257131a98636e62accc485c5272825c461f4dc36513d
MATLAB
2,547
55
% STD_PACPLOT - Commandline function to plot cluster PAC % (phase-amplitude coupling). % % Usage: % >> [STUDY] = std_pacplot(STUDY, ALLEEG, key1, val1, key2, val2); % >> [STUDY itcdata itctimes itcfreqs pgroup pcond pinter] = ... % std_pacplot(STUDY, ALLEEG ...); % Inputs: % S...
a3adb8beeda27647257a557e3d3f1e8fb424fdb7fb96ccbde1cba9a8c0a7516b
MATLAB
2,547
68
%% get_set_clearswi(h,mode,input) % % Input % -------------- % h : structure contains all handles of SEPIA % mode : 'set' - extract information from GUI to config file % 'get' - extract information from config file to GUI % input : if mode is 'set' then input should be fid %...
54ac01dc87fd3c57d412391cc6feeb53c931b2bfdd891404f4a7023a30681f7f
MATLAB
2,550
99
function [outputArg1,outputArg2] = PlotSubjectMeans_All(sn, TitleStr, lp_Color, hp_Color, bb_Color) % --- Standard values for params if not specified if ~exist('TitleStr','var') % title parameter does not exist, so default it to something TitleStr = ' '; end % --- means & standard deviation per azimuth ...
a68c0b989088fa93273e672db270f04a7b76db88d4bf67eda89c743c7473b861
MATLAB
2,550
82
% this script does the final assessment of all of the screening. %%%%%%%% load all the results! nsdsetup; ix = 6+(1:14); a1 = load('/research/papers/2022 nsd/figures/SCREENING/BOLDSNR/results.mat','pcts'); tt = 20; boldprf = normalizerange(a1.pcts(:,1,tt)',1,5); boldfloc = normalizerange(a1.pcts(:,2,tt)',1,5); a1 ...
ba695584e31423f3f65f69724ca28b5c8fd3fdce89693c5c60a0a3acf954c114
MATLAB
2,550
74
function plotRTClassifierCorrelationAll(outputs, eventName, method) % Plot the correlation between the real and the predicted RTs % Figure fig; hold on; ax = gca; axis off % Params colors = turbo(length(outputs)); markers = {'s', 'x', '+', '*', 'o'}; % Loop over mice corrsM1 = []; corrsS1 = []; mouseN = 1; for mouse...
eaaa9e0df3a1d96e0a0d4b1f371d3a527dc72f8b2b1bdd11256cd23b2d72df53
MATLAB
2,550
59
function [outdata, outsform1, outroi] = cifti_struct_dense_extract_volume_structure_data(cifti, structure, cropped, dimension) %function [outdata, outsform1, outroi] = cifti_struct_dense_extract_volume_structure_data(cifti, structure, cropped, dimension) % Extract the data for one cifti volume structure, expa...
fb67b8ede00d2c8e64fb42fd51ad4bebe2ee5dbfa4fe53b0242cdecd8f82f5d9
MATLAB
2,550
85
function glm_prf(subjix,ppdirname,tr,runix,prepname,stimversion,glmdirname,chunkstart) % notes: % - assume HRF % - average the 3 reps of each stimulus type up front % - fit ALL voxels within brainmask. very expensive. % - we use a chunking mechanism to do it in chunks. % - use supergrid to set the initial seed % - run...
7c48e9a91ee246fd49f082dce5bb6aa9d0191acf4597173f0366e8a5536201cd
MATLAB
2,552
59
function colorCell = GiveMeColors(numColors) % GiveMeColors outputs a cell of colors for the specified number of colors % % Relies on the BF_GetColorMap function to pull out the appropriate colorbrewer % colormaps % ------------------------------------------------------------------------------ % Copyright (C) 2013-202...
317cf1ec8134c3f20bb8f3ae82a303fd7ae3cb964a73fcc9d2556d548e8b8f83
MATLAB
2,554
75
function outputImage = smooth(this, varargin) % smoothes ND MrImage using Gaussian kernel and via SPM functionality % % Y = MrImage() % sY = Y.smooth('fwhm', 5, 'splitDimLabels', 'echo', 'splitComplex', 'ri') % % This is a method of class MrImage. % % IN % fwhm Full-width-at-half-maximum of the smoothi...
4838a037fbd2a9e9cfefa9baace7df8b9d6ad59a2b92032e88a85e64ca5a0e11
MATLAB
2,554
78
% UIPUTFILE2 - same as uigputfile but remember folder location. % % Usage: >> uiputfile2(...) % % Inputs: Same as uiputfile % % Author: Arnaud Delorme & Hilit Serby, Scott Makeig, SCCN, UCSD, 2004 % Thanks to input from Bas Kortmann % % Copyright (C) Arnaud Delorme & Hilit Serby, Scott Makeig, SCCN, UCSD, 2004 ...
942f58456b16a9e3dec12852fda78ce617e5047b2eb68c4040ca58244cc3da6b
MATLAB
2,554
55
%% sepiatest.compare_to_reference(testCase, actual, reference, tol, label) % % Description: compares a sepiatest.mask_stats() struct against a % previously-saved reference struct (same shape), using testCase.verifyEqual % with a relative+absolute tolerance, and a normalized-RMSE check on the % coarse downsampled array....
a6a0cc9e3d06b1f7c5d5253d960216477b9bd230e47eedb3971354a34409ac13
MATLAB
2,554
74
function [mask,vol,voxsize] = get_random_mask(n,P) % % n is the number of random points % P is the filename of the mask image file OR the actual mask array % P should be brain-only, or better, gray-matter only voxels % if P is empty, select using GUI % % vol is the search space - the whole brain mask where coordina...
77e1241be97e2b9a7c0b9dde6c7c51708655fbe251ad9cbc6208d8134d4d7be0
MATLAB
2,555
46
function [joint,expected,difference,corrected] = JointPETH(PETH1, PETH2,smooth) %JointPETH - produce a joint histogram for the co-occurrence of two sets of signals around events. % PETH1 and PETH2 should be in the format of PETH, see example usage below. % This analysis tests for interactions. For example, the intera...
829570e2844420fe401ec222a808efb7fbf9605d36074fdf033dcb5a42d625a8
MATLAB
2,555
43
% on surly: % annotate the individual subjects for p=1:8 unix(sprintf('convert /home/stone-ext4/generic/Dropbox/nsddata/inspections/surfacevisualizations/fsaverageflat_curvature_subj%02d.png -gravity northwest -font FreeMono-Bold -fill black -pointsize 120 -stroke ''#eeeeee'' -strokewidth 10 -annotate +20+20 ''subj%...
25dbdc6ecf6aad86aace189610e1315459a860b348cda5fa99dcc61a62b89a8f
MATLAB
2,557
62
% Script demo_load_geometry_from_nifti % load geometry from nifti % % demo_load_geometry_from_nifti % % % See also % Author: Saskia Bollmann & Lars Kasper % Created: 2018-10-18 % Copyright (C) 2018 Institute for Biomedical Engineering % University of Zurich and ETH Zurich % % This file is part...