[seek-dev] Some Kepler/Ptolemy Sampling Workflows

Rod Spears rods at ku.edu
Tue Jun 1 20:03:49 PDT 2004


Did the IRC discussion get captured and mailed to a seek news group? We 
really HAVE to start doing this. I was out on friday.

Rod


Dan Higgins wrote:

> Hi All,
>    After our IRC discussion on Friday, I built a couple of workflows 
> for subsampling from a dataset using existing Ptolemy actors. One is a 
> random subsample from an input vector and the other is a sequential 
> subsampler (every nth value). These could be turned into composite 
> actors, but for now they are probably best considered as samples of 
> what can be done by combining lower level existing actors. The MOML 
> files for these workflows are attached.
>
> Comments appreciated
>
> Dan
>
>------------------------------------------------------------------------
>
><?xml version="1.0" standalone="no"?>
><!DOCTYPE entity PUBLIC "-//UC Berkeley//DTD MoML 1//EN"
>    "http://ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.dtd">
><entity name="sequencedSampling" class="ptolemy.actor.TypedCompositeActor">
>    <property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="4.0-beta">
>    </property>
>    <property name="SDF Director" class="ptolemy.domains.sdf.kernel.SDFDirector">
>        <property name="iterations" class="ptolemy.data.expr.Parameter" value="1">
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[190.0, 35.0]">
>        </property>
>    </property>
>    <property name="input" class="ptolemy.data.expr.Parameter" value="{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}">
>        <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
>            <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 0.0, 1.0, 1.0}">
>            </property>
>        </property>
>        <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
>            <configure>
>      <svg>
>        <text x="20" style="font-size:14; font-family:SansSerif; fill:blue" y="20">-P-</text>
>      </svg>
>    </configure>
>        </property>
>        <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[30.0, 85.0]">
>        </property>
>    </property>
>    <property name="step" class="ptolemy.data.expr.Parameter" value="3">
>        <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
>            <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 0.0, 1.0, 1.0}">
>            </property>
>        </property>
>        <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
>            <configure>
>      <svg>
>        <text x="20" style="font-size:14; font-family:SansSerif; fill:blue" y="20">-P-</text>
>      </svg>
>    </configure>
>        </property>
>        <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[30.0, 125.0]">
>        </property>
>    </property>
>    <property name="startIndex" class="ptolemy.data.expr.Parameter" value="1">
>        <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
>            <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 0.0, 1.0, 1.0}">
>            </property>
>        </property>
>        <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
>            <configure>
>      <svg>
>        <text x="20" style="font-size:14; font-family:SansSerif; fill:blue" y="20">-P-</text>
>      </svg>
>    </configure>
>        </property>
>        <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[30.0, 105.0]">
>        </property>
>    </property>
>    <property name="Annotation" class="ptolemy.vergil.kernel.attributes.TextAttribute">
>        <property name="text" class="ptolemy.kernel.util.StringAttribute" value="This workflow shows a simple, sequential sampling tool for sampling from a&#10;input array. The startIndex and the step are provided as parameters. The&#10;output is an array which is a subset of the input array, starting at the&#10;'startIndex' element of the input array and selecting elements spaced at&#10;the given 'step'.">
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="{40, 275}">
>        </property>
>    </property>
>    <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds = {523, 94, 815, 518}, maximized = false}">
>    </property>
>    <property name="_vergilSize" class="ptolemy.actor.gui.SizeAttribute" value="[600, 400]">
>    </property>
>    <property name="_vergilZoomFactor" class="ptolemy.data.expr.ExpertParameter" value="1.0">
>    </property>
>    <property name="_vergilCenter" class="ptolemy.data.expr.ExpertParameter" value="{300.0, 200.0}">
>    </property>
>    <entity name="Ramp" class="ptolemy.actor.lib.Ramp">
>        <property name="firingCountLimit" class="ptolemy.data.expr.Parameter" value="input.length()/step">
>        </property>
>        <property name="init" class="ptolemy.data.expr.Parameter" value="startIndex">
>        </property>
>        <property name="step" class="ptolemy.actor.parameters.PortParameter" value="step">
>        </property>
>        <doc>Create a sequence of tokens with increasing value</doc>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[65.0, 210.0]">
>        </property>
>    </entity>
>    <entity name="Expression" class="ptolemy.actor.lib.Expression">
>        <property name="expression" class="ptolemy.kernel.util.StringAttribute" value="input(i)">
>        </property>
>        <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
>            <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="expression">
>            </property>
>            <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
>            </property>
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[185.0, 210.0]">
>        </property>
>        <port name="i" class="ptolemy.actor.TypedIOPort">
>            <property name="input"/>
>            <property name="_type" class="ptolemy.actor.TypeAttribute" value="int">
>            </property>
>            <property name="_showName" class="ptolemy.kernel.util.SingletonAttribute">
>            </property>
>        </port>
>    </entity>
>    <entity name="SequenceToArray" class="ptolemy.domains.sdf.lib.SequenceToArray">
>        <property name="arrayLength" class="ptolemy.actor.parameters.PortParameter" value="input.length()/step">
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[315.0, 220.0]">
>        </property>
>    </entity>
>    <entity name="Display" class="ptolemy.actor.lib.gui.Display">
>        <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds = {903, 563, 292, 231}, maximized = false}">
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[475.0, 220.0]">
>        </property>
>    </entity>
>    <relation name="relation" class="ptolemy.actor.TypedIORelation">
>    </relation>
>    <relation name="relation2" class="ptolemy.actor.TypedIORelation">
>    </relation>
>    <relation name="relation3" class="ptolemy.actor.TypedIORelation">
>    </relation>
>    <link port="Ramp.output" relation="relation"/>
>    <link port="Expression.output" relation="relation2"/>
>    <link port="Expression.i" relation="relation"/>
>    <link port="SequenceToArray.input" relation="relation2"/>
>    <link port="SequenceToArray.output" relation="relation3"/>
>    <link port="Display.input" relation="relation3"/>
></entity>
>  
>
>------------------------------------------------------------------------
>
><?xml version="1.0" standalone="no"?>
><!DOCTYPE entity PUBLIC "-//UC Berkeley//DTD MoML 1//EN"
>    "http://ptolemy.eecs.berkeley.edu/xml/dtd/MoML_1.dtd">
><entity name="randomSample" class="ptolemy.actor.TypedCompositeActor">
>    <property name="_createdBy" class="ptolemy.kernel.attributes.VersionAttribute" value="4.0-beta">
>    </property>
>    <property name="SDF Director" class="ptolemy.domains.sdf.kernel.SDFDirector">
>        <property name="allowDisconnectedGraphs" class="ptolemy.data.expr.Parameter" value="false">
>        </property>
>        <property name="iterations" class="ptolemy.data.expr.Parameter" value="10">
>        </property>
>        <property name="vectorizationFactor" class="ptolemy.data.expr.Parameter" value="1">
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="125.0, 45.0">
>        </property>
>    </property>
>    <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds = {92, 47, 815, 719}, maximized = false}">
>    </property>
>    <property name="_vergilSize" class="ptolemy.actor.gui.SizeAttribute" value="[600, 608]">
>    </property>
>    <property name="_vergilZoomFactor" class="ptolemy.data.expr.ExpertParameter" value="1.0">
>    </property>
>    <property name="_vergilCenter" class="ptolemy.data.expr.ExpertParameter" value="{300.0, 304.0}">
>    </property>
>    <property name="input" class="ptolemy.data.expr.Parameter" value="{1,2,3,4,5,6,7,8,9,10,11,12,13,14}">
>        <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
>            <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 0.0, 1.0, 1.0}">
>            </property>
>        </property>
>        <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
>            <configure>
>      <svg>
>        <text x="20" style="font-size:14; font-family:SansSerif; fill:blue" y="20">-P-</text>
>      </svg>
>    </configure>
>        </property>
>        <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[40.0, 95.0]">
>        </property>
>    </property>
>    <property name="sampleSize" class="ptolemy.data.expr.Parameter" value="5">
>        <property name="_icon" class="ptolemy.vergil.icon.ValueIcon">
>            <property name="_color" class="ptolemy.actor.gui.ColorAttribute" value="{0.0, 0.0, 1.0, 1.0}">
>            </property>
>        </property>
>        <property name="_smallIconDescription" class="ptolemy.kernel.util.SingletonConfigurableAttribute">
>            <configure>
>      <svg>
>        <text x="20" style="font-size:14; font-family:SansSerif; fill:blue" y="20">-P-</text>
>      </svg>
>    </configure>
>        </property>
>        <property name="_editorFactory" class="ptolemy.vergil.toolbox.VisibleParameterEditorFactory">
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="{40, 115}">
>        </property>
>    </property>
>    <property name="Annotation" class="ptolemy.vergil.kernel.attributes.TextAttribute">
>        <property name="text" class="ptolemy.kernel.util.StringAttribute" value="This is an example of a workflow which will randomly sample an input vector&#10;for the number of subsamples indicated by the sampleSize parameter. A random&#10;number generator in the 'Uniform' actor is used to create a random index and&#10;the value of the indexed input is compied to the output. [Note that the random&#10;number seed is a parameter of the 'Uniform' actor.]">
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[40.0, 365.0]">
>        </property>
>    </property>
>    <entity name="ArrayElement" class="ptolemy.actor.lib.ArrayElement">
>        <property name="index" class="ptolemy.actor.parameters.PortParameter" value="3">
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[245.0, 195.0]">
>        </property>
>    </entity>
>    <entity name="Expression" class="ptolemy.actor.lib.Expression">
>        <property name="expression" class="ptolemy.kernel.util.StringAttribute" value="input">
>        </property>
>        <property name="_icon" class="ptolemy.vergil.icon.BoxedValueIcon">
>            <property name="attributeName" class="ptolemy.kernel.util.StringAttribute" value="expression">
>            </property>
>            <property name="displayWidth" class="ptolemy.data.expr.Parameter" value="60">
>            </property>
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[65.0, 185.0]">
>        </property>
>    </entity>
>    <entity name="Uniform" class="ptolemy.actor.lib.Uniform">
>        <property name="seed" class="ptolemy.data.expr.Parameter" value="0L">
>        </property>
>        <property name="lowerBound" class="ptolemy.data.expr.Parameter" value="0.0">
>        </property>
>        <property name="upperBound" class="ptolemy.data.expr.Parameter" value="input.length()">
>        </property>
>        <doc>Create a sequence of uniformly distributed random numbers</doc>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[70.0, 275.0]">
>        </property>
>    </entity>
>    <entity name="Round" class="ptolemy.actor.lib.conversions.Round">
>        <property name="function" class="ptolemy.kernel.util.StringAttribute" value="floor">
>            <property name="style" class="ptolemy.actor.gui.style.ChoiceStyle">
>                <property name="ceil" class="ptolemy.kernel.util.StringAttribute" value="ceil">
>                </property>
>                <property name="floor" class="ptolemy.kernel.util.StringAttribute" value="floor">
>                </property>
>                <property name="round" class="ptolemy.kernel.util.StringAttribute" value="round">
>                </property>
>                <property name="truncate" class="ptolemy.kernel.util.StringAttribute" value="truncate">
>                </property>
>            </property>
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[180.0, 275.0]">
>        </property>
>    </entity>
>    <entity name="SequenceToArray" class="ptolemy.domains.sdf.lib.SequenceToArray">
>        <property name="arrayLength" class="ptolemy.actor.parameters.PortParameter" value="sampleSize">
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[350.0, 230.0]">
>        </property>
>    </entity>
>    <entity name="Display" class="ptolemy.actor.lib.gui.Display">
>        <property name="rowsDisplayed" class="ptolemy.data.expr.Parameter" value="10">
>        </property>
>        <property name="columnsDisplayed" class="ptolemy.data.expr.Parameter" value="40">
>        </property>
>        <property name="_windowProperties" class="ptolemy.actor.gui.WindowPropertiesAttribute" value="{bounds = {494, 400, 308, 224}, maximized = false}">
>        </property>
>        <property name="_location" class="ptolemy.kernel.util.Location" value="[480.0, 230.0]">
>        </property>
>    </entity>
>    <relation name="relation2" class="ptolemy.actor.TypedIORelation">
>    </relation>
>    <relation name="relation" class="ptolemy.actor.TypedIORelation">
>    </relation>
>    <relation name="relation4" class="ptolemy.actor.TypedIORelation">
>    </relation>
>    <relation name="relation3" class="ptolemy.actor.TypedIORelation">
>    </relation>
>    <relation name="relation5" class="ptolemy.actor.TypedIORelation">
>    </relation>
>    <link port="ArrayElement.input" relation="relation2"/>
>    <link port="ArrayElement.output" relation="relation3"/>
>    <link port="ArrayElement.index" relation="relation4"/>
>    <link port="Expression.output" relation="relation2"/>
>    <link port="Uniform.output" relation="relation"/>
>    <link port="Round.input" relation="relation"/>
>    <link port="Round.output" relation="relation4"/>
>    <link port="SequenceToArray.input" relation="relation3"/>
>    <link port="SequenceToArray.output" relation="relation5"/>
>    <link port="Display.input" relation="relation5"/>
></entity>
>  
>

-- 
	Rod Spears
Biodiversity Research Center
University of Kansas
1345 Jayhawk Boulevard
Lawrence, KS 66045, USA
Tel: 785 864-4082, Fax: 785 864-5335

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mercury.nceas.ucsb.edu/ecoinformatics/pipermail/seek-dev/attachments/20040601/852ffd53/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jayhawk.gif
Type: image/gif
Size: 4637 bytes
Desc: not available
Url : http://mercury.nceas.ucsb.edu/ecoinformatics/pipermail/seek-dev/attachments/20040601/852ffd53/jayhawk.gif


More information about the Seek-dev mailing list