python-damaris/scripts/DAMARIS
2014-06-26 11:10:51 +00:00

52 lines
1.5 KiB
Python
Executable File

#!/usr/bin/python
# setup script will insert local DAMARIS installation path behind import sys statement
# this must happen before any damaris stuff is called!
import sys
import os
# for numpy-1.1 and later: check the environment for LANG and LC_NUMERIC
# see: http://projects.scipy.org/scipy/numpy/ticket/902
if os.environ.get("LANG","").startswith("de") or os.environ.get("LC_NUMERIC", "").startswith("de"):
os.environ["LC_NUMERIC"]="C"
import damaris.gui.DamarisGUI
import matplotlib
import os.path
# argv is already parsed by gtk initialisation
myargs=sys.argv[1:]
myname=os.path.basename(sys.argv[0])
# find debug flag:
if "--debug" in myargs:
damaris.gui.DamarisGUI.debug = True
print "debug flag set"
try:
import resource
resource.setrlimit(resource.RLIMIT_CORE, (-1,-1))
except ImportError:
pass
matplotlib.rcParams["verbose.level"]="debug"
myargs.remove("--debug")
# remove matplotlib flags
if "-d"+matplotlib.rcParams["backend"] in myargs:
myargs.remove("-d"+matplotlib.rcParams["backend"])
# find scripts to load in parameter list
exp_script = None
res_script = None
if len(myargs)<=2:
if len(myargs)>=1:
exp_script=myargs[0]
if len(myargs)==2:
res_script=myargs[1]
else:
print """too many arguments.\n%s [--debug] [-dGTK(Agg|Cairo|)] (Experiment File|"") (Result File|"")"""%(myname)
d=damaris.gui.DamarisGUI.DamarisGUI(exp_script, res_script)
d.run()
sys.stdout=sys.__stdout__
sys.stderr=sys.__stderr__