Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl(&$output) in /nfs/c02/h09/mnt/40423/domains/lizardinthesun.com/html/cloudblog/wp-includes/classes.php on line 594

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl(&$output) in /nfs/c02/h09/mnt/40423/domains/lizardinthesun.com/html/cloudblog/wp-includes/classes.php on line 594

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el(&$output) in /nfs/c02/h09/mnt/40423/domains/lizardinthesun.com/html/cloudblog/wp-includes/classes.php on line 594

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el(&$output) in /nfs/c02/h09/mnt/40423/domains/lizardinthesun.com/html/cloudblog/wp-includes/classes.php on line 594

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el(&$output) in /nfs/c02/h09/mnt/40423/domains/lizardinthesun.com/html/cloudblog/wp-includes/classes.php on line 611

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl(&$output) in /nfs/c02/h09/mnt/40423/domains/lizardinthesun.com/html/cloudblog/wp-includes/classes.php on line 705

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl(&$output) in /nfs/c02/h09/mnt/40423/domains/lizardinthesun.com/html/cloudblog/wp-includes/classes.php on line 705

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el(&$output) in /nfs/c02/h09/mnt/40423/domains/lizardinthesun.com/html/cloudblog/wp-includes/classes.php on line 705

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el(&$output) in /nfs/c02/h09/mnt/40423/domains/lizardinthesun.com/html/cloudblog/wp-includes/classes.php on line 705

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el(&$output) in /nfs/c02/h09/mnt/40423/domains/lizardinthesun.com/html/cloudblog/wp-includes/classes.php on line 728

Strict Standards: Redefining already defined constructor for class wpdb in /nfs/c02/h09/mnt/40423/domains/lizardinthesun.com/html/cloudblog/wp-includes/wp-db.php on line 306

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /nfs/c02/h09/mnt/40423/domains/lizardinthesun.com/html/cloudblog/wp-includes/cache.php on line 425

Strict Standards: Redefining already defined constructor for class WP_Dependencies in /nfs/c02/h09/mnt/40423/domains/lizardinthesun.com/html/cloudblog/wp-includes/class.wp-dependencies.php on line 15
Loglet in the Clouds » 2008 » November

Archive for November 2008

alpha release


http://lizardinthesun.com/loglet/loglet3.html

is an alpha release of a javascript version of Loglet Lab, which fits S-curves of the form:


For a demo, click the buttons labeled “step 1″, “step 2″, and “step 3″ (in that order). That will load the “classic” dataset on the growth of a sunflower, and fit a single S-shaped logistic to it. The data and plots all load on one page, so you have to keep scrolling down. There are other datasets pre-loaded. The data is “live” once loaded, so you can change values and click “step 3″ (fit) with new values.

This “app” is mainly to test browser support and work on the algorithms and plotting, with the eventual goal of turning this into a google spreadsheet widget, but it is actually usable on its own.

I am using a “new” constrained regression algorithm that is inefficient (but robust…). So you really need a cutting edge browser (i.e. google chrome, webkit nightly build, or Firefox 3.1 beta with JIT enabled). I don’t use Microsoft IE, so it probably won’t work on IE. I plan on explaining the regression algorithm in a later post.

This PDF explains a bit about the logistic formulation used and how we do our plots.

Matlab, jQuery and JSON

I do all my numerical algorithm development in Matlab, so I needed a way to easily get results from Matlab into javascript. Here is a (a pretty cool if I don’t say so myself) matlab code that creates a JSON file from a matlab data structure.


data.x = rand(10,1);
data.y = rand(10,1)

dataname = 'data' 

fid = fopen('matlab.json','w');

numdata = max(size(fieldnames(eval(dataname))))

fdata = char(fieldnames(eval(dataname)));

fprintf(fid,'{ "%s" : {\n ',dataname)
for dataiter=1:numdata,
  fprintf(fid,' "%s" : [ \n',fdata(dataiter));
  stmp = sprintf('%s.%s',dataname,fdata(dataiter));
  for i=1:(max(length(eval(stmp))))-1,
    stmp = sprintf('%s.%s(%i)',dataname,fdata(dataiter),i);
    fprintf(fid,'%1.10e , \n',eval(stmp));
  end
  stmp2 =  sprintf('%s.%s',dataname,fdata(dataiter));;
  stmp = sprintf('%s.%s(%i)',dataname,fdata(dataiter),(max(length(eval(stmp2)))));
  fprintf(fid,'%1.10e  \n',eval(stmp));

  if dataiter == numdata ,
    fprintf(fid,'] \n');
  else
    fprintf(fid,'], \n');
  end

end

fprintf(fid,'} } \n');

And then reading it in and parsing it with jQuery is really simple.


 var x = [];
 var y = [];
 $.ajaxSetup({ async: false});
  $.getJSON("matlab.json", function (json)
            {
              x = json.data.x.slice(0);
              y = json.data.y.slice(0);
            }
            );
  

Welcome to Loglet in the Clouds

I am currently (re)-writing the Loglet Lab¬†software application into a “cloud” application.¬† Basically, it means re-writing the algorithms in javascript, so that it is easy to plug into and “mash up” the Web 2.0 “cloud” (i.e. as a plug-in (gadget) for google spreadsheets).¬† As the code will be open source ( current license LPGL 2.1 ), I’ll post things that other users or developers of Loglet Lab Cloud edition might find useful.

Here is an example of a proof-of-concept google gadget for google spreadsheets, which uses the excellent flot plotting library for the jQuery framework: