Programming Assignment Checklist: Atomic Nature of Matter

This assignment is new, so the checklist is subject to updating. If something is unclear, please let us know.

12/6 Warning: we had a units problem on the version posted on Monday. The radius of the bead and the number of meters per pixel are in units of 10^-6 (and not 10^-9).

12/7 We changed the name of the data type from Blob.java to Bead.java.

12/7 Grayscale 0 is black; grayscale 255 is white. The assignment originally had these reversed.

12/9 Changed the output of the estimate of Avogadro's number to 6.629E23 for run_1. Our solution was finding the bead in frame t+1 closest to each bead in frame t (rather than vice versa). The decision is arbitrary (and doesn't matter unless two beads get rather close), but the assignment says to do the former. Thanks to Chris U. for identifying this.

12/15 Changed the output of the estimate of Avogadro's number in the checklist to match our update from 12/9. Thanks to Andrew F. for catching this.

Frequently Asked Questions

How do I read in the .jpg files? Use our Picture.java data type, described in Section 3.1 of Intro to CS. To see it in action, program Threshold.java takes the name of a picture file as a command line argument, displays it on the screen, converts all pixels to grayscale, and displays all those pixels with a grayscale value ≥ 180.

Do I need to build an explicit Graph to find the blobs? You are free to use Graph and CCFinder. Alternatively, you can run DFS directly on the pixels since it's already easy to iterate over the neighbors.

Are diagonal pixels considered adjacent? No, use only the 4 horizontal and vertical neighbors (N, E, S, and W).

What should I do if several of the beads in frame t+1 have the same bead in frame t as their closest bead? That's a theoretical possibility. But it's fine to ignore here since the beads aren't supposed to get to close. If they do get close, there's not a good way to track them anyway.

My physics is a bit rusty. Do I need to worry about converting units? No, we have provided all of the constant in SI units. The only conversion you should need to do is to convert from distances measured in pixels to distance measured in meters using the conversion factor of 0.175 * 10-6 meters per pixel.

Will all of the frames by 640-by-480? Will all of the runs be comprised of 200 runs? Yes, yes. However, it shouldn't be necessary to hardwire any of these constants into your program.

How long should my program take? It depends on the speed of your computer. Ours takes about 30 seconds to process a set of 200 frames.

What is the true value of Avogadro's number? Boltzmann's constant? Avogadro's number is approximately 6.022142 *1023; Boltzmann's constant is approximately 1.3806503 * 10-23 J K-1. They are currently (and most accurately) calculated using x-ray crystallography.

How accurate of an estimate should I get? You should get with within 10% or so. (The standard deviation of the radius of the beads is about 10%, so you shouldn't expect results more accurate than that.)

What is polystyrene? It's an inexpensive plastic that is used in many everyday things including plastic forks, drinking cups, and the case of your desktop computer. Styrofoam is a popular brand of polystyrene foam. Computational biologists use micron size polystyrene beads (aka microspheres, latex beads) to "capture" a single DNA molecule, e.g., for a DNA test.

Input, Output, and Testing

Testing. For references, beads_run_1.txt contains a list of all of the beads identified in each of the 200 frames in the run_1 dataset; it was obtained by running

% java BeadFinder < run_1/*.jpg
For references, displacements-run_1.txt contains a list of all of the displacements; it was obtained by running
% java BeadTracker < run_1/*.jpg
You can also use displacement-run_1.txt to independently test your version of Avogadro.java.
% java Avogadro < ftp/displacements-run_1.txt
Boltzmann = 1.254E-23
Avogadro  = 6.629E23

Submission

Use the following readme file template.

Possible Progress Steps

These are purely suggestions for how you might make progress. You do not have to follow these steps.

Enrichment

What's the history of measuring Avogadro's number? In 1811, Avogadro hypothesized that the number of molecules in a liter of gas at a given temperature and pressure is the same for all gases. Unfortunately, he was never able to determine this number that would later be named after him. Johann Josef Loschmidt, an Austrian physicist, gave the first estimate for this number using the kinetic gas theory. In some places, this number is known as Loschmidt's number. In 1873 Maxwell estimated the number of be around 4.3 * 10^23; later Kelvin estimated it to be around 5 * 10^23. Perrin gave the first "accurate" estimate (6.5 - 6.8 * 10^23) of, what he coined, Avogadro's number. Here's a reference on estimating Avogadro's number.



Intro to Computer Science
wayne@cs.princeton.edu