[kepler-users] help with Python Actors

Christopher Brooks cxh at eecs.berkeley.edu
Thu Jul 9 09:55:57 PDT 2009


Hi Rick,
I'm not familiar with Python or Python tuples.
http://diveintopython.org/getting_to_know_python/tuples.html
says "A tuple is an immutable list. A tuple can not be changed
in any way once it is created."

You could try setting the type of the port to object, but
this might require hacking around with the Python actor code.

It could be that there is a need for a PythonTuple type, which is
not that difficult to add if there is no need to convert from
other types to PythonTuple.

--start--
5.3 How do I add a type?
The Ptolemy Type system is covered in a chapter in "Volume 2:
Ptolemy II Software Architecture," which can be found via
http://ptolemy.eecs.berkeley.edu/ptolemyII/designdoc.htm

The Ptolemy Type system has a type lattice that is implemented
in classes in ptolemy.data.type.  A common misconception is
that to add a type, one needs to add the new type to the type
lattice by editing ptolemy.data.type.BaseType.
However, you need only add a type to the type lattice if you want
to automatically convert your type to preexisting types (other
than UNKNOWN and GENERAL).  If you have a type class, then the type
system will check types for you.  For examples, see
$PTII/ptolemy/data/type/test/TestToken.java and
$PTII/ptolemy/actor/lib/Security/KeyToken.java.
--end--

The advantage of adding a PythonTupleToken over using an ObjectToken is
that with a PythonTupleToken, you can be sure that two actors are sharing
the right data type instead of just a random Object.

_Christopher

Rick Moore wrote:
> I'm trying to use multiple Python Actors in a data validation workflow. 
> What I need to do is pass a Python tuple from one Python Actor to the 
> next, but I can't figure out how to configure the ports to allow it. So 
> far have tried setting the type to General and Unknown and also leaving 
> the type blank.
> 
> I'm new at this, so any help would be greatly appreciated.
> 
> Rick Moore
> Information Science
> Cornell University
> _______________________________________________
> Kepler-users mailing list
> Kepler-users at kepler-project.org
> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users

-- 
Christopher Brooks (cxh at eecs berkeley edu) University of California
CHESS Executive Director                      US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust        Berkeley, CA 94720-1774
ph: 510.643.9841 fax:510.642.2718	      (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 (W-F) 510.655.5480



More information about the Kepler-users mailing list