Coastal-Imaging-Research-Network / cBathy-Toolbox

Routines needed to run cBathy + demos
https://github.com/Coastal-Imaging-Research-Network/cBathy-toolbox/wiki/cBathy-User-Manual
GNU General Public License v3.0
25 stars 23 forks source link

nlinfit version issue #57

Open RobHolman opened 5 years ago

RobHolman commented 5 years ago

@KateBrodie @mpalmsten @jstanleyx @bergsmaE - I've been doing a lot of work on cBathy and will send out a summary in a while. But I stumbled on a small item that slows the code a ton. If you don't have the stats toolbox, the code should opt for using the alternate LMFit routine. It knows this by asking for ver('stats'). The bad news is that it asks this for every tile while doing bathyFromKAlpha.m and again in bathyCI.m (but strangely enough, not in csmInvertKAlpha.m. When I did a run time profile I found just these 'ver' calls add about 90 s to a typical cBathy analysis. As an alternate, I suggest adding if isempty(ver('stats')) bathy.params.nlinfit = 0; end at the beginning of analyzeBathyCollect.m so it is only called once. Then change the previous checks in bathyFromKAlpha.m and bathyCI.m to just check for the params.nlinfit flag.
I would do this change but my code is so different from this version that I will do it as V1.3 when I tidy things up. And I haven't seriously tested this fix.

mpalmsten commented 5 years ago

Thanks for catching that. We also need to find a better open source Levenburg-Marquardt solver. See issue 47 about that:

https://github.com/Coastal-Imaging-Research-Network/cBathy-Toolbox/issues/47