Code Monkey home page Code Monkey logo

algae-viz's Introduction

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.

algae-viz's People

Contributors

wilson428 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.