Commit 7c415452 authored by Giuseppe Carboni's avatar Giuseppe Carboni
Browse files

Merge branch 'master' of https://github.com/discos/discos into fix-issue-derotator-328

parents 21cfd3fc 05d18e60
Loading
Loading
Loading
Loading
+27 −1
Original line number Original line Diff line number Diff line
@@ -69,6 +69,32 @@ and this project adheres to [Semantic Versioning](http://semver.org/
    issue #452 - The Total Power component erroneously assigned a timestamp to the samples in case more samples were needed to reach total integration time
    issue #452 - The Total Power component erroneously assigned a timestamp to the samples in case more samples were needed to reach total integration time
    issue #473 - The SRT AS USDs now retry 5 times to communicate with the hardware before setting their state to unavailable
    issue #473 - The SRT AS USDs now retry 5 times to communicate with the hardware before setting their state to unavailable


## [discos1.0.4] 03-02-2020
### Added
    issue #505 - CALMUX integrated and tested into the SRT production line (it has been successfully tested with DBBC and DFB backends)
### Changed
    issue #477 - removed the SecureArea from some AntennaBoss methods
    issue #476 - replaced all occurrencies of DPI/2 with the defined variable DPIBY2, this should improve precision
    issue #489 - new focus curve for SRT X band receiver
    issue #506 - each SRT local oscillator now has its dedicated container
    issue #510 - fixed SRT TotalPower CDB configuration in order to use the correct IP address
### Fixed
    issue #433 - limited refraction correction values to a meaningful range in order to avoid flooding the jlog with warning messages whenever the elevation is close to 90 degrees
    issue #502 - removed last service daemon reference from Manager.xml io SRT production line
    
## [discos1.0.5] - 
## Added
	issue #504 - added credits clause (regarding INAF data ownership) to fits files headers
   issue #518 - KBand receivers cryo temperature read wrongly with connection problems. More information:
    https://github.com/discos/discos/issues/518#issuecomment-590838480
   issue #530 - New Fitszilla versione 1.21 online. The subscan offsets related keywords added to the primary header.

## Fixed
    issue #518 - In case of communication error we set a dummy value (100000) for the temperature properties, and the related timestamp keeps the value of the last communication timestamp.
    issue #525 - When in LOCAL mode the receivers can turn on/off the noise mark and LNAs. There is no more MNG_FAILURE logging in case of LOCAL mode: only the LOCAL/REMOTE status (during component activation) and the change of status (LOCAL to REMOTE and viceversa) are written to the logfile.
## Changed  
    issue #545 - Oscillation checks enabled for Mc and Nt telescopes, this setting is now under control of a CDB argument   

## [Next Major] -
## [Next Major] -
### Added
### Added
### Changed
### Changed
+2 −2
Original line number Original line Diff line number Diff line
@@ -66,7 +66,7 @@ lllll_OBJECTS =
#
#
# Scripts (public and local)
# Scripts (public and local)
# ----------------------------
# ----------------------------
SCRIPTS         =
SCRIPTS         = calibrationtoolclient
SCRIPTS_L       =
SCRIPTS_L       =


#
#
@@ -78,7 +78,7 @@ TCL_SCRIPTS_L =
#
#
# Python stuff (public and local)
# Python stuff (public and local)
# ----------------------------
# ----------------------------
PY_SCRIPTS         =  calibrationtoolclient
PY_SCRIPTS         =  _ctc
PY_SCRIPTS_L       =  
PY_SCRIPTS_L       =  


PY_MODULES         = customwidgets calibrationtool_ui 
PY_MODULES         = customwidgets calibrationtool_ui 
+177 −148
Original line number Original line Diff line number Diff line
@@ -12,9 +12,10 @@ import ACS, ACS__POA # Import the Python CORBA
from PyQt4 import Qt
from PyQt4 import Qt
from PyQt4.QtCore import pyqtSlot,QThread,QMutex,QTimer
from PyQt4.QtCore import pyqtSlot,QThread,QMutex,QTimer
import PyQt4.Qwt5 as Qwt
import PyQt4.Qwt5 as Qwt
import sys,getopt
import sys,getopt,os
from time import sleep
from time import sleep
import math 
import math 
from IRAPy import logger,userLogger






@@ -28,6 +29,7 @@ __version__ = '$Id'
@version $Id$
@version $Id$
'''
'''


DEFAULT_COMPONENT="MANAGEMENT/CalibrationTool"


class MyWorker(QThread):
class MyWorker(QThread):
	def __init__(self,component,parent=None):
	def __init__(self,component,parent=None):
@@ -166,42 +168,83 @@ class MyWorker(QThread):
                pass
                pass
 
 





class Application(Qt.QDialog,calibrationtool_ui.Ui_CalibrationToolDialog):
class Application(Qt.QDialog,calibrationtool_ui.Ui_CalibrationToolDialog):
 
 
	def __init__(self,compname,parent=None):
	def __init__(self,compname,parent=None):
		Qt.QDialog.__init__(self)
		
		
		self.scheduler=None
		self.antennaBoss=None
		self.component=None
		self.componentName=DEFAULT_COMPONENT
		self.managerConnected=False
		self.thread=None
		
		try:
			self.simpleClient = PySimpleClient()
			self.simpleClient = PySimpleClient()
			self.managerConnected=True
		except Exception,ex:
			newEx = ClientErrorsImpl.CouldntLogManagerExImpl(exception=ex, create=1)
			logger.logException(newEx)
			print "Please check the system is up and running......"
			sys.exit(-1)
							
		try:
		try:
                        scheduler= self.simpleClient.getDefaultComponent("IDL:alma/Management/Scheduler:1.0")
			self.scheduler= self.simpleClient.getDefaultComponent("IDL:alma/Management/Scheduler:1.0")
                        antennaBoss =self.simpleClient.getDefaultComponent("IDL:alma/Antenna/AntennaBoss:1.0")
		except Exception,ex:
			newEx = ClientErrorsImpl.CouldntAccessComponentExImpl(exception=ex, create=1)
			newEx.setComponentName("IDL:alma/Management/Scheduler:1.0")
			logger.logException(newEx)
			print "Please check the system is up and running and scheduler component is alive!"
			sys.exit(-1)

		try:
			self.antennaBoss =self.simpleClient.getDefaultComponent("IDL:alma/Antenna/AntennaBoss:1.0")
		except Exception,ex:
			newEx = ClientErrorsImpl.CouldntAccessComponentExImpl(exception=ex, create=1)
			newEx.setComponentName("IDL:alma/Antenna/AntennaBoss:1.0")
			logger.logException(newEx)
			print "Please check the system is up and running and antenna boss is alive!"
			sys.exit(-1)


		#choose default recorder
		#choose default recorder
		if compname=='default':
		if compname=='default':
                              
			try:
                              recorder=scheduler._get_currentRecorder()
				recorder=self.scheduler._get_currentRecorder()
				(recordername,compl)=recorder.get_sync()
				(recordername,compl)=recorder.get_sync()
                              self.componentname=recordername
			except  Exception,ex:
                              print recordername
				newEx = ClientErrorsImpl.CouldntAccessPropertyExImpl(exception=ex, create=1)
				logger.logException(newEx)
				print "Please check scheduler component is alive and responsive|" 
				sys.exit(-1)
					
			print "Starting with default component: " + DEFAULT_COMPONENT	
			if recordername!=DEFAULT_COMPONENT:
				print "Be aware that the in-use recorder is currently " + recordername

			self.componentName=DEFAULT_COMPONENT
				
		else:
		else:
                              self.componentname=compname
			self.componentName=compname
                        print self.componentname
			print "Starting with component: " + self.componentName
                        component= self.simpleClient.getComponent(self.componentname)
       	               
     			self.thread=MyWorker([component,scheduler,antennaBoss,self.simpleClient])
		try:
			self.component= self.simpleClient.getComponent(self.componentName)
		except Exception,ex:
			newEx = ClientErrorsImpl.CouldntAccessComponentExImpl(exception=ex, create=1)
			newEx.setComponentName(self.componentName)
			logger.logException(newEx)
			print "Please check the system is up and running and " + self.componentName + " is alive!"
			sys.exit(-1)
		
		self.thread=MyWorker([self.component,self.scheduler,self.antennaBoss,self.simpleClient])
		Qt.QDialog.__init__(self)
		self.setupUi(self)
		self.setupUi(self)
#		self.qwtPlot_datax.setAxisScale(Qwt.QwtPlot.xBottom, 0,1000)
#		self.qwtPlot_datax.setAxisScale(Qwt.QwtPlot.xBottom, 0,1000)
		self.qwtPlot_datax.setAxisAutoScale(Qwt.QwtPlot. yLeft) 
		self.qwtPlot_datax.setAxisAutoScale(Qwt.QwtPlot. yLeft) 
			self.setWindowTitle(self.componentname)
		self.setWindowTitle(self.componentName)
		self.qwtPlot_datax.setAxisTitle(Qwt.QwtPlot.yLeft, "Ta(K)")
		self.qwtPlot_datax.setAxisTitle(Qwt.QwtPlot.yLeft, "Ta(K)")
		self.qwtPlot_datay.setAxisTitle(Qwt.QwtPlot.yLeft, "Ta(K)")
		self.qwtPlot_datay.setAxisTitle(Qwt.QwtPlot.yLeft, "Ta(K)")
		
		




		self.connect(self.thread,Qt.SIGNAL("arrayDataX"),self.qwtPlot_datay.setX)
		self.connect(self.thread,Qt.SIGNAL("arrayDataX"),self.qwtPlot_datay.setX)
		self.connect(self.thread,Qt.SIGNAL("arrayDataY"),self.qwtPlot_datay.setVal)
		self.connect(self.thread,Qt.SIGNAL("arrayDataY"),self.qwtPlot_datay.setVal)
                        
                        
@@ -223,16 +266,6 @@ class Application(Qt.QDialog,calibrationtool_ui.Ui_CalibrationToolDialog):
		self.connect(self.thread,Qt.SIGNAL("isRecording"),self.isRecording)
		self.connect(self.thread,Qt.SIGNAL("isRecording"),self.isRecording)
		self.connect(self.thread,Qt.SIGNAL("scanAxis"),self.scanAxis)
		self.connect(self.thread,Qt.SIGNAL("scanAxis"),self.scanAxis)
                       
                       


		except  Exception,ex:
			newEx = ClientErrorsImpl.CouldntAccessComponentExImpl(exception=ex, create=1)
#        		newEx.setComponentName(self.componentname)
         #ACS_LOG_ERROR
        		newEx.log(self.simpleClient.getLogger(),ACSLog.ACS_LOG_ERROR)
        		self.simpleClient.disconnect()
        		sys.exit(-1)	
                        
	@pyqtSlot(Qt.QObject,name="isRecording")
	@pyqtSlot(Qt.QObject,name="isRecording")
	def isRecording(self,rec):
	def isRecording(self,rec):
		if rec==False:
		if rec==False:
@@ -242,9 +275,6 @@ class Application(Qt.QDialog,calibrationtool_ui.Ui_CalibrationToolDialog):
			palette.setColor(role, Qt.QColor('gray'))
			palette.setColor(role, Qt.QColor('gray'))
			self.recording.setPalette(palette)
			self.recording.setPalette(palette)
			self.BScanaxis.setEnabled(False)
			self.BScanaxis.setEnabled(False)
                
                
                
		if rec==True:
		if rec==True:
			self.recording.setText("ON")
			self.recording.setText("ON")
			palette = self.recording.palette()
			palette = self.recording.palette()
@@ -256,7 +286,6 @@ class Application(Qt.QDialog,calibrationtool_ui.Ui_CalibrationToolDialog):
	@pyqtSlot(Qt.QObject,name="scanAxis")  # decorator for the slot
	@pyqtSlot(Qt.QObject,name="scanAxis")  # decorator for the slot
	def scanAxis(self,scanaxis):
	def scanAxis(self,scanaxis):
		self.BScanaxis.setText(str(scanaxis))           
		self.BScanaxis.setText(str(scanaxis))           
                
		if 'SUBR' not in str(scanaxis):
		if 'SUBR' not in str(scanaxis):
			self.scanAxisLabel.setText('ScanAxis - Pointing')
			self.scanAxisLabel.setText('ScanAxis - Pointing')
			xaxis_text="Direction (Deg)"
			xaxis_text="Direction (Deg)"
@@ -266,47 +295,45 @@ class Application(Qt.QDialog,calibrationtool_ui.Ui_CalibrationToolDialog):
			self.scanAxisLabel.setText('ScanAxis - Focus')
			self.scanAxisLabel.setText('ScanAxis - Focus')
			xaxis_text="Distance (mm)"
			xaxis_text="Distance (mm)"
			hpbw_label_text='HPBW(mm)'
			hpbw_label_text='HPBW(mm)'

			peakOffsetLabel_text='PeakOffset(mm)'  
			peakOffsetLabel_text='PeakOffset(mm)'  
                
			self.qwtPlot_datax.setAxisTitle(Qwt.QwtPlot.xBottom, xaxis_text)
			self.qwtPlot_datax.setAxisTitle(Qwt.QwtPlot.xBottom, xaxis_text)
			self.qwtPlot_datay.setAxisTitle(Qwt.QwtPlot.xBottom, xaxis_text)
			self.qwtPlot_datay.setAxisTitle(Qwt.QwtPlot.xBottom, xaxis_text)
			self.hpbw_label.setText(hpbw_label_text)
			self.hpbw_label.setText(hpbw_label_text)
			self.peakOffsetLabel.setText(peakOffsetLabel_text)
			self.peakOffsetLabel.setText(peakOffsetLabel_text)


        

	@pyqtSlot(Qt.QObject,name="scalePlots")  # decorator for the slot
	@pyqtSlot(Qt.QObject,name="scalePlots")  # decorator for the slot
	def scalePlots(self,val):
	def scalePlots(self,val):
		self.qwtPlot_datay.setAxisScale(QwtPlot.xBottom, min(val), max(val))
		self.qwtPlot_datay.setAxisScale(QwtPlot.xBottom, min(val), max(val))
   	
	def run(self):
	def run(self):
		self.thread.start()
		self.thread.start()
					
					
	def __del__(self):
	def __del__(self):
		self.thread.run=False  
		#__del__ apparently is called twice, I have no clue and it should be investigated 
		if self.thread:
			if self.thread.isRunning:
				self.thread.quit()

		if self.managerConnected:
			try:
			try:
 		     self.simpleClient.releaseComponent(self.componentname)
				if self.component:
					self.simpleClient.releaseComponent(self.component._get_name())
				if self.scheduler:
					self.simpleClient.releaseComponent(self.scheduler._get_name())
					self.simpleClient.releaseComponent(self.scheduler._get_name())
 		     self.simpleClient.releaseComponent(self.boss._get_name())
				if self.antennaBoss:
     
					self.simpleClient.releaseComponent(self.antennaBoss._get_name())


		     self.simpleClient.disconnect()
			except Exception,ex:
			except Exception,ex:
                      print "exception"
				print "Error in application cleanup"                      
                      
		print "end app"
		

def usage(nameapp):
        print nameapp+" [component name]"
        
        
  
		
		
		
		
def usage():
	print "calibrationtoolclient [component name]"
	print
	print "If no component name is provided, the default "+DEFAULT_COMPONENT+" will be used" 


def main(args):
def main(args):
	sys.tracebacklimit=0

	try:
	try:
		opts, args = getopt.getopt(sys.argv[1:],"h",["help"])
		opts, args = getopt.getopt(sys.argv[1:],"h",["help"])
	except getopt.GetoptError, err:
	except getopt.GetoptError, err:
@@ -324,13 +351,15 @@ def main(args):
	else:
	else:
		componentname=args[0]
		componentname=args[0]
  
  
        print componentname   
	app = Qt.QApplication(args)
	app = Qt.QApplication(args)
	a=Application(componentname) #passa il nome del component al costruttore
	a=Application(componentname) #passa il nome del component al costruttore
	sleep(1)
	a.run()
	a.run()
	p=a.show()	
	p=a.show()	
		
	sys.exit(app.exec_())
	sys.exit(app.exec_())
	sleep(2)
	sleep(2)
	print "Application closed!"
	

if __name__=='__main__':
if __name__=='__main__':
	main(sys.argv)
	main(sys.argv)
+9 −0
Original line number Original line Diff line number Diff line
#! /bin/bash
# ***********************************************************************
# Who                                           when            What
# Andrea Orlati(andrea.orlati@inaf.it)          22/05/2020      Creation
#************************************************************************


export ACS_LOG_STDOUT=11
_ctc $1
+24 −11
Original line number Original line Diff line number Diff line
@@ -133,7 +133,6 @@ def main():
					cmd=raw_input("<%d> "%cmdCounter)
					cmd=raw_input("<%d> "%cmdCounter)
				except IOError:
				except IOError:
					cmd='exit'
					cmd='exit'
					pass
			else:
			else:
				cmd="version"
				cmd="version"
			cmdCounter=cmdCounter+1
			cmdCounter=cmdCounter+1
@@ -157,6 +156,15 @@ def main():
					idx = res.find('\\')
					idx = res.find('\\')
					cmd_name, response = res[:idx+1], res[idx+1:].rstrip('\\')
					cmd_name, response = res[:idx+1], res[idx+1:].rstrip('\\')
					if success and response:
					if success and response:
						if response.startswith('STR '):
							# We got a formatted string in return, print it
							# without any modification
							response = response[4:]
							lines = response.split('\n')
							print cmd_name
							for line in lines:
								print line
						else:
							groups = response.split(',')
							groups = response.split(',')
							for group in groups:
							for group in groups:
								values = group.split(';')
								values = group.split(';')
@@ -173,8 +181,13 @@ def main():
					newEx.setAction("command()")
					newEx.setAction("command()")
					newEx.setReason(ex.message)
					newEx.setReason(ex.message)
					newEx.log(simpleClient.getLogger(),ACSLog.ACS_LOG_ERROR) 
					newEx.log(simpleClient.getLogger(),ACSLog.ACS_LOG_ERROR) 
		except KeyboardInterrupt:
		except EOFError:
			# CTRL + D event: Equivalent to the exit command, we stop the loop
			stopAll=True
			stopAll=True
		except KeyboardInterrupt:
			# CTRL + C event: Ignore whatever string was written on the
			# terminal and show a new prompt line
			print '^C'
            
            
	readline.write_history_file(historyFile)            
	readline.write_history_file(historyFile)            
	simpleClient.releaseComponent(compName)     
	simpleClient.releaseComponent(compName)     
Loading