def init(self): if self.restoreInfo() == 0: raise mdsExceptions.TclFAILED_ESSENTIAL try: self.frames.setCompressOnPut(False) except: Data.execute( 'DevLogErr($1,$2)', self.nid, 'Cannot disable automatic compress on put for frames node') raise mdsExceptions.TclFAILED_ESSENTIAL try: self.frames_metad.setCompressOnPut(False) except: Data.execute( 'DevLogErr($1,$2)', self.nid, 'Cannot disable automatic compress on put for frames_metad node' ) raise mdsExceptions.TclFAILED_ESSENTIAL ###Object Parameters try: o_refl_temp = c_double(self.object_refl_temp.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid value for object refletive temperature') raise mdsExceptions.TclFAILED_ESSENTIAL try: o_atm_temp = c_double(self.object_atm_temp.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid value for object atmosfere temperature') raise mdsExceptions.TclFAILED_ESSENTIAL try: o_distance = c_double(self.object_distance.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid value for object distance') raise mdsExceptions.TclFAILED_ESSENTIAL try: o_emissivity = c_double(self.object_emissivity.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid value for object emissivity') raise mdsExceptions.TclFAILED_ESSENTIAL try: o_atm_hum = c_double(self.object_atm_hum.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid value for object atmosfere humidity') raise mdsExceptions.TclFAILED_ESSENTIAL try: o_optic_temp = c_double(self.object_optic_temp.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid value for object optic temperature') raise mdsExceptions.TclFAILED_ESSENTIAL try: o_optic_trans = c_double(self.object_optic_trans.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid value for object optic transmission') raise mdsExceptions.TclFAILED_ESSENTIAL try: o_atm_trans = c_double(self.object_atm_trans.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid value for object atmosfere trasmission') raise mdsExceptions.TclFAILED_ESSENTIAL status = FLIRSC65X.flirLib.setObjectParameters( self.handle, o_refl_temp, o_atm_temp, o_distance, o_emissivity, o_atm_hum, o_optic_temp, o_optic_trans, o_atm_trans) if status < 0: FLIRSC65X.flirLib.getLastError(self.handle, self.error) Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot Set Object Parameters : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Frame Rate try: frameRate = self.timing_frame_rate.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid frame rate value') raise mdsExceptions.TclFAILED_ESSENTIAL status = FLIRSC65X.flirLib.setFrameRateNew(self.handle, c_double(frameRate)) if status < 0: FLIRSC65X.flirLib.getLastError(self.handle, self.error) Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot Set Frame Rate : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Frame Area x = c_int(0) y = c_int(0) width = c_int(0) height = c_int(0) status = FLIRSC65X.flirLib.getReadoutArea(self.handle, byref(x), byref(y), byref(width), byref(height)) if status < 0: FLIRSC65X.flirLib.getLastError(self.handle, self.error) Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot Get Readout Area : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL #write data in mdsplus self.frame_x.putData(x.value) self.frame_y.putData(y.value) self.frame_width.putData(width.value) self.frame_height.putData(height.value) ###Focal Length try: focalLength = self.cam_setup_focal_length.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid Focal Length value') raise mdsExceptions.TclFAILED_ESSENTIAL if focalLength == '25': focalLengthInt = 0 elif focalLength == '41': focalLengthInt = 3 #offset to select the correct calibration curve using the Measurement Range ###Measurement Range try: measureRange = self.cam_setup_meas_range.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid measurement range value') raise mdsExceptions.TclFAILED_ESSENTIAL if measureRange == '-40...150': measRangeInt = 0 elif measureRange == '100...650': measRangeInt = 1 elif measureRange == '300...2000': measRangeInt = 2 status = FLIRSC65X.flirLib.setMeasurementRange( self.handle, c_int(measRangeInt + focalLengthInt)) if status < 0: try: FLIRSC65X.flirLib.getLastError(self.handle, self.error) Data.execute( 'DevLogErr($1,$2)', self.nid, 'Cannot Set Measurement Range : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL except: traceback.print_exc() ###Image Temperature try: frameTempUnit = self.frame_temp_unit.data() except: Data.execute( 'DevLogErr($1,$2)', self.nid, 'Invalid image temperature unit (Radiometric, 10mk, 100mk) value' ) raise mdsExceptions.TclFAILED_ESSENTIAL if frameTempUnit == 'Radiometric': frameTempUnitCode = c_int(0) elif frameTempUnit == 'LinearTemperature10mK': frameTempUnitCode = c_int(1) elif frameTempUnit == 'LinearTemperature100mK': frameTempUnitCode = c_int(2) status = FLIRSC65X.flirLib.setIrFormat(self.handle, frameTempUnitCode) if status < 0: FLIRSC65X.flirLib.getLastError(self.handle, self.error) Data.execute( 'DevLogErr($1,$2)', self.nid, 'Cannot Set Image Temperature unit : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Frame Trigger mode try: burstDuration = self.timing_burst_dur.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid acquisition duration value') raise mdsExceptions.TclFAILED_ESSENTIAL try: triggerMode = self.timing_trig_mode.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid trigger mode value') raise mdsExceptions.TclFAILED_ESSENTIAL try: trigSource = self.timing_trig_source.data() except: if triggerMode == 'EXTERNAL': Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid trigger source value') raise mdsExceptions.TclFAILED_ESSENTIAL else: trigSource = array([0.]) print("OK " + triggerMode) if triggerMode == 'EXTERNAL': #0=internal 1=external trigger trigModeCode = c_int(1) else: trigSource = array([0.]) trigModeCode = c_int(0) numTrigger = trigSource.size print("OK - NUM TRIGGER ", numTrigger) print("OK - Trigger Source ", trigSource) timeBase = Data.compile( " $ : $ + $ :(zero( size( $ ), 0.) + 1.) * 1./$", trigSource, trigSource, burstDuration, trigSource, frameRate) print("Data = " + Data.decompile(timeBase)) self.timing_time_base.putData(timeBase) status = FLIRSC65X.flirLib.setTriggerMode(self.handle, trigModeCode, c_double(burstDuration), numTrigger) if status < 0: FLIRSC65X.flirLib.getLastError(self.handle, self.error) Data.execute( 'DevLogErr($1,$2)', self.nid, 'Cannot Set Internal/External Trigger : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Calibration try: calibAuto = self.cam_setup_calib_auto.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid auto calibration setup') raise mdsExceptions.TclFAILED_ESSENTIAL calibModeCode = c_int(1) if calibAuto == 'NO': try: calibTime = self.cam_setup_calib_time.data() calibModeCode = c_int(0) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid calibration duration value') raise mdsExceptions.TclFAILED_ESSENTIAL if numTrigger > 1 and (burstDuration + calibTime) > ( trigSource[1] - trigSource[0]): Data.execute('DevLogErr($1,$2)', self.nid, 'Calibration executed during acquisition') raise mdsExceptions.TclFAILED_ESSENTIAL status = FLIRSC65X.flirLib.setCalibMode(self.handle, calibModeCode) if status < 0: FLIRSC65X.flirLib.getLastError(self.handle, self.error) Data.execute( 'DevLogErr($1,$2)', self.nid, 'Cannot Set Internal/External Trigger : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Read and save current Focus Position try: focusPosRes = self.readFocusPos() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Error reading focus position') raise mdsExceptions.TclFAILED_ESSENTIAL ###Streaming try: streamingMode = self.streaming_mode.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming mode setup') raise mdsExceptions.TclFAILED_ESSENTIAL if streamingMode == 'Stream and Store': streamingEnabled = c_int(1) storeEnabled = c_int(1) elif streamingMode == 'Only Stream': streamingEnabled = c_int(1) storeEnabled = c_int(0) else: #streamingMode == 'Only Store': streamingEnabled = c_int(0) storeEnabled = c_int(1) if 1: #streamingEnabled (FM: setStreamingMode use this flag) try: if self.streaming_autoscale.data() == 'YES': autoAdjustLimit = c_int(1) else: autoAdjustLimit = c_int(0) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming autoscale parameter value') raise mdsExceptions.TclFAILED_ESSENTIAL try: lowLim = c_int(self.streaming_lolim.data()) except: Data.execute( 'DevLogErr($1,$2)', self.nid, 'Invalid streaming low temperature limit parameter value') raise mdsExceptions.TclFAILED_ESSENTIAL try: highLim = c_int(self.streaming_hilim.data()) except: Data.execute( 'DevLogErr($1,$2)', self.nid, 'Invalid streaming high temperature limit parameter value') raise mdsExceptions.TclFAILED_ESSENTIAL try: streamingPort = c_int(self.streaming_port.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming port parameter value') raise mdsExceptions.TclFAILED_ESSENTIAL try: streamingServer = self.streaming_server.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming server parameter value') raise mdsExceptions.TclFAILED_ESSENTIAL try: adjRoiX = c_int(self.streaming_adjroix.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming ROI x value') raise mdsExceptions.TclFAILED_ESSENTIAL try: adjRoiY = c_int(self.streaming_adjroiy.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming ROI y value') raise mdsExceptions.TclFAILED_ESSENTIAL try: adjRoiW = c_int(self.streaming_adjroiw.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming ROI width value') raise mdsExceptions.TclFAILED_ESSENTIAL try: adjRoiH = c_int(self.streaming_adjroih.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming ROI height value') raise mdsExceptions.TclFAILED_ESSENTIAL print("lowLim ", lowLim) print("highLim ", highLim) print("frameTempUnitCode ", frameTempUnitCode) print("streamingPort ", streamingPort) print("streamingServer ", streamingServer) print("streaming adj ROI x ", adjRoiX) print("streaming adj ROI y ", adjRoiY) print("streaming adj ROI w ", adjRoiW) print("streaming adj ROI h ", adjRoiH) #FM: recover device name and pass it to setStreaming to overlay text on frame!!! deviceName = str(self).rsplit(":", 1) deviceName = deviceName[1] print("Device Name ", deviceName) status = FLIRSC65X.flirLib.setStreamingMode( self.handle, frameTempUnitCode, streamingEnabled, autoAdjustLimit, c_char_p(streamingServer), streamingPort, lowLim, highLim, adjRoiX, adjRoiY, adjRoiW, adjRoiH, c_char_p(deviceName)) if status < 0: FLIRSC65X.flirLib.getLastError(self.handle, self.error) Data.execute( 'DevLogErr($1,$2)', self.nid, 'Cannot execute streaming setup mode : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Acquisition try: acqSkipFrameNumber = c_int(self.timing_skip_frame.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid acquisition decimation value') raise mdsExceptions.TclFAILED_ESSENTIAL status = FLIRSC65X.flirLib.setAcquisitionMode(self.handle, storeEnabled, acqSkipFrameNumber) if status < 0: FLIRSC65X.flirLib.getLastError(self.handle, self.error) Data.execute( 'DevLogErr($1,$2)', self.nid, 'Cannot execute acquisition setup mode : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL try: treePtr = c_void_p(0) status = FLIRSC65X.mdsLib.camOpenTree( c_char_p(self.getTree().name), c_int(self.getTree().shot), byref(treePtr)) if status == -1: Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot open tree') raise mdsExceptions.TclFAILED_ESSENTIAL except: traceback.print_exc() framesNid = self.frames.nid timebaseNid = self.timing_time_base.nid framesMetadNid = self.frames_metad.nid frame0TimeNid = self.frame0_time.nid status = FLIRSC65X.flirLib.setTreeInfo(self.handle, treePtr, framesNid, timebaseNid, framesMetadNid, frame0TimeNid) if status < 0: FLIRSC65X.flirLib.getLastError(self.handle, self.error) Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot execute set tree info : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Auto Calibration status = FLIRSC65X.flirLib.executeAutoCalib(self.handle) if status < 0: FLIRSC65X.flirLib.getLastError(self.handle, self.error) Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot Execute Auto Calibration : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL print('Init action completed.') return 1
def init(self): if self.restoreInfo() == 0: raise mdsExceptions.TclFAILED_ESSENTIAL self.saveInfo() try: self.frames.setCompressOnPut(False) except: Data.execute( 'DevLogErr($1,$2)', self.nid, 'Cannot disable automatic compresson on put for frames node') raise mdsExceptions.TclFAILED_ESSENTIAL try: self.frames_metad.setCompressOnPut(False) except: Data.execute( 'DevLogErr($1,$2)', self.nid, 'Cannot disable automatic compresson on put for frames_metad node' ) raise mdsExceptions.TclFAILED_ESSENTIAL ###Gain try: gain = self.cam_setup_gain.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid gain value') raise mdsExceptions.TclFAILED_ESSENTIAL status = BASLERACA.baslerLib.setGain(self.handle, c_int(gain)) if status < 0: BASLERACA.baslerLib.getLastError(self.handle, self.error) Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot Set Gain : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Gain Auto try: gainAuto = self.cam_setup_gain_auto.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid gain auto value') raise mdsExceptions.TclFAILED_ESSENTIAL status = BASLERACA.baslerLib.setGainAuto(self.handle, c_char_p(gainAuto)) if status < 0: BASLERACA.baslerLib.getLastError(self.handle, self.error) Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot Set Gain Auto : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Gamma Enable try: gammaEnable = self.cam_setup_gamma_en.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid gamma enable value') raise mdsExceptions.TclFAILED_ESSENTIAL status = BASLERACA.baslerLib.setGammaEnable(self.handle, c_char_p(gammaEnable)) if status < 0: BASLERACA.baslerLib.getLastError(self.handle, self.error) Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot Set Gamma Enable : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Exposure Auto try: exposureAuto = self.cam_setup_exp_auto.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid exposure auto value') raise mdsExceptions.TclFAILED_ESSENTIAL status = BASLERACA.baslerLib.setExposureAuto(self.handle, c_char_p(exposureAuto)) if status < 0: BASLERACA.baslerLib.getLastError(self.handle, self.error) Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot Set Exposure Auto : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Exposure try: exposure = self.cam_setup_exposure.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid exposure value') raise mdsExceptions.TclFAILED_ESSENTIAL status = BASLERACA.baslerLib.setExposure(self.handle, c_double(exposure)) if status < 0: BASLERACA.baslerLib.getLastError(self.handle, self.error) Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot Set Exposure : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###READ CAMERA TEMPERATURE status = BASLERACA.baslerLib.readInternalTemperature(self.handle) if status < 0: BASLERACA.baslerLib.getLastError(self.handle, self.error) Data.execute( 'DevLogErr($1,$2)', self.nid, 'Cannot Read Internal Temperature : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Pixel Format try: pixelFormat = self.frame_pixel_format.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid pixel format value') raise mdsExceptions.TclFAILED_ESSENTIAL status = BASLERACA.baslerLib.setPixelFormat(self.handle, c_char_p(pixelFormat)) if status < 0: BASLERACA.baslerLib.getLastError(self.handle, self.error) Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot Set Pixel Format : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Frame Rate try: frameRate = self.timing_frame_rate.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid frame rate value') raise mdsExceptions.TclFAILED_ESSENTIAL status = BASLERACA.baslerLib.setFrameRate(self.handle, c_double(frameRate)) if status < 0: BASLERACA.baslerLib.getLastError(self.handle, self.error) Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot Set Frame Rate : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Frame Area try: x = self.frame_x.data() y = self.frame_y.data() width = self.frame_width.data() height = self.frame_height.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid Frame Area value') raise mdsExceptions.TclFAILED_ESSENTIAL status = BASLERACA.baslerLib.setReadoutArea(self.handle, c_int(x), c_int(y), c_int(width), c_int(height)) if status < 0: BASLERACA.baslerLib.getLastError(self.handle, self.error) Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot Set Frame Area : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Frame Trigger mode try: burstDuration = self.timing_burst_dur.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid acquisition duration value') raise mdsExceptions.TclFAILED_ESSENTIAL try: triggerMode = self.timing_trig_mode.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid trigger mode value') raise mdsExceptions.TclFAILED_ESSENTIAL try: trigSource = self.timing_trig_source.data() except: if triggerMode == 'EXTERNAL': Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid trigger source value') raise mdsExceptions.TclFAILED_ESSENTIAL else: trigSource = array([0.]) self.debugPrint("---OK ", triggerMode) if triggerMode == 'EXTERNAL': #0=internal 1=external trigger trigModeCode = c_int(1) else: #trigSource = array([0.]) CT 2018-06-06 Use trigger source, if ii is defined, in internal mode trigModeCode = c_int(0) numTrigger = trigSource.size self.debugPrint("OK - NUM TRIGGER ", numTrigger) self.debugPrint("OK - Trigger Source ", trigSource) timeBase = Data.compile( " $ : $ + $ :(zero( size( $ ), 0.) + 1.) * 1./$", trigSource, trigSource, burstDuration, trigSource, frameRate) self.debugPrint("Data = " + Data.decompile(timeBase)) self.timing_time_base.putData(timeBase) status = BASLERACA.baslerLib.setTriggerMode(self.handle, trigModeCode, c_double(burstDuration), numTrigger) if status < 0: BASLERACA.baslerLib.getLastError(self.handle, self.error) Data.execute( 'DevLogErr($1,$2)', self.nid, 'Cannot Set Internal/External Trigger : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Streaming try: streamingMode = self.streaming_mode.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming mode setup') raise mdsExceptions.TclFAILED_ESSENTIAL if streamingMode == 'Stream and Store': streamingEnabled = c_int(1) storeEnabled = c_int(1) elif streamingMode == 'Only Stream': streamingEnabled = c_int(1) storeEnabled = c_int(0) else: #streamingMode == 'Only Store': streamingEnabled = c_int(0) storeEnabled = c_int(1) if streamingEnabled: try: if self.streaming_autoscale.data() == 'YES': autoAdjustLimit = c_int(1) else: autoAdjustLimit = c_int(0) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming autoscale parameter value') raise mdsExceptions.TclFAILED_ESSENTIAL try: lowLim = c_int(self.streaming_lolim.data()) except: Data.execute( 'DevLogErr($1,$2)', self.nid, 'Invalid streaming low temperature limit parameter value') raise mdsExceptions.TclFAILED_ESSENTIAL try: highLim = c_int(self.streaming_hilim.data()) except: Data.execute( 'DevLogErr($1,$2)', self.nid, 'Invalid streaming high temperature limit parameter value') raise mdsExceptions.TclFAILED_ESSENTIAL try: streamingPort = c_int(self.streaming_port.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming port parameter value') raise mdsExceptions.TclFAILED_ESSENTIAL try: streamingServer = self.streaming_server.data() except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming server parameter value') raise mdsExceptions.TclFAILED_ESSENTIAL try: adjRoiX = c_int(self.streaming_adjroix.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming ROI x value') raise mdsExceptions.TclFAILED_ESSENTIAL try: adjRoiY = c_int(self.streaming_adjroiy.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming ROI y value') raise mdsExceptions.TclFAILED_ESSENTIAL try: adjRoiW = c_int(self.streaming_adjroiw.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming ROI width value') raise mdsExceptions.TclFAILED_ESSENTIAL try: adjRoiH = c_int(self.streaming_adjroih.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid streaming ROI height value') raise mdsExceptions.TclFAILED_ESSENTIAL self.debugPrint("lowLim ", lowLim) self.debugPrint("highLim ", highLim) self.debugPrint("streamingPort ", streamingPort) self.debugPrint("streamingServer ", streamingServer) self.debugPrint("streaming adj ROI x ", adjRoiX) self.debugPrint("streaming adj ROI y ", adjRoiY) self.debugPrint("streaming adj ROI w ", adjRoiW) self.debugPrint("streaming adj ROI h ", adjRoiH) deviceName = str(self).rsplit( ":", 1) #Recover device name to overlay it as text on frame deviceName = deviceName[1] self.debugPrint("Device Name ", deviceName) status = BASLERACA.baslerLib.setStreamingMode( self.handle, streamingEnabled, autoAdjustLimit, c_char_p(streamingServer), streamingPort, lowLim, highLim, adjRoiX, adjRoiY, adjRoiW, adjRoiH, c_char_p(deviceName)) if status < 0: BASLERACA.baslerLib.getLastError(self.handle, self.error) Data.execute( 'DevLogErr($1,$2)', self.nid, 'Cannot execute streaming setup mode : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL ###Acquisition try: acqSkipFrameNumber = c_int(self.timing_skip_frame.data()) except: Data.execute('DevLogErr($1,$2)', self.nid, 'Invalid acquisition decimation value') raise mdsExceptions.TclFAILED_ESSENTIAL status = BASLERACA.baslerLib.setAcquisitionMode( self.handle, storeEnabled, acqSkipFrameNumber) if status < 0: BASLERACA.baslerLib.getLastError(self.handle, self.error) Data.execute( 'DevLogErr($1,$2)', self.nid, 'Cannot execute acquisition setup mode : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL try: treePtr = c_void_p(0) status = BASLERACA.mdsLib.camOpenTree( c_char_p(self.getTree().name), c_int(self.getTree().shot), byref(treePtr)) if status == -1: Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot open tree') raise mdsExceptions.TclFAILED_ESSENTIAL except: traceback.print_exc() framesNid = self.frames.nid timebaseNid = self.timing_time_base.nid framesMetadNid = self.frames_metad.nid frame0TimeNid = self.frame0_time.nid status = BASLERACA.baslerLib.setTreeInfo(self.handle, treePtr, framesNid, timebaseNid, framesMetadNid, frame0TimeNid) if status < 0: BASLERACA.baslerLib.getLastError(self.handle, self.error) Data.execute('DevLogErr($1,$2)', self.nid, 'Cannot execute set tree info : ' + self.error.raw) raise mdsExceptions.TclFAILED_ESSENTIAL self.debugPrint('Init action completed.') return 1