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

test_fsig.py

Blame
    • 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_knm.py 979 B
    from pykat import *
    from pykat.utilities.knm import knmHG, makeCouplingMatrix, plot_knm_matrix
    from pykat.utilities.maps import aperturemap
    import numpy as np
    import time
    
    q1 = beam_param(w0=5e-2, z=0)
    q2 = beam_param(w0=5e-2, z=0)
    
    aperture = 0.1
    s = 1000
    size = np.array([s, s])
    stepsize = 0.3/(size-1)
    smap = aperturemap("tilt", size, stepsize, aperture)
    
    couplings = makeCouplingMatrix(1)
    
    params = {"usepolar":True, "aperture":aperture, "epsabs": 1e-3, "epsrel": 1e-3}
    
    t0 = time.time()
    kbh = knmHG(couplings, q1, q2, method="adaptive", verbose=True, params=params)
    print time.time() - t0
    
    t0 = time.time()
    kr = knmHG(couplings, q1, q2, surface_map=smap, method="riemann", verbose=True)
    print time.time() - t0
    
    smap.generateROMWeights(isModeMatched=True, verbose=True)
    t0 = time.time()
    krm = knmHG(couplings, q1, q2, surface_map=smap, method="romhom")
    print time.time() - t0
    
    print kbh
    print kr
    print krm
    
    plot_knm_matrix(couplings, np.log10(np.abs(kbh - kr)))
    
    print params