Example #1
0
	def readData(self, url):
		ws_lw_acquisition_controller = self.linac_wizard_document.getWS_LW_Controller()
		da = XmlDataAdaptor.adaptorForUrl(url,false)
		root_da = da.childAdaptor("LINAC_Wizard")		
		title = root_da.stringValue("Title")
		seqNames = root_da.stringValue("AccSequence").split()
		if(len(seqNames) != 0): 
			#------set up selected names in the SetUp tables
			linac_setup_controller	= self.linac_wizard_document.getSetUp_Controller()
			linac_setup_controller.setSelectedSequences(seqNames[0],seqNames[len(seqNames)-1])
			#-----------------------------------------------
			lst = ArrayList()
			for seqName in seqNames:
				lst.add(self.accl.getSequence(seqName))
			accSeq = AcceleratorSeqCombo("SEQUENCE", lst)
			self.linac_wizard_document.ws_lw_controller.cleanOldWSdata()
			self.linac_wizard_document.setAccSeq(accSeq)
			nodes = accSeq.getAllNodes(true)
			name_to_node_dict = {}
			for node in nodes:
				name_to_node_dict[node.getId()] = node	
			#-----add cavities to the nodes dictinary ------------
			for cav in ws_lw_acquisition_controller.cavs:
				name_to_node_dict[cav.getId()] = cav	
			#----read WS or LW wave_form data
			self.readData_WS_LW_Records(root_da,name_to_node_dict)
			#----read Initial Twiss and beam parameters
			self.readTransverseTwiss(root_da)
		#---- read SCL Phase Scan data
		self.linac_wizard_document.scl_long_tuneup_controller.clean()
		self.linac_wizard_document.scl_long_tuneup_controller.readDataFromXML(root_da)		
		self.linac_wizard_document.scl_long_tuneup_controller.updateAllTables()
Example #2
0
 def readData(self, url):
     monitor_controller = self.event_monitor_document.monitor_controller
     monitor_controller.event_holder.clean()
     monitor_controller.events_table.getModel().fireTableDataChanged()
     #------- event handler configuration
     event_handler = monitor_controller.event_handler
     event_handler.clean()
     da = XmlDataAdaptor.adaptorForUrl(url, false)
     root_da = da.childAdaptor("Event_Monitor")
     buff_size_time = root_da.doubleValue("buff_size_time")
     event_buff_size = root_da.doubleValue("event_buff_size")
     min_limit = root_da.doubleValue("min_limit")
     max_limit = root_da.doubleValue("max_limit")
     trigger_pv_name = root_da.stringValue("triggerPV")
     eventDir = root_da.stringValue("eventDir")
     monitor_controller.buffer_size_text.setValue(buff_size_time)
     monitor_controller.event_buffer_size_text.setValue(event_buff_size)
     monitor_controller.min_limit_text.setValue(min_limit)
     monitor_controller.max_limit_text.setValue(max_limit)
     event_handler.setTriggerMonitor(trigger_pv_name)
     monitor_controller.pvTriggerJText.setText(trigger_pv_name)
     monitor_controller.dumpDirJText.setText(eventDir)
     for pv_da in root_da.childAdaptors():
         pv_name = pv_da.stringValue("pv_name")
         event_handler.addPV_Value_Monitor(pv_name)
     event_handler.setMonitoring(false)
     monitor_controller.sinceTimeJText.setText("Not Running.")
     monitor_controller.dump_button.setSelected(false)
     monitor_controller.pv_monitored_table.getModel().fireTableDataChanged()
	def readData(self, url):
		monitor_controller = self.event_monitor_document.monitor_controller
		monitor_controller.event_holder.clean()
		monitor_controller.events_table.getModel().fireTableDataChanged()
		#------- event handler configuration
		event_handler = monitor_controller.event_handler 
		event_handler.clean()
		da = XmlDataAdaptor.adaptorForUrl(url,false)
		root_da = da.childAdaptor("Event_Monitor")
		buff_size_time = root_da.doubleValue("buff_size_time") 
		event_buff_size = root_da.doubleValue("event_buff_size")
		min_limit = root_da.doubleValue("min_limit")
		max_limit = root_da.doubleValue("max_limit")
		trigger_pv_name = root_da.stringValue("triggerPV")
		eventDir = root_da.stringValue("eventDir")
		monitor_controller.buffer_size_text.setValue(buff_size_time)
		monitor_controller.event_buffer_size_text.setValue(event_buff_size)
		monitor_controller.min_limit_text.setValue(min_limit)
		monitor_controller.max_limit_text.setValue(max_limit)
		event_handler.setTriggerMonitor(trigger_pv_name)
		monitor_controller.pvTriggerJText.setText(trigger_pv_name)
		monitor_controller.dumpDirJText.setText(eventDir)
		for pv_da in root_da.childAdaptors():
			pv_name = pv_da.stringValue("pv_name")
			event_handler.addPV_Value_Monitor(pv_name)
		event_handler.setMonitoring(false)
		monitor_controller.sinceTimeJText.setText("Not Running.")
		monitor_controller.dump_button.setSelected(false)
		monitor_controller.pv_monitored_table.getModel().fireTableDataChanged()
	def readData(self, url):
		ws_lw_acquisition_controller = self.linac_wizard_document.getWS_LW_Controller()
		da = XmlDataAdaptor.adaptorForUrl(url,false)
		root_da = da.childAdaptor("LINAC_Wizard")		
		title = root_da.stringValue("Title")
		seqNames = root_da.stringValue("AccSequence").split()
		if(len(seqNames) != 0): 
			#------set up selected names in the SetUp tables
			linac_setup_controller	= self.linac_wizard_document.getSetUp_Controller()
			linac_setup_controller.setSelectedSequences(seqNames[0],seqNames[len(seqNames)-1])
			#-----------------------------------------------
			lst = ArrayList()
			for seqName in seqNames:
				lst.add(self.accl.getSequence(seqName))
			accSeq = AcceleratorSeqCombo("SEQUENCE", lst)
			self.linac_wizard_document.ws_lw_controller.cleanOldWSdata()
			self.linac_wizard_document.setAccSeq(accSeq)
			nodes = accSeq.getAllNodes(true)
			name_to_node_dict = {}
			for node in nodes:
				name_to_node_dict[node.getId()] = node	
			#-----add cavities to the nodes dictinary ------------
			for cav in ws_lw_acquisition_controller.cavs:
				name_to_node_dict[cav.getId()] = cav	
			#----read WS or LW wave_form data
			self.readData_WS_LW_Records(root_da,name_to_node_dict)
			#----read Initial Twiss and beam parameters
			self.readTransverseTwiss(root_da)
		#---- read SCL Phase Scan data
		self.linac_wizard_document.scl_long_tuneup_controller.clean()
		self.linac_wizard_document.scl_long_tuneup_controller.readDataFromXML(root_da)		
		self.linac_wizard_document.scl_long_tuneup_controller.updateAllTables()
Example #5
0
 def readWarm_Linac_RF_SetUp_Document(self, url):
     # here you put the initialization of the application from the XML file
     da = XmlDataAdaptor.adaptorForUrl(url, false)
     root_da = da.childAdaptor("Warm_Linac_SetUp")
     self.warm_linac_rf_setup_document.main_loop_controller.readDataFromXML(
         root_da)
Example #6
0
from java.net import URL

import sys

import os

sys.path.insert(0,"/Users/j72/git/openxal/core/src/xal/tools")

from pythonTools import urlFinder

urlDataFile = urlFinder.fetchURL("sns_pyorbit_linac_structure_untested.xml")

print(urlDataFile)

daptDoc = XmlDataAdaptor.adaptorForUrl(urlDataFile,False)

daptLinac = daptDoc.childAdaptor("SNS_Linac")
lstDaptSeq = daptLinac.childAdaptors("accSeq")
name_array = []
ttf_array = []
ttfp_array = []
stf_array = []
stfp_array = []
beta_array = []
with open("AndreiTTFData.DAT",'w') as Attf:
    Attf.truncate(0)
    for daptSeq in lstDaptSeq:
        strSeqId = daptSeq.stringValue("name")
        dblSeqLng = daptSeq.doubleValue("length")
        
	def readWarm_Linac_RF_SetUp_Document(self,url):
		# here you put the initialization of the application from the XML file 
		da = XmlDataAdaptor.adaptorForUrl(url,false)
		root_da = da.childAdaptor("Warm_Linac_SetUp")		
		self.warm_linac_rf_setup_document.main_loop_controller.readDataFromXML(root_da)
Example #8
0
        if len(gap_id) == 2:
            new_name = new_name.replace('Rg' + gap_id,
                                        'RF:Cav0' + cav_id + ':Rg' + gap_id)
        else:
            new_name = new_name.replace('Rg' + gap_id,
                                        'RF:Cav0' + cav_id + ':Rg0' + gap_id)
        n_arr[n_arr.index(name)] = new_name
    elif name.startswith('SCL'):
        new_name = name.replace('SCL', 'SCL_RF')
        gap_id = new_name[-1]
        new_name = new_name.replace('Rg' + gap_id, 'Rg0' + gap_id)
        n_arr[n_arr.index(name)] = new_name
    else:
        pass

daptDoc = XmlDataAdaptor.adaptorForUrl(file_url, False)

daptWrite = XmlDataAdaptor.newEmptyDocumentAdaptor()

daptLinac = daptDoc.childAdaptor("xdxf")

lstDaptSeq = daptLinac.childAdaptors("sequence")

primseq = []
subseq = []
nodes = []
box = dict()
box2 = dict()

# START1-------------------------------------
for seq in lstDaptSeq:  # go through all of the sequences in the list of primary sequences