%SIFPLOT Plot a sif file with options.
%
% Description
%
% Plots and saves a sif file taken with Andor Newton camera. The plot
% data can be written to an exported figure, which gives a quick way of
% processing sif files. The main benefit of using this function over
% sifreadnk is the variety of plotting options.
%
% sifPlot can also take a data structure as an input (aka the output of
% sifreadnk).
%
% Input and Output
%
% data = sifPlot(fname,options). fname is the name of a sif file to be
% imported and plotted. options is a list of desired plot options
% explained below. data is an output structure giving the sif file's
% characteristics.
%
% The data output structure contains a lot of information. Here are
% some descriptions of the most important fields
%
% 'imageData': Contains the actual data. The imageData field is an
% array of dimension [1024, 1, length]. The first dimension, 1024,
% corresponds to the number of pixels in the x-direction for the
% camera. The second dimension is 1 when we acquire in full
% vertical binning (FVB) mode. The 3rd dimension is the length of
% the kinetic series if more than one frame were acquired.
%
% 'axisWavelength': The x-axis for the spectrum in units of nm.
%
% 'axisEnergy': The x-axis in units of eV. 'axisGHZ': the x-axis in
% units of GHz.
%
% Options
%
% Here are all the possible options and the default values.
%
% 'xunits' : [('eV') 'nm' 'GHz' 'pixels'] change x-units of plot
%
% 'yunits' : ['normalized' 'counts' {'rate'}]. 'Normalized' scales
% the data linearly to the interval [0,1]. 'Counts' displays the
% total number of counts in the spectrum. 'rate' displays the data
% in units of counts per second.
%
% 'scale' : 1. Scales the image data by the number specified.
% This can help zoom in on a section of a plot.
%
% 'offset' : 0. Offsets the plot by the number specified. This is
% helpful for easily plotting several sif files on top of each
% other.
%
% 'crop' : 'units', cropMin, cropMax. Crops the x axis in the
% specified units (either 'nm','eV', 'GHz', or 'pixels'). The
% program finds the xaxis pixel closest to the cropMin and cropMax
% specified.
%
% 'frame' : 1. Give a number to choose which frame of a kinetic
% series to plot.
%
% 'genPDF' : generate a pdf containing the plotted spectrum and
% some information about it. This is especially useful for quick
% processing of sif files for later investigation. The file name is
% the same as the imported .sif file except with the extension .pdf
%
% 'noPlot' : do not plot the spectrum. This speeds up execution
% time massively.
%
% 'saveData': Saves the generated data as a .mat file with the same
% name as the imported file name.
%
% 'filter' : [filterMin,filterMax] Draws a box around a certain
% region in the plot.
%
% 'plotSpec': plotSpec specifies the style of the plotted line.
%
% 'fontsize': 12 sets font size of plot axes and labels.
%
% 'interp': numToInterp. Interpolates numToInterp points in the
% spectrum.
%
% Examples
%
% The following are examples of function calls. The various options can
% be conbined. Coding 'data =' gives the imported information about the
% sif file as a structure. It is not necessary to write 'data ='
%
% data = sifPlot('example.sif') : plots a sif file using default
% settings. data = sifPlot('spectra.sif','xunits', 'eV') : uses eV
% for x axis. Can also be 'nm', 'GHz' or 'pixels'
%
% data = sifPlot('spectra.sif','yunits', 'normalize') : normalizes
% the y-axis. Options are 'normalize, 'counts', 'rate' (counts per
% sec).
%
% data = sifPlot('spectra.sif','crop','nm',800,826) : crops the
% y-axis to 800nm - 826 nm. Can also specify crop dimensions in
% 'nm' or 'pixels'. If crop dimensions are out of bounds, then
% program will find the closest crop value that is valid.
%
% data = sifPlot('spectra.sif','cosmicrays',[200 415]) : removes
% cosmic rays at pixels 200 and 415.
%
% data = sifPlot('spectra.sif','nopdf') : do not produce a pdf data
% file, improves program runtime.
%
% data = sifPlot('spectra.sif','noplot') : does not plot the
% spectrum. data = sifPlot('spectra.sif','savedata') : saves the
%
% data as mat file data = sifPlot('spectra.sif','frame',100) :
% displays the 100th frame of a kinetic series.
%
% data = sifPlot('spectra.sif','offset',.3') : adds a .3 offset to
% the plotted data.
%
% sifPlot('spectra.sif','plotSpec','--k') : draws the spectrum with
% a dotted black line.
%
% See also:
% sifreadnk, convertUnits
%
%
% Todd Karin
% 08/22/2012
% Version History
%
% 3/28/2012
% Added a 'nopdf' option
%
% 3/5/2012
% remade input parameters to be easier to use.
%
% 3/1/2012
% Allowed for variable number of input arguments.
%
% 2/25/2012
% Made into a function.
%
% 06/02/2012
% Added some more options: genpdf, genplot, saveData
%
% 06/26/2012
% Added ability to select which frame of a kinetic series to plot.
%
% 06/29/2012
% Cleaned up option specification.
% PROGRAM
function [data,varargout] =sifPlot(varargin)
% Read options
fname = varargin{1};
[ret, xswitch] = readOption('xunits',1,'nm',varargin);
[ret, yunits] = readOption('yunits',1,'rate',varargin);
[ret, scale] = readOption('scale',1,1,varargin);
[ret, offset] = readOption('offset',1,0,varargin);
[ret,cropswitch,crop(1),crop(2)] = readOption('crop',3,{'pixels',0,1e7},varargin);
[removeCosmicRays cosmicrays] = readOption('cosmicRays',1,[],varargin);
genpdf = readOption('genPDF',0,0,varargin);
noplot = readOption('noPlot',0,0,varargin);
saveData = readOption('saveData',0,0,varargin);
[ret,frame] = readOption('frame',1,1,varargin);
[axesHandleOn,axesHandle]= readOption('axesHandle',1,0,varargin);
[plotRangeOn,plotRange] = readOption('plotrange',1,[1 1],varargin);
[filterOn, filter] = readOption('filter',1,[0,0],varargin);
[fontSizeOn, fontSize] = readOption('fontSize',1,12,varargin);
[ret,plotSpec] = readOption('plotSpec',1,'k',varargin);
[interpOn,interpPoints] = readOption('interp',1,1,varargin);
[ret,xoffset] = readOption('xoffset',1,0,varargin);
% Make a name 'fname2' name without underscores or .sif at the end.
if ischar(fname)
fname2 = remove_underscores(fname);
else
fname2 = 'untitled';
end
% Import the spectrum
if ischar(fname) % from a file
data = sifreadnk(fname);
else % from a data structure
data = fname;
end
% Interpolate more data points.
if interpOn
axisWavelengthNew = increaseAxisResolution(data.axisWavelength,interpPoints);
data.imageData = interp1( data.axisWavelength, data.imageData, axisWavelengthNew,'spline')';
data.axisWavelength = axisWavelengthNew;
data.axisEnergy = convertUnits(data.axisWavelength,'nm','eV');
data.axisGHz = convertUnits(data.axisWavelength,'nm','GHz');
end
% Crop the image to desired wavelength range
if strcmpi(cropswitch,'nm')
data.cropi(1) = findElement(crop(1),data.axisWavelength);
data.cropi(2) = findElement(crop(2),data.axisWavelength);
elseif strcmpi(cropswitch,'eV')
data.cropi(1) = findElement(crop(1),data.axisEnergy);
data.cropi(2) = findElement(crop(2),data.axisEnergy);
elseif strcmpi(cropswitch,'pixels')
data.cropi(1) = findElement(crop(1),1:length(data.axisWavelength));
data.cropi(2) = findElement(crop(2),1:length(data.axisWavelength));
elseif strcmpi(cropswitch,'GHz')
data.cropi(1) = findElement(crop(1),data.axisGHz);
data.cropi(2) = findElement(crop(2),data.a
没有合适的资源?快使用搜索试试~ 我知道了~
使用matlab读取光谱仪sif文件,sif文件的信息完全显示出来,含仿真操作录像
共10个文件
m:5个
sif:1个
nb:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 4 下载量 192 浏览量
2022-04-14
23:59:35
上传
评论 1
收藏 465KB RAR 举报
温馨提示
1.版本:matlab2021a,包含仿真操作录像,操作录像使用windows media player播放。 2.领域:光谱仪sif文件读取。 3.内容:使用matlab读取光谱仪sif文件,sif文件的信息完全显示出来。 o=fscanf(f,'%f',5);%% Scan the next 5 bytes info.delayExpPeriod=o(2); info.exposureTime=o(3); info.accumulateCycles=o(5); info.accumulateCycleTime=o(4); skipBytes(f,2); %% skip 2 more bytes o=fscanf(f,'%f',2); info.stackCycleTime=o(1); info.pixelReadoutTime=o(2); o=fscanf(f,'%d',3); info.gainDAC=o(3); skipLines(f,1);
资源推荐
资源详情
资源评论
收起资源包目录
使用matlab读取光谱仪sif文件,sif文件的信息完全显示出来.rar (10个子文件)
仿真操作录像0004.avi 41.9MB
1.jpg 24KB
code
example.sif 7KB
increaseAxisResolution.m 460B
convertUnits.m 3KB
sifReaderMathematica.nb 26KB
sifreadnk.m 9KB
sifPlot.m 17KB
example.mat 27KB
Runme.m 156B
共 10 条
- 1
资源评论
- 无人与我立黄昏9542023-07-06感谢大佬分享的资源,对我启发很大,给了我新的灵感。
- qq_350194582023-08-17这个资源总结的也太全面了吧,内容详实,对我帮助很大。
- peguinShang2022-11-04资源使用价值高,内容详实,给了我很多新想法,感谢大佬分享~
- m0_748436842024-01-11简直是宝藏资源,实用价值很高,支持!
fpga和matlab
- 粉丝: 15w+
- 资源: 2548
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功