Skip to content
Snippets Groups Projects
Select Git revision
  • 2c40a2e4c24cf413a476e017304b61c574a5e266
  • master default
2 results

test_fsig.py

Blame
  • Forked from finesse / pykat
    Source project has a limited visibility.
    • Daniel Brown's avatar
      4d173029
      adding in fsig command (not parsing yet). See example test_fsig.py in bin... · 4d173029
      Daniel Brown authored
      adding in fsig command (not parsing yet). See example test_fsig.py in bin folder. Also made component variable an optional argument for xaxis and x2axis which will break previous scripts. Did this as when setting the parameter to tune, the Param object contains whatever component owns that parameter so no need to pass it twice. Also stops someone passing a parameter not for the component stated.
      4d173029
      History
      adding in fsig command (not parsing yet). See example test_fsig.py in bin...
      Daniel Brown authored
      adding in fsig command (not parsing yet). See example test_fsig.py in bin folder. Also made component variable an optional argument for xaxis and x2axis which will break previous scripts. Did this as when setting the parameter to tune, the Param object contains whatever component owns that parameter so no need to pass it twice. Also stops someone passing a parameter not for the component stated.
    test_fsig.py 1.02 KiB
    from pykat import finesse
    from pykat.detectors import *
    from pykat.components import *
    from pykat.commands import *
    from pykat.structs import *
    
    import numpy as np
    import pylab as pl
    
    code = """
    l l1 2 0 n1
    m m1 0.99 0.01 0 n1 n2
    s cav1 1200 n2 n3
    m m2 0.99 0.01 -0.1 n3 n4
    
    attr m2 m 1  # mech sus1
    
    ad up_refl 0 n1
    ad low_refl 0 n1
    
    qd refl_A 0 0 n1
    qd refl_Q 0 90 n1
    qd tran_A 0 0 n4
    qd tran_Q 0 90 n4
    
    put up_refl f $x1
    put low_refl f $mx1
    
    yaxis log re:im
    """
    
    kat = finesse.kat(kat_code=code)
    
    kat.signals.apply(kat.l1.power, 1, 0)
    kat.signals.apply(kat.m1.phi, 1, 90)
    
    kat.add(xaxis('log', [1, 1000], kat.signals.f, 100))
    
    out = kat.run(printout=0, printerr=0)
    
    # using real and imag part compute the complex value of the upper and lower sidebands
    a_up = out.y[:,0] + out.y[:,1]*1j
    a_lo = out.y[:,2] + out.y[:,3]*-1j
    
    pl.figure(1)
    pl.loglog(out.x, np.abs(a_up + a_lo), out.x, np.abs((a_up - a_lo) / (1j)))
    pl.xlabel(out.xlabel)
    pl.title("Reflection quadratures with no relative carrier phase")
    pl.legend(["Amplitude","Phase"])
    pl.show()