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/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:dbf45c4a-7c9d-2eda-2893-600693aba52f |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | BC20:746A2:733F77:98CF9A:698ED963 |
| html-safe-nonce | 5dee1703c3741e4798cdf8c39fce168d33bbf20b63cf2349e8817ab787ffe77d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQzIwOjc0NkEyOjczM0Y3Nzo5OENGOUE6Njk4RUQ5NjMiLCJ2aXNpdG9yX2lkIjoiODg0Mjk4NTUyODQ1NjMwNDk5NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3a5225c63900316d47535006d248c300ead1fb0026ac5052162085524edbce6f |
| hovercard-subject-tag | pull_request:1628143194 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,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/checks |
| 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 |
| 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 full-width-p-0 |
| disable-turbo | false |
| 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