Skip to content

electricpy.math.rfft() raises NameError: name 'filter' is not defined #131

@marcostfermin

Description

@marcostfermin

Describe the bug

electricpy.math.rfft() calls filter.dnsample(...), but the module does not import or define filter, so the function raises a NameError whenever resample is truthy or numeric.

This is visible directly in the module code where filter.dnsample is referenced without any filter import/definition.

https://electricpy.readthedocs.io/en/latest/_modules/electricpy/math.html

Reproduction Code

# Setup
import numpy as np
import electricpy as ep

# Code which causes failure
x = np.sin(2*np.pi*5*np.linspace(0, 1, 1000, endpoint=False))
ep.math.rfft(x, dt=0.001, resample=True)  # triggers filter.dnsample(...)

Expected behavior

Return the FFT array (optionally downsampled) without raising a NameError.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Linux]
  • Python Version: 3.11.6
  • Version: 0.4.0

Additional context

The error occurs because filter is never imported/defined in electricpy.math even though it’s used inside rfft.

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions