Skip to main content

Your handy frequency and impulse response processing object

Project description

Response

travis-ci codecov

The response module defines the Response class as an abstraction of frequency and impulse responses.

import numpy as np
from response import Response

fs = 48000  # sampling rate
T = 0.5     # length of signal
# a sine at 100 Hz
t = np.arange(int(T * fs)) / fs
x = np.sin(2 * np.pi * 100 * t)
# Do chain of processing
r = (
    Response.from_time(fs, x)
    # time window at the end and beginning
    .time_window((0, 0.1), (-0.1, None), window="hann")  # equivalent to Tukey window
    # zeropad to one second length
    .zeropad_to_length(fs * 1)
    # circular shift to center
    .circdelay(T / 2)
    # resample with polyphase filter, keep gain of filter
    .resample_poly(500, window=("kaiser", 0.5), normalize="same_amplitude")
    # cut 0.2s at beginning and end
    .timecrop(0.2, -0.2)
    # apply frequency domain window
    .freq_window((0, 90), (110, 500))
)
# plot result
r.plot(show=True)
# real impulse response
r.in_time
# complex frequency response
r.in_freq
# and much more ...

Testing

Run tests in base directory with

pytest

Always run tests before pushing code.

Developing

Install for development with pip install -e . .

Comments should comply with the Numpy/Scipy documentation style. An example can also be found here. Code should comply to the pep8 coding style. You can check if the code complies by executing

pycodestyle
pydocstyle

Git commit messages follow Angular style. Uses python-semantic-release for versioning on travis-ci for pushs to master branch.

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

response-0.2.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

response-0.2.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file response-0.2.0.tar.gz.

File metadata

  • Download URL: response-0.2.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.1

File hashes

Hashes for response-0.2.0.tar.gz
Algorithm Hash digest
SHA256 34b4f1c129b72a4c221806735b5518dd5acf33c32b5acfe1f8b39ca913c96c74
MD5 b1c211e3bebc2db420490ad9c6ad088b
BLAKE2b-256 49e21c6c2da4ccc7ee8171fc4564b8db2d7bf4e53c7eb5fb545790984527dba2

See more details on using hashes here.

File details

Details for the file response-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: response-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.1

File hashes

Hashes for response-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ae07f57cdffc8a8bcadc94eee1fc5fa6d9731e95a921a0226a2eeab0fcecffa
MD5 d8d73b191835f417c10a4a39e2d41877
BLAKE2b-256 07451b8cf89bae758c742a3c246fb43e0a84345797fcb91589ef4bcd4a958720

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