Home > vbmeg > demo > tutorial > MEG > vb_meg_tutorial.m

vb_meg_tutorial

PURPOSE ^

tutorial of VBMEG for MEG

SYNOPSIS ^

function vb_meg_tutorial(tut_code)

DESCRIPTION ^

 tutorial of VBMEG for MEG
 [usage]
   vb_meg_tutorial(tut_code)
 [input]
   tut_code : <optional> tutorial code number
            :  1001) vb_job_meg (import Yokogawa data)
 [output]
   none
 [note]

 [history]
   2010-02-10 (Sako) last update

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function vb_meg_tutorial(tut_code)
0002 % tutorial of VBMEG for MEG
0003 % [usage]
0004 %   vb_meg_tutorial(tut_code)
0005 % [input]
0006 %   tut_code : <optional> tutorial code number
0007 %            :  1001) vb_job_meg (import Yokogawa data)
0008 % [output]
0009 %   none
0010 % [note]
0011 %
0012 % [history]
0013 %   2010-02-10 (Sako) last update
0014 %
0015 % Copyright (C) 2011, ATR All Rights Reserved.
0016 % License : New BSD License(see VBMEG_LICENSE.txt)
0017 
0018 % --- CHECK ENVIRONMENT
0019 if ~exist('tut_code', 'var'), tut_code = []; end
0020 [tut_code, data_root] = inner_solve_env(tut_code);
0021 
0022 % if isempty(tut_code)
0023 %   test_code = 1001;
0024 % end
0025 
0026 proj_root = './tutorial/MEG/vbmeg_data';
0027 
0028 switch tut_code
0029 
0030   % TUTORIAL 1000s : import yokogawa data
0031   case 1001
0032     % --- vb_job_meg - POS-MAT file is given
0033     meg_parm = vb_meg_parm_set_measurement([], 'MEG', 'YOKOGAWA');
0034  
0035     meg_data_dir = [data_root '/AM090311'];
0036     pos_data_dir = [data_root '/AM090311-POS'];
0037     meg_parm.yokogawa_file = [meg_data_dir '/AM090311a.con'];
0038     meg_parm.pos_file = [pos_data_dir '/AM090311.pos.mat'];
0039 
0040     % --- output
0041 %     meg_parm.meg_file = sprintf('test_%d.meg.mat', tut_code);
0042     meg_parm.meg_file = sprintf('test.meg.mat');
0043     
0044 %     meg_parm.memory_max = 10000000;
0045 %     meg_parm.ex_ch_gain = [];
0046     
0047 %     saveman.data_dir = sprintf('./binary_data_%d', tut_code);
0048 %     saveman.precision = 'float64';
0049 %     meg_parm.saveman = saveman;
0050     
0051     vb_job_meg(proj_root, meg_parm);
0052     
0053   case 1002
0054     % --- vb_job_meg - POS-MAT file is not be given
0055     meg_parm = vb_meg_parm_set_measurement([], 'MEG', 'YOKOGAWA');
0056     meg_data_dir = [data_root '/AM090311'];
0057     meg_parm.yokogawa_file = [meg_data_dir '/AM090311a.con'];
0058 
0059     % --- output
0060     meg_parm.meg_file = sprintf('test_%d.meg.mat', tut_code);
0061     
0062     meg_parm.memory_max = 10000000;
0063     meg_parm.ex_ch_gain = [];
0064     
0065     saveman.data_dir = sprintf('./binary_data_%d', tut_code);
0066     saveman.precision = 'float64';
0067     meg_parm.saveman = saveman;
0068     
0069     vb_job_meg(proj_root, meg_parm);
0070 
0071   case 1003
0072     % --- remake MEG-MAT file by loading POS-MAT file
0073     base_no   = 1002;
0074 
0075     meg_data_dir = proj_root;
0076     pos_data_dir = [data_root '/AM090311-POS'];
0077 
0078     pos_file = [pos_data_dir '/AM090311.pos.mat'];
0079     meg_file = [meg_data_dir '/' sprintf('test_%d.meg.mat', base_no)];
0080 
0081     new_file = sprintf('%s/test_%d.meg.mat', proj_root, tut_code);
0082     
0083     result = vb_posfile_remake_datafile(pos_file, meg_file, new_file);
0084     return;
0085 
0086   case 1101
0087     % --- load 'MEG' data (default)
0088     test_data_no = 1001;
0089 
0090     file_name = sprintf('test_%d.meg.mat', test_data_no);
0091     meg_file = [proj_root '/' file_name];
0092     
0093     new_file = sprintf('%s/load_%d.meg.mat', proj_root, tut_code);
0094     [meg_data, ch_info] = vb_load_meg_data(meg_file);
0095 
0096   case 1102
0097     % --- load 'EXTRA' data
0098     base_no = 1001;
0099 
0100     file_name = sprintf('test_%d.meg.mat', base_no);
0101     meg_file = [proj_root '/' file_name];
0102     
0103     loadspec.ChannelType = 'EXTRA';
0104     
0105     new_file = sprintf('%s/test_%d.meg.mat', proj_root, tut_code);
0106     [meg_data, ch_info] = vb_load_meg_data(meg_file, loadspec, new_file);
0107     
0108   case 1103
0109     % --- load 'REFERENCE' data
0110     base_no = 1001;
0111 
0112     file_name = sprintf('test_%d.meg.mat', base_no);
0113     meg_file = [proj_root '/' file_name];
0114     
0115     loadspec.ChannelType = 'REFERENCE';
0116     
0117     new_file = sprintf('%s/test_%d.meg.mat', proj_root, tut_code);
0118     [meg_data, ch_info] = vb_load_meg_data(meg_file, loadspec, new_file);
0119     
0120   case 1111
0121     % --- loading narrowed data by channel type 'AXIAL'
0122     test_data_no = 1001;
0123 
0124     file_name = sprintf('test_%d.meg.mat', test_data_no);
0125     meg_file = [proj_root '/' file_name];
0126     
0127     % --- set load_spec
0128     % ----- User wants to get the AXIAL data
0129     ch_info_axial = vb_load_channel_info(meg_file, 'AXIAL');
0130     % --- [ChannelInfo <struct>] ---------- *
0131     % ---  .Active [n_channel x 1]
0132     % ---  .Name   {n_channel x 1}
0133     % ---  .ID     [n_channel x 1]
0134     % ---  .Type   [n_channel x 1]
0135     % ------------------------------------- *
0136     loadspec.ChannelName = ch_info_axial.Name;
0137     
0138     new_file = sprintf('%s/load_%d.meg.mat', proj_root, tut_code);
0139     [meg_data, ch_info] = vb_load_meg_data(meg_file, loadspec, new_file);
0140 
0141   case 1112
0142     % --- loading narrowed data by channel type 'PLANAR'
0143     test_data_no = 1001;
0144 
0145     file_name = sprintf('test_%d.meg.mat', test_data_no);
0146     meg_file = [proj_root '/' file_name];
0147     
0148     % --- set load_spec
0149     % ----- User wants to get the AXIAL data
0150     ch_info_planar = vb_load_channel_info(meg_file, 'PLANAR');
0151     % --- [ChannelInfo <struct>] ---------- *
0152     % ---  .Active [n_channel x 1]
0153     % ---  .Name   {n_channel x 1}
0154     % ---  .ID     [n_channel x 1]
0155     % ---  .Type   [n_channel x 1]
0156     % ------------------------------------- *
0157     loadspec.ChannelName = ch_info_planar.Name;
0158     
0159     new_file = sprintf('%s/load_%d.meg.mat', proj_root, tut_code);
0160     [meg_data, ch_info] = vb_load_meg_data(meg_file, loadspec, new_file);
0161     
0162   case 1121
0163     % --- make TRIAL MEG data file
0164     test_data_no = 1001;
0165     org_file  = sprintf('%s/test_%d.meg.mat', proj_root, test_data_no);
0166     new_file  = sprintf('%s/test_%d.meg.mat', proj_root, tut_code);
0167     loadspec.ChannelType = 'ALL';
0168     loadspec.Trigger = [2000; 5000; 8000; 11000; 14000; 17000; 20000];
0169     loadspec.Pretrigger = 200;
0170     loadspec.Posttrigger = 2000;
0171     [loaded_data, ch_info] = vb_load_meg_data(org_file, loadspec, new_file);
0172 
0173   case 1122
0174     % --- make shortend meg.mat file
0175     test_data_no = 1121;
0176     org_file  = sprintf('%s/test_%d.meg.mat', proj_root, test_data_no);
0177     new_file  = sprintf('%s/test_%d.meg.mat', proj_root, tut_code);
0178     loadspec.ChannelType = 'ALL';
0179     loadspec.TrialNumber = [2;4;5];
0180     [loaded_data, ch_info] = vb_load_meg_data(org_file, loadspec, new_file);
0181 
0182   case 2011
0183     % --- utilities - vb_load_meg_info
0184     %     info_type : <optional> (bit sequence) type code you want [1]
0185     %               :  1) (0001) basic
0186     %               :      .SampleFreq
0187     %               :      .Nchannel
0188     %               :      .Nsample
0189     %               :      .Nrepeat
0190     %               :      .Pretrigger
0191     %               :      .device
0192     %               :  2) (0010) for brain sphere model
0193     %               :      .Vcenter
0194     %               :      .Vradius
0195     %               :  3) (0100) channel data
0196     %               :      .MEGch_id
0197     %               :      .MEGch_name
0198     %               :  4) (1000) active conditions
0199     %               :      .ActiveChannel
0200     %               :      .ActiveTrial
0201     test_data_no = 1001;
0202 
0203     file_name = sprintf('test_%d.meg.mat', test_data_no);
0204     meg_file = [proj_root '/' file_name];
0205 
0206     meg_info = vb_load_meg_info(meg_file);
0207     vb_util_show_struct(meg_info, 0);
0208 
0209     meg_info = vb_load_meg_info(meg_file, 1);
0210     vb_util_show_struct(meg_info, 0);
0211     
0212     meg_info = vb_load_meg_info(meg_file, 2);
0213     vb_util_show_struct(meg_info, 0);
0214 
0215     meg_info = vb_load_meg_info(meg_file, 3);
0216     vb_util_show_struct(meg_info, 0);
0217     
0218     meg_info = vb_load_meg_info(meg_file, 4);
0219     vb_util_show_struct(meg_info, 0);
0220     
0221     meg_info = vb_load_meg_info(meg_file, 5);
0222     vb_util_show_struct(meg_info, 0);
0223     
0224     meg_info = vb_load_meg_info(meg_file, 6);
0225     vb_util_show_struct(meg_info, 0);
0226     
0227     meg_info = vb_load_meg_info(meg_file, 7);
0228     vb_util_show_struct(meg_info, 0);
0229     
0230     meg_info = vb_load_meg_info(meg_file, 8);
0231     vb_util_show_struct(meg_info, 0);
0232     
0233     meg_info = vb_load_meg_info(meg_file, 9);
0234     vb_util_show_struct(meg_info, 0);
0235     
0236     meg_info = vb_load_meg_info(meg_file, 10);
0237     vb_util_show_struct(meg_info, 0);
0238     
0239     meg_info = vb_load_meg_info(meg_file, 11);
0240     vb_util_show_struct(meg_info, 0);
0241     
0242     meg_info = vb_load_meg_info(meg_file, 12);
0243     vb_util_show_struct(meg_info, 0);
0244     
0245     meg_info = vb_load_meg_info(meg_file, 13);
0246     vb_util_show_struct(meg_info, 0);
0247     
0248     meg_info = vb_load_meg_info(meg_file, 14);
0249     vb_util_show_struct(meg_info, 0);
0250     
0251     meg_info = vb_load_meg_info(meg_file, 15);
0252     vb_util_show_struct(meg_info, 0);
0253     return;
0254 
0255   case 2021
0256     test_data_no = 1001;
0257 
0258     file_name = sprintf('test_%d.meg.mat', test_data_no);
0259     meg_file = [proj_root '/' file_name];
0260     
0261     % --- default
0262     [ch_info] = vb_load_channel_info(meg_file);
0263     vb_util_show_struct(ch_info);
0264 
0265     % --- specified by type name
0266     [ch_info] = vb_load_channel_info(meg_file, 'MEG');
0267     vb_util_show_struct(ch_info);
0268 
0269     [ch_info] = vb_load_channel_info(meg_file, 'EEG');
0270     vb_util_show_struct(ch_info);
0271 
0272     [ch_info] = vb_load_channel_info(meg_file, 'EXTRA');
0273     vb_util_show_struct(ch_info);
0274     
0275     [ch_info] = vb_load_channel_info(meg_file, 'REFERENCE');
0276     vb_util_show_struct(ch_info);
0277     
0278     [ch_info] = vb_load_channel_info(meg_file, 'ALL');
0279     vb_util_show_struct(ch_info);
0280     
0281     [ch_info] = vb_load_channel_info(meg_file, 'AXIAL');
0282     vb_util_show_struct(ch_info);
0283     
0284     [ch_info] = vb_load_channel_info(meg_file, 'PLANAR');
0285     vb_util_show_struct(ch_info);
0286     
0287     [ch_info] = vb_load_channel_info(meg_file, 'UNKNOWN');
0288     vb_util_show_struct(ch_info);
0289 
0290     [ch_info] = vb_load_channel_info(meg_file, 'USER', {'10';'100';'200'});
0291     vb_util_show_struct(ch_info);
0292 
0293     [ch_info] = vb_load_channel_info(meg_file, 'USER', [13;23;33;43;53;303]);
0294     vb_util_show_struct(ch_info);
0295 
0296     % --- specified by type code (number defined by Yokogawa)
0297     [ch_info] = vb_load_channel_info(meg_file, 2);
0298     vb_util_show_struct(ch_info);
0299 
0300     [ch_info] = vb_load_channel_info(meg_file, 3);
0301     vb_util_show_struct(ch_info);
0302 
0303     [ch_info] = vb_load_channel_info(meg_file, -1);
0304     vb_util_show_struct(ch_info);
0305     
0306     [ch_info] = vb_load_channel_info(meg_file, -2);
0307     vb_util_show_struct(ch_info);
0308     return;
0309    
0310   case 2022
0311     % load sensor information
0312     % --- utilities - vb_load_sensor
0313     % --- loading sensor informations like coordinates etc.
0314     test_data_no = 1001;
0315 
0316     file_name = sprintf('test_%d.meg.mat', test_data_no);
0317     meg_file = [proj_root '/' file_name];
0318     
0319     [p,q,c,v] = vb_load_sensor(meg_file);
0320     fprintf('[pick]       size(p) = [%d x %d]\n', size(p,1), size(p,2));
0321     fprintf('[Qpick]      size(q) = [%d x %d]\n', size(q,1), size(q,2));
0322     fprintf('[CoilWeight] size(c) = [%d x %d]\n', size(c,1), size(c,2));
0323     fprintf('[Vcenter] = (%f,%f,%f)\n', v(1),v(2),v(3));
0324     return;
0325 
0326   case 3001
0327     % --- vb_megfile_filter_ch_data
0328     test_data_no = 1001;
0329     meg_file  = sprintf('%s/test_%d.meg.mat', proj_root, test_data_no);
0330     
0331     proc_spec = [];
0332     
0333     parm.filt_suffix = '_filt';
0334     parm.bias_flg = 1;
0335     parm.highpass = 0.5000;
0336     parm.lowpass = 100;
0337     parm.highpass_online = 1;
0338     parm.lowpass_online = 0;
0339     parm.common_flg = 0;
0340     parm.fsamp = [];
0341     
0342     proc_spec.parm = parm;
0343     
0344     % --- new meg file
0345     proc_spec.new_meg = sprintf('filtered_%d.meg.mat', tut_code);
0346     proc_spec.new_bin_dir = sprintf('binary_data_%d', tut_code);
0347     
0348     result = vb_megfile_filter_ch_data(meg_file, proc_spec);
0349 
0350   case 3002
0351     % --- make trigger file - vb_job_trial_onset
0352     test_data_no  = 3001;
0353     meg_file_body = sprintf('filtered_%d', test_data_no);
0354     data_file{1}  = meg_file_body;
0355     root_dir      = proj_root;
0356 
0357     % --- List of MEG file names (base name without extension)
0358 %     plot_parm.mode  = 1;
0359     plot_parm.mode  = 0;
0360     plot_parm.NXmax = 6; % # of trial   in X-axis
0361     plot_parm.NYmax = 5; % # of subplot in Y-axis
0362 
0363     % --- Set condition list
0364     condition    = {'voice', 'mik_B', 'mik_G', 'ter_B', 'ter_G' };
0365     status_ch    = { '442',  '435',   '436',   '437',   '438'   };
0366     trig_type    = {'voice', 'analog','analog','analog','analog'};
0367     slope        = {'','low_to_high','low_to_high','low_to_high','low_to_high'};
0368     status_level = [ 0.02, 0.5 ,  0.5 ,  0.5 ,  0.5 ] ;
0369     Pretrigger_ms   = [ 500 ,    0,    0,    0,    0]; % [msec]
0370     Posttrigger_ms  = [1000 , 2000, 2000, 2000, 2000]; % [msec]
0371 
0372     Nfile = length(data_file);
0373     Ncond = length(condition);
0374 %     Ncond = 2;
0375 
0376     % --- Trial onset extraction start
0377     for n=1:Nfile
0378         % MEG mat file
0379         parm.data_file  = [data_file{n} '.meg.mat'];
0380     
0381         for m=1:Ncond
0382             % m-th condition
0383             parm.condition    = condition{m};
0384             parm.status_ch    = status_ch{m};
0385             parm.trig_type    = trig_type{m};
0386             parm.slope        = slope{m};
0387         
0388             parm.status_level = status_level(m);
0389             parm.Pretrigger_ms   = Pretrigger_ms(m);
0390             parm.Posttrigger_ms  = Posttrigger_ms(m);
0391         
0392             % Trial onset  file
0393             parm.trig_file  = [data_file{n} '_' condition{m} '.mat'];
0394         
0395             % Get time index for each trial by checking status channel
0396             vb_job_trial_onset(root_dir,parm);
0397         
0398             if plot_parm.mode > 0
0399                 % png file name
0400                 fpng = [root_dir '/' data_file{n} '_' condition{m} ];
0401                 plot_parm.png = fpng;
0402             
0403                 vb_plot_status([root_dir '/' parm.trig_file ], plot_parm);
0404         end
0405       end
0406     end
0407     return;
0408 
0409   case 3003
0410     % --- chop data - vb_msrmnt_make_trial_data
0411     proc_spec = [];
0412     base_data_no = 3001;
0413     filter_type = 'voice';
0414 
0415     proc_spec.trig_file  = sprintf('filtered_%d_%s.mat', ...
0416       base_data_no, filter_type);
0417 
0418     % --- make chopped data
0419     proc_spec.root_dir = proj_root;
0420     
0421     proc_spec.new_file = sprintf('%s/test_%d.meg.mat', ...
0422       proc_spec.root_dir, tut_code);
0423 
0424     % --- switch to store externally
0425     proc_spec.new_bin_dir = sprintf('binary_data_%d', tut_code);
0426     [meg_data, ch_info] = vb_msrmnt_make_trial_data(proc_spec);
0427     fprintf('size of ''meg_data'' is [%d x %d x %d]\n', ...
0428       size(meg_data,1), size(meg_data,2), size(meg_data,3));
0429     vb_util_show_struct(ch_info);
0430     return;
0431     
0432   case 3004
0433     % --- loading chopped data
0434     test_no = 3003;
0435     file_name = sprintf('test_%d.meg.mat', test_no);
0436     meg_file = [proj_root '/' file_name];
0437 
0438     new_meg = sprintf('%s/test_%d.meg.mat', proj_root, tut_code);
0439 
0440     %
0441     % --- The data 20003 is expected that its data size is [448 x 6751 x 120]
0442     % --- as [n_channel x n_sample x n_trial].
0443     load_spec.ChannelType = 'ALL';
0444     load_spec.Trigger = 1000;
0445     load_spec.Pretrigger = 449;
0446     load_spec.Posttrigger = 2000;
0447     load_spec.TrialNumber = [1;10;13;26;110];
0448     load_spec.ChannelName = {'50';'51';'103';'284';'335';'400';'410';'440'};
0449 
0450     [meg_data, ch_info] = vb_load_meg_data(meg_file, load_spec, new_meg);
0451 
0452     fprintf('size of ''meg_data'' is [%d x %d x %d]\n', ...
0453       size(meg_data,1), size(meg_data,2), size(meg_data,3));
0454     vb_util_show_struct(ch_info);
0455 
0456   case 3005
0457     % --- active channel load test
0458     % --- 1) make new meg file which is updated active flags(channel and trial)
0459     % --- 2) try to load with active switch on
0460     base_no = 3003;
0461     meg_file = sprintf('%s/test_%d.meg.mat', proj_root, base_no);
0462     tmp_file = sprintf('%s/tmp_%d.meg.mat', proj_root, tut_code);
0463 
0464     active_ch = ones(400,1);
0465     active_ch([1:190 200:370 381 383 385]) = 0;
0466 
0467     active_tr = ones(120,1);
0468     active_tr([1:70 80:110]) = 0;
0469 
0470     vb_msrmnt_update_active_flag(meg_file, active_ch, active_tr, tmp_file);
0471     
0472     % --- active channel load test - continuous
0473     % --- [default] load_spec.ActiveChannel [true]
0474     % --- [default] load_spec.ActiveTrial   [true]
0475     new_file = sprintf('%s/test_%d.meg.mat', proj_root, tut_code);
0476     [meg_data, ch_info] = vb_load_meg_data(tmp_file, [], new_file);
0477 
0478     fprintf('size of ''meg_data'' is [%d x %d x %d]\n', ...
0479       size(meg_data,1), size(meg_data,2), size(meg_data,3));
0480     vb_util_show_struct(ch_info);
0481 
0482   case 3006
0483     % --- vb_megfile_make_trial_data
0484     base_no  = 1001;
0485     meg_file = sprintf('%s/test_%d.meg.mat', proj_root, base_no);
0486     trig_code = 3001;
0487     trig_type = 'voice';
0488 
0489     trig_file = sprintf('%s/filtered_%d_%s.mat', ...
0490       proj_root, trig_code, trig_type);
0491     triginfo = load(trig_file);
0492     
0493     proc_spec.trigger        = triginfo.trig;
0494     proc_spec.pretrigger_ms  = triginfo.parm.Pretrigger_ms;
0495     proc_spec.posttrigger_ms = triginfo.parm.Posttrigger_ms;
0496     proc_spec.sample_freq    = triginfo.parm.fsamp;
0497     proc_spec.new_file       = sprintf('test_%d.meg.mat', tut_code);
0498 
0499     [meg_data, ch_info] = vb_megfile_make_trial_data(meg_file, proc_spec);
0500 
0501     fprintf('size of ''meg_data'' is [%d x %d x %d]\n', ...
0502       size(meg_data,1), size(meg_data,2), size(meg_data,3));
0503     vb_util_show_struct(ch_info);
0504 
0505   case 3007
0506     % --- vb_megfile_make_trial_data
0507     base_no  = 1001;
0508     meg_file = sprintf('%s/test_%d.meg.mat', proj_root, base_no);
0509     
0510     trig_code = 3001;
0511     trig_type = 'voice';
0512 
0513     trig_file = sprintf('%s/filtered_%d_%s.mat', ...
0514       proj_root, trig_code, trig_type);
0515     triginfo = load(trig_file);
0516     
0517     proc_spec.trigger        = triginfo.trig;
0518     proc_spec.pretrigger_ms  = triginfo.parm.Pretrigger_ms;
0519     proc_spec.posttrigger_ms = triginfo.parm.Posttrigger_ms;
0520     proc_spec.sample_freq    = triginfo.parm.fsamp;
0521     proc_spec.new_file       = sprintf('%s/test_%d.meg.mat', ...
0522                                  proj_root, tut_code);
0523     proc_spec.new_bin_dir    = sprintf('binary_data_%d', tut_code);
0524 
0525     [meg_data, ch_info] = vb_megfile_make_trial_data(meg_file, proc_spec);
0526 
0527     fprintf('size of ''meg_data'' is [%d x %d x %d]\n', ...
0528       size(meg_data,1), size(meg_data,2), size(meg_data,3));
0529     vb_util_show_struct(ch_info);
0530 
0531   case 3008
0532     % --- vb_info_get_trial_data
0533     base_no  = 20007;
0534     meg_file = sprintf('%s/test_%d.meg.mat', proj_root, base_no);
0535     
0536     info = vb_load_measurement_info(meg_file);
0537 %     trial_id = [];
0538     trial_id = [10:20];
0539 %     field_name = 'Active';
0540 %     field_name = 'sample';
0541     field_name = 'number';
0542     [trial, id_list] = vb_info_get_trial_data(info, trial_id, field_name);
0543 %     [trial, id_list] = vb_info_get_trial_data(info, [], field_name);
0544 %     [trial, id_list] = vb_info_get_trial_data(info, trial_id);
0545 %     [trial, id_list] = vb_info_get_trial_data(info);
0546 %     [trial, id_list] = vb_info_get_trial_data();
0547     fprintf('size of trial   is [%d x %d]\n', size(trial,1), size(trial,2));
0548     fprintf('size of id_list is [%d x %d]\n', size(id_list,1), size(id_list,2));
0549 
0550   case 3009
0551     % --- vb_load_device
0552     base_no  = 20007;
0553     meg_file = sprintf('%s/test_%d.meg.mat', proj_root, base_no);
0554     [Measurement, Device] = vb_load_device(meg_file);
0555 
0556   case 10001
0557     % --- (preprocessing test) vb_actfile_combine_key
0558     file_name = 'test_00.act.mat';
0559     act_file = [proj_root '/' file_name];
0560 
0561     key1 = 'Uniform';
0562     key2 = 'Tvalue4MI001';
0563     key3 = 'New_Key';
0564     mode = '';
0565     vb_actfile_combine_key(act_file, key1, key2, key3, mode);
0566 
0567   case 10002
0568     % --- (preprocessing test) vb_megfile_remove_noisysensor
0569     test_data_no = 10000;
0570     meg_file  = sprintf('%s/test_%d.meg.mat', proj_root, test_data_no);
0571     new_file  = sprintf('%s/test_%d.meg.mat', proj_root, tut_code);
0572     vb_megfile_remove_noisysensor(meg_file, new_file);
0573 
0574   case 10003
0575     % --- (preprocessing test) vb_megfile_remove_noisytrial
0576     test_data_no = 10000;
0577     meg_file  = sprintf('%s/test_%d.meg.mat', proj_root, test_data_no);
0578     new_file  = sprintf('%s/test_%d.meg.mat', proj_root, tut_code);
0579     vb_megfile_remove_noisytrial(meg_file, new_file);
0580     
0581   case 10004
0582     % --- (preprocessing test) vb_megfile_remove_offset
0583     test_data_no = 10000;
0584     meg_file  = sprintf('%s/test_%d.meg.mat', proj_root, test_data_no);
0585     new_file  = sprintf('%s/test_%d.meg.mat', proj_root, tut_code);
0586     vb_megfile_remove_offset(meg_file, new_file);
0587   
0588   case 10005
0589     % --- (preprocessing test) vb_megfile_remove_trial
0590     test_data_no = 10000;
0591     meg_file  = sprintf('%s/test_%d.meg.mat', proj_root, test_data_no);
0592     new_file  = sprintf('%s/test_%d.meg.mat', proj_root, tut_code);
0593     ix_trial_remove = (2);
0594     vb_megfile_remove_trial(meg_file, new_file, ix_trial_remove);
0595     
0596   case 10006
0597     % --- (preprocessing test) vb_megfile_remove_trial_ext
0598     test_data_no = 10000;
0599     meg_file  = sprintf('%s/test_%d.meg.mat', proj_root, test_data_no);
0600     new_file  = sprintf('%s/test_%d.meg.mat', proj_root, tut_code);
0601     vb_megfile_remove_trial_ext(meg_file, new_file);
0602 
0603   case 10007
0604     % --- (preprocessing test) vb_megfile_write_pretrigger
0605     test_data_no = 10000;
0606     meg_file  = sprintf('%s/test_%d.meg.mat', proj_root, test_data_no);
0607     pretrigger = 200;
0608     vb_megfile_write_pretrigger(meg_file, pretrigger);
0609     
0610   case 10008
0611     % --- (preprocessing test) vb_test_meg_rejection
0612     test_data_no = 10000;
0613     meg_file  = sprintf('%s/test_%d.meg.mat', proj_root, test_data_no);
0614     
0615     bexp = vb_load_meg_data(meg_file);
0616     loadspec.ChannelType = 'EXTRA';
0617     extra = vb_load_meg_data(meg_file, loadspec);
0618     loadspec.ChannelType = 'REFERENCE';
0619     refmg = vb_load_meg_data(meg_file, loadspec);
0620     bexp_ext = [extra; refmg];
0621     ejectedTrials = vb_test_meg_rejection(bexp, bexp_ext);
0622     
0623   case 20001
0624     % --- vb_util_check_variable_in_matfile.m
0625     sample_mat = sprintf('%s/test_%d.meg.mat', proj_root, 1001);
0626     hot_var = 'CoordType';
0627 %     hot_var = 'bexp';
0628     [state, const] = vb_util_check_variable_in_matfile(sample_mat, hot_var);
0629     fprintf('%s in %s is ', hot_var, sample_mat);
0630     if state == const.VALID
0631       fprintf('VALID\n');
0632     elseif state == const.VACANT
0633       fprintf('VACANT\n');
0634     elseif state == const.NONEXISTENT
0635       fprintf('NONEXISTENT\n');
0636     else
0637       fprintf('SOMETHING BAD STATE (%d)\n', state);
0638     end
0639     
0640   case 20002
0641     % --- temporary test
0642     meg_mat = sprintf('%s/test_%d.meg.mat', proj_root, 1121);
0643     load_spec.ChannelType = 'ALL';
0644     tic
0645     [data, ch_info] = vb_load_meg_data(meg_mat, load_spec);
0646     fprintf('data[%d x %d x %d]\n', size(data,1), size(data,2), size(data,3));
0647     vb_util_show_struct(ch_info, 0);
0648     fprintf('%f[sec]\n', toc);
0649   
0650   otherwise
0651     error('(%s) unknown test_code : %d', mfilename, test_code);
0652 end
0653 
0654 
0655 % --- INNER FUNCTIONS -------------------------------------------------------- %
0656 %
0657 % --- inner_solve_env()
0658 %
0659 function [tut_code, data_root] = inner_solve_env(tut_code)
0660 % --- Linux
0661 % data_root = '/home/cbi-data1/sakot/sample_data/meg';
0662 
0663 % --- Windows
0664 data_root = '\\Cbi-data1\cbi-data1\sakot\sample_data\meg';
0665   
0666 if isempty(tut_code)
0667   tut_code = 1001;
0668 end
0669 return;
0670 %
0671 % --- end of inner_solve_env()
0672 %
0673 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0674 
0675 %%% END OF FILE %%%

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005