Skip to content
Snippets Groups Projects
Commit 2f1a53ff authored by Corné Lukken's avatar Corné Lukken
Browse files

L2SS-459: Add required=True to argsparse arguments in statistics_writer

Closes-bug: L2SS-459
parent 1d080312
No related branches found
No related tags found
1 merge request!146L2SS-287: implement python packaging
......@@ -5,16 +5,9 @@ import argparse
import os
import psutil
import pytz
import time
process = psutil.Process(os.getpid())
parser = argparse.ArgumentParser(description='Select a file to explore')
parser.add_argument('--files', type=str, nargs="+", help='the name and path of the files, takes one or more files')
parser.add_argument('--start_time', type=str, help='lowest timestamp to process (uses isoformat, ex: 2021-10-04T07:50:08.937+00:00)')
parser.add_argument('--end_time', type=str, help='highest timestamp to process (uses isoformat, ex: 2021-10-04T07:50:08.937+00:00)')
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("hdf5_explorer")
......@@ -219,7 +212,20 @@ class statistics_data:
self.values = numpy.array(file.get(f"{group_key}/values"))
if __name__ == "__main__":
def main():
parser = argparse.ArgumentParser(description='Select a file to explore')
parser.add_argument(
'--files', type=str, nargs="+", required=True,
help='the name and path of the files, takes one or more files')
parser.add_argument(
'--start_time', type=str, required=True,
help='lowest timestamp to process (uses isoformat, ex: 2021-10-04T07:50'
':08.937+00:00)')
parser.add_argument(
'--end_time', type=str, required=True,
help='highest timestamp to process (usesisoformat, ex: 2021-10-04T07:50'
':08.937+00:00)')
args = parser.parse_args()
files = args.files
end_time = args.end_time
......
import argparse
from receiver import tcp_receiver, file_receiver
from hdf5_writer import hdf5_writer
import sys
import signal
from tangostationcontrol.statistics_writer.receiver import tcp_receiver, file_receiver
from tangostationcontrol.statistics_writer.hdf5_writer import hdf5_writer
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("statistics_writer")
parser = argparse.ArgumentParser(description='Converts a stream of statistics packets into HDF5 files.')
parser.add_argument('-a', '--host', type=str, help='the host to connect to')
parser.add_argument('-p', '--port', type=int, default=0, help='the port to connect to, or 0 to use default port for the selected mode (default: %(default)s)')
parser.add_argument('-f', '--file', type=str, help='the file to read from')
parser.add_argument('-m', '--mode', type=str, choices=['SST', 'XST', 'BST'], default='SST', help='sets the statistics type to be decoded options (default: %(default)s)')
parser.add_argument('-i', '--interval', type=float, default=3600, nargs="?", help='The time between creating new files in seconds (default: %(default)s)')
parser.add_argument('-o', '--output_dir', type=str, default=".", nargs="?", help='specifies the folder to write all the files (default: %(default)s)')
parser.add_argument('-v', '--debug', dest='debug', action='store_true', default=False, help='increase log output')
parser.add_argument('-d', '--decimation', type=int, default=1, help='Configure the writer to only store one every n samples. Saves storage space')
def main():
parser = argparse.ArgumentParser(
description='Converts a stream of statistics packets into HDF5 files.')
parser.add_argument(
'-a', '--host', type=str, required=True, help='the host to connect to')
parser.add_argument(
'-p', '--port', type=int, default=0,
help='the port to connect to, or 0 to use default port for the '
'selected mode (default: %(default)s)')
parser.add_argument(
'-f', '--file', type=str, required=True, help='the file to read from')
parser.add_argument(
'-m', '--mode', type=str, choices=['SST', 'XST', 'BST'], default='SST',
help='sets the statistics type to be decoded options (default: '
'%(default)s)')
parser.add_argument(
'-i', '--interval', type=float, default=3600, nargs="?",
help='The time between creating new files in seconds (default: '
'%(default)s)')
parser.add_argument(
'-o', '--output_dir', type=str, default=".", nargs="?",
help='specifies the folder to write all the files (default: '
'%(default)s)')
parser.add_argument(
'-v', '--debug', dest='debug', action='store_true', default=False,
help='increase log output')
parser.add_argument(
'-d', '--decimation', type=int, default=1,
help='Configure the writer to only store one every n samples. Saves '
'storage space')
if __name__ == "__main__":
args = parser.parse_args()
# argparse arguments
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment