Home > bml > io > bml_neuroomega_info_depth.m

bml_neuroomega_info_depth

PURPOSE ^

BML_NEUROOMEGA_INFO_DEPTH returns a table with .mat file information

SYNOPSIS ^

function info = bml_neuroomega_info_depth(cfg)

DESCRIPTION ^

 BML_NEUROOMEGA_INFO_DEPTH returns a table with .mat file information
 aggregated by depth. Useful to select relevant depths

 Use as
   info = bml_neuroomega_info_depth(cfg)

 where cfg is a configureation struct with the following fields
 cfg.path - string: path where to look for the .mat files
 cfg.sort - string: variable by which to sort the output table
 cfg.direction - string: either 'descend' (default) or 'ascend'

 Returns a table with variables
   depth - double: position of the record in mm
   files - double: number of files at this depth
   size - double: aggregated size of all files in MB

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function info = bml_neuroomega_info_depth(cfg)
0002 
0003 % BML_NEUROOMEGA_INFO_DEPTH returns a table with .mat file information
0004 % aggregated by depth. Useful to select relevant depths
0005 %
0006 % Use as
0007 %   info = bml_neuroomega_info_depth(cfg)
0008 %
0009 % where cfg is a configureation struct with the following fields
0010 % cfg.path - string: path where to look for the .mat files
0011 % cfg.sort - string: variable by which to sort the output table
0012 % cfg.direction - string: either 'descend' (default) or 'ascend'
0013 %
0014 % Returns a table with variables
0015 %   depth - double: position of the record in mm
0016 %   files - double: number of files at this depth
0017 %   size - double: aggregated size of all files in MB
0018 
0019 % 2017.10.13 AB
0020 
0021 sortvar = ft_getopt(cfg,'sort','depth');
0022 direction = ft_getopt(cfg,'direction','descend');
0023 
0024 files = bml_neuroomega_info_file(cfg);
0025 files.size = files{:,'bytes'}/1e6;
0026 
0027 info=varfun(@(x)round(sum(x),1),files,'InputVariables','size',...
0028        'GroupingVariables','depth');
0029 if ismember('time_begin', files.Properties.VariableNames)
0030   info=join(info,...
0031     varfun(@min,files,'InputVariables','time_begin',...
0032        'GroupingVariables','depth')...
0033     ,'Keys','depth');
0034 end
0035 if ismember('time_end', files.Properties.VariableNames)
0036   info=join(info,...
0037     varfun(@max,files,'InputVariables','time_end',...
0038        'GroupingVariables','depth')...
0039     ,'Keys','depth');
0040 end
0041 if all(ismember({'time_begin','time_end'}, files.Properties.VariableNames))
0042   files.file_duration=files.time_end-files.time_begin;
0043   info=join(info,...
0044     varfun(@sum,files,'InputVariables','file_duration',...
0045        'GroupingVariables','depth')...
0046     ,'Keys','depth');
0047   info.duration=info.max_time_end-info.min_time_begin;
0048   info.contiguous=info.sum_file_duration > 0.99 * info.duration;
0049 end
0050 
0051 if ismember('GroupCount_info', info.Properties.VariableNames)
0052   info.Properties.VariableNames{'GroupCount_info'} = 'files';
0053 elseif ismember('GroupCount', info.Properties.VariableNames)
0054   info.Properties.VariableNames{'GroupCount'} = 'files';  
0055 end
0056 
0057 %Eliminating GroupCounts
0058 info(:,strncmp('GroupCount',info.Properties.VariableNames,10))=[]
0059 
0060 info.Properties.VariableNames{'Fun_size'} = 'size';
0061 %info.Properties.VariableUnits = {'mm' '#' 'MB'};
0062 
0063 info=sortrows(info,sortvar,direction);
0064 
0065 
0066 
0067 
0068 
0069 
0070

Generated on Tue 25-Sep-2018 10:08:19 by m2html © 2005