-
Notifications
You must be signed in to change notification settings - Fork 3
[ENH] Classmethod to create SphericalHarmonicSignal from SphericalHarmonicDefinition #247
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
add docstrings move n_max and dimensions check to base class
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
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.
Thanks for the draft. I did a quick conceptual review.
Main point is to harmonize it with #249
spharpy/classes/audio.py
Outdated
| def from_spherical_harmonics_definition( | ||
| cls, data, times, sh_definition, domain='time', | ||
| fft_norm='none', comment="", is_complex=False): |
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.
| def from_spherical_harmonics_definition( | |
| cls, data, times, sh_definition, domain='time', | |
| fft_norm='none', comment="", is_complex=False): | |
| def from_definition( | |
| cls, sh_definition, data, times, domain='time', | |
| fft_norm='none', comment="", is_complex=False): |
I'd suggest to change the order and shorten the name as in #249
spharpy/classes/audio.py
Outdated
| Create a SphericalHarmonicsSignal class object from | ||
| SphericalHarmonicsDefinition object, data, and sampling | ||
| rate. |
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.
Just noting this so it's not forgotten:
i) Please use the correct names, also see occurences below.
| Create a SphericalHarmonicsSignal class object from | |
| SphericalHarmonicsDefinition object, data, and sampling | |
| rate. | |
| Create a SphericalHarmonicSignal class object from | |
| SphericalHarmonicDefinition object, data, and sampling | |
| rate. |
ii) Classmethods should get parameter documentation
spharpy/classes/audio.py
Outdated
| @property | ||
| def freq(self): | ||
| """Return or set the data in the frequency domain.""" | ||
| return _convert_from_standard_definition(Signal.freq.fget(self), | ||
| self.normalization, | ||
| self.channel_convention) | ||
|
|
||
| @freq.setter | ||
| def freq(self, value): | ||
| """Return or set the data in the frequency domain.""" |
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.
| @property | |
| def freq(self): | |
| """Return or set the data in the frequency domain.""" | |
| return _convert_from_standard_definition(Signal.freq.fget(self), | |
| self.normalization, | |
| self.channel_convention) | |
| @freq.setter | |
| def freq(self, value): | |
| """Return or set the data in the frequency domain.""" |
I have the feeling that this is here by mistake?
| match="Invalid basis type, only " | ||
| "'complex' and 'real' are supported"): |
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.
unrelated, please keep the diff clean.
change names change order of parameters add parameter documentation
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! I only found a repeating typo and made a suggestion for shortening a line in the tests.
spharpy/classes/audio.py
Outdated
| cls, sh_definition, data, times, comment="", is_complex=False): | ||
| r""" | ||
| Create a SphericalHarmonicTimeData class object from | ||
| SphericalHarmonicsDefinition object, data, and times. |
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.
| SphericalHarmonicsDefinition object, data, and times. | |
| SphericalHarmonicDefinition object, data, and times. |
spharpy/classes/audio.py
Outdated
| cls, sh_definition, data, frequencies, comment=""): | ||
| r""" | ||
| Create a SphericalHarmonicFrequencyData class object from | ||
| SphericalHarmonicsDefinition object, data, and frequencies |
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.
| SphericalHarmonicsDefinition object, data, and frequencies | |
| SphericalHarmonicDefinition object, data, and frequencies |
spharpy/classes/audio.py
Outdated
| fft_norm='none', comment="", is_complex=False): | ||
| r""" | ||
| Create a SphericalHarmonicsSignal class object from | ||
| SphericalHarmonicsDefinition object, data, and sampling |
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.
| SphericalHarmonicsDefinition object, data, and sampling | |
| SphericalHarmonicDefinition object, data, and sampling |
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 review. While fixing this typo I realized that I generally used spherical harmonic / harmonicS quite interchangeably. Actually, we (mostly I) used it interchangeably throughout multiple docstrings. I will probably take care in a separate PR.
| assert not deepdiff.DeepDiff( | ||
| time_data_def.__dict__, time_data.__dict__) |
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.
Could we use assert time_data == time_data_def here? I think we overloaded the == operator.
| assert not deepdiff.DeepDiff( | ||
| freq_data_def.__dict__, freq_data.__dict__) |
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.
see above
| assert not deepdiff.DeepDiff( | ||
| signal_def.__dict__, signal.__dict__) |
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.
see above
ahms5
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.
looks good, just a very tiny remark,
| match="Invalid basis type, only " | ||
| "'complex' and 'real' are supported"): |
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.
| match="Invalid basis type, only " | |
| "'complex' and 'real' are supported"): | |
| match="Invalid basis type, only " | |
| "'complex' and 'real' are supported"): |
unrelated change
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.
I think the failing tests for python 3.12 and 3.13 are caused by Unidata/netcdf4-python#1461 (noted by Anton on slack).
To fix tests for 3.11 you probably have to merge develop into your branch to get #259.
Otherwise approved.
Changes proposed in this pull request:
Note: Tests are failing because of #259