Skip to content
Snippets Groups Projects
Select Git revision
  • 10cce382bffd5210c8ec00809e64aee30f83d7cd
  • master default protected
  • legacy
  • jdk-17.0.13-ga-legacy
  • jdk-17.0.14+4
  • jdk-17.0.14+3
  • jdk-17.0.14+2
  • jdk-17.0.14+1
  • jdk-17.0.13-ga
  • jdk-17.0.13+11
  • jdk-17.0.13+10
  • jdk-17.0.13+9
  • jdk-17.0.13+8
  • jdk-17.0.13+7
  • jdk-17.0.13+6
  • jdk-17.0.14+0
  • jdk-17.0.13+5
  • jdk-17.0.13+4
  • jdk-17.0.13+3
  • jdk-17.0.13+2
  • jdk-17.0.13+1
  • jdk-17.0.13+0
  • jdk-17.0.12-ga
23 results

building.md

Blame
  • 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