forked from jbengtsson/thor-scsi-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] added tests checking calling signature of digital twin
Functional tests pending
- Loading branch information
1 parent
11cf5b6
commit 4b900a4
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from thor_scsi.utils import canonical_variables_mapping_default | ||
from thor_scsi.utils.linear_optics import compute_Twiss_along_lattice | ||
from thor_scsi.factory import accelerator_from_config | ||
from thor_scsi import lib as tslib | ||
import gtpsa | ||
import pytest | ||
from pathlib import Path | ||
import os.path | ||
|
||
desc = gtpsa.desc(6, 1) | ||
|
||
path = ( | ||
Path(os.path.dirname(__file__)) | ||
/ "lattices" | ||
/ "b2_stduser_beamports_blm_tracy_corr.lat" | ||
) | ||
|
||
|
||
def create_acc(): | ||
acc = accelerator_from_config(path) | ||
acc.set_log_level(tslib.accelerator_log_level.warning) | ||
return acc | ||
|
||
|
||
def test_twiss_without_radiation(): | ||
"""Functions as used by digital twin""" | ||
n_dof = 2 | ||
calc_config = tslib.ConfigType() | ||
calc_config.radiation = False | ||
calc_config.Cavity_on = False | ||
acc = create_acc() | ||
compute_Twiss_along_lattice( | ||
n_dof, acc, calc_config, desc=desc, mapping=canonical_variables_mapping_default | ||
) | ||
|
||
|
||
@pytest.mark.skip | ||
def test_twiss_with_radiation(): | ||
"""Functions as used by digital twin | ||
just check that it runs | ||
""" | ||
calc_config = tslib.ConfigType() | ||
n_dof = 3 | ||
calc_config.radiation = True | ||
calc_config.Cavity_on = True | ||
calc_config.Energy = 2.7 | ||
acc = create_acc() | ||
compute_Twiss_along_lattice( | ||
n_dof, acc, calc_config, desc=desc, mapping=canonical_variables_mapping_default | ||
) |