Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Directivity example notebook is broken #32

Closed
MitchellAcoustics opened this issue Oct 30, 2024 · 1 comment · Fixed by #35
Closed

Directivity example notebook is broken #32

MitchellAcoustics opened this issue Oct 30, 2024 · 1 comment · Fixed by #35
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@MitchellAcoustics
Copy link
Collaborator

MitchellAcoustics commented Oct 30, 2024

Looks like we have an issue with directivity.Directivity.using_spherical() not being passed the right args. This is not caught in the directivity tests.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[2], [line 2](vscode-notebook-cell:?execution_count=2&line=2)
      [1](vscode-notebook-cell:?execution_count=2&line=1) d = Omni()
----> [2](vscode-notebook-cell:?execution_count=2&line=2) fig = d.plot()

File ~/Documents/GitHub/acoustic-toolbox/acoustic_toolbox/directivity.py:157, in Directivity.plot(***failed resolving arguments***)
    [155](https://file+.vscode-resource.vscode-cdn.net/Users/mitch/Documents/GitHub/acoustic-toolbox/examples/~/Documents/GitHub/acoustic-toolbox/acoustic_toolbox/directivity.py:155) # TODO: filename
    [156](https://file+.vscode-resource.vscode-cdn.net/Users/mitch/Documents/GitHub/acoustic-toolbox/examples/~/Documents/GitHub/acoustic-toolbox/acoustic_toolbox/directivity.py:156) del filename
--> [157](https://file+.vscode-resource.vscode-cdn.net/Users/mitch/Documents/GitHub/acoustic-toolbox/examples/~/Documents/GitHub/acoustic-toolbox/acoustic_toolbox/directivity.py:157) return plot(self, include_rotation)

File ~/Documents/GitHub/acoustic-toolbox/acoustic_toolbox/directivity.py:257, in plot(d, sphere)
    [252](https://file+.vscode-resource.vscode-cdn.net/Users/mitch/Documents/GitHub/acoustic-toolbox/examples/~/Documents/GitHub/acoustic-toolbox/acoustic_toolbox/directivity.py:252) theta, phi = np.meshgrid(
    [253](https://file+.vscode-resource.vscode-cdn.net/Users/mitch/Documents/GitHub/acoustic-toolbox/examples/~/Documents/GitHub/acoustic-toolbox/acoustic_toolbox/directivity.py:253)     np.linspace(0.0, np.pi, 50), np.linspace(0.0, +2.0 * np.pi, 50)
    [254](https://file+.vscode-resource.vscode-cdn.net/Users/mitch/Documents/GitHub/acoustic-toolbox/examples/~/Documents/GitHub/acoustic-toolbox/acoustic_toolbox/directivity.py:254) )
    [256](https://file+.vscode-resource.vscode-cdn.net/Users/mitch/Documents/GitHub/acoustic-toolbox/examples/~/Documents/GitHub/acoustic-toolbox/acoustic_toolbox/directivity.py:256) # Directivity strength. Real-valued. Can be positive and negative.
--> [257](https://file+.vscode-resource.vscode-cdn.net/Users/mitch/Documents/GitHub/acoustic-toolbox/examples/~/Documents/GitHub/acoustic-toolbox/acoustic_toolbox/directivity.py:257) dr = d.using_spherical(theta, phi)
    [259](https://file+.vscode-resource.vscode-cdn.net/Users/mitch/Documents/GitHub/acoustic-toolbox/examples/~/Documents/GitHub/acoustic-toolbox/acoustic_toolbox/directivity.py:259) if sphere:
    [260](https://file+.vscode-resource.vscode-cdn.net/Users/mitch/Documents/GitHub/acoustic-toolbox/examples/~/Documents/GitHub/acoustic-toolbox/acoustic_toolbox/directivity.py:260)     x, y, z = spherical_to_cartesian(1.0, theta, phi)

TypeError: Directivity.using_spherical() missing 1 required positional argument: 'phi'
@MitchellAcoustics MitchellAcoustics added bug Something isn't working documentation Improvements or additions to documentation labels Oct 30, 2024
@MitchellAcoustics MitchellAcoustics self-assigned this Oct 30, 2024
@MitchellAcoustics MitchellAcoustics linked a pull request Nov 1, 2024 that will close this issue
@MitchellAcoustics
Copy link
Collaborator Author

0d00c8ae40f93850b5e5d16d99ada1aea0b431b2 will resolve this for now. This changes from using d.plot() method to plot(d), since the function seems fine, it's just the class method that is broken. Directivity.plot() method needs to be re-implemented to match the directivity.plot() function signature.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant