Package pyfeyn
[hide private]
[frames] | no frames]

Source Code for Package pyfeyn

 1  """PyFeyn - a simple Python interface for making Feynman diagrams (pre-release version >= 0.2.0b1).""" 
 2   
 3  __author__ = "Andy Buckley (andy@insectnation.org)" 
 4  __version__ = "0.2.0b1" 
 5  __date__ = "$Date: 2006/08/05 00:14:20 $" 
 6  __copyright__ = "Copyright (c) 2007 Andy Buckley" 
 7  __license__ = "GPL" 
 8   
 9  import pyx 
10   
11  ## Version check 
12  import re 
13  majorversionstr = re.sub(r"(\d+\.\d+).*", r"\1", pyx.version.version) 
14  if float(majorversionstr) < 0.9: 
15      print "Warning: PyFeyn may not work with PyX versions older than 0.9!" 
16   
17   
18  ## Units 
19  pyx.unit.set(uscale = 4, vscale = 4, wscale = 4, xscale = 4) 
20  pyx.unit.set(defaultunit = "cm") 
21   
22   
23  ## TeX stuff 
24  pyx.text.defaulttexrunner.set(mode="latex") 
25  if pyx.pykpathsea.find_file("hepnicenames.sty", pyx.pykpathsea.kpse_tex_format): 
26     pyx.text.defaulttexrunner.preamble(r"\usepackage{hepnicenames}") 
27  else: 
28     print "Warning: hepnames LaTeX package not found!" 
29   
30   
31  ## Set __all__ (for "import * from pyfeyn") 
32  __all__ = ["diagrams", "points", "blobs", "lines", "deco", "utils"] 
33   
34   
35  ## Option parsing 
36  from optparse import OptionParser  
37  _parser = OptionParser() 
38  _parser.add_option("-V", "--visual-debug", dest="VDEBUG", action = "store_true", default = False, 
39                     help="produce visual debug output") 
40  _parser.add_option("-D", "--debug", dest="DEBUG", action = "store_true", default = False, 
41                     help="produce debug output") 
42  from diagrams import FeynDiagram 
43  (FeynDiagram.options, args) = _parser.parse_args() 
44