Class ArrayPlotterXY

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, PortablePlaceable, SequenceActor, TypedActor, Changeable, Configurable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class ArrayPlotterXY
    extends Plotter
    implements SequenceActor

    A plotter that plots a sequence of pairs of arrays of doubles as an XY plot. This plotter contains an instance of the Plot class from the Ptolemy plot package as a public member. Data at the inputs, which can have any number of channels, are plotted on this instance. Each pair of input channels is plotted as a separate data set. Each input token is an array of doubles.

    The iterationsPerUpdate parameter can be used to fine tune the display. It can be quite expensive to generate the display, and by default, this actor generates it on every firing. If iterationsPerUpdate is set to some integer greater than one, then it specifies how many iterations should be executed between updates. Thus, if iterationsPerUpdate = 2, then every second time this actor fires, it will update the display. That is, it will update its display on the first firing, the third, the fifth, etc. It will, however, consume its inputs on every firing. The plot is always updated in the wrapup() method.

    Note that this can be used to generate live plots, like XYScope, but it has fewer drawing artifacts than XYScope since it does not use XOR drawing mode.

    Since:
    Ptolemy II 6.1
    Version:
    $Id$
    Author:
    Edward A. Lee
    See Also:
    XYScope
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Yellow (eal)
    • Field Detail

      • iterationsPerUpdate

        public Parameter iterationsPerUpdate
        The number of iterations between updates of the display on the screen. This parameter has type IntToken, with default value 1. Its value must be non-negative.
      • x

        public TypedIOPort x
        Input port for the horizontal axis, which receives an array of doubles.
      • y

        public TypedIOPort y
        Input port for the vertical axis, which receives an array of doubles.
    • Method Detail

      • initialize

        public void initialize()
                        throws IllegalActionException
        If the plot has not already been created, create it. If configurations specified by a call to configure() have not yet been processed, process them. This overrides the base class to also start counting iterations, so that the iterationsPerUpdate parameter works.
        Specified by:
        initialize in interface Initializable
        Overrides:
        initialize in class Plotter
        Throws:
        IllegalActionException - If the parent class throws it.
      • postfire

        public boolean postfire()
                         throws IllegalActionException
        Read at most one token from each input channel on x and y inputs, and if there is a token on both, plot the data as an XY plot. The input data are plotted in postfire() to ensure that the data have settled.
        Specified by:
        postfire in interface Executable
        Overrides:
        postfire in class AtomicActor<TypedIOPort>
        Returns:
        True if it is OK to continue.
        Throws:
        IllegalActionException - If there is no director, or if the base class throws it.