Add default anatric path to pyzebra app cli

This commit is contained in:
usov_i 2021-05-11 16:27:24 +02:00
parent 90387174e5
commit 09d22e7674
3 changed files with 6 additions and 6 deletions

View File

@ -7,6 +7,7 @@ DATA_FACTORY_IMPLEMENTATION = [
"morph", "morph",
"d10", "d10",
] ]
REFLECTION_PRINTER_FORMATS = [ REFLECTION_PRINTER_FORMATS = [
"rafin", "rafin",
"rafinf", "rafinf",
@ -20,10 +21,11 @@ REFLECTION_PRINTER_FORMATS = [
"oksana", "oksana",
] ]
ANATRIC_PATH = "/afs/psi.ch/project/sinq/rhel7/bin/anatric"
ALGORITHMS = ["adaptivemaxcog", "adaptivedynamic"] ALGORITHMS = ["adaptivemaxcog", "adaptivedynamic"]
def anatric(config_file, anatric_path="/afs/psi.ch/project/sinq/rhel7/bin/anatric", cwd=None): def anatric(config_file, anatric_path=ANATRIC_PATH, cwd=None):
comp_proc = subprocess.run( comp_proc = subprocess.run(
[anatric_path, config_file], [anatric_path, config_file],
stdout=subprocess.PIPE, stdout=subprocess.PIPE,

View File

@ -6,6 +6,7 @@ from bokeh.application.application import Application
from bokeh.application.handlers import ScriptHandler from bokeh.application.handlers import ScriptHandler
from bokeh.server.server import Server from bokeh.server.server import Server
from pyzebra.anatric import ANATRIC_PATH
from pyzebra.app.handler import PyzebraHandler from pyzebra.app.handler import PyzebraHandler
logging.basicConfig(format="%(asctime)s %(message)s", level=logging.INFO) logging.basicConfig(format="%(asctime)s %(message)s", level=logging.INFO)
@ -38,7 +39,7 @@ def main():
) )
parser.add_argument( parser.add_argument(
"--anatric-path", type=str, default=None, help="path to anatric executable", "--anatric-path", type=str, default=ANATRIC_PATH, help="path to anatric executable",
) )
parser.add_argument( parser.add_argument(

View File

@ -347,10 +347,7 @@ def create():
with tempfile.TemporaryDirectory() as temp_dir: with tempfile.TemporaryDirectory() as temp_dir:
temp_file = temp_dir + "/config.xml" temp_file = temp_dir + "/config.xml"
config.save_as(temp_file) config.save_as(temp_file)
if doc.anatric_path: pyzebra.anatric(temp_file, anatric_path=doc.anatric_path, cwd=temp_dir)
pyzebra.anatric(temp_file, anatric_path=doc.anatric_path, cwd=temp_dir)
else:
pyzebra.anatric(temp_file, cwd=temp_dir)
with open(os.path.join(temp_dir, config.logfile)) as f_log: with open(os.path.join(temp_dir, config.logfile)) as f_log:
output_log.value = f_log.read() output_log.value = f_log.read()