[kepler-users] I'm new to Kepler

Derik Barseghian barseghian at nceas.ucsb.edu
Tue Apr 7 15:13:49 PDT 2009


Hi Tommy,

I've attached a workflow that works without your needing to specify  
the length of the array. It uses a Composite actor inside an Iterate  
Over Array actor. Since you had no more control actors in the  
iteration of the workflow you sent me, I switched to the SDF director.  
Right now I just send the resultant array into a Barplot actor, but  
you should be able to change this to an R actor. Note also that I had  
to change the String Splitter actor to split on \n instead of \r\n,  
even though your files do indeed use dos end-of-line characters -- I'm  
not sure why this is the case at the moment.

To convert from String to Double, you can try the StringToN actor if  
you're running kepler-trunk. It doesn't have documentation and isn't  
in the gui search-tree yet, but you can use Tools => Instantiate  
Component to instantiate it. I believe you just configure the output  
port to be type double. If you're trying to use Kepler-1.0, let us  
know, and we can try to find a solution for that.

Hope this helps,
Derik

-------------- next part --------------
A non-text attachment was scrubbed...
Name: HistogramMaker_new.xml
Type: text/xml
Size: 74773 bytes
Desc: not available
URL: <http://lists.nceas.ucsb.edu/kepler/pipermail/kepler-users/attachments/20090407/bc18e25a/attachment.xml>
-------------- next part --------------



On Apr 7, 2009, at 9:44 AM, Tommy Stropp wrote:

> Sure, no problem.
>
> - Tommy
>
> http://www.arresteddevelopment2009.com
>
>
>
>
> > From: barseghian at nceas.ucsb.edu
> > To: tommystropp at hotmail.com
> > Subject: Re: [kepler-users] I'm new to Kepler
> > Date: Mon, 6 Apr 2009 18:10:38 -0700
> >
> > Hi Tommy,
> > If you don't mind, could you send me the workflow file? It will save
> > me some time trying to help. If not, that's ok, I can try to help
> > without it.
> > Derik
> >
> >
> > On Apr 6, 2009, at 4:00 PM, Tommy Stropp wrote:
> >
> > > Okay, I like the second option, but the problem I have now is
> > > that when I set the iterations to 0, it gives me infinitely many
> > > arrays (which makes sense). If I set it to 1, it does nothing. I
> > > would have thought that I only need to set it to 1 since I only  
> need
> > > to read the file once, no? I played around with the numbers and  
> with
> > > a file that has 20 lines (so, an array of length 20), if I set
> > > iterations to less than 46 it does nothing, 46 - 85 it displays  
> one
> > > array, 86 - 125 it displays two, 126 it displays three, etc.  
> With a
> > > 10 line file, it displays twice as many arrays. I've included
> > > another screenshot of this new workflow and I simplified it a bit.
> > > I've also made progress since my previous email. I solved the
> > > problem of not knowing the lenght of the array I need by making a
> > > composite actor that has its own Director that only fires once. I
> > > use FileReader, put it the result in an array, and then I know the
> > > array length. The only problem with this method is that it isn't
> > > very... elegent. I don't like the fact that I have to read the  
> file
> > > twice, with LineReader AND with FileReader. I mean, I'll use it  
> if I
> > > have to but If I can make your method work, I would prefer that.
> > >
> > > And also, how do I convert from String to Double? I need it to
> > > work with Doubles in other files, but there is no StringToDouble
> > > actor (that I can find).
> > >
> > > - Tommy
> > >
> > > http://www.arresteddevelopment2009.com
> > >
> > >
> > >
> > >
> > > > CC: kepler-users at kepler-project.org
> > > > From: barseghian at nceas.ucsb.edu
> > > > To: tommystropp at hotmail.com
> > > > Subject: Re: [kepler-users] I'm new to Kepler
> > > > Date: Fri, 3 Apr 2009 16:07:53 -0700
> > > >
> > > > Tommy,
> > > >
> > > > Oops, you're right. I'm not sure of a way around having to
> > > statically
> > > > declare how long the array will be in advance of running the
> > > workflow.
> > > >
> > > > One solution would be to run two workflows in succession. The  
> first
> > > > would be a modified version of your workflow that instead ends  
> with
> > > > your String to Int going into a Counter actor that outputs to  
> a File
> > > > Writer. So this file would store the count of values found. Then
> > > in a
> > > > second modified version of your current workflow, you could  
> get the
> > > > number of values via a File To Array Converter actor feeding  
> into an
> > > > Array Maximum actor.
> > > >
> > > > Another option is to read the entire file in at the beginning of
> > > your
> > > > workflow with the File Reader actor. You could then split it by
> > > end of
> > > > line characters, and iterate over the resulting arrays to remove
> > > +'s.
> > > > With this option you'll know how many values you'll be sending  
> into
> > > > the R actor from the start.
> > > >
> > > > Let me know how it goes,
> > > > Derik
> > > >
> > > >
> > > >
> > > > On Apr 3, 2009, at 12:58 PM, Tommy Stropp wrote:
> > > >
> > > > > Hi Derik,
> > > > >
> > > > > Well, that kind of helped.
> > > > > If I configure the arrayLength parameter to be the exact  
> number I
> > > > > need, it does work. However, I don't know this number. It  
> will be
> > > > > different for different files, and when I set it to a number
> > > higher
> > > > > than the number of values it will receive, I get no output. I
> > > > > attached an ArrayLength actor to the SequenceToArray actor (so
> > > now I
> > > > > have StringToInt -> SequenceToArray -> ArrayLength ->  
> Display) and
> > > > > it also gives me no output. It seems that the array isn't  
> being
> > > > > created.
> > > > > Any insight? Thanks again.
> > > > >
> > > > > - Tommy
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > > CC: kepler-users at kepler-project.org
> > > > > > From: barseghian at nceas.ucsb.edu
> > > > > > To: tommystropp at hotmail.com
> > > > > > Subject: Re: [kepler-users] I'm new to Kepler
> > > > > > Date: Fri, 3 Apr 2009 12:36:28 -0700
> > > > > >
> > > > > > Hi Tommy,
> > > > > >
> > > > > > You might try a Sequence To Array actor between your  
> String to
> > > Int
> > > > > and
> > > > > > RExpression actors, so that you can feed all your values  
> into
> > > the R
> > > > > > actor at once. You'd optimally want to configure the  
> Sequence to
> > > > > Array
> > > > > > ArrayLength parameter to be the number of values it's  
> going to
> > > > > > receive. If it's the case that you don't know and therefore
> > > can't
> > > > > set
> > > > > > that number before running the workflow, in this case for  
> your
> > > > > > particular workflow, I believe you can just set  
> ArrayLength to a
> > > > > very
> > > > > > high number.
> > > > > >
> > > > > > Derik
> > > > > >
> > > > > > On Apr 3, 2009, at 11:44 AM, Tommy Stropp wrote:
> > > > > >
> > > > > > > I'm trying to make a histogram of values that I read  
> from a
> > > file.
> > > > > > > Each value is on a separate line in the file and each line
> > > has a
> > > > > lot
> > > > > > > of data that is separated by tabs.
> > > > > > > So what I have been able to do is extract the numbers I  
> need,
> > > > > but I
> > > > > > > haven't been able to figure out how to put them all  
> together
> > > to
> > > > > make
> > > > > > > a histogram. The way I have it now, Kepler makes a  
> separate
> > > > > > > histogram for each value. Also, I only have that working  
> with
> > > > > > > integers. I need to work with floating point numbers as  
> well.
> > > > > > > I should also tell you that I know nothing when it comes  
> to
> > > > > > > programming in R. Everything I am doing I am learning by
> > > myself.
> > > > > > > I've included a screenshot of what I have so far and a  
> couple
> > > > > sample
> > > > > > > files that can be opened with a text editor (the end of  
> line
> > > > > > > character is \r\n).
> > > > > > > Any help would be greatly appreciated. Thanks in advance.
> > > > > > >
> > > > > > > - Tommy
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Internet Explorer 8 makes surfing easier. Get it now!
> > > > > > > <
> > > > > > > KeplerWorkflow
> > > > > > > .jpg
> > > > > > > >
> > > > > > > <
> > > > > > > file1_integers
> > > > > > > .gff
> > > > > > >
> > > > >
> > >  
> ><file2_doubles.gff>_______________________________________________
> > > > > > > Kepler-users mailing list
> > > > > > > Kepler-users at kepler-project.org
> > > > > > > http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
> > > > > >
> > > > >
> > > > > Create a cool, new character for your Windows Live? Messenger.
> > > Check
> > > > > it out
> > > >
> > >
> > > Windows Live Messenger makes it easier to stay in touch ? learn  
> how!
> > > <HistMaker.bmp>
> >
>
> Internet Explorer 8 makes surfing easier. Get it now!  
> <HistogramMaker.xml>



More information about the Kepler-users mailing list