OSOceanAcoustics / echopype

Enabling interoperability and scalability in ocean sonar data analysis
https://echopype.readthedocs.io/
Apache License 2.0
98 stars 73 forks source link

Scaling of CW-based beamwidth parameters inverted #997

Closed leewujung closed 1 year ago

leewujung commented 1 year ago

In v0.6.4, the functionality to calibrate broadband Sv was overhauled. However, I just discovered one bug: the scaling of beamwidth parameters (beam_width_alongship and beam_width_athwartship) based on the center frequency of each ping wrt the nominal frequency of a given channel is inverted.

In the current (wrong) implementation, the higher the center frequency, the larger the beamwidth -- this is the opposite of what should happen.

I will create a patch to fix this ASAP and issue a v0.6.4.2 patch. ~However this means that the current tests against pyEcholab values are no longer valid. I will look into testing against Echoview values (while developing v0.6.4 I opted for testing against pyEcholab for band-averaged Sv).~ Turns out for that particular file used in test_calibrate_ek80.py, there was no need to scale CW-based cal parameters (stored in the Sonar/Beam_groupX group) because those cal parameters happen to exist in a frequency-dependent form (stored in the Vendor-specific group) for the BB channels. (To elaborate: scaling is only needed if a particular parameter is not available in the frequency-dependent form and needs to be estimated from CW-based values.)

I also noted this in an issue in pyEcholab here: https://github.com/CI-CMG/pyEcholab/issues/66.

leewujung commented 1 year ago

This is addressed in #998.