Title: Subscriptable 'Frequencies' class by TKosir · Pull Request #265 · python-acoustics/python-acoustics · GitHub
Open Graph Title: Subscriptable 'Frequencies' class by TKosir · Pull Request #265 · python-acoustics/python-acoustics
X Title: Subscriptable 'Frequencies' class by TKosir · Pull Request #265 · python-acoustics/python-acoustics
Description: Greetings, First of all, thank you for this great package! The other day I needed to calculate sound pressure levels in specific frequency regions. I wanted to use the Signal.bandpass_frequencies method which needs Frequencies class as input frequencies. The code I used is the following: import numpy as np import matplotlib.pyplot as plt sample_rate = 44100 signal = np.random.randn(10000) s = Signal(signal, sample_rate) freq_bands = np.array([[100, 200], [200, 400], [800, 1600], [3200, 6400]]) frequencies = Frequencies(center=freq_bands.mean(axis=1), lower=freq_bands[:, 0], upper=freq_bands[:, 1]) f, o = s.bandpass_frequencies(frequencies=frequencies) Lp = o.leq() fig, ax = plt.subplots() ax.plot(f.center, Lp, ".-") However, when using the following code, I get "TypeError: 'Frequencies' object is not subscriptable". I want to therefore propose a small change for the base Frequencies class by adding __getitem__ method, like in other child frequencies classes to resolve this issue and make Frequencies class usable also as stand alone.
Open Graph Description: Greetings, First of all, thank you for this great package! The other day I needed to calculate sound pressure levels in specific frequency regions. I wanted to use the Signal.bandpass_frequencies m...
X Description: Greetings, First of all, thank you for this great package! The other day I needed to calculate sound pressure levels in specific frequency regions. I wanted to use the Signal.bandpass_frequencies m...
Opengraph URL: https://github.com/python-acoustics/python-acoustics/pull/265
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:35cedada-9879-8332-36b6-0be111d4a18e |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | BD76:16D2A2:6030B4:7BF774:698E8F38 |
| html-safe-nonce | 8665e3d012df55f2a3182df0ed0ebab8ba4dcd31ef373e0b42e2c64fd46274f5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRDc2OjE2RDJBMjo2MDMwQjQ6N0JGNzc0OjY5OEU4RjM4IiwidmlzaXRvcl9pZCI6IjYzODg1MDYyNTUzMTc0MzgyNjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 73f97587be536d1aae1177cd2865b57751613c9a6978d1c26a121b5e01cebd47 |
| hovercard-subject-tag | pull_request:1628143194 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python-acoustics/python-acoustics/pull/265/files |
| twitter:image | https://avatars.githubusercontent.com/u/81802900?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/81802900?s=400&v=4 |
| og:image:alt | Greetings, First of all, thank you for this great package! The other day I needed to calculate sound pressure levels in specific frequency regions. I wanted to use the Signal.bandpass_frequencies m... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb2828a801ee6b7be618f3ac76fbf55def35bbc30f053a9c41bf90210b8b72ba |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python-acoustics/python-acoustics git https://github.com/python-acoustics/python-acoustics.git |
| octolytics-dimension-user_id | 3644840 |
| octolytics-dimension-user_login | python-acoustics |
| octolytics-dimension-repository_id | 14710112 |
| octolytics-dimension-repository_nwo | python-acoustics/python-acoustics |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14710112 |
| octolytics-dimension-repository_network_root_nwo | python-acoustics/python-acoustics |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6b91a7e6e46287d26887e3fb7a4161657bab8f7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width