本文整理汇总了Python中MDSplus.Data.makeData方法的典型用法代码示例。如果您正苦于以下问题:Python Data.makeData方法的具体用法?Python Data.makeData怎么用?Python Data.makeData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDSplus.Data
的用法示例。
在下文中一共展示了Data.makeData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: store
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import makeData [as 别名]
def store(self, arg):
"""
Store the data from the device
"""
print '####################################################'
print 'HMA store sh_amp.py 13/06/2012'
#Open the Serial Port
try:
ser=serial.Serial(0, 19200, timeout=1)
except serial.SerialException:
raise RuntimeError('!!! EXCEPTION - Unable to open serial port - check no other program is using it')
#exit("Unable to open the serial port!!! Check no other program is using")
print ' Serial Port Open::',
ser.flushInput()
#Send Transmit Command
print ' Transmit To Amplifiers::',
self.sendMicroCommand(ser, '3')
self.sendMicroCommand(ser, '6')
#Wait for success reply from Micro, close Serial Port and Exit
#print 'Wait for success reply from Micro'
self.waitForData(ser, 1)
test=ord(ser.read())
print ser.read()
if test==1:
print ' TransmitSuccess'
#print 'Finished Transmitting - Success!!!!'
else:
print ' Transmission Failed!!!!!'
raise RuntimeError('!!! EXCEPTION - Transmission failure')
#exit("Transmission Failure Error From Micro")
print ' RetrieveAmpShotSettings::'
self.sendMicroCommand(ser, '6')
self.waitForData(ser, 96)
returnedData=map(ord,ser.read(96))
#print 'Values That Were Stored in the Amplifier Switch Chips'
#print returnedData
#Readback the old settings
data, data2 = self.get_settings()
if returnedData==data2:
print ' Success - Correct Return Values'
returnedValueSuccess=1
else:
print ' !!! Fail - Incorrect Return Values'
raise RuntimeError('!!! EXCEPTION - ECHOED VALUES INCORRECT - WRONG AMPLIFIER SETTINGS DURING SHOT')
returnedValueSuccess=0
ser.close()
print ' Serial Port Closed'
linelength = 6
n_loops = len(returnedData)/linelength
anotherOutput=''
for i in range(n_loops):
tmp_line = returnedData[i*linelength:(i+1)*linelength]
line_str = ' '.join('%d' %i for i in tmp_line)
output_str = '< %s >\n' %line_str
#print output_str
anotherOutput+=output_str
if returnedValueSuccess==1:
anotherOutput+='SUCCESS'
else:
anotherOutput+='FAIL'
new_data = Data.makeData(anotherOutput)
self.readback.putData(new_data)
if returnedValueSuccess==1:
new_data2=Data.makeData('1')
else:
new_data2=Data.makeData('0')
self.amp_success.putData(new_data2)
#node.putData(new_data)
#node2=t.getNode('.shaunampbox:amp_success')
#node2.putData(new_data2)
#print 'Received Data written to MDSplus Shot Number :' + str(shot_number)
return 1
示例2: store
# 需要导入模块: from MDSplus import Data [as 别名]
# 或者: from MDSplus.Data import makeData [as 别名]
def store(self, arg):
"""
Store the data from the device
"""
print '============Helical / Toroidal Mirnov Array Serial Connection - Post Shot======='
#Open the Serial Port
try:
ser=serial.Serial(0, 19200, timeout=1)
except serial.SerialException:
exit("Unable to open the serial port!!! Check no other program is using")
print 'Serial Port Open'
ser.flushInput()
#Send Transmit Command
print 'Sending ~Transmit To Amplifiers~ Command Sequence to Micro'
self.sendMicroCommand(ser, '3')
self.sendMicroCommand(ser, '6')
#Wait for success reply from Micro, close Serial Port and Exit
print 'Wait for success reply from Micro'
self.waitForData(ser, 1)
test=ord(ser.read())
print ser.read()
if test==1:
print 'Finished Transmitting - Success!!!!'
else:
print 'Transmission Failed!!!!!'
exit("Transmission Failure Error From Micro")
print 'Obtain Values that were stored in the amplifier switch chips from the Micro'
self.sendMicroCommand(ser, '6')
self.waitForData(ser, 96)
returnedData=map(ord,ser.read(96))
print 'Values That Were Stored in the Amplifier Switch Chips'
print returnedData
#Readback the old settings
data, data2 = self.get_settings()
if returnedData==data2:
print '=====================Success - Correct Return Values========'
returnedValueSuccess=1
else:
print '======================Fail - Incorrect Return Values========'
returnedValueSuccess=0
ser.close()
print 'Serial Port Closed'
linelength = 6
n_loops = len(returnedData)/linelength
anotherOutput=''
for i in range(n_loops):
tmp_line = returnedData[i*linelength:(i+1)*linelength]
line_str = ' '.join('%d' %i for i in tmp_line)
output_str = '< %s >\n' %line_str
#print output_str
anotherOutput+=output_str
if returnedValueSuccess==1:
anotherOutput+='SUCCESS'
else:
anotherOutput+='FAIL'
new_data = Data.makeData(anotherOutput)
self.readback.putData(new_data)
if returnedValueSuccess==1:
new_data2=Data.makeData('1')
else:
new_data2=Data.makeData('0')
self.amp_success.putData(new_data2)
#node.putData(new_data)
#node2=t.getNode('.shaunampbox:amp_success')
#node2.putData(new_data2)
#print 'Received Data written to MDSplus Shot Number :' + str(shot_number)
return 1