sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
88c63ed8c088d69c8315cb2670961fc4d10ffe5d58e60cf4ba6242e131b31d0c | MATLAB | 997 | 15 | function r = is_evaluated(x)
% determine whether an expression can be taken as a fully evaluated MATLAB value
% this holds for both impure expressions and literal expressions (almost all MATLAB data structures; see exp_eval for a detailed list)
% it excludes:
% * canonical expression structs (with the only fields bei... |
9cdf24a465ab2b2a37d9c0c80862561b4f6ff34bc5bb669684987937ef1a5ecc | MATLAB | 997 | 26 | function Corr = tapas_Cov2Corr(Cov)
% Converts a covariance matrix into a correlation matrix
%
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2013 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the... |
d66e4e108baf39b3eb8f41525728ed685d4b26b025e878700b858213b2c76440 | MATLAB | 997 | 37 | function plot_shaded_error_bars(x, y, color)
%{
PURPOSE: Plots shaded error bars for the data specified by x and y in the
color specified. Shaded error bars are SEM.
ARGUMENTS:
- x: (array) 1xn with x data
- y: (array) mxn with y data for m replications
- color: (array or string) either RGB values or stri... |
3b100a8f03475d7a34a467e42024b3fe78e405d124e3d8d3cc4453e587b0dcae | MATLAB | 998 | 41 | function [posterior] = tapas_sem_multiv_estimate(data, model, inference, pars)
%% Estimates the hgf using mcmc.
%
% Input
% data -- Data of the model. It should be a structure array with
% fields y, and u of dimensions n times 1, when n is the
% number of subjects.
% model... |
9d35a32694e073158b5273fe53a1ad6ae7d83522bab5fa28ff88cdf12c2bfa1f | MATLAB | 998 | 39 | function [onset, duration] = doTrial(cfg, thisEvent, thisFixation)
%% Get parameters
% Set for how many frames this event will last
framesLeft = floor(cfg.timing.eventDuration / cfg.screen.ifi);
%% Start the dots presentation
vbl = Screen('Flip', cfg.screen.win);
onset = vbl;
while frame... |
e9cdcc93c0f492449f053a2dbec782135d88d9e81e6fb3d984a4b82b6c907c01 | MATLAB | 998 | 35 | function TiffWriter(image,fname,bitspersamp,bigtiff)
if bigtiff
t = Tiff(fname,'w8');
else
t = Tiff(fname,'w');
end
tagstruct.ImageLength = size(image,1);
tagstruct.ImageWidth = size(image,2);
tagstruct.Photometric = Tiff.Photometric.MinIsBlack;
if bitspersamp==16
tagstruct.BitsPerSample = 16;
... |
ed17675df5f6e2e65d3b29ebcf89752bd4b3e33e483efd19af7ebe977539de23 | MATLAB | 998 | 28 | function [DecimalEvents, Timestamps] = OpenEphysEvents2Bpod(filename)
[data, pinChangeTimestamps, info] = load_open_ephys_data(filename);
Pos = find(info.eventId==1, 1, 'first');
BinaryEventCode = '0000000';
nPinChanges = length(pinChangeTimestamps)-Pos+1;
nTotalTimestamps = length(pinChangeTimestamps);
DecimalEvents =... |
3b3f78f6c9ff4eb3efa79c6e23094bd55c63e83c71c903cb40fcef4d6d339182 | MATLAB | 1,000 | 31 | classdef SprottJ < Environment
% SprottJ system.
properties
D = 3; % system dimension
Ranges = [52.5, -6.7;
11.5, -5.5;
26, -14.95]; % variable ranges
Params = struct(); ... |
815ed83feeb5f5f5c6f84c4fcd63cb3ffbed917887cfd3f057fdf12f7997bba5 | MATLAB | 1,000 | 33 | function kinematicsAll = loadLockKinematicsAll(datasets, dataPath)
% Loads multiple datasets, locks the kinematics and creates a single data
% struct combining across trials
kinematicsAll = [];
for dataset = datasets
mouse = dataset{1}{1};
session = dataset{1}{2};
% Load and lock
kinematics =... |
e2e00c1723d5e33bb6b805b5d455d7d373b28539f1bf54a2d952a957e0f8e3f2 | MATLAB | 1,000 | 37 | function [FRs, validTrials, RPE_firstTrial] = ...
get_FR_persistence(neuron, beh, A)
% get average firing rate at A on a sequence of 3 trials where the RPE
% on the 2nd trial is small
% get an RPE sequence
% filter out outliers in ITI and compute -delta ITI
cutoff = [prctile(beh.iti,2), prctile(beh.iti,98)];
... |
9799e9c308749baf5388e9caaf0e5977fc1f1c1a274659660fa5399954c10ba7 | MATLAB | 1,001 | 31 | classdef SprottS < Environment
% SprottS system. CANT FIND RANGES
properties
D = 3; % system dimension
Ranges = [6, -4;
4, -1;
4, -1.5]; % variable ranges
Params = struct(); ... |
9dfcb8cc21149934c0a4ca827c5b193137bd5d45fb9c26504258787368f481c4 | MATLAB | 1,001 | 39 | %% fndHE(Enunciado)
%
% Regresa los Ciclos de Hamilton y Euler del Enunciado.
%
% Enunciado = "string"
%
%
%%
function HandE=fndHE(e)
e_c=getCiclo(e); % obtiene todos los ciclos del enunciado
n_he=0; % número de ciclos de hamilton y euler encontrados
% busca entre todos los ciclos del enunciado
for i=... |
be0478a0bcd768220a917eac6af8d9bdd5d705bb3d849caa6e9b94e71526e74c | MATLAB | 1,001 | 31 | function db_close
% DB_CLOSE closes the connection to the database
%
% Use as
% db_close
%
% See also DB_OPEN, DB_SELECT, DB_INSERT, DB_SELECT_BLOB, DB_INSERT_BLOB
% Copyright (C) 2007, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
... |
1557f67803a85bbb716d1e7101c6eccd8c48e81e158c3a304ce4102ba1719af1 | MATLAB | 1,002 | 27 | function fieldData = get_SI_metadata_field(SIMetadata,fieldName)
% Purpose: to parse ScanImage (SI) metadata contained in SI-generated TIFFs
% for a specific field names. For example, so see list of channels that
% were saved, input 'SI.hChannels.channelSave' as second argument.
% Parse the TIFF metadata
% Get the p... |
26d993d34fba390cb9f6510bd0c15911b987be37d86d1cf77bead504722d966e | MATLAB | 1,002 | 37 | function getTriggers_carGame_obstOnly(params)
% determines & saves trigger times and class labels
% (c) Jiri, May16
display('triggering on rewards / obstacles ...');
%% per session: load, get trigger times and assign labels, save
for sess = 1:size(params.storage.analyzedSess,2)
t_trigger = [];
clz_label... |
39adefd2537e583ef53c6bcb7d70a07925f7d23a3813cda02601883d74fb4a42 | MATLAB | 1,002 | 53 | function [posi, b, sthi] = sero_srr_sero_gen2(nShot, ar, nz, bv, in_seed)
% function [pos, b, sthi] = sero_srr_sero_gen2(nShot, ar, nz, bv, in_seed)
%
% Second generation SERO sampling protocol that only produces positions
% (pos), b-values (b) and slice thicknesses.
if nargin < 4
bv = [1.2 0.8 0.4 0.1];
end
if n... |
3aa743a073a7d03e06613b0d189177f38c1b060888bef0b73c06d472445eb1d4 | MATLAB | 1,002 | 33 | function [ypred,ytest] = test_predict(xtest,ytest,modelfile)
% --- Prediction for test data
% [ypred,ytest] = test_predict(xtest,ytest,modelfile)
% xtest : test input data ( Xdim x Timesample x Ntrial)
% ytest : test output data ( Ydim x Timesample x Ntrial)
% ypred : predicted output from xtest
% if ytes... |
7bb4b7c3ffa786ca8c7a62b58dc03b151c5041cbd1b7fe824f5876c54030755d | MATLAB | 1,002 | 32 | %% function save_nii_img_only_newres(headerfilename,savefilename,img,datatype,voxelSize)
%
% Description: Wrapper script for saving with target image header
%
% Kwok-shing Chan @ DCCN
% k.chan@donders.ru.nl
% Date created: 24 January 2017
% Date modified: 28 June 2020 (v0.8.0)
%
function save_nii_img_only_newres(header... |
9dcfe20dfbffd2054361ffe11084f043b0bd8cf681fe68d6537d3d8812c32c66 | MATLAB | 1,002 | 33 | function origin = get_origin(this)
% Computes the origin of the affine transformation.
%
% Y = MrAffineTransformation()
% Y.get_origin()
%
% This is a method of class MrAffineTransformation.
%
% IN
%
% OUT Voxel indices x, y, z of the origin, i.e. those voxel who are
% at location [0 0 0].
%
% EXAMPLE
% g... |
af4b02b83c2ae7bd4ae55656436cabeaf18b6f5f4f51ea13a14be03d2fe1ba79 | MATLAB | 1,002 | 37 |
classdef colors
% Custom colors
properties(Constant)
black = [0 0 0];
red = [197 0 11]/255;
green = [0 128 0]/255;
blue = [0 114 198]/255;
grey = [128 128 128]/255;
salmon = [255 179 148]/255;
jade = [180 253 145]/255;
sk... |
b814c21137b0bb6cc700347dcbbe937bd5dadb4b9e7d5c5257c76783acb0a1c4 | MATLAB | 1,002 | 35 | function [ptheta] = tapas_sem_seria_ptheta()
%% Returns the standard priors of the model.
%
% Input
%
% Output
% ptheta -- Structure containing the priors. The prior distribution is assumed
% to be log Gaussian, so that the prior are the means and covariance
% matrix. It is assumed that the covaria... |
18a6626bbb301615c98c99f8dd551a2e28d381a80d5373e59f4a14d20aff7b8e | MATLAB | 1,004 | 21 | % Please cite this paper if you use any component of this software:
% D. Cunefare, L. Fang, R.F. Cooper, A. Dubra, J. Carroll, S. Farsiu, "Open source software for automatic detection of cone photoreceptors in adaptive optics ophthalmoscopy using convolutional neural networks," Scientific Reports, 7, 6620, 2017.
% Re... |
926c639a0633603b57896ab6cc80c4685f7cc925bb0ef357e7178a99b471cf92 | MATLAB | 1,004 | 31 | classdef SprottO < Environment
% SprottO system. CANT FIND RANGES
properties
D = 3; % system dimension
Ranges = [36, -30;
32, -44;
5, -1]; % variable ranges
Params = struct(); ... |
01e45e8806e3b8e949cc9bd64001be5bf28d1143505da3ae44ea0eaf4cdd0504 | MATLAB | 1,005 | 24 | function [stepPerTrialWithSkips,stepsPerTrial] = calc_nSteps_navig(block,choice,initDist)
% block, choice and initDist are all nChoices x 1 vectors, where each row
% is a single choice made the subject in any trial (a path from start to
% target image).
% blocks: the block number of the trial (1-32, depends on the ... |
bbd5474f02ab8d19d682d1766498672c03a0b76d7d8ef5860777e66efa2dba22 | MATLAB | 1,005 | 40 | %% function eroded_mask = erode3d(mask, noisemap)
%
% Description: Function to carry out 3D mask erosion based on a noise-based
% threshold.
% Input
% _____
% mask : logical n-d array masking the local field map
% noisemap : standard deviation of field map estimate (with the
% ... |
d2a708f76e6bf4bd4ee35e54f75853a31b3c22717d6a6999df6bb3dbb55cbdaa | MATLAB | 1,005 | 44 | function [Q E1 E2] = test09()
% function test09()
%
% See personal notes of June 13, 2012
%
% This file is part of Manopt: www.manopt.org.
% Original author: Nicolas Boumal, Dec. 30, 2012.
% Contributors:
% Change log:
% Generate the data
n = 4;
i = 1; j = 2;
k = 3; l = 4;
E1 = zeros(n... |
2c71b42cb8fc8a95bb096800027d5969053a656fcdbd83414f8a68d81aff91a6 | MATLAB | 1,006 | 33 | clear all;
% data=dlmread('data4.txt');
data=readtable('anatExt_decodAccu.xlsx');
X = ones(size(data,1),size(data,2));
X(:,2:size(data,2)) =data(:,2:size(data,2)); %explanatory variables
%X=data(:,2:4); %explanatory variables
H=X*(inv(X'*X))*X'; %hat matrix
Y_hat=H*data(:,1); %second column is the response variab... |
3ac6e4f0cb60354e94d8c8533a871d4e5ee277384c1f0083fed5ffe0c48bfea6 | MATLAB | 1,006 | 36 | function ft_rBBR(input)
% Run rBBR
%
% ft_rBBR(input)
%
% Inputs:
% input - mat-file with all input variables.
%
% This function calls the recursive BBR function in the OpenFmriAnalysis
% toolbox. From an loaded mat-file, all input parameters are ordered in a
% cell structure, i.e. all the needed variables should be ... |
75d4e4f24c08c67cf4047dd26bc5e25950304326d1d25bc606bb8aafa5e804e9 | MATLAB | 1,006 | 32 | % Define global variable NET for testing (needed to format the figure in
% ARTwarp_Create_Figure.m
global NET
% Populate NET.maxNumCategories with some small value (the only field
% used by ARTwarp_Create_Figure.m)
maxNumCategories = 10;
NET = struct('maxNumCategories', {maxNumCategories});
% GENERATE 'dummy' FIGURE ... |
2c76a9860e172c77d29aafa02e36eeb6fb4899c873171a2d4fae37250193fcf3 | MATLAB | 1,007 | 41 | function value = GeneralLogical(a)
%GeneralLogical - Cast input to logical array
%
% USAGE
%
% value = GeneralLogical(a)
%
% a generalized logical: can take values in:
% [true, false, 1, 0, "on", "off"]
%
% OUTPUT
%
% value converted input
% Copyright (C) 2025 by ... |
6df288b7878471b54c9d577fefeb8b11da997e2c5b927dca19d496b729a7eea4 | MATLAB | 1,008 | 35 | %% Restart function
function []=defaultconfiguration(app)
% Clear XTick and YTick for Ax2 and Ax3
app.Ax2.XTick=[];
app.Ax2.YTick=[];
app.Ax3.XTick=[];
app.Ax3.YTick=[];
%Enable panels
panelsToEnable = [app.LoadImagePanel, app.LoadImagePanel_2];
set(findall(panelsToEnable, '-proper... |
9a2b7b915c52851bdd1fe1793a070455a52c10de840737bb18418e998c24202c | MATLAB | 1,008 | 34 | clear
% GO TO THE SUBJECT'S FOLDER AND EXECUTE LINE BY LINE
% Get all text files in the current folder
files = dir('*.json');
% Loop through each file
for iFile = 1:length(files)
% Get the file name
[~, f,ext] = fileparts(files(iFile).name);
%remove the last 18 characters which include date and time, so... |
f0dfa8aa3cea895c2530805e822ef935ecf4a2dc0f4753d414acecd2a753b6b9 | MATLAB | 1,009 | 31 | classdef SprottQ < Environment
% SprottQ system. CANT FIND RANGES
properties
D = 3; % system dimension
Ranges = [13, -10;
8, -6;
22, -11]; % variable ranges
Params = struct(); ... |
839e52d4673da00822f6d8cf839c84252279bc4329a9dbd7d9546d5ceabf2d0c | MATLAB | 1,010 | 41 | function [DataF]=sh_NotchFilter(Data,Fsampling,Fcenter,harmonics)
% apply a notch filter on a time trace. Data can be a matrix or tensor
% [DataFilt]=sh_NotchFilter(movie,fs,60)
% [DataFilt]=sh_NotchFilter(trace,fs,60,2)
dim=size(Data);
if istensor(Data)
DataF=reshape(Data,dim(1)*dim(2),dim(3));
elseif dim(1)<dim... |
113dcd917f0832ba32cdedcf1c17e42171477e3ad767fb5c4505e0b7ce67ba9a | MATLAB | 1,011 | 41 | function Xcov = embed_covariance(X,D,tau)
% Covariance matrix in time delay embedding space
% Xcov = embed_covariance(X,D,tau)
% --- Input
% X : input signal : [Xdim x Tsample x Ntrial]
% D : time embedding dimension (integer)
% tau : delay time in sample number (integer)
% --- Output
% Xcov([i,t1],[j,t2]... |
244e47db73ef5301d2f4f076399f959de2b3cf53c5c6cdb076bb0ae86cc163c7 | MATLAB | 1,011 | 44 | function tapas_sem_empirical_delta_plot(congruent, incongruent, quants)
%% Draws the delta plot from a vector of congruent and incongruent responses.
%
% Input
%
% congruent -- Vector of congruent reaction times
% incongruent -- Vector of incongruent responses
% quatiles -- Quantiles ... |
6088ed712f6a67da2b34d0c5d03995a74e18c47cd716242b7d36256a7a9f81ca | MATLAB | 1,011 | 41 | function nii_type = type_num2nii(type,is_complex)
if nargin < 2
is_complex = false;
end
switch lower(type)
case 'logical'
nii_type = 'binary';
case 'uint8'
nii_type = 'uint8';
case 'uint16'
nii_type = 'uint16';
case 'uint32'
... |
6850f288d31609aadac68f1f05f2a036ed98a7d2247d3ba5a8edd9478a6cbd2c | MATLAB | 1,011 | 41 | function [wave_data, tfp_excitation, tfp_refocusing] = sero_pulseq_getWaveDataAndTimes(seq, blockInd)
% function [wave_data, tfp_excitation, tfp_refocusing] = sero_pulseq_getWaveDataAndTimes(seq, blockInd)
[wave_data, tfp_excitation, tfp_refocusing] = seq.waveforms_and_times(true, blockInd);
[indEx, indRef, indSat] =... |
02177621e61a746c241d98edd34e1d7feb0d2280e2f27d36ac4e7732051e1b10 | MATLAB | 1,012 | 44 | %mM - Show min and max values for any number of variables.
%
% USAGE
%
% mM(x,y,...)
%
% x,y,... variables
%
% Copyright (C) 2012 by Michaël Zugaro
%
% 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 So... |
5a713af5fd29430e1be5118b5b6ae8ff1738ad3ed030d3d116a70d5d737c1f6d | MATLAB | 1,012 | 32 | function [D] = consensus_coclassify(input_cell)
% H Smith, Cambridge, 2020
% Calculate consensus matrix for a series of community partitions
% For an nodes i and j, calculates the proportion of times that i and j are
% in the same modularity group in repeated grouping
% INPUTS:
% input_cell = cell containing ... |
9f2928e22964f5217525c2fbdc6517f07c9b6ba15e17f4e5e89a4fe8bff512b9 | MATLAB | 1,012 | 42 | function [res,RSS] = calc_reg_param(y_real,y_calc)
% calculation of regression parameters
%
% [res] = reg_eval(y_real,y_calc)
%
% INPUT
% y_real: vector of experimental responses (samples x 1)
% y_calc: vector of calculated responses (samples x 1)
%
% OUTPUT
% res is a structure array with fields:
% R2: per... |
dfc4f8bc12a1b8953302525b641ae85029897aa46019272a1d6d95564f619d5b | MATLAB | 1,012 | 32 | function tapas_physio_logo()
% Prints something like a PhysIO Logo in the command window...
%
% output = tapas_physio_logo(input)
%
% IN
%
% OUT
%
% EXAMPLE
% tapas_physio_logo
%
% See also
% Author: Lars Kasper
% Created: 2018-02-17
% Copyright (C) 2018 TNU, Institute for Biomedical Engineering,
% ... |
9a588be67ebc785db892e84621647b1426820e40e0b15968d5803d572500b104 | MATLAB | 1,013 | 16 | %{
vis.SingleDot (manual) # single dot to map receptive field
-> vis.Condition
-----
bg_level : smallint # (0-255) the index of the background luminance, 0 is black
dot_level : smallint # (0-255) the index of the dot luminance, 0 is black
do... |
9a7df00a14ef15f3c05e0db791404c130fff4b61cbb9067d5180be0d2a49dc10 | MATLAB | 1,013 | 34 | function plotAperturePolygon(data, plotParams)
% Plots the skeleton for a specific set of time points, with the aperture
% polygon filled in across the paw
% Configure params
liftBin = find(data.tPts == 0);
tPts = [liftBin, data.collectBin, data.extendBin]; % for figure, using these timepoints
% Create figure
fig;
hA... |
ac2bb3dd2b11bfb5858d34a93e0fcedb6588d0326c0f71c22176ad6b90bb8202 | MATLAB | 1,013 | 49 | function [summary] = tapas_sem_posterior_summary(posterior, time)
%% Generate a summary of the posterior estimates.
%
% Input
% posterior -- Estimate from the model.
% Output
% summary -- Summary structue computed from the posterior.
%
% aponteeduardo@gmail.com
% copyright (C) 2019
%
... |
d0c686ac2867b61ef784f097168d1438a3e36b4f4b37d0e8c30803de63a935de | MATLAB | 1,013 | 31 | function outputTable = tapas_uniqc_transpose_table(inputTable)
% transposes Matlab table object (rows->columns, columns->rows)
%
% outputTable = tapas_uniqc_transpose_table(inputTable)
%
% IN
%
% OUT
%
% EXAMPLE
% tapas_uniqc_transpose_table
%
% See also
% Author: Saskia Bollmann & Lars Kasper
% Created: 2020... |
4f9554cebe1b7df6ef90a7fca815eac8a1a0cf4565b13e29aaeb035b0576df66 | MATLAB | 1,014 | 29 | %{
aodpre.Sync (imported) # stimulus synchronization
-> aodpre.Scan
-----
-> psy.Session
first_trial : int # first trial index from psy.Trial overlapping recording
last_trial : int # last trial index from psy.Trial overlapping recordin... |
dff63ff1dcb119d724746ebb1d2165daf40135f05f43d69072de16af65f4cd94 | MATLAB | 1,014 | 30 | %% addon_config
%
% Description: Addon script to incorporate new method to the SEPIA framework
%
% Kwok-shing Chan @ DCCN
% k.chan@donders.ru.nl
% Date created: 27 June 2020
% Date modified: 22 June 2021
%
% DO NOT change the variable names, update the variable value instead
%
%% main
% This name will be used thorough... |
0f568da6747723a8fe3e8ee76163492079d933e834e68c101d9681c5585308d8 | MATLAB | 1,015 | 34 | function [output] = mean_of_rows(traces,row_groups)
% average rows in traces that belong to the same 'row_group'
if size(traces,2)>1
if iscell(row_groups)
num_rows = numel(row_groups);
output = nan(num_rows,size(traces,2));
for r = 1:num_rows
output(r,:) = nanmean(traces(r... |
3765bf30f4fb2033817939cf2bca27845865d1528900f7c123e868b1e1cd5a2f | MATLAB | 1,015 | 24 | % Regenerates the coordinate-lookup ground-truth fixture used to validate
% channel_layout.py's get_coords_from_layout() against MATLAB's
% getCoordsFromLayout.m directly. Prints channel/coord counts; save the
% .mat and diff channels/coords array-for-array in Python (see
% src/meanap/pipeline/channel_layout.py's docst... |
50afe6750f83f0624a84b7bde87379b9534b6e854e63b61a2b709238a58faa3b | MATLAB | 1,015 | 40 | function c = catToColor(f, pal)
% FORMAT c = catToColor(f, pal)
% f - categorical (4D) image.
% pal - palette (Mx3 array or handle to palette function) [hsv]
%
% Generate an RGB volume from a categorical (e.g. responsibilities) volume.
if nargin < 2 || isempty(pal)
pal = @hsv;
end
tri = fals... |
3827bb3676a6066fb2548eb3dda0a477c42e466621d25428441205fd435d6fc4 | MATLAB | 1,016 | 20 | % Map the numerical elements in the vector "v" onto the variables "s" which can
% be of any type. The number of numerical elements must match; on exit "v"
% should be empty. Non-numerical entries are just copied. See also any2vec.m.
function [s v] = vec2any(s, v)
if isnumeric(s)
if numel(v) < numel(s)
error('The... |
6c548349529919c908ee57bd9004c6b9e0a07d9f1f3265c244e6f39112f2f6b4 | MATLAB | 1,016 | 32 | classdef SprottM < Environment
% SprottM system.
% CANT FIND RANGES
properties
D = 3; % system dimension
Ranges = [35, -2.5;
244, -244;
70, -64]; % variable ranges
Params = stru... |
71e0eb09a73f94b253b542822de2df8900a4f6589431287c98d7bdb5675aaa83 | MATLAB | 1,017 | 45 | function [Mend] = bloch_rotate(Mstart, T, B)
%
% FUNCTION TAKEN FROM>
% https://github.com/LarsonLab/MRI-education-resources/blob/main/Physics/bloch_rotate.m
%
% bloch_rotate - compute the rotation of the net magnetization for a given magnetic field
%
% INPUTS
% Mstart - initial magnetization
% T - duration [ms]
% B = ... |
9452283361395a14d51c4be8a9b10e1d875ccc25794be7ffdfe36106e0aaddbb | MATLAB | 1,017 | 48 | function RHSdiv = divergenceTermCylindrical1D(F)
% This function calculates the divergence of a field using its face
% average value and the vector u, which is a face vector
%
% SYNOPSIS:
%
%
% PARAMETERS:
%
%
% RETURNS:
%
%
% EXAMPLE:
%
% SEE ALSO:
%
% Copyright (c) 2012-2016 Ali Akbar Eftekhari
% See the license fil... |
bec02dc094002f87e7b8ea6922b89d605c83184f68bda41588fb7819fb688034 | MATLAB | 1,017 | 27 | % (C) Copyright 2020 CPP visual motion localizer developpers
function saveResponsesAndTriggers(responseEvents, cfg, logFile, triggerString)
if isfield(responseEvents(1), 'onset') && ~isempty(responseEvents(1).onset)
for iResp = 1:size(responseEvents, 1)
responseEvents(iResp).onset = ...
... |
c52f50d97cfd6f0a597c9c9ca263086587fbe9f65e0cef4293ac2f78c8745f0b | MATLAB | 1,017 | 32 | %LC Mayo 2010.
%A partir del S_index toma cada renglon para comparar todos los picos que
%tengan alguna similitud entre ellos. (>20%)
%Finalmente determina el indice de sobrelape (promedio) de todos los picos
%que comparten celulas.
function [Div_index_mean]=compara(S_index,Rasterbin)
[cells,pks]=size(Rasterbin);
fo... |
6bbb4e252c714f9cf044718ccfd03c4e8aa0ae7c1b6866c43ca37cbcbf7fcc36 | MATLAB | 1,018 | 32 | function y = tapas_autocorr(x)
% USAGE:
% Y = tapas_autocorr(X)
%
% INPUT:
% X - n-by-m matrix of m time series (columns) of length n
%
% OUTPUT:
% Y - n-by-m matrix with m columns of autocorrelation coefficients for lags n-1
% -------------------------------------------------------------------------------... |
dd22e27f239915702ba2c7d3e87893918bd8269e59ebd76c8a5b7258af038031 | MATLAB | 1,019 | 36 | function params = motimus_get_params()
% Extract current machine name
[~, hostname] = system('hostname');
hostname = deblank(hostname);
% Add a case for your own machine
if strcmp(hostname, 'mac-BX22-210.local')
experiment_path = ['/Users/segoleneguerin/Documents/research/' ...
'motimus/empirical'];
else... |
f391c6d49e924fcefc83e1061061c8d4c0561d537975284dcf8981f2c4a5ace2 | MATLAB | 1,019 | 39 | function [d_fr, d_iti, idx] = get_dFRdITI(neuron, S, A)
% look twin sec around the event
twin = [0 0.3];
T = neuron.xvec.(A{1});
[~,t1] = min(abs(T-twin(1)));
[~,t2] = min(abs(T-twin(2)));
% filter out outliers in ITI
cutoff = [prctile(S.iti,2), prctile(S.iti,98)];
fprintf('ITI cutoff (s): %.2f, %.2f\n', cutoff)
ITI ... |
2f10e1c574def65ca9d7f898c141a45718405a93c2672c48dea0c3b3a4d59c26 | MATLAB | 1,020 | 40 | function E = sero_pulseq_trb2pos_v2(tr, b, dz, spacing)
% function E = sero_pulseq_trb2pos_with_gap(tr, b, dz, gap_factor)
% tr = position-wise repetition times in seconds
% b = shot-wise b-values in s/m2 with arbitrary scale
% dz = step distance in meters
% spacing = factor to determine the gap between positions (1 ... |
325ed3fd1cad5b601952b0e8ddbace32b3aac781efcebd10567b7fcd6189dae2 | MATLAB | 1,020 | 36 | function [pdata_avg, pdata] = get_avgFl(datadir, region, sensor, datatype)
basedir = fullfile(datadir, 'data-published\PhotometryDataAligned');
[region, sensor] = standardizeInputs(region, sensor);
fulldatadir = fullfile(basedir, strcat(sensor, '_', region));
if strcmpi(datatype, 'volume')
namepattern = '*_avgFby... |
3736ff5c3844601095aae06e54d77426dea7a215ca63a051d4871519822e7a56 | MATLAB | 1,021 | 39 | function varargout=relabel_region(reg,varargin)
% [reg,regList,minorReg]=relabel_region(reg,...)
%
% default values
% minCellNum=5;
% coreReg={'vCA1','vCA3','vSub','BLA','LA','CeA','PrL L2/3','PrL L5'};
%
%%
param.minCellNum=5;
param.coreReg={'vCA1','vCA3','vSub','BLA','LA','CeA','PrL L2/3','PrL L5'};
%%
param=parsePar... |
3be3952e46b83d9c24e2258698c3d0157adc7cd38526270a423032b15177282d | MATLAB | 1,021 | 28 | function obj3 = bsxfun(f, obj1, obj2)
if isa(obj2, 'mmo'), error('bsxfun does not work yet with the second argument being a memory mapped object'); end
data1 = memmapfile(obj1.dataFile, 'writable', obj1.writable, 'format', { 'single' obj1.dimensions 'x' });
data2 = obj2;
% make new memory mapped data ... |
717c1771c59263b6d1d86a3f22dbf990d7d2d2bc4efb64ecff6fff232f3fa5a9 | MATLAB | 1,022 | 34 | function [ordering,groupbreaks] = time2peakByCluster(X,ops)
%does time 2 peak by subgroups of data
%
%Inputs:
%X: (nn x nt) data of interest, nn neurons, nt time points
%ops: structure with following
% useZScore: do normal sorting on X, or z score it first
% grouping: (nn x 1) vector of integers, assignign each to ... |
cf559933bcd1e2f2d1003cd6d38a55ba1c6b3a58f6cfb6568c4e2cad0419ef7d | MATLAB | 1,022 | 28 | function candoit = canGetHessian(problem)
% Checks whether the Hessian can be computed for a problem structure.
%
% function candoit = canGetHessian(problem)
%
% Returns true if the Hessian of the cost function can be computed given
% the problem description, false otherwise.
%
% See also: canGetCost canGetDirectionalD... |
11ef26ba13c8f04174cefcbdccab298197a25507712a6e0cf319c3137b8e023c | MATLAB | 1,023 | 45 | function meas = fun_clusterConsistency(lab1,lab2)
%function to check cluster consistency, relative to labeling 2, as
%MI(lab1,lab2)/H(lab2)
%sample script to show how the similarity measure changes with probability
unique1 = unique(lab1);
unique2 = unique(lab2);
n1 = numel(unique1); %classes in lab1
n2 = numel(unique2... |
c5001af3f791bc9bb41be27c0bf8cd4be892937feea5b37ac08ce95529923452 | MATLAB | 1,023 | 41 | function [X, Y, Z] = cellLocations(m)
% X = cellLocations(m)
% this function returns the location of the cell centers as cell
% variables. It can later be used in defining properties that are variable
% in space.
%
% SYNOPSIS:
%
%
% PARAMETERS:
%
%
% RETURNS:
%
%
% EXAMPLE:
%
% SEE ALSO:
% faceLocations
% Copyright ... |
c5c73c50680de023d03829f141f9f3c263808f7a9daa0a7eb32530a909b2b266 | MATLAB | 1,023 | 36 | % takes files from autoqc_nsd_grand.m...
files0 = matchfiles('~/nsd/ppdata/NSD???-glmdata-glmBASIC/grand.mat');
cmatrix = {};
for p=1:length(files0)
a0 = load(files0{p});
cmatrix{p} = a0.cmatrix(2:end,2:end); % we want only the core NSD
end
% visualize
figureprep([100 100 1200 600]); hold on;
for p=1:8
subplot... |
e2805032107ef9e7647d6c6e54ca224f3271346bc2c6b113231c02adbffb499a | MATLAB | 1,025 | 32 | classdef SprottL < Environment
% SprottL system.
% CANT FIND APPROPRIATE RANGES
properties
D = 3; % system dimension
Ranges = [32, -9;
118.5, 1;
17, -16]; % variable ranges
Para... |
e906cd09ea9381264efe0130deec7cf3a2d49a4202986ac5a6a28816fa828953 | MATLAB | 1,025 | 34 | function [] = load_overlay ()
%%load_overlay: Load overlay information
global info
global dat
[~, headers, ~] = xlsread(info.calledfile, 'Overlay');
alphabet = ['A':'Z'];
% Determine number of overlay events
[I, J] = find(contains(headers, {'Behavior', 'Event', 'Category', 'Type'}));
info.overlay.Num = size(headers(... |
8796508ba671d381072aef96e31988287ed74c988a113e4e712d3dce6fc82d39 | MATLAB | 1,026 | 28 | function [stage_coord] = GetStageCoordinates(image_coord, PathName, ui0)
%GETSTAGECOORDINATES Loads conversion variables and converts image to stage
%coordinates
%
% - 'image_coord' must be a two-column vector, where the first column
% corresponds to the x and the second column to the y image coordinates.
% ... |
8f6d1cf17a495c37f9e565af198a6cb1871a019f1c4eff56ed5e53008a6de5cb | MATLAB | 1,026 | 35 | function violins(hA, vals, names, cmap, axvals, ax, alpha, mrkSz, linesmin, linesmax, nlines)
if nargin < 6
linesmin = 1;
end
if nargin < 7
linesmax = 1;
end
if nargin < 8
nlines = 5;
end
% Loop over columns with VE data
for col = 1:size(vals,2)
if strcmp(ax, 'y')
axval = [axvals(col), 0];
... |
426c0a79afc028ef73ae738bb1d0bf22763259488fe9e98f9b1fb79a34b0245a | MATLAB | 1,027 | 32 | classdef SprottD < Environment
% SprottD system.
% CANT FIND WELL BEHAVING ATTRACTOR.
properties
D = 3; % system dimension
Ranges = [10, -10;
15, -10;
20, 0]; % variable ranges
P... |
4b1067bf25acd54e71e4e0f6fe3be986df0e812c442cc37b63f81165508e13c5 | MATLAB | 1,027 | 34 | function [CI] = compute_CI(numVec, zValue)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% compute_CI computes confidence intervals of given vector of numbers.
% Formula is: µ ± z* σ/√n.
% Check https://tinyurl.com/54adtnuy for common z-values.
%
%
% Arguments:
% numVec = Number vector... |
bbe5f2a17ac1d1d8898e5f4b01124b332075f312cbaca776e3b3143793a7b413 | MATLAB | 1,027 | 27 | function [ sig_coactivity , shuff_coactivity ] = findSignificantCoactivity( X , opts )
%FINDSIGNIFICANTCOACTIVITY( X , opts )
%
%
% === Jan Moelter, The University of Queensland, 2018 ===================
%
[ T , ~ ] = size( X );
shuffle = @( X , d ) cell2mat( cellfun( @(x) x( reshape( randperm( numel( x ) ) , size(... |
ae22c9ab39939d6158999c85fa714da447475d771a319de75d8c44ff4b1ea606 | MATLAB | 1,028 | 25 | function [rawdata, headerinfo] = Readfile(PathName,FileName)
%% reads a force file
% The next loop check for different Versions of Headers with different
% settings. It does NOT contain all possibilities, and will also have
% to be given alternatives after JPK updates etc.
filename = fullfile(PathNa... |
f2ffb919f0e9a2db83319f460928ea25380dbfbd069fb701dc5c23aafeac0e85 | MATLAB | 1,028 | 31 | function [spikeMatrix] = SpikeTimesToMatrix(spikeTimes,fs,method,Info)
% Convert spike times to spike matrix
% TODO: can replace spikeDetectionResult with just fs, since
% spikeDetectionResult may not always be available
% -------------------------------------------------------------------
% C... |
9a5c9998fd4987afce05d7c0ca6e8368b559f61066b390d2c8b65b9eba7ccb12 | MATLAB | 1,029 | 68 | function [t, tr, b, w] = sero_srr_sampling_conventional(ts, n, a, z, do_interleaved, start_pos)
if nargin < 1
[ts, n, z] = sero_srr_default_image_pars();
[t, tr, b, w] = sero_srr_sampling_conventional(ts, n, 1, z, 0);
a=1;
clf
sero_srr_plot_sampling_stats_v2(tr, b, w)
return
end
if nargin < 5
... |
d397e2d56c1c92ec6f6ad29b9e284bfd7646c0f7a0320331fb423230463bebca | MATLAB | 1,029 | 22 | function [ Cells_coords, Pools_coords ] = Search_edos_coords( Cells_edos, sis_query, Coordactive )
%Encuentra las coordenadas de las celulas pertenecientes a cada estado y
%las coordenadas de los grupos base. Cells_coords son las coordenadas de
%cada estado [x,y,edo] Pools_coords [x,y,edo] Cells_edos: celulas de cada
%... |
9f91e653232c59e67cee509c54af962f4d2e4849b25426fb7deabedae34152fd | MATLAB | 1,030 | 49 | function J = costaccfun_withbias(param,x,y,delta,usepriors)
if nargin < 5
usepriors = false;
end
if nargin < 4
delta = zeros(size(x));
end
mu = 0;
sigma = param(1);
lapse = param(2);
if length(param) < 4
param(3:end) = 0;
end
bias_amplitude = param(3);
bias_width = param(4);
constant = sqr... |
f4df03362bcab1d6a33d683eab3ca557cb4947d17509b03c4222971108239295 | MATLAB | 1,030 | 30 | %% addon_config
%
% Description: Addon script to incorporate new method to the SEPIA framework
%
% Kwok-shing Chan @ DCCN
% k.chan@donders.ru.nl
% Date created: 27 June 2020
% Date modified:
%
% DO NOT change the variable names, update the variable value instead
%
%% main
% This name will be used thorough the SEPIA f... |
000567d57a9b2c96e5fefe53264c56fa2a9ea9cf7568e4aa6840c05cd037df55 | MATLAB | 1,031 | 40 | classdef Scale < dagnn.ElementWise
properties
size
hasBias = true
end
methods
function outputs = forward(obj, inputs, params)
args = horzcat(inputs, params) ;
outputs{1} = bsxfun(@times, args{1}, args{2}) ;
if obj.hasBias
outputs{1} = bsxfun(@plus, outputs{1}, args{3}) ;
... |
3749cdbf1f8aa7c7867b12105b1047d65f52e0fcb9aadf5162a1b140363a3570 | MATLAB | 1,032 | 30 | %% addon_config
%
% Description: Addon script to incorporate new method to the SEPIA framework
%
% Kwok-shing Chan @ DCCN
% k.chan@donders.ru.nl
% Date created: 3 August 2022
% Date modified:
%
% DO NOT change the variable names, update the variable value instead
%
%% main
% This name will be used thorough the SEPIA ... |
7babf8f77b8a5d1db6cfd3a7c2e9b06b9364b1fd0d5a360b03e12a9b307fac18 | MATLAB | 1,032 | 38 | function isEqual = uniqc_isempty(this)
% Tests whether an object is empty, i.e. whether it equals a newly created
% object from the same class.
%
% Y = MrDimInfo()
% Y.uniqc_isempty()
%
% This is a method of class MrDimInfo.
%
% IN
%
% OUT
%
% EXAMPLE
% uniqc_isempty
%
% See also MrDimInfo
% Author: Saskia B... |
adc0b00a1885e0ad160bc14b41d33dc61bbe148c9b59afea2e944ec0b7d2c73e | MATLAB | 1,032 | 39 |
bestmatch_d = @(c1,c2) 1 - numel( intersect( c1 , c2 ) ) / numel( union( c1 , c2 ) );
bestmatch_score = @(A,B) 1 - bestmatch( bestmatch_d , A , B ) / ( 1 * ( numel( A ) + numel( B ) ) );
printConsoleSection( 'EMBEDDED ASSEMBLY CONFIGURATION' );
A_ = CALCIUM_FLUORESCENCE_mat.parameter.assembly_configuration;
A_ = c... |
7d3f4561519e7e0d4ca07fa1ae222123f8f6bfbae700deaf929da38231cb8ba2 | MATLAB | 1,034 | 40 | classdef Scale < dagnn_bc.ElementWise
properties
size
hasBias = true
end
methods
function outputs = forward(obj, inputs, params)
args = horzcat(inputs, params) ;
outputs{1} = bsxfun(@times, args{1}, args{2}) ;
if obj.hasBias
outputs{1} = bsxfun(@plus, outputs{1}, args{3}) ;... |
b390b60d4d71a1c31fe362edf05c8f7b8e9cf522cb7ce0aede46c44a3d451f16 | MATLAB | 1,034 | 29 | function [shapeGrid,nComb] = get_paramGridShapeComb(paramGrid)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% get_paramGridShapeComb returns shape of parameter grid and total number
% of parameter combinations.
%
% Arguments
% paramGrid = Structure including parameters.
%
% Output
% ... |
d32f0fefacc45306d0e150f2e3c3c479337e91b6c5306b2a465eb5a94bea5220 | MATLAB | 1,034 | 32 | function X = tapas_nearest_psd(X)
% Finds the nearest positive semi-defnite matrix to X
%
% --------------------------------------------------------------------------------------------------
% Copyright (C) 2020 Christoph Mathys, TNU, UZH & ETHZ
%
% This file is part of the HGF toolbox, which is released under the term... |
702dcb3c2e1516e2bd2fc0dde621b46dd82ab1c928aec0625b888ab5edbf845c | MATLAB | 1,035 | 39 | function ind = plotdprime(hmat,T,xvec,varargin)
% inputs:
% hmat: hmat of the data you want to plot
% T: index of hmat you want to plot
% times: axes times corresponding to the T values of the hmat
% varagrin =
% 1 sort time to peak
% 1 win1 2 win2
load("\\constantinoplelab.cns.nyu.edu\server\M... |
95c593ecee1f04a24c503e71d7c18776df59ddc3c137d3738dba54d4d902d30e | MATLAB | 1,035 | 34 | function [dWU,W, U, Weight,Topchan] = SVD_template(dWU, Nrank,criteria)
[nt0, Nchan ,Nfilt] = size(dWU);
W = zeros(nt0, Nfilt, Nrank ,'single');
U = zeros(Nchan, Nfilt,Nrank, 'single');
Weight = zeros(Nrank,Nfilt,'single');
Topchan = zeros(Nfilt,1);
dWU(isnan(dWU)) = 0;
for i=1:Nfilt
if(isempty(nonzeros(dWU(:,:... |
c4b57d0a684785d387b7ade7a30063811e118722fac35cf9012265b774e713e8 | MATLAB | 1,035 | 39 | function [num_type,is_complex] = type_nii2num(nii_type)
is_complex = false;
nii_type = strsplit(nii_type, '-');
nii_type = nii_type{1};
switch lower(nii_type)
case 'binary'
num_type = 'logical';
case 'uint8'
num_type = 'uint8';
case 'uint16'
n... |
8b747c9d39ca112dda639bd3c27b3507d597d4c24e18d5b0f59651a1b3f06232 | MATLAB | 1,036 | 40 | function nbrs=surfing_surface_nbrs(f)
% Finds the neighbours on a surface
%
% INPUT:
% F Nx3 face matrix for N faces
% OUTPUT:
% NRBS NxP neighbour matrix, if each node has at most D neighbours
% The K-th row contains the neighbours of node K, and values zero
% if node K has less than P neighbo... |
190c4738e0c8d2e27ca08d86eae8be4bd9fdcf2d2b16c939c115c435c8644a69 | MATLAB | 1,037 | 30 | function mustBeLogicalScalarOrEmpty(A)
%MUSTBELOGICALSCALAROREMPTY Validate that value is generalized logical scalar or empty
% MUSTBELOGICALSCALAROREMPTY(A) throws an error if A isn't one of: false, true, 0, 1, "off", "on", [].
% Copyright (C) 2025 by Pietro Bozzo
%
% This program is free software; you can redistri... |
631db8c9a391e5a8c4cec08205a86a572e8dc1b48ce772d1ffd372787e922ee1 | MATLAB | 1,037 | 34 | function map=vec2map(vec,mask)
% USAGE
% map=vec2map(vec,mask)
%
% FUNCTION
% to convert space column vector vec into a spatial map of dimensions of array
% mask. mask is a logical array whose true values must correspond to
% vec in number and order.
%
% the returned maps are zero, wherev... |
67ee30e3bd47c794da96c884f2b0796486ad87825844f7eb9d607d1939cb23f5 | MATLAB | 1,038 | 65 | %clear all
%fname = 'D:\MatData\umeda data2\modified_motion01_03.mat';
%%load(fname)
%
%ydata = ydata(2:3,:,:);
%
%xdata(:,:,ind) = [];
%ydata(:,:,ind) = [];
%fsave = 'test_spike.mat';
%
%load(fsave)
ypred = predict_output(xtest, Model, parm);
ydev = predict_variance(xtest, Model, parm);
ymin = mi... |
f7c5d1291fd22015d29786151835fb7c97f23d56cf181581fb62e0ca555a60f5 | MATLAB | 1,038 | 46 | function [model] = tapas_sem_hier_model(data, ptheta, pars)
%% Set up the model.
%
% Input
% hgf -- Hgf model.
% pars -- pars structure.
% Output
% model -- Model structre.
%
% aponteeduardo@gmail.com
% copyright (C) 2016
%
%% Define the model.
%
% aponteeduardo@gmail.com
... |
5837a1c6aa62e922823b323cfa3e261824c453720c2126aaad3019c5e9d53d21 | MATLAB | 1,039 | 32 | classdef SprottI < Environment
% SprottI system.
% DONT KNOW HOW TO INITIALIZE WITHOUT IT EXPLODING.
properties
D = 3; % system dimension
Ranges = [10, 10;
10, 10;
10, 10]; % variable ran... |
5daba89546bf132728c6dc527fa589eb0f22a180a7d269c2aca43d76ca5dfe1d | MATLAB | 1,039 | 29 | % Please cite this paper if you use any component of this software:
% D. Cunefare, L. Fang, R.F. Cooper, A. Dubra, J. Carroll, S. Farsiu, "Open source software for automatic detection of cone photoreceptors in adaptive optics ophthalmoscopy using convolutional neural networks," Scientific Reports, 7, 6620, 2017.
% Re... |
6fec0e59ca4e12dfdceb1846882bb1bbc37694c45315809cc22cd4a39fd87b9a | MATLAB | 1,039 | 34 | function [dim] = pos2dim(pos)
% POS2DIM reconstructs the volumetric dimensions from an ordered list of
% positions.
%
% Use as
% [dim] = pos2dim(pos)
% where pos is an ordered list of positions.
%
% The output dim is a 3-element vector which correspond to the 3D
% volumetric dimensions
%
% See also POS2TRANSFORM
% ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.