Entry for the /r/dataisbeautiful/ Jan. 2018 contest
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
data
.gitignore
LICENSE.md
README.md
algae.css
algae.js
index.html
initialize.js
package-lock.json
package.json
scrape.js

README.md

Algae Visualization

By Chris Wilson (@wilson428)

Entry for the /r/dataisbeautiful/ Jan. 2018 contest

Getting the data

I'm using the Node modules downcache (which I wrote and maintain) and cheerio to scrape the relevant table and convert it into a nice JSON file (in JavaScript form to avoid AJAX calls). It also outputs a categories.js with the eight combinations of temperature and light. These outputs are in the repo, so you don't need to rerun them unless you so desire:

npm install
npm scape.js

Running the visualization

Just open index.html in a browser. You don't even have to run a local server since there are no AJAX calls.

Calculating cell growth

It is surprisingly difficult to find a cogent definition of "divisions per day", but this post on Illustrative Mathematics neatly shows how one can calculate the number of cells in an algae bloom (or decline) based on this figure, which is essentially the percentage (in decimal form) of cells that duplicate each day. Thus, for N initial cells, on a given day t with a division count of d, the number of cells is N * 2^(d*t).

Drawing the Petri dishes

There are 152 unique combinations of temperature, light and species (4 temperatures * 2 luxes/temperature * 19 species). While it would be convenient to use D3 to handle the clustering of cells around a central point, an SVG-based visualization would quickly blossom (so to speak) into 100,000-plus DOM objects. Canvas is a much more performance-friendly solution. Each cell is randomly placed inside its Petri dish with a simple random radius from the center at a random angle.

Scientific limitations

Algae requires light to reproduce, so a dramatically high level of divisions-per-day, sometimes classified as a Harmful algae bloom, will max out when the algae is so dense that it's rate of reproduction reduces. This seven-day simulation does not place an upper-limit on the number of cells that can be reproduced even when, particularly in the case of Nannochlorois oculata, the algae becomes so populous that it would not longer fully reproduce every day.