Changes between Version 9 and Version 10 of misc/setup_for_ML/example_beamsize


Ignore:
Timestamp:
09/13/23 23:16:38 (10 months ago)
Author:
obina
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • misc/setup_for_ML/example_beamsize

    v9 v10  
    2323=== GPyOptによるビームサイズ最小化 === 
    2424コードをそのまま書きます。本当は適切にクラス化するべきですが、 
    25 この長さならベタ書きで分かると思うので global 変数を使ってQMのk値を関数側で変えてしまいます 
     25この長さならベタ書きで分かると思うので分かりやすさ(?)優先で 
    2626 
    2727また、実際にはターゲットとなるビームサイズを定義する方が良いでしょう。 
     
    4848    cell = (L50, QM1, L20, QM2, L50, L50) 
    4949    lat = MagneticLattice(cell, stop=None) 
    50     # print("length of the cell: ", lat.totalLen, " m") 
    51     # Initial condition 
     50    ## Initial condition 
    5251    tws0 = Twiss() 
    5352    tws0.beta_x = 20.0 
     
    5857    tws0.emit_y = 1.0 
    5958    tws0.E = 1.0 
    60     # update optics 
     59    ## update optics 
    6160    lat.update_transfer_maps() 
    6261    tws = twiss(lat, tws0, nPoints=1000) 
     
    8584def eval_func(x): 
    8685    global cnt 
    87  
    8886    x0 = x[0][0] 
    8987    x1 = x[0][1] 
     
    9189    sx, sy, tws = calc_resp(x0, x1) # calc optics for 2 QM 
    9290 
    93     # Evaluation Function Example 
     91    # Evaluation Function Examples 
    9492    val = np.abs(sx) + np.abs(sy) 
    9593    # val = np.abs(sx*sy)