pyscript-0.6.1/ 0000755 0001750 0000144 00000000000 10441274723 013100 5 ustar cochrane users pyscript-0.6.1/bin/ 0000755 0001750 0000144 00000000000 10441274721 013646 5 ustar cochrane users pyscript-0.6.1/bin/pyscript 0000755 0001750 0000144 00000007060 10245240702 015446 0 ustar cochrane users #!/usr/bin/env python
import sys, getopt, os, traceback
import tempfile
from pyscript.version import version as versionNum
def usage():
print """Usage:
pyscript [options] file.py
options:
[-h/--help] Print usage information and exit
[-V/--version] Print version information and exit
[-o/--output=outputFile] Specify an alternative output file name
[-l/--logfile=logFile] Specify an alternative log file name
"""
def version():
print "This is pyscript version %s" % (versionNum,)
print "For more information see http://pyscript.sourceforge.net\n"
#---------------------------------------------------------------------
# Handle options
#---------------------------------------------------------------------
try:
opts, args = getopt.getopt(sys.argv[1:], "hVo:l:d",
["help", "version", "output=", "logfile="])
except getopt.GetoptError:
# print help information and exit:
usage()
sys.exit(2)
logFile = "pyscript.log"
DEBUG=False
globals={}
for o, a in opts:
if o in ("-h", "--help"):
usage()
sys.exit()
if o in ("-V", "--version"):
version()
sys.exit()
if o in ("-o", "--output"):
globals['output']=a
elif o in ("-l", "--logfile"):
logFile=a
elif o in ("-d",):
DEBUG=True
if len(args) != 1:
usage()
sys.exit()
# print some pretty info
version()
#---------------------------------------------------------------------
# Set up log file
#---------------------------------------------------------------------
# redirect stdout and stderr to file
# keep a copy
save_err = sys.stderr
# open the log file
#tempfile.template="pyscript-"
#logFile = tempfile.mktemp(".log")
if logFile=="-":
log=sys.stdout
else:
log = open(logFile,"w")
print "Log file is",logFile
sys.stderr = log
#---------------------------------------------------------------------
# look for ~/.pyscript
#---------------------------------------------------------------------
# now see about importing the defaults from .pyscript/defaults.py
HOME = os.path.expandvars("$HOME")
# if $HOME/.pyscript directory exists, append this to the python path
# this is so that user defined libs can be imported
if os.path.isdir(HOME+'/.pyscript'):
sys.path.append(HOME+'/.pyscript')
if os.path.isfile(HOME+'/.pyscript/defaults.py'):
# try $HOME/.pyscript/defaults.py
execfile(HOME+'/.pyscript/defaults.py',globals)
else:
print "No user defaults file found."
print "Executing script..."
#---------------------------------------------------------------------
# now run the script
#---------------------------------------------------------------------
try:
execfile(args[0],globals)
except:
divider="-"*60+'\n'
sys.stderr.write("Exception in user code:\n")
sys.stderr.write(divider)
traceback.print_exc(file=sys.stderr)
sys.stderr.write(divider)
sys.stdout.write("Exception in user code:\n")
sys.stdout.write(divider)
traceback.print_exc(file=sys.stdout)
sys.stdout.write(divider)
print "Further clues may be found in the log file:",logFile
else:
# clean up a bit
sys.stderr = save_err
if logFile!="-":
log.close()
if not DEBUG:
print "Removing log file"
os.remove(logFile)
print "Removing temp files"
tempfiles = ("temp.aux", "temp.dvi", "temp.log", "temp.ps",
"temp.tex", "temp1.aux", "temp1.dvi", "temp1.eps",
"temp1.log", "temp1.tex")
for tmpfile in tempfiles:
if os.path.exists(tmpfile):
os.remove(tmpfile)
print "Done!"
pyscript-0.6.1/contrib/ 0000755 0001750 0000144 00000000000 10441274721 014536 5 ustar cochrane users pyscript-0.6.1/contrib/styles/ 0000755 0001750 0000144 00000000000 10441274721 016061 5 ustar cochrane users pyscript-0.6.1/contrib/styles/ccp2004-poster.py 0000644 0001750 0000144 00000003301 10422757007 021017 0 ustar cochrane users # poster style for PyScript, used for the CCP2004 conference
HOME = os.path.expandvars("$HOME")
stylesDir = HOME + "/.pyscript/styles/"
# set the default style settings
self.title = ""
self.title_fg = Color("yellow")*2.0
self.title_scale = 1.4
self.title_width = 0.8 # as a fraction of the total poster width
self.title_text_style = "\large \sf"
self.authors = ""
self.authors_fg = Color("yellow")
self.authors_scale = 1
self.authors_width = 0.8 # as a fraction of the total poster width
self.authors_text_style = "\sf"
self.address = ""
self.address_fg = Color("yellow")
self.address_scale = 0.9
self.address_width = 0.8 # as a fraction of the total poster width
self.address_text_style = "\sf"
self.abstract = ""
self.abstract_fg = Color("gold")*1.1
self.abstract_scale = 0.8
self.abstract_width = 0.92 # relative to total width of poster
self.abstract_text_style = ""
self.gutter = 0.2
self.pad = 0 # should get set by add_column()
self.item_sep = 0.3
self.bg = Color("royalblue")*0.8
self.signature_fg = Color("white")
self.logo_height = 1.2
# styles for columns
self.column_item_sep = 0.3
# styles for column boxes
# the title's style...
self.column_box_title_align = "c"
self.column_box_title_tex_scale = 1.4
self.column_box_title_fixed_width = 9.4
self.column_box_title_text_style = r"\sf"
self.column_box_title_fg = Color("orangered")*0.95
# the text styles of the column box
self.column_box_text_align = "w"
self.column_box_tex_scale = 0.7
self.column_box_text_width = 9.4
self.column_box_text_style = r""
self.column_box_text_fg = Color(0)
# the column box styles
self.column_box_item_sep = 0.1
self.column_box_width = 9.9
self.column_box_bg = Color("LightGoldenRod")*1.1
self.column_box_border = 1
pyscript-0.6.1/contrib/styles/greenbullet.eps 0000644 0001750 0000144 00000021722 10412567550 021111 0 ustar cochrane users %!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 61 61
%%Creator: PyScript 0.4.0
%%CreationDate: Wed Jul 23 14:26:11 2003
%%LanguageLevel: 2
%%Title: PyScriptEPS
%%Pages: 1
%%EndComments
%%BeginProlog
%%BeginResource: procset pyscript
/PyScriptDict 10 dict def PyScriptDict begin
%%show text with kerning if supplied
/kernshow { 0 2 2 counttomark 2 sub { -2 roll } for
counttomark 2 idiv { exch show 0 rmoveto} repeat pop
} bind def
/BeginEPSF {
/b4_Inc_state save def
/dict_count countdictstack def
/op_count count 1 sub def
userdict begin
/showpage { } def
0 setgray 0 setlinecap
1 setlinewidth 0 setlinejoin
10 setmiterlimit [ ] 0 setdash newpath
/languagelevel where
{pop languagelevel
1 ne
{false setstrokeadjust false setoverprint
} if
} if
} bind def
/EndEPSF {
count op_count sub {pop} repeat
countdictstack dict_count sub {end} repeat
b4_Inc_state restore
} bind def
/PyScriptStart {} def
/PyScriptEnd {} def
/showpage {} def
end
%%EndResource
%%EndProlog
%%BeginSetup
PyScriptDict begin
/uu {28.346000 mul} def 0.5 setlinewidth
1 setlinecap 0 setlinejoin 10 setmiterlimit [ ] 0 setdash
end
%%EndSetup
%%Page: 1 1
PyScriptDict begin
gsave [1 0 0 1 1.09363 uu 1.09363 uu] concat
gsave [1 0 0 1 0 uu 0 uu] concat
gsave [1 0 0 1 -0.0206239 uu -0.0206239 uu] concat
0 0 0 setrgbcolor 0 0 1 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0 0 setrgbcolor 0 0 1 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0 uu 0 uu] concat
0 0.114834 0 setrgbcolor 0 0 0.966667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.114834 0 setrgbcolor 0 0 0.966667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.0206239 uu 0.0206239 uu] concat
0 0.162288 0 setrgbcolor 0 0 0.933333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.162288 0 setrgbcolor 0 0 0.933333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.0412479 uu 0.0412479 uu] concat
0 0.198535 0 setrgbcolor 0 0 0.9 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.198535 0 setrgbcolor 0 0 0.9 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.0618718 uu 0.0618718 uu] concat
0 0.228881 0 setrgbcolor 0 0 0.866667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.228881 0 setrgbcolor 0 0 0.866667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.0824958 uu 0.0824958 uu] concat
0 0.255369 0 setrgbcolor 0 0 0.833333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.255369 0 setrgbcolor 0 0 0.833333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.10312 uu 0.10312 uu] concat
0 0.279036 0 setrgbcolor 0 0 0.8 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.279036 0 setrgbcolor 0 0 0.8 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.123744 uu 0.123744 uu] concat
0 0.300493 0 setrgbcolor 0 0 0.766667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.300493 0 setrgbcolor 0 0 0.766667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.144368 uu 0.144368 uu] concat
0 0.32013 0 setrgbcolor 0 0 0.733333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.32013 0 setrgbcolor 0 0 0.733333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.164992 uu 0.164992 uu] concat
0 0.338215 0 setrgbcolor 0 0 0.7 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.338215 0 setrgbcolor 0 0 0.7 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.185616 uu 0.185616 uu] concat
0 0.35494 0 setrgbcolor 0 0 0.666667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.35494 0 setrgbcolor 0 0 0.666667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.206239 uu 0.206239 uu] concat
0 0.370445 0 setrgbcolor 0 0 0.633333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.370445 0 setrgbcolor 0 0 0.633333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.226863 uu 0.226863 uu] concat
0 0.384839 0 setrgbcolor 0 0 0.6 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.384839 0 setrgbcolor 0 0 0.6 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.247487 uu 0.247487 uu] concat
0 0.398204 0 setrgbcolor 0 0 0.566667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.398204 0 setrgbcolor 0 0 0.566667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.268111 uu 0.268111 uu] concat
0 0.410606 0 setrgbcolor 0 0 0.533333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.410606 0 setrgbcolor 0 0 0.533333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.288735 uu 0.288735 uu] concat
0 0.422097 0 setrgbcolor 0 0 0.5 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.422097 0 setrgbcolor 0 0 0.5 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.309359 uu 0.309359 uu] concat
0 0.43272 0 setrgbcolor 0 0 0.466667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.43272 0 setrgbcolor 0 0 0.466667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.329983 uu 0.329983 uu] concat
0 0.442508 0 setrgbcolor 0 0 0.433333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.442508 0 setrgbcolor 0 0 0.433333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.350607 uu 0.350607 uu] concat
0 0.45149 0 setrgbcolor 0 0 0.4 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.45149 0 setrgbcolor 0 0 0.4 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.371231 uu 0.371231 uu] concat
0 0.45969 0 setrgbcolor 0 0 0.366667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.45969 0 setrgbcolor 0 0 0.366667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.391855 uu 0.391855 uu] concat
0 0.467127 0 setrgbcolor 0 0 0.333333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.467127 0 setrgbcolor 0 0 0.333333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.412479 uu 0.412479 uu] concat
0 0.473817 0 setrgbcolor 0 0 0.3 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.473817 0 setrgbcolor 0 0 0.3 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.433103 uu 0.433103 uu] concat
0 0.479772 0 setrgbcolor 0 0 0.266667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.479772 0 setrgbcolor 0 0 0.266667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.453727 uu 0.453727 uu] concat
0 0.485004 0 setrgbcolor 0 0 0.233333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.485004 0 setrgbcolor 0 0 0.233333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.474351 uu 0.474351 uu] concat
0 0.489523 0 setrgbcolor 0 0 0.2 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.489523 0 setrgbcolor 0 0 0.2 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.494975 uu 0.494975 uu] concat
0 0.493335 0 setrgbcolor 0 0 0.166667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.493335 0 setrgbcolor 0 0 0.166667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.515599 uu 0.515599 uu] concat
0 0.496446 0 setrgbcolor 0 0 0.133333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.496446 0 setrgbcolor 0 0 0.133333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.536223 uu 0.536223 uu] concat
0 0.498861 0 setrgbcolor 0 0 0.1 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.498861 0 setrgbcolor 0 0 0.1 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.556847 uu 0.556847 uu] concat
0 0.500584 0 setrgbcolor 0 0 0.0666667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.500584 0 setrgbcolor 0 0 0.0666667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.577471 uu 0.577471 uu] concat
0 0.501617 0 setrgbcolor 0 0 0.0333333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0.501617 0 setrgbcolor 0 0 0.0333333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
grestore
grestore
end %PyScriptDict
showpage
%%Trailer
%%EOF
pyscript-0.6.1/contrib/styles/prosper-darkblue.py 0000644 0001750 0000144 00000003567 10412575541 021731 0 ustar cochrane users # talk style for PyScript, following the Darkblue design of prosper
HOME = os.path.expandvars("$HOME")
stylesDir = HOME + "/.pyscript/styles/"
# set the foreground and background colour of the title text of the talk
self.title_fg = Color('white')
self.title_bg = Color('white')
# set the talk title's text style
self.title_textstyle = r"\bf\sf"
# set the text style for the text of who is giving the talk
self.speaker_textstyle = r"\sf"
# set the colour and text style of the address of the speaker of the talk
self.address_fg = Color('white')
self.address_textstyle = r"\sf"
# set the colour and text style of the authors of the talk (not necessarily
# the speaker of the talk)
self.authors_fg = Color('white')
self.authors_textstyle = r"\sf"
# set the colour and text style of the title of the *slide*
self.slide_title_fg = Color('lightgray')
self.slide_title_textstyle = r"\bf"
# set the colour, scale, textstyle, bullet and indent type for a level 1 heading
self.headings_fgs[1] = Color('white')
self.headings_scales[1] = 3
self.headings_textstyle[1] = r"\sf"
self.headings_bullets[1] = Epsf(file=stylesDir+"redbullet.eps").scale(0.2,0.2)
self.headings_indent[1] = 0
# set the colour, scale, textstyle, bullet and indent type for a level 2 heading
self.headings_fgs[2] = Color('white')
self.headings_scales[2] = 2.5
self.headings_textstyle[2] = r"\sf"
self.headings_bullets[2] = Epsf(file=stylesDir+"greenbullet.eps").scale(0.15,0.15)
self.headings_indent[2] = 0.5
# set the colour, scale, textstyle, bullet and indent type for a level 3 heading
self.headings_fgs[3] = Color('white')
self.headings_scales[3] = 2.2
self.headings_textstyle[3] = r"\sf"
self.headings_bullets[3] = Epsf(file=stylesDir+"yellowbullet.eps").scale(0.1,0.1)
self.headings_indent[3] = 1
# set the colour, textstyle and scale for placed text
self.text_scale = 3.0
self.text_fg = Color('white')
self.text_textstyle = r"\sf"
pyscript-0.6.1/contrib/styles/redbullet.eps 0000644 0001750 0000144 00000021730 10412567550 020562 0 ustar cochrane users %!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 61 61
%%Creator: PyScript 0.4.0
%%CreationDate: Fri Jul 18 18:00:14 2003
%%LanguageLevel: 2
%%Title: PyScriptEPS
%%Pages: 1
%%EndComments
%%BeginProlog
%%BeginResource: procset pyscript
/PyScriptDict 10 dict def PyScriptDict begin
%%show text with kerning if supplied
/kernshow { 0 2 2 counttomark 2 sub { -2 roll } for
counttomark 2 idiv { exch show 0 rmoveto} repeat pop
} bind def
/BeginEPSF {
/b4_Inc_state save def
/dict_count countdictstack def
/op_count count 1 sub def
userdict begin
/showpage { } def
0 setgray 0 setlinecap
1 setlinewidth 0 setlinejoin
10 setmiterlimit [ ] 0 setdash newpath
/languagelevel where
{pop languagelevel
1 ne
{false setstrokeadjust false setoverprint
} if
} if
} bind def
/EndEPSF {
count op_count sub {pop} repeat
countdictstack dict_count sub {end} repeat
b4_Inc_state restore
} bind def
/PyScriptStart {} def
/PyScriptEnd {} def
/showpage {} def
end
%%EndResource
%%EndProlog
%%BeginSetup
PyScriptDict begin
/uu {28.346000 mul} def 0.5 setlinewidth
1 setlinecap 0 setlinejoin 10 setmiterlimit [ ] 0 setdash
end
%%EndSetup
%%Page: 1 1
PyScriptDict begin
gsave [1 0 0 1 1.09363 uu 1.09363 uu] concat
gsave [1 0 0 1 0 uu 0 uu] concat
gsave [1 0 0 1 -0.0206239 uu -0.0206239 uu] concat
0 0 0 setrgbcolor 0 0 1 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0 0 setrgbcolor 0 0 1 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0 uu 0 uu] concat
0.228771 0 0 setrgbcolor 0 0 0.966667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.228771 0 0 setrgbcolor 0 0 0.966667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.0206239 uu 0.0206239 uu] concat
0.323309 0 0 setrgbcolor 0 0 0.933333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.323309 0 0 setrgbcolor 0 0 0.933333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.0412479 uu 0.0412479 uu] concat
0.395518 0 0 setrgbcolor 0 0 0.9 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.395518 0 0 setrgbcolor 0 0 0.9 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.0618718 uu 0.0618718 uu] concat
0.455973 0 0 setrgbcolor 0 0 0.866667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.455973 0 0 setrgbcolor 0 0 0.866667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.0824958 uu 0.0824958 uu] concat
0.508743 0 0 setrgbcolor 0 0 0.833333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.508743 0 0 setrgbcolor 0 0 0.833333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.10312 uu 0.10312 uu] concat
0.555893 0 0 setrgbcolor 0 0 0.8 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.555893 0 0 setrgbcolor 0 0 0.8 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.123744 uu 0.123744 uu] concat
0.598638 0 0 setrgbcolor 0 0 0.766667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.598638 0 0 setrgbcolor 0 0 0.766667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.144368 uu 0.144368 uu] concat
0.637759 0 0 setrgbcolor 0 0 0.733333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.637759 0 0 setrgbcolor 0 0 0.733333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.164992 uu 0.164992 uu] concat
0.673788 0 0 setrgbcolor 0 0 0.7 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.673788 0 0 setrgbcolor 0 0 0.7 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.185616 uu 0.185616 uu] concat
0.707107 0 0 setrgbcolor 0 0 0.666667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.707107 0 0 setrgbcolor 0 0 0.666667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.206239 uu 0.206239 uu] concat
0.737997 0 0 setrgbcolor 0 0 0.633333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.737997 0 0 setrgbcolor 0 0 0.633333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.226863 uu 0.226863 uu] concat
0.766672 0 0 setrgbcolor 0 0 0.6 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.766672 0 0 setrgbcolor 0 0 0.6 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.247487 uu 0.247487 uu] concat
0.793297 0 0 setrgbcolor 0 0 0.566667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.793297 0 0 setrgbcolor 0 0 0.566667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.268111 uu 0.268111 uu] concat
0.818004 0 0 setrgbcolor 0 0 0.533333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.818004 0 0 setrgbcolor 0 0 0.533333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.288735 uu 0.288735 uu] concat
0.840896 0 0 setrgbcolor 0 0 0.5 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.840896 0 0 setrgbcolor 0 0 0.5 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.309359 uu 0.309359 uu] concat
0.862058 0 0 setrgbcolor 0 0 0.466667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.862058 0 0 setrgbcolor 0 0 0.466667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.329983 uu 0.329983 uu] concat
0.881559 0 0 setrgbcolor 0 0 0.433333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.881559 0 0 setrgbcolor 0 0 0.433333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.350607 uu 0.350607 uu] concat
0.899454 0 0 setrgbcolor 0 0 0.4 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.899454 0 0 setrgbcolor 0 0 0.4 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.371231 uu 0.371231 uu] concat
0.91579 0 0 setrgbcolor 0 0 0.366667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.91579 0 0 setrgbcolor 0 0 0.366667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.391855 uu 0.391855 uu] concat
0.930605 0 0 setrgbcolor 0 0 0.333333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.930605 0 0 setrgbcolor 0 0 0.333333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.412479 uu 0.412479 uu] concat
0.943931 0 0 setrgbcolor 0 0 0.3 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.943931 0 0 setrgbcolor 0 0 0.3 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.433103 uu 0.433103 uu] concat
0.955796 0 0 setrgbcolor 0 0 0.266667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.955796 0 0 setrgbcolor 0 0 0.266667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.453727 uu 0.453727 uu] concat
0.96622 0 0 setrgbcolor 0 0 0.233333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.96622 0 0 setrgbcolor 0 0 0.233333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.474351 uu 0.474351 uu] concat
0.975221 0 0 setrgbcolor 0 0 0.2 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.975221 0 0 setrgbcolor 0 0 0.2 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.494975 uu 0.494975 uu] concat
0.982815 0 0 setrgbcolor 0 0 0.166667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.982815 0 0 setrgbcolor 0 0 0.166667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.515599 uu 0.515599 uu] concat
0.989013 0 0 setrgbcolor 0 0 0.133333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.989013 0 0 setrgbcolor 0 0 0.133333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.536223 uu 0.536223 uu] concat
0.993825 0 0 setrgbcolor 0 0 0.1 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.993825 0 0 setrgbcolor 0 0 0.1 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.556847 uu 0.556847 uu] concat
0.997257 0 0 setrgbcolor 0 0 0.0666667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.997257 0 0 setrgbcolor 0 0 0.0666667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.577471 uu 0.577471 uu] concat
0.999315 0 0 setrgbcolor 0 0 0.0333333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.999315 0 0 setrgbcolor 0 0 0.0333333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
grestore
grestore
end %PyScriptDict
showpage
%%Trailer
%%EOF
pyscript-0.6.1/contrib/styles/yellowbullet.eps 0000644 0001750 0000144 00000022551 10412567550 021325 0 ustar cochrane users %!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 61 61
%%Creator: PyScript 0.4.0
%%CreationDate: Thu Oct 2 21:45:29 2003
%%LanguageLevel: 2
%%Title: PyScriptEPS
%%Pages: 1
%%EndComments
%%BeginProlog
%%BeginResource: procset pyscript
/PyScriptDict 10 dict def PyScriptDict begin
%show text with kerning if supplied
/kernshow { 0 2 2 counttomark 2 sub { -2 roll } for
counttomark 2 idiv { exch show 0 rmoveto} repeat pop
} bind def
/BeginEPSF {
/b4_Inc_state save def
/dict_count countdictstack def
/op_count count 1 sub def
userdict begin
/showpage { } def
0 setgray 0 setlinecap
1 setlinewidth 0 setlinejoin
10 setmiterlimit [ ] 0 setdash newpath
/languagelevel where
{pop languagelevel
1 ne
{false setstrokeadjust false setoverprint
} if
} if
} bind def
/EndEPSF {
count op_count sub {pop} repeat
countdictstack dict_count sub {end} repeat
b4_Inc_state restore
} bind def
/PyScriptStart {} def
/PyScriptEnd {} def
/showpage {} def
end
%%EndResource
%%EndProlog
%%BeginSetup
PyScriptDict begin
/uu {28.346000 mul} def 0.5 setlinewidth
1 setlinecap 0 setlinejoin 10 setmiterlimit [ ] 0 setdash
end
%%EndSetup
%%Page: 1 1
PyScriptDict begin
gsave [1 0 0 1 1.09363 uu 1.09363 uu] concat
gsave [1 0 0 1 0 uu 0 uu] concat
gsave [1 0 0 1 -0.0206239 uu -0.0206239 uu] concat
0 0 0 setrgbcolor 0 0 1 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0 0 0 setrgbcolor 0 0 1 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0 uu 0 uu] concat
0.228771 0.228771 0 setrgbcolor 0 0 0.966667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.228771 0.228771 0 setrgbcolor 0 0 0.966667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.0206239 uu 0.0206239 uu] concat
0.323309 0.323309 0 setrgbcolor 0 0 0.933333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.323309 0.323309 0 setrgbcolor 0 0 0.933333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.0412479 uu 0.0412479 uu] concat
0.395518 0.395518 0 setrgbcolor 0 0 0.9 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.395518 0.395518 0 setrgbcolor 0 0 0.9 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.0618718 uu 0.0618718 uu] concat
0.455973 0.455973 0 setrgbcolor 0 0 0.866667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.455973 0.455973 0 setrgbcolor 0 0 0.866667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.0824958 uu 0.0824958 uu] concat
0.508743 0.508743 0 setrgbcolor 0 0 0.833333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.508743 0.508743 0 setrgbcolor 0 0 0.833333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.10312 uu 0.10312 uu] concat
0.555893 0.555893 0 setrgbcolor 0 0 0.8 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.555893 0.555893 0 setrgbcolor 0 0 0.8 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.123744 uu 0.123744 uu] concat
0.598638 0.598638 0 setrgbcolor 0 0 0.766667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.598638 0.598638 0 setrgbcolor 0 0 0.766667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.144368 uu 0.144368 uu] concat
0.637759 0.637759 0 setrgbcolor 0 0 0.733333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.637759 0.637759 0 setrgbcolor 0 0 0.733333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.164992 uu 0.164992 uu] concat
0.673788 0.673788 0 setrgbcolor 0 0 0.7 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.673788 0.673788 0 setrgbcolor 0 0 0.7 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.185616 uu 0.185616 uu] concat
0.707107 0.707107 0 setrgbcolor 0 0 0.666667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.707107 0.707107 0 setrgbcolor 0 0 0.666667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.206239 uu 0.206239 uu] concat
0.737997 0.737997 0 setrgbcolor 0 0 0.633333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.737997 0.737997 0 setrgbcolor 0 0 0.633333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.226863 uu 0.226863 uu] concat
0.766672 0.766672 0 setrgbcolor 0 0 0.6 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.766672 0.766672 0 setrgbcolor 0 0 0.6 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.247487 uu 0.247487 uu] concat
0.793297 0.793297 0 setrgbcolor 0 0 0.566667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.793297 0.793297 0 setrgbcolor 0 0 0.566667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.268111 uu 0.268111 uu] concat
0.818004 0.818004 0 setrgbcolor 0 0 0.533333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.818004 0.818004 0 setrgbcolor 0 0 0.533333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.288735 uu 0.288735 uu] concat
0.840896 0.840896 0 setrgbcolor 0 0 0.5 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.840896 0.840896 0 setrgbcolor 0 0 0.5 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.309359 uu 0.309359 uu] concat
0.862058 0.862058 0 setrgbcolor 0 0 0.466667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.862058 0.862058 0 setrgbcolor 0 0 0.466667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.329983 uu 0.329983 uu] concat
0.881559 0.881559 0 setrgbcolor 0 0 0.433333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.881559 0.881559 0 setrgbcolor 0 0 0.433333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.350607 uu 0.350607 uu] concat
0.899454 0.899454 0 setrgbcolor 0 0 0.4 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.899454 0.899454 0 setrgbcolor 0 0 0.4 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.371231 uu 0.371231 uu] concat
0.91579 0.91579 0 setrgbcolor 0 0 0.366667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.91579 0.91579 0 setrgbcolor 0 0 0.366667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.391855 uu 0.391855 uu] concat
0.930605 0.930605 0 setrgbcolor 0 0 0.333333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.930605 0.930605 0 setrgbcolor 0 0 0.333333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.412479 uu 0.412479 uu] concat
0.943931 0.943931 0 setrgbcolor 0 0 0.3 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.943931 0.943931 0 setrgbcolor 0 0 0.3 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.433103 uu 0.433103 uu] concat
0.955796 0.955796 0 setrgbcolor 0 0 0.266667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.955796 0.955796 0 setrgbcolor 0 0 0.266667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.453727 uu 0.453727 uu] concat
0.96622 0.96622 0 setrgbcolor 0 0 0.233333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.96622 0.96622 0 setrgbcolor 0 0 0.233333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.474351 uu 0.474351 uu] concat
0.975221 0.975221 0 setrgbcolor 0 0 0.2 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.975221 0.975221 0 setrgbcolor 0 0 0.2 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.494975 uu 0.494975 uu] concat
0.982815 0.982815 0 setrgbcolor 0 0 0.166667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.982815 0.982815 0 setrgbcolor 0 0 0.166667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.515599 uu 0.515599 uu] concat
0.989013 0.989013 0 setrgbcolor 0 0 0.133333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.989013 0.989013 0 setrgbcolor 0 0 0.133333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.536223 uu 0.536223 uu] concat
0.993825 0.993825 0 setrgbcolor 0 0 0.1 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.993825 0.993825 0 setrgbcolor 0 0 0.1 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.556847 uu 0.556847 uu] concat
0.997257 0.997257 0 setrgbcolor 0 0 0.0666667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.997257 0.997257 0 setrgbcolor 0 0 0.0666667 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
gsave [1 0 0 1 0.577471 uu 0.577471 uu] concat
0.999315 0.999315 0 setrgbcolor 0 0 0.0333333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn fill
0.999315 0.999315 0 setrgbcolor 0 0 0.0333333 uu 360 0 -1 mul add 90 add 360 360 -1 mul add 90 add arcn stroke
grestore
grestore
grestore
end %PyScriptDict
showpage
%%Trailer
%%EOF
pyscript-0.6.1/doc/ 0000755 0001750 0000144 00000000000 10441274721 013643 5 ustar cochrane users pyscript-0.6.1/doc/examples/ 0000755 0001750 0000144 00000000000 10441274722 015462 5 ustar cochrane users pyscript-0.6.1/doc/examples/Makefile 0000644 0001750 0000144 00000001203 10423143526 017113 0 ustar cochrane users # $Id: Makefile,v 1.8 2006/04/24 12:40:54 paultcochrane Exp $
MAIN = align.eps\
align2.eps\
atom.eps\
bifurcate.eps\
detector.eps\
distribute.eps\
div_con.eps\
fabry-perot_pdh.eps\
flower_algorithm.eps\
mach-zehnder.eps\
michelson-morely.eps\
qcirc.eps\
sagnac.eps\
sphere.eps\
stateSwap.eps\
teleport.eps\
tex.eps\
tutorial.eps\
twoqubitQST.eps
all: $(MAIN) Makefile
view: $(MAIN)
$(foreach i, $(MAIN), $(shell gv $i))
# standard TeX stuff
%.eps: %.py
pyscript $<
clean:
rm -f $(MAIN)
# vim: shiftwidth=4:
pyscript-0.6.1/doc/examples/align.py 0000755 0001750 0000144 00000002001 10211214563 017112 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: align.py,v 1.4 2005/03/02 01:40:03 paultcochrane Exp $
"""
align.py - example of using the Align class.
Define some Rectangles and Circles and show how the Align class aligns them
in a horizontal line.
"""
# import the pyscript objects
from pyscript import *
# set the default units to use
defaults.units=UNITS['cm']
# define some objects to align
r1 = Rectangle(width=2, height=1, c=P(0,0))
r2 = Rectangle(width=1, height=2, c=P(2,1))
c1 = Circle(c=P(3,2))
c2 = Circle(r=2, c=P(6,3))
# group the objects together to save their original positions
orig = Group(r1, r2, c1, c2)
# define an Align object and add the rectangles and circles to it
a = Align(a1="e", a2="w", space=None, angle=90)
for o in orig:
a.append(o.copy())
# record where they started in red
orig.apply(fg=Color('Red'))
# make the linewidth of the aligned objects thicker
a.apply(linewidth=2)
# render the objects and save to file
render(
orig,
a,
file="align.eps",
)
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/align2.py 0000755 0001750 0000144 00000001120 10374363175 017213 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: align2.py,v 1.3 2006/02/14 14:23:08 paultcochrane Exp $
"""
Aligning boxes, with numbers inside, around a circle.
"""
from pyscript import *
# define the object to hold all the objects
all = Align(angle=90, space=2)
# create an equal sided rectangle, put a number in it and add it to the
# group of all objects
for ii in range(10):
rt = Rectangle(width=1, height=1)
all.append(
Group(rt, Text(str(ii), c=rt.c)), angle=all.angle+ii*360/10.)
# render the diagram
render(
all,
file='align2.eps',
)
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/atom.py 0000755 0001750 0000144 00000004764 10374363533 017016 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: atom.py,v 1.5 2006/02/14 14:23:08 paultcochrane Exp $
"""
Diagram of an energy level diagram for quantum readout of an electronic
state of an atom. (Helpful for quantum computing.)
"""
# import the pyscript libraries
from pyscript import *
# set up the default units for the diagram
defaults.units=UNITS['cm']
# define some helpful definitions for LaTeX
defaults.tex_head=r"""
\documentclass{article}
\pagestyle{empty}
\newcommand{\ket}[1]{\mbox{$|#1\rangle$}}
\newcommand{\bra}[1]{\mbox{$\langle #1|$}}
\newcommand{\braket}[2]{\mbox{$\langle #1|#2\rangle$}}
\newcommand{\ketbra}[2]{\mbox{|#1$\rangle\langle #2|$}}
\newcommand{\op}[1]{\mbox{\boldmath $\hat{#1}$}}
\begin{document}
"""
# function to define an energy level
def level(x,y,label,**dict):
w = 1
label.w = P(x+w/2., y)
return Group(
apply(Path, (P(x-w/2.,y), P(x+w/2.,y)), dict),
label,
)
# import some functionality from the standard math library
from math import atan2, pi
# function to describe a double-headed arrow
def darrow(s, e, label, **dict):
# don't yet have an arrow object ...
gap = .05
d = e - s
length = d.length
theta = -atan2(e[1]-s[1], e[0]-s[0])/pi*180
label.s = P(length/2., gap)
p00 = P(0,0)
dh = .05
dl = .2
ah1 = apply(Path, (p00, P(dl,dh), P(dl,-dh), p00), dict)
ah2 = apply(Path, (p00, P(-dl,-dh), P(-dl,dh), p00), dict)
ah2.move(length, 0)
g = Group(
apply(Path, (P(0,0), P(length,0)), dict),
ah1, ah2,
label,
)
g.rotate(theta)
g.move(s[0], s[1])
return g
# render the diagram
render(
# four labelled levels
level(0, 0, TeX("$\ket{1}\equiv\ket{g}$")),
level(2, 0.3, TeX("$\ket{2}\equiv\ket{e}$")),
level(.5, 2, TeX("\ket{3}")),
level(2.5, 2.5, TeX("\ket{4}")),
# a dashed level describing the laser detuning
Path(P(0,1.7), P(1,1.7), dash=Dash(2)),
TeX(r'$\Delta\left\{\rule{0cm}{2.75mm}\right.$')(e=P(0,1.85)),
# double-headed arrow for the signal
darrow(P(0,0), P(.3,1.7), TeX('\small signal'),
fg=Color('green'), bg=Color('green')),
# double-headed arrow for the activation
darrow(P(.6,1.7), P(1.8,.3), TeX('\small activation'),
fg=Color('red'), bg=Color('red')),
# double-headed arrow for the read out
darrow(P(2.2,.3), P(2.5,2.5), TeX('\small read out'),
fg=Color('blue'), bg=Color('blue')),
# the output file name
file = "atom.eps",
)
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/bifurcate.py 0000755 0001750 0000144 00000002166 10374363623 020014 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: bifurcate.py,v 1.2 2006/02/14 14:23:08 paultcochrane Exp $
"""
bifurcate.py - a bifurcation diagram
As lambda increases to some critical value the function becomes
multivalued and bifurcates giving the fork structure after \lambda_c.
"""
# import the pyscript objects
from pyscript import *
# define the default units to use
defaults.units = UNITS['cm']
render(
# define the axes
Arrow( P(0,0), P(0,4) ),
Arrow( P(0,0), P(5,0) ),
# dashed vertical line at lambda_c
Path( P(2,3.8), P(2,0), dash=Dash(2), fg=Color(.5) ),
# solid line before bifurcation point
Path( P(.5,2), P(2,2), linewidth=1 ),
# multi-valued part of function after bifurcation
Path( P(4,3.7),
C(P(3,3.5), P(2,3)),
P(2,2),
C(P(2,1), P(3,.5)),
P(4,.3), linewidth=1),
# dashed horizontal line after lambda_c
Path( P(2,2), P(4,2), dash=Dash(3), linewidth=1 ),
# axes labels
TeX(r'$\bar{\lambda}_c$', n=P(2,-.1)),
TeX(r'$\bar{\lambda}$', ne=P(4.8,-.1)),
# the output file
file="bifurcate.eps",
)
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/ccp2004_poster.py 0000644 0001750 0000144 00000027354 10423154443 020513 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id#
"""
Poster for the Conference on Computational Physics 2004
"""
from pyscript.lib.presentation import Poster, Column, ColumnBox, CodeBox, TeXBox
defaults.tex_head+=r"\newcommand{\xmds}{\textsc{xmds}\xspace}"
# firstly, write the code I would like to write...
poster = Poster(size="a4", style="ccp2004-poster")
poster.set_title(r"\xmds: the eXtensible Multi-Dimensional Simulator")
poster.set_authors(r"""\underline{Paul~T.~Cochrane}, G.~Collecutt,
P.~D.~Drummond, and J.~J.~Hope""")
poster.set_address(r"""Australian Centre for Quantum-Atom Optics,
Physics Department, The University of Queensland,
Brisbane, Australia""")
poster.set_abstract(r"""{\em
Writing codes for the simulation of complex phenomena is an art and
science unto itself. What with finding and using good algorithms,
actually writing the code, debugging the code and testing the code,
not much time is left to actually investigate what it was you were
initially out to look at. This is where \xmds comes in. \xmds allows
you to write a high-level description of the problem you are
trying to solve (usually a differential equation of some form) it goes
away and writes low-level simulation code for you (trying hard to
keep the code as efficient as possible), compiles and presents it,
ready to be run.}
""")
poster.add_logo("ARC_COE_crop.eps", height=1.2)
poster.add_logo("uq_logo_new.eps", height=1.2)
# could also do this as:
#poster.add_logos("ARC_COE_crop.eps", "uq_logo_new.eps", height=1.2)
col1 = Column(poster)
what_xmds = ColumnBox(poster)
what_xmds.set_title(r"What is \xmds?")
what_xmds.add_TeXBox(r"""
\begin{itemize}
\setlength{\itemsep}{-1mm}
\item \xmds = e\underline{X}tensible \underline{M}ulti-\underline{D}imensional
\underline{S}imulator
\item \xmds is open source software; released under the GNU General Public
License
\item Has applications in physics, mathematics, weather, chemistry,
economics \ldots
\item One writes a high-level description of a problem in XML
\item \xmds converts XML to C language code, which is then compiled to
produce an executable which solves the problem about as quickly as code
written by an expert
\item \xmds gives people doing simulations structure, organisation and
standardisation
\item Provides a convenient framework for describing simulations of a
system be it in a scientific or industrial setting
\item Keeps the ideas behind a simulation well laid out and, importantly,
documented for others to see and use
\item \xmds gives a common ground from which scientists can compare their
numerical work; something lacking in an area at the interface between
theory and experiment, which already have a well-ingrained culture of
comparison and verification~\cite{Ceperley:1999:1}
\end{itemize}
""")
col1.add_box(what_xmds)
overview = ColumnBox(poster)
overview.set_title(r"Overview")
overview.add_TeXBox(r"""
\begin{itemize}
\setlength{\itemsep}{-2mm}
\item \xmds is designed to integrate the following general PDE:
\vspace*{-3mm}
\begin{align}
\frac{\partial}{\partial x^0}\vect{a}(\vect{x}) & =
\vect{\mathcal{N}}\left(\vect{x}, \vect{a}(\vect{x}), \vect{p}(\vect{x}),
\vect{b}(\vect{x}),\;\vect{\xi}(\vect{x})\right),\\
p^i(\vect{x}) & = \mathcal{F}^{-1}\left[\Sigma_j
\mathcal{L}^{ij}\left(x^0,\vect{k_\bot}\right)
\mathcal{F}\left[a^j(\vect{x})\right]\right],\\
\frac{\partial}{\partial x^{c}}\vect{b}(\vect{x}) & =
\vect{\mathcal{H}}\left(\vect{x}, \vect{a}(\vect{x}),
\vect{b}(\vect{x})\right)
\label{eq:xmdsPdeEx}
\end{align}
\vspace*{-4mm}
\item $\vect{a}(\vect{x})$ : main field, $\vect{b}(\vect{x})$ :
cross-propagating field, $\vect{p}(\vect{x})$ : field in Fourier space,\\
$\xi(\vect{x})$ : noise terms
\item \xmds integrates ODEs, PDEs, and stochastic ODEs and PDEs
\end{itemize}
""")
tAlign = Align(a1="ne", a2="nw", angle=90, space=-0.2)
t1 = TeXBox(r"""
\begin{itemize}
\item \xmds solves DEs with two methods:
\begin{itemize}
\setlength{\itemsep}{-1.5mm}
\vspace*{-3mm}
\item fourth-order Runge-Kutta,
\item split-step semi-implicit method~\cite{Drummond:1983:1}
\end{itemize}
\end{itemize}
""")
t1.set_fixed_width(5.1)
t1.make()
t2 = TeXBox(r"""
\begin{itemize}
\item \xmds can handle any number of:
\vspace*{-3mm}
\begin{itemize}
\setlength{\itemsep}{-1.5mm}
\item components
\item dimensions
\item random variables
\end{itemize}
\end{itemize}
""")
t2.set_fixed_width(4.5)
t2.make()
tAlign.append(t1, t2)
overview.add_object(tAlign)
overview.add_TeXBox(r"""
\vspace*{-3mm}
\begin{itemize}
\setlength{\itemsep}{-2mm}
\item Performs automatic numerical error checking
\item Handles cross-propagating fields
\item Calculates trajectory means and variances of stochastic simulations
\item Automatically parallelises stochastic and deterministic problems using MPI
\end{itemize}
""")
col1.add_box(overview)
why_xmds = ColumnBox(poster)
why_xmds.set_title(r"Why use \xmds?")
why_xmds.add_TeXBox(r"""
\begin{itemize}
\setlength{\itemsep}{-1.5mm}
\item \xmds reduces development time and user-introduced bugs
\item Execution time closely approximates that of hand-written code
\item Input file size dramatically smaller than hand-written code
\item Open source and documentation
(\texttt{http://www.xmds.org})~\cite{xmdsweb}
\item Uses XSIL output format for easy and portable data interchange
\item FFTW (Fastest Fourier Transform in the West) for highly efficient
FFTs~\cite{fftwweb}
\item Allows simple and transparent comparison of simulations with other
researchers
\item The script documents the simulation
\item Simulation script (and therefore parameters) are output with the
simulation data, so the data and the variables that generated it are kept
together for future reference
\end{itemize}
""")
col1.add_box(why_xmds)
nlse = ColumnBox(poster)
nlse.set_title(r"Nonlinear Schr\"{o}diner Equation")
nlse.add_TeXBox(r"""
\begin{equation}
\frac{\partial \phi}{\partial z } = i\left[\frac{1}{2} \frac{\partial ^{2}
\phi}{\partial t ^{2}} + |\phi|^{2} \phi + i \Gamma (t) \phi
\right]
\end{equation}
Where $\phi$ is the field, $z$ is the spatial dimension,
$t$ is time and $\Gamma(t)$ is a damping term.
""")
nlseEpsf = Epsf("nlse.eps", width=4.29)
nlseCode = CodeBox(r"""
\begin{verbatim}
nlse z
t
phi
RK4IP
\end{verbatim}
""").scale(0.4, 0.4)
nlseAlign = Align(a1="ne", a2="nw", angle=90, space=0.1)
nlseAlign.append(nlseEpsf, nlseCode)
nlse.add_object(nlseAlign)
col1.add_box(nlse)
future = ColumnBox(poster)
future.set_title("Future Features")
future.add_TeXBox(r"""
\begin{itemize}
\setlength{\itemsep}{-2mm}
\item More algorithms, user-defined libraries of routines
\item Improved load balancing of parallel stochastic simulations
\item Timed output of simulation data to monitor data on-the-fly
\item Reimplementation and generalisation of \xmds engine
%\item breakpoints: binary output of entire simulation state at end of
%simulation so that can restart the simulation from this point at next run
%of the simulation
\end{itemize}
""")
col1.add_box(future)
# add the column to the poster
poster.add_column(col1, side="left")
# start a new column
col2 = Column(poster)
# make a column box
fibre_optic = ColumnBox(poster)
fibre_optic.set_title("Fibre Optic Laser Field")
fibre_optic.add_TeXBox(r"""
Equation~(\ref{eq:fibre}) describes a one dimensional
damped field subject to a complex noise.\\ This is a stochastic PDE.
\begin{equation}
\frac{\partial \phi}{\partial t} = -i \frac{\partial^{2}
\phi}{\partial x^{2}} - \gamma \phi + \frac{\beta}{\sqrt{2}}
\left[\xi_1(x,t) + i\xi_2(x,t)\right].
\label{eq:fibre}
\end{equation}
""")
fibre1 = VAlign(space=0.2)
fibre1.append(Epsf("fibre1.eps", width=4))
fibre1.append(TeX("single path").scale(0.8, 0.8))
fibre2 = VAlign(space=0.2)
fibre2.append(Epsf("fibre2.eps", width=4))
fibre2.append(TeX("1024 path mean").scale(0.8, 0.8))
fibres = Align(a1="ne", a2="nw", angle=90, space=0.2)
fibres.append(fibre1, fibre2)
fibre_optic.add_object(fibres)
# add the column box to the poster
col2.add_box(fibre_optic)
# make a column box
process = ColumnBox(poster)
process.set_title("Process and Functionality")
process.add_TeXBox(r"""
The figures below describe the processes involved in creating an
\xmds simulation (left-hand diagram) and operating within an \xmds simulation
(right-hand diagram). \xmds reads the XML script, parses it, generates
C/C++ code and then compiles the simulation binary using a C++ compiler.
The simulation when executed generates XSIL output, which can
then be converted for display in your favourite graphing package.
""")
procAlign = Align(a1="ne", a2="nw", angle=90, space=1.0)
procAlign.append(Epsf("xmdsProcess.eps", width=3))
procAlign.append(Epsf("xmdsFunctionality.eps", width=3))
process.add_object(procAlign)
# add the column box to the poster
col2.add_box(process)
other = ColumnBox(poster)
other.set_title("Other Features")
other1 = TeXBox(r"""
\begin{itemize}
\setlength{\itemsep}{-2mm}
\item ASCII and binary output
\item Benchmarking of simulations
\item User-defined preferences
\end{itemize}
""")
other1.set_fixed_width(4.5)
other1.make()
other2 = TeXBox(r"""
\begin{itemize}
\setlength{\itemsep}{-2mm}
\item Field initialisation from file
\item Command line arguments to simulations
\item \xmds script template output
\end{itemize}
""")
other2.set_fixed_width(5)
other2.make()
otherAlign = Align(a1="ne", a2="nw", angle=90, space=-0.2)
otherAlign.append(other1, other2)
other.add_object(otherAlign)
col2.add_box(other)
takehome = ColumnBox(poster)
takehome.set_title("Take-home message")
takehome.add_TeXBox(r"""
\xmds will save you time by solving your problems very quickly.
So why not give it a go? See \texttt{http://www.xmds.org} and try it out.
""")
col2.add_box(takehome)
refs = ColumnBox(poster)
refs.set_title("References")
refs.add_TeXBox(r"""
\renewcommand*{\refname}{ }
\begin{thebibliography}{14}
\expandafter\ifx\csname natexlab\endcsname\relax\def\natexlab#1{#1}\fi
\expandafter\ifx\csname bibnamefont\endcsname\relax
\def\bibnamefont#1{#1}\fi
\expandafter\ifx\csname bibfnamefont\endcsname\relax
\def\bibfnamefont#1{#1}\fi
\expandafter\ifx\csname citenamefont\endcsname\relax
\def\citenamefont#1{#1}\fi
\expandafter\ifx\csname url\endcsname\relax
\def\url#1{\texttt{#1}}\fi
\expandafter\ifx\csname urlprefix\endcsname\relax\def\urlprefix{URL }\fi
\providecommand{\bibinfo}[2]{#2}
\providecommand{\eprint}[2][]{\url{#2}}
\setlength{\itemsep}{-2mm}
\bibitem{Ceperley:1999:1}
\bibinfo{author}{\bibfnamefont{D.~M.} \bibnamefont{Ceperley}},
\bibinfo{journal}{Rev. Mod. Phys.} \textbf{\bibinfo{volume}{71}},
\bibinfo{pages}{438} (\bibinfo{year}{1999}).
\bibitem{Drummond:1983:1}
\bibinfo{author}{\bibfnamefont{P.~D.} \bibnamefont{Drummond}},
\bibinfo{journal}{Comp. Phys. Comm.} \textbf{\bibinfo{volume}{29}},
\bibinfo{pages}{211} (\bibinfo{year}{1983}).
\bibitem{xmdsweb}
\emph{\bibinfo{title}{\xmds home page}},
\urlprefix\url{http://www.xmds.org}.
\bibitem{fftwweb}
\emph{\bibinfo{title}{FFTW home page}},
\urlprefix\url{http://www.fftw.org}.
\end{thebibliography}
""")
col2.add_box(refs)
poster.add_column(col2, side="right")
poster.make(file="ccp2004_poster.eps")
pyscript-0.6.1/doc/examples/detector.py 0000644 0001750 0000144 00000004154 10374363635 017660 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: detector.py,v 1.4 2006/02/14 14:23:09 paultcochrane Exp $
"""
A quantum circuit diagram of a detection setup in optical quantum computing.
"""
# import the pyscript libraries
from pyscript import *
# set up the default units for the diagram
defaults.units=UNITS['cm']
# define some helpful LaTeX macros
defaults.tex_head=r"""
\documentclass{article}
\pagestyle{empty}
\newcommand{\ket}[1]{\mbox{$|#1\rangle$}}
\newcommand{\bra}[1]{\mbox{$\langle #1|$}}
\newcommand{\braket}[2]{\mbox{$\langle #1|#2\rangle$}}
\newcommand{\ketbra}[2]{\mbox{|#1$\rangle\langle #2|$}}
\newcommand{\op}[1]{\mbox{\boldmath $\hat{#1}$}}
\begin{document}
"""
# import helpful objects from the optics and quantumcircuits libraries
from pyscript.lib.optics import BS
from pyscript.lib.quantumcircuits import detector, classicalpath
# distance between the two "rails" of the quantum circuit
h = 1.7
# define the phase plate
pp2 = P(2,0)
phase = Rectangle(width=.1, height=.4, c=pp2, bg=Color(.8) )
# define the beam splitter
pp = P(1.5,0)
bs = Rectangle(width=.1, height=1, c=pp, bg=Color(1) ).rotate(-45, pp)
# define detectors
d1 = detector()(c=P(1.5+h/2.,0))
d2 = detector()(c=P(1.5,-h/2.)).rotate(90, P(1.5,-h/2.))
# render the diagram
render(
# the rails of the quantum circuit
Path(P(1.5,h/2.), P(1.5,-h/2.)),
Path(P(3.5,h), P(0,h), P(-.5,h/2.), P(0,0), P(1.5+h/2.,0)),
# the state at one output port
TeX(r'$\ket{p}$', s=P(1.5,h/2.)),
# beam splitter and label
bs,
TeX(r'$\omega$', se=bs.n),
# labels of paths through system
TeX('$a$', sw=P(.1,h+.1)),
TeX('$b$', sw=P(.1,0.1)),
TeX('$c$', w=P(1.6,h/2.4)),
# phase plate and label
phase,
TeX(r'$\lambda$', s=phase.n+P(0,.1)),
# detectors and label
d1,
d2,
TeX('$y$', w=d1.e),
TeX('$x$', n=d2.e),
# box highlighting part of the circuit
Rectangle(width=h+.6, height=h+1, dash=Dash(2), e=d1.e+P(.4,0)),
# the input state
Dot(P(-.5,h/2.), r=.05),
TeX(r'$\ket{\psi}$', e=P(-.5,h/2.)),
# the output file name
file="detector.eps",
)
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/distribute.py 0000644 0001750 0000144 00000001726 10374363650 020224 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: distribute.py,v 1.4 2006/02/14 14:23:09 paultcochrane Exp $
"""
An example showing usage of the Distribute class and functionality.
"""
# load pyscript libraries
from pyscript import *
# define the default units for the diagram
defaults.units = UNITS['cm']
# end points of line about which to distribute objects
p1 = P(-3,0)
p2 = P(3,0)
# objects to distribute
o1 = Rectangle(width=.5, height=1)
o2 = Circle(r=.5)
o3 = Rectangle(width=.5, height=.5)
o4 = Rectangle(width=2, height=.5)
# render the diagram
render(
# distribute the objects
Distribute(o1, o2, o3, o4,
p1=p1, p2=p2,
a1='c', a2='c', as='w', ae='e'),
# highlight the line about which everything is distributed with a line
Path(p1, p2, fg=Color('red')),
# dots showing centres of all objects distributed
Dot(o1.c), Dot(o2.c), Dot(o3.c), Dot(o4.c),
# output file name
file="distribute.eps"
)
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/div_con.py 0000755 0001750 0000144 00000004455 10374363662 017477 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: div_con.py,v 1.3 2006/02/14 14:23:09 paultcochrane Exp $
"""
Example usage of the qi (quantum information) library. Output is of a
divide-and-conquer scheme of quantum gates.
"""
# import relevant pyscript libraries
from pyscript import *
from pyscript.lib.qi import *
# assemble one set of quantum gates and wires together
g1 = Assemble(
Gate(Boxed(TeX(r'$\mathcal{E}_1$'), height=1.5)), 1.5,
Gate(Boxed(TeX(r'$\mathcal{E}_2$'), height=1.5)), 2.5,
Gate(Boxed(TeX(r'$\mathcal{E}_3$'), height=1.5)), 1.5,
wires=[QWire, QWire, QWire],
)
# assemble another set of quantum gates
g21 = Assemble(Gate(Boxed(TeX(r'$\mathcal{E}_1$'), height=1.5)), 1.5,
wires=[QWire, QWire, QWire],
)
g22 = Assemble(Gate(Boxed(TeX(r'$\mathcal{E}_2$'), height=1.5)), 2.5,
wires=[QWire, QWire, QWire],
)
g23 = Assemble(Gate(Boxed(TeX(r'$\mathcal{E}_3$'), height=1.5)), 1.5,
wires=[QWire, QWire, QWire],
)
# and assemble a third set of quantum gates together
g31 = Assemble(Gate(Boxed(TeX(r'$\mathcal{E}_1$'), height=1.5)), 1.5,
wires=[QWire, QWire],
)
g32 = Assemble(Gate(Boxed(TeX(r'$\mathcal{E}_2$'), height=1.5)), 1.5,
wires=[QWire, QWire],
)
g33 = Assemble(Gate(Boxed(TeX(r'$\mathcal{E}_3$'), height=1.5)), 1.5,
wires=[QWire, QWire],
)
# define some TeX objects for later reuse
m1 = TeX(r'\Large $\le$')
m2 = TeX(r'\Large $+$')
m3 = TeX(r'\Large $+$')
m4 = TeX(r'\Large $=$')
m5 = TeX(r'\Large $+$')
m6 = TeX(r'\Large $+$')
# align all the gate and TeX objects
Align(g1, m1, m2, m3, m4, m5, m6, g31, g32, g33,
a1="e", a2="w", angle=90)
# distribute the objects equally along a line
divnconk = Distribute(
g1,
m1,
g21, m2, g22,
m3, g23,
m4,
g31, m5, g32, m6, g33,
a1="e", a2="w", p1=P(0,0), p2=P(15,0),
)
# define some labels
t1 = TeX(r'\Large (by chaining)', n=P(g22.s.x, divnconk.s.y-.2))
t2 = TeX(r'\Large (by stability)', n=P(g32.s.x, divnconk.s.y-.2))
# append the labels to the object for the diagram
divnconk.append(t1,t2).scale(.7)
# render the diagram
render(
# object to render
divnconk,
# output file name
file="div_con.eps"
)
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/fabry-perot_pdh.py 0000755 0001750 0000144 00000002114 10401335014 021106 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: fabry-perot_pdh.py,v 1.1 2006/03/01 15:13:16 paultcochrane Exp $
# a Fabry-Perot cavity in a Pound-Drever-Hall setup
# import the pyscript objects
from pyscript import *
# import the optics library
from pyscript.lib.optics import *
# set up some handy defaults
defaults.units=UNITS['cm']
# initialise a laser beam
beam = Group()
# the laser
laser = Laser(c=P(0,0))
# the EOM
eom = Modulator()
eom.w = laser.e + P(1,0)
beam.append(Path(laser.e, eom.w))
# the "west" mirror
mirror_w = Mirror()
mirror_w.w = eom.e + P(1,0)
beam.append(Path(eom.e, mirror_w.w))
# some free space
fs = FreeSpace()
fs.w = mirror_w.e + P(1,0)
beam.append(Path(mirror_w.e, fs.w))
# the "east" mirror
mirror_e = Mirror()
mirror_e.w = fs.e + P(1,0)
beam.append(Path(fs.e, mirror_e.w))
# set the colour of the beam
beam.apply(fg=Color("red"))
# collect all the objects together
fig = Group(
beam,
laser,
eom,
mirror_e, mirror_w,
fs,
)
# render the figure
render(fig,
file="fabry-perot_pdh.eps")
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/flower_algorithm.py 0000644 0001750 0000144 00000006370 10374363702 021410 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: flower_algorithm.py,v 1.5 2006/02/14 14:23:09 paultcochrane Exp $
"""
Quite a complex example of using the quantumcircuits library. This shows
the quantum circuit of the flower algorithm.
"""
# import the relevant pyscript libraries
from pyscript import *
import pyscript.lib.quantumcircuits as qc
# define the default units for the diagram
defaults.units=UNITS['cm']
# define some handy LaTeX macros
defaults.tex_head=r"""
\documentclass{article}
\pagestyle{empty}
\newcommand{\ket}[1]{\mbox{$|#1\rangle$}}
\newcommand{\bra}[1]{\mbox{$\langle #1|$}}
\newcommand{\braket}[2]{\mbox{$\langle #1|#2\rangle$}}
\newcommand{\op}[1]{\mbox{\boldmath $\hat{#1}$}}
\begin{document}
"""
# the main paths through the diagram
p1 = Path(P(-.8,0), P(11,0), linewidth=2)
p2 = Path(P(0,2), P(6.7,2))
p3 = Path(P(0,4), P(6.7,4))
p4 = Path(P(0,5), P(6.7,5))
# define the quantum fourier transform box
r = Rectangle(c=P(6,3.5), width=.8, height=4.2, bg=Color(1))
t = TeX(r'QFT$^\dagger$')
t.rotate(-90)
t.c = r.c
qft = Group(r, t)
# define a vacuum state
ket0 = TeX(r'\ket{0}')
# define a detector
det = qc.detector()
# define the horizontal and vertical dots TeX objects
dots = TeX(r'$\cdots$')
vdots = TeX(r'$\vdots$')
# define a Hadamard gate
H = qc.Boxed(TeX(r'H'))
# ancilla qubits label
anc = TeX('$q$ ancilla qubits')
anc.rotate(-90)
# render the diagram
render(
# the paths through the circuit
p1, p2, p3, p4,
# place the dots in the diagram
Rectangle(s=P(2.7,-.2), height=5.4, width=.5, bg=Color(1), fg=Color(1)),
dots.copy(c=P(2.7,0)),
dots.copy(c=P(2.7,2)),
dots.copy(c=P(2.7,4)),
dots.copy(c=P(2.7,5)),
vdots.copy(c=P(-.2,3)),
vdots.copy(c=P(1,3)),
vdots.copy(c=P(6.8,3)),
# place the Hadamard gates
H.copy(c=P(1,2)),
H.copy(c=P(1,4)),
H.copy(c=P(1,5)),
# describe the classical path
qc.classicalpath(Path(P(6.7,2), P(7.5,2), P(7.5,5), P(6.7,5)),
Path(P(6.7,4), P(7.5,4)),
Path(P(7.5,3), P(9,3), P(9,0)),
),
# place boxes for the various unitary operations
qc.cbox(TeX(r'$\;U^{2^0}\;$'), 1.8, 0, 2),
qc.cbox(TeX(r'$U^{2^{q-2}}$'), 3.8, 0, 4),
qc.cbox(TeX(r'$U^{2^{q-1}}$'), 5, 0, 5),
# place the detectors
det.copy(c=p2.end),
det.copy(c=p3.end),
det.copy(c=p4.end),
# place the displacement of the state \rho and a label
qc.Boxed(TeX(r'$\mathcal{D}$'), c=P(9,0)),
TeX(r'\renewcommand{\arraycolsep}{1mm}$\left\{\begin{array}{ccc}0&\mathrm{w.p.}&1-p(E_j)\\1&\mathrm{w.p.}&p(E_j)\end{array}\right.$',
w=P(9.1,3)),
qc.Boxed(TeX(r'$\phi_j$'), c=P(7.5,3)),
qc.Dot(P(9,3)),
# place the vacuum states
ket0.copy(e=p2.start),
ket0.copy(e=p3.start),
ket0.copy(e=p4.start),
# place some labels
TeX(r'$\rho$', e=p1.start-P(.1,0)),
TeX(r'$\mathcal{E}(\rho)$', w=p1.end+P(.1,0)),
TeX(r'\ket{E_j}', s=P(7.5,0.1)),
# place the ancilla qubits label
anc(c=P(-1,3.5)),
# place the quantum fourier transform
qft,
# output file name
file="flower_algorithm.eps")
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/mach-zehnder.py 0000755 0001750 0000144 00000002627 10402060065 020401 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: mach-zehnder.py,v 1.1 2006/03/03 15:26:45 paultcochrane Exp $
# Mach-Zehnder interferometer
# import the pyscript objects
from pyscript import *
# import the optics library
from pyscript.lib.optics import *
# set up some handy defaults
defaults.units=UNITS['cm']
# initialise a laser beam
beam = Group()
# the laser
laser = Laser(c=P(0,0))
# the "west" beam splitter
bs_w = BSBox(height=0.7)
bs_w.w = laser.e + P(1,0)
beam.append(Path(laser.e, bs_w.w))
# the "north" mirror
mirror_n = Mirror(angle=45)
mirror_n.s = bs_w.n + P(0,3)
beam.append(Path(bs_w.n, mirror_n.c))
# the "east" mirror
mirror_e = Mirror(angle=45)
mirror_e.w = bs_w.e + P(3,0)
beam.append(Path(bs_w.e, mirror_e.c))
# the "east" beam splitter
bs_e = BSBox(height=0.7)
bs_e.c = P(mirror_e.c.x, mirror_n.c.y)
beam.append(Path(mirror_e.c, bs_e.s))
beam.append(Path(mirror_n.c, bs_e.w))
# the "north" detector
det_n = Detector(angle=-90)
det_n.s = bs_e.n + P(0,1)
beam.append(Path(bs_e.n, det_n.s))
# the "east" detector
det_e = Detector()
det_e.w = bs_e.e + P(1,0)
beam.append(Path(bs_e.e, det_e.w))
# set the colour of the beam
beam.apply(fg=Color("red"))
# collect all the objects together
fig = Group(
laser,
bs_w,
mirror_n, mirror_e,
bs_e,
det_n, det_e,
beam,
)
# render the figure
render(fig,
file="mach-zehnder.eps")
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/michelson-morely.py 0000755 0001750 0000144 00000002103 10401331362 021307 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: michelson-morely.py,v 1.3 2006/03/01 14:42:58 paultcochrane Exp $
# Michelson-Morely interferometer
# import the pyscript objects
from pyscript import *
# import the optics library
from pyscript.lib.optics import *
# set up some handy defaults
defaults.units=UNITS['cm']
# initialise a laser beam
beam = Group()
# the laser
laser = Laser(c=P(0,0))
# the beam splitter
bs = BSBox(height=0.7)
bs.w = laser.e + P(1,0)
beam.append(Path(laser.e, bs.w))
# the "north" mirror
mirror_n = Mirror(angle=90)
mirror_n.s = bs.n + P(0,3)
beam.append(Path(bs.n, mirror_n.s))
# the "east" mirror
mirror_e = Mirror()
mirror_e.w = bs.e + P(3,0)
beam.append(Path(bs.e, mirror_e.w))
# the detector
det = Detector(angle=90)
det.n = bs.s + P(0,-1)
beam.append(Path(bs.s, det.n))
# make the beam red
beam.apply(fg=Color("red"))
# collect all the objects together
fig = Group(
laser,
bs,
mirror_n, mirror_e,
det,
beam,
)
# render the figure
render(fig,
file="michelson-morely.eps")
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/qcirc.py 0000755 0001750 0000144 00000003057 10374363723 017152 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: qcirc.py,v 1.3 2006/02/14 14:23:09 paultcochrane Exp $
"""
A quantum circuit example usingt the qi (quantum information) library.
"""
from pyscript import *
from pyscript.lib.qi import *
defaults.tex_head=r"""
\documentclass{article}
\pagestyle{empty}
\newcommand{\ket}[1]{\mbox{$|#1\rangle$}}
\newcommand{\bra}[1]{\mbox{$\langle #1|$}}
\newcommand{\braket}[2]{\mbox{$\langle #1|#2\rangle$}}
\newcommand{\op}[1]{\mbox{\boldmath $\hat{#1}$}}
\newcommand{\Ket}[2]{|#1\rangle^{ (#2)}}
% Paragraph formatting
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[dvips,nodvipsnames]{color}
\begin{document}
"""
def RX(theta,**dict):
return Circled(TeX(r"$X_{%s}$"%theta,**dict),r=.5)
def RY(theta,**dict):
return Circled(TeX(r"$Y_{%s}$"%theta,**dict),r=.5)
def RZ(theta,**dict):
return Circled(TeX(r"$Z_{%s}$"%theta,**dict),r=.5)
render(
Path(P(-1,0),P(5,0)),
Path(P(-1,2),P(10,2)),
classicalpath(Path(P(5,0),P(5.8,0),P(5.8,2)),Path(P(5.8,0),P(7,0),P(7,2))),
Boxed(TeX(r'$\mathcal{E}(\rho)$',c=P(0,2))),
RX(r'\frac{\pi}{2}',c=P(2,2)),
RX(r'-\frac{\pi}{2}',c=P(8.5,2)),
RY(r'\chi',c=P(4,0)),
RY(r'\eta',c=P(7,2)),
TeX(r'$\ket{\psi_s}$',e=P(-1-.1,2)),
TeX(r'$\ket{\psi_m}$',e=P(-1-.1,0)),
TeX(r'$\rho_s$',w=P(10+.1,2)),
NOT(target=P(3,0),control=P(3,2)),
Detector(c=P(5,0),height=.7),
Z(c=P(5.8,2)),
Rectangle(w=P(1,1),height=3.5,width=8.5,dash=Dash(2,1)),
file="qcirc.eps",
)
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/sagnac.py 0000755 0001750 0000144 00000002374 10403335107 017272 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: sagnac.py,v 1.3 2006/03/07 16:52:23 paultcochrane Exp $
# Sagnac interferometer
# import the pyscript objects
from pyscript import *
# import the optics library
from pyscript.lib.optics import *
# set up some handy defaults
defaults.units=UNITS['cm']
# initialise a laser beam
beam = Group()
# the laser
laser = Laser(c=P(0,0))
# the beam splitter
bs = BSBox(height=0.7)
bs.w = laser.e + P(1,0)
beam.append(Path(laser.e, bs.w))
# the "north" mirror
mirror_n = Mirror(angle=45)
mirror_n.s = bs.n + P(0,2)
beam.append(Path(bs.n, mirror_n.c))
# the "east" mirror
mirror_e = Mirror(angle=45)
mirror_e.w = bs.e + P(3,0)
beam.append(Path(bs.e, mirror_e.c))
# the "north-east" mirror
mirror_ne = Mirror(angle=135)
mirror_ne.c = P(mirror_e.c.x, mirror_n.c.y)
beam.append(Path(mirror_n.c, mirror_ne.c))
beam.append(Path(mirror_e.c, mirror_ne.c))
# the detector
det = Detector(angle=90)
det.n = bs.s + P(0,-1)
beam.append(Path(bs.s, det.n))
# set the colour of the beam
beam.apply(fg=Color("red"))
# collect all the objects together
fig = Group(
beam,
laser,
bs,
mirror_n, mirror_e, mirror_ne,
det,
)
# render the figure
render(fig,
file="sagnac.eps")
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/sphere.py 0000644 0001750 0000144 00000005323 10374363715 017333 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: sphere.py,v 1.5 2006/02/14 14:23:09 paultcochrane Exp $
"""
A Poincare sphere. The example shows a sphere with axes labeled and a
vector pointing to a point on the surface of the sphere.
"""
# import the pyscript libraries
from pyscript import *
# define the default units for the diagram
defaults.units=UNITS['cm']
# define some handy LaTeX macros
defaults.tex_head=r"""
\documentclass{article}
\pagestyle{empty}
\newcommand{\ket}[2]{\mbox{$|#1\rangle_{#2}$}}
\newcommand{\bra}[1]{\mbox{$\langle #1|$}}
\newcommand{\braket}[2]{\mbox{$\langle #1|#2\rangle$}}
\newcommand{\op}[1]{\mbox{\boldmath $\hat{#1}$}}
\begin{document}
"""
# define an arrow head function
def ArrowHead(tip=P(0,0), width=0.2, height=0.2,
fg=Color("black"), bg=Color("black"), angle=0, dent=0.2):
"""
ArrowHead object
"""
tmptip = P(0,0)
ah = Path(tmptip, tmptip + P(width/2.0,-height),
tmptip + P(0,-height*(1-dent)),
tmptip + P(-width/2.0,-height), tmptip,
fg=fg, bg=bg)
ah.rotate(angle)
ah.move(tip-tmptip)
return ah
# define the circle in the x-z plane
circ1 = Circle(c=P(0,0))
# define the circle in the x-y plane
circ2front = Circle(c=P(0,0), start=90, end=270)
circ2back = Circle(c=P(0,0), start=270, end=90, dash=Dash(3))
circ2 = Group(circ2front, circ2back)
circ2.scale(1, 0.3)
# define the circle in the y-z plane
circ3front = Circle(c=P(0,0), start=90, end=270)
circ3back = Circle(c=P(0,0), start=270, end=90, dash=Dash(3))
circ3 = Group(circ3front, circ3back)
x2 = 0.78
circ3.scale(x2, 0.3*x2)
circ3.c = P(0,-0.6)
# define the axes
zaxis = Path(P(0,-1.2), P(0,1.2))
xaxis = Path(P(-1.2,0), P(1.2,0))
yaxis = Path(P(-0.7,0), P(0.7,0))
yaxis.rotate(p=yaxis.P(.5), angle=-30)
# define the arrows for each axis
xArrow = ArrowHead(tip=xaxis.end, width=0.07, height=0.07, angle=90)
yArrow = ArrowHead(tip=yaxis.end, angle=90-30, width=0.07, height=0.07)
zArrow = ArrowHead(tip=zaxis.end, width=0.07, height=0.07)
# define the labels
xLabel = TeX("$\mathbf{J}_x$").scale(.5)(sw=xaxis.end)
yLabel = TeX("$\mathbf{J}_y$").scale(.5)(se=yaxis.end+P(0,.05))
zLabel = TeX("$\mathbf{J}_z$").scale(.5)(sw=zaxis.end)
# define the vector R
rad = Path(P(0,-0.59), P(0.5,-0.59))
rad.rotate(p=rad.bbox().w, angle=20)
radArrow = ArrowHead(tip=rad.end, width=0.06, height=0.06, angle=90+20)
radThing = Group(rad, radArrow)
radLabel = TeX("$\mathcal{R}$").scale(0.5,0.5)(sw=rad.P(.5))
# define the figure describing the diagram
fig = Group(circ1, circ2, circ3,
zaxis, xaxis, yaxis,
xArrow, yArrow, zArrow,
xLabel, yLabel, zLabel,
radThing, radLabel)
# render the diagram
render(fig, file="sphere.eps")
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/stateSwap.py 0000644 0001750 0000144 00000002144 10374363715 020016 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: stateSwap.py,v 1.5 2006/02/14 14:23:09 paultcochrane Exp $
"""
State swapping quantum computing circuit diagram. Uses the
quantumcircuits library.
"""
# import the pyscript libraries
from pyscript import *
from pyscript.lib.quantumcircuits import *
# define some handy LaTeX macros
defaults.tex_head=r"""
\documentclass{article}
\pagestyle{empty}
\newcommand{\ket}[2]{\mbox{$|#1\rangle_{#2}$}}
\newcommand{\bra}[1]{\mbox{$\langle #1|$}}
\newcommand{\braket}[2]{\mbox{$\langle #1|#2\rangle$}}
\newcommand{\op}[1]{\mbox{\boldmath $\hat{#1}$}}
\begin{document}
"""
# define the rails
rail1 = Rail(w=P(0,0), length=3.0,
labelIn=r'\ket{\psi}{}', labelOut=r'\ket{\phi}{}')
rail2 = Rail(w=P(0,1), length=3.0,
labelIn=r'\ket{\phi}{}', labelOut=r'\ket{\psi}{}')
# three controlled nots
cnot1 = Cnot(c=P(0.5,0), targetDist=1.0, direction="up")
cnot2 = Cnot(c=P(1.5,1), targetDist=1.0, direction="down")
cnot3 = Cnot(c=P(2.5,0), targetDist=1.0, direction="up")
# draw it!
render(rail1, rail2, cnot1, cnot2, cnot3,
file="stateSwap.eps")
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/teleport.py 0000755 0001750 0000144 00000001660 10374363715 017706 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: teleport.py,v 1.3 2006/02/14 14:23:09 paultcochrane Exp $
"""
Create a quantum circuit of a quantum teleporter using the qi library
"""
# import the pyscript libraries
from pyscript import *
from pyscript.lib.qi import *
# Assemble the quantum circuit
g = Assemble(
SWAP, 1, 2,
NOT, 2, 1,
H, 1,
X, 3, 2,
Z, 3, 1,
hang=.5,
wires=[QWire, QWire, QWire],
)
# define the object for the wires
w = g.wires
# render the diagram
render(
# the main circuit
g,
# some labels
TeX(r'$|\psi\rangle$', e=w[0].w),
TeX(r'$|\psi\rangle$', w=w[2].e),
TeX(r'$|\beta_{00}\rangle\left\{\rule{0cm}{7mm}\right.$',
e=(w[2].w+w[1].w)/2.),
# the meters
Meter(w=w[0].e),
Meter(w=w[1].e),
# the output file
file="teleport.eps"
)
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/tex.py 0000644 0001750 0000144 00000001717 10374363715 016650 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: tex.py,v 1.4 2006/02/14 14:23:09 paultcochrane Exp $
"""
Example showing off the TeX object. This shows a series of TeX objects of a
mathematical description of a wavefunction (but you don't need to know that)
placed at various angles in a circle, with a blue background.
"""
# import the pyscript libraries
from pyscript import *
# define the default units for the diagram
defaults.units=UNITS['cm']
# define a TeX object
tex = TeX(r'$|\psi_t\rangle=e^{-iHt/\hbar}|\psi_0\rangle$',
w=P(.5,0), fg=Color(1))
# define the group of objects to render
g = Group()
for ii in range(0, 360, 60):
g.append(tex.copy().rotate(ii, P(0,0)))
# render the diagram
render(
# one circle
Circle(r=.6+tex.width, bg=Color('midnightblue')),
# the TeX object
g,
# another circle
Circle(r=.4, bg=Color(1)),
# the output file name
file="tex.eps")
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/tutorial.py 0000644 0001750 0000144 00000004750 10374363715 017713 0 ustar cochrane users #!/usr/bin/env pyscript
# $Id: tutorial.py,v 1.5 2006/02/14 14:23:09 paultcochrane Exp $
"""
A tutorial script showing how to create a quantum circuit.
"""
# import the relevant pyscript libraries
from pyscript import *
from pyscript.lib.quantumcircuits import *
# set the default units for the diagam
defaults.units=UNITS['cm']
# set up some handy LaTeX macros
defaults.tex_head=r"""
\documentclass{article}
\pagestyle{empty}
\usepackage{amsmath}
\newcommand{\ket}[1]{\mbox{$|#1\rangle$}}
\newcommand{\bra}[1]{\mbox{$\langle #1|$}}
\newcommand{\braket}[2]{\mbox{$\langle #1|#2\rangle$}}
\newcommand{\ketbra}[2]{\mbox{|#1$\rangle\langle #2|$}}
\newcommand{\op}[1]{\mbox{\boldmath $\hat{#1}$}}
\newcommand{\R}[3]{%
\renewcommand{\arraystretch}{.5}
$\begin{array}{@{}c@{}}{#1}\\{#2}\end{array}{#3}$
\renewcommand{\arraystretch}{1}
}
\begin{document}
"""
# define some colours
blue = Color(.65, .65, 1)
green = Color(.65, 1, .65)
# define a Bell detector function
def BellDet(c=P(0,0)):
H = P(0,.8)
W = P(.5,0)
D = Group(Path(c+H,
C(c+H+W,c+H+W),
c+W,
C(c-H+W,c-H+W),
c-H, bg=blue,
))
return Group(
Path(c-H, c+H, linewidth=2),
D,
TeX(r'$\mathcal{B}$', c=D.c)
)
# a box showing what part of the circuit happens "offline"
offline = Rectangle(height=4, width=5.5, e=P(3.5,1.5),
dash='[3 ] 0', bg=Color(.85))
render(
# the offline background box and label
offline,
TeX('offline', nw=offline.nw+P(.1,-.1)),
# the quantum path in the offline part
Path(P(5,0), P(-.3,0), P(-.6,.5), P(-.3,1), P(2,1)),
Path(P(2,2), P(-.3,2), P(-.6,2.5), P(-.3,3), P(3.7,3)),
Path(P(-1,4), P(3.7,4)),
# two dots
Dot(P(-.6,.5)),
Dot(P(-.6,2.5)),
# the classical path
classicalpath(Path(P(2.1,1.5), P(4.5,1.5), P(4.5,0)),
Path(P(3,1.5), P(3,0)),
Path(P(3.8,3.5), P(4.5,3.5), P(4.5,1.5)),
),
# Bell detectors
BellDet(P(2,1.5)),
BellDet(P(3.7,3.5)),
# displacement operation
Boxed(TeX(r'$D\left(\frac{i\theta}{2\alpha^2}\right)$'),
c=P(1,2), bg=green),
# Pauli operators
Boxed(TeX('$X$'), c=P(3,0), bg=green),
Boxed(TeX('$Z$'), c=P(4.5,0), bg=green),
# input quantum states
TeX(r'$\ket{B_{00}}$', e=P(-.7,.5)),
TeX(r'$\ket{B_{00}}$', e=P(-.7,2.5)),
TeX(r'$\ket{Q}$', e=P(-1.1,4)),
# output file name
file="tutorial.eps",
)
# vim: expandtab shiftwidth=4:
pyscript-0.6.1/doc/examples/twoqubitQST.py 0000644 0001750 0000144 00000014460 10423142766 020311 0 ustar cochrane users from pyscript import *
defaults.units=UNITS['mm']
defaults.linewidth=1
black = Color("Black")
grey = Color("LightGray")
laserCol = Color("OrangeRed")
pumpCol = Color("RoyalBlue")
def ScaledText(text,**dict):
t=TeX(text).scale(2,2)
apply(t,(),dict)
return t
def arrowhead(n,wid,len,angle,col):
L = P(0,len)
W = P(wid,0)
arrow = Path(n,n-L+W,n-L-W,n,bg=col).rotate(angle,p=n)
return arrow
def loop(c,radius):
return Circle(r=radius,c=c)
def fibre(c):
loops = Group(
loop(c+P(0,1),10),
loop(c,10),
loop(c-P(0,1),10)
)
l = 10
x1 = P(0,l)
x2 = P(0,1.5*l)
x3 = P(-l/2,2*l)
x4 = P(-l,2.5*l)
return Group(
Path(loops.e,
loops.e+x1,
C(loops.e+x2, loops.e+x2),
loops.e+x3
#loops.e+x4
),
Path(loops.w,
loops.w-x1,
C(loops.w-x2, loops.w-x2),
loops.w-x3
#loops.w-x4
),
loops
).rotate(-45,p=c)
def fibrecoupler(c,angle):
boxW = 15
boxH = 12
nozzle = 3
box = Rectangle(c=c+P(boxW/6,0),width=boxW,height=boxH)
fibrepos = c
lenspos = box.e-P(box.width/3,0)
irispos = box.e-P(box.width/12,0)
irisInside = P(0,1)
irisOutside = P(0,5)
iris = Group(
Path(irispos+irisInside,
irispos+irisOutside
),
Path(irispos-irisInside,
irispos-irisOutside
)
)
lens = Circle(r=4)
lens.scale(0.3,1)
lens.c = lenspos
coupler = Group(
box,
Path(box.w,fibrepos),
Path(fibrepos,
fibrepos-P(0,nozzle/2),
fibrepos-P(nozzle,0),
fibrepos+P(0,nozzle/2),
fibrepos,
bg=black
),
lens,
iris
).rotate(angle,p=c)
return coupler
def fibrecollimator(c,angle):
rectW = c
collimator = Group(
Path(c,
c+P(0,1.5),
c+P(-3,0),
c+P(0,-1.5),
c,
bg=black
),
Rectangle(w=rectW,width=2,height=8,bg=black)
).rotate(angle,p=c)
return collimator
def hologram(c,angle):
platesize = P(0,6)
plate = Path(c-platesize,c+platesize,linewidth=3)
stageStart = 1.25*platesize
stageFinish = 2.25*platesize
arrowL = 2
arrowW = 1
offset = arrowL/4
hologram = Group(
plate,
Path(c+stageStart,c+stageFinish-P(0,offset)),
Circle(r=0.75,c=c+stageStart,bg=black),
arrowhead(c+stageFinish,arrowW,arrowL,0,black),
ScaledText(r"$x$",c=c+stageFinish-P(4,0)),
ScaledText(r"$y$",c=c+stageStart-P(4,0))
)
return hologram
def laser(e):
box = Rectangle(e=e,width=20,height=8,bg=grey)
lasername = ScaledText(r'Laser',c=box.c,fg=Color("DarkBlue"));
#I want to do a squiggle with an arrow (the light symbol)
return Group(
box,
lasername,
)
coupler1 = fibrecoupler(P(180,10),180)
coupler2 = fibrecoupler(P(180,10),180)
analyser1 = Group(
Path(P(110,10),P(150,10),linewidth=2,fg=laserCol),
arrowhead(P(140,10),1,3,90,laserCol),
Path(P(150,10),P(180,10),linewidth=2,fg=laserCol).rotate(-22.5,p=P(150,10)),
hologram(P(150,10),0),
coupler1.rotate(-22.5,p=P(150,10))
)
analyser2 = Group(
Path(P(110,10),P(150,10),linewidth=2,fg=laserCol),
arrowhead(P(140,10),1,3,90,laserCol),
Path(P(150,10),P(180,10),linewidth=2,fg=laserCol).rotate(22.5,p=P(150,10)),
hologram(P(150,10),0),
coupler2.rotate(22.5,p=P(150,10))
)
analyser1.rotate(40,p=P(110,10))
point1 = analyser1.itoe(analyser1[4].w)
analyser2.rotate(-40,p=P(110,10))
point2 = analyser2.itoe(analyser2[4].w)
fibre1 = fibre(P(220,10))
fibre1.scale(1,-1,p=fibre1.c)
#fibre1.move(point1+P(10,-5)-fibre1.itoe(fibre1[0].path[-1]))
fibre1.move(point1+P(10,-5)-fibre1.itoe(fibre1[0].P(1)))
fibre2 = fibre(P(220,10))
#fibre2.move(point2+P(10,5)-fibre2.itoe(fibre2[0].path[-1]))
fibre2.move(point2+P(10,5)-fibre2.itoe(fibre2[0].P(1)))
detector1 = Group(
Rectangle(c=P(240,10),width=10,height=10,bg=black),
Circle(r=5,c=P(245,10),bg=black),
)
#detector1.move(fibre1.itoe(fibre1[1].path[-1])-detector1[1].w)
detector1.move(fibre1.itoe(fibre1[1].P(1))-detector1[1].w)
detector2 = Group(
Rectangle(c=P(240,10),width=10,height=10,bg=black),
Circle(r=5,c=P(245,10),bg=black),
)
#detector2.move(fibre2.itoe(fibre2[1].path[-1])-detector2[1].w)
detector2.move(fibre2.itoe(fibre2[1].P(1))-detector2[1].w)
render(
laser(P(70,10)),
Path(P(70,10),P(110,10),linewidth=2,fg=pumpCol),
arrowhead(P(100,10),1,3,90,pumpCol),
Path(P(110,10),P(140,10),linewidth=2,fg=pumpCol),
arrowhead(P(130,10),1,3,90,pumpCol),
Rectangle(c=P(140,10),width=4,height=4,fg=None,bg=black),
analyser1,
analyser2,
# label analyser hologram
# label coupler2
Rectangle(c=P(110,10),height=12,width=3,bg=grey),
ScaledText(r'BBO',n=P(110,2)),
ScaledText(r'coupler 2',s=point2+P(-5,5)),
Path(
point1,
C(point1+P(5,-5), point1+P(5,-5)),
point1+P(10,-5),
),
Path(
point2,
C(point2+P(5,5), point2+P(5,5)),
point2+P(10,5),
),
ScaledText(r'holo 1',s=P(140,-28)),
ScaledText(r'holo 2',s=P(135,48)),
# label preparation hologram
# insert fibre between coupler and fibre loop
fibre1,
Rectangle(width=20,height=7,c=fibre1.c,bg=Color(1)),
ScaledText(r'SMF',c=fibre1.c),
fibre2,
Rectangle(width=20,height=7,c=fibre2.c,bg=Color(1)),
ScaledText(r'SMF',c=fibre2.c),
# insert fibre between coupler and detector
detector1,
ScaledText(r'detector 1',nw=detector1.itoe(detector1[1].s)+P(-3,-3)),
# label detector
detector2,
ScaledText(r'detector 2',sw=detector2.itoe(detector2[1].n)+P(-3,3)),
# label detector
Path(detector1.itoe(detector1[1].e),
detector1.itoe(detector1[1].e)+P(20,0)
),
Path(detector2.itoe(detector2[1].e),
detector2.itoe(detector2[1].e)+P(20,0)
),
arrowhead(detector1.itoe(detector1[1].e)+P(20,0),1,3,90,black),
arrowhead(detector2.itoe(detector2[1].e)+P(20,0),1,3,90,black),
ScaledText(r'''\begin{center}
Coincidence Counting\\Electronics\end{center}''',
w=P(240,10)),
file="twoqubitQST.eps"
)
pyscript-0.6.1/doc/manual/ 0000755 0001750 0000144 00000000000 10441274722 015121 5 ustar cochrane users pyscript-0.6.1/doc/manual/electronics/ 0000755 0001750 0000144 00000000000 10441274722 017433 5 ustar cochrane users pyscript-0.6.1/doc/manual/electronics/AndGate.pdf 0000644 0001750 0000144 00000001640 10402637414 021430 0 ustar cochrane users %PDF-1.3
%Çì¢
6 0 obj
<>
stream
xœµPKÂ@Ýs
N€Ì™^ÁΚؘt¯/53mդƅ!ÃLÈdg«±/0Ááìq¸ÁAý
FE‡–±´<$¡ÎâÞ2ÝŠ/ð®ªãOªüV) ¬
ßp´‰$ &6
9vä{¨Øxíå«Tסšõú°¿¯X®ØÞ¬ù¸.ÿ`2hŽÉÚ´ù¨Z˜•ûüS…¤Óéß
U¿Ãgx=µ@ŠL.5