Skip to content

Conversation

@tluebeck
Copy link

@tluebeck tluebeck commented Dec 15, 2025

Changes proposed in this pull request:

  • add SphericalHarmonics constructor which creates SH signal from SHdefinition object

Note: Tests are failing because of #259

Copy link
Member

@mberz mberz left a 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

Comment on lines 243 to 245
def from_spherical_harmonics_definition(
cls, data, times, sh_definition, domain='time',
fft_norm='none', comment="", is_complex=False):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Comment on lines 247 to 249
Create a SphericalHarmonicsSignal class object from
SphericalHarmonicsDefinition object, data, and sampling
rate.
Copy link
Member

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.

Suggested change
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

Comment on lines 479 to 488
@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."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@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?

Comment on lines 131 to 132
match="Invalid basis type, only "
"'complex' and 'real' are supported"):
Copy link
Member

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.

@mberz mberz changed the title add SphericalHarmonicsSignal constructor [ENH] Classmethod to create SphericalHarmonicsSignal from SphericalHarmonicDefinitoon Dec 19, 2025
change names
change order of parameters
add parameter documentation
@tluebeck tluebeck marked this pull request as ready for review December 22, 2025 11:53
@tluebeck tluebeck changed the title [ENH] Classmethod to create SphericalHarmonicsSignal from SphericalHarmonicDefinitoon [ENH] Classmethod to create SphericalHarmonicSignal from SphericalHarmonicDefinition Dec 22, 2025
Copy link
Member

@f-brinkmann f-brinkmann left a 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.

cls, sh_definition, data, times, comment="", is_complex=False):
r"""
Create a SphericalHarmonicTimeData class object from
SphericalHarmonicsDefinition object, data, and times.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SphericalHarmonicsDefinition object, data, and times.
SphericalHarmonicDefinition object, data, and times.

cls, sh_definition, data, frequencies, comment=""):
r"""
Create a SphericalHarmonicFrequencyData class object from
SphericalHarmonicsDefinition object, data, and frequencies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SphericalHarmonicsDefinition object, data, and frequencies
SphericalHarmonicDefinition object, data, and frequencies

fft_norm='none', comment="", is_complex=False):
r"""
Create a SphericalHarmonicsSignal class object from
SphericalHarmonicsDefinition object, data, and sampling
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SphericalHarmonicsDefinition object, data, and sampling
SphericalHarmonicDefinition object, data, and sampling

Copy link
Author

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.

Comment on lines 61 to 62
assert not deepdiff.DeepDiff(
time_data_def.__dict__, time_data.__dict__)
Copy link
Member

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.

Comment on lines 100 to 101
assert not deepdiff.DeepDiff(
freq_data_def.__dict__, freq_data.__dict__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

Comment on lines 48 to 49
assert not deepdiff.DeepDiff(
signal_def.__dict__, signal.__dict__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

Copy link
Member

@ahms5 ahms5 left a 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,

Comment on lines 129 to 130
match="Invalid basis type, only "
"'complex' and 'real' are supported"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
match="Invalid basis type, only "
"'complex' and 'real' are supported"):
match="Invalid basis type, only "
"'complex' and 'real' are supported"):

unrelated change

@tluebeck tluebeck requested a review from f-brinkmann January 5, 2026 12:09
Copy link
Member

@f-brinkmann f-brinkmann left a 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.

Copy link
Member

@mberz mberz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found another typo. ;)

@github-project-automation github-project-automation bot moved this from Backlog to Reviewer Approved in Weekly Planning Jan 21, 2026
@mberz mberz added the enhancement New feature or request label Jan 21, 2026
@mberz mberz merged commit 68d54a9 into develop Jan 21, 2026
7 of 10 checks passed
@github-project-automation github-project-automation bot moved this from Reviewer Approved to Done in Weekly Planning Jan 21, 2026
@mberz mberz deleted the feature/add_sh_audio_constructors branch January 21, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feature

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants