matlab

Live Fourier transform

2011/02/03 // 8 Comments

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 [...]

Monte-Carlo Code

2010/12/21 // 2 Comments

Hi all, Herewith a preliminary release of the Monte-Carlo code for fitting SAXS patterns. Documentation will follow, as will a movie and more. MCFit_sph.m Check it out and let me know if you have any [...]

Sorry for the delay

2010/12/10 // 0 Comments

Hi all, 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 [...]

saxsfit software with documentation, fitting function examples and example data

2010/10/10 // 2 Comments

Hi all, 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! Cheers! [...]

“Perfect” 1D pattern generation software.

2010/08/30 // 0 Comments

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 [...]