I have been asked alot for the Petzval bokeh code. I kinda dropped it since Alexander beat me to it and made a release version. But i can see that he forgot to add the source code, so here it is: http://hagbarth.net/nuke/Petzval.nk
The concept is quite simple, having two convolutions one being offset from your center and masking off the main convolution.