Skip to content

Error with RoomAnalysis #40

Open
Open

Description

@the-drunk-coder

I tried the reverberation_time example, and I get the following error:

[/usr/local/lib/python3.7/dist-packages/scipy/signal/filter_design.py](https://localhost:8080/#) in iirfilter(N, Wn, rp, rs, btype, analog, ftype, output, fs)
   2344     if not analog:
   2345         if numpy.any(Wn <= 0) or numpy.any(Wn >= 1):
-> 2346             raise ValueError("Digital filter critical frequencies "
   2347                              "must be 0 < Wn < 1")
   2348         fs = 2.0

ValueError: Digital filter critical frequencies must be 0 < Wn < 1

Any hints?

Best,
N

Activity

  1. the-drunk-coder commented on Jun 9, 2022

    @the-drunk-coder
    Author

    Here's the full traceback:

    (pytta-env) ubuntu@op-mm-deeparts-os:~/PyTTa/examples$ python reverberation_time.py 
    Traceback (most recent call last):
      File "reverberation_time.py", line 19, in <module>
        maxFreq=float(2e4))
      File "/home/ubuntu/miniconda3/envs/pytta-env/lib/python3.7/site-packages/PyTTa-0.1.2a0-py3.7.egg/pytta/classes/analysis.py", line 970, in __init__
      File "/home/ubuntu/miniconda3/envs/pytta-env/lib/python3.7/site-packages/PyTTa-0.1.2a0-py3.7.egg/pytta/classes/analysis.py", line 996, in estimate_energy_parameters
      File "/home/ubuntu/miniconda3/envs/pytta-env/lib/python3.7/site-packages/PyTTa-0.1.2a0-py3.7.egg/pytta/classes/analysis.py", line 1471, in cumulative_integration
      File "/home/ubuntu/miniconda3/envs/pytta-env/lib/python3.7/site-packages/PyTTa-0.1.2a0-py3.7.egg/pytta/classes/analysis.py", line 1161, in _filter
      File "/home/ubuntu/miniconda3/envs/pytta-env/lib/python3.7/site-packages/PyTTa-0.1.2a0-py3.7.egg/pytta/classes/filter.py", line 83, in __init__
      File "/home/ubuntu/miniconda3/envs/pytta-env/lib/python3.7/site-packages/PyTTa-0.1.2a0-py3.7.egg/pytta/classes/filter.py", line 115, in get_sos_filters
      File "/home/ubuntu/miniconda3/envs/pytta-env/lib/python3.7/site-packages/PyTTa-0.1.2a0-py3.7.egg/pytta/classes/filter.py", line 105, in __design_sos_butter
      File "/home/ubuntu/miniconda3/envs/pytta-env/lib/python3.7/site-packages/scipy/signal/filter_design.py", line 2867, in butter
        output=output, ftype='butter', fs=fs)
      File "/home/ubuntu/miniconda3/envs/pytta-env/lib/python3.7/site-packages/scipy/signal/filter_design.py", line 2346, in iirfilter
        raise ValueError("Digital filter critical frequencies "
    ValueError: Digital filter critical frequencies must be 0 < Wn < 1
    
  2. Chum4k3r commented on Jun 9, 2022

    @Chum4k3r
    Collaborator

    Hello @the-drunk-coder, thank you for the traceback and your interest in pytta.

    My time for pytta lies only on the weekends, when there's spare time, so I won't be able to give you some more hints right away. If you don't mind trying to run it from de code in development and get us the traceback, we might coordinate a solution to this issue.

    Thanks again, and feel free to question as much as you want!

  3. the-drunk-coder commented on Jun 9, 2022

    @the-drunk-coder
    Author

    Hi @Chum4k3r, no worries :)

    The traceback above is from the latest development version, I checked it out this morning, in a conda environment generated from the requirements.yml.

    I played around with it and tried to scale the edge frequencies to [0, 1] (by dividing them by samplerate//2, but now I get a different error, so I'm not sure whether that was the right way to go ...

    Best,
    Niklas

  4. Chum4k3r commented on Jun 9, 2022

    @Chum4k3r
    Collaborator

    Ok, from the scipy.signal.iirfilter documentation, it seems that the parameter fs receives a None, instead of the actual .samplingRate property.

    If it is None, it is coming from the OctFilter class as a samplingRate == None.

    Can you debug the filtering steps to check?

    This is the critical code line of the filtering process.

    best,
    João Vitor

  5. the-drunk-coder commented on Jun 10, 2022

    @the-drunk-coder
    Author

    That doesn't seem to be it, the samplerate is passed correctly to the OctFilter constructor.

    I also tried the following (mentioned above but here's the details):

    In filter.py, line 102, add: edges = edges / (samplingRate//2) to normalize the frequencies to [0,1]

    This leaves me with another error, though:

    Traceback (most recent call last):
      File "revtime_local.py", line 21, in <module>
        maxFreq=float(2e4))
      File "/home/ubuntu/miniconda3/envs/pytta-env/lib/python3.7/site-packages/PyTTa-0.1.2a0-py3.7.egg/pytta/classes/analysis.py", line 970, in __init__
      File "/home/ubuntu/miniconda3/envs/pytta-env/lib/python3.7/site-packages/PyTTa-0.1.2a0-py3.7.egg/pytta/classes/analysis.py", line 996, in estimate_energy_parameters
      File "/home/ubuntu/miniconda3/envs/pytta-env/lib/python3.7/site-packages/PyTTa-0.1.2a0-py3.7.egg/pytta/classes/analysis.py", line 1488, in cumulative_integration
      File "/home/ubuntu/miniconda3/envs/pytta-env/lib/python3.7/site-packages/PyTTa-0.1.2a0-py3.7.egg/pytta/classes/analysis.py", line 1414, in energy_decay_calculation
      File "/home/ubuntu/miniconda3/envs/pytta-env/lib/python3.7/site-packages/PyTTa-0.1.2a0-py3.7.egg/pytta/classes/analysis.py", line 1281, in _Lundeby_correction
    IndexError: index -1 is out of bounds for axis 0 with size 0
    
  6. aguirreSL commented on Oct 31, 2026

    @aguirreSL

    I tried this again on the current development branch (1d30852) with Python 3.12, numpy 1.26 and scipy 1.17. examples/reverberation_time.py runs to the end and no longer raises the ValueError from scipy.signal.butter. If it still fails for you, a traceback from development would help. Otherwise I think this issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions