sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
d08c2bd5c332e92e94b7ebeba24d461cbce5fead11874a46a91bb0c54536c29e | MATLAB | 819 | 34 | function outVector = LK_resizev(inVector, augFac)
%
% LK_resizev resizes vector "inVector" using the augmentation factor
% "augFac". inVector is an n x 1 or 1 x n vector.
%
% Output is the resized vertical vector "outVector".
%
% Use as: outVector = LK_resizev(inVector, augFac)
%
% Lukas Kunz, 2021
% size of input vec... |
f1306237c5c2f1e9527670c3debed57a3e56448bea6a4e54ef7b8a9d3016a49d | MATLAB | 820 | 31 | function [F_R, F_B] = dummy_filter(vq_R,vq_B)
%--------------------------------------------------------------------------
%for thresholding the beads cling to the surface
%%
a = vq_R;
b = vq_B;
J_R = adaptthresh(a,'neigh',[5 5],'Statistic','median');
BW_R = imbinarize(a,J_R);
figure(1);imshow(a*70)
a(BW_R) =... |
52970e8b3ae3e8b883f36d3676beab3eb6f02bf4fd6403995dd46dcd32ada95f | MATLAB | 821 | 35 | % GAUSS Gauss function output.
% (scheme package)
%
% y = gauss (x, mu, sigma)
% ------------------------
%
% Simple equation:
% y = (1 / (sigma * (sqrt (2 * pi)))) * ...
% exp (-((x - mu).^2) ./ (2 * sigma * sigma))
%
% Input
% -----
% - x ::vector: x values
% - mu ::value: center of gaus... |
3fcfca6d9536aebd04145d28f8503ea6f0740be85f8c94bd71abd7812c9fe5fd | MATLAB | 822 | 30 | clear;
% folder of the raw video
dir_video='..\..\demo\data\';
% folder of the GT Masks
dir_GTMasks=fullfile(dir_video,'GT Masks\');
% name of the videos
list_Exp_ID={'YST_part11';'YST_part12';'YST_part21';'YST_part22'};
for id = 1:length(list_Exp_ID)
Exp_ID = list_Exp_ID{id};
% Load video
tic;
fname=... |
682f796d876a521c08a7e5ab38707bbb1a1e602fc6105cec985a55200c7aca11 | MATLAB | 822 | 36 | function tParam = randomTemporalparam(temporalModel,nVoxels)
rng('default') % For reproducibility
switch temporalModel
case 'spatial'
searchRange =[];
case 'CST'
% 2 extra params to solve:
% [temporal delay 2) exponent]
searchRange = [
4 0.1; ...
100 1... |
a5979df675aa94d73e47408127a024ce2ff329a01a3b3af795cb0ed72a7098c3 | MATLAB | 823 | 37 | function [JSD] = getJSDiv(p,q)
% Calculate the Jensen-Shannon divergence between two probability distributions
%
% Usage: [JSD] = getJSDiv(p,q)
%
% Where p and q are either horizontal vectors of the same size
% OR
% matrices representing multiple different distribution comparisons, where
% each row is a different c... |
fa15c33b32300ff869241b538fdf98c71e2c87d53274f311cc4974fac6d1438a | MATLAB | 823 | 34 | clear;
clc;
subs=1:1:30;
parfor ss=1:length(subs)
subnum=subs(ss)
ac=savefor_Figure10(subnum);
end
for ii=1:length(subs)
subnum=subs(ii)
filename=[pwd,'\temporary data\fbcca_ac\ac',num2str(subnum),'.mat'];
load(filename)
ac_stime(subnum,:,:,:)=ac;
end
size(ac_stime)
%30*2*3*5... |
e548841e1f1b963168e8129871394bdae36bdf8656114dc410ea5052b82f1904 | MATLAB | 826 | 17 |
%%%%% convert stimuli %%%%
load('chamberRat19-probe20-day1-2019-02-04-133814-0000_video_data_results2')
TimesOfStimuliExploration{1,3}=TimesOfStimuliExploration{1,1};
TimesOfStimuliExploration{1,1}=TimesOfStimuliExploration{1,2};
TimesOfStimuliExploration{1,2}=TimesOfStimuliExploration{1,3};
TimesOfStimuliExplor... |
9b1dc88eefdf7211bbbd82e46ed450356337a18f109bb90504203d831a8bc3db | MATLAB | 827 | 23 | function addLastPointLocationMarker(obj)
% Add marker for showing the last point location
%
% zapit.gui.main.controller.addLastPointLocationMarker
%
% Purpose
% The last clicked location is shown in the image by a red circle. Since
% multiple functions use this feature, creation of the plot ... |
c7303c0995433cd0ed33baf07cfaf5eaa002cf555c672f35038ff0ecdcb0affa | MATLAB | 830 | 36 | function L=list_open_ephys_binary(jsonFile, type)
%function L=list_open_ephys_binary(oebinFile, type)
%
%Lists the elements present in a Open Ephys binary format recording
% oebinFile: The path for the structure.oebin json file
% type: The type of data to load. Can be 'continuous', 'events' or
% 'spikes'
%
%Returns ... |
d77010c00c163cc31d0bf288a707d32ae8f0f36f4cccddfcef2eac94262ecdb7 | MATLAB | 830 | 24 | function incomplete = convert_voltage()
%% Read files
locs = load(['..' filesep '..' filesep 'Results' filesep 'NEURON' filesep 'locs' filesep 'locs_all_seg.txt']);
try
voltage = load(['..' filesep '..' filesep 'Results' filesep 'NEURON' filesep 'voltage_trace.dat'])';
tvec = load(['..' filesep '..' filesep 'Re... |
66fe4678c3680058fd92982c4fab4a3204a061dc324ef8d78531f1dce0b32576 | MATLAB | 831 | 24 | % SCHEME
%
% basic functions that have nothing to do with TREES
%
% Files
% bezahlt - Make string from number
% deg2rad - Transposes from degrees to radians.
% eucdist - 2D Euclidean distances between two sets of points.
% gauss - Gauss function output.
% gifm... |
081f94e51a10f0ff42e25b1bd75914b8980aaffbaee8e789c09ebf29b10db4c7 | MATLAB | 834 | 33 | function [] = overlying_curves_v4_bas_corr_v3(slices,baselines,RelHumidities,sbp,avg_factor,Quantity)
%% overlying curves
% figure;
subplot(sbp(1),sbp(2),sbp(3));
colors = lines(max(size(slices)));
for i = 1:max(size(slices))
yyaxis left
plot((slices{i}(:,1)-slices{i}(1,1))/60,movmean(slices{i}(:,2),avg_factor)... |
51e99ede535fe0f57cc6d740a0c9535a3e9512a1817ae91e8fba6f41e4ddaeaa | MATLAB | 834 | 33 | %% check_bin_tree
%% test 1
dLPTCs = load_tree ('dLPTCs.mtr');
for counterN = 1 : 1000
for counter = 1 : length (dLPTCs{1})
tree = dLPTCs{1}{counter};
bin_tree (tree, [], 4);
end
end
%% test 2
bin_tree (sample_tree, [], [], '-s')
tprint ('./panels/bin_tree1', .... |
967f4bcc0a879e26a63e72f05cd6e2368e4e3f4e89339a1586aa5443e5c53420 | MATLAB | 836 | 20 | function f = LK_PlotTransitionMatrix(tra)
%
% LK_PlotTransitionMatrix plots the transition matrix for converting
% original channels into bipolar channels.
%
% The output is a figure handle.
%
% Lukas Kunz, 2021
% create figure
f = figure('units', 'centimeters', 'position', [-5, -5, size(tra.labelold, 1), size(tra.lab... |
fb95218c2ef0f429fd6cd1672c8b8d3d91cb7091dc6dd91ce8d99c2476d6d666 | MATLAB | 841 | 21 | function figure1(dataFolder)
if(nargin<1)
error('Path to data required as input argument. Data can be downloaded from link in README file.');
end
% Add paths for function execution
myPath = mfilename('fullpath');
basePath = fileparts(fileparts(myPath));
addpath(fullfile(basePath,'auxiliary'));
addpath(fullfile(ba... |
b7af41b16b2b8f03f8ec635ae7eed05f420057c6e09259947fc3f9ca67b370ab | MATLAB | 842 | 21 | %% Constants
% Here, define the path to the SampleData and Scripts folders on your computer:
SOFTWARE_PATH = 'D:\GitRepositories\island\Scripts\RawToProcessed\';
DATA_PATH='D:\GitRepositories\island\SampleData\HeadDirectionData\Raw\';
addpath([SOFTWARE_PATH 'crcns-hc2-scripts']);
MOUSE_NAME = 'Mouse28-140313';
globa... |
6da64295ce85abab4e8ad017e30e35398bbbbcf9d09e51a2505df11fa37622f5 | MATLAB | 843 | 33 |
clear
close all force
load('a0_0_bhv2trialStrct.mat');
load('a7_2_createAvergedNOTMorphedHeatMapsLoad.mat');
heatMapNew = zeros(733+2,977+3);
pix2deg = 34.910;
sigXY = pix2deg * .24;
heatMapNew = zeros(733+2,977+3);
hmAll105x140 = nan([105,140, size(hmAll,3:6)]);
%%
for i3 = 1:size(hmAll,3)
for i4 = 1:size(hm... |
222a23087ecfe71525af596ccd48ae6475d024bd215af2984f843aadb11d4ca3 | MATLAB | 844 | 29 | function binned = binXY(mov, factor)
%BINXY Adapted from Rohan's binning script, bins only in XY
if nargin < 2, factor = 2; end
factor = round(factor);
[y, x, nframes] = size(mov);
% Remove edge pixels if necessary
if mod(x, factor), x = x - mod(x, factor); end
if mod(y, factor)... |
2b8eb1e088e96e05f935958dc5c0471eda9f8ab32383dde1e8d798a33a54cb6f | MATLAB | 844 | 20 | %decc_plotFigS2
% Related to Viswanathan, Stein, Nieder, PLOS Biol, 2024
% PV 2024
% Requires https://www.mathworks.com/matlabcentral/fileexchange/22282-venn?s_tid=srchtitle_support_results_1_venn
load('DECCdataFigS2.mat')
% % Venn diagram
figure('Color',[1 1 1],'Position',[230 250 75 50]);
axis equal, axis off
protp... |
609f5b16e9f6c3ce9bdba5f033fa9a7a0dfb1ba40e23c018a220fb6add4a029d | MATLAB | 844 | 33 | function win = filtNd(sz,alpha,dim,type)
% win = filtNd(sz,alpha,dim, type)
% alpha: alpha for type='kb', gaussian fwhm (wrt full width of kspace) for 'gauss'
% No filtering along dims of k>dim
%
% (c) Corey Baron
switch type
case 'kb'
filtFcn = @(szIn,alphaIn) kaiser(szIn,alphaIn);
case 'gauss'
... |
d3cefe64c45f3e77ac4f4115904fd9444c78fe2f90494144b1c5e965602cc6fd | MATLAB | 845 | 28 | function MRSIStruct = setDimension(MRSIStruct, dimLabel, value)
switch(lower(dimLabel))
case 'x'
MRSIStruct.dims.x = value;
case 'y'
MRSIStruct.dims.y = value;
case 'z'
MRSIStruct.dims.z = value;
case 'coils'
MRSIStruct.dims.coils = val... |
29228e63131a07d1a474dbd908d87c5b7219ad7a744e5b952a785d6850c14b49 | MATLAB | 849 | 25 | function y = morlet_wav(f,t,width)
% function y = morlet_wav(f,t,width)
%
% Create a Morlet wavelet 'y' with frequency resolution 'f' and temporal
% resolution 't'. The wavelet will be normalized so the total energy is 1.
% The 'width' defines the temporal and frequency resolution for the given
% centre frequency 'f'... |
44932df796945c5402e81c5e60879837c77695bb67c6c9dde8576c63e16e913d | MATLAB | 849 | 31 | %% check_ssecat_tree
%% test 1
dLPTCs = load_tree ('dLPTCs.mtr');
for counterN = 1 : 10
for counter = 1 : length (dLPTCs{1})
tree = dLPTCs{1}{counter};
tree.Ri = 100;
tree.Gm = 1 / 2500;
tree.Cm = 1;
ssecat_tree ( ...
... |
4d6f29f821b03991a5cd4db49cc2988f36e84ce2ac6efd9b0f1086887091d524 | MATLAB | 849 | 28 | %% check_allBCTS_tree
%% test 1
allBCTs_tree (11, '-s -w');
tprint ( ...
'./panels/allBCTs_tree1', ...
'-jpg -HR', [10 10]);
%% test2
xd = 70;
clf; hold on;
[BCT, BCTtrees] = allBCTs_tree (6);
dd = spread_tree (BCTtrees);
for counter = 1 : size (B... |
5e198576344a65a37016e8a1d14300fb5c34c3a40ca6b8fdefc69fa6c7a4446a | MATLAB | 850 | 39 | function params = displayParams
% Critical parameters
% for projector
params.numPixels = [1280 1024];
params.dimensions = [38 20]; % [46 20]
% params.dimensions = [46 20] ; % [46 20]
params.distance = 51; % 32 channel -> 43 cm // 16 channel -> 25 cm
params.frameRate = 60;
params.cmapDepth = 10;
params.screenNumber =... |
8288235d1ac55f8ac2ade01a656d76553f8790b94fb3d7be5a4052234abb43bd | MATLAB | 851 | 25 | function device = getBestDevice(display)
% device = getBestDevice(devices)
%
% Purpose
% Determine if an external button box or other input device exists. If
% not, use the default input device (ex: internal keyboard on a laptop).
%
% Input
% display - Generated with loadDisplayParams and openScreen.
% No... |
e8431bfe6d3da892ba89b26002b111748500a871bea128b58ca99e4030ca87f1 | MATLAB | 851 | 33 | function [tlabv, tinsp, cp, cpi] = sync_v3(tlabv, tinsp, cp, LabVIEW_t0, Insplorer_t0, arbshift)
% %% Sync the tracks, faster version of v1
% % Shift tlabv
[Y, M, D, H, MN, S] = datevec(LabVIEW_t0);
LWt0 = H*3600+MN*60+S;
[Y, M, D, H, MN, S] = datevec(Insplorer_t0);
Inspt0 = H*3600+MN*60+S;
Shift = LWt0 - Inspt0;
tl... |
0aa6d65a85d4deea3473262659a3ea996f8ca298c212b2c12f5baa3c32e707bc | MATLAB | 852 | 27 | function [ bounds ] = ZeroCenteredBounds( data, clipPrctileRange )
% ZEROCENTEREDINTERVAL returns a zero centered interval that surrounds
% input data. useful for determining the color interval for imagesc map
% plotting. to set minVal and maxVal to true min and max, use
% clipPrctileRange = [0 100].
minVal = pr... |
5cc25836561c53d7bec8c2b259af618e2d94b5c2780256aed5194561fb843198 | MATLAB | 856 | 34 | function loadLaserFit(obj)
% Load the laser fit object to the user settings directory
%
% zapit.pointer.loadLaserFit()
%
% Purpose
% Loads the laser fit to a .mat in the settings directory.
%
% Inputs
% none
%
% Outputs
% none
%
% Rob Campbell - SWC 2022
%
... |
f84c09d084f9d49baed0f4e93c9af5f78d9d5dab69d4cd0dd269b106c1a039f1 | MATLAB | 856 | 24 | % Script that should contain all necessary metadata for takign the chM
% rounds and stitching them together complete
% Written by Dan Goodwin, dgoodwin@mit.edu July 20 2019
%% Create the spatial map of the tiling snake pattern
% Numbers are from metadata and examining the raw data folders
numTiles = 180;
numRows = 10;... |
67e21de4864a9122a0288838d3926c8c326507196b981ce677c0b7bed38419a0 | MATLAB | 857 | 24 | function setConstants(new_output_dir,new_simulator_dir,new_sessionDate)
% Read the contents of the original .m file
file_name = './template/c_template.m'; % Replace with the name of your original .m file
fid = fopen(file_name, 'r');
file_contents = fread(fid, '*char')';
fclose(fid);
output_dir = 'p1';
simulator_dir =... |
a512c2279247ebb87bb3efda69f8013c0ab4542337d6c0dcdda1c446b71166bc | MATLAB | 859 | 32 |
clc; clear;
maskpath = '/Users/qingfangliu/Desktop/GlobalConnectedness/masks';
% load extracted and filtered scan data
load('tc_filtered_3mm.mat');
hdr = spm_vol(fullfile(maskpath,'gm_0.1_3mm.nii'));
gm = spm_read_vols(hdr);
gm_idx = find(gm > 0);
nvox = length(gm_idx); % number of voxels
nscans = 430; % n... |
22de86c38d27b3c315160669272600a91d0279fcae6b6e33c9f32cb32f45b5fa | MATLAB | 861 | 36 | function [B,Slope,Intercept] = RemoveLinearTrend(A,Dim,X)
%% Remove linear trend in A at the dimention of DIM
% B = A-SLOPE*X-INTERCEPT
% X is a vector along DIM for linear fitting
% B is the residual after removing the linear trend
%
%
% YC at ES lab
% Created on Oct. 13, 2005
% Last modified on May 7, 2008... |
6ca542c9723b9797cd657d6fdb73b77f28a4b78e5e223cd95f9c3f17c2a24b92 | MATLAB | 862 | 30 | function y = bpvec(f,s,Fs,width)
% function y = bpvec(f,s,Fs,width)
%
% Returns a vector 'y' containing signal 's' filtered for frequency 'f'
% (via convolution with a complex Morlet wavelet described by 'width')
%
% INPUTS:
% f - frequency to filter at
% s - signal to be filtered
% Fs - sampling frequency of s
% widt... |
ef9f09e74b77b8f1224cb4a50f860e28d5db9eca98221cf1342a7be7cd653341 | MATLAB | 863 | 29 | function cal = calFixGammaTable(cal, calfile)
% function cal = calFixGammaTable(cal, [calfile])
%
% inputs:
% cal: a psychtoolbox calibration structure
% calfile: name of file to store the fixed calibration struct
%
% purpose:
% check to see whetehr a PyschToolBox calibration file contain... |
c6309816420d756db7fae77eefbab06373b52fa9b7f981d4dc553f3ef987e4d1 | MATLAB | 865 | 22 | function writeConfig(obj,fname)
% Write a YAML config file
%
% zapit.stimConfig.writeConfig(fname)
%
% Purpose
% Write properties into a stim config YAML file that can be re-read.
% stimModulationFreqHz is global to the whole config so it is written once at the
% top level. laserPowerIn... |
b5f76e2d39aee5983e21bd23da0acf42d7235c0154281b1c8b453272721416a3 | MATLAB | 866 | 43 | function varargout = listDevices
% List connected devices
%
% function devices = nidaqmx.listDevices
%
% Purpose
% Query the NI devices attached to the PC. If no outputs are requested,
% the results are printed in screen. If outputs are requested, the
% display is suppressed and a cell array of strings is returned.
%
%... |
31bf8a8b49802cfefe846f76e0dd60cec5c0f3ab9636a07214b6036c73c5f508 | MATLAB | 867 | 24 | %Written for the first splintr barcode dataset from Oz
FOLDER_NAME = 'ExSeqAutoSlice';
FILEROOT_NAME = 'exseqauto';
for roundnum = 1:30
%Load three of the channels, ignoring ch02
chan4 = load3DTif(sprintf('/om/project/boyden/%s/input/%s_round%i_ch03.tif',FOLDER_NAME,FILEROOT_NAME,roundnum));
%These nu... |
328d2d3d009ea82130291389b48876d4fb05de91b341f5ad8bb88468b76340e7 | MATLAB | 868 | 76 | %UCLA flex board pad bond aray is arranged such that, when the probe is facing upward (also tip upward),
%CH1 is on the top left, and the channels wrap around counter-clockwise.
%So CH32 is on the bottom left, CH33 is on the bottom right, and CH64 is on the top right.
%first column = numbering of channels on probe ... |
ea7eb491c02d5fdf5a720779c7889084a80d9ee45600cc4107c402c98a399af1 | MATLAB | 870 | 34 | %% check_chull_tree
%% test 1
clf; hold on; shine
axis off
dLPTCs = load_tree ('dLPTCs.mtr');
for counterN = 1 : 20
for counter = 1 : length (dLPTCs{1})
tree = dLPTCs{1}{counter};
chull_tree (tree, [], rand (1, 3));
end
end
tprint ('./panels/chull_... |
641a719c503223b666956581fd369923b6db5b9635145fc96ec05db1cb711bed | MATLAB | 871 | 78 | %first column = channel number on probe.
%second column = channel number on the probe PCB connector for the head
%stage, assuming the HS will be plugged in from the top.
%third column = channel number on the probe PCB connector for the head
%stage, assuming the HS will be plugged in from the bottom.
pcbwiring=[
1 ... |
8d57b331ffef6be1631bcad61a71d5095526c2336e5aafdf43591e67214a849b | MATLAB | 871 | 37 | function details = getAddonDetails
% If Zapit was installed as an add-on return the details
%
% function details = zapit.updater.getAddonDetails()
%
% Purpose
% If zapit was installed as an add-on, return the details as a structure.
%
% Inputs
% none
%
% Outputs
% detail... |
ba8de0dfa7eef119e406c1d220a01941c479b0f3540a349990b75904389596dc | MATLAB | 871 | 29 | function oinfo = goi_oinfo_all(ts,maxorder,biascorrect)
% Compute O-information for all the multiplets until a max order
% INPUT
% ts input (observations x variables), time series or static/behavioral data
% maxorder maximum order for the gradients
% biascorrect apply or not bias correct... |
3656464f5ad24997e0f0f776fec9f0755323f533b7878f1fc272713cec0a6009 | MATLAB | 872 | 30 | function [i, ofreq] = select(ifreq)
% SELECT make a random selection from given relative frequencies
% [i, ofreq] = SELECT (ifreq)
% ifreq a vector of relative frequencies (all must be 0 or positive)
% i index of the selected element
% ofreq frequencies with ifreq[i] decremented
%
% To the best o... |
e45e808df584159832b3c72945baa22f4372823f8de91b902b507280ed64dc4b | MATLAB | 874 | 30 | % the pattern separation toolbox: analyse spike train ensembles
% Copyright (C) 2022 Alexander D Bird
function [output_spiketimes] = spike_thinner_random(input_spiketimes,n_rep,p_del)
%SPIKE_THINNER_RANDOM Randomly removes spikes from input trains
if nargin<2 || isempty(n_rep)
n_rep=1;
end
if nargin<3 || isempty(... |
26de21a21b4939ef43114ad4adf9ddc5b36247a0e26e19be11b0e309a0aa342a | MATLAB | 875 | 34 | function userDir = userFolder
% Return path to user's home folder as a string
%
% function userDir = zapit.settings.userFolder
%
% Purpose
% Return path to user's home folder on Windows or Unix systems. Returns
% empty if it fails to find a home folder for some reason.
%
% Inputs
... |
d63c06fca00b0d979d3c6ca748d45c863a48b10baec4c1827a29f1c664f28ef5 | MATLAB | 875 | 22 | function [new_img_R, new_img_B] = background_sub(vq_R, vq_B)
vq_R(isnan(vq_R))=0;
vq_B(isnan(vq_B))=0;
figure(10)
imshow(vq_R*70,'InitialMagnification','fit')
title('circle a region for background substraction')
%function of selected interested region for background substraction
Selected_background_Region =... |
1c714912563cf6e4943917f38c8fd84483f8bd5f2a34ca0c8fd63cd12769b976 | MATLAB | 877 | 32 | %% check_hull_tree
%% test 1
clf; hold on; shine
axis off
dLPTCs = load_tree ('dLPTCs.mtr');
for counter = 1 : length (dLPTCs{1})
display (counter)
tree = dLPTCs{1}{counter};
[~, ~, hp] = hull_tree (tree, [], 20, 20, 20, '-s');
set (hp, 'facecolor', rand (1, 3));
end
t... |
8e4c95d0e977a1dab13344f9a93121a89d0fea39f46319eb4bca6c0f6ab076e7 | MATLAB | 877 | 34 | function out = LK_RandomPointsInCircle(myR)
%
% LK_RandomPointsInCircle creates random points drawn from a circular area.
%
% Input: structure with fields
% maxR --> maximum radius
% minR --> minimum radius
% N --> number of points to create
% centerX --> x-center of circle
% centerY --> y-center ... |
cc2cc607b839a15f45ba7021c5a0d15181f80b4aa2f19a1b5b165453f0aa3579 | MATLAB | 878 | 27 | dblist=dir('Database_*.mat')
Data_Succ=zeros(length(dblist), 3);
Data_MUnb=zeros(length(dblist), 3);
Data_pval=zeros(length(dblist), 2);
dblist2=[];
for i=1:length(dblist)
dblist2(i).ID=str2num(dblist(i).name(10:14));
load(dblist(i).name);
for j=1:length(MotorSynth)
temp=[];
cnt=... |
fe26966bd8c0205cdd1fc1502479c2afc6650287c7f3073e639c00f605445fe8 | MATLAB | 878 | 28 | function channel = sshfrommatlabclose(channel)
%SSHFROMMATLABCLOSE disconnects Matlab from a remote machine
%
% CHANNEL = SSHFROMMATLABCLOSE(CHANNEL)
%
% where CHANNEL is the Java ChannelShell object to disconnect
%
% See also SSHFROMMATLAB, SSHFROMMATLABINSTALL, SSHFROMMATLABISSUE
%
% (c) 2008 British Oceanogra... |
272bee347b3dea9142d8fdfccd316895c4a0ec92129a4838605963234e38bd21 | MATLAB | 880 | 24 | function [hFig, hAx, hScatter, hLine, hPatch] = plotScatterLineFitPredInts(x, y)
[xSorted, sortInd] = sort(x);
lineFit = fit(xSorted', y(sortInd)', 'poly1');
confIntType = 'functional';
confIntSimultaneous = 'on';
confLevelArray = [.85, 0.95, 0.99];
hFig = createFullScreenFig;
hAx = gca;
hold on;
lineCol... |
bc8ce3dcbb1b9d1eafeec9406ec0032dca0d4366087964d941deadcdd3d61e13 | MATLAB | 880 | 51 | %% timestr
%
% Format time string in hours/minutes/seconds
%
% <matlab:open('timestr.m') code>
%
%% Syntax
%
% tstr = timestr(t)
%
%% Arguments
%
% _input_
%
% t time (seconds)
%
% _output_
%
% tstr formatted time string
%
%% Description
%
% Return formatted string |tstr... |
57ebdd6e5d430516943b15f2f56f5ff2ece5aefc1a9e1ad1d2afb9025fd9337d | MATLAB | 881 | 26 | %%% plot_coverage.m
%%% Omkar N. Athavale, October 2023
%%% Plots the resampled marginal change in fitted parameter values per addiotional iteration of the parameter optimisation.
%%% Uses saved data files for Step 1 to calculate this.
% load a saved Step 1 file
addpath('..')
load('data/optim_ICC_data')
% resample ... |
0c3cd5a811619c461c94182c1ec477f6ea6c65469deaba4d0295cf92ddb0cd45 | MATLAB | 882 | 46 | function varargout = analogInput_SingleShot
% Example showing how to record two seconds
%
% function data = daqtoolbox.AI.analogInput_SingleShot
%
% Purpose
% Records two seconds of data and plots it to screen.
% Optionally returns as output argument.
%
% Outputs
% data - [optional] Returns the data vector that was pl... |
aede7b9fe8bd7adf62f33c7aa8d88bc3f6262380b5cda7abe3db8559ece2cc47 | MATLAB | 883 | 31 | function zapSite_Callback(obj,~,~)
% Stimulate the areas selected by the test site drop-down
%
% zapit.gui.main.controller.zapSite_Callback
%
% Purpose
% This callback stimulates areas named in one condition.
if isempty(obj.model.stimConfig)
obj.ZapSiteButton.Value = 0;
retu... |
d90c3d6dbd9c83e2e8c817e20dcb0fae5a65e9d8c0bc6804b153d8001b7a8364 | MATLAB | 889 | 21 | function [max_pool_size] = concurrency_size_in_puncta_roicollect_bgincl(cond)
loadParameters;
if ~isfield(params,'PUNCTA_MAX_POOL_SIZE')
main_mem_usage = cond.imgsize_dbl + params.MATLAB_PROC_CONTEXT;
par_worker_mem_usage = 2 * cond.imgsize_dbl + params.MATLAB_PROC_CONTEXT;
max_pool_si... |
1c5a93d81f983d1b8670e9772f20db928078b628361a1199f600ff165a40ff66 | MATLAB | 890 | 36 | %% check_BO_tree
%% test 1
dLPTCs = load_tree ('dLPTCs.mtr');
for counterN = 1 : 500
for counter = 1 : length (dLPTCs{1})
tree = dLPTCs{1}{counter};
BO_tree (tree);
end
end
%% test 2
BO_tree (sample_tree, '-s');
tprint ('./panels/BO_tree1', ...
'-jpg -... |
bc5801b7c2b738b66afb4d69d9f9bf827bc914163249f8718eb5951566592bad | MATLAB | 892 | 28 | function bgtraces=generate_bgtraces_from_masks_exclude(video,masks)
% Generate background traces for each neuron from ground truth masks.
% Background intensity is the median of the intensity in the nearby
% region of the neuron, but excluding the neuron itself.
[Lx,Ly,T]=size(video);
[Lxm,Lym,ncells]=size(masks);
[x... |
a7ebec76c8fd79da091cb78654d64bbc4f40284a615e6eef25dad96a2c43e067 | MATLAB | 893 | 34 | nsub = 50;
% nsub = 44;
for i = 1:nsub
Y = predicted_rating{i};
X = actual_rating{i};
% Y = all_predict{i};
% X = all_Y{i};
zy = zscore(Y);
zx = zscore(X);
% all_y{i} = zy;
% % all_x{i} = zx;
fit_y{i} = zy;
fit_x{i} = zx;
% out = plot_y_yfit(X, Y, 'data_alpha', ... |
b43f960321d442b1e730b45a0d8a851312564b59552ed1fe4e3e7c94598b5f3f | MATLAB | 893 | 22 | function figure1(dataFolder)
if(nargin<1)
error('Path to data required as input argument. Data can be downloaded from link in README file.');
end
% Add paths for function execution
myPath = mfilename('fullpath');
basePath = fileparts(fileparts(myPath));
addpath(fullfile(basePath,'auxiliary'));
addpath(fullfile(ba... |
b5a77701d689bd11bbf97121026dca5ddb4116a6f503920207bbfcaf446111e8 | MATLAB | 894 | 30 | function y = phasevec(f,s,Fs,width)
% function y = phasevec(f,s,Fs,width)
%
% Returns a vector 'y' containing the instantaneous phase values of signal
% 's' filtered for frequency 'f' (via convolution with a complex Morlet
% wavelet described by 'width')
%
% INPUTS:
% f - frequency to filter at
% s - signal to be fi... |
a156a2d2b500bb19375d22631a4e436c3b45a895591db376b8cc1b421a8ce0cc | MATLAB | 895 | 33 | % the pattern separation toolbox: analyse spike train ensembles
% Copyright (C) 2022 Alexander D Bird
function [TE_sum] = compute_TE(joint_distribution,delay_distribution)
dd_norm=sum(delay_distribution(:));
jd_norm=sum(joint_distribution(:));
sz=size(joint_distribution);
H1=0;
for lag_ind=1:sz(3)
PZ=... |
aee6a493094a6194fc2f04bda39505b65536db88b47a43167ba8aeb3a760cfb2 | MATLAB | 895 | 36 | function header=parseHeader(input)
% PARSEHEADER - Read ScanImage Header String and return structure.
% PARSEHEADER will output the value of the header fields as a structure.
% Input is the header from ScanImage TIF File (char array).
%
% See also
out={};
tempcell=strread(input,'%q');
for lineCounter=1:length(t... |
d6f60372db38ce9ff059b0491686cf42809f346335e4a409aab0798d17d3f049 | MATLAB | 895 | 32 | function mival = mi_measure(phase_sig, amp_sig)
% function mival = mi_measure(phase_sig, amp_sig)
%
% Returns a value for the MI measure calculated between two signals.
% (Functionality to deal with multiple trials will be added soon)
%
% INPUTS:
%
% phase_sig - the instantaneous phase values for a signal which has be... |
e9d3d2091d25e4a02f8f976ff6ca9ef09f746ee1d654bb65780d80312b05db7a | MATLAB | 898 | 30 | function number = LK_letter2num(letter)
%
% LK_num2letter converts one or more alphabetical letters (e.g., A) into
% their corresponding number (e.g., 1). The output number is given as
% int16. It is not possible to have both uppercase and lowercase letters in
% the input letter at the same time.
%
% Examples: a --> 1;... |
145c1f91ec35a0054b19070305722526b03083c65c6d66100b9ffa3a28c19162 | MATLAB | 899 | 32 | function pull_3d_scatter_dots( pull_length, source_coordinates )
% pull dots of a 3D scatter plot towards the camera position so that they
% are not hidden by another object (e.g. mesh object).
if nargin < 2
source_coordinates = [0 0 0];
end
if nargin < 1
pull_length = 1;
end
h = gca;
cam_pos = h.CameraPosi... |
b8a1cf88336c2bfe646e48d588e0dbb4b3b569b8331dc789e5834b424c060fcf | MATLAB | 899 | 31 | function value = distTosoma(data_xyz,connct,type,label)
% calculate path distance from every skeletal points to the estimated centre of soma from SWC file
distlist = 0;
if sum(type==1)== 3
%find rows of peripheral soma points
row_soma = find(type==1);
row_somap = row_soma(connct(row_soma)==1);
... |
2bcc962101d799e31740e8d7f863cc469503f0917dd188fd9979cd10825309ec | MATLAB | 901 | 28 | %% check_rpoints_tree
%% test 1
clf; hold on;
tree = hsn_tree;
[M, dX, dY, dZ] = gdens_tree (tree, 20, ...
find (B_tree (tree) | T_tree (tree)),'none');
c = hull_tree (tree, 20, [], [], [], '-2d');
rpoints_tree (M, 1290, [], dX, dY, dZ, 5, '-s');
tprint ('./panels/rpoints_tree1', ...
'... |
a3803083728ad83c1faccc5cd63c23a35ac36b0edeb5abeae98773f3ea6f359b | MATLAB | 902 | 31 | %sc.autumn Red-yellow colormap
%
% Examples:
% map = autumn;
% map = autumn(len);
% B = autumn(A);
% B = autumn(A, lims);
%
% Similar to MATLAB's sc.autumn function, but also able to return a concise
% colormap table.
%
% The function can additionally be used to convert a real-valued array into
% a truecolor a... |
c826146a0d3e16d57dda2df195de7af60ad52c07e45f7fd3f9faaad480231326 | MATLAB | 902 | 51 | function f = dejitter(im_in, M, par_alpha)
%DEJITTER Summary of this function goes here
% Detailed explanation goes here
[r,c] = size(im_in);
N = M + 1;
ft = padarray(im_in(:,1),N,'both');
f = padarray(im_in,[0 N],'both');
gamma = im_in(:,(N+1):c-N);
p = zeros(1,r);
p(1) = N+1;
p(2) = p(1);
phi1 = padarray(gamma... |
574530056411ef5e925aade24b97acf661a23583f11d5ec6237bf5425b4896ec | MATLAB | 904 | 30 | function y = ampvec(f,s,Fs,width)
% function y = ampvec(f,s,Fs,width)
%
% Returns a vector 'y' containing the instantaneous amplitude values of
% signal 's' filtered for frequency 'f' (via convolution with a complex
% Morlet wavelet described by 'width')
%
% INPUTS:
% f - frequency to filter at
% s - signal to be fi... |
2a22e6a83aa0ab3bcb2d53b7825ca095deb56de39c59c6862baf0df82058731b | MATLAB | 905 | 34 |
filename = mfilename('fullpath');
filename = 'E:\Research_Projects\004_Propofol';
gitRepo = fileparts(filename);
parentDirectory = fileparts(gitRepo);
while ~strcmp(gitRepo,parentDirectory);
parentDirectory = gitRepo;
gitRepo = fileparts(gitRepo);
F = dir(gitRepo);
gitFound = sum(cellfun(@(x)strcmp(x,'... |
60c22a9ab39881559ab6ade498a43c42c9b669c4c084c72d6ac5dffc11bd2d34 | MATLAB | 905 | 19 | % ELECTROTONICS
%
% functions to calculate current flow in a tree
%
% Files
% elen_tree - Electrotonic length of segments in a tree
% gi_tree - Axial conductances of the segments of a tree.
% gm_tree - Membrane conductances of the segments of a tree.
% lambda_tree - Length constants of the seg... |
392c96445b710cf6eeaf226be6323cf36c5d69156a2e951e52c3298742ff669e | MATLAB | 907 | 18 | function smoothed_estimated_angle_by_clustering = smooth_estimated_angle(estimated_angle_by_clustering, filter_mask)
sigma = 2;
hsize = 5;
gaussian_kernel=exp(-(([1:hsize]-(hsize+1)/2).^2)/(2*sigma^2));
gaussian_kernel=gaussian_kernel./sum(gaussian_kernel);
%smoothed_estimated_angle_by_clustering=... |
8d6e300abffee387fc84d4347992cf00e6e9591069ab8bec8de32113a6c873fd | MATLAB | 907 | 31 | %% check_vhull_tree
%% test 1
tree = sample2_tree;
clf; shine;
axis off;
hp = plot_tree (tree, [0 0 0], [], [], 32);
set (hp, ...
'facealpha', 0.5);
c = hull_tree (tree, 15, [], [], [], 'none');
points = c.vertices;
hp = vh... |
b35b7850182546bc2d7b38801621a73f108c33822caf4d367cae1a27cf23d087 | MATLAB | 908 | 37 | function[Val,resid] = regress_fast(x,y,Pval)
% INPUTS
% x: nxp regressor matrix of n observations (rows) across
% p regressors (columns)
% y: Comun vector of responses
% Pval: Optional, computes P-values of the estimates
% OUTPUT
% Val: Column vector of the estimated coefficie... |
802c215db84ea414b5930c5fda3c74066c35250a80f116533380b262aa783c71 | MATLAB | 909 | 34 | classdef Test_CellScan_ui < matlab.unittest.TestCase
% ================================================================== %
methods (TestMethodSetup)
function clear_persistent(~)
utils.clear_persistent();
end
end
% ==========================================... |
f1f6b535d379bcb033d754ca1e75bfcb0e3b683aa3c526c632bab1c14bad4cd4 | MATLAB | 909 | 28 | function [mixedsig, CovEvals, percentvar] = cellsort_svd(covmat,...
nPCs, nt, npix1)
%-----------------------
% Perform SVD
[mixedsig, CovEvals] = eig(covmat);
CovEvals = diag(CovEvals);
[CovEvals, I] = sort(CovEvals, 'descend');
CovEvals = CovEvals(1:nPCs);
mixedsig = mixedsig(:,I... |
049774f4dab6b656cfd50228b32d73f5d430e69c3fa10c0a6852b87c3a1aee55 | MATLAB | 910 | 38 | % DEMOs reference
stack = load_stack('stack2.stk','-s');
tree = load_tree ('tree2.mtr','-s');
%% fitD1_stack
clf; shine;
HP = show_stack (stack); colormap gray
HP = plot_tree(tree,[1 0 0],[],[],32);set(HP,'facealpha',.5);
view(2); axis off tight;
tprint ('DEMO_fitD1_stack','-tif -HR',[20 20]);
%% fitD2_stack
clf; s... |
d6b3c5bae09fda7dea143ec08a04750debf3f39f5d2564e3f258b0df66892a6f | MATLAB | 910 | 35 | %in the "summary.m", the field was actually number of in field bins, here
%let's calculate the real fields
p=pwd;
load('foldersAll.mat');
load('foldersAllIndvFOV.mat');
load('commonCellsAllIdx.mat');
nFieldReal=[];
for m=1:length(foldersAllIndvFOV);
disp(m)
N=[];
for n=1:length(foldersAllIndvF... |
b05ee76617553dab4639ab0de6253d8e22223789a5b396747fb523920fb65e3e | MATLAB | 911 | 21 | function drFlag = containDR(imgNeuron_store)
% This function checks if the neurons contain darkRegion
% Input 16-bit neuron image and return 1 if there is a relatively large
% dark region in the image, otherwise return 0
% Minimum detectable dark region size is 1% of the original image
darkRegionBW = double(i... |
53c2cb84b4f4bf99c64b23fd1c5d62ef3202945c6835600c372d4de26d67b5a8 | MATLAB | 913 | 37 | classdef Mock_Calc < Calc & IMock
%Mock_Calc Summary of this class goes here
% Detailed explanation goes here
properties
end
properties (Constant, Access = protected)
validConfig = {'Mock_Config'};
validData = {'Mock_Data'};
validPlotNames = {};
validProcessedI... |
5b31c44ffa8ee3695dc1f80a9a67d9686337e44a1ea3308f141f6bdd295f7ddb | MATLAB | 913 | 43 | function [keys RT] = recordKeys(startTime,duration,deviceNumber)
% Collects all keypresses for a given duration (in secs).
% Written by KGS Lab
% Edited by AS 8/2014
keys = [];
RT = [];
rcStart = GetSecs;
% wait until keys are released
while KbCheck(deviceNumber)
if (GetSecs-startTime) > duration
break
... |
08bae367a559d10e1fd6157c13ef51460024b841ff9741fff7d55880e5f21e13 | MATLAB | 916 | 34 | classdef Test_XSectScan_ui < matlab.unittest.TestCase
% ================================================================== %
methods (TestMethodSetup)
function clear_persistent(~)
utils.clear_persistent();
end
end
% =========================================... |
1df29de2cb25dd57a6603b265961cd533466a5c6bb502cafed191f068e0d8b41 | MATLAB | 917 | 1 | function stimulus = createStimulusStruct(img,cmap,seq,destRect,seqtiming,fixseq)
%stimulus = createStimulusStruct(img,cmap,seq,destRect)
%
%Creates an stimulus structure with the fields:
%
%stimulus.image array of images
%stimulus.cmap array of cmaps
%stimulus.seq array of indices into images and cmap... |
20fdc30b59cba61c1467c20d944b104f004d4fbc4e3896f9e84faf695b265297 | MATLAB | 918 | 25 | % the pattern separation toolbox: analyse spike train ensembles
% Copyright (C) 2022 Alexander D Bird
function [all_codes] = all_rate_codes(max_value, n_trial)
basis_vec=0:max_value;
if n_trial==1
all_codes=combvec(basis_vec)';
elseif n_trial==2
all_codes=combvec(basis_vec,basis_vec)';
elseif n_tri... |
7ee3e0c507cb087640638807441d45f9bcf09d1ce4eeeb9e9b56ad1e24e7446d | MATLAB | 920 | 24 | function NOP(varargin)
%NOP - Do nothing
%
% NOP( ... )
%
% A do-nothing function for use as a placeholder when working with callbacks
% or function handles.
% 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 th... |
3e923fb70ae3ca8493466a01627c801c075a06346df0cb675d44a70df8b3c6ea | MATLAB | 921 | 30 | %THERMAL Black-purple-red-yellow-white colormap
%
% Examples:
% map = thermal;
% map = thermal(len);
% B = thermal(A);
% B = thermal(A, lims);
%
% A colormap designed to replicate the tones of thermal images.
%
% The function can additionally be used to convert a real-valued array into
% a truecolor array usin... |
645fdb1a8affb5c55453745c4be568713d78ad26b74d901d15b8fe2520a3840f | MATLAB | 922 | 40 | function [retDisps] = screen2retDisp(scrDisps,rfCent,cortArea)
% Convert frontoparallel "screen" disparity to actual retinal disparity
switch cortArea
case 'V1'
z = 0.89;
case 'V2'
z = 0.89;
case 'MT'
z = 0.57;
end
% assume a 6cm ipd
ipd = 0.03;
xL = -ipd/2;
xR = ipd/2;
r... |
95ba1c19b896cc249f36a0b19ba844a95fe66a4c50d7fefe5f12192960c6fdc7 | MATLAB | 922 | 34 | classdef Test_ConfigFrameScan_ui < matlab.unittest.TestCase
% ================================================================== %
methods (TestMethodSetup)
function clear_persistent(~)
utils.clear_persistent();
end
end
% ===================================... |
e77727d7961c65fa18d765bbe1d48d233490e8d0c732bdb08929c3990c3b5574 | MATLAB | 922 | 47 | %%
cType = {'dataR_*.mat','dataFx_*.mat','data_*.mat'};
cType = {'dataFx_*.mat'};
cDraw = {'g.','m.','k.'};
cSz = [36 100 25];
nC = length(cType);
d = cell(1,nC);
for ii = 1:nC
d{ii} = dir(cType{ii});
end
for ff = [3 9 11 22 23]%1:length(d{1})
F = figure; hold on
title(['FOV ' num2str(ff... |
8e5df6665d55a8f1f5f1f620be6f0679783fdce2591e22fa7a56592e7e307ac9 | MATLAB | 923 | 51 |
%-------------------------------------------------------------------
% Build a knn graph
%
% dist = buildKNNGraph(data,k,type);
%
% Input:
% - data : the input data matrix
% - k : number of neighbors
% - type : type of graph (0: mutual, 1: at least one direction)
%
% ... |
ba0e744829df8c27be6e57fe4d317f2c66c2e575c5eeccd8c81da542f28f34d6 | MATLAB | 923 | 41 | function varargout = readAndPlot(fname,sampleRate,nChans)
% function varargout = readAndPlot(fname,sampleRate,nChans)
%
% Read and plot raw data
%
% Reasonable defaults for inputs by default so it's enough to
% to just feed in a file name. If no output arg is specifed the
% function will p... |
130aa9766244ac09b3ce09ed649edca65f7cdff002db2aa4bbe165b36136c3c6 | MATLAB | 925 | 32 | function [y,finidx,idfin] = filter_y_data(file,id,study,ylab)
[num_data,txt_data,raw_data] = xlsread(file);
vlabels = txt_data(1,:);
%id_xls = convertId(num_data(:,1),txt_data(2:end,1));
id_xls = raw_data(2:end,1);
%study_xls = txt_data(2:end,12);
study_xls = raw_data(2:end,12);
%y_xls... |
4c52cd671c7762f40948029101dc83cdb799e35983a97f966364aedc6b36daba | MATLAB | 925 | 25 | function outputs = generateRegressors(cfg)
%GENERATEREGRESSORS Run the pipeline and export shareable nuisance regressors.
%
% outputs = fmriPhase.pipeline.generateRegressors(cfg)
%
% This is the collaborator-facing entry point. It produces one regressor
% matrix and writes files that can be imported by common fMRI pack... |
dafe1633dc64167061f52121583cb8d7c4ff504186fd4ea752ab94f2743567ea | MATLAB | 927 | 24 | function f = LK_PlotTemporalStabilityOfCueObjCells_20231008(dt)
%
% LK_PlotTemporalStabilityOfCueObjCells_20231008 plots the temporal
% stability of the object cells.
%
% Input is a structure with multiple fields.
%
% Output is a figure handle.
%
% Lukas Kunz, 2023
% histogram of temporal stabilities
f = figure('units... |
7774990937b8bee02dde2f40833d760a0c18b6999af5811404cbcf89f54ea389 | MATLAB | 928 | 25 | function [ adaptorsOut, devicesOut, formatsOut, IDsOut ] = getCameraHardware()
%getCameraHardware list information about all attached cameras
% Returns four lists, with each row refering to an available camera
% device.
adaptorsOut = []; devicesOut = {}; formatsOut = []; IDsOut = [];
i = 0;
adaptors = imaqhwinfo();... |
2e9be1c36cda4d5f3ce50510f568e2d89e67e897bfe7fd346c344187c5ea6bff | MATLAB | 930 | 30 | % the pattern separation toolbox: analyse spike train ensembles
% Copyright (C) 2022 Alexander D Bird
function [input_spiketimes] = spatially_correlated(max_time,n_trial,rate,corr)
%SPATIALLY_CORRELATED Generates a set of spike times with correlations within trains.
master_rate=rate/corr;
input_spiketimes=cel... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.