sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
439ff6c784ed7ebfaddbc910503004fb51dd9489e2cfc1aae2691e0d1cbfd820
MATLAB
395
11
% This script is to be run after processing a session with neural data % The variable `expdata` is defined in `main.m` % Step 1. Run the manual tagger to select noise clusters tag_KS_clusters %% % Step 2. After tagging, you can create a "flat file" that contains all % information from the experiment integrated into o...
2d0cff5b423bef2efa24b1b128a241c7b6344345039cfb8d86e35dae15d65d8b
MATLAB
396
12
function out=init_data_struct(out) out.collected_trial=0; out.location_in_data=0; s=size(out.sum_data{1}); for k=1:out.num_elec out.data{k}=zeros(2,s(2)); out.sum_data{k}=zeros(1,s(2)); end out.data{out.num_elec+1}=zeros(2,out.num_elec,s(2)); out.sum_data{out.num_elec+1}=zeros(out.num_elec,s(2)); out.trial_data=cell(ou...
a802ecc6ca1df2d1b19273ea54dcc5e240f2fb435047ec2c0ee57ae417fd5770
MATLAB
396
16
function val= get(pa5,prop) % GET Get PA%X property from the specified object % and return the value. Property names are: if isa(prop,'char') switch prop case 'Device_num' val=pa5.device_num; case 'Controler' val=pa5.controler; case 'Atten' val=pa5.atten; otherwise...
627c09b4cf8cc910d22500c4bc646effcd5357ac84c8452ea704ecc7be4ecb85
MATLAB
398
15
HDSPInInd=6; HDSPOutInd=6; ftab=exp(linspace(log(1000),log(64000),51)); Hz=2*pi/192000; for ii=1:length(ftab) sig=sin(ftab(ii)*Hz*(1:192000)); win=[linspace(0,1,1920) ones(1,192000-1920*2) linspace(1,0,1920)]; sig=sig.*win/10; y=audioplayer(sig,192000,24,HDSPOutInd); samp=audiorecorder(192000,24,2,H...
1fc9760f2a9e8379f0a807659cc55672706b6b0585c6373f15cdaa88903f3dce
MATLAB
399
14
function idxs = create_behav_clusters(speed, param) % JN 2020-12-13, 2020-12-14 r_speed = speed(:, param.cluster_start_samp:param.cluster_stop_samp); max_speed = max(abs(r_speed), [], 2); idx_slow = max_speed < param.cluster_thr; [ma, ~] = max(r_speed, [], 2); [mi, ~] = max(-r_speed, [], 2); idx_pos = (ma >= mi) & ~...
15a51b6e4b610d979a60f4bdf27d77c01e520f22b4c454920b8a507d9b0ce3e4
MATLAB
404
17
% cleanplot % Mohammad Shams <m.shams.ahmar@gmail.com> % % For the current axis: % - makes the tick lines of the plot outward % - removes the white background % - removes the border around the legend % - converts all the text objects to Helvetica-8 function cleanplot set(gca,'tickdir','out','color','none') box...
71b9660881d74f55d2884e898a51268a90e2898cbbedf9709154cac5131eea72
MATLAB
406
13
function samp_points=synth(sig,samp_rate,trial_dur,varargin) % SYNTH is BBN synth function. % SAMP_POINTS=SYNTH(SIG,SAMP_RATE,TRIAL_DUR,VARARGIN) Samples the signal % according to the givan SAMP_RATE and TRIAL_DUR. Returns the sampled % points. switch nargin case 4 samp_points=randn(1,round(samp_rate*(trial_d...
4e47cd2b36506520905bb954f3ddab9fce01272a1fdb65cdf03168a1739171ef
MATLAB
407
15
function valid_flag=is_legal_fname(comp,val) % IS_LEGAL_FNAME checks the legacy of the given value as a signal Start-time value. % VALID_FLAG=IS_LEGAL_FNAME(COMP,VAL) checks that VAL is a legal value as a % filename. If legal returns 1, otherwise returns 0. valid_flag=1; if (~isa(val,'char')) valid_flag=0;...
6c8cdd2a351e76b19f3c456a5944da0bd32f6f6efc00c8e609c6bba4d4762c00
MATLAB
408
15
function valid_flag=is_legal_freq(comp,val) % IS_LEGAL_FREQ checks the legacy of the given value as a signal frequency value. % VALID_FLAG=IS_LEGAL_FREQ(COMP,VAL) checks that VAL is a legal value as a % signal Freq_comp value. If legal returns 1, otherwise returns 0. valid_flag=1; if (~(isa(val,'double')) || ...
9d243516f8e09ced97f7beaaf79c336e6a36984af258314d9786a7914561acbf
MATLAB
408
15
function valid_flag=is_legal_ramp(comp,val) % IS_LEGAL_RAMP checks the legacy of the given value as a signal Ramp-length value. % VALID_FLAG=IS_LEGAL_RAMP(COMP,VAL) checks that VAL is a legal value as a % signal Ramp_comp value. If legal returns 1, otherwise returns 0. valid_flag=1; if (~(isa(val,'double')) ||...
97bf6953b9394da8b45f5fd21b3a0ff3355b6cc7ed9079dfe7e1485a33f7a457
MATLAB
409
15
function valid_flag=is_legal_stime(comp,val) % IS_LEGAL_STIME checks the legacy of the given value as a signal Start-time value. % VALID_FLAG=IS_LEGAL_STIME(COMP,VAL) checks that VAL is a legal value as a % signal STime_comp value. If legal returns 1, otherwise returns 0. valid_flag=1; if (~isa(val,'double') |...
a328bd6699eee7fddaa36ef67fcc4bc4a9c46f850cfa9a87e348da0893cb7d30
MATLAB
409
10
function [trimGammaBand,trimSdftm] = trimGammaBand(GammaBand,croppedSdftm) % Trim to only see the transient window [50 to 150 ms based on croppedSdftm] startTm = find(croppedSdftm == .050); stopTm = find(croppedSdftm == .150); trimSdftm = croppedSdftm(1,startTm:stopTm); trimGammaBand.data = GammaBand.data(:,startTm:st...
dc962c85533127a12bed13f60ee09c8ac7445f5985cd99a4bc9d7ac594190b43
MATLAB
409
21
function [xx,rr] = myqr(kk) % myqr orthogonalizes sets of vectors with qr decomposition % % Inputs: % kk: raw vectors [ndim nvec] % % Output: % xx: orthogonalized vectors [ndim nvec] % % xx = myqr(kk) % Number of regressors [ndim,nvec] = size(kk); % Orthogonalize [qq,rr] = qr(kk); % Keep signs ...
2903d27dcbf1772bca69506e3ad9623e78ae6ab58d2e60ee2c34fa21193042e5
MATLAB
410
15
function valid_flag=is_legal_etime(comp,val) % IS_LEGAL_ETIME checks the legacy of the given value as a signal End-time value. % VALID_FLAG=IS_LEGAL_ETIME(COMP,VAL) checks that VAL is a legal value as a % signal ETime_comp value. If legal returns 1, otherwise returns 0. valid_flag=1; if (~(isa(val,'double')) |...
b12cae544941f6fdace9a5cf1f192b3cb311d409797005f773960fd3620095f2
MATLAB
411
8
function out_manager = update_plot_flag(out_manager,index,status) % function out_manager = update_plot_flag(out_manager,index,status,h) flag_list=get(out_manager,'Plot_flags'); flag_list(index)=status; % handles_list=get(out_manager,'Plot_handles'); % handles_list(index)=h; % out_manager=set(out_manager,'Plot_flags',fl...
36dcc678379260ea970c957b246a6183b1a00dfe48651fb9f05665b30f8fb7c5
MATLAB
414
17
% Manually test ExperimentController % Requires an Arduino to be connected to the computer. % Author: Lasse Osterhagen load('ecGapTrainingConfig.mat') e = depInj.createObjFromTree(ecConfig); lb = LogBook(); lb.addObservable(e, 'Running'); lb.addObservable(e, 'Stopped'); lb.addObservable(e, 'Ascend'); lb.addObservable...
1efc4e5b58e2083bfa325839a3c4f7677884db8e8b1616acc99d74cd25b27847
MATLAB
417
15
function valid_flag=is_legal_phase(comp,val) % IS_LEGAL_PHASE checks the legacy of the given value as a signal phase value. % VALID_FLAG=IS_LEGAL_PHASE(COMP,VAL) checks that VAL is a legal value as a % signal Phase_comp value. If legal returns 1, otherwise returns 0. valid_flag=1; if (~(isa(val,'double')) || ~...
d33fdf8fc02f525e9505cf667dbde7a8a797fdca594164daf4beae752fc649fa
MATLAB
420
19
% This function generates the coordinates of the blocks %% function m_blockPoint = Locate_blk(i, j, blk_step, block_Size, width, height) if (i-1)*blk_step + block_Size < width point_x = 1+(i-1)*blk_step; else point_x = width - block_Size + 1; end if (j-1)*blk_step + block_Size < height point_y = 1 + (j-1)...
b2cd7c197d23e4d1bce3a031009a7c33c323121015e1ecbd6a25829e8ea579d0
MATLAB
422
18
function [NBLANKS FORMATSTRING]=progressbar(NITERATIONS) % % % % returns formatstring for a simple progressbar % taken from http://blogs.mathworks.com/loren/2007/08/01/monitoring-progress-of-a-calculation/ Hnans Geerligs 8/2007 NBLANKS=ceil(log10(NITERATIONS)+1); backspace_string=''; for i=1:NBLANKS backspace_str...
4b7805240228477e880fb2d0e489919cee1795fa2be7b6b13db905deab2219f2
MATLAB
426
16
function valid_flag=is_legal_depth(comp,val) % IS_LEGAL_DEPTH checks the legacy of the given value as a signal Depth value. % VALID_FLAG=IS_LEGAL_DEPTH(COMP,VAL) checks that VAL is a legal value as a % signal Depth_comp value. If legal returns 1, otherwise returns 0. valid_flag=1; if (~(isa(val,'double')) || ~...
b8c23f841569169ba920e138e5c7372ca66107ed9b478f2c7dc81a60e001f2b9
MATLAB
426
18
function [n_per_type,transitions_abs]=count_transitions(type_list) n_per_type=zeros(1,max(type_list)); transitions_abs=zeros(max(type_list)); for i=1:length(type_list)-1 t1=type_list(i); t2=type_list(i+1); n_per_type(t1)=n_per_type(t1)+1; transitions_abs(t1,t2)=transitions_abs...
d1b26f3537fd292ac3e16619100baab09cfd893cefc66d097ca1af0c1c65fd07
MATLAB
427
16
function new_sig=PULSE(varargin) % NEW_SIGNAL class constructor. switch nargin case 0 % if no input arguments, create a default object m_sig=Main_signal('PULSE'); new_sig.num_of_comps=4;%PULSE has the basic 4 components. new_sig=class(new_sig,'PULSE',m_sig); case 1 if (isa(varargin{1},'PULSE')) n...
06ee41764aed2a39b7944819d8e5b7580bacd7ac91931ff147b1a5338a9e2b51
MATLAB
428
12
function epi_split(subjectdir, filename, scans_subj, prefix, fsldir, Ntime) %filename includes the extension e.g. .nii.gz or .nii %prefix: e.g., '_reg_sm_fil', '_reg' cd(subjectdir); system('pwd'); parfor scan_num=1:length(scans_subj) cmd = [fsldir 'fslroi ' filename ' ' char(scans_subj(scan_num)) ... ...
8d2edb891607bb1a26f79c4f903e7cf6d15bb32d6204efbcb066993a621f1dac
MATLAB
434
20
function stimDir = createStimulusDir(handles) type = []; area = []; stimlistLine = []; names = categorical({'reward';'punish';'timeout';'punishTO'}); T = handles.stimlist.T; for jj = 1:length(names) idx = find(T.soundtype == names(jj)); for kk = 1:length(idx) type = [type; names(jj)]; end a...
0ce5ff45157db5b4bdc20f3c6741d348b6f49365844c284b31536d1594df9c9d
MATLAB
435
21
classdef (Abstract) AudioPlayer < handle %AUDIOPLAYER is an abstract base class for audio players. % Implement this interface to create audio players that can be used by % ExperimentController. % Author: Lasse Osterhagen properties (SetAccess = protected) % Time when last AudioObject was played lastAOTime...
aa2ef4d6deb5c6ff428cb368df2f6abb7b5e1f6822845abd5bc2d010417d3669
MATLAB
436
16
function env=get_envelope(m_sig,index) % GET_ENVELOPE returns the envelope in the specified index. % M_SIG=GET_ENVELOPE(M_SIG,INDEX) returns the envelop in the % specified index of the given main_signal's envelope list. if (~(isint(index)) || index<1) treat_error('Illegal INDEX input to Main_signal/get_envelope')...
619f6d320487d20bd69e98e9fee2c4c059f6c73c8daa08898c39119e58c62d22
MATLAB
439
13
function [croppedSDFforInteroc,croppedSdftmforInteroc] = cropSDF_getInteroc(SDF,STIM,sdftm) % Find trials associated with non-brfs paradigms interocTrials = contains(STIM.task,'interoc'); taskSDF = SDF(:,:,interocTrials); % Crop dow to [-150 to 200 ms based on sdftm] startTm = find(sdftm == -.150); stopTm = find(sdft...
871eecdf24ac00055da83068acd1e85679cf5515fe7d462fd60125499bf148cc
MATLAB
439
13
a = ['C:\logging_data\14-06-2017Test\bg_s1.tif']; frame = imread(a); imshow(a, 'Border', 'tight'); [x, y] = getpts; x = round(x); y = round(y); size = 10; rect = frame(y-size:y+size, x-size:x+size); D = regionprops(rect == max(max(rect)), 'Centroid'); p = round(D.Centroid); hold on; h1 = plot(x+p(1)-11, y+p(2)-11, 'r*...
6afb490c20ada2db7ecc5bfe1d235fb0567b6a47be1f813fa6226a924e655418
MATLAB
440
17
% Manually test a setup with GapStimuli and LaserBlockCtrl intermixed. % Uses an Arduino to trigger AudioObjects % Author: Lasse Osterhagen load('ecAOArrayGapLaserConfig.mat'); e = depInj.createObjFromTree(ecConfig); lb = LogBook(); lb.addObservable(e, 'Running'); lb.addObservable(e, 'Stopped'); lb.addObservable(e, '...
8911a35e876adda92ee609e846c1a227817155bec234de9a54af2b3dbe419cb1
MATLAB
441
10
function throwIncorrectEventError(callingFunction, event) % THROWINCORRECTEVENTERROR throws an ExperimentState:IncorrectEvent exception. % This function is used by all LogbookStates to throw an exception if the % following event is not allowed given the current event. % Author: Lasse Osterhagen msgID = ['Experime...
2fd59a55ce2080d30b14d0eba18ec3fe4d0b3a837eb766d6b41faf398f103508
MATLAB
443
26
% Play tones for recording % Author: Lasse Osterhagen % Prepare gaps to play levels = 0:5:80; ta = arrayfun(@(x) ToneStimulus('level', x), levels, 'UniformOutput', false); ta = [ta{:}]; % Create ContinuousBgndAudioPlayer load('cBgnAPToneConfig.mat') a = depInj.createObjFromTree(audioPlayerConfig); pause(1); a.start...
3281d3b93460f3b8b287146616688d3d2d0995aa03f0c063a8fa3c3dcfb7fea9
MATLAB
443
27
function C = micca_fastcorr(X,Y) % % C = micca_fastcorr(X,Y) % % if(nargin<2) [T N] = size(X); for i = 1:N X(:,i) = X(:,i) - mean(X(:,i)); end C = (X'*X); X = sqrt(sum(X.^2)); C = C./(X'*X); else [T N] = size(X); for i = 1:N X(:,i) = X(:,i) - mean(X(:,i)); end [T N] = size(Y); for i = 1:N ...
cc6403fc3e2b1dab39f7341580c79a7540ede92dc07378585887d5eb108befc0
MATLAB
445
20
function val = get(sig,prop_name) % GET Get Signal property from the specified object % and return the value. Property names are: % Name, Num_of_comps. if isa(prop_name,'char') switch prop_name case 'Name' val = sig.name; case 'Num_of_comps' val=0; otherwise treat_error([p...
1426b04902284abcbfe29c3680821813e9c51e1b12a78da6f84eff1150745729
MATLAB
448
14
function [Distance] = Block_distance(im1, im2) % Distance calculated using the Frobenius Norm blk_size = size(im1,1); Distance = (norm(im1-im2,'fro').^2)/(blk_size.^2); % 'L' % Distance = im1.*log(im1) + im2.*log(im2) - (im1 + im2).*log((im1 + im2)./2); % Distance = mean2(abs(Distance)); % % 'KL' % K...
34a7af52455608835e6edd460e2ecd207921a5bc266e10b7e79e76cdc633adbe
MATLAB
452
14
function valid_flag=is_legal_trial_dur(comp,val) % IS_LEGAL_TRIAL_DUR checks the legacy of the given value as a signal Trial_duration value. % VALID_FLAG=IS_LEGAL_TRIAL_DUR(COMP,VAL) checks that VAL is a legal value as a % signal Trial_dur_comp value. If legal returns 1, otherwise returns 0. valid_flag=1; if (~...
72d182d0b5441f38a8aa30915d24f11b129f69850f23eab69be1b8dc7f2d5644
MATLAB
452
23
function lowpass=LOWPASS(varargin) % lowpass class constructor. switch nargin case 0 % if no input arguments, create a default object env=Envelope('LOWPASS'); lowpass.num_of_comps=2; lowpass=class(lowpass,'LOWPASS',env); lowpass=add_to_comp_list(lowpass,'Freq_comp',Freq_comp(50)); case 1 if (isa(varargin{1},'LOW...
12edcf7e636b835c40b0282df7ba67a5d9c14105da070b2319ce945d742e3b4b
MATLAB
453
16
% ISINT checks if a given value is an Integer. % RES = ISINT(VAL) checks if a VAL is an Integer. Returns 1 if VAL is an % integer and 0 otherwise. % An integer is a whole number (not a fractional % number) that can be positive, negative, or zero. function res=isint(val) if ((~(length(val)==1)) || ~(isnumeric(val)))...
29104bc6a763fdf4bb6b3ca3273dca42e1ec1972c4af021a98a3289a0d5d5a70
MATLAB
454
14
function [croppedSDF,croppedSdftm] = cropNaNsFromSDF(SDF,STIM,sdftm) % % % Find trials associated with non-brfs paradigms % % nonBrfsTrials = ((~strcmp(STIM.task,'brfs')) & (~strcmp(STIM.task,'dbrfs'))); % % taskSDF = SDF(:,:,nonBrfsTrials); taskSDF = SDF; % Crop dow to [-150 to 200 ms based on sdftm] startTm = find(s...
bb10e696d939d048ca3ede88e7ba27c706d72d0d7359e9bf5325a9dabef95341
MATLAB
454
18
global ASIODev InitializePsychSound dev=PsychPortAudio('GetDevices'); k=cellfun(@isempty,strfind({dev.HostAudioAPIName},'ASIO')); ASIODev=dev(~k).DeviceIndex; tmp_points=zeros(192000/3,6); tmp_routing=1:6; samp_rate=192000; t=1:length(tmp_points); t=t(:); Hz=2*pi/samp_rate; tmp_points(1:1920,1)=1; tmp_points(1920+(1:19...
0304a3ab9a74cc71c9fccf14664702a6fd725aeba6479903145e312f04f64036
MATLAB
455
12
function writeByuWithScalarToVTK(in_byu,in_mat,out_vtk); %data_dir='/home/ROBARTS/alik/EpilepsyDatabase/standard/projects/penny_striatum/with_dti' %template_byu=sprintf('%s/surfdisp_data/surfdisp_singlestruct_striatum_unbiasedAvg_affine/template/dstriatum_nii.byu',data_dir); tmpfile=sprintf('/tmp/tempsurf%d.txt',rand...
44428d73f20f7ec95ab11a2144be40bbcebe614a11df659016301ffa9ce78000
MATLAB
455
13
function [tabbed_string] = tabJoin(cell_of_strings, tab_length) tabbed_string = ''; for i=1:(numel(cell_of_strings)-1) if numel(tab_length)==1 tab = tab_length-length(cell_of_strings{i}); else tab = tab_length(i)-length(cell_of_strings{i}); end tabbed_stri...
dd0df85df9cecf1aaf01dd86c7e8ae011c1b8e2e84d9fc21d38f1a5b32543899
MATLAB
455
14
function hPLT = NS_MeanErrPlot(db1X, db1Y, db1Err, db1Color) if iscolumn(db1X), db1X = db1X'; end if iscolumn(db1Y), db1Y = db1Y'; end if iscolumn(db1Err), db1Err = db1Err'; end hold on % Plots the error in shaded area db1XFill = [db1X db1X(end:-1:1)]; db1YFill = [db1Y + db1Err db1Y(end:-1:1) - db1Err(end:-1:1)]; fil...
5a4df1fc7cd5a2c610a1c1d877fb019c103d192c25187856b2e84d805008a786
MATLAB
456
15
% It is a code to calculate the integral % "var" is a variable which that be integrated % "var" should be a vector % "dt" is a time interval between each variable % "dt" should be a constant % "int_v" is an output vector which are integrated values of "var" % Copyright (c) 2023 Hong Gi Yeom function [int_v]=In...
c3f0586aab636eb9169a1bab6bd41314e80bef1ec171d5633470e0b34ec05548
MATLAB
456
17
function val = get(mtf,prop_name) % GET Get MTF property from the specified object % and return the value. Property names are: % Name, Signal, Freq_comp, Phase_comp, Comp_list, % Num_of_comps, Comp_list_str. if isa(prop_name,'char') switch prop_name case 'Envelope' val=mtf.Envelope; otherw...
f53c427e0579a2ac3ddf3599fcb4c151f622e5b1e9581e1d8ce285794c2f09a6
MATLAB
460
16
function valid_flag=is_legal_level(comp,val) % IS_LEGAL_LEVEL checks the legacy of the given value as a signal level value. % VALID_FLAG=IS_LEGAL_LEVEL(COMP,VAL) checks that VAL is a legal value as a % signal Level_comp value. If legal returns 1, otherwise returns 0. MAX_LEVEL=get(comp,'MAX_LEVEL'); valid_flag=1...
30489646ca2cd88db87c5100cef98ff626ac0a32de07d36fa79c61b329c29f68
MATLAB
461
26
% Play gaps for recording % Author: Lasse Osterhagen % Prepare gaps to play gaps = .00015*2.^(0:10); ga = arrayfun(@(x) GapStimulus('duration', x), gaps, 'UniformOutput', false); ga = repmat([ga{:}], 1, 2); % Create ContinuousBgndAudioPlayer load('cBgnAPGapConfig.mat') a = depInj.createObjFromTree(audioPlayerConfig)...
b0332a750cef10c6b812924b5c2ffca6755012219fa53a4644bb5a283fbf199d
MATLAB
462
20
function bbn=BBN(varargin) % BBN class constructor. switch nargin case 0 % if no input arguments, create a default object m_sig=Main_signal('BBN'); bbn.num_of_comps=length(get(m_sig,'Comp_list')); bbn=class(bbn,'BBN',m_sig); level=get(bbn,'Level_comp'); level=set(level,'Static_value',...
ec4f86ee83693f423298ef8571135954d92f00b3aaa290c75e0d3ab11b8fea75
MATLAB
463
17
function data=mAO_getSpikes global mAO difftime=mAO.mt-mAO.PrevTrig; num_samples=ceil(difftime*mAO.RX8sfreq); t=(1:num_samples)*difftime/num_samples+mAO.PrevTrig; data=zeros(mAO.num_elec,length(t)); for ic=1:length(mAO.SEGChannels) for is=1:mAO.SEGind(ic) if mAO.SEGbuffers{ic}(is)<mAO.mt tind=fi...
081a0c053f7f924a502ecfec3d5bd1c75d89b9b2f68ba9b6928ed102400a3c56
MATLAB
464
21
function nice_plot(var, t) var=real(var); n = inputname(1); closes = count(n, "_"); if contains(n, '_') n = [replace(n, "_", "_{"), repelem("}", closes)]; end plot(t, var, "LineWidth", 2) title(n) xlabel('Time [sec]') ylabel(n) xlim([t(1), t(end)]); ylim([1.5*min([0, min(var)]), 1.5*max([0, max(var)])]); set(gca,'...
1dbc527e348d761b0449599ae92e8f4ee8cf683c9ba8e6c62a6c6de3be707546
MATLAB
464
16
function val = get(gap,prop_name) % GET Get GAP property from the specified object % and return the value. Property names are: % Name, Signal, ETime_comp, STime_comp, Ramp_comp, Comp_list, % Num_of_comps, Comp_list_str. if isa(prop_name,'char') switch prop_name case 'Envelope' val=gap.Envelo...
745ef978f4dc6eb588ca337cba505e0c7503358e739b25ea9ee0de90a8b3f519
MATLAB
466
15
% used in SampleNplot.m % This code was obtained from the following link % https://www.mathworks.com/matlabcentral/answers/467330-how-to-plot-the-roc-curve-for-the-average-of-10-fold-cross-validation-using-matlab#answer_402596 function x= adjust_unique_points(Xroc) x= zeros(1, length(Xroc)); aux= 0.0000...
17a60456c7272e36cebbb0defd53b6912a5d4c89e2e9589d31f4a30c46205dee
MATLAB
468
15
function gap = set(gap,varargin) % SET Set GAP properties and return the updated object % Property names are: % STime_comp, ETime_comp, Ramp_comp. property_argin = varargin; while length(property_argin) >= 2, prop = property_argin{1}; if ~isa(prop,'char') treat_error(['The property input is not a valid ...
1fbb4259bfa5cc1d0917ee7affbf5f5efa32b07fe7e61b2533bb69eeaecbbb03
MATLAB
468
16
function val = get(new_env,prop_name) % GET Get NEW_ENV property from the specified object % and return the value. Property names are: % Name, Signal, Freq_comp, Phase_comp, Comp_list, % Num_of_comps, Comp_list_str. if isa(prop_name,'char') switch prop_name case 'Envelope' val=new_env.Envelo...
6e208588587a24c1884ef572e0ab6e1334f7ad380eeb587359160abb19a13837
MATLAB
468
15
function mtf = set(mtf,varargin) % SET Set MTF properties and return the updated object % Property names are: % Freq_comp, Phase_comp, Depth_comp. property_argin = varargin; while length(property_argin) >= 2, prop = property_argin{1}; if ~isa(prop,'char') treat_error(['The property input is not a valid ...
8df66008f90feec6858fc800727959ff75b76bcdb3b3eff8d9aeda3c6f6bb72d
MATLAB
468
16
function val = get(trapeze,prop_name) % GET Get TRAPEZE property from the specified object % and return the value. Property names are: % Name, Signal, Freq_comp, Phase_comp, Comp_list, % Num_of_comps, Comp_list_str. if isa(prop_name,'char') switch prop_name case 'Envelope' val=trapeze.Envelo...
bcb62f286aedbbfa9a0f84f610d987f1722d942ae624724606e01d03b58a7f95
MATLAB
469
17
function val= get(bbn,prop) % GET Get BBN signal property from the specified object % and return the value. Property names are: % Name, Signal, Level_comp, STime_comp, ETime_comp, Ramp_comp, Envelope_list, % Num_of_env, Num_of_comps, Comp_list, Comp_list_str. if isa(prop,'char') switch prop case 'Main_signal' ...
39d519b3542a3ddf37496c1de1480a04e2ec8f41f5ccc89e1d8affc7ae72c4b8
MATLAB
472
21
function fig_config(allsize) if nargin < 1 allsize = 12; end xaxis_size = allsize * 1.2; yaxis_size = allsize * 1.2; legend_size = allsize; ax = gca; ax.LineWidth = 4; ax.XAxis.FontSize = xaxis_size; ax.YAxis.FontSize = yaxis_size; if not(isempty(...
7b79d28e302b4788116c40556569c4510b40713768de647f4e47d8a76d9ca919
MATLAB
473
27
function FS_Sort(motif) % Sort data by motif %% Custom Paramaters nparams=length(varargin); if mod(nparams,2)>0 error('Parameters must be specified as parameter/value pairs'); end for i=1:2:nparams switch lower(varargin{i}) case 'filt_rad' filt_rad=varargin{i+1}; case 'filt_alpha' filt_alpha=varargin{...
069ce8b2a77ba6103c44fda7b0818f67864a7156107da8ae523661399303f713
MATLAB
474
31
function x_t = generate_Boltzmann(beta,W,N,T) x_t = zeros(N,T); for t=1: T if t > 1 input = beta*W*x_t(:,t-1); prob_vec = sigmoid(input); else prob_vec = rand(N,1); end logic_vec = rand(N,1) < prob_vec; for i=1: N if logic_vec(i) x_t(i,t) = 1; ...
2551bc383bca2556391771b76a8f6e996f25621fd10b0c5e51bd7dac38a7fc0a
MATLAB
477
14
function N = createOrnsteinGaussKern(n,p) % calculation of Ornstein-Uhlenbeck process with Gaussian kernel % calculation a priori for entire time % Gaussian kernel (positive part) as low-pass filter whiteNoise = p.varNoise .* randn(n,p.numSteps); impResp = normpdf(0:p.dt:p.T,0,p.varImpResp); impResp = impResp/norm(...
a63ab54626540105f85ef62cdb24d6c2aca6400c37e6b7162003bac9ad0c6f3e
MATLAB
477
15
function durFreqSet = extractDurFreqSetFromExpAr(expAr) %EXTRACTDURFREQSETFROMEXPAR extracts the duration/frequency set for %ToneStimulus objects from an experimentArray % Arguments: % expAr - the experimentArray % Author: Lasse Osterhagen % Get all ToneStimulus objects tar = expAr(arrayfun(@(x) isa(x, 'ToneStimu...
c22a1c0f091db0eff2915f6668ca46dc682d23748ccc99d1a5ca3a5e373e1585
MATLAB
477
14
function N = createOrnsteinExpKern(n,p) % calculation of Ornstein-Uhlenbeck process with exponential kernel % calculation a priori for entire time % exponential kernel as low-pass filter whiteNoise = p.varNoise .* randn(n,p.numSteps); impResp = exp(-(0:p.dt:p.T)/p.varImpResp )/p.varImpResp; impResp = impResp/norm(i...
3d3b4d19b8d8b4e9a10ee60ec14255b59d7f34c90ef9b193c2740172a6f2559c
MATLAB
478
17
function freq=FREQ(varargin) % FREQ class constructor. switch nargin case 0 % if no input arguments, create a default object m_sig=Main_signal('FREQ'); freq.num_of_comps=5; freq=class(freq,'FREQ',m_sig); freq=add_to_comp_list(freq,'Freq_comp',Freq_comp); case 1 ...
87096c40bfbb379b0181998fa6d3efd4866c09b25612c66789082733a528f780
MATLAB
478
34
function b = removePad(a,pad) y1 = pad(1); y2 = y1 - 1; if length(pad)==1 x1 = pad(1); else x1 = pad(2); end x2 = x1 - 1; if length(pad) == 3 a(:,:,1:pad(3)) = []; a(:,:,end-pad(3)+1:end) = []; end sz1 = size(a,1)-2*y1; sz2 = size(a,2)-2*x1; sz3 = size(a,3); b = zeros(sz1,sz2,sz3); for i = 1:size(...
de723eae3c4c49974027dc3f7b7478b158af25e4f4cc124d29a87ea21247809b
MATLAB
478
15
function line=get_line(meta,index) % GET_LINE returns a Basic-line from the list of lines of the MetaBlock. % META=GET_LINE(META,INDEX) returns the line in the specified index % in this metablock's line list. if (~(isint(index)) || index<1) treat_error('Illegal INDEX input to MetaBlock/get_line'); end list=get(me...
5fd5b66963e4c3a10ca4350e4e0eaa3c7f4e813fc77dcda42df5307f2ba25e7d
MATLAB
479
16
function [clustOut] = hierAgglomClust(emb,dim,thresh,nClust) %hierAgglomClust Cluster using stated threshold or number of clusters linkMeth = 'ward'; clustThresh = thresh; X = emb(:,dim(1):dim(2)); Y = pdist(X); Z = linkage(squareform(Y),linkMeth); maxVal = max(Z(:,3)); if nargin>=4 ...
23de14679b5fa7d2d9bc3cf170bfdabed2bc0c36c4c4d69469b9d1c6db77bf16
MATLAB
480
15
function trapeze = set(trapeze,varargin) % SET Set NEW_ENV properties and return the updated object % Property names are: % Freq_comp, Phase_comp. property_argin = varargin; while length(property_argin) >= 2, prop = property_argin{1}; if ~isa(prop,'char') treat_error(['The property input is not a valid ...
35a989435e1e6607f66d54b2e98cd95818a24bf703ff3a0a71c616f444b508c8
MATLAB
480
15
function lowpass = set(lowpass,varargin) % SET Set lowpass properties and return the updated object % Property names are: % Freq_comp, Phase_comp. property_argin = varargin; while length(property_argin) >= 2, prop = property_argin{1}; if ~isa(prop,'char') treat_error(['The property input is not a valid ...
9b5061b6994a14d8e74d8b1df1d6f6691b3ed16f1008d6bdc648266d6cc3b7b7
MATLAB
480
15
function new_env = set(new_env,varargin) % SET Set NEW_ENV properties and return the updated object % Property names are: % Freq_comp, Phase_comp. property_argin = varargin; while length(property_argin) >= 2, prop = property_argin{1}; if ~isa(prop,'char') treat_error(['The property input is not a valid ...
64869086994ede00a8ab2c485fca807a885c369876604f0df2d674cc7cfed6e6
MATLAB
483
19
function img = gui_MibiPlotDataAndCap(data,cap,titlestr,figureTitle,varargin) global pipeline_data currdata = data; currdata(currdata>cap) = cap; disp('varargin >') disp(varargin) disp('<') if any(strcmp('background', varargin)) if numel(varargin)==2 sfigure(varargin{1}); else pipeline_data.back...
0a4316c7f64347eec787926d6512a56cdabbcef9effba725d3f7f9f8f7a2fe5f
MATLAB
484
19
% Sript for manually testing ContinuousBgndAudioPlayer and % GapStimulusSampleFactory % Author: Lasse Osterhagen load('cBgnAPGapConfig.mat') audioPlayer = depInj.createObjFromTree(audioPlayerConfig); audioPlayer.start(); pause(1); audioPlayer.playAudioObject(GapStimulus('duration', .02)); pause(1); audioPlayer.playA...
134922aacd9e8941eee5379e013f39976cfcf9ef7821cff23c3569c38a221540
MATLAB
486
16
function snr_times = AO_get_snr_times(folders) % JN 2019-02-11 % JN 2020-05-07 fname = fullfile(folders.results, 'snr_times.mat'); if isfile(fname) S = load(fname); log_msg(folders.results, 'load-mat', fname); snr_times = S.snr_times; else snr_times = AO_process_ttls(folders.logging, folders.results);...
97a58d74b33967e5cad59c970a21cc45e490ab3fec9a777fa23af8deb7b19d9f
MATLAB
486
17
function [modelParams] = makeParamMat(Npd, numDuple, direction, decoderN) if strcmp(decoderN,'pvd') if direction==0 tmpVal = linspace(-180, 180, Npd+1); modelParams.PD = tmpVal(2:end); elseif direction==-15 modelParams.PD = linspace(-195, 165, Npd); elseif direction==15 mode...
c5dc1b86c75e80a1b0841764864898add5ac26aa6883e61d1a28668e3ea8e73a
MATLAB
487
15
function mdp_analysis(sounds_table, mdp_table, experimenter, outputdir) % JN 2020-04-26 purpose of this function is simply to make everything % maintanable by splitting code into different files, instead of one huge % code file switch experimenter case "Maciej" mdp_analysis_maciej(sounds_table, mdp_table,...
c385717f7061940ab8bf4da1d7dae6f224ffe000a1ad4ac5a6fcf3508452dba6
MATLAB
490
16
function [rates_ave] = spikeAnalysisFn(tinds,times,params) tBurn = 1000; rates_ave = zeros(params.Npop,1); for jj = 1:params.Npop % indicator for the current population popData = ismember(tinds,params.pinds(jj):params.pinds(jj+1)-1); % indicator for the right time window timeData = times>=tBurn; ...
de3d4db6c2e7ef360d208308f375acfacce3cee25d282eb1d9706c687347cf22
MATLAB
490
21
classdef TestClassB < handle %TESTCLASSB Class for testing createObjFromTree() % This class is used on the second layer of a tree struct. It % containts a two simple properties. % Author: Lasse Osterhagen properties simpleProp1 simpleProp2 end methods ...
dcd50c9827fe67112645410a27db3de89e4d55312ba1f9c8c58ea11b5cb362ed
MATLAB
496
24
clear all clc A=load('6.25mM_AK_NAG_denoise.txt'); for n=1:1:60 for i=1:1:200 reform(200*(i-1)+1:200*i,n)=A(:,(n-1)*200+i); end end %spect_mean=mean(reform); %plot (spect_mean); [Xc,Z]=airPLS(reform,10e7,6,0.1,0.5,20); a=mean(Xc); b=mean(Z); figure plot(a) % title('order=3,lambda=e6'); ...
1d82c2986f8480a6fbb0ecce17752fd123932e9c0a9555c38b1b3fe8771a5d7e
MATLAB
497
13
function [auth_token] = getAuthToken(url, usr) email = usr{1}; pswrd = usr{2}; uri = [url, '/api-token-auth/']; header = matlab.net.http.HeaderField('Content-Type', 'application/json'); body_struct.email = email; body_struct.password = pswrd; body = matlab.net.http.MessageBody(body_struct); ...
c870de4b86eb30c23aaede0d06d7394e9d0856f2233894da767752034b88a6cc
MATLAB
498
25
function gap=GAP(varargin) % GAP class constructor. switch nargin case 0 % if no input arguments, create a default object env=Envelope('GAP'); gap.num_of_comps=3; gap=class(gap,'GAP',env); gap=add_to_comp_list(gap,'STime_comp',STime_comp); gap=add_to_comp_list(gap,'ETime_comp',ETime_comp); gap=add_to_comp_list(gap,'...
9982e99d9252075f2b07e695d0d58cf72c304872e2cb6a02664c8c2819f3bf14
MATLAB
499
14
function trialsStr = extractStimuli(eventLog) %EXTRACTSTIMULI extracts the stimuli from an eventLog cell array. % eventLog is the raw output data of a PsychDetect experiment as it is % saved to a .mat file. % The output of the function will be an array of structs that contains % all stimuli played. % Author: ...
b25a85995f598d43457ecd945fff7460be09ae61133eee0f82454882fc7dc894
MATLAB
499
17
function synth=get_synth_chans(line,right_ear,left_ear) synth_chans=zeros(1,4); if (~isempty(findstr('1',right_ear)) || ~isempty(findstr('1',left_ear))) synth_chans(1)=1; end if (~isempty(findstr('2',right_ear)) || ~isempty(findstr('2',left_ear))) synth_chans(2)=1; end if (~isempty(findstr('3',right_ear)) || ...
a6f42710dde67971239105ab2183bf98c6dd74678b4cff65d1f8f20a725d198b
MATLAB
500
21
function [sub, text] = sub_text(text,columns,breaks) if numel(text)<=columns sub = text; else found = false; index = columns; for i=columns:-1:1 if contains(breaks, text(i)) sub = text(1:i); text = text((i+1):end); found...
632dd16feac9e6a80a346f5f8680edde2233561009e0ab41ef65d88a735b4794
MATLAB
502
15
% Create a SOC Claustrum Network gamma = 9; rate = 10; desired_SA = 0.3; % Create claustrum network with connectivity from literature: % E-E connectivity: 0.03 (Kim et al., JNeurosci 2014) % E-I & I-E connectivity: 0.4 (Kim et al., JNeurosci 2014) % I-I connectivity: 0.5 (Kim et al., JNeurosci 2014, Chia et ...
a80ce9e2ec3503343e772b0ad014da2607e5f91ecba035cfdba483d7f2917608
MATLAB
504
25
function mtf=MTF(varargin) % MTF class constructor. switch nargin case 0 % if no input arguments, create a default object env=Envelope('MTF'); mtf.num_of_comps=3; mtf=class(mtf,'MTF',env); mtf=add_to_comp_list(mtf,'Freq_comp',Freq_comp(20)); mtf=add_to_comp_list(mtf,'Phase_comp',Phase_comp); mtf=add_to_comp_list(mt...
5c6d83314e1c50f8f52ab4824fdc1d49c6e61e9308845cd37f4b73eea5e4715a
MATLAB
505
16
function val = get(freq,prop_name) % GET Get FREQ property from the specified object % and return the value. Property names are: % Name, Signal, Level_comp, STime_comp, ETime_comp, Ramp_comp, Envelope_list, % Num_of_env, Comp_list, Num_of_comps, Comp_list_str. if isa(prop_name,'char') switch prop_name case...
56515eb8f1b74c064add38aa0727b2018d1c9daab6550b39ce86b96f267e81be
MATLAB
507
17
function [outputArg1,outputArg2] = scatterText(x,y,z,useText,useColor,fontSize,fontWeight) %UNTITLED4 Summary of this function goes here % Detailed explanation goes here if ~exist('fontSize','var') fontSize = 6; end if ~exist('fontWeight','var') fontWeight = 'normal'; end hold on; for iTxt = 1:lengt...
7fbaf138ac7309132d023dc4005da349fe997f4852c5c10135e763e885d113c7
MATLAB
509
17
function bbn= set(bbn,varargin) % SET Set BBN properties and return the updated object % Property names are: % Level_comp, STime_comp, ETime_comp, Ramp_comp, Envelope_list. property_argin = varargin; while length(property_argin) >= 2, prop = property_argin{1}; if ~isa(prop,'char') treat_error(['The prop...
8615ded4b7268367128dfcdee22f0432cb3fabd4ee4f98331b43c4f923edd640
MATLAB
509
16
function val = get(nb,prop_name) % GET Get NB property from the specified object % and return the value. Property names are: % Name, Signal, Level_comp, STime_comp, ETime_comp, Ramp_comp, Phase_comp, Envelope_list, % Num_of_env, Comp_list, Num_of_comps, Comp_list_str. if isa(prop_name,'char') switch prop_name ...
a10a6473128c0b9b60b4c1484242315ddfe1a67a50013384143275ee45b6e3db
MATLAB
509
14
function filteredData = gui_MibiFilterImageByNNThreshold(data,NNVec,nnValToRemov) % function filteredData = MibiFilterImageByNNThreshold(data,NNVec,nnValToRemov) % function receives an image and filters it according to the nearest % neighbour results filteredData = data; posSignal=find(filteredData); if ~isempty(posSi...
f3931f02eccdfea7f558dee9b15bd4dc5b63e291fa3c85caa9b8cb5eb30bf4f8
MATLAB
509
27
classdef (Abstract) LogbookState < handle %LOGBOOKSTATE is the base class of all experimental states. % An experiment traverses different states. Those states are reflected in % the Logbook, which keeps track of them. % Author: Lasse Osterhagen properties (Access = protected) % Reference to LogbookEvaluat...
1d952e2d19d7a5457fa1d8d7daa535bde73e2cd0db85c034d92ecba1632687d7
MATLAB
510
20
function [dd_T , df_T, I_CaT] = T_Type_calcium(V, d_T, f_T) g_CaT = 6*10; E_CaT = 38; alpha_d_t = 674.173.*exp((V + 23.3)./30); beta_d_t = 674.173.*exp(-(V + 23.3)./30); tau_d_t = 1./(alpha_d_t + beta_d_t); d_tm = 1./(1 + exp(-(V + 23)./6.1)); dd_T = (d_tm - d_T)./tau_d_t; alpha_f_t = 9.637.*exp(-(V + 75)./83.3); be...
d8c050f2764740925bda59d7fe32c032236f703d1ff6bd7779b7d3efab92b157
MATLAB
511
24
function new_env=NEW_ENV(varargin) % NEW_ENV class constructor. switch nargin case 0 % if no input arguments, create a default object env=Envelope('NEW_ENV'); new_env.num_of_comps=3; new_env=class(new_env,'NEW_ENV',env); new_env=add_to_comp_list(new_env,'Freq_comp',Freq_comp(20)); new_env=add_to_comp_list(new_env,'P...
f09bf8aed8464628e5ed17905abc25a85249606b66e04aaeabb819bfc8046e70
MATLAB
513
17
%% ________Merge functional scans from different sessions____________ % function file_merge=epi_merge(fsldir, subjectdir, scans) k = strfind(subjectdir,'subject'); sub = [subjectdir(k:end),' - ']; cd(subjectdir); T = datetime('now'); time = whatsthetime(T); fprintf([time, sub, ': ','Merge all nii files ... ']) cmd=...
0b5034be2e6c107a48fc16bc2a569ff54845d1d224d896040bd405a40fa867af
MATLAB
515
20
function comp_val=get_comp_by_crid(signal,crid) % GET_COMP_BY_CRID search for the first component in the signal with % the given coordination-index(crid) and returns that component. if (~isint(crid) || (crid<0)) treat_error('Illegal CRID input - must be a positive integer'); end comp={}; comp_list=get_comp_list(...
aaf73f1ca956138720501cc32aed7651c2d551f16361bde70d331c007302e404
MATLAB
515
18
function succeeded=set_tag_val(rx8,tag_name,val) succeeded=1; actx_cntrl=get(rx8,'Controler'); check=invoke(actx_cntrl,'SetTagVal',tag_name,val); if ~check succeeded=0; global Out_Manager; if ~isempty(Out_Manager) fid=get(Out_Manager,'Fid'); dev_num=get(rx8,'Device_num'); if ~(fid==-...
0ddfe43ca80cf6559d0e0e2c07f1c264e501e86d363418c2d1d1171747039bfd
MATLAB
516
21
function val = get(comp,prop_name) % GET get Freq_comp property from the specified object % and return the value. Property names are: % Sig_comp,Name,Swp_on,Seq_on,Static_value,Sweep,Seq_values. global FREQ_COMP_DEFAULT; if isa(prop_name,'char') switch prop_name case 'Sig_comp' val = comp.Sig_comp; case 'Name' ...
5d5a755a9ee739ff1c3e6ff1a835b0b60d9e9206d895a63f436ef90a20a4b90a
MATLAB
519
21
function val = get(comp,prop_name) % GET Get STIME_comp property from the specified object % and return the value. Property names are: % Name,Sig_comp,Swp_on,Seq_on,Static_value,Sweep,Seq_values. global STIME_COMP_DEFAULT; if isa(prop_name,'char') switch prop_name case 'Sig_comp' val = comp.Sig_comp; case 'Name'...
c87ef67c43018a50da8562d38472c780291f4012cd4e6b9e483c29c04d359932
MATLAB
520
19
function last_idx_before_skip = find_skipped_mpx_file(snr_table) % JN 2019-06-10 % check if there is a "lost .mpx file" and return last "sane" index if ismember('DatedFromFileNo', snr_table.Properties.VariableNames) sort_column = snr_table.DatedFromFileNo; else sort_column = snr_table.FromFileNo; end fnum_d...
8188e7131d6140331035422cc0b763a6bf2460fb769f53ceb4091a74d12747eb
MATLAB
526
14
function data = dt2_read_kilosort2(fname, n_channels) % AK 07/02/2019 % Don't convert to double and don't convert to uV fid = fopen(fname, 'r'); int_data = fread(fid, 'uint16=>uint16'); fclose(fid); % Memory math: Typical 'NEUR0000.DT2' file from 31.01.19 is 16MB. Length of recording is 8.19 seconds % When loaded as ...
bce8dd46fe4c1094f9a7d472e5823f8aa5a243f2c1f59a88e98cf4b0c9c42eaa
MATLAB
526
16
function freq = set(freq,varargin) % SET Set FREQ properties and return the updated object % Property names are: % Level_comp, STime_comp, ETime_comp, Ramp_comp, Freq_comp, Envelope_list. property_argin = varargin; while length(property_argin) >= 2, prop = property_argin{1}; if ~isa(prop,'char') treat_e...