A3-DouglasMason

From CS294-10 Visualization Fa08

Jump to: navigation, search

Contents

Part I

Flower Power

While working on Assignment #2, I encountered a dataset that included flower color and geographic location (US states, to be exact) along with a myriad of other flower properties, notably temperature tolerance, precipitation tolerance, frost tolerance, fire resistance, and height. At the time, this other data was enough to satiate me, but my mind immediately dreamed up a number of fun interactive ways to look at how flower properties were distributed throughout the US. Specifically, I wanted to answer a question that I originally posed but didn't have the tools to answer: Can you find geographic trends in flower color?

Massaging the Data

The original hurdle to implementing such a visualization was that the data was not organized in a standard way. The geographic data was listed in a field for each flower as "USA (AL,AK,...,WY) CANADA (AL) ". This poses a number of challenges to implementing a geographic visualization. It will first be necessary to compile an additional database which works the other way around. In other words, I will need to generate a database which lists for each state the indices which connect to each flower in the original database. Call this routine "geodata = DataMassage(flowerdata)" or "DataMassage" for short.

Creating a United States Map

It will then be necessary to create a US Map with a filled polygon for each state that is clickable and can have its color or other properties adjusted. This will be ideally suited to FLASH/FLEX/ACTIONSCRIPT. As it turns out, there are a huge number of commercially available maps ready-for-download to alleviate having to draw it yourself, and they start at $20. I am faced with two choices, to build one myself (it will look terrible and childlike, and it will take a lot of time) or to buy one of these. Is this a moral dilemma?

Neutral State

No, not Switzerland. If I will be adjusting these properties, I have to determine a neutral state of the map with no filters or data involved. This will be a white map, no text for each state except for New England, and each state outlined boldly in black.

What do you want to see?

There will be a few steps to implementing this visualization. Each one builds on the previous, which is a great setup since I can't say how ambitious the final project is. At least this way, I know I will have something respectable to show you guys, even if I fail myself personally.

Each Flower, One-by-One

I can start by providing a drop-down menu with a subset of flowers that you can select. Upon selecting each flower, the states in which it is represented will darken from white to the color of the flower. This is a great first step since it won't require DataMassage, and will allow me to debug the map.

Flower Color

The final question, of course, is how this relates to geographic flower color. My initial reaction was to blend the weighted colors of the flowers in each state, but it is pretty apparent that this will give you a disgusting beige map. No fun at all! But what I could suggest, instead, is a drop-down menu for each color option, which then darkens in each state according to the number of flowers that have that color in that state. This data will be compiled a priori in DataMassage. The great feature is that this way each flower color range is normalized and we can get a clearer idea of the fine differences between each state.

Precipitation Tolerance, etc

We can extend this application, since I already know that I have data for precipitation, temperature, and frost tolerance, as well as its height. For each flower, we have its maxmimum and minimum tolerances, from which we can calculate each flower's range. We can add this data to DataMassage to calculate the average and standard deviation for each state and compile it to our "special" database. From there I can then calculate for each state its average and standard deviation...

  1. Maximum/Minimum/Range Precipitation Tolerance
  2. Maximum/Minimum/Range Temperature Tolerance
  3. Maximum/Minimum/Range Frost Tolerance
  4. Plant Height

Looking at the above, we see that we have four properties, three subsets of these properties, and the average/standard deviation. In sum total, that's 3x3x2+2=20 different states for the map! Again here we can scale and add more data or options as we have time, so you may end up only seeing a subset of the above promises. Wouldn't I make a good politician?

Encoding in Color

The above properties will affect the color of the map, and there a number of choices here. As was mentioned earlier, we have 20 states, but also have a number of properties we can overlay. I will restrict myself to color and opacity, or in other words, hue and lightness. To me it makes the most sense to encode the average as the the hue and the standard deviation as the lightness (darker for more restricted range, lighter for a larger variation). The precipitation will be encoded as Red/Green, temperature will be Orange/Blue, and frost will be Blue/Green. Each set will be normalized, of course. This will cut us back to 10 states.

One Last Step

There is one last step to answer the question, and this will require the most work and may be the most expendable. We begin with the flower-color-per-state set-up but now we will provide a range bar at the bottom of the display which allows you to restrict the dataset to ranges in Precipitation/Temperature/Frost tolerance and height. I know from the previous assignment that there ARE correlations between these items and flower color, and now we can explore that last dimension, geography. Each refresh will be re-normalized so that the map doesn't fade out of existence.

Storyboard

Below I depict the storyboard. The middle column contains the range selectors, the right-hand column contains the drop-down menus. The left column contains the normalization information (max/min) and is not interactive.

Image:Flower_color_storyboard.jpg

Part II

As it turns out, I'm trained in scientific computing, not object-oriented computing. My efforts to create the above software turned into a bizarre frenzy of attempting to learn an entirely new programming style, not to mention a new language, and learn to distribute it. Luckily, I can acknowledge where my limitations lie, just not early enough to avoid this fate! So instead I have drawn from my research an interesting gratuitous visualization project I call the Eigenstate Explorer that I wrote in MATLAB's GUI.

Background

In my work on simulating carbon-based transistors, I have recently come across an interesting question that begged a decent visualization. I could spill all the details immediately, but instead, for those who are not familiar with this esoteric study, I will first provide an analogy rife with drama and excitement!

Say you have a gourd, a very pretty gourd, and you want to make music out of it. Fortunately, the gourd is hollow and when you strike it it makes a drum-like sound. Unfortunately, you are not in the percussion section, and whatever ethnic tribe you belong to will sacrifice you to the music gods if you cannot make a beautiful melodious sound. So what do you do? You drill a hole in it! But where should it go, and how big should it be?

Luckily you're patient, and in this case, patient enough to earn a physics PhD. You realize that before you drill the hole, you better find out what kinds of sounds your gourd makes without the hole. Only then can you make an intelligent decision. You discover that when you strike it, you excite a number of frequencies, but not all frequencies, just a few. It turns out that like a guitar string can only vibrate in the middle, the gourd can only vibrate at its shell. This means that we have a number of discrete frequencies, and associated with these are wavepatterns inside the gourd. In mathematical language, these are our eigenvalues and our eigenstates.

When you drill a hole into the gourd, you no longer have eigenstates because now the gourd can leak out that energy. This causes the eigenstates to mix up, and we no longer have discrete frequencies but now we can excite all the frequencies. But obviously certain frequencies are still favored. We can find out which frequencies are favored because they are related to the discrete frequencies of the closed gourd. We call these frequencies resonances.

But the relationship is not always so easy to tease out. For instance, the resonant frequency usually shifts, and some frequencies are more resonant than others. What is a musician to do?

The same scenario occurs when we connect a nanotransistor to two wires. This simultaneously injects and leaks energy to and from the transistor in the form electrons. We need to know the relationship between the eigenstates of the transistor and the resonant frequencies when we connect it to the wires, because this relationship shows us why certain shapes of nanotransistors work well and others can be left behind in the annals of physics journals.

Difficulties Visualizing Eigenenergies

The Eigenstate Explorer with small Gamma parameter. Note how sharp and difficult to identify the peaks are on the right
The Eigenstate Explorer with small Gamma parameter. Note how sharp and difficult to identify the peaks are on the right
The Eigenstate Explorer with the default Gamma parameter. Now the plot on the right is easier to see, but we've lost some detail
The Eigenstate Explorer with the default Gamma parameter. Now the plot on the right is easier to see, but we've lost some detail

The eigenvalues are simply a list of energies. Frequently we would like to know how many eigenvalues exist in a given span of energy, since this indicates how many eigenstates we might excite with an injection of electrons at that energy. This number can vary wildly, so it behooves to find a means of visualizing them.

We can start by convolving the eigenvalues with a Lorentzian function so that our plot is the following function f=\frac{1}{2\pi}\sum_{i}\frac{\Gamma}{\left(\frac{\Gamma}{2}\right)^{2}+\left(E-E_{0}\right)^{2}} The Lorentzian is normalized so that the area under the curve is always one. This means that if we have two degenerate eigenvalues, we will obtain a peak twice as high! This is much better than plotting delta function which could never account for this problem.

However, we still have the difficulty that there is an arbitrary parameter Γ which determines the width (and height, since the area is normalized) of each eigenvalue's contribution. If we set this parameter too large, we will have a flat line. If we set it too small we will have sharp peaks (see picture). Somewhere in the middle it makes the eigenvalues obvious, but whatever setting we choose will tend to blur the eigenvalues together (see picture ). Thus, we must strike a balance between visibility and precision.

The DOS and the Eigenstates

The Eigenstate Explorer with the energy-slide set to a higher energy than above. As you move around the energy-slider, the LDOS on the left is updated, and the eigenstate projection on the right tends to peak around the energy (vertical line)
The Eigenstate Explorer with the energy-slide set to a higher energy than above. As you move around the energy-slider, the LDOS on the left is updated, and the eigenstate projection on the right tends to peak around the energy (vertical line)

We can determine the eigenstates of the isolated nanotransistor and determine the density function of the nanotransistor connected to the wires. The density function can give us, for instance, the Local Density of States, or (LDOS), which tells us "If I have a nanotransistor at Energy E, where can I expect to find the electrons?" We can plot the LDOS as a series of circles in space, whose radius is determined by the likelihood of finding an electron at each circle, which is plotted on the left when the DOS button is depressed.

The density function like an eigenstate, but much more, because it allows us to decompose the device at a particular energy into those very eigenstates of the isolated device. We can compute the contribution from each eigenstate to the density function at a particular energy, which gives us a series of coefficients which indicate the relative contribution of each state. We can then modify the above equation and inspect f(E)=\frac{1}{2\pi}\sum_{i}C(E)_{i}\frac{\Gamma}{\left(\frac{\Gamma}{2}\right)^{2}+\left(E-E_{0}\right)^{2}} where C(E)i are those very coefficients. We plot this function in blue against the control function, mentioned in the earlier section and plotted in green, for comparison on the right-hand side of the window. There are no units here, since once we convolve with the Lorentzian the result is mostly qualitative.

I have also included a Gamma-slider so that you can adjust the Gamma setting for both plots. Play around with it, because as I mentioned before, selecting the right Gamma is a balancing act and you may find that there are two very-close eigenstates with very distinct properties if you set Gamma too large. The importance of adjusting this setting at will necessitated the slider.

Bunching up at the Energy

We expect these coefficients to "bunch up" around the eigenstates with energies near the energy we are examining, and this is exactly what we see. As you move from left to right on the energy slider, the eigenstate-projection is strongly peaked around the energy (indicated by a vertical line). However, there is more information than that. For instance, in the example given, near the largest peak (where several closely-spaced eigenvalues live) we can isolate the coefficients entirely to that set of degenerate eigenstates. If we examine an energy where no eigenstate resides, the spread becomes quite more as the system "searches out" for neighboring eigenstates.

Examing the Eigenstates Themselves

The Eigenstate Explorer in the eigenstate mode. Using the left and right arrows progresses through the eigenstates, and their spatial functions are plotted on the left. Note that the Lorentzian convolution of the single eigenvalue is plotted on the right
The Eigenstate Explorer in the eigenstate mode. Using the left and right arrows progresses through the eigenstates, and their spatial functions are plotted on the left. Note that the Lorentzian convolution of the single eigenvalue is plotted on the right

If you un-depress the DOS button, you can then plot the eigenstates themselves, instead of the LDOS. This allows us to examine, for instance, the character of the eigenstates the contribute to the LDOS of a particular energy. Since the eigenstates don't exist on a continuum, you must use the left-and-right arrows to peruse these eigenstates. If you depress the DOS button again or move the energy slider, the program will look for the eigenstate with the closest energy and plot that one.

Two More Options

I have also included two buttons, "Plot Spatial" and "Read Out". The former allows you to adjust whether the LDOS/Eigenstate is plotted, since this is computationally intensive and it behooves us to turn it off sometimes. In addition, "Read Out" button allows you to save the plots at any particular energy to an external file.

Download

Follow this link to download the MATLAB source files [1]

Expand the zip file, direct MATLAB to the directory, and run the following command: overseer('viz_demo',3,2,5)



[add comment]
Personal tools