[GSOC2018][GRPlot][18-6-2018] Created first working prototype of the scripting Layer

5 views
Skip to first unread message

Pranav Garg

unread,
Jun 18, 2018, 8:22:45 AM6/18/18
to Sameer Deshmukh, Prasun Anand, Pjotr Prins, John Woods, SciRuby Mailing List
Since the important work in porting the GR Framework to Ruby is complete. The next task is to create a functioning High-level plotting library on top of that AKA the scripting layer as a class and creating the required artist functions (Most Artist functions are already implemented in GR Framework).

One of the things that stumped me here was the question of how to define the range of the axes of the graph. Since the user might want multiple plots in a single image. In GR Framework the plotting area is normalized to values between 0 and 1.after which you have to explicitly mention what value is corresponding to 0 and what value is corresponding to 1 for each axis.
If I had to just make a single plot then it would have been easy I could have easily found out the maximum and minimum of the data given to the plotting function and plotted it right there.
But for multiple graphs, I needed to analyse the parameters (coordinates) of all the functions and plot accordingly.

I spent the last night thinking of various ways to execute this
The first idea that came to me was to create a queue of called functions that gets executed when popped.I was not able to come across anything like this.
Then I researched a bit about functors. Finally, I decided to turn every function into a class that can be instantiated and added to a tasklist .So when a graph is called by the user the program checks for the maximum and minimum coordinates and when the user asks for plot using the .plotgraph instance the library plots the axes and the graphs by popping the tasklist.
I created a small example testing.rb Which plots multiple graphs on a single image(As attached).

I now see the how the design suggestions of the mentors are coming together and easing the workflow to a great extent :D. I hope I am able to develop similar foresight by the end of the project.

You can find the commit for the same here.
Regards
Pranav Garg


GRPlot.png

Sameer Deshmukh

unread,
Jun 18, 2018, 8:32:57 AM6/18/18
to Pranav Garg, Prasun Anand, Pjotr Prins, John Woods, SciRuby Mailing List

Whatever you're doing right now is very specific to GR. We had agreed upon a common interface for both libraries. The scripting layer comes last. Lets talk about it in detail tonight.

Reply all
Reply to author
Forward
0 new messages