Home > matlabmk > headinfo_spec.m

headinfo_spec

PURPOSE ^

headinfo_spec() - Displays channel, bin and t-test information about the

SYNOPSIS ^

function headinfo_spec(variable_or_filename)

DESCRIPTION ^

 headinfo_spec() - Displays channel, bin and t-test information about the
                   data stored in a specGND, specGRP, or tfrGND variable
                   (i.e., the matlabMK variables for storing power spectra
                   averaged across participants and groups respectively) in
                   the MATLAB command window.  Similar to Kutaslab UNIX
                   "headinfo" command.

 Usage:
  >> headinfo_spec(variable_or_filename)

 Input:
  variable_or_filename  - A matlabMK specGND, specGRP, or tfrGND structure
                          variable or the filename of a matlabMK specGND or
                          specGRP structure that has been saved to disk.
                          If you specifiy a filename be sure to include
                          the file's path, unless the file is in the current
                          working directory.

 Outputs:
   Text is displayed in command window.

 Examples:
 -For a specGND variable already in memory
 >>headinfo_spec(specGND)

 -For a tfrGND variable already in memory
 >>headinfo_spec(tfrGND)

 -For a GND variable on disk but not in MATLAB
 >>headinfo_spec('yngvob.specGND')

 Author:
 David Groppe
 Kutaslab, 12/2010

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % headinfo_spec() - Displays channel, bin and t-test information about the
0002 %                   data stored in a specGND, specGRP, or tfrGND variable
0003 %                   (i.e., the matlabMK variables for storing power spectra
0004 %                   averaged across participants and groups respectively) in
0005 %                   the MATLAB command window.  Similar to Kutaslab UNIX
0006 %                   "headinfo" command.
0007 %
0008 % Usage:
0009 %  >> headinfo_spec(variable_or_filename)
0010 %
0011 % Input:
0012 %  variable_or_filename  - A matlabMK specGND, specGRP, or tfrGND structure
0013 %                          variable or the filename of a matlabMK specGND or
0014 %                          specGRP structure that has been saved to disk.
0015 %                          If you specifiy a filename be sure to include
0016 %                          the file's path, unless the file is in the current
0017 %                          working directory.
0018 %
0019 % Outputs:
0020 %   Text is displayed in command window.
0021 %
0022 % Examples:
0023 % -For a specGND variable already in memory
0024 % >>headinfo_spec(specGND)
0025 %
0026 % -For a tfrGND variable already in memory
0027 % >>headinfo_spec(tfrGND)
0028 %
0029 % -For a GND variable on disk but not in MATLAB
0030 % >>headinfo_spec('yngvob.specGND')
0031 %
0032 % Author:
0033 % David Groppe
0034 % Kutaslab, 12/2010
0035 
0036 %%%%%%%%%%%%%%%% REVISION LOG %%%%%%%%%%%%%%%%%
0037 % 4/13/2011-Made function able to accept tfrGND variables as well.
0038 
0039 function headinfo_spec(variable_or_filename)
0040 
0041 specGRP_var=0;
0042 tfrGND_var=0;
0043 %load specGND/specGRP variable if a filename was passed
0044 if ischar(variable_or_filename),
0045     fprintf('Loading specGND. specGRP, or tfrGND struct from file %s.\n',variable_or_filename);
0046     load(variable_or_filename,'-MAT');
0047     if ~exist('specGND','var') && ~exist('specGRP','var') && ~exist('tfrGND','var')
0048         error('File %s does not contain a specGND, specGRP, or tfrGND variable.',variable_or_filename);
0049     end
0050     if exist('specGRP','var'),
0051         specGND=specGRP; %for simplicity GRP variables are re-named specGND
0052         clear GRP;
0053         specGRP_var=1;
0054     elseif exist('tfrGND','var'),
0055         specGND=tfrGND; %for simplicity GRP variables are re-named specGND
0056         clear tfrGND;
0057         tfrGND_var=1;
0058     end
0059 else
0060     specGND=variable_or_filename; %for simplicity GRP and specGND variables are named specGND
0061     fldnames=fieldnames(specGND);
0062     if ismember('group_desc',fldnames),
0063         specGRP_var=1;
0064     elseif ismember('tfr_fnames',fldnames),
0065         tfrGND_var=1;
0066     end
0067 end
0068 
0069 %Report Channels, Group, Bin Names, Frequency (optional), & Time Range
0070 %(optional)
0071 if tfrGND_var,
0072     %moving time window spectral analysis based on fieldtrip
0073     [n_chans n_freqs n_time]=size(specGND.grands{1});
0074     
0075     fprintf('CHANNELS\n');
0076     for c=1:n_chans,
0077         fprintf('%d:%s ',c,specGND.ftrip.label{c});
0078         if ~mod(c,8)
0079             fprintf('\n');
0080         end
0081     end
0082     if mod(c,8),
0083         fprintf('\n');
0084     end
0085     
0086     n_bins=length(specGND.bindesc);
0087     fprintf('\nBINS\n');
0088     if n_bins
0089         for b=1:n_bins,
0090             fprintf('Bin %d: %s\n',b,specGND.bindesc{b});
0091         end
0092     else
0093         fprintf('No bins are yet stored with these data.\n');
0094     end
0095     
0096     fprintf('\nTIME RANGE\n');
0097     fprintf('%g to %g ms\n',specGND.ftrip.time(1)*1000,specGND.ftrip.time(end)*1000);
0098     
0099     fprintf('\nFREQUENCY RANGE\n');
0100     fprintf('%g to %g Hz\n',specGND.ftrip.freq(1),specGND.ftrip.freq(end));
0101     
0102 else
0103     %static time window spectral analysis
0104     [n_chans n_freqs n_bins]=size(specGND.grands_pow_dB);
0105     
0106     fprintf('CHANNELS\n');
0107     for c=1:n_chans,
0108         fprintf('%d:%s ',c,specGND.chanlocs(c).labels);
0109         if ~mod(c,8)
0110             fprintf('\n');
0111         end
0112     end
0113     if mod(c,8),
0114         fprintf('\n');
0115     end
0116     
0117     if specGRP_var,
0118         fprintf('\nGROUPS\n');
0119         n_groups=length(specGND.group_desc);
0120         for b=1:n_groups,
0121             fprintf('Group %d: %s (%d participants)\n',b,specGND.group_desc{b}, ...
0122                 length(specGND.indiv_fnames{b}));
0123         end
0124     end
0125     
0126     fprintf('\nTIME RANGE\n');
0127     fprintf('%g to %g ms\n',specGND.time_pts(1),specGND.time_pts(end));
0128     
0129     fprintf('\nSAMPLING RATE\n');
0130     fprintf('%g Hz\n',specGND.srate);
0131     
0132     fprintf('\nBINS\n');
0133     if n_bins
0134         for b=1:n_bins,
0135             if specGRP_var,
0136                 fprintf('Bin %d: %s\n',b,specGND.bin_info(b).bindesc);
0137             else
0138                 fprintf('Bin %d: %s\n',b,specGND.bindesc{b});
0139             end
0140         end
0141     else
0142         fprintf('No bins are yet stored with these data.\n');
0143     end
0144 end
0145 %t-Tests
0146 fprintf('\nt-TESTS\n');
0147 if tfrGND_var,
0148     %moving time window spectral analysis based on fieldtrip
0149     n_ptests=length(specGND.stats);
0150     
0151     for t=1:n_ptests,
0152         fprintf('t-test %d->Bin(s) %s\n',t,specGND.stats{t}.bins);
0153         fprintf('Multiple comparison correction: %s\n', ...
0154             specGND.stats{t}.correctm);
0155         fprintf('Alpha level: %g\n', ...
0156             specGND.stats{t}.family_alpha);
0157         if strcmpi(specGND.stats{t}.correctm,'cluster'),
0158             fprintf('Test-wise alpha level for cluster inclusion: %g\n', ...
0159                 specGND.stats{t}.cfg.clusteralpha);
0160             fprintf('Sensor neighborhood distance threshold: %g\n', ...
0161                 specGND.stats{t}.cfg.neighbourdist);
0162             fprintf('Minimum number of neighbors for cluster inclusion: %d\n', ...
0163                 specGND.stats{t}.cfg.minnbchan);
0164         end
0165         
0166         %Time Range
0167         fprintf('Time points included: %g to %g ms\n',specGND.stats{t}.time(1)*1000, ...
0168             specGND.stats{t}.time(end)*1000);
0169 
0170         %Freq Range
0171         fprintf('Frequencies included: %g to %g Hz\n',specGND.stats{t}.freq(1), ...
0172             specGND.stats{t}.freq(end));
0173         
0174         %Channels
0175         if strcmpi(specGND.stats{t}.cfg.avgoverchan,'yes')
0176             %Averaged over channels?
0177             fprintf('Analysis performed on averaged channel spectra.\n');
0178         end
0179         
0180         excluded=setdiff(specGND.ftrip.label,specGND.stats{t}.label);
0181         if isempty(excluded),
0182             fprintf('All channels included\n');
0183         else
0184             fprintf('Excluding channels:');
0185             for c=1:length(excluded),
0186                 fprintf(' %s',excluded{c});
0187             end
0188             fprintf('\n');
0189         end
0190         
0191         %Tail of test
0192         if specGND.stats{t}.cfg.tail==1,
0193             fprintf('Upper tailed test.\n');
0194         elseif specGND.stats{t}.cfg.tail==-1,
0195             fprintf('Lower tailed test.\n');
0196         else
0197             fprintf('Two-tailed test.\n');
0198         end
0199         
0200         fprintf('\n');
0201     end
0202 else
0203     %Static time window spectral analysis
0204     n_ptests=length(specGND.t_tests);
0205     
0206     % Add test tail?
0207     
0208     for t=1:n_ptests,
0209         fprintf('t-test %d->Bin %d, ',t,specGND.t_tests(t).bin);
0210         if isnan(specGND.t_tests(t).n_perm)
0211             fprintf('q(method=%s)=%f, ',specGND.t_tests(t).mult_comp_method, ...
0212                 specGND.t_tests(t).desired_alphaORq);
0213         else
0214             fprintf('Est. Alpha=%f, ',specGND.t_tests(t).estimated_alpha);
0215         end
0216         if strcmpi(specGND.t_tests(t).mean_band,'yes'),
0217             fprintf('Mean power in ');
0218         else
0219             fprintf('Each frequency in ');
0220         end
0221         n_wind=size(specGND.t_tests(t).freq_band,1);
0222         for w=1:n_wind,
0223             if w==n_wind
0224                 fprintf('%f-%f Hz, ',rnd_orderofmag(10*specGND.t_tests(t).freq_band(w,1))/10, ...
0225                     rnd_orderofmag(10*specGND.t_tests(t).freq_band(w,2))/10);
0226             else
0227                 fprintf('%f-%f, ',specGND.t_tests(t).freq_band(w,1), ...
0228                     specGND.t_tests(t).freq_band(w,2));
0229             end
0230         end
0231         ex_ids=setdiff(1:length(specGND.chanlocs),specGND.t_tests(t).used_chan_ids);
0232         if isempty(ex_ids),
0233             fprintf('All channels included\n');
0234         else
0235             fprintf('Excluding channels:');
0236             for c=ex_ids,
0237                 fprintf(' %s',specGND.chanlocs(c).labels);
0238             end
0239             fprintf('\n');
0240         end
0241         fprintf('\n');
0242     end
0243 end
0244 if ~n_ptests,
0245     fprintf('No t-test results have been stored with these data.\n');
0246 end

Generated on Tue 10-May-2016 16:37:45 by m2html © 2005