Skip to main content

Principal Fourier Transformation (PFT)

An implementation A complete overhaul of https://github.com/eloquentarduino/principal-fft for pytorch.

Extracts the principal Fourier Transform Components. That is, for a set of signal data, PFT will extract the top N components for the whole dataset.

TL;DR: Principal Component Analysis (PCA) for Fourier Space.

Installation

With pip...

pip install pft

Usage

# Lets say you've a dataset of transient signal data
# For now, lets construct our own dataset with a single signal.

# The signal will be a composite of many sine functions
num_steps = 100 # Number of temporal steps
num_coefs = 100 # Number of sine functions that make up our composite signal
coefs = torch.rand(num_coefs) * torch.linspace(0, 1, num_steps)
freqs = torch.rand(num_coefs) * 2 * torch.pi

# Don't forgot the leading dimension!
# pft expects the data to have the shape (num_of_data_samples, num_of_time_steps)
signal = torch.zeros((1, num_steps)) 
for i, coef in enumerate(coefs):
	signal += coef * torch.sin(freqs[i] * t)

# Now lets extract 10 prinicipal Fourier coefficients
import pft

num_pfc = 10 # Number of principal Fourier coefficients
pfa = pft.PFT( # pfa = Principal Fourier Analysis
	num_pfc,
	use_torch=True, # Change to False to use numpy backend. Default is True.
	norm="ortho",	# Forward and Inverse Foureir Transform normalisation. Defaults to "ortho".
) 
pfa.fit(signal) # Calculates the prinicipal Fourier coefficients indexes.
pfc = pfa.transform(signal) # Gets the principal Fourier coefficients for this set of signals.

# The indexes of the prinicipal Fourier coefficients are stored internally.
# To get from the principal Fourier coefficients back to the transient signal
# do the following:

reconstructed_signal = pfa.ifit(pfc)

Metadata

Release files for pft 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pft 0.4.2
File Size Uploaded Provenance Actions
pft-0.4.2.tar.gz 15.0 kB Without provenance Details for pft-0.4.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pft 0.4.2
File Interpreter ABI Platform Actions
pft-0.4.2-py3-none-any.whl Python 3 none any Details for pft-0.4.2-py3-none-any.whl

Total release size: 30.2 kB

Release files / pft-0.4.2.tar.gz

Download URL pft-0.4.2.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e652139e35097955a6cfb803bfec86e0ed556eceb3a788e88afab7ebf38ccca3
BLAKE2b-256 checksum
How to use checksums
c49983c291f5962c54d01f3ae5cc70185c536423efffd8e34dbda6b8b637ef49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.10 Linux/5.15.63-gentoo-dist

Release files / pft-0.4.2-py3-none-any.whl

Download URL pft-0.4.2-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c31d99ab0a9c877af647a9123880b40e6e8972dcbbfa8d9b37c0172b1e5711ee
BLAKE2b-256 checksum
How to use checksums
b0c5f8f097f380c8a0490b61d85559b89cb76afebfba12b1a7d507cb5f059669
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.10 Linux/5.15.63-gentoo-dist

Security for pft 0.4.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page