AtacamaLargeMillimeterArray ACS Training Using the Python Error System
NRAO, July 2004ACS Training2 Getting Started At the console, type: cvs co ACS/LGPL/CommonSoftware/acscourse This gives you the source code from the slides.
NRAO, July 2004ACS Training3 What’s Available in Python? Everything available in C++ including Completion helper class support, but it’s much simpler to use.
NRAO, July 2004ACS Training4 Example (XML) <Type xmlns:xsi=" xsi:noNamespaceSchemaLocation="ACSError.xsd" name="ACSErrTypeACSCourse" type="9005" _prefix="alma"> <Code name="Pointing" shortDescription="Pointing" description="Pointing in progress"/> <ErrorCode name="TargetNotFound" shortDescription="Target Not Found" description="Target Couldn't be found"/>
NRAO, July 2004ACS Training5 Example (IDL) #ifndef _ACSCOURSE_MOUNT_IDL_ #define _ACSCOURSE_MOUNT_IDL_ #include /* */ #include #pragma prefix "alma" module ACSCOURSE_MOUNT { interface Mount1 : ACS::ACSComponent { /* (Pre)sets a new non-moving position for the antenna. az position azimuth (degree) elev position elevation (degree) */ void objfix (in double az, in double elev) raises (ACSErrTypeACSCourse::TargetNotFoundEx); }; #endif IDL
NRAO, July 2004ACS Training6 Example (Python) import ACSCOURSE_MOUNT__POA #--ACS Imports from Acspy.Servants.ContainerServices import ContainerServices from Acspy.Servants.ComponentLifecycle import ComponentLifecycle from Acspy.Servants.ACSComponent import ACSComponent import ACSErrTypeACSCourseImpl class Mount1(ACSCOURSE_MOUNT__POA.Mount1, #CORBA stubs for IDL interface ACSComponent, #Base IDL interface ContainerServices, #Developer niceties ComponentLifecycle): #HLA stuff '''Simple component impl provided as a reference for developers.''' def __init__(self): ACSComponent.__init__(self) ContainerServices.__init__(self) return Corresponds to Error Type
NRAO, July 2004ACS Training7 Example (Python) # def objfix(self, az, el): '''Python implementation of IDL method.''' if el>90: self.getLogger().logInfo("objfix called with az="+str(az)+ " and el="+str(el)) else: self.getLogger().logCritical("Wrong value for el "+str(el)) raise ACSErrTypeACSCourseImpl.TargetNotFoundExImpl() Corresponds to Error Type Corresponds to ErrorCode
NRAO, July 2004ACS Training8 What methods do exception/completion helper classes generated by the ACS Error System have? As usual, look at the Pydoc!Pydoc
NRAO, July 2004ACS Training9 Questions about the Python Error System?
NRAO, July 2004ACS Training10 Demo