コード例 #1
0
import sys
import math
import random
import time

from orbit.py_linac.linac_parsers import SNS_LinacLatticeFactory

from bunch import Bunch

from orbit.lattice import AccLattice, AccNode, AccActionsContainer

from orbit.py_linac.orbit_correction import TrajectoryCorrection

names = ["HEBT1", "HEBT2"]
#---- create the factory instance
sns_linac_factory = SNS_LinacLatticeFactory()
sns_linac_factory.setMaxDriftLength(0.5)

#---- the XML file name with the structure
xml_file_name = "../sns_linac_xml/sns_linac.xml"

#---- make lattice from XML file
accLattice = sns_linac_factory.getLinacAccLattice(names, xml_file_name)

print "Linac lattice is ready. L=", accLattice.getLength()

#----------------------------------------------------------
# Set Linac style quads and drifts instead of TEAPOT style
# That can be useful when energy spread is huge and TEAPOT
# accuracy is not enough for tracking.
# This will slow down tracking and it is not symplectic.
コード例 #2
0
xml_file_name = "../sns_linac_xml/sns_linac.xml"
sns_lattice_da = XmlDataAdaptor.adaptorForFile(xml_file_name)

dtl_da = getChildDA(sns_lattice_da, "DTL3")

#---- make vacuum window node and add it to the end of the DTL
window_length = 0.005
pos = dtl_da.doubleValue("length") - window_length - 0.00001
vacwin_node = make_vacwin_da("DTL:VACWIN", window_length, pos)
dtl_da.addChildAdaptor(vacwin_node)

#---- print a structure of the new data adaptor DTL3
#print dtl_da.makeXmlText()

#---- create the factory instance
sns_linac_factory = SNS_LinacLatticeFactory()
sns_linac_factory.setMaxDriftLength(0.1)

#---- make lattice from XML file
names = ["MEBT", "DTL1", "DTL2", "DTL3"]
sns_lattice = sns_linac_factory.getLinacAccLatticeFromDA(names, sns_lattice_da)

bunch = Bunch()
bunch.readBunch("bunch_at_mebt_start.dat")

lostbunch = Bunch()
paramsDict = {
    "lostbunch": lostbunch,
}

sns_lattice.trackDesignBunch(bunch)
コード例 #3
0
]
names = [
    "SCLMed",
]
names = [
    "MEBT",
]

#---- the XML file name with the structure
xml_file_name = "../sns_linac_xml/sns_linac.xml"

#---- RF axis fields files location
rf_field_location = "../sns_rf_fields/"

#---- create the factory instance
sns_linac_factory = SNS_LinacLatticeFactory()
sns_linac_factory.setMaxDriftLength(0.1)


def getQuadFiledsDistribution(seq_name,xml_file_name,rf_field_location, \
                             use_overlapped_fields = False, reverse_latt = False):

    accLattice = sns_linac_factory.getLinacAccLattice([
        seq_name,
    ], xml_file_name)
    print "debug seq=", seq_name, " Length [m] =", accLattice.getLength()

    if (use_overlapped_fields):

        #---- longitudinal step along the distributed fields lattice
        z_step = 0.005
コード例 #4
0
It also will measure how fast we parsing.
"""

import sys
import time

from orbit.py_linac.linac_parsers import SNS_LinacLatticeFactory

# import acc. nodes
from orbit.py_linac.lattice import Quad, Drift, Bend, BaseRF_Gap

# import the XmlDataAdaptor XML parser
from orbit.utils.xml import XmlDataAdaptor

#---- create the factory instance
sns_linac_factory = SNS_LinacLatticeFactory()

#---- set the maximal drift length - sometimes it is useful for diagnostics
sns_linac_factory.setMaxDriftLength(0.05)
print "Lattice max drift length =", sns_linac_factory.getMaxDriftLength()

print "============================================="

#---- define the sequences in the linac accelerator lattice
names = [
    "MEBT", "DTL1", "DTL2", "DTL3", "DTL4", "DTL5", "DTL6", "CCL1", "CCL2",
    "CCL3", "CCL4", "SCLMed", "SCLHigh", "HEBT1", "HEBT2"
]

#---- the XML file name with the structure
xml_file_name = "../sns_linac_xml/sns_linac.xml"
コード例 #5
0
from orbit.py_linac.overlapping_fields import EngeFunction, SNS_MEBT_OverlappingQuadsSubst
from orbit.py_linac.overlapping_fields import OverlappingQuadsController
from orbit.py_linac.overlapping_fields import getGlobalField

from orbit.py_linac.linac_parsers import SNS_LinacLatticeFactory

#-------------------------------------------
# START of Script
#-------------------------------------------

names = ["MEBT",]

py_orbit_sns_home = "../"

#---- create the factory instance
sns_linac_factory = SNS_LinacLatticeFactory()
sns_linac_factory.setMaxDriftLength(0.01)

#---- the XML file name with the structure
xml_file_name = py_orbit_sns_home+"sns_linac_xml/sns_linac.xml"

#---- make lattice from XML file 
accLattice = sns_linac_factory.getLinacAccLattice(names,xml_file_name)

print "Linac lattice is ready. L=",accLattice.getLength()

length = accLattice.getLength()
step = 0.001
n_points = int(length/step) + 1
res_z_G0_G_arr = []
for ind in range(n_points):
コード例 #6
0
"""
This is a test script to check the functionality of the SNS linac parser.
It also will measure how fast we parsing.
"""

import sys
import time

from orbit.py_linac.linac_parsers import SNS_LinacLatticeFactory

# import the XmlDataAdaptor XML parser
from orbit.utils.xml import XmlDataAdaptor

#---- create the factory instance
sns_linac_factory = SNS_LinacLatticeFactory()

#---- set the maximal drift length - sometimes it is useful for diagnostics
sns_linac_factory.setMaxDriftLength(0.05)
print "Lattice max drift length =",sns_linac_factory.getMaxDriftLength()

print "============================================="

#---- define the sequences in the linac accelerator lattice
names = ["MEBT","DTL1","DTL2","DTL3","DTL4","DTL5","DTL6","CCL1","CCL2","CCL3","CCL4","SCLMed","SCLHigh","HEBT1","HEBT2"]
#names = ["MEBT","DTL1","DTL2","DTL3","DTL4","DTL5","DTL6","CCL1","CCL2","CCL3","CCL4"]

#---- the XML file name with the structure
xml_file_name = "../sns_linac_xml/sns_linac.xml"
acc_da = XmlDataAdaptor.adaptorForFile(xml_file_name)