gaitsetpy.dataset.arduous

Arduous Dataset Loader. Maintainer: @aharshit123456

This file contains the Arduous dataset loader class that inherits from BaseDatasetLoader.

  1'''
  2Arduous Dataset Loader.
  3Maintainer: @aharshit123456
  4
  5This file contains the Arduous dataset loader class that inherits from BaseDatasetLoader.
  6'''
  7
  8import os
  9import pandas as pd
 10import numpy as np
 11from typing import List, Dict, Tuple
 12from ..core.base_classes import BaseDatasetLoader
 13from .utils import download_dataset, extract_dataset, sliding_window
 14
 15
 16class ArduousLoader(BaseDatasetLoader):
 17    """
 18    Arduous dataset loader class.
 19    
 20    This class handles loading and processing of the Arduous dataset for gait analysis.
 21    """
 22    
 23    def __init__(self):
 24        super().__init__(
 25            name="arduous",
 26            description="Arduous Dataset - Contains multi-sensor wearable data for daily activity recognition"
 27        )
 28        self.metadata = {
 29            'sensors': ['accelerometer', 'gyroscope', 'magnetometer'],
 30            'components': ['x', 'y', 'z'],
 31            'sampling_frequency': 50,  # Typical for Arduous
 32            'activities': ['walking', 'running', 'sitting', 'standing', 'lying']
 33        }
 34    
 35    def load_data(self, data_dir: str, **kwargs) -> Tuple[List[pd.DataFrame], List[str]]:
 36        """
 37        Load Arduous dataset from the specified directory.
 38        
 39        Args:
 40            data_dir: Directory to store/find the dataset
 41            **kwargs: Additional arguments (unused for Arduous)
 42            
 43        Returns:
 44            Tuple of (data_list, names_list)
 45        """
 46        # TODO: Implement Arduous data loading
 47        # This is a placeholder implementation
 48        print("Arduous data loading is not yet implemented")
 49        return [], []
 50    
 51    def create_sliding_windows(self, data: List[pd.DataFrame], names: List[str], 
 52                             window_size: int = 192, step_size: int = 32) -> List[Dict]:
 53        """
 54        Create sliding windows from the Arduous dataset.
 55        
 56        Args:
 57            data: List of DataFrames containing Arduous data
 58            names: List of names corresponding to the data
 59            window_size: Size of the sliding window (default: 192)
 60            step_size: Step size for the sliding window (default: 32)
 61            
 62        Returns:
 63            List of dictionaries containing sliding windows for each DataFrame
 64        """
 65        # TODO: Implement Arduous sliding window creation
 66        # This is a placeholder implementation
 67        print("Arduous sliding window creation is not yet implemented")
 68        return []
 69    
 70    def get_supported_formats(self) -> List[str]:
 71        """
 72        Get list of supported file formats for Arduous dataset.
 73        
 74        Returns:
 75            List of supported file extensions
 76        """
 77        return ['.csv', '.txt']
 78    
 79    def get_sensor_info(self) -> Dict[str, List[str]]:
 80        """
 81        Get information about sensors in the dataset.
 82        
 83        Returns:
 84            Dictionary containing sensor information
 85        """
 86        return {
 87            'sensors': self.metadata['sensors'],
 88            'components': self.metadata['components'],
 89            'sampling_frequency': self.metadata['sampling_frequency']
 90        }
 91    
 92    def get_activity_info(self) -> List[str]:
 93        """
 94        Get information about activities in the dataset.
 95        
 96        Returns:
 97            List of activity types
 98        """
 99        return self.metadata['activities']
100
101
102# Legacy function wrapper for backward compatibility
103def load_arduous_data():
104    """
105    Legacy function for loading Arduous data.
106    
107    Returns:
108        Tuple of (data_list, names_list)
109    """
110    loader = ArduousLoader()
111    return loader.load_data("")
class ArduousLoader(gaitsetpy.core.base_classes.BaseDatasetLoader):
 17class ArduousLoader(BaseDatasetLoader):
 18    """
 19    Arduous dataset loader class.
 20    
 21    This class handles loading and processing of the Arduous dataset for gait analysis.
 22    """
 23    
 24    def __init__(self):
 25        super().__init__(
 26            name="arduous",
 27            description="Arduous Dataset - Contains multi-sensor wearable data for daily activity recognition"
 28        )
 29        self.metadata = {
 30            'sensors': ['accelerometer', 'gyroscope', 'magnetometer'],
 31            'components': ['x', 'y', 'z'],
 32            'sampling_frequency': 50,  # Typical for Arduous
 33            'activities': ['walking', 'running', 'sitting', 'standing', 'lying']
 34        }
 35    
 36    def load_data(self, data_dir: str, **kwargs) -> Tuple[List[pd.DataFrame], List[str]]:
 37        """
 38        Load Arduous dataset from the specified directory.
 39        
 40        Args:
 41            data_dir: Directory to store/find the dataset
 42            **kwargs: Additional arguments (unused for Arduous)
 43            
 44        Returns:
 45            Tuple of (data_list, names_list)
 46        """
 47        # TODO: Implement Arduous data loading
 48        # This is a placeholder implementation
 49        print("Arduous data loading is not yet implemented")
 50        return [], []
 51    
 52    def create_sliding_windows(self, data: List[pd.DataFrame], names: List[str], 
 53                             window_size: int = 192, step_size: int = 32) -> List[Dict]:
 54        """
 55        Create sliding windows from the Arduous dataset.
 56        
 57        Args:
 58            data: List of DataFrames containing Arduous data
 59            names: List of names corresponding to the data
 60            window_size: Size of the sliding window (default: 192)
 61            step_size: Step size for the sliding window (default: 32)
 62            
 63        Returns:
 64            List of dictionaries containing sliding windows for each DataFrame
 65        """
 66        # TODO: Implement Arduous sliding window creation
 67        # This is a placeholder implementation
 68        print("Arduous sliding window creation is not yet implemented")
 69        return []
 70    
 71    def get_supported_formats(self) -> List[str]:
 72        """
 73        Get list of supported file formats for Arduous dataset.
 74        
 75        Returns:
 76            List of supported file extensions
 77        """
 78        return ['.csv', '.txt']
 79    
 80    def get_sensor_info(self) -> Dict[str, List[str]]:
 81        """
 82        Get information about sensors in the dataset.
 83        
 84        Returns:
 85            Dictionary containing sensor information
 86        """
 87        return {
 88            'sensors': self.metadata['sensors'],
 89            'components': self.metadata['components'],
 90            'sampling_frequency': self.metadata['sampling_frequency']
 91        }
 92    
 93    def get_activity_info(self) -> List[str]:
 94        """
 95        Get information about activities in the dataset.
 96        
 97        Returns:
 98            List of activity types
 99        """
100        return self.metadata['activities']

Arduous dataset loader class.

This class handles loading and processing of the Arduous dataset for gait analysis.

ArduousLoader()
24    def __init__(self):
25        super().__init__(
26            name="arduous",
27            description="Arduous Dataset - Contains multi-sensor wearable data for daily activity recognition"
28        )
29        self.metadata = {
30            'sensors': ['accelerometer', 'gyroscope', 'magnetometer'],
31            'components': ['x', 'y', 'z'],
32            'sampling_frequency': 50,  # Typical for Arduous
33            'activities': ['walking', 'running', 'sitting', 'standing', 'lying']
34        }

Initialize the dataset loader.

Args: name: Name of the dataset description: Description of the dataset

metadata
def load_data( self, data_dir: str, **kwargs) -> Tuple[List[pandas.core.frame.DataFrame], List[str]]:
36    def load_data(self, data_dir: str, **kwargs) -> Tuple[List[pd.DataFrame], List[str]]:
37        """
38        Load Arduous dataset from the specified directory.
39        
40        Args:
41            data_dir: Directory to store/find the dataset
42            **kwargs: Additional arguments (unused for Arduous)
43            
44        Returns:
45            Tuple of (data_list, names_list)
46        """
47        # TODO: Implement Arduous data loading
48        # This is a placeholder implementation
49        print("Arduous data loading is not yet implemented")
50        return [], []

Load Arduous dataset from the specified directory.

Args: data_dir: Directory to store/find the dataset **kwargs: Additional arguments (unused for Arduous)

Returns: Tuple of (data_list, names_list)

def create_sliding_windows( self, data: List[pandas.core.frame.DataFrame], names: List[str], window_size: int = 192, step_size: int = 32) -> List[Dict]:
52    def create_sliding_windows(self, data: List[pd.DataFrame], names: List[str], 
53                             window_size: int = 192, step_size: int = 32) -> List[Dict]:
54        """
55        Create sliding windows from the Arduous dataset.
56        
57        Args:
58            data: List of DataFrames containing Arduous data
59            names: List of names corresponding to the data
60            window_size: Size of the sliding window (default: 192)
61            step_size: Step size for the sliding window (default: 32)
62            
63        Returns:
64            List of dictionaries containing sliding windows for each DataFrame
65        """
66        # TODO: Implement Arduous sliding window creation
67        # This is a placeholder implementation
68        print("Arduous sliding window creation is not yet implemented")
69        return []

Create sliding windows from the Arduous dataset.

Args: data: List of DataFrames containing Arduous data names: List of names corresponding to the data window_size: Size of the sliding window (default: 192) step_size: Step size for the sliding window (default: 32)

Returns: List of dictionaries containing sliding windows for each DataFrame

def get_supported_formats(self) -> List[str]:
71    def get_supported_formats(self) -> List[str]:
72        """
73        Get list of supported file formats for Arduous dataset.
74        
75        Returns:
76            List of supported file extensions
77        """
78        return ['.csv', '.txt']

Get list of supported file formats for Arduous dataset.

Returns: List of supported file extensions

def get_sensor_info(self) -> Dict[str, List[str]]:
80    def get_sensor_info(self) -> Dict[str, List[str]]:
81        """
82        Get information about sensors in the dataset.
83        
84        Returns:
85            Dictionary containing sensor information
86        """
87        return {
88            'sensors': self.metadata['sensors'],
89            'components': self.metadata['components'],
90            'sampling_frequency': self.metadata['sampling_frequency']
91        }

Get information about sensors in the dataset.

Returns: Dictionary containing sensor information

def get_activity_info(self) -> List[str]:
 93    def get_activity_info(self) -> List[str]:
 94        """
 95        Get information about activities in the dataset.
 96        
 97        Returns:
 98            List of activity types
 99        """
100        return self.metadata['activities']

Get information about activities in the dataset.

Returns: List of activity types

def load_arduous_data():
104def load_arduous_data():
105    """
106    Legacy function for loading Arduous data.
107    
108    Returns:
109        Tuple of (data_list, names_list)
110    """
111    loader = ArduousLoader()
112    return loader.load_data("")

Legacy function for loading Arduous data.

Returns: Tuple of (data_list, names_list)