"""
Reads and plots active (i.e. non-zero) signals from SIEMENS advanced physiological log / DICOM files

This function expects to find either a combination of individual logfiles (*_ECG.log, *_RESP.log,
*_PULS.log, *_EXT.log, *_Info.log) generated by >=R013 sequences, or a single encoded "_PHYSIO" DICOM
file generated by >=R015 sequences.
"""

import argparse


def get_parser():
    """Build an argument parser with input arguments for plotphysio.py"""

    parser = argparse.ArgumentParser(prog='plotphysio',
                                     formatter_class=argparse.RawDescriptionHelpFormatter,
                                     description=__doc__,
                                     epilog='examples:\n'
                                            '  plotphysio myproject/sub-001/MR000000.dcm\n'
                                            '  plotphysio -s 2000 myproject/sub-001/Physio_20200428_142451_007e910e-02d9-4d7a-8fdb-8e3568be8322\n\n'
                                            '@author: Marcel Zwiers\n ')
    parser.add_argument('filename',           help="Either the fullpath of the DICOM file or the basename of the PHYSIO logfiles (fullpath without suffix and file extension, e.g. 'foo/bar/Physio_DATE_TIME_UUID'")
    parser.add_argument('-s','--showsamples', help='The nr of plotted samples of the physiological traces (default: 1000, nothing is plotted if 0)', default=1000, type=int)

    return parser
