forked from stanfordnmbl/opencap-fshd-dm-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
44 lines (33 loc) · 1.11 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import argparse
import nimblephysics_libs.biomechanics
from cli.visualize import VisualizeCommand
from cli.train import TrainCommand
import nimblephysics as nimble
import logging
def main():
commands = [VisualizeCommand(), TrainCommand()]
# Create an ArgumentParser object
parser = argparse.ArgumentParser(
description='MarkerTranslator Command Line Interface')
# Split up by command
subparsers = parser.add_subparsers(dest="command")
# Add a parser for each command
for command in commands:
command.register_subcommand(subparsers)
# Parse the arguments
args = parser.parse_args()
for command in commands:
if command.run(args):
return
if __name__ == '__main__':
logpath = "log"
# Create and configure logger
logging.basicConfig(filename=logpath,
format='%(asctime)s %(message)s',
filemode='a')
# Creating an object
logger = logging.getLogger()
logger.addHandler(logging.StreamHandler())
# Setting the threshold of logger to INFO
logger.setLevel(logging.INFO)
main()