As some of you have probably noticed, I haven't written here for a while.
The reason for this is two-fold: I don't write as much as I used to and I have a new website that I created on GitHub. The new website allows me to post notes and documentation on various projects, which is something I had wanted for a long time but was lacking in blogger.
Go check out the new site and let me know what you think: http://kmdouglass.github.io
-Kyle
Thursday, February 20, 2014
Wednesday, December 11, 2013
Beginning a post-doc abroad
As you may know, I recently accepted a position as a post-doc at EPFL in Lausanne, Switzerland. Just about two weeks ago, my wife and I moved to Lausanne and I began my new work.
This is my first actual "job" that I've had. Sure, it carries many simularities to graduate school, but my responsibilities are greater and, on top of that, I'm now living in a new culture. All of these aspects taken together have made for a very exciting two weeks.
By moving to a new country, I hope to experience a little bit of what so many students and researchers experience when they move to the US from abroad. Working in scientific research is tough, but I could only imagine what it was like for many of my colleagues to adapt to a new lifestyle as well. I was, in a sense, jealous of this great experience they were having and of the worldliness they obtained as a consequence.
Of course, there have been difficulties with the move. Language is one such difficulty. I'm learning French, but my skills still remain atrocious. And little things, like the idea that one never gets on at the front of a bus in Lausanne, have led to embarrassing moments with bus drivers and the public.
Overall, though, I'm quite satisfied with my new location and even more so with my work. I have switched my research to biophysics and can feel the excitement of a field that still has quite a bit of knowledge remaining to discover. My lab environment is fantastic and the EPFL campus is energetic and knowledge-driven, which is similar to my undergraduate institution, Rose-Hulman.
To my mind, Academia is special because it not only drives discovery, but also encourages a global-attitude and feeling of trust amongst people from all nations.
This is my first actual "job" that I've had. Sure, it carries many simularities to graduate school, but my responsibilities are greater and, on top of that, I'm now living in a new culture. All of these aspects taken together have made for a very exciting two weeks.
By moving to a new country, I hope to experience a little bit of what so many students and researchers experience when they move to the US from abroad. Working in scientific research is tough, but I could only imagine what it was like for many of my colleagues to adapt to a new lifestyle as well. I was, in a sense, jealous of this great experience they were having and of the worldliness they obtained as a consequence.
Of course, there have been difficulties with the move. Language is one such difficulty. I'm learning French, but my skills still remain atrocious. And little things, like the idea that one never gets on at the front of a bus in Lausanne, have led to embarrassing moments with bus drivers and the public.
Overall, though, I'm quite satisfied with my new location and even more so with my work. I have switched my research to biophysics and can feel the excitement of a field that still has quite a bit of knowledge remaining to discover. My lab environment is fantastic and the EPFL campus is energetic and knowledge-driven, which is similar to my undergraduate institution, Rose-Hulman.
To my mind, Academia is special because it not only drives discovery, but also encourages a global-attitude and feeling of trust amongst people from all nations.
Labels:
academia
Wednesday, November 6, 2013
Tips on communicating science to a class
Yes, I am still alive.
My wife and I just returned from a long hiking and climbing trip out in the western states. It's tough readjusting to normal life after having been on the road for a month, but I've managed to slowly get back into the world of science while I wait out the visa application process for Switzerland.
Today I came across an interesting article in Wired called "A Media Guide for Physics" by Rhett Allain. In the article, Rhett gives a few tips for producers of science TV shows that would help them communicate science better. His tips are
The article also got me thinking about what tips teachers and educators should use when communicating science to their students. The list must necessarily be different because the audience is different. What follows is my own list of tips that I think are valuable to college professors when communicating concepts to a class.
My wife and I just returned from a long hiking and climbing trip out in the western states. It's tough readjusting to normal life after having been on the road for a month, but I've managed to slowly get back into the world of science while I wait out the visa application process for Switzerland.
Today I came across an interesting article in Wired called "A Media Guide for Physics" by Rhett Allain. In the article, Rhett gives a few tips for producers of science TV shows that would help them communicate science better. His tips are
- don't be wrong;
- it's better to say nothing than to be wrong;
- don't be misleading;
- [don't focus] on comparisons and numbers;
- don't get out of control crazy.
The article also got me thinking about what tips teachers and educators should use when communicating science to their students. The list must necessarily be different because the audience is different. What follows is my own list of tips that I think are valuable to college professors when communicating concepts to a class.
- Don't assume that students are well-grounded in the "background" material and concepts.
- Don't gesture too much while lecturing. When you gesture, you're referring to an image in your head that only you can see. At least put that image on the board.
- Present ideas visually and verbally before going into derivations.
- Include a little history behind the concept you're about to teach if there's time. The reasons for why a concept is important are often found in the history of the development of the idea. For example, Newton's laws seem obvious now, but philosophers had some very muddy ideas about motion before Newton formulated them. And all of thermodynamics arose out of a need to understand how newly invented engines and devices worked. If you start a class by talking about molecules in a box, the relevance is lost.
Thursday, September 5, 2013
How much time should be spent on coding?
Probably any scientist that went through college starting sometime in the early 2000's knows how to program to some degree. They may have learned how to write computer code to do data analysis, to implement simulations, or simply for fun. In my own case, I had been interested in computer programming since middle school when I first taught myself Visual Basic and HTML (I know, I know, HTML is not a programming language, but it did get me interested in programming).
Now, as a researcher, I often have to temper my enthusiasm for writing programs. It's true that creating scripts to automate data analysis and processing will save me a lot of time in the long run, but I also think that tweaking my code too much or trying to engineer it to do too many things may be counter-productive. After all, code is a means to an end, and my goal is not to write as many programs as possible.
So what's the right amount of time that should be invested into writing code to help with usual laboratory tasks? This is a tough but important question that scientists should ask themselves, since it putting in just the right amount of time should maximize their productivity.
And beyond maximizing productivity, scientists should also dedicate time to writing code that makes it easier to document and reproduce what they did. For example, I have recently written scripts to take the output of a curve fit routine and write a report that includes the fitting bounds, initial guesses, fit functions, and other data that is relevant to reproducing a fit. Hopefully, a future grad student can read my automatically-generated reports and figure out exactly what was done.
So in the end, enough time should be invested in coding when it significantly cuts down on the amount of time taken to do repetitive tasks and when it streamlines documentation and note taking, which may not happen otherwise.
Now, as a researcher, I often have to temper my enthusiasm for writing programs. It's true that creating scripts to automate data analysis and processing will save me a lot of time in the long run, but I also think that tweaking my code too much or trying to engineer it to do too many things may be counter-productive. After all, code is a means to an end, and my goal is not to write as many programs as possible.
So what's the right amount of time that should be invested into writing code to help with usual laboratory tasks? This is a tough but important question that scientists should ask themselves, since it putting in just the right amount of time should maximize their productivity.
And beyond maximizing productivity, scientists should also dedicate time to writing code that makes it easier to document and reproduce what they did. For example, I have recently written scripts to take the output of a curve fit routine and write a report that includes the fitting bounds, initial guesses, fit functions, and other data that is relevant to reproducing a fit. Hopefully, a future grad student can read my automatically-generated reports and figure out exactly what was done.
So in the end, enough time should be invested in coding when it significantly cuts down on the amount of time taken to do repetitive tasks and when it streamlines documentation and note taking, which may not happen otherwise.
Saturday, August 24, 2013
Onward to the future...
One week ago from yesterday I successfully defended my dissertation, "Mesoscale light-matter interactions," which means that I am effectively finished with my graduate school career (woot woot!). I would offer my dissertation for viewing here on the web, but due to publication restraints associated with UCF, I have to wait one year before disseminating the work publicly. This is too bad, but the decision to do this was largely out of my control.
I'm excited to be moving on to a slightly new line of work. Later this year, I'll be moving to EPFL in Lausanne, Switzerland to work on STORM microscopes and problems in single molecule biophysics.
I'm particularly excited about this work because now I'll be able to apply my knowledge of optics to biology problems. Most of my PhD work was focused on designing new optics-based techniques and then looking for a problem to solve; I hope to become immersed enough in the biophysics community that I can identify unknowns in biology first and then design measurements to address these unknowns afterward. I think a problem-driven route is a more appropriate for the design of optical sensing techniques and I just can't wait to begin.
During my last year at graduate school, I've also begun several endeavors that I believe make me a much better researcher and contributor to science. Some of these new practices include:
I won't get started in my new position until November or December. In the mean time, my wife and I are going on a long climbing and hiking trip out West, so you may have to be patient if you're waiting for posts between September and November.
And if you're still working on your PhD or Masters degree, keep up the hard work. It will pay off :)
I'm excited to be moving on to a slightly new line of work. Later this year, I'll be moving to EPFL in Lausanne, Switzerland to work on STORM microscopes and problems in single molecule biophysics.
I'm particularly excited about this work because now I'll be able to apply my knowledge of optics to biology problems. Most of my PhD work was focused on designing new optics-based techniques and then looking for a problem to solve; I hope to become immersed enough in the biophysics community that I can identify unknowns in biology first and then design measurements to address these unknowns afterward. I think a problem-driven route is a more appropriate for the design of optical sensing techniques and I just can't wait to begin.
During my last year at graduate school, I've also begun several endeavors that I believe make me a much better researcher and contributor to science. Some of these new practices include:
- Following a paradigm that makes my research as open as possible. This includes making easily reproducible code and sharing data openly. (I'm exploring the use of Figshare and following @openscience on Twitter. Looking at these resources are great starting points).
- Related to the first point, I'm writing a Python package for processing dynamic light scattering data and simulating experiments that I intend to release freely and open sourced. I think that my expertise in this area would serve many others extremely well, since DLS is often treated like a "black box" technique by a lot of people who use it for macromolecular studies.
- Though my writing has waned since I began serious work on my defense, I want to begin writing again as a means of exploring more topics in research and academia.
- I'm structuring my own research around simple questions. I think simple questions, such as "how do cells respond to light" form great, long term questions in science. More complicated questions often lead to short term research goals.
I won't get started in my new position until November or December. In the mean time, my wife and I are going on a long climbing and hiking trip out West, so you may have to be patient if you're waiting for posts between September and November.
And if you're still working on your PhD or Masters degree, keep up the hard work. It will pay off :)
Friday, August 9, 2013
Making presentation slides flow
Today I gave the first practice talk for my defense presentation to my research group. Prior to today I had been dragging my feet with working on it because making a presentation is fairly boring. It also requires a lot of work, so yesterday I put together quite a few, rather dense slides without taking the time to ensure that the content on each side had a certain "flow," that is, a logical spatial order to the information presented on them. Now, the slides made sense in the order that they came in, but the information on each individual slide was not so well ordered with respect to other text and figures on the same slide.
Of course, being the first practice, it was a bit rough. But one thing in particular struck me as insightful. I had attempted to tell a story for each slide based on the information that the slides contained. However, since the information was mixed up on any given slide, I often stumbled with the explanations because my attention would jump randomly from one region of the slide to the next.
In prior presentations I took the time to add animations such that graphs or illustrations would appear on a slide as I talked about them. This was a good thing since it automatically gave some nice order to each slide. More importantly, it kept my speech coherent because I wouldn't get confused about what point to talk about.
The downside to making slides like these is that it takes a lot more time. For example, if I have one plot with three curves on it and I want to make the curves appear one at a time as I click the mouse, then I have to in reality make three separate plots!
In the end, though, I think it's worth it. It keeps me talking coherently, it makes the slides aesthetically pleasing, and it enforces a flow with which information is communicated to the audience.
Of course, being the first practice, it was a bit rough. But one thing in particular struck me as insightful. I had attempted to tell a story for each slide based on the information that the slides contained. However, since the information was mixed up on any given slide, I often stumbled with the explanations because my attention would jump randomly from one region of the slide to the next.
In prior presentations I took the time to add animations such that graphs or illustrations would appear on a slide as I talked about them. This was a good thing since it automatically gave some nice order to each slide. More importantly, it kept my speech coherent because I wouldn't get confused about what point to talk about.
The downside to making slides like these is that it takes a lot more time. For example, if I have one plot with three curves on it and I want to make the curves appear one at a time as I click the mouse, then I have to in reality make three separate plots!
In the end, though, I think it's worth it. It keeps me talking coherently, it makes the slides aesthetically pleasing, and it enforces a flow with which information is communicated to the audience.
Monday, August 5, 2013
Why we should just say no
Well, it's certainly been a while since I last wrote a post. I have a good reason for it, though. My defense is in less than two weeks and life has been crazy. I'm a bit sorry that I haven't had the time to write lately since it's a good stress outlet, but my mental energies have been absolutely and continuously drained by other tasks.
It's perhaps ironic then that I'm writing this post because it was my lack of time to think about writing that inspired me to, well, write.
From the last few months I've learned the value of saying "no" to requests that people ask of me. It was never really necessary before and I was usually happy to oblige people who needed help with something.
These days, however, I must say "no" if I want to finish the things I need to graduate. And I've come to appreciate that saying "no" to things should apply to more people than just graduate students nearing the end of their work.
I think academics have a hard time with trying to limit the number of projects and tasks they take on. As a result, they and their lab members may become overworked and so attention to detail slips. This often leads to sloppy science, such as not checking hypotheses and assumptions, making conclusions on poorly measured data, etc. At the extreme, it might also be fatal to academic careers.
Unfortunately, I think sloppy science has become very common because, in part, people just take on too many things. I can think of a personal reason for why academics take on too much. I become excited at the start of a new project, but bored near the end, so I tend to start more than I can handle while letting others die off. I shouldn't do this, but I do.
Recognizing that this is an issue is the first step to fixing it. I am glad to see that other academics are slowly fighting back against the status quo and saying "no" to too many tasks. I realize it might be hard at times, but it is very necessary to stay happy and to do good science.
It's perhaps ironic then that I'm writing this post because it was my lack of time to think about writing that inspired me to, well, write.
From the last few months I've learned the value of saying "no" to requests that people ask of me. It was never really necessary before and I was usually happy to oblige people who needed help with something.
These days, however, I must say "no" if I want to finish the things I need to graduate. And I've come to appreciate that saying "no" to things should apply to more people than just graduate students nearing the end of their work.
I think academics have a hard time with trying to limit the number of projects and tasks they take on. As a result, they and their lab members may become overworked and so attention to detail slips. This often leads to sloppy science, such as not checking hypotheses and assumptions, making conclusions on poorly measured data, etc. At the extreme, it might also be fatal to academic careers.
Unfortunately, I think sloppy science has become very common because, in part, people just take on too many things. I can think of a personal reason for why academics take on too much. I become excited at the start of a new project, but bored near the end, so I tend to start more than I can handle while letting others die off. I shouldn't do this, but I do.
Recognizing that this is an issue is the first step to fixing it. I am glad to see that other academics are slowly fighting back against the status quo and saying "no" to too many tasks. I realize it might be hard at times, but it is very necessary to stay happy and to do good science.
Labels:
academia
Thursday, July 11, 2013
Challenging dogmatic science
I am back from Europe after a brief visit to a couple institutions at which I am applying for a post-doc position. The trip was brief, taxing, and very informative. I'll try to write about the experience when I have the time. Overall, I'm glad to be back and set on finishing my dissertation. I only hope I've succeeded in obtaining a job from this trip!
On another note, I wanted to highlight a very nice paragraph that sums up a concern many have with some scientific fields. It comes from an article entitled "Thinking outside the simulation box" and appears in this month's issue of Nature Physics. Here it is:
However, for science to remain healthy, scientists must challenge the assumptions and beliefs of their paradigm. It is too bad, in my mind, that the architecture of an academic career is setup to encourage scientists to avoid this line of thinking.
Note: I also very much liked the following excerpt.
On another note, I wanted to highlight a very nice paragraph that sums up a concern many have with some scientific fields. It comes from an article entitled "Thinking outside the simulation box" and appears in this month's issue of Nature Physics. Here it is:
One would have naively expected scientific activity to be open-minded to critical questioning of its architectural design, but the reality is that conservatism prevails within the modern academic setting. Orthodoxy with respect to mainstream scientific dogmas does not lead to extreme atrocities such as burning at the stake for heresy but it propagates other collective punishments, such as an unfair presentation of an innovative idea at conferences, bullying and drying up of resources for creative thinkers.The author, Abraham Loeb, is arguing that too many cosmologists are concerned with building support for an existing paradigm, rather than challenging these paradigms or building new ones. One reason, he thinks, is that it is very difficult to build a career as junior scientists by challenging beliefs that are held true by members of academic job selection committees.
However, for science to remain healthy, scientists must challenge the assumptions and beliefs of their paradigm. It is too bad, in my mind, that the architecture of an academic career is setup to encourage scientists to avoid this line of thinking.
Note: I also very much liked the following excerpt.
Conceptual work is often undervalued in the minds of those who work on the details. A common misconception is that the truth will inevitably be revealed by working out the particulars. But this highlights the biggest blunder in the history of science: that the accumulation of details can be accommodated in any prevailing paradigm by tweaking and complicating the model. A classic example is Ptolemaic cosmology — a theory of epicycles for the motion of the Sun and planets around the Earth — which survived empirical scrutiny for longer than it deserved.
Labels:
academia
Thursday, June 20, 2013
Signalling in intrinsically disordered proteins
I take a small interest in biology and biophysics because of its complexity and the large number of unsolved but important problems. Lately I've noticed an increase in the number of popular articles on intrinsically disordered proteins (IDP's). These proteins are shaking up conventional wisdom on how proteins work and the importance of their structures.
This interesting News & Views article in Nature summarizes some recent work on disordered proteins and how they respond to activators and inhibitors. While I don't understand much of the jargon in the article, the overall message is exciting. I found the following excerpts of interest:
I absolutely love that IDP's are currently rewriting the dogmas of much of molecular biology.
This interesting News & Views article in Nature summarizes some recent work on disordered proteins and how they respond to activators and inhibitors. While I don't understand much of the jargon in the article, the overall message is exciting. I found the following excerpts of interest:
The observation of striking differences in the crystal structures of haemoglobin in the presence and absence of oxygen seemed to validate the idea that allostery [the link is my own] can be rationalized, and possibly even quantitatively accounted for, by examining the structural distortions that connect the different oxygen-binding sites... This structural view of allostery has largely guided the field ever since. However, the realization that more than 30% of the proteome — the complete set of proteins found in a cell — consists of intrinsically disordered proteins (IDPs), and that intrinsic disorder is hyper-abundant in allosteric signalling proteins such as transcription factors, raises the possibility that a well-defined structure is neither necessary nor sufficient for signal transmission.
The take-home message of Ferreon and colleagues' work, and the reason that a switch is possible, is that proteins should not be thought of as multiple copies of identical structures that respond uniformly to a signal. Instead, proteins — especially IDPs — exist as ensembles of sometimes radically different structural states. This structural heterogeneity can produce ensembles that are functionally 'pluripotent', a property that endows IDPs with a unique repertoire of regulatory strategies.
I absolutely love that IDP's are currently rewriting the dogmas of much of molecular biology.
Wednesday, June 19, 2013
Fourier transforms are not good for analyzing nonstationary signals
I'm currently thumbing through parts of "Image Processing and Data Analysis: The Multiscale Approach." In Chapter 1, I found this enlightening comment on the Fourier transform:
The Fourier transform is well suited only to the study of stationary signals where all frequencies have an infinite coherence time, or – otherwise expressed – the signal’s statistical properties do not change over time. Fourier analysis is based on global information which is not adequate for the study of compact or local patterns.You can find a free pdf of this book here: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.122.8536&rep=rep1&type=pdf
Monday, June 10, 2013
Understanding the static structure factor
The structure factor \(S(q)\) is an important quantity for characterizing disordered systems of particles, like colloids. Its significance comes from the fact that it can be directly measured in a light scattering experiment and is related to other quantities that characterize a system's microscopic arrangement and inter-particle interactions. However, it's difficult to learn about it the context of disorder because it's primarily used in crystallography. Crystals are far from being disordered.
In this post, I'll explore the nature of the static structure factor, which is something of an average structure factor over many microscopic configurations of a material. A dynamic structure factor describes the statistics of a material in time as well as space.
The structure factor of a disordered material can be measured by illuminating the material with a beam of some type of radiation (usually X-rays, neutrons, or light). The choice of radiation depends on the material. It is also important that the material should not scatter the incident beam too strongly because the structure function is typically found in singly-scattered radiation (see the first Born approximation for a discussion about a related concept). If the material is multiply scattering, the information about the material's structure, which is largely carried by the singly scattered light, is washed out.
In a measurement, the sample is usually placed at the center of rotation of a long rotating arm. A detector for the radiation is placed at the opposite end of the arm. The arm is rotated about this axis and the intensity of the scattered radiation as determined by the detector is recorded as a function of the angle. This data set essentially contains the structure factor, but must be transformed and corrected for, accordingly.
First, the structure factor is usefully represented as a function of the scattering wave number, \(q\), and not as a function of the scattering angle. In optics, \(q\) is usually given by
where \(n\) is the refractive index of the background material (usually a solvent like water) and \(\lambda\) is the wavelength of the light. \(\theta\) is the scattering angle.
Additionally, the structure factor must be corrected for a large number of confounding factors, such as scattering from the sample cell and radiation frequency-dependent detectors. A classic paper that details all these corrections to find \(S(q)\) in a neutron scattering experiment is given here.
Once the structure factor is found in an experiment, it may be Fourier transformed numerically to give the radial distribution function, \(g(r)\) (see Ziman for the proper conditions for which this applies) of particles. This function gives the probability of finding a particle at a radial distance from another particle in the system. Many important thermodynamic properties are related to \(g(r)\). Importantly, the pair-wise interaction potential between any two particles is related to \(g(r)\), and the pair-wise interaction determines many macroscopic system properties.
The structure factor as \(q\) (or equivalently the scattering angle) goes to zero is also an important quantity in itself. \(S(0)\) is equal to the macroscopic density fluctuations of particles in the medium (see Ziman, Section 4.4, p. 130). But density fluctuations can be calculated from thermodynamics and leads to the isothermal compressibility of a material.
In the language of optics, which I'll stick to for the rest of this post, the density fluctuations would correspond to large regions of refractive index variations across the sample.
This leads to an interesting problem, the resolution of which reminds me of the fallibility in taking some models too literally: for a homogeneous and non-scattering optical material, like a very nice piece of glass, the value of the density fluctuations in the refractive index are essentially zero (this is true because the disorder in a glass is at a length scale that is much smaller than the wavelength of light). This means that \(S(0) = 0\). At the same time, the scattered intensity in the type of experiment measured above is directly proportional to the structure factor:
The problem is that this expression is for the scattered intensity. In random media, we often talk about the scattered light and the ballistic light. The latter of these two is not scattered but directly transmitted through the material as if the material were not there. So, even though no light is scattered into the forward direction, there is still the ballistic, unscattered beam, that is passing straight through the sample.
Most small angle light scattering experiments measure as close as they can to \(q=0\) and extrapolate to the structure function's limiting value. \(S(0)\) can't actually be measured. But, it's determination is important for materials with significant long-range order, such as those near a phase transition, because the small angles correspond to large distances, due to their inverse Fourier relationship.
One can also engineer a material to not transmit any light into the forward direction. To do this, \(S(q)\) must be zero AND there must be no ballistic light passing through the material. This can be achieved with a crystal that diffracts all the light into directions other than the forward direction, such as a blazed grating.
On a final note, the structure factor can sometimes be related to important material properties beyond the radial distribution function. Ziman says in section 4.1, pg. 126 that the direct correlation function (which measures interactions between pairs of particles) can be derived directly from the structure factor. This correlation function is related to the Percus-Yevick model for liquids.
In this post, I'll explore the nature of the static structure factor, which is something of an average structure factor over many microscopic configurations of a material. A dynamic structure factor describes the statistics of a material in time as well as space.
The structure factor of a disordered material can be measured by illuminating the material with a beam of some type of radiation (usually X-rays, neutrons, or light). The choice of radiation depends on the material. It is also important that the material should not scatter the incident beam too strongly because the structure function is typically found in singly-scattered radiation (see the first Born approximation for a discussion about a related concept). If the material is multiply scattering, the information about the material's structure, which is largely carried by the singly scattered light, is washed out.
In a measurement, the sample is usually placed at the center of rotation of a long rotating arm. A detector for the radiation is placed at the opposite end of the arm. The arm is rotated about this axis and the intensity of the scattered radiation as determined by the detector is recorded as a function of the angle. This data set essentially contains the structure factor, but must be transformed and corrected for, accordingly.
First, the structure factor is usefully represented as a function of the scattering wave number, \(q\), and not as a function of the scattering angle. In optics, \(q\) is usually given by
\[ q = \frac{4 \pi n}{\lambda} \sin( \theta / 2) \]
where \(n\) is the refractive index of the background material (usually a solvent like water) and \(\lambda\) is the wavelength of the light. \(\theta\) is the scattering angle.
Additionally, the structure factor must be corrected for a large number of confounding factors, such as scattering from the sample cell and radiation frequency-dependent detectors. A classic paper that details all these corrections to find \(S(q)\) in a neutron scattering experiment is given here.
Once the structure factor is found in an experiment, it may be Fourier transformed numerically to give the radial distribution function, \(g(r)\) (see Ziman for the proper conditions for which this applies) of particles. This function gives the probability of finding a particle at a radial distance from another particle in the system. Many important thermodynamic properties are related to \(g(r)\). Importantly, the pair-wise interaction potential between any two particles is related to \(g(r)\), and the pair-wise interaction determines many macroscopic system properties.
The structure factor as \(q\) (or equivalently the scattering angle) goes to zero is also an important quantity in itself. \(S(0)\) is equal to the macroscopic density fluctuations of particles in the medium (see Ziman, Section 4.4, p. 130). But density fluctuations can be calculated from thermodynamics and leads to the isothermal compressibility of a material.
In the language of optics, which I'll stick to for the rest of this post, the density fluctuations would correspond to large regions of refractive index variations across the sample.
This leads to an interesting problem, the resolution of which reminds me of the fallibility in taking some models too literally: for a homogeneous and non-scattering optical material, like a very nice piece of glass, the value of the density fluctuations in the refractive index are essentially zero (this is true because the disorder in a glass is at a length scale that is much smaller than the wavelength of light). This means that \(S(0) = 0\). At the same time, the scattered intensity in the type of experiment measured above is directly proportional to the structure factor:
\[I(q) \sim S(q).\]So, if I illuminate a nice piece of glass with a laser beam, and I know that \(S(0)\) is equal to zero, the above expression means that there should be no scattered intensity in the forward direction. But this is a silly conclusion, because when I do this experiment in the lab I see the laser beam shining straight through the glass! In other words, \(I(0)\) is not zero.
The problem is that this expression is for the scattered intensity. In random media, we often talk about the scattered light and the ballistic light. The latter of these two is not scattered but directly transmitted through the material as if the material were not there. So, even though no light is scattered into the forward direction, there is still the ballistic, unscattered beam, that is passing straight through the sample.
Most small angle light scattering experiments measure as close as they can to \(q=0\) and extrapolate to the structure function's limiting value. \(S(0)\) can't actually be measured. But, it's determination is important for materials with significant long-range order, such as those near a phase transition, because the small angles correspond to large distances, due to their inverse Fourier relationship.
One can also engineer a material to not transmit any light into the forward direction. To do this, \(S(q)\) must be zero AND there must be no ballistic light passing through the material. This can be achieved with a crystal that diffracts all the light into directions other than the forward direction, such as a blazed grating.
On a final note, the structure factor can sometimes be related to important material properties beyond the radial distribution function. Ziman says in section 4.1, pg. 126 that the direct correlation function (which measures interactions between pairs of particles) can be derived directly from the structure factor. This correlation function is related to the Percus-Yevick model for liquids.
Wednesday, June 5, 2013
Logical indexing with Numpy
I just discovered one nuance of Python's Numpy package which, given my Matlab background, is a bit unintuitive.
Suppose I have an array of numeric data and I would like to filter out only elements whose values lie between, say, 10 and 60, inclusive. In Matlab, I would do this:
However, logical operations with Numpy sometimes require special functions. The equivalent expression in Python is
np.logical_and() computes the element-wise truth values of (data >= 10) AND(data <= 60), allowing me to logical index (or fancy index, as pythonistas say) into data.
Suppose I have an array of numeric data and I would like to filter out only elements whose values lie between, say, 10 and 60, inclusive. In Matlab, I would do this:
filterData = data(data >= 10 & data <=60)
However, logical operations with Numpy sometimes require special functions. The equivalent expression in Python is
filterData = data[np.logical_and(data >= 10, data <= 60)].
np.logical_and() computes the element-wise truth values of (data >= 10) AND(data <= 60), allowing me to logical index (or fancy index, as pythonistas say) into data.
Sunday, June 2, 2013
IguanaTeX puts TeX equations into PowerPoint
As OSA's CLEO conference draws closer, I find myself drawn back into the deep, dark abyss of PowerPoint engineering for the design of my talk.
One constant disappointment I've had with PowerPoint is the lack of a good equation editor since 2007. It was in this year, I believe, that Microsoft chose to dump almost all of the useful features of its native equation editor. Most appalling was that they removed the option to change the color of equations. This is absolutely crucial if you're working with dark backgrounds to enhance the contrast of your text, but for some reason this disappeared.
To replace those lost features, a new piece of software called Math Type came about from Design Science. If you've seen the movie Looper, then I would equate the rise of Math Type with that of the Rainmaker, the mysterious, telepathic character who arose out of nowhere and is intent on killing off people he doesn't like and making everyone live by his rules.
What I don't like about Math Type is that they charge what I think is too much for incremental improvements to their software. For example, I bought a license for Math Type 6.6 before Office 2010 came out, but to get easy integration with 2010, I need to spend about $40 just to get a new version. There is a way to get 6.6 to work, but they make it very difficult to find this information. I also don't like that I've seen Design Science employees trolling PowerPoint forums telling people to buy Math Type to solve some issues and that it's very difficult to find older versions of their software on their website.
Now, to be fair, the software is quite nice and it does make it easy to type equations into PowerPoint and other Office software products. I just don't like how all the functionality that I enjoyed as a part of Office for free was moved into a separate, commercial product. And since I am required to use PowerPoint and Word at work, I'm stuck with this situation.
So you can imagine how happy I was to have found a wonderful alternative to Math Type called IguanaTeX. It's a plugin for PowerPoint 2003, 2007, and 2010 that let's you add LaTeX equations to slides as png files. You need to have MikTeX installed, and it's a bit finnicky getting the right packages at first, but once it's setup it works like a charm. AND you don't have to pay just to change the colors of your equations.
Check it out, especially if you know TeX.
One constant disappointment I've had with PowerPoint is the lack of a good equation editor since 2007. It was in this year, I believe, that Microsoft chose to dump almost all of the useful features of its native equation editor. Most appalling was that they removed the option to change the color of equations. This is absolutely crucial if you're working with dark backgrounds to enhance the contrast of your text, but for some reason this disappeared.
To replace those lost features, a new piece of software called Math Type came about from Design Science. If you've seen the movie Looper, then I would equate the rise of Math Type with that of the Rainmaker, the mysterious, telepathic character who arose out of nowhere and is intent on killing off people he doesn't like and making everyone live by his rules.
What I don't like about Math Type is that they charge what I think is too much for incremental improvements to their software. For example, I bought a license for Math Type 6.6 before Office 2010 came out, but to get easy integration with 2010, I need to spend about $40 just to get a new version. There is a way to get 6.6 to work, but they make it very difficult to find this information. I also don't like that I've seen Design Science employees trolling PowerPoint forums telling people to buy Math Type to solve some issues and that it's very difficult to find older versions of their software on their website.
Now, to be fair, the software is quite nice and it does make it easy to type equations into PowerPoint and other Office software products. I just don't like how all the functionality that I enjoyed as a part of Office for free was moved into a separate, commercial product. And since I am required to use PowerPoint and Word at work, I'm stuck with this situation.
So you can imagine how happy I was to have found a wonderful alternative to Math Type called IguanaTeX. It's a plugin for PowerPoint 2003, 2007, and 2010 that let's you add LaTeX equations to slides as png files. You need to have MikTeX installed, and it's a bit finnicky getting the right packages at first, but once it's setup it works like a charm. AND you don't have to pay just to change the colors of your equations.
Check it out, especially if you know TeX.
Labels:
latex,
PowerPoint
Saturday, June 1, 2013
My latest LabVIEW code now up on GitHub
If anyone is curious to see my implementation of my LabVIEW code for the project I've been mentioning, I've now placed it in this GitHub respository: git://github.com/kmdouglass/goniometer.git. There is a design document called program_design.html that should give you a good idea about what I was trying to do.
Now, it's not complete. I've only just managed to get it working. I need to clean it up A LOT, by creating more SubVI's and being more consistent with when I use global variables and when I pass data from the front panel. But if you have any ideas or comments, send them my way. I'd be happy to receive feedback from any LabVIEW pros out there.
---Update: November 6, 2013---
The code is no longer on GitHub, but you may e-mail me if you need it, as some of you have already done.
Now, it's not complete. I've only just managed to get it working. I need to clean it up A LOT, by creating more SubVI's and being more consistent with when I use global variables and when I pass data from the front panel. But if you have any ideas or comments, send them my way. I'd be happy to receive feedback from any LabVIEW pros out there.
---Update: November 6, 2013---
The code is no longer on GitHub, but you may e-mail me if you need it, as some of you have already done.
Labels:
labview
Friday, May 31, 2013
String/number conversions in LabVIEW
My LabVIEW program is mostly working after a long week. All in all, the design and implementation of the program went well, since it's now working. However, the implementation is very rough and I know that my LabVIEW programming skills can be improved a lot. In particular, I need to decide when global variables are necessary to use and when they're not, make better use of error handling and other forms of feedback for moving through sequences (beyond just using the Wait function for a long time), and make better use of subVI's.
One annoying aspect of LabVIEW that I've learned to appreciate through all of this is its string/number conversions and data types. One 12-hour measurement was wasted because I thought "Convert to Decimal Number" meant that I could take a string such as "42.5" and convert it to a number with decimal places, like 42.5. Unfortunately, inputting "42.5" into this function produces 42 at the output. A quick get-around is to use "Convert to Exponential Number," but I think I'll want to use "Format Value" and supply a format string to ensure that I'm converting correctly.
Here is a list of string/number conversion functions and their descriptions. I will be using this list, as well as the list of numeric data types, more frequently since I find them unintuitive.
One annoying aspect of LabVIEW that I've learned to appreciate through all of this is its string/number conversions and data types. One 12-hour measurement was wasted because I thought "Convert to Decimal Number" meant that I could take a string such as "42.5" and convert it to a number with decimal places, like 42.5. Unfortunately, inputting "42.5" into this function produces 42 at the output. A quick get-around is to use "Convert to Exponential Number," but I think I'll want to use "Format Value" and supply a format string to ensure that I'm converting correctly.
Here is a list of string/number conversion functions and their descriptions. I will be using this list, as well as the list of numeric data types, more frequently since I find them unintuitive.
Labels:
labview
Wednesday, May 29, 2013
There's now an academic Stack Exchange
This morning I was pleased to come across Academia Stack Exchange. Stack Exchange is a network of web forums for collecting crowd-sourced answers to questions. I believe that it originally came from Stack Overflow, a Q&A web forum for programming, and has expanded since.
I hope that such a site will provide academics answers to questions that they just can't find in other places. Academia can be frustrating because there's a large disconnect between people at different levels: post-docs don't understand graduate students, graduate students don't understand faculty, and faculty are just plain space cadets... just kidding about that last one :)
In all seriousness though, I'm glad to see such a support site and I hope to make good use of it.
I hope that such a site will provide academics answers to questions that they just can't find in other places. Academia can be frustrating because there's a large disconnect between people at different levels: post-docs don't understand graduate students, graduate students don't understand faculty, and faculty are just plain space cadets... just kidding about that last one :)
In all seriousness though, I'm glad to see such a support site and I hope to make good use of it.
Monday, May 27, 2013
More on LabVIEW, this time with RS232
My LabVIEW adventures continued today (yes, being close to graduation means you work on US national holidays). I began designing and implementing the pieces of my LabVIEW program for controlling the experimental setup that I discussed briefly in my last post.
After getting all the hardware pieces independently working with LabVIEW example VI's, I started working on some custom VI's that did exactly what I needed each piece of hardware to do. My idea is that I will use each custom subVI in a large control script. This control script should contain the commands to pass to each subVI and the order in which they'll be executed. All the data from the SR400 Photon Counter should be saved at each step, along with the current state of all the hardware pieces.
I started working on controlling the laser I have connected to a RS232 port. This should have been simple, but I my first bit of code simply didn't do anything. If I told the laser to turn off, it wouldn't. To mock me, the example "Basic Serial Write and Read.vi" that's included with the LabVIEW base DID work.
After an hour or two of playing around, I discovered that the strings I was passing to the laser in my custom VI did not contain the line feed ASCII character "\n" that is required to mark the end of a command, even though I included it in the string. The strings were stored in a drop down menu of common commands I frequently use. The line feed character was also included in the string I entered into the example VI and this was actually sent to the laser, which is why it worked.
I ended up fixing the situation using the information on this NI community page. It's a bit strange that it requires this much work to place a line feed at the end of a string, but oh well, it works.
I also ran into some issues with having the commands from the laser echoed back to me when I read the data from its buffer with a VISA read VI. I didn't want the echoes, I wanted the information that each command should return. I fixed this by doing to VISA reads. Apparently, LabVIEW's VISA read only reads until the carriage return/line feed and leaves the rest of the information in the read buffer.
Though I ran into some bumps, I'm very grateful for the help I've been able to find on the NI support and community sites. Without them I probably would still be stuck.
After getting all the hardware pieces independently working with LabVIEW example VI's, I started working on some custom VI's that did exactly what I needed each piece of hardware to do. My idea is that I will use each custom subVI in a large control script. This control script should contain the commands to pass to each subVI and the order in which they'll be executed. All the data from the SR400 Photon Counter should be saved at each step, along with the current state of all the hardware pieces.
I started working on controlling the laser I have connected to a RS232 port. This should have been simple, but I my first bit of code simply didn't do anything. If I told the laser to turn off, it wouldn't. To mock me, the example "Basic Serial Write and Read.vi" that's included with the LabVIEW base DID work.
After an hour or two of playing around, I discovered that the strings I was passing to the laser in my custom VI did not contain the line feed ASCII character "\n" that is required to mark the end of a command, even though I included it in the string. The strings were stored in a drop down menu of common commands I frequently use. The line feed character was also included in the string I entered into the example VI and this was actually sent to the laser, which is why it worked.
I ended up fixing the situation using the information on this NI community page. It's a bit strange that it requires this much work to place a line feed at the end of a string, but oh well, it works.
I also ran into some issues with having the commands from the laser echoed back to me when I read the data from its buffer with a VISA read VI. I didn't want the echoes, I wanted the information that each command should return. I fixed this by doing to VISA reads. Apparently, LabVIEW's VISA read only reads until the carriage return/line feed and leaves the rest of the information in the read buffer.
Though I ran into some bumps, I'm very grateful for the help I've been able to find on the NI support and community sites. Without them I probably would still be stuck.
Labels:
labview
Saturday, May 25, 2013
Learning how to operate GPIB buses with Labview
I'm currently engaged in a project which requires me to coordinate four separate pieces of hardware (two lasers, a stepper motor, and a photon counter). As is the case with all good experimental scientists educated in the 2000's, my first thought was to turn to Labview for making this happen.
However, I'm not terribly excited about this. I haven't actually programmed in Labview since my REU studies at the University of Colorado, Boulder, during which I made a visible grating-based spectrometer for working with lasers in vacuum systems. Since then, I've somehow managed to perform ALL of my experiments without automation and by writing down results in my lab notebook. I know that automated data acquisition can make my life easier, but my experiments have been relatively simple until now and learning Labview would have taken too much time.
Furthermore, I'm much more interested in using open-source software whenever I can (PyVISA is one such Python package which might help me). I don't ever want to be dependent upon possessing some company's latest toolbox or software version to do my research.
Despite all of this, I'm under a time-crunch with my current project and Labview is arguably the de facto standard for automation and measurement, so... here I go!
I first installed Labview 2012 on a Windows 7 system. There really wasn't any problem here; the software took a while to install, but it wasn't a big deal.
Following this, I quickly discovered that I needed to install the DAQmx software to get nearly all of my lab's previous VI's working. This wasn't a big deal either (it's free if you're registered with National Instruments), but I wonder why something that is apparently so important to Labview is left out of the installation. Some slight perusing on the NI community pages led me to find that since the 2012 version, NI changed up what is included from DAQmx with the base Labview install. I found an old repository for these now "missing" VI's, but it was pretty confusing to navigate.
Now, onto the GPIB control. I found an old NI PCI-GPIB controller card in one of our lab computers, removed it, and inserted it into the computer that I'm currently using. Windows recognized the card but didn't know what to do with it and Labview didn't know it existed. Fortunately, I found and downloaded the NI-488.2 driver, version 3.1.1 from NI's website and installed it without a hitch. After reboot, the card was recognized in NI's Measurement and Automation Explorer (MAX).
Now, I admit that getting the first device, a Stanford Research SR400 Photon Counter, was a breeze. I ran a GPIB cable from the PCI card to the SR400, and another one from the SR400 to my motion controller (of the two lasers, one is controlled via USB and the other via RS232). Both GPIB devices were recognized in MAX. This is what my MAX window looked like after clicking "Scan for Instruments" while having PCI-GPIB "GPIB0" selected in the left-most itemized list:
However, I'm not terribly excited about this. I haven't actually programmed in Labview since my REU studies at the University of Colorado, Boulder, during which I made a visible grating-based spectrometer for working with lasers in vacuum systems. Since then, I've somehow managed to perform ALL of my experiments without automation and by writing down results in my lab notebook. I know that automated data acquisition can make my life easier, but my experiments have been relatively simple until now and learning Labview would have taken too much time.
Furthermore, I'm much more interested in using open-source software whenever I can (PyVISA is one such Python package which might help me). I don't ever want to be dependent upon possessing some company's latest toolbox or software version to do my research.
Despite all of this, I'm under a time-crunch with my current project and Labview is arguably the de facto standard for automation and measurement, so... here I go!
I first installed Labview 2012 on a Windows 7 system. There really wasn't any problem here; the software took a while to install, but it wasn't a big deal.
Following this, I quickly discovered that I needed to install the DAQmx software to get nearly all of my lab's previous VI's working. This wasn't a big deal either (it's free if you're registered with National Instruments), but I wonder why something that is apparently so important to Labview is left out of the installation. Some slight perusing on the NI community pages led me to find that since the 2012 version, NI changed up what is included from DAQmx with the base Labview install. I found an old repository for these now "missing" VI's, but it was pretty confusing to navigate.
Now, onto the GPIB control. I found an old NI PCI-GPIB controller card in one of our lab computers, removed it, and inserted it into the computer that I'm currently using. Windows recognized the card but didn't know what to do with it and Labview didn't know it existed. Fortunately, I found and downloaded the NI-488.2 driver, version 3.1.1 from NI's website and installed it without a hitch. After reboot, the card was recognized in NI's Measurement and Automation Explorer (MAX).
Now, I admit that getting the first device, a Stanford Research SR400 Photon Counter, was a breeze. I ran a GPIB cable from the PCI card to the SR400, and another one from the SR400 to my motion controller (of the two lasers, one is controlled via USB and the other via RS232). Both GPIB devices were recognized in MAX. This is what my MAX window looked like after clicking "Scan for Instruments" while having PCI-GPIB "GPIB0" selected in the left-most itemized list:
In this picture I had already renamed the devices in MAX. I could tell which was which by turning one off and rescanning. Most of this information is found on an NI community website: http://www.ni.com/gettingstarted/setuphardware/instrumentcontrol/gpibconnect.htm
One final note: after reading some discussions on the SR400, I found that this particular device is tricky to work with because it's so old. Fortunately, on this same discussion I found custom VI's for working with it from Paul Henning which have worked like a charm.
So far, I'm quite happy with how easy it was to get to this point. This was facilitated by software that worked seamlessly at finding the hardware and a strong user-base for getting specific hardware to work. I still anticipate having some difficulty with the actual programming and getting the instruments to work in sync, but that can't be helped so much.
Kudos to you, NI.
Wednesday, May 15, 2013
Metamaterials for heat
There's a really cool experiment described in a recent PRL and summarized here about creating a metamaterial for cloaking objects from heat flow.
What connections to metamaterials for light can be drawn? The transport of heat is governed by a diffusion equation, which is very different from the wave equation and Maxwell's equations for governing light transport.
However, the diffusion equation can apply to light transport in disordered materials (see Ishimaru or van Rossum and Nieuwenhuizen). Is there some way, then to cloak objects in randomly scattering media from light?
The trouble with this thought is that one would have to add structure to a random material, and the only way I can think of doing this would be to create large-scale structures from a material with small-scale disorder.
What connections to metamaterials for light can be drawn? The transport of heat is governed by a diffusion equation, which is very different from the wave equation and Maxwell's equations for governing light transport.
However, the diffusion equation can apply to light transport in disordered materials (see Ishimaru or van Rossum and Nieuwenhuizen). Is there some way, then to cloak objects in randomly scattering media from light?
The trouble with this thought is that one would have to add structure to a random material, and the only way I can think of doing this would be to create large-scale structures from a material with small-scale disorder.
Wednesday, May 8, 2013
Becoming a scientist
I'm not sure if you can read this without a subscription to Nature Jobs, but if you can read it, please do so.
This is an essay written by a post-doctoral fellow in neuroscience named Thomas Schofield. He was tragically killed in a bus accident in 2010.
This brief essay on becoming a scientist is very insightful and may help others to shed some misconceptions about a career in science.
This is an essay written by a post-doctoral fellow in neuroscience named Thomas Schofield. He was tragically killed in a bus accident in 2010.
This brief essay on becoming a scientist is very insightful and may help others to shed some misconceptions about a career in science.
Subscribe to:
Posts (Atom)