Convert

Script to automatically convert several files (created on October 19th 2022 by M. Reichmann (remichae@phys.ethz.ch))

source

AutoConvert

 AutoConvert (first_run=None, last_run=None, batch=None, beamtest=None,
              verbose=False, force=False)

Initialize self. See help(type(self)) for accurate signature.


source

BatchConvert

 BatchConvert (batch=None, beamtest=None, verbose=False, force=False)

Initialize self. See help(type(self)) for accurate signature.

@call_parse
def main(m:Param('turn parallel processing ON', action='store_true'),
         v:Param('turn verbose OFF', action='store_false'),
         t:Param('turn test mode ON', action='store_true'),
         f:Param('force conversion', action='store_true'),
         tc:str=None, # Test Campaign in YYYYMM format
         s:int=None, # run number where to start, default [None], = stop if no end is provided
         e:int=None, # run number where to stop, default [None]
         b:str=None, # batch number, default [None]
        ):

#     from argparse import ArgumentParser

#     parser = ArgumentParser()
#     parser.add_argument('-m', action='store_true', help='turn parallel processing ON')
#     parser.add_argument('-tc', nargs='?', default=None)
#     parser.add_argument('s', nargs='?', default=None, help='run number where to start, default [None], = stop if no end is provided', type=int)
#     parser.add_argument('e', nargs='?', default=None, help='run number where to stop, default [None]', type=int)
#     parser.add_argument('-b', nargs='?', default=None, help='batch number, default [None]')
#     parser.add_argument('-v', action='store_false', help='turn verbose OFF')
#     parser.add_argument('-t', action='store_true', help='turn test mode ON')
#     parser.add_argument('-f', action='store_true', help='force conversion')

#     args = parser.parse_args()

    z = AutoConvert(s, e, b, tc, v, f) if s is not None else BatchConvert(b, tc, v, f)
    a = z.Converter
    cs = z.Converters if hasattr(z, 'Converters') else None

    if not t:
        cs = z.converters
        if len(cs):
            print_banner(f'Start converting runs {cs[0].Run} - {cs[-1].Run}', color=GREEN)
            z.run()
            print_banner('Finished Conversion!', color=GREEN)
        else:
            info('There is nothing to convert :-)\n', blank_lines=1)