function varargout=dopGraph1Raw(rawData,varargin)
% dopOSCCI Mark II: dopGraph1Raw~ 21-9-2010 (last edit)
%
% make Raw data group
%
fprintf('\n%s\n\t%s',['Running ',mfilename],...
    'Making Graph:');
try
    inputs.varargin=varargin;
    inputs.turnOn={'test'};
    inputs.defaults=struct('fileType','TX',...);% type of doppler data file TX = analogue, .EXP = digital (I think...)
        'sampleRate',100,...); % recording sample (used to be down sampleRate) in hertz to figure out timing
        'indName','Bruce',... % individual data file identification
        'graphAbb','Raw',... % graph abbreviation - used for saving
        'graphName','Raw Data',...); % graph name
        'outPos',[0 .5 1 .5],...); % outer position of figure in normalized units
        'info',[]); % raw information
    inputs.defaults.labels={'left','right','ext1','ext2','ext3','ext4'};
    gr=setGetInputsStruct(inputs);
    
    gr.translation='graph raw';
    gr.structAbbreviations='gr';
    gr.data=rawData; clear rawData
    gr.sampleSec=gr.sampleRate^-1;
    
    %% setup figure
    gr.h=figure('NumberTitle','off','Name',[gr.graphName,': ',gr.indName],...
        'Units','normalized','OuterPosition',gr.outPos,'Visible','Off');
    gr.hNames{1}=[gr.graphAbb,'_',gr.indName];
    %% setup plots details
    gr.pl.labels=inputs.defaults.labels;%{'left','right','ext1','ext2','ext3','ext4'}; % TX data
    gr.pl.colours={'b','r','g','c','m','y','b','r','g','c','m','y'};
    if strcmp(gr.fileType,'EXP')
        % do some trimming here so we get something that makes sense...
        if ~isempty(gr.info)
            gr.pl.labels=[]; gr.tmp.data=gr.data; gr.data=[];
            for i=1:size(gr.tmp.data,2)
                if ~isempty(strfind(gr.info.dataLabels{i},'Env'))...
                        || ~isempty(strfind(gr.info.dataLabels{i},'Analog'))
                    gr.pl.labels{end+1}=gr.info.dataLabels{i};
                    gr.data(:,end+1)=gr.tmp.data(:,i);
                    if ~isempty(strfind(gr.info.dataLabels{i},'Analog'))
                       gr.data(:,end)=gr.data(:,end)/10; 
                    end
                end
            end
            
        end
    end
    for i=1:size(gr.data,2)
       plot((1:size(gr.data,1))*gr.sampleSec,gr.data(:,i),'color',gr.pl.colours{i},'DisplayName',gr.pl.labels{i})
       if i==1; hold; end;
    end
    gr.axes=get(gr.h,'CurrentAxes');
    set(get(gr.axes,'Title'),'string',[gr.graphName,': ',gr.indName]);
    set(get(gr.axes,'XLabel'),'String',['Time in seconds (approx. ',...
        num2str(round(size(gr.data,1)*gr.sampleSec/60)),' minutes)']);
    set(gr.axes,'XLim',[0 size(gr.data,1)*gr.sampleSec]);
    set(gr.axes,'XTick',(1:size(gr.data,1)*(gr.sampleSec/60))*60)
    set(get(gr.axes,'YLabel'),'String','Raw Doppler Velocity (cm/s)');
    gr.lgd=legend('location','northEast','orientation','horizontal');
    set(gr.lgd,'Box','Off');
    
     %% test
    if gr.test; set(gr.h,'Visible','on'); end
%         fprintf('%s\n','Test procedure on - throwing error for debugging');
%         plang; % should generate an error
%     end
    %% set ouputs
%    gr.out.note='li = laterality index output';
    varargout{1}=gr.h;
    varargout{2}=gr.hNames;
    fprintf('\t%s\n','Done');
catch err
    %% catch dopOSCCI error
    % 
save(dopOSCCIdebug(mfilename));throw(err); 
%     dopOSCCIcrash(err,gr,mfilename);
end

clear gr inputs