# Machinery Data Loader
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
## Overview
Machinery Data Loader is a Python package designed to facilitate the loading and preprocessing
of machinery data described in the paper titled
["Machine Learning for Fault Detection and Diagnosis in Rotating Machines: A Benchmark Data Set"](http://papers.phmsociety.org/index.php/ijphm/article/view/3497).
The datasets can be downloaded from the [PHM Data Science Repository](https://search-data.ubfc.fr/search.php?s=collection%3ADATA-PHM).
The available datasets include:
1. **AMPERE**: Detection and diagnostics of rotor and stator faults in rotating machines.
2. **LASPI**: Detection and diagnostics of gearbox faults.
3. **METALLICADOUR**: Detection and diagnostics of multi-axis robot faults.
## Features
- **Data downloading**: Download data if no local data is given.
- **Data Loading**: Load data from CSV/XLSX files specified in a metadata DataFrame.
- **Data Splitting**: Split metadata DataFrame into training and testing sets.
## Installation
Make sure to **Enable Long Paths in Windows** before using the package on **Windows**.
By default, Windows has a limitation on the maximum path length, which might cause issues when using certain packages.
Install the Machinery Data Loader package using pip:
```bash
pip install machinery-diag
```
## Usage
### LASPI
```python
from machinery.loader.base import split_metadata
from machinery.loader.laspi import load_laspi_metadata, load_laspi_data, load_split_laspi_data
# Load metadata
# if no local data_dir is given for LASPI, the module will download the data.
laspi_metadata_df, laspi_class_mapping = load_laspi_metadata()
# Load global data
data, target = load_laspi_data(laspi_metadata_df)
# Load split
laspi_train_df, laspi_test_df = split_metadata(laspi_metadata_df, group_by_cols=["Load_Percent"], test_size=0.25, random_state=42)
X_train, y_train, X_test, y_test = load_split_laspi_data(laspi_train_df, laspi_test_df)
```
### AMPERE-ROTOR
```python
from machinery.loader.base import split_metadata
from machinery.loader.ampere import load_ampere_rotor_metadata, load_ampere_rotor_data, load_split_ampere_rotor_data
# Load metadata
# if no local data_dir is given for AMPERE, the module will download the data.
ampere_rotor_metadata_df, ampere_rotor_class_mapping = load_ampere_rotor_metadata()
# Load global data
ampere_rotor_data, ampere_rotor_target = load_ampere_rotor_data(ampere_rotor_metadata_df)
# Load split data
ampere_rotor_train_df, ampere_rotor_test_df = split_metadata(ampere_rotor_metadata_df, group_by_cols=["Load_Percent"], test_size=0.25, random_state=42)
X_train, y_train, X_test, y_test = load_split_ampere_rotor_data(ampere_rotor_train_df, ampere_rotor_test_df)
```
### AMPERE-STATOR
```python
from machinery.loader.base import split_metadata
from machinery.loader.ampere import load_ampere_stator_metadata, load_ampere_stator_data, load_split_ampere_stator_data
# Load metadata
# if no local data_dir is given for AMPERE, the module will download the data.
ampere_stator_metadata_df, ampere_stator_class_mapping = load_ampere_stator_metadata()
# Load global data
ampere_stator_data, ampere_stator_target = load_ampere_stator_data(ampere_stator_metadata_df)
# Load split data
ampere_stator_train_df, ampere_stator_test_df = split_metadata(ampere_stator_metadata_df, group_by_cols=["Load_Percent"], test_size=0.25, random_state=42)
X_train, y_train, X_test, y_test = load_split_ampere_stator_data(ampere_stator_train_df, ampere_stator_test_df)
```
### METALLICADOUR-TOOLWEAR
```python
from machinery.loader.base import split_metadata
from machinery.loader.metallicadour import load_metallicadour_toolwear_metadata, load_metallicadour_toolwear_data, load_metallicadour_toolwear_split_data
# Load metadata
# if no local data_dir is given for METALLICADOUR, the module will download the data.
toolwear_metadata_df, toolwear_class_mapping = load_metallicadour_toolwear_metadata()
# Load global data
toolwear_data, toolwear_target = load_metallicadour_toolwear_data(toolwear_metadata_df)
# Load split data
ampere_stator_train_df, ampere_stator_test_df = split_metadata(toolwear_metadata_df, group_by_cols=["Cutting_Depth"], test_size=0.25, random_state=42)
X_train, y_train, X_test, y_test = load_metallicadour_toolwear_split_data(ampere_stator_train_df, ampere_stator_test_df)
```
### METALLICADOUR-DRIFT
```python
from machinery.loader.metallicadour import load_metallicadour_drifts_metadata, load_drifts_data
# Load metadata
# if no local data_dir is given for METALLICADOUR, the module will download the data.
tool_metadata_df, position_metadata_df, class_mapping= load_metallicadour_drifts_metadata()
# Load tool data
tool_data, tool_target = load_drifts_data(tool_metadata_df)
# Load position data
pos_data, pos_target = load_drifts_data(position_metadata_df)
```
Raw data
{
"_id": null,
"home_page": "",
"name": "machinery-diag",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "phm,diagnostic,machinery",
"author": "Khaled Benaggoune",
"author_email": "khaled.mommi@gmail.com",
"download_url": "",
"platform": null,
"description": "# Machinery Data Loader\r\n\r\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\r\n\r\n## Overview\r\n\r\nMachinery Data Loader is a Python package designed to facilitate the loading and preprocessing\r\nof machinery data described in the paper titled \r\n[\"Machine Learning for Fault Detection and Diagnosis in Rotating Machines: A Benchmark Data Set\"](http://papers.phmsociety.org/index.php/ijphm/article/view/3497).\r\nThe datasets can be downloaded from the [PHM Data Science Repository](https://search-data.ubfc.fr/search.php?s=collection%3ADATA-PHM).\r\n\r\nThe available datasets include:\r\n\r\n1. **AMPERE**: Detection and diagnostics of rotor and stator faults in rotating machines.\r\n2. **LASPI**: Detection and diagnostics of gearbox faults.\r\n3. **METALLICADOUR**: Detection and diagnostics of multi-axis robot faults.\r\n\r\n## Features\r\n\r\n- **Data downloading**: Download data if no local data is given.\r\n- **Data Loading**: Load data from CSV/XLSX files specified in a metadata DataFrame.\r\n- **Data Splitting**: Split metadata DataFrame into training and testing sets.\r\n\r\n\r\n## Installation\r\n\r\nMake sure to **Enable Long Paths in Windows** before using the package on **Windows**.\r\n\r\nBy default, Windows has a limitation on the maximum path length, which might cause issues when using certain packages.\r\n\r\nInstall the Machinery Data Loader package using pip:\r\n\r\n```bash\r\npip install machinery-diag\r\n\r\n```\r\n\r\n## Usage\r\n\r\n### LASPI\r\n```python\r\nfrom machinery.loader.base import split_metadata\r\nfrom machinery.loader.laspi import load_laspi_metadata, load_laspi_data, load_split_laspi_data\r\n\r\n# Load metadata\r\n# if no local data_dir is given for LASPI, the module will download the data. \r\nlaspi_metadata_df, laspi_class_mapping = load_laspi_metadata()\r\n\r\n# Load global data\r\ndata, target = load_laspi_data(laspi_metadata_df)\r\n\r\n# Load split\r\nlaspi_train_df, laspi_test_df = split_metadata(laspi_metadata_df, group_by_cols=[\"Load_Percent\"], test_size=0.25, random_state=42)\r\nX_train, y_train, X_test, y_test = load_split_laspi_data(laspi_train_df, laspi_test_df)\r\n```\r\n\r\n### AMPERE-ROTOR\r\n```python\r\nfrom machinery.loader.base import split_metadata\r\nfrom machinery.loader.ampere import load_ampere_rotor_metadata, load_ampere_rotor_data, load_split_ampere_rotor_data\r\n\r\n# Load metadata\r\n# if no local data_dir is given for AMPERE, the module will download the data.\r\nampere_rotor_metadata_df, ampere_rotor_class_mapping = load_ampere_rotor_metadata()\r\n\r\n# Load global data\r\nampere_rotor_data, ampere_rotor_target = load_ampere_rotor_data(ampere_rotor_metadata_df)\r\n\r\n# Load split data\r\nampere_rotor_train_df, ampere_rotor_test_df = split_metadata(ampere_rotor_metadata_df, group_by_cols=[\"Load_Percent\"], test_size=0.25, random_state=42)\r\nX_train, y_train, X_test, y_test = load_split_ampere_rotor_data(ampere_rotor_train_df, ampere_rotor_test_df)\r\n```\r\n\r\n### AMPERE-STATOR\r\n```python\r\nfrom machinery.loader.base import split_metadata\r\nfrom machinery.loader.ampere import load_ampere_stator_metadata, load_ampere_stator_data, load_split_ampere_stator_data\r\n\r\n# Load metadata\r\n# if no local data_dir is given for AMPERE, the module will download the data.\r\nampere_stator_metadata_df, ampere_stator_class_mapping = load_ampere_stator_metadata()\r\n\r\n# Load global data\r\nampere_stator_data, ampere_stator_target = load_ampere_stator_data(ampere_stator_metadata_df)\r\n\r\n# Load split data\r\nampere_stator_train_df, ampere_stator_test_df = split_metadata(ampere_stator_metadata_df, group_by_cols=[\"Load_Percent\"], test_size=0.25, random_state=42)\r\nX_train, y_train, X_test, y_test = load_split_ampere_stator_data(ampere_stator_train_df, ampere_stator_test_df)\r\n```\r\n\r\n### METALLICADOUR-TOOLWEAR\r\n```python\r\nfrom machinery.loader.base import split_metadata\r\nfrom machinery.loader.metallicadour import load_metallicadour_toolwear_metadata, load_metallicadour_toolwear_data, load_metallicadour_toolwear_split_data\r\n\r\n# Load metadata\r\n# if no local data_dir is given for METALLICADOUR, the module will download the data.\r\ntoolwear_metadata_df, toolwear_class_mapping = load_metallicadour_toolwear_metadata()\r\n\r\n# Load global data\r\ntoolwear_data, toolwear_target = load_metallicadour_toolwear_data(toolwear_metadata_df)\r\n\r\n# Load split data\r\nampere_stator_train_df, ampere_stator_test_df = split_metadata(toolwear_metadata_df, group_by_cols=[\"Cutting_Depth\"], test_size=0.25, random_state=42)\r\nX_train, y_train, X_test, y_test = load_metallicadour_toolwear_split_data(ampere_stator_train_df, ampere_stator_test_df)\r\n```\r\n\r\n### METALLICADOUR-DRIFT\r\n```python\r\nfrom machinery.loader.metallicadour import load_metallicadour_drifts_metadata, load_drifts_data\r\n\r\n# Load metadata\r\n# if no local data_dir is given for METALLICADOUR, the module will download the data.\r\ntool_metadata_df, position_metadata_df, class_mapping= load_metallicadour_drifts_metadata()\r\n\r\n# Load tool data\r\ntool_data, tool_target = load_drifts_data(tool_metadata_df)\r\n\r\n# Load position data\r\npos_data, pos_target = load_drifts_data(position_metadata_df)\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Package for diagnostic open data set",
"version": "1.0.3",
"project_urls": null,
"split_keywords": [
"phm",
"diagnostic",
"machinery"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9e74dfb4db014159d5e78f678e477c2edf9cea775c00287efa214279f086ac1b",
"md5": "4de1aa5795fad53cd22a32fb27614fa0",
"sha256": "7420f652f03610fa7caf12c92279ba59116f91e600f4de4f71eb7af519c816e7"
},
"downloads": -1,
"filename": "machinery_diag-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4de1aa5795fad53cd22a32fb27614fa0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 11518,
"upload_time": "2024-02-04T18:59:40",
"upload_time_iso_8601": "2024-02-04T18:59:40.615064Z",
"url": "https://files.pythonhosted.org/packages/9e/74/dfb4db014159d5e78f678e477c2edf9cea775c00287efa214279f086ac1b/machinery_diag-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-04 18:59:40",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "machinery-diag"
}