During some recent presentations, I have used a small matlab program giving me a live Fourier transform of the laptop camera input. It can be used in combination with some printed “structures” to show what we would see on a SAXS or WAXS detector.
The idea is not mine, I heard that it was used by dr. Henrik Lemke for his Ph.D. defense to show the effects of lattice strain on the diffraction pattern.
It turns out to be quite popular with the audience so far, so I will post the code for Matlab running on a macbook Pro here. Feel fee to use the code. I will also make a short movie showing one example of how to use it. I am sure you can think of many other useful purposes for it!
The package is here: FT_cam_package
Since it is so specific in its application, there is no documentation. Also, run “FTcamdemo” and the rest should be quite self-explanatory in the GUI that comes up. This package uses (and comes with) camera image capture code (Java) by Kalle Kempe and Ikkjin Ahn.
Herewith a preliminary release of the Monte-Carlo code for fitting SAXS patterns. Documentation will follow, as will a movie and more.
Check it out and let me know if you have any questions.
Sorry for the big wait. It is not over yet, but I am working on it. More posts hopefully soon although I cannot promise a topic. Might be videos, but maybe also the monte-carlo code.
The Monte-Carlo thing is almost ready to go, just some documentation left to write. It has become a slow bugger by now, but if you have a fast computer, you have nothing to worry about ;).
Limitations: You need good data. and I mean thousands of counts. Millions, if you have them. Also, it only works for dilute, spherical systems. God, I feel like a physicist now… Anywho, for that, it works and it retrieves all information present in your scattering pattern. Check again soon and I may have it up here. And I hope there is a publication to follow as well, as we have to keep the numbers up in this climate.
Oh, and if you wonder about my current writing style… I must admit, I have been overdosing on Transmetropolitan
I have made some new software available on the “software” page. This is the saxsfit (yes, terrible name, I know) routine I normally use for fitting SAXS curves to model functions. Nothing special, except that it can also deal with (time)series quite nicely. Also there is documentation for some of the packages. I hope to have the documentation complete for all packages in the future, but for now is still a work-in-progress. Next time, a Monte-Carlo fitting routine, which should come complete with introductory Youtube movie!
I have written some small, simple bits of Matlab software that can generate scattering patterns in the range you request for polydisperse, dilute spheres or ellipsoids. While nothing new per se, this implementation is guaranteed to produce correct scattering patterns irrespective of the width of the distribution. Allow me to quickly explain.
The normal way of calculating these patterns in fitting functions and the likes, is to choose an upper size limit (perhaps related to the width and mean of the distribution), and divide the size range between zero and this upper limit into perhaps 100 different sizes. Then the scattering pattern of each of these contributions is calculated, multiplied with their probability (obtained from the probability (or size) distribution function), multiplied with the square of the particle volume for that size, and then summed. In all, then, this is a numeric integration over the volume-square weighted size distribution.
The problem lies in the determination of the upper limit and the number of divisions required. In the past, I have tried using the cumulative distribution function to select “smart” divisions, or adjusting the width and mean to compensate for the volume-square weighting, but this often resulted in the appearance of oscillatory behaviour in the scattering patterns. An alternative solution was therefore required.
These functions are not necessarily fast enough for fitting purposes, but they can be used for checking the applicability of your fitting procedures. You should get out of your fitting functions what you put into these simulated patterns.
These functions work by random generation of a number of spheres or ellipsoids. A scattering pattern is calculated from an initial number of spheres or ellipsoids. Then, the scattering pattern is calculated of the original block with the addition of a new set of shapes. This is repeated until the effect of adding a new block on the scattering pattern no longer exceeds a certain threshold.
Included are the programs for generating scattering patterns using polydisperse distributions of spheres or ellipsoids. All distributions supported by the “statistics library”‘s RANDOM function are available. For ellipsoids, an additional distribution can be used for the aspect ratio. If the use is not clear, let me know and I will write some more extensive documentation.
The programs are: perfectpattern_spheres and perfectpattern_ellipsoids. Have fun!