[kepler-users] help with Python Actors

Rick Moore rem63 at cornell.edu
Thu Jul 9 14:15:08 PDT 2009


Tommy and Christopher, thanks for the ideas,

I think I'll give ObjectToken a whirl first.

Rick

Tommy Stropp wrote:
> Hi Rick
>
> If you're just passing from one python actor to another, you should be 
> able to just pass it as an object. Just import ObjectToken:
> from ptolemy.data import ObjectToken
> then send your tuple through the port as an ObjectToken and make sure 
> you set the port type to object.
> In the receiving python actor, using the getValue() method will get 
> you your tuple back.
>
> - Tommy
>
>
>
>
> > Date: Thu, 9 Jul 2009 09:55:57 -0700
> > From: cxh at eecs.berkeley.edu
> > To: rem63 at cornell.edu
> > CC: kepler-users at kepler-project.org
> > Subject: Re: [kepler-users] help with Python Actors
> >
> > 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
> > _______________________________________________
> > Kepler-users mailing list
> > Kepler-users at kepler-project.org
> > http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>
> ------------------------------------------------------------------------
> Windows Live helps you keep up with all your friends, in one place. 
> <http://go.microsoft.com/?linkid=9660824>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20090709/81ff9394/attachment.html>


More information about the Kepler-users mailing list