Difference between revisions of "AnyWave:CLI runPlugin"

From WikiMEG
Jump to: navigation, search
(Created page with "Hello, I'm Candice, a 23 year old from Ijmuiden, Netherlands.<br>My hobbies include (but are not limited to) American football, Rock stacking and watching 2 Broke Girls.<br><b...")
 
(Created page with "=Process files= AnyWave can also process data files, running a specific process (plugin) to a bunch a files or directories.<br/> The keyword to do that kind of opteration is :...")
Line 1: Line 1:
Hello, I'm Candice, a 23 year old from Ijmuiden, Netherlands.<br>My hobbies include (but are not limited to) American football, Rock stacking and watching 2 Broke Girls.<br><br>My web-site [http://writerstogether.com/members/ruebecastlebe/activity/179010/ best supplement to lose weight]
+
=Process files=
 +
AnyWave can also process data files, running a specific process (plugin) to a bunch a files or directories.<br/>
 +
The keyword to do that kind of opteration is :<br/>
 +
'''--run <plugin name | json file | json string>'''<br/>
 +
To run a plugin, the user must set all the required parameters as well as input and output options.<br/>
 +
The other requirement is that the plugin CAN run in batch mode.<br/>
 +
See the dedicated section to see how to make your plugin compatible or simply browse the list of compatible built-in plugins.<br/>
 +
There is a list of common command line keywords that can be used anytime by every plug-ins:<br/>
 +
'''--input_file <file>''' set the file to process.<br/>
 +
'''--input_dir <dir>''' sets the input directory to use.<br/>
 +
'''--output_dir <dir>''' sets the output directory. The location where the plugin should generate its results.<br/>
 +
'''--output_file <file>''' sets the name of the processing output file.<br/>
 +
'''--output_prefix <string>''' sets the prefix of the output file.<br/>
 +
'''--hp <value>''' sets the high pass filter value to use.<br/>
 +
'''--lp <value>''' sets the low pass filter value to use.<br/>
 +
'''--notch <value>''' sets the notch filter value to use.<br/>
 +
<br/>
 +
==Setup parameters and run a processing plugin==
 +
Processing a file relies on a specific plugin which need to be setup using specific parameters.<br/>
 +
There are several ways to setup plugin parameters and run it:<br/>
 +
1. use a json file to describe all the parameters.<br/>
 +
2. use a json string to describe all the parameters.<br/>
 +
3. use a plugin which declares its parameters.<br/>
 +
<br/>
 +
'''Examples''':<br/>
 +
Suppose we want to run a processing using a plugin named ''ProcessPlugin''.<br/>
 +
This ''ProcessPlugin'' requires two parameters, a time window (s) and a threshold value.<br/>
 +
The expected parameters are :  time_window, threshold.<br/>
 +
If the plugin published its required arguments to AnyWave, you can do :<br/>
 +
<syntaxhighlight lang='bash'>
 +
anywave --run ProcessPlugin --input_file d:\data\my_file.eeg --time_window 4 --threshold 0.3
 +
</syntaxhighlight>
 +
Note the input_file common keyword that set the data file to be processed by the plugin.<br/>
 +
If the command fails, you'd probably need to use the json way:<br/>
 +
Create a parameters.json file as follow:<br/>
 +
<syntaxhighlight lang='java'>
 +
{
 +
"plugin" : "ProcessPlugin",
 +
"time_window" : 4,
 +
"threshold" : 0.3
 +
}
 +
</syntaxhighlight>
 +
and use the command line:<br/>
 +
<syntaxhighlight lang='bash'>
 +
anywave --run parameters.json --input_file d:\data\my_file.eeg
 +
</syntaxhighlight>
 +
This way AnyWave will read the parameters from the json file and setup the plugin accordingly.<br/>
 +
Note the you can also use the common keywords inside your json file:<br/>
 +
<syntaxhighlight lang='java'>
 +
{
 +
"plugin" : "ProcessPlugin",
 +
"input_file" : "d:\\data\\my_file.eeg",
 +
"time_window" : 4,
 +
"threshold" : 0.3
 +
}
 +
</syntaxhighlight>
 +
Although it does not make sense there to specify input_file, you can do it.
 +
You can also write down the json string on the command line after the --run keyword:<br/>
 +
<syntaxhighlight lang='bash'>
 +
anywave --run "{ """plugin""" : """ProcessPlugin""", """time_window""" : 4, """threshold""" : 0.3 }" --input_file d:\data\my_file.eeg
 +
</syntaxhighlight>

Revision as of 12:49, 14 April 2020

Process files

AnyWave can also process data files, running a specific process (plugin) to a bunch a files or directories.
The keyword to do that kind of opteration is :
--run <plugin name | json file | json string>
To run a plugin, the user must set all the required parameters as well as input and output options.
The other requirement is that the plugin CAN run in batch mode.
See the dedicated section to see how to make your plugin compatible or simply browse the list of compatible built-in plugins.
There is a list of common command line keywords that can be used anytime by every plug-ins:
--input_file <file> set the file to process.
--input_dir <dir> sets the input directory to use.
--output_dir <dir> sets the output directory. The location where the plugin should generate its results.
--output_file <file> sets the name of the processing output file.
--output_prefix <string> sets the prefix of the output file.
--hp <value> sets the high pass filter value to use.
--lp <value> sets the low pass filter value to use.
--notch <value> sets the notch filter value to use.

Setup parameters and run a processing plugin

Processing a file relies on a specific plugin which need to be setup using specific parameters.
There are several ways to setup plugin parameters and run it:
1. use a json file to describe all the parameters.
2. use a json string to describe all the parameters.
3. use a plugin which declares its parameters.

Examples:
Suppose we want to run a processing using a plugin named ProcessPlugin.
This ProcessPlugin requires two parameters, a time window (s) and a threshold value.
The expected parameters are : time_window, threshold.
If the plugin published its required arguments to AnyWave, you can do :

anywave --run ProcessPlugin --input_file d:\data\my_file.eeg --time_window 4 --threshold 0.3

Note the input_file common keyword that set the data file to be processed by the plugin.
If the command fails, you'd probably need to use the json way:
Create a parameters.json file as follow:

{ 
"plugin" : "ProcessPlugin",
"time_window" : 4,
"threshold" : 0.3
}

and use the command line:

anywave --run parameters.json --input_file d:\data\my_file.eeg

This way AnyWave will read the parameters from the json file and setup the plugin accordingly.
Note the you can also use the common keywords inside your json file:

{ 
"plugin" : "ProcessPlugin",
"input_file" : "d:\\data\\my_file.eeg",
"time_window" : 4,
"threshold" : 0.3
}

Although it does not make sense there to specify input_file, you can do it. You can also write down the json string on the command line after the --run keyword:

anywave --run "{ """plugin""" : """ProcessPlugin""", """time_window""" : 4, """threshold""" : 0.3 }" --input_file d:\data\my_file.eeg