Friday, January 3, 2014

What is JSvg?

In 2005, I was asked by a colleague to write a 2D video analysis package that would work on any operating system and which was freely available to students.  In order to display kinematic results from tracking, a graphing library was needed.  At the time, there was no jQuery, Raphael, svgjs or other Javascript framework for rapid development or graphics.  Nor were there any statistical libraries available.  To meet the requirements of relatively easy development, easy access for users, and since data were to be processed locally, Firefox (XUL+Javascript) was chosen as the platform.  Likewise, the SVG graphical format was chosen since it was possible to create vector graphics that were scriptable and with little work, could be publication quality.  The result of this effort is JSvg.
Fig 1: View of original OT from 2005


JSvg has, to this point, been part of the OpenTrack (OT) Firefox extension.  You won't find OT in Mozilla's addons due to its size (more than 30,000 lines of code), and the need for quick fixes and rereleases mid-semester.  There was no time for the Mozilla approval process.  Rather OT has been released via two sources simultaneously: Sourceforge, and niiler.com (xpi file). The first site was chosen for visibility whereas the second was chosen for automatic updating (which Sourceforge doesn't allow). 

While still embedded as part of OpenTrack, since 2005, JSvg has evolved to become a rather robust graphical and analysis program, run locally as a Firefox extension.  It makes ample use of Firefox's Web Console and Scratchpad and has recently obtained a console for easy navigation of results.
Figure 2: Some of the latest from JSvg showing analysis capabilities comparing different distributions.


So what can it do?  In addition to the many types of plots, it is also capable of running a number of statistics (t-tests, ANOVA, regression, descriptive stats...), signal processing (smoothing, fitting, FFT, derivatives), linear algebra, and more.

The next version of JSvg will be released shortly, both alongside OpenTrack, and for the first time, as its own extension.  This blog will serve as a tutorial to JSvg showing users how to do certain analyses, coding, or graphics.  In a number of cases, I will show benchmarks versus the R statistical language (which is my old standby).  [Note: due to limitations of Javascript, the precision of JSvg results compared to R are not nearly as good.  But that said, the results are often comparable to two or three sig figs.]

Until next time.

No comments:

Post a Comment