The ispy
package is a Python interface to IPC, the Information Service (IS)
and the Online Histogramming Service (OH).
It allows easy access from a scripting language to all the information in IS and OH.
To use the package, simply start the tdaq_python
interpreter:
% tdaq_python Python 2.5 (r25:51908, Oct 18 2007, 16:26:11) [GCC 3.4.6 20060404 (Red Hat 3.4.6-8)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import ipc >>> import ispy >>> import oh
The following classes from IS are available in Python:
The following minimal script shows how to use them in a simple way:
#!/usr/bin/env tdaq_python part_name = 'rhauser_test' import sys from ipc import IPCPartition from ispy import * p = IPCPartition(part_name) if not p.isValid(): print "Partition:",p.name(),"is not valid" sys.exit(1) x = ISObject(p, 'DF.L2SV-1', 'L2SV') print "Exists: ",x.isExist() x.checkout() print x sum = ISObject(p,'DF.L2SV-Summary', 'L2SV') sum.LVL2_events = x.LVL2_events sum.checkin(False)
Several utility classes are provide to make it easier to read
arbitrary information from IS. See the examples
directory
for how to use them.
The ispygui.py
is a simple application using Tcl/Tk to
give an overview of the dataflow part of a running partition.
The callback routines can now be used in separate python threads, the actual code is protected and deals nicely with the interpreter.
The following classes are available from the OH package. Note that many methods are pythonized in such a way that the user does not have to use a method that is specific for TH1, TGraph etc.