CI-CMG / pyEcholab

pyEcholab is an open-source, Python-based toolkit for reading, processing, plotting and exporting fisheries acoustic echosounder data. The goal for this project is to become a community resource the grows through community involvement and contribution.
Other
37 stars 23 forks source link

'Frequency' assignment assumes center frequency #61

Closed leviner closed 2 years ago

leviner commented 2 years ago

For FM channels, frequency is assigned as the center frequency, which is likely not the typical case given the ranges used for common transducers. There are two spots where I think this is assigned:

line 3361 in EK80.py

# Adjust sensitivities for FM
if cal_parms['frequency'] is None:
    fc = (cal_parms['frequency_start'] + cal_parms['frequency_end']) / 2
    fc /= cal_parms['transducer_frequency']

and again at line 3674:

if self.is_fm(all=True):
  # All of the pings are FM
  frequency = (self.frequency_start + self.frequency_end) / 2.0

This seems to be carried over into the power_data.frequency used in Sv calculations (line 4052) and not corrected when applying an ecs file. First as expected when loading a file with a single 70 kHz FM channel: image

If I just calculate the power using the default parameters: image

If I read in an ecs file, frequency returns nothing, though the transducer frequency is now set: image

I'm happy to help pick through this, but I'm not sure the best approach. One simple alternative would be to use the transducer_frequency from the configuration and otherwise allow someone to reassign the nominal frequency for Sv calculations.

leviner commented 2 years ago

This was my mistake, I thought you were tracking fnom in the 'frequency' parameter not fc