Skip to main content

Signal processing tools

Project description

SignalProcessingTools

Tests PyPI version Python versions

A comprehensive Python package for time and space domain signal processing operations with a focus on vibration analysis and frequency-domain transformations. The space domain operations focus on railway applications, while the time domain operations are more general.

Overview

SignalProcessingTools provides a suite of tools for analyzing, transforming, and processing data.

Time domain operations:

  • Fast Fourier Transforms (FFT) and inverse FFT
  • Signal filtering
  • Integration
  • Power Spectral Density (PSD) using Welch's method
  • Spectrogram generation
  • Effective velocity calculations using SBR method
  • 1/3 octave band analysis
  • Windowing functions (Hann, Hamming, Blackman, etc.)

Space domain operations:

  • D0, D1, D2, and D3 track longitudinal levels, following EN 13848-1:2006.
  • Hmax and Hrms according to Zandberg et al. (2022).

Installation

Install from PyPI

You can install the package directly from PyPI using pip:

pip install SignalProcessingTools

Install from Source

To install the package from the source, clone the repository and run the following commands:

git clone https://github.com/PlatypusBytes/SignalProcessing.git
cd SignalProcessing
pip install -e .

Usage

Basic Example of Time Domain Operations

FFT and signal integration

import numpy as np
from SignalProcessingTools.time_signal import SignalProcessing, Windows

# Create a test signal
t = np.linspace(0, 10, 5001)
y = 1.75 * np.sin(2 * np.pi * 6 * t)

# Initialize the signal processor
sig = SignalProcessing(t, y)

# Perform FFT
sig.fft()

# Integrate the signal
sig.integrate(baseline=True, hp=True, fpass=1, n=6)

Windowed Processing and PSD and spectrogram

# Create a signal processor with Hamming window
sig = SignalProcessing(t, y, window=Windows.HAMMING, window_size=4096)

# Calculate Power Spectral Density
sig.psd()

# Generate a spectrogram
sig.spectrogram()

Signal Filtering

# Apply a low-pass filter to remove high frequency noise
sig.filter(10, 4, type_filter="lowpass")

Effective Velocity Calculation (SBR-B Method)

# Calculate effective velocity using SBR method
sig.v_eff_SBR()

Basic Example of Spatial Domain Operations

D0, D1, D2, and D3 Calculation

import numpy as np
from SignalProcessingTools.space_signal import SpatialSignal
from SignalProcessingTools.space_signal import EN13848

# Create test data
x = np.linspace(0, 100, 50001)
omega = 2 * np.pi * 6
y = 1.75 * np.sin(omega * x)
y_noise = y + 0.01 * np.sin(120 * x)

sig = SpaceSignalProcessing(x, y_noise)
# Compute track longitudinal levels
sig.compute_track_longitudinal_levels()

Hmax and Hrms Calculation

x_track = np.linspace(0, 500, 25001)
track_irregularity = (
    0.002 * np.sin(2 * np.pi * 0.1 * x_track) +
    0.001 * np.sin(2 * np.pi * 0.2 * x_track) +
    0.0005 * np.sin(2 * np.pi * 0.4 * x_track) +
    0.0002 * np.random.randn(len(x_track))
)

sig_hmax = SpaceSignalProcessing(x_track, track_irregularity)
# Compute Hmax parameters
sig_hmax.compute_Hmax(convert_m2mm=True)

Example Files

A comprehensive example demonstrating all features is provided for the time signal and space signal.

License

This project is licensed under the MIT License - see the License file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

signalprocessingtools-1.2.4.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

signalprocessingtools-1.2.4-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file signalprocessingtools-1.2.4.tar.gz.

File metadata

  • Download URL: signalprocessingtools-1.2.4.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for signalprocessingtools-1.2.4.tar.gz
Algorithm Hash digest
SHA256 c88ba4c162a6cc145e05423d36c9f1ffa99183ca1140e9798a834e6b4e635334
MD5 3f1bc906a541d9419af52aa063c5f011
BLAKE2b-256 8be4fb6585340928efe3ed8a42d3909dd1a2a3de2b6d49795a2c0c6d15e9eb6d

See more details on using hashes here.

File details

Details for the file signalprocessingtools-1.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for signalprocessingtools-1.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 435b12d476c46b2987dd7c1dafee0e5b0ff75daf603e4f745c28c6ceb0800902
MD5 0dd46eb7e254172dce350c95a3626279
BLAKE2b-256 307223d63679a01737ddbfbfaac5b73442ea24d7f69015da84cba99947bd5888

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page