Difference between revisions of "AnyWave:MATLAB Batch"

From WikiMEG
Jump to: navigation, search
(Created page with " [http://www.bodybuilding.com/store/goalanabolic.htm bodybuilding.com]Glucosamine - This extremely popular arthritis treatment that aid your entire body variety cartilage. Ma...")
 
(3. Define the arguments required by your plugin)
 
(42 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
=Introduction=
 +
One of the features of AnyWave is to run some processing from the command line.<br/>
 +
This is called batch processing, allowing to process many files in different locations using a script file run by the OS.<br/>
 +
=Make my plugin runnable in command line=
 +
If you want AnyWave to handle your plugin using the command line, you must do as follow:<br/>
 +
== 1 - edit the desc.txt==
 +
<syntaxhighlight lang="text">
 +
name = MyPlugin
 +
description = do something in MATLAB
 +
category = Process:Test:MyPlugin
 +
flags = CanRunFromCommandLine
 +
</syntaxhighlight>
 +
Note: we've added a line with the flags keyword. This keyword will inform AnyWave of the capabilities of your plugin.<br/>
 +
You may combine flags using the : (the colon character). Example:<br/>
 +
flags = CanRunFromCommandLine:NoDataRequired<br/>
 +
This indicates that the plugin can be called from the command line but also indicates that no data file is required. (The plugin will not run on a data file.)<br/>
 +
== 2 - edit your MATLAB code ==
 +
Modify the main.m file:<br/>
 +
<syntaxhighlight lang="matlab">
 +
function main(varargin)
 +
global args;  %% IMPORTANT: this variable will hold the arguments set by the user on the command line.
 +
if isdeployed  % this is the code to use if you plan to Compile your plugin to distribute it.
 +
% STANDALONE AnyWave Plugin code
 +
  global host; 
 +
  global port;
 +
  global pid;
  
 +
  if (nargin < 3) % basic argument checking
 +
      error('missing arguments.');
 +
  end
 +
  host = varargin{1};
 +
  port = str2num(varargin{2});
 +
  pid = str2num(varargin{3});
 +
  if (nargin > 3)
 +
    args = varargin{4};
 +
  end
 +
 
 +
  assignin('base', 'host',  host);
 +
  assignin('base', 'port', port);
 +
  assignin('base', 'pid', pid);
 +
  assignin('base', 'args', args);
 +
% end of STANDALONE AnyWave Plugin code
 +
end
  
[http://www.bodybuilding.com/store/goalanabolic.htm bodybuilding.com]Glucosamine - This extremely popular arthritis treatment that aid your entire body variety cartilage. Many bodybuilders encounter pains at their joints throughout the day from weightlifting.<br><br>[http://www.ebay.com/itm/Best-Natural-Testosterone-Booster-Supplement-Pills-TEST-WORx-Made-in-USA-/251595171442 ebay.com]<br><br>Testosterone Supplements can also be prescribed for someone who could have a low libido. Due to the fact testosterone is once more one particular of the major hormones accountable for a gentleman's sexual wish. So, logically, escalating the testosterone amounts will aid in escalating a gentleman's sexual wish: his libido. You can acquire about the counter nutritional supplements from a drug shop or overall health retail outlet. But the ideal costs are online, specially if you obtain a lot at the same time. Be cautious although of guarantees and statements manufactured about the solution. Do your investigation initial about what merchandise you might take into account to make certain they get the job done, to make confident you are informed of all facet outcomes and that you're getting the ideal price.<br><br>The very first matter that you require to ask by yourself when contemplating about gaining muscle mass is what size do you want to be? Are you just hunting to be toned? If so, this article is almost certainly not heading to aid you. There are numerous exercise routines you can use to develop properly toned muscle. This post will help if you want to be major. It isn't for everyone, so don't feel there is something mistaken with concentrating on finding a fit, toned physique rather of bodybuilding.<br><br>Finally, there is Hilary Robbins, a 43 calendar year previous divorce attorney and mother of one in El Paso TX who relies on the best testosterone therapy available. Hilary purchases effective testosterone goods to maintain quiet and cool all day at the business office. Right after all, the stress from her unattractive caseload can surely make up. Devoid of a amazing testosterone remedy, Hilary would turn out to be overstressed. The panic from her occupation would make her pull out all of her individual hair. Thankfully, a marvelous testosterone plan effectively keeps Hilary in a peaceful temper.<br><br>Testo100 [http://www.ebay.com/itm/Best-Natural-Testosterone-Booster-Supplement-Pills-TEST-WORx-Made-in-USA-/251595171442 Testosterone Booster] was formulated to increase the physique's possess manufacturing of testosterone. Testosterone is responsible for lowering excess body extra fat, and attaining more lean muscle mass mass.<br><br>When the time is right for you to start off looking and feeling 50 percent you age, just get in contact with a accredited medical professional at a impressive testosterone middle. You must only get testosterone injections. All of the Testosterone Pills, sprays, oils and lotions for sale are explained to be worthless ripoffs. It is just as critical to only do enterprise with a dependable testosterone clinic functioning inside the US. Normally, you won't have our nation's Fda searching out for you normal wellbeing. With a trustworthy testosterone program, you and your wife or husband can get the lean and desirable physiques of your past.<br><br>There are issues like protein bars, whey, creatine, glutamine, advancement hormones, testosterone boosters - and the listing goes on. Every one particular undoubtedly serves various functions. If you're a starter in the arena of overall body constructing, it may be difficult to pinpoint one particular that you genuinely will need. And with a limited budget, it's not possible to acquire all of them.<br><br>You could go to your physician and see if they'll prescribe testosterone remedy, and it's certainly suggested that you talk to with your health practitioner on this kind of matters. But not each and every health practitioner is willing to offer with testosterone remedy, and numerous folks just downright can't pay for the expense. So they search for other cures for boosting take a look at.
+
% we assume here that the code will always run in batch mode.
 +
% To check if the plugin was called in batch mode, just check if args variable is empty or not.
 +
if isempty(args)
 +
  error('this plugin will only run in batch mode');
 +
end
 +
 
 +
% code your stuff here
 +
% use args to get the arguments:
 +
% args is a structure containing fields named upon the arguments set by the command line.
 +
%
 +
% one of the common argument set by AnyWave is input_file which contains the path to the data file to process.
 +
% so to get the file use :  file = args.input_file;
 +
 
 +
</syntaxhighlight>
 +
== 3. Define the arguments required by your plugin==
 +
AnyWave offers a set of predefined arguments name, let's call them common arguments.<br/>
 +
See here to view all the common arguments name to use.<br/>
 +
But sometimes, you will need to use specific arguments for your plugin and you will need to let AnyWave know about them.<br/>
 +
To inform AnyWave about the argument key it will recognize from the command line and pass them to your plugin, you need to add a json file to the folder containing your plugin.<br>
 +
<br/>
 +
The file must be named '''args.json''' and must contain at least one key called '''parameters'''.<br/>
 +
An optional key named '''flags''' may also  be added. flags will be used as boolean arguments for the plugin.<br/>
 +
Example:<br/>
 +
<syntaxhighlight lang="java">
 +
{
 +
"parameters" : [ "eeg_file", "meg_file"],
 +
"flags" : [ "downsample", "use_threshold"]
 +
}
 +
</syntaxhighlight>
 +
Hence, AnyWave will be able to parse --eeg_file and --meg_file keys from the command line and pass them to your plugin (in the args global variable):<br/>
 +
AnyWave will also parse arguments --downsample <true|yes|false|no> and set the corresponding boolean value.<br/>
 +
<syntaxhighlight lang="matlab">
 +
function main(varargin)
 +
global args;  %% DO NOT FORGET
 +
% init code
 +
% ...
 +
 
 +
eeg = args.eeg_file;
 +
meg = args.meg_file;
 +
 
 +
% compute something...
 +
end
 +
</syntaxhighlight>

Latest revision as of 15:30, 21 April 2020

Introduction

One of the features of AnyWave is to run some processing from the command line.
This is called batch processing, allowing to process many files in different locations using a script file run by the OS.

Make my plugin runnable in command line

If you want AnyWave to handle your plugin using the command line, you must do as follow:

1 - edit the desc.txt

name = MyPlugin
description = do something in MATLAB
category = Process:Test:MyPlugin
flags = CanRunFromCommandLine

Note: we've added a line with the flags keyword. This keyword will inform AnyWave of the capabilities of your plugin.
You may combine flags using the : (the colon character). Example:
flags = CanRunFromCommandLine:NoDataRequired
This indicates that the plugin can be called from the command line but also indicates that no data file is required. (The plugin will not run on a data file.)

2 - edit your MATLAB code

Modify the main.m file:

function main(varargin)
global args;  %% IMPORTANT: this variable will hold the arguments set by the user on the command line. 
if isdeployed  % this is the code to use if you plan to Compile your plugin to distribute it.
% STANDALONE AnyWave Plugin code
   global host;   
   global port;
   global pid;
 
   if (nargin < 3) % basic argument checking
       error('missing arguments.');
  end
  host = varargin{1};
  port = str2num(varargin{2});
  pid = str2num(varargin{3});
  if (nargin > 3)
    args = varargin{4};
  end
 
  assignin('base', 'host',  host);
  assignin('base', 'port', port);
  assignin('base', 'pid', pid);
  assignin('base', 'args', args);
% end of STANDALONE AnyWave Plugin code
end
 
% we assume here that the code will always run in batch mode.
% To check if the plugin was called in batch mode, just check if args variable is empty or not.
if isempty(args)
   error('this plugin will only run in batch mode');
end
 
% code your stuff here
% use args to get the arguments:
% args is a structure containing fields named upon the arguments set by the command line.
%
% one of the common argument set by AnyWave is input_file which contains the path to the data file to process.
% so to get the file use :  file = args.input_file;

3. Define the arguments required by your plugin

AnyWave offers a set of predefined arguments name, let's call them common arguments.
See here to view all the common arguments name to use.
But sometimes, you will need to use specific arguments for your plugin and you will need to let AnyWave know about them.
To inform AnyWave about the argument key it will recognize from the command line and pass them to your plugin, you need to add a json file to the folder containing your plugin.

The file must be named args.json and must contain at least one key called parameters.
An optional key named flags may also be added. flags will be used as boolean arguments for the plugin.
Example:

{
"parameters" : [ "eeg_file", "meg_file"],
"flags" : [ "downsample", "use_threshold"]
}

Hence, AnyWave will be able to parse --eeg_file and --meg_file keys from the command line and pass them to your plugin (in the args global variable):
AnyWave will also parse arguments --downsample <true|yes|false|no> and set the corresponding boolean value.

function main(varargin)
global args;  %% DO NOT FORGET
% init code
% ...
 
eeg = args.eeg_file;
meg = args.meg_file;
 
% compute something...
end