sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
f21d88536efd237de2427f158ff13db624ecc2459032835507c2dfcd2d1191be | MATLAB | 1,320 | 33 | function params = parse_params(dflts, varargin)
%parse_params - Helper function for parsing parameter values
%
% This function is not intended to be called directly.
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% This program is free software: you can redistribute it and/or modify
% i... |
098c4c082d7f66c79bbedfaa08c2d8296cb7a62c0e38a2b6eab43fdf2d7493bf | MATLAB | 1,321 | 27 | function baseName = FindSessionPrefix(basePath, flyInd, stackInd)
% FINDESSIONPREFIX - Find prefix of data for a particular fly
try
search_string = fullfile(basePath, sprintf('*fly%d*', flyInd));
listing = dir(search_string);
flyFolder = fullfile(basePath, listing(1).name);
search_stack_str = fullfil... |
9e44968652d6f8926359f9f8bbb0898fa70bf20bd0cece75bd2202eeaa92ab69 | MATLAB | 1,321 | 39 | function [params,synFun,full_model] = synDetrend(f,P,nPeaks,fitType,startPoint)
% MATLAB wrapper for detrending.py
myPath = strrep(fileparts(mfilename('fullpath')),'\','/');
if(nargin<3)
nPeaks = 3;
elseif(~isnumeric(nPeaks) || nPeaks>4)
error('nPeaks must be an integer less than 3')
end... |
a5c97dcb0b6fdc117cf6ee1dc10b35d6f2c2dcf1132d1587990c9d17cea23362 | MATLAB | 1,324 | 36 | function reduced_data = reduce_data_by_laplacian_eigenmap(data, p_neighbors, number_of_reduced_dimensions)
rng(0);
N = size(data, 1);
% Changing these values will lead to different nonlinear embeddings
knn = ceil(p_neighbors*N); % each patch will only look at its knn nearest neighbors in R^d
%... |
c2b3d92900929247e1b7c9d2bcd2c2fa8bffdda8152555564dc48bc53523d8dd | MATLAB | 1,327 | 28 | function [] = LK_report_ft_timelockstatistics(outFT)
%
% LK_report_ft_timelockstatistics reports significance information
% contained in the output from ft_timelockstatistics.
%
% Use as: [] = LK_report_ft_timelockstatistics(outFT);
%
% Input: outFT, which is the output structure from ft_timelockstatistics.
%
% Lukas K... |
2c3233684026c60871e27bc853f3c33c1990837125093301766e81236bd33def | MATLAB | 1,329 | 33 | % TFCE Toolbox
% Version 349 (TFCE1.3.3) 2026-08-11
% __________________________________________________________________________
% Copyright (C) 2020 Christian Gaser christian.gaser@uni-jena.de
%
% $Id$
% ==========================================================================
% Description
% ======================... |
65ac6c83e7dfcec1bf9aa6281fc556ca1030a5720c845c1de5578e1179d4268c | MATLAB | 1,331 | 59 | function analogOutput_Continuous
% Play a continuous sine wave out of an analog output
%
% function daqtoolbox.AO.analogOutput_Continuous
%
%
% Instructions
% Connect AO0 of NI device Dev1 to an oscilloscope and run this function.
% Quit with ctrl-C.
%
%
% Rob Campbell - Basel 2016
%
% Also see:
% vidrio.AO.hardwareCon... |
2a0f6d11a27bd5c16e26290b958c304292f104f2438e38c43b3a60a69a4b624c | MATLAB | 1,336 | 52 | function pulseDuration_ms = checkTimeAveragedPower(hZP)
% Check the time-averaged power of a stimulus set. We want to know
% whether the system is generating the same power per pulse over
% stim number
chanSamples = hZP.stimConfig.chanSamples;
samplesPerSecond = hZP.settings.NI.samplesPerSecon... |
90c3e754f74466869f2a95fdcaf725ad03b3eaa3da2fffce259a383597cd6f97 | MATLAB | 1,336 | 38 | function varargout = check_rawImg(self, rawImg)
%check_rawImg - Class method to check that a rawImg meets the requirements
% to be added as the rawImg property in IRawImg objects.
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% This program is free software: you can redistribute it and/o... |
67d6857b608bc02b1e455ae6d7ad9ac1c0d1618d207ccf70fa22154dd7357c55 | MATLAB | 1,337 | 37 | function clear_unwanted_wngs(IDsOff, lastMsgPre, lastIDPre)
%clear_unwanted_wngs - Helper function to clear unwanted warnings
%
% This function is not intended to be called directly.
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% This program is free software: you can redistribute it an... |
800a25c871a94e2314e3297dcd5747ba0ecd523f652a72a6cc478260895c2fc4 | MATLAB | 1,337 | 38 | function tf = issubclass(subClassStr, superClassStr)
%issubclass - Check if a class is a subclass
%
% TF = issubclass('subclass', 'superclass') returns a binary flag
% specifying whether 'subclass' is a subclass of 'superclass'.
%
% See also subclasses, metaclass
% Copyright (C) 2017 Matthew J.P. Barrett, Kim... |
33ecc97e60a1ca5faaf131ab7967e7eb443badda7fc57fb3d22f08f77ab465f1 | MATLAB | 1,338 | 50 | function order = makeorder(numconds,trialspercond)
% Generates counterbalanced order of conditions.
% Written by KGS Lab
% Edited by AS 8/2014
% check that numconds is a factor of trialspercond
numtrials = numconds*trialspercond;
if (numtrials/(numconds*numconds)) ~= round((numtrials/(numconds*numconds)))
error('T... |
ae85ff952a0cb825a4b25a2dbd587fbffdcb2c5bb1b5b838eb91c789a025cc3a | MATLAB | 1,339 | 61 | function [fn,savename]=st_recon_plot_ecc(DT,params,roiList,plotDir)
polar_radius = 12;
polar_dim = 61;
x = linspace(0,polar_radius*2,polar_dim);
x = x - mean(x); y = x;
% close all; clc;
saveNames = { 'fov_recon.mat', 'peri_recon.mat'};
counter = 1;
fn = figure('position',[ 0 0 900 50... |
13dac89d64f4bed8a96d22d0e5231712d9713aa6c879ca5f0c4c92800851723a | MATLAB | 1,340 | 50 | clear
close all force
warning on
hWB = waitbar(0,'checking the trials ...');
%load tirals info
load('a0_0_bhv2trialStrct.mat');
I = arrayfun(@(x) isfield(x.analyze,mfilename), dataTrl);
if any(I)
I(I) = arrayfun(@(x) x.analyze.(mfilename), dataTrl(I));
end
nTrialAllNext = 0;
iTrialAll = 0;
NTrial = find(~... |
481a0051d6b51a4bb1929561f09947d82cf0aebd7cc084a94def4ae384e9509c | MATLAB | 1,341 | 42 | function pac_plot_fun(pacmat, ph_freq_vec, amp_freq_vec, measure,...
structure1, structure2, dataset)
% function pac_plot_fun(pacmat, ph_freq_vec, amp_freq_vec, measure,...
% structure1, structure2, dataset)
%
% This function plots a PACgram.
%
% INPUTS:
%
% pacmat - matrix of PAC values to be plotted
% ph_freq_v... |
7bf770cd7d2a1e230e48ca88a2a09c279c0625c131971ccdf1926cce1b24334d | MATLAB | 1,347 | 44 | % INPUTS:
% Data -- Standardized data you want to model. Rows are observations,
% columns are features.
% y -- the dependent variable being predicted
% ShowPlot -- enter "1" if you want to see plots for the optimization,
% enter "0" otherwise
% OUTPUTS:
% Mdl -- the optimized SVM model
% r -- the predicted values of... |
2a4c3d0126506828aa48ff30d50a84a0c75f6df8b1d21d872bd828c8e47738b1 | MATLAB | 1,348 | 45 | % INPUTS:
% Data -- Standardized data you want to model. Rows are observations,
% columns are features.
% y -- the dependent variable being predicted
% ShowPlot -- enter "1" if you want to see plots for the optimization,
% enter "0" otherwise
% OUTPUTS:
% Mdl -- the optimized SVM model
% r -- the predicted values of... |
fd5f000aa265d84cd4434f7845830d8e04354d1f6a14419b747baf21902a97c3 | MATLAB | 1,348 | 46 | function runThroughAllStimPoints(varargin)
% Demo showing how to present stim at each location for a short time
%
% function runThroughAllStimPoints(varargin)
%
% Purpose
% Demo showing how to present stim at each location for a short time. Does not make
% any log files. Absolute minimal exa... |
c5e7156d406d4cebd979a3c9bbf6948484f73eeb162fe5e9f6db7e52179d6ce5 | MATLAB | 1,350 | 42 | %%
% Reproduces the plot illustrating effect of ensemble spread (Fig. 2B)
%
% Function inputs:
% cellTable: structure containing neuron data
% cellCond: a vector of 1's and 0's that denotes which cells should be
% included (e.g., only non-offTarget cells)
%
%%
function [ensResp] = Fig2B(cellTable,cellCond)
%... |
d1b1ba350f9cd16d7787b525fff42304593efbb7247937c8cb71661cc3dc9562 | MATLAB | 1,350 | 31 | function [cfg, X, clabel] = mv_preprocess(cfg, X, clabel)
% Applies a preprocessing pipeline to the data (train or test).
%
% This function is usually called automatically from within the high-level
% functions such as mv_classify_across_time.
%
% Usage:
% [cfg, X, clabel] = mv_preprocess(cfg, X, clabel)
%
%Parameters:... |
462fdef9da587c23f73b37045de198727ecb583a407000f80ad8454d959fc176 | MATLAB | 1,351 | 39 | function [nsyn, syn_ids, syndens] = getsynnum(tree,syn_dens,regions)
rng('shuffle')
for r = 1:numel(regions)
ind = tree.R==find(strcmp(tree.rnames,regions{r}));
nodes{r} = find(ind);
len = len_tree(tree);
region_len(r) = sum(len(ind));
tot_nsyn = round(syn_dens*region_len(r));
if tot_nsyn >... |
83de4e81b616f22df6b6edc964dee024e9ffa160510b4c9b6e4df01245414dfc | MATLAB | 1,351 | 47 | net = alexnet;
net.Layers
% -- remove fully-connected layers from AlexNet
lgraph = net.Layers(1:end-3);
numClasses = 12;
% -- create appropriate fully-connected layers for our dataset
lgraph = [
lgraph
fullyConnectedLayer(numClasses, 'WeightLearnRateFactor', 20, 'BiasLearnRateF... |
1ee76eab2472addd17cd33641d89224030b1b4410aa62e745622645d1b43df48 | MATLAB | 1,352 | 63 | function [trial,nStim] = st_mkTrial(stimprm,fs)
% function [stimulus, time] = st_fMRIStimulus(with0OrNot)
% INPUT -------------------------------------------
% stimprm: [variations X prms]
% prms = [on off trialDur framerate]
% on, unit: nFrame
% off (isi), unit: nFrame
% trialDur, unit: secon... |
b9fa7fc6e3041eb54308fa6dcf6d1b164abfe74f183557d79173a4f063892653 | MATLAB | 1,352 | 21 | load('Fig3DiscriminationEffect')
for ntp = 1:49
[h,p(ntp),dc,stats] = ttest2(avg_RSA_ripple_tg_AMY_lowAro(ntp,:) , avg_RSA_ripple_tg_AMY_highAro(ntp,:) ,'tail', 'left') ; %
t_val(ntp) = stats.tstat ;
end
h = p<=0.05;
[labeledA, numRegions] = bwlabel(h , 8);
for n_cluster = 1:numRegions , t_val(labe... |
d05f57a8cb4cd87b0c3b5d51a3c6529ba1547fdf401049a2a09d08f3cd848022 | MATLAB | 1,353 | 43 | function connectUnclockedAO(obj, verbose)
% connectUnclockedAO(obj)
%
% function zapit.DAQ.dotNETwrapper.connectUnclockedAO
%
% Create a task that is unclocked AO and can be used for sample setup.
% The connection options are set by properties in the dotNETwrapper
% class. see: .device_ID, .... |
17ad9bfaf7cb742fab70b23d2c659d05fd3deb68f0b50fed2b37d03acbdf0e64 | MATLAB | 1,354 | 32 | function MakeSbxZ_new(sbxPath, sbxInfo, shiftPath)
% Load interpolation results
load(shiftPath,'-mat');
RS = RS1 + RS2 + RS3 + RS_chunk;
CS = CS1 + CS2 + CS3 + CS_chunk;
ZS = ZS1 + ZS_chunk;
% Generate .sbxz file
rw = SbxWriter(sbxPath, sbxInfo, '.sbxz');
w = waitbar(0,'Generating sbxz');
for scan = 1:sbxInfo... |
d0b51fcab4fc0e51dc01f56abe1fbfa74fd2f2105a3cd08629bb538113fa14a3 | MATLAB | 1,355 | 38 | %% Generate fMRI phase nuisance regressors for one run.
%
% Edit the paths below, then run this script from MATLAB. Outputs include
% generic TSV/MAT files plus SPM, AFNI, and CONN import-friendly files.
repoRoot = fileparts(fileparts(mfilename('fullpath')));
addpath(fullfile(repoRoot, 'matlab'));
addpath(fullfile(rep... |
149baddddffacd451190c03236edb30a252de5105fe236880480d4ae4c152f91 | MATLAB | 1,356 | 68 | function [V1p,V2p,MTp] = permuteFits(V1,V2,MT,origin,target,parameter)
% Given a set of real fits to neurons from a cortical region, resample
% parameter fits given a f
% Define target and origin datasets
switch origin
case 'V1'
oriDat = V1;
case 'V2'
oriDat = V2;
case 'MT'
oriDat ... |
b6c87439614749b562110974e8d9bf1da601c51ac28fd179edc027ccadc509b9 | MATLAB | 1,356 | 46 | %% Trigger Input
%
% <html>
% This examples shows how to start a Synapse recording using an external
% trigger into your processor <br>
% Matlab monitors the bit input and controls Synapse state <br>
% </html>
%% Housekeeping
% Clear workspace and close existing figures.
close all; clear all; clc;
[APIEXAMP... |
84dcb6019f12d0c44857ba7365068525c647a9c3d8911f9c0d7d06203e99ae5d | MATLAB | 1,360 | 66 | clear all
load('rData.mat')
% Heading and goal angles
H = -157.5:45:157.5;
G = H;
% Initial parameter values for fits
a = 25;
b = 1;
c = 0;
d = 1;
phi = 45;
% Fit to Data
pFit0 = [a b c d phi];
OPTIONS = optimset('MaxFunEvals',1e9,'MaxIter',1e6);
pFit = fminsearch(@(pFit) FitErr(pFit,H,G,rate),pFit0,OPTIONS);
% per... |
4ccdd5dbeaf8cbc4596fb008febea629fc7ad95715492a3da7608b6c0ed46091 | MATLAB | 1,362 | 38 | function mask = choose_mask_imroi(self, imgType, roiFun, roiType)
%choose_mask_imroi - Protected class method to choose an individual mask
% based on the built in imroi functions
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% This program is free software: you can redistribute it and/or... |
89dbc721de6a99e8e0e27d16a992a18e1618735d9d5919a5327e8df8e0ca17c1 | MATLAB | 1,363 | 55 | function [tvais,mRH,vtmp] = vaisala_reader_v5(filename,LabVIEW_t0_long)
%% read signal
% Vaisala export txt
fileID = fopen(char(strcat('..\Data\43rd experiment SSPv12\Data\',filename,{'_Vaisala.txt'})),'r');
% Read the data stored in the file from Vaisala
%% Number of lines determination
nr = 0;
a = 'a';
while ischar(a... |
b95735ea8323c4e26c314aee026932a6a556e4fb84d8c68ac58f67c46c4ebbc1 | MATLAB | 1,364 | 50 | close all force
%
clear
load('a0_0_bhv2trialStrct.mat')
%}
UMuscimol = [ 0, 12,9 ,4,1 ];
UMuscimol = [ 0, 12,9 ,4,1 ,14,11 ,6,3 ];
NMonkey{1} = find([dataTrl.iMonkey] == 1 & [dataTrl.iQuality] & [dataTrl.quality] & any([dataTrl.iMuscimol]==UMuscimol'));
NMonkey{2} = find... |
b76ea35f264878294d55ecbc2ad5f24973dbaa7f0ccf105fcdd000dc51570d42 | MATLAB | 1,365 | 55 | clear
close all force
warning on
imSize = [733, 977];
imSizeCent = fix([733, 977]/2);
hWB = waitbar(0,'checking the trials ...');
%load tirals info
load('a0_0_bhv2trialStrct.mat');
NTrial = find([dataTrl.iMuscimol]==0);
for i = NTrial
dataTrl(i).analyze.(mfilename) = false;
end
I = arrayfun(@(x) isfield(x.an... |
be1e2d9dd889360ed4947fe27b30222aa2a7d743d50ccb1f4d521c4ec823741c | MATLAB | 1,366 | 38 | function outname = t2n_catName(varargin)
% This function concatenates strings to a full file, e.g. for file names.
% If the first input is a path (i.e. containing separators / or \) than the
% function concatenates the strings to a full file path
%
% INPUTS
% varargin any number of strings
%
% OUTPUTS
% outname ... |
56b7b3984467d004cb2e6e59cb80104fc9ce29bb5af67e33313c20e854662b80 | MATLAB | 1,367 | 38 | function tracesAdj = adjust_traces(traces, spacingFactor)
%adjust_traces - Adjust traces to plot on a single axes
%
% This function is not intended to be called directly.
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% This program is free software: you can redistribute it and/or modify
... |
c56af95c7b04c41069da7960d1fb32230016a29ef573a955124231fb23cb33ce | MATLAB | 1,368 | 34 | function f = LK_PlotMemoryPerformanceHalves_20231004(dt)
%
% LK_PlotMemoryPerformanceHalves_20231004 plots the subjects' memory
% performance as a function of trial half.
%
% Lukas Kunz, 2023
% create figure
f = figure('units', 'centimeters', 'position', [5, 5, 5, 6]);
axes('units', 'centimeters', 'position', [1.5, 1.... |
6c024e4f2288ab44de93621b811198e48b040b50c070f79649a426220f306725 | MATLAB | 1,369 | 40 | classdef Test_CellScan_params < matlab.unittest.TestCase
%Test_CellScan Summary of this class goes here
% Detailed explanation goes here
% ================================================================== %
properties (TestParameter)
fillBadData = {'nan', 'zero', 'median', 'inpaint'... |
b35b73dfd2f986a990befb06ef98a06af5c4b7e38031f0f26ed118d9ba22499b | MATLAB | 1,369 | 20 | load('Fig3ArousalEffect')
for ntp = 1:49
[h,p(ntp),dc,stats] = ttest2(avg_RSA_ripple_tg_AMY_lowAro(ntp,:) , avg_RSA_ripple_tg_AMY_highAro(ntp,:) ,'tail', 'left') ; %
t_val(ntp) = stats.tstat ;
end
h = p<=0.05;
[labeledA, numRegions] = bwlabel(h , 8);
for n_cluster = 1:numRegions , t_val(labeledA==n... |
bcc3c04e7c2e8ea8425bef5e5725be654fa885b24d0d698f14b9cf99e80f31fc | MATLAB | 1,369 | 30 | if 1 %that can be pre-produced (and then reused each time)
n=NUMBER_OF_CLUSTERS; %there is a way to make it more efficient, becomes relevant for higher n
shuffle_mat=nan(factorial(n),n);
for run_shuffle=1:factorial(n)
temp_shuffle_vec=nan(1,n);
index_n=run_shuffle;
for run_shuffle_i... |
f6f7b68ee6904e9ce58a3933463ec3da148fc595a9cc7f8e7ca8323b5cb357de | MATLAB | 1,369 | 34 | function [pparam, X, clabel] = mv_preprocess_zscore(pparam, X, clabel)
% Z-scores the data to have mean=0 and std=1. It does so by subtracting the
% mean across samples and dividing by the standard deviation. Z-scoring is
% always performed across the first dimension, for each of the other
% dimensions separately.
%
... |
baa883a07e5c907fb9fccb2ac5790960d17a82ab948e7c426490364ec4950c9e | MATLAB | 1,373 | 37 | function print(obj)
% Print to the command line the index, coordinates, and brain area of each condition
%
% zapit.stimConfig
%
% Purpose
% Provide a summary of the conditions in this stimulus configuration file
% by printing to the command line what is in each stimulus condition. Example
... |
a414b0d08fc4898b7d536a77c805654360545fb39152a94dab6d8bc5c3a063c6 | MATLAB | 1,374 | 51 | %% check_smooth_tree
%% test 1
smooth_tree (sample2_tree, 0.5, 0.5, 10, '-s');
tprint ('./panels/smooth_tree1', ...
'-jpg -HR', [10 10]);
%% test 2
clf; hold on;
tree = resample_tree (sample2_tree, 1);
tree = jitter_tree (tree, 0.5, 2, 'none');
stree = cell (1, 10);
for... |
5ac8fc4fb010e41cc6028215d1abe210dfbb5aa5b44053d04620f40c122ccc63 | MATLAB | 1,376 | 40 | function powerCalc
% The original configuration of the software sees us present 4 mW of light for 12.5 ms.
% The beam goes back and forth between two locations with a resultant duty cycle of 40 Hz.
% We want to try presenting the same total number of photons but over a shorter period of
% time. So, for... |
cde80dc9165f0771cdcdf7f32beca38e1ec68b3b364ee4d59a62bdd429a7bd55 | MATLAB | 1,380 | 58 | function [f,file] = stripfile(x,flag,sep)
% function [f,file] = stripfile(x,flag,sep)
%
% <x> is a string referring to a file (it is okay if the file
% does not actually exist). if <x> ends in /, we automatically
% act as if that / does not exist.
% <flag> (optional) is whether to swap the output arguments. defa... |
01b5eb1648b20ec882efdf7e445bea5bb19f4c674bdf32a498e98fbdbb335e15 | MATLAB | 1,383 | 41 | function flagValue = getFlags(MRSIStruct, flagName)
flags = MRSIStruct.flags;
switch lower(flagName)
case 'writtentostruct'
flagValue = flags.writtentostruct;
case 'gotparams'
flagValue = flags.gotparams;
case 'leftshifted'
flagValue = flags.leftshifte... |
113b947f82645ad5b2b9d87f9a0ff808d438c889730e7f870a178906619d645a | MATLAB | 1,384 | 42 | function varargout = plot_average(self, varargin)
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% 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 3... |
33c2450199258723e44889885a69dd4678fe9f67ae482db23e3ab79004b6b4da | MATLAB | 1,385 | 35 | function plot_traces_heatmap(self, traces, hAxTraces, params)
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% 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, eith... |
ffdf83ed3bad2e40cff1e03ae396a1803fcac7a8e93f08d567bef85f4658b6a6 | MATLAB | 1,386 | 34 | function [hConstructor, strClass] = choose_rawImg_type()
%choose_rawImg_type - Class method to choose a RawImg type interactively.
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General ... |
5a592998bf4bed1d19f7bf5e38d0a211448f097361ed6b667bbe3f5ae4432d39 | MATLAB | 1,387 | 49 | function writeDigitalData(obj,waveforms)
% Write digital data to the buffer
%
% function zapit.DAQ.dotNETwrapper.writeDigitalData(waveforms)
%
% Purpose
% Write digital data to the buffer and also log in a property the
% data that were written.
%
% Inputs
% waveforms - columns ar... |
ad34683cc57cd35f3c17d01d741d276f46bd84c993a8137baee29e29337045e3 | MATLAB | 1,387 | 37 | function [R,C,reg] = RectifyStack(vol, start)
[~,~,Nz] = size(vol); % Nx,Ny
R = zeros(Nz,1);
C = zeros(Nz,1);
reg = zeros(size(vol));
metric = registration.metric.MeanSquares;
optimizer = registration.optimizer.RegularStepGradientDescent;
%figure('WindowState','maximized');
target = vol(:,:,start); %imga... |
472b07645eddc2308dfc4790e857e3b526787c6cc4519201036406b5b4c82ca0 | MATLAB | 1,388 | 36 | function hrfTable = cleanHRFtable(hrfTable)
hrfTable.name = string(hrfTable.name);
hrfTable = hrfTable(~contains(hrfTable.name,'V3d'),:);
hrfTable = hrfTable(~contains(hrfTable.name,'V3v'),:);
hrfTable = hrfTable(~contains(hrfTable.name,'V2d'),:);
hrfTable = hrfTable(~contains(hrfTable.name,'V2v'),:);
hrfTable = hrf... |
08e239f00368be52d242e15dea63a35ac8bed21d5280758f1299b16524d5e9ca | MATLAB | 1,391 | 39 | % getSizeFromDimensions.m
% Brenden Kadota, Sunnybrook 2022
%
% Description: Helper function for MRSI processing. Takes an MRSI structure and
% cell array of dimension labels and returns their respective sizes.
% If the dimension does not exist, or is empty, set the dimension size to 1.
%
% Input:
% MRSIStruct = MR... |
782c651bf39b0425c671f93bef05ec93fb316fa20c75f5259b3063f19a360b17 | MATLAB | 1,392 | 38 | function nameOut = choose_name()
% choose_name - Choose a name for the ImgGroup object
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% 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 ... |
4f26c3fecfc61889b501e22b6c8a40308c1ee3ddbd30a332285c7984a1185aa5 | MATLAB | 1,393 | 36 | function [chunkLims, Nchunk, chunkLength] = MakeChunkLims(firstScan, lastScan, totScan, varargin)
IP = inputParser;
addRequired( IP, 'firstScan', @isnumeric )
addRequired( IP, 'lastScan', @isnumeric )
addOptional( IP, 'totScan', lastScan, @isnumeric )
addParameter( IP, 'N',NaN, @isnumeric )
addParameter( IP, 'siz... |
ee35db144cfbd1abffdf10cb71274569585135c6fef37b50b93bd4c5d4092c69 | MATLAB | 1,393 | 44 | function varargout = plot_trajs(self, varargin)
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% 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 3 o... |
5d613fbcb3a101be37b42c789ef4fab61f5ddf5d3ee20e108930f0fd4d36b8c9 | MATLAB | 1,398 | 33 | function self = post_process_diameter(self, pixelWidth, pixelSize)
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% 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,... |
e4c06327a92edbe772eedcddad133ff2acd128361d7d78023d2b99e8664471c5 | MATLAB | 1,405 | 28 | function f = LK_PlotRipplePhaseLockingAcrossChannels_20231030(dt)
%
% LK_PlotRipplePhaseLockingAcrossChannels_20231030 plots the phase locking
% of ripples to delta-frequency activity.
%
% Input is a structure with multiple fields.
%
% Output is a figure handle.
%
% Lukas Kunz, 2023
% create figure
f = figure('units',... |
b14d235375d45ffe7331596816bfd33f5c6358e8dfb1d40da5ed67fdc32083eb | MATLAB | 1,406 | 53 | function [h] = shadeplot(ctIn,ebIn,hIn,color_in,alpha,linewidth)
% Plots a filled shaded region instead of error bars or IQRs. Assumes
% input arguments are at most nx2 matrices, lower CI/IQR is the first dim.)
%
% Usage: shadeplot(centTendencyMet,ErrorBarMet,hAxis,colorIn,alpha,lineWidth)
% Make s... |
0ca172808d8d2e7cb0ee3ceb3cb5d227b7e5be3790764f4504d439d97e23f64e | MATLAB | 1,411 | 42 | function cPoints = calibratedPoints(obj)
% The stimulation locations after they have been calibrated to the sample
%
% zapit.stimConfig.calibratedPoints
%
% Purpose
% Places the stereotaxic target coords in stimLocations into the sample
% space being imaged by the camera. It does this using ... |
69da45134176ec4af482d92a367fd82898e07d083c3c37ea9fed21beb20dc445 | MATLAB | 1,412 | 46 | function varargout = plot_graphs(self, ~, hAx, varargin)
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% 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 ve... |
515826561403c9ae37369eb6e4e092e4911893d8f97a84cab63872db94a15b63 | MATLAB | 1,414 | 36 | function tf = has_ch(self, channels)
%has_ch - Determine if particular channels are present
%
% TF = has_ch(OBJ, CHNAMES) returns a logical array that is true where
% the elements of CHNAMES are channels in OBJ and false where they are
% not. CHNAMES must be either a single row character array or a cell
% arra... |
0cb896276d9bd4fe48b9a8d8b17d60e3b5e74b3758e3a66cf7cf98e2758a7b8b | MATLAB | 1,415 | 43 | function offsetAxes(ax)
% thanks to Pierre Morel, undocumented Matlab
% and https://stackoverflow.com/questions/38255048/separating-axes-from-plot-area-in-matlab
%
% by Anne Urai, 2016
% Modified Luis Ramos T. 2019
if ~exist('ax', 'var'), ax = gca; end
% If there is only one tick do not change stuff.
% Otherwis... |
b506fafab6d9651c1a3d74f96bfbe52bacbbee086529237d3e3b0badf976b271 | MATLAB | 1,415 | 40 | function mc = get_mc(self)
%get_mc - Get the motion correction information
%
% MC = get_mc(OBJ) returns a motion correction structure MC that contains
% information about the motion correction performed.
%
% See also RawImg.motion_correct(), utils.motion_correct()
% Copyright (C) 2017 Matthew J.P. Barrett, Ki... |
b447d0133a0e7b6f0aef4e135a3bff8a51def7cb70fafd04c909f2416e3be407 | MATLAB | 1,418 | 26 | function [ maximum_likelihood_angle_per_sample_index ] = head_direction_ml_decoder(spike_rate_mat_neuron_by_angle, neuronal_activity_mat_neuron_by_sample, temporal_time_bin)
% 'spike_rate_mat_neuron_by_angle' - in hertz
% 'temporal_time_bin' - BEHAVIOR_SAMPLES_PER_TEMPORAL_BIN / BEHAVIOR_SAMPLE_RATE (from 'main... |
f62fadff87adefe3b05807772b3bb85ebe868202b9e25fc032b1caaba1a93530 | MATLAB | 1,418 | 27 | function [outModel] = joinModels(inModel1, inModel2)
outModel = inModel1;
outModel.rxns = [inModel1.rxns;inModel2.rxns];
outModel.mets = [inModel1.mets;inModel2.mets];
outModel.lb = [inModel1.lb;inModel2.lb];
outModel.ub = [inModel1.ub;inModel2.ub];
outModel.c = [inModel1.c;inModel2.c];
outModel.b = [inModel1.b;inMode... |
1f4269ecbe0eadacd216ca5ebc7e612648fd3f283fef37b9f316cf22b6aadf6a | MATLAB | 1,420 | 52 | close all;
path = fileparts(mfilename('fullpath'));
delete(sprintf('%s/Output/Stimulus/*.xlsx', path));
addpath(sprintf('%s/Includes', path));
[filenames, path] = uigetfile({'*.abf'}, 'Select file(s)', 'MultiSelect', 'on');
if ~iscell(filenames) %if filenames is not an array
filenames = {filenames}
end
number_... |
d13bce28d93f32a87977aa2b961749735e0b21a5b7a8270569293f811859e0ba | MATLAB | 1,420 | 38 | function addStimConfigToRecents(obj,fname,pathToFname)
% Add file to the recntly loaded stim config structure
%
% zapit.gui.main.controller.addStimConfigToRecents
%
% Purpose
% The property previouslyLoadedStimConfigs lists all the config files
% that were loaded recently. This method adds a... |
dcfa99cff5641dc59915b377631de5977dfa52f923242bdb6c35cbb9066d72f7 | MATLAB | 1,422 | 36 | function DataMatrix = SubstractMouseMeanWithNans(DataMatrix, StimuliLabels, MouseIDs)
uniqueSLabels = unique(StimuliLabels);
uniqueMouseID = unique(MouseIDs);
meanPerMouse = zeros(size(DataMatrix,1),length(uniqueMouseID));
for m=1:length(uniqueMouseID)
meanCurMouse = 0;
cnt = 0;
cntValidPerMouse... |
28d16bc632ece1982767df466f6a8d16b2ad880093fb269d05851020e43b105a | MATLAB | 1,424 | 41 | function installType = findInstallType
% Return a string indicating how Zapit is installed
%
% zapit.updater.findInstallType
%
% Purpose
% Zapit might have been installed via MATLAB, it could be a Git Repo, or it could be from a
% zip archive. Knowing which it is will help provide instructio... |
4329fa09d095c34c5935b42bd690febdf8f8982bdcf403089793eb9189f0e9c3 | MATLAB | 1,431 | 44 | function MRSIStruct = setFlags(MRSIStruct, flagName, value)
flags = MRSIStruct.flags;
switch lower(flagName)
case 'writtentostruct'
flags.writtentostruct = value;
case 'gotparams'
flags.gotparams = value;
case 'leftshifted'
flags.leftshifted = value;... |
5e03aae931e53bc881d1b5da0555849acc5f22117b70500be036c79c7c1385eb | MATLAB | 1,432 | 48 | function params = displayParams
% For Scanner NEC LCD2080UX display
% Driven directly by Powerbook laptop via a labelled DVI-VGA cable, a VGA F-F adapter,
% a Y-shape VGA splitter, with the other end hang empty, a VGA-5 BNC converter, 5 BNC
% connectors at control room<->scanner room panel, 50ft BNC cables, and 5 BNC-V... |
d9103bbcc8e18b27bfdc6f66d1578af4e2e5169b930fb33ceb2d7a31eb5d8257 | MATLAB | 1,432 | 31 | % GRAPH THEORY CORE
%
% functions relating to the tree as a graph
%
% Files
% asym_tree - Branch point asymmetry.
% B_tree - Branch point indices in a tree.
% bin_tree - Binning nodes in a tree.
% BO_tree - Branch order values in a tree.
% C_tree - Continuation point indices in a ... |
f985acb4e69d6334a768d310ae55f73086ed334d7fd2aa6328c213e68ec6b25a | MATLAB | 1,434 | 44 | % op_CSIPlotVoxelSpec.m
% Brenden Kadota, SunnyBrook Hosptial 2021.
%
% USAGE:
% [out]=op_CSIPlotVoxelSpec(in, x, y, ppmmin, ppmmax, xlab, ylab, title);
%
% DESCRIPTION:
% Plots the spec of one voxel in the CSI FID-A structure. Additional
% arguments augments the output plot. Uses the op_plotspec function.
%
% INPUTS... |
c236495bcbb69f4e8ac2bad6b5e402ac2676e376930ad28e0b2091e391d82120 | MATLAB | 1,437 | 47 | function vStruct = versionStringToStructure(vString)
% Convert a version string into a structure for easier parsing
%
% function vStruct = zapit.updater.versionStringToStructure(vString)
%
% Purpose
% Converts a version string to a structure so it can be handled more easily.
%
% Inputs
... |
d314bb308687fe9dd5a305f6d0cdcbd0149ccc4ae858745f95e7aa6d3b53c3d3 | MATLAB | 1,438 | 50 | %% check_quaddiameter_tree
%% test 1
clf;
tree = resample_tree (sample2_tree, 1, 'none');
qtree = quaddiameter_tree (tree, 1, 1, '-s');
tprint ('./panels/quaddiameter1_tree', ...
'-jpg -HR', [10 10]);
%% test 2
clf;
tree = resample_tree (sample2_tree, 1, 'none');
qt... |
20f5f928d221d65c0fb9980f57da52f49dfba23a0baca65b1f4f60c70ca0d672 | MATLAB | 1,441 | 57 | function [] = overlying_curves_v6(slices,RelHumidities,sbp,norm,avg_factor,Quantity)
%% overlying curves
% figure;
subplot(sbp(1),sbp(2),sbp(3));
colors = lines(max(size(slices)));
for i = 1:max(size(slices))
%% find the deoffsetting point
D = diff(slices{i}(:,4));
CV = abs([D ; 0]) >= 0.01; % change vec... |
8b99b632af9deee3bd1a20969cf7d667d487003c43796ba402194dfe708872a1 | MATLAB | 1,443 | 51 | function p_value = perfrom_permutation(param_to_test,roiList)
%% permutation test
rng("default")
% param_to_test=window;
n_voxel = 100;
n_boot = 100;
n_permute = 10000;
all_sample = zeros(n_boot,length(roiList));
f_null = zeros(1,n_permute);
voxel_sample = zeros(n_voxel,length(roiList));
f_dist = zeros(1,n_permute);... |
0aa9700bc46a02fa2e434830e8a84331332cddba8892bf17e1c5d46e19481e66 | MATLAB | 1,444 | 27 | function [outModel] = joinModels(inModel1, inModel2)
outModel = inModel1;
outModel.rxns = [inModel1.rxns;inModel2.rxns];
outModel.mets = [inModel1.mets;inModel2.mets];
outModel.lb = [inModel1.lb;inModel2.lb];
outModel.ub = [inModel1.ub;inModel2.ub];
outModel.c = [inModel1.c;inModel2.c];
outModel.b = [inModel1.... |
71c10932c95c453ffc826a2da0a98079993451e7cb9bb1d4090e511a2dfb3d30 | MATLAB | 1,444 | 54 | classdef Mock_StreakScan < StreakScan & IMock
%MOCK_STREAKSCAN Summary of this class goes here
% Detailed explanation goes here
% ================================================================== %
properties
end
% ---------------------------------------------------------------... |
ebc49fe6dbe00f4b6b56de797ee0d68094a879bbafd30d54a8751b9def091c74 | MATLAB | 1,444 | 39 | function childrenOut = from_files_sub(varargin)
%from_files_sub - Protected helper function to create children for an
% ImgGroup object from a list of files
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% This program is free software: you can redistribute it and/or modify
% it under t... |
f6ea9a2cbf0e04590407efff84dfadf2f0ecc2640c61d45bc6f1a45e3a2b6166 | MATLAB | 1,445 | 25 | % Run this code when you extracted the T2N zip file including this script at its final loation.
%
% *****************************************************************************************************
% * This function is part of the T2N software package. *
% * Copyright ... |
f8997099ad4092b8afff466e29ab3c132fef251096eeb6f01dbd6a3874ddafef | MATLAB | 1,447 | 47 |
function newDT = tableThreshold(DT,cutoff,level)
if notDefined('level')
level = 'lower' ; % remove everything lower this
end
for jj=1:width(DT)
paramName = DT.Properties.VariableNames{jj};
if isfield(cutoff,paramName) %%|| isempty(params.(paramName))
if strcmp(level,'lower')
... |
41531ed46563124608bd03d20b2481f7f9a1f7f83ba672f08f1c20698574744b | MATLAB | 1,449 | 43 | function [W_greedy, Clist, CID] = greedy(Wp, func, threshold_GT)
% a greedy version of the greedy peeling algorithm
% the algorithm finds a cluster at each time until the average value in the
% remainder adjacency matrix is below the mean of the input cluster
% Chuan
Wp(Wp<-log10(threshold_GT)) = 0;
N = size(Wp... |
ba367a2bd38945704986693888183a7bf910c0fadbd1f67c084f0ab33af65399 | MATLAB | 1,449 | 58 |
close all force
clear
load('a0_0_bhv2trialStrct.mat');
load a19_0_downSizeAverageHeatMaps.mat
UMuscimol = [ 0, 12,9 ,4,1 ,14,11 ,6,3 ];
UMonkey = [1,3];
%%
I0 = [dataTrl.iQuality] & [dataTrl.quality];
I3B = [dataTrl.iMuscimol] == 0;
hmAll105x140BetweenWithBaseline = nan(size(hmAll105... |
6002a7a437a8e6c3be630f1a2633e3ce7f8627dbf1b456e54ec696e598e1351d | MATLAB | 1,450 | 48 | function SavePar(Par)
% SavePar(Par)
% save the structure with these elements into the par file :
%
% .FileName= % -> name of file loaded from
% .nChannels= % -> number of total channels
% .nBits= % -> number of bits of the file
% .SampleTime= % -> time, in microseconds, of 1 sample (ie 1e6 / samp... |
7bb471c77b016afa548cf9b153a9c59e098c9447aa066119eaae807b6649b09d | MATLAB | 1,450 | 54 | %% check_soma_tree
%% test 1
tree = resample_tree (sample_tree, 1, 'none');
tree = redirect_tree (tree, 10, 'none');
soma_tree (tree, 20, 30, '-s'); % WRONG MEASURES!!!!
tprint ('./panels/soma_tree1', ...
'-jpg -HR', [10 10]);
%% test 2
clf;
tree = resample_tree (sa... |
f597a883678ec9fdaf02bca202de1730245cf55ab377c702441b03392ca9af23 | MATLAB | 1,450 | 39 | function [W,Em,Nbest,cbest,E,EE,pbest]=BWASD(X,Y,n,tmax,p,d,delta)
% function for finding the optimal hidden-layer neurons powers and weights
% of the neuronet
[G,M]=size(X);eta_delta=0.95;eta_d=0.95;
G1=round(p*G); % size of data fitting
G2=G-G1; % size of data validation
x0=(1-round(n/2):n-round(n/2))';... |
59fe0d0c906f5420f89cd91d4ccffa5cf150afa5ed012d59cb0bd6a04bb870ec | MATLAB | 1,456 | 51 | classdef Test_SCIM_Tif_ui < matlab.unittest.TestCase
% ================================================================== %
methods (TestMethodSetup)
function clear_persistent(~)
utils.clear_persistent();
end
end
% ==========================================... |
0911d62a402402ea6f81ce7f24c42da0668b88f52a0937a7c9be9c6e13b0acc6 | MATLAB | 1,460 | 39 | function zz = zscore(xx)
%zscore - Replacement for MATLAB function zscore without Statistics Toolbox
%
% Z = zscore(X) calculates the zscore of a vector or matrix (i.e. the
% values centered by the mean and normalised by the standard deviation).
% If X is a matrix, skewness calculates the value for each column of... |
a0096f6c2698adb34fbc9c7d8ba3f2beae331922476b56c12f173761236c0157 | MATLAB | 1,460 | 55 | function [h, ymin, ymax] = tch_plot_tc(x, y, lw, lcol, ecol, err_type)
% Generates clean version of a simple line plot with error region
%
% INPUTS
% 1) x: vector of x-axis values
% 2) y: matrix of data (N x P)
% 3) lw: line width (default = 1)
% 4) lcol: plotting color for line
% 5) ecol: plotting color for... |
3914e54464061eba123d24544281b498adbef22449604dc05548ad54717cfd95 | MATLAB | 1,461 | 46 | function devices=getDevices
% devices=getDevices - gets device numbers for KbCheck;
%
% Usefull for getting a summary of device numbers.
% These device numbers are needed for an input argument for
% KbCheck if you have more than one connected (otherwise
% it will pick the first one).
%
% Also tries to determine whet... |
9b30a957f7294d54e76d285a872b96eeb45270cab8c17e9cd93e287fcb653dd1 | MATLAB | 1,461 | 51 | classdef Test_BioFormats_ui < matlab.unittest.TestCase
% ================================================================== %
methods (TestMethodSetup)
function clear_persistent(~)
utils.clear_persistent();
end
end
% ========================================... |
4c2e73254664fd6bbac3674fc42945e7ecffe486cfda6949c572161b80b6f686 | MATLAB | 1,464 | 63 | % ISBCT_TREE Checks if tree is sorted to be BCT conform.
% (trees package)
%
% isBCT = isBCT_tree (intree)
% ---------------------------
%
% checks if a tree (or a BCT vector of terminals (0), continuations (1) and
% branches (2)) is conform to BCT order.
% NOTE! does not always work (doesn't check for trifurcations... |
e4fd697742e2cfc8fd7895d589373a31c678631502de45b84686edf19e6a0f3e | MATLAB | 1,467 | 37 | function self = fit(self)
%fit - Fit the funRaw to the supplied data
% Copyright (C) 2017 Matthew J.P. Barrett, Kim David Ferrari et al.
%
% 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 Foundatio... |
6e71f028815dd294d09d194be52ca3efce3bfe6989761208b8669829add3e88d | MATLAB | 1,468 | 41 | function [ Atb, Ctb ] = A_adj_pca_3d(Fpsf, weights, error, k, padding)
% [ Atb, Ctb ] = A_adj_pca_3d(Fpsf, weights, error, k, pad, crop)
% Fpsf: 2D Fourier transform of PSFs, size Ny x Nx x Npc x Nz
% Ny - num pixels in y (after padding)
% Nx - num pixels in x (after padding)
% Npc - num of spa... |
7da96d5311431a72d6f349142cd52413880712b2c96123180703eadedccd329c | MATLAB | 1,469 | 36 | function [RespMat,RespMatComb,CRespMat,CRespMatComb] = resp_eval_vis_v4(resparr,cresparr,RelHumidities,startsubpl,Quantity)
% Visualizes the magnitudes of the responses within SSP
RespMat = reshape(cell2mat(resparr),length(resparr{1}),length(RelHumidities));
RespMatComb = (RespMat(1:end/2,:) + RespMat(end:-1... |
466cbed1adba4c87195ce72121a15c23dbcbb2551b3c91777e519a25e701c403 | MATLAB | 1,472 | 57 | classdef DAQ_build_tests < matlab.unittest.TestCase
% Tests associated with whether the DAQ builds correctly
properties
DAQ = [];
isPC
end %properties
methods(TestClassSetup)
function buildDAQ(obj)
obj.isPC = ispc;
if obj.isPC
obj.DAQ = ... |
31253095004b3a424adbb93a2b34f0e7342f988b1fdd4f73954f18198a4122ff | MATLAB | 1,474 | 55 | function [h, ymin, ymax] = tch_plot_tc_norm(x, y, lw, lcol, ecol, err_type)
% Generates clean version of a simple line plot with error region
%
% INPUTS
% 1) x: vector of x-axis values
% 2) y: matrix of data (N x P)
% 3) lw: line width (default = 1)
% 4) lcol: plotting color for line
% 5) ecol: plotting colo... |
718273c438cbd8407d33b694a0b898fc9c0987cb1b8eb2c5eb3832b545c832a9 | MATLAB | 1,474 | 37 | function [img_u, MM] = unmix_chs(img, varargin)
%unmix_chs - Perform unmixing of image channels
%
% IMG = unmix_chs(IMG) interactively unmixes image channels.
%
% IMG = unmix_chs(IMG, ...) passes all additional arguments to the
% linear_unmix function. See the linear_unmix function documentation
% (link below)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.