Skip to content

Commit

Permalink
***** NPMK Version 5.4.2.0 :October 2, 2020 *****
Browse files Browse the repository at this point in the history
%
% 1.1.0.0: NSxPowerSpectrum: October 2, 2020
%   - Fixed a bug where the sampling frequency is now read from the header
%     file instead of it being fixed at 300 Hz.
% 
% 7.3.1.0: openNSx: October 2, 2020
%   - If the units are in µV (openNSx('uv'), ths correct information is now 
%     written to the electrodes header: 1000 nV (raw).
  • Loading branch information
kianabc committed Oct 2, 2020
1 parent 5565d1d commit dae8b45
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
32 changes: 31 additions & 1 deletion NPMK/NSx Utilities/NSxPowerSpectrum.m
Original file line number Diff line number Diff line change
@@ -1,13 +1,43 @@
function NSxPowerSpectrum(NSx, channelNumber, colorCode)

% NSxPowerSpectrum
%
% Plots a power spectrum of a given channel.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Use NSxPowerSpectrum
%
% Use settingsManager(NSx, channelNumber, colorCode)
%
% NSx: The NSx file containing the data.
%
% channelNumber: The channel to be plotted.
%
% colorCode: The color of the plot. This follows the standard "plot"
% colors in MATLAB. See "help plot" for more information.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Kian Torab
% [email protected]
% Blackrock Microsystems
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Version History
%
% 1.1.0.0: October 2, 2020
% - Fixed a bug where the sampling frequency is now read from the header
% file instead of it being fixed at 300 Hz.
%

function NSxPowerSpectrum(NSx, channelNumber, colorCode)

if ~exist('colorCode', 'var')
colorCode = 'b';
end

x = double(NSx.Data(channelNumber,:));

rng default;
Fs = 300;
Fs = NSx.MetaTags.SamplingFreq;
t = linspace(0,1,length(x));

N = length(x);
Expand Down
12 changes: 11 additions & 1 deletion NPMK/Versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -449,5 +449,15 @@ NPMK Version 2.8.2.0: 5 May 2014
% - Fixed a bug where the response to 1/4 uV warning was not being saved.
%

***** NPMK Version 5.4.2.0 :October 2, 2020 *****
%
% 1.1.0.0: NSxPowerSpectrum: October 2, 2020
% - Fixed a bug where the sampling frequency is now read from the header
% file instead of it being fixed at 300 Hz.
%
% 7.3.1.0: openNSx: October 2, 2020
% - If the units are in �V (openNSx('uv'), ths correct information is now
% written to the electrodes header: 1000 nV (raw).


LATEST:5.4.1.0
LATEST:5.4.2.0
5 changes: 4 additions & 1 deletion NPMK/openNSx.m
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@
% - If the units are in "raw", ths correct information is now written to
% the electrodes header: 250 nV (raw).
%
% 7.3.1.0: October 2, 2020
% - If the units are in µV (openNSx('uv'), ths correct information is now
% written to the electrodes header: 1000 nV (raw).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Defining the NSx data structure and sub-branches.
Expand Down Expand Up @@ -530,7 +533,7 @@
NSx.ElectrodesInfo(headerIDX).MinAnalogValue = typecast(ExtendedHeader((27:28)+offset), 'int16');
NSx.ElectrodesInfo(headerIDX).MaxAnalogValue = typecast(ExtendedHeader((29:30)+offset), 'int16');
if strcmpi(waveformUnits, 'uV')
NSx.ElectrodesInfo(headerIDX).AnalogUnits = char(ExtendedHeader((31:46)+offset))';
NSx.ElectrodesInfo(headerIDX).AnalogUnits = '1000 nV (raw) ';
else
NSx.ElectrodesInfo(headerIDX).AnalogUnits = '250 nV (raw) ';
end
Expand Down

0 comments on commit dae8b45

Please sign in to comment.