Package: machinery-diag
Machinery Data LoaderOverviewMachinery 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".
The datasets can be downloaded from thePHM Data Science Repository.The available datasets include:AMPERE: Detection and diagnostics of rotor and stator faults in rotating machines.LASPI: Detection and diagnostics of gearbox faults.METALLICADOUR: Detection and diagnostics of multi-axis robot faults.FeaturesData 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.InstallationMake sure toEnable Long Paths in Windowsbefore using the package onWindows.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:pipinstallmachinery-diagUsageLASPIfrommachinery.loader.baseimportsplit_metadatafrommachinery.loader.laspiimportload_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 datadata,target=load_laspi_data(laspi_metadata_df)# Load splitlaspi_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-ROTORfrommachinery.loader.baseimportsplit_metadatafrommachinery.loader.ampereimportload_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 dataampere_rotor_data,ampere_rotor_target=load_ampere_rotor_data(ampere_rotor_metadata_df)# Load split dataampere_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-STATORfrommachinery.loader.baseimportsplit_metadatafrommachinery.loader.ampereimportload_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 dataampere_stator_data,ampere_stator_target=load_ampere_stator_data(ampere_stator_metadata_df)# Load split dataampere_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-TOOLWEARfrommachinery.loader.baseimportsplit_metadatafrommachinery.loader.metallicadourimportload_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 datatoolwear_data,toolwear_target=load_metallicadour_toolwear_data(toolwear_metadata_df)# Load split dataampere_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-DRIFTfrommachinery.loader.metallicadourimportload_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 datatool_data,tool_target=load_drifts_data(tool_metadata_df)# Load position datapos_data,pos_target=load_drifts_data(position_metadata_df)