Skip to main content

A Package to Compute S-transform with Hyperbolic Window

Project description

Hyperbolic S-Transform

Package for Hyperbolic S-transform

1. Introduction

HS Transform is a Python package for performing Hyperbolic S-transform [1]. The S-transform is a time-frequency representation that combines the best properties of the Short-time Fourier Transform and the Wavelet Transform. It provides simultaneous information on both the frequency content and temporal localization of a signal.

This is a work of my published paper

References

[1] Stockwell, R.G., Mansinha, L. & Lowe, R.P., (1996). Localization of the complex spectrum: the S transform. IEEE Trans. Signal Process., 44(4), 998–1001, doi:10.1109/78.492555

2. Dependencies

HS Transform requires the following Python packages:

  • numpy
  • scipy
  • pandas
  • matplotlib
  • pytest

3. How to Install

After that, you can install HS Transform using pip:

pip install HSTransform

You can also install all dependencies and package in 1 statement

pip install numpy scipy pandas matplotlib pytest HSTransform

4. Run tests

After installation, you can test the package using the included test scripts: pytest tests/

5. Example

Here’s an example of how to use HS Transform to analyze a signal with voltage disturbance and power system fault:

It's noted sometimes you need to include the installed HSTransform package location into sys

import sys
import os

# Add the package directory to sys.path
package_path = os.path.abspath('/usr/local/Caskroom/miniconda/base/envs/YOUR_ENVIRONMENT/lib/python3.10/site-packages/')
if package_path not in sys.path:
    sys.path.insert(0, package_path)

import numpy as np
from hstransform import HSTransform

# Create input signal (for example: Voltage signal)
t = np.linspace(0, 10, 100) # timeseries
V_m = 220*np.sqrt(2)  # peak voltage
f_V = 50  # frequency
phi_V = 0  # phase

V_clean = V_m * np.sin(2 * np.pi * f_V * t + phi_V)
# Create voltage sag/dip (80% of the nominal voltage for 0.15 second)
V_sag = np.where((t >= 2) & (t <= 3.5), 0.5 * V_clean, V_clean)

# Create an instance of HSTransform

hs = HSTransform()

# Perform the transform
signal = V_sag
S_transformed = hs.fit_transform(t, signal)

5.1 Power Quality Disturbance

Compare HS-transform vs. Morlet Wavelet Transform: Voltage Disturbance

The figure showed HS-transform is able to detect the transient disturbances like notch, spike. Meanwhile, those signals from Morlet Wavelet transform are not obviously recognized.

Real-Imag Trajectory We can see also different types of voltage disturbance can generate different real-imaginary trajectory in S-transform at different frequencies.

5.2 Power System Faults

Different Faults

As can be seen, both Wavelet and S-transform are able to detect when the fault occur (huge change in current magnitude). Wavelet transform seems more sensitive with noise with high distortion compared with HS-transform.

Real-Imag Trajectory

We can also observe different types of faults can generate different real-imaginary trajectory in S-transform at varying levels of frequencies.

6. Communication

If you have any questions, issues, or suggestions for HS Transform, please open an issue on the GitHub repository. or contact email: linhvietnguyen.ee@gmail.com

7. Citation

If you use HS Transform in your research, please cite it as follows: Linh V Nguyen (2024). HS Transform (Version 0.1) [Computer software]. GitHub: github.com/nvlinhvn/hstransform

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

HSTransform-0.1.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

HSTransform-0.1.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file HSTransform-0.1.1.tar.gz.

File metadata

  • Download URL: HSTransform-0.1.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.4

File hashes

Hashes for HSTransform-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1669713f43a903e85d867fceb4239cf0d4453ebc8ec9df80399621c0c7622562
MD5 c6cce3803e3337373029a04ab668b7b5
BLAKE2b-256 194c15daaca915ec258685618d715588b238f7813fb8982705bdee6032a7a64c

See more details on using hashes here.

File details

Details for the file HSTransform-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: HSTransform-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.4

File hashes

Hashes for HSTransform-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4b025137004a742daeb0d22a74466911b21ba3a2f2b8dda36dbba472f450af3
MD5 944676d1241c25613ab8d0f4aca0963b
BLAKE2b-256 168cbaa35ade502bc7cf7d9e2a6cf759ad8121ef14ec3b7f7d082244b5be19f7

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