Skip to content

GSoC 2019 Proposal

Alish Dipani edited this page Jul 16, 2019 · 12 revisions

1. Contact information. Please provide your email address, GitHub username, and approximate physical location.
Name: Alish Dipani
Email: alish.dipani@gmail.com
Github Username: alishdipani
Physical Location: Nagpur, Maharashtra, India
Website: alishdipani.github.io

2. Why do you like Ruby, and why do you want to work on SciRuby?
I recently started learning Ruby and have limited experience but the thing I loved most about ruby is that it took me very little time to learn and understand how to code in Ruby, I find it very user and developer friendly. I also love how easy the syntax is, it almost feels like writing in English which increases productivity as I can express myself through code. I love science and I want to work with Ruby and hence I want to work with Sciruby. I have used scientific libraries for python and have experienced how easy these libraries make a project. I want to build the same environment for ruby so that users can easily code and use Ruby in their research. I would love to be a part of the journey of creating this environment for ruby as I will get a chance to built the libraries from scratch and learn and gain experience in the process. I also like how welcoming, helpful and friendly the Sciruby community is, I would love to be a part of this community and work on projects with the members.

3. What do you like about science and why? What area do you like best?
I love the fact that science defines and controls how everything works, it is absolute and forms the foundation of this universe. Science is complex and yet so beautiful. The areas which I like the best are Artificial Intelligence and Neuroscience, I am intrigued by the working of our brain, it makes us who we are, what we think what we do even without us knowing how does the brain work. I am interested in researching how does the brain work and hence I am interested in Neuroscience and Artificial Intelligence, one gives us an insights on how does the brain actually work through the Biological processes and the second area tries to mimic the working of the brain and tries to find a solution to the question that can a machine learn to think and act like a human.

4. Describe your experience with the following: Ruby, C, C++, other languages.
Ruby: I have recently started coding in Ruby and am comfortable with using it.
C/C++: I was introduced to computer programming through the language C during the first year of my college, I have been coding in C and C++ since then for the implementation of Data Structures and Algorithms for courses in my college as well as for Competitive Coding. I have also used C for coding basic computer networks.
Java: I gained experience of coding in Java through the Object Oriented programming course during the second year of my college.
Python: I have done various projects in Python involving various applications of Machine Learning and Deep Learning like Data analysis, Audio processing, Image segmentation and am very fluent in coding in Python.

5. Describe your educational background (school, degree plan, major, past degrees, research area, publications, etc.).
I am a third-year undergraduate student at BITS Pilani, K.K. Birla Goa Campus pursuing Computer Science. I am interested in and working on various projects involving Neuroscience and Deep Learning, I am especially interested in the intersection of these fields and am working on projects on the same which are building Spiking Neural Networks for Reinforcement Learning and Data generation and interpretation using EEG signals.

6. Have you offered any pull requests for SciRuby or contributed in other ways? Please provide links, if possible. Past contributions are required and must be in the form of code. Documentation contributions are also beneficial.
I had documented an earlier version of Rubyplot including working of the library band explaining it with an example which was built by Pranav Garg as a part of GSoC 2018 which can be found here. I also made a small scatter plot example using Magick backend which can be found here.

7. What other commitments do you have this summer aside from GSoC? What obstacles do you foresee this summer as far as contributing the full forty hours per week during the GSoC period?
I will attend a conference organized by Intel from 12th June to 16th June, apart from this I have no other commitments this summer. I will compensate for my absence by dedicating more than 40 hours every week.

8. Are you planning any fun vacations this summer?
No.

9. How many classes are you taking this summer?
None.

10. Do you have any other employment this summer?
No.

11. Please talk a bit about any past GSoC projects in which you have participated. If you've done GSoC before, how could we reach your mentor(s)?
I have not participated in GSoC before.

12. Please propose a project you would like to work on. Successful proposals will require advanced planning, communication with the project administrators and mentors, and likely a great deal of research on specific methods for achieving your project goals (e.g., what algorithms will you use? What frameworks?). A good place to start is the Ideas Page. You should also consider lurking on our IRC channel (#sciruby on FreeNode), various Gitter channels (check repo pages) and slack (https://sciruby-slack.herokuapp.com/). Participation in listserv discussions is strongly recommended.

Title

Adding Magick back-end support and iruby integration to Rubyplot.

Abstract

Rubyplot only supports GR back-end, my project is to extend this support to Magick back-end, adding plot function to Rubyplot and integration with iruby notebooks. This project will greatly enhance the plotting interface of Rubyplot and pave the way for much greater expansion and allow users to test and debug their code easily.

Background

Rubyplot is a plotting library for ruby inspired from the library Matplotlib for Python. The aim of creating such a library is to create a platform-independent library to be used with ruby for scientific computing and web development. For this library to be platform-independent, it should support multiple back-ends commonly used. The front-end should be back-end agnostic. Currently, Rubyplot has been designed in such a way that the front-end is back-end agnostic but currently it supports only GR back-end. I plan to extend the back-end support to another commonly used back-end ImageMagick.
Further to develop this library to be used in development and applications, it should allow easy plotting, testing and debugging of plots. For this purpose, if a user can see the plot before saving it, this would save the user's time by allowing easy debugging before final plotting and saving. Currently, the library does not support viewing a plot and supports only saving the image directly. I plan to extend the library and create a plot function inspired by Matplotlib's plot function. This function should support all the back-ends and hence I will implement both GR and Magick back-ends for this function.
Further, while developing a large scale application or a program, debugging is time-consuming as one needs to compile the whole program again for just a small change. This difficulty can be overcome if the user can compile and test small parts of code before testing the change with the whole program. iruby notebooks allow such development and support compiling of small snippets of code instead of compiling the whole program. While plotting and making graphs, having such support would allow the user to test and debug the code easily. Currently, iruby notebooks do not support Rubyplot. I plan to integrate Rubyplot with iruby notebooks to allow easy debugging and testing. iruby notebooks will support all the back-ends and also viewing of plots in the notebook itself, hence I will integrate both GR and Magick backend with iruby notebook supporting inline plotting as well.

Deliverables:

The deliverables of the project would be as follows:

  1. ImageMagick support: Support for ImageMagick back-end will be added in addition to the currently supported back-end GR, the front-end of the library will be back-end agnostic and the current overall integrity of the library will be preserved.
  2. Plotting and show function: A new plot function will be added which plots markers (for example circles) to form a scatter plot or a line plot with just the points as inputs. A new function show will be added which will allow viewing of a plot without saving it. This plot function will be back-end agnostic and hence will support both GR and Magick back-end.
  3. Integration with iruby notebooks: Rubyplot will be integrated with iruby notebooks supporting all backends and allowing inline plotting.

Approach

ImageMagick Support

Currently, Rubyplot supports only GR back-end and has a back-end agnostic frontend. I will add support for Magick back-end so that all the plots can be plotted using Magick back-end.

Comparison with GR: GR is written in C and had no Ruby bindings, Pranav Garg created the base of Rubyplot which had ruby bindings for GR so the library supported only GR back-end as his GSoC 2018 project. In the case of ImageMagick, rmagick library already has ruby bindings for ImageMagick. Hence, rmagick will be used for basic functions. For creating custom functions, I will make the necessary ruby bindings for ImageMagick.

Creating the backend: Each plot is just a collection of basic functions which are performed by the back-end, for example, scatter plot uses back-end to draw markers, line plot uses back-end to draw a simple line. So, I will code these basic functions using rmagick by using the Draw class of rmagick which has various functions like circle, polyline, etc. to implement the basic functions. The front-end is already present in the artist layer. As a deliverable these plots will be supported by the Magick back-end: scatter plot, area plot, bar plot, bubble plot, candle-stick plot, histogram, line plot, error bars, violin plot and grouped box plot.
All these plots use basic functions implemented in back-end like draw_markers, draw_circle, draw_line, etc. In addition to these basic functions there are some important functions which are required for the plots which will also be coded in the back-end, these functions are:

  • draw_axes, draw_x_axis and draw_y_axis: These functions draw the X and the Y axes of the plot. In GR back-end, functions for creating the axes are already present whereas in Magick these axes will be made by plotting lines on the canvas. In the front-end there two functions, one for plotting X-axis and one for plotting Y axis, this gives the user independence to draw only one axis if desired, the draw_axes function uses these functions to plot the axes. The draw_x_axis function does not require y coordinates and is independent, combining draw_x_axis and draw_y_axis functions in GR is convenient as it already has inbuilt functions for drawing the axes whereas, in Magick, a new draw_axes function will be made to use the X and Y axis functions and combine these to create the axes. A pseudo-code to plot the axes would be:
# This is just a rough example to create the axes
axes = Magick::Draw.new # This creates a new Draw object
axes.ployline(origin_x,origin_y,max_x,origin_y, origin_x,origin_y,min_x,origin_y, origin_x,origin_y,origin_x,max_y, origin_x,origin_y,origin_x,min_y) # polyline function creates a line and takes in input as x and y coordinates i.e. x1,y1,x2,y2,....xN,yN
axes.draw(canvas) # drawing this Draw object on the canvas
  • within_window: This is a general function used in the basic functions like draw_lines, draw_circle, etc. This function selects a subspace of the space to draw the lines, circles, etc. It chooses the subspace which is of interest to the plot i.e. between the minimum and maximum values of the coordinates so that the visibility and appearance of the plot are improved. If we have only a small nearby value and we choose a very large space, the plot would not make sense as those points would appear very close or even inseparable. For this function, GR uses two inbuilt functions, setwindow which selects the rectangular subspace which will be displayed and setviewport which selects the rectangular subspace in which the user wishes to draw.
    There are no such functions present in Magick and so I will make a function similar to within_window.

Apart from these functions, Magick also lacks basic options for plots, for example, different types of markers in scatter plot, in GR different inbuilt types are present for marker types like a star, plus, etc. I will create code for any such options required by using the basic Magick functions, for example, creating plus by using lines.
So, all these functions together will be integrated with the already existing front-end to plot the graphs.

Plot function

The line plot and the scatter plot are basically the same as they both just plot points. The line plot has points which are close enough to look like a line whereas in scatter plot the points are separated. To combine these plots, I will implement a plot function which plots markers for points with just the points as inputs, if the points are close the plot will look like a line and if not it will be a scatter plot.

Show function

To allow better testing and debugging, viewing a plot before saving it would be helpful. Currently, Rubyplot does not have any function to view a plot and the user has to directly save the plot by writing it into an image. So, I will implement a show function inspired by Matplotlib's plot function which will allow users to see a plot. The front-end for this function will be created in the artist layer which will be back-end agnostic. For viewing the plot each back-end has its own inbuilt functions:

  • Magick: Magick has the view function which allows a user to see the plot. For example,
require 'rmagick'
$canvas_height = 100
$canvas_width = 100
$canvas = Magick::ImageList.new
$canvas.new_image($canvas_height, $canvas_width, Magick::HatchFill.new('white', 'gray90'))

draw_circle = Magick::Draw.new
draw_circle.circle(50,50, 70,50)
draw_circle.draw($canvas)

$canvas.display

This code displays a popup with a circle in the centre as defined in the code.
plotted circle

  • GR: The C function gr_updatews() updates the GR workspace and shows the plot. This feature was implemented in the previous version of the library by Pranav Garg. I will take inspiration from his implementation and will create the ruby bindings for this C function to create the plot function.

Using the corresponding inbuilt functions in the back-end, the plot function will be created to view a plot before saving.

Integration with iruby notebooks

To allow easy testing and debugging of code, instead of compiling the whole code, compiling small snippets of code would be helpful. iruby notebooks allow compiling small snippets of the code. Currently, iruby notebooks do not support Rubyplot and hence I will integrate iruby notebooks with rubyplot such that the user can use the plot function to plot a graph in the notebook itself i.e. inline plotting. This would be inspired by Matplotlib's inline plotting in IPython notebooks. Integration for both Magick and GR back-ends will be added.
This will require adding plotting support in the iruby notebook and does not require any changes in Rubyplot.

13. Please provide a specific timeline for your project from application period until pencils-down. What benchmarks will you set for yourself? The greater the detail on this question and the previous, the better.
This is a rough timeline and I will add more details to the timeline as the project proceeds. The timeline is as follows:

Application Review Period

I will revise the basics of Ruby. I will learn more about the GR and the Magick back-ends. I will get myself more familiarized with the current Rubyplot.

Community Bonding Period

I will study about iruby notebooks and will create a more detailed timeline after interacting with the mentors. I plan to stay active in discussions about Rubyplot as well as other projects in Sciruby. I will interact with the community, the mentors and the other students having different projects.

Coding Period

Week 1 (27 May - 2 June):
Weekly Deliverables : Improving the current scatter plot by correcting the transform function, improving X and Y axes, creating a within_window function.
31 May : Correcting the transform function.
1 June : Implementing Major and minor ticks in the X-axis and Y-axis.
2 June - 4 June : Finding an alternative in Magick backend for the within_window function in GR backend.
Week 2 (3 June - 9 June):
Weekly Deliverables : Improving scatter plot and area plot.
5 June - 6 June : Writing documentation and tests for the functions to draw X and Y axes, within_window and other functions.
7 June - 8 June : Working on scatter plot, implementing different types of markers and shifting draw circle marker to backend (currently uses frontend). Improving draw_circle function.
9 June : Checking draw_polygon function, area plot and writing tests and documentation for area plot.
Week 3 (10 June - 16 June):
Weekly Deliverables : Improving bar plot, bubble plot and candle-stick plot.
10 June : Checking draw_rectangle function, bar plot and writing tests and documentation for bar plot.
11 June : Checking bubble plot and writing tests and documentation for bubble plot.
12 June : Checking candle-stick plot and writing tests and documentation for candle-stick plot.
13 June - 16 June : Unavailable to work, attending Intel student ambassador summit at Bangalore.
Week 4 (17 June - 23 June):
Weekly Deliverables : Improving histogram, line plot, error bar plot, box plot and voilin plot.
17 June : Checking histogram and writing tests and documentation for histogram.
18 June : Checking line plot and writing tests and documentation for line plot.
19 June - 20 June : Implementing draw_arrow function, Error bar plot and writing tests and documentation for it. Adding arrows to end of axes.
21 June - 22 June : Implementing box plot and writing tests and documentation for it.
23 June - 24 June : Implementing violin plot and writing tests and documentation for it.
Phase 1 Evaluation (24 June - 28 June):
24 June - 28 June : Testing every plot and function, improving documentation and submission.
Week 5 and 6 (29 June - 7 July):
Weekly Deliverables : Improving multi bar plot, multi box plot, multi candle-stick plot, multi stacked bar plot, grouped box plot and checking subplots.
29 June : Checking multi bar plot and writing tests and documentation for it.
30 June : Checking multi box plot and writing tests and documentation for it.
1 July : Checking multi candle-stick plot and writing tests and documentation for it.
2 July : Checking multi stacked bar plot and writing tests and documentation for it.
3 July - 4 July : Implementing grouped box plot and writing tests and documentation for it.
5 July - 6 July : Checking drawing multiple subplots.
7 July : Finishing any remaining work, improving documentation and making a list of plots.
Week 7 (8 July - 14 July):
Weekly Deliverables : Implementing show function and a base for plot function.
8 July : Implementing show function in Magick backend.
9 July - 10 July : Implementing show function in GR backend.
11 July - 12 July : Writing tests and documentation for show function.
13 July - 14 July : Implementing a basic plot function with frontend and backend for combining scatter plot and line plot.
Week 8 (15 July - 21 July):
Weekly Deliverables : Improving plot function.
15 July - 16 July : Doing research on fmt argument for plot function to define different types of plots which have their base as scatter plot or line plot.
17 July - 21 July : Implementing fmt argument.
Phase 2 Evaluations (22 July - 26 July):
22 July - 26 July : Testing implemented plots, plot and show functions, improving documentation and submission.
Week 9 (27 July - 28 July):
Weekly Deliverables : Improving plot function.
27 July - 28 July : Writing tests and documentation for plot function.
Week 10 (29 July - 4 August):
Weekly Delivearbles : Research on iruby notebooks.
29 July - 2 August : Unavailable to work due to Shifting to France for my undergraduate thesis.
3 August - 4 August : Getting familiar with codebase of iruby notebooks and doing research on integrating rubyplot with iruby notebooks.
Week 11(5 August - 11 August):
Weekly Deliverables : Integration with iruby notebook.
5 August - 11 August : Integrating rubyplot with iruby notebooks with show method displaying the plot in the iruby notebook itself. Writing tests and documentation for it.
Week 12 (12 August - 18 August):
Weekly Deliverables : Improving documentation and making tutorials.
12 August - 13 August : Compiling and improving documentation for rubyplot.
14 August : Writing developer notes for new contributors to get started with the library.
15 August - 18 August : Making iruby notebooks of tutorials for users through which they can get started with the library easily.
Final Evaluations (19 August - 26 August):
19 August - 26 August : Finishing any remaining work and submission for final evaluation.

Post GSoC

I would like to continue development of Rubyplot to add more plots and more back-ends. I plan to stay active in the SciRuby community and start working on other ongoing projects as well.

14. What is one long-term vision for something you'd like scientific software to be able to do. Think big picture, not necessarily realistic in the short term.
I would like the scientific software to be easy to use, platform independent and it should remove the language barrier i.e. there should be only a single programming language which is just like natural language which combines all the benefits of the programming languages currently present. This language should also have inbuilt algorithms and functions which are used the most. It should also be to able to more hardware friendly and should be able to use the hardware present efficiently. In the long term, this language would allow the users to focus more on their research or development rather than on learning the language itself, this would not only make the work more productive but also shorten the learning curve and would also save the time currently required to shift from one language to another.

15. What are your hobbies, aside from coding? Tell us a little about yourself that isn't reflected in the rest of your application. What do you want to do with your life (if you have any idea)?
I like to read about upcoming technologies like new devices, new applications, etc. In my free time, I like to play computer games and listening to heavy metal music. I would like to pursue research on Artificial Intelligence and Neuroscience.

16. What else do you think we should have asked but didn't? Propose a question of your own and answer it here.

  • Why GSoC and what do expect to gain from this experience?
    Apart from gaining the prestigious title of a GSoCer, I plan to gain a low of knowledge and experience from this program. GSoC is the perfect program for someone to get started with open source development. I want to get started with open source development to work on projects which are used by a lot of people, improve my software development skills and my coding skills and to be a part of open source community and help others to get started with their journey with open source software development as well.

17. Bonus question: One aim of the Ruby Science Foundation (SciRuby) is to increase diversity in open source science software development. How do we get more women interested in open source software development and science? How do we get more people from underrepresented groups involved?
Programs like Google summer of code for women and underrepresented groups would be a very good way to increase diversity in open source science software development. Another good way would be to promote women and people from underrepresented groups who are involved in development to inspire others, creating an interactive application to introduce people to open source science software development would be a very good resource for them to get started with open source development. Support and help from the community is also a crucial aspect to get people to start open source science software development as many people start it but are demotivated soon and discontinue, support and motivation from a friendly community would encourage people to continue open source science software development and even inspire more people to start with it.