The ESO Recipe Flexible Execution Workbench
Instructions for Python usage in ESO Reflex
At present astronmers are widely using Python as a scripting languague and therefore it is important to get
the flexibility and power of Python in use of ESO Reflex. This page includes instructions and examples with detailed description of the reflex.py Python module which is required for the usage in ESO Reflex.
Python interface of Reflex
The reflex.py Python module (download here) is the Python interface of Reflex. It is located under reflex/reflex-current/scripts/python. It contains the following four classes for reading parametres from stdin and printing output parameters from stdout back to java.
ReflexExittells to Reflex we are exiting the Python script. When exiting the outputs are updated.ReflexInputandReflexOutputcreate the Reflex input and output ports with following three parameters:nameis an individual port identification name, e.g.dispCoeffmimetypetells to Reflex the data type of the input/output, most common values are'text/plain'and'file/fits'valueis a value for the input port or the result for the output port, value can be in any type but it must be identical with mimetype
These two classes contain also methods for setting and reading these parameters.
setMimeType(mimeType)sets the mime type of the port,mimeTypeisStringsetName(name)sets the name of the port,nameisStringsetValue(value)sets the location of the port,valueis e.g."/home/tester/rectified_lamp_mxu.fits"printValues()prints portname,mimeTypeandvaluegetName()returns portnamegetMimeType()returns portmimeTypegetValue()returns portvalue
ReflexQueryhas three parameters-qmakes a Reflex query and displays Reflex ports with correct mimetypes and values-druns script with default values (god option with Python stand alone usage and for test purposes)-helpshows possible parameters
Python script editing window
In the figure below is the workflow pythonExample.xml located under reflex/reflex-current/examples.
Click on the Python processor Python_example, and the window below will open.
Edit the script by adding the row input2 = ReflexInput(type="'file/fits'",name="output2",value="test2.fits") under the row input1 = ReflexInput(type="'text/plain'",name="outputFilename",value="test.fits"). Press "Save script changes", and you will see in the figure below a new entry in the Input ports window.
Make on purpose an error to the scripts. In the example below the word BUG is written on a line. Try pressing "Save script changes", and you will get the message below.
