summaryrefslogtreecommitdiffstats
path: root/tests/roof/arguments.py
blob: 3c8caed0db40c78f7ec486b5e4df2c7c79426d9d (plain)
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
import argparse
from roof.defaults import roof_data_types

def roof_get_args():
    data_types = []
    for stage in roof_data_types:
        data_types += roof_data_types[stage].keys()
    data_types = set(data_types)

    parser = argparse.ArgumentParser()
    parser.add_argument('-c', '--config',   dest="config",          default="roof.json",                                                                help="ROOF configuration (JSON)")

    # Modes
    parser.add_argument('-s', '--simulate',     dest="simulate",        default=None,   action="store_true",                                            help="Simulation mode, read data from files instead of network")
    parser.add_argument('-b', '--benchmark',    dest="benchmark",       default=None,   action="store_true",                                            help="Bencmarking mode, writes to /dev/null")
    parser.add_argument('-g', '--gui',          dest='gui',             default=False,  action="store_true",                                            help="Visualize data")
    parser.add_argument('-t', '--track',        dest='track',           default=False,  action="store_true",                                            help="Track & control experiment")

    parser.add_argument(      '--no-roof',      dest="noroof",          default=False,  action="store_true",                                            help="Disable ROOF, only network testing (no sinogram building, store linearly)")

    # I/O
    #parser.add_argument('-i', '--input',       dest="input",           default=None,                                                                   help="Reconstruct from sinograms")
    parser.add_argument('-o', '--output',       dest="output",          default=None,                                                                   help="Output file(s)")
    parser.add_argument('-r', '--read',         dest="read",            default=None,   choices=data_types,     nargs='?', const="raw_sinograms",       help="Read recorded sinograms instead of listening on the network")
    parser.add_argument('-w', '--write',        dest="write",           default=None,   choices=data_types,     nargs='?', const="slices",              help="Only generate flat-fields, dark-fields, or sinograms (default)")
    parser.add_argument(      '--format',       dest="format",          default=None,                                                                   help="Override default storage format")

    # Limits & Filtering
    parser.add_argument('-n', '--number',       dest="number",          default=None,   type=int,                                                       help="Specify number of frames to capture (limits number of captured frames irrespective of further filtering)")
    parser.add_argument('-p', '--plane',        dest="plane",           default=None,   type=int,                                                       help="Only process the specified detector plane (indexed from 1)")

    return parser.parse_args()