diff --git a/ast_monitor/basic_data.py b/ast_monitor/basic_data.py index 29c8867..7cd17a7 100644 --- a/ast_monitor/basic_data.py +++ b/ast_monitor/basic_data.py @@ -8,7 +8,7 @@ class BasicData: Class for storing and tracking the basic training data in real time.\n Args: hr_data_path (str): - path to the file that contains HR data + path to the file that contains heart rate data gps_data_path (str): path to the file that contains GPS data """ @@ -17,7 +17,7 @@ def __init__(self, hr_data_path: str, gps_data_path: str) -> None: Initialization method for BasicData class.\n Args: hr_data_path (str): - path to the file that contains HR data + path to the file that contains heart rate data gps_data_path (str): path to the file that contains GPS data """ @@ -36,7 +36,7 @@ def __init__(self, hr_data_path: str, gps_data_path: str) -> None: def read_current_hr(self) -> None: """ - Reading the current HR from the file. + Reading the current heart rate from the file. """ if not os.path.exists(self.hr_data_path): self.current_heart_rate = None diff --git a/ast_monitor/digital_twin.py b/ast_monitor/digital_twin.py index e6f548e..e0a68ab 100644 --- a/ast_monitor/digital_twin.py +++ b/ast_monitor/digital_twin.py @@ -76,7 +76,7 @@ def calculate_prediction( expected_trackpoints (int): the number of expected trackpoints Returns: - float: the proposed heart rate + float: the predicted heart rate """ if trimp_delta < 0: self.minus += trimp_delta diff --git a/ast_monitor/gps_sensor.py b/ast_monitor/gps_sensor.py index 27f846d..bc16a6f 100644 --- a/ast_monitor/gps_sensor.py +++ b/ast_monitor/gps_sensor.py @@ -20,7 +20,7 @@ def __init__(self, gps_path: str = 'sensor_data/gps.txt') -> None: Initialisation method for GpsSensor class.\n Args: gps_path (str): - path to file for storing gps data + path to file for storing GPS data """ self.gps_path = gps_path @@ -50,8 +50,9 @@ def write_gps_data_to_file( def get_gps_data(self) -> None: """ Method for listening the channel for obtaining GPS data from sensor.\n - Note: Example is based on source code from - https://github.com/adafruit/Adafruit_CircuitPython_GPS + Note: + Example is based on source code from + https://github.com/adafruit/Adafruit_CircuitPython_GPS """ uart = serial.Serial('/dev/serial0', baudrate=9600, timeout=10) gps = adafruit_gps.GPS(uart, debug=False) diff --git a/ast_monitor/hr_sensor.py b/ast_monitor/hr_sensor.py index 1bf2e60..939fb07 100644 --- a/ast_monitor/hr_sensor.py +++ b/ast_monitor/hr_sensor.py @@ -8,23 +8,23 @@ class HrSensor(): """ - Class for working with HR sensor.\n + Class for working with heart rate sensor.\n Args: hr_path (str): - path to file for storing HR data + path to file for storing heart rate data """ def __init__(self, hr_path='sensor_data/hr.txt') -> None: """ Initialisation method for HrSensor class.\n Args: hr_path (str): - path to file for storing HR data + path to file for storing heart rate data """ self.hr_path = hr_path def write_hr_data_to_file(self, hr: int) -> None: """ - Method for writing hr data to text file.\n + Method for writing heart rate data to text file.\n Args: hr (int): heart rate @@ -36,7 +36,7 @@ def on_data(self, data) -> None: """ Extracting and writing heart rate data to file.\n Args: - data (): + data (list): list that contains heart rate """ heartrate = data[7] @@ -46,8 +46,9 @@ def on_data(self, data) -> None: def get_hr_data(self) -> None: """ Method for listening the channel for obtaining HR data from sensor.\n - Note: Example is based on source code from - https://github.com/Tigge/openant/blob/master/examples/heart_rate_monitor.py + Note: + Example is based on source code from + https://github.com/Tigge/openant/blob/master/examples/heart_rate_monitor.py """ NETWORK_KEY = [0xB9, 0xA5, 0x21, 0xFB, 0xBD, 0x72, 0xC3, 0x45] diff --git a/ast_monitor/html_request_handler.py b/ast_monitor/html_request_handler.py index 9417a60..2d57865 100644 --- a/ast_monitor/html_request_handler.py +++ b/ast_monitor/html_request_handler.py @@ -12,9 +12,8 @@ def translate_path(self, path): Method that allows the server to serve the html files from the dist folder instead of the root folder. Args: path: url path - Returns: - + translated_path (str): translated url path """ parsed_path = urlparse(path).path current_file_directory = os.path.dirname(os.path.abspath(__file__)) diff --git a/ast_monitor/interval_training.py b/ast_monitor/interval_training.py index 3007acf..d66df63 100644 --- a/ast_monitor/interval_training.py +++ b/ast_monitor/interval_training.py @@ -10,13 +10,10 @@ class IntervalTraining: Initialization method of the IntervalTraining class.\n Args: - training: dict + training (dict): an interval training - tick_time: int + tick_time (int): tick time in milliseconds - - Returns: - None """ def __init__(self, training: dict, basic_data) -> None: @@ -24,13 +21,10 @@ def __init__(self, training: dict, basic_data) -> None: Initialization method of the IntervalTraining class.\n Args: - training: dict + training (dict): an interval training - tick_time: int + tick_time (int): tick time in milliseconds - - Returns: - None """ self.file = training['file'] self.name = training['interval'][0]['name'] @@ -57,7 +51,7 @@ def __eq__(self, __o: object) -> bool: Method for comparing two IntervalTraining objects.\n Args: - __o: IntervalTraining + __o (IntervalTraining): an interval training to be compared to Returns: @@ -80,11 +74,8 @@ def start(self, write_log: bool = False) -> None: Starting an interval training.\n Args: - write_log: bool - writing log if True - - Returns: - None + write_log (bool): + if True, write log """ # Writing the header of the training. if write_log: @@ -104,13 +95,10 @@ def start_speed_phase(self, interval: int, write_log: bool) -> None: Starting a speed phase of an interval.\n Args: - interval: int + interval (int): index of the interval - write_log: bool - writing log if True - - Returns: - None + write_log (bool): + if True, write log """ self.current_interval = interval, 'speed' self.speed_notification = True @@ -149,10 +137,7 @@ def start_recovery_phase(self, interval: int, write_log: bool) -> None: interval: int index of the interval write_log: bool - writing log if True - - Returns: - None + if True, write log """ self.current_interval = interval, 'recovery' self.recovery_notification = True diff --git a/ast_monitor/model.py b/ast_monitor/model.py index fd65ad5..a1311aa 100644 --- a/ast_monitor/model.py +++ b/ast_monitor/model.py @@ -36,7 +36,7 @@ class AST(QMainWindow, Ui_MainWindow): Main class for the manipulation with the GUI of the application.\n Args: hr_data_path (str): - path to the file that contains HR data + path to the file that contains heart rate data gps_data_path (str): path to the file that contains GPS data """ @@ -46,7 +46,7 @@ def __init__(self, hr_data_path: str, gps_data_path: str, route_data_path=None) Initialization method for AST class.\n Args: hr_data_path (str): - path to the file that contains HR data + path to the file that contains heart rate data gps_data_path (str): path to the file that contains GPS data route_dict (dict): @@ -128,11 +128,11 @@ def update_map_component(self, progress: float = None, remaining_distance: float """ Updating method for the (Vue.js rendered) map component with the new data. Args: - progress: - remaining_distance: - remaining_ascent: - speed: - heartrate: + progress (float): + remaining_distance (float): + remaining_ascent (float): + speed (float): + heartrate (int): duration: distance: lat_lng: @@ -180,7 +180,7 @@ def start_training_session(self, show_feedback: bool = True) -> None: Start of the training session.\n Args: show_feedback (bool): - showing notification for session start if True + if True, show notification for starting a training session """ self.session = TrainingSession() self.widget_start_stop.setCurrentIndex(1) @@ -200,7 +200,7 @@ def end_training_session(self, show_feedback: bool = True) -> None: End of the training session.\n Args: show_feedback (bool): - showing notification for session end if True + if True, show notification for ending a training session """ del self.session self.widget_start_stop.setCurrentIndex(0) @@ -245,6 +245,9 @@ def menu_right(self) -> None: def load_training(self, show_feedback: bool = True) -> None: """ Loading an interval training from a JSON file. + Args: + show_feedback (bool): + if True, show notification for successful training """ # Getting all available trainings. trainings = glob.glob(os.path.join(os.path.dirname( @@ -502,8 +505,6 @@ def __init__(self): def run(self): """ Method that runs the HTTP server. - Returns: - None """ PORT = 8000 Handler = CustomHandler @@ -513,9 +514,5 @@ def run(self): httpd.handle_request() def stop(self): - """ - Method that stops the HTTP server. - Returns: - - """ + """Method that stops the HTTP server.""" self.running = False diff --git a/ast_monitor/route_reader.py b/ast_monitor/route_reader.py index 72ae6fc..90d41d3 100644 --- a/ast_monitor/route_reader.py +++ b/ast_monitor/route_reader.py @@ -28,7 +28,7 @@ def merge_dicts(self, dict_list): """ Helper method that merges dictionaries. Args: - dict_list: + dict_list: list of dictionaries to be merged. Returns: merged_dict: merged dictionary diff --git a/ast_monitor/simulation.py b/ast_monitor/simulation.py index 3524696..0fc243e 100644 --- a/ast_monitor/simulation.py +++ b/ast_monitor/simulation.py @@ -65,9 +65,7 @@ def write_gps_to_file(self, lon: float, lat: float, alt: float) -> None: print('Lon: ' + str(lon) + ' Lat: ' + str(lat)) def simulate_hr(self) -> None: - """ - Randomly generate heart rate between 150 and 160 beats per minute. - """ + """Randomly generate heart rate between 150 and 160 beats per minute.""" while True: for i in range(25): time.sleep(1) @@ -90,14 +88,10 @@ def simulate_hr(self) -> None: self.write_hr_to_file(new_rand) def simulate_gps(self) -> None: - """ - GPS simulation. - """ - tcx_reader = TCXReader() - file_location = os.path.join(os.path.dirname(os.path.abspath( - __file__)), '..', 'development', 'datasets', '15.tcx') - """ - TCX file test2.tcx was taken from the following dataset: + f""" + GPS simulation.\n + Note: + TCX file 15.tcx was taken from the following dataset: S. Rauter, I. Jr. Fister, I. Fister. A collection of sport activity files @@ -106,6 +100,9 @@ def simulate_gps(self) -> None: Technical report 0201, University of Ljubljana and University of Maribor, 2015. """ + tcx_reader = TCXReader() + file_location = os.path.join(os.path.dirname(os.path.abspath( + __file__)), '..', 'development', 'datasets', '15.tcx') data = tcx_reader.read(file_location) for i in range(len(data.trackpoints)):