<?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=Cmp+chem</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=Cmp+chem"/>
	<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php/Special:Contributions/Cmp_chem"/>
	<updated>2026-04-30T13:59:39Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://wiki.pymol.org/index.php?title=Stereo_ray&amp;diff=10482</id>
		<title>Stereo ray</title>
		<link rel="alternate" type="text/html" href="https://wiki.pymol.org/index.php?title=Stereo_ray&amp;diff=10482"/>
		<updated>2007-07-05T20:51:11Z</updated>

		<summary type="html">&lt;p&gt;Cmp chem: /* Manually */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:Stereo_ex_l.png|Left Image|200px|thumb|left]]&lt;br /&gt;
[[Image:Stereo_ex_r.png|Right Image|200px|thumb|right]]&lt;br /&gt;
[[Image:Stereo_complete.png|Combined Images|center|thumb|250px]]&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot; /&amp;gt;&lt;br /&gt;
== Manually ==&lt;br /&gt;
&lt;br /&gt;
To get a stereo diagram you need two images. The left image is rotated +3 degrees and the right image is rotated -3 degrees.&lt;br /&gt;
&lt;br /&gt;
To obtain the left image, type:&lt;br /&gt;
 ray angle=+3&lt;br /&gt;
 png left-image.png&lt;br /&gt;
Likewise, to obtain the right image, type:&lt;br /&gt;
 ray angle=-3&lt;br /&gt;
 png right-image.png&lt;br /&gt;
&lt;br /&gt;
You still use any other [[ray]] based modifications, such as:&lt;br /&gt;
 ray 1600,1200,angle=+3&lt;br /&gt;
 png big-left-image.png&lt;br /&gt;
&lt;br /&gt;
== Script ==&lt;br /&gt;
&lt;br /&gt;
A user on the PyMol list wrote a very nice little stereo ray tracing script.  Just copy this to a text file.  Then, in PyMol run&lt;br /&gt;
 run dirName/scriptName.pym&lt;br /&gt;
where '''dirName''' is where you put it, and '''scriptName''' is what you named the file then run one something like the example lines given:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
EXAMPLE&lt;br /&gt;
   stereo_ray output, 1000, 600&lt;br /&gt;
   stereo_ray secondImage.png&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
This will create to images, one with an L and one with an R suffix.  Just paste the two images next to each other (in some image editing program) and you're done.&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;
&lt;br /&gt;
def stereo_ray(output='', width='', height=''):&lt;br /&gt;
   '''&lt;br /&gt;
DESCRIPTION&lt;br /&gt;
   &amp;quot;stereo_ray&amp;quot; ray-traces the current scene twice (separated by &lt;br /&gt;
   a six-degree rotation around the y axis)&lt;br /&gt;
   and saves a pair of images that can be combined in any image&lt;br /&gt;
   manipulation software to form a stereoimage.&lt;br /&gt;
   The first argument, the output file name, is mandatory.&lt;br /&gt;
   The second and third arguments, the size of the image, are not.&lt;br /&gt;
   If the width is given, the height will be calculated.&lt;br /&gt;
&lt;br /&gt;
USAGE&lt;br /&gt;
   stereo_ray filename [, width [, height]]&lt;br /&gt;
&lt;br /&gt;
EXAMPLE&lt;br /&gt;
   stereo_ray output, 1000, 600&lt;br /&gt;
   stereo_ray secondImage.png&lt;br /&gt;
   '''&lt;br /&gt;
&lt;br /&gt;
   if output == '':&lt;br /&gt;
      print 'no output filename defined\n'&lt;br /&gt;
      print 'try: \'stereo_ray filename\''&lt;br /&gt;
      return -1&lt;br /&gt;
      # abort if no output file name given&lt;br /&gt;
&lt;br /&gt;
   if width == '':&lt;br /&gt;
      width,height = cmd.get_session()['main'][0:2]&lt;br /&gt;
      # get dimensions from viewer if not given&lt;br /&gt;
&lt;br /&gt;
   elif height == '':&lt;br /&gt;
      oldWidth,oldHeight = cmd.get_session()['main'][0:2]&lt;br /&gt;
      height = int(width)*oldHeight/oldWidth&lt;br /&gt;
      # calculate height from proportions of viewer if&lt;br /&gt;
      # only width is given&lt;br /&gt;
&lt;br /&gt;
   cmd.ray(width, height, angle=-3)&lt;br /&gt;
   cmd.png(output+&amp;quot;_r&amp;quot;)&lt;br /&gt;
   cmd.ray(width, height, angle=3)&lt;br /&gt;
   cmd.png(output+&amp;quot;_l&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
cmd.extend('stereo_ray',stereo_ray)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Script_Library|Stereo Ray]]&lt;/div&gt;</summary>
		<author><name>Cmp chem</name></author>
	</entry>
</feed>