Batch processing

The approach to batch processing depends on the structure of the anybody model. A commonly used strategy is a single anyscript main file. The main file is then loaded with different define statements to set the trial name, subject id or other parameters. This strategy for batch processing is outlined on the anyscript.org wiki page.

Another strategy is to have a separate main file for each trial. These individual main-files hold all trial-specific data and include a base model that is common to all trials and subjects. The approach makes it much easier to work with mocap models that have many subject or hundreds of trials.

The following shows how to batch process models where each trials is its own main file.

Model with many main files

This (zip) illustrates the concept of a single model with many main files. The model is based on the Arm2D demo from the AnyBody tutorials. The main files are located in subfolders (model1-model9).

[1]:
!dir /d  "Tutorial files/BatchProcess"
 Volume in drive C has no label.
 Volume Serial Number is FA73-929B

 Directory of C:\Users\mel\Documents\AnyPyTools\Tutorial\Tutorial files\BatchProcess

[.]               [model1]          [model5]          [model9]
[..]              [model2]          [model6]          [Output]
batchprocess.py   [model3]          [model7]          RunExample.bat
Demo.Arm2D.any    [model4]          [model8]
               3 File(s)         10.904 bytes
              12 Dir(s)  113.444.696.064 bytes free
[2]:
!dir /s /b "main.any"
C:\Users\mel\Documents\AnyPyTools\Tutorial\Tutorial files\BatchProcess\model1\main.any
C:\Users\mel\Documents\AnyPyTools\Tutorial\Tutorial files\BatchProcess\model2\main.any
C:\Users\mel\Documents\AnyPyTools\Tutorial\Tutorial files\BatchProcess\model3\main.any
C:\Users\mel\Documents\AnyPyTools\Tutorial\Tutorial files\BatchProcess\model4\main.any
C:\Users\mel\Documents\AnyPyTools\Tutorial\Tutorial files\BatchProcess\model5\main.any
C:\Users\mel\Documents\AnyPyTools\Tutorial\Tutorial files\BatchProcess\model6\main.any
C:\Users\mel\Documents\AnyPyTools\Tutorial\Tutorial files\BatchProcess\model7\main.any
C:\Users\mel\Documents\AnyPyTools\Tutorial\Tutorial files\BatchProcess\model8\main.any
C:\Users\mel\Documents\AnyPyTools\Tutorial\Tutorial files\BatchProcess\model9\main.any

Each of main files main.any has it own set of parameters, and they all include the same common fiile Demo.Arm2D.any.

[1]:
from anypytools import AnyPyProcess

folderlist = ["Tutorial files/BatchProcess"]
app = AnyPyProcess(num_processes = 3)
macrolist = [
    'load "main.any"',
    'operation Main.Study.InverseDynamics',
    'run'
]

app.start_macro(macrolist, folderlist, search_subdirs= "model[1-9].*main.any" );
[ ]: