From 52e481abc57aa59f6ee261e621a7b04aae27b9a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Fri, 28 Oct 2016 16:33:44 +0200 Subject: [PATCH] Accelerated calculations in fitSourceModel. --- pylot/core/analysis/magnitude.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pylot/core/analysis/magnitude.py b/pylot/core/analysis/magnitude.py index 6bf2f293..026bf864 100644 --- a/pylot/core/analysis/magnitude.py +++ b/pylot/core/analysis/magnitude.py @@ -646,7 +646,18 @@ def fitSourceModel(f, S, fc0, iplot, verbosity=False): # vary corner frequency around initial point print("fitSourceModel: Varying corner frequency " "around initial corner frequency ...") - for i in range(il, ir, 10): + print il, ir + # check difference of il and ir in order to + # keep calculation time acceptable + idiff = ir - il + if idiff > 10000: + increment = 100 + elif idiff <= 20: + increment = 1 + else: + increment = 10 + + for i in range(il, ir, increment): FC = f[i] indexdc = np.where((f > 0) & (f <= FC)) dc = np.mean(S[indexdc])