Commit 98a8b84f authored by mikelovskij's avatar mikelovskij

updated the isCavStable method so that it works even if there are other detectors in the kat

parent 2df4c4f6
......@@ -773,20 +773,29 @@ def c2r_errsig(z, phase):
return np.real(z*np.exp(-1j*phase*np.pi/180.0))
def isCavsStable(kat):
isStable = True
is_stable = True
kat1 = kat.deepcopy()
code = ''
cp_names = []
for cav in kat1.getAll(pykat.commands.cavity):
code += 'cp {0} x m\ncp {0} y m\n'.format(cav)
code += 'noxaxis'
out =
ymax = np.abs(out.y).max()
cp_outs = []
for name in cp_names:
ymax = np.abs(cp_outs).max()
if ymax >= 1:
isStable = False
return isStable, ymax
is_stable = False
return is_stable, ymax
def opt_demod_phase(cdata, x, xbounds=None, err_tol=1e-5, xatol=1e-9, isplot=False):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment