JLAB: Matlab freeware for data analysis
News
Keep informed about updates by subscribing to the JLAB announcement list. Subscribe by emailing jlab-subscribe at jmlilly dot net.
JLAB version 0.90 is available as of February 15, 2008. Version 0.90 is a major new release, including:
- Improved organization of modules
- Dozens of new functions and significant fixes
- New functions of spherical geometry
- Fast interpolation functions: QUADINTERP and CUBEINTERP
- Refactoring and improvements to wavelet ridge code
- Additional Morse wavelet functions
There are two dozen new functions and many improvements; see the changelog for details. All JLAB users should upgrade to the new version by simply reinstalling.
JLAB has been downloaded thousands of times globally. Thanks for your interest!
Download
JLAB is available in two formats, a gzipped tar archive [jlab-current.tgz] for Unix / Linux users, and zip version [jlab-current.zip] for Windows uses. Installation is simple and is described below.
Introduction
JLAB is a set of Matlab functions I have written or co-written over the past fifteen years for the purpose of analyzing data. It consists of four hundred m-files spanning thirty thousand lines of code. JLAB includes functions ranging in complexity from one-line aliases to high-level algorithms for certain specialized tasks. These have been collected together and made publicly available for you to use, modify, and --- subject to certain very reasonable constraints --- to redistribute.
Some of the highlights are: a suite of functions for the rapid manipulation of multi-component, potentially multi-dimensional datasets; a systematic way of dealing with datasets having components of non-uniform length; tools for fine-tuning figures using compact, straightforward statements; and specialized functions for spectral and time / frequency analysis, including advanced wavelet algorithms developed by myself and collaborators.
Organization
JLAB is organized into several modules:
General purpose
| jarray | - Vector, matrix, and N-D array tools. |
| jmath | - Mathematical aliases and basic functions. |
| jpoly | - Special polynomials, matrices, and functions. |
| jdata | - Data management and manipulation. |
| jgraph | - Fine-turning and customizing figures. |
| jstrings | - Strings and groups of strings. |
| jstats | - Statistical tools and probability distributions. |
| jsignal | - Signal processing, wavelet and spectral analysis. |
| jellipse | - Elliptical (bivariate) time series analysis. |
| joceans | - Oceanography-specific functions. |
| jsphere | - Spherical geometry and derivatives. |
| jsatfun | - Satellite data treatment and design. |
| jtriads | - Gravity-capillary triad interaction functions. |
| jpapers | - Figures from papers by J. M. Lilly, i.e. myself. |
Communication
Please send comments, questions, and bug reports to eponym at jmlilly dot net.
It is my intention to release updated versions of JLAB periodically, and to include, to the extent that it is feasible, the functions and figure-generating scripts used in future papers. If you would like to be notified of such releases, please contact me at the above email address.
Contributions, in the form of improvements or new routines, are also welcome.
Installation
Upon unzipping, the JLAB package will be located in a folder called "jlab". Put this folder in a convenient location and put an "addpath" statement in your "startup.m" file, e.g. "addpath /Users/matlab/jlab". Then typing "jlab_runtests" at the Matlab command prompt will run a series of tests to make sure everything is working properly.
To reinstall, simply throw away the old version and install the new version.
Goals
The purpose for the public release of this software collection is threefold:
- As a means of organizing myself for greater productivity;
- As a service to colleagues who are particularly interested in my work;
- In the hopes that Matlab users in general may find some benefit.
Philosophy
JLAB is founded on three philosophical ideas
- Incremental abstraction
- Automated testing
- Free redistribution
Incremental abstraction
Often scientists rely heavily on scripts, that is, files that execute a long list of instructions in order. On a practical level, this means if we need to do the same thing a second time but with small changes --- with a different variable set, say --- we copy and paste into a new script file and make changes at every stage.
Programming exclusively with scripts means that we are not abstracting or generalizing common tasks for future use. Thus we are not taking advantage of the that fact that we are essentially writing algorithms. Since often the same tasks come up over and over again, script-based programming tends to quickly plateau in the amount of productivity obtained per unit effort, while exponentially growing in disorder as more and more files accumulate.
Instead, as a habitual practice, we can try to recognize common patterns and abstract these into functions. Then every day we build tools which can be used and re-used in the future, rather than focusing exclusively on the present. New tools can then build on earlier work, so that coding becomes easier and faster as time progresses. This has indeed been my experience since I invested the time to create a stable public release of JLAB.
My rule of thumb is that if I find myself doing the same thing twice, I write a function. This is because if the same pattern repeats itself twice, it will likely repeat again. Of course, scripting is always necessary for unique tasks, but these scripts can drastically simplify when they make effective use of stable sets of tools.
Automated testing
When writing a function, one should also write test code to check that the function works as expected. This becomes increasingly important as the functions grow in complexity, and as the package itself grows in size.
Often we test as we work, but do not save the tests. Such "on the fly" testing is useless to i) other people and ii) ourselves in the future. Changing a routine, or change other routines which it depends on, or simply re-verifying that it works as expected, then becomes a laborious process in which we essentially have to start from scratch.
Instead, if we code all such tests so that they can be run at a later time, verifying that everything works as expected is accomplished with a one-line command. This in turn provides the freedom to change, improve, simplify, and adapt code as needed without fear of unforeseen consequences.
In JLAB, tests are embedded in the individual functions and may be run with commands such as "aresame --t". All tests in the JLAB suite, of which there are many dozens, are run by the command "jlab_runtests".
Free redistribution
As scientists, it is expected that we will want to modify routines, incorporate them into our own work, and redistribute them to our colleagues or to the community at large. It is therefore imperative that we grant each other the right to freely redistribute software in order that ideas be able to evolve freely and naturally.
Sharing software, but not granting distribution rights, is not really sharing software. It is analogous to letting other scientists read our publications, but to prohibit them from referring to our results in their own publications.
Of course, one also wants to receive credit for one's work. The JLAB license therefore attempts to balance free redistribution with the expectation of appropriate acknowledgement, while remaining short and and simple.
History
Despite its many advantages as an environment for data processing and figure creation, I have found Matlab to be inadequate on a number of counts. Many common matrix or array operations have no built-in representation, leading to the frequent occurrence of rather awkward constructions. No framework exists for manipulating multi-component datasets, in which one may wish to perform the identical operation on a number of different variables. The "handle graphics" interface is particularly clumsy, and leads to inordinately large amounts of time spent tweaking low-level properties in order to generate high-quality figures.
The preparation of a collection such as this one has been a major endeavor, but seemed to me to be a necessity for my own work. In the course of my everyday research, I regularly wrote new functions which abstracted the essence of a task, so that I could use these in the future. However, under the constant pressure to produce results, I did not take the last step to assimilate my programs into a tested, stable, and organized collection.
After working on perhaps ten projects in as many years, Matlab m-files were scattered over many directories, with no systematic index or organization. Functions written years earlier were lost, forgotten about, re-written, and eventually rediscovered at some inopportune moment. Changes in one function would inadvertently break another function, thus I was not able to reproduce earlier computations without substantial mucking around. Clearly my effort was not adding up.
It seemed to me that I was faced with two alternatives: either to spend my entire life hacking amidst chaos in order to maximize short-term production, or invest the time, now, to create a stable base on which future work could easily be built. This led to the creation of JLAB. If others find this collection useful in their own research, so much the better.