plateform stringclasses 1
value | repo_name stringlengths 13 113 | name stringlengths 3 74 | ext stringclasses 1
value | path stringlengths 12 229 | size int64 23 843k | source_encoding stringclasses 9
values | md5 stringlengths 32 32 | text stringlengths 23 843k |
|---|---|---|---|---|---|---|---|---|
github | xyza11808/MATLAB-master | MergeGUI.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortGUI/MergeGUI.m | 7,356 | utf_8 | 1cec49a8855ff13f839fdb39b02c0e55 | %
% main file for graphical user interface for Osort
%
% initial version written by Matthew McKinley, Summer 2007.
%
%
%
function varargout = MergeGUI(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
... |
github | xyza11808/MATLAB-master | DefineUsableClustersGUI.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortGUI/DefineUsableClustersGUI.m | 7,339 | utf_8 | 9cfc1dc54f84fa4625cd826674fac95f | function varargout = DefineUsableClustersGUI(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @DefineUsableClustersGUI_OpeningFcn, ...
... |
github | xyza11808/MATLAB-master | mergeClustersAutomatic.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortGUI/mergeClustersAutomatic.m | 1,653 | utf_8 | efac74fdaf384b41e4089de1ee96854b | %
%merges two clusters and saves an updated file.
%this is the function version of the script mergeClusters.m
%
%
function mergeClustersAutomatic(figureoutpath,cluster,channel1,channel2);
display(['merging clusters: ' num2str(cluster) '...']);
global PATH;
outPath = [PATH];
basePathFigs=[figureoutpath];
if exist(out... |
github | xyza11808/MATLAB-master | Osort.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortGUI/Osort.m | 32,480 | utf_8 | 77bed535367e3df2c2f38c034c5a2098 | %
% main file for graphical user interface for Osort
%
% initial version written by Matthew McKinley, Summer 2007.
%
%
%
%% initialize GUI
function varargout = GUI(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @GUI_Ope... |
github | xyza11808/MATLAB-master | copyFieldIfExists.m | .m | MATLAB-master/osort/osort-v3-rel/code/helpers/copyFieldIfExists.m | 373 | utf_8 | e209aa89ffcc47dc53e3e97ef2425f7a | %
% gets the value of a variable in a struct if the field exists; if not, the default value is assigned.
% helper function to read parameters from structs
%
% uses dynamic field names
%
%urut/sept08
function val = copyFieldIfExists( s, fieldname, default )
if isfield(s,fieldname)
val = s.(fieldname); %a dynamic... |
github | xyza11808/MATLAB-master | determineFigExportFormat.m | .m | MATLAB-master/osort/osort-v3-rel/code/helpers/determineFigExportFormat.m | 355 | utf_8 | dfa39e7e6857744e7e7c35a3cd804436 | %determines the options for figure export, according to the file suffix (i.e. png, eps)
%
%
function [outputEnding,outputOption] = determineFigExportFormat( outputFormat )
%determine output format for exported figures
outputOption = ['-d' outputFormat];
if outputFormat=='eps'
outputOption = [ outputOption 'c2'];
end
o... |
github | xyza11808/MATLAB-master | copyStructFields.m | .m | MATLAB-master/osort/osort-v3-rel/code/helpers/copyStructFields.m | 883 | utf_8 | 6ff409239721010e047335eb13da9c61 | %
%copies a list of fields from a source to a target structure
%
%fields -> cell array of strings. entries in the cell array can also be an other cell array
%with two string entries: src and target. (to rename fields).
%
%i.e. fieldsSrc = {'a1',{'a2','a3'}, {'from','to'})
%
%will copy target.a1=src1 and target.a3=src2.... |
github | xyza11808/MATLAB-master | sortMain.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortTextUI/sortMain.m | 1,365 | utf_8 | 2c3f51efd8a4c4f7121ae05ef8dce6be | %
%
%mode: 1=with GUI; 2=no GUI (textmode
%
%thresholdMethod: 1=approximation (std), 2=exact (whitened data)
%
function handles = sortMain( hObject, handles, mode, thresholdMethod )
defineSortingConstants;
handles.correctionFactorThreshold
stdEstimate = handles.stdEstimateOrig + handles.correctionFactorThreshold * h... |
github | xyza11808/MATLAB-master | produceFigures.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortTextUI/produceFigures.m | 3,412 | utf_8 | e7fcb8457842fab15147655af1fe23b5 | %
%plots figures that show the result of clustering
%
function produceFigures(handles, outputpath,outputFormat, thresholdMethod)
paperPosition=[0 0 16 12];
figure(123);
close(gcf);
colors = defineClusterColors;
rawWaveforms = handles.newSpikesNegative;
if isfield(handles,'scalingFactor')
rawWaveforms = rawWavef... |
github | xyza11808/MATLAB-master | produceThresholdFig.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortTextUI/produceThresholdFig.m | 2,029 | utf_8 | b977929622562beaf00eff484ca045f8 | %
%produces a figure showing the number spikes found as a function of different thresholds.
%this figure can be used to find the optimal extraction threshold btw the limit between SUA/MUA
%
%urut/nov06
function handles = produceThresholdFig( handles , figPath, thresholds )
if exist(figPath)==0
mkdir(figPath);
end
d... |
github | xyza11808/MATLAB-master | defineClusterColors.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortTextUI/defineClusterColors.m | 207 | utf_8 | d6abee0cf34fe19103b624eb5e0826a2 | %
% the order of colors used for plotting clusters, from big to small.
%
function colors = defineClusterColors
colors={'r','g','b','k','y','m','c','r','g','b','k','y','m','c','r','g','b','k','y','m','c'};
|
github | xyza11808/MATLAB-master | StandaloneInit.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortTextUI/StandaloneInit.m | 3,295 | utf_8 | a94edc8bb99f222ecf45d32ecc1e5a8b |
%
%does detection standalone
%prewhiten: 0/1. prewhiten of the raw signal,before extraction of spikes.
%alignMethod: 1 (pos), 2 (neg), 3 (mixed)
%
%
function handles = StandaloneInit( handles , tillBlocks, prewhiten, alignMethod,includeRange )
handles = initFilter(handles);
%read timestamps
[timestamps,nrBlocks,nrSam... |
github | xyza11808/MATLAB-master | prepareFigure.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortTextUI/prepareFigure.m | 388 | utf_8 | 82f319dc1bd43dbb8fcd70a722669734 | %
%
%pos==1:upper half
% 2:lower half
%
function prepareFigure(nr,pos)
get(0,'screensize');
w=ans(3);
h=ans(4);
x=ceil(w/2)+5;
y=ceil(h/2)+2;
ww=x-8;
wh=y-76;
if pos==1
screen = [0 , y, 2*ww, wh];
end
if pos==2
screen = [0 , 0, 2*ww, wh];
end
figure(nr);
set(gcf, 'position',screen);
set(gcf,'... |
github | xyza11808/MATLAB-master | initFilter.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortTextUI/initFilter.m | 1,154 | utf_8 | e766df0163766117b1a6213abcf4fb9d | %
%designs the bandpass filter used for spike detection/extraction
%
%the pass band is 300-3000
%default sampling freq is 25kHz unless the handles.samplingFreq variable is set.
%
%This file can either accept parameters with in the handles array (for GUI
%purposes) or with separate list of arguments
%
%urut
function [ha... |
github | xyza11808/MATLAB-master | produceProjectionFigures.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortTextUI/produceProjectionFigures.m | 2,081 | utf_8 | 87e37266abb060b9df7ea0366613eb31 | %
%plots and exports projection test figures
%
function produceProjectionFigures(handles, outputpath,outputFormat, thresholdMethod)
paperPosition=[0 0 16 12];
%make dir to store the figures
if exist(outputpath)==0
mkdir(outputpath);
end
colors = defineClusterColors;
rawWaveforms = handles.newSpikesNegative;
%order ... |
github | xyza11808/MATLAB-master | StandaloneGUI.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortTextUI/StandaloneGUI.m | 7,025 | utf_8 | c85c293f91030dd6f56e3f619ddadaa1 | %
%main functions for unsupervised sorting. this function is called by
%either the UI or by a script.
%
%urut/may07
function StandaloneGUI(paths, filesToProcess, thres, normalizationChannels, paramsIn)
starttime=clock;
timeSortingStats=[]; %i time nrSpikesSorted
timeDetectionStats =[];%i time duration(in blocks of 51... |
github | xyza11808/MATLAB-master | loadSortResultFiles.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortTextUI/loadSortResultFiles.m | 2,491 | utf_8 | bdd5021f9a38f50571280794543e968a | %loads results of sorting/detection (if already done)
%
%1=GUI (TODO: not supported right now, wont work.)
%2=without GUI
%
%fileexists: is 0 if the file did not exist
%
function [handles,fexists] = loadSortResultFiles(hObject,handles,mode)
if mode==1
handles.from=get(handles.fieldFrom,'String');
[handles] = GUIInit... |
github | xyza11808/MATLAB-master | produceRawTraceFig.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortTextUI/produceRawTraceFig.m | 4,102 | utf_8 | a8c1ab5cfc7a4f023a6f91d8c4500e9b | %
%produces a figure of the raw data traces and saves it in a file
%
%urut/feb05
%
function handles = produceRawTraceFig( handles , figPath, outputFormat)
if exist(figPath)==0
mkdir(figPath);
end
%get timestamps and header info
handles = initFilter(handles);
[timestampsRaw, nrBlocks,nrSamples,sampleFreq,isContino... |
github | xyza11808/MATLAB-master | storeSortResultFiles.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortTextUI/storeSortResultFiles.m | 3,673 | utf_8 | ae1e84224ed8e2ef5ac24e8f5cff20ee |
%
%mode==1:store figures
%mode==2:store no figures
%
%displayMode==1: with GUI, 2: without GUI
%
%
function handles = storeSortResultFiles( hObject, handles, mode, displayMode )
versionCreated = 300;
filenamePrefix='';
if displayMode==1
filenamePrefix = [handles.basepath handles.prefix get(handles.labelCurrentBloc... |
github | xyza11808/MATLAB-master | plotClusterPairs.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortTextUI/plotClusterPairs.m | 2,342 | utf_8 | 93b1758f2a6b61142bbe29d50492efea | %
% plots, for a pair of clusters, the mean waveforms and ISI for easier
% comparison (on top of each other)
%
% plotMode:1 waveforms, 2 ISIs, 3 projection test
%
%
%urut/sept09
function plotClusterPairs( waveforms, assigned, timestamps, allSpikesDecorrelated, clNr1, clNr2, plotMode, col1, col2, titlep )
indsCl1 ... |
github | xyza11808/MATLAB-master | produceOverviewFigure.m | .m | MATLAB-master/osort/osort-v3-rel/code/osortTextUI/produceOverviewFigure.m | 2,326 | utf_8 | 8680efb63ede9be2cf3bd2fbb8539baf | %
%overview figure which plots, for each pair of clusters, the mean/std of
%mean waveform and ISIs on top of each other for easy comparison.
%
function produceOverviewFigure(handles, outputpath, outputFormat, thresholdMethod)
MAX_NR_CLUSTERS=10;
paperPosition=[0 0 16 12];
%% get data and organize
rawWaveforms = handle... |
github | xyza11808/MATLAB-master | detect_spikes_wavelet.m | .m | MATLAB-master/osort/osort-v3-rel/code/3rdParty/cwtDetection/detect_spikes_wavelet.m | 6,655 | utf_8 | e32f6e48de6339d536ea21a808d7af24 | function TE=detect_spikes_wavelet(Signal,SFr,Wid,option,L,wname, ...
Plot,Comment)
% DETECT_SPIKES_WAVELET wavelet based algorithm for detection of transients
% from neural data.
%
% TE=DETECT_SPIKES_WAVELET(Signal,SFr,Wid,'option',L,'wname',Plot,Comment)
%
% Signal - spike train to be analyzed 1 x Nt;
%
% S... |
github | xyza11808/MATLAB-master | assignSpikesToClusters.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/assignSpikesToClusters.m | 1,152 | utf_8 | 2f2bc881d732a88075aec84b179dd48c | %
%this function is a very much simplified version of sortSpikesOnline.m
%It takes a number of precomputed cluster centers and assigns each spike to them, if they
%are within the threshold. all others are assigned to noise. no new clusters are removed/merged.
%
%urut/sept06
function assigned = assignSpikesToClusters(ba... |
github | xyza11808/MATLAB-master | calculateDistance.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/calculateDistance.m | 215 | utf_8 | 790bfb4ea1ad18817c6b87a8e266f27e | %
%distance measure between different spikes.
%
%
function diffs = calculateDistance(baseClusters, to, weights)
diffs = ((baseClusters - repmat(to, size(baseClusters,1),1)).^2)*weights ; %/ (size(baseClusters,2));
|
github | xyza11808/MATLAB-master | removeWhitenoise.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/removeWhitenoise.m | 815 | utf_8 | 647ef13db73cf19c280d3342b7d2d8e0 | %
%uses truncated SVD to remove white noise from pre-whitened waveforms.
%returns a low-rank approximation of the original signal.
%
%
%rankCut: cut off after which rank
%
%returns: spectr is the singular value spectrum (diag of S)
% transformed is low rank approx
%
%urut/nov04
function [transformed,spectr] = r... |
github | xyza11808/MATLAB-master | findInitialMeanWaveforms.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/findInitialMeanWaveforms.m | 989 | utf_8 | 084f60654d1580f2a1546bfee485b64c | %
%processes a block of spikes (after detection) and returns the threshold
%for clustering and the mean waveforms for assigning individual spikes to
%clusters.
%
%inputs:
%spikes
%timestamps
%stdEstimate: estimate of std of filtered raw signal (for threshold
%calculation)
%
%minClustSize: min number of spikes that need... |
github | xyza11808/MATLAB-master | calculateDistanceNorm2.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/calculateDistanceNorm2.m | 567 | utf_8 | 989b6a7d6cbd81399f4e633b8b911a61 | %
%norm as distance measurements (if whitened). takes all whitened spikes of
%two clusters and calculates the distance in terms of standard deviations
%(projection test).
%
%spikes: whitened spikes
%baseClusters: all baseclusters
%baseSpikesID: mapping of IDs to basecluster indexes
%toID: id of to cluster
%assigned: to... |
github | xyza11808/MATLAB-master | calculateDistanceNorm.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/calculateDistanceNorm.m | 733 | utf_8 | b271ef23fee3b4e09da65ab187a864f4 | %
%norm as distance measurements (if whitened). takes all whitened spikes of
%two clusters and calculates the distance in terms of standard deviations
%(projection test).
%
%spikes: whitened spikes
%baseClusters: all baseclusters
%baseSpikesID: mapping of IDs to basecluster indexes
%toID: id of to cluster
%assigned: to... |
github | xyza11808/MATLAB-master | realigneSpikes.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/realigneSpikes.m | 3,205 | utf_8 | 378bc43b385b9de451327079008f0731 | %
%realign spikes (after they were upsampled to 100KHz).
%
%input:
%allSpikes: spikes before realignment
%allTimestamps: timestamps of those (will be adjusted).
%alignParam: this param is only considered if peakAlignMethod=1.
% 1: positive (peak is max)
% 2: negative (peak is min)
% 3: mixed
%stdEstima... |
github | xyza11808/MATLAB-master | calcDistMacro.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/calcDistMacro.m | 323 | utf_8 | 0140d66509e3618b6337cabc34ef2ed5 | %calculate the appropriate distance for the method chosen
%
%used by sortSpikesOnline.m
%
%urut
function D=calcDistMacro(thresholdMethod, baseSpikes, testSpike, weights,Cinv)
if thresholdMethod==1
D=calculateDistance(baseSpikes, testSpike, weights);
else
D=calculateDistanceChi2(baseSpikes, testSpike, Cinv);
en... |
github | xyza11808/MATLAB-master | clusterSpikes.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/clusterSpikes.m | 3,142 | utf_8 | 5cad43cb81a0a28c5862ca608ab94158 | %first step in online spike sorting.
%
%clusters spike according to their form.
%
%thres is the sensitive parameter -- change if result is not satisfying.
%
%
%%urut/april04
function [NrOfclustersFound, assigned] = clusterSpikes( allSpikes, allTimestamps,thres )
%thres=500;
%weights=ones(1,256);
%weights = [ ones(1,2... |
github | xyza11808/MATLAB-master | clusterMeans.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/clusterMeans.m | 3,398 | utf_8 | dcd421634f56aa65906fc5ef60092987 | %
%merges mean waveforms of found clusters, according to order (meanClusters
%is sorted, first one is strongest).
%
%urut/april04
%------
function [newMeans,success] = clusterMeans(meanClusters, nrAssigned, thres)
success=false;
newMeans=meanClusters;
if size(meanClusters,1)==1
return;
end
x=1:size(meanClusters,... |
github | xyza11808/MATLAB-master | plotSortingResultRaw.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/plotSortingResultRaw.m | 2,590 | utf_8 | f21c55759c6bd7fce80101e41d3665ea | %displays the raw waveforms of all spikes that were assigned to a valid
%cell.
%
%urut/april04
function plotSortingResultRaw(spikesPos, spikesNeg, assignedPos, assignedNeg, toUsePos, toUseNeg, label, colors )
nrDataPoints=size(spikesPos,2);
%raw , sorted
for k=1:2
allSpikes=[];
assigned=[];
toUse=[];
... |
github | xyza11808/MATLAB-master | postDetectionFilter.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/postDetectionFilter.m | 498 | utf_8 | 5d3a1ea8663ec9ee522723f8f3cdb6bf | %
%erases spurious spikes that dont have a sufficient overshoot
%
%
%
function [newSpikes,newTimestamps, didntPass] = postDetectionFilter( allSpikes, allTimestamps)
toKeep=zeros(1,size(allSpikes,1));
for i=1:size(allSpikes,1)
currentSpike = allSpikes(i,:) ;
if abs(min(currentSpike)) >= 0.3* max(curre... |
github | xyza11808/MATLAB-master | convertToSpiketrain.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/convertToSpiketrain.m | 495 | utf_8 | 31c030444b226e8d4dbf917dc22e5a0e | %
%converts array of timestamps to spiketrain, with 1ms binsize
%
%binsize: in ms
%
%
function n = convertToSpiketrain(timestamps, binsize)
if nargin<2
binsize=1;
end
spiketrain=(timestamps/1000); %now in ms
spiketrain=spiketrain-spiketrain(1); %offset gone
roundedSpiketrain = round(spiketrain);
if binsize==1
... |
github | xyza11808/MATLAB-master | createMeanWaveforms.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/createMeanWaveforms.m | 1,315 | utf_8 | 7ce8d5c946d68dc3d03417c845e04b46 | %merges similar mean waveforms of different clusters.
%
%minClustSize: min number of spikes that need to be associated to a cluster
%for it to be considered a mean waveform
%
%
%returns:
%meanWaveforms: mean waveforms of top clusters
%meanClusters: merged mean waveforms
%
%
%
function [meanWaveforms,meanClusters,meanCl... |
github | xyza11808/MATLAB-master | plotMeanWaveforms.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/plotMeanWaveforms.m | 1,835 | utf_8 | a539f34b8711624a1bc85fc4006274c5 | %
%shows mean waveforms and merged mean waveforms
%
%urut/april04
function plotMeanWaveforms( meanWaveforms, meanClusters, threshold, stdEstimate, label)
if size(meanWaveforms,1)==0
return;
end
plotLims=[-2200 2200];
[weights,weightsInv] = setDistanceWeight(1:256,1);
subplot(2,3,1)
plot(meanWaveforms(1,:), 'g'... |
github | xyza11808/MATLAB-master | posthocWhiten.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/posthocWhiten.m | 1,118 | utf_8 | 674b819345ac4b00fbedeba74ce253ba | %
%post-hoc whitening & upsampling of waveforms
%
%used in cases when online estimate of covariance is unstable
%
%returns:
%trans: transformed spikes
%corr:autocorrelation function of the noise
%stdWhitened: std of the whitened waveforms. if this is substantion > 0 -> electrode moved.
%
%
%urut/nov05
function [trans, ... |
github | xyza11808/MATLAB-master | plotRawWithHist.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/plotRawWithHist.m | 475 | utf_8 | 3d8012447bf0ee8362a3a13d6c2b937f | %plot raw
function plotRawWithHist(label, allSpikes, allTimestamps)
subplot(2,1,1)
plot( allSpikes','b');
xlim( [1 256] )
xlabel('samples (1...256=2.5ms). 0.01ms per step');
ylabel('[uV]');
title(['raw waveforms n=' num2str( size(allSpikes,1)) ' ' label ]);
subplot(2,1,2)
d = diff(allTimestamps);
d = d/1000; %in ms
... |
github | xyza11808/MATLAB-master | getStatsForCluster.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/getStatsForCluster.m | 1,119 | utf_8 | 49e63269516316b2b72a7e624768a8af | %
%calculates various statistics for a putative cell
%
%returns:
%percentageBelow(1): % below 3.0ms in range 0...70
%percentageBelow(2): % below 3.0ms in range 0...700
%
%urut/04
function [f,Pxxn,tvect,Cxx,edges1,n1,yGam1,edges2,n2,yGam2,mGlobal,m1,m2,percentageBelow,CV] = getStatsForCluster(spikes, timestamps)
d = di... |
github | xyza11808/MATLAB-master | plotClusters.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/plotClusters.m | 2,031 | utf_8 | 28944cd51e0bcb4d8095b73ec57f2075 | %
%plots the 10 biggest clusters (or less if not available).
%
%urut/april04
function plotClusters(allSpikes, allTimestamps, assigned, label)
spikeLength=size(allSpikes,2);
clusters = unique( assigned );
nrClusters=length(clusters);
%plot detected clusters
cl=1;
till=size(allSpikes,1);
for i=1:nrClusters
cl... |
github | xyza11808/MATLAB-master | mergeNegativePositiveSpikes.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/mergeNegativePositiveSpikes.m | 790 | utf_8 | c0626235f218bff65baa2c26dcf1cc4d | %
%merges negative and positive spikes together
%
%urut/april04
function [allSpikes,allTimestamps] = mergeNegativePositiveSpikes(OKspikesPositive, OKspikesNegative, OKtimestampsPositive, OKtimestampsNegative)
allSpikesAndTimestamps = zeros( length(OKtimestampsPositive)+length(OKtimestampsNegative), 257);
allSpikesAnd... |
github | xyza11808/MATLAB-master | calculateDistanceChi2.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/calculateDistanceChi2.m | 658 | utf_8 | 14ff571e22d1f3655898e97866008694 | %
%distance measure between different spikes.
%
%version that uses covariance matrix. Cinv is the inverted covariance
%matrix
function diffs = calculateDistanceChi2(baseClusters, to, Cinv)
n=size(baseClusters,1);
diffs=zeros(n,1);
for i=1:n
%diffs(i) = (baseClusters(i,:) - to) * Cinv * (baseClusters(i,:) - to)'... |
github | xyza11808/MATLAB-master | RBFconv.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/RBFconv.m | 510 | utf_8 | 1ccff60f8d1fb086d1a63ad8ca512fdc | %
%fits radial basis function to each spike and returns coeffiecents.
%
%
%
function [spikesRBF, spikesSolved] = RBFconv( spikes )
%spikesSolved=spikes;
%return;
x=1:size(spikes,2);
nrOfCenters = 16;
centers = linspace( x(1), x(end), nrOfCenters ); % pick centers
spikesRBF=zeros(size(spikes,1), nrOfCenters);
spik... |
github | xyza11808/MATLAB-master | filterAndRBF.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/filterAndRBF.m | 1,417 | utf_8 | e63a4c7f83fa0ec920fb86f9d12eec79 | %
%does realignment at maximum, performs various tests before/after filtering
%to exclude spurious waveforms and converts to RBF representation.
%
%allSpikes: waveforms
%allTimestamps: timestamps for this waveforms
%stdEstimate: estimate of std of raw signal
%
%type 1(positive), 2(negative)
function [spikesSolved, newS... |
github | xyza11808/MATLAB-master | sortSpikesOnline.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/sortSpikesOnline.m | 12,497 | utf_8 | bf0c87ef306ce7e166da0ce467b0a257 | %
%online sorting
%
%thresholdMethod:
%1 -> use raw data. stdEstimate is threshold in this case.
%2-> use covariance. stdEstimate is chi2 value in this case. covariance
%matrix Cinv needs to be given. Cinv is the inverted covariance matrix.
%
%
%urut/nov04; major revision urut/nov05
function [assigned, nrAssigned, bas... |
github | xyza11808/MATLAB-master | getMeanSpikeForms.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/getMeanSpikeForms.m | 609 | utf_8 | 1bd95f933aee98a6a292f2a17b2811a3 | %
%returns the mean waveform of all clusters.
%
%urut/april04
function meanSpikeForms = getMeanSpikeForms(allSpikes, assigned,nrOfClustersFound )
meanSpikeForms = zeros(nrOfClustersFound,size(allSpikes,2));
for i=1:nrOfClustersFound
spikesToDraw = allSpikes( find(assigned==i),:);
%if only one s... |
github | xyza11808/MATLAB-master | calculatePowerspect.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/calculatePowerspect.m | 201 | utf_8 | 015241ca36faabbe69b32f1582181cd1 | %
%calculate powerspectrum and autocorrelation
%
function [f,Pxxn,tvect,Cxx] = calculatePowerspect(n, binsize)
if nargin<2
binsize=1; %1ms
end
[f,Pxxn,tvect,Cxx] = psautospk(n,binsize);%1=binsize
|
github | xyza11808/MATLAB-master | calculateDistanceT2.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/calculateDistanceT2.m | 768 | utf_8 | ece4ff6ea6c90288270f445ae690fafe | %
%distance measure between mean waveforms (mean of clusters).
%
%version that uses covariance matrix. Cinv is the inverted covariance
%matrix
function [diffs,thresholds] = calculateDistanceT2(baseClusters, to, toID, Cinv, baseSpikesCounter)
alpha=0.05;
p=size(baseClusters,2);
n=size(baseClusters,1);
diffs=zeros(n,1)... |
github | xyza11808/MATLAB-master | calcFDist.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/calcFDist.m | 624 | utf_8 | f1185dc7aca6c13d6a0bb73004ea07c0 | %
%distance between two means, F distributed
%
%eq 6.23 on pp284 of Johnson&Wichern
%
%params:
%p: dimensionality (number datapoints per sample)
%n1/n2: number items in mean1/2
%sp1/sp2: mean waveforms
%Cinv: inverse covariance matrix
%alpha:significance values
%
%returns:
%dist -> left hand side of eq6.23
%c2 -> c2 va... |
github | xyza11808/MATLAB-master | plotSingleCluster.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/plotSingleCluster.m | 2,630 | utf_8 | 7e4b812d4e7b3375e585fa695ee1ceed | %
%plots details about a single cluster
%
function plotSingleCluster(allSpikes, allTimestamps, assigned, label, clusterNr, spikeColor)
spikeLength=size(allSpikes,2);
cluNr=clusterNr;
spikesToDraw = allSpikes( find(assigned==cluNr),:);
timestamps = allTimestamps( find(assigned==cluNr) );
%for plotting/figures -- plot ... |
github | xyza11808/MATLAB-master | assignToWaveform.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/assignToWaveform.m | 3,101 | utf_8 | 62f470590361a709499237aa37d7841b | %
%
%assign spikes to one of the waveforms supplied or throw away as noise
%
%cluster nr 999 is noise
%
function [assignedCluster, rankedClusters ] = assignToWaveform(allSpikes, allTimestamps, meanWaveforms, defaultThreshold, stdEstimate, maxDistance, envelopeSize)
assignedCluster = zeros(1,size(allSpikes,1));
noiseC... |
github | xyza11808/MATLAB-master | setDistanceWeight.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/setDistanceWeight.m | 19,126 | utf_8 | 037cc4eee2fc341384f9ebc9fde9903f | %x:datapoints at which to set weights
%
%mode==1:mean waveforms
%mode==2:assignment
function [weights,weightsInv] = setDistanceWeight(x,mode)
weights=[];
%sum 1
%weights=[0.00376040483222247 0.00391872719227713 0.00402013991507288 0.00402673633425588 0.00393927544758201 0.00379512195653398 0.00368482247208692 0.00365... |
github | xyza11808/MATLAB-master | sortBlock.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/sortBlock.m | 1,058 | utf_8 | 333224cf8f00285e09b037960b328477 | %
%sorts a block of spikes
%
%-------------------------
%inputs:
%allSpikes: block of spikes, 256 datapoints each
%
%allTimestamps: timestamp for each spike. arbitrary units.
%
%returns:
%NrOfclustersFound
%
%assignedCluster: for each spike, which cluster # (clusters are arbitrarly
%numbered)
%
%meanSpikeForm: mean spi... |
github | xyza11808/MATLAB-master | sortingTextGUI.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/sortingTextGUI.m | 2,048 | utf_8 | 5163a13f10b638857a71b8ca7ab0e3cf | %
%
%main interface to automatic sorting (but manual classification of good/bad
%cells).
%
%
function sortingTextGUI
basepath='/home/urut/caltech/schuman/P1_S3/';
filenameIn='b11';
label=[ filenameIn ' P1 S3 ']; %label is channel/patient/session
%--------------------------------
%do all sorting
automaticSort(basepa... |
github | xyza11808/MATLAB-master | figureClusterOverlap.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/projectionTest/figureClusterOverlap.m | 3,951 | utf_8 | 6244831690d339f7e9f296dc22dee481 | %plots projection test between two clusters clNr1 and clNr2
%
%
%mode: 1=plot everything (6 subplots)
% 2=plot only one subplot and do not issue any subplot commands
% 3=no plotting (only calculation)
%colors: two string values, eg {'r','b'} for the color of the histogram
%
%bug: in R14,this color values some... |
github | xyza11808/MATLAB-master | projectionTest.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/projectionTest/projectionTest.m | 877 | utf_8 | 8614ac8b61d15b2cbfd5487293ebc8cf | %
%
%d: euclidean norm of distance between centers of two clusters
%
function [m1,m2, projectedResidual1,projectedResidual2,overlap,d] = projectionTest( spikes1,spikes2 )
m1 = mean(spikes1);
m2 = mean(spikes2);
d = norm(m1-m2);
projectedResidual1 = residualProjection( (m2-m1), m1, spikes1 );
projectedResidual2 = resid... |
github | xyza11808/MATLAB-master | generateSpiketrain_times.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/generateSpiketrain_times.m | 1,082 | utf_8 | 0c6849c4760a09103425f754fa9ce510 | %
%randomly generates firing times for simulated neurons, poisson distributed.
%used to simulate artifical spiketrains
%
%realWaveforms: how many neurons are simulated
%peakOffsets: for each waveform, offset to the real peak (which should be detected). is 95 by default.
%
%urut/april07
function spiketimes = generateSp... |
github | xyza11808/MATLAB-master | runSimulatedEval.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/runSimulatedEval.m | 19,945 | utf_8 | 8dfd00e2abdd554f8233f9d874bf5e31 | %detects and sorts spike of a simulated file. calculates statistics about performance.
%plots various statistics and diagnostic tools.
%
%
%parameters need to be modified before this file can be run.
%reorder needs to be modified manually after sorting to match found
%clusters to theoretical clusters before performance... |
github | xyza11808/MATLAB-master | estimatePDF.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/estimatePDF.m | 893 | utf_8 | 57f1ba98a1c9cf3f16fc829748bf94e0 | %
%estimates a PDF, using binned data
%
%see "computational statistics handbook with matlab" book, pp266
%
%parameters
%vals: array of values
%nBins: number of bins to use; if == 0 is provided, the number of bins is
%chosen automatically (estimate using normal reference rule)
%
%returns
%bc: centers of the bin
%fhat: p... |
github | xyza11808/MATLAB-master | loadSimulationFilesVars.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/loadSimulationFilesVars.m | 219 | utf_8 | 77371d9b878dd178d04da98b7e3208e3 | %
%loads a list of variables instead of all variables.
%
%urut/may07
function varargout = loadSimulationFilesVars(simNr,levelNr,varargin)
loadSimulationFiles;
for k = 1:nargout
varargout{k} = eval(varargin{k});
end |
github | xyza11808/MATLAB-master | figSimulationPerformance.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/figSimulationPerformance.m | 2,319 | utf_8 | 36b1663fd78ffa64a6cab3f8d645dbc5 | %plots performance comparison figures between algorithms
%
%perfAll is a cell array of cell arrays. each cell array part of perfAll is
%a collection of performance tables for all noise levels of the simulation.
%
%perfOrig is the same as perfAll, except that it contains all the clusters,
%not only the once that could b... |
github | xyza11808/MATLAB-master | calcRsquare.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/calcRsquare.m | 689 | utf_8 | 15333f84275846aef0c7adb7608d0a00 | %
%calculates Rsquare value
%
%inputs:
%response -> as observed in the data
%predicted -> as predicted with some fit of a model
%
%
%returns Rsquare, SSR (sum of squares of the regression) and SST (total sum
%of squares)
%
%urut/jan05
function [Rsquare,SSR,SST,SSE] = calcRsquare( response, predicted )
%calculate Rsqua... |
github | xyza11808/MATLAB-master | generateSpiketrain_noiseBackground.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/generateSpiketrain_noiseBackground.m | 1,284 | utf_8 | 53ab9b30ed1fae4873940db07e494fa6 | %
% prepare a noise background consisting of many randomly scaled waveforms
% for later insertion of simulated spikes.
%
% moved out of generateSpiketrain.m
%
%urut/aug11
function spiketrain = generateSpiketrain_noiseBackground( nrSamples )
nrIters=30; %how many iterations
load('allMeans.mat');
%find all waveforms wi... |
github | xyza11808/MATLAB-master | detectArtificialSpikes.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/detectArtificialSpikes.m | 1,473 | utf_8 | d0d7aae00742b9630daa7cf9b68c7059 | %
%detect spikes from simulated spiketrain
%
%params: fields detectionMethod/detectionParams/peakAlignMethod -> see header of extractSpikes.m for explanation
%
%initial:
%urut/dec05
%updates:
%urut/april07, updated for new calling syntax of extractSpikes
%
function [filteredSignal, rawTraceSpikes,spikeWaveforms, spikeT... |
github | xyza11808/MATLAB-master | findAllOrigTimestamps.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/findAllOrigTimestamps.m | 601 | utf_8 | ef591402ce9c262a598c6b4b0f9055f1 | %
%finds all timestamps that belong to a specific neuron,based on ground
%truth.
%
%
function inds = findAllOrigTimestamps ( origTimestampsOfClass,spikeTimestamps)
tollerance=30; %allow 15 datasamples jitter due to re-sampling,re-alignment etc
inds=[];
for j=1:length(origTimestampsOfClass)
origValue = origTime... |
github | xyza11808/MATLAB-master | loadSimulationFiles_order.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/loadSimulationFiles_order.m | 1,170 | utf_8 | 80109578688aeffa300e42bfe283ee0e | %
%loads the appropriate reorder variable
%the reorder variable determines which detected cluster matches to which simulated cluster (because the order of the sorting output is "random")
%
function reorder = loadSimulationFiles_order(simNr, levelNr, paramSet)
if simNr<=3
basepath='/home/urut/code/sortingNew/model/... |
github | xyza11808/MATLAB-master | evalPerformance.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/evalPerformance.m | 3,845 | utf_8 | 5b858450a92437d6a4447f60d484a3b4 | %
%calculates performance of sorting algorithm by comparing to ground truth
%
%was previously part of plotGeneratedSpiketrain.m
%
%spikeTimestampsDetected: detected spikes from sorting
%spiketimesSimulated: ground truth
%
%reorder: mapping of cluster numbers
%nrAssigned: mapping of cluster numbers to how many were foun... |
github | xyza11808/MATLAB-master | generateSpiketrain_tetrode.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/generateSpiketrain_tetrode.m | 2,368 | utf_8 | 8a76c57a35cb947af25cd726e20797a2 | %
% generate a simulated tetrode recording (4 channels, same waveform but
% differently scaled).
%
%
function [ spiketrains_tetrode, spiketimes, scalingFactors ] = generateSpiketrain_tetrode( noiseStds, nrSamples, firingRate, refractory, Fs, realWaveformsInd, allMeans )
nChannels = 4;
pathCache = '/data/cache/';
%% g... |
github | xyza11808/MATLAB-master | generateSpiketrain_insertSpikes.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/generateSpiketrain_insertSpikes.m | 2,359 | utf_8 | d258a685fc9089f695a54de313910148 | %
% insert waveforms of simulated units into background of simulated noise.
% this function is deterministic, no randomness is added.
%
%
% allMeans : waveforms from previous recordings, at 4 times the Fs of the
% simulated data
%
%urut/aug11. moved out of generateSpiketrain.m
%
function [spiketrainsAll,waveformsOrig,s... |
github | xyza11808/MATLAB-master | generateSpiketrain.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/generateSpiketrain.m | 1,852 | utf_8 | aca2aacc2a59d3911e9164b4b4748fa1 | %generates a set of spiketrains,at different noise levels but with the same
%neuronal firing. simulates a single-wire recording.
%
%input
%allMeans: collection of mean waveforms
%realWaveformsInd: real waveforms to use
%nrsamples:# samples to generate,sampled at 100000Hz
%noiseStds: vector of noise stds to generate
%
%... |
github | xyza11808/MATLAB-master | plotSimulatedAlignPerf.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/detection/plotSimulatedAlignPerf.m | 1,269 | utf_8 | 49896c10b93e13a98edafa70b1bfd2c0 | %
%summary plot of aligned waveforms. also clusters waveforms to illustrate number of clusters (rather than quality of sorting).
%
%urut/april07
function plotSimulatedAlignPerf(w, errors, hits, nonHits, noiseLevel)
subplot(2,2,1)
plot( 1:64, w(hits,1:64)', 'r');
hold on
if length(nonHits)>0
plot(1:64, w(nonHits,1:... |
github | xyza11808/MATLAB-master | evalSimulatedAlignPerf.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/detection/evalSimulatedAlignPerf.m | 591 | utf_8 | 47e6f1f501e805d1853da21a9471fdfa | %spiketimes is ground truth (from simulation)
%spikeTimestamps is what the algorithm detected
%hits: which waveforms were TPs
%
%returns: alignErrors -> has one entry for each hit. difference in timesteps between detected and ground truth timestamp.
%
%
%urut/april06
function alignErrors = evalSimulatedAlignPerf( spike... |
github | xyza11808/MATLAB-master | evalSimulatedPerfDetection.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/detection/evalSimulatedPerfDetection.m | 2,246 | utf_8 | 450e0035f4b4c5c8ad419d39c0c37e0f | %
%determines whether detected spikes are real (true positives) or not.
%
%spiketimesSimulated is ground truth (from simulation)
%timestampsDetected is what the algorithm detected
%tolerance is the number of samples the timestamp is allowed to be off and still counted as valid
%
%returns:
%trueDetections : true detecti... |
github | xyza11808/MATLAB-master | benchmarkSpikedetection_sweepParams2.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/detection/benchmarkSpikedetection_sweepParams2.m | 1,339 | utf_8 | 334281ccda4a0da3d17640658c87accb | %
%
% sweep over a secondary parameter, for each of which a sweep of a primary
% parameter is done (to explore all combinations of 2 parameter values)
%
% paramNr1, paramValues1 : the primary parameter
% paramNr2, paramValues2 : the secondary parameter
%
%
%
%
%urut/aug11
%
function [TPall,FPall,AUCs,thresholds, nr... |
github | xyza11808/MATLAB-master | calcDetectionROC_perLevel.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/detection/calcDetectionROC_perLevel.m | 1,319 | utf_8 | 45756635db991697214d40c9539ca347 | %loops over extraction thresholds; all other values are constant.
%calculate TP/FP of detection for a particular noise levels and all provided thresholds
%
%inputs:
%simNr -> simulation number
%levelNr -> noise level
%thresholds -> array of all thresholds to use
%
%returns:
%all (see below); one row per threshold
%TPal... |
github | xyza11808/MATLAB-master | benchmarkSpikedetection_sweepParams_assignParam.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/detection/benchmarkSpikedetection_sweepParams_assignParam.m | 551 | utf_8 | 406bf8f66b74081f0c15bddddee027e3 | %
%helper function used by benchmarkSpikedetection_sweepParams and
%benchmarkSpikedetection_sweepParams2
%
function [params,paramStr] = benchmarkSpikedetection_sweepParams_assignParam( params, paramNr, paramValue )
paramStr = '';
switch(paramNr)
case 1
params.extractionThreshold = paramValue;
param... |
github | xyza11808/MATLAB-master | calcDetectionROC_precompute.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/detection/calcDetectionROC_precompute.m | 2,095 | utf_8 | f2c060452bef3fb98576566e1ba58d3d | %
% this file pre-computes data for later usage in other files (calcDetection.m, calcAlignPerf, plotDetectionROC_precomputed
% results are stored in files. this is done such that this function can be executed multiple times in parallel on different CPUs (with different parameters)
%
%urut/may07
function calcDetectionR... |
github | xyza11808/MATLAB-master | plotDetectionROC.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/detection/plotDetectionROC.m | 1,185 | utf_8 | fad430561e77fbebefe2e64d7789f3b8 | %
% plot several ROCs to compare different detection methods
%
%plotThresholds: 0 no, 1 yes (all), 2 yes (only extremes)
%
%
%initial urut/caltech/2005
%extended urut/aug11
function plotDetectionROC( TPall, FPall, thresholds, labels, xlims, ylims, ptitle, plotThresholds,plotThresholdPrefix,plotDiagLine)
if nargin<8
... |
github | xyza11808/MATLAB-master | benchmarkSpikedetection_sweepParams.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/detection/benchmarkSpikedetection_sweepParams.m | 1,590 | utf_8 | dfcd53f397639ca00fb2415e2daf1d92 | %
%sweep a parameter and calculate spike detection performance for simulated
%datasets.
%
%inputs:
%data: raw data where spikes are to be detected
%Hd: filter to be applied
%params: parameters for spike detection
%spiketimesSimulated: ground truth, as simulated
%tollerance: nr samples of tollerance to match spikes
%
%u... |
github | xyza11808/MATLAB-master | calcAlignPerf_allSims.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/detection/calcAlignPerf_allSims.m | 2,839 | utf_8 | 6a3c7e19bf0516349ee8c4cd180d3957 | %
%calculates the std of the align error for all simulations for a given noise level
%
%doUpsample:upsample and correct error yes/no
%doNormalizeError:subtract median from error yes/no
%
%
function [allStds,allMeans, errorsNormalized,params] = calcAlignPerf_allSims(simNrs, levelNr, alignMethods, basepath, Fs, doUpsampl... |
github | xyza11808/MATLAB-master | evalDetectionSimulated.m | .m | MATLAB-master/osort/osort-v3-rel/code/sortingNew/model/detection/evalDetectionSimulated.m | 1,724 | utf_8 | 1159dd7cf222059b3702cc6052a9af3a | %
%evaluates a spike detection method for a particular noise level and extraction threshold of the simulated data.
%
%returns:
%TP: true positives rate
%FP: false positives rate
%misses: how many were not found
%spikeWaveforms/spikeTimestamps: all detected waveforms and their time of occurence
%hits: which of the detec... |
github | xyza11808/MATLAB-master | processRaw.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/processRaw.m | 7,316 | utf_8 | 6e389b890ffe9bb929249f15699b5474 | %
%processes raw signal, extracts spikes. loads data directly from neuralynx
%file.
%
%filename: full path/name to neuralynx file
%totNrSamples: nr of samples in this file
%Hd: filter specification
%howManyBlocks: >0 do only so many blocks
% 0 : as many as there are
%startWithBlock: 1=start with first blo... |
github | xyza11808/MATLAB-master | getRawTimestamps.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/getRawTimestamps.m | 1,167 | utf_8 | 8b2b02c1994766a34fbb0a7b362c30bc | %
%reads raw timestamps; calls the appropriate routine for the data format used.
%
%the fileFormat variable is defined in defineFileFormat.m (all possible values).
%
%not all file formats support reading timestamps independent of data. in
%this case,the timestamps returned will be empty.
%
%urut/april07
function [times... |
github | xyza11808/MATLAB-master | getRawData.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/getRawData.m | 1,057 | utf_8 | db61745edcd722b414bad4cdee96d34c | %
%reads raw continous data
%calls the appropriate routine for the data format used.
%
%the fileFormat variable is defined in defineFileFormat.m (all possible values).
%
%not all formats require a valid samplingFreq argument - it can be set to 0
%in those cases.
%
%urut/april07
function [timestamps,dataSamples] = getR... |
github | xyza11808/MATLAB-master | filterSignal.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/filterSignal.m | 252 | utf_8 | 1d15bee6ace94b3eced06379464835ce | %
%
%apply bandpass filter 300...3000hz
%
function filteredSignal = filterSignal( Hd, rawSignal )
%cant filter if the signal is too short
if length(rawSignal)<20
filteredSignal=[];
return;
end
filteredSignal = filtfilt(Hd{1}, Hd{2}, rawSignal);
|
github | xyza11808/MATLAB-master | determineBlocks.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/determineBlocks.m | 293 | utf_8 | 9a52c3ae6d40c809a2abc534976c9949 | %
%determines the blocksize and how many of those are to be processed, based on the raw number of samples available in
%the file
%
%
function [nrRuns, blocksize] = determineBlocks( totNrSamples, blocksize )
if nargin<2
blocksize=512000;
end
nrRuns = fix( totNrSamples/ blocksize ) + 1;
|
github | xyza11808/MATLAB-master | plotSpikeExtraction.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/plotSpikeExtraction.m | 6,016 | utf_8 | 9041f4b7bf32e7d559c6e9461bc4ff73 | %
%plots various steps of the spike extraction process.
%
%input:
%spiketimestamps -> of the detected spikes (which are in rawTraceSpikes).
%blockOffsets -> absolute timestamp of the beginning of this plotted block (returned from processRaw)
%
%
%from top to bottom:
%raw signal
%filtered signal
%thresholded signal (if ... |
github | xyza11808/MATLAB-master | upsampleSpikes.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/upsampleSpikes.m | 433 | utf_8 | ea098851e43604ae5d57018fa4edcd3c | %
%upsample spikes from raw sampling to 100kHz.
%
%urut/april04
function upsampledSpikes = upsampleSpikes( allSpikesRawFiltered )
%L=4; %upsample factor
%would like to have 256 datapoints at 100kHz.
%L*size(allSpikesRawFiltered,2)
nrDatapoints=256;
if size(allSpikesRawFiltered,1)>0
upsampledSpikes=interpft... |
github | xyza11808/MATLAB-master | extractSpikes.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/extractSpikes.m | 4,908 | utf_8 | 89dfbc9a98bc322c85e19142ed4f5ad4 | %extracts spikes from raw signal
%applies band-pass filtering to raw signal before doing so.
%
%params.nrNoiseTraces: 0 if no noise should be estimated
% >0 : # of noise traces to be used to estimate autocorr of
% noise, returned in variable autocorr
%
%
%params.detectionMethod: 1 -> from po... |
github | xyza11808/MATLAB-master | computeNormalizedGround.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/computeNormalizedGround.m | 1,207 | utf_8 | b123674c621c02722fc6b418ea35b55c | %todo: note that this wont work if the gains are different on channels on the same ground.
%
%
%returns the average of a number of raw signals; the purpose of the returned value is to-renormalize to a common ground, in case the ground wire was noisy.
%
%input params:
%datapath
%channels: array of channels to be used fo... |
github | xyza11808/MATLAB-master | runningTEO.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/runningTEO.m | 374 | utf_8 | 853b16860a938ad0f2af601e4e8c3acb | %
% calcs the function x(n)^2 - x(n-1)*x(n+1)
%
% this is the standard energy operator (TEO)
% some people like to invent new names for old concepts and call this "NEO -> nonlinear energy operator"
%
% urut/aprl07
function out = runningTEO(rawSignal,k)
if nargin==1
k=1;
end
out = rawSignal.^2 - [rawSignal(1+k:end)... |
github | xyza11808/MATLAB-master | findPeak.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/findPeak.m | 2,116 | utf_8 | f7b0503414a7b0ff5347c0df50d19e95 | %
%finds the peak of a spike for the purpose of realignment.
%
%alignMethod: 1=pos, 2=neg, 3=mix (order if both peaks are sig,otherwise max)
%
%urut/dec04
function peakInd = findPeak( spikeSignal,stdEstimate, alignMethod )
%find peak (either neagtive or positive)
maximum=max(spikeSignal);
minimum=min(spikeSignal);
pea... |
github | xyza11808/MATLAB-master | getRawHeader.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/getRawHeader.m | 1,071 | utf_8 | 8760a4bb0333a4f2614416090b33bb07 | %
%get header, scale factor from there
%
%urut/may06
function [headerInfo, scaleFact, fileExists] = getRawHeader( filename )
scaleFact=0;
headerInfo='';
if exist(filename)==0
fileExists=0;
return;
end
fileExists=1;
%isContinous=false;
FieldSelection(1) = 0;%timestamps
FieldSelection(2) = 0;
FieldSelection(3)... |
github | xyza11808/MATLAB-master | MTEO.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/MTEO.m | 435 | utf_8 | 4cd26d3fceb6c3c38a140fa820ea1160 | %
%impements the MTEO detector according to
%Choi,Jung,Kim 2006, IEEE T Biomed Eng
%
%urut/april07
function runTEO = MTEO(rawSignal, ks)
tmp=zeros(length(ks),length(rawSignal));
for i=1:length(ks)
tmp(i,:) = runningTEO(rawSignal, ks(i));
v(i) = var(tmp(i,:));
%apply the window
win = hamming( 4*ks(i)... |
github | xyza11808/MATLAB-master | runningRMS.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/runningRMS.m | 411 | utf_8 | 220231c301e2079543f72f836be3be13 | %
%calculates a running rms (fast, with convolution).
%
%
%urut/april04
function runRMS = runningRMS( rawSignal, k)
coef = ones(1, k) / k;
run_mean_1 = filter(coef, 1, rawSignal.^2);
runRMS = sqrt( run_mean_1 / k );
%run_mean_2 = filter(coef, 1, rawSignal).^2;
%run_mean_1 = run_mean_1(k : end);
%run_mean_2 = run_me... |
github | xyza11808/MATLAB-master | findPeakMTEO.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/findPeakMTEO.m | 1,128 | utf_8 | b52c59d299c1b3ac6cd0b4ac26866c15 | %
% determine peak location of spike using MTEO signal
%
%urut/may07
function peakInd=findPeakMTEO(spikeSignal, mteoSignal)
maxPos = find( mteoSignal == max(mteoSignal) );
maxPos = maxPos(end); %in case multiple points are min, take the last one.
maxPos = maxPos-3; %MTEO is a leading indicator; mean of window size of ... |
github | xyza11808/MATLAB-master | findPeakPower.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/findPeakPower.m | 1,053 | utf_8 | c5ae20306b5448a3b18c2e948d852998 | %
% determine peak location of spike using power signal
%
%urut/may07
function peakInd=findPeakPower(spikeSignal, powerSignal)
%differential
dP = diff(powerSignal);
minPos = find( dP == min(dP) );
minPos = minPos(end); %in case multiple points are min, take the last one.
tollerance=5; %0.4ms
indsFrom=max(1,minPos-tol... |
github | xyza11808/MATLAB-master | convertTimestamps.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/convertTimestamps.m | 1,666 | utf_8 | 16718166b9fb7dff5cfce5700decce3d | %
%converts from internal representation of timestamps to real timestamps
%
%internal representation (indTimestamps) is relative to the currently processed block (0=start of current block)
%rawTimestamps is absolute value retrieved from file. file has only one timestamp per block. each block
%consists of 512 values.
%... |
github | xyza11808/MATLAB-master | detectSpikes.m | .m | MATLAB-master/osort/osort-v3-rel/code/continuous/detectSpikes.m | 7,432 | utf_8 | 135ae83b057aaf97f2a9725bb0302bb3 | %Spike detection and extraction; extraction of noise traces
%
%detects spikes from raw signal; re-aligns spikes. supports multiple methods of detection as well as alignment.
%this function can detect spikes in two ways: either by thresholding an arbitrary signal (thresholdSignal) or by picking spikes
%at pre-defined ti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.