|
|
**Tables of Contents**
|
|
|
|
|
|
[[_TOC_]]
|
|
|
|
|
|
# Creating HTB Files
|
|
|
From the previous step of our tutorial we have 4 steps in our pipeline, a filter, two Amica steps, and a labeling step.
|
|
|
|
|
|
HTB files are just regular Matlab files with template placeholders.
|
|
|
|
|
|
## Bandpass
|
|
|
|
|
|
This is a comment less version of our s01_bandpass.htb in the `scripts/` directory
|
|
|
|
|
|
```matlab
|
|
|
disp('Loading set file: [batch_dfn]...');
|
|
|
EEG = pop_loadset('filename', '[batch_dfn]', 'filepath', '[in_path]');
|
|
|
EEG = eeg_checkset(EEG);
|
|
|
EEG = pop_eegfiltnew(EEG, [low_bound_hz], [high_bound_hz]);
|
|
|
disp('Saving output: [batch_dfn,_,-1]_bandpass.set');
|
|
|
EEG = pop_saveset( EEG, 'filename','[batch_dfn,_,-1]_bandpass.set', ...
|
|
|
'filepath', '[out_path]');
|
|
|
|
|
|
disp('Writing Amica param file')
|
|
|
swapstr_1 = make_amica_param(1)
|
|
|
swapstr_2 = make_amica_param(2)
|
|
|
|
|
|
fidparam = fopen('[out_path]/[batch_dfn,_,-1]_1.param', 'w');
|
|
|
fprintf(fidparam, '%s', swapstr_1);
|
|
|
fclose(fidparam);
|
|
|
|
|
|
fidparam = fopen('[out_path]/[batch_dfn,_,-1]_2.param', 'w');
|
|
|
fprintf(fidparam, '%s', swapstr_2);
|
|
|
fclose(fidparam);
|
|
|
|
|
|
function swapstr = make_amica_param(n)
|
|
|
swapstr = file_strswap('config/amica-default.param', ...
|
|
|
'[repstr_fdt_fname]', '[out_path]/[batch_dfn,_,-1]_bandpass.set', ...
|
|
|
'[repstr_outpath]', ['[out_path]/[batch_dfn,_,-1]_amicaout_', num2str(n)], ...
|
|
|
'[repstr_nbchan]', num2str(EEG.nbchan), ...
|
|
|
'[repstr_pnts]', sprintf('%12.0f',EEG.pnts), ...
|
|
|
'[repstr_pca]', num2str(EEG.nbchan));
|
|
|
'filepath', '[out_path]');
|
|
|
end
|
|
|
```
|
|
|
|
|
|
This htb file has 4 user provided string swaps. [Writing scripts is document more here](script-files). You can additionally look [here for Advanced String Swapping Techniques](adv-str-swap)
|
|
|
|
|
|
We don't count the `repstr_*` string swaps because they are actually being used to replace string in the Amica param file we are writing.
|
|
|
|
|
|
The user provided string swaps are
|
|
|
* in_path - input directory
|
|
|
* low_bound_hz - high pass value
|
|
|
* high_bound_hz - low pass value
|
|
|
* out_path - output directory
|
|
|
|
|
|
The script opens the `batch_dfn` from `in_path` which represents the name of the input file, runs it through a band pass filter then saves it in `out_path`.
|
|
|
|
|
|
In the next step we will make the configuration for these jobs which will require setting these variables.
|
|
|
|
|
|
## Amica
|
|
|
|
|
|
Amica is a binary program that can be run from the command line. Batch_context is capable of incorporating these into our pipeline as well. You use the .htb file to form the command line that is submitted to the scheduler.
|
|
|
|
|
|
Normally Amica is run from the command line like so
|
|
|
|
|
|
`./amica15 amica-default.param`
|
|
|
|
|
|
We can make this into a pipeline htb file the following way.
|
|
|
|
|
|
Make the file `scripts/s02_amica.htb` contain this code
|
|
|
|
|
|
```bash
|
|
|
[dep_path]/[amica_ver] [in_path]/[batch_dfn,_,-1]_1.param
|
|
|
```
|
|
|
Similarly, make `scripts/s03_amica.htb` contain this
|
|
|
|
|
|
```bash
|
|
|
[dep_path]/[amica_ver] [in_path]/[batch_dfn,_,-1]_2.param
|
|
|
```
|
|
|
|
|
|
Then in our configuration file we provide the `dep_path`,`amica_ver`, `in_path` variables. We will do this in the next step.
|
|
|
|
|
|
For now we wont explain `S04_fin` as it will similar enough to `s01_bandpass` in nature.
|
|
|
|
|
|
*Updated/Verified by Brad Kennedy on 2017-08-09*
|
|
|
|
|
|
[ :arrow_up: Top of Page](home) |
|
|
\ No newline at end of file |