-
Notifications
You must be signed in to change notification settings - Fork 3
Spherical harmonics transform #152
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
base: develop
Are you sure you want to change the base?
Conversation
mberz
left a comment
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.
I think we should review the concept again. Specifying all properties again does not use the power of the SH class at all from a users perspective.
Passing the SH class instead of creating it within the function would make things much easier in my opinion.
Always store fully normalized data in ACN order and renormalize accordinglz in setter/getter
manually integrate branch #229
allow to pass sh data with dimensions < 3
overwrite basis_type setter and freq_raw
f-brinkmann
left a comment
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.
Thanks for the effort. Functionality is great to have and looks good to me. I only marked two points for reducing code for now.
| # move spherical samples to -2 | ||
| data = np.moveaxis(data, axis, -2) | ||
|
|
||
| # perform transform | ||
| data_nm = np.tensordot(Y_inv, data, [1, -2]) | ||
|
|
||
| # move SH channels to -2 | ||
| data_nm = np.moveaxis(data_nm, 0, -2) |
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.
We have matrix multiplication implemented in pyfar arithmetics. If we use this, we can maybe avoid moving the axis by passing the axes parameter.
| if isinstance(signal, Signal): | ||
| sh_signal = SphericalHarmonicSignal( | ||
| data=data_nm, | ||
| basis_type=spherical_harmonics.basis_type, | ||
| normalization=spherical_harmonics.normalization, | ||
| channel_convention=spherical_harmonics.channel_convention, | ||
| condon_shortley=spherical_harmonics.condon_shortley, | ||
| sampling_rate=signal.sampling_rate, | ||
| fft_norm=signal.fft_norm, | ||
| is_complex=signal.complex, | ||
| comment=signal.comment) | ||
| elif isinstance(signal, TimeData): | ||
| sh_signal = SphericalHarmonicTimeData( | ||
| data=data_nm, | ||
| times=signal.times, | ||
| basis_type=spherical_harmonics.basis_type, | ||
| normalization=spherical_harmonics.normalization, | ||
| channel_convention=spherical_harmonics.channel_convention, | ||
| condon_shortley=spherical_harmonics.condon_shortley, | ||
| comment=signal.comment, | ||
| is_complex=False) | ||
| elif isinstance(signal, FrequencyData): | ||
| sh_signal = SphericalHarmonicFrequencyData( | ||
| data=data_nm, | ||
| frequencies=signal.frequencies, | ||
| basis_type=spherical_harmonics.basis_type, | ||
| normalization=spherical_harmonics.normalization, | ||
| channel_convention=spherical_harmonics.channel_convention, | ||
| condon_shortley=spherical_harmonics.condon_shortley, | ||
| comment=signal.comment) |
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.
After we have implemented the from_defition methods for the SHAudio classes, this could probably be shortened significantly.
Which issue(s) are closed by this pull request?
Closes #133
Changes proposed in this pull request:
transforms?