<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pymol.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jarl.Underhaug</id>
	<title>PyMOL Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pymol.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jarl.Underhaug"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php/Special:Contributions/Jarl.Underhaug"/>
	<updated>2026-04-21T22:04:26Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11993</id>
		<title>FocalBlur</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11993"/>
		<updated>2012-12-14T11:47:33Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: /* Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
&lt;br /&gt;
This script creates fancy figures by introducing a focal blur to the image. The object at the origin will be in focus. &lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
&lt;br /&gt;
Load the script using the [[run]] command. Execute the script using PyMOL syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur aperture=2.0,samples=20,ray=1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
or using python syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur(aperture=2.0,samples=20,ray=1)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For additional options, see the script comments.&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
&lt;br /&gt;
* When using raytracing, the image creation will take ''n'' times longer than normal, where ''n'' is the number of samples.&lt;br /&gt;
* The aperture is related to the aperture on a camera.&lt;br /&gt;
&lt;br /&gt;
===Bugs===&lt;br /&gt;
&lt;br /&gt;
* FocalBlur uses the Python Image Library (PIL), a necessary components of PIL is missing in the Windows version of PyMOL&lt;br /&gt;
* There is a bug when not using ray tracing with the free version of PyMOL&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery perrow=3 widths=300 heights=240&amp;gt;&lt;br /&gt;
Image:FocalBlur_a1.0_r1.png|FocalBlur aperture=1,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a2.0_r1.png|FocalBlur aperture=2,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r1.png|FocalBlur aperture=4,samples=400,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r0.png|FocalBlur aperture=4,samples=400,ray=0&lt;br /&gt;
Image:Focal_blur _ex6.png&lt;br /&gt;
Image:Focal blur_ex_ap3.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode1.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode2.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode3.png&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Script==&lt;br /&gt;
Load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from tempfile import mkdtemp&lt;br /&gt;
from shutil import rmtree&lt;br /&gt;
from math import sin,cos,pi,sqrt&lt;br /&gt;
from PIL import Image&lt;br /&gt;
 &lt;br /&gt;
def FocalBlur(aperture=2.0,samples=10,ray=0,width=0,height=0):&lt;br /&gt;
    '''&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
 &lt;br /&gt;
    Creates fancy figures by introducing a focal blur to the image. The object&lt;br /&gt;
    at the origin will be in focus. &lt;br /&gt;
 &lt;br /&gt;
AUTHOR&lt;br /&gt;
 &lt;br /&gt;
    Jarl Underhaug&lt;br /&gt;
    University of Bergen&lt;br /&gt;
    jarl_dot_underhaug_at_gmail_dot_com&lt;br /&gt;
&lt;br /&gt;
    Updates by Jason Vertrees and Thomas Holder&lt;br /&gt;
 &lt;br /&gt;
USAGE&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=float, samples=int, ray=0/1, width=int, height=int&lt;br /&gt;
 &lt;br /&gt;
EXAMPELS&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=1, samples=100&lt;br /&gt;
    FocalBlur aperture=2, samples=100, ray=1, width=600, height=400&lt;br /&gt;
    '''&lt;br /&gt;
&lt;br /&gt;
    # Formalize the parameter types&lt;br /&gt;
    ray = (ray in (&amp;quot;True&amp;quot;, &amp;quot;true&amp;quot;, 1, &amp;quot;1&amp;quot;))&lt;br /&gt;
    aperture, samples = float(aperture), int(samples)&lt;br /&gt;
    width, height = int(width), int(height)&lt;br /&gt;
 &lt;br /&gt;
    # Create a temporary directory&lt;br /&gt;
    tmpdir = mkdtemp()&lt;br /&gt;
&lt;br /&gt;
    # Get the orientation of the protein and the light&lt;br /&gt;
    light = cmd.get('light')[1:-1]&lt;br /&gt;
    light = [float(s) for s in light.split(',')]&lt;br /&gt;
    view = cmd.get_view()&lt;br /&gt;
 &lt;br /&gt;
    # Rotate the protein and the light in order to create the blur&lt;br /&gt;
    for frame in range(samples):&lt;br /&gt;
        # Angles to rotate protein and light&lt;br /&gt;
        # Populate angles as Fermat's spiral&lt;br /&gt;
        theta = frame * pi * 110.0/144.0&lt;br /&gt;
        radius = 0.5 * aperture * sqrt(frame/float(samples-1))&lt;br /&gt;
        x = cos(theta) * radius&lt;br /&gt;
        y = sin(theta) * radius&lt;br /&gt;
        xr = x/180.0*pi&lt;br /&gt;
        yr = y/180.0*pi&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the protein&lt;br /&gt;
        cmd.turn('x',x)&lt;br /&gt;
        cmd.turn('y',y)&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the light&lt;br /&gt;
        ly = light[1]*cos(xr)-light[2]*sin(xr)&lt;br /&gt;
        lz = light[2]*cos(xr)+light[1]*sin(xr)&lt;br /&gt;
        lx = light[0]*cos(yr)+lz*sin(yr)&lt;br /&gt;
        lz = lz*cos(yr)-lx*sin(yr)&lt;br /&gt;
        cmd.set('light',[lx,ly,lz])&lt;br /&gt;
 &lt;br /&gt;
        curFile = &amp;quot;%s/frame-%04d.png&amp;quot; % (tmpdir,frame)&lt;br /&gt;
        print &amp;quot;Created frame %i/%i (%0.0f%%)&amp;quot; % (frame+1,samples,100*(frame+1)/samples)&lt;br /&gt;
&lt;br /&gt;
        # Save the image to temporary directory&lt;br /&gt;
	if ray:&lt;br /&gt;
                cmd.ray(width,height)&lt;br /&gt;
                cmd.png(curFile)&lt;br /&gt;
	else:&lt;br /&gt;
        	cmd.png(curFile,quiet=1)&lt;br /&gt;
        &lt;br /&gt;
        # Create the average/blured image&lt;br /&gt;
        try:&lt;br /&gt;
            avg = Image.blend(avg,Image.open(curFile),1.0/(frame+1))&lt;br /&gt;
        except:&lt;br /&gt;
            avg = Image.open(curFile)&lt;br /&gt;
        &lt;br /&gt;
        # Return the protein and the light to the original orientation&lt;br /&gt;
        cmd.set('light',light)&lt;br /&gt;
        cmd.set_view(view)&lt;br /&gt;
 &lt;br /&gt;
    # Load the blured image&lt;br /&gt;
    avg.save('%s/avg.png' % (tmpdir))&lt;br /&gt;
    cmd.load('%s/avg.png' % (tmpdir))&lt;br /&gt;
 &lt;br /&gt;
    # Delete the temporary files&lt;br /&gt;
    rmtree(tmpdir)&lt;br /&gt;
&lt;br /&gt;
cmd.extend('FocalBlur', FocalBlur)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11992</id>
		<title>FocalBlur</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11992"/>
		<updated>2012-11-28T14:30:16Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
&lt;br /&gt;
This script creates fancy figures by introducing a focal blur to the image. The object at the origin will be in focus. &lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
&lt;br /&gt;
Load the script using the [[run]] command. Execute the script using PyMOL syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur aperture=2.0,samples=20,ray=1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
or using python syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur(aperture=2.0,samples=20,ray=1)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For additional options, see the script comments.&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
&lt;br /&gt;
* When using raytracing, the image creation will take ''n'' times longer than normal, where ''n'' is the number of samples.&lt;br /&gt;
* The aperture is related to the aperture on a camera.&lt;br /&gt;
&lt;br /&gt;
===Bugs===&lt;br /&gt;
&lt;br /&gt;
* FocalBlur uses the Python Image Library (PIL), a necessary components of PIL is missing in the Windows version of PyMOL&lt;br /&gt;
* There is a bug when not using ray tracing with the free version of PyMOL&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery perrow=3 widths=300 heights=240&amp;gt;&lt;br /&gt;
Image:FocalBlur_a1.0_r1.png|FocalBlur aperture=1,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a2.0_r1.png|FocalBlur aperture=2,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r1.png|FocalBlur aperture=4,samples=400,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r0.png|FocalBlur aperture=4,samples=400,ray=0&lt;br /&gt;
Image:Focal_blur _ex6.png&lt;br /&gt;
Image:Focal blur_ex_ap3.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode1.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode2.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode3.png&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Script==&lt;br /&gt;
Load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from tempfile import mkdtemp&lt;br /&gt;
from shutil import rmtree&lt;br /&gt;
from math import sin,cos,pi,sqrt&lt;br /&gt;
from PIL import Image&lt;br /&gt;
 &lt;br /&gt;
def FocalBlur(aperture=2.0,samples=10,ray=0,width=0,height=0):&lt;br /&gt;
    '''&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
 &lt;br /&gt;
    Creates fancy figures by introducing a focal blur to the image. The object&lt;br /&gt;
    at the origin will be in focus. &lt;br /&gt;
 &lt;br /&gt;
AUTHOR&lt;br /&gt;
 &lt;br /&gt;
    Jarl Underhaug&lt;br /&gt;
    University of Bergen&lt;br /&gt;
    jarl_dot_underhaug_at_gmail_dot_com&lt;br /&gt;
&lt;br /&gt;
    Updates by Jason Vertrees and Thomas Holder&lt;br /&gt;
 &lt;br /&gt;
USAGE&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=float, samples=int, ray=0/1, width=int, height=int&lt;br /&gt;
 &lt;br /&gt;
EXAMPELS&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=1, samples=100&lt;br /&gt;
    FocalBlur aperture=2, samples=100, ray=1, width=600, height=400&lt;br /&gt;
    '''&lt;br /&gt;
&lt;br /&gt;
    # Formalize the parameter types&lt;br /&gt;
    ray = (ray in (&amp;quot;True&amp;quot;, &amp;quot;true&amp;quot;, 1, &amp;quot;1&amp;quot;))&lt;br /&gt;
    aperture, samples = float(aperture), int(samples)&lt;br /&gt;
    width, height = int(width), int(height)&lt;br /&gt;
 &lt;br /&gt;
    # Create a temporary directory&lt;br /&gt;
    tmpdir = mkdtemp()&lt;br /&gt;
&lt;br /&gt;
    # Get the orientation of the protein and the light&lt;br /&gt;
    light = cmd.get('light')[1:-1]&lt;br /&gt;
    light = [float(s) for s in light.split(',')]&lt;br /&gt;
    view = cmd.get_view()&lt;br /&gt;
 &lt;br /&gt;
    # Rotate the protein and the light in order to create the blur&lt;br /&gt;
    for frame in range(samples):&lt;br /&gt;
        # Angles to rotate protein and light&lt;br /&gt;
        # Populate angles as Fermat's spiral&lt;br /&gt;
        theta = frame * pi * 110.0/144.0&lt;br /&gt;
        radius = 0.5 * aperture * sqrt(frame/float(samples-1))&lt;br /&gt;
        x = cos(theta) * radius&lt;br /&gt;
        y = sin(theta) * radius&lt;br /&gt;
        xr = x/180.0*pi&lt;br /&gt;
        yr = y/180.0*pi&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the protein&lt;br /&gt;
        cmd.turn('x',x)&lt;br /&gt;
        cmd.turn('y',y)&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the light&lt;br /&gt;
        ly = light[1]*cos(xr)-light[2]*sin(xr)&lt;br /&gt;
        lz = light[2]*cos(xr)+light[1]*sin(xr)&lt;br /&gt;
        lx = light[0]*cos(yr)+lz*sin(yr)&lt;br /&gt;
        lz = lz*cos(yr)-lx*sin(yr)&lt;br /&gt;
        cmd.set('light',[lx,ly,lz])&lt;br /&gt;
 &lt;br /&gt;
        curFile = &amp;quot;%s/frame-%04d.png&amp;quot; % (tmpdir,frame)&lt;br /&gt;
        print &amp;quot;Created frame %i/%i (%0.0f%%)&amp;quot; % (frame+1,samples,100*(frame+1)/samples)&lt;br /&gt;
&lt;br /&gt;
        # Save the image to temporary directory&lt;br /&gt;
	if ray:&lt;br /&gt;
                cmd.ray()&lt;br /&gt;
                cmd.png(curFile)&lt;br /&gt;
	else:&lt;br /&gt;
        	cmd.png(curFile,quiet=1)&lt;br /&gt;
        &lt;br /&gt;
        # Create the average/blured image&lt;br /&gt;
        try:&lt;br /&gt;
            avg = Image.blend(avg,Image.open(curFile),1.0/(frame+1))&lt;br /&gt;
        except:&lt;br /&gt;
            avg = Image.open(curFile)&lt;br /&gt;
        &lt;br /&gt;
        # Return the protein and the light to the original orientation&lt;br /&gt;
        cmd.set('light',light)&lt;br /&gt;
        cmd.set_view(view)&lt;br /&gt;
 &lt;br /&gt;
    # Load the blured image&lt;br /&gt;
    avg.save('%s/avg.png' % (tmpdir))&lt;br /&gt;
    cmd.load('%s/avg.png' % (tmpdir))&lt;br /&gt;
 &lt;br /&gt;
    # Delete the temporary files&lt;br /&gt;
    rmtree(tmpdir)&lt;br /&gt;
&lt;br /&gt;
cmd.extend('FocalBlur', FocalBlur)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11991</id>
		<title>FocalBlur</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11991"/>
		<updated>2012-11-28T14:29:47Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: /* Usage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
&lt;br /&gt;
This script creates fancy figures by introducing a focal blur to the image. The object at the origin will be in focus. &lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
&lt;br /&gt;
Load the script using the [[run]] command. Execute the script using PyMOL syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur aperture=2.0,samples=20,ray=1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
or using python syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur(aperture=2.0,samples=20,ray=1)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For additional options, see the script comments.&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
&lt;br /&gt;
* When using raytracing, the image creation will take ''n'' times longer than normal, where ''n'' is the number of samples.&lt;br /&gt;
* The aperture is related to the aperture on a camera.&lt;br /&gt;
&lt;br /&gt;
===Bugs===&lt;br /&gt;
&lt;br /&gt;
* FocalBlur uses the Python Image Library (PIL), a necessary components of PIL is missing in the Windows version of PyMOL&lt;br /&gt;
* There is a bug when not using ray tracing with the free version of PyMOL&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery perrow=3 widths=300 heights=240&amp;gt;&lt;br /&gt;
Image:FocalBlur_a1.0_r1.png|FocalBlur aperture=1,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a2.0_r1.png|FocalBlur aperture=2,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r1.png|FocalBlur aperture=4,samples=400,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r0.png|FocalBlur aperture=4,samples=400,ray=0&lt;br /&gt;
Image:Focal_blur _ex6.png&lt;br /&gt;
Image:Focal blur_ex_ap3.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode1.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode2.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode3.png&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Script==&lt;br /&gt;
Load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from tempfile import mkdtemp&lt;br /&gt;
from shutil import rmtree&lt;br /&gt;
from math import sin,cos,pi,sqrt&lt;br /&gt;
from PIL import Image&lt;br /&gt;
 &lt;br /&gt;
def FocalBlur(aperture=2.0,samples=10,ray=0,width=0,height=0):&lt;br /&gt;
    '''&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
 &lt;br /&gt;
    Creates fancy figures by introducing a focal blur to the image. The object&lt;br /&gt;
    at the origin will be in focus. &lt;br /&gt;
 &lt;br /&gt;
AUTHOR&lt;br /&gt;
 &lt;br /&gt;
    Jarl Underhaug&lt;br /&gt;
    University of Bergen&lt;br /&gt;
    jarl_dot_underhaug_at_gmail_dot_com&lt;br /&gt;
&lt;br /&gt;
    Updates by Jason Vertrees and Thomas Holder&lt;br /&gt;
 &lt;br /&gt;
USAGE&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=float, samples=int, ray=0/1, width=int, height=int&lt;br /&gt;
 &lt;br /&gt;
EXAMPELS&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=1, samples=100&lt;br /&gt;
    FocalBlur aperture=2, samples=100, ray=1, width=600, height=400&lt;br /&gt;
    '''&lt;br /&gt;
&lt;br /&gt;
    # Formalize the parameter types&lt;br /&gt;
    ray = (ray in (&amp;quot;True&amp;quot;, &amp;quot;true&amp;quot;, 1, &amp;quot;1&amp;quot;))&lt;br /&gt;
    aperture, samples = float(aperture), int(samples)&lt;br /&gt;
    width, height = int(width), int(height)&lt;br /&gt;
 &lt;br /&gt;
    # Create a temporary directory&lt;br /&gt;
    tmpdir = mkdtemp()&lt;br /&gt;
&lt;br /&gt;
    # Get the orientation of the protein and the light&lt;br /&gt;
    light = cmd.get('light')[1:-1]&lt;br /&gt;
    light = [float(s) for s in light.split(',')]&lt;br /&gt;
    view = cmd.get_view()&lt;br /&gt;
 &lt;br /&gt;
    # Rotate the protein and the light in order to create the blur&lt;br /&gt;
    for frame in range(samples):&lt;br /&gt;
        # Angles to rotate protein and light&lt;br /&gt;
        # Populate angles as Fermat's spiral&lt;br /&gt;
        theta = frame * pi * 110.0/144.0&lt;br /&gt;
        radius = 0.5 * aperture * sqrt(frame/float(samples-1))&lt;br /&gt;
        x = cos(theta) * radius&lt;br /&gt;
        y = sin(theta) * radius&lt;br /&gt;
        xr = x/180.0*pi&lt;br /&gt;
        yr = y/180.0*pi&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the protein&lt;br /&gt;
        cmd.turn('x',x)&lt;br /&gt;
        cmd.turn('y',y)&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the light&lt;br /&gt;
        ly = light[1]*cos(xr)-light[2]*sin(xr)&lt;br /&gt;
        lz = light[2]*cos(xr)+light[1]*sin(xr)&lt;br /&gt;
        lx = light[0]*cos(yr)+lz*sin(yr)&lt;br /&gt;
        lz = lz*cos(yr)-lx*sin(yr)&lt;br /&gt;
        cmd.set('light',[lx,ly,lz])&lt;br /&gt;
 &lt;br /&gt;
        curFile = &amp;quot;%s/frame-%04d.png&amp;quot; % (tmpdir,frame)&lt;br /&gt;
        print &amp;quot;Created frame %i/%i (%0.0f%%)&amp;quot; % (frame+1,samples,100*(frame+1)/samples)&lt;br /&gt;
&lt;br /&gt;
        # Save the image to temporary directory&lt;br /&gt;
	if ray:&lt;br /&gt;
                cmd.ray()&lt;br /&gt;
                cmd.png(curFile)&lt;br /&gt;
	else:&lt;br /&gt;
        	cmd.png(curFile,quiet=1)&lt;br /&gt;
        &lt;br /&gt;
        # Create the average/blured image&lt;br /&gt;
        try:&lt;br /&gt;
            avg = Image.blend(avg,Image.open(curFile),1.0/(frame+1))&lt;br /&gt;
        except:&lt;br /&gt;
            avg = Image.open(curFile)&lt;br /&gt;
        &lt;br /&gt;
        # Return the protein and the light to the original orientation&lt;br /&gt;
        cmd.set('light',light)&lt;br /&gt;
        cmd.set_view(view)&lt;br /&gt;
 &lt;br /&gt;
    # Load the blured image&lt;br /&gt;
    avg.save('%s/avg.png' % (tmpdir))&lt;br /&gt;
    cmd.load('%s/avg.png' % (tmpdir))&lt;br /&gt;
 &lt;br /&gt;
    # Delete the temporary files&lt;br /&gt;
    rmtree(tmpdir)&lt;br /&gt;
&lt;br /&gt;
cmd.extend('FocalBlur', FocalBlur)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11990</id>
		<title>FocalBlur</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11990"/>
		<updated>2012-11-28T14:29:30Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
&lt;br /&gt;
This script creates fancy figures by introducing a focal blur to the image. The object at the origin will be in focus. &lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
&lt;br /&gt;
Load the script using the [[run]] command. Execute the script using PyMOL syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur aperture=2.0,samples=100,ray=1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
or using python syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur(aperture=2.0,samples=100,ray=1)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For additional options, see the script comments.&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
&lt;br /&gt;
* When using raytracing, the image creation will take ''n'' times longer than normal, where ''n'' is the number of samples.&lt;br /&gt;
* The aperture is related to the aperture on a camera.&lt;br /&gt;
&lt;br /&gt;
===Bugs===&lt;br /&gt;
&lt;br /&gt;
* FocalBlur uses the Python Image Library (PIL), a necessary components of PIL is missing in the Windows version of PyMOL&lt;br /&gt;
* There is a bug when not using ray tracing with the free version of PyMOL&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery perrow=3 widths=300 heights=240&amp;gt;&lt;br /&gt;
Image:FocalBlur_a1.0_r1.png|FocalBlur aperture=1,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a2.0_r1.png|FocalBlur aperture=2,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r1.png|FocalBlur aperture=4,samples=400,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r0.png|FocalBlur aperture=4,samples=400,ray=0&lt;br /&gt;
Image:Focal_blur _ex6.png&lt;br /&gt;
Image:Focal blur_ex_ap3.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode1.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode2.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode3.png&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Script==&lt;br /&gt;
Load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from tempfile import mkdtemp&lt;br /&gt;
from shutil import rmtree&lt;br /&gt;
from math import sin,cos,pi,sqrt&lt;br /&gt;
from PIL import Image&lt;br /&gt;
 &lt;br /&gt;
def FocalBlur(aperture=2.0,samples=10,ray=0,width=0,height=0):&lt;br /&gt;
    '''&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
 &lt;br /&gt;
    Creates fancy figures by introducing a focal blur to the image. The object&lt;br /&gt;
    at the origin will be in focus. &lt;br /&gt;
 &lt;br /&gt;
AUTHOR&lt;br /&gt;
 &lt;br /&gt;
    Jarl Underhaug&lt;br /&gt;
    University of Bergen&lt;br /&gt;
    jarl_dot_underhaug_at_gmail_dot_com&lt;br /&gt;
&lt;br /&gt;
    Updates by Jason Vertrees and Thomas Holder&lt;br /&gt;
 &lt;br /&gt;
USAGE&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=float, samples=int, ray=0/1, width=int, height=int&lt;br /&gt;
 &lt;br /&gt;
EXAMPELS&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=1, samples=100&lt;br /&gt;
    FocalBlur aperture=2, samples=100, ray=1, width=600, height=400&lt;br /&gt;
    '''&lt;br /&gt;
&lt;br /&gt;
    # Formalize the parameter types&lt;br /&gt;
    ray = (ray in (&amp;quot;True&amp;quot;, &amp;quot;true&amp;quot;, 1, &amp;quot;1&amp;quot;))&lt;br /&gt;
    aperture, samples = float(aperture), int(samples)&lt;br /&gt;
    width, height = int(width), int(height)&lt;br /&gt;
 &lt;br /&gt;
    # Create a temporary directory&lt;br /&gt;
    tmpdir = mkdtemp()&lt;br /&gt;
&lt;br /&gt;
    # Get the orientation of the protein and the light&lt;br /&gt;
    light = cmd.get('light')[1:-1]&lt;br /&gt;
    light = [float(s) for s in light.split(',')]&lt;br /&gt;
    view = cmd.get_view()&lt;br /&gt;
 &lt;br /&gt;
    # Rotate the protein and the light in order to create the blur&lt;br /&gt;
    for frame in range(samples):&lt;br /&gt;
        # Angles to rotate protein and light&lt;br /&gt;
        # Populate angles as Fermat's spiral&lt;br /&gt;
        theta = frame * pi * 110.0/144.0&lt;br /&gt;
        radius = 0.5 * aperture * sqrt(frame/float(samples-1))&lt;br /&gt;
        x = cos(theta) * radius&lt;br /&gt;
        y = sin(theta) * radius&lt;br /&gt;
        xr = x/180.0*pi&lt;br /&gt;
        yr = y/180.0*pi&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the protein&lt;br /&gt;
        cmd.turn('x',x)&lt;br /&gt;
        cmd.turn('y',y)&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the light&lt;br /&gt;
        ly = light[1]*cos(xr)-light[2]*sin(xr)&lt;br /&gt;
        lz = light[2]*cos(xr)+light[1]*sin(xr)&lt;br /&gt;
        lx = light[0]*cos(yr)+lz*sin(yr)&lt;br /&gt;
        lz = lz*cos(yr)-lx*sin(yr)&lt;br /&gt;
        cmd.set('light',[lx,ly,lz])&lt;br /&gt;
 &lt;br /&gt;
        curFile = &amp;quot;%s/frame-%04d.png&amp;quot; % (tmpdir,frame)&lt;br /&gt;
        print &amp;quot;Created frame %i/%i (%0.0f%%)&amp;quot; % (frame+1,samples,100*(frame+1)/samples)&lt;br /&gt;
&lt;br /&gt;
        # Save the image to temporary directory&lt;br /&gt;
	if ray:&lt;br /&gt;
                cmd.ray()&lt;br /&gt;
                cmd.png(curFile)&lt;br /&gt;
	else:&lt;br /&gt;
        	cmd.png(curFile,quiet=1)&lt;br /&gt;
        &lt;br /&gt;
        # Create the average/blured image&lt;br /&gt;
        try:&lt;br /&gt;
            avg = Image.blend(avg,Image.open(curFile),1.0/(frame+1))&lt;br /&gt;
        except:&lt;br /&gt;
            avg = Image.open(curFile)&lt;br /&gt;
        &lt;br /&gt;
        # Return the protein and the light to the original orientation&lt;br /&gt;
        cmd.set('light',light)&lt;br /&gt;
        cmd.set_view(view)&lt;br /&gt;
 &lt;br /&gt;
    # Load the blured image&lt;br /&gt;
    avg.save('%s/avg.png' % (tmpdir))&lt;br /&gt;
    cmd.load('%s/avg.png' % (tmpdir))&lt;br /&gt;
 &lt;br /&gt;
    # Delete the temporary files&lt;br /&gt;
    rmtree(tmpdir)&lt;br /&gt;
&lt;br /&gt;
cmd.extend('FocalBlur', FocalBlur)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11989</id>
		<title>FocalBlur</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11989"/>
		<updated>2012-11-28T14:26:07Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: /* Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
&lt;br /&gt;
This script creates fancy figures by introducing a focal blur to the image. The object at the origin will be in focus. &lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
&lt;br /&gt;
Load the script using the [[run]] command. Execute the script using PyMOL syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur aperture=2.0,samples=100,ray=1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
or using python syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur(aperture=2.0,samples=100,ray=1)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For additional options, see the script comments.&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
&lt;br /&gt;
* When using raytracing, the image creation will take ''n'' times longer than normal, where ''n'' is the number of samples.&lt;br /&gt;
* The aperture is related to the aperture on a camera.&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery perrow=3 widths=300 heights=240&amp;gt;&lt;br /&gt;
Image:FocalBlur_a1.0_r1.png|FocalBlur aperture=1,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a2.0_r1.png|FocalBlur aperture=2,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r1.png|FocalBlur aperture=4,samples=400,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r0.png|FocalBlur aperture=4,samples=400,ray=0&lt;br /&gt;
Image:Focal_blur _ex6.png&lt;br /&gt;
Image:Focal blur_ex_ap3.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode1.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode2.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode3.png&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Script==&lt;br /&gt;
Load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from tempfile import mkdtemp&lt;br /&gt;
from shutil import rmtree&lt;br /&gt;
from math import sin,cos,pi,sqrt&lt;br /&gt;
from PIL import Image&lt;br /&gt;
 &lt;br /&gt;
def FocalBlur(aperture=2.0,samples=10,ray=0,width=0,height=0):&lt;br /&gt;
    '''&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
 &lt;br /&gt;
    Creates fancy figures by introducing a focal blur to the image. The object&lt;br /&gt;
    at the origin will be in focus. &lt;br /&gt;
 &lt;br /&gt;
AUTHOR&lt;br /&gt;
 &lt;br /&gt;
    Jarl Underhaug&lt;br /&gt;
    University of Bergen&lt;br /&gt;
    jarl_dot_underhaug_at_gmail_dot_com&lt;br /&gt;
&lt;br /&gt;
    Updates by Jason Vertrees and Thomas Holder&lt;br /&gt;
 &lt;br /&gt;
USAGE&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=float, samples=int, ray=0/1, width=int, height=int&lt;br /&gt;
 &lt;br /&gt;
EXAMPELS&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=1, samples=100&lt;br /&gt;
    FocalBlur aperture=2, samples=100, ray=1, width=600, height=400&lt;br /&gt;
    '''&lt;br /&gt;
&lt;br /&gt;
    # Formalize the parameter types&lt;br /&gt;
    ray = (ray in (&amp;quot;True&amp;quot;, &amp;quot;true&amp;quot;, 1, &amp;quot;1&amp;quot;))&lt;br /&gt;
    aperture, samples = float(aperture), int(samples)&lt;br /&gt;
    width, height = int(width), int(height)&lt;br /&gt;
 &lt;br /&gt;
    # Create a temporary directory&lt;br /&gt;
    tmpdir = mkdtemp()&lt;br /&gt;
&lt;br /&gt;
    # Get the orientation of the protein and the light&lt;br /&gt;
    light = cmd.get('light')[1:-1]&lt;br /&gt;
    light = [float(s) for s in light.split(',')]&lt;br /&gt;
    view = cmd.get_view()&lt;br /&gt;
 &lt;br /&gt;
    # Rotate the protein and the light in order to create the blur&lt;br /&gt;
    for frame in range(samples):&lt;br /&gt;
        # Angles to rotate protein and light&lt;br /&gt;
        # Populate angles as Fermat's spiral&lt;br /&gt;
        theta = frame * pi * 110.0/144.0&lt;br /&gt;
        radius = 0.5 * aperture * sqrt(frame/float(samples-1))&lt;br /&gt;
        x = cos(theta) * radius&lt;br /&gt;
        y = sin(theta) * radius&lt;br /&gt;
        xr = x/180.0*pi&lt;br /&gt;
        yr = y/180.0*pi&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the protein&lt;br /&gt;
        cmd.turn('x',x)&lt;br /&gt;
        cmd.turn('y',y)&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the light&lt;br /&gt;
        ly = light[1]*cos(xr)-light[2]*sin(xr)&lt;br /&gt;
        lz = light[2]*cos(xr)+light[1]*sin(xr)&lt;br /&gt;
        lx = light[0]*cos(yr)+lz*sin(yr)&lt;br /&gt;
        lz = lz*cos(yr)-lx*sin(yr)&lt;br /&gt;
        cmd.set('light',[lx,ly,lz])&lt;br /&gt;
 &lt;br /&gt;
        curFile = &amp;quot;%s/frame-%04d.png&amp;quot; % (tmpdir,frame)&lt;br /&gt;
        print &amp;quot;Created frame %i/%i (%0.0f%%)&amp;quot; % (frame+1,samples,100*(frame+1)/samples)&lt;br /&gt;
&lt;br /&gt;
        # Save the image to temporary directory&lt;br /&gt;
	if ray:&lt;br /&gt;
                cmd.ray()&lt;br /&gt;
                cmd.png(curFile)&lt;br /&gt;
	else:&lt;br /&gt;
        	cmd.png(curFile,quiet=1)&lt;br /&gt;
        &lt;br /&gt;
        # Create the average/blured image&lt;br /&gt;
        try:&lt;br /&gt;
            avg = Image.blend(avg,Image.open(curFile),1.0/(frame+1))&lt;br /&gt;
        except:&lt;br /&gt;
            avg = Image.open(curFile)&lt;br /&gt;
        &lt;br /&gt;
        # Return the protein and the light to the original orientation&lt;br /&gt;
        cmd.set('light',light)&lt;br /&gt;
        cmd.set_view(view)&lt;br /&gt;
 &lt;br /&gt;
    # Load the blured image&lt;br /&gt;
    avg.save('%s/avg.png' % (tmpdir))&lt;br /&gt;
    cmd.load('%s/avg.png' % (tmpdir))&lt;br /&gt;
 &lt;br /&gt;
    # Delete the temporary files&lt;br /&gt;
    rmtree(tmpdir)&lt;br /&gt;
&lt;br /&gt;
cmd.extend('FocalBlur', FocalBlur)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11988</id>
		<title>FocalBlur</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11988"/>
		<updated>2012-11-28T14:25:00Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: /* Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
&lt;br /&gt;
This script creates fancy figures by introducing a focal blur to the image. The object at the origin will be in focus. &lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
&lt;br /&gt;
Load the script using the [[run]] command. Execute the script using PyMOL syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur aperture=2.0,samples=100,ray=1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
or using python syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur(aperture=2.0,samples=100,ray=1)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For additional options, see the script comments.&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
&lt;br /&gt;
* When using raytracing, the image creation will take ''n'' times longer than normal, where ''n'' is the number of samples.&lt;br /&gt;
* [http://www.imagemagick.org/ ImageMagick] is required for the script to work.&lt;br /&gt;
* The aperture is a purely arbitrary value and not related to ''f'' stops on a camera.&lt;br /&gt;
* There is a bug preventing custom image sizes when not using raytracing.&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery perrow=3 widths=300 heights=240&amp;gt;&lt;br /&gt;
Image:FocalBlur_a1.0_r1.png|FocalBlur aperture=1,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a2.0_r1.png|FocalBlur aperture=2,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r1.png|FocalBlur aperture=4,samples=400,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r0.png|FocalBlur aperture=4,samples=400,ray=0&lt;br /&gt;
Image:Focal_blur _ex6.png&lt;br /&gt;
Image:Focal blur_ex_ap3.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode1.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode2.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode3.png&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Script==&lt;br /&gt;
Load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from tempfile import mkdtemp&lt;br /&gt;
from shutil import rmtree&lt;br /&gt;
from math import sin,cos,pi,sqrt&lt;br /&gt;
from PIL import Image&lt;br /&gt;
 &lt;br /&gt;
def FocalBlur(aperture=2.0,samples=10,ray=0,width=0,height=0):&lt;br /&gt;
    '''&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
 &lt;br /&gt;
    Creates fancy figures by introducing a focal blur to the image. The object&lt;br /&gt;
    at the origin will be in focus. &lt;br /&gt;
 &lt;br /&gt;
AUTHOR&lt;br /&gt;
 &lt;br /&gt;
    Jarl Underhaug&lt;br /&gt;
    University of Bergen&lt;br /&gt;
    jarl_dot_underhaug_at_gmail_dot_com&lt;br /&gt;
&lt;br /&gt;
    Updates by Jason Vertrees and Thomas Holder&lt;br /&gt;
 &lt;br /&gt;
USAGE&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=float, samples=int, ray=0/1, width=int, height=int&lt;br /&gt;
 &lt;br /&gt;
EXAMPELS&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=1, samples=100&lt;br /&gt;
    FocalBlur aperture=2, samples=100, ray=1, width=600, height=400&lt;br /&gt;
    '''&lt;br /&gt;
&lt;br /&gt;
    # Formalize the parameter types&lt;br /&gt;
    ray = (ray in (&amp;quot;True&amp;quot;, &amp;quot;true&amp;quot;, 1, &amp;quot;1&amp;quot;))&lt;br /&gt;
    aperture, samples = float(aperture), int(samples)&lt;br /&gt;
    width, height = int(width), int(height)&lt;br /&gt;
 &lt;br /&gt;
    # Create a temporary directory&lt;br /&gt;
    tmpdir = mkdtemp()&lt;br /&gt;
&lt;br /&gt;
    # Get the orientation of the protein and the light&lt;br /&gt;
    light = cmd.get('light')[1:-1]&lt;br /&gt;
    light = [float(s) for s in light.split(',')]&lt;br /&gt;
    view = cmd.get_view()&lt;br /&gt;
 &lt;br /&gt;
    # Rotate the protein and the light in order to create the blur&lt;br /&gt;
    for frame in range(samples):&lt;br /&gt;
        # Angles to rotate protein and light&lt;br /&gt;
        # Populate angles as Fermat's spiral&lt;br /&gt;
        theta = frame * pi * 110.0/144.0&lt;br /&gt;
        radius = 0.5 * aperture * sqrt(frame/float(samples-1))&lt;br /&gt;
        x = cos(theta) * radius&lt;br /&gt;
        y = sin(theta) * radius&lt;br /&gt;
        xr = x/180.0*pi&lt;br /&gt;
        yr = y/180.0*pi&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the protein&lt;br /&gt;
        cmd.turn('x',x)&lt;br /&gt;
        cmd.turn('y',y)&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the light&lt;br /&gt;
        ly = light[1]*cos(xr)-light[2]*sin(xr)&lt;br /&gt;
        lz = light[2]*cos(xr)+light[1]*sin(xr)&lt;br /&gt;
        lx = light[0]*cos(yr)+lz*sin(yr)&lt;br /&gt;
        lz = lz*cos(yr)-lx*sin(yr)&lt;br /&gt;
        cmd.set('light',[lx,ly,lz])&lt;br /&gt;
 &lt;br /&gt;
        curFile = &amp;quot;%s/frame-%04d.png&amp;quot; % (tmpdir,frame)&lt;br /&gt;
        print &amp;quot;Created frame %i/%i (%0.0f%%)&amp;quot; % (frame+1,samples,100*(frame+1)/samples)&lt;br /&gt;
&lt;br /&gt;
        # Save the image to temporary directory&lt;br /&gt;
	if ray:&lt;br /&gt;
                cmd.ray()&lt;br /&gt;
                cmd.png(curFile)&lt;br /&gt;
	else:&lt;br /&gt;
        	cmd.png(curFile,quiet=1)&lt;br /&gt;
        &lt;br /&gt;
        # Create the average/blured image&lt;br /&gt;
        try:&lt;br /&gt;
            avg = Image.blend(avg,Image.open(curFile),1.0/(frame+1))&lt;br /&gt;
        except:&lt;br /&gt;
            avg = Image.open(curFile)&lt;br /&gt;
        &lt;br /&gt;
        # Return the protein and the light to the original orientation&lt;br /&gt;
        cmd.set('light',light)&lt;br /&gt;
        cmd.set_view(view)&lt;br /&gt;
 &lt;br /&gt;
    # Load the blured image&lt;br /&gt;
    avg.save('%s/avg.png' % (tmpdir))&lt;br /&gt;
    cmd.load('%s/avg.png' % (tmpdir))&lt;br /&gt;
 &lt;br /&gt;
    # Delete the temporary files&lt;br /&gt;
    rmtree(tmpdir)&lt;br /&gt;
&lt;br /&gt;
cmd.extend('FocalBlur', FocalBlur)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11987</id>
		<title>FocalBlur</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11987"/>
		<updated>2011-07-18T08:56:07Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: /* Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
&lt;br /&gt;
This script creates fancy figures by introducing a focal blur to the image. The object at the origin will be in focus. &lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
&lt;br /&gt;
Load the script using the [[run]] command. Execute the script using PyMOL syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur aperture=2.0,samples=100,ray=1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
or using python syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur(aperture=2.0,samples=100,ray=1)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For additional options, see the script comments.&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
&lt;br /&gt;
* When using raytracing, the image creation will take ''n'' times longer than normal, where ''n'' is the number of samples.&lt;br /&gt;
* [http://www.imagemagick.org/ ImageMagick] is required for the script to work.&lt;br /&gt;
* The aperture is a purely arbitrary value and not related to ''f'' stops on a camera.&lt;br /&gt;
* There is a bug preventing custom image sizes when not using raytracing.&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery perrow=3 widths=300 heights=240&amp;gt;&lt;br /&gt;
Image:FocalBlur_a1.0_r1.png|FocalBlur aperture=1,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a2.0_r1.png|FocalBlur aperture=2,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r1.png|FocalBlur aperture=4,samples=400,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r0.png|FocalBlur aperture=4,samples=400,ray=0&lt;br /&gt;
Image:Focal_blur _ex6.png&lt;br /&gt;
Image:Focal blur_ex_ap3.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode1.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode2.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode3.png&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Script==&lt;br /&gt;
Load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from os import system&lt;br /&gt;
from tempfile import mkdtemp&lt;br /&gt;
from shutil import rmtree&lt;br /&gt;
from math import sin,cos,pi,sqrt&lt;br /&gt;
from sys import exit&lt;br /&gt;
import subprocess&lt;br /&gt;
 &lt;br /&gt;
def FocalBlur(aperture=2.0,samples=10,ray=0,width=0,height=0):&lt;br /&gt;
    '''&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
 &lt;br /&gt;
    Creates fancy figures by introducing a focal blur to the image. The object&lt;br /&gt;
    at the origin will be in focus. &lt;br /&gt;
 &lt;br /&gt;
AUTHOR&lt;br /&gt;
 &lt;br /&gt;
    Jarl Underhaug&lt;br /&gt;
    University of Bergen&lt;br /&gt;
    jarl_dot_underhaug_at_gmail_dot_com&lt;br /&gt;
&lt;br /&gt;
    Updates by Jason Vertrees and Thomas Holder&lt;br /&gt;
 &lt;br /&gt;
USAGE&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=float, samples=int, ray=0/1, width=int, height=int&lt;br /&gt;
 &lt;br /&gt;
EXAMPELS&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=1, samples=100&lt;br /&gt;
    FocalBlur aperture=2, samples=100, ray=1, width=600, height=400&lt;br /&gt;
    '''&lt;br /&gt;
    # Check if Imagemagick is installed&lt;br /&gt;
    try:&lt;br /&gt;
        subprocess.call(['convert','-version'])&lt;br /&gt;
    except OSError, e:&lt;br /&gt;
        if e[0]==2: print('Error - ImageMagick is probably not installed')&lt;br /&gt;
        sys.exit()&lt;br /&gt;
&lt;br /&gt;
    # Formalize the parameter types&lt;br /&gt;
    ray = (ray in (&amp;quot;True&amp;quot;, &amp;quot;true&amp;quot;, 1, &amp;quot;1&amp;quot;))&lt;br /&gt;
    aperture, samples = float(aperture), int(samples)&lt;br /&gt;
    width, height = int(width), int(height)&lt;br /&gt;
 &lt;br /&gt;
    # Because of a bug, only custom sizes when raytracing&lt;br /&gt;
    #if not ray:&lt;br /&gt;
    #    width=0&lt;br /&gt;
    #    height=0&lt;br /&gt;
 &lt;br /&gt;
    # Create a temporary directory&lt;br /&gt;
    tmpdir = mkdtemp()&lt;br /&gt;
 &lt;br /&gt;
    # Get the orientation of the protein and the light&lt;br /&gt;
    light = cmd.get('light')[1:-1]&lt;br /&gt;
    light = [float(s) for s in light.split(',')]&lt;br /&gt;
    view = cmd.get_view()&lt;br /&gt;
 &lt;br /&gt;
    # Rotate the protein and the light in order to create the blur&lt;br /&gt;
    for frame in range(samples):&lt;br /&gt;
        # Angles to rotate protein and light&lt;br /&gt;
        # Populate angles as Fermat's spiral&lt;br /&gt;
        theta = frame * pi * 110.0/144.0&lt;br /&gt;
        radius = 0.5 * aperture * sqrt(frame/float(samples-1))&lt;br /&gt;
        x = cos(theta) * radius&lt;br /&gt;
        y = sin(theta) * radius&lt;br /&gt;
        xr = x/180.0*pi&lt;br /&gt;
        yr = y/180.0*pi&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the protein&lt;br /&gt;
        cmd.turn('x',x)&lt;br /&gt;
        cmd.turn('y',y)&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the light&lt;br /&gt;
        ly = light[1]*cos(xr)-light[2]*sin(xr)&lt;br /&gt;
        lz = light[2]*cos(xr)+light[1]*sin(xr)&lt;br /&gt;
        lx = light[0]*cos(yr)+lz*sin(yr)&lt;br /&gt;
        lz = lz*cos(yr)-lx*sin(yr)&lt;br /&gt;
        cmd.set('light',[lx,ly,lz])&lt;br /&gt;
 &lt;br /&gt;
        curFile = &amp;quot;%s/frame-%04d.png&amp;quot; % (tmpdir,frame)&lt;br /&gt;
&lt;br /&gt;
        # Save the image&lt;br /&gt;
	if ray:&lt;br /&gt;
        	cmd.png(curFile,width=width,height=height,ray=ray,quiet=1)&lt;br /&gt;
	else:&lt;br /&gt;
        	cmd.png(curFile,quiet=1)&lt;br /&gt;
 &lt;br /&gt;
        # Return the protein and the light to the original orientation&lt;br /&gt;
        cmd.set('light',light)&lt;br /&gt;
        cmd.set_view(view)&lt;br /&gt;
 &lt;br /&gt;
    # Create a blured image of all the frames&lt;br /&gt;
    r = subprocess.call('convert %s/frame-*.png +matte -average %s/blur.png' % (tmpdir,tmpdir),shell=True)&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
    # Load the blured image&lt;br /&gt;
    print &amp;quot;load %s/blur.png&amp;quot; % tmpdir &lt;br /&gt;
    cmd.load('%s/blur.png' % tmpdir)&lt;br /&gt;
 &lt;br /&gt;
    # Delete the temporary files&lt;br /&gt;
    rmtree(tmpdir)&lt;br /&gt;
 &lt;br /&gt;
cmd.extend('FocalBlur', FocalBlur)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11986</id>
		<title>FocalBlur</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11986"/>
		<updated>2011-07-17T13:28:51Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: /* Notes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
&lt;br /&gt;
This script creates fancy figures by introducing a focal blur to the image. The object at the origin will be in focus. &lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
&lt;br /&gt;
Load the script using the [[run]] command. Execute the script using PyMOL syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur aperture=2.0,samples=100,ray=1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
or using python syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur(aperture=2.0,samples=100,ray=1)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For additional options, see the script comments.&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
&lt;br /&gt;
* When using raytracing, the image creation will take ''n'' times longer than normal, where ''n'' is the number of samples.&lt;br /&gt;
* [http://www.imagemagick.org/ ImageMagick] is required for the script to work.&lt;br /&gt;
* The aperture is a purely arbitrary value and not related to ''f'' stops on a camera.&lt;br /&gt;
* There is a bug preventing custom image sizes when not using raytracing.&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery perrow=3 widths=300 heights=240&amp;gt;&lt;br /&gt;
Image:FocalBlur_a1.0_r1.png|FocalBlur aperture=1,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a2.0_r1.png|FocalBlur aperture=2,samples=100,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r1.png|FocalBlur aperture=4,samples=400,ray=1&lt;br /&gt;
Image:FocalBlur_a4.0_r0.png|FocalBlur aperture=4,samples=400,ray=0&lt;br /&gt;
Image:Focal_blur _ex6.png&lt;br /&gt;
Image:Focal blur_ex_ap3.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode1.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode2.png&lt;br /&gt;
Image:Focal blur_ex_ap3_mode3.png&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Script==&lt;br /&gt;
Load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from os import system&lt;br /&gt;
from tempfile import mkdtemp&lt;br /&gt;
from shutil import rmtree&lt;br /&gt;
from math import sin,cos,pi,sqrt&lt;br /&gt;
import subprocess&lt;br /&gt;
 &lt;br /&gt;
def FocalBlur(aperture=2.0,samples=10,ray=0,width=0,height=0):&lt;br /&gt;
    '''&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
 &lt;br /&gt;
    Creates fancy figures by introducing a focal blur to the image. The object&lt;br /&gt;
    at the origin will be in focus. &lt;br /&gt;
 &lt;br /&gt;
AUTHOR&lt;br /&gt;
 &lt;br /&gt;
    Jarl Underhaug&lt;br /&gt;
    University of Bergen&lt;br /&gt;
    jarl_dot_underhaug_at_gmail_dot_com&lt;br /&gt;
&lt;br /&gt;
    Updates by Jason Vertrees and Thomas Holder&lt;br /&gt;
 &lt;br /&gt;
USAGE&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=float, samples=int, ray=0/1, width=int, height=int&lt;br /&gt;
 &lt;br /&gt;
EXAMPELS&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=1, samples=100&lt;br /&gt;
    FocalBlur aperture=2, samples=100, ray=1, width=600, height=400&lt;br /&gt;
    '''&lt;br /&gt;
    # Formalize the parameter types&lt;br /&gt;
    ray = (ray in (&amp;quot;True&amp;quot;, &amp;quot;true&amp;quot;, 1, &amp;quot;1&amp;quot;))&lt;br /&gt;
    aperture, samples = float(aperture), int(samples)&lt;br /&gt;
    width, height = int(width), int(height)&lt;br /&gt;
 &lt;br /&gt;
    # Because of a bug, only custom sizes when raytracing&lt;br /&gt;
    #if not ray:&lt;br /&gt;
    #    width=0&lt;br /&gt;
    #    height=0&lt;br /&gt;
 &lt;br /&gt;
    # Create a temporary directory&lt;br /&gt;
    tmpdir = mkdtemp()&lt;br /&gt;
 &lt;br /&gt;
    # Get the orientation of the protein and the light&lt;br /&gt;
    light = cmd.get('light')[1:-1]&lt;br /&gt;
    light = [float(s) for s in light.split(',')]&lt;br /&gt;
    view = cmd.get_view()&lt;br /&gt;
 &lt;br /&gt;
    # Rotate the protein and the light in order to create the blur&lt;br /&gt;
    for frame in range(samples):&lt;br /&gt;
        # Angles to rotate protein and light&lt;br /&gt;
        # Populate angles as Fermat's spiral&lt;br /&gt;
        theta = frame * pi * 110.0/144.0&lt;br /&gt;
        radius = 0.5 * aperture * sqrt(frame/float(samples-1))&lt;br /&gt;
        x = cos(theta) * radius&lt;br /&gt;
        y = sin(theta) * radius&lt;br /&gt;
        xr = x/180.0*pi&lt;br /&gt;
        yr = y/180.0*pi&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the protein&lt;br /&gt;
        cmd.turn('x',x)&lt;br /&gt;
        cmd.turn('y',y)&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the light&lt;br /&gt;
        ly = light[1]*cos(xr)-light[2]*sin(xr)&lt;br /&gt;
        lz = light[2]*cos(xr)+light[1]*sin(xr)&lt;br /&gt;
        lx = light[0]*cos(yr)+lz*sin(yr)&lt;br /&gt;
        lz = lz*cos(yr)-lx*sin(yr)&lt;br /&gt;
        cmd.set('light',[lx,ly,lz])&lt;br /&gt;
 &lt;br /&gt;
        curFile = &amp;quot;%s/frame-%04d.png&amp;quot; % (tmpdir,frame)&lt;br /&gt;
&lt;br /&gt;
        # Save the image&lt;br /&gt;
	if ray:&lt;br /&gt;
        	cmd.png(curFile,width=width,height=height,ray=ray,quiet=1)&lt;br /&gt;
	else:&lt;br /&gt;
        	cmd.png(curFile,quiet=1)&lt;br /&gt;
 &lt;br /&gt;
        # Return the protein and the light to the original orientation&lt;br /&gt;
        cmd.set('light',light)&lt;br /&gt;
        cmd.set_view(view)&lt;br /&gt;
 &lt;br /&gt;
    # Create a blured image of all the frames&lt;br /&gt;
    r = subprocess.call('convert %s/frame-*.png +matte -average %s/blur.png' % (tmpdir,tmpdir),shell=True)&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
    # Load the blured image&lt;br /&gt;
    print &amp;quot;load %s/blur.png&amp;quot; % tmpdir &lt;br /&gt;
    cmd.load('%s/blur.png' % tmpdir)&lt;br /&gt;
 &lt;br /&gt;
    # Delete the temporary files&lt;br /&gt;
    rmtree(tmpdir)&lt;br /&gt;
 &lt;br /&gt;
cmd.extend('FocalBlur', FocalBlur)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Covers&amp;diff=5325</id>
		<title>Covers</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Covers&amp;diff=5325"/>
		<updated>2011-06-20T08:53:38Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= PyMOL-created Journal Covers =&lt;br /&gt;
Part of PyMOL's popularity comes from the fact that it is very flexible and it offers arbitrarily high-resolution images as output; this make it a great tool for making journal covers or any press-related images.&lt;br /&gt;
&lt;br /&gt;
Here are some of the known PyMOL-created Journal Covers.  There are surely more out there.  If you have a cover you'd like to add, feel free.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery perrow=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
Image:JExpBiol-214-4.jpg|'''Deconstructing honeybee vitellogenin''' [http://dx.doi.org/10.1242/jeb.048314  J. Exp. Biol., Volume 214, Issue 4, 2011].&lt;br /&gt;
Image:FEBS-585-8.png|'''Binding of 14-3-3g to membranes''' [http://dx.doi.org/10.1016/j.febslet.2011.03.027 FEBS lett., Volume 585, Issue 8, 2011].&lt;br /&gt;
Image:MolecularCell011.jpg|'''FLT3 Activation by an Oncogenic Insertion''' Molecular Cell, Volume 13 Number 2, January 30, 2004.&lt;br /&gt;
Image:Cen.jpg|'''PI3K Inhibitors''' C&amp;amp;EN, April 11, 2011.&lt;br /&gt;
Image:Salam.jpg|'''Microbiology of article entitled &amp;quot;Genetic mapping of the interface between the ArsD metallochaperone and the ArsA ATPase.'''  Volume 79, Feb, 2011, [http://onlinelibrary.wiley.com/doi/10.1111/mmi.2011.79.issue-4/issuetoc ''Molecular Microbiology'']&lt;br /&gt;
Image:101209Nature.jpg|'''X-ray structure, symmetry and mechanism of an AMPA-subtype glutamate receptor''' [http://www.nature.com/nature/journal/v462/n7274/full/nature08624.html ''Nature'']&lt;br /&gt;
Image:biochem_010110_cover.jpg|'''Crystal Structure of the Class D beta-lactamase OXA-1 in complex with doripenem''' [http://www.ncbi.nlm.nih.gov/pubmed/19919101 ''Biochemistry'']&lt;br /&gt;
Image:MMcoverMay2009.png|'''Impact of rRNA methylations on ribosome recycling and fidelity of initiation in ''Escherichia coli''.''' [http://www.ncbi.nlm.nih.gov/pubmed/19400784 ''Molecular Microbiology'']&lt;br /&gt;
Image:jbc_mchu.jpeg|'''Crystal structure of the catalytic domain of the mitotic checkpoint kinase Mps1 in complex with SP600125'''. Chu ML, Chavas LM, Douglas KT, Eyers PA, Tabernero L. ''[http://www.ncbi.nlm.nih.gov/pubmed/18480048 J Biol Chem.'' 2008 Aug 1;283(31):21495-500]. Epub 2008 May 14.&lt;br /&gt;
Image:JBC_Apr18_2008.jpg|'''Allosteric motions in structures of yeast NAD-specific isocitrate dehydrogenase.''' [http://www.ncbi.nlm.nih.gov/pubmed/18256028?ordinalpos=1&amp;amp;itool=EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_RVDocSum ''J. Biol. Chem.'']&lt;br /&gt;
Image:ACR_Jun_2007.jpg|'''Shall we dance? How a multicopper oxidase chooses its electron transfer partner.''' [http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=pubmed&amp;amp;cmd=Retrieve&amp;amp;dopt=AbstractPlus&amp;amp;list_uids=17425282&amp;amp;query_hl=1&amp;amp;itool=pubmed_docsum ''Acc. Chem. Res.'']&lt;br /&gt;
Image:ABB_May1_2007.jpg|'''Crystal structure of the yeast nicotinamidase Pnc1p.''' [http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=pubmed&amp;amp;cmd=Retrieve&amp;amp;dopt=AbstractPlus&amp;amp;list_uids=17382284&amp;amp;query_hl=1&amp;amp;itool=pubmed_docsum ''Arch. Biochem. Biophys.'']&lt;br /&gt;
Image:Cover_royal_soc_small.png |[http://pymolwiki.org/index.php/File:Cover_royal_soc_small.png  Philosophical Transactions of The Royal Society, B : Biological Sciences Jan,  2009 ]&lt;br /&gt;
Image:Image_large.png |[http://pymolwiki.org/index.php/File:Image_large.png MD simulation of protein-protein binding  ]'''Pymol generated Movie is avialable inside pdf'''[[http://www.pymolwiki.org/index.php/File:SH3.pdf]] ''' or high quality AVI format'''[http://gepard.bioinformatik.uni-saarland.de/old_html/material/dl/SH3_large.avi]&lt;br /&gt;
Image:Cover_JCIM_2008_48-10.png|[http://pubs.acs.org/action/showLargeCover?issue=329743592 J. Chem. Inf. Model., 2008, 48 (10)]&lt;br /&gt;
Image:Science090410.jpg|[http://www.sciencemag.org/content/vol324/issue5924/index.dtl Protein Dynamics]&lt;br /&gt;
Image:080701_h.a.steinberg_biochemie.jpg|'''Targeting DNA''', [http://www.sciencedirect.com/science?_ob=PublicationURL&amp;amp;_tockey=%23TOC%236236%232008%23999099992%23693363%23FLA%23&amp;amp;_cdi=6236&amp;amp;_pubType=J&amp;amp;_auth=y&amp;amp;_acct=C000050221&amp;amp;_version=1&amp;amp;_urlVersion=0&amp;amp;_userid=10&amp;amp;md5=3e9cfd266720a7645cec65b2bfbd7645 BIOCHEMIE], July 1, 2008 Cover, Vol. 90.&lt;br /&gt;
Image:080602cnen.pdf.jpg|'''Harnessing Helices''', [http://pubs.acs.org/cen/coverstory/86/8622aboutcover.html Chemical &amp;amp; Engineering News], June 2, 2008 Cover, Vol. 86, Issue 22.&lt;br /&gt;
Image:080118_h.a.steinberg_JBC.jpg|''' Fusarium head blight (FHB)''', [http://www.jbc.org/content/vol283/issue3/cover.shtml JBC], January 18, 2008 Cover, Vol. 283, Issue 3.&lt;br /&gt;
Image:071213nature.pdf.jpg|'''Pumping Ions''', [http://www.nature.com/nature/journal/v450/n7172/index.html Nature], Dec. 13th, 2007.&lt;br /&gt;
Image:0712channels.jpg|[http://www.landesbioscience.com/journals/channels/toc/1/6], Dec 2007.&lt;br /&gt;
Image:071123science.pdf.jpg|[http://www.sciencemag.org/content/vol318/issue5854/index.dtl Science], Nov. 23rd, 2007.&lt;br /&gt;
Image:071120pnas.jpg|'''Sensing Calciums'''[http://www.pnas.org/content/104/47.toc], Nov 20th, 2007. &lt;br /&gt;
Image:071113Structure.png|'''Aminoacyl-tRNA synthetases from human mitochondria'''[http://www.cell.com/structure/issue?pii=S0969-2126(07)X0180-1], Nov. 13th, 2007.&lt;br /&gt;
Image:071009science.pdf.jpg|[http://www.sciencemag.org/content/vol318/issue5849/index.dtl Science], Oct. 19th, 2007.&lt;br /&gt;
Image:070920nature.pdf.jpg|'''Sensing Acid''', [http://www.nature.com/nature/journal/v449/n7160/index.html Nature], Sept. 20th, 2007.&lt;br /&gt;
Image:070816nature.pdf.jpg|'''Form Finds Function?''', [http://www.nature.com/nature/journal/v448/n7155/index.html Nature], Aug. 16thm 2007.&lt;br /&gt;
Image:Largecover.gif|[http://www.nature.com/neuro/journal/v10/n8/abs/nn1942.html Nature Neuroscience] Vol. 10 No. 8 Aug. 2007&lt;br /&gt;
Image:070803_h.a.steinberg_molec_cell.jpg|'''Paused transcription complexes''', [http://www.cell.com/molecular-cell/issue?pii=S1097-2765(07)X0175-8# Molecular Cell], August 3 2007 Cover, Vol. 27, Issue 3.&lt;br /&gt;
Image:070415.h.a.steinberg_ABB.jpg|'''Vitamin D''', [http://www.sciencedirect.com/science?_ob=PublicationURL&amp;amp;_cdi=6701&amp;amp;_pubType=J&amp;amp;_auth=y&amp;amp;_acct=C000050221&amp;amp;_version=1&amp;amp;_urlVersion=0&amp;amp;_userid=10&amp;amp;md5=b9733feacdee17300b6b31649737997b&amp;amp;jchunk=460#460 ABB], April 14 2007 Cover, Vol. 460, Issue 2.&lt;br /&gt;
Image:Jbc_20070413.gif|&amp;lt;b&amp;gt;''Mycobacterium tuberculosis'' PknD dimerization&amp;lt;/b&amp;gt; [http://www.jbc.org/content/282/15 JBC], April 13 2007 Cover, Vol. 282, Issue 15.&lt;br /&gt;
Image:070405nature.pdf.jpg|'''Auxin Action Revealed''', [http://www.nature.com/nature/journal/v446/n7136/index.html Nature], April 5, 2007.&lt;br /&gt;
Image:070301_h.a.steinberg_protein_science.jpg|'''Glucose-1-phosphate uridylyltransferase''', [http://www.proteinscience.org/content/vol16/issue3/cover.shtml Protein Science], March 3, 2007 Cover, Volume 16 Issue 3.&lt;br /&gt;
Image:070219cnen.pdf.jpg|'''How Ribosomes Work''', [http://pubs.acs.org/cen/coverstory/85/8508aboutcover.html Chemical &amp;amp; Engineering News], Feb. 19th, 2007.&lt;br /&gt;
Image:070215nature.pdf.jpg|'''HIV's Hidden Weakness''', [http://www.nature.com/nature/journal/v445/n7129/index.html Nature], Feb. 15th, 2007.&lt;br /&gt;
Image:061208_h.a.steinberg_molec_cell.jpg|'''Sen1 Control of RNA Pol II Termination''', [http://www.molecule.org/content/issue?volume=24&amp;amp;issue=5 Molecular Cell], December 8, 2006 Cover, Volume 24 Issue 5.&lt;br /&gt;
Image:061201_h.a.steinberg_molec_micro.jpg|'''Transposon Loops''', [http://www.blackwell-synergy.com/toc/mmi/62/6 Molecular Microbiology], December 1, 2006 Cover, Volume 62 Issue 6.&lt;br /&gt;
Image:060904cnen.pdf.jpg|'''Glycosylation Engineering''', [http://pubs.acs.org/subscribe/journals/cen/84/i36/toc/toc_i36.html Chemical &amp;amp; Engineering News], Sept. 4th, 2006.&lt;br /&gt;
Image:060817nature.pdf.jpg|'''Chromatin Code Decoded''', [http://www.nature.com/nature/journal/v442/n7104/index.html Nature], Aug. 17th, 2006.&lt;br /&gt;
Image:060522cnen.pdf.jpg|'''Halogenases''', [http://pubs.acs.org/subscribe/journals/cen/84/i21/toc/toc_i21.html Chemical &amp;amp; Engineering News], May 22nd, 2006.&lt;br /&gt;
Image:060101_h.a.steinberg_protein_science.jpg|'''Poly (2S-proline)''', [http://www.proteinscience.org/content/vol15/issue1/cover.shtml Protein Science], January 1, 2006 Cover, Volume 15, Issue 1.&lt;br /&gt;
Image:050624_h.a.steinberg_JMB.jpg|'''Ribonuclease A''', [http://www.sciencedirect.com/science?_ob=PublicationURL&amp;amp;_tockey=%23TOC%236899%232005%23996459998%23609160%23FLA%23&amp;amp;_cdi=6899&amp;amp;_pubType=J&amp;amp;view=c&amp;amp;_auth=y&amp;amp;_acct=C000050221&amp;amp;_version=1&amp;amp;_urlVersion=0&amp;amp;_userid=10&amp;amp;md5=9623405850d13617453adb034fb10a81 JMB], November 18, 2005 Cover, Volume 354, Issue 1.&lt;br /&gt;
Image:051020nature.pdf.jpg|'''The B to Z of DNA''', [http://www.nature.com/nature/journal/v437/n7062/index.html Nature], Oct. 20th, 2005.&lt;br /&gt;
&lt;br /&gt;
Image:050923_h.a.steinberg_JBC.jpg|'''GalNAc kinase''', [http://www.jbc.org/content/vol280/issue38/cover.shtml JBC], September 23, 2005 Cover, Volume 280, Issue 38.&lt;br /&gt;
Image:050908nature.pdf.jpg|'''Neurotransmission''', [http://www.nature.com/nature/journal/v437/n7056/index.html Nature], Sept. 8th, 2005.&lt;br /&gt;
Image:050722science.pdf.jpg|[http://www.sciencemag.org/content/vol309/issue5734/index.dtl Science], July 22nd, 2005.&lt;br /&gt;
Image:050624_h.a.steinberg_jmb1.jpg|[http://www.sciencedirect.com/science?_ob=PublicationURL&amp;amp;_tockey=%23TOC%236899%232005%23996509994%23597371%23FLA%23&amp;amp;_cdi=6899&amp;amp;_pubType=J&amp;amp;_auth=y&amp;amp;_acct=C000050221&amp;amp;_version=1&amp;amp;_urlVersion=0&amp;amp;_userid=10&amp;amp;md5=0bc37bcef231976694d0fbe8920ef596 JMB], June 24, 2005 Cover, Volume 349, Issue 5.&lt;br /&gt;
Image:050609nature.pdf.jpg|'''Probing Prions''', [http://www.nature.com/nature/journal/v435/n7043/index.html Nature], June 9th, 2005.&lt;br /&gt;
Image:050429science.pdf.jpg|[http://www.sciencemag.org/content/vol308/issue5722/index.dtl Science], April 29th, 2005.&lt;br /&gt;
Image:040910science.pdf.jpg|[http://www.sciencemag.org/content/vol305/issue5690/index.dtl Science], Sept., 10th, 2004.&lt;br /&gt;
Image:040123science.pdf.jpg|[http://www.sciencemag.org/content/vol303/issue5657/index.dtl Science], Jan. 23rd, 2004.&lt;br /&gt;
Image:apr2003_ProtSci.png|&amp;lt;b&amp;gt;''Pae'' SmAP1&amp;lt;/b&amp;gt; 14-mers, [http://www3.interscience.wiley.com/journal/121602086/issue ''Protein Science'', April 2003].&lt;br /&gt;
Image:Ribbon_hh1.png|[http://www.chembiol.com/content/issue?volume=15&amp;amp;issue=4 Chem. Biol.]&lt;br /&gt;
Image:0903_1_1.jpg|[http://pubs.acs.org/journals/achre4/covers/36/articleWindow.achre4.091603.html Accounts of Chemical Research]&lt;br /&gt;
Image:CRP_nature_cover1.jpg|''Nature'', April 27th, 2006.&lt;br /&gt;
Image:Iapp.gif|&amp;lt;b&amp;gt;Cross-Beta Spine of IAPP&amp;lt;/b&amp;gt;, [http://www3.interscience.wiley.com/journal/121603721/issue ''Protein Science'', September 2008].&lt;br /&gt;
Image:JBC 080406 no31 proof.png|&amp;lt;b&amp;gt;Calcium Sensor&amp;lt;/b&amp;gt;, [http://www.jbc.org/content/281/31 ''JBC'', August 4, 2006].&lt;br /&gt;
Image:AngewChemIntEd_Comm_Cover_R_Cighetti.jpg |[http://pymolwiki.org/index.php/File:AngewChemIntEd_Comm_Cover_R_Cighetti.jpg, &amp;lt;b&amp;gt;LPS coated nanoparticle&amp;lt;/b&amp;gt;, ''Angew.Chem.Int.Ed.'', January 17, 2011]&lt;br /&gt;
Image:Structure_cover_Dec2010.jpg|&amp;lt;b&amp;gt;DAXX helical bundle (DHB) and DHB/Rassf1C structures&amp;lt;/b&amp;gt;, [http://www.cell.com/structure/issue?pii=S0969-2126%2810%29X0013-2 ''Structure'', December 2010].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:JExpBiol-214-4.jpg&amp;diff=2115</id>
		<title>File:JExpBiol-214-4.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:JExpBiol-214-4.jpg&amp;diff=2115"/>
		<updated>2011-06-20T08:48:13Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: Cover of The Journal of Experimental Biology 214(4)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Cover of The Journal of Experimental Biology 214(4)&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Covers&amp;diff=5320</id>
		<title>Covers</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Covers&amp;diff=5320"/>
		<updated>2011-06-09T12:50:54Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= PyMOL-created Journal Covers =&lt;br /&gt;
Part of PyMOL's popularity comes from the fact that it is very flexible and it offers arbitrarily high-resolution images as output; this make it a great tool for making journal covers or any press-related images.&lt;br /&gt;
&lt;br /&gt;
Here are some of the known PyMOL-created Journal Covers.  There are surely more out there.  If you have a cover you'd like to add, feel free.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery perrow=&amp;quot;5&amp;quot;&amp;gt;&lt;br /&gt;
Image:FEBS-585-8.png|'''Binding of 14-3-3g to membranes''' [http://dx.doi.org/10.1016/j.febslet.2011.03.027 FEBS lett., Volume 585, Issue 8, 2011].&lt;br /&gt;
Image:MolecularCell011.jpg|'''FLT3 Activation by an Oncogenic Insertion''' Molecular Cell, Volume 13 Number 2, January 30, 2004.&lt;br /&gt;
Image:Cen.jpg|'''PI3K Inhibitors''' C&amp;amp;EN, April 11, 2011.&lt;br /&gt;
Image:Salam.jpg|'''Microbiology of article entitled &amp;quot;Genetic mapping of the interface between the ArsD metallochaperone and the ArsA ATPase.'''  Volume 79, Feb, 2011, [http://onlinelibrary.wiley.com/doi/10.1111/mmi.2011.79.issue-4/issuetoc ''Molecular Microbiology'']&lt;br /&gt;
Image:101209Nature.jpg|'''X-ray structure, symmetry and mechanism of an AMPA-subtype glutamate receptor''' [http://www.nature.com/nature/journal/v462/n7274/full/nature08624.html ''Nature'']&lt;br /&gt;
Image:biochem_010110_cover.jpg|'''Crystal Structure of the Class D beta-lactamase OXA-1 in complex with doripenem''' [http://www.ncbi.nlm.nih.gov/pubmed/19919101 ''Biochemistry'']&lt;br /&gt;
Image:MMcoverMay2009.png|'''Impact of rRNA methylations on ribosome recycling and fidelity of initiation in ''Escherichia coli''.''' [http://www.ncbi.nlm.nih.gov/pubmed/19400784 ''Molecular Microbiology'']&lt;br /&gt;
Image:jbc_mchu.jpeg|'''Crystal structure of the catalytic domain of the mitotic checkpoint kinase Mps1 in complex with SP600125'''. Chu ML, Chavas LM, Douglas KT, Eyers PA, Tabernero L. ''[http://www.ncbi.nlm.nih.gov/pubmed/18480048 J Biol Chem.'' 2008 Aug 1;283(31):21495-500]. Epub 2008 May 14.&lt;br /&gt;
Image:JBC_Apr18_2008.jpg|'''Allosteric motions in structures of yeast NAD-specific isocitrate dehydrogenase.''' [http://www.ncbi.nlm.nih.gov/pubmed/18256028?ordinalpos=1&amp;amp;itool=EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_RVDocSum ''J. Biol. Chem.'']&lt;br /&gt;
Image:ACR_Jun_2007.jpg|'''Shall we dance? How a multicopper oxidase chooses its electron transfer partner.''' [http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=pubmed&amp;amp;cmd=Retrieve&amp;amp;dopt=AbstractPlus&amp;amp;list_uids=17425282&amp;amp;query_hl=1&amp;amp;itool=pubmed_docsum ''Acc. Chem. Res.'']&lt;br /&gt;
Image:ABB_May1_2007.jpg|'''Crystal structure of the yeast nicotinamidase Pnc1p.''' [http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=pubmed&amp;amp;cmd=Retrieve&amp;amp;dopt=AbstractPlus&amp;amp;list_uids=17382284&amp;amp;query_hl=1&amp;amp;itool=pubmed_docsum ''Arch. Biochem. Biophys.'']&lt;br /&gt;
Image:Cover_royal_soc_small.png |[http://pymolwiki.org/index.php/File:Cover_royal_soc_small.png  Philosophical Transactions of The Royal Society, B : Biological Sciences Jan,  2009 ]&lt;br /&gt;
Image:Image_large.png |[http://pymolwiki.org/index.php/File:Image_large.png MD simulation of protein-protein binding  ]'''Pymol generated Movie is avialable inside pdf'''[[http://www.pymolwiki.org/index.php/File:SH3.pdf]] ''' or high quality AVI format'''[http://gepard.bioinformatik.uni-saarland.de/old_html/material/dl/SH3_large.avi]&lt;br /&gt;
Image:Cover_JCIM_2008_48-10.png|[http://pubs.acs.org/action/showLargeCover?issue=329743592 J. Chem. Inf. Model., 2008, 48 (10)]&lt;br /&gt;
Image:Science090410.jpg|[http://www.sciencemag.org/content/vol324/issue5924/index.dtl Protein Dynamics]&lt;br /&gt;
Image:080701_h.a.steinberg_biochemie.jpg|'''Targeting DNA''', [http://www.sciencedirect.com/science?_ob=PublicationURL&amp;amp;_tockey=%23TOC%236236%232008%23999099992%23693363%23FLA%23&amp;amp;_cdi=6236&amp;amp;_pubType=J&amp;amp;_auth=y&amp;amp;_acct=C000050221&amp;amp;_version=1&amp;amp;_urlVersion=0&amp;amp;_userid=10&amp;amp;md5=3e9cfd266720a7645cec65b2bfbd7645 BIOCHEMIE], July 1, 2008 Cover, Vol. 90.&lt;br /&gt;
Image:080602cnen.pdf.jpg|'''Harnessing Helices''', [http://pubs.acs.org/cen/coverstory/86/8622aboutcover.html Chemical &amp;amp; Engineering News], June 2, 2008 Cover, Vol. 86, Issue 22.&lt;br /&gt;
Image:080118_h.a.steinberg_JBC.jpg|''' Fusarium head blight (FHB)''', [http://www.jbc.org/content/vol283/issue3/cover.shtml JBC], January 18, 2008 Cover, Vol. 283, Issue 3.&lt;br /&gt;
Image:071213nature.pdf.jpg|'''Pumping Ions''', [http://www.nature.com/nature/journal/v450/n7172/index.html Nature], Dec. 13th, 2007.&lt;br /&gt;
Image:0712channels.jpg|[http://www.landesbioscience.com/journals/channels/toc/1/6], Dec 2007.&lt;br /&gt;
Image:071123science.pdf.jpg|[http://www.sciencemag.org/content/vol318/issue5854/index.dtl Science], Nov. 23rd, 2007.&lt;br /&gt;
Image:071120pnas.jpg|'''Sensing Calciums'''[http://www.pnas.org/content/104/47.toc], Nov 20th, 2007. &lt;br /&gt;
Image:071113Structure.png|'''Aminoacyl-tRNA synthetases from human mitochondria'''[http://www.cell.com/structure/issue?pii=S0969-2126(07)X0180-1], Nov. 13th, 2007.&lt;br /&gt;
Image:071009science.pdf.jpg|[http://www.sciencemag.org/content/vol318/issue5849/index.dtl Science], Oct. 19th, 2007.&lt;br /&gt;
Image:070920nature.pdf.jpg|'''Sensing Acid''', [http://www.nature.com/nature/journal/v449/n7160/index.html Nature], Sept. 20th, 2007.&lt;br /&gt;
Image:070816nature.pdf.jpg|'''Form Finds Function?''', [http://www.nature.com/nature/journal/v448/n7155/index.html Nature], Aug. 16thm 2007.&lt;br /&gt;
Image:Largecover.gif|[http://www.nature.com/neuro/journal/v10/n8/abs/nn1942.html Nature Neuroscience] Vol. 10 No. 8 Aug. 2007&lt;br /&gt;
Image:070803_h.a.steinberg_molec_cell.jpg|'''Paused transcription complexes''', [http://www.cell.com/molecular-cell/issue?pii=S1097-2765(07)X0175-8# Molecular Cell], August 3 2007 Cover, Vol. 27, Issue 3.&lt;br /&gt;
Image:070415.h.a.steinberg_ABB.jpg|'''Vitamin D''', [http://www.sciencedirect.com/science?_ob=PublicationURL&amp;amp;_cdi=6701&amp;amp;_pubType=J&amp;amp;_auth=y&amp;amp;_acct=C000050221&amp;amp;_version=1&amp;amp;_urlVersion=0&amp;amp;_userid=10&amp;amp;md5=b9733feacdee17300b6b31649737997b&amp;amp;jchunk=460#460 ABB], April 14 2007 Cover, Vol. 460, Issue 2.&lt;br /&gt;
Image:Jbc_20070413.gif|&amp;lt;b&amp;gt;''Mycobacterium tuberculosis'' PknD dimerization&amp;lt;/b&amp;gt; [http://www.jbc.org/content/282/15 JBC], April 13 2007 Cover, Vol. 282, Issue 15.&lt;br /&gt;
Image:070405nature.pdf.jpg|'''Auxin Action Revealed''', [http://www.nature.com/nature/journal/v446/n7136/index.html Nature], April 5, 2007.&lt;br /&gt;
Image:070301_h.a.steinberg_protein_science.jpg|'''Glucose-1-phosphate uridylyltransferase''', [http://www.proteinscience.org/content/vol16/issue3/cover.shtml Protein Science], March 3, 2007 Cover, Volume 16 Issue 3.&lt;br /&gt;
Image:070219cnen.pdf.jpg|'''How Ribosomes Work''', [http://pubs.acs.org/cen/coverstory/85/8508aboutcover.html Chemical &amp;amp; Engineering News], Feb. 19th, 2007.&lt;br /&gt;
Image:070215nature.pdf.jpg|'''HIV's Hidden Weakness''', [http://www.nature.com/nature/journal/v445/n7129/index.html Nature], Feb. 15th, 2007.&lt;br /&gt;
Image:061208_h.a.steinberg_molec_cell.jpg|'''Sen1 Control of RNA Pol II Termination''', [http://www.molecule.org/content/issue?volume=24&amp;amp;issue=5 Molecular Cell], December 8, 2006 Cover, Volume 24 Issue 5.&lt;br /&gt;
Image:061201_h.a.steinberg_molec_micro.jpg|'''Transposon Loops''', [http://www.blackwell-synergy.com/toc/mmi/62/6 Molecular Microbiology], December 1, 2006 Cover, Volume 62 Issue 6.&lt;br /&gt;
Image:060904cnen.pdf.jpg|'''Glycosylation Engineering''', [http://pubs.acs.org/subscribe/journals/cen/84/i36/toc/toc_i36.html Chemical &amp;amp; Engineering News], Sept. 4th, 2006.&lt;br /&gt;
Image:060817nature.pdf.jpg|'''Chromatin Code Decoded''', [http://www.nature.com/nature/journal/v442/n7104/index.html Nature], Aug. 17th, 2006.&lt;br /&gt;
Image:060522cnen.pdf.jpg|'''Halogenases''', [http://pubs.acs.org/subscribe/journals/cen/84/i21/toc/toc_i21.html Chemical &amp;amp; Engineering News], May 22nd, 2006.&lt;br /&gt;
Image:060101_h.a.steinberg_protein_science.jpg|'''Poly (2S-proline)''', [http://www.proteinscience.org/content/vol15/issue1/cover.shtml Protein Science], January 1, 2006 Cover, Volume 15, Issue 1.&lt;br /&gt;
Image:050624_h.a.steinberg_JMB.jpg|'''Ribonuclease A''', [http://www.sciencedirect.com/science?_ob=PublicationURL&amp;amp;_tockey=%23TOC%236899%232005%23996459998%23609160%23FLA%23&amp;amp;_cdi=6899&amp;amp;_pubType=J&amp;amp;view=c&amp;amp;_auth=y&amp;amp;_acct=C000050221&amp;amp;_version=1&amp;amp;_urlVersion=0&amp;amp;_userid=10&amp;amp;md5=9623405850d13617453adb034fb10a81 JMB], November 18, 2005 Cover, Volume 354, Issue 1.&lt;br /&gt;
Image:051020nature.pdf.jpg|'''The B to Z of DNA''', [http://www.nature.com/nature/journal/v437/n7062/index.html Nature], Oct. 20th, 2005.&lt;br /&gt;
&lt;br /&gt;
Image:050923_h.a.steinberg_JBC.jpg|'''GalNAc kinase''', [http://www.jbc.org/content/vol280/issue38/cover.shtml JBC], September 23, 2005 Cover, Volume 280, Issue 38.&lt;br /&gt;
Image:050908nature.pdf.jpg|'''Neurotransmission''', [http://www.nature.com/nature/journal/v437/n7056/index.html Nature], Sept. 8th, 2005.&lt;br /&gt;
Image:050722science.pdf.jpg|[http://www.sciencemag.org/content/vol309/issue5734/index.dtl Science], July 22nd, 2005.&lt;br /&gt;
Image:050624_h.a.steinberg_jmb1.jpg|[http://www.sciencedirect.com/science?_ob=PublicationURL&amp;amp;_tockey=%23TOC%236899%232005%23996509994%23597371%23FLA%23&amp;amp;_cdi=6899&amp;amp;_pubType=J&amp;amp;_auth=y&amp;amp;_acct=C000050221&amp;amp;_version=1&amp;amp;_urlVersion=0&amp;amp;_userid=10&amp;amp;md5=0bc37bcef231976694d0fbe8920ef596 JMB], June 24, 2005 Cover, Volume 349, Issue 5.&lt;br /&gt;
Image:050609nature.pdf.jpg|'''Probing Prions''', [http://www.nature.com/nature/journal/v435/n7043/index.html Nature], June 9th, 2005.&lt;br /&gt;
Image:050429science.pdf.jpg|[http://www.sciencemag.org/content/vol308/issue5722/index.dtl Science], April 29th, 2005.&lt;br /&gt;
Image:040910science.pdf.jpg|[http://www.sciencemag.org/content/vol305/issue5690/index.dtl Science], Sept., 10th, 2004.&lt;br /&gt;
Image:040123science.pdf.jpg|[http://www.sciencemag.org/content/vol303/issue5657/index.dtl Science], Jan. 23rd, 2004.&lt;br /&gt;
Image:apr2003_ProtSci.png|&amp;lt;b&amp;gt;''Pae'' SmAP1&amp;lt;/b&amp;gt; 14-mers, [http://www3.interscience.wiley.com/journal/121602086/issue ''Protein Science'', April 2003].&lt;br /&gt;
Image:Ribbon_hh1.png|[http://www.chembiol.com/content/issue?volume=15&amp;amp;issue=4 Chem. Biol.]&lt;br /&gt;
Image:0903_1_1.jpg|[http://pubs.acs.org/journals/achre4/covers/36/articleWindow.achre4.091603.html Accounts of Chemical Research]&lt;br /&gt;
Image:CRP_nature_cover1.jpg|''Nature'', April 27th, 2006.&lt;br /&gt;
Image:Iapp.gif|&amp;lt;b&amp;gt;Cross-Beta Spine of IAPP&amp;lt;/b&amp;gt;, [http://www3.interscience.wiley.com/journal/121603721/issue ''Protein Science'', September 2008].&lt;br /&gt;
Image:JBC 080406 no31 proof.png|&amp;lt;b&amp;gt;Calcium Sensor&amp;lt;/b&amp;gt;, [http://www.jbc.org/content/281/31 ''JBC'', August 4, 2006].&lt;br /&gt;
Image:AngewChemIntEd_Comm_Cover_R_Cighetti.jpg |[http://pymolwiki.org/index.php/File:AngewChemIntEd_Comm_Cover_R_Cighetti.jpg, &amp;lt;b&amp;gt;LPS coated nanoparticle&amp;lt;/b&amp;gt;, ''Angew.Chem.Int.Ed.'', January 17, 2011]&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:FEBS-585-8.png&amp;diff=2296</id>
		<title>File:FEBS-585-8.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:FEBS-585-8.png&amp;diff=2296"/>
		<updated>2011-06-09T12:50:24Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: FEBS Lett., Volume 585, Issue 8&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;FEBS Lett., Volume 585, Issue 8&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Talk:FocalBlur&amp;diff=200</id>
		<title>Talk:FocalBlur</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Talk:FocalBlur&amp;diff=200"/>
		<updated>2011-06-09T09:07:41Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Improvements==&lt;br /&gt;
&lt;br /&gt;
Currently a square aperture with random sampling is used by FocalBlur. This can give clusters of points resulting in poor quality, especially when few sampling points are used. This should be improved to be a circular aperture with an optimal spread of sampling points.--[[User:Jarl.Underhaug|Jarl.Underhaug]] 06:26, 8 June 2011 (CDT)&lt;br /&gt;
{|&lt;br /&gt;
|[[Image:FocalBlur_current_sampling.png|thumb|200px|left|Current aperture sampling]]&lt;br /&gt;
|[[Image:FocalBlur_optimal_sampling.png|thumb|200px|left|Optimal aperture sampling?]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:I suggest aperture sampling following a [http://en.wikipedia.org/wiki/Fermat%27s_spiral Fermat's spiral] --[[User:Speleo3|Speleo3]] 11:30, 8 June 2011 (CDT)&lt;br /&gt;
&lt;br /&gt;
::Perfect! --[[User:Jarl.Underhaug|Jarl.Underhaug]] 04:07, 9 June 2011 (CDT)&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11984</id>
		<title>FocalBlur</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11984"/>
		<updated>2011-06-09T09:04:14Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: /* Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
&lt;br /&gt;
This script creates fancy figures by introducing a focal blur to the image. The object at the origin will be in focus. &lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
&lt;br /&gt;
Load the script using the [[run]] command. Execute the script using PyMOL syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur aperture=2.0,samples=100,ray=1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
or using python syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur(aperture=2.0,samples=100,ray=1)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For additional options, see the script comments.&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
&lt;br /&gt;
* When using raytracing, the image creation will take ''n'' times longer than normal, where ''n'' is the number of samples.&lt;br /&gt;
* The script uses [http://www.imagemagick.org/ ImageMagick] for creating the blured image. It has only been tested on Linux&lt;br /&gt;
* The aperture is a purely arbitrary value and not related to ''f'' stops on a camera.&lt;br /&gt;
* There is a bug preventing custom image sizes when not using raytracing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[Image:FocalBlur_a1.0_r1.png|thumb|400px|left|FocalBlur aperture=1,samples=100,ray=1]]&lt;br /&gt;
|[[Image:FocalBlur_a2.0_r1.png|thumb|400px|left|FocalBlur aperture=2,samples=100,ray=1]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:FocalBlur_a4.0_r1.png|thumb|400px|left|FocalBlur aperture=4,samples=400,ray=1]]&lt;br /&gt;
|[[Image:FocalBlur_a4.0_r0.png|thumb|400px|left|FocalBlur aperture=4,samples=400,ray=0]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Script==&lt;br /&gt;
Load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from os import system&lt;br /&gt;
from tempfile import mkdtemp&lt;br /&gt;
from shutil import rmtree&lt;br /&gt;
from math import sin,cos,pi,sqrt&lt;br /&gt;
import subprocess&lt;br /&gt;
 &lt;br /&gt;
def FocalBlur(aperture=2.0,samples=10,ray=0,width=0,height=0):&lt;br /&gt;
    '''&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
 &lt;br /&gt;
    Creates fancy figures by introducing a focal blur to the image. The object&lt;br /&gt;
    at the origin will be in focus. &lt;br /&gt;
 &lt;br /&gt;
AUTHOR&lt;br /&gt;
 &lt;br /&gt;
    Jarl Underhaug&lt;br /&gt;
    University of Bergen&lt;br /&gt;
    jarl_dot_underhaug_at_gmail_dot_com&lt;br /&gt;
&lt;br /&gt;
    Updates by Jason Vertrees and Thomas Holder&lt;br /&gt;
 &lt;br /&gt;
USAGE&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=float, samples=int, ray=0/1, width=int, height=int&lt;br /&gt;
 &lt;br /&gt;
EXAMPELS&lt;br /&gt;
 &lt;br /&gt;
    FocalBlur aperture=1, samples=100&lt;br /&gt;
    FocalBlur aperture=2, samples=100, ray=1, width=600, height=400&lt;br /&gt;
    '''&lt;br /&gt;
    # Formalize the parameter types&lt;br /&gt;
    ray = (ray in (&amp;quot;True&amp;quot;, &amp;quot;true&amp;quot;, 1, &amp;quot;1&amp;quot;))&lt;br /&gt;
    aperture, samples = float(aperture), int(samples)&lt;br /&gt;
    width, height = int(width), int(height)&lt;br /&gt;
 &lt;br /&gt;
    # Because of a bug, only custom sizes when raytracing&lt;br /&gt;
    #if not ray:&lt;br /&gt;
    #    width=0&lt;br /&gt;
    #    height=0&lt;br /&gt;
 &lt;br /&gt;
    # Create a temporary directory&lt;br /&gt;
    tmpdir = mkdtemp()&lt;br /&gt;
 &lt;br /&gt;
    # Get the orientation of the protein and the light&lt;br /&gt;
    light = cmd.get('light')[1:-1]&lt;br /&gt;
    light = [float(s) for s in light.split(',')]&lt;br /&gt;
    view = cmd.get_view()&lt;br /&gt;
 &lt;br /&gt;
    # Rotate the protein and the light in order to create the blur&lt;br /&gt;
    for frame in range(samples):&lt;br /&gt;
        # Angles to rotate protein and light&lt;br /&gt;
        # Populate angles as Fermat's spiral&lt;br /&gt;
        theta = frame * pi * 110.0/144.0&lt;br /&gt;
        radius = 0.5 * aperture * sqrt(frame/float(samples-1))&lt;br /&gt;
        x = cos(theta) * radius&lt;br /&gt;
        y = sin(theta) * radius&lt;br /&gt;
        xr = x/180.0*pi&lt;br /&gt;
        yr = y/180.0*pi&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the protein&lt;br /&gt;
        cmd.turn('x',x)&lt;br /&gt;
        cmd.turn('y',y)&lt;br /&gt;
 &lt;br /&gt;
        # Rotate the light&lt;br /&gt;
        ly = light[1]*cos(xr)-light[2]*sin(xr)&lt;br /&gt;
        lz = light[2]*cos(xr)+light[1]*sin(xr)&lt;br /&gt;
        lx = light[0]*cos(yr)+lz*sin(yr)&lt;br /&gt;
        lz = lz*cos(yr)-lx*sin(yr)&lt;br /&gt;
        cmd.set('light',[lx,ly,lz])&lt;br /&gt;
 &lt;br /&gt;
        curFile = &amp;quot;%s/frame-%04d.png&amp;quot; % (tmpdir,frame)&lt;br /&gt;
&lt;br /&gt;
        # Save the image&lt;br /&gt;
	if ray:&lt;br /&gt;
        	cmd.png(curFile,width=width,height=height,ray=ray,quiet=1)&lt;br /&gt;
	else:&lt;br /&gt;
        	cmd.png(curFile,quiet=1)&lt;br /&gt;
 &lt;br /&gt;
        # Return the protein and the light to the original orientation&lt;br /&gt;
        cmd.set('light',light)&lt;br /&gt;
        cmd.set_view(view)&lt;br /&gt;
 &lt;br /&gt;
    # Create a blured image of all the frames&lt;br /&gt;
    r = subprocess.call('convert %s/frame-*.png +matte -average %s/blur.png' % (tmpdir,tmpdir),shell=True)&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
    # Load the blured image&lt;br /&gt;
    print &amp;quot;load %s/blur.png&amp;quot; % tmpdir &lt;br /&gt;
    cmd.load('%s/blur.png' % tmpdir)&lt;br /&gt;
 &lt;br /&gt;
    # Delete the temporary files&lt;br /&gt;
    rmtree(tmpdir)&lt;br /&gt;
 &lt;br /&gt;
cmd.extend('FocalBlur', FocalBlur)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Talk:FocalBlur&amp;diff=198</id>
		<title>Talk:FocalBlur</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Talk:FocalBlur&amp;diff=198"/>
		<updated>2011-06-08T11:26:44Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: Created page with &amp;quot;==Improvements==  Currently a square aperture with random sampling is used by FocalBlur. This can give clusters of points resulting in poor quality, especially when few sampling ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Improvements==&lt;br /&gt;
&lt;br /&gt;
Currently a square aperture with random sampling is used by FocalBlur. This can give clusters of points resulting in poor quality, especially when few sampling points are used. This should be improved to be a circular aperture with an optimal spread of sampling points.--[[User:Jarl.Underhaug|Jarl.Underhaug]] 06:26, 8 June 2011 (CDT)&lt;br /&gt;
{|&lt;br /&gt;
|[[Image:FocalBlur_current_sampling.png|thumb|200px|left|Current aperture sampling]]&lt;br /&gt;
|[[Image:FocalBlur_optimal_sampling.png|thumb|200px|left|Optimal aperture sampling?]]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:FocalBlur_optimal_sampling.png&amp;diff=1808</id>
		<title>File:FocalBlur optimal sampling.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:FocalBlur_optimal_sampling.png&amp;diff=1808"/>
		<updated>2011-06-08T11:24:58Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: Optimal sampling?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Optimal sampling?&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:FocalBlur_current_sampling.png&amp;diff=2306</id>
		<title>File:FocalBlur current sampling.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:FocalBlur_current_sampling.png&amp;diff=2306"/>
		<updated>2011-06-08T11:24:26Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: Current aperture sampling used by FocalBlur&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Current aperture sampling used by FocalBlur&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11982</id>
		<title>FocalBlur</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11982"/>
		<updated>2011-06-08T09:24:13Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
&lt;br /&gt;
This script creates fancy figures by introducing a focal blur to the image. The object at the origin will be in focus. &lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
&lt;br /&gt;
Load the script using the [[run]] command. Execute the script using PyMOL syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur aperture=2.0,samples=100,ray=1&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
or using python syntax:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur(aperture=2.0,samples=100,ray=1)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For additional options, see the script comments.&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
&lt;br /&gt;
* When using raytracing, the image creation will take ''n'' times longer than normal, where ''n'' is the number of samples.&lt;br /&gt;
* The script uses [http://www.imagemagick.org/ ImageMagick] for creating the blured image. It has only been tested on Linux&lt;br /&gt;
* The aperture is a purely arbitrary value and not related to ''f'' stops on a camera.&lt;br /&gt;
* There is a bug preventing custom image sizes when not using raytracing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[Image:FocalBlur_a1.0_r1.png|thumb|400px|left|FocalBlur aperture=1,samples=100,ray=1]]&lt;br /&gt;
|[[Image:FocalBlur_a2.0_r1.png|thumb|400px|left|FocalBlur aperture=2,samples=100,ray=1]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:FocalBlur_a4.0_r1.png|thumb|400px|left|FocalBlur aperture=4,samples=400,ray=1]]&lt;br /&gt;
|[[Image:FocalBlur_a4.0_r0.png|thumb|400px|left|FocalBlur aperture=4,samples=400,ray=0]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Script==&lt;br /&gt;
Load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import random&lt;br /&gt;
&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from os import system&lt;br /&gt;
from tempfile import mkdtemp&lt;br /&gt;
from shutil import rmtree&lt;br /&gt;
from math import sin,cos,pi&lt;br /&gt;
&lt;br /&gt;
def FocalBlur(aperture=2.0,samples=10,ray=0,width=0,height=0):&lt;br /&gt;
    '''&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
&lt;br /&gt;
    Creates fancy figures by introducing a focal blur to the image. The object&lt;br /&gt;
    at the origin will be in focus. &lt;br /&gt;
&lt;br /&gt;
AUTHOR&lt;br /&gt;
&lt;br /&gt;
    Jarl Underhaug&lt;br /&gt;
    University of Bergen&lt;br /&gt;
    jarl_dot_underhaug_at_gmail_dot_com&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
&lt;br /&gt;
    FocalBlur aperture=float, samples=int, ray=0/1, width=int, height=int&lt;br /&gt;
       &lt;br /&gt;
EXAMPELS&lt;br /&gt;
&lt;br /&gt;
    FocalBlur aperture=1, samples=100&lt;br /&gt;
    FocalBlur aperture=2, samples=100, ray=1, width=600, height=400&lt;br /&gt;
    '''&lt;br /&gt;
    aperture, samples = float(aperture), int(samples)&lt;br /&gt;
    ray, width, height = int(ray), int(width), int(height)&lt;br /&gt;
&lt;br /&gt;
    # Because of a bug, only custom sizes when raytracing&lt;br /&gt;
    if not ray:&lt;br /&gt;
        width=0&lt;br /&gt;
        height=0&lt;br /&gt;
&lt;br /&gt;
    # Create a temporary directory&lt;br /&gt;
    tmpdir = mkdtemp()&lt;br /&gt;
&lt;br /&gt;
    # Get the orientation of the protein and the light&lt;br /&gt;
    light = cmd.get('light')[1:-1]&lt;br /&gt;
    light = [float(s) for s in light.split(',')]&lt;br /&gt;
    view = cmd.get_view()&lt;br /&gt;
&lt;br /&gt;
    # Rotate the protein and the light in order to create the blur&lt;br /&gt;
    for frame in range(samples):&lt;br /&gt;
        # Angles to rotate protein and light&lt;br /&gt;
        x  = (random.random()-0.5)*aperture&lt;br /&gt;
        y  = (random.random()-0.5)*aperture&lt;br /&gt;
        xr = x/180.0*pi&lt;br /&gt;
        yr = y/180.0*pi&lt;br /&gt;
&lt;br /&gt;
        # Rotate the protein&lt;br /&gt;
        cmd.turn('x',x)&lt;br /&gt;
        cmd.turn('y',y)&lt;br /&gt;
&lt;br /&gt;
        # Rotate the light&lt;br /&gt;
        ly = light[1]*cos(xr)-light[2]*sin(xr)&lt;br /&gt;
        lz = light[2]*cos(xr)+light[1]*sin(xr)&lt;br /&gt;
        lx = light[0]*cos(yr)+lz*sin(yr)&lt;br /&gt;
        lz = lz*cos(yr)-lx*sin(yr)&lt;br /&gt;
        cmd.set('light',[lx,ly,lz])&lt;br /&gt;
&lt;br /&gt;
        # Save the image&lt;br /&gt;
        cmd.png(tmpdir+'/frame-%04d.png' % (frame),width=width,height=height,ray=ray)&lt;br /&gt;
        &lt;br /&gt;
        # Return the protein and the light to the original orientation&lt;br /&gt;
        cmd.set('light',light)&lt;br /&gt;
        cmd.set_view(view)&lt;br /&gt;
&lt;br /&gt;
    # Create a blured image of all the frames&lt;br /&gt;
    system('convert %s/frame-*.png +matte -average %s/blur.png' % (tmpdir,tmpdir))&lt;br /&gt;
&lt;br /&gt;
    # Load the blured image &lt;br /&gt;
    cmd.load('%s/blur.png' % (tmpdir))&lt;br /&gt;
&lt;br /&gt;
    # Delete the temporary files&lt;br /&gt;
    rmtree(tmpdir)&lt;br /&gt;
&lt;br /&gt;
cmd.extend('FocalBlur', FocalBlur)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11981</id>
		<title>FocalBlur</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11981"/>
		<updated>2011-06-07T08:27:03Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
&lt;br /&gt;
This script creates fancy figures by introducing a focal blur to the image. The object at the origin will be in focus. &lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
&lt;br /&gt;
Load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur(aperture=2.0,samples=100,raytrace=True)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For additional options, see the script comments.&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
&lt;br /&gt;
* When using raytracing, the image creation will take ''n'' times longer than normal, where ''n'' is the number of samples.&lt;br /&gt;
* The script uses [http://www.imagemagick.org/ ImageMagick] for creating the blured image. It has only been tested on Linux&lt;br /&gt;
* The aperture is a purely arbitrary value and not related to ''f'' stops on a camera.&lt;br /&gt;
* There is a bug preventing custom image sizes when not using raytracing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[Image:FocalBlur_a1.0_r1.png|thumb|400px|left|FocalBlur(aperture=1,samples=100,raytrace=True)]]&lt;br /&gt;
|[[Image:FocalBlur_a2.0_r1.png|thumb|400px|left|FocalBlur(aperture=2,samples=100,raytrace=True)]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:FocalBlur_a4.0_r1.png|thumb|400px|left|FocalBlur(aperture=4,samples=400,raytrace=True)]]&lt;br /&gt;
|[[Image:FocalBlur_a4.0_r0.png|thumb|400px|left|FocalBlur(aperture=4,samples=400,raytrace=False)]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Script==&lt;br /&gt;
Load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import random&lt;br /&gt;
&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from os import system&lt;br /&gt;
from tempfile import mkdtemp&lt;br /&gt;
from shutil import rmtree&lt;br /&gt;
from math import sin,cos,pi&lt;br /&gt;
&lt;br /&gt;
print 'Usage: FocalBlur(aperture=float,samples=int,raytrace=True/False,width=int,height=int)'&lt;br /&gt;
&lt;br /&gt;
def FocalBlur(aperture=2.0,samples=10,raytrace=False,width=0,height=0):&lt;br /&gt;
    '''&lt;br /&gt;
&lt;br /&gt;
    AUTHOR&lt;br /&gt;
&lt;br /&gt;
       Jarl Underhaug&lt;br /&gt;
       University of Bergen&lt;br /&gt;
       jarl_dot_underhaug_at_gmail_dot_com&lt;br /&gt;
&lt;br /&gt;
    USAGE&lt;br /&gt;
&lt;br /&gt;
       FocalBlur(aperture=float,samples=int,raytrace=True/False,width=int,height=int)&lt;br /&gt;
       &lt;br /&gt;
    EXAMPELS&lt;br /&gt;
&lt;br /&gt;
       FocalBlur(aperture=1,samples=100,raytrace=False)&lt;br /&gt;
       FocalBlur(aperture=2,samples=100,raytrace=True,width=600,height=400)&lt;br /&gt;
       &lt;br /&gt;
&lt;br /&gt;
    '''&lt;br /&gt;
&lt;br /&gt;
    # Because of a bug, only custom sizes when raytracing&lt;br /&gt;
    if not raytrace:&lt;br /&gt;
        width=0&lt;br /&gt;
        height=0&lt;br /&gt;
&lt;br /&gt;
    # Create a temporary directory&lt;br /&gt;
    tmpdir = mkdtemp()&lt;br /&gt;
&lt;br /&gt;
    # Get the orientation of the protein and the light&lt;br /&gt;
    light = cmd.get('light')[1:-1]&lt;br /&gt;
    light = [float(s) for s in light.split(',')]&lt;br /&gt;
    view = cmd.get_view()&lt;br /&gt;
&lt;br /&gt;
    # Rotate the protein and the light in order to create the blur&lt;br /&gt;
    for frame in range(samples):&lt;br /&gt;
        # Angles to rotate protein and light&lt;br /&gt;
        x  = (random.random()-0.5)*aperture&lt;br /&gt;
        y  = (random.random()-0.5)*aperture&lt;br /&gt;
        xr = x/180.0*pi&lt;br /&gt;
        yr = y/180.0*pi&lt;br /&gt;
&lt;br /&gt;
        # Rotate the protein&lt;br /&gt;
        cmd.turn('x',x)&lt;br /&gt;
        cmd.turn('y',y)&lt;br /&gt;
&lt;br /&gt;
        # Rotate the light&lt;br /&gt;
        ly = light[1]*cos(xr)-light[2]*sin(xr)&lt;br /&gt;
        lz = light[2]*cos(xr)+light[1]*sin(xr)&lt;br /&gt;
        lx = light[0]*cos(yr)+lz*sin(yr)&lt;br /&gt;
        lz = lz*cos(yr)-lx*sin(yr)&lt;br /&gt;
        cmd.set('light',[lx,ly,lz])&lt;br /&gt;
&lt;br /&gt;
        # Save the image&lt;br /&gt;
        cmd.png(tmpdir+'/frame-%04d.png' % (frame),width=width,height=height,ray=raytrace)&lt;br /&gt;
        &lt;br /&gt;
        # Return the protein and the light to the original orientation&lt;br /&gt;
        cmd.set('light',light)&lt;br /&gt;
        cmd.set_view(view)&lt;br /&gt;
&lt;br /&gt;
    # Create a blured image of all the frames&lt;br /&gt;
    system('convert %s/frame-*.png +matte -average %s/blur.png' % (tmpdir,tmpdir))&lt;br /&gt;
&lt;br /&gt;
    # Load the blured image &lt;br /&gt;
    cmd.load('%s/blur.png' % (tmpdir))&lt;br /&gt;
&lt;br /&gt;
    # Delete the temporary files&lt;br /&gt;
    rmtree(tmpdir)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11980</id>
		<title>FocalBlur</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11980"/>
		<updated>2011-06-07T08:22:29Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
&lt;br /&gt;
This script creates fancy figures by introducing a focal blur to the image. The object at the origin will be in focus. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
&lt;br /&gt;
load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur(aperture=2.0,samples=100,raytrace=True)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For additional options, see the script comments.&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
&lt;br /&gt;
* When using raytracing, the image creation will take ''n'' times longer than normal, where ''n'' is the number of samples.&lt;br /&gt;
* The script uses [http://www.imagemagick.org/ ImageMagick] for creating the blured image. It has only been tested on Linux&lt;br /&gt;
* The aperture is a purely arbitrary value and not related to ''f'' stops on a camera.&lt;br /&gt;
* There is a bug preventing custom size images when not using raytracing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[Image:FocalBlur_a1.0_r1.png|thumb|400px|left|FocalBlur(aperture=1,samples=100,raytrace=True)]]&lt;br /&gt;
|[[Image:FocalBlur_a2.0_r1.png|thumb|400px|left|FocalBlur(aperture=2,samples=100,raytrace=True)]]&lt;br /&gt;
|-&lt;br /&gt;
|[[Image:FocalBlur_a4.0_r1.png|thumb|400px|left|FocalBlur(aperture=4,samples=400,raytrace=True)]]&lt;br /&gt;
|[[Image:FocalBlur_a4.0_r0.png|thumb|400px|left|FocalBlur(aperture=4,samples=400,raytrace=False)]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Script==&lt;br /&gt;
load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import random&lt;br /&gt;
&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from os import system&lt;br /&gt;
from tempfile import mkdtemp&lt;br /&gt;
from shutil import rmtree&lt;br /&gt;
from math import sin,cos,pi&lt;br /&gt;
&lt;br /&gt;
print 'Usage: FocalBlur(aperture=float,samples=int,raytrace=True/False,width=int,height=int)'&lt;br /&gt;
&lt;br /&gt;
def FocalBlur(aperture=2.0,samples=10,raytrace=False,width=0,height=0):&lt;br /&gt;
    '''&lt;br /&gt;
&lt;br /&gt;
    AUTHOR&lt;br /&gt;
&lt;br /&gt;
       Jarl Underhaug&lt;br /&gt;
       University of Bergen&lt;br /&gt;
       jarl_dot_underhaug_at_gmail_dot_com&lt;br /&gt;
&lt;br /&gt;
    USAGE&lt;br /&gt;
&lt;br /&gt;
       FocalBlur(aperture=float,samples=int,raytrace=True/False,width=int,height=int)&lt;br /&gt;
       &lt;br /&gt;
    EXAMPELS&lt;br /&gt;
&lt;br /&gt;
       FocalBlur(aperture=1,samples=100,raytrace=False)&lt;br /&gt;
       FocalBlur(aperture=2,samples=100,raytrace=True,width=600,height=400)&lt;br /&gt;
       &lt;br /&gt;
&lt;br /&gt;
    '''&lt;br /&gt;
&lt;br /&gt;
    # Because of a bug, only custom sizes when raytracing&lt;br /&gt;
    if not raytrace:&lt;br /&gt;
        width=0&lt;br /&gt;
        height=0&lt;br /&gt;
&lt;br /&gt;
    # Create a temporary directory&lt;br /&gt;
    tmpdir = mkdtemp()&lt;br /&gt;
&lt;br /&gt;
    # Get the orientation of the protein and the light&lt;br /&gt;
    light = cmd.get('light')[1:-1]&lt;br /&gt;
    light = [float(s) for s in light.split(',')]&lt;br /&gt;
    view = cmd.get_view()&lt;br /&gt;
&lt;br /&gt;
    # Rotate the protein and the light in order to create the blur&lt;br /&gt;
    for frame in range(samples):&lt;br /&gt;
        # Angles to rotate protein and light&lt;br /&gt;
        x  = (random.random()-0.5)*aperture&lt;br /&gt;
        y  = (random.random()-0.5)*aperture&lt;br /&gt;
        xr = x/180.0*pi&lt;br /&gt;
        yr = y/180.0*pi&lt;br /&gt;
&lt;br /&gt;
        # Rotate the protein&lt;br /&gt;
        cmd.turn('x',x)&lt;br /&gt;
        cmd.turn('y',y)&lt;br /&gt;
&lt;br /&gt;
        # Rotate the light&lt;br /&gt;
        ly = light[1]*cos(xr)-light[2]*sin(xr)&lt;br /&gt;
        lz = light[2]*cos(xr)+light[1]*sin(xr)&lt;br /&gt;
        lx = light[0]*cos(yr)+lz*sin(yr)&lt;br /&gt;
        lz = lz*cos(yr)-lx*sin(yr)&lt;br /&gt;
        cmd.set('light',[lx,ly,lz])&lt;br /&gt;
&lt;br /&gt;
        # Save the image&lt;br /&gt;
        cmd.png(tmpdir+'/frame-%04d.png' % (frame),width=width,height=height,ray=raytrace)&lt;br /&gt;
        &lt;br /&gt;
        # Return the protein and the light to the original orientation&lt;br /&gt;
        cmd.set('light',light)&lt;br /&gt;
        cmd.set_view(view)&lt;br /&gt;
&lt;br /&gt;
    # Create a blured image of all the frames&lt;br /&gt;
    system('convert %s/frame-*.png +matte -average %s/blur.png' % (tmpdir,tmpdir))&lt;br /&gt;
&lt;br /&gt;
    # Load the blured image &lt;br /&gt;
    cmd.load('%s/blur.png' % (tmpdir))&lt;br /&gt;
&lt;br /&gt;
    # Delete the temporary files&lt;br /&gt;
    rmtree(tmpdir)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:FocalBlur_a4.0_r0.png&amp;diff=1806</id>
		<title>File:FocalBlur a4.0 r0.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:FocalBlur_a4.0_r0.png&amp;diff=1806"/>
		<updated>2011-06-07T08:21:22Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: FocalBlur(aperture=4,samples=400,raytrace=False)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;FocalBlur(aperture=4,samples=400,raytrace=False)&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:FocalBlur_a4.0_r1.png&amp;diff=2057</id>
		<title>File:FocalBlur a4.0 r1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:FocalBlur_a4.0_r1.png&amp;diff=2057"/>
		<updated>2011-06-07T08:20:21Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: FocalBlur(aperture=4,samples=400,raytrace=True)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;FocalBlur(aperture=4,samples=400,raytrace=True)&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:FocalBlur_a2.0_r1.png&amp;diff=2304</id>
		<title>File:FocalBlur a2.0 r1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:FocalBlur_a2.0_r1.png&amp;diff=2304"/>
		<updated>2011-06-07T08:19:49Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: FocalBlur(aperture=2,samples=100,raytrace=True)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;FocalBlur(aperture=2,samples=100,raytrace=True)&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=File:FocalBlur_a1.0_r1.png&amp;diff=2055</id>
		<title>File:FocalBlur a1.0 r1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=File:FocalBlur_a1.0_r1.png&amp;diff=2055"/>
		<updated>2011-06-07T08:19:16Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: FocalBlur(aperture=1,samples=100,raytrace=True)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;FocalBlur(aperture=1,samples=100,raytrace=True)&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11979</id>
		<title>FocalBlur</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=FocalBlur&amp;diff=11979"/>
		<updated>2011-06-07T08:17:30Z</updated>

		<summary type="html">&lt;p&gt;Jarl.Underhaug: Created page with &amp;quot;==Description==  This script creates fancy figures by introducing a focal blur to the image. The object at the origin will be in focus.    ===Usage===  load the script using the ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Description==&lt;br /&gt;
&lt;br /&gt;
This script creates fancy figures by introducing a focal blur to the image. The object at the origin will be in focus. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Usage===&lt;br /&gt;
&lt;br /&gt;
load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
FocalBlur(aperture=2.0,samples=100,raytrace=True)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For additional options, see the script comments.&lt;br /&gt;
&lt;br /&gt;
===Notes===&lt;br /&gt;
&lt;br /&gt;
* When using raytracing, the image creation will take ''n'' times longer than normal, where ''n'' is the number of samples.&lt;br /&gt;
* The script uses [http://www.imagemagick.org/ ImageMagick] for creating the blured image. It has only been tested on Linux&lt;br /&gt;
* The aperture is a purely arbitrary value and not related to ''f'' stops on a camera.&lt;br /&gt;
* There is a bug preventing custom size images when not using raytracing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[Image:FocalBlur_a1.0_r1.png|thumb|300px|left|FocalBlur(aperture=1,samples=100,raytrace=True)]]&lt;br /&gt;
|[[Image:FocalBlur_a2.0_r1.png|thumb|300px|left|FocalBlur(aperture=2,samples=100,raytrace=True)]]&lt;br /&gt;
|[[Image:FocalBlur_a4.0_r1.png|thumb|300px|left|FocalBlur(aperture=4,samples=400,raytrace=True)]]&lt;br /&gt;
|[[Image:FocalBlur_a4.0_r0.png|thumb|300px|left|FocalBlur(aperture=4,samples=100,raytrace=False)]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Script==&lt;br /&gt;
load the script using the [[run]] command&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import random&lt;br /&gt;
&lt;br /&gt;
from pymol import cmd&lt;br /&gt;
from os import system&lt;br /&gt;
from tempfile import mkdtemp&lt;br /&gt;
from shutil import rmtree&lt;br /&gt;
from math import sin,cos,pi&lt;br /&gt;
&lt;br /&gt;
print 'Usage: FocalBlur(aperture=float,samples=int,raytrace=True/False,width=int,height=int)'&lt;br /&gt;
&lt;br /&gt;
def FocalBlur(aperture=2.0,samples=10,raytrace=False,width=0,height=0):&lt;br /&gt;
    '''&lt;br /&gt;
&lt;br /&gt;
    AUTHOR&lt;br /&gt;
&lt;br /&gt;
       Jarl Underhaug&lt;br /&gt;
       University of Bergen&lt;br /&gt;
       jarl_dot_underhaug_at_gmail_dot_com&lt;br /&gt;
&lt;br /&gt;
    USAGE&lt;br /&gt;
&lt;br /&gt;
       FocalBlur(aperture=float,samples=int,raytrace=True/False,width=int,height=int)&lt;br /&gt;
       &lt;br /&gt;
    EXAMPELS&lt;br /&gt;
&lt;br /&gt;
       FocalBlur(aperture=1,samples=100,raytrace=False)&lt;br /&gt;
       FocalBlur(aperture=2,samples=100,raytrace=True,width=600,height=400)&lt;br /&gt;
       &lt;br /&gt;
&lt;br /&gt;
    '''&lt;br /&gt;
&lt;br /&gt;
    # Because of a bug, only custom sizes when raytracing&lt;br /&gt;
    if not raytrace:&lt;br /&gt;
        width=0&lt;br /&gt;
        height=0&lt;br /&gt;
&lt;br /&gt;
    # Create a temporary directory&lt;br /&gt;
    tmpdir = mkdtemp()&lt;br /&gt;
&lt;br /&gt;
    # Get the orientation of the protein and the light&lt;br /&gt;
    light = cmd.get('light')[1:-1]&lt;br /&gt;
    light = [float(s) for s in light.split(',')]&lt;br /&gt;
    view = cmd.get_view()&lt;br /&gt;
&lt;br /&gt;
    # Rotate the protein and the light in order to create the blur&lt;br /&gt;
    for frame in range(samples):&lt;br /&gt;
        # Angles to rotate protein and light&lt;br /&gt;
        x  = (random.random()-0.5)*aperture&lt;br /&gt;
        y  = (random.random()-0.5)*aperture&lt;br /&gt;
        xr = x/180.0*pi&lt;br /&gt;
        yr = y/180.0*pi&lt;br /&gt;
&lt;br /&gt;
        # Rotate the protein&lt;br /&gt;
        cmd.turn('x',x)&lt;br /&gt;
        cmd.turn('y',y)&lt;br /&gt;
&lt;br /&gt;
        # Rotate the light&lt;br /&gt;
        ly = light[1]*cos(xr)-light[2]*sin(xr)&lt;br /&gt;
        lz = light[2]*cos(xr)+light[1]*sin(xr)&lt;br /&gt;
        lx = light[0]*cos(yr)+lz*sin(yr)&lt;br /&gt;
        lz = lz*cos(yr)-lx*sin(yr)&lt;br /&gt;
        cmd.set('light',[lx,ly,lz])&lt;br /&gt;
&lt;br /&gt;
        # Save the image&lt;br /&gt;
        cmd.png(tmpdir+'/frame-%04d.png' % (frame),width=width,height=height,ray=raytrace)&lt;br /&gt;
        &lt;br /&gt;
        # Return the protein and the light to the original orientation&lt;br /&gt;
        cmd.set('light',light)&lt;br /&gt;
        cmd.set_view(view)&lt;br /&gt;
&lt;br /&gt;
    # Create a blured image of all the frames&lt;br /&gt;
    system('convert %s/frame-*.png +matte -average %s/blur.png' % (tmpdir,tmpdir))&lt;br /&gt;
&lt;br /&gt;
    # Load the blured image &lt;br /&gt;
    cmd.load('%s/blur.png' % (tmpdir))&lt;br /&gt;
&lt;br /&gt;
    # Delete the temporary files&lt;br /&gt;
    rmtree(tmpdir)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library]]&lt;/div&gt;</summary>
		<author><name>Jarl.Underhaug</name></author>
	</entry>
</feed>