Mercurial > repos > rv43 > tomo
comparison tomo_reduce.py @ 74:4f4ee8db5f67 draft
planemo upload for repository https://github.com/rolfverberg/galaxytools commit f8c4bdb31c20c468045ad5e6eb255a293244bc6c-dirty
author | rv43 |
---|---|
date | Tue, 21 Mar 2023 17:40:03 +0000 |
parents | adb84c450789 |
children | d5e1d4ea2b7e |
comparison
equal
deleted
inserted
replaced
73:adb84c450789 | 74:4f4ee8db5f67 |
---|---|
13 #@profile | 13 #@profile |
14 def __main__(): | 14 def __main__(): |
15 # Parse command line arguments | 15 # Parse command line arguments |
16 parser = argparse.ArgumentParser( | 16 parser = argparse.ArgumentParser( |
17 description='Reduce tomography data') | 17 description='Reduce tomography data') |
18 # parser.add_argument('-i', '--input_file', | 18 parser.add_argument('-i', '--input_file', |
19 # required=True, | 19 required=True, |
20 # type=pathlib.Path, | 20 type=pathlib.Path, |
21 # help='''Full or relative path to the input file (in yaml or nxs format).''') | 21 help='''Full or relative path to the input file (in yaml or nxs format).''') |
22 # parser.add_argument('-o', '--output_file', | 22 parser.add_argument('-o', '--output_file', |
23 # required=True, | 23 required=True, |
24 # type=pathlib.Path, | 24 type=pathlib.Path, |
25 # help='''Full or relative path to the output file (in Nexus format).''') | 25 help='''Full or relative path to the output file (in Nexus format).''') |
26 # parser.add_argument('--galaxy_flag', | 26 parser.add_argument('--galaxy_flag', |
27 # action='store_true', | 27 action='store_true', |
28 # help='''Use this flag to run the scripts as a galaxy tool.''') | 28 help='''Use this flag to run the scripts as a galaxy tool.''') |
29 # parser.add_argument('--img_x_bounds', | 29 parser.add_argument('--img_x_bounds', |
30 # required=False, | 30 required=False, |
31 # nargs=2, | 31 nargs=2, |
32 # type=int, | 32 type=int, |
33 # help='Vertical data reduction image range') | 33 help='Vertical data reduction image range') |
34 parser.add_argument('-l', '--log', | 34 parser.add_argument('-l', '--log', |
35 # type=argparse.FileType('w'), | 35 # type=argparse.FileType('w'), |
36 default=sys.stdout, | 36 default=sys.stdout, |
37 help='Logging stream or filename') | 37 help='Logging stream or filename') |
38 # parser.add_argument('--log_level', | 38 parser.add_argument('--log_level', |
39 # choices=logging._nameToLevel.keys(), | 39 choices=logging._nameToLevel.keys(), |
40 # default='INFO', | 40 default='INFO', |
41 # help='''Specify a preferred logging level.''') | 41 help='''Specify a preferred logging level.''') |
42 args = parser.parse_args() | 42 args = parser.parse_args() |
43 | 43 |
44 # Set log configuration | 44 # Set log configuration |
45 # When logging to file, the stdout log level defaults to WARNING | 45 # When logging to file, the stdout log level defaults to WARNING |
46 logging_format = '%(asctime)s : %(levelname)s - %(module)s : %(funcName)s - %(message)s' | 46 logging_format = '%(asctime)s : %(levelname)s - %(module)s : %(funcName)s - %(message)s' |
64 | 64 |
65 # Start memory monitoring | 65 # Start memory monitoring |
66 # tracemalloc.start() | 66 # tracemalloc.start() |
67 | 67 |
68 # Log command line arguments | 68 # Log command line arguments |
69 # logging.info(f'input_file = {args.input_file}') | 69 logging.info(f'input_file = {args.input_file}') |
70 # logging.info(f'output_file = {args.output_file}') | 70 logging.info(f'output_file = {args.output_file}') |
71 # logging.info(f'galaxy_flag = {args.galaxy_flag}') | 71 logging.info(f'galaxy_flag = {args.galaxy_flag}') |
72 # logging.info(f'img_x_bounds = {args.img_x_bounds}') | 72 logging.info(f'img_x_bounds = {args.img_x_bounds}') |
73 # logging.debug(f'log = {args.log}') | 73 logging.debug(f'log = {args.log}') |
74 # logging.debug(f'is log stdout? {args.log is sys.stdout}') | 74 logging.debug(f'is log stdout? {args.log is sys.stdout}') |
75 # logging.debug(f'log_level = {args.log_level}') | 75 logging.debug(f'log_level = {args.log_level}') |
76 logging.info(f'log = {args.log}') | |
77 logging.info(f'is log stdout? {args.log is sys.stdout}') | |
78 print('Done') | |
79 | 76 |
80 # Instantiate Tomo object | 77 # Instantiate Tomo object |
81 # tomo = Tomo(galaxy_flag=args.galaxy_flag) | 78 tomo = Tomo(galaxy_flag=args.galaxy_flag) |
82 | 79 |
83 # Read input file | 80 # Read input file |
84 # data = tomo.read(args.input_file) | 81 data = tomo.read(args.input_file) |
85 | 82 |
86 # Generate reduced tomography images | 83 # Generate reduced tomography images |
87 # data = tomo.gen_reduced_data(data, img_x_bounds=args.img_x_bounds) | 84 data = tomo.gen_reduced_data(data, img_x_bounds=args.img_x_bounds) |
88 | 85 |
89 # Write output file | 86 # Write output file |
90 # data = tomo.write(data, args.output_file) | 87 data = tomo.write(data, args.output_file) |
91 | 88 |
92 # Displaying memory usage | 89 # Displaying memory usage |
93 # logging.info(f'Memory usage: {tracemalloc.get_traced_memory()}') | 90 # logging.info(f'Memory usage: {tracemalloc.get_traced_memory()}') |
94 | 91 |
95 # Stop memory monitoring | 92 # Stop memory monitoring |