Class ArrayPlotter

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

    public class ArrayPlotter
    extends Plotter
    implements SequenceActor

    A plotter that plots a sequence of arrays of doubles. This plotter contains an instance of the Plot class from the Ptolemy plot package as a public member. Data at the input, which can consist of any number of channels, are plotted on this instance. Each input channel 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 SequenceScope, but it has fewer drawing artifacts than SequenceScope since it does not use XOR drawing mode.

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

      • input

        public TypedIOPort input
        Input port, which receives an array of doubles.
      • 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.
      • xUnit

        public Parameter xUnit
        The increment of the X axis.
      • xInit

        public Parameter xInit
        The start point of the X axis.
      • _xInit

        protected double _xInit
        Start of the X axis counter.
      • _xUnit

        protected double _xUnit
        Increment of the X axis counter.
    • 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 and plot it as a function of the iteration number, scaled by xUnit. The first point is plotted at the horizontal position given by xInit. The increments on the position are given by xUnit. 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.