New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
concatenate bins #543
base: develop
Are you sure you want to change the base?
concatenate bins #543
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for implementing this.
I have a few conceptual comments/questions.
- Would it make sense to combine this with a function which also supports merging TimeData?
- Since the function does sort the frequency data, it's more of a merge, rather than concatenation of the data. I'd rename to sth. like
merge_data
or similar.
Good question, but then sorting the bins does not make much scence, doesn't it? or we also add concatenate, which just concatenate the data, and merge does the sorting... an other option would be to add the sorting as an option... not sure what is the best way to go for. sure we can rename it. lets finalize your first question first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also in favor for discussing suggestions from @mberz and added one more idea to improve flexibility.
"Input must be a tuple or list of pf.FrequencyData objects.") | ||
|
||
for signal in signals: | ||
if not isinstance(signal, (pf.FrequencyData)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is True
for pyfar.Signal
due to the inheritance. I think type(signal) != pf.FrequencyData
is what you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also be tested then.
@@ -212,3 +212,45 @@ def concatenate_channels(signals, caxis=0, broadcasting=False): | |||
return pf.TimeData(data, signals[0].times) | |||
else: | |||
return pf.FrequencyData(data, signals[0].frequencies) | |||
|
|||
|
|||
def concatenate_bins(signals): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we now have functions to broadcast cshapes of audio objects it would be nice to include this by default to make this more flexible.
Which issue(s) are closed by this pull request?
Closes #469
Changes proposed in this pull request: