This repository contains Python scripts to assess the quality of time-series signals. The main steps include:
- Reading raw data from text files.
- Segmenting signals into windows.
- Transforming them to the frequency domain (FFT).
- Computing quality metrics (Spectral Entropy, etc.).
- Visualizing the mean spectrum with uncertainty (standard deviation).
- Saving metrics into timestamped
.yml
files.
.
├── .gitignore
├── data/
│ ├── 0702 без перекосов фаза A.txt
│ └── data-sample_motor-operating-at-100%-load.txt
├── environment.yml
├── pyproject.toml
├── res/
│ ├── result.yml
│ └── segment_with_uncertainty.png
├── setup.sh
├── src/
│ ├── __init__.py
│ ├── data_preprocessing.py
│ ├── quality_assessment.py
│ ├── utils.py
│ └── vis.py
└── main.py
└── README.md
- data/: Contains example
.txt
signals. - res/: Output folder for results, plots, and metrics in
.yml
format. - src/: All source code modules.
- main.py: Command-line interface script for running signal quality assessment.
- environment.yml / pyproject.toml: Dependencies configuration.
- setup.sh: Setup script.
git clone https://github.com/xndrleib/Signal-Quality-Assessment.git
cd Signal-Quality-Assessment
bash setup.sh
conda activate py311_sqa
Install the package using the pyproject.toml setup:
pip install -e .
Run the CLI script main.py
to process either a single file or an entire folder of signals.
python main.py --input <path_to_file_or_folder> [OPTIONS]
Options:
--res_dir
: Output directory for results (default: "res"
).--window_length
: Number of samples in each segment (default: 10000
).--step
: Step size for windowing (default: 20
).--f_sampling
: Sampling frequency (default: 10000.0
).--db
: Flag to convert FFT results to dB scale (default: True
).--cutoff_freq
: Frequency cutoff for filtering (default: 250.0
).
-
Process a single file:
python main.py \ --input data/data-sample_motor-operating-at-100%-load.txt \ --res_dir res \ --window_length 10000 \ --step 20 \ --f_sampling 10000 \ --db True \ --cutoff_freq 250
-
Process all
.txt
files in a folder:python main.py --input data/
After completion, the script will generate:
- Plot of Average Spectrum with Uncertainty in
res/spectrum_with_uncertainty_data-sample_motor-operating-at-100%-load_20241227_101523.png
. - Result metrics in
.yml
files (e.g.,res/data-sample_motor-operating-at-100%-load_20241227_101523.yml
).
- Signal Reading: Implemented in
src/utils.py
. - Segmentation & FFT: Implemented in
src/data_preprocessing.py
. - Quality Metrics: Spectral Entropy, etc. in
src/quality_assessment.py
. - Visualization: Plot functions in
src/vis.py
.