ccamlr / SDWBA_TS

Stochastic distorted wave born approximation
2 stars 1 forks source link

Parameterization by length in BSTS_SDWBA.m #1

Open jrenfree opened 1 year ago

jrenfree commented 1 year ago

Hi,

In Conti and Demer (2006) and Calise and Skaret (2011), the equations for computing the number of cylinders and phase standard deviation are functions of the krill length and incident frequency:

$$N=N_0 \frac{f L}{f_0 L_0}$$

$$sd{\phi}=sd{\phi_0} \frac{N_0 L}{N L_0}$$

However, in the BSTS_SDWBA.m script, the equations exclude the length terms, and are instead computed as:

$$N=N_0 \frac{f}{f_0}$$

$$sd{\phi}=sd{\phi_0} \frac{N_0}{N}$$

So I'm curious as to why the length terms are left out. I understand that the krill shape vectors are resized to the desired length, but I don't think this would affect how the number of cylinders is computed, as that resized krill shape would still require a certain number of cylinders to maintain the desired ratio of wavelength to the length of each cylinder.

gavinmacaulay commented 1 year ago

The length-less versions of those equations were in the original version of the code in this repository (see here) and appear to have been carried through in subsequent versions.

I wonder if the setting of the number of cylinders is done elsewhere in the code?

The question as to why is perhaps best asked of S. Conti and/or L. Carlise.

jrenfree commented 1 year ago

I emailed Lucio yesterday, but haven't heard back yet, and not completely sure I had the correct email address. Not sure how to contact Stephane, but I'll cc @ddemer here in case he knows, or perhaps knows the answer to this question.

I can't see any other place that the number of cylinders might be set. In the file 'GUI_Estimation_SDWBA2010_TS.m', Lines 705-707 scale the default krill shape to the defined length, then Line 723 calls the BSTS_SDWBA.m function to calculate the TS.

In the BSTS_SDWBA function, Line 85 computes the desired number of cylinders, Line 97 the desired standard deviation of the phase, then on Line 100 it calls the function to resample the krill shape to use the desired number of cylinders calculated on Line 85.

I don't see anything in the Shape_resampling_2010.m function that alters the number of cylinders that gets passed to it from the BSTS_SDWBA function.

Everything else seems fairly straightforward.

Thanks.

gavinmacaulay commented 1 year ago

It looks like the only place where the number of cylinders could be changed is in GUI_Estimation_SDBBA2010_TS.m, but only manually via the GUI.

jrenfree commented 1 year ago

I've had some back-and-forth conversations with Stephane, which I'll try my best to summarize here, and hopefully accurately describe the situation.

It sounds like Stephane's original code was intended to derive TS for the standard 38.35-mm krill, in which case the length, $L$, is equal to the reference length, $L0$, and the equations for $N$ and $sd{\phi}$ defined in Equations 8 and 9 from Conti and Demer (2006) simplify to the equations used in the function BSTS_SDWBA(), which do not contain length terms.

The TS computed from the standard 38.35-mm krill, $TS_{L_0}$, can then be used to derive the TS for a krill of length $L$ by matching $kL$ values and compensating for the change in length:

$$TS{L}(kL) = TS{L0}(kL)-20log{10}({L_0 \over L})$$

Or in terms of frequency:

$$TS{L}(f) = TS{L_0}(f{L \over L0})-20log{10}({L_0 \over L})$$

This is effectively Equation 10 from Conti and Demer (2006), and what the "GUI_Orientation_SDWBA2010_TS" program is doing, except that $TS_{L0}$ is replaced by a polynomial fit to the $TS{L_0}$ derived from "GUI_Estimation_SDWBA2010_TS".

A couple issues I foresee are:

  1. If trying to compute TS using the BSTS_SDWBA() function for a krill shape where $L \neq L0$, the computations for $N$ and $sd{\phi}$ do not adhere to Equations 8 and 9 from Conti and Demer (2006).
  2. The BSTS_SDWBA() function is coded such that if the computed $N$ is less than $N0$, then $N$ and $sd{\phi}$ are set to $N0$ and $sd{\phi0}$. This makes the relationships in Equations 5 and 7 from Conti and Demer (2006) break down. Moreover, once the frequency or length increases enough to cause $N$ to change from 14 to 15, the $sd{\phi}$ can abruptly change, resulting in a large jump in the TS spectra.

To test the effects of (1), I computed the TS for a 20-mm krill at 200 kHz (kL=16.8) at a 60-degree incidence angle using three different methods: (1) the current BSTS_SDWBA() function, (2) a modified version of BSTSSDWBA(), which I'll call Renfree() and includes length terms for calculating $N$ and $sd{\phi}$, and (3) using BSTS_SDWBA() to compute $TS_{L0}$ then deriving $TS{L}$ as in the above equation. For each method, the TS were averaged over 100 random iterations, with the random number generator reset each time to obtain comparable results. The resulting TS were:

Method 1: -96.28 dB Method 2: -90.77 dB Method 3: -90.77 dB

The method of compensating $TS_{L_0}$ for a krill of length $L$ matches exactly the Renfree() function which includes the length terms, while the current version of BSTS_SDWBA() differs by nearly 6 dB. The former match exactly because the $N$ and $sd_{\phi}$ get set to the defaults of 14 and 0.71, respectively, while the latter is 24 and and 0.41.

To look at the effects of (2), I computed the TS spectra for a 20-mm krill at a 60-degree incidence angle, with the TS at each frequency computed from the average of 50 random iterations. The spectra are overlaid with the values of $N$ and $sd_{\phi}$. image image

All three match closely for kL<12. From ~12<kL<19, the "Renfree" and "CCAMLR_38.35mm" models deviate from the "CCAMLR_25mm" model, then at ~kL=19 the "Renfree" model abruptly converges with "CCAMLR_25mm". The deviation of "CCAMLR25mm" from 12<kL<19 is due to $N$ and $sd{\phi}$ modulating from the default values. The "Renfree" model jumps lower at kL=19 when $N$ changes from 14 to 15, which causes a significant change in $sd_{\phi}$ to match that for "CCAMLR_25mm", causing them to converge. They then continue to match each other whereas the "CCAMLR38.35mm" $sd{\phi}$ and TS remain notably higher.

If I modify the "Renfree" model to compute $sd{\phi}$ according to Equation 5 in Conti and Demer: $$sd{\phi}(f)f = sd_{\phi_0} f_0$$

while maintaining a minimum of 14 cylinders, I obtain the following: image

The "Renfree modified" model closely matches the "CCAMLR_25mm" except for low kL (<6).

So then the question is which method is accurate. The issue seems to arise when the the $L$ or $f$ are small enough to cause $N$ to hit the lower limit of $N0$, which causes $sd{\phi}$ to stop modulating with $L$ or $f$ and affects the computation of TS. In this case, the current BSTSSDWBA() might be generally OK as $N$ and $sd{\phi}$ begin modulating for comparatively lower kL due to the computation of $N$ not including the length terms, but I'm not sure it's accurate for low kL when $sd_{\phi}$ remains static independent of frequency.

Apologies in advance if I'm misinterpreting anything or not correctly understanding the issue.