##// END OF EJS Templates
First beam is loaded by default after sending the beam file to the control modules.
First beam is loaded by default after sending the beam file to the control modules.

File last commit:

r197:198
r231:232
Show More
ABSData.py
68 lines | 2.4 KiB | text/x-python | PythonLexer
'''
Created on Jun 3, 2013
@author: Jose Antonio Sal y Rosas Celi
@contact: jose.salyrosas@jro.igp.gob.pe
'''
class ABSData(object):
__scriptName = "ABSData.py"
def __init__(self):
pass
def convertStringtoList2(self, strData):
if strData != "" or strData != "None" or strData != None:
lines = strData.split("],[")
listData = [[0 for i in range(8)] for j in range(8)]
for i,line in enumerate(lines):
if i == 0:
lines[i] = line.replace("[[","")
if i == len(lines)-1:
lines[i] = line.replace("]]","")
elements = lines[i].split(",")
for j,element in enumerate(elements):
listData[i][j] = element
else:
listData = [["0","0","0","0","0","0","0","0"],\
["0","0","0","0","0","0","0","0"],\
["0","0","0","0","0","0","0","0"],\
["0","0","0","0","0","0","0","0"],\
["0","0","0","0","0","0","0","0"],\
["0","0","0","0","0","0","0","0"],\
["0","0","0","0","0","0","0","0"],\
["0","0","0","0","0","0","0","0"]]
return listData
def convertStringtoList1(self, strData):
if strData != "" or strData != "None" or strData != None:
lines = strData.split(",")
for i,line in enumerate(lines):
if i == 0:
lines[i] = line.replace("[","")
if i == len(lines)-1:
lines[i] = line.replace("]","")
else:
lines = ["0","0","0","0"]
return lines
def printList(self, listData):
print listData
if __name__ == '__main__':
strData = "[[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0]," \
"[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \
"[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]," \
"[1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5]]"
txtUes = "[0.533333,0.00000,1.06667,0.00000]"
data = ABSData()
listData = data.convertStringtoList2(strData)
listUes = data.convertStringtoList1(txtUes)
data.printList(listData)
data.printList(listUes)