-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
correct gain for channels - spikeGLX
- Loading branch information
1 parent
7468ee8
commit f8ecb67
Showing
17 changed files
with
85 additions
and
358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
function rawAmplitude_uV = getRawAmplitude(rawWaveforms, peakChan, metaFile, probeType, gain_to_uV) | ||
% JF, Get the amplitude of the mean raw waveform for a unit | ||
% ------ | ||
% Inputs | ||
% ------ | ||
% rawWaveforms: nTimePoints × 1 double vector of the mean raw waveform | ||
% for one unit in mV | ||
% metaFileDir: dir structure containing the location of the raw .meta or .oebin file. | ||
% probeType: optional. only used if you are using spikeGLX *and* the meta | ||
% file does not contain any probetype field (imDatPrb_type or imProbeOpt) | ||
% ------ | ||
% Outputs | ||
% ------ | ||
% rawAmplitude: raw amplitude in microVolts of the mean raw waveform for | ||
% this unit | ||
|
||
% sanitize inputs | ||
if nargin < 4 || isempty(probeType) | ||
probeType = 'NaN'; | ||
else | ||
probeType = num2str(probeType); | ||
end | ||
|
||
% get scaling factor | ||
if strcmp(metaFile, 'NaN') == 0 | ||
if contains(metaFile, 'oebin') | ||
% open ephys format | ||
scalingFactor = bc.load.readOEMetaFile(metaFile); % single sclaing factor per channel for now | ||
else | ||
% spikeGLX format | ||
[scalingFactors_all, ~, ~] = bc.load.readSpikeGLXMetaFile(metaFile, probeType); | ||
scalingFactor = scalingFactors_all(peakChan); | ||
end | ||
else | ||
scalingFactor = gain_to_uV; | ||
end | ||
|
||
% scale waveforms to get amplitude in microVolts | ||
rawWaveforms = rawWaveforms .* scalingFactor; | ||
rawAmplitude_uV = abs(max(rawWaveforms)) + abs(min(rawWaveforms)); | ||
%rawAmplitude_mV = rawAmplitude_uV ./1000; | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Oops, something went wrong.