2014-06-26 11:10:51 +00:00
|
|
|
#!/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
|
2018-03-16 16:03:44 +00:00
|
|
|
import os, argparse
|
2014-06-26 11:10:51 +00:00
|
|
|
|
|
|
|
# for numpy-1.1 and later: check the environment for LANG and LC_NUMERIC
|
|
|
|
# see: http://projects.scipy.org/scipy/numpy/ticket/902
|
2018-03-16 16:03:44 +00:00
|
|
|
if os.environ.get("LANG", "").startswith("de") or os.environ.get("LC_NUMERIC", "").startswith("de"):
|
|
|
|
os.environ["LC_NUMERIC"] = "C"
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser(description='DArmstadt MAgnetic Resonance Instrumentation Software')
|
|
|
|
|
|
|
|
parser.add_argument("--run", action="store_true", help="run DAMARIS immediately with given scripts")
|
|
|
|
parser.add_argument("--debug", action="store_true", help="run DAMARIS with DEBUG flag set")
|
|
|
|
parser.add_argument("--mpl", help="run DAMARIS with matplotlib backend",
|
|
|
|
choices=["GTKAgg","GTKCairo","GTK"], default="GTKAgg")
|
|
|
|
|
|
|
|
parser.add_argument("exp_script", help="experiment script", nargs="?", metavar="EXP.py")
|
|
|
|
parser.add_argument("res_script", help="result script", nargs="?", metavar="RES.py")
|
|
|
|
|
|
|
|
args = parser.parse_args()
|
2014-06-26 11:10:51 +00:00
|
|
|
|
|
|
|
import matplotlib
|
|
|
|
|
2018-03-16 16:03:44 +00:00
|
|
|
if args.mpl:
|
|
|
|
matplotlib.use(args.mpl)
|
2014-06-26 11:10:51 +00:00
|
|
|
|
2018-03-16 16:03:44 +00:00
|
|
|
import damaris.gui.DamarisGUI
|
|
|
|
|
|
|
|
if args.debug:
|
2014-06-26 11:10:51 +00:00
|
|
|
damaris.gui.DamarisGUI.debug = True
|
|
|
|
print "debug flag set"
|
|
|
|
try:
|
|
|
|
import resource
|
2018-03-16 16:03:44 +00:00
|
|
|
resource.setrlimit(resource.RLIMIT_CORE, (-1, -1))
|
2014-06-26 11:10:51 +00:00
|
|
|
except ImportError:
|
|
|
|
pass
|
2018-03-16 16:03:44 +00:00
|
|
|
matplotlib.rcParams["verbose.level"] = "debug"
|
|
|
|
|
|
|
|
d = damaris.gui.DamarisGUI.DamarisGUI(args.exp_script, args.res_script, start_immediatly=args.run)
|
2014-06-26 11:10:51 +00:00
|
|
|
d.run()
|
2018-03-16 16:03:44 +00:00
|
|
|
|
|
|
|
sys.stdout = sys.__stdout__
|
|
|
|
sys.stderr = sys.__stderr__
|