cusignal icon indicating copy to clipboard operation
cusignal copied to clipboard

[FEA] Investigate Matlab-IIR Filter Design - Butterworth and more!

Open GBZH opened this issue 1 year ago • 2 comments

Describe the bug Running code snippets from the RAPIDS documentation page https://docs.rapids.ai/api/cusignal/nightly/api.html#cusignal.windows.windows.hann returns the following error message : AttributeError: module 'cusignal' has no attribute 'butter'

Steps/Code to reproduce bug import cusignal import cupy as cp import matplotlib.pyplot as plt

`fs = 10e3 N = 1e5 amp = 20 freq = 1234.0 noise_power = 0.001 * fs / 2 time = cp.arange(N) / fs b, a = cusignal.butter(2, 0.25, 'low') x = cp.random.normal(scale=cp.sqrt(noise_power), size=time.shape)

lfilter not implemented in cuSignal

y = cusignal.lfilter(b, a, x) x += ampcp.sin(2cp.pifreqtime) y += cp.random.normal(scale=0.1*cp.sqrt(noise_power), size=time.shape)`

Expected behavior The Butterwirth filter seems to have been removed from a previous version in the nightly distribution of RAPIDS (23-04) that I have just installed.

Environment details (please complete the following information):

  • Environment location: Ubuntu 22.04 LTS
  • Method of cuSignal install: conda 23.3.0
  • Code snippet ran from code (VSCode) in a Jupyter notebook

Additional context Add any other context about the problem here.

GBZH avatar Mar 29 '23 15:03 GBZH

Hi @GBZH

Thanks for using cusignal and for submitting this bug report. We haven't implemented many of the IIR filter design tools, including the butterworth filter. This is a little confusing because we have, in our coherence function, cusignal.butter referenced in the documentation. We'll fix this.

We'll also look into the pros/cons of implementing some of these IIR filters in cuSignal, but in the meantime, you can always generate the filter weights with scipy.signal and move them to GPU with cp.asarray().

Are you okay if I re-name this BUG report to a FEA request and start a thread on what's needed to implement more IIR filtering in cusignal?

awthomp avatar Mar 31 '23 14:03 awthomp

Hi Adam,

Thanks a lot for your clear answer. Of course you can rename this post to something better for the development of this very nice tool.

Many thanks,

Gilles

De: "Adam Thompson" @.> À: "rapidsai/cusignal" @.> Cc: "GBZH" @.>, "Mention" @.> Envoyé: Vendredi, Mars 31, 2023 04:04:43 PM Objet: Re: [rapidsai/cusignal] [BUG] AttributeError: module 'cusignal' has no attribute 'butter' (Issue #559)

Hi @GBZH

Thanks for using cusignal and for submitting this bug report. We haven't implemented many of the IIR filter design tools, including the butterworth filter. This is a little confusing because we have, in our coherence function, cusignal.butter referenced in the documentation. We'll fix this.

We'll also look into the pros/cons of implementing some of these IIR filters in cuSignal, but in the meantime, you can always generate the filter weights with scipy.signal and move them to GPU with cp.asarray() .

Are you okay if I re-name this BUG report to a FEA request and start a thread on what's needed to implement more IIR filtering in cusignal?

— Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you were mentioned. Message ID: @.***>

GBZH avatar Mar 31 '23 19:03 GBZH